1 | /*
|
---|
2 | * QTDialog.hpp
|
---|
3 | *
|
---|
4 | * Created on: Jan 18, 2010
|
---|
5 | * Author: crueger
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef QTDIALOG_HPP_
|
---|
9 | #define QTDIALOG_HPP_
|
---|
10 |
|
---|
11 | #include "UIElements/Dialog.hpp"
|
---|
12 | #include <QtGui/QDialog>
|
---|
13 |
|
---|
14 | class QBoxLayout;
|
---|
15 | class QLabel;
|
---|
16 | class QSpinBox;
|
---|
17 | class QDoubleSpinBox;
|
---|
18 | class QLineEdit;
|
---|
19 | class QComboBox;
|
---|
20 | class QDialogButtonBox;
|
---|
21 |
|
---|
22 |
|
---|
23 | // Forward declarations for plumbing
|
---|
24 | class StringQTQueryPipe;
|
---|
25 | class IntQTQueryPipe;
|
---|
26 | class DoubleQTQueryPipe;
|
---|
27 | class MoleculeQTQueryPipe;
|
---|
28 | class ElementQTQueryPipe;
|
---|
29 |
|
---|
30 | class QTDialog : public QDialog, public Dialog
|
---|
31 | {
|
---|
32 | Q_OBJECT
|
---|
33 | public:
|
---|
34 | QTDialog();
|
---|
35 | virtual ~QTDialog();
|
---|
36 |
|
---|
37 | virtual void queryEmpty(const char*, std::string);
|
---|
38 | virtual void queryBoolean(const char *, bool *, std::string = "");
|
---|
39 | virtual void queryInt(const char *, int *,std::string = "");
|
---|
40 | virtual void queryDouble(const char*,double *,std::string = "");
|
---|
41 | virtual void queryString(const char*, std::string *,std::string = "");
|
---|
42 | virtual void queryAtom(const char*,atom**,std::string = "");
|
---|
43 | virtual void queryMolecule(const char*,molecule**,std::string = "");
|
---|
44 | virtual void queryVector(const char*,Vector *,bool,std::string = "");
|
---|
45 | virtual void queryBox(const char*,Box*, std::string = "");
|
---|
46 | virtual void queryElement(const char*,std::vector<element *> *_target,std::string = "");
|
---|
47 |
|
---|
48 | virtual bool display();
|
---|
49 |
|
---|
50 | virtual void update();
|
---|
51 |
|
---|
52 | protected:
|
---|
53 | class IntQTQuery : public Dialog::IntQuery {
|
---|
54 | public:
|
---|
55 | IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog);
|
---|
56 | virtual ~IntQTQuery();
|
---|
57 | virtual bool handle();
|
---|
58 | private:
|
---|
59 | QBoxLayout *parent;
|
---|
60 | QBoxLayout *thisLayout;
|
---|
61 | QLabel *titleLabel;
|
---|
62 | QSpinBox *inputBox;
|
---|
63 |
|
---|
64 | IntQTQueryPipe *pipe;
|
---|
65 | };
|
---|
66 |
|
---|
67 | class DoubleQTQuery : public Dialog::DoubleQuery {
|
---|
68 | public:
|
---|
69 | DoubleQTQuery(std::string title, double *_target,QBoxLayout *_parent,QTDialog *_dialog);
|
---|
70 | virtual ~DoubleQTQuery();
|
---|
71 | virtual bool handle();
|
---|
72 | private:
|
---|
73 | QBoxLayout *parent;
|
---|
74 | QBoxLayout *thisLayout;
|
---|
75 | QLabel *titleLabel;
|
---|
76 | QDoubleSpinBox *inputBox;
|
---|
77 |
|
---|
78 | DoubleQTQueryPipe *pipe;
|
---|
79 | };
|
---|
80 |
|
---|
81 | class StringQTQuery : public Dialog::StringQuery {
|
---|
82 | public:
|
---|
83 | StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog);
|
---|
84 | virtual ~StringQTQuery();
|
---|
85 | virtual bool handle();
|
---|
86 | private:
|
---|
87 | QBoxLayout *parent;
|
---|
88 | QBoxLayout *thisLayout;
|
---|
89 | QLabel *titleLabel;
|
---|
90 | QLineEdit *inputBox;
|
---|
91 |
|
---|
92 | StringQTQueryPipe *pipe;
|
---|
93 | };
|
---|
94 |
|
---|
95 | class MoleculeQTQuery : public Dialog::MoleculeQuery {
|
---|
96 | public:
|
---|
97 | MoleculeQTQuery(std::string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog);
|
---|
98 | virtual ~MoleculeQTQuery();
|
---|
99 | virtual bool handle();
|
---|
100 | private:
|
---|
101 | QBoxLayout *parent;
|
---|
102 | QBoxLayout *thisLayout;
|
---|
103 | QLabel *titleLabel;
|
---|
104 | QComboBox *inputBox;
|
---|
105 |
|
---|
106 | MoleculeQTQueryPipe *pipe;
|
---|
107 | };
|
---|
108 |
|
---|
109 | class VectorQTQuery : public Dialog::VectorQuery {
|
---|
110 | public:
|
---|
111 | VectorQTQuery(std::string title,Vector *_target,bool _check,QBoxLayout *,QTDialog *);
|
---|
112 | virtual ~VectorQTQuery();
|
---|
113 | virtual bool handle();
|
---|
114 | private:
|
---|
115 | QBoxLayout *parent;
|
---|
116 | QBoxLayout *mainLayout;
|
---|
117 | QLabel *titleLabel;
|
---|
118 | QBoxLayout *subLayout;
|
---|
119 | QBoxLayout *coordLayout[3];
|
---|
120 | QLabel *coordLabel[3];
|
---|
121 | QDoubleSpinBox *coordInput[3];
|
---|
122 |
|
---|
123 | DoubleQTQueryPipe *pipe[3];
|
---|
124 | };
|
---|
125 |
|
---|
126 | class ElementQTQuery : public Dialog::ElementQuery {
|
---|
127 | public:
|
---|
128 | ElementQTQuery(std::string _title, std::vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog);
|
---|
129 | virtual ~ElementQTQuery();
|
---|
130 | virtual bool handle();
|
---|
131 | private:
|
---|
132 | QBoxLayout *parent;
|
---|
133 | QBoxLayout *thisLayout;
|
---|
134 | QLabel *titleLabel;
|
---|
135 | QComboBox *inputBox;
|
---|
136 |
|
---|
137 | ElementQTQueryPipe *pipe;
|
---|
138 | };
|
---|
139 |
|
---|
140 | private:
|
---|
141 | QBoxLayout *mainLayout;
|
---|
142 | QBoxLayout *inputLayout;
|
---|
143 | QBoxLayout *buttonLayout;
|
---|
144 | QDialogButtonBox *buttons;
|
---|
145 | };
|
---|
146 |
|
---|
147 | // All kinds of plumbing for Queries
|
---|
148 | // Plumbing needs to be outside of the class where it is needed,
|
---|
149 | // since MOC doesn't like nested classes
|
---|
150 |
|
---|
151 | class StringQTQueryPipe : public QWidget {
|
---|
152 | Q_OBJECT
|
---|
153 | public:
|
---|
154 | StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
|
---|
155 | virtual ~StringQTQueryPipe();
|
---|
156 |
|
---|
157 | public slots:
|
---|
158 | void update(const QString&);
|
---|
159 |
|
---|
160 | private:
|
---|
161 | std::string *content;
|
---|
162 | QTDialog *dialog;
|
---|
163 |
|
---|
164 | };
|
---|
165 |
|
---|
166 | class IntQTQueryPipe : public QWidget {
|
---|
167 | Q_OBJECT
|
---|
168 | public:
|
---|
169 | IntQTQueryPipe(int *_content, QTDialog *_dialog);
|
---|
170 | virtual ~IntQTQueryPipe();
|
---|
171 |
|
---|
172 | public slots:
|
---|
173 | void update(int);
|
---|
174 |
|
---|
175 | private:
|
---|
176 | int *content;
|
---|
177 | QTDialog *dialog;
|
---|
178 |
|
---|
179 | };
|
---|
180 |
|
---|
181 | class DoubleQTQueryPipe : public QWidget {
|
---|
182 | Q_OBJECT
|
---|
183 | public:
|
---|
184 | DoubleQTQueryPipe(double *_content, QTDialog *_dialog);
|
---|
185 | virtual ~DoubleQTQueryPipe();
|
---|
186 |
|
---|
187 | public slots:
|
---|
188 | void update(double);
|
---|
189 |
|
---|
190 | private:
|
---|
191 | double *content;
|
---|
192 | QTDialog *dialog;
|
---|
193 |
|
---|
194 | };
|
---|
195 |
|
---|
196 | class MoleculeQTQueryPipe : public QWidget {
|
---|
197 | Q_OBJECT
|
---|
198 | public:
|
---|
199 | MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox);
|
---|
200 | virtual ~MoleculeQTQueryPipe();
|
---|
201 |
|
---|
202 | public slots:
|
---|
203 | void update(int);
|
---|
204 |
|
---|
205 | private:
|
---|
206 | molecule **content;
|
---|
207 | QTDialog *dialog;
|
---|
208 | QComboBox *theBox;
|
---|
209 |
|
---|
210 | };
|
---|
211 |
|
---|
212 | class ElementQTQueryPipe : public QWidget {
|
---|
213 | Q_OBJECT
|
---|
214 | public:
|
---|
215 | ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox);
|
---|
216 | virtual ~ElementQTQueryPipe();
|
---|
217 |
|
---|
218 | public slots:
|
---|
219 | void update(int);
|
---|
220 |
|
---|
221 | private:
|
---|
222 | std::vector<element *> *content;
|
---|
223 | QTDialog *dialog;
|
---|
224 | QComboBox *theBox;
|
---|
225 | };
|
---|
226 | #endif /* QTDIALOG_HPP_ */
|
---|