void CtrlRegisterList::onPopupClick(wxCommandEvent& evt)
{
	switch (evt.GetId())
	{
	case ID_REGISTERLIST_DISPLAY32:
		resolvePointerStrings = false;
		maxBits = 32;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT,0);
		Refresh();
		break;
	case ID_REGISTERLIST_DISPLAY64:
		resolvePointerStrings = false;
		maxBits = 64;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT,0);
		Refresh();
		break;
	case ID_REGISTERLIST_DISPLAY128:
		resolvePointerStrings = false;
		maxBits = 128;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT,0);
		Refresh();
		break;
	case ID_REGISTERLIST_DISPLAY128STRINGS:
		resolvePointerStrings = true;
		maxBits = 128;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT, 0);
		Refresh();
		break;
	case ID_REGISTERLIST_CHANGELOWER:
		changeValue(LOWER64);
		Refresh();
		break;
	case ID_REGISTERLIST_CHANGEUPPER:
		changeValue(UPPER64);
		Refresh();
		break;
	case ID_REGISTERLIST_CHANGEVALUE:
		if (cpu->getRegisterSize(category) == 32)
			changeValue(CHANGE32);
		else
			changeValue(LOWER64);
		Refresh();
		break;
	case ID_REGISTERLIST_GOTOINMEMORYVIEW:
		postEvent(debEVT_GOTOINMEMORYVIEW, cpu->getRegister(category, currentRows[category])._u32[0]);
		break;
	case ID_REGISTERLIST_GOTOINDISASM:
		postEvent(debEVT_GOTOINDISASM, cpu->getRegister(category, currentRows[category])._u32[0]);
		break;
	default:
		wxMessageBox( L"Unimplemented.",  L"Unimplemented.", wxICON_INFORMATION);
		break;
	}
}
void WidgetMOItem::onCheckChanged(int state)
{
    QWidget *editor = qobject_cast<QWidget *>(sender());
    switch(state)
    {
    case Qt::Unchecked:
    case Qt::PartiallyChecked    :
        changeValue(editor,QVariant(false));
        break;
    case Qt::Checked :
        changeValue(editor,QVariant(true));
        break;
    }
}
void MenuSystem::setJoin()
{
	auto gameOptions = static_cast<SettingsSystem*>
		(m_world->getSystem(SystemType::SettingsSystem));

	GameSettingsInfo settings = gameOptions->getSettings();

	auto rocketBackend = static_cast<LibRocketBackendSystem*>(
		m_world->getSystem(SystemType::LibRocketBackendSystem));

	rocketBackend->changeValue(m_joinIdx, "1", settings.ip);
	rocketBackend->changeValue(m_joinIdx, "2", settings.port);
	rocketBackend->changeValue(m_joinIdx, "3", settings.playerName);
}
void MenuSystem::setHost()
{
	auto gameOptions = static_cast<SettingsSystem*>
		(m_world->getSystem(SystemType::SettingsSystem));

	GameSettingsInfo settings = gameOptions->getSettings();

	auto rocketBackend = static_cast<LibRocketBackendSystem*>(
		m_world->getSystem(SystemType::LibRocketBackendSystem));

	rocketBackend->changeValue(m_hostIdx, "4", settings.serverName);
	rocketBackend->changeValue(m_hostIdx, "5", settings.port);
	rocketBackend->changeValue(m_hostIdx, "6", settings.playerName);
	rocketBackend->changeValue(m_hostIdx, "7", toString(settings.defaultGameTime));
}
Exemple #5
0
void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
    if( isSliding )
    {
        QRect rect( paddingL - 15,    -1,
                    WLENGTH + 15 * 2 , WHEIGHT + 5 );
        if( !rect.contains( event->pos() ) )
        { /* We are outside */
            if ( !b_mouseOutside )
                setValue( i_oldvalue );
            b_mouseOutside = true;
        }
        else
        { /* We are inside */
            b_mouseOutside = false;
            changeValue( event->x() - paddingL );
            emit sliderMoved( value() );
        }
    }
    else
    {
        int i = ( ( event->x() - paddingL ) * maximum() + 40 ) / WLENGTH;
        i = __MIN( __MAX( 0, i ), maximum() );
        setToolTip( QString("%1  %" ).arg( i ) );
    }
}
Exemple #6
0
void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
    /* handle mouserelease hijacking */
    if ( isSliding && ( event->buttons() & ~Qt::RightButton ) == Qt::NoButton )
        processReleasedButton();

    if( isSliding )
    {
        QRect rect( paddingL - 15,    -1,
                    wlength + 15 * 2 , wheight + 5 );
        if( !rect.contains( event->pos() ) )
        { /* We are outside */
            if ( !b_mouseOutside )
                setValue( i_oldvalue );
            b_mouseOutside = true;
        }
        else
        { /* We are inside */
            b_mouseOutside = false;
            changeValue( event->x() - paddingL );
            emit sliderMoved( value() );
        }
    }
    else
    {
        int i = ( ( event->x() - paddingL ) * maximum() + 40 ) / wlength;
        i = __MIN( __MAX( 0, i ), maximum() );
        setToolTip( QString("%1  %" ).arg( i ) );
    }
}
void SlidersController::changeValue(int v) {
  if (valueSpinManualEdit) {
    QColor filter = QColor::fromHsv(0, 0, v);
    changeValue(filter);
  }
  valueSpinManualEdit = true;
}
Exemple #8
0
Slider::Slider(const QString &label, int defaultValue, int min, int max, Helper helper)
    : SourceParameters(label),
      m_frame( new QFrame() ),
      m_inputText(nullptr),
      m_label(nullptr),
      m_slider(new QSlider() )
{
    m_frame->setLayout( new QHBoxLayout() );

    m_slider->setOrientation(Qt::Horizontal);
    m_slider->setMinimum(min);
    m_slider->setMaximum(max);

    m_frame->layout()->addWidget(m_slider);
    if( helper == PrintValue )
    {
        m_label = new QLabel();
        m_frame->layout()->addWidget( m_label );
    }
    else if( helper == EnterValue)
    {
        m_inputText = new QLineEdit();
        m_frame->layout()->addWidget( m_inputText );
        connect(m_inputText, SIGNAL(editingFinished()), this, SLOT(changeValue()));
    }
    connect( m_slider, SIGNAL(valueChanged(int)), this, SLOT(changeValue(int)));
    m_slider->setValue(defaultValue);
}
Exemple #9
0
void SpinSlider::changeValue(int value)
{
    qreal value2 = 0.0;
    if (type=="linear") value2 = min + value*(max-min)/100;
    if (type=="log") value2 = min * std::exp( value*std::log(max/min) / 100 );
    changeValue(value2);
}
void FontPropertyToolEditor::changeFont()
{
    bool ok;
    QFont font = QFontDialog::getFont(&ok);
    if (ok) {
        changeValue(QVariant::fromValue(font));
    }
}
Exemple #11
0
void SpinSlider::setValue(qreal value)
{
    qreal value2 = 0.0;
    if (type=="linear") value2 = qRound( 100*(value-min)/(max-min) );
    if (type=="log") value2 = qRound( 100.0*std::log(value/0.2)/log(1000.0) );
    slider->setSliderPosition(value2);
    changeValue(value);
}
Exemple #12
0
void kommuHandler(void){
	int i;
	while(buildCommand(input_buf,command)){
		switch(command[0]){
		case 'a':
			if(kommuConnected){
				sendCommand("a",1);
				kommuNoPing = 0;
			}
			break;
		case 'b':
			sendCommand("c",1);
			kommuConnected = 1;
			kommuNoPing = 0;
			HAL_GPIO_WritePin(GPIOD,GPIO_PIN_12,GPIO_PIN_SET);
			break;
		case 's':
			stopRecording(command[1]);
			break;
		case 'r':
			if(kommuConnected){
				startRecording(command[1]);
			}
			break;
		case 'q':
			stopRecordingAll();
			break;
		case 'x':
			if(kommuConnected){
				changeValue(command+1);
			}
			break;
		}		
	}
	if(kommuConnected){
		for(i = 0; i < sendingCodesCurrent; i++){
			sendCode(sendingCodes[i],buffer);
		}
	}
	if(kommuNoPing > maxPingsMissed){ //Max ping loss?
		kommuConnected = 0;
		HAL_GPIO_WritePin(GPIOD,GPIO_PIN_12,GPIO_PIN_RESET);
	}else{
		kommuNoPing++;
	}

	if((output_currentPos>0) && !ptrUSART->GetStatus().tx_busy){
		ptrUSART->Send(output_currentBuffer,output_currentPos);
		if(output_currentBufferNr == 1){
			output_currentBuffer = output_buffer2;
			output_currentBufferNr = 2;
		}else{
			output_currentBuffer = output_buffer1;
			output_currentBufferNr = 1;
		}
		output_currentPos = 0;
	}
}
void FontPropertyToolEditor::changeFont()
{
    QFont font = value().value<QFont>();
    bool ok;
    font = QFontDialog::getFont(&ok, font);
    if (ok) {
        changeValue(QVariant::fromValue(font));
    }
}
Exemple #14
0
void CtrlRegisterList::onPopupClick(wxCommandEvent& evt)
{
    int cat = getCurrentCategory();
    wxGrid* regGrid = registerGrids[cat];
    int reg = regGrid->GetGridCursorRow();
    switch (evt.GetId())
    {
    case ID_REGISTERLIST_DISPLAY32:
        maxBits = 32;
        postEvent(debEVT_UPDATELAYOUT, 0);
        Refresh();
        break;
    case ID_REGISTERLIST_DISPLAY64:
        maxBits = 64;
        postEvent(debEVT_UPDATELAYOUT, 0);
        Refresh();
        break;
    case ID_REGISTERLIST_DISPLAY128:
        maxBits = 128;
        postEvent(debEVT_UPDATELAYOUT, 0);
        Refresh();
        break;
    case ID_REGISTERLIST_CHANGELOWER:
        changeValue(LOWER64, cat, reg);
        Refresh();
        break;
    case ID_REGISTERLIST_CHANGEUPPER:
        changeValue(UPPER64, cat, reg);
        Refresh();
        break;
    case ID_REGISTERLIST_CHANGEVALUE:
        if (cpu->getRegisterSize(cat) == 32)
            changeValue(CHANGE32, cat, reg);
        else
            changeValue(LOWER64, cat, reg);
        Refresh();
        break;
    default:
        wxMessageBox(L"Unimplemented.", L"Unimplemented.", wxICON_INFORMATION);
        break;
    }
    needsValueUpdating = true;
    needsSizeUpdating = true;
}
void CPBoolPlugin::configDialog()
{
    QDialog dialog;
    QGridLayout *layout = new QGridLayout;

    QLabel *topictxt = new QLabel(tr("Topic Name:"));
    QLineEdit *topicedit = new QLineEdit(topic);
    layout->addWidget(topictxt, 0, 0);
    layout->addWidget(topicedit, 0, 1);

    QLabel *slabeltxt = new QLabel(tr("Show Label:"));
    QCheckBox *slabelcheck = new QCheckBox();
    slabelcheck->setChecked(ui->label->isVisible());
    layout->addWidget(slabeltxt, 1, 0);
    layout->addWidget(slabelcheck, 1, 1);

    QLabel *labeltxt = new QLabel(tr("Label:"));
    QLineEdit *labeledit = new QLineEdit(ui->label->text());
    connect(slabelcheck, SIGNAL(toggled(bool)), labeledit, SLOT(setEnabled(bool)));
    labeledit->setEnabled(ui->label->isVisible());
    layout->addWidget(labeltxt, 2, 0);
    layout->addWidget(labeledit, 2, 1);

    QPushButton *okbutton = new QPushButton(tr("&OK"));
    layout->addWidget(okbutton, 3, 1);

    dialog.setLayout(layout);

    dialog.setWindowTitle("Plugin Configuration - Bool");

    connect(okbutton, SIGNAL(clicked()), &dialog, SLOT(accept()));

    if(!dialog.exec())
        return;

    if(topic != topicedit->text())
    {
        emit changeValue("N/A");
        topic = topicedit->text();
        settings->setValue(uuid.toString() + "/Topic", topic);
        activateNodelet(true);
    }

    if(ui->label->isVisible() != slabelcheck->isChecked())
    {
        ui->label->setVisible(slabelcheck->isChecked());
        ui->value->setAlignment((slabelcheck->isChecked() ? Qt::AlignLeft : Qt::AlignHCenter) | Qt::AlignVCenter);
        settings->setValue(uuid.toString() + "/ShowLabel", slabelcheck->isChecked());
    }

    if(ui->label->text() != labeledit->text())
    {
        emit changeLabel(labeledit->text());
        settings->setValue(uuid.toString() + "/Label", labeledit->text());
    }
}
Exemple #16
0
void StDictionary::set(const StDictEntry& thePair) {
    for(size_t anId = 0; anId < size(); ++anId) {
        StDictEntry& anArg = changeValue(anId);
        if(anArg.getKey().isEqualsIgnoreCase(thePair.getKey())) {
            anArg.setValue(thePair.getValue());
            return;
        }
    }
    add(thePair);
}
Exemple #17
0
void TagTree::changeValue(const char* format, ...)
{
	char buffer[XMPQE_BUFFERSIZE];
	va_list args;
	va_start(args, format);
		vsprintf(buffer, format, args);
	va_end(args);

	changeValue( std::string(buffer) );
}
Exemple #18
0
StDictEntry& StDictionary::addChange(const StString& theKey) {
    for(size_t anId = 0; anId < size(); ++anId) {
        StDictEntry& anArg = changeValue(anId);
        if(anArg.getKey().isEqualsIgnoreCase(theKey)) {
            return anArg;
        }
    }
    add(StDictEntry(theKey));
    return changeLast();
}
Exemple #19
0
void CtrlRegisterList::onPopupClick(wxCommandEvent& evt)
{
	switch (evt.GetId())
	{
	case ID_REGISTERLIST_DISPLAY32:
		maxBits = 32;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT,0);
		Refresh();
		break;
	case ID_REGISTERLIST_DISPLAY64:
		maxBits = 64;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT,0);
		Refresh();
		break;
	case ID_REGISTERLIST_DISPLAY128:
		maxBits = 128;
		SetInitialSize(ClientToWindowSize(GetMinClientSize()));
		postEvent(debEVT_UPDATELAYOUT,0);
		Refresh();
		break;
	case ID_REGISTERLIST_CHANGELOWER:
		changeValue(LOWER64);
		Refresh();
		break;
	case ID_REGISTERLIST_CHANGEUPPER:
		changeValue(UPPER64);
		Refresh();
		break;
	case ID_REGISTERLIST_CHANGEVALUE:
		if (cpu->getRegisterSize(category) == 32)
			changeValue(CHANGE32);
		else
			changeValue(LOWER64);
		Refresh();
		break;
	default:
		wxMessageBox( L"Unimplemented.",  L"Unimplemented.", wxICON_INFORMATION);
		break;
	}
}
Exemple #20
0
unsigned char changeEnum(const char **list, unsigned char currvalue, unsigned char maxvalue, DELTA *delta)
{
	unsigned char output = changeValue(currvalue, maxvalue,delta);

	put(VFD_CR);
	print("                   ");
	put(VFD_CR);
	print(list[output]);

	return output;
}
Exemple #21
0
// One day, this'll show a bar. Ran out of time back then
unsigned char changeNumber(unsigned char currvalue, unsigned char maxvalue, DELTA *delta)
{
	unsigned char output = changeValue(currvalue, maxvalue,delta);

	put(VFD_CR);
	printnum(output);
	print("/");
	printnum(maxvalue);
	print("  ");

	return output;
}
Exemple #22
0
void SoundSlider::mousePressEvent( QMouseEvent *event )
{
    if( event->button() != Qt::RightButton )
    {
        /* We enter the sliding mode */
        isSliding = true;
        i_oldvalue = value();
        emit sliderPressed();
        changeValue( event->x() - paddingL );
        emit sliderMoved( value() );
    }
}
Exemple #23
0
MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent)
{
	this->resize(800, 600);

    table_view = new TableView();

	count_label = new QLabel();

    add_button = new QPushButton();
    add_button->setText("add");
	connect(add_button, SIGNAL(clicked()), this, SLOT(add()));

	update_button = new QPushButton();
	update_button->setText("update");

	delete_button = new QPushButton();
	delete_button->setText("delete");
	connect(delete_button, SIGNAL(clicked()), table_view, SLOT(remove()));

	clear_button = new QPushButton();
	clear_button->setText("clear");

	QHBoxLayout *operate_layout = new QHBoxLayout();
	operate_layout->addWidget(count_label);
	operate_layout->addStretch();
	operate_layout->addWidget(add_button);
	operate_layout->addWidget(update_button);
	operate_layout->addWidget(delete_button);
	operate_layout->addWidget(clear_button);
	operate_layout->addStretch();
	operate_layout->setSpacing(20);
	operate_layout->setContentsMargins(0, 0, 0, 0);

	QVBoxLayout *main_layout = new QVBoxLayout();
	main_layout->addWidget(table_view);
	main_layout->addLayout(operate_layout);
	main_layout->setSpacing(20);
	main_layout->setContentsMargins(20, 20, 20, 20);

	this->setLayout(main_layout); 

	timer = new QTimer();
	timer->setInterval(1000);
	connect(timer, SIGNAL(timeout()), table_view, SLOT(changeValue()));
	connect(update_button, SIGNAL(clicked()), timer, SLOT(start()));
	connect(clear_button, SIGNAL(clicked()), timer, SLOT(stop()));
	connect(clear_button, SIGNAL(clicked()), table_view, SLOT(clear()));
	connect(table_view, &TableView::updateCount, this, &MainWindow::updateCount);

	this->updateCount(0);
}
Exemple #24
0
    T_Health takeDamage(T_Damage d)
    {
        T_Armor armor = m_armor;
        armor -= std::get<Pierce>(d);
        if(armor < 0)
            armor = 0;

        if(std::get<Generic>(d) <= armor)
            return getValue();
        else
            changeValue(-std::get<Generic>(d)+armor);
        return getValue();
    }
