source: src/UIElements/Qt4/QtDialog.hpp@ 4cf323d

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

Renamed QT -> Qt in files, dirs, and class names.

  • 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.