Home · All Namespaces · All Classes · Functions · Coding Style · 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _NEWGUI_HPP_
00021 #define _NEWGUI_HPP_
00022 
00023 #include "StelModule.hpp"
00024 #include "LocationDialog.hpp"
00025 #include "ViewDialog.hpp"
00026 #include "StelObjectType.hpp"
00027 #include "StelObject.hpp"
00028 #include "HelpDialog.hpp"
00029 #include "DateTimeDialog.hpp"
00030 #include "SearchDialog.hpp"
00031 #include "ConfigurationDialog.hpp"
00032 #include "DownloadPopup.hpp"
00033 #include <QDebug>
00034 #include <QGraphicsItem>
00035 
00036 class QGraphicsSceneMouseEvent;
00037 class QAction;
00038 class QGraphicsTextItem;
00039 class QTimeLine;
00040 class StelButton;
00041 class BottomStelBar;
00042 
00044 class InfoPanel : public QGraphicsTextItem
00045 {
00046 public:
00047     InfoPanel(QGraphicsItem* parent);
00048     void setInfoTextFilters(const StelObject::InfoStringGroup& aflags) {infoTextFilters=aflags;}
00049     const StelObject::InfoStringGroup& getInfoTextFilters(void) const {return infoTextFilters;}
00050     void setTextFromObjects(const QList<StelObjectP>&);
00051 private:
00052     StelObject::InfoStringGroup infoTextFilters;
00053 };
00054 
00058 class StelGui : public StelModule
00059 {
00060     Q_OBJECT
00061 public:
00062     friend class ViewDialog;
00063     
00064     StelGui();
00065     virtual ~StelGui();
00066 
00068     // Methods defined in the StelModule class
00070     virtual void init();
00071     virtual void draw(StelCore* core) {;}
00072     virtual void update(double deltaTime);
00073     virtual void updateI18n();
00074     virtual double getCallOrder(StelModuleActionName actionName) const;
00075     virtual void glWindowHasBeenResized(int w, int h);
00076     virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
00078     virtual void setStelStyle(const StelStyle& style);
00079     
00081     // Methods specific to the StelGui class
00083     void loadStyle(const QString& fileName);
00084 
00086     InfoPanel* getInfoPanel(void) { return infoPanel; }
00087     
00091     class QProgressBar* addProgressBar();
00092     
00101     QAction* addGuiActions(const QString& actionName, const QString& text, const QString& shortCut, const QString& helpGroup, bool checkable=true, bool autoRepeat=false, const QString& persistenceName=QString());
00102     
00106     QAction* getGuiActions(const QString& actionName);
00107     
00109     BottomStelBar* getButtonBar() {return buttonBar;}
00110     
00112     class LeftStelBar* getWindowsButtonBar() {return winBar;}
00113     
00115     static QPixmap makeRed(const QPixmap& p);
00116 
00118     bool getFlagShowFlipButtons() {return flagShowFlipButtons;}
00119     
00121     bool getFlagShowNebulaBackgroundButton() {return flagShowNebulaBackgroundButton;}
00122 
00124     bool initComplete(void) {return initDone;}
00125     
00126     DownloadPopup* getDownloadPopup() {return &downloadPopup;}
00127 
00128 public slots:
00130     void setFlagShowFlipButtons(bool b);
00131     
00133     void setFlagShowNebulaBackgroundButton(bool b);
00134 
00136     bool getAutoHideHorizontalButtonBar() const {return autoHideHorizontalButtonBar;}
00142     void setAutoHideHorizontalButtonBar(bool b) {autoHideHorizontalButtonBar=b;}
00143     
00145     bool getAutoHideVerticalButtonBar() const {return autoHideVerticalButtonBar;}
00151     void setAutoHideVerticalButtonBar(bool b) {autoHideVerticalButtonBar=b;}
00152 
00155     void setHideGui(bool b);
00157     bool getHideGui();
00158     
00159     void quitStellarium();
00160 
00161 private slots:
00163     void updateBarsPos();
00164     void reloadStyle();
00165     void cancelDownloadAndQuit();
00166     void dontQuit();
00167     
00169     void guiActionTriggered(bool b=false);
00170     
00171 private:
00172     
00173     class LeftStelBar* winBar;
00174     BottomStelBar* buttonBar;
00175     InfoPanel* infoPanel;
00176     class StelBarsPath* buttonBarPath;
00177 
00178     QTimeLine* animLeftBarTimeLine;
00179     QTimeLine* animBottomBarTimeLine;
00180     
00181     StelButton* buttonTimeRewind;
00182     StelButton* buttonTimeRealTimeSpeed;
00183     StelButton* buttonTimeCurrent;
00184     StelButton* buttonTimeForward;
00185     
00186     StelButton* buttonGotoSelectedObject;
00187     
00188     LocationDialog locationDialog;
00189     HelpDialog helpDialog;
00190     DateTimeDialog dateTimeDialog;
00191     SearchDialog searchDialog;
00192     ViewDialog viewDialog;
00193     ConfigurationDialog configurationDialog;
00194     DownloadPopup downloadPopup;
00195     
00196     class StelProgressBarMgr* progressBarMgr;
00197     
00198     int lastButtonbarWidth;
00199     
00200     // The 2 auto hide buttons in the lower left corner
00201     StelButton* btHorizAutoHide;
00202     StelButton* btVertAutoHide;
00203     
00204     class CornerButtons* autoHidebts;
00205     
00206     bool autoHideHorizontalButtonBar;
00207     bool autoHideVerticalButtonBar;
00208 
00209     bool flagShowFlipButtons;
00210     class StelButton* flipVert;
00211     class StelButton* flipHoriz;
00212     
00213     bool flagShowNebulaBackgroundButton;
00214     class StelButton* btShowNebulaeBackground;
00215 
00216     bool initDone;
00217     bool guiHidden;
00218 };
00219 
00220 #endif // _STELGUI_HPP_

Generated on Mon Mar 9 16:16:16 2009 for Stellarium by  doxygen 1.5.5