StelGui.cpp   StelGui.cpp 
skipping to change at line 22 skipping to change at line 22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "SkyGui.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include "StelMainWindow.hpp" #include "StelMainWindow.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
skipping to change at line 43 skipping to change at line 44
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "ConstellationMgr.hpp" #include "ConstellationMgr.hpp"
#include "GridLinesMgr.hpp" #include "GridLinesMgr.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelNavigator.hpp" #include "StelNavigator.hpp"
#include "StelObjectType.hpp" #include "StelObjectType.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "StelSkyImageMgr.hpp" #include "StelSkyLayerMgr.hpp"
#include "StelStyle.hpp" #include "StelStyle.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "MeteorMgr.hpp" #include "MeteorMgr.hpp"
#include "DownloadPopup.hpp" #ifdef ENABLE_SCRIPT_CONSOLE
#include "StelDownloadMgr.hpp" #include "ScriptConsole.hpp"
#endif
#include "StelScriptMgr.hpp"
#include "StelAppGraphicsWidget.hpp"
#include <QDebug> #include <QDebug>
#include <QTimeLine> #include <QTimeLine>
#include <QFontDatabase> #include <QFontDatabase>
#include <QMouseEvent> #include <QMouseEvent>
#include <QAction> #include <QAction>
#include <QApplication> #include <QApplication>
#include <QFile> #include <QFile>
#include <QTextDocument>
#include <QTextBrowser> #include <QTextBrowser>
#include <QGraphicsWidget> #include <QGraphicsWidget>
#include <QGraphicsGridLayout>
InfoPanel::InfoPanel(QGraphicsItem* parent) : QGraphicsTextItem("", parent) StelGuiBase* StelStandardGuiPluginInterface::getStelGuiBase() const
{ {
QSettings* conf = StelApp::getInstance().getSettings(); return new StelGui();
Q_ASSERT(conf);
QString objectInfo = conf->value("gui/selected_object_info", "all").
toString();
if (objectInfo == "all")
infoTextFilters = StelObject::InfoStringGroup(StelObject::Al
lInfo);
else if (objectInfo == "short")
infoTextFilters = StelObject::InfoStringGroup(StelObject::Sh
ortInfo);
else if (objectInfo == "none")
infoTextFilters = StelObject::InfoStringGroup(0);
else
{
qWarning() << "config.ini option gui/selected_object_info is
invalid, using \"all\"";
infoTextFilters = StelObject::InfoStringGroup(StelObject::Al
lInfo);
}
QFont font("DejaVuSans");
font.setPixelSize(13);
setFont(font);
} }
Q_EXPORT_PLUGIN2(StelGui, StelStandardGuiPluginInterface)
void InfoPanel::setTextFromObjects(const QList<StelObjectP>& selected) StelGui::StelGui() : topLevelGraphicsWidget(NULL), configurationDialog(NULL
{ ), initDone(false)
if (selected.size() == 0)
{
if (!document()->isEmpty())
document()->clear();
}
else
{
// just print details of the first item for now
QString s = selected[0]->getInfoString(StelApp::getInstance(
).getCore(), infoTextFilters);
setHtml(s);
}
}
StelGui::StelGui() : initDone(false)
{ {
// QPixmapCache::setCacheLimit(30000); ? // QPixmapCache::setCacheLimit(30000); ?
setObjectName("StelGui");
winBar = NULL;
buttonBar = NULL;
infoPanel = NULL;
buttonBarPath = NULL;
lastButtonbarWidth = 0;
autoHidebts = NULL;
autoHideHorizontalButtonBar = true;
autoHideVerticalButtonBar = true;
animLeftBarTimeLine = new QTimeLine(200, this);
animLeftBarTimeLine->setCurveShape(QTimeLine::EaseInOutCurve);
connect(animLeftBarTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT
(updateBarsPos()));
animBottomBarTimeLine = new QTimeLine(200, this);
animBottomBarTimeLine->setCurveShape(QTimeLine::EaseInOutCurve);
connect(animBottomBarTimeLine, SIGNAL(valueChanged(qreal)), this, SL
OT(updateBarsPos()));
flipHoriz = NULL; flipHoriz = NULL;
flipVert = NULL; flipVert = NULL;
btShowNebulaeBackground = NULL; btShowNebulaeBackground = NULL;
} }
StelGui::~StelGui() StelGui::~StelGui()
{ {
infoPanel->deleteLater();
} }
/************************************************************************* void StelGui::init(QGraphicsWidget* atopLevelGraphicsWidget, StelAppGraphic
Reimplementation of the getCallOrder method sWidget* astelAppGraphicsWidget)
*************************************************************************/
double StelGui::getCallOrder(StelModuleActionName actionName) const
{
if (actionName==StelModule::ActionDraw)
return 100000;
if (actionName==StelModule::ActionHandleMouseMoves)
return -1;
return 0;
}
void StelGui::init()
{ {
qDebug() << "Creating GUI ..."; qDebug() << "Creating GUI ...";
StelGuiBase::init(atopLevelGraphicsWidget, astelAppGraphicsWidget);
skyGui = new SkyGui();
configurationDialog = new ConfigurationDialog(this);
//////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////// ///
// Create all the main actions of the program, associated with short cuts // Create all the main actions of the program, associated with short cuts
QString group = N_("Display Options"); QString group = N_("Display Options");
addGuiActions("actionShow_Constellation_Lines", N_("Constellation li addGuiActions("actionShow_Constellation_Lines", N_("Constellation li
nes"), "C", group, true, false, "viewing/flag_constellation_drawing"); nes"), "C", group, true, false);
addGuiActions("actionShow_Constellation_Art", N_("Constellation art" addGuiActions("actionShow_Constellation_Art", N_("Constellation art"
), "R", group, true, false, "viewing/flag_constellation_art"); ), "R", group, true, false);
addGuiActions("actionShow_Constellation_Labels", N_("Constellation l addGuiActions("actionShow_Constellation_Labels", N_("Constellation l
abels"), "V", group, true, false, "viewing/flag_constellation_name"); abels"), "V", group, true, false);
addGuiActions("actionShow_Constellation_Boundaries", N_("Constellati addGuiActions("actionShow_Constellation_Boundaries", N_("Constellati
on boundaries"), "B", group, true, false, "viewing/flag_constellation_bound on boundaries"), "B", group, true, false);
aries");
addGuiActions("actionShow_Azimuthal_Grid", N_("Azimuthal grid"), "Z"
addGuiActions("actionShow_Azimuthal_Grid", N_("Azimuthal grid"), "Z" , group, true, false);
, group, true, false, "viewing/flag_azimuthal_grid"); addGuiActions("actionShow_Equatorial_Grid", N_("Equatorial grid"), "
addGuiActions("actionShow_Equatorial_Grid", N_("Equatorial grid"), " E", group, true, false);
E", group, true, false, "viewing/flag_equatorial_grid"); addGuiActions("actionShow_Equatorial_J2000_Grid", N_("Equatorial J20
addGuiActions("actionShow_Equatorial_J2000_Grid", N_("Equatorial J20 00 grid"), "", group, true, false);
00 grid"), "", group, true, false, "viewing/flag_equatorial_J2000_grid"); addGuiActions("actionShow_Galactic_Grid", N_("Galactic grid"), "", g
addGuiActions("actionShow_Ecliptic_Line", N_("Ecliptic line"), ",", roup, true, false);
group, true, false, "viewing/flag_ecliptic_line"); addGuiActions("actionShow_Ecliptic_Line", N_("Ecliptic line"), ",",
addGuiActions("actionShow_Equator_Line", N_("Equator line"), ".", gr group, true, false);
oup, true, false, "viewing/flag_equator_line"); addGuiActions("actionShow_Equator_Line", N_("Equator line"), ".", gr
addGuiActions("actionShow_Meridian_Line", N_("Meridian line"), "", g oup, true, false);
roup, true, false, "viewing/flag_meridian_line"); addGuiActions("actionShow_Meridian_Line", N_("Meridian line"), ";",
addGuiActions("actionShow_Cardinal_Points", N_("Cardinal points"), " group, true, false);
Q", group, true, false, "viewing/flag_cardinal_points"); addGuiActions("actionShow_Cardinal_Points", N_("Cardinal points"), "
Q", group, true, false);
addGuiActions("actionShow_Ground", N_("Ground"), "G", group, true, f
alse, "landscape/flag_landscape"); addGuiActions("actionShow_Ground", N_("Ground"), "G", group, true, f
addGuiActions("actionShow_Atmosphere", N_("Atmosphere"), "A", group, alse);
true, false, "landscape/flag_atmosphere"); addGuiActions("actionShow_Atmosphere", N_("Atmosphere"), "A", group,
addGuiActions("actionShow_Fog", N_("Fog"), "F", group, true, false, true, false);
"landscape/flag_fog"); addGuiActions("actionShow_Fog", N_("Fog"), "F", group, true, false);
addGuiActions("actionShow_Nebulas", N_("Nebulas"), "N", group, true, false, "astro/flag_nebula_name"); addGuiActions("actionShow_Nebulas", N_("Nebulas"), "N", group, true, false);
addGuiActions("actionShow_DSS", N_("Nebulas background images"), "", group, true, false); addGuiActions("actionShow_DSS", N_("Nebulas background images"), "", group, true, false);
addGuiActions("actionShow_Stars", N_("Stars"), "S", group, true, fal addGuiActions("actionShow_Stars", N_("Stars"), "S", group, true, fal
se, "astro/flag_stars"); se);
addGuiActions("actionShow_Planets_Labels", N_("Planets labels"), "P" addGuiActions("actionShow_Planets_Labels", N_("Planets labels"), "P"
, group, true, false, "astro/flag_planets_labels"); , group, true, false);
addGuiActions("actionShow_Planets_Orbits", N_("Planet orbits"), "O",
group, true, false);
addGuiActions("actionShow_Night_Mode", N_("Night mode"), "", group, addGuiActions("actionShow_Night_Mode", N_("Night mode"), "", group,
true, false, "viewing/flag_night"); true, false);
addGuiActions("actionSet_Full_Screen_Global", N_("Full-screen mode") addGuiActions("actionSet_Full_Screen_Global", N_("Full-screen mode")
, "F11", group, true, false); // TODO: move persistence here? (currently el , "F11", group, true, false);
sewhere)
addGuiActions("actionHorizontal_Flip", N_("Flip scene horizontally") , "Ctrl+Shift+H", group, true, false); addGuiActions("actionHorizontal_Flip", N_("Flip scene horizontally") , "Ctrl+Shift+H", group, true, false);
addGuiActions("actionVertical_Flip", N_("Flip scene vertically"), "C trl+Shift+V", group, true, false); addGuiActions("actionVertical_Flip", N_("Flip scene vertically"), "C trl+Shift+V", group, true, false);
group = N_("Windows"); group = N_("Windows");
addGuiActions("actionShow_Help_Window_Global", N_("Help window"), "F 1", group, true, false); addGuiActions("actionShow_Help_Window_Global", N_("Help window"), "F 1", group, true, false);
addGuiActions("actionShow_Configuration_Window_Global", N_("Configur ation window"), "F2", group, true, false); addGuiActions("actionShow_Configuration_Window_Global", N_("Configur ation window"), "F2", group, true, false);
addGuiActions("actionShow_Search_Window_Global", N_("Search window") , "F3, Ctrl+F", group, true, false); addGuiActions("actionShow_Search_Window_Global", N_("Search window") , "F3, Ctrl+F", group, true, false);
addGuiActions("actionShow_SkyView_Window_Global", N_("Sky and viewin g options window"), "F4", group, true, false); addGuiActions("actionShow_SkyView_Window_Global", N_("Sky and viewin g options window"), "F4", group, true, false);
addGuiActions("actionShow_DateTime_Window_Global", N_("Date/time win dow"), "F5", group, true, false); addGuiActions("actionShow_DateTime_Window_Global", N_("Date/time win dow"), "F5", group, true, false);
addGuiActions("actionShow_Location_Window_Global", N_("Location wind ow"), "F6", group, true, false); addGuiActions("actionShow_Location_Window_Global", N_("Location wind ow"), "F6", group, true, false);
#ifdef ENABLE_SCRIPT_CONSOLE
addGuiActions("actionShow_ScriptConsole_Window_Global", N_("Script c
onsole window"), "F12", group, true, false);
#endif
group = N_("Date and Time"); group = N_("Date and Time");
addGuiActions("actionDecrease_Script_Speed", N_("Slow down the scrip
t execution rate"), "", group, false, false);
addGuiActions("actionIncrease_Script_Speed", N_("Speed up the script
execution rate"), "", group, false, false);
addGuiActions("actionSet_Real_Script_Speed", N_("Set the normal scri
pt execution rate"), "", group, false, false);
addGuiActions("actionDecrease_Time_Speed", N_("Decrease time speed") , "J", group, false, false); addGuiActions("actionDecrease_Time_Speed", N_("Decrease time speed") , "J", group, false, false);
addGuiActions("actionIncrease_Time_Speed", N_("Increase time speed") , "L", group, false, false); addGuiActions("actionIncrease_Time_Speed", N_("Increase time speed") , "L", group, false, false);
addGuiActions("actionSet_Real_Time_Speed", N_("Set normal time rate" ), "K", group, false, false); addGuiActions("actionSet_Real_Time_Speed", N_("Set normal time rate" ), "K", group, false, false);
addGuiActions("actionDecrease_Time_Speed_Less", N_("Decrease time sp
eed (a little)"), "Shift+J", group, false, false);
addGuiActions("actionIncrease_Time_Speed_Less", N_("Increase time sp
eed (a little)"), "Shift+L", group, false, false);
addGuiActions("actionSet_Time_Rate_Zero", N_("Set time rate to zero" ), "7", group, false, false); addGuiActions("actionSet_Time_Rate_Zero", N_("Set time rate to zero" ), "7", group, false, false);
addGuiActions("actionReturn_To_Current_Time", N_("Set time to now"), "8", group, false, false); addGuiActions("actionReturn_To_Current_Time", N_("Set time to now"), "8", group, false, false);
addGuiActions("actionAdd_Solar_Hour", N_("Add 1 solar hour"), "Ctrl+ =", group, false, true); addGuiActions("actionAdd_Solar_Hour", N_("Add 1 solar hour"), "Ctrl+ =", group, false, true);
addGuiActions("actionSubtract_Solar_Hour", N_("Subtract 1 solar hour "), "Ctrl+-", group, false, true); addGuiActions("actionSubtract_Solar_Hour", N_("Subtract 1 solar hour "), "Ctrl+-", group, false, true);
addGuiActions("actionAdd_Solar_Day", N_("Add 1 solar day"), "=", gro up, false, true); addGuiActions("actionAdd_Solar_Day", N_("Add 1 solar day"), "=", gro up, false, true);
addGuiActions("actionSubtract_Solar_Day", N_("Subtract 1 solar day") , "-", group, false, true); addGuiActions("actionSubtract_Solar_Day", N_("Subtract 1 solar day") , "-", group, false, true);
addGuiActions("actionAdd_Solar_Week", N_("Add 1 solar week"), "]", g roup, false, true); addGuiActions("actionAdd_Solar_Week", N_("Add 1 solar week"), "]", g roup, false, true);
addGuiActions("actionSubtract_Solar_Week", N_("Subtract 1 solar week "), "[", group, false, true); addGuiActions("actionSubtract_Solar_Week", N_("Subtract 1 solar week "), "[", group, false, true);
addGuiActions("actionAdd_Sidereal_Day", N_("Add 1 sidereal day"), "A lt+=", group, false, true); addGuiActions("actionAdd_Sidereal_Day", N_("Add 1 sidereal day"), "A lt+=", group, false, true);
addGuiActions("actionSubtract_Sidereal_Day", N_("Subtract 1 sidereal day"), "Alt+-", group, false, true); addGuiActions("actionSubtract_Sidereal_Day", N_("Subtract 1 sidereal day"), "Alt+-", group, false, true);
skipping to change at line 229 skipping to change at line 184
addGuiActions("actionMove_Telescope_To_Selection_9", N_("Move telesc ope #9 to selected object"), "Ctrl+9", group, false, false); addGuiActions("actionMove_Telescope_To_Selection_9", N_("Move telesc ope #9 to selected object"), "Ctrl+9", group, false, false);
group = N_("Miscellaneous"); group = N_("Miscellaneous");
addGuiActions("actionSwitch_Equatorial_Mount", N_("Switch between eq uatorial and azimuthal mount"), "Ctrl+M", group, true, false); addGuiActions("actionSwitch_Equatorial_Mount", N_("Switch between eq uatorial and azimuthal mount"), "Ctrl+M", group, true, false);
addGuiActions("actionQuit_Global", N_("Quit"), "Ctrl+Q", group, fals e, false); addGuiActions("actionQuit_Global", N_("Quit"), "Ctrl+Q", group, fals e, false);
addGuiActions("actionSave_Screenshot_Global", N_("Save screenshot"), "Ctrl+S", group, false, false); addGuiActions("actionSave_Screenshot_Global", N_("Save screenshot"), "Ctrl+S", group, false, false);
addGuiActions("action_Reload_Style", "Reload style", "Ctrl+R", "Debu g", false, false); addGuiActions("action_Reload_Style", "Reload style", "Ctrl+R", "Debu g", false, false);
addGuiActions("actionAutoHideHorizontalButtonBar", N_("Auto hide hor izontal button bar"), "", group, true, false); addGuiActions("actionAutoHideHorizontalButtonBar", N_("Auto hide hor izontal button bar"), "", group, true, false);
addGuiActions("actionAutoHideVerticalButtonBar", N_("Auto hide verti cal button bar"), "", group, true, false); addGuiActions("actionAutoHideVerticalButtonBar", N_("Auto hide verti cal button bar"), "", group, true, false);
addGuiActions("actionToggle_GuiHidden_Global", N_("Toggle visibility addGuiActions("actionToggle_GuiHidden_Global", N_("Toggle visibility
of toolbars"), "Ctrl+T", group, true, false); of GUI"), "Ctrl+T", group, true, false);
//QMetaObject::connectSlotsByName(Form);
//////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////// ///
// Connect all the GUI actions signals with the Core of Stellarium // Connect all the GUI actions signals with the Core of Stellarium
connect(getGuiActions("actionQuit_Global"), SIGNAL(triggered()), thi s, SLOT(quitStellarium())); connect(getGuiActions("actionQuit_Global"), SIGNAL(triggered()), qAp p, SLOT(quit()));
// Debug // Debug
connect(getGuiActions("action_Reload_Style"), SIGNAL(triggered()), t his, SLOT(reloadStyle())); connect(getGuiActions("action_Reload_Style"), SIGNAL(triggered()), t his, SLOT(reloadStyle()));
ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr); ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr);
connect(getGuiActions("actionShow_Constellation_Lines"), SIGNAL(togg led(bool)), cmgr, SLOT(setFlagLines(bool))); connect(getGuiActions("actionShow_Constellation_Lines"), SIGNAL(togg led(bool)), cmgr, SLOT(setFlagLines(bool)));
getGuiActions("actionShow_Constellation_Lines")->setChecked(cmgr->ge tFlagLines()); getGuiActions("actionShow_Constellation_Lines")->setChecked(cmgr->ge tFlagLines());
connect(getGuiActions("actionShow_Constellation_Art"), SIGNAL(toggle d(bool)), cmgr, SLOT(setFlagArt(bool))); connect(getGuiActions("actionShow_Constellation_Art"), SIGNAL(toggle d(bool)), cmgr, SLOT(setFlagArt(bool)));
getGuiActions("actionShow_Constellation_Art")->setChecked(cmgr->getF lagArt()); getGuiActions("actionShow_Constellation_Art")->setChecked(cmgr->getF lagArt());
connect(getGuiActions("actionShow_Constellation_Labels"), SIGNAL(tog gled(bool)), cmgr, SLOT(setFlagLabels(bool))); connect(getGuiActions("actionShow_Constellation_Labels"), SIGNAL(tog gled(bool)), cmgr, SLOT(setFlagLabels(bool)));
skipping to change at line 274 skipping to change at line 227
getGuiActions("actionShow_Cardinal_Points")->setChecked(lmgr->getFla gCardinalsPoints()); getGuiActions("actionShow_Cardinal_Points")->setChecked(lmgr->getFla gCardinalsPoints());
connect(getGuiActions("actionShow_Atmosphere"), SIGNAL(toggled(bool) ), lmgr, SLOT(setFlagAtmosphere(bool))); connect(getGuiActions("actionShow_Atmosphere"), SIGNAL(toggled(bool) ), lmgr, SLOT(setFlagAtmosphere(bool)));
getGuiActions("actionShow_Atmosphere")->setChecked(lmgr->getFlagAtmo sphere()); getGuiActions("actionShow_Atmosphere")->setChecked(lmgr->getFlagAtmo sphere());
connect(getGuiActions("actionShow_Fog"), SIGNAL(toggled(bool)), lmgr , SLOT(setFlagFog(bool))); connect(getGuiActions("actionShow_Fog"), SIGNAL(toggled(bool)), lmgr , SLOT(setFlagFog(bool)));
getGuiActions("actionShow_Fog")->setChecked(lmgr->getFlagFog()); getGuiActions("actionShow_Fog")->setChecked(lmgr->getFlagFog());
NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr); NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
connect(getGuiActions("actionShow_Nebulas"), SIGNAL(toggled(bool)), nmgr, SLOT(setFlagHints(bool))); connect(getGuiActions("actionShow_Nebulas"), SIGNAL(toggled(bool)), nmgr, SLOT(setFlagHints(bool)));
getGuiActions("actionShow_Nebulas")->setChecked(nmgr->getFlagHints() ); getGuiActions("actionShow_Nebulas")->setChecked(nmgr->getFlagHints() );
StelSkyImageMgr* imgr = GETSTELMODULE(StelSkyImageMgr); StelSkyLayerMgr* imgr = GETSTELMODULE(StelSkyLayerMgr);
connect(getGuiActions("actionShow_DSS"), SIGNAL(toggled(bool)), imgr , SLOT(setFlagShow(bool))); connect(getGuiActions("actionShow_DSS"), SIGNAL(toggled(bool)), imgr , SLOT(setFlagShow(bool)));
getGuiActions("actionShow_DSS")->setChecked(imgr->getFlagShow()); getGuiActions("actionShow_DSS")->setChecked(imgr->getFlagShow());
StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr);
StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( ); StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( );
connect(getGuiActions("actionIncrease_Script_Speed"), SIGNAL(trigger
ed()), this, SLOT(increaseScriptSpeed()));
connect(getGuiActions("actionDecrease_Script_Speed"), SIGNAL(trigger
ed()), this, SLOT(decreaseScriptSpeed()));
connect(getGuiActions("actionSet_Real_Script_Speed"), SIGNAL(trigger
ed()), this, SLOT(setRealScriptSpeed()));
connect(getGuiActions("actionIncrease_Time_Speed"), SIGNAL(triggered ()), nav, SLOT(increaseTimeSpeed())); connect(getGuiActions("actionIncrease_Time_Speed"), SIGNAL(triggered ()), nav, SLOT(increaseTimeSpeed()));
connect(getGuiActions("actionDecrease_Time_Speed"), SIGNAL(triggered ()), nav, SLOT(decreaseTimeSpeed())); connect(getGuiActions("actionDecrease_Time_Speed"), SIGNAL(triggered ()), nav, SLOT(decreaseTimeSpeed()));
connect(getGuiActions("actionSet_Real_Time_Speed"), SIGNAL(triggered connect(getGuiActions("actionIncrease_Time_Speed_Less"), SIGNAL(trig
()), nav, SLOT(setRealTimeSpeed())); gered()), nav, SLOT(increaseTimeSpeedLess()));
connect(getGuiActions("actionDecrease_Time_Speed_Less"), SIGNAL(trig
gered()), nav, SLOT(decreaseTimeSpeedLess()));
connect(getGuiActions("actionSet_Real_Time_Speed"), SIGNAL(triggered
()), nav, SLOT(toggleRealTimeSpeed()));
connect(getGuiActions("actionSet_Time_Rate_Zero"), SIGNAL(triggered( )), nav, SLOT(setZeroTimeSpeed())); connect(getGuiActions("actionSet_Time_Rate_Zero"), SIGNAL(triggered( )), nav, SLOT(setZeroTimeSpeed()));
connect(getGuiActions("actionReturn_To_Current_Time"), SIGNAL(trigge red()), nav, SLOT(setTimeNow())); connect(getGuiActions("actionReturn_To_Current_Time"), SIGNAL(trigge red()), nav, SLOT(setTimeNow()));
connect(getGuiActions("actionSwitch_Equatorial_Mount"), SIGNAL(toggl connect(getGuiActions("actionSwitch_Equatorial_Mount"), SIGNAL(toggl
ed(bool)), nav, SLOT(setEquatorialMount(bool))); ed(bool)), mmgr, SLOT(setEquatorialMount(bool)));
getGuiActions("actionSwitch_Equatorial_Mount")->setChecked(StelApp:: getGuiActions("actionSwitch_Equatorial_Mount")->setChecked(mmgr->get
getInstance().getCore()->getNavigator()->getMountMode() != StelNavigator::M MountMode() != StelMovementMgr::MountAltAzimuthal);
ountAltAzimuthal);
connect(getGuiActions("actionAdd_Solar_Hour"), SIGNAL(triggered()), nav, SLOT(addHour())); connect(getGuiActions("actionAdd_Solar_Hour"), SIGNAL(triggered()), nav, SLOT(addHour()));
connect(getGuiActions("actionAdd_Solar_Day"), SIGNAL(triggered()), n av, SLOT(addDay())); connect(getGuiActions("actionAdd_Solar_Day"), SIGNAL(triggered()), n av, SLOT(addDay()));
connect(getGuiActions("actionAdd_Solar_Week"), SIGNAL(triggered()), nav, SLOT(addWeek())); connect(getGuiActions("actionAdd_Solar_Week"), SIGNAL(triggered()), nav, SLOT(addWeek()));
connect(getGuiActions("actionSubtract_Solar_Hour"), SIGNAL(triggered ()), nav, SLOT(subtractHour())); connect(getGuiActions("actionSubtract_Solar_Hour"), SIGNAL(triggered ()), nav, SLOT(subtractHour()));
connect(getGuiActions("actionSubtract_Solar_Day"), SIGNAL(triggered( )), nav, SLOT(subtractDay())); connect(getGuiActions("actionSubtract_Solar_Day"), SIGNAL(triggered( )), nav, SLOT(subtractDay()));
connect(getGuiActions("actionSubtract_Solar_Week"), SIGNAL(triggered ()), nav, SLOT(subtractWeek())); connect(getGuiActions("actionSubtract_Solar_Week"), SIGNAL(triggered ()), nav, SLOT(subtractWeek()));
connect(getGuiActions("actionAdd_Sidereal_Day"), SIGNAL(triggered()) , nav, SLOT(addSiderealDay())); connect(getGuiActions("actionAdd_Sidereal_Day"), SIGNAL(triggered()) , nav, SLOT(addSiderealDay()));
connect(getGuiActions("actionAdd_Sidereal_Week"), SIGNAL(triggered() ), nav, SLOT(addSiderealWeek())); connect(getGuiActions("actionAdd_Sidereal_Week"), SIGNAL(triggered() ), nav, SLOT(addSiderealWeek()));
connect(getGuiActions("actionSubtract_Sidereal_Day"), SIGNAL(trigger ed()), nav, SLOT(subtractSiderealDay())); connect(getGuiActions("actionSubtract_Sidereal_Day"), SIGNAL(trigger ed()), nav, SLOT(subtractSiderealDay()));
connect(getGuiActions("actionSubtract_Sidereal_Week"), SIGNAL(trigge red()), nav, SLOT(subtractSiderealWeek())); connect(getGuiActions("actionSubtract_Sidereal_Week"), SIGNAL(trigge red()), nav, SLOT(subtractSiderealWeek()));
skipping to change at line 313 skipping to change at line 272
connect(getGuiActions("actionMove_Telescope_To_Selection_4"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected())); connect(getGuiActions("actionMove_Telescope_To_Selection_4"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected()));
connect(getGuiActions("actionMove_Telescope_To_Selection_5"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected())); connect(getGuiActions("actionMove_Telescope_To_Selection_5"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected()));
connect(getGuiActions("actionMove_Telescope_To_Selection_6"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected())); connect(getGuiActions("actionMove_Telescope_To_Selection_6"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected()));
connect(getGuiActions("actionMove_Telescope_To_Selection_7"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected())); connect(getGuiActions("actionMove_Telescope_To_Selection_7"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected()));
connect(getGuiActions("actionMove_Telescope_To_Selection_8"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected())); connect(getGuiActions("actionMove_Telescope_To_Selection_8"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected()));
connect(getGuiActions("actionMove_Telescope_To_Selection_9"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected())); connect(getGuiActions("actionMove_Telescope_To_Selection_9"), SIGNAL (triggered()), tmgr, SLOT(moveTelescopeToSelected()));
connect(getGuiActions("actionShow_Night_Mode"), SIGNAL(toggled(bool) ), &StelApp::getInstance(), SLOT(setVisionModeNight(bool))); connect(getGuiActions("actionShow_Night_Mode"), SIGNAL(toggled(bool) ), &StelApp::getInstance(), SLOT(setVisionModeNight(bool)));
getGuiActions("actionShow_Night_Mode")->setChecked(StelApp::getInsta nce().getVisionModeNight()); getGuiActions("actionShow_Night_Mode")->setChecked(StelApp::getInsta nce().getVisionModeNight());
StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr);
connect(getGuiActions("actionGoto_Selected_Object"), SIGNAL(triggere d()), mmgr, SLOT(setFlagTracking())); connect(getGuiActions("actionGoto_Selected_Object"), SIGNAL(triggere d()), mmgr, SLOT(setFlagTracking()));
connect(getGuiActions("actionZoom_In_Auto"), SIGNAL(triggered()), mm gr, SLOT(autoZoomIn())); connect(getGuiActions("actionZoom_In_Auto"), SIGNAL(triggered()), mm gr, SLOT(autoZoomIn()));
connect(getGuiActions("actionZoom_Out_Auto"), SIGNAL(triggered()), m mgr, SLOT(autoZoomOut())); connect(getGuiActions("actionZoom_Out_Auto"), SIGNAL(triggered()), m mgr, SLOT(autoZoomOut()));
connect(getGuiActions("actionSet_Tracking"), SIGNAL(toggled(bool)), mmgr, SLOT(setFlagTracking(bool))); connect(getGuiActions("actionSet_Tracking"), SIGNAL(toggled(bool)), mmgr, SLOT(setFlagTracking(bool)));
getGuiActions("actionSet_Tracking")->setChecked(mmgr->getFlagTrackin g()); getGuiActions("actionSet_Tracking")->setChecked(mmgr->getFlagTrackin g());
connect(getGuiActions("actionSet_Full_Screen_Global"), SIGNAL(toggle d(bool)), &StelMainWindow::getInstance(), SLOT(setFullScreen(bool))); connect(getGuiActions("actionSet_Full_Screen_Global"), SIGNAL(toggle d(bool)), &StelMainWindow::getInstance(), SLOT(setFullScreen(bool)));
getGuiActions("actionSet_Full_Screen_Global")->setChecked(StelMainWi ndow::getInstance().isFullScreen()); getGuiActions("actionSet_Full_Screen_Global")->setChecked(StelMainWi ndow::getInstance().isFullScreen());
connect(getGuiActions("actionShow_Location_Window_Global"), SIGNAL(t oggled(bool)), &locationDialog, SLOT(setVisible(bool))); connect(getGuiActions("actionShow_Location_Window_Global"), SIGNAL(t oggled(bool)), &locationDialog, SLOT(setVisible(bool)));
connect(&locationDialog, SIGNAL(visibleChanged(bool)), getGuiActions ("actionShow_Location_Window_Global"), SLOT(setChecked(bool))); connect(&locationDialog, SIGNAL(visibleChanged(bool)), getGuiActions ("actionShow_Location_Window_Global"), SLOT(setChecked(bool)));
connect(getGuiActions("actionShow_Configuration_Window_Global"), SIG #ifdef ENABLE_SCRIPT_CONSOLE
NAL(toggled(bool)), &configurationDialog, SLOT(setVisible(bool))); connect(getGuiActions("actionShow_ScriptConsole_Window_Global"), SIG
connect(&configurationDialog, SIGNAL(visibleChanged(bool)), getGuiAc NAL(toggled(bool)), &scriptConsole, SLOT(setVisible(bool)));
tions("actionShow_Configuration_Window_Global"), SLOT(setChecked(bool))); connect(&scriptConsole, SIGNAL(visibleChanged(bool)), getGuiActions(
"actionShow_ScriptConsole_Window_Global"), SLOT(setChecked(bool)));
#endif
connect(getGuiActions("actionShow_Configuration_Window_Global"), SIG
NAL(toggled(bool)), configurationDialog, SLOT(setVisible(bool)));
connect(configurationDialog, SIGNAL(visibleChanged(bool)), getGuiAct
ions("actionShow_Configuration_Window_Global"), SLOT(setChecked(bool)));
connect(getGuiActions("actionShow_SkyView_Window_Global"), SIGNAL(to ggled(bool)), &viewDialog, SLOT(setVisible(bool))); connect(getGuiActions("actionShow_SkyView_Window_Global"), SIGNAL(to ggled(bool)), &viewDialog, SLOT(setVisible(bool)));
connect(&viewDialog, SIGNAL(visibleChanged(bool)), getGuiActions("ac tionShow_SkyView_Window_Global"), SLOT(setChecked(bool))); connect(&viewDialog, SIGNAL(visibleChanged(bool)), getGuiActions("ac tionShow_SkyView_Window_Global"), SLOT(setChecked(bool)));
connect(getGuiActions("actionShow_Help_Window_Global"), SIGNAL(toggl ed(bool)), &helpDialog, SLOT(setVisible(bool))); connect(getGuiActions("actionShow_Help_Window_Global"), SIGNAL(toggl ed(bool)), &helpDialog, SLOT(setVisible(bool)));
connect(&helpDialog, SIGNAL(visibleChanged(bool)), getGuiActions("ac tionShow_Help_Window_Global"), SLOT(setChecked(bool))); connect(&helpDialog, SIGNAL(visibleChanged(bool)), getGuiActions("ac tionShow_Help_Window_Global"), SLOT(setChecked(bool)));
connect(getGuiActions("actionShow_DateTime_Window_Global"), SIGNAL(t oggled(bool)), &dateTimeDialog, SLOT(setVisible(bool))); connect(getGuiActions("actionShow_DateTime_Window_Global"), SIGNAL(t oggled(bool)), &dateTimeDialog, SLOT(setVisible(bool)));
connect(&dateTimeDialog, SIGNAL(visibleChanged(bool)), getGuiActions ("actionShow_DateTime_Window_Global"), SLOT(setChecked(bool))); connect(&dateTimeDialog, SIGNAL(visibleChanged(bool)), getGuiActions ("actionShow_DateTime_Window_Global"), SLOT(setChecked(bool)));
connect(getGuiActions("actionShow_Search_Window_Global"), SIGNAL(tog gled(bool)), &searchDialog, SLOT(setVisible(bool))); connect(getGuiActions("actionShow_Search_Window_Global"), SIGNAL(tog gled(bool)), &searchDialog, SLOT(setVisible(bool)));
connect(&searchDialog, SIGNAL(visibleChanged(bool)), getGuiActions(" actionShow_Search_Window_Global"), SLOT(setChecked(bool))); connect(&searchDialog, SIGNAL(visibleChanged(bool)), getGuiActions(" actionShow_Search_Window_Global"), SLOT(setChecked(bool)));
connect(getGuiActions("actionSave_Screenshot_Global"), SIGNAL(trigge red()), &StelMainGraphicsView::getInstance(), SLOT(saveScreenShot())); connect(getGuiActions("actionSave_Screenshot_Global"), SIGNAL(trigge red()), &StelMainGraphicsView::getInstance(), SLOT(saveScreenShot()));
getGuiActions("actionToggle_GuiHidden_Global")->setChecked(false); getGuiActions("actionToggle_GuiHidden_Global")->setChecked(true);
connect(getGuiActions("actionToggle_GuiHidden_Global"), SIGNAL(toggl connect(getGuiActions("actionToggle_GuiHidden_Global"), SIGNAL(toggl
ed(bool)), this, SLOT(setHideGui(bool))); ed(bool)), this, SLOT(setGuiVisible(bool)));
connect(getGuiActions("actionHorizontal_Flip"), SIGNAL(toggled(bool) ), StelApp::getInstance().getCore(), SLOT(setFlipHorz(bool))); connect(getGuiActions("actionHorizontal_Flip"), SIGNAL(toggled(bool) ), StelApp::getInstance().getCore(), SLOT(setFlipHorz(bool)));
getGuiActions("actionHorizontal_Flip")->setChecked(StelApp::getInsta nce().getCore()->getFlipHorz()); getGuiActions("actionHorizontal_Flip")->setChecked(StelApp::getInsta nce().getCore()->getFlipHorz());
connect(getGuiActions("actionVertical_Flip"), SIGNAL(toggled(bool)), StelApp::getInstance().getCore(), SLOT(setFlipVert(bool))); connect(getGuiActions("actionVertical_Flip"), SIGNAL(toggled(bool)), StelApp::getInstance().getCore(), SLOT(setFlipVert(bool)));
getGuiActions("actionVertical_Flip")->setChecked(StelApp::getInstanc e().getCore()->getFlipVert()); getGuiActions("actionVertical_Flip")->setChecked(StelApp::getInstanc e().getCore()->getFlipVert());
StarMgr* smgr = GETSTELMODULE(StarMgr); StarMgr* smgr = GETSTELMODULE(StarMgr);
connect(getGuiActions("actionShow_Stars"), SIGNAL(toggled(bool)), sm gr, SLOT(setFlagStars(bool))); connect(getGuiActions("actionShow_Stars"), SIGNAL(toggled(bool)), sm gr, SLOT(setFlagStars(bool)));
getGuiActions("actionShow_Stars")->setChecked(smgr->getFlagStars()); getGuiActions("actionShow_Stars")->setChecked(smgr->getFlagStars());
SolarSystem* ssmgr = GETSTELMODULE(SolarSystem); SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
connect(getGuiActions("actionShow_Planets_Labels"), SIGNAL(toggled(b ool)), ssmgr, SLOT(setFlagLabels(bool))); connect(getGuiActions("actionShow_Planets_Labels"), SIGNAL(toggled(b ool)), ssmgr, SLOT(setFlagLabels(bool)));
getGuiActions("actionShow_Planets_Labels")->setChecked(ssmgr->getFla gLabels()); getGuiActions("actionShow_Planets_Labels")->setChecked(ssmgr->getFla gLabels());
connect(getGuiActions("actionShow_Meridian_Line"), SIGNAL(toggled(bo ol)), gmgr, SLOT(setFlagMeridianLine(bool))); connect(getGuiActions("actionShow_Meridian_Line"), SIGNAL(toggled(bo ol)), gmgr, SLOT(setFlagMeridianLine(bool)));
getGuiActions("actionShow_Meridian_Line")->setChecked(gmgr->getFlagM eridianLine()); getGuiActions("actionShow_Meridian_Line")->setChecked(gmgr->getFlagM eridianLine());
connect(getGuiActions("actionShow_Equatorial_J2000_Grid"), SIGNAL(to ggled(bool)), gmgr, SLOT(setFlagEquatorJ2000Grid(bool))); connect(getGuiActions("actionShow_Equatorial_J2000_Grid"), SIGNAL(to ggled(bool)), gmgr, SLOT(setFlagEquatorJ2000Grid(bool)));
getGuiActions("actionShow_Equatorial_J2000_Grid")->setChecked(gmgr-> getFlagEquatorJ2000Grid()); getGuiActions("actionShow_Equatorial_J2000_Grid")->setChecked(gmgr-> getFlagEquatorJ2000Grid());
connect(getGuiActions("actionShow_Galactic_Grid"), SIGNAL(toggled(bo
ol)), gmgr, SLOT(setFlagGalacticGrid(bool)));
getGuiActions("actionShow_Galactic_Grid")->setChecked(gmgr->getFlagG
alacticGrid());
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
Q_ASSERT(conf); Q_ASSERT(conf);
setAutoHideHorizontalButtonBar(conf->value("gui/auto_hide_horizontal _toolbar", true).toBool()); setAutoHideHorizontalButtonBar(conf->value("gui/auto_hide_horizontal _toolbar", true).toBool());
setAutoHideVerticalButtonBar(conf->value("gui/auto_hide_vertical_too lbar", true).toBool()); setAutoHideVerticalButtonBar(conf->value("gui/auto_hide_vertical_too lbar", true).toBool());
connect(getGuiActions("actionAutoHideHorizontalButtonBar"), SIGNAL(t oggled(bool)), this, SLOT(setAutoHideHorizontalButtonBar(bool))); connect(getGuiActions("actionAutoHideHorizontalButtonBar"), SIGNAL(t oggled(bool)), this, SLOT(setAutoHideHorizontalButtonBar(bool)));
getGuiActions("actionAutoHideHorizontalButtonBar")->setChecked(getAu toHideHorizontalButtonBar()); getGuiActions("actionAutoHideHorizontalButtonBar")->setChecked(getAu toHideHorizontalButtonBar());
connect(getGuiActions("actionAutoHideVerticalButtonBar"), SIGNAL(tog gled(bool)), this, SLOT(setAutoHideVerticalButtonBar(bool))); connect(getGuiActions("actionAutoHideVerticalButtonBar"), SIGNAL(tog gled(bool)), this, SLOT(setAutoHideVerticalButtonBar(bool)));
getGuiActions("actionAutoHideVerticalButtonBar")->setChecked(getAuto HideVerticalButtonBar()); getGuiActions("actionAutoHideVerticalButtonBar")->setChecked(getAuto HideVerticalButtonBar());
StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc
riptMgr();
connect(&scriptMgr, SIGNAL(scriptRunning()), this, SLOT(scriptStarte
d()));
connect(&scriptMgr, SIGNAL(scriptStopped()), this, SLOT(scriptStoppe
d()));
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
//// QGraphicsView based GUI //// QGraphicsView based GUI
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Construct the Windows buttons bar // Add everything
winBar = new LeftStelBar(NULL); QPixmap pxmapDefault;
QPixmap pxmapGlow(":/graphicGui/gui/glow.png"); QPixmap pxmapGlow(":/graphicGui/gui/glow.png");
QPixmap pxmapOn(":/graphicGui/gui/2-on-location.png"); QPixmap pxmapOn(":/graphicGui/gui/2-on-location.png");
QPixmap pxmapOff(":/graphicGui/gui/2-off-location.png"); QPixmap pxmapOff(":/graphicGui/gui/2-off-location.png");
StelButton* b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions("actionShow_Location_Window_Global")); StelButton* b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions("actionShow_Location_Window_Global"));
winBar->addButton(b); skyGui->winBar->addButton(b);
pxmapOn = QPixmap(":/graphicGui/gui/1-on-time.png"); pxmapOn = QPixmap(":/graphicGui/gui/1-on-time.png");
pxmapOff = QPixmap(":/graphicGui/gui/1-off-time.png"); pxmapOff = QPixmap(":/graphicGui/gui/1-off-time.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_DateTime_Window_Global")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_DateTime_Window_Global"));
winBar->addButton(b); skyGui->winBar->addButton(b);
pxmapOn = QPixmap(":/graphicGui/gui/5-on-labels.png"); pxmapOn = QPixmap(":/graphicGui/gui/5-on-labels.png");
pxmapOff = QPixmap(":/graphicGui/gui/5-off-labels.png"); pxmapOff = QPixmap(":/graphicGui/gui/5-off-labels.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_SkyView_Window_Global")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_SkyView_Window_Global"));
winBar->addButton(b); skyGui->winBar->addButton(b);
pxmapOn = QPixmap(":/graphicGui/gui/6-on-search.png"); pxmapOn = QPixmap(":/graphicGui/gui/6-on-search.png");
pxmapOff = QPixmap(":/graphicGui/gui/6-off-search.png"); pxmapOff = QPixmap(":/graphicGui/gui/6-off-search.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_Search_Window_Global")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_Search_Window_Global"));
winBar->addButton(b); skyGui->winBar->addButton(b);
pxmapOn = QPixmap(":/graphicGui/gui/8-on-settings.png"); pxmapOn = QPixmap(":/graphicGui/gui/8-on-settings.png");
pxmapOff = QPixmap(":/graphicGui/gui/8-off-settings.png"); pxmapOff = QPixmap(":/graphicGui/gui/8-off-settings.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_Configuration_Window_Global")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_Configuration_Window_Global"));
winBar->addButton(b); skyGui->winBar->addButton(b);
pxmapOn = QPixmap(":/graphicGui/gui/9-on-help.png"); pxmapOn = QPixmap(":/graphicGui/gui/9-on-help.png");
pxmapOff = QPixmap(":/graphicGui/gui/9-off-help.png"); pxmapOff = QPixmap(":/graphicGui/gui/9-off-help.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_Help_Window_Global")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiActions ("actionShow_Help_Window_Global"));
winBar->addButton(b); skyGui->winBar->addButton(b);
// Construct the bottom buttons bar
buttonBar = new BottomStelBar(NULL, QPixmap(":/graphicGui/gui/btbg-l
eft.png"), QPixmap(":/graphicGui/gui/btbg-right.png"),
QPixmap(":/graphicGui/gui/btbg-middle.png"), QPixmap
(":/graphicGui/gui/btbg-single.png"));
infoPanel = new InfoPanel(NULL);
QPixmap pxmapGlow32x32(":/graphicGui/gui/glow32x32.png"); QPixmap pxmapGlow32x32(":/graphicGui/gui/glow32x32.png");
pxmapOn = QPixmap(":/graphicGui/gui/btConstellationLines-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btConstellationLines-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btConstellationLines-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btConstellationLines-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Constellation_Lines")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Constellation_Lines"));
buttonBar->addButton(b, "010-constellationsGroup"); skyGui->buttonBar->addButton(b, "010-constellationsGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btConstellationLabels-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btConstellationLabels-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btConstellationLabels-off.png") ; pxmapOff = QPixmap(":/graphicGui/gui/btConstellationLabels-off.png") ;
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Constellation_Labels")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Constellation_Labels"));
buttonBar->addButton(b, "010-constellationsGroup"); skyGui->buttonBar->addButton(b, "010-constellationsGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btConstellationArt-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btConstellationArt-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btConstellationArt-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btConstellationArt-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Constellation_Art")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Constellation_Art"));
buttonBar->addButton(b, "010-constellationsGroup"); skyGui->buttonBar->addButton(b, "010-constellationsGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btEquatorialGrid-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btEquatorialGrid-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btEquatorialGrid-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btEquatorialGrid-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Equatorial_Grid")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Equatorial_Grid"));
buttonBar->addButton(b, "020-gridsGroup"); skyGui->buttonBar->addButton(b, "020-gridsGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btAzimuthalGrid-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btAzimuthalGrid-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btAzimuthalGrid-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btAzimuthalGrid-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Azimuthal_Grid")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Azimuthal_Grid"));
buttonBar->addButton(b, "020-gridsGroup"); skyGui->buttonBar->addButton(b, "020-gridsGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btGround-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btGround-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btGround-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btGround-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Ground")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Ground"));
buttonBar->addButton(b, "030-landscapeGroup"); skyGui->buttonBar->addButton(b, "030-landscapeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btCardinalPoints-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btCardinalPoints-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btCardinalPoints-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btCardinalPoints-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Cardinal_Points")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Cardinal_Points"));
buttonBar->addButton(b, "030-landscapeGroup"); skyGui->buttonBar->addButton(b, "030-landscapeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btAtmosphere-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btAtmosphere-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btAtmosphere-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btAtmosphere-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Atmosphere")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Atmosphere"));
buttonBar->addButton(b, "030-landscapeGroup"); skyGui->buttonBar->addButton(b, "030-landscapeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btNebula-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btNebula-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btNebula-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btNebula-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Nebulas")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Nebulas"));
buttonBar->addButton(b, "040-nebulaeGroup"); skyGui->buttonBar->addButton(b, "040-nebulaeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btPlanets-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btPlanets-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btPlanets-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btPlanets-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Planets_Labels")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Planets_Labels"));
buttonBar->addButton(b, "040-nebulaeGroup"); skyGui->buttonBar->addButton(b, "040-nebulaeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btEquatorialMount-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btEquatorialMount-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btEquatorialMount-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btEquatorialMount-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionSwitch_Equatorial_Mount")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionSwitch_Equatorial_Mount"));
b->setChecked(getGuiActions("actionSwitch_Equatorial_Mount")->isChec ked()); b->setChecked(getGuiActions("actionSwitch_Equatorial_Mount")->isChec ked());
buttonBar->addButton(b, "060-othersGroup"); skyGui->buttonBar->addButton(b, "060-othersGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btGotoSelectedObject-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btGotoSelectedObject-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btGotoSelectedObject-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btGotoSelectedObject-off.png");
buttonGotoSelectedObject = new StelButton(NULL, pxmapOn, pxmapOff, p xmapGlow32x32, getGuiActions("actionGoto_Selected_Object")); buttonGotoSelectedObject = new StelButton(NULL, pxmapOn, pxmapOff, p xmapGlow32x32, getGuiActions("actionGoto_Selected_Object"));
buttonBar->addButton(buttonGotoSelectedObject, "060-othersGroup"); skyGui->buttonBar->addButton(buttonGotoSelectedObject, "060-othersGr oup");
pxmapOn = QPixmap(":/graphicGui/gui/btNightView-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btNightView-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btNightView-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btNightView-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Night_Mode")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionShow_Night_Mode"));
buttonBar->addButton(b, "060-othersGroup"); skyGui->buttonBar->addButton(b, "060-othersGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btFullScreen-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btFullScreen-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btFullScreen-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btFullScreen-off.png");
b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionSet_Full_Screen_Global")); b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAc tions("actionSet_Full_Screen_Global"));
buttonBar->addButton(b, "060-othersGroup"); skyGui->buttonBar->addButton(b, "060-othersGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btQuit.png");
b = new StelButton(NULL, pxmapOn, pxmapOn, pxmapGlow32x32, getGuiAct
ions("actionQuit_Global"));
buttonBar->addButton(b, "060-othersGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btTimeRewind-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btTimeRewind-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btTimeRewind-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btTimeRewind-off.png");
buttonTimeRewind = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow 32x32, getGuiActions("actionDecrease_Time_Speed")); buttonTimeRewind = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow 32x32, getGuiActions("actionDecrease_Time_Speed"));
buttonBar->addButton(buttonTimeRewind, "070-timeGroup"); skyGui->buttonBar->addButton(buttonTimeRewind, "070-timeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btTimeRealtime-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btTimeRealtime-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btTimeRealtime-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btTimeRealtime-off.png");
buttonTimeRealTimeSpeed = new StelButton(NULL, pxmapOn, pxmapOff, px pxmapDefault = QPixmap(":/graphicGui/gui/btTimePause-on.png");
mapGlow32x32, getGuiActions("actionSet_Real_Time_Speed")); buttonTimeRealTimeSpeed = new StelButton(NULL, pxmapOn, pxmapOff, px
buttonBar->addButton(buttonTimeRealTimeSpeed, "070-timeGroup"); mapDefault, pxmapGlow32x32, getGuiActions("actionSet_Real_Time_Speed"));
skyGui->buttonBar->addButton(buttonTimeRealTimeSpeed, "070-timeGroup
");
pxmapOn = QPixmap(":/graphicGui/gui/btTimeNow-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btTimeNow-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btTimeNow-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btTimeNow-off.png");
buttonTimeCurrent = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlo w32x32, getGuiActions("actionReturn_To_Current_Time")); buttonTimeCurrent = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlo w32x32, getGuiActions("actionReturn_To_Current_Time"));
buttonBar->addButton(buttonTimeCurrent, "070-timeGroup"); skyGui->buttonBar->addButton(buttonTimeCurrent, "070-timeGroup");
pxmapOn = QPixmap(":/graphicGui/gui/btTimeForward-on.png"); pxmapOn = QPixmap(":/graphicGui/gui/btTimeForward-on.png");
pxmapOff = QPixmap(":/graphicGui/gui/btTimeForward-off.png"); pxmapOff = QPixmap(":/graphicGui/gui/btTimeForward-off.png");
buttonTimeForward = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlo w32x32, getGuiActions("actionIncrease_Time_Speed")); buttonTimeForward = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlo w32x32, getGuiActions("actionIncrease_Time_Speed"));
buttonBar->addButton(buttonTimeForward, "070-timeGroup"); skyGui->buttonBar->addButton(buttonTimeForward, "070-timeGroup");
buttonBar->setGroupMargin("070-timeGroup", 32, 0);
// The path drawn around the button bars
buttonBarPath = new StelBarsPath(NULL);
buttonBarPath->updatePath(buttonBar, winBar);
buttonBarPath->setZValue(-0.1);
// Used to display some progress bar in the lower right corner, e.g.
when loading a file
progressBarMgr = new StelProgressBarMgr(NULL);
// Add everything in the scene
QGraphicsScene* scene = StelMainGraphicsView::getInstance().scene();
scene->addItem(winBar);
scene->addItem(buttonBar);
scene->addItem(buttonBarPath);
scene->addItem(infoPanel);
scene->addItem(progressBarMgr);
// Create the 2 auto hide buttons in the bottom left corner
autoHidebts = new CornerButtons();
pxmapOn = QPixmap(":/graphicGui/gui/HorizontalAutoHideOn.png");
pxmapOff = QPixmap(":/graphicGui/gui/HorizontalAutoHideOff.png");
btHorizAutoHide = new StelButton(autoHidebts, pxmapOn, pxmapOff, QPi
xmap(), getGuiActions("actionAutoHideHorizontalButtonBar"), true);
btHorizAutoHide->setChecked(getAutoHideHorizontalButtonBar());
pxmapOn = QPixmap(":/graphicGui/gui/VerticalAutoHideOn.png");
pxmapOff = QPixmap(":/graphicGui/gui/VerticalAutoHideOff.png");
btVertAutoHide = new StelButton(autoHidebts, pxmapOn, pxmapOff, QPix
map(), getGuiActions("actionAutoHideVerticalButtonBar"), true);
btVertAutoHide->setChecked(getAutoHideVerticalButtonBar());
btHorizAutoHide->setPos(1,btVertAutoHide->pixmap().height()-btHorizA
utoHide->pixmap().height()+1);
btVertAutoHide->setPos(0,0);
btVertAutoHide->setZValue(1000);
scene->addItem(autoHidebts);
// Re-adjust position skyGui->buttonBar->setGroupMargin("070-timeGroup", 32, 0);
setStelStyle(*StelApp::getInstance().getCurrentStelStyle());
updateBarsPos();
infoPanel->setPos(8,8);
// If auto hide is off, show the relevant toolbars
if (!getAutoHideHorizontalButtonBar())
{
animBottomBarTimeLine->setDirection(QTimeLine::Forward);
animBottomBarTimeLine->start();
}
if (!getAutoHideVerticalButtonBar()) pxmapOn = QPixmap(":/graphicGui/gui/btQuit.png");
{ b = new StelButton(NULL, pxmapOn, pxmapOn, pxmapGlow32x32, getGuiAct
animLeftBarTimeLine->setDirection(QTimeLine::Forward); ions("actionQuit_Global"));
animLeftBarTimeLine->start(); skyGui->buttonBar->addButton(b, "080-quitGroup");
}
// add the flip buttons if requested in the config // add the flip buttons if requested in the config
setFlagShowFlipButtons(conf->value("gui/flag_show_flip_buttons", fal se).toBool()); setFlagShowFlipButtons(conf->value("gui/flag_show_flip_buttons", fal se).toBool());
setFlagShowNebulaBackgroundButton(conf->value("gui/flag_show_nebulae _background_button", 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);
skyGui->setGeometry(stelAppGraphicsWidget->geometry());
skyGui->updateBarsPos();
setStelStyle(*StelApp::getInstance().getCurrentStelStyle());
initDone = true; initDone = true;
} }
//! Reload the current Qt Style Sheet (Debug only) //! Reload the current Qt Style Sheet (Debug only)
void StelGui::reloadStyle() void StelGui::reloadStyle()
{ {
setStelStyle(*StelApp::getInstance().getCurrentStelStyle()); setStelStyle(*StelApp::getInstance().getCurrentStelStyle());
} }
//! Load color scheme from the given ini file and section name //! Load color scheme from the given ini file and section name
void StelGui::setStelStyle(const StelStyle& style) void StelGui::setStelStyle(const StelStyle& style)
{ {
qApp->setStyleSheet(style.qtStyleSheet); qApp->setStyleSheet(style.qtStyleSheet);
if (style.confSectionName=="night_color") skyGui->setStelStyle(style);
{
buttonBarPath->setPen(QColor::fromRgbF(0.7,0.2,0.2,0.5));
buttonBarPath->setBrush(QColor::fromRgbF(0.23, 0.13, 0.03, 0
.2));
buttonBar->setColor(QColor::fromRgbF(0.9, 0.33, 0.33, 0.9));
winBar->setColor(QColor::fromRgbF(0.9, 0.33, 0.33, 0.9));
winBar->setRedMode(true);
buttonBar->setRedMode(true);
btHorizAutoHide->setRedMode(true);
btVertAutoHide->setRedMode(true);
}
else
{
buttonBarPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
buttonBarPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0
.2));
buttonBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
winBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
buttonBar->setRedMode(false);
winBar->setRedMode(false);
btHorizAutoHide->setRedMode(false);
btVertAutoHide->setRedMode(false);
}
locationDialog.styleChanged(); locationDialog.styleChanged();
dateTimeDialog.styleChanged(); dateTimeDialog.styleChanged();
configurationDialog.styleChanged(); configurationDialog->styleChanged();
searchDialog.styleChanged(); searchDialog.styleChanged();
viewDialog.styleChanged(); viewDialog.styleChanged();
} }
void StelGui::glWindowHasBeenResized(int ww, int hh)
{
if (!winBar || !buttonBar)
return;
updateBarsPos();
}
void StelGui::updateI18n() void StelGui::updateI18n()
{ {
// Translate all action texts StelGuiBase::updateI18n();
foreach (QObject* obj, StelMainGraphicsView::getInstance().children(
))
{
QAction* a = qobject_cast<QAction*>(obj);
if (a)
{
const QString& englishText = a->property("englishTex
t").toString();
if (!englishText.isEmpty())
{
a->setText(q_(englishText));
}
}
}
// Update the dialogs // Update the dialogs
configurationDialog.languageChanged(); configurationDialog->languageChanged();
dateTimeDialog.languageChanged(); dateTimeDialog.languageChanged();
helpDialog.languageChanged(); helpDialog.languageChanged();
locationDialog.languageChanged(); locationDialog.languageChanged();
searchDialog.languageChanged(); searchDialog.languageChanged();
viewDialog.languageChanged(); viewDialog.languageChanged();
} }
void StelGui::update(double deltaTime) void StelGui::update()
{ {
StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( ); StelNavigator* nav = StelApp::getInstance().getCore()->getNavigator( );
if (nav->getTimeRate()<-0.99*JD_SECOND) if (nav->getTimeRate()<-0.99*JD_SECOND)
{ {
if (buttonTimeRewind->isChecked()==false) if (buttonTimeRewind->isChecked()==false)
buttonTimeRewind->setChecked(true); buttonTimeRewind->setChecked(true);
} }
else else
{ {
if (buttonTimeRewind->isChecked()==true) if (buttonTimeRewind->isChecked()==true)
buttonTimeRewind->setChecked(false); buttonTimeRewind->setChecked(false);
} }
if (nav->getTimeRate()>1.01*JD_SECOND) if (nav->getTimeRate()>1.01*JD_SECOND)
{ {
if (buttonTimeForward->isChecked()==false) if (buttonTimeForward->isChecked()==false)
buttonTimeForward->setChecked(true); buttonTimeForward->setChecked(true);
} }
else else
{ {
if (buttonTimeRewind->isChecked()==true) if (buttonTimeForward->isChecked()==true)
buttonTimeRewind->setChecked(false); buttonTimeForward->setChecked(false);
} }
if (buttonTimeRealTimeSpeed->isChecked()!=nav->getRealTimeSpeed()) if (nav->getTimeRate() == 0) {
{ if (buttonTimeRealTimeSpeed->isChecked() != StelButton::Butt
if (buttonTimeRealTimeSpeed->isChecked()!=nav->getRealTimeSp onStateNoChange)
eed()) buttonTimeRealTimeSpeed->setChecked(StelButton::Butt
buttonTimeRealTimeSpeed->setChecked(nav->getRealTime onStateNoChange);
Speed()); } else if (nav->getRealTimeSpeed()) {
if (buttonTimeRealTimeSpeed->isChecked() != StelButton::Butt
onStateOn)
buttonTimeRealTimeSpeed->setChecked(StelButton::Butt
onStateOn);
} else if (buttonTimeRealTimeSpeed->isChecked() != StelButton::Butto
nStateOff) {
buttonTimeRealTimeSpeed->setChecked(StelButton::ButtonStateO
ff);
} }
const bool isTimeNow=nav->getIsTimeNow(); const bool isTimeNow=nav->getIsTimeNow();
if (buttonTimeCurrent->isChecked()!=isTimeNow) if (buttonTimeCurrent->isChecked()!=isTimeNow)
buttonTimeCurrent->setChecked(isTimeNow); buttonTimeCurrent->setChecked(isTimeNow);
StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr);
const bool b = mmgr->getFlagTracking(); const bool b = mmgr->getFlagTracking();
if (buttonGotoSelectedObject->isChecked()!=b) if (buttonGotoSelectedObject->isChecked()!=b)
buttonGotoSelectedObject->setChecked(b); buttonGotoSelectedObject->setChecked(b);
StarMgr* smgr = GETSTELMODULE(StarMgr); StarMgr* smgr = GETSTELMODULE(StarMgr);
if (getGuiActions("actionShow_Stars")->isChecked()!=smgr->getFlagSta rs()) if (getGuiActions("actionShow_Stars")->isChecked()!=smgr->getFlagSta rs())
getGuiActions("actionShow_Stars")->setChecked(smgr->getFlagS tars()); getGuiActions("actionShow_Stars")->setChecked(smgr->getFlagS tars());
infoPanel->setTextFromObjects(GETSTELMODULE(StelObjectMgr)->getSelec skyGui->infoPanel->setTextFromObjects(GETSTELMODULE(StelObjectMgr)->
tedObject()); getSelectedObject());
}
bool StelGui::handleMouseMoves(int x, int y, Qt::MouseButtons b) // Check if the progressbar window changed, if yes update the whole
{ view
double maxX = winBar->boundingRect().width()+2.*buttonBarPath->getRo if (savedProgressBarSize!=skyGui->progressBarMgr->boundingRect().siz
undSize(); e())
double maxY = winBar->boundingRect().height()+buttonBar->boundingRec
t().height()+2.*buttonBarPath->getRoundSize();
double minX = 0;
if (x<=maxX && y<=maxY && b==Qt::NoButton && animLeftBarTimeLine->st
ate()==QTimeLine::NotRunning && winBar->pos().x()<minX)
{
animLeftBarTimeLine->setDirection(QTimeLine::Forward);
animLeftBarTimeLine->start();
}
if (autoHideVerticalButtonBar && (x>maxX+30 || y>maxY+30) && animLef
tBarTimeLine->state()==QTimeLine::NotRunning && winBar->pos().x()>=minX)
{ {
animLeftBarTimeLine->setDirection(QTimeLine::Backward); savedProgressBarSize=skyGui->progressBarMgr->boundingRect().
animLeftBarTimeLine->start(); size();
skyGui->updateBarsPos();
} }
maxX = winBar->boundingRect().width()+buttonBar->boundingRect().widt
h()+2.*buttonBarPath->getRoundSize();
maxY = buttonBar->boundingRect().height()+2.*buttonBarPath->getRound
Size();
if (x<=maxX && y<=maxY && b==Qt::NoButton && animBottomBarTimeLine->
state()==QTimeLine::NotRunning && animBottomBarTimeLine->currentValue()<1.)
{
animBottomBarTimeLine->setDirection(QTimeLine::Forward);
animBottomBarTimeLine->start();
}
if (autoHideHorizontalButtonBar && (x>maxX+30 || y>maxY+30) && animB
ottomBarTimeLine->state()==QTimeLine::NotRunning && animBottomBarTimeLine->
currentValue()>=0.9999999)
{
animBottomBarTimeLine->setDirection(QTimeLine::Backward);
animBottomBarTimeLine->start();
}
return false;
}
// Note: "text" and "helpGroup" must be in English -- this method and the h
elp
// dialog take care of translating them. Of course, they still have to be
// marked for translation using the N_() macro.
QAction* StelGui::addGuiActions(const QString& actionName, const QString& t
ext, const QString& shortCut, const QString& helpGroup, bool checkable, boo
l autoRepeat, const QString& persistenceName)
{
QAction* a;
a = new QAction(&StelMainGraphicsView::getInstance());
a->setObjectName(actionName);
a->setText(q_(text));
QList<QKeySequence> shortcuts;
QStringList shortcutStrings = shortCut.split(QRegExp(",(?!,|$)"));
for (int i = 0; i < shortcutStrings.size(); ++i)
shortcuts << QKeySequence(shortcutStrings.at(i).trimmed());
a->setShortcuts(shortcuts);
a->setCheckable(checkable);
a->setAutoRepeat(autoRepeat);
a->setProperty("englishText", QVariant(text));
a->setProperty("persistenceName", QVariant(persistenceName));
a->setShortcutContext(Qt::WidgetShortcut);
if (!shortCut.isEmpty())
helpDialog.setKey(helpGroup, "", shortCut, text);
StelMainGraphicsView::getInstance().addAction(a);
// connect(a, SIGNAL(toggled(bool)), this, SLOT(guiActionTriggered(b
ool)));
return a;
}
QAction* StelGui::getGuiActions(const QString& actionName)
{
QAction* a = StelMainGraphicsView::getInstance().findChild<QAction*>
(actionName);
if (!a)
{
qWarning() << "Can't find action " << actionName;
return NULL;
}
return a;
}
// Called each time a GUI action is triggered
void StelGui::guiActionTriggered(bool b)
{
// can get the action name from: QObject::sender()->objectName();
// to get the config.ini key:
// and QObject::sender()->property("persistenceName").toString();
}
void StelGui::updateBarsPos()
{
const int ww = StelMainGraphicsView::getInstance().width();
const int hh = StelMainGraphicsView::getInstance().height();
bool updatePath = false;
// Use a position cache to avoid useless redraw triggered by the pos
ition set if the bars don't move
double rangeX = winBar->boundingRectNoHelpLabel().width()+2.*buttonB
arPath->getRoundSize()+1.;
const qreal newWinBarX = buttonBarPath->getRoundSize()-(1.-animLeftB
arTimeLine->currentValue())*rangeX-0.5;
const qreal newWinBarY = hh-winBar->boundingRectNoHelpLabel().height
()-buttonBar->boundingRectNoHelpLabel().height()-20;
if (winBar->pos().x()!=newWinBarX || winBar->pos().y()!=newWinBarY)
{
winBar->setPos(newWinBarX, newWinBarY);
updatePath = true;
}
double rangeY = buttonBar->boundingRectNoHelpLabel().height()+0.5-7.
-buttonBarPath->getRoundSize();
const qreal newButtonBarX = winBar->boundingRectNoHelpLabel().right(
)+buttonBarPath->getRoundSize();
const qreal newButtonBarY = hh-buttonBar->boundingRectNoHelpLabel().
height()-buttonBarPath->getRoundSize()+0.5+(1.-animBottomBarTimeLine->curre
ntValue())*rangeY;
if (buttonBar->pos().x()!=newButtonBarX || buttonBar->pos().y()!=new
ButtonBarY)
{
buttonBar->setPos(newButtonBarX, newButtonBarY);
updatePath = true;
}
if (lastButtonbarWidth != buttonBar->boundingRectNoHelpLabel().width
())
{
updatePath = true;
lastButtonbarWidth = (int)(buttonBar->boundingRectNoHelpLabe
l().width());
}
// double barOpacity = 1.-(5.+StelApp::getInstance().getCore()->getSkyD
rawer()->getLimitMagnitude())/10.;
// barOpacity = qMin(qMax(0., barOpacity), 1.);
// barOpacity = 0.2+barOpacity*0.4;
// buttonBarPath->setBackgroundOpacity(barOpacity);
if (updatePath)
buttonBarPath->updatePath(buttonBar, winBar);
const qreal newProgressBarX = ww-progressBarMgr->boundingRect().widt
h()-5;
const qreal newProgressBarY = hh-progressBarMgr->boundingRect().heig
ht()-5;
if (progressBarMgr->pos().x()!=newProgressBarX || progressBarMgr->po
s().y()!=newProgressBarY)
{
progressBarMgr->setPos(newProgressBarX, newProgressBarY);
updatePath = true;
}
// Update position of the auto-hide buttons
autoHidebts->setPos(0, hh-autoHidebts->childrenBoundingRect().height
()+1);
double opacity = qMax(animLeftBarTimeLine->currentValue(), animBotto
mBarTimeLine->currentValue());
autoHidebts->setOpacity(opacity < 0.01 ? 0.01 : opacity); // W
ork around a qt bug
} }
// Add a new progress bar in the lower right corner of the screen. // Add a new progress bar in the lower right corner of the screen.
QProgressBar* StelGui::addProgressBar() QProgressBar* StelGui::addProgressBar()
{ {
return progressBarMgr->addProgressBar(); return skyGui->progressBarMgr->addProgressBar();
} }
void StelGui::quitStellarium() void StelGui::setScriptKeys(bool b)
{ {
if(StelApp::getInstance().getDownloadMgr().blockQuit()) if (b)
{ {
downloadPopup.setVisible(true); getGuiActions("actionDecrease_Time_Speed")->setShortcut(QKey
downloadPopup.setText(QString("Stellarium is still downloadi Sequence());
ng the star " getGuiActions("actionIncrease_Time_Speed")->setShortcut(QKey
"catalog %1. Would you like to cancel the download a Sequence());
nd quit " getGuiActions("actionSet_Real_Time_Speed")->setShortcut(QKey
"Stellarium? (You can always restart the download at Sequence());
a later time.)") getGuiActions("actionDecrease_Script_Speed")->setShortcut(QK
.arg(StelApp::getInstance().getDownloadMgr().name()) eySequence("J"));
); getGuiActions("actionIncrease_Script_Speed")->setShortcut(QK
eySequence("L"));
connect(&downloadPopup, SIGNAL(cancelClicked()), this, SLOT( getGuiActions("actionSet_Real_Script_Speed")->setShortcut(QK
cancelDownloadAndQuit())); eySequence("K"));
connect(&downloadPopup, SIGNAL(continueClicked()), this, SLO
T(dontQuit()));
} }
else else
QCoreApplication::exit(); {
getGuiActions("actionDecrease_Script_Speed")->setShortcut(QK
eySequence());
getGuiActions("actionIncrease_Script_Speed")->setShortcut(QK
eySequence());
getGuiActions("actionSet_Real_Script_Speed")->setShortcut(QK
eySequence());
getGuiActions("actionDecrease_Time_Speed")->setShortcut(QKey
Sequence("J"));
getGuiActions("actionIncrease_Time_Speed")->setShortcut(QKey
Sequence("L"));
getGuiActions("actionSet_Real_Time_Speed")->setShortcut(QKey
Sequence("K"));
}
} }
void StelGui::cancelDownloadAndQuit() void StelGui::increaseScriptSpeed()
{ {
StelApp::getInstance().getDownloadMgr().abort(); StelMainGraphicsView::getInstance().getScriptMgr().setScriptRate(Ste
QCoreApplication::exit(); lMainGraphicsView::getInstance().getScriptMgr().getScriptRate()*2);
} }
void StelGui::dontQuit() void StelGui::decreaseScriptSpeed()
{ {
downloadPopup.setVisible(false); StelMainGraphicsView::getInstance().getScriptMgr().setScriptRate(Ste lMainGraphicsView::getInstance().getScriptMgr().getScriptRate()/2);
} }
QPixmap StelGui::makeRed(const QPixmap& p) void StelGui::setRealScriptSpeed()
{ {
QImage im = p.toImage().convertToFormat(QImage::Format_ARGB32); StelMainGraphicsView::getInstance().getScriptMgr().setScriptRate(1);
Q_ASSERT(im.format()==QImage::Format_ARGB32);
QRgb* bits = (QRgb*)im.bits();
const QRgb* stop = bits+im.width()*im.height();
do
{
*bits = qRgba(qRed(*bits), (int)(0.2*qGreen(*bits)), (int)(0
.2*qBlue(*bits)), qAlpha(*bits));
++bits;
}
while (bits!=stop);
return QPixmap::fromImage(im);
} }
void StelGui::setFlagShowFlipButtons(bool b) void StelGui::setFlagShowFlipButtons(bool b)
{ {
if (b==true) if (b==true)
{ {
if (flipVert==NULL) if (flipVert==NULL)
{ {
// Create the vertical flip button // Create the vertical flip button
QPixmap pxmapGlow32x32(":/graphicGui/gui/glow32x32.p ng"); QPixmap pxmapGlow32x32(":/graphicGui/gui/glow32x32.p ng");
flipVert = new StelButton(NULL, flipVert = new StelButton(NULL,
QPixmap(":/graphicGui/gui/ QP
btFlipVertical-on.png"), ixmap(":/graphicGui/gui/btFlipVertical-on.png"),
QPixmap(":/graphicGui/gui/ QP
btFlipVertical-off.png"), ixmap(":/graphicGui/gui/btFlipVertical-off.png"),
pxmapGlow32x32, px
getGuiActions("actionVerti mapGlow32x32,
cal_Flip")); ge
tGuiActions("actionVertical_Flip"));
} }
if (flipHoriz==NULL) if (flipHoriz==NULL)
{ {
QPixmap pxmapGlow32x32(":/graphicGui/gui/glow32x32.p ng"); QPixmap pxmapGlow32x32(":/graphicGui/gui/glow32x32.p ng");
flipHoriz = new StelButton(NULL, flipHoriz = new StelButton(NULL,
QPixmap(":/graphicGui/gui Q
/btFlipHorizontal-on.png"), Pixmap(":/graphicGui/gui/btFlipHorizontal-on.png"),
QPixmap(":/graphicGui/gui Q
/btFlipHorizontal-off.png"), Pixmap(":/graphicGui/gui/btFlipHorizontal-off.png"),
pxmapGlow32x32, p
getGuiActions("actionHori xmapGlow32x32,
zontal_Flip")); g
etGuiActions("actionHorizontal_Flip"));
} }
getButtonBar()->addButton(flipVert, "060-othersGroup", "acti onQuit_Global"); getButtonBar()->addButton(flipVert, "060-othersGroup", "acti onQuit_Global");
getButtonBar()->addButton(flipHoriz, "060-othersGroup", "act ionVertical_Flip"); getButtonBar()->addButton(flipHoriz, "060-othersGroup", "act ionVertical_Flip");
} }
else else
{ {
bool b = getButtonBar()->hideButton("actionVertical_Flip")== flipVert; bool b = getButtonBar()->hideButton("actionVertical_Flip")== flipVert;
Q_ASSERT(b); Q_ASSERT(b);
b = getButtonBar()->hideButton("actionHorizontal_Flip")==fli pHoriz; b = getButtonBar()->hideButton("actionHorizontal_Flip")==fli pHoriz;
Q_ASSERT(b); Q_ASSERT(b);
skipping to change at line 933 skipping to change at line 689
} }
else else
{ {
bool bb; bool bb;
bb = (getButtonBar()->hideButton("actionShow_DSS")==btShowNe bulaeBackground); bb = (getButtonBar()->hideButton("actionShow_DSS")==btShowNe bulaeBackground);
Q_ASSERT(bb); Q_ASSERT(bb);
} }
flagShowNebulaBackgroundButton = b; flagShowNebulaBackgroundButton = b;
} }
void StelGui::setHideGui(bool b) void StelGui::setVisible(bool b)
{ {
qDebug() << "StelGui::setHideGui -- " << b; skyGui->setVisible(b);
buttonBar->setVisible(!b);
winBar->setVisible(!b);
autoHidebts->setVisible(!b);
buttonBarPath->setVisible(!b);
} }
bool StelGui::getHideGui(void) bool StelGui::getVisible() const
{ {
return getGuiActions("actionToggle_GuiHidden_Global")->isChecked(); return skyGui->isVisible();
}
bool StelGui::isCurrentlyUsed() const
{
return skyGui->buttonBar->isUnderMouse() || skyGui->winBar->isUnderM
ouse();
}
void setScriptKeys()
{
}
void setNormalKeys()
{
}
void StelGui::setInfoTextFilters(const StelObject::InfoStringGroup& aflags)
{
skyGui->infoPanel->setInfoTextFilters(aflags);
}
const StelObject::InfoStringGroup& StelGui::getInfoTextFilters() const
{
return skyGui->infoPanel->getInfoTextFilters();
}
BottomStelBar* StelGui::getButtonBar() {return skyGui->buttonBar;}
LeftStelBar* StelGui::getWindowsButtonBar() {return skyGui->winBar;}
bool StelGui::getAutoHideHorizontalButtonBar() const {return skyGui->autoHi
deHorizontalButtonBar;}
void StelGui::setAutoHideHorizontalButtonBar(bool b) {skyGui->autoHideHoriz
ontalButtonBar=b;}
bool StelGui::getAutoHideVerticalButtonBar() const {return skyGui->autoHide
VerticalButtonBar;}
void StelGui::setAutoHideVerticalButtonBar(bool b) {skyGui->autoHideVertica
lButtonBar=b;}
void StelGui::forceRefreshGui()
{
skyGui->updateBarsPos();
}
void StelGui::scriptStarted()
{
setScriptKeys(true);
}
void StelGui::scriptStopped()
{
setScriptKeys(false);
}
void StelGui::setGuiVisible(bool b)
{
setVisible(b);
}
QAction* StelGui::addGuiActions(const QString& actionName, const QString& t
ext, const QString& shortCut, const QString& helpGroup, bool checkable, boo
l autoRepeat)
{
if (!shortCut.isEmpty())
helpDialog.setKey(helpGroup, "", shortCut, text);
return StelGuiBase::addGuiActions(actionName, text, shortCut, helpGr
oup, checkable, autoRepeat);
} }
 End of changes. 89 change blocks. 
522 lines changed or deleted 329 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/