Stellarium 0.15.2
SkyGui.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2009 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 _SKYGUI_HPP_
21 #define _SKYGUI_HPP_
22 
23 #include "StelStyle.hpp"
24 #include "StelObject.hpp"
25 
26 #include <QDebug>
27 #include <QGraphicsWidget>
28 #include <QGraphicsPixmapItem>
29 
30 class QGraphicsSceneMouseEvent;
31 class QGraphicsTextItem;
32 class QTimeLine;
33 class StelButton;
34 class BottomStelBar;
36 
38 class InfoPanel : public QGraphicsTextItem
39 {
40  public:
43  InfoPanel(QGraphicsItem* parent);
44  ~InfoPanel();
45  void setInfoTextFilters(const StelObject::InfoStringGroup& aflags) {infoTextFilters=aflags;}
46  const StelObject::InfoStringGroup& getInfoTextFilters(void) const {return infoTextFilters;}
47  void setTextFromObjects(const QList<StelObjectP>&);
48  const QString getSelectedText(void);
49 
50  private:
51  StelObject::InfoStringGroup infoTextFilters;
52  QGraphicsPixmapItem *infoPixmap; // Used when text rendering is buggy. Used when CLI option -t given.
53 };
54 
56 class SkyGui: public QGraphicsWidget
57 {
58  Q_OBJECT
59 
60 public:
61  friend class StelGui;
62 
63  SkyGui(QGraphicsItem * parent=NULL);
67  void addProgressBar(StelProgressController*);
68 
69  void init(class StelGui* stelGui);
70 
71  virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* = 0) Q_DECL_OVERRIDE;
72 
73  int getSkyGuiWidth() const;
74  int getSkyGuiHeight() const;
75 
76 protected:
77  virtual void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE;
78  virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE;
79  virtual QVariant itemChange(GraphicsItemChange change, const QVariant & value) Q_DECL_OVERRIDE;
80 
81 private slots:
83  void setStelStyle(const QString& style);
84 
86  void updateBarsPos();
87 
88 private:
89  class StelBarsPath* buttonBarPath;
90  QTimeLine* animLeftBarTimeLine;
91  QTimeLine* animBottomBarTimeLine;
92  int lastButtonbarWidth;
93  class LeftStelBar* winBar;
94  BottomStelBar* buttonBar;
95  class InfoPanel* infoPanel;
96  class StelProgressBarMgr* progressBarMgr;
97 
98  // The 2 auto hide buttons in the lower left corner
99  StelButton* btHorizAutoHide;
100  StelButton* btVertAutoHide;
101 
102  class CornerButtons* autoHidebts;
103 
104  bool autoHideHorizontalButtonBar;
105  bool autoHideVerticalButtonBar;
106 
107  StelGui* stelGui;
108 };
109 
110 #endif // _SKYGUI_HPP_
InfoPanel(QGraphicsItem *parent)
Reads "gui/selected_object_info", etc from the configuration file.
The informations about the currently selected object.
Definition: SkyGui.hpp:38
A Button Graphicsitem for use in Stellarium&#39;s graphic widgets.
The class managing the layout for button bars, selected object info and loading bars.
Definition: SkyGui.hpp:56
Maintain the state of a progress bar.
virtual void init(QGraphicsWidget *topLevelGraphicsWidget)
Initialize the StelGui object.
Main class for the GUI based on QGraphicView.
Definition: StelGui.hpp:53