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