1 /*
2  * Copyright (C) 2009 Timothy Reaves
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 OCULARDIALOG_HPP
21 #define OCULARDIALOG_HPP
22 
23 #include <QObject>
24 #include "CCD.hpp"
25 #include "Ocular.hpp"
26 #include "PropertyBasedTableModel.hpp"
27 #include "StelDialog.hpp"
28 #include "StelStyle.hpp"
29 #include "Telescope.hpp"
30 #include "Lens.hpp"
31 #include "VecMath.hpp"
32 
33 class Ui_ocularDialogForm;
34 
35 QT_BEGIN_NAMESPACE
36 class QDataWidgetMapper;
37 class QDoubleValidator;
38 class QIntValidator;
39 class QRegularExpressionValidator;
40 class QModelIndex;
41 class QStandardItemModel;
42 QT_END_NAMESPACE
43 
44 class Oculars;
45 
46 //! @ingroup oculars
47 class OcularDialog : public StelDialog
48 {
49 	Q_OBJECT
50 
51 public:
52 	OcularDialog(Oculars* plugin, QList<CCD *>* ccds, QList<Ocular *>* oculars, QList<Telescope *>* telescopes, QList<Lens *>* lenses);
53 	virtual ~OcularDialog();
54 
55 public slots:
56 	void closeWindow();
57 	void deleteSelectedCCD();
58 	void deleteSelectedOcular();
59 	void deleteSelectedTelescope();
60 	void deleteSelectedLens();
61 	void insertNewCCD();
62 	void insertNewOcular();
63 	void insertNewTelescope();
64 	void insertNewLens();
65 	void moveUpSelectedSensor();
66 	void moveUpSelectedOcular();
67 	void moveUpSelectedTelescope();
68 	void moveUpSelectedLens();
69 	void moveDownSelectedSensor();
70 	void moveDownSelectedOcular();
71 	void moveDownSelectedTelescope();
72 	void moveDownSelectedLens();
73 	void retranslate();
74 
75 	// Mini-methods required to immediately update display
76 	void updateOcular();
77 	void selectOcular(const QModelIndex);
78 	void updateLens();
79 	void selectLens(const QModelIndex);
80 	void updateCCD();
81 	void selectCCD(const QModelIndex);
82 	void updateTelescope();
83 	void selectTelescope(const QModelIndex);
84 
85 protected:
86 	//! Initialize the dialog widgets and connect the signals/slots
87 	virtual void createDialogContent();
88 	Ui_ocularDialogForm* ui;
89 
90 private slots:
91 	void initAboutText();
92 	void setLabelsDescriptionText(bool state);
93 	void updateTelradCustomFOV();
94 	void setupTelradFOVspins(Vec4f fov);
95 	void updateGuiOptions();
96 	void updateCCDRotationAngles();
97 
98 private:
99 	Oculars* plugin;
100 
101 	QDataWidgetMapper*		ccdMapper;
102 	QList<CCD *>*			ccds;
103 	PropertyBasedTableModel*	ccdTableModel;
104 	QDataWidgetMapper*		ocularMapper;
105 	QList<Ocular *>*		oculars;
106 	PropertyBasedTableModel*	ocularTableModel;
107 	QDataWidgetMapper*		telescopeMapper;
108 	QList<Telescope *>*		telescopes;
109 	PropertyBasedTableModel*	telescopeTableModel;
110 	QDataWidgetMapper*		lensMapper;
111 	QList<Lens *>*			lenses;
112 	PropertyBasedTableModel*	lensTableModel;
113 	QRegularExpressionValidator*	validatorName;
114 };
115 
116 #endif // OCULARDIALOG_HPP
117