QWidget *FileStorage::settingsWidget() { FileStorageSettingsWidget *w = new FileStorageSettingsWidget( QSettings().value(QString("storage.%1.path").arg(systemName())).toString(), this); connect(w, SIGNAL(apply()), SLOT(settingsApplied())); return w; }
void SettingsMenu::on_applyButton_clicked() { ui->appearance->updateSyntaxStyle(); ui->appearance->on_saveStyleSheet_clicked(); Settings::set("TextEditor/Font", ui->appearance->mFont.family()); Settings::set("TextEditor/FontSize", ui->appearance->mFont.pointSize()); Settings::sync(); emit settingsApplied(); }
void QgsGlobePluginDialog::apply() { QgsSettings settings; // Video settings settings.setValue( "/Plugin-Globe/stereoMode", comboBoxStereoMode->currentText() ); settings.setValue( "/Plugin-Globe/stereoScreenDistance", spinBoxStereoScreenDistance->value() ); settings.setValue( "/Plugin-Globe/stereoScreenWidth", spinBoxStereoScreenWidth->value() ); settings.setValue( "/Plugin-Globe/stereoScreenHeight", spinBoxStereoScreenHeight->value() ); settings.setValue( "/Plugin-Globe/stereoEyeSeparation", spinBoxStereoEyeSeparation->value() ); settings.setValue( "/Plugin-Globe/SplitStereoHorizontalSeparation", spinBoxSplitStereoHorizontalSeparation->value() ); settings.setValue( "/Plugin-Globe/SplitStereoVerticalSeparation", spinBoxSplitStereoVerticalSeparation->value() ); settings.setValue( "/Plugin-Globe/SplitStereoHorizontalEyeMapping", comboBoxSplitStereoHorizontalEyeMapping->currentIndex() ); settings.setValue( "/Plugin-Globe/SplitStereoVerticalEyeMapping", comboBoxSplitStereoVerticalEyeMapping->currentIndex() ); settings.setValue( "/Plugin-Globe/anti-aliasing", groupBoxAntiAliasing->isChecked() ); settings.setValue( "/Plugin-Globe/anti-aliasing-level", lineEditAASamples->text() ); // Advanced settings settings.setValue( "/Plugin-Globe/scrollSensitivity", sliderScrollSensitivity->value() ); settings.setValue( "/Plugin-Globe/invertScrollWheel", checkBoxInvertScroll->checkState() ); settings.setValue( "/Plugin-Globe/frustum-highlighting", checkBoxFrustumHighlighting->isChecked() ); settings.setValue( "/Plugin-Globe/feature-identification", checkBoxFeatureIdentification->isChecked() ); writeProjectSettings(); // Apply stereo settings int stereoMode = comboBoxStereoMode->currentData().toInt(); if ( stereoMode == -1 ) { osg::DisplaySettings::instance()->setStereo( false ); } else { osg::DisplaySettings::instance()->setStereo( true ); osg::DisplaySettings::instance()->setStereoMode( static_cast<osg::DisplaySettings::StereoMode>( stereoMode ) ); osg::DisplaySettings::instance()->setEyeSeparation( spinBoxStereoEyeSeparation->value() ); osg::DisplaySettings::instance()->setScreenDistance( spinBoxStereoScreenDistance->value() ); osg::DisplaySettings::instance()->setScreenWidth( spinBoxStereoScreenWidth->value() ); osg::DisplaySettings::instance()->setScreenHeight( spinBoxStereoScreenHeight->value() ); osg::DisplaySettings::instance()->setSplitStereoVerticalSeparation( spinBoxSplitStereoVerticalSeparation->value() ); osg::DisplaySettings::instance()->setSplitStereoVerticalEyeMapping( static_cast<osg::DisplaySettings::SplitStereoVerticalEyeMapping>( comboBoxSplitStereoVerticalEyeMapping->currentIndex() ) ); osg::DisplaySettings::instance()->setSplitStereoHorizontalSeparation( spinBoxSplitStereoHorizontalSeparation->value() ); osg::DisplaySettings::instance()->setSplitStereoHorizontalEyeMapping( static_cast<osg::DisplaySettings::SplitStereoHorizontalEyeMapping>( comboBoxSplitStereoHorizontalEyeMapping->currentIndex() ) ); } emit settingsApplied(); }
void GlobePlugin::initGui() { mSettingsDialog = new QgsGlobePluginDialog( mQGisIface->mainWindow(), QgisGui::ModalDialogFlags ); connect( mSettingsDialog, SIGNAL( settingsApplied() ), this, SLOT( applySettings() ) ); mActionToggleGlobe = new QAction( QIcon( ":/globe/globe.png" ), tr( "Launch Globe" ), this ); mActionToggleGlobe->setCheckable( true ); mQGisIface->addToolBarIcon( mActionToggleGlobe ); mQGisIface->addPluginToMenu( tr( "&Globe" ), mActionToggleGlobe ); mLayerPropertiesFactory = new QgsGlobeLayerPropertiesFactory( this ); mQGisIface->registerMapLayerPropertiesFactory( mLayerPropertiesFactory ); connect( mActionToggleGlobe, SIGNAL( triggered( bool ) ), this, SLOT( setGlobeEnabled( bool ) ) ); // connect( mQGisIface->mapCanvas(), SIGNAL( annotationItemChanged( QgsAnnotationItem* ) ), this, SLOT( updateAnnotationItem( QgsAnnotationItem* ) ) ); connect( QgsProject::instance()->billboardRegistry(), SIGNAL( itemAdded( QgsBillBoardItem* ) ), this, SLOT( addBillboard( QgsBillBoardItem* ) ) ); connect( QgsProject::instance()->billboardRegistry(), SIGNAL( itemRemoved( QgsBillBoardItem* ) ), this, SLOT( removeBillboard( QgsBillBoardItem* ) ) ); connect( mLayerPropertiesFactory, SIGNAL( layerSettingsChanged( QgsMapLayer* ) ), this, SLOT( layerChanged( QgsMapLayer* ) ) ); connect( this, SIGNAL( xyCoordinates( const QgsPoint & ) ), mQGisIface->mapCanvas(), SIGNAL( xyCoordinates( const QgsPoint & ) ) ); connect( mQGisIface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), kwp(this), appSettings(new QSettings("vagblocks.ini", QSettings::IniFormat, this)), serialConfigured(false), storedRow(-1), storedCol(-1), currentlyLogging(false) { /* QFile roboto(":/resources/Roboto-Regular.ttf"); roboto.open(QIODevice::ReadOnly); if (QFontDatabase::addApplicationFontFromData(roboto.readAll()) < 0) { // error } roboto.close(); */ ui->setupUi(this); QString svnRev = APP_SVN_REV; int colonAt = svnRev.indexOf(":"); if (colonAt > 0) { svnRev = svnRev.mid(colonAt+1); } QString appVer = APP_VERSION; aboutDialog = new about(appVer, svnRev, this); serSettings = new serialSettingsDialog(this); settingsDialog = new settings(appSettings, this); connect(ui->action_About, SIGNAL(triggered()), aboutDialog, SLOT(show())); connect(ui->actionApplication_settings, SIGNAL(triggered()), settingsDialog, SLOT(show())); setupBlockArray(ui->blocksLayout); connect(&kwp, SIGNAL(log(QString, int)), this, SLOT(log(QString, int))); connect(&kwp, SIGNAL(newBlockData(int)), this, SLOT(newBlockData(int))); connect(&kwp, SIGNAL(blockOpen(int)), this, SLOT(blockOpen(int))); connect(&kwp, SIGNAL(blockClosed(int)), this, SLOT(blockClosed(int))); connect(&kwp, SIGNAL(channelOpen(bool)), this, SLOT(channelOpen(bool))); connect(&kwp, SIGNAL(elmInitialised(bool)), this, SLOT(elmInitialised(bool))); connect(&kwp, SIGNAL(portOpened(bool)), this, SLOT(portOpened(bool))); connect(&kwp, SIGNAL(portClosed()), this, SLOT(portClosed())); connect(&kwp, SIGNAL(newModuleInfo(QStringList)), this, SLOT(moduleInfoReceived(QStringList))); connect(&kwp, SIGNAL(newEcuInfo(QStringList)), this, SLOT(ecuInfoReceived(QStringList))); connect(ui->pushButton_log, SIGNAL(clicked(bool)), this, SLOT(startLogging(bool))); connect(&kwp, SIGNAL(labelsLoaded(bool)), this, SLOT(labelsLoaded(bool))); connect(ui->lineEdit_moduleNum, SIGNAL(textChanged(QString)), this, SLOT(clearUI())); connect(ui->comboBox_modules, SIGNAL(activated(int)), this, SLOT(selectNewModule(int))); connect(&kwp, SIGNAL(moduleListRefreshed()), this, SLOT(refreshModules())); connect(ui->pushButton_refresh, SIGNAL(clicked()), &kwp, SLOT(openGW_refresh())); connect(&kwp, SIGNAL(sampleFormatChanged()), this, SLOT(sampleFormatChanged())); connect(&kwp, SIGNAL(loggingStarted()), this, SLOT(loggingStarted())); connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(updateSettings())); for (int i = 0; i < 16; i++) { // setup running average for sample rate avgList.append(0); } restoreSettings(); if (serialConfigured) { kwp.setSerialParams(serSettings->getSettings()); QMetaObject::invokeMethod(&kwp, "openPort", Qt::QueuedConnection); } connect(serSettings, SIGNAL(settingsApplied()), this, SLOT(connectToSerial())); refreshModules(true); }
void NfcPeerToPeer::doApplySettings() { if (!(m_isResetting && m_isBusy) || !m_appSettings) { // Allow running this method only if called through applySettings(). // Also, don't run this method if m_appSettings isn't set. return; } // This setting doesn't need any restarting of services, // so can always be copied from the settings object // to the currently used config. m_sendThroughServerSocket = m_appSettings->sendThroughServerSocket(); // Now check for individual changes that affect the // communication and in most cases requires restarting services. if (m_appSettings->useConnectionLess() != m_useConnectionLess) { // Switched between connection-oriented and connection-less mode m_useConnectionLess = m_appSettings->useConnectionLess(); // Close all current connections resetAll(); // Start services again initAndStartNfc(); } else if (m_useConnectionLess && m_appSettings->nfcPort() != m_nfcPort) { // Connection-less mode // Changed port m_nfcPort = m_appSettings->nfcPort(); // Close all current connections resetAll(); // Start services again initAndStartNfc(); } else if (!m_useConnectionLess) { // Connection-oriented mode bool restartOrShutdownServer = false; bool restartOrShutdownClient = false; // Connection-oriented: check if URI changed if (m_appSettings->nfcUri() != QString(m_nfcUri)) { // New URI - restart socket server copyNfcUriFromAppSettings(); restartOrShutdownServer = true; restartOrShutdownClient = true; } if (m_appSettings->connectClientSocket() != m_connectClientSocket) { m_connectClientSocket = m_appSettings->connectClientSocket(); restartOrShutdownClient = true; } if (m_appSettings->connectServerSocket() != m_connectServerSocket) { m_connectServerSocket = m_appSettings->connectServerSocket(); restartOrShutdownServer = true; } if (restartOrShutdownServer || restartOrShutdownClient) { // We could also differentiate here which socket to // re-establish, based on the two boolean variables. // But for now, just reset everything. // Close all current connections resetAll(); // Start services again initAndStartNfc(); } } m_isResetting = false; m_isBusy = false; emit busyChanged(); emit settingsApplied(); }