source: src/UIElements/QT4/QTDialog.hpp@ ee62e4

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 ee62e4 was ee62e4, checked in by Frederik Heber <heber@…>, 15 years ago

Added BooleanQTQuery.

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