Stellarium 0.12.1
StelGui.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2008 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STELGUI_HPP_
21 #define _STELGUI_HPP_
22 
23 #include "StelModule.hpp"
24 #include "StelObject.hpp"
25 #include "StelGuiBase.hpp"
26 #include "StelStyle.hpp"
27 
28 #include <QGraphicsTextItem>
29 
30 class QGraphicsSceneMouseEvent;
31 class QAction;
32 class QTimeLine;
33 class StelButton;
34 class BottomStelBar;
35 class InfoPanel;
37 class DateTimeDialog;
38 class HelpDialog;
39 class LocationDialog;
40 class SearchDialog;
41 class ViewDialog;
42 class ShortcutsDialog;
43 #ifdef ENABLE_SCRIPT_CONSOLE
44 class ScriptConsole;
45 #endif
46 
50 class StelGui : public QObject, public StelGuiBase
51 {
52  Q_OBJECT
53 public:
54  friend class ViewDialog;
55 
56  StelGui();
57  virtual ~StelGui();
58 
60  // Methods defined in the StelModule class
62  virtual void init(QGraphicsWidget* topLevelGraphicsWidget, StelAppGraphicsWidget* stelAppGraphicsWidget);
63  void update();
64 
65  StelStyle getStelStyle() const {return currentStelStyle;}
66 
68  // Methods specific to the StelGui class
70  void loadStyle(const QString& fileName);
71 
75  class QProgressBar* addProgressBar();
76 
78  BottomStelBar* getButtonBar() const;
79 
81  class LeftStelBar* getWindowsButtonBar() const;
82 
85  class SkyGui* getSkyGui() const;
86 
88  bool getFlagShowFlipButtons() const;
89 
92 
94  bool initComplete(void) const;
95 
96 #ifdef ENABLE_SCRIPT_CONSOLE
97  ScriptConsole* getScriptConsole() {return scriptConsole;}
98 #endif
99 
101  virtual void forceRefreshGui();
102 
103  virtual void setVisible(bool b);
104 
105  virtual bool getVisible() const;
106 
107  virtual bool isCurrentlyUsed() const;
108 
109  virtual void setInfoTextFilters(const StelObject::InfoStringGroup& aflags);
110  virtual const StelObject::InfoStringGroup& getInfoTextFilters() const;
111 
112  virtual QAction* getGuiAction(const QString& actionName);
113 
114 public slots:
116  void setFlagShowFlipButtons(bool b);
117 
120 
122  bool getAutoHideHorizontalButtonBar() const;
128  void setAutoHideHorizontalButtonBar(bool b);
129 
131  bool getAutoHideVerticalButtonBar() const;
137  void setAutoHideVerticalButtonBar(bool b);
138 
139 #ifndef DISABLE_SCRIPTING
140 
141  void setScriptKeys(bool b);
142  void increaseScriptSpeed();
143  void decreaseScriptSpeed();
144  void setRealScriptSpeed();
145  void stopScript();
146  void pauseScript();
147  void resumeScript();
148 #endif
149 
151  void setGuiVisible(bool);
152 
153 private slots:
154  void reloadStyle();
155 #ifndef DISABLE_SCRIPTING
156  void scriptStarted();
157  void scriptStopped();
158 #endif
159 
160  void setStelStyle(const QString& section);
161  void quit();
162  void updateI18n();
164  void artDisplayedUpdated(const bool displayed);
165  void boundariesDisplayedUpdated(const bool displayed);
166  void linesDisplayedUpdated(const bool displayed);
167  void namesDisplayedUpdated(const bool displayed);
169  void azimuthalGridDisplayedUpdated(const bool displayed);
170  void equatorGridDisplayedUpdated(const bool displayed);
171  void equatorJ2000GridDisplayedUpdated(const bool displayed);
172  void eclipticJ2000GridDisplayedUpdated(const bool displayed);
173  void galacticGridDisplayedUpdated(const bool displayed);
174  void equatorLineDisplayedUpdated(const bool displayed);
175  void eclipticLineDisplayedUpdated(const bool displayed);
176  void meridianLineDisplayedUpdated(const bool displayed);
177  void horizonLineDisplayedUpdated(const bool displayed);
178  void galacticPlaneLineDisplayedUpdated(const bool displayed);
180  void atmosphereDisplayedUpdated(const bool displayed);
181  void cardinalsPointsDisplayedUpdated(const bool displayed);
182  void fogDisplayedUpdated(const bool displayed);
183  void landscapeDisplayedUpdated(const bool displayed);
184  void copySelectedObjectInfo(void);
185 
186 private:
187  QGraphicsWidget* topLevelGraphicsWidget;
188 
189  class SkyGui* skyGui;
190 
191  StelButton* buttonTimeRewind;
192  StelButton* buttonTimeRealTimeSpeed;
193  StelButton* buttonTimeCurrent;
194  StelButton* buttonTimeForward;
195 
196  StelButton* buttonGotoSelectedObject;
197 
198  LocationDialog* locationDialog;
199  HelpDialog* helpDialog;
200  DateTimeDialog* dateTimeDialog;
201  SearchDialog* searchDialog;
202  ViewDialog* viewDialog;
203  ShortcutsDialog* shortcutsDialog;
204  ConfigurationDialog* configurationDialog;
205 #ifdef ENABLE_SCRIPT_CONSOLE
206  ScriptConsole* scriptConsole;
207 #endif
208 
209  bool flagShowFlipButtons;
210  StelButton* flipVert;
211  StelButton* flipHoriz;
212 
213  bool flagShowNebulaBackgroundButton;
214  StelButton* btShowNebulaeBackground;
215 
216  bool initDone;
217  bool guiHidden;
218 
219  QSizeF savedProgressBarSize;
220 
221  // Currently used StelStyle
222  StelStyle currentStelStyle;
223 
224  // This method is used by init() to initialize the ConstellationMgr instance.
225  void initConstellationMgr();
226 
227  // This method is used by init() to initialize the GridLineMgr instance.
228  void initGrindLineMgr();
229 
230  // This method is used by init() to initialize the LandscapeMgr instance.
231  void initLandscapeMgr();
232 };
233 
236 {
237  Q_OBJECT;
238  Q_INTERFACES(StelGuiPluginInterface);
239 public:
240  virtual class StelGuiBase* getStelGuiBase() const;
241 };
242 
243 #endif // _STELGUI_HPP_