Exemple #25
0
void Options::handle(View* view, OptionSet set, int lastIndex) {
  vector<ListElem> options;
  options.emplace_back("Change settings:", ListElem::TITLE);
  for (OptionId option : optionSets.at(set))
    options.push_back(ListElem(names.at(option),
          getValueString(option, getValue(option))).setTip(hints.at(option)));
  options.emplace_back("Done");
  auto index = view->chooseFromList("", options, lastIndex, getMenuType(set));
  if (!index || (*index) == optionSets.at(set).size())
    return;
  OptionId option = optionSets.at(set)[*index];
  changeValue(option, getValue(option), view);
  handle(view, set, *index);
}
Exemple #26
0
/**
 * now - current time in seconds
 */
int getIdle(IdleValveState *idle, int currentRpm, int now) {
	if (currentRpm == 0 || isCranking()) {
		return setNewValue(idle, currentRpm, now, "cranking value: ", DEFAULT_IDLE_DUTY);
	}

	if (currentRpm < 0.7 * idle->targetRpmRangeLeft) {
		return setNewValue(idle, currentRpm, now, "RPMs are seriously low: ", lastGoodValue);
	}

	if (now - idle->timeOfLastIdleChange < IDLE_PERIOD) {
		// too soon to adjust anything - exiting
		return idle->value;
	}

	if (currentRpm > idle->targetRpmRangeLeft && currentRpm < idle->targetRpmRangeRight) {
		// current RPM is good enough
		// todo: need idle signal input
		//lastGoodValue = idle->value;
		return idle->value;
	}

	if (currentRpm >= idle->targetRpmRangeRight + 100)
		return changeValue(idle, currentRpm, now, "idle control: rpm is too high: ", -IDLE_DECREASE_STEP);

	if (currentRpm >= idle->targetRpmRangeRight)
		return changeValue(idle, currentRpm, now, "idle control: rpm is a bit too high: ", -1);

	// we are here if RPM is low, let's see how low
//	if (currentRpm < 0.7 * idle->targetRpmRangeLeft) {
//		// todo: act faster in case of really low RPM?
//		return setNewValue(idle, currentRpm, now, "RPMs are seriously low: ", 15 * IDLE_INCREASE_STEP);
//	} else
	if (currentRpm < idle->targetRpmRangeLeft - 100) {
		return changeValue(idle, currentRpm, now, "idle control: RPMs are low: ", IDLE_INCREASE_STEP);
	}
	return changeValue(idle, currentRpm, now, "idle control: RPMs are a bit low: ", 1);
}
void Ambulancia(){
	uint8_t brilho = Maxbrilho;
	int i;

	if(PadraoInit==0){
		for(i=0; i < size; i+=1){
		  values[i]=0;
		}
		SendData(values,size);
		PadraoInit=1;
	}

	uint8_t LedPosition[SireneA];
	for(i=0; i <SireneA; i++)
		LedPosition[i] =  i;
	int k;
	for(k=0; k < 500 && MudaPadrao==0; k++){
		for(i=0; i < SireneA && MudaPadrao==0; i+=1){
		  if(LedPosition[i] >= size)
			  LedPosition[i]=0;
		  changeValue(LedPosition[i],'b',brilho);
		  LedPosition[i]++;
		}
		if(LedPosition[0] !=0)
			changeValue(LedPosition[0]-1,'b',0);
		else
			changeValue(size,'b',0);
		SendData(values,size);

		Wait(25);
	}




}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    lineCount = 1;
    timer = new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(isThreadFinished()));
    test = new testinfo;
    threadList = new QList<workThread*>;
    ui->setupUi(this);
    ui->textEdit->ensureCursorVisible();
