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 "Qt4/QtDialog.hpp"
|
---|
18 | #include "Parameters/Parameter.hpp"
|
---|
19 |
|
---|
20 | class QHBoxLayout;
|
---|
21 | class QBoxLayout;
|
---|
22 | class QDialogButtonBox;
|
---|
23 | class QLabel;
|
---|
24 | class QSpinBox;
|
---|
25 | class QDoubleSpinBox;
|
---|
26 | class QLineEdit;
|
---|
27 | class QListWidget;
|
---|
28 | class QPushButton;
|
---|
29 | class QTableWidget;
|
---|
30 | class QTextEdit;
|
---|
31 | class QComboBox;
|
---|
32 | class QCheckBox;
|
---|
33 |
|
---|
34 | // Forward declarations for plumbing
|
---|
35 | template<typename T> class QtQueryListPipe;
|
---|
36 | class AtomQtQueryPipe;
|
---|
37 | class AtomsQtQueryPipe;
|
---|
38 | class BooleanQtQueryPipe;
|
---|
39 | class RealSpaceMatrixQtQueryPipe;
|
---|
40 | class DoubleQtQueryPipe;
|
---|
41 | class DoublesQtQueryPipe;
|
---|
42 | class ElementQtQueryPipe;
|
---|
43 | class ElementsQtQueryPipe;
|
---|
44 | class EmptyQtQueryPipe;
|
---|
45 | class FileQtQueryPipe;
|
---|
46 | class FilesQtQueryPipe;
|
---|
47 | class IntQtQueryPipe;
|
---|
48 | class MoleculeQtQueryPipe;
|
---|
49 | class MoleculesQtQueryPipe;
|
---|
50 | class StringQtQueryPipe;
|
---|
51 | class StringsQtQueryPipe;
|
---|
52 | class UnsignedIntQtQueryPipe;
|
---|
53 | class UnsignedIntsQtQueryPipe;
|
---|
54 | class VectorQtQueryPipe;
|
---|
55 | class VectorsQtQueryPipe;
|
---|
56 | class RandomNumberDistribution_ParametersQtQueryPipe;
|
---|
57 |
|
---|
58 | class QtDialog::AtomQtQuery : public Dialog::AtomQuery {
|
---|
59 | public:
|
---|
60 | AtomQtQuery(Parameter<const atom *> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
61 | virtual ~AtomQtQuery();
|
---|
62 | virtual bool handle();
|
---|
63 | private:
|
---|
64 | QBoxLayout *parent;
|
---|
65 | QBoxLayout *thisLayout;
|
---|
66 | QLabel *titleLabel;
|
---|
67 | QComboBox *inputBox;
|
---|
68 |
|
---|
69 | AtomQtQueryPipe *pipe;
|
---|
70 | };
|
---|
71 |
|
---|
72 | class QtDialog::AtomsQtQuery : public Dialog::AtomsQuery {
|
---|
73 | public:
|
---|
74 | AtomsQtQuery(Parameter<std::vector<const atom *> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
75 | virtual ~AtomsQtQuery();
|
---|
76 | virtual bool handle();
|
---|
77 | private:
|
---|
78 | QBoxLayout *parent;
|
---|
79 | QBoxLayout *thisLayout;
|
---|
80 | QLabel *titleLabel;
|
---|
81 | QLabel *inputLabel;
|
---|
82 | QListWidget *inputList;
|
---|
83 |
|
---|
84 | AtomsQtQueryPipe *pipe;
|
---|
85 | };
|
---|
86 |
|
---|
87 | class QtDialog::BooleanQtQuery : public Dialog::BooleanQuery {
|
---|
88 | public:
|
---|
89 | BooleanQtQuery(Parameter<bool> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
90 | virtual ~BooleanQtQuery();
|
---|
91 | virtual bool handle();
|
---|
92 | private:
|
---|
93 | QBoxLayout *parent;
|
---|
94 | QBoxLayout *thisLayout;
|
---|
95 | QLabel *titleLabel;
|
---|
96 | QCheckBox *booleanCheckBox;
|
---|
97 |
|
---|
98 | BooleanQtQueryPipe *pipe;
|
---|
99 | };
|
---|
100 |
|
---|
101 | class QtDialog::RealSpaceMatrixQtQuery : public Dialog::RealSpaceMatrixQuery {
|
---|
102 | public:
|
---|
103 | RealSpaceMatrixQtQuery(Parameter<RealSpaceMatrix> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
104 | virtual ~RealSpaceMatrixQtQuery();
|
---|
105 | virtual bool handle();
|
---|
106 | private:
|
---|
107 | QBoxLayout *parent;
|
---|
108 | QBoxLayout *thisLayout;
|
---|
109 | QLabel *titleLabel;
|
---|
110 | QTableWidget *inputTable;
|
---|
111 |
|
---|
112 | RealSpaceMatrixQtQueryPipe *pipe;
|
---|
113 | };
|
---|
114 |
|
---|
115 | class QtDialog::DoubleQtQuery : public Dialog::DoubleQuery {
|
---|
116 | public:
|
---|
117 | DoubleQtQuery(Parameter<double> &, std::string title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
118 | virtual ~DoubleQtQuery();
|
---|
119 | virtual bool handle();
|
---|
120 | private:
|
---|
121 | QBoxLayout *parent;
|
---|
122 | QBoxLayout *thisLayout;
|
---|
123 | QLabel *titleLabel;
|
---|
124 | QDoubleSpinBox *inputBox;
|
---|
125 |
|
---|
126 | DoubleQtQueryPipe *pipe;
|
---|
127 | };
|
---|
128 |
|
---|
129 | class QtDialog::DoublesQtQuery : public Dialog::DoublesQuery {
|
---|
130 | public:
|
---|
131 | DoublesQtQuery(Parameter<std::vector<double> > &, std::string title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
132 | virtual ~DoublesQtQuery();
|
---|
133 | virtual bool handle();
|
---|
134 | private:
|
---|
135 | QBoxLayout *parent;
|
---|
136 | QBoxLayout *thisLayout;
|
---|
137 | QLabel *titleLabel;
|
---|
138 | QDoubleSpinBox *inputBox;
|
---|
139 |
|
---|
140 | QtQueryListPipe<double> *pipe;
|
---|
141 | };
|
---|
142 |
|
---|
143 | class QtDialog::ElementQtQuery : public Dialog::ElementQuery {
|
---|
144 | public:
|
---|
145 | ElementQtQuery(Parameter<const element *> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
146 | virtual ~ElementQtQuery();
|
---|
147 | virtual bool handle();
|
---|
148 | private:
|
---|
149 | QBoxLayout *parent;
|
---|
150 | QBoxLayout *thisLayout;
|
---|
151 | QLabel *titleLabel;
|
---|
152 | QComboBox *inputBox;
|
---|
153 |
|
---|
154 | ElementQtQueryPipe *pipe;
|
---|
155 | };
|
---|
156 |
|
---|
157 | class QtDialog::ElementsQtQuery : public Dialog::ElementsQuery {
|
---|
158 | public:
|
---|
159 | ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
160 | virtual ~ElementsQtQuery();
|
---|
161 | virtual bool handle();
|
---|
162 | private:
|
---|
163 | QBoxLayout *parent;
|
---|
164 | QBoxLayout *thisLayout;
|
---|
165 | QLabel *titleLabel;
|
---|
166 | QComboBox *inputBox;
|
---|
167 |
|
---|
168 | ElementsQtQueryPipe *pipe;
|
---|
169 | };
|
---|
170 |
|
---|
171 | class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
|
---|
172 | public:
|
---|
173 | EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
174 | virtual ~EmptyQtQuery();
|
---|
175 | virtual bool handle();
|
---|
176 | private:
|
---|
177 | QBoxLayout *parent;
|
---|
178 | QBoxLayout *thisLayout;
|
---|
179 | QLabel *titleLabel;
|
---|
180 |
|
---|
181 | EmptyQtQueryPipe *pipe;
|
---|
182 | };
|
---|
183 |
|
---|
184 | class QtDialog::FileQtQuery : public Dialog::FileQuery {
|
---|
185 | public:
|
---|
186 | FileQtQuery(Parameter<boost::filesystem::path> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
187 | virtual ~FileQtQuery();
|
---|
188 | virtual bool handle();
|
---|
189 | private:
|
---|
190 | QBoxLayout *parent;
|
---|
191 | QBoxLayout *thisLayout;
|
---|
192 | QLabel *filenameLabel;
|
---|
193 | QLineEdit *filenameLineEdit;
|
---|
194 | QPushButton *filedialogButton;
|
---|
195 |
|
---|
196 | FileQtQueryPipe *pipe;
|
---|
197 | };
|
---|
198 |
|
---|
199 | class QtDialog::FilesQtQuery : public Dialog::FilesQuery {
|
---|
200 | public:
|
---|
201 | FilesQtQuery(Parameter<std::vector< boost::filesystem::path> > &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
202 | virtual ~FilesQtQuery();
|
---|
203 | virtual bool handle();
|
---|
204 | void IntegerEntered(const QString&);
|
---|
205 | void IntegerSelected();
|
---|
206 | void AddInteger();
|
---|
207 | void RemoveInteger();
|
---|
208 | private:
|
---|
209 | QBoxLayout *parent;
|
---|
210 | QBoxLayout *thisLayout;
|
---|
211 | QLabel *titleLabel;
|
---|
212 |
|
---|
213 | QtQueryListPipe<boost::filesystem::path> *pipe;
|
---|
214 | };
|
---|
215 |
|
---|
216 | class QtDialog::IntQtQuery : public Dialog::IntQuery {
|
---|
217 | public:
|
---|
218 | IntQtQuery(Parameter<int> &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
219 | virtual ~IntQtQuery();
|
---|
220 | virtual bool handle();
|
---|
221 | private:
|
---|
222 | QBoxLayout *parent;
|
---|
223 | QBoxLayout *thisLayout;
|
---|
224 | QLabel *titleLabel;
|
---|
225 | QSpinBox *inputBox;
|
---|
226 |
|
---|
227 | IntQtQueryPipe *pipe;
|
---|
228 | };
|
---|
229 |
|
---|
230 | class QtDialog::IntsQtQuery : public Dialog::IntsQuery {
|
---|
231 | public:
|
---|
232 | IntsQtQuery(Parameter<std::vector<int> > &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
233 | virtual ~IntsQtQuery();
|
---|
234 | virtual bool handle();
|
---|
235 | void IntegerEntered(const QString&);
|
---|
236 | void IntegerSelected();
|
---|
237 | void AddInteger();
|
---|
238 | void RemoveInteger();
|
---|
239 | private:
|
---|
240 | QBoxLayout *parent;
|
---|
241 | QBoxLayout *thisLayout;
|
---|
242 | QLabel *titleLabel;
|
---|
243 |
|
---|
244 | QtQueryListPipe<int> *pipe;
|
---|
245 | };
|
---|
246 |
|
---|
247 | class QtDialog::MoleculeQtQuery : public Dialog::MoleculeQuery {
|
---|
248 | public:
|
---|
249 | MoleculeQtQuery(Parameter<const molecule *> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
250 | virtual ~MoleculeQtQuery();
|
---|
251 | virtual bool handle();
|
---|
252 | private:
|
---|
253 | QBoxLayout *parent;
|
---|
254 | QBoxLayout *thisLayout;
|
---|
255 | QLabel *titleLabel;
|
---|
256 | QComboBox *inputBox;
|
---|
257 |
|
---|
258 | MoleculeQtQueryPipe *pipe;
|
---|
259 | };
|
---|
260 |
|
---|
261 | class QtDialog::MoleculesQtQuery : public Dialog::MoleculesQuery {
|
---|
262 | public:
|
---|
263 | MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
264 | virtual ~MoleculesQtQuery();
|
---|
265 | virtual bool handle();
|
---|
266 | private:
|
---|
267 | QBoxLayout *parent;
|
---|
268 | QBoxLayout *thisLayout;
|
---|
269 | QLabel *titleLabel;
|
---|
270 | QComboBox *inputBox;
|
---|
271 |
|
---|
272 | MoleculesQtQueryPipe *pipe;
|
---|
273 | };
|
---|
274 |
|
---|
275 | class QtDialog::StringQtQuery : public Dialog::StringQuery {
|
---|
276 | public:
|
---|
277 | StringQtQuery(Parameter<std::string> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
278 | virtual ~StringQtQuery();
|
---|
279 | virtual bool handle();
|
---|
280 | private:
|
---|
281 | QBoxLayout *parent;
|
---|
282 | QBoxLayout *thisLayout;
|
---|
283 | QLabel *titleLabel;
|
---|
284 | QLineEdit *inputBox;
|
---|
285 |
|
---|
286 | StringQtQueryPipe *pipe;
|
---|
287 | };
|
---|
288 |
|
---|
289 | class QtDialog::StringsQtQuery : public Dialog::StringsQuery {
|
---|
290 | public:
|
---|
291 | StringsQtQuery(Parameter<std::vector<std::string> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
292 | virtual ~StringsQtQuery();
|
---|
293 | virtual bool handle();
|
---|
294 | private:
|
---|
295 | QBoxLayout *parent;
|
---|
296 | QBoxLayout *thisLayout;
|
---|
297 | QLabel *titleLabel;
|
---|
298 | QLineEdit *inputBox;
|
---|
299 |
|
---|
300 | StringsQtQueryPipe *pipe;
|
---|
301 | };
|
---|
302 |
|
---|
303 | class QtDialog::UnsignedIntQtQuery : public Dialog::UnsignedIntQuery {
|
---|
304 | public:
|
---|
305 | UnsignedIntQtQuery(Parameter<unsigned int> &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
306 | virtual ~UnsignedIntQtQuery();
|
---|
307 | virtual bool handle();
|
---|
308 | private:
|
---|
309 | QBoxLayout *parent;
|
---|
310 | QBoxLayout *thisLayout;
|
---|
311 | QLabel *titleLabel;
|
---|
312 | QSpinBox *inputBox;
|
---|
313 |
|
---|
314 | UnsignedIntQtQueryPipe *pipe;
|
---|
315 | };
|
---|
316 |
|
---|
317 | class QtDialog::UnsignedIntsQtQuery : public Dialog::UnsignedIntsQuery {
|
---|
318 | public:
|
---|
319 | UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
320 | virtual ~UnsignedIntsQtQuery();
|
---|
321 | virtual bool handle();
|
---|
322 | void IntegerEntered(const QString&);
|
---|
323 | void IntegerSelected();
|
---|
324 | void AddInteger();
|
---|
325 | void RemoveInteger();
|
---|
326 | private:
|
---|
327 | QBoxLayout *parent;
|
---|
328 | QBoxLayout *thisLayout;
|
---|
329 | QLabel *titleLabel;
|
---|
330 |
|
---|
331 | QtQueryListPipe<unsigned int> *pipe;
|
---|
332 | };
|
---|
333 |
|
---|
334 |
|
---|
335 | class QtDialog::VectorQtQuery : public Dialog::VectorQuery {
|
---|
336 | public:
|
---|
337 | VectorQtQuery(Parameter<Vector> &, std::string title,QBoxLayout *,QtDialog *);
|
---|
338 | virtual ~VectorQtQuery();
|
---|
339 | virtual bool handle();
|
---|
340 | private:
|
---|
341 | QBoxLayout *parent;
|
---|
342 | QBoxLayout *mainLayout;
|
---|
343 | QLabel *titleLabel;
|
---|
344 | QBoxLayout *subLayout;
|
---|
345 | QBoxLayout *coordLayout;
|
---|
346 | QLabel *coordLabel;
|
---|
347 | QDoubleSpinBox *coordInputX;
|
---|
348 | QDoubleSpinBox *coordInputY;
|
---|
349 | QDoubleSpinBox *coordInputZ;
|
---|
350 |
|
---|
351 | VectorQtQueryPipe *pipe;
|
---|
352 | };
|
---|
353 |
|
---|
354 | class QtDialog::VectorsQtQuery : public Dialog::VectorsQuery {
|
---|
355 | public:
|
---|
356 | VectorsQtQuery(Parameter<std::vector<Vector> > &, std::string title,QBoxLayout *,QtDialog *);
|
---|
357 | virtual ~VectorsQtQuery();
|
---|
358 | virtual bool handle();
|
---|
359 | private:
|
---|
360 | QBoxLayout *parent;
|
---|
361 | QBoxLayout *mainLayout;
|
---|
362 | QLabel *titleLabel;
|
---|
363 | QBoxLayout *subLayout;
|
---|
364 | QBoxLayout *coordLayout;
|
---|
365 | QLabel *coordLabel;
|
---|
366 | QDoubleSpinBox *coordInput;
|
---|
367 |
|
---|
368 | VectorsQtQueryPipe *pipe;
|
---|
369 | };
|
---|
370 |
|
---|
371 | class QtDialog::RandomNumberDistribution_ParametersQtQuery : public Dialog::RandomNumberDistribution_ParametersQuery {
|
---|
372 | public:
|
---|
373 | RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title,QBoxLayout *,QtDialog *);
|
---|
374 | virtual ~RandomNumberDistribution_ParametersQtQuery();
|
---|
375 | virtual bool handle();
|
---|
376 | private:
|
---|
377 | QBoxLayout *parent;
|
---|
378 | QHBoxLayout *thisLayout;
|
---|
379 | QLabel *titleLabel;
|
---|
380 | QTextEdit *inputBox;
|
---|
381 | QPushButton *okButton;
|
---|
382 |
|
---|
383 | RandomNumberDistribution_ParametersQtQueryPipe *pipe;
|
---|
384 | };
|
---|
385 |
|
---|
386 | #endif /* QTQUERY_HPP_ */
|
---|