Stellarium 0.14.3
TelescopeDialog.hpp
1 /*
2  * Stellarium Telescope Control Plug-in
3  *
4  * Copyright (C) 2009-2011 Bogdan Marinov (this file)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19 */
20 
21 #ifndef _TELESCOPEDIALOG_HPP_
22 #define _TELESCOPEDIALOG_HPP_
23 
24 #include <QObject>
25 #include <QHash>
26 #include <QIntValidator>
27 #include <QModelIndex>
28 #include <QStandardItemModel>
29 
30 #include "StelDialog.hpp"
31 #include "TelescopeControlGlobals.hpp"
32 #include "TelescopeConfigurationDialog.hpp"
33 
34 using namespace TelescopeControlGlobals;
35 
36 class Ui_telescopeDialogForm;
38 class TelescopeControl;
39 
41 {
42  Q_OBJECT
43 public:
45  virtual ~TelescopeDialog();
46  void updateStyle();
47 
48 public slots:
49  void retranslate();
50 
51 protected:
53  virtual void createDialogContent();
54  Ui_telescopeDialogForm* ui;
55 
56 private:
57  enum TelescopeStatus {
58  StatusNA = 0,
59  StatusStarting,
60  StatusConnecting,
61  StatusConnected,
62  StatusDisconnected,
63  StatusStopped,
64  StatusCount
65  };
66 
68  void updateStatusButtonForSlot(int slot);
69 
70  void setStatusButtonToStart();
71  void setStatusButtonToStop();
72  void setStatusButtonToConnect();
73  void setStatusButtonToDisconnect();
74 
75  void setAboutText();
76  void setHeaderNames();
77  void updateWarningTexts();
78 
79  QString getTypeLabel(ConnectionType type);
80  void addModelRow(int slotNumber, ConnectionType type, TelescopeStatus status, const QString& name);
81  void updateModelRow(int rowNumber, ConnectionType type, TelescopeStatus status, const QString& name);
82 
83 private slots:
84  void buttonChangeStatusPressed(void);
85  void buttonConfigurePressed(void);
86  void buttonAddPressed(void);
87  void buttonRemovePressed(void);
88 
89  void checkBoxUseExecutablesToggled(bool);
90  void buttonBrowseServerDirectoryPressed(void);
91 
93  void saveChanges(QString name, ConnectionType type);
95  void discardChanges(void);
96 
97  void selectTelecope(const QModelIndex &);
98  void configureTelescope(const QModelIndex &);
99 
101  void updateTelescopeStates(void);
102 
103 private:
105  enum ModelColumns {
106  ColumnSlot = 0,
107  //ColumnStartup, //!< startup checkbox column
108  ColumnStatus,
109  ColumnType,
110  ColumnName,
111  ColumnCount
112  };
113 
114  QHash<int, QString> statusString;
115  TelescopeConfigurationDialog configurationDialog;
116 
117  QStandardItemModel * telescopeListModel;
118 
119  TelescopeControl * telescopeManager;
120 
121  TelescopeStatus telescopeStatus[SLOT_NUMBER_LIMIT];
122  ConnectionType telescopeType[SLOT_NUMBER_LIMIT];
123 
124  int telescopeCount;
125  int configuredSlot;
126  bool configuredTelescopeIsNew;
127 };
128 
129 #endif // _TELESCOPEDIALOG_
A local copy of StelDialog, the base class for all the GUI windows in Stellarium, included to allow t...
This class manages the controlling of one or more telescopes by one instance of the stellarium progra...