void PreferencesDialog::buttonClicked(QAbstractButton* button) { switch(ui.buttonBox->standardButton(button)){ case QDialogButtonBox::Discard: restorePrefs(); close(); break; case QDialogButtonBox::Apply: syncSettings(); break; case QDialogButtonBox::FirstButton: syncSettings(); close(); break; default: break; // ignore warnings. } }
void OverhangTerrainPagedWorldSection::init( OverhangTerrainGroup * otg ) { if (_pOhGrp == otg) return; delete _pOhGrp; _pOhGrp = otg; _pOhGrp->setOverhangTerrainPagedWorldSection(this); syncSettings(); }
//--------------------------------------------------------------------- void TerrainPagedWorldSection::loadSubtypeData(StreamSerialiser& ser) { // we load the TerrainGroup information from here if (!mTerrainGroup) mTerrainGroup = OGRE_NEW TerrainGroup(getSceneManager()); mTerrainGroup->loadGroupDefinition(ser); // params that are in the Grid2DStrategyData will have already been loaded // as part of the main load() routine syncSettings(); }
//--------------------------------------------------------------------- void TerrainPagedWorldSection::init(TerrainGroup* grp) { if (mTerrainGroup == grp) return; if (mTerrainGroup) OGRE_DELETE mTerrainGroup; mTerrainGroup = grp; syncSettings(); // Unload all existing terrain pages, because we want the paging system // to be in charge of this mTerrainGroup->removeAllTerrains(); }
Sky::Sky(Arena &arena, const Map &map, const SkyInit &initializer) : Subsystem(arena), Networked(initializer), map(map), physics(map, *this), settings(initializer.settings) { arena.forPlayers([&](Player &player) { const auto iter = initializer.participations.find(player.pid); registerPlayerWith( player, (iter == initializer.participations.end()) ? ParticipationInit{} : iter->second); }); syncSettings(); appLog("Instantiated Sky.", LogOrigin::Engine); }
QtMarbleConfigDialog::QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *cloudSyncManager, QWidget *parent ) : QDialog( parent ), d( new QtMarbleConfigDialogPrivate( marbleWidget, cloudSyncManager ) ) { QTabWidget *tabWidget = new QTabWidget( this ); QDialogButtonBox *buttons = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel, Qt::Horizontal, this ); // Connect the signals of the ButtonBox // to the corresponding slots of the dialog. connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) ); // Ok connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) ); // Cancel connect( buttons->button( QDialogButtonBox::Apply ),SIGNAL(clicked()), this, SLOT(writeSettings()) ); // Apply // If the dialog is accepted. Save the settings. connect( this, SIGNAL(accepted()), this, SLOT(writeSettings()) ); // view page QWidget *w_viewSettings = new QWidget( this ); d->ui_viewSettings.setupUi( w_viewSettings ); tabWidget->addTab( w_viewSettings, tr( "View" ) ); // It's experimental -- so we remove it for now. // FIXME: Delete the following line once OpenGL support is officially supported. d->ui_viewSettings.kcfg_graphicsSystem->removeItem( Marble::OpenGLGraphics ); QString nativeString ( tr("Native") ); #ifdef Q_WS_X11 nativeString = tr( "Native (X11)" ); #endif #ifdef Q_WS_MAC nativeString = tr( "Native (Mac OS X Core Graphics)" ); #endif d->ui_viewSettings.kcfg_graphicsSystem->setItemText( Marble::NativeGraphics, nativeString ); d->ui_viewSettings.kcfg_labelLocalization->hide(); d->ui_viewSettings.label_labelLocalization->hide(); // navigation page QWidget *w_navigationSettings = new QWidget( this ); d->ui_navigationSettings.setupUi( w_navigationSettings ); tabWidget->addTab( w_navigationSettings, tr( "Navigation" ) ); d->ui_navigationSettings.kcfg_dragLocation->hide(); d->ui_navigationSettings.label_dragLocation->hide(); // cache page QWidget *w_cacheSettings = new QWidget( this ); d->ui_cacheSettings.setupUi( w_cacheSettings ); tabWidget->addTab( w_cacheSettings, tr( "Cache and Proxy" ) ); // Forwarding clear button signals connect( d->ui_cacheSettings.button_clearVolatileCache, SIGNAL(clicked()), SIGNAL(clearVolatileCacheClicked()) ); connect( d->ui_cacheSettings.button_clearPersistentCache, SIGNAL(clicked()), SIGNAL(clearPersistentCacheClicked()) ); // time page QWidget *w_timeSettings = new QWidget( this ); d->ui_timeSettings.setupUi( w_timeSettings ); tabWidget->addTab( w_timeSettings, tr( "Date and Time" ) ); // routing page QWidget *w_routingSettings = new RoutingProfilesWidget( marbleWidget->model() ); tabWidget->addTab( w_routingSettings, tr( "Routing" ) ); // plugin page d->m_pluginModel.setRenderPlugins( d->m_marbleWidget->renderPlugins() ); d->w_pluginSettings = new MarblePluginSettingsWidget( this ); d->w_pluginSettings->setModel( &d->m_pluginModel ); d->w_pluginSettings->setObjectName( "plugin_page" ); tabWidget->addTab( d->w_pluginSettings, tr( "Plugins" ) ); // Setting the icons for the plugin dialog. d->w_pluginSettings->setAboutIcon( QIcon(":/icons/help-about.png") ); d->w_pluginSettings->setConfigIcon( QIcon(":/icons/settings-configure.png") ); connect( this, SIGNAL(rejected()), &d->m_pluginModel, SLOT(retrievePluginState()) ); connect( this, SIGNAL(accepted()), &d->m_pluginModel, SLOT(applyPluginState()) ); QWidget *w_cloudSyncSettings = new QWidget( this ); d->ui_cloudSyncSettings.setupUi( w_cloudSyncSettings ); tabWidget->addTab( w_cloudSyncSettings, tr( "Synchronization" ) ); d->ui_cloudSyncSettings.button_syncNow->setEnabled( syncBookmarks() ); d->m_cloudSyncStatusLabel = d->ui_cloudSyncSettings.cloudSyncStatus; connect( d->ui_cloudSyncSettings.button_syncNow, SIGNAL(clicked()), SIGNAL(syncNowClicked()) ); connect( d->ui_cloudSyncSettings.testLoginButton, SIGNAL(clicked()), this, SLOT(updateCloudSyncCredentials()) ); if ( d->m_syncManager ) { connect(d->m_syncManager, SIGNAL(syncComplete()), this, SLOT(updateLastSync())); updateLastSync(); } if ( d->m_cloudSyncManager ) { connect( d->m_cloudSyncManager, SIGNAL(statusChanged(QString)), this, SLOT(updateCloudSyncStatus(QString))); } // Layout QVBoxLayout *layout = new QVBoxLayout( this ); layout->addWidget( tabWidget ); layout->addWidget( buttons ); this->setLayout( layout ); // When the settings have been changed, write to disk. connect( this, SIGNAL(settingsChanged()), this, SLOT(syncSettings()) ); initializeCustomTimezone(); }
void QtMarbleConfigDialog::writeSettings() { syncSettings(); // Determining the graphicsSystemString QString graphicsSystemString; switch ( d->ui_viewSettings.kcfg_graphicsSystem->currentIndex() ) { case Marble::RasterGraphics : graphicsSystemString = "raster"; break; case Marble::OpenGLGraphics : graphicsSystemString = "opengl"; break; default: case Marble::NativeGraphics : graphicsSystemString = "native"; break; } d->m_settings.beginGroup( "View" ); d->m_settings.setValue( "distanceUnit", d->ui_viewSettings.kcfg_distanceUnit->currentIndex() ); d->m_settings.setValue( "angleUnit", d->ui_viewSettings.kcfg_angleUnit->currentIndex() ); d->m_settings.setValue( "stillQuality", d->ui_viewSettings.kcfg_stillQuality->currentIndex() ); d->m_settings.setValue( "animationQuality", d->ui_viewSettings.kcfg_animationQuality->currentIndex() ); d->m_settings.setValue( "mapFont", d->ui_viewSettings.kcfg_mapFont->currentFont() ); d->m_settings.setValue( "graphicsSystem", graphicsSystemString ); d->m_settings.endGroup(); d->m_settings.beginGroup( "Navigation" ); d->m_settings.setValue( "onStartup", d->ui_navigationSettings.kcfg_onStartup->currentIndex() ); d->m_settings.setValue( "inertialEarthRotation", d->ui_navigationSettings.kcfg_inertialEarthRotation->isChecked() ); d->m_settings.setValue( "animateTargetVoyage", d->ui_navigationSettings.kcfg_animateTargetVoyage->isChecked() ); if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 0 ) { d->m_settings.setValue( "externalMapEditor", "" ); } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 1 ) { d->m_settings.setValue( "externalMapEditor", "potlatch" ); } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 2 ) { d->m_settings.setValue( "externalMapEditor", "josm" ); } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 3 ) { d->m_settings.setValue( "externalMapEditor", "merkaartor" ); } else { Q_ASSERT( false && "Unexpected index of the external editor setting" ); } d->m_settings.endGroup(); d->m_settings.beginGroup( "Cache" ); d->m_settings.setValue( "volatileTileCacheLimit", d->ui_cacheSettings.kcfg_volatileTileCacheLimit->value() ); d->m_settings.setValue( "persistentTileCacheLimit", d->ui_cacheSettings.kcfg_persistentTileCacheLimit->value() ); d->m_settings.setValue( "proxyUrl", d->ui_cacheSettings.kcfg_proxyUrl->text() ); d->m_settings.setValue( "proxyPort", d->ui_cacheSettings.kcfg_proxyPort->value() ); d->m_settings.setValue( "proxyType", d->ui_cacheSettings.kcfg_proxyType->currentIndex() ); if ( d->ui_cacheSettings.kcfg_proxyAuth->isChecked() ) { d->m_settings.setValue( "proxyAuth", true ); d->m_settings.setValue( "proxyUser", d->ui_cacheSettings.kcfg_proxyUser->text() ); d->m_settings.setValue( "proxyPass", d->ui_cacheSettings.kcfg_proxyPass->text() ); } else { d->m_settings.setValue( "proxyAuth", false ); } d->m_settings.endGroup(); d->m_settings.beginGroup( "Time" ); d->m_settings.setValue( "systemTimezone", d->ui_timeSettings.kcfg_systemTimezone->isChecked() ); d->m_settings.setValue( "UTC", d->ui_timeSettings.kcfg_utc->isChecked() ); d->m_settings.setValue( "customTimezone", d->ui_timeSettings.kcfg_customTimezone->isChecked() ); d->m_settings.setValue( "systemTime", d->ui_timeSettings.kcfg_systemTime->isChecked() ); d->m_settings.setValue( "lastSessionTime", d->ui_timeSettings.kcfg_lastSessionTime->isChecked() ); d->m_settings.setValue( "chosenTimezone", d->ui_timeSettings.kcfg_chosenTimezone->currentIndex() ); d->m_settings.endGroup(); d->m_settings.beginGroup( "CloudSync" ); d->m_settings.setValue( "enableSync", d->ui_cloudSyncSettings.kcfg_enableSync->isChecked() ); d->m_settings.setValue( "syncBackend", "owncloud" ); d->m_settings.setValue( "syncBookmarks", d->ui_cloudSyncSettings.kcfg_syncBookmarks->isChecked() ); d->m_settings.setValue( "syncRoutes", d->ui_cloudSyncSettings.kcfg_syncRoutes->isChecked() ); d->m_settings.setValue( "owncloudServer", d->ui_cloudSyncSettings.kcfg_owncloudServer->text() ); d->m_settings.setValue( "owncloudUsername", d->ui_cloudSyncSettings.kcfg_owncloudUsername->text() ); d->m_settings.setValue( "owncloudPassword", d->ui_cloudSyncSettings.kcfg_owncloudPassword->text() ); d->m_settings.endGroup(); // Plugins d->m_marbleWidget->writePluginSettings( d->m_settings ); emit settingsChanged(); if ( d->m_initialGraphicsSystem != graphicsSystem() && d->m_previousGraphicsSystem != graphicsSystem() ) { QMessageBox::information (this, tr("Graphics System Change"), tr("You have decided to run Marble with a different graphics system.\n" "For this change to become effective, Marble has to be restarted.\n" "Please close the application and start Marble again.") ); } d->m_previousGraphicsSystem = graphicsSystem(); }
void QtMarbleConfigDialog::readSettings() { d->m_initialGraphicsSystem = graphicsSystem(); d->m_previousGraphicsSystem = d->m_initialGraphicsSystem; // Sync settings to make sure that we read the current settings. syncSettings(); // View d->ui_viewSettings.kcfg_distanceUnit->setCurrentIndex( measurementSystem() ); d->ui_viewSettings.kcfg_angleUnit->setCurrentIndex( angleUnit() ); d->ui_viewSettings.kcfg_stillQuality->setCurrentIndex( stillQuality() ); d->ui_viewSettings.kcfg_animationQuality->setCurrentIndex( animationQuality() ); d->ui_viewSettings.kcfg_labelLocalization->setCurrentIndex( Marble::Native ); d->ui_viewSettings.kcfg_mapFont->setCurrentFont( mapFont() ); d->ui_viewSettings.kcfg_graphicsSystem->setCurrentIndex( graphicsSystem() ); // Navigation d->ui_navigationSettings.kcfg_dragLocation->setCurrentIndex( Marble::KeepAxisVertically ); d->ui_navigationSettings.kcfg_onStartup->setCurrentIndex( onStartup() ); d->ui_navigationSettings.kcfg_inertialEarthRotation->setChecked( inertialEarthRotation() ); d->ui_navigationSettings.kcfg_animateTargetVoyage->setChecked( animateTargetVoyage() ); int editorIndex = 0; if ( externalMapEditor() == "potlatch") { editorIndex = 1; } else if ( externalMapEditor() == "josm") { editorIndex = 2; } else if ( externalMapEditor() == "merkaartor") { editorIndex = 3; } d->ui_navigationSettings.kcfg_externalMapEditor->setCurrentIndex( editorIndex ); // Cache d->ui_cacheSettings.kcfg_volatileTileCacheLimit->setValue( volatileTileCacheLimit() ); d->ui_cacheSettings.kcfg_persistentTileCacheLimit->setValue( persistentTileCacheLimit() ); d->ui_cacheSettings.kcfg_proxyUrl->setText( proxyUrl() ); d->ui_cacheSettings.kcfg_proxyPort->setValue( proxyPort() ); d->ui_cacheSettings.kcfg_proxyUser->setText( proxyUser() ); d->ui_cacheSettings.kcfg_proxyPass->setText( proxyPass() ); d->ui_cacheSettings.kcfg_proxyType->setCurrentIndex( proxyType() ); d->ui_cacheSettings.kcfg_proxyAuth->setChecked( proxyAuth() ); // Time d->ui_timeSettings.kcfg_systemTimezone->setChecked( systemTimezone() ); d->ui_timeSettings.kcfg_customTimezone->setChecked( customTimezone() ); d->ui_timeSettings.kcfg_chosenTimezone->setCurrentIndex( chosenTimezone() ); d->ui_timeSettings.kcfg_utc->setChecked( UTC() ); d->ui_timeSettings.kcfg_systemTime->setChecked( systemTime() ); d->ui_timeSettings.kcfg_lastSessionTime->setChecked( lastSessionTime() ); if( systemTimezone() == true ) { QDateTime localTime = QDateTime::currentDateTime().toLocalTime(); localTime.setTimeSpec( Qt::UTC ); d->m_marbleWidget->model()->setClockTimezone( QDateTime::currentDateTime().toUTC().secsTo( localTime ) ); } else if( UTC() == true ) { d->m_marbleWidget->model()->setClockTimezone( 0 ); } else if( customTimezone() == true ) { d->m_marbleWidget->model()->setClockTimezone( d->m_timezone.value( chosenTimezone() ) ); } // Routing // ownCloud d->ui_cloudSyncSettings.kcfg_enableSync->setChecked( syncEnabled() ); d->ui_cloudSyncSettings.kcfg_syncBookmarks->setChecked( syncBookmarks() ); d->ui_cloudSyncSettings.kcfg_syncRoutes->setChecked( syncRoutes() ); d->ui_cloudSyncSettings.kcfg_owncloudServer->setText( owncloudServer() ); d->ui_cloudSyncSettings.kcfg_owncloudUsername->setText( owncloudUsername() ); d->ui_cloudSyncSettings.kcfg_owncloudPassword->setText( owncloudPassword() ); // Read the settings of the plugins d->m_marbleWidget->readPluginSettings( d->m_settings ); // The settings loaded in the config dialog have been changed. emit settingsChanged(); }
void Sky::changeSettings(const SkySettingsDelta &delta) { settings.applyDelta(delta); syncSettings(); }