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 {
|
---|
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 | public slots:
|
---|
136 | void onUpdate();
|
---|
137 |
|
---|
138 | private:
|
---|
139 | QBoxLayout *parent;
|
---|
140 | QBoxLayout *thisLayout;
|
---|
141 | QLabel *titleLabel;
|
---|
142 | QDoubleSpinBox *inputBox;
|
---|
143 | Dialog *dialog;
|
---|
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 {
|
---|
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 | public slots:
|
---|
172 | void onUpdate();
|
---|
173 |
|
---|
174 | private:
|
---|
175 | QBoxLayout *parent;
|
---|
176 | QBoxLayout *thisLayout;
|
---|
177 | QLabel *titleLabel;
|
---|
178 | QComboBox *inputBox;
|
---|
179 | Dialog *dialog;
|
---|
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 {
|
---|
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 | void IntegerEntered(const QString&);
|
---|
222 | void IntegerSelected();
|
---|
223 | void AddInteger();
|
---|
224 | void RemoveInteger();
|
---|
225 |
|
---|
226 | public slots:
|
---|
227 | void onUpdate();
|
---|
228 |
|
---|
229 | private:
|
---|
230 | QBoxLayout *parent;
|
---|
231 | QBoxLayout *thisLayout;
|
---|
232 | QLabel *titleLabel;
|
---|
233 | Dialog *dialog;
|
---|
234 | };
|
---|
235 |
|
---|
236 | class QtDialog::IntQtQuery : public QWidget, public Dialog::IntQuery {
|
---|
237 | Q_OBJECT
|
---|
238 | public:
|
---|
239 | IntQtQuery(Parameter<int> &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
240 | virtual ~IntQtQuery();
|
---|
241 | virtual bool handle();
|
---|
242 |
|
---|
243 | public slots:
|
---|
244 | void onUpdate(int);
|
---|
245 |
|
---|
246 | private:
|
---|
247 | QBoxLayout *parent;
|
---|
248 | QBoxLayout *thisLayout;
|
---|
249 | QLabel *titleLabel;
|
---|
250 | QSpinBox *inputBox;
|
---|
251 | Dialog *dialog;
|
---|
252 | };
|
---|
253 |
|
---|
254 | class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery {
|
---|
255 | Q_OBJECT
|
---|
256 | public:
|
---|
257 | IntsQtQuery(Parameter<std::vector<int> > &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
258 | virtual ~IntsQtQuery();
|
---|
259 | virtual bool handle();
|
---|
260 | void IntegerEntered(const QString&);
|
---|
261 | void IntegerSelected();
|
---|
262 | void AddInteger();
|
---|
263 | void RemoveInteger();
|
---|
264 |
|
---|
265 | public slots:
|
---|
266 | void onUpdate();
|
---|
267 |
|
---|
268 | private:
|
---|
269 | QBoxLayout *parent;
|
---|
270 | QBoxLayout *thisLayout;
|
---|
271 | QLabel *titleLabel;
|
---|
272 | Dialog *dialog;
|
---|
273 | };
|
---|
274 |
|
---|
275 | class QtDialog::MoleculeQtQuery : public QWidget, public Dialog::MoleculeQuery {
|
---|
276 | Q_OBJECT
|
---|
277 | public:
|
---|
278 | MoleculeQtQuery(Parameter<const molecule *> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
279 | virtual ~MoleculeQtQuery();
|
---|
280 | virtual bool handle();
|
---|
281 |
|
---|
282 | public slots:
|
---|
283 | void onUpdate(int);
|
---|
284 |
|
---|
285 | private:
|
---|
286 | QBoxLayout *parent;
|
---|
287 | QBoxLayout *thisLayout;
|
---|
288 | QLabel *titleLabel;
|
---|
289 | QComboBox *inputBox;
|
---|
290 | Dialog *dialog;
|
---|
291 | };
|
---|
292 |
|
---|
293 | class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery {
|
---|
294 | Q_OBJECT
|
---|
295 | public:
|
---|
296 | MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
297 | virtual ~MoleculesQtQuery();
|
---|
298 | virtual bool handle();
|
---|
299 |
|
---|
300 | public slots:
|
---|
301 | void onUpdate();
|
---|
302 |
|
---|
303 | private:
|
---|
304 | QBoxLayout *parent;
|
---|
305 | QBoxLayout *thisLayout;
|
---|
306 | QLabel *titleLabel;
|
---|
307 | QComboBox *inputBox;
|
---|
308 | Dialog *dialog;
|
---|
309 | };
|
---|
310 |
|
---|
311 | class QtDialog::StringQtQuery : public QWidget, public Dialog::StringQuery {
|
---|
312 | Q_OBJECT
|
---|
313 | public:
|
---|
314 | StringQtQuery(Parameter<std::string> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
315 | virtual ~StringQtQuery();
|
---|
316 | virtual bool handle();
|
---|
317 |
|
---|
318 | public slots:
|
---|
319 | void onUpdate(const QString&);
|
---|
320 |
|
---|
321 | private:
|
---|
322 | QBoxLayout *parent;
|
---|
323 | QBoxLayout *thisLayout;
|
---|
324 | QLabel *titleLabel;
|
---|
325 | QLineEdit *inputBox;
|
---|
326 | Dialog *dialog;
|
---|
327 | };
|
---|
328 |
|
---|
329 | class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery, public QtQueryList<std::string> {
|
---|
330 | Q_OBJECT
|
---|
331 | public:
|
---|
332 | StringsQtQuery(Parameter<std::vector<std::string> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
---|
333 | virtual ~StringsQtQuery();
|
---|
334 | virtual bool handle();
|
---|
335 |
|
---|
336 | virtual void onSubUpdate();
|
---|
337 |
|
---|
338 | public slots:
|
---|
339 | void onAddElement();
|
---|
340 | void onRemoveElement();
|
---|
341 | void onElementSelected();
|
---|
342 |
|
---|
343 | private:
|
---|
344 | StringQtQuery *subQuery;
|
---|
345 | };
|
---|
346 |
|
---|
347 | class QtDialog::UnsignedIntQtQuery : public QWidget, public Dialog::UnsignedIntQuery {
|
---|
348 | Q_OBJECT
|
---|
349 | public:
|
---|
350 | UnsignedIntQtQuery(Parameter<unsigned int> &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
351 | virtual ~UnsignedIntQtQuery();
|
---|
352 | virtual bool handle();
|
---|
353 |
|
---|
354 | public slots:
|
---|
355 | void onUpdate(unsigned int);
|
---|
356 |
|
---|
357 | private:
|
---|
358 | QBoxLayout *parent;
|
---|
359 | QBoxLayout *thisLayout;
|
---|
360 | QLabel *titleLabel;
|
---|
361 | QSpinBox *inputBox;
|
---|
362 | Dialog *dialog;
|
---|
363 | };
|
---|
364 |
|
---|
365 | class QtDialog::UnsignedIntsQtQuery : public QWidget, public Dialog::UnsignedIntsQuery {
|
---|
366 | Q_OBJECT
|
---|
367 | public:
|
---|
368 | UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
---|
369 | virtual ~UnsignedIntsQtQuery();
|
---|
370 | virtual bool handle();
|
---|
371 | void IntegerEntered(const QString&);
|
---|
372 | void IntegerSelected();
|
---|
373 | void AddInteger();
|
---|
374 | void RemoveInteger();
|
---|
375 |
|
---|
376 | public slots:
|
---|
377 | void onUpdate();
|
---|
378 |
|
---|
379 | private:
|
---|
380 | QBoxLayout *parent;
|
---|
381 | QBoxLayout *thisLayout;
|
---|
382 | QLabel *titleLabel;
|
---|
383 | Dialog *dialog;
|
---|
384 | };
|
---|
385 |
|
---|
386 |
|
---|
387 | class QtDialog::VectorQtQuery : public QWidget, public Dialog::VectorQuery {
|
---|
388 | Q_OBJECT
|
---|
389 | public:
|
---|
390 | VectorQtQuery(Parameter<Vector> &, std::string title,QBoxLayout *,Dialog *);
|
---|
391 | virtual ~VectorQtQuery();
|
---|
392 | virtual bool handle();
|
---|
393 |
|
---|
394 | public slots:
|
---|
395 | void onUpdateX(double);
|
---|
396 | void onUpdateY(double);
|
---|
397 | void onUpdateZ(double);
|
---|
398 |
|
---|
399 | private:
|
---|
400 | QBoxLayout *parent;
|
---|
401 | QBoxLayout *mainLayout;
|
---|
402 | QLabel *titleLabel;
|
---|
403 | QBoxLayout *subLayout;
|
---|
404 | QBoxLayout *coordLayout;
|
---|
405 | QLabel *coordLabel;
|
---|
406 | QDoubleSpinBox *coordInputX;
|
---|
407 | QDoubleSpinBox *coordInputY;
|
---|
408 | QDoubleSpinBox *coordInputZ;
|
---|
409 | Dialog *dialog;
|
---|
410 | };
|
---|
411 |
|
---|
412 | class QtDialog::VectorsQtQuery : public QWidget, public Dialog::VectorsQuery {
|
---|
413 | Q_OBJECT
|
---|
414 | public:
|
---|
415 | VectorsQtQuery(Parameter<std::vector<Vector> > &, std::string title,QBoxLayout *,Dialog *);
|
---|
416 | virtual ~VectorsQtQuery();
|
---|
417 | virtual bool handle();
|
---|
418 |
|
---|
419 | public slots:
|
---|
420 | void onUpdate();
|
---|
421 |
|
---|
422 | private:
|
---|
423 | QBoxLayout *parent;
|
---|
424 | QBoxLayout *mainLayout;
|
---|
425 | QLabel *titleLabel;
|
---|
426 | QBoxLayout *subLayout;
|
---|
427 | QBoxLayout *coordLayout;
|
---|
428 | QLabel *coordLabel;
|
---|
429 | QDoubleSpinBox *coordInput;
|
---|
430 | Dialog *dialog;
|
---|
431 | };
|
---|
432 |
|
---|
433 | class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public Dialog::RandomNumberDistribution_ParametersQuery {
|
---|
434 | Q_OBJECT
|
---|
435 | public:
|
---|
436 | RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title,QBoxLayout *,Dialog *);
|
---|
437 | virtual ~RandomNumberDistribution_ParametersQtQuery();
|
---|
438 | virtual bool handle();
|
---|
439 |
|
---|
440 | public slots:
|
---|
441 | void onUpdate();
|
---|
442 |
|
---|
443 | private:
|
---|
444 | QBoxLayout *parent;
|
---|
445 | QHBoxLayout *thisLayout;
|
---|
446 | QLabel *titleLabel;
|
---|
447 | QTextEdit *inputBox;
|
---|
448 | QPushButton *okButton;
|
---|
449 | Dialog *dialog;
|
---|
450 | };
|
---|
451 |
|
---|
452 | #endif /* QTQUERY_HPP_ */
|
---|