1 | /*
|
---|
2 | * QtQuery.hpp
|
---|
3 | *
|
---|
4 | * Created on: Nov 8, 2010
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef QTQUERY_HPP_
|
---|
9 | #define QTQUERY_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 |
|
---|
17 | #include <Qt/qwidget.h>
|
---|
18 | #include "Qt4/QtDialog.hpp"
|
---|
19 | #include "Parameters/Parameter.hpp"
|
---|
20 | #include "QtQueryList.hpp"
|
---|
21 |
|
---|
22 | class QHBoxLayout;
|
---|
23 | class QBoxLayout;
|
---|
24 | class QDialogButtonBox;
|
---|
25 | class QLabel;
|
---|
26 | class QSpinBox;
|
---|
27 | class QDoubleSpinBox;
|
---|
28 | class QLineEdit;
|
---|
29 | class QListWidget;
|
---|
30 | class QPushButton;
|
---|
31 | class QTableWidget;
|
---|
32 | class QTextEdit;
|
---|
33 | class QComboBox;
|
---|
34 | class QCheckBox;
|
---|
35 | class QFileDialog;
|
---|
36 |
|
---|
37 | class QtDialog::AtomQtQuery : public QWidget, public Dialog::AtomQuery {
|
---|
38 | Q_OBJECT
|
---|
39 | public:
|
---|
40 | AtomQtQuery(Parameter<const atom *> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
41 | virtual ~AtomQtQuery();
|
---|
42 | virtual bool handle();
|
---|
43 |
|
---|
44 | public slots:
|
---|
45 | void onUpdate(int);
|
---|
46 |
|
---|
47 | private:
|
---|
48 | QBoxLayout *parent;
|
---|
49 | QBoxLayout *thisLayout;
|
---|
50 | QLabel *titleLabel;
|
---|
51 | QComboBox *inputBox;
|
---|
52 | Dialog *dialog;
|
---|
53 | };
|
---|
54 |
|
---|
55 | class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery, public QtQueryList<const atom *> {
|
---|
56 | Q_OBJECT
|
---|
57 | public:
|
---|
58 | AtomsQtQuery(Parameter<std::vector<const atom *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
59 | virtual ~AtomsQtQuery();
|
---|
60 | virtual bool handle();
|
---|
61 |
|
---|
62 | virtual void onSubUpdate();
|
---|
63 |
|
---|
64 | public slots:
|
---|
65 | void onAddElement();
|
---|
66 | void onRemoveElement();
|
---|
67 | void onElementSelected();
|
---|
68 |
|
---|
69 | private:
|
---|
70 | AtomQtQuery *subQuery;
|
---|
71 | };
|
---|
72 |
|
---|
73 | class QtDialog::BooleanQtQuery : public QWidget, public Dialog::BooleanQuery {
|
---|
74 | Q_OBJECT
|
---|
75 | public:
|
---|
76 | BooleanQtQuery(Parameter<bool> &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
---|
77 | virtual ~BooleanQtQuery();
|
---|
78 | virtual bool handle();
|
---|
79 |
|
---|
80 | public slots:
|
---|
81 | void onUpdate(int);
|
---|
82 |
|
---|
83 | private:
|
---|
84 | QBoxLayout *parent;
|
---|
85 | QBoxLayout *thisLayout;
|
---|
86 | QLabel *titleLabel;
|
---|
87 | QCheckBox *booleanCheckBox;
|
---|
88 | Dialog *dialog;
|
---|
89 | };
|
---|
90 |
|
---|
91 | class QtDialog::RealSpaceMatrixQtQuery : public QWidget, public Dialog::RealSpaceMatrixQuery {
|
---|
92 | Q_OBJECT
|
---|
93 | public:
|
---|
94 | RealSpaceMatrixQtQuery(Parameter<RealSpaceMatrix> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
95 | virtual ~RealSpaceMatrixQtQuery();
|
---|
96 | virtual bool handle();
|
---|
97 |
|
---|
98 | public slots:
|
---|
99 | void onUpdate(int, int);
|
---|
100 |
|
---|
101 | private:
|
---|
102 | QBoxLayout *parent;
|
---|
103 | QBoxLayout *thisLayout;
|
---|
104 | QLabel *titleLabel;
|
---|
105 | QTableWidget *inputTable;
|
---|
106 | Dialog *dialog;
|
---|
107 | };
|
---|
108 |
|
---|
109 | class QtDialog::DoubleQtQuery : public QWidget, public Dialog::DoubleQuery {
|
---|
110 | Q_OBJECT
|
---|
111 | public:
|
---|
112 | DoubleQtQuery(Parameter<double> &, std::string title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
113 | virtual ~DoubleQtQuery();
|
---|
114 | virtual bool handle();
|
---|
115 |
|
---|
116 | public slots:
|
---|
117 | void onUpdate(double);
|
---|
118 |
|
---|
119 | private:
|
---|
120 | QBoxLayout *parent;
|
---|
121 | QBoxLayout *thisLayout;
|
---|
122 | QLabel *titleLabel;
|
---|
123 | QDoubleSpinBox *inputBox;
|
---|
124 | Dialog *dialog;
|
---|
125 | };
|
---|
126 |
|
---|
127 | class QtDialog::DoublesQtQuery : public QWidget, public Dialog::DoublesQuery, public QtQueryList<double> {
|
---|
128 | Q_OBJECT
|
---|
129 | public:
|
---|
130 | DoublesQtQuery(Parameter<std::vector<double> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
131 | virtual ~DoublesQtQuery();
|
---|
132 | virtual bool handle();
|
---|
133 |
|
---|
134 | virtual void onSubUpdate();
|
---|
135 |
|
---|
136 | public slots:
|
---|
137 | void onAddElement();
|
---|
138 | void onRemoveElement();
|
---|
139 | void onElementSelected();
|
---|
140 |
|
---|
141 | private:
|
---|
142 | DoubleQtQuery *subQuery;
|
---|
143 | };
|
---|
144 |
|
---|
145 | class QtDialog::ElementQtQuery : public QWidget, public Dialog::ElementQuery {
|
---|
146 | Q_OBJECT
|
---|
147 | public:
|
---|
148 | ElementQtQuery(Parameter<const element *> &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
---|
149 | virtual ~ElementQtQuery();
|
---|
150 | virtual bool handle();
|
---|
151 |
|
---|
152 | public slots:
|
---|
153 | void onUpdate(int);
|
---|
154 |
|
---|
155 | private:
|
---|
156 | QBoxLayout *parent;
|
---|
157 | QBoxLayout *thisLayout;
|
---|
158 | QLabel *titleLabel;
|
---|
159 | QComboBox *inputBox;
|
---|
160 | Dialog *dialog;
|
---|
161 | };
|
---|
162 |
|
---|
163 | class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery, public QtQueryList<const element *> {
|
---|
164 | Q_OBJECT
|
---|
165 | public:
|
---|
166 | ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
167 | virtual ~ElementsQtQuery();
|
---|
168 | virtual bool handle();
|
---|
169 |
|
---|
170 | virtual void onSubUpdate();
|
---|
171 |
|
---|
172 | public slots:
|
---|
173 | void onAddElement();
|
---|
174 | void onRemoveElement();
|
---|
175 | void onElementSelected();
|
---|
176 |
|
---|
177 | private:
|
---|
178 | ElementQtQuery *subQuery;
|
---|
179 | };
|
---|
180 |
|
---|
181 | class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
|
---|
182 | public:
|
---|
183 | EmptyQtQuery(std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
---|
184 | virtual ~EmptyQtQuery();
|
---|
185 | virtual bool handle();
|
---|
186 | private:
|
---|
187 | QBoxLayout *parent;
|
---|
188 | QBoxLayout *thisLayout;
|
---|
189 | QLabel *titleLabel;
|
---|
190 | Dialog *dialog;
|
---|
191 | };
|
---|
192 |
|
---|
193 | class QtDialog::FileQtQuery : public QWidget, public Dialog::FileQuery {
|
---|
194 | Q_OBJECT
|
---|
195 | public:
|
---|
196 | FileQtQuery(Parameter<boost::filesystem::path> &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
---|
197 | virtual ~FileQtQuery();
|
---|
198 | virtual bool handle();
|
---|
199 |
|
---|
200 | public slots:
|
---|
201 | void onUpdate();
|
---|
202 | void showFileDialog();
|
---|
203 |
|
---|
204 | private:
|
---|
205 | QBoxLayout *parent;
|
---|
206 | QBoxLayout *thisLayout;
|
---|
207 | QLabel *filenameLabel;
|
---|
208 | QLineEdit *filenameLineEdit;
|
---|
209 | QPushButton *filedialogButton;
|
---|
210 | QFileDialog *theFileDialog;
|
---|
211 | Dialog *dialog;
|
---|
212 | };
|
---|
213 |
|
---|
214 | class QtDialog::FilesQtQuery : public QWidget, public Dialog::FilesQuery, public QtQueryList<boost::filesystem::path> {
|
---|
215 | Q_OBJECT
|
---|
216 | public:
|
---|
217 | FilesQtQuery(Parameter<std::vector<boost::filesystem::path> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
218 | virtual ~FilesQtQuery();
|
---|
219 | virtual bool handle();
|
---|
220 |
|
---|
221 | virtual void onSubUpdate();
|
---|
222 |
|
---|
223 | public slots:
|
---|
224 | void onAddElement();
|
---|
225 | void onRemoveElement();
|
---|
226 | void onElementSelected();
|
---|
227 |
|
---|
228 | private:
|
---|
229 | FileQtQuery *subQuery;
|
---|
230 | };
|
---|
231 |
|
---|
232 | class QtDialog::IntQtQuery : public QWidget, public Dialog::IntQuery {
|
---|
233 | Q_OBJECT
|
---|
234 | public:
|
---|
235 | IntQtQuery(Parameter<int> &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
236 | virtual ~IntQtQuery();
|
---|
237 | virtual bool handle();
|
---|
238 |
|
---|
239 | public slots:
|
---|
240 | void onUpdate(int);
|
---|
241 |
|
---|
242 | private:
|
---|
243 | QBoxLayout *parent;
|
---|
244 | QBoxLayout *thisLayout;
|
---|
245 | QLabel *titleLabel;
|
---|
246 | QSpinBox *inputBox;
|
---|
247 | Dialog *dialog;
|
---|
248 | };
|
---|
249 |
|
---|
250 | class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery, public QtQueryList<int> {
|
---|
251 | Q_OBJECT
|
---|
252 | public:
|
---|
253 | IntsQtQuery(Parameter<std::vector<int> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
254 | virtual ~IntsQtQuery();
|
---|
255 | virtual bool handle();
|
---|
256 |
|
---|
257 | virtual void onSubUpdate();
|
---|
258 |
|
---|
259 | public slots:
|
---|
260 | void onAddElement();
|
---|
261 | void onRemoveElement();
|
---|
262 | void onElementSelected();
|
---|
263 |
|
---|
264 | private:
|
---|
265 | IntQtQuery *subQuery;
|
---|
266 | };
|
---|
267 |
|
---|
268 | class QtDialog::MoleculeQtQuery : public QWidget, public Dialog::MoleculeQuery {
|
---|
269 | Q_OBJECT
|
---|
270 | public:
|
---|
271 | MoleculeQtQuery(Parameter<const molecule *> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
272 | virtual ~MoleculeQtQuery();
|
---|
273 | virtual bool handle();
|
---|
274 |
|
---|
275 | public slots:
|
---|
276 | void onUpdate(int);
|
---|
277 |
|
---|
278 | private:
|
---|
279 | QBoxLayout *parent;
|
---|
280 | QBoxLayout *thisLayout;
|
---|
281 | QLabel *titleLabel;
|
---|
282 | QComboBox *inputBox;
|
---|
283 | Dialog *dialog;
|
---|
284 | };
|
---|
285 |
|
---|
286 | class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery, public QtQueryList<const molecule *> {
|
---|
287 | Q_OBJECT
|
---|
288 | public:
|
---|
289 | MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
290 | virtual ~MoleculesQtQuery();
|
---|
291 | virtual bool handle();
|
---|
292 |
|
---|
293 | virtual void onSubUpdate();
|
---|
294 |
|
---|
295 | public slots:
|
---|
296 | void onAddElement();
|
---|
297 | void onRemoveElement();
|
---|
298 | void onElementSelected();
|
---|
299 |
|
---|
300 | private:
|
---|
301 | MoleculeQtQuery *subQuery;
|
---|
302 | };
|
---|
303 |
|
---|
304 | class QtDialog::StringQtQuery : public QWidget, public Dialog::StringQuery {
|
---|
305 | Q_OBJECT
|
---|
306 | public:
|
---|
307 | StringQtQuery(Parameter<std::string> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
308 | virtual ~StringQtQuery();
|
---|
309 | virtual bool handle();
|
---|
310 |
|
---|
311 | public slots:
|
---|
312 | void onUpdate(const QString&);
|
---|
313 |
|
---|
314 | private:
|
---|
315 | QBoxLayout *parent;
|
---|
316 | QBoxLayout *thisLayout;
|
---|
317 | QLabel *titleLabel;
|
---|
318 | QLineEdit *inputBox;
|
---|
319 | Dialog *dialog;
|
---|
320 | };
|
---|
321 |
|
---|
322 | class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery, public QtQueryList<std::string> {
|
---|
323 | Q_OBJECT
|
---|
324 | public:
|
---|
325 | StringsQtQuery(Parameter<std::vector<std::string> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
326 | virtual ~StringsQtQuery();
|
---|
327 | virtual bool handle();
|
---|
328 |
|
---|
329 | virtual void onSubUpdate();
|
---|
330 |
|
---|
331 | public slots:
|
---|
332 | void onAddElement();
|
---|
333 | void onRemoveElement();
|
---|
334 | void onElementSelected();
|
---|
335 |
|
---|
336 | private:
|
---|
337 | StringQtQuery *subQuery;
|
---|
338 | };
|
---|
339 |
|
---|
340 | class QtDialog::UnsignedIntQtQuery : public QWidget, public Dialog::UnsignedIntQuery {
|
---|
341 | Q_OBJECT
|
---|
342 | public:
|
---|
343 | UnsignedIntQtQuery(Parameter<unsigned int> &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
344 | virtual ~UnsignedIntQtQuery();
|
---|
345 | virtual bool handle();
|
---|
346 |
|
---|
347 | public slots:
|
---|
348 | void onUpdate(int);
|
---|
349 |
|
---|
350 | private:
|
---|
351 | QBoxLayout *parent;
|
---|
352 | QBoxLayout *thisLayout;
|
---|
353 | QLabel *titleLabel;
|
---|
354 | QSpinBox *inputBox;
|
---|
355 | Dialog *dialog;
|
---|
356 | };
|
---|
357 |
|
---|
358 | class QtDialog::UnsignedIntsQtQuery : public QWidget, public Dialog::UnsignedIntsQuery, public QtQueryList<unsigned int> {
|
---|
359 | Q_OBJECT
|
---|
360 | public:
|
---|
361 | UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
362 | virtual ~UnsignedIntsQtQuery();
|
---|
363 | virtual bool handle();
|
---|
364 |
|
---|
365 | virtual void onSubUpdate();
|
---|
366 |
|
---|
367 | public slots:
|
---|
368 | void onAddElement();
|
---|
369 | void onRemoveElement();
|
---|
370 | void onElementSelected();
|
---|
371 |
|
---|
372 | private:
|
---|
373 | UnsignedIntQtQuery *subQuery;
|
---|
374 | };
|
---|
375 |
|
---|
376 | class QtDialog::VectorQtQuery : public QWidget, public Dialog::VectorQuery {
|
---|
377 | Q_OBJECT
|
---|
378 | public:
|
---|
379 | VectorQtQuery(Parameter<Vector> &, std::string title,QBoxLayout *,Dialog *);
|
---|
380 | virtual ~VectorQtQuery();
|
---|
381 | virtual bool handle();
|
---|
382 |
|
---|
383 | public slots:
|
---|
384 | void onUpdateX(double);
|
---|
385 | void onUpdateY(double);
|
---|
386 | void onUpdateZ(double);
|
---|
387 |
|
---|
388 | private:
|
---|
389 | QBoxLayout *parent;
|
---|
390 | QBoxLayout *mainLayout;
|
---|
391 | QLabel *titleLabel;
|
---|
392 | QBoxLayout *subLayout;
|
---|
393 | QBoxLayout *coordLayout;
|
---|
394 | QLabel *coordLabel;
|
---|
395 | QDoubleSpinBox *coordInputX;
|
---|
396 | QDoubleSpinBox *coordInputY;
|
---|
397 | QDoubleSpinBox *coordInputZ;
|
---|
398 | Dialog *dialog;
|
---|
399 | };
|
---|
400 |
|
---|
401 | class QtDialog::VectorsQtQuery : public QWidget, public Dialog::VectorsQuery, public QtQueryList<Vector> {
|
---|
402 | Q_OBJECT
|
---|
403 | public:
|
---|
404 | VectorsQtQuery(Parameter<std::vector<Vector> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
405 | virtual ~VectorsQtQuery();
|
---|
406 | virtual bool handle();
|
---|
407 |
|
---|
408 | virtual void onSubUpdate();
|
---|
409 |
|
---|
410 | public slots:
|
---|
411 | void onAddElement();
|
---|
412 | void onRemoveElement();
|
---|
413 | void onElementSelected();
|
---|
414 |
|
---|
415 | private:
|
---|
416 | VectorQtQuery *subQuery;
|
---|
417 | };
|
---|
418 |
|
---|
419 | class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public Dialog::RandomNumberDistribution_ParametersQuery {
|
---|
420 | Q_OBJECT
|
---|
421 | public:
|
---|
422 | RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title,QBoxLayout *,Dialog *);
|
---|
423 | virtual ~RandomNumberDistribution_ParametersQtQuery();
|
---|
424 | virtual bool handle();
|
---|
425 |
|
---|
426 | public slots:
|
---|
427 | void onUpdate();
|
---|
428 |
|
---|
429 | private:
|
---|
430 | QBoxLayout *parent;
|
---|
431 | QHBoxLayout *thisLayout;
|
---|
432 | QLabel *titleLabel;
|
---|
433 | QTextEdit *inputBox;
|
---|
434 | QPushButton *okButton;
|
---|
435 | Dialog *dialog;
|
---|
436 | };
|
---|
437 |
|
---|
438 | #endif /* QTQUERY_HPP_ */
|
---|