StelGui.hpp   StelGui.hpp 
skipping to change at line 20 skipping to change at line 20
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/ */
#ifndef _NEWGUI_HPP_ #ifndef _STELGUI_HPP_
#define _NEWGUI_HPP_ #define _STELGUI_HPP_
#include "StelModule.hpp" #include "StelModule.hpp"
#include "StelObject.hpp"
#include "LocationDialog.hpp" #include "LocationDialog.hpp"
#include "ViewDialog.hpp" #include "ViewDialog.hpp"
#include "StelObjectType.hpp"
#include "StelObject.hpp"
#include "HelpDialog.hpp" #include "HelpDialog.hpp"
#include "DateTimeDialog.hpp" #include "DateTimeDialog.hpp"
#include "SearchDialog.hpp" #include "SearchDialog.hpp"
#include "ConfigurationDialog.hpp" #include "ConfigurationDialog.hpp"
#include "DownloadPopup.hpp" #ifdef ENABLE_SCRIPT_CONSOLE
#include <QDebug> #include "ScriptConsole.hpp"
#include <QGraphicsItem> #endif
#include "StelGuiBase.hpp"
#include <QGraphicsTextItem>
class QGraphicsSceneMouseEvent; class QGraphicsSceneMouseEvent;
class QAction; class QAction;
class QGraphicsTextItem;
class QTimeLine; class QTimeLine;
class StelButton; class StelButton;
class BottomStelBar; class BottomStelBar;
class InfoPanel;
//! The informations about the currently selected object
class InfoPanel : public QGraphicsTextItem
{
public:
InfoPanel(QGraphicsItem* parent);
void setInfoTextFilters(const StelObject::InfoStringGroup& aflags) {
infoTextFilters=aflags;}
const StelObject::InfoStringGroup& getInfoTextFilters(void) const {r
eturn infoTextFilters;}
void setTextFromObjects(const QList<StelObjectP>&);
private:
StelObject::InfoStringGroup infoTextFilters;
};
//! @class StelGui //! @class StelGui
//! Main class for the GUI based on QGraphicView. //! Main class for the GUI based on QGraphicView.
//! It manages the various qt configuration windows, the buttons bars, the list of QAction/shortcuts. //! It manages the various qt configuration windows, the buttons bars, the list of QAction/shortcuts.
class StelGui : public StelModule class StelGui : public QObject, public StelGuiBase
{ {
Q_OBJECT Q_OBJECT
public: public:
friend class ViewDialog; friend class ViewDialog;
StelGui(); StelGui();
virtual ~StelGui(); virtual ~StelGui();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
//! Initialize the StelGui object. //! Initialize the StelGui object.
virtual void init(); virtual void init(QGraphicsWidget* topLevelGraphicsWidget, StelAppGr
virtual void draw(StelCore* core) {;} aphicsWidget* stelAppGraphicsWidget);
virtual void update(double deltaTime); void update();
virtual void updateI18n(); virtual void updateI18n();
virtual double getCallOrder(StelModuleActionName actionName) const;
virtual void glWindowHasBeenResized(int w, int h);
virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
//! Load color scheme from the given ini file and section name //! Load color scheme from the given ini file and section name
virtual void setStelStyle(const StelStyle& style); virtual void setStelStyle(const StelStyle& style);
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods specific to the StelGui class // Methods specific to the StelGui class
//! Load a Qt style sheet to define the widgets style //! Load a Qt style sheet to define the widgets style
void loadStyle(const QString& fileName); void loadStyle(const QString& fileName);
//! Get a pointer on the info panel used to display selected object
info
InfoPanel* getInfoPanel(void) { return infoPanel; }
//! 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.
//! When the progress bar is deleted with removeProgressBar() the la yout is automatically rearranged. //! When the progress bar is deleted with removeProgressBar() the la yout is automatically rearranged.
//! @return a pointer to the progress bar //! @return a pointer to the progress bar
class QProgressBar* addProgressBar(); class QProgressBar* addProgressBar();
//! Add a new action managed by the GUI. This method should be used
to add new shortcuts to the program
//! @param actionName qt object name. Used as a reference for later
uses
//! @param text the text to display when hovering, or in the help wi
ndow
//! @param shortCut the qt shortcut to use
//! @param helpGroup hint on how to group the text in the help windo
w
//! @param checkable whether the action should be checkable
//! @param autoRepeat whether the action should be autorepeated
//! @param persistenceName name of the attribute for persistence in
the config.ini. Not persistent if empty.
QAction* addGuiActions(const QString& actionName, const QString& tex
t, const QString& shortCut, const QString& helpGroup, bool checkable=true,
bool autoRepeat=false, const QString& persistenceName=QString());
//! Get a pointer on an action managed by the GUI
//! @param actionName qt object name for this action
//! @return a pointer on the QAction object or NULL if don't exist
QAction* getGuiActions(const QString& actionName);
//! Get the button bar at the bottom of the screen //! Get the button bar at the bottom of the screen
BottomStelBar* getButtonBar() {return buttonBar;} BottomStelBar* getButtonBar();
//! Get the button bar of the left of the screen //! Get the button bar of the left of the screen
class LeftStelBar* getWindowsButtonBar() {return winBar;} class LeftStelBar* getWindowsButtonBar();
//! Transform the pixmap so that it look red for night vision mode
static QPixmap makeRed(const QPixmap& p);
//! Get whether the buttons toggling image flip are visible //! Get whether the buttons toggling image flip are visible
bool getFlagShowFlipButtons() {return flagShowFlipButtons;} bool getFlagShowFlipButtons() {return flagShowFlipButtons;}
//! Get whether the button toggling nebulae background is visible //! Get whether the button toggling nebulae background is visible
bool getFlagShowNebulaBackgroundButton() {return flagShowNebulaBackg roundButton;} bool getFlagShowNebulaBackgroundButton() {return flagShowNebulaBackg roundButton;}
//! returns true if the gui has complted init process. //! returns true if the gui has complted init process.
bool initComplete(void) {return initDone;} bool initComplete(void) {return initDone;}
DownloadPopup* getDownloadPopup() {return &downloadPopup;} #ifdef ENABLE_SCRIPT_CONSOLE
ScriptConsole* getScriptConsole() {return &scriptConsole;}
#endif
//! Used to force a refreshing of the GUI elements such as the butto
n bars.
virtual void forceRefreshGui();
virtual void setVisible(bool b);
virtual bool getVisible() const;
virtual bool isCurrentlyUsed() const;
virtual void setInfoTextFilters(const StelObject::InfoStringGroup& a
flags);
virtual const StelObject::InfoStringGroup& getInfoTextFilters() cons
t;
virtual QAction* addGuiActions(const QString& actionName, const QStr
ing& text, const QString& shortCut, const QString& helpGroup, bool checkabl
e=true, bool autoRepeat=false);
public slots: public slots:
//! Define whether the buttons toggling image flip should be visible //! Define whether the buttons toggling image flip should be visible
void setFlagShowFlipButtons(bool b); void setFlagShowFlipButtons(bool b);
//! Define whether the button toggling nebulae background should be visible //! Define whether the button toggling nebulae background should be visible
void setFlagShowNebulaBackgroundButton(bool b); void setFlagShowNebulaBackgroundButton(bool b);
//! Get the auto-hide status of the horizontal toolbar. //! Get the auto-hide status of the horizontal toolbar.
bool getAutoHideHorizontalButtonBar() const {return autoHideHorizont alButtonBar;} bool getAutoHideHorizontalButtonBar() const;
//! Set the auto-hide status of the horizontal toolbar. //! Set the auto-hide status of the horizontal toolbar.
//! When set to true, the horizontal toolbar will auto-hide itself, only //! When set to true, the horizontal toolbar will auto-hide itself, only
//! making an appearance when the mouse is nearby. When false, it w ill //! making an appearance when the mouse is nearby. When false, it w ill
//! remain on screen. //! remain on screen.
//! @param b to hide or not to hide //! @param b to hide or not to hide
void setAutoHideHorizontalButtonBar(bool b) {autoHideHorizontalButto nBar=b;} void setAutoHideHorizontalButtonBar(bool b);
//! Get the auto-hide status of the vertical toolbar. //! Get the auto-hide status of the vertical toolbar.
bool getAutoHideVerticalButtonBar() const {return autoHideVerticalBu ttonBar;} bool getAutoHideVerticalButtonBar() const;
//! Set the auto-hide status of the vertical toolbar. //! Set the auto-hide status of the vertical toolbar.
//! When set to true, the vertical toolbar will auto-hide itself, on ly //! When set to true, the vertical toolbar will auto-hide itself, on ly
//! making an appearance when the mouse is nearby. When false, it w ill //! making an appearance when the mouse is nearby. When false, it w ill
//! remain on screen. //! remain on screen.
//! @param b to hide or not to hide //! @param b to hide or not to hide
void setAutoHideVerticalButtonBar(bool b) {autoHideVerticalButtonBar =b;} void setAutoHideVerticalButtonBar(bool b);
//! show or hide the toolbars //! change keys when a script is running / not running
//! @param b when true, toolbars will be shown, else they will be hi void setScriptKeys(bool b);
dden. void increaseScriptSpeed();
void setHideGui(bool b); void decreaseScriptSpeed();
//! get the current visible status of the toolbars void setRealScriptSpeed();
bool getHideGui();
void quitStellarium(); //! Hide or show the GUI. Public so it can be called from scripts.
void setGuiVisible(bool);
private slots: private slots:
//! Update the position of the button bars in the main window
void updateBarsPos();
void reloadStyle(); void reloadStyle();
void cancelDownloadAndQuit(); void scriptStarted();
void dontQuit(); void scriptStopped();
//! Called each time a GUI action is triggered
void guiActionTriggered(bool b=false);
private: private:
QGraphicsWidget* topLevelGraphicsWidget;
class LeftStelBar* winBar; class SkyGui* skyGui;
BottomStelBar* buttonBar;
InfoPanel* infoPanel;
class StelBarsPath* buttonBarPath;
QTimeLine* animLeftBarTimeLine;
QTimeLine* animBottomBarTimeLine;
StelButton* buttonTimeRewind; StelButton* buttonTimeRewind;
StelButton* buttonTimeRealTimeSpeed; StelButton* buttonTimeRealTimeSpeed;
StelButton* buttonTimeCurrent; StelButton* buttonTimeCurrent;
StelButton* buttonTimeForward; StelButton* buttonTimeForward;
StelButton* buttonGotoSelectedObject; StelButton* buttonGotoSelectedObject;
LocationDialog locationDialog; LocationDialog locationDialog;
HelpDialog helpDialog; HelpDialog helpDialog;
DateTimeDialog dateTimeDialog; DateTimeDialog dateTimeDialog;
SearchDialog searchDialog; SearchDialog searchDialog;
ViewDialog viewDialog; ViewDialog viewDialog;
ConfigurationDialog configurationDialog; ConfigurationDialog* configurationDialog;
DownloadPopup downloadPopup; #ifdef ENABLE_SCRIPT_CONSOLE
ScriptConsole scriptConsole;
class StelProgressBarMgr* progressBarMgr; #endif
int lastButtonbarWidth;
// The 2 auto hide buttons in the lower left corner
StelButton* btHorizAutoHide;
StelButton* btVertAutoHide;
class CornerButtons* autoHidebts;
bool autoHideHorizontalButtonBar;
bool autoHideVerticalButtonBar;
bool flagShowFlipButtons; bool flagShowFlipButtons;
class StelButton* flipVert; class StelButton* flipVert;
class StelButton* flipHoriz; class StelButton* flipHoriz;
bool flagShowNebulaBackgroundButton; bool flagShowNebulaBackgroundButton;
class StelButton* btShowNebulaeBackground; class StelButton* btShowNebulaeBackground;
bool initDone; bool initDone;
bool guiHidden; bool guiHidden;
QSizeF savedProgressBarSize;
};
//! Allow to load the GUI as a static plugin
class StelStandardGuiPluginInterface : public QObject, public StelGuiPlugin
Interface
{
Q_OBJECT
Q_INTERFACES(StelGuiPluginInterface)
public:
virtual class StelGuiBase* getStelGuiBase() const;
}; };
#endif // _STELGUI_HPP_ #endif // _STELGUI_HPP_
 End of changes. 26 change blocks. 
101 lines changed or deleted 70 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/