source: src/UIElements/QT4/QTDialog.hpp@ 2a76b0

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 2a76b0 was 7cd6e7, checked in by Frederik Heber <heber@…>, 14 years ago

Add all possible versions of queries where the user is asked for multiples of the same.

  • Note that these are correctly implemented in TextUI and CommandLineUI, but not yet in QT4.
  • Property mode set to 100644
File size: 11.2 KB
Line 
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
14class QBoxLayout;
15class QLabel;
16class QSpinBox;
17class QDoubleSpinBox;
18class QLineEdit;
19class QListWidget;
20class QComboBox;
21class QDialogButtonBox;
22
23
24// Forward declarations for plumbing
25template<typename T> class QTQueryListPipe;
26class StringQTQueryPipe;
27class StringsQTQueryPipe;
28class IntQTQueryPipe;
29class DoubleQTQueryPipe;
30class DoublesQTQueryPipe;
31class AtomQTQueryPipe;
32class AtomsQTQueryPipe;
33class MoleculeQTQueryPipe;
34class MoleculesQTQueryPipe;
35class ElementQTQueryPipe;
36class ElementsQTQueryPipe;
37class VectorQTQueryPipe;
38class VectorsQTQueryPipe;
39
40class QTDialog : public QDialog, public Dialog
41{
42 Q_OBJECT
43public:
44 QTDialog();
45 virtual ~QTDialog();
46
47 virtual void queryEmpty(const char*, std::string);
48 virtual void queryBoolean(const char *, std::string = "");
49 virtual void queryInt(const char *,std::string = "");
50 virtual void queryInts(const char *,std::string = "");
51 virtual void queryDouble(const char*,std::string = "");
52 virtual void queryDoubles(const char*,std::string = "");
53 virtual void queryString(const char*,std::string = "");
54 virtual void queryStrings(const char*,std::string = "");
55 virtual void queryAtom(const char*,std::string = "");
56 virtual void queryAtoms(const char*,std::string = "");
57 virtual void queryMolecule(const char*,std::string = "");
58 virtual void queryMolecules(const char*,std::string = "");
59 virtual void queryVector(const char*,bool,std::string = "");
60 virtual void queryVectors(const char*,bool,std::string = "");
61 virtual void queryBox(const char*, std::string = "");
62 virtual void queryElement(const char*,std::string = "");
63 virtual void queryElements(const char*,std::string = "");
64
65 virtual bool display();
66
67 virtual void update();
68
69protected:
70 class IntQTQuery : public Dialog::IntQuery {
71 public:
72 IntQTQuery(std::string _title,QBoxLayout *_parent,QTDialog *_dialog);
73 virtual ~IntQTQuery();
74 virtual bool handle();
75 private:
76 QBoxLayout *parent;
77 QBoxLayout *thisLayout;
78 QLabel *titleLabel;
79 QSpinBox *inputBox;
80
81 IntQTQueryPipe *pipe;
82 };
83
84 class IntsQTQuery : public Dialog::IntsQuery {
85 public:
86 IntsQTQuery(std::string _title,QBoxLayout *_parent,QTDialog *_dialog);
87 virtual ~IntsQTQuery();
88 virtual bool handle();
89 void IntegerEntered(const QString&);
90 void IntegerSelected();
91 void AddInteger();
92 void RemoveInteger();
93 private:
94 QBoxLayout *parent;
95 QBoxLayout *thisLayout;
96 QLabel *titleLabel;
97
98 QTQueryListPipe<int> *pipe;
99 };
100
101 class DoubleQTQuery : public Dialog::DoubleQuery {
102 public:
103 DoubleQTQuery(std::string title,QBoxLayout *_parent,QTDialog *_dialog);
104 virtual ~DoubleQTQuery();
105 virtual bool handle();
106 private:
107 QBoxLayout *parent;
108 QBoxLayout *thisLayout;
109 QLabel *titleLabel;
110 QDoubleSpinBox *inputBox;
111
112 DoubleQTQueryPipe *pipe;
113 };
114
115 class DoublesQTQuery : public Dialog::DoublesQuery {
116 public:
117 DoublesQTQuery(std::string title,QBoxLayout *_parent,QTDialog *_dialog);
118 virtual ~DoublesQTQuery();
119 virtual bool handle();
120 private:
121 QBoxLayout *parent;
122 QBoxLayout *thisLayout;
123 QLabel *titleLabel;
124 QDoubleSpinBox *inputBox;
125
126 QTQueryListPipe<double> *pipe;
127 };
128
129 class StringQTQuery : public Dialog::StringQuery {
130 public:
131 StringQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
132 virtual ~StringQTQuery();
133 virtual bool handle();
134 private:
135 QBoxLayout *parent;
136 QBoxLayout *thisLayout;
137 QLabel *titleLabel;
138 QLineEdit *inputBox;
139
140 StringQTQueryPipe *pipe;
141 };
142
143 class StringsQTQuery : public Dialog::StringsQuery {
144 public:
145 StringsQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
146 virtual ~StringsQTQuery();
147 virtual bool handle();
148 private:
149 QBoxLayout *parent;
150 QBoxLayout *thisLayout;
151 QLabel *titleLabel;
152 QLineEdit *inputBox;
153
154 QTQueryListPipe<std::string> *pipe;
155 };
156
157 class AtomQTQuery : public Dialog::AtomQuery {
158 public:
159 AtomQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
160 virtual ~AtomQTQuery();
161 virtual bool handle();
162 private:
163 QBoxLayout *parent;
164 QBoxLayout *thisLayout;
165 QLabel *titleLabel;
166 QComboBox *inputBox;
167
168 AtomQTQueryPipe *pipe;
169 };
170
171 class AtomsQTQuery : public Dialog::AtomsQuery {
172 public:
173 AtomsQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
174 virtual ~AtomsQTQuery();
175 virtual bool handle();
176 private:
177 QBoxLayout *parent;
178 QBoxLayout *thisLayout;
179 QLabel *titleLabel;
180 QComboBox *inputBox;
181
182 AtomsQTQueryPipe *pipe;
183 };
184
185 class MoleculeQTQuery : public Dialog::MoleculeQuery {
186 public:
187 MoleculeQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
188 virtual ~MoleculeQTQuery();
189 virtual bool handle();
190 private:
191 QBoxLayout *parent;
192 QBoxLayout *thisLayout;
193 QLabel *titleLabel;
194 QComboBox *inputBox;
195
196 MoleculeQTQueryPipe *pipe;
197 };
198
199 class MoleculesQTQuery : public Dialog::MoleculesQuery {
200 public:
201 MoleculesQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
202 virtual ~MoleculesQTQuery();
203 virtual bool handle();
204 private:
205 QBoxLayout *parent;
206 QBoxLayout *thisLayout;
207 QLabel *titleLabel;
208 QComboBox *inputBox;
209
210 MoleculesQTQueryPipe *pipe;
211 };
212
213 class VectorQTQuery : public Dialog::VectorQuery {
214 public:
215 VectorQTQuery(std::string title,bool _check,QBoxLayout *,QTDialog *);
216 virtual ~VectorQTQuery();
217 virtual bool handle();
218 private:
219 QBoxLayout *parent;
220 QBoxLayout *mainLayout;
221 QLabel *titleLabel;
222 QBoxLayout *subLayout;
223 QBoxLayout *coordLayout;
224 QLabel *coordLabel;
225 QDoubleSpinBox *coordInput;
226
227 VectorQTQueryPipe *pipe;
228 };
229
230 class VectorsQTQuery : public Dialog::VectorsQuery {
231 public:
232 VectorsQTQuery(std::string title,bool _check,QBoxLayout *,QTDialog *);
233 virtual ~VectorsQTQuery();
234 virtual bool handle();
235 private:
236 QBoxLayout *parent;
237 QBoxLayout *mainLayout;
238 QLabel *titleLabel;
239 QBoxLayout *subLayout;
240 QBoxLayout *coordLayout;
241 QLabel *coordLabel;
242 QDoubleSpinBox *coordInput;
243
244 VectorsQTQueryPipe *pipe;
245 };
246
247 class ElementQTQuery : public Dialog::ElementQuery {
248 public:
249 ElementQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
250 virtual ~ElementQTQuery();
251 virtual bool handle();
252 private:
253 QBoxLayout *parent;
254 QBoxLayout *thisLayout;
255 QLabel *titleLabel;
256 QComboBox *inputBox;
257
258 ElementQTQueryPipe *pipe;
259 };
260
261 class ElementsQTQuery : public Dialog::ElementsQuery {
262 public:
263 ElementsQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
264 virtual ~ElementsQTQuery();
265 virtual bool handle();
266 private:
267 QBoxLayout *parent;
268 QBoxLayout *thisLayout;
269 QLabel *titleLabel;
270 QComboBox *inputBox;
271
272 ElementsQTQueryPipe *pipe;
273 };
274
275private:
276 QBoxLayout *mainLayout;
277 QBoxLayout *inputLayout;
278 QBoxLayout *buttonLayout;
279 QDialogButtonBox *buttons;
280};
281
282// All kinds of plumbing for Queries
283// Plumbing needs to be outside of the class where it is needed,
284// since MOC doesn't like nested classes
285
286
287template<typename T> class QTQueryListPipe : public QWidget {
288 public:
289 QTQueryListPipe(std::vector<T> *_content, QTDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton);
290 virtual ~QTQueryListPipe();
291 void AddInteger();
292 void RemoveInteger();
293 void IntegerSelected();
294 void IntegerEntered(const QString&);
295
296 private:
297 void AddValue(T item);
298 void RemoveRow(int row);
299
300 std::vector<T> *content;
301 QTDialog *dialog;
302 QLineEdit *inputBox;
303 QListWidget *inputList;
304 QPushButton *AddButton;
305 QPushButton *RemoveButton;
306};
307
308
309class StringQTQueryPipe : public QWidget {
310 Q_OBJECT
311public:
312 StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
313 virtual ~StringQTQueryPipe();
314
315public slots:
316 void update(const QString&);
317
318private:
319 std::string *content;
320 QTDialog *dialog;
321
322};
323
324class IntQTQueryPipe : public QWidget {
325 Q_OBJECT
326public:
327 IntQTQueryPipe(int *_content, QTDialog *_dialog);
328 virtual ~IntQTQueryPipe();
329
330public slots:
331 void update(int);
332
333private:
334 int *content;
335 QTDialog *dialog;
336
337};
338
339
340class DoubleQTQueryPipe : public QWidget {
341 Q_OBJECT
342public:
343 DoubleQTQueryPipe(double *_content, QTDialog *_dialog);
344 virtual ~DoubleQTQueryPipe();
345
346public slots:
347 void update(double);
348
349private:
350 double *content;
351 QTDialog *dialog;
352
353};
354
355class AtomQTQueryPipe : public QWidget {
356 Q_OBJECT
357public:
358 AtomQTQueryPipe(atom **_content, QTDialog *_dialog, QComboBox *_theBox);
359 virtual ~AtomQTQueryPipe();
360
361public slots:
362 void update(int);
363
364private:
365 atom **content;
366 QTDialog *dialog;
367 QComboBox *theBox;
368
369};
370
371
372class AtomsQTQueryPipe : public QWidget {
373 Q_OBJECT
374public:
375 AtomsQTQueryPipe(std::vector<atom *>*_content, QTDialog *_dialog, QComboBox *_theBox);
376 virtual ~AtomsQTQueryPipe();
377
378public slots:
379 void update(int);
380
381private:
382 std::vector<atom *>*content;
383 QTDialog *dialog;
384 QComboBox *theBox;
385
386};
387
388class MoleculeQTQueryPipe : public QWidget {
389 Q_OBJECT
390public:
391 MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox);
392 virtual ~MoleculeQTQueryPipe();
393
394public slots:
395 void update(int);
396
397private:
398 molecule **content;
399 QTDialog *dialog;
400 QComboBox *theBox;
401
402};
403
404class MoleculesQTQueryPipe : public QWidget {
405 Q_OBJECT
406public:
407 MoleculesQTQueryPipe(std::vector<molecule *>*_content, QTDialog *_dialog, QComboBox *_theBox);
408 virtual ~MoleculesQTQueryPipe();
409
410public slots:
411 void update(int);
412
413private:
414 std::vector<molecule *>*content;
415 QTDialog *dialog;
416 QComboBox *theBox;
417
418};
419
420class VectorQTQueryPipe : public QWidget {
421 Q_OBJECT
422public:
423 VectorQTQueryPipe(Vector *_content, QTDialog *_dialog, QComboBox *_theBox);
424 virtual ~VectorQTQueryPipe();
425
426public slots:
427 void update();
428
429private:
430 Vector *content;
431 QTDialog *dialog;
432 QComboBox *theBox;
433};
434
435class VectorsQTQueryPipe : public QWidget {
436 Q_OBJECT
437public:
438 VectorsQTQueryPipe(std::vector<Vector>*_content, QTDialog *_dialog, QComboBox *_theBox);
439 virtual ~VectorsQTQueryPipe();
440
441public slots:
442 void update();
443
444private:
445 std::vector<Vector> *content;
446 QTDialog *dialog;
447 QComboBox *theBox;
448};
449
450class ElementQTQueryPipe : public QWidget {
451 Q_OBJECT
452public:
453 ElementQTQueryPipe(element **_content, QTDialog *_dialog, QComboBox *_theBox);
454 virtual ~ElementQTQueryPipe();
455
456public slots:
457 void update(int);
458
459private:
460 element **content;
461 QTDialog *dialog;
462 QComboBox *theBox;
463};
464
465class ElementsQTQueryPipe : public QWidget {
466 Q_OBJECT
467public:
468 ElementsQTQueryPipe(std::vector<element *>*_content, QTDialog *_dialog, QComboBox *_theBox);
469 virtual ~ElementsQTQueryPipe();
470
471public slots:
472 void update(int);
473
474private:
475 std::vector<element *>*content;
476 QTDialog *dialog;
477 QComboBox *theBox;
478};
479#endif /* QTDIALOG_HPP_ */
Note: See TracBrowser for help on using the repository browser.