Stellarium 0.11.2
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure
gui/StelGui.hpp
00001 /*
00002  * Stellarium
00003  * Copyright (C) 2008 Fabien Chereau
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
00018  */
00019 
00020 #ifndef _STELGUI_HPP_
00021 #define _STELGUI_HPP_
00022 
00023 #include "StelModule.hpp"
00024 #include "StelObject.hpp"
00025 #include "LocationDialog.hpp"
00026 #include "ViewDialog.hpp"
00027 #include "HelpDialog.hpp"
00028 #include "DateTimeDialog.hpp"
00029 #include "SearchDialog.hpp"
00030 #include "ConfigurationDialog.hpp"
00031 #ifdef ENABLE_SCRIPT_CONSOLE
00032 #include "ScriptConsole.hpp"
00033 #endif
00034 #include "StelGuiBase.hpp"
00035 #include "StelStyle.hpp"
00036 
00037 #include <QGraphicsTextItem>
00038 
00039 class QGraphicsSceneMouseEvent;
00040 class QAction;
00041 class QTimeLine;
00042 class StelButton;
00043 class BottomStelBar;
00044 class InfoPanel;
00045 
00049 class StelGui : public QObject, public StelGuiBase
00050 {
00051     Q_OBJECT
00052 public:
00053     friend class ViewDialog;
00054     
00055     StelGui();
00056     virtual ~StelGui();
00057 
00059     // Methods defined in the StelModule class
00061     virtual void init(QGraphicsWidget* topLevelGraphicsWidget, StelAppGraphicsWidget* stelAppGraphicsWidget);
00062     void update();
00063 
00064     StelStyle getStelStyle() const {return currentStelStyle;}
00065     
00067     // Methods specific to the StelGui class
00069     void loadStyle(const QString& fileName);
00070     
00074     class QProgressBar* addProgressBar();
00075     
00077     BottomStelBar* getButtonBar() const;
00078     
00080     class LeftStelBar* getWindowsButtonBar() const;
00081 
00084     class SkyGui* getSkyGui() const;
00085     
00087     bool getFlagShowFlipButtons() const;
00088     
00090     bool getFlagShowNebulaBackgroundButton() const;
00091 
00093     bool initComplete(void) const;
00094 
00095 #ifdef ENABLE_SCRIPT_CONSOLE
00096     ScriptConsole* getScriptConsole() {return &scriptConsole;}
00097 #endif
00098 
00100     virtual void forceRefreshGui();
00101     
00102     virtual void setVisible(bool b);
00103 
00104     virtual bool getVisible() const;
00105 
00106     virtual bool isCurrentlyUsed() const;
00107     
00108     virtual void setInfoTextFilters(const StelObject::InfoStringGroup& aflags);
00109     virtual const StelObject::InfoStringGroup& getInfoTextFilters() const;
00110     
00111     virtual QAction* addGuiActions(const QString& actionName,
00112                                    const QString& text,
00113                                    const QString& shortCut,
00114                                    const QString& helpGroup,
00115                                    bool checkable=true,
00116                                    bool autoRepeat=false);
00117     
00118 public slots:
00120     void setFlagShowFlipButtons(bool b);
00121     
00123     void setFlagShowNebulaBackgroundButton(bool b);
00124 
00126     bool getAutoHideHorizontalButtonBar() const;
00132     void setAutoHideHorizontalButtonBar(bool b);
00133     
00135     bool getAutoHideVerticalButtonBar() const;
00141     void setAutoHideVerticalButtonBar(bool b);
00142 
00143     #ifndef DISABLE_SCRIPTING
00144 
00145     void setScriptKeys(bool b);
00146     void increaseScriptSpeed();
00147     void decreaseScriptSpeed();
00148     void setRealScriptSpeed();
00149     #endif
00150 
00152     void setGuiVisible(bool);
00153 
00154 private slots:
00155     void reloadStyle();
00156     #ifndef DISABLE_SCRIPTING
00157     void scriptStarted();
00158     void scriptStopped();
00159     #endif
00160 
00161     void setStelStyle(const QString& section);
00162     void quit();
00163     void updateI18n();
00165     void artDisplayedUpdated(const bool displayed);
00166     void boundariesDisplayedUpdated(const bool displayed);
00167     void linesDisplayedUpdated(const bool displayed);
00168     void namesDisplayedUpdated(const bool displayed);
00170     void azimuthalGridDisplayedUpdated(const bool displayed);
00171     void equatorGridDisplayedUpdated(const bool displayed);
00172     void equatorJ2000GridDisplayedUpdated(const bool displayed);
00173     void galacticGridDisplayedUpdated(const bool displayed);
00174     void equatorLineDisplayedUpdated(const bool displayed);
00175     void eclipticLineDisplayedUpdated(const bool displayed);
00176     void meridianLineDisplayedUpdated(const bool displayed);
00177     void horizonLineDisplayedUpdated(const bool displayed);
00178     void galacticPlaneLineDisplayedUpdated(const bool displayed);
00180     void atmosphereDisplayedUpdated(const bool displayed);
00181     void cardinalsPointsDisplayedUpdated(const bool displayed);
00182     void fogDisplayedUpdated(const bool displayed);
00183     void landscapeDisplayedUpdated(const bool displayed);
00184     void copySelectedObjectInfo(void);
00185 
00186 private:
00187     QGraphicsWidget* topLevelGraphicsWidget;
00188             
00189     class SkyGui* skyGui;
00190     
00191     StelButton* buttonTimeRewind;
00192     StelButton* buttonTimeRealTimeSpeed;
00193     StelButton* buttonTimeCurrent;
00194     StelButton* buttonTimeForward;
00195     
00196     StelButton* buttonGotoSelectedObject;
00197     
00198     LocationDialog locationDialog;
00199     HelpDialog helpDialog;
00200     DateTimeDialog dateTimeDialog;
00201     SearchDialog searchDialog;
00202     ViewDialog viewDialog;
00203     ConfigurationDialog* configurationDialog;
00204 #ifdef ENABLE_SCRIPT_CONSOLE
00205     ScriptConsole scriptConsole;
00206 #endif
00207 
00208     bool flagShowFlipButtons;
00209     StelButton* flipVert;
00210     StelButton* flipHoriz;
00211     
00212     bool flagShowNebulaBackgroundButton;
00213     StelButton* btShowNebulaeBackground;
00214 
00215     bool initDone;
00216     bool guiHidden;
00217     
00218     QSizeF savedProgressBarSize;
00219 
00220     // Currently used StelStyle
00221     StelStyle currentStelStyle;
00222 
00223     // This method is used by init() to initialize the ConstellationMgr instance.
00224     void initConstellationMgr();
00225 
00226     // This method is used by init() to initialize the GridLineMgr instance.
00227     void initGrindLineMgr();
00228 
00229     // This method is used by init() to initialize the LandscapeMgr instance.
00230     void initLandscapeMgr();
00231 };
00232 
00234 class StelStandardGuiPluginInterface : public QObject, public StelGuiPluginInterface
00235 {
00236     Q_OBJECT
00237     Q_INTERFACES(StelGuiPluginInterface)
00238 public:
00239     virtual class StelGuiBase* getStelGuiBase() const;
00240 };
00241 
00242 #endif // _STELGUI_HPP_