Stellarium 0.12.3
OcularsGuiPanel.hpp
1 /*
2 Oculars plug-in for Stellarium: graphical user interface widget
3 Copyright (C) 2011 Bogdan Marinov
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 OCULARSGUIPANEL_HPP
21 #define OCULARSGUIPANEL_HPP
22 
23 #include <QGraphicsWidget>
24 
25 class Oculars;
26 class StelButton;
27 class QGraphicsLinearLayout;
28 class QGraphicsProxyWidget;
29 class QLabel;
30 class QPushButton;
31 class QWidget;
32 
34 class OcularsGuiPanel : public QGraphicsWidget
35 {
36  Q_OBJECT
37 
38 public:
39  OcularsGuiPanel(Oculars* ocularsPlugin,
40  QGraphicsWidget * parent = 0,
41  Qt::WindowFlags wFlags = 0);
42  ~OcularsGuiPanel();
43 
44 public slots:
46  void showOcularGui();
48  void showCcdGui();
50  void foldGui();
51 
52 private slots:
55  void updatePosition();
56 
58  void updateOcularControls();
60  void updateCcdControls();
63  void updateTelescopeControls();
65  void updateLensControls();
67  void setColorScheme(const QString& schemeName);
68 
69 private:
70  Oculars* ocularsPlugin;
71 
73  QGraphicsWidget* parentWidget;
74 
75  QGraphicsLinearLayout* mainLayout;
76 
77  QGraphicsPathItem* borderPath;
78 
80  QGraphicsWidget* buttonBar;
81  QGraphicsWidget* ocularControls;
82  QGraphicsWidget* lensControls;
83  QGraphicsWidget* ccdControls;
84  QGraphicsWidget* telescopeControls;
85 
86  //Mini-toolbar
87  StelButton* buttonOcular;
88  StelButton* buttonCrosshairs;
89  StelButton* buttonCcd;
90  StelButton* buttonTelrad;
91  StelButton* buttonConfiguration;
92 
93  //Information display
94  StelButton* prevOcularButton;
95  StelButton* nextOcularButton;
96  StelButton* prevTelescopeButton;
97  StelButton* nextTelescopeButton;
98  StelButton* prevCcdButton;
99  StelButton* nextCcdButton;
100  StelButton* prevLensButton;
101  StelButton* nextLensButton;
102  QGraphicsTextItem* fieldLensName;
103  QGraphicsTextItem* fieldLensMultipler;
104  QGraphicsTextItem* fieldOcularName;
105  QGraphicsTextItem* fieldOcularFl;
106  QGraphicsTextItem* fieldOcularAfov;
107  QGraphicsTextItem* fieldCcdName;
108  QGraphicsTextItem* fieldCcdDimensions;
109  QGraphicsTextItem* fieldCcdRotation;
110  QGraphicsTextItem* fieldTelescopeName;
111  QGraphicsTextItem* fieldMagnification;
112  QGraphicsTextItem* fieldFov;
113 
114  //Sensor frame rotation controls
115  StelButton* rotateCcdMinus15Button;
116  StelButton* rotateCcdMinus5Button;
117  StelButton* rotateCcdMinus1Button;
118  StelButton* resetCcdRotationButton;
119  StelButton* rotateCcdPlus1Button;
120  StelButton* rotateCcdPlus5Button;
121  StelButton* rotateCcdPlus15Button;
122 
124  void setOcularControlsVisible(bool show);
125  void setCcdControlsVisible(bool show);
126  void setTelescopeControlsVisible(bool show);
127  void setLensControlsVisible(bool show);
129  void updateMainButtonsPositions();
130 
131  void setControlsColor(const QColor& color);
132  void setControlsFont(const QFont& font);
134  void setButtonsNightMode(bool nightMode);
135 
136  static QPixmap createPixmapFromText(const QString& text,
137  int width,
138  int height,
139  const QFont& font,
140  const QColor& textColor,
141  const QColor& backgroundColor = QColor(0,0,0,0));
142 };
143 
144 #endif // OCULARSGUIPANEL_HPP