//    sky_sdfs_init("config.ini");
    connect(ui->textEdit,SIGNAL(textChanged()),this,SLOT(textDown()));
    connect(ui->checkBox,SIGNAL(clicked()),this,SLOT(changeValue()));
}
Exemple #29
0
void SpinSlider::setValue( qreal v )
{
    //qDebug() << "setValue!!" << v;
    int value2 = 0;
    if ( mGrowthType == LINEAR )
    {
        value2 = std::round( 100 * ( v - mMin ) / ( mMax - mMin ) );
    }
    if ( mGrowthType == LOG )
    {
        value2 = std::round( std::log( v / mMin ) * 100 / std::log( mMax / mMin ) );
    }
    //qDebug() << "Position! " << value2;

    changeValue( v );
}
Exemple #30
0
void caCalc::setValue(double value)
{
    char asc[MAX_STRING_LENGTH], format[20];
    int precision;
    if((precision = getPrecision()) >= 0) {
       sprintf(format, "%s.%dlf", "%", precision);
    } else {
       sprintf(format, "%s.%dle", "%", -precision);
    }
    snprintf(asc, MAX_STRING_LENGTH, format, value);

    setTextLine(QString(asc));

    // emit signal when requested
    if(thisEventSignal == onFirstChange) {
        if(!eventFired) {
            emit emitSignal((int) value);
            emit emitSignal(value);
            emit emitSignal((bool) value);
        }
        eventFired = true;
    } else if(thisEventSignal == onAnyChange) {
        emit emitSignal((int) value);
        emit emitSignal(value);
        emit emitSignal((bool) value);
    } else if(thisEventSignal == TriggerZeroToOne) {
        if((qRound(thisValue) == 0) && (qRound(value) == 1)) {
            emit emitSignal((int) value);
            emit emitSignal(value);
            emit emitSignal((bool) value);
        }
    } else if(thisEventSignal == TriggerOneToZero) {
        if((qRound(thisValue) == 1) && (qRound(value) == 0)) {
            emit emitSignal((int) value);
            emit emitSignal(value);
            emit emitSignal((bool) value);
        }
    }
    thisValue =value;
    //printf("%s emit change value %f\n", qasc(objectName()), value);
    // only in case of a change where no calculation takes places, will we update
    // the data container with the actual value
    if(thisCalc.trimmed().size() == 0) emit changeValue(value);
}