MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), bridge(NULL), workerThread(NULL), debugListTimer(), debugListMessages() { ui->setupUi(this); // Fixed width, minimum height this->setMinimumSize(this->size()); this->setMaximumSize(this->size().width(), 2000); #ifdef Q_OS_LINUX this->setWindowIcon(QIcon(":/images/images/icon48.png")); #endif // Plumb event filter for focus events ui->cmbMidiIn->installEventFilter(this); ui->cmbMidiOut->installEventFilter(this); ui->cmbSerial->installEventFilter(this); // Load initial state this->workerThread = new QThread(); this->workerThread->start(QThread::HighestPriority); refresh(); scrollbackSize=Settings::getScrollbackSize(); ui->chk_debug->setChecked( Settings::getDebug() ); selectIfAvailable(ui->cmbMidiIn, Settings::getLastMidiIn()); selectIfAvailable(ui->cmbMidiOut, Settings::getLastMidiOut()); selectIfAvailable(ui->cmbSerial, Settings::getLastSerialPort()); // Set up timer for the display list debugListTimer.setSingleShot(true); debugListTimer.setInterval(1000 / LIST_REFRESH_RATE); // Plumb signals & slots connect(ui->cmbMidiIn, SIGNAL(currentIndexChanged(int)), SLOT(onValueChanged())); connect(ui->cmbMidiOut, SIGNAL(currentIndexChanged(int)), SLOT(onValueChanged())); connect(ui->cmbSerial, SIGNAL(currentIndexChanged(int)), SLOT(onValueChanged())); connect(ui->chk_on, SIGNAL(clicked()), SLOT(onValueChanged())); connect(ui->chk_debug, SIGNAL(clicked(bool)), SLOT(onDebugClicked(bool))); connect(&debugListTimer, SIGNAL(timeout()), SLOT(refreshDebugList())); // Menu items connect(ui->actionExit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutBox())); connect(ui->actionPreferences, SIGNAL(triggered()), SLOT(showPreferences())); // Get started onValueChanged(); #ifdef Q_OS_MAC // hack: avoid an empty dummy File menu on OS X // there might be a better way to do this, but hide() and clear() don't work. ui->menuFile->setTitle(""); // Doesn't do anything on OS X #endif }
QWidget *ptFilter_ChannelMixer::doCreateGui() { auto guiBody = new QWidget; Ui_ChannelMixerForm form; form.setupUi(guiBody); this->initDesignerGui(guiBody); FMixerNameStore.setAssocLabel(form.MixernameLabel); form.ChannelMatrixGrid->setVerticalSpacing(6); form.ChannelMatrixGrid->setHorizontalSpacing(6); connect(form.LoadButton, SIGNAL(clicked()), SLOT(onLoadButtonClicked())); connect(form.SaveButton, SIGNAL(clicked()), SLOT(onSaveButtonClicked())); connect(form.Red2Red, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Red2Green, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Red2Blue, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Green2Red, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Green2Green, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Green2Blue, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Blue2Red, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Blue2Green, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); connect(form.Blue2Blue, SIGNAL(valueChanged(QString,QVariant)), SLOT(onValueChanged(QString,QVariant))); return guiBody; }
AppletToolsBrightness::AppletToolsBrightness(QGraphicsObject *parent): AppletToolsWidget("brightness", false, parent) { addIcon("icon-extensions-brightness-min"); addIcon("icon-extensions-brightness-med"); addIcon("icon-extensions-brightness-max"); setIcon(0); m_gconf_brightness = new GConfItem("/system/osso/dsm/display/display_brightness"); connect(m_gconf_brightness, SIGNAL(valueChanged()), this, SLOT(onValueChanged())); onValueChanged(); }
void Slider::SetValue(int value) { if (value < GetMinValue()) { value = GetMinValue(); } else if (value > GetMaxValue()) { value = GetMaxValue(); } _value = value; (onValueChanged != 0) ? onValueChanged(this) : OnValueChangedEvent(); if (GetOrientation() == ORIENTATION_VERTICAL) { GetMarker()->SetX(GetMarkerOffsetX()); GetMarker()->SetY(static_cast<sint>(GetMarkerOffsetY() + GetHeight() / ((GetMaxValue() - GetMinValue()) / static_cast<float>(GetValue())) - GetMarker()->GetHeight() / 2.0f)); } else { GetMarker()->SetX(static_cast<sint>(GetMarkerOffsetX() + GetWidth() / ((GetMaxValue() - GetMinValue()) / static_cast<float>(GetValue())) - GetMarker()->GetWidth() / 2.0f)); GetMarker()->SetY(GetMarkerOffsetY()); } }
void ScrollBar::SetValue(int32_t value) { if (value < GetMinValue()) { value = GetMinValue(); } else if (value > GetMaxValue()) { value = GetMaxValue(); } _value = value; (onValueChanged != 0) ? onValueChanged(this) : OnValueChanged(); if (GetOrientation() == ORIENTATION_HORIZONTAL) { GetMarker()->SetX(static_cast<PosType>(GetMarkerOffsetX() + (Slider::GetWidth() - GetMarker()->GetWidth()) / ((GetMaxValue() - GetMinValue()) / static_cast<float>(GetValue())))); GetMarker()->SetY(GetMarkerOffsetY()); } else { GetMarker()->SetX(GetMarkerOffsetX()); GetMarker()->SetY(static_cast<PosType>(GetMarkerOffsetY() + (Slider::GetHeight() - GetMarker()->GetHeight()) / ((GetMaxValue() - GetMinValue()) / static_cast<float>(GetValue())))); } }
void AMExtendedControlEditor::onConnectedChanged() { if (control_ && control_->canMeasure()) { onValueChanged(control_->value()); onUnitsChanged(control_->units()); onMotion(control_->isMoving()); if (control_->isEnum()) dialog_->setEnumNames(control_->moveEnumNames()); setHappy(true); } else { valueLabel_->setText("[Not Connected]"); unitsLabel_->setText("?"); onMotion(false); dialog_->setEnumNames(QStringList()); setHappy(false); } updateReadOnlyStatus(); }
void AMExtendedControlEditor::setPrecision(int precision) { precision_ = precision; if (control_) onValueChanged(control_->value()); }
void QgsRelationReferenceSearchWidgetWrapper::initWidget( QWidget* editor ) { mWidget = qobject_cast<QgsRelationReferenceWidget*>( editor ); if ( !mWidget ) return; mWidget->setEditorContext( context(), mCanvas, nullptr ); mWidget->setEmbedForm( false ); mWidget->setReadOnlySelector( false ); mWidget->setAllowMapIdentification( config( QStringLiteral( "MapIdentification" ), false ).toBool() ); mWidget->setOrderByValue( config( QStringLiteral( "OrderByValue" ), false ).toBool() ); mWidget->setAllowAddFeatures( false ); mWidget->setOpenFormButtonVisible( false ); if ( config( QStringLiteral( "FilterFields" ), QVariant() ).isValid() ) { mWidget->setFilterFields( config( QStringLiteral( "FilterFields" ) ).toStringList() ); mWidget->setChainFilters( config( QStringLiteral( "ChainFilters" ) ).toBool() ); } QgsRelation relation = QgsProject::instance()->relationManager()->relation( config( QStringLiteral( "Relation" ) ).toString() ); mWidget->setRelation( relation, false ); mWidget->showIndeterminateState(); connect( mWidget, SIGNAL( foreignKeyChanged( QVariant ) ), this, SLOT( onValueChanged( QVariant ) ) ); }
void GUITextField::_setValue(const String& value, bool triggerEvent) { setValue(value); if (triggerEvent) onValueChanged(value); }
void SliderComponent::onSizeChanged() { if(!mSuffix.empty()) mFont = Font::get((int)(mSize.y()), FONT_PATH_LIGHT); onValueChanged(); }
void GUIIntField::_setValue(INT32 value, bool triggerEvent) { mValue = value; setText(value); if (triggerEvent) onValueChanged(mValue); }
void GUIFloatField::_setValue(float value, bool triggerEvent) { mValue = value; setText(value); if(triggerEvent) onValueChanged(mValue); }
void MainWindow::showPreferences() { SettingsDialog dialog; if(dialog.exec() == QDialog::Accepted) { scrollbackSize=Settings::getScrollbackSize(); onValueChanged(); } }
void ProgressBar::setValue(int v) { v = std::min(maxV, std::max(v, minV) ); if( val!=v ){ val = v; onValueChanged(val); update(); } }
void SliderComponent::setValue(float value) { mValue = value; if(mValue < mMin) mValue = mMin; else if(mValue > mMax) mValue = mMax; onValueChanged(); }
CKitProperty(QString name, prop_fn_t fn) : QObject(0) , name(name) , prop(name) , fn(fn) { connect(&prop, SIGNAL(valueChanged()), this, SLOT(onValueChanged())); prop.subscribe(); }
bool AMExtendedControlEditor::setControlFormat(const QChar& format, int precision){ if(format == 'g' || format == 'G' || format == 'e' || format == 'E' || format == 'f' || format == 'F'){ format_ = format; precision_ = precision; if(control_ && control_->isConnected()) onValueChanged(control_->value()); return true; } return false; }
ValueWidget::ValueWidget(QWidget* parent) : QWidget(parent) { m_Layout = new QHBoxLayout(this); m_label = new QLabel("Label"); m_value = new QLCDNumber( 3 ); m_Layout->addWidget(m_label); m_Layout->addWidget(m_value); connect( &gData, SIGNAL(sigChanged()), this, SLOT(onValueChanged()) ); }
OscOutBlock::OscOutBlock(MainController *controller, QString uid) : OneInputBlock(controller, uid) , m_message("") , m_lastValue(0) , m_minValue(0) , m_maxValue(1) , m_useInteger(false) , m_negativeMinValue(this, "negativeMinValue", false) , m_negativeMaxValue(this, "negativeMaxValue", false) { connect(m_inputNode, SIGNAL(dataChanged()), this, SLOT(onValueChanged())); }
void Spinner::setCurrentValue(float value) { if (value != d_currentValue) { // limit input value to within valid range for spinner value = ceguimax(ceguimin(value, d_maxValue), d_minValue); d_currentValue = value; WindowEventArgs args(this); onValueChanged(args); } }
void VESPERSSetStringAction::startImplementation() { // Must have a control, and it must be able to move. if(!control_) { AMErrorMon::alert(this, VESPERSSETSTRINGACTION_NOCONTROL, QString("There was an error setting the string to the control, because the control was not found. Please report this problem to the Acquaman developers.")); setFailed(); return; } AMProcessVariable *pv = ((AMPVControl *)(control_))->writePV(); connect(pv, SIGNAL(valueChanged()), this, SLOT(onValueChanged())); VESPERS::stringToPV(pv, ((VESPERSSetStringActionInfo *)info())->text()); }
/************************************************************************* set the current slider value. *************************************************************************/ void Slider::setCurrentValue(float value) { float oldval = d_value; // range for value: 0 <= value <= maxValue d_value = (value >= 0.0f) ? ((value <= d_maxValue) ? value : d_maxValue) : 0.0f; updateThumb(); // send notification if slider value changed. if (d_value != oldval) { WindowEventArgs args(this); onValueChanged(args); } }
/// Constructor. Creates new adaptor for the given manager with the given /// dbus connection. The connection \a conn is not retained. PropertyAdaptor::PropertyAdaptor(PropertyPrivate* propertyPrivate, QDBusConnection *conn) : QDBusAbstractAdaptor(propertyPrivate), propertyPrivate(propertyPrivate), connection(conn) { // Start listening to the QDBusServiceWathcer, to know when our client has // exited. sconnect(&serviceWatcher, SIGNAL(serviceUnregistered(const QString&)), this, SLOT(onClientExited(const QString&))); serviceWatcher.setConnection(*conn); sconnect(propertyPrivate, SIGNAL(valueChanged(const QVariantList&, const quint64&)), this, SIGNAL(ValueChanged(const QVariantList&, const quint64&))); // Start listening to ValueChanged signals. We only listen to the // same bus we're on: that means if the same property is provided // both on session and on system bus, overhearing won't work. connection->connect("", objectPath(), DBUS_INTERFACE, "ValueChanged", this, SLOT(onValueChanged(QVariantList, quint64))); }
void AMExtendedControlEditor::setHappy(bool happy) { if(control_ && happy){ unitsLabel_->setStyleSheet("border: 1px outset #00df00; background: #d4ffdf; padding: 1px; width: 100%; color: #00df00;"); onUnitsChanged(control_->units()); onValueChanged(control_->value()); if(!connectedOnce_){ dialog_->setDoubleMaximum(control_->maximumValue()); dialog_->setDoubleMinimum(control_->minimumValue()); dialog_->setDoubleValue(control_->value()); connectedOnce_ = true; } } else { unitsLabel_->setStyleSheet("border: 1px outset #f20000; background: #ffdfdf; padding: 1px; color: #f20000;"); } }
/************************************************************************* set the maximum value for the slider. Note that the minimum value is fixed at 0. *************************************************************************/ void Slider::setMaxValue(float maxVal) { d_maxValue = maxVal; float oldval = d_value; // limit current value to be within new max if (d_value > d_maxValue) { d_value = d_maxValue; } updateThumb(); // send notification if slider value changed. if (d_value != oldval) { WindowEventArgs args(this); onValueChanged(args); } }
void GUIGameObjectField::setValue(const HGameObject& value, bool triggerEvent) { if (value) { if (mInstanceId == value.getInstanceId()) return; mInstanceId = value->getInstanceId(); mDropButton->setContent(GUIContent(HString(toWString(value->getName()) + L" (" + toWString(mType) + L")"))); } else { if (mInstanceId == 0) return; mInstanceId = 0; mDropButton->setContent(GUIContent(HString(L"None (" + toWString(mType) + L")"))); } if (triggerEvent) onValueChanged(value); }
QGridLayout* WidgetParameters::buildLayoutFromParameters() { //Adding Layout QGridLayout *mainLayout = new QGridLayout(this); // get groups QMultiMap<QString,MOParameter*> groupmap = _localParameters->groupmap(); QStringList groups = groupmap.uniqueKeys(); QStringList paramNames; for(int i=0;i<_localParameters->size();i++) paramNames.push_back(_localParameters->at(i)->name()); QPushButton *newPush; MOParameter* parameter; MOParameterListed *paramList; QList<MOParameter*> groupParameters; QGridLayout *curLayout; QGroupBox *curBox; // create group box for(int iG=0;iG<groups.size();iG++) { int iRow=0; if(groups.size()>1) { curBox = new QGroupBox(groups.at(iG),this); curLayout = new QGridLayout(curBox); } else curLayout = mainLayout; groupParameters = groupmap.values(groups.at(iG)); // to reproduce parameters order, start from the end // it seems MultiMap behaves like a pile for(int iP=groupParameters.size()-1;iP>=0;iP--) { parameter = groupParameters.at(iP); // add setting QString dispName; if(parameter->name().contains("/")) dispName = parameter->name().section("/",1,-1); else dispName = parameter->name(); curLayout->addWidget(new QLabel(parameter->description()),iRow,0); //boxLayout->addWidget(new QLabel(dispName),iRow,0); int type = parameter->getFieldValue(MOParameter::TYPE).toInt(); QWidget *valueWidget; QVariant value = parameter->getFieldValue(MOParameter::VALUE); switch(type) { case MOParameter::STRING : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); break; case MOParameter::FILEPATH : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); // add button newPush = new QPushButton("...",this); newPush->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); _pathsMap.insert(newPush,((QLineEdit*)valueWidget)); curLayout->addWidget(newPush,iRow,2); connect(newPush,SIGNAL(clicked()),this,SLOT(onSelectFileClicked())); break; case MOParameter::FOLDERPATH : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); //add button newPush = new QPushButton("...",this); newPush->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); _pathsMap.insert(newPush,((QLineEdit*)valueWidget)); curLayout->addWidget(newPush,iRow,2); connect(newPush,SIGNAL(clicked()),this,SLOT(onSelectFolderClicked())); break; case MOParameter::DOUBLE : valueWidget = new QScienceSpinBox(this); ((QScienceSpinBox*)valueWidget)->setMinimum(parameter->getFieldValue(MOParameter::MIN).toDouble()); ((QScienceSpinBox*)valueWidget)->setMaximum(parameter->getFieldValue(MOParameter::MAX).toDouble()); ((QScienceSpinBox*)valueWidget)->setDecimals(10); ((QScienceSpinBox*)valueWidget)->setValue(value.toDouble()); connect(((QScienceSpinBox*)valueWidget),SIGNAL(valueChanged(double)),this,SLOT(onValueChanged())); break; case MOParameter::INT : valueWidget = new QSpinBox(this); ((QSpinBox*)valueWidget)->setMinimum(parameter->getFieldValue(MOParameter::MIN).toInt()); ((QSpinBox*)valueWidget)->setMaximum(parameter->getFieldValue(MOParameter::MAX).toInt()); ((QSpinBox*)valueWidget)->setValue(value.toInt()); connect(((QSpinBox*)valueWidget),SIGNAL(valueChanged(int)),this,SLOT(onValueChanged())); break; case MOParameter::BOOL : valueWidget = new QCheckBox(this); Qt::CheckState state; if(value.toBool()) state = Qt::Checked; else state = Qt::Unchecked; connect(((QCheckBox*)valueWidget),SIGNAL(stateChanged(int)),this,SLOT(onValueChanged())); ((QCheckBox*)valueWidget)->setCheckState(state); break; case MOParameter::LIST : //if is a list, param should be a MOParameterListed valueWidget = new QComboBox(this); paramList = dynamic_cast<MOParameterListed*>(parameter); if(paramList) { //adding list items in qcombobox for(int iValue = 0 ; iValue<paramList->mapList().keys().size();iValue++) { ((QComboBox*)valueWidget)->addItem( paramList->mapList().values().at(iValue), paramList->mapList().keys().at(iValue)); } // set current index ((QComboBox*)valueWidget)->setCurrentIndex(((QComboBox*)valueWidget)->findData(value)); connect(((QComboBox*)valueWidget),SIGNAL(currentIndexChanged(int)),this,SLOT(onValueChanged())); } break; default : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); break; } curLayout->addWidget(valueWidget,iRow,1); valueWidget->setEnabled(_editable); // store (to save data when click ok) _mapValueWidgets.insert(parameter,valueWidget); _paramNames.push_back(parameter->name()); _paramTypes.push_back(type); iRow++; } if(groups.size()>1) { curBox->setLayout(curLayout); mainLayout->addWidget(curBox); } } if(_editable) updateEnabled(); //update return mainLayout; }
void AnalogStick::SetValueX(float valueX) { _valueX = valueX; (onValueChanged != 0) ? onValueChanged(this) : OnValueChangedEvent(); }
/** * Called when a config property's value is changed. * * @param name The name of the property which changed. * @param newValue The new value of the property. * @param oldValue The old value of the property. */ void ConfigObserver::notifyValueChanged(const std::string &name, const std::string &newValue, const std::string &oldValue) { onValueChanged(name, newValue, oldValue); }
void AnalogStick::SetValueY(float valueY) { _valueY = valueY; (onValueChanged != 0) ? onValueChanged(this) : OnValueChangedEvent(); }