Stellarium 0.13.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 QTimeLine;
32 class StelButton;
33 class BottomStelBar;
34 class InfoPanel;
36 class DateTimeDialog;
37 class HelpDialog;
38 class LocationDialog;
39 class SearchDialog;
40 class ViewDialog;
41 class ShortcutsDialog;
42 #ifdef ENABLE_SCRIPT_CONSOLE
43 class ScriptConsole;
44 #endif
45 
49 class StelGui : public QObject, public StelGuiBase
50 {
51  Q_OBJECT
52  Q_PROPERTY(bool visible READ getVisible WRITE setVisible)
53  Q_PROPERTY(bool autoHideHorizontalButtonBar READ getAutoHideHorizontalButtonBar WRITE setAutoHideHorizontalButtonBar)
54  Q_PROPERTY(bool autoHideVerticalButtonBar READ getAutoHideVerticalButtonBar WRITE setAutoHideVerticalButtonBar)
55 
56 public:
57  friend class ViewDialog;
58 
59  StelGui();
60  virtual ~StelGui();
61 
63  // Methods defined in the StelModule class
65  virtual void init(QGraphicsWidget* topLevelGraphicsWidget);
66  void update();
67 
68  StelStyle getStelStyle() const {return currentStelStyle;}
69 
71  // Methods specific to the StelGui class
73  void loadStyle(const QString& fileName);
74 
76  BottomStelBar* getButtonBar() const;
77 
79  class LeftStelBar* getWindowsButtonBar() const;
80 
83  class SkyGui* getSkyGui() const;
84 
86  bool getFlagShowFlipButtons() const;
87 
90 
92  bool initComplete(void) const;
93 
94 #ifdef ENABLE_SCRIPT_CONSOLE
95  ScriptConsole* getScriptConsole() {return scriptConsole;}
96 #endif
97 
99  virtual void forceRefreshGui();
100 
101  virtual void setVisible(bool b);
102 
103  virtual bool getVisible() const;
104 
105  virtual bool isCurrentlyUsed() const;
106 
107  virtual void setInfoTextFilters(const StelObject::InfoStringGroup& aflags);
108  virtual const StelObject::InfoStringGroup& getInfoTextFilters() const;
109 
110 public slots:
112  void setFlagShowFlipButtons(bool b);
113 
116 
118  bool getAutoHideHorizontalButtonBar() const;
124  void setAutoHideHorizontalButtonBar(bool b);
125 
127  bool getAutoHideVerticalButtonBar() const;
133  void setAutoHideVerticalButtonBar(bool b);
134 
135 #ifndef DISABLE_SCRIPTING
136  void setScriptKeys(bool b);
138  void increaseScriptSpeed();
139  void decreaseScriptSpeed();
140  void setRealScriptSpeed();
141  void stopScript();
142  void pauseScript();
143  void resumeScript();
144 #endif
145 
147  void setGuiVisible(bool);
148 
149 private slots:
150  void reloadStyle();
151 #ifndef DISABLE_SCRIPTING
152  void scriptStarted();
153  void scriptStopped();
154 #endif
155  void setStelStyle(const QString& section);
157  void quit();
158  void updateI18n();
159  void copySelectedObjectInfo(void);
160 
161 private:
163  StelAction* getAction(const QString& actionName);
164 
165  QGraphicsWidget* topLevelGraphicsWidget;
166 
167  class SkyGui* skyGui;
168 
169  StelButton* buttonTimeRewind;
170  StelButton* buttonTimeRealTimeSpeed;
171  StelButton* buttonTimeCurrent;
172  StelButton* buttonTimeForward;
173 
174  StelButton* buttonGotoSelectedObject;
175 
176  LocationDialog* locationDialog;
177  HelpDialog* helpDialog;
178  DateTimeDialog* dateTimeDialog;
179  SearchDialog* searchDialog;
180  ViewDialog* viewDialog;
181  ShortcutsDialog* shortcutsDialog;
182  ConfigurationDialog* configurationDialog;
183 #ifdef ENABLE_SCRIPT_CONSOLE
184  ScriptConsole* scriptConsole;
185 #endif
186 
187  bool flagShowFlipButtons;
188  StelButton* flipVert;
189  StelButton* flipHoriz;
190 
191  bool flagShowNebulaBackgroundButton;
192  StelButton* btShowNebulaeBackground;
193 
194  bool initDone;
195 
196  QSizeF savedProgressBarSize;
197 
198  // Currently used StelStyle
199  StelStyle currentStelStyle;
200 };
201 
204 {
205  Q_OBJECT
206  Q_PLUGIN_METADATA(IID "stellarium.StelGuiPluginInterface/1.0")
207  Q_INTERFACES(StelGuiPluginInterface)
208 public:
209  virtual class StelGuiBase* getStelGuiBase() const;
210 };
211 
212 #endif // _STELGUI_HPP_
void setFlagShowFlipButtons(bool b)
Define whether the buttons toggling image flip should be visible.
void setGuiVisible(bool)
Hide or show the GUI. Public so it can be called from scripts.
virtual void setInfoTextFilters(const StelObject::InfoStringGroup &aflags)
Get a pointer on the info panel used to display selected object info.
virtual bool isCurrentlyUsed() const
Show wether the Gui is currently used.
Define the interface to implement when creating a GUI plugin.
Definition: StelGuiBase.hpp:62
void setFlagShowNebulaBackgroundButton(bool b)
Define whether the button toggling nebulae background should be visible.
bool getFlagShowNebulaBackgroundButton() const
Get whether the button toggling nebulae background is visible.
bool getAutoHideHorizontalButtonBar() const
Get the auto-hide status of the horizontal toolbar.
void setAutoHideHorizontalButtonBar(bool b)
Set the auto-hide status of the horizontal toolbar.
class SkyGui * getSkyGui() const
Get the SkyGui instance (useful for adding other interface elements).
virtual void setVisible(bool b)
Show whether the GUI is visible.
virtual void forceRefreshGui()
Used to force a refreshing of the GUI elements such as the button bars.
void setScriptKeys(bool b)
change keys when a script is running / not running
Abstract class defining the base interface for all GUIs.
Definition: StelGuiBase.hpp:32
virtual bool getVisible() const
Get the current visible status of the GUI.
Allow to load the GUI as a static plugin.
Definition: StelGui.hpp:203
bool getAutoHideVerticalButtonBar() const
Get the auto-hide status of the vertical toolbar.
The informations about the currently selected object.
Definition: SkyGui.hpp:38
A Button Graphicsitem for use in Stellarium's graphic widgets.
The class managing the layout for button bars, selected object info and loading bars.
Definition: SkyGui.hpp:54
BottomStelBar * getButtonBar() const
Get the button bar at the bottom of the screensetDateTime.
bool getFlagShowFlipButtons() const
Get whether the buttons toggling image flip are visible.
bool initComplete(void) const
returns true if the gui has complted init process.
void setAutoHideVerticalButtonBar(bool b)
Set the auto-hide status of the vertical toolbar.
virtual class StelGuiBase * getStelGuiBase() const =0
Get the instance of StelGuiBase implmenting the GUI.
virtual void init(QGraphicsWidget *topLevelGraphicsWidget)
Initialize the StelGui object.
Holds the information related to a color style for GUI and modules of Stellarium. ...
Definition: StelStyle.hpp:28
Main class for the GUI based on QGraphicView.
Definition: StelGui.hpp:49
The sky object search dialog.
void loadStyle(const QString &fileName)
Load a Qt style sheet to define the widgets style.
class LeftStelBar * getWindowsButtonBar() const
Get the button bar of the left of the screen.