MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { /* Window Title */ setWindowTitle(tr(APPLICATION_NAME)); /* Set sticky places for dockwidgets */ setCorner(Qt::TopLeftCorner, Qt::TopDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); /* * Create Mastercontroller (zone -1) * Controls all zones on all bridges. */ master = new SingleController("Master", -1, this); masterDockWidget = new QDockWidget(tr("Master Controller"), this); masterDockWidget->setWidget(master); masterDockWidget->setMaximumWidth(200); addDockWidget(Qt::TopDockWidgetArea, masterDockWidget); /* Audio Controller */ audio = new audioController(this); addDockWidget(Qt::TopDockWidgetArea, audio); /* Connect Audio to Master .*/ connect(audio, SIGNAL(setRandomSame()), master, SLOT(setRandomExt())); connect(audio, SIGNAL(flash()), master, SLOT(flash())); connect(audio, SIGNAL(flashRandom()), master, SLOT(flashRandom())); connect(audio, SIGNAL(fade10()), master, SLOT(fade10Ext())); connect(audio, SIGNAL(fade20()), master, SLOT(fade20Ext())); presetController = new PresetController(this); presetController->setMinimumWidth(230); addDockWidget(Qt::TopDockWidgetArea, presetController); connect(presetController, SIGNAL(createPreset()), this, SLOT(getPreset())); connect(this, SIGNAL(presetAvailable(Preset*)), presetController, SLOT(addPreset(Preset*))); connect(presetController, SIGNAL(setPreset(Preset*)), this, SLOT(setPreset(Preset*))); /* Center the window. */ QWidget *w = window(); w->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, w->size(), qApp->desktop()->availableGeometry())); /* Create Bridge Discovery Dialog. */ MiLightDiscover *d = new MiLightDiscover(this); connect(d, SIGNAL(selectedDevices(QStringList, bool)), this, SLOT(setupControllers(QStringList, bool))); d->exec(); setupActions(); setupToolBar(); setupMenuBar(); setupStatusBar(); loadSettings(); delete d; }
CountProducerWidget::CountProducerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::CountProducerWidget) { ui->setupUi(this); Util::setColorsToHighlight(ui->nameLabel); ui->directionCombo->addItem(tr("Down"), QVariant("down")); ui->directionCombo->addItem(tr("Up"), QVariant("up")); ui->directionCombo->setCurrentIndex(0); ui->styleCombo->addItem(tr("Seconds"), QVariant("seconds")); ui->styleCombo->addItem(tr("Seconds + 1"), QVariant("seconds+1")); ui->styleCombo->addItem(tr("Frames"), QVariant("frames")); ui->styleCombo->addItem(tr("Timecode"), QVariant("timecode")); ui->styleCombo->addItem(tr("Clock"), QVariant("clock")); ui->styleCombo->setCurrentIndex(0); ui->soundCombo->addItem(tr("2-Pop"), QVariant("2pop")); ui->soundCombo->addItem(tr("Silent"), QVariant("silent")); ui->soundCombo->addItem(tr("Frame 0"), QVariant("frame0")); ui->soundCombo->setCurrentIndex(0); ui->backgroundCombo->addItem(tr("Clock"), QVariant("clock")); ui->backgroundCombo->addItem(tr("None"), QVariant("none")); ui->backgroundCombo->setCurrentIndex(0); ui->dropCheckBox->setChecked(true); ui->durationSpinBox->setValue(qRound(MLT.profile().fps() * 10.0)); // 10 seconds ui->preset->saveDefaultPreset(getPreset()); ui->preset->loadPresets(); }
IsingWidget::IsingWidget(QWidget *parent) : QWidget(parent), ui(new Ui::IsingWidget) { ui->setupUi(this); ui->preset->saveDefaultPreset(*getPreset()); ui->preset->loadPresets(); }
NetworkProducerWidget::NetworkProducerWidget(QWidget *parent) : QWidget(parent), ui(new Ui::NetworkProducerWidget) { ui->setupUi(this); Util::setColorsToHighlight(ui->label_2); ui->applyButton->hide(); ui->preset->saveDefaultPreset(*getPreset()); ui->preset->loadPresets(); }
Video4LinuxWidget::Video4LinuxWidget(QWidget *parent) : QWidget(parent), ui(new Ui::Video4LinuxWidget), m_audioWidget(0) { ui->setupUi(this); Util::setColorsToHighlight(ui->label_3); ui->applyButton->hide(); ui->preset->saveDefaultPreset(getPreset()); ui->preset->loadPresets(); }
PresetManager::Preset * PresetManager::addPresetFromControllableContainer(const String &name, const String & filter, ControllableContainer * container, bool recursive, bool includeNotExposed) { //Array<PresetValue *> vPresets; Preset * pre = getPreset(filter, name); bool presetExists = pre != nullptr; if (!presetExists) { pre = new Preset(name, filter); } else { pre->clear(); } for (auto &p : container->getAllParameters(recursive,includeNotExposed)) { if (!p->isPresettable) continue; if(p==(Parameter*)container->currentPresetName){ continue; } if (!p->isControllableExposed && !includeNotExposed) continue; //DBG("Add preset value " << p->niceName << " > " << p->value.toString() << p->stringValue()); //PresetValue * preVal = new PresetValue(p->controlAddress,p->value.clone()); //vPresets.add(preVal); pre->addPresetValue(p->getControlAddress(container), var(p->getValue())); } //DBG("Saving preset, recursive ? " << String(recursive)); if (!recursive) { for (auto &cc : container->controllableContainers) { //DBG("Child container : " << cc->niceName << "preset name : "<< cc->currentPresetName->stringValue()); if (cc->currentPresetName->stringValue().isNotEmpty()) { //DBG(" >> Saving child container preset : " << cc->currentPresetName->stringValue()); pre->addPresetValue(cc->currentPresetName->getControlAddress(container), cc->currentPresetName->getValue()); } } } if(!presetExists) presets.add(pre); return pre; }
SOAP_FMAC5 int SOAP_FMAC6 __tptz__GetPresets(struct soap* soap, struct _tptz__GetPresets *tptz__GetPresets, struct _tptz__GetPresetsResponse *tptz__GetPresetsResponse) { logInfo("__tptz__GetPresets"); OnvifPTZAllPresets onvifPTZAllPresets; if (!isRetCodeSuccess(getPTZAllPresets(&onvifPTZAllPresets))) { logInfo("__tptz__GetPresets getPTZAllPresets failed"); return getOnvifPTZSoapActionNotSupport(soap, "PTZ GetPresets", "getPTZAllPresets failed"); } tptz__GetPresetsResponse->__sizePreset = onvifPTZAllPresets.size; if (onvifPTZAllPresets.size > 0) { tptz__GetPresetsResponse->Preset = (struct tt__PTZPreset*) my_soap_malloc(soap, sizeof(struct tt__PTZPreset) * onvifPTZAllPresets.size); int i; for (i = 0; i < onvifPTZAllPresets.size; i++) { getPreset(soap, &(tptz__GetPresetsResponse->Preset[i]), &(onvifPTZAllPresets.presets[i])); } } else tptz__GetPresetsResponse->Preset = NULL; return SOAP_OK; }
void NetworkProducerWidget::on_preset_saveClicked() { ui->preset->savePreset(getPreset()); }
void HidController::visit(const HidControllerPreset* preset) { m_preset = *preset; // Emit presetLoaded with a clone of the preset. emit(presetLoaded(getPreset())); }
void MidiController::visit(const MidiControllerPreset* preset) { m_preset = *preset; emit(presetLoaded(getPreset())); }
void AlsaWidget::on_preset_saveClicked() { ui->preset->savePreset(getPreset()); }
void Video4LinuxWidget::on_preset_saveClicked() { ui->preset->savePreset(getPreset()); }
void MainWindow::keyPressEvent(QKeyEvent *e) { switch(e->key()){ case Qt::Key_0: master->setOffExt(); break; case Qt::Key_1: master->setOnExt(); break; case Qt::Key_F1: case Qt::Key_W: master->setWhiteExt(); master->setFixed(true); break; case Qt::Key_F2: master->red(); master->setFixed(true); break; case Qt::Key_F3: master->green(); master->setFixed(true); break; case Qt::Key_F4: master->blue(); master->setFixed(true); break; case Qt::Key_F5: case Qt::Key_B: if(!e->isAutoRepeat() && master->state()){ master->setOffExt(); master->setFixed(true); } break; case Qt::Key_F7: case Qt::Key_F: { QColor c = master->color(); if(c.hue() != QColor(Qt::white).hue()){ master->setWhiteExt(); master->setColorExt(c); } else{ master->setRandomExt(); master->setWhiteExt(); } break; } case Qt::Key_F8: case Qt::Key_G: if(!e->isAutoRepeat() && master->color().hue() != QColor(Qt::white).hue()){ master->setWhiteExt(); master->setFixed(true); } break; case Qt::Key_A: break; case Qt::Key_P: getPreset(); break; case Qt::Key_R: master->setRandomExt(); break; case Qt::Key_T: master->state() ? master->setOffExt() : master->setOnExt(); break; case Qt::Key_Up: master->setBrightExt(master->brightness() + 1); break; case Qt::Key_Down: master->setBrightExt(master->brightness() - 1); break; case Qt::Key_Left: master->fadeExt(-1); break; case Qt::Key_Right: master->fadeExt(1); break; default: break; } }
void setFromPreset(size_t num) { settings->vjoy_controls = getPreset(num); settings->vjoy_current_preset = num; setUpdated(); }
void setupPreferences() { auto preferences = DependencyManager::get<Preferences>(); MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); static const QString AVATAR_BASICS { "Avatar Basics" }; { auto getter = [=]()->QString { return myAvatar->getDisplayName(); }; auto setter = [=](const QString& value) { myAvatar->setDisplayName(value); }; auto preference = new EditPreference(AVATAR_BASICS, "Avatar display name (optional)", getter, setter); preference->setPlaceholderText("Not showing a name"); preferences->addPreference(preference); } { auto getter = [=]()->QString { return myAvatar->getCollisionSoundURL(); }; auto setter = [=](const QString& value) { myAvatar->setCollisionSoundURL(value); }; auto preference = new EditPreference(AVATAR_BASICS, "Avatar collision sound URL (optional)", getter, setter); preference->setPlaceholderText("Enter the URL of a sound to play when you bump into something"); preferences->addPreference(preference); } { auto getter = [=]()->QString { return myAvatar->getFullAvatarURLFromPreferences().toString(); }; auto setter = [=](const QString& value) { myAvatar->useFullAvatarURL(value, ""); }; auto preference = new AvatarPreference(AVATAR_BASICS, "Appearance", getter, setter); preferences->addPreference(preference); } { auto getter = [=]()->bool { return myAvatar->getSnapTurn(); }; auto setter = [=](bool value) { myAvatar->setSnapTurn(value); }; preferences->addPreference(new CheckPreference(AVATAR_BASICS, "Snap turn when in HMD", getter, setter)); } { auto getter = [=]()->bool { return myAvatar->getClearOverlayWhenMoving(); }; auto setter = [=](bool value) { myAvatar->setClearOverlayWhenMoving(value); }; preferences->addPreference(new CheckPreference(AVATAR_BASICS, "Clear overlays when moving", getter, setter)); } // Snapshots static const QString SNAPSHOTS { "Snapshots" }; { auto getter = []()->QString { return Snapshot::snapshotsLocation.get(); }; auto setter = [](const QString& value) { Snapshot::snapshotsLocation.set(value); }; auto preference = new BrowsePreference(SNAPSHOTS, "Put my snapshots here", getter, setter); preferences->addPreference(preference); } // Scripts { auto getter = []()->QString { return DependencyManager::get<ScriptEngines>()->getScriptsLocation(); }; auto setter = [](const QString& value) { DependencyManager::get<ScriptEngines>()->setScriptsLocation(value); }; preferences->addPreference(new BrowsePreference("Scripts", "Load scripts from this directory", getter, setter)); } preferences->addPreference(new ButtonPreference("Scripts", "Load Default Scripts", [] { DependencyManager::get<ScriptEngines>()->loadDefaultScripts(); })); { auto getter = []()->bool { return !Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger); }; auto setter = [](bool value) { Menu::getInstance()->setIsOptionChecked(MenuOption::DisableActivityLogger, !value); }; preferences->addPreference(new CheckPreference("Privacy", "Send data", getter, setter)); } static const QString LOD_TUNING("Level of Detail Tuning"); { auto getter = []()->float { return DependencyManager::get<LODManager>()->getDesktopLODDecreaseFPS(); }; auto setter = [](float value) { DependencyManager::get<LODManager>()->setDesktopLODDecreaseFPS(value); }; auto preference = new SpinnerPreference(LOD_TUNING, "Minimum desktop FPS", getter, setter); preference->setMin(0); preference->setMax(120); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<LODManager>()->getHMDLODDecreaseFPS(); }; auto setter = [](float value) { DependencyManager::get<LODManager>()->setHMDLODDecreaseFPS(value); }; auto preference = new SpinnerPreference(LOD_TUNING, "Minimum HMD FPS", getter, setter); preference->setMin(0); preference->setMax(120); preference->setStep(1); preferences->addPreference(preference); } static const QString AVATAR_TUNING { "Avatar Tuning" }; { auto getter = [=]()->float { return myAvatar->getRealWorldFieldOfView(); }; auto setter = [=](float value) { myAvatar->setRealWorldFieldOfView(value); }; auto preference = new SpinnerPreference(AVATAR_TUNING, "Real world vertical field of view (angular size of monitor)", getter, setter); preference->setMin(1); preference->setMax(180); preferences->addPreference(preference); } { auto getter = []()->float { return qApp->getFieldOfView(); }; auto setter = [](float value) { qApp->setFieldOfView(value); }; auto preference = new SpinnerPreference(AVATAR_TUNING, "Vertical field of view", getter, setter); preference->setMin(1); preference->setMax(180); preference->setStep(1); preferences->addPreference(preference); } { auto getter = [=]()->float { return myAvatar->getUniformScale(); }; auto setter = [=](float value) { myAvatar->setTargetScaleVerbose(value); }; // The hell? auto preference = new SpinnerPreference(AVATAR_TUNING, "Avatar scale (default is 1.0)", getter, setter); preference->setMin(0.01f); preference->setMax(99.9f); preference->setDecimals(2); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<DdeFaceTracker>()->getEyeClosingThreshold(); }; auto setter = [](float value) { DependencyManager::get<DdeFaceTracker>()->setEyeClosingThreshold(value); }; preferences->addPreference(new SliderPreference(AVATAR_TUNING, "Camera binary eyelid threshold", getter, setter)); } { auto getter = []()->float { return FaceTracker::getEyeDeflection(); }; auto setter = [](float value) { FaceTracker::setEyeDeflection(value); }; preferences->addPreference(new SliderPreference(AVATAR_TUNING, "Face tracker eye deflection", getter, setter)); } { auto getter = []()->QString { return DependencyManager::get<Faceshift>()->getHostname(); }; auto setter = [](const QString& value) { DependencyManager::get<Faceshift>()->setHostname(value); }; auto preference = new EditPreference(AVATAR_TUNING, "Faceshift hostname", getter, setter); preference->setPlaceholderText("localhost"); preferences->addPreference(preference); } { auto getter = [=]()->QString { return myAvatar->getAnimGraphOverrideUrl().toString(); }; auto setter = [=](const QString& value) { myAvatar->setAnimGraphOverrideUrl(QUrl(value)); }; auto preference = new EditPreference(AVATAR_TUNING, "Avatar animation JSON", getter, setter); preference->setPlaceholderText("default"); preferences->addPreference(preference); } static const QString AVATAR_CAMERA { "Avatar Camera" }; { auto getter = [=]()->float { return myAvatar->getPitchSpeed(); }; auto setter = [=](float value) { myAvatar->setPitchSpeed(value); }; auto preference = new SpinnerPreference(AVATAR_CAMERA, "Camera pitch speed (degrees/second)", getter, setter); preference->setMin(1.0f); preference->setMax(360.0f); preferences->addPreference(preference); } { auto getter = [=]()->float { return myAvatar->getYawSpeed(); }; auto setter = [=](float value) { myAvatar->setYawSpeed(value); }; auto preference = new SpinnerPreference(AVATAR_CAMERA, "Camera yaw speed (degrees/second)", getter, setter); preference->setMin(1.0f); preference->setMax(360.0f); preferences->addPreference(preference); } static const QString AUDIO("Audio"); { auto getter = []()->bool { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getDynamicJitterBuffers(); }; auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setDynamicJitterBuffers(value); }; preferences->addPreference(new CheckPreference(AUDIO, "Enable dynamic jitter buffers", getter, setter)); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getDesiredJitterBufferFrames(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setStaticDesiredJitterBufferFrames(value); }; auto preference = new SpinnerPreference(AUDIO, "Static jitter buffer frames", getter, setter); preference->setMin(0); preference->setMax(10000); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getMaxFramesOverDesired(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setMaxFramesOverDesired(value); }; auto preference = new SpinnerPreference(AUDIO, "Max frames over desired", getter, setter); preference->setMax(10000); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->bool { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getUseStDevForJitterCalc(); }; auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setUseStDevForJitterCalc(value); }; preferences->addPreference(new CheckPreference(AUDIO, "Use standard deviation for dynamic jitter calc", getter, setter)); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getWindowStarveThreshold(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setWindowStarveThreshold(value); }; auto preference = new SpinnerPreference(AUDIO, "Window A starve threshold", getter, setter); preference->setMax(10000); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getWindowSecondsForDesiredCalcOnTooManyStarves(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setWindowSecondsForDesiredCalcOnTooManyStarves(value); }; auto preference = new SpinnerPreference(AUDIO, "Window A (raise desired on N starves) seconds", getter, setter); preference->setMax(10000); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getWindowSecondsForDesiredReduction(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setWindowSecondsForDesiredReduction(value); }; auto preference = new SpinnerPreference(AUDIO, "Window B (desired ceiling) seconds", getter, setter); preference->setMax(10000); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->bool { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getRepetitionWithFade(); }; auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setRepetitionWithFade(value); }; preferences->addPreference(new CheckPreference(AUDIO, "Repetition with fade", getter, setter)); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputBufferSize(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputBufferSize(value); }; auto preference = new SpinnerPreference(AUDIO, "Output buffer initial size (frames)", getter, setter); preference->setMin(1); preference->setMax(20); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->bool { return DependencyManager::get<AudioClient>()->getOutputStarveDetectionEnabled(); }; auto setter = [](bool value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionEnabled(value); }; auto preference = new CheckPreference(AUDIO, "Output starve detection (automatic buffer size increase)", getter, setter); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputStarveDetectionThreshold(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionThreshold(value); }; auto preference = new SpinnerPreference(AUDIO, "Output starve detection threshold", getter, setter); preference->setMin(1); preference->setMax(500); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputStarveDetectionPeriod(); }; auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionPeriod(value); }; auto preference = new SpinnerPreference(AUDIO, "Output starve detection period (ms)", getter, setter); preference->setMin(1); preference->setMax((float)999999999); preference->setStep(1); preferences->addPreference(preference); } #if DEV_BUILD || PR_BUILD { auto getter = []()->float { return DependencyManager::get<AudioClient>()->getGateThreshold(); }; auto setter = [](float value) { return DependencyManager::get<AudioClient>()->setGateThreshold(value); }; auto preference = new SpinnerPreference(AUDIO, "Debug gate threshold", getter, setter); preference->setMin(1); preference->setMax((float)100); preference->setStep(1); preferences->addPreference(preference); } #endif { auto getter = []()->float { return qApp->getMaxOctreePacketsPerSecond(); }; auto setter = [](float value) { qApp->setMaxOctreePacketsPerSecond(value); }; auto preference = new SpinnerPreference("Octree", "Max packets sent each second", getter, setter); preference->setMin(60); preference->setMax(6000); preference->setStep(10); preferences->addPreference(preference); } { auto getter = []()->float { return qApp->getApplicationCompositor().getHmdUIAngularSize(); }; auto setter = [](float value) { qApp->getApplicationCompositor().setHmdUIAngularSize(value); }; auto preference = new SpinnerPreference("HMD", "UI horizontal angular size (degrees)", getter, setter); preference->setMin(30); preference->setMax(160); preference->setStep(1); preferences->addPreference(preference); } { auto getter = []()->float { return controller::InputDevice::getReticleMoveSpeed(); }; auto setter = [](float value) { controller::InputDevice::setReticleMoveSpeed(value); }; auto preference = new SpinnerPreference("Sixense Controllers", "Reticle movement speed", getter, setter); preference->setMin(0); preference->setMax(100); preference->setStep(1); preferences->addPreference(preference); } { static const QString RENDER("Graphics"); auto renderConfig = qApp->getRenderEngine()->getConfiguration(); auto ambientOcclusionConfig = renderConfig->getConfig<AmbientOcclusionEffect>(); { auto getter = [ambientOcclusionConfig]()->QString { return ambientOcclusionConfig->getPreset(); }; auto setter = [ambientOcclusionConfig](QString preset) { ambientOcclusionConfig->setPreset(preset); }; auto preference = new ComboBoxPreference(RENDER, "Ambient occlusion", getter, setter); preference->setItems(ambientOcclusionConfig->getPresetList()); preferences->addPreference(preference); } auto shadowConfig = renderConfig->getConfig<RenderShadowTask>(); { auto getter = [shadowConfig]()->QString { return shadowConfig->getPreset(); }; auto setter = [shadowConfig](QString preset) { shadowConfig->setPreset(preset); }; auto preference = new ComboBoxPreference(RENDER, "Shadows", getter, setter); preference->setItems(shadowConfig->getPresetList()); preferences->addPreference(preference); } } { static const QString RENDER("Networking"); auto nodelist = DependencyManager::get<NodeList>(); { static const int MIN_PORT_NUMBER { 0 }; static const int MAX_PORT_NUMBER { 65535 }; auto getter = [nodelist] { return static_cast<int>(nodelist->getSocketLocalPort()); }; auto setter = [nodelist](int preset) { nodelist->setSocketLocalPort(static_cast<quint16>(preset)); }; auto preference = new IntSpinnerPreference(RENDER, "Listening Port", getter, setter); preference->setMin(MIN_PORT_NUMBER); preference->setMax(MAX_PORT_NUMBER); preferences->addPreference(preference); } } }