source: src/UIElements/QT4/QTDialog.hpp@ 41167c

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

Added BoxQTQuery.

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