void StelGui::init(QGraphicsWidget* atopLevelGraphicsWidget, StelAppGraphicsWidget* astelAppGraphicsWidget) { qDebug() << "Creating GUI ..."; StelGuiBase::init(atopLevelGraphicsWidget, astelAppGraphicsWidget); skyGui = new SkyGui(atopLevelGraphicsWidget); locationDialog = new LocationDialog(); helpDialog = new HelpDialog(); dateTimeDialog = new DateTimeDialog(); searchDialog = new SearchDialog(); viewDialog = new ViewDialog(); shortcutsDialog = new ShortcutsDialog(); configurationDialog = new ConfigurationDialog(this); #ifdef ENABLE_SCRIPT_CONSOLE scriptConsole = new ScriptConsole(); #endif /////////////////////////////////////////////////////////////////////// // Create all the main actions of the program, associated with shortcuts StelApp::getInstance().getStelShortcutManager()->loadShortcuts(); #ifdef ENABLE_SCRIPT_CONSOLE StelApp::getInstance().getStelShortcutManager()-> addGuiAction("actionShow_ScriptConsole_Window_Global", true, N_("Script console window"), "F12", "", N_("Windows"), true, false, true); #endif /////////////////////////////////////////////////////////////////////// // Connect all the GUI actions signals with the Core of Stellarium connect(getGuiAction("actionQuit_Global"), SIGNAL(triggered()), this, SLOT(quit())); initConstellationMgr(); initGrindLineMgr(); initLandscapeMgr(); NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr); connect(getGuiAction("actionShow_Nebulas"), SIGNAL(toggled(bool)), nmgr, SLOT(setFlagHints(bool))); getGuiAction("actionShow_Nebulas")->setChecked(nmgr->getFlagHints()); StelSkyLayerMgr* imgr = GETSTELMODULE(StelSkyLayerMgr); connect(getGuiAction("actionShow_DSS"), SIGNAL(toggled(bool)), imgr, SLOT(setFlagShow(bool))); getGuiAction("actionShow_DSS")->setChecked(imgr->getFlagShow()); StelCore* core = StelApp::getInstance().getCore(); StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr); connect(getGuiAction("actionIncrease_Script_Speed"), SIGNAL(triggered()), this, SLOT(increaseScriptSpeed())); connect(getGuiAction("actionDecrease_Script_Speed"), SIGNAL(triggered()), this, SLOT(decreaseScriptSpeed())); connect(getGuiAction("actionSet_Real_Script_Speed"), SIGNAL(triggered()), this, SLOT(setRealScriptSpeed())); connect(getGuiAction("actionStop_Script"), SIGNAL(triggered()), this, SLOT(stopScript())); connect(getGuiAction("actionPause_Script"), SIGNAL(triggered()), this, SLOT(pauseScript())); connect(getGuiAction("actionResume_Script"), SIGNAL(triggered()), this, SLOT(resumeScript())); connect(getGuiAction("actionIncrease_Time_Speed"), SIGNAL(triggered()), core, SLOT(increaseTimeSpeed())); connect(getGuiAction("actionDecrease_Time_Speed"), SIGNAL(triggered()), core, SLOT(decreaseTimeSpeed())); connect(getGuiAction("actionIncrease_Time_Speed_Less"), SIGNAL(triggered()), core, SLOT(increaseTimeSpeedLess())); connect(getGuiAction("actionDecrease_Time_Speed_Less"), SIGNAL(triggered()), core, SLOT(decreaseTimeSpeedLess())); connect(getGuiAction("actionSet_Real_Time_Speed"), SIGNAL(triggered()), core, SLOT(toggleRealTimeSpeed())); connect(getGuiAction("actionSet_Time_Rate_Zero"), SIGNAL(triggered()), core, SLOT(setZeroTimeSpeed())); connect(getGuiAction("actionReturn_To_Current_Time"), SIGNAL(triggered()), core, SLOT(setTimeNow())); connect(getGuiAction("actionSwitch_Equatorial_Mount"), SIGNAL(toggled(bool)), mmgr, SLOT(setEquatorialMount(bool))); getGuiAction("actionSwitch_Equatorial_Mount")->setChecked(mmgr->getMountMode() != StelMovementMgr::MountAltAzimuthal); connect(getGuiAction("actionAdd_Solar_Hour"), SIGNAL(triggered()), core, SLOT(addHour())); connect(getGuiAction("actionAdd_Solar_Day"), SIGNAL(triggered()), core, SLOT(addDay())); connect(getGuiAction("actionAdd_Solar_Week"), SIGNAL(triggered()), core, SLOT(addWeek())); connect(getGuiAction("actionSubtract_Solar_Hour"), SIGNAL(triggered()), core, SLOT(subtractHour())); connect(getGuiAction("actionSubtract_Solar_Day"), SIGNAL(triggered()), core, SLOT(subtractDay())); connect(getGuiAction("actionSubtract_Solar_Week"), SIGNAL(triggered()), core, SLOT(subtractWeek())); connect(getGuiAction("actionAdd_Sidereal_Day"), SIGNAL(triggered()), core, SLOT(addSiderealDay())); connect(getGuiAction("actionAdd_Sidereal_Week"), SIGNAL(triggered()), core, SLOT(addSiderealWeek())); connect(getGuiAction("actionAdd_Sidereal_Month"), SIGNAL(triggered()), core, SLOT(addSiderealMonth())); connect(getGuiAction("actionAdd_Sidereal_Year"), SIGNAL(triggered()), core, SLOT(addSiderealYear())); connect(getGuiAction("actionSubtract_Sidereal_Day"), SIGNAL(triggered()), core, SLOT(subtractSiderealDay())); connect(getGuiAction("actionSubtract_Sidereal_Week"), SIGNAL(triggered()), core, SLOT(subtractSiderealWeek())); connect(getGuiAction("actionSubtract_Sidereal_Month"), SIGNAL(triggered()), core, SLOT(subtractSiderealMonth())); connect(getGuiAction("actionSubtract_Sidereal_Year"), SIGNAL(triggered()), core, SLOT(subtractSiderealYear())); connect(getGuiAction("actionSet_Home_Planet_To_Selected"), SIGNAL(triggered()), core, SLOT(moveObserverToSelected())); connect(getGuiAction("actionGo_Home_Global"), SIGNAL(triggered()), core, SLOT(returnToHome())); // connect the actor after setting the nightmode. // StelApp::init() already set flagNightMode for us, don't do it twice! getGuiAction("actionShow_Night_Mode")->setChecked(StelApp::getInstance().getVisionModeNight()); connect(getGuiAction("actionShow_Night_Mode"), SIGNAL(toggled(bool)), &StelApp::getInstance(), SLOT(setVisionModeNight(bool))); connect(getGuiAction("actionGoto_Selected_Object"), SIGNAL(triggered()), mmgr, SLOT(setFlagTracking())); connect(getGuiAction("actionZoom_In_Auto"), SIGNAL(triggered()), mmgr, SLOT(autoZoomIn())); connect(getGuiAction("actionZoom_Out_Auto"), SIGNAL(triggered()), mmgr, SLOT(autoZoomOut())); connect(getGuiAction("actionSet_Tracking"), SIGNAL(toggled(bool)), mmgr, SLOT(setFlagTracking(bool))); getGuiAction("actionSet_Tracking")->setChecked(mmgr->getFlagTracking()); connect(getGuiAction("actionSet_Full_Screen_Global"), SIGNAL(toggled(bool)), &StelMainWindow::getInstance(), SLOT(setFullScreen(bool))); getGuiAction("actionSet_Full_Screen_Global")->setChecked(StelMainWindow::getInstance().isFullScreen()); QAction* tempAction = getGuiAction("actionShow_Location_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), locationDialog, SLOT(setVisible(bool))); connect(locationDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); #ifdef ENABLE_SCRIPT_CONSOLE tempAction = getGuiAction("actionShow_ScriptConsole_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), scriptConsole, SLOT(setVisible(bool))); connect(scriptConsole, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); #endif tempAction = getGuiAction("actionShow_Configuration_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), configurationDialog, SLOT(setVisible(bool))); connect(configurationDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); tempAction = getGuiAction("actionShow_SkyView_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), viewDialog, SLOT(setVisible(bool))); connect(viewDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); tempAction = getGuiAction("actionShow_Help_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), helpDialog, SLOT(setVisible(bool))); connect(helpDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); tempAction = getGuiAction("actionShow_DateTime_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), dateTimeDialog, SLOT(setVisible(bool))); connect(dateTimeDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); tempAction = getGuiAction("actionShow_Search_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), searchDialog, SLOT(setVisible(bool))); connect(searchDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); tempAction = getGuiAction("actionShow_Shortcuts_Window_Global"); connect(tempAction, SIGNAL(toggled(bool)), shortcutsDialog, SLOT(setVisible(bool))); connect(shortcutsDialog, SIGNAL(visibleChanged(bool)), tempAction, SLOT(setChecked(bool))); connect(getGuiAction("actionSave_Screenshot_Global"), SIGNAL(triggered()), &StelMainGraphicsView::getInstance(), SLOT(saveScreenShot())); connect(getGuiAction("actionSave_Copy_Object_Information_Global"), SIGNAL(triggered()), this, SLOT(copySelectedObjectInfo())); getGuiAction("actionToggle_GuiHidden_Global")->setChecked(true); connect(getGuiAction("actionToggle_GuiHidden_Global"), SIGNAL(toggled(bool)), this, SLOT(setGuiVisible(bool))); connect(getGuiAction("actionHorizontal_Flip"), SIGNAL(toggled(bool)), StelApp::getInstance().getCore(), SLOT(setFlipHorz(bool))); getGuiAction("actionHorizontal_Flip")->setChecked(StelApp::getInstance().getCore()->getFlipHorz()); connect(getGuiAction("actionVertical_Flip"), SIGNAL(toggled(bool)), StelApp::getInstance().getCore(), SLOT(setFlipVert(bool))); getGuiAction("actionVertical_Flip")->setChecked(StelApp::getInstance().getCore()->getFlipVert()); StarMgr* smgr = GETSTELMODULE(StarMgr); connect(getGuiAction("actionShow_Stars"), SIGNAL(toggled(bool)), smgr, SLOT(setFlagStars(bool))); getGuiAction("actionShow_Stars")->setChecked(smgr->getFlagStars()); connect(getGuiAction("actionShow_Stars_Labels"), SIGNAL(toggled(bool)), smgr, SLOT(setFlagLabels(bool))); getGuiAction("actionShow_Stars_Labels")->setChecked(smgr->getFlagLabels()); SolarSystem* ssmgr = GETSTELMODULE(SolarSystem); connect(getGuiAction("actionShow_Planets_Labels"), SIGNAL(toggled(bool)), ssmgr, SLOT(setFlagLabels(bool))); getGuiAction("actionShow_Planets_Labels")->setChecked(ssmgr->getFlagLabels()); connect(getGuiAction("actionShow_Planets_Orbits"), SIGNAL(toggled(bool)), ssmgr, SLOT(setFlagOrbits(bool))); getGuiAction("actionShow_Planets_Orbits")->setChecked(ssmgr->getFlagOrbits()); connect(getGuiAction("actionShow_Planets_Trails"), SIGNAL(toggled(bool)), ssmgr, SLOT(setFlagTrails(bool))); getGuiAction("actionShow_Planets_Trails")->setChecked(ssmgr->getFlagTrails()); QSettings* conf = StelApp::getInstance().getSettings(); Q_ASSERT(conf); setAutoHideHorizontalButtonBar(conf->value("gui/auto_hide_horizontal_toolbar", true).toBool()); setAutoHideVerticalButtonBar(conf->value("gui/auto_hide_vertical_toolbar", true).toBool()); connect(getGuiAction("actionAutoHideHorizontalButtonBar"), SIGNAL(toggled(bool)), this, SLOT(setAutoHideHorizontalButtonBar(bool))); getGuiAction("actionAutoHideHorizontalButtonBar")->setChecked(getAutoHideHorizontalButtonBar()); connect(getGuiAction("actionAutoHideVerticalButtonBar"), SIGNAL(toggled(bool)), this, SLOT(setAutoHideVerticalButtonBar(bool))); getGuiAction("actionAutoHideVerticalButtonBar")->setChecked(getAutoHideVerticalButtonBar()); #ifndef DISABLE_SCRIPTING StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getScriptMgr(); connect(&scriptMgr, SIGNAL(scriptRunning()), this, SLOT(scriptStarted())); connect(&scriptMgr, SIGNAL(scriptStopped()), this, SLOT(scriptStopped())); #endif /////////////////////////////////////////////////////////////////////////// //// QGraphicsView based GUI /////////////////////////////////////////////////////////////////////////// // Add everything QPixmap pxmapDefault; QPixmap pxmapGlow(":/graphicGui/glow.png"); QPixmap pxmapOn(":/graphicGui/2-on-location.png"); QPixmap pxmapOff(":/graphicGui/2-off-location.png"); StelButton* b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Location_Window_Global")); skyGui->winBar->addButton(b); pxmapOn = QPixmap(":/graphicGui/1-on-time.png"); pxmapOff = QPixmap(":/graphicGui/1-off-time.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_DateTime_Window_Global")); skyGui->winBar->addButton(b); pxmapOn = QPixmap(":/graphicGui/5-on-labels.png"); pxmapOff = QPixmap(":/graphicGui/5-off-labels.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_SkyView_Window_Global")); skyGui->winBar->addButton(b); pxmapOn = QPixmap(":/graphicGui/6-on-search.png"); pxmapOff = QPixmap(":/graphicGui/6-off-search.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Search_Window_Global")); skyGui->winBar->addButton(b); pxmapOn = QPixmap(":/graphicGui/8-on-settings.png"); pxmapOff = QPixmap(":/graphicGui/8-off-settings.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Configuration_Window_Global")); skyGui->winBar->addButton(b); pxmapOn = QPixmap(":/graphicGui/9-on-help.png"); pxmapOff = QPixmap(":/graphicGui/9-off-help.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Help_Window_Global")); skyGui->winBar->addButton(b); QPixmap pxmapGlow32x32(":/graphicGui/glow32x32.png"); pxmapOn = QPixmap(":/graphicGui/btConstellationLines-on.png"); pxmapOff = QPixmap(":/graphicGui/btConstellationLines-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Constellation_Lines")); skyGui->buttonBar->addButton(b, "010-constellationsGroup"); pxmapOn = QPixmap(":/graphicGui/btConstellationLabels-on.png"); pxmapOff = QPixmap(":/graphicGui/btConstellationLabels-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Constellation_Labels")); skyGui->buttonBar->addButton(b, "010-constellationsGroup"); pxmapOn = QPixmap(":/graphicGui/btConstellationArt-on.png"); pxmapOff = QPixmap(":/graphicGui/btConstellationArt-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Constellation_Art")); skyGui->buttonBar->addButton(b, "010-constellationsGroup"); pxmapOn = QPixmap(":/graphicGui/btEquatorialGrid-on.png"); pxmapOff = QPixmap(":/graphicGui/btEquatorialGrid-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Equatorial_Grid")); skyGui->buttonBar->addButton(b, "020-gridsGroup"); pxmapOn = QPixmap(":/graphicGui/btAzimuthalGrid-on.png"); pxmapOff = QPixmap(":/graphicGui/btAzimuthalGrid-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Azimuthal_Grid")); skyGui->buttonBar->addButton(b, "020-gridsGroup"); pxmapOn = QPixmap(":/graphicGui/btGround-on.png"); pxmapOff = QPixmap(":/graphicGui/btGround-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Ground")); skyGui->buttonBar->addButton(b, "030-landscapeGroup"); pxmapOn = QPixmap(":/graphicGui/btCardinalPoints-on.png"); pxmapOff = QPixmap(":/graphicGui/btCardinalPoints-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Cardinal_Points")); skyGui->buttonBar->addButton(b, "030-landscapeGroup"); pxmapOn = QPixmap(":/graphicGui/btAtmosphere-on.png"); pxmapOff = QPixmap(":/graphicGui/btAtmosphere-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Atmosphere")); skyGui->buttonBar->addButton(b, "030-landscapeGroup"); pxmapOn = QPixmap(":/graphicGui/btNebula-on.png"); pxmapOff = QPixmap(":/graphicGui/btNebula-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Nebulas")); skyGui->buttonBar->addButton(b, "040-nebulaeGroup"); pxmapOn = QPixmap(":/graphicGui/btPlanets-on.png"); pxmapOff = QPixmap(":/graphicGui/btPlanets-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Planets_Labels")); skyGui->buttonBar->addButton(b, "040-nebulaeGroup"); pxmapOn = QPixmap(":/graphicGui/btEquatorialMount-on.png"); pxmapOff = QPixmap(":/graphicGui/btEquatorialMount-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionSwitch_Equatorial_Mount")); b->setChecked(getGuiAction("actionSwitch_Equatorial_Mount")->isChecked()); skyGui->buttonBar->addButton(b, "060-othersGroup"); pxmapOn = QPixmap(":/graphicGui/btGotoSelectedObject-on.png"); pxmapOff = QPixmap(":/graphicGui/btGotoSelectedObject-off.png"); buttonGotoSelectedObject = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionGoto_Selected_Object")); skyGui->buttonBar->addButton(buttonGotoSelectedObject, "060-othersGroup"); pxmapOn = QPixmap(":/graphicGui/btNightView-on.png"); pxmapOff = QPixmap(":/graphicGui/btNightView-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Night_Mode")); skyGui->buttonBar->addButton(b, "060-othersGroup"); pxmapOn = QPixmap(":/graphicGui/btFullScreen-on.png"); pxmapOff = QPixmap(":/graphicGui/btFullScreen-off.png"); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionSet_Full_Screen_Global")); skyGui->buttonBar->addButton(b, "060-othersGroup"); pxmapOn = QPixmap(":/graphicGui/btTimeRewind-on.png"); pxmapOff = QPixmap(":/graphicGui/btTimeRewind-off.png"); buttonTimeRewind = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionDecrease_Time_Speed")); skyGui->buttonBar->addButton(buttonTimeRewind, "070-timeGroup"); pxmapOn = QPixmap(":/graphicGui/btTimeRealtime-on.png"); pxmapOff = QPixmap(":/graphicGui/btTimeRealtime-off.png"); pxmapDefault = QPixmap(":/graphicGui/btTimePause-on.png"); buttonTimeRealTimeSpeed = new StelButton(NULL, pxmapOn, pxmapOff, pxmapDefault, pxmapGlow32x32, getGuiAction("actionSet_Real_Time_Speed")); skyGui->buttonBar->addButton(buttonTimeRealTimeSpeed, "070-timeGroup"); pxmapOn = QPixmap(":/graphicGui/btTimeNow-on.png"); pxmapOff = QPixmap(":/graphicGui/btTimeNow-off.png"); buttonTimeCurrent = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionReturn_To_Current_Time")); skyGui->buttonBar->addButton(buttonTimeCurrent, "070-timeGroup"); pxmapOn = QPixmap(":/graphicGui/btTimeForward-on.png"); pxmapOff = QPixmap(":/graphicGui/btTimeForward-off.png"); buttonTimeForward = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionIncrease_Time_Speed")); skyGui->buttonBar->addButton(buttonTimeForward, "070-timeGroup"); skyGui->buttonBar->setGroupMargin("070-timeGroup", 32, 0); pxmapOn = QPixmap(":/graphicGui/btQuit.png"); b = new StelButton(NULL, pxmapOn, pxmapOn, pxmapGlow32x32, getGuiAction("actionQuit_Global")); skyGui->buttonBar->addButton(b, "080-quitGroup"); // add the flip buttons if requested in the config setFlagShowFlipButtons(conf->value("gui/flag_show_flip_buttons", false).toBool()); setFlagShowNebulaBackgroundButton(conf->value("gui/flag_show_nebulae_background_button", false).toBool()); /////////////////////////////////////////////////////////////////////// // Create the main base widget skyGui->init(this); QGraphicsGridLayout* l = new QGraphicsGridLayout(); l->setContentsMargins(0,0,0,0); l->setSpacing(0); l->addItem(skyGui, 0, 0); stelAppGraphicsWidget->setLayout(l); setStelStyle(StelApp::getInstance().getCurrentStelStyle()); skyGui->setGeometry(stelAppGraphicsWidget->geometry()); skyGui->updateBarsPos(); // The disabled text for checkboxes is embossed with the QPalette::Light setting for the ColorGroup Disabled. // It doesn't appear to be possible to set this from the stylesheet. Instead we'll make it 100% transparent // and set the text color for disabled in the stylesheets. QPalette p = QApplication::palette(); p.setColor(QPalette::Disabled, QPalette::Light, QColor(0,0,0,0)); // And this is for the focus... apparently the focus indicator is the inverted value for Active/Button. p.setColor(QPalette::Active, QPalette::Button, QColor(255,255,255)); QApplication::setPalette(p); StelApp *app = &StelApp::getInstance(); connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&))); initDone = true; }
// Initialize the dialog widgets and connect the signals/slots void SatellitesDialog::createDialogContent() { ui->setupUi(dialog); ui->tabs->setCurrentIndex(0); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); // Settings tab / updates group connect(ui->internetUpdatesCheckbox, SIGNAL(stateChanged(int)), this, SLOT(setUpdatesEnabled(int))); connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(updateTLEs())); connect(GETSTELMODULE(Satellites), SIGNAL(updateStateChanged(Satellites::UpdateState)), this, SLOT(updateStateReceiver(Satellites::UpdateState))); connect(GETSTELMODULE(Satellites), SIGNAL(tleUpdateComplete(int, int, int)), this, SLOT(updateCompleteReceiver(int, int, int))); connect(ui->updateFrequencySpinBox, SIGNAL(valueChanged(int)), this, SLOT(setUpdateValues(int))); refreshUpdateValues(); // fetch values for last updated and so on // if the state didn't change, setUpdatesEnabled will not be called, so we force it setUpdatesEnabled(ui->internetUpdatesCheckbox->checkState()); updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(refreshUpdateValues())); updateTimer->start(7000); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); // Settings tab / General settings group connect(ui->labelsGroup, SIGNAL(toggled(bool)), dynamic_cast<StelGui*>(StelApp::getInstance().getGui())->getGuiAction("actionShow_Satellite_Labels"), SLOT(setChecked(bool))); connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), GETSTELMODULE(Satellites), SLOT(setLabelFontSize(int))); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(restoreDefaults())); connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveSettings())); // Settings tab / orbit lines group ui->orbitLinesGroup->setChecked(GETSTELMODULE(Satellites)->getOrbitLinesFlag()); ui->orbitSegmentsSpin->setValue(Satellite::orbitLineSegments); ui->orbitFadeSpin->setValue(Satellite::orbitLineFadeSegments); ui->orbitDurationSpin->setValue(Satellite::orbitLineSegmentDuration); connect(ui->orbitLinesGroup, SIGNAL(toggled(bool)), GETSTELMODULE(Satellites), SLOT(setOrbitLinesFlag(bool))); connect(ui->orbitSegmentsSpin, SIGNAL(valueChanged(int)), this, SLOT(setOrbitParams())); connect(ui->orbitFadeSpin, SIGNAL(valueChanged(int)), this, SLOT(setOrbitParams())); connect(ui->orbitDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(setOrbitParams())); // Satellites tab filterProxyModel = new QSortFilterProxyModel(this); filterProxyModel->setSourceModel(satellitesModel); filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->satellitesList->setModel(filterProxyModel); connect(ui->lineEditSearch, SIGNAL(textEdited(QString)), filterProxyModel, SLOT(setFilterWildcard(QString))); QItemSelectionModel* selectionModel = ui->satellitesList->selectionModel(); connect(selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(updateSelectedInfo(QModelIndex,QModelIndex))); connect(ui->satellitesList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(handleDoubleClick(QModelIndex))); connect(ui->groupsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(listSatelliteGroup(int))); connect(ui->saveSatellitesButton, SIGNAL(clicked()), this, SLOT(saveSatellites())); connect(ui->removeSatellitesButton, SIGNAL(clicked()), this, SLOT(removeSatellites())); connectSatelliteGuiForm(); importWindow = new SatellitesImportDialog(); connect(ui->addSatellitesButton, SIGNAL(clicked()), importWindow, SLOT(setVisible())); connect(importWindow, SIGNAL(satellitesAccepted(TleDataList)), this, SLOT(addSatellites(TleDataList))); // Sources tab connect(ui->sourceList, SIGNAL(currentTextChanged(const QString&)), ui->sourceEdit, SLOT(setText(const QString&))); connect(ui->sourceEdit, SIGNAL(editingFinished()), this, SLOT(sourceEditingDone())); connect(ui->deleteSourceButton, SIGNAL(clicked()), this, SLOT(deleteSourceRow())); connect(ui->addSourceButton, SIGNAL(clicked()), this, SLOT(addSourceRow())); // About tab setAboutHtml(); updateGuiFromSettings(); }
void ObservabilityDialog::setGoodDatesFlag(int checkState) { bool b = checkState != Qt::Unchecked; GETSTELMODULE(Observability)->setShow(3,b); }
void SupernovaeDialog::setUpdateValues(int days) { GETSTELMODULE(Supernovae)->setUpdateFrequencyDays(days); refreshUpdateValues(); }
void SupernovaeDialog::saveSettings(void) { GETSTELMODULE(Supernovae)->saveSettingsToConfig(); }
void MeteorShowersMgr::displayMessage(const QString& message, const QString hexColor) { m_messageIDs << GETSTELMODULE(LabelMgr)->labelScreen(message, 30, 30 + (20 * m_messageIDs.count()), true, 16, hexColor); m_messageTimer->start(); }
void MpcImportWindow::addObjects() { disconnect(ssoManager, SIGNAL(solarSystemChanged()), this, SLOT(resetDialog())); QList<QString> checkedObjectsNames; //Extract the marked objects //TODO: Something smarter? for (int row = 0; row < candidateObjectsModel->rowCount(); row++) { QStandardItem * item = candidateObjectsModel->item(row); if (item->checkState() == Qt::Checked) { checkedObjectsNames.append(item->text()); if (row==0) SearchDialog::extSearchText = item->text(); } } //qDebug() << "Checked:" << checkedObjectsNames; QList<SsoElements> approvedForAddition; for (int i = 0; i < candidatesForAddition.count(); i++) { QString name = candidatesForAddition.at(i).value("name").toString(); if (checkedObjectsNames.contains(name)) approvedForAddition.append(candidatesForAddition.at(i)); } bool overwrite = ui->radioButtonOverwrite->isChecked(); QList<SsoElements> approvedForUpdate; for (int j = 0; j < candidatesForUpdate.count(); j++) { QString name = candidatesForUpdate.at(j).value("name").toString(); if (checkedObjectsNames.contains(name)) { if (overwrite) { approvedForAddition.append(candidatesForUpdate.at(j)); } else { approvedForUpdate.append(candidatesForUpdate.at(j)); } } } //Write to file ssoManager->appendToSolarSystemConfigurationFile(approvedForAddition); if (ui->radioButtonUpdate->isChecked()) { SolarSystemEditor::UpdateFlags flags(SolarSystemEditor::UpdateNameAndNumber | SolarSystemEditor::UpdateOrbitalElements); if (!ui->checkBoxOnlyOrbitalElements->isChecked()) { flags |= SolarSystemEditor::UpdateType; flags |= SolarSystemEditor::UpdateMagnitudeParameters; } ssoManager->updateSolarSystemConfigurationFile(approvedForUpdate, flags); } //Refresh the Solar System GETSTELMODULE(SolarSystem)->reloadPlanets(); resetDialog(); emit objectsImported(); }
void SearchDialog::manualPositionChanged() { ui->completionLabel->clearValues(); StelCore* core = StelApp::getInstance().getCore(); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); Vec3d pos; Vec3d aimUp; double spinLong=ui->AxisXSpinBox->valueRadians(); double spinLat=ui->AxisYSpinBox->valueRadians(); // Since 0.15: proper handling of aimUp vector. This does not depend on the searched coordinate system, but on the MovementManager's C.S. // However, if those are identical, we have a problem when we want to look right into the pole. (e.g. zenith), which requires a special up vector. // aimUp depends on MovementMgr::MountMode mvmgr->mountMode! mvmgr->setViewUpVector(Vec3d(0., 0., 1.)); aimUp=mvmgr->getViewUpVectorJ2000(); StelMovementMgr::MountMode mountMode=mvmgr->getMountMode(); switch (getCurrentCoordinateSystem()) { case equatorialJ2000: { StelUtils::spheToRect(spinLong, spinLat, pos); if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. // Strictly mount should be in a new J2000 mode, but this here also stabilizes searching J2000 coordinates. mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case equatorial: { StelUtils::spheToRect(spinLong, spinLat, pos); pos = core->equinoxEquToJ2000(pos); if ( (mountMode==StelMovementMgr::MountEquinoxEquatorial) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case horizontal: { double cx; cx = 3.*M_PI - spinLong; // N is zero, E is 90 degrees if (cx > 2.*M_PI) cx -= 2.*M_PI; StelUtils::spheToRect(cx, spinLat, pos); pos = core->altAzToJ2000(pos); if ( (mountMode==StelMovementMgr::MountAltAzimuthal) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. mvmgr->setViewUpVector(Vec3d(-cos(cx), -sin(cx), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case galactic: { StelUtils::spheToRect(spinLong, spinLat, pos); pos = core->galacticToJ2000(pos); if ( (mountMode==StelMovementMgr::MountGalactic) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) { // make up vector more stable. mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); aimUp=mvmgr->getViewUpVectorJ2000(); } break; } case eclipticJ2000: { double ra, dec; StelUtils::eclToEqu(spinLong, spinLat, core->getCurrentPlanet()->getRotObliquity(2451545.0), &ra, &dec); StelUtils::spheToRect(ra, dec, pos); break; } case ecliptic: { double ra, dec; StelUtils::eclToEqu(spinLong, spinLat, core->getCurrentPlanet()->getRotObliquity(core->getJDE()), &ra, &dec); StelUtils::spheToRect(ra, dec, pos); pos = core->equinoxEquToJ2000(pos); break; } } mvmgr->setFlagTracking(false); mvmgr->moveToJ2000(pos, aimUp, 0.05); }
AddRemoveLandscapesDialog::AddRemoveLandscapesDialog() { ui = new Ui_addRemoveLandscapesDialogForm; landscapeManager = GETSTELMODULE(LandscapeMgr); lastUsedDirectoryPath = QDir::homePath(); }
// Initialize the dialog widgets and connect the signals/slots void SatellitesDialog::createDialogContent() { ui->setupUi(dialog); ui->tabs->setCurrentIndex(0); ui->labelAutoAdd->setVisible(false); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); Satellites* plugin = GETSTELMODULE(Satellites); // Settings tab / updates group // These controls are refreshed by updateSettingsPage(), which in // turn is triggered by setting any of these values. Because // clicked() is issued only by user input, there's no endless loop. connect(ui->internetUpdatesCheckbox, SIGNAL(clicked(bool)), plugin, SLOT(enableInternetUpdates(bool))); connect(ui->checkBoxAutoAdd, SIGNAL(clicked(bool)), plugin, SLOT(enableAutoAdd(bool))); connect(ui->checkBoxAutoRemove, SIGNAL(clicked(bool)), plugin, SLOT(enableAutoRemove(bool))); connect(ui->updateFrequencySpinBox, SIGNAL(valueChanged(int)), plugin, SLOT(setUpdateFrequencyHours(int))); connect(ui->updateButton, SIGNAL(clicked()), this, SLOT(updateTLEs())); connect(ui->jumpToSourcesButton, SIGNAL(clicked()), this, SLOT(jumpToSourcesTab())); connect(plugin, SIGNAL(updateStateChanged(Satellites::UpdateState)), this, SLOT(showUpdateState(Satellites::UpdateState))); connect(plugin, SIGNAL(tleUpdateComplete(int, int, int, int)), this, SLOT(showUpdateCompleted(int, int, int, int))); updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateCountdown())); updateTimer->start(7000); // Settings tab / General settings group // This does call Satellites::setFlagLabels() indirectly. QAction* action = dynamic_cast<StelGui*>(StelApp::getInstance().getGui())->getGuiAction("actionShow_Satellite_Labels"); connect(ui->labelsGroup, SIGNAL(clicked(bool)), action, SLOT(setChecked(bool))); connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), plugin, SLOT(setLabelFontSize(int))); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(restoreDefaults())); connect(ui->saveSettingsButton, SIGNAL(clicked()), this, SLOT(saveSettings())); // Settings tab / orbit lines group connect(ui->orbitLinesGroup, SIGNAL(clicked(bool)), plugin, SLOT(setOrbitLinesFlag(bool))); connect(ui->orbitSegmentsSpin, SIGNAL(valueChanged(int)), this, SLOT(setOrbitParams())); connect(ui->orbitFadeSpin, SIGNAL(valueChanged(int)), this, SLOT(setOrbitParams())); connect(ui->orbitDurationSpin, SIGNAL(valueChanged(int)), this, SLOT(setOrbitParams())); // Settings tab - populate all values updateSettingsPage(); // Satellites tab filterModel = new SatellitesListFilterModel(this); filterModel->setSourceModel(GETSTELMODULE(Satellites)->getSatellitesListModel()); filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->satellitesList->setModel(filterModel); connect(ui->lineEditSearch, SIGNAL(textEdited(QString)), filterModel, SLOT(setFilterWildcard(QString))); QItemSelectionModel* selectionModel = ui->satellitesList->selectionModel(); connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateSatelliteData())); connect(ui->satellitesList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(trackSatellite(QModelIndex))); // Two-state input, three-state display connect(ui->displayedCheckbox, SIGNAL(clicked(bool)), ui->displayedCheckbox, SLOT(setChecked(bool))); connect(ui->orbitCheckbox, SIGNAL(clicked(bool)), ui->orbitCheckbox, SLOT(setChecked(bool))); connect(ui->userCheckBox, SIGNAL(clicked(bool)), ui->userCheckBox, SLOT(setChecked(bool))); // Because the previous signals and slots were connected first, // they will be executed before these. connect(ui->displayedCheckbox, SIGNAL(clicked()), this, SLOT(setFlags())); connect(ui->orbitCheckbox, SIGNAL(clicked()), this, SLOT(setFlags())); connect(ui->userCheckBox, SIGNAL(clicked()), this, SLOT(setFlags())); connect(ui->groupsListWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(handleGroupChanges(QListWidgetItem*))); connect(ui->groupFilterCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(filterListByGroup(int))); connect(ui->saveSatellitesButton, SIGNAL(clicked()), this, SLOT(saveSatellites())); connect(ui->removeSatellitesButton, SIGNAL(clicked()), this, SLOT(removeSatellites())); importWindow = new SatellitesImportDialog(); connect(ui->addSatellitesButton, SIGNAL(clicked()), importWindow, SLOT(setVisible())); connect(importWindow, SIGNAL(satellitesAccepted(TleDataList)), this, SLOT(addSatellites(TleDataList))); // Sources tab connect(ui->sourceList, SIGNAL(currentTextChanged(const QString&)), ui->sourceEdit, SLOT(setText(const QString&))); connect(ui->sourceList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(saveSourceList())); connect(ui->sourceEdit, SIGNAL(editingFinished()), this, SLOT(saveEditedSource())); connect(ui->deleteSourceButton, SIGNAL(clicked()), this, SLOT(deleteSourceRow())); connect(ui->addSourceButton, SIGNAL(clicked()), this, SLOT(addSourceRow())); connect(plugin, SIGNAL(settingsChanged()), this, SLOT(toggleCheckableSources())); // About tab populateAboutPage(); populateFilterMenu(); populateSourcesList(); }
void Comet::drawTail(StelCore* core, StelProjector::ModelViewTranformP transfo, bool gas) { // Find rotation matrix from 0/0/1 to eclipticPosition: crossproduct for axis (normal vector), dotproduct for angle. Vec3d eclposNrm=eclipticPos; eclposNrm.normalize(); Mat4d tailrot=Mat4d::rotation(Vec3d(0.0, 0.0, 1.0)^(eclposNrm), std::acos(Vec3d(0.0, 0.0, 1.0).dot(eclposNrm)) ); StelProjector::ModelViewTranformP transfo2 = transfo->clone(); transfo2->combine(tailrot); if (!gas) { CometOrbit* orbit=(CometOrbit*)userDataPtr; Vec3d velocity=orbit->getVelocity(); // [AU/d] // This was a try to rotate a straight parabola somewhat away from the antisolar direction. //Mat4d dustTailRot=Mat4d::rotation(eclposNrm^(-velocity), 0.15f*std::acos(eclposNrm.dot(-velocity))); // GZ: This scale factor of 0.15 is empirical from photos of Halley and Hale-Bopp. // The curved tail is curved towards positive X. We first rotate around the Z axis into a direction opposite of the motion vector, then again the antisolar rotation applies. Mat4d dustTailRot=Mat4d::zrotation(atan2(velocity[1], velocity[0]) + M_PI); transfo2->combine(dustTailRot); // In addition, we let the dust tail already start with a light tilt. Mat4d dustTailYrot=Mat4d::yrotation(5.0f*velocity.length()); // again, this is pretty ad-hoc, feel free to improve! transfo2->combine(dustTailYrot); } StelPainter* sPainter = new StelPainter(core->getProjection(transfo2)); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); glDisable(GL_CULL_FACE); // GZ: If we use getVMagnitudeWithExtinction(), a head extincted in the horizon mist can completely hide an otherwise frighteningly long tail. // we must use unextincted mag, but mix/dim with atmosphere/sky brightness. // In addition, light falloff is a bit reduced for better visibility. Power basis should be 0.4, we use 0.6. //float magfactor=std::pow(0.4f , getVMagnitudeWithExtinction(core)); float magFactor=std::pow(0.6f , getVMagnitude(core)); if (core->getSkyDrawer()->getFlagHasAtmosphere()) { // Mix with sky brightness and light pollution: This is very ad-hoc, if someone finds a better solution, please go ahead! // Light pollution: float bortleIndexFactor=0.1f * (11 - core->getSkyDrawer()->getBortleScaleIndex()); magFactor*= bortleIndexFactor*bortleIndexFactor; // GZ-Guesstimate for light pollution influence // sky brightness: This is about 10 for twilight where bright comet tails should already be visible. Dark night is close to 0. float avgAtmLum=GETSTELMODULE(LandscapeMgr)->getAtmosphereAverageLuminance(); float atmLumFactor=(15.0f-avgAtmLum)/15.0f; if (atmLumFactor<0.05f) atmLumFactor=0.05f; //atmLumFactor=std::sqrt(atmLumFactor); magFactor*=atmLumFactor*atmLumFactor; } magFactor*=(gas? 0.9 : dustTailBrightnessFactor); // TBD: empirical adjustment for texture brightness. magFactor=qMin(magFactor, 1.05f); // Limit excessively bright display. gasTailTexture->bind(); if (gas) { //gasTailTexture->bind(); sPainter->setColor(0.15f*magFactor,0.15f*magFactor,0.6f*magFactor); sPainter->setArrays((Vec3d*)gastailVertexArr.constData(), (Vec2f*)gastailTexCoordArr.constData()); sPainter->drawFromArray(StelPainter::Triangles, gastailIndices.size(), 0, true, gastailIndices.constData()); } else { //dustTailTexture->bind(); sPainter->setColor(magFactor, magFactor,0.6f*magFactor); //sPainter->setArrays((Vec3d*)dusttailVertexArr.constData(), (Vec2f*)dusttailTexCoordArr.constData()); //sPainter->drawFromArray(StelPainter::Triangles, dusttailIndices.size(), 0, true, dusttailIndices.constData()); sPainter->setArrays((Vec3d*)dusttailVertexArr.constData(), (Vec2f*)gastailTexCoordArr.constData()); sPainter->drawFromArray(StelPainter::Triangles, gastailIndices.size(), 0, true, gastailIndices.constData()); } glDisable(GL_BLEND); if (sPainter) delete sPainter; sPainter=NULL; }
void SatellitesDialog::updateSatelliteData() { // NOTE: This was probably going to be used for editing satellites? satelliteModified = false; QModelIndexList selection = ui->satellitesList->selectionModel()->selectedIndexes(); if (selection.isEmpty()) return; // TODO: Clear the fields? enableSatelliteDataForm(false); if (selection.count() > 1) { ui->nameEdit->clear(); ui->noradNumberEdit->clear(); ui->descriptionTextEdit->clear(); ui->tleFirstLineEdit->clear(); ui->tleSecondLineEdit->clear(); } else { QModelIndex& index = selection.first(); ui->nameEdit->setText(index.data(Qt::DisplayRole).toString()); ui->noradNumberEdit->setText(index.data(Qt::UserRole).toString()); // NOTE: Description is deliberately displayed untranslated! ui->descriptionTextEdit->setText(index.data(SatDescriptionRole).toString()); ui->tleFirstLineEdit->setText(index.data(FirstLineRole).toString()); ui->tleFirstLineEdit->setCursorPosition(0); ui->tleSecondLineEdit->setText(index.data(SecondLineRole).toString()); ui->tleSecondLineEdit->setCursorPosition(0); } // TODO: Fix the comms button... // ui->commsButton->setEnabled(sat->comms.count()>0); // Things that are cumulative in a multi-selection GroupSet globalGroups = GETSTELMODULE(Satellites)->getGroups(); GroupSet groupsUsedBySome; GroupSet groupsUsedByAll = globalGroups; ui->displayedCheckbox->setChecked(false); ui->orbitCheckbox->setChecked(false); ui->userCheckBox->setChecked(false); for (int i = 0; i < selection.size(); i++) { const QModelIndex& index = selection.at(i); // "Displayed" checkbox SatFlags flags = index.data(SatFlagsRole).value<SatFlags>(); if (flags.testFlag(SatDisplayed)) { if (!ui->displayedCheckbox->isChecked()) { if (i == 0) ui->displayedCheckbox->setChecked(true); else ui->displayedCheckbox->setCheckState(Qt::PartiallyChecked); } } else if (ui->displayedCheckbox->isChecked()) ui->displayedCheckbox->setCheckState(Qt::PartiallyChecked); // "Orbit" box if (flags.testFlag(SatOrbit)) { if (!ui->orbitCheckbox->isChecked()) { if (i == 0) ui->orbitCheckbox->setChecked(true); else ui->orbitCheckbox->setCheckState(Qt::PartiallyChecked); } } else if (ui->orbitCheckbox->isChecked()) ui->orbitCheckbox->setCheckState(Qt::PartiallyChecked); // User ("do not update") box if (flags.testFlag(SatUser)) { if (!ui->userCheckBox->isChecked()) { if (i == 0) ui->userCheckBox->setChecked(true); else ui->userCheckBox->setCheckState(Qt::PartiallyChecked); } } else if (ui->userCheckBox->isChecked()) ui->userCheckBox->setCheckState(Qt::PartiallyChecked); // Accumulating groups GroupSet groups = index.data(SatGroupsRole).value<GroupSet>(); groupsUsedBySome.unite(groups); groupsUsedByAll.intersect(groups); } // Repopulate the group selector // Nice list of checkable, translated groups that allows adding new groups ui->groupsListWidget->blockSignals(true); ui->groupsListWidget->clear(); foreach (const QString& group, globalGroups) { QListWidgetItem* item = new QListWidgetItem(q_(group), ui->groupsListWidget); item->setData(Qt::UserRole, group); Qt::CheckState state = Qt::Unchecked; if (groupsUsedByAll.contains(group)) state = Qt::Checked; else if (groupsUsedBySome.contains(group)) state = Qt::PartiallyChecked; item->setData(Qt::CheckStateRole, state); }
void StelGui::update() { StelCore* core = StelApp::getInstance().getCore(); if (core->getTimeRate()<-0.99*StelCore::JD_SECOND) { if (buttonTimeRewind->isChecked()==false) buttonTimeRewind->setChecked(true); } else { if (buttonTimeRewind->isChecked()==true) buttonTimeRewind->setChecked(false); } if (core->getTimeRate()>1.01*StelCore::JD_SECOND) { if (buttonTimeForward->isChecked()==false) { buttonTimeForward->setChecked(true); } } else { if (buttonTimeForward->isChecked()==true) buttonTimeForward->setChecked(false); } if (core->getTimeRate() == 0) { if (buttonTimeRealTimeSpeed->isChecked() != StelButton::ButtonStateNoChange) buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateNoChange); } else if (core->getRealTimeSpeed()) { if (buttonTimeRealTimeSpeed->isChecked() != StelButton::ButtonStateOn) buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateOn); } else if (buttonTimeRealTimeSpeed->isChecked() != StelButton::ButtonStateOff) { buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateOff); } const bool isTimeNow=core->getIsTimeNow(); if (buttonTimeCurrent->isChecked()!=isTimeNow) { buttonTimeCurrent->setChecked(isTimeNow); } StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr); const bool b = mmgr->getFlagTracking(); if (buttonGotoSelectedObject->isChecked()!=b) { buttonGotoSelectedObject->setChecked(b); } bool flag = GETSTELMODULE(StarMgr)->getFlagStars(); if (getGuiAction("actionShow_Stars")->isChecked() != flag) { getGuiAction("actionShow_Stars")->setChecked(flag); } flag = GETSTELMODULE(NebulaMgr)->getFlagHints(); if (getGuiAction("actionShow_Nebulas")->isChecked() != flag) getGuiAction("actionShow_Nebulas")->setChecked(flag); flag = GETSTELMODULE(StelSkyLayerMgr)->getFlagShow(); if (getGuiAction("actionShow_DSS")->isChecked() != flag) getGuiAction("actionShow_DSS")->setChecked(flag); flag = mmgr->getMountMode() != StelMovementMgr::MountAltAzimuthal; if (getGuiAction("actionSwitch_Equatorial_Mount")->isChecked() != flag) getGuiAction("actionSwitch_Equatorial_Mount")->setChecked(flag); SolarSystem* ssmgr = GETSTELMODULE(SolarSystem); flag = ssmgr->getFlagLabels(); if (getGuiAction("actionShow_Planets_Labels")->isChecked() != flag) getGuiAction("actionShow_Planets_Labels")->setChecked(flag); flag = ssmgr->getFlagOrbits(); if (getGuiAction("actionShow_Planets_Orbits")->isChecked() != flag) getGuiAction("actionShow_Planets_Orbits")->setChecked(flag); flag = ssmgr->getFlagTrails(); if (getGuiAction("actionShow_Planets_Trails")->isChecked() != flag) getGuiAction("actionShow_Planets_Trails")->setChecked(flag); flag = StelApp::getInstance().getVisionModeNight(); if (getGuiAction("actionShow_Night_Mode")->isChecked() != flag) getGuiAction("actionShow_Night_Mode")->setChecked(flag); flag = StelMainWindow::getInstance().isFullScreen(); if (getGuiAction("actionSet_Full_Screen_Global")->isChecked() != flag) getGuiAction("actionSet_Full_Screen_Global")->setChecked(flag); skyGui->infoPanel->setTextFromObjects(GETSTELMODULE(StelObjectMgr)->getSelectedObject()); // Check if the progressbar window changed, if yes update the whole view if (savedProgressBarSize!=skyGui->progressBarMgr->boundingRect().size()) { savedProgressBarSize=skyGui->progressBarMgr->boundingRect().size(); skyGui->updateBarsPos(); } dateTimeDialog->setDateTime(core->getJDay()); }
void StelGui::initGrindLineMgr() { GridLinesMgr* gridLineManager = GETSTELMODULE(GridLinesMgr); getGuiAction("actionShow_Equatorial_Grid")->setChecked(gridLineManager->getFlagEquatorGrid()); connect(getGuiAction("actionShow_Equatorial_Grid"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagEquatorGrid(bool))); connect(gridLineManager, SIGNAL(equatorGridDisplayedChanged(const bool)), this, SLOT(equatorGridDisplayedUpdated(const bool))); getGuiAction("actionShow_Azimuthal_Grid")->setChecked(gridLineManager->getFlagAzimuthalGrid()); connect(getGuiAction("actionShow_Azimuthal_Grid"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagAzimuthalGrid(bool))); connect(gridLineManager, SIGNAL(azimuthalGridDisplayedChanged(const bool)), this, SLOT(azimuthalGridDisplayedUpdated(const bool))); getGuiAction("actionShow_Ecliptic_Line")->setChecked(gridLineManager->getFlagEclipticLine()); connect(getGuiAction("actionShow_Ecliptic_Line"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagEclipticLine(bool))); connect(gridLineManager, SIGNAL(eclipticLineDisplayedChanged(const bool)), this, SLOT(eclipticLineDisplayedUpdated(const bool))); getGuiAction("actionShow_Equator_Line")->setChecked(gridLineManager->getFlagEquatorLine()); connect(getGuiAction("actionShow_Equator_Line"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagEquatorLine(bool))); connect(gridLineManager, SIGNAL(equatorLineDisplayedChanged(const bool)), this, SLOT(equatorLineDisplayedUpdated(const bool))); getGuiAction("actionShow_Meridian_Line")->setChecked(gridLineManager->getFlagMeridianLine()); connect(getGuiAction("actionShow_Meridian_Line"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagMeridianLine(bool))); connect(gridLineManager, SIGNAL(meridianLineDisplayedChanged(const bool)), this, SLOT(meridianLineDisplayedUpdated(const bool))); getGuiAction("actionShow_Horizon_Line")->setChecked(gridLineManager->getFlagHorizonLine()); connect(getGuiAction("actionShow_Horizon_Line"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagHorizonLine(bool))); connect(gridLineManager, SIGNAL(horizonLineDisplayedChanged(const bool)), this, SLOT(horizonLineDisplayedUpdated(const bool))); getGuiAction("actionShow_Equatorial_J2000_Grid")->setChecked(gridLineManager->getFlagEquatorJ2000Grid()); connect(getGuiAction("actionShow_Equatorial_J2000_Grid"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagEquatorJ2000Grid(bool))); connect(gridLineManager, SIGNAL(equatorJ2000GridDisplayedChanged(const bool)), this, SLOT(equatorJ2000GridDisplayedUpdated(const bool))); getGuiAction("actionShow_Ecliptic_J2000_Grid")->setChecked(gridLineManager->getFlagEclipticJ2000Grid()); connect(getGuiAction("actionShow_Ecliptic_J2000_Grid"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagEclipticJ2000Grid(bool))); connect(gridLineManager, SIGNAL(eclipticJ2000GridDisplayedChanged(const bool)), this, SLOT(eclipticJ2000GridDisplayedUpdated(const bool))); getGuiAction("actionShow_Galactic_Grid")->setChecked(gridLineManager->getFlagGalacticGrid()); connect(getGuiAction("actionShow_Galactic_Grid"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagGalacticGrid(bool))); connect(gridLineManager, SIGNAL(galacticGridDisplayedChanged(const bool)), this, SLOT(galacticGridDisplayedUpdated(const bool))); getGuiAction("actionShow_Galactic_Plane_Line")->setChecked(gridLineManager->getFlagGalacticPlaneLine()); connect(getGuiAction("actionShow_Galactic_Plane_Line"), SIGNAL(toggled(bool)), gridLineManager, SLOT(setFlagGalacticPlaneLine(bool))); connect(gridLineManager, SIGNAL(galacticPlaneLineDisplayedChanged(const bool)), this, SLOT(galacticPlaneLineDisplayedUpdated(const bool))); }
/* Init our module */ void Pulsars::init() { upgradeConfigIni(); try { StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Pulsars"); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Pulsars")) { qDebug() << "Pulsars: no Pulsars section exists in main config file - creating with defaults"; restoreDefaultConfigIni(); } // populate settings from main config file. readSettingsFromConfig(); jsonCatalogPath = StelFileMgr::findFile("modules/Pulsars", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/pulsars.json"; if (jsonCatalogPath.isEmpty()) return; texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png"); Pulsar::markerTexture = StelApp::getInstance().getTextureManager().createTexture(":/Pulsars/pulsar.png"); // key bindings and other actions addAction("actionShow_Pulsars", N_("Pulsars"), N_("Show pulsars"), "pulsarsVisible", "Ctrl+Alt+P"); addAction("actionShow_Pulsars_ConfigDialog", N_("Pulsars"), N_("Pulsars configuration window"), configDialog, "visible"); GlowIcon = new QPixmap(":/graphicGui/glow32x32.png"); OnIcon = new QPixmap(":/Pulsars/btPulsars-on.png"); OffIcon = new QPixmap(":/Pulsars/btPulsars-off.png"); setFlagShowPulsars(getEnableAtStartup()); setFlagShowPulsarsButton(flagShowPulsarsButton); } catch (std::runtime_error &e) { qWarning() << "Pulsars: 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(messageTimeout())); // If the json file does not already exist, create it from the resource in the Qt resource if(QFileInfo(jsonCatalogPath).exists()) { if (!checkJsonFileFormat() || getJsonFileFormatVersion()<CATALOG_FORMAT_VERSION) { restoreDefaultJsonFile(); } } else { qDebug() << "Pulsars: pulsars.json does not exist - copying default file to" << QDir::toNativeSeparators(jsonCatalogPath); restoreDefaultJsonFile(); } qDebug() << "Pulsars: loading catalog file:" << QDir::toNativeSeparators(jsonCatalogPath); readJsonFile(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(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(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); }
void ArchaeoLinesDialog::createDialogContent() { al = GETSTELMODULE(ArchaeoLines); ui->setupUi(dialog); #ifdef Q_OS_WIN //Kinetic scrolling for tablet pc and pc QList<QWidget *> addscroll; addscroll << ui->aboutTextBrowser; installKineticScrolling(addscroll); #endif 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))); //ui->useDmsFormatCheckBox->setChecked(al->isDmsFormat()); //connect(ui->useDmsFormatCheckBox, SIGNAL(toggled(bool)), al, SLOT(useDmsFormat(bool))); ui->equinoxCheckBox->setChecked(al->isEquinoxDisplayed()); connect(ui->equinoxCheckBox, SIGNAL(toggled(bool)), al, SLOT(showEquinox(bool))); ui->solsticesCheckBox->setChecked(al->isSolsticesDisplayed()); connect(ui->solsticesCheckBox, SIGNAL(toggled(bool)), al, SLOT(showSolstices(bool))); ui->crossquarterCheckBox->setChecked(al->isCrossquartersDisplayed()); connect(ui->crossquarterCheckBox, SIGNAL(toggled(bool)), al, SLOT(showCrossquarters(bool))); ui->majorStandstillCheckBox->setChecked(al->isMajorStandstillsDisplayed()); connect(ui->majorStandstillCheckBox, SIGNAL(toggled(bool)), al, SLOT(showMajorStandstills(bool))); ui->minorStandstillCheckBox->setChecked(al->isMinorStandstillsDisplayed()); connect(ui->minorStandstillCheckBox, SIGNAL(toggled(bool)), al, SLOT(showMinorStandstills(bool))); ui->zenithPassageCheckBox->setChecked(al->isZenithPassageDisplayed()); connect(ui->zenithPassageCheckBox, SIGNAL(toggled(bool)), al, SLOT(showZenithPassage(bool))); ui->nadirPassageCheckBox->setChecked(al->isNadirPassageDisplayed()); connect(ui->nadirPassageCheckBox, SIGNAL(toggled(bool)), al, SLOT(showNadirPassage(bool))); ui->selectedObjectCheckBox->setChecked(al->isSelectedObjectDisplayed()); connect(ui->selectedObjectCheckBox, SIGNAL(toggled(bool)), al, SLOT(showSelectedObject(bool))); ui->currentSunCheckBox->setChecked(al->isCurrentSunDisplayed()); connect(ui->currentSunCheckBox, SIGNAL(toggled(bool)), al, SLOT(showCurrentSun(bool))); ui->currentMoonCheckBox->setChecked(al->isCurrentMoonDisplayed()); connect(ui->currentMoonCheckBox, SIGNAL(toggled(bool)), al, SLOT(showCurrentMoon(bool))); // Planet ComboBox requires special handling! setCurrentPlanetFromApp(); connect(al, SIGNAL(currentPlanetChanged(ArchaeoLine::Line)), this, SLOT(setCurrentPlanetFromApp())); connect(ui->currentPlanetComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentPlanetFromGUI(int))); ui->customAzimuth1CheckBox->setChecked(al->isCustomAzimuth1Displayed()); connect(ui->customAzimuth1CheckBox, SIGNAL(toggled(bool)), al, SLOT(showCustomAzimuth1(bool))); ui->customAzimuth2CheckBox->setChecked(al->isCustomAzimuth2Displayed()); connect(ui->customAzimuth2CheckBox, SIGNAL(toggled(bool)), al, SLOT(showCustomAzimuth2(bool))); ui->customAzimuth1DoubleSpinBox->setValue(al->getLineAngle(ArchaeoLine::CustomAzimuth1)); ui->customAzimuth2DoubleSpinBox->setValue(al->getLineAngle(ArchaeoLine::CustomAzimuth2)); connect(ui->customAzimuth1DoubleSpinBox, SIGNAL(valueChanged(double)), al, SLOT(setCustomAzimuth1(double))); connect(ui->customAzimuth2DoubleSpinBox, SIGNAL(valueChanged(double)), al, SLOT(setCustomAzimuth2(double))); ui->customAzimuth1LineEdit->setText(al->getLineLabel(ArchaeoLine::CustomAzimuth1)); ui->customAzimuth2LineEdit->setText(al->getLineLabel(ArchaeoLine::CustomAzimuth2)); connect(ui->customAzimuth1LineEdit, SIGNAL(textChanged(QString)), al, SLOT(setCustomAzimuth1Label(QString))); connect(ui->customAzimuth2LineEdit, SIGNAL(textChanged(QString)), al, SLOT(setCustomAzimuth2Label(QString))); equinoxColor = al->getLineColor(ArchaeoLine::Equinox); solsticeColor = al->getLineColor(ArchaeoLine::Solstices); crossquarterColor = al->getLineColor(ArchaeoLine::Crossquarters); majorStandstillColor = al->getLineColor(ArchaeoLine::MajorStandstill); minorStandstillColor = al->getLineColor(ArchaeoLine::MinorStandstill); zenithPassageColor = al->getLineColor(ArchaeoLine::ZenithPassage); nadirPassageColor = al->getLineColor(ArchaeoLine::NadirPassage); selectedObjectColor = al->getLineColor(ArchaeoLine::SelectedObject); currentSunColor = al->getLineColor(ArchaeoLine::CurrentSun); currentMoonColor = al->getLineColor(ArchaeoLine::CurrentMoon); currentPlanetColor = al->getLineColor(ArchaeoLine::CurrentPlanetNone); customAzimuth1Color = al->getLineColor(ArchaeoLine::CustomAzimuth1); customAzimuth2Color = al->getLineColor(ArchaeoLine::CustomAzimuth2); equinoxColorPixmap=QPixmap(48, 12); equinoxColorPixmap.fill(equinoxColor); ui->equinoxColorToolButton->setIconSize(QSize(48, 12)); ui->equinoxColorToolButton->setIcon(QIcon(equinoxColorPixmap)); solsticeColorPixmap=QPixmap(48, 12); solsticeColorPixmap.fill(solsticeColor); ui->solsticesColorToolButton->setIconSize(QSize(48, 12)); ui->solsticesColorToolButton->setIcon(QIcon(solsticeColorPixmap)); crossquarterColorPixmap=QPixmap(48, 12); crossquarterColorPixmap.fill(crossquarterColor); ui->crossquarterColorToolButton->setIconSize(QSize(48, 12)); ui->crossquarterColorToolButton->setIcon(QIcon(crossquarterColorPixmap)); minorStandstillColorPixmap=QPixmap(48, 12); minorStandstillColorPixmap.fill(minorStandstillColor); ui->minorStandstillColorToolButton->setIconSize(QSize(48, 12)); ui->minorStandstillColorToolButton->setIcon(QIcon(minorStandstillColorPixmap)); majorStandstillColorPixmap=QPixmap(48, 12); majorStandstillColorPixmap.fill(majorStandstillColor); ui->majorStandstillColorToolButton->setIconSize(QSize(48, 12)); ui->majorStandstillColorToolButton->setIcon(QIcon(majorStandstillColorPixmap)); zenithPassageColorPixmap=QPixmap(48, 12); zenithPassageColorPixmap.fill(zenithPassageColor); ui->zenithPassageColorToolButton->setIconSize(QSize(48, 12)); ui->zenithPassageColorToolButton->setIcon(QIcon(zenithPassageColorPixmap)); nadirPassageColorPixmap=QPixmap(48, 12); nadirPassageColorPixmap.fill(nadirPassageColor); ui->nadirPassageColorToolButton->setIconSize(QSize(48, 12)); ui->nadirPassageColorToolButton->setIcon(QIcon(nadirPassageColorPixmap)); selectedObjectColorPixmap=QPixmap(48, 12); selectedObjectColorPixmap.fill(selectedObjectColor); ui->selectedObjectColorToolButton->setIconSize(QSize(48, 12)); ui->selectedObjectColorToolButton->setIcon(QIcon(selectedObjectColorPixmap)); currentSunColorPixmap=QPixmap(48, 12); currentSunColorPixmap.fill(currentSunColor); ui->currentSunColorToolButton->setIconSize(QSize(48, 12)); ui->currentSunColorToolButton->setIcon(QIcon(currentSunColorPixmap)); currentMoonColorPixmap=QPixmap(48, 12); currentMoonColorPixmap.fill(currentMoonColor); ui->currentMoonColorToolButton->setIconSize(QSize(48, 12)); ui->currentMoonColorToolButton->setIcon(QIcon(currentMoonColorPixmap)); currentPlanetColorPixmap=QPixmap(48, 12); currentPlanetColorPixmap.fill(currentPlanetColor); ui->currentPlanetColorToolButton->setIconSize(QSize(48, 12)); ui->currentPlanetColorToolButton->setIcon(QIcon(currentPlanetColorPixmap)); customAzimuth1ColorPixmap=QPixmap(48, 12); customAzimuth1ColorPixmap.fill(customAzimuth1Color); ui->customAzimuth1ColorToolButton->setIconSize(QSize(48, 12)); ui->customAzimuth1ColorToolButton->setIcon(QIcon(customAzimuth1ColorPixmap)); customAzimuth2ColorPixmap=QPixmap(48, 12); customAzimuth2ColorPixmap.fill(customAzimuth2Color); ui->customAzimuth2ColorToolButton->setIconSize(QSize(48, 12)); ui->customAzimuth2ColorToolButton->setIcon(QIcon(customAzimuth2ColorPixmap)); connect(ui->equinoxColorToolButton, SIGNAL(released()), this, SLOT(askEquinoxColor())); connect(ui->solsticesColorToolButton, SIGNAL(released()), this, SLOT(askSolsticeColor())); connect(ui->crossquarterColorToolButton, SIGNAL(released()), this, SLOT(askCrossquarterColor())); connect(ui->majorStandstillColorToolButton, SIGNAL(released()), this, SLOT(askMajorStandstillColor())); connect(ui->minorStandstillColorToolButton, SIGNAL(released()), this, SLOT(askMinorStandstillColor())); connect(ui->zenithPassageColorToolButton, SIGNAL(released()), this, SLOT(askZenithPassageColor())); connect(ui->nadirPassageColorToolButton, SIGNAL(released()), this, SLOT(askNadirPassageColor())); connect(ui->selectedObjectColorToolButton, SIGNAL(released()), this, SLOT(askSelectedObjectColor())); connect(ui->currentSunColorToolButton, SIGNAL(released()), this, SLOT(askCurrentSunColor())); connect(ui->currentMoonColorToolButton, SIGNAL(released()), this, SLOT(askCurrentMoonColor())); connect(ui->currentPlanetColorToolButton, SIGNAL(released()), this, SLOT(askCurrentPlanetColor())); connect(ui->customAzimuth1ColorToolButton, SIGNAL(released()), this, SLOT(askCustomAzimuth1Color())); connect(ui->customAzimuth2ColorToolButton, SIGNAL(released()), this, SLOT(askCustomAzimuth2Color())); connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(resetArchaeoLinesSettings())); // We must apparently warn about a potential problem, but only on Windows. (QTBUG-35302) #ifndef Q_OS_WIN ui->switchToWindowedModeLabel->hide(); #endif setAboutHtml(); }
/* Init our module */ void Exoplanets::init() { try { StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Exoplanets"); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Exoplanets")) { qDebug() << "Exoplanets::init no Exoplanets section exists in main config file - creating with defaults"; restoreDefaultConfigIni(); } // populate settings from main config file. readSettingsFromConfig(); jsonCatalogPath = StelFileMgr::findFile("modules/Exoplanets", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/exoplanets.json"; // key bindings and other actions StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png"); OnIcon = new QPixmap(":/Exoplanets/btExoplanets-on.png"); OffIcon = new QPixmap(":/Exoplanets/btExoplanets-off.png"); gui->getGuiAction("actionShow_Exoplanets")->setChecked(flagShowExoplanets); toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Exoplanets")); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup"); connect(gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SIGNAL(toggled(bool)), exoplanetsConfigDialog, SLOT(setVisible(bool))); connect(exoplanetsConfigDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SLOT(setChecked(bool))); connect(gui->getGuiAction("actionShow_Exoplanets"), SIGNAL(toggled(bool)), this, SLOT(setFlagShowExoplanets(bool))); } catch (std::runtime_error &e) { qWarning() << "Exoplanets::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(messageTimeout())); // If the json file does not already exist, create it from the resource in the Qt resource if(QFileInfo(jsonCatalogPath).exists()) { if (getJsonFileVersion() < CATALOG_FORMAT_VERSION) { restoreDefaultJsonFile(); } } else { qDebug() << "Exoplanets::init catalog.json does not exist - copying default file to " << jsonCatalogPath; restoreDefaultJsonFile(); } qDebug() << "Exoplanets::init using catalog.json file: " << jsonCatalogPath; readJsonFile(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(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(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); }
void PulsarsDialog::setUpdateValues(int days) { GETSTELMODULE(Pulsars)->setUpdateFrequencyDays(days); refreshUpdateValues(); }
void MeteorShowersMgr::messageTimeout() { foreach(int i, m_messageIDs) { GETSTELMODULE(LabelMgr)->deleteLabel(i); }
void PulsarsDialog::setDistributionEnabled(int checkState) { bool b = checkState != Qt::Unchecked; GETSTELMODULE(Pulsars)->setDisplayMode(b); }
/************************************************************************* Reimplementation of the getCallOrder method *************************************************************************/ double StelSkyLayerMgr::getCallOrder(StelModuleActionName actionName) const { if (actionName==StelModule::ActionDraw) return GETSTELMODULE(MilkyWay)->getCallOrder(actionName)+5; return 0; }
void PulsarsDialog::setDisplayAtStartupEnabled(int checkState) { bool b = checkState != Qt::Unchecked; GETSTELMODULE(Pulsars)->setEnableAtStartup(b); }
void SupernovaeDialog::updateGuiFromSettings(void) { ui->internetUpdatesCheckbox->setChecked(GETSTELMODULE(Supernovae)->getUpdatesEnabled()); refreshUpdateValues(); }
void PulsarsDialog::setDisplayShowPulsarsButton(int checkState) { bool b = checkState != Qt::Unchecked; GETSTELMODULE(Pulsars)->setFlagShowPulsarsButton(b); }
} void SatellitesDialog::listSatelliteGroup(int index) { QItemSelectionModel* selectionModel = ui->satellitesList->selectionModel(); QModelIndexList selectedIndexes = selectionModel->selectedRows(); QVariantList prevMultiSelection; foreach (const QModelIndex& index, selectedIndexes) { prevMultiSelection << index.data(Qt::UserRole); } satellitesModel->clear(); QHash<QString,QString> satellites; Satellites* plugin = GETSTELMODULE(Satellites); QString selectedGroup = ui->groupsCombo->itemData(index).toString(); if (selectedGroup == "all") satellites = plugin->getSatellites(); else if (selectedGroup == "visible") satellites = plugin->getSatellites(QString(), Satellites::Visible); else if (selectedGroup == "notvisible") satellites = plugin->getSatellites(QString(), Satellites::NotVisible); else if (selectedGroup == "newlyadded") satellites = plugin->getSatellites(QString(), Satellites::NewlyAdded); else if (selectedGroup == "orbiterror") satellites = plugin->getSatellites(QString(), Satellites::OrbitError); else satellites = plugin->getSatellites(ui->groupsCombo->currentText()); //satellitesModel->->setSortingEnabled(false);
void PulsarsDialog::saveSettings(void) { GETSTELMODULE(Pulsars)->saveSettingsToConfig(); }
void ObservabilityDialog::saveSettings(void) { GETSTELMODULE(Observability)->saveSettingsToConfig(); }
/* Init our module */ void Supernovae::init() { try { StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Supernovae"); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Supernovae")) { qDebug() << "Supernovae: no Supernovae section exists in main config file - creating with defaults"; restoreDefaultConfigIni(); } // populate settings from main config file. readSettingsFromConfig(); sneJsonPath = StelFileMgr::findFile("modules/Supernovae", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/supernovae.json"; if (sneJsonPath.isEmpty()) return; texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png"); // key bindings and other actions addAction("actionShow_Supernovae_ConfigDialog", N_("Historical Supernovae"), N_("Historical Supernovae configuration window"), configDialog, "visible"); } catch (std::runtime_error &e) { qWarning() << "Supernovas: 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(messageTimeout())); // If the json file does not already exist, create it from the resource in the Qt resource if(QFileInfo(sneJsonPath).exists()) { if (!checkJsonFileFormat() || getJsonFileVersion()<CATALOG_FORMAT_VERSION) { restoreDefaultJsonFile(); } } else { qDebug() << "Supernovae: supernovae.json does not exist - copying default file to" << QDir::toNativeSeparators(sneJsonPath); restoreDefaultJsonFile(); } qDebug() << "Supernovae: loading catalog file:" << QDir::toNativeSeparators(sneJsonPath); readJsonFile(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(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(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); }
void ObservabilityDialog::setOppositionFlag(int checkState) { bool b = checkState != Qt::Unchecked; GETSTELMODULE(Observability)->setShow(4,b); }
void StelMovementMgr::init() { QSettings* conf = StelApp::getInstance().getSettings(); objectMgr = GETSTELMODULE(StelObjectMgr); Q_ASSERT(conf); Q_ASSERT(objectMgr); connect(objectMgr, SIGNAL(selectedObjectChanged(StelModule::StelModuleSelectAction)), this, SLOT(selectedObjectChange(StelModule::StelModuleSelectAction))); movementsSpeedFactor=1.; flagEnableMoveAtScreenEdge = conf->value("navigation/flag_enable_move_at_screen_edge",false).toBool(); mouseZoomSpeed = conf->value("navigation/mouse_zoom",30).toInt(); flagEnableZoomKeys = conf->value("navigation/flag_enable_zoom_keys").toBool(); flagEnableMoveKeys = conf->value("navigation/flag_enable_move_keys").toBool(); keyMoveSpeed = conf->value("navigation/move_speed",0.0004f).toFloat(); keyZoomSpeed = conf->value("navigation/zoom_speed", 0.0004f).toFloat(); autoMoveDuration = conf->value ("navigation/auto_move_duration",1.5f).toFloat(); flagManualZoom = conf->value("navigation/flag_manual_zoom").toBool(); flagAutoZoomOutResetsDirection = conf->value("navigation/auto_zoom_out_resets_direction", true).toBool(); flagEnableMouseNavigation = conf->value("navigation/flag_enable_mouse_navigation",true).toBool(); minFov = conf->value("navigation/min_fov",0.001389).toDouble(); // default: minimal FOV = 5" maxFov = 100.; initFov = conf->value("navigation/init_fov",60.f).toFloat(); currentFov = initFov; setInitConstellationIntensity(conf->value("viewing/constellation_art_intensity", 0.5f).toFloat()); // With a special code of init_view_position=x/y/2 you can set zenith into the center and atan2(x/y) to bottom of screen. // examples: 1/0->0 (-1/0) // -1/0 ->180 (1/0) // 0/-1 --> 90 (0/-1) // 0/1 ->270 (0/1) Vec3f tmp = StelUtils::strToVec3f(conf->value("navigation/init_view_pos").toString()); if (tmp[2]==2) { initViewPos.set(0., 0., 1.); setViewUpVector(Vec3d(tmp[0], tmp[1], 0.)); setViewDirectionJ2000(core->altAzToJ2000(Vec3d(0., 0., 1.), StelCore::RefractionOff)); } else { initViewPos.set(tmp[0], tmp[1], tmp[2]); viewDirectionJ2000 = core->altAzToJ2000(initViewPos, StelCore::RefractionOff); } QString tmpstr = conf->value("navigation/viewing_mode", "horizon").toString(); if (tmpstr=="equator") setMountMode(StelMovementMgr::MountEquinoxEquatorial); else { if (tmpstr=="horizon") setMountMode(StelMovementMgr::MountAltAzimuthal); else { qWarning() << "ERROR: Unknown viewing mode type: " << tmpstr; setMountMode(StelMovementMgr::MountEquinoxEquatorial); } } QString movementGroup = N_("Movement and Selection"); addAction("actionSwitch_Equatorial_Mount", N_("Miscellaneous"), N_("Switch between equatorial and azimuthal mount"), "equatorialMount", "Ctrl+M"); addAction("actionGoto_Selected_Object", movementGroup, N_("Center on selected object"), "setFlagTracking()", "Space"); addAction("actionZoom_In_Auto", movementGroup, N_("Zoom in on selected object"), "autoZoomIn()", "/"); addAction("actionZoom_Out_Auto", movementGroup, N_("Zoom out"), "autoZoomOut()", "\\"); addAction("actionSet_Tracking", movementGroup, N_("Track object"), "tracking", "T"); }