void SatellitesPlugin::initialize() { // FIXME: remove the const_cast, it may be best to create a new type of // plugins where marbleModel() is not const, since traditional // RenderPlugins do not require that m_satModel = new SatellitesModel( const_cast<MarbleModel *>( marbleModel() )->treeModel(), marbleModel()->clock() ); m_configModel = new SatellitesConfigModel( this ); m_configDialog->configWidget()->treeView->setModel( m_configModel ); connect( m_satModel, SIGNAL(fileParsed(QString)), SLOT(dataSourceParsed(QString)) ); connect( m_satModel, SIGNAL(fileParsed(QString)), SLOT(updateDataSourceConfig(QString)) ); connect( m_configDialog, SIGNAL(dataSourcesReloadRequested()), SLOT(updateSettings()) ); connect( m_configDialog, SIGNAL(accepted()), SLOT(writeSettings()) ); connect( m_configDialog, SIGNAL(rejected()), SLOT(readSettings()) ); connect( m_configDialog->configWidget()->buttonBox->button( QDialogButtonBox::Reset ), SIGNAL(clicked()), SLOT(restoreDefaultSettings()) ); connect( m_configDialog, SIGNAL(userDataSourcesChanged()), SLOT(writeSettings()) ); connect( m_configDialog, SIGNAL(userDataSourceAdded(QString)), SLOT(userDataSourceAdded(QString)) ); m_isInitialized = true; readSettings(); updateSettings(); enableModel( enabled() ); }
QDialog *GraticulePlugin::configDialog() { if ( !m_configDialog ) { m_configDialog = new QDialog(); ui_configWidget = new Ui::GraticuleConfigWidget; ui_configWidget->setupUi( m_configDialog ); connect( ui_configWidget->gridPushButton, SIGNAL(clicked()), this, SLOT(gridGetColor()) ); connect( ui_configWidget->tropicsPushButton, SIGNAL(clicked()), this, SLOT(tropicsGetColor()) ); connect( ui_configWidget->equatorPushButton, SIGNAL(clicked()), this, SLOT(equatorGetColor()) ); connect( ui_configWidget->m_buttonBox, SIGNAL(accepted()), this, SLOT(writeSettings()) ); connect( ui_configWidget->m_buttonBox->button( QDialogButtonBox::Reset ), SIGNAL(clicked()), SLOT(restoreDefaultSettings()) ); QPushButton *applyButton = ui_configWidget->m_buttonBox->button( QDialogButtonBox::Apply ); connect( applyButton, SIGNAL(clicked()), this, SLOT(writeSettings()) ); } readSettings(); return m_configDialog; }
QDialog *EarthquakePlugin::configDialog() { if ( !m_configDialog ) { // Initializing configuration dialog m_configDialog = new QDialog(); m_ui = new Ui::EarthquakeConfigWidget; m_ui->setupUi( m_configDialog ); m_ui->m_numResults->setRange( 1, m_maximumNumberOfItems ); readSettings(); connect( m_ui->m_buttonBox, SIGNAL(accepted()), SLOT(writeSettings()) ); connect( m_ui->m_buttonBox, SIGNAL(rejected()), SLOT(readSettings()) ); connect( m_ui->m_buttonBox->button( QDialogButtonBox::Reset ), SIGNAL(clicked()), SLOT(restoreDefaultSettings()) ); QPushButton *applyButton = m_ui->m_buttonBox->button( QDialogButtonBox::Apply ); connect( applyButton, SIGNAL(clicked()), SLOT(writeSettings()) ); connect( m_ui->m_endDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(validateDateRange()) ); connect( this, SIGNAL(settingsChanged(QString)), this, SLOT(readSettings()) ); } return m_configDialog; }
QDialog *OverviewMap::configDialog() { if ( !m_configDialog ) { // Initializing configuration dialog m_configDialog = new QDialog(); ui_configWidget = new Ui::OverviewMapConfigWidget; ui_configWidget->setupUi( m_configDialog ); for( int i = 0; i < m_planetID.size(); ++i ) { ui_configWidget->m_planetComboBox->addItem( Planet::name(m_planetID.value( i ) ) ); } ui_configWidget->m_planetComboBox->setCurrentIndex( 2 ); readSettings(); loadMapSuggestions(); connect( ui_configWidget->m_buttonBox, SIGNAL(accepted()), SLOT(writeSettings()) ); connect( ui_configWidget->m_buttonBox, SIGNAL(rejected()), SLOT(readSettings()) ); connect( ui_configWidget->m_buttonBox->button( QDialogButtonBox::Reset ), SIGNAL(clicked()), SLOT(restoreDefaultSettings()) ); QPushButton *applyButton = ui_configWidget->m_buttonBox->button( QDialogButtonBox::Apply ); connect( applyButton, SIGNAL(clicked()), SLOT(writeSettings()) ); connect( ui_configWidget->m_fileChooserButton, SIGNAL(clicked()), SLOT(chooseCustomMap()) ); connect( ui_configWidget->m_widthBox, SIGNAL(valueChanged(int)), SLOT(synchronizeSpinboxes()) ); connect( ui_configWidget->m_heightBox, SIGNAL(valueChanged(int)), SLOT(synchronizeSpinboxes()) ); connect( ui_configWidget->m_planetComboBox, SIGNAL(currentIndexChanged(int)), SLOT(showCurrentPlanetPreview()) ); connect( ui_configWidget->m_colorChooserButton, SIGNAL(clicked()), SLOT(choosePositionIndicatorColor()) ); connect( ui_configWidget->m_tableWidget, SIGNAL(cellClicked(int,int)), SLOT(useMapSuggestion(int)) ); }
int restoreSettings( void ) { struct settingsStruct settingsTmp; memset(&settingsTmp, 0, sizeof(settingsTmp)); if( flash_read_page(FLASH_PART_SETTINGS, &settingsTmp, sizeof(settingsTmp)) != 0 ) return -1; // sprawdzamy czy ustawienia sa poprawne, jezeli nie to przywracamy domyslne if( settingsTmp.settings_crc != SETTINGS_CRC_DEFAULT && settingsTmp.settings_crc != SETTINGS_CRC_SAVED ) { int ret = restoreDefaultSettings(); if( ret == 0 ) return 1; else return ret; } memcpy(&_settings, &settingsTmp, sizeof(_settings)); // test /*int ok = 0; if( _settings.measInterval == _settingsDefault.measInterval ) ok = 1; else ok = 2;*/ // \test return 0; }
void RemoteControlDialog::createDialogContent() { rc = GETSTELMODULE(RemoteControl); ui->setupUi(dialog); // Kinetic scrolling kineticScrollingList << ui->aboutTextBrowser; StelGui* gui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); if (gui) { enableKineticScrolling(gui->getFlagUseKineticScrolling()); connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool))); } connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); // TODO Fill other buttons connectCheckBox(ui->enabledCheckbox,"actionShow_Remote_Control"); connect(ui->enabledCheckbox, SIGNAL(clicked(bool)), this, SLOT(updateIPlabel(bool))); updateIPlabel(ui->enabledCheckbox->isChecked()); ui->activateOnStartCheckBox->setChecked(rc->getFlagAutoStart()); connect(ui->activateOnStartCheckBox, SIGNAL(toggled(bool)), rc, SLOT(setFlagAutoStart(bool))); connect(rc, SIGNAL(flagAutoStartChanged(bool)), ui->activateOnStartCheckBox, SLOT(setChecked(bool))); ui->passwordCheckBox->setChecked(rc->getFlagUsePassword()); connect(ui->passwordCheckBox, SIGNAL(toggled(bool)), rc, SLOT(setFlagUsePassword(bool))); connect(rc, SIGNAL(flagUsePasswordChanged(bool)), ui->passwordCheckBox, SLOT(setChecked(bool))); ui->passwordEdit->setEnabled(rc->getFlagUsePassword()); ui->passwordEdit->setText(rc->getPassword()); connect(rc,SIGNAL(flagUsePasswordChanged(bool)),ui->passwordEdit,SLOT(setEnabled(bool))); connect(ui->passwordEdit, SIGNAL(textChanged(QString)), rc, SLOT(setPassword(QString))); ui->portNumberSpinBox->setValue(rc->getPort()); connect(ui->portNumberSpinBox, SIGNAL(valueChanged(int)), rc, SLOT(setPort(int))); ui->restartPanel->setVisible(false); connect(rc, SIGNAL(flagUsePasswordChanged(bool)), this, SLOT(requiresRestart())); connect(rc, SIGNAL(passwordChanged(QString)), this, SLOT(requiresRestart())); connect(rc, SIGNAL(portChanged(int)), this, SLOT(requiresRestart())); connect(ui->resetButton, SIGNAL(clicked(bool)),this,SLOT(restart())); connect(ui->saveSettingsButton, SIGNAL(clicked()), rc, SLOT(saveSettings())); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), rc, SLOT(restoreDefaultSettings())); setAboutHtml(); }
void KrView::init() { // sanity checks: if (!_widget) qFatal("_widget must be set during construction of KrView inheritors"); // ok, continue initProperties(); _operator = createOperator(); setup(); restoreDefaultSettings(); KConfigGroup grp(_config, _instance.name()); enableUpdateDefaultSettings(true); _instance.m_objects.append(this); }
OverviewMap::OverviewMap( const MarbleModel *marbleModel ) : AbstractFloatItem( marbleModel, QPointF( 10.5, 10.5 ), QSizeF( 166.0, 86.0 ) ), m_target(), m_planetID( Planet::planetList() ), m_defaultSize( AbstractFloatItem::size() ), ui_configWidget( 0 ), m_configDialog( 0 ), m_mapChanged( false ) { // cache is no needed because: // (1) the SVG overview map is already rendered and stored in m_worldmap pixmap // (2) bounding box and location dot keep changing during navigation setCacheMode( NoCache ); connect( this, SIGNAL(settingsChanged(QString)), this, SLOT(updateSettings()) ); restoreDefaultSettings(); }
void AngleMeasure::init() { if (!conf->childGroups().contains("AngleMeasure")) restoreDefaultSettings(); loadSettings(); startPoint.set(0.,0.,0.); endPoint.set(0.,0.,0.); perp1StartPoint.set(0.,0.,0.); perp1EndPoint.set(0.,0.,0.); perp2StartPoint.set(0.,0.,0.); perp2EndPoint.set(0.,0.,0.); StelApp& app = StelApp::getInstance(); // Create action for enable/disable & hook up signals addAction("actionShow_Angle_Measure", N_("Angle Measure"), N_("Angle measure"), "enabled", "Ctrl+A"); // Initialize the message strings and make sure they are translated when // the language changes. updateMessageText(); connect(&app, SIGNAL(languageChanged()), this, SLOT(updateMessageText())); // Add a toolbar button try { StelGui* gui = dynamic_cast<StelGui*>(app.getGui()); if (gui!=NULL) { toolbarButton = new StelButton(NULL, QPixmap(":/angleMeasure/bt_anglemeasure_on.png"), QPixmap(":/angleMeasure/bt_anglemeasure_off.png"), QPixmap(":/graphicGui/glow32x32.png"), "actionShow_Angle_Measure"); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup"); } } catch (std::runtime_error& e) { qWarning() << "WARNING: unable create toolbar button for AngleMeasure plugin: " << e.what(); } }
QDialog *OpenCachingPlugin::configDialog() { if ( !m_configDialog ) { // Initializing configuration dialog m_configDialog = new QDialog(); m_ui = new Ui::OpenCachingConfigWidget; m_ui->setupUi( m_configDialog ); readSettings(); connect( m_ui->m_buttonBox, SIGNAL(accepted()), SLOT(writeSettings()) ); connect( m_ui->m_buttonBox, SIGNAL(rejected()), SLOT(readSettings()) ); connect( m_ui->m_buttonBox->button( QDialogButtonBox::Reset ), SIGNAL(clicked()), SLOT(restoreDefaultSettings()) ); QPushButton *applyButton = m_ui->m_buttonBox->button( QDialogButtonBox::Apply ); connect( applyButton, SIGNAL(clicked()), SLOT(writeSettings()) ); connect( m_ui->m_endDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(validateDateRange()) ); connect( m_ui->m_maxDifficulty, SIGNAL(valueChanged(double)), SLOT(validateDifficultyRange()) ); }
void Satellites::init() { QSettings* conf = StelApp::getInstance().getSettings(); try { // TODO: Compatibility with installation-dir modules? --BM // It seems that the original code couldn't handle them either. QString dirPath = StelFileMgr::getUserDir() + "/modules/Satellites"; // TODO: Ideally, this should return a QDir object StelFileMgr::makeSureDirExistsAndIsWritable(dirPath); dataDir.setPath(dirPath); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Satellites")) { //qDebug() << "Stellites: created section in config file."; restoreDefaultSettings(); } // populate settings from main config file. loadSettings(); // absolute file name for inner catalog of the satellites catalogPath = dataDir.absoluteFilePath("satellites.json"); // absolute file name for qs.mag file qsMagFilePath = dataDir.absoluteFilePath("qs.mag"); // Load and find resources used in the plugin texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png"); Satellite::hintTexture = StelApp::getInstance().getTextureManager().createTexture(":/satellites/hint.png"); // key bindings and other actions StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); QString satGroup = N_("Satellites"); addAction("actionShow_Satellite_Hints", satGroup, N_("Satellite hints"), "hintsVisible", "Ctrl+Z"); addAction("actionShow_Satellite_Labels", satGroup, N_("Satellite labels"), "labelsVisible", "Shift+Z"); addAction("actionShow_Satellite_ConfigDialog_Global", satGroup, N_("Satellites configuration window"), configDialog, "visible", "Alt+Z"); // Gui toolbar button toolbarButton = new StelButton(NULL, QPixmap(":/satellites/bt_satellites_on.png"), QPixmap(":/satellites/bt_satellites_off.png"), QPixmap(":/graphicGui/glow32x32.png"), "actionShow_Satellite_Hints"); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup"); } catch (std::runtime_error &e) { qWarning() << "Satellites::init error: " << e.what(); return; } // A timer for hiding alert messages messageTimer = new QTimer(this); messageTimer->setSingleShot(true); // recurring check for update messageTimer->setInterval(9000); // 6 seconds should be enough time messageTimer->stop(); connect(messageTimer, SIGNAL(timeout()), this, SLOT(hideMessages())); // If the json file does not already exist, create it from the resource in the QT resource if(QFileInfo(catalogPath).exists()) { if (!checkJsonFileFormat() || readCatalogVersion() != SATELLITES_PLUGIN_VERSION) { displayMessage(q_("The old satellites.json file is no longer compatible - using default file"), "#bb0000"); restoreDefaultCatalog(); } } else { qDebug() << "Satellites::init satellites.json does not exist - copying default file to " << QDir::toNativeSeparators(catalogPath); restoreDefaultCatalog(); } if(!QFileInfo(qsMagFilePath).exists()) { restoreDefaultQSMagFile(); } qDebug() << "Satellites: loading catalog file:" << QDir::toNativeSeparators(catalogPath); // create satellites according to content os satellites.json file loadCatalog(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(saveDownloadedUpdate(QNetworkReply*))); updateState = CompleteNoUpdates; updateTimer = new QTimer(this); updateTimer->setSingleShot(false); // recurring check for update updateTimer->setInterval(13000); // check once every 13 seconds to see if it is time for an update connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate())); updateTimer->start(); earth = GETSTELMODULE(SolarSystem)->getEarth(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); // Handle changes to the observer location: connect(StelApp::getInstance().getCore(), SIGNAL(locationChanged(StelLocation)), this, SLOT(updateObserverLocation(StelLocation))); }