source: src/UIElements/Dialog.hpp@ 85537a

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 Candidate_v1.7.0 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 85537a was 7cd6e7, checked in by Frederik Heber <heber@…>, 15 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: 7.3 KB
RevLine 
[f5a86a]1/*
2 * Dialog.hpp
3 *
4 * Created on: Jan 5, 2010
5 * Author: crueger
6 */
7
8#ifndef DIALOG_HPP_
9#define DIALOG_HPP_
10
11#include<string>
12#include<list>
[104524]13#include<vector>
[f5a86a]14
[7cd6e7]15#include "vector.hpp"
16
[97ebf8]17class atom;
[84c494]18class Box;
[97ebf8]19class element;
[7aa000]20class molecule;
[45f5d6]21
[de8e45]22
23/** Dialog is one of the two main classes of the UIFactory base class.
24 *
25 * The Dialog is meant for asking the user for information needed to perform actions he
26 * desires, such as asking for a position in space or a length.
27 *
28 * For this purpose there is the base class Query and numerous specializations for each
29 * of the types to be asked. There are primitives integer, doubles and string, but also
30 * advanced types such as element, molecule or Vector. There is also an empty query for
31 * displaying text.
32 */
[f5a86a]33class Dialog
34{
35public:
36 Dialog();
37 virtual ~Dialog();
38
[86466e]39 virtual void queryEmpty(const char *, std::string = "")=0;
[75dc28]40 virtual void queryBoolean(const char *, std::string = "")=0;
41 virtual void queryInt(const char *, std::string = "")=0;
[7cd6e7]42 virtual void queryInts(const char *, std::string = "")=0;
[75dc28]43 virtual void queryDouble(const char*, std::string = "")=0;
[7cd6e7]44 virtual void queryDoubles(const char*, std::string = "")=0;
[75dc28]45 virtual void queryString(const char*, std::string = "")=0;
46 virtual void queryStrings(const char*, std::string = "")=0;
47 virtual void queryAtom(const char*,std::string = "")=0;
[7cd6e7]48 virtual void queryAtoms(const char*,std::string = "")=0;
[75dc28]49 virtual void queryMolecule(const char*, std::string = "")=0;
[7cd6e7]50 virtual void queryMolecules(const char*, std::string = "")=0;
[75dc28]51 virtual void queryVector(const char*,bool, std::string = "")=0;
[7cd6e7]52 virtual void queryVectors(const char*,bool, std::string = "")=0;
[75dc28]53 virtual void queryBox(const char*, std::string = "")=0;
54 virtual void queryElement(const char*, std::string = "")=0;
[7cd6e7]55 virtual void queryElements(const char*, std::string = "")=0;
[f5a86a]56
[45f5d6]57 virtual bool display();
[f5a86a]58
[d3a5ea]59 virtual bool checkAll();
60 virtual void setAll();
61
[f5a86a]62protected:
63 // methodology for handling queries
64 // all queries are stored and then performed at appropriate times
65
66 //these queries can be handled by this dialog
[45f5d6]67
68 //TODO: Find a way to reduce complexity...
69 //needs O(N*M) query classes, where N is the number of query types and M is the number of GUIs
70 //usual approach for reducing inheritance complexity (strategy pattern) does not work,
71 //due to lack of common code for query types as well as GUI-Types (all subtypes differ a lot)
72
73 //base class for all queries
74 class Query {
[94d131]75 friend class Dialog;
[45f5d6]76 public:
[a2ab15]77 Query(std::string _title, std::string _description = "");
[5a7243]78 virtual ~Query();
[45f5d6]79 virtual bool handle()=0;
80 virtual void setResult()=0;
81 protected:
82 const std::string getTitle() const;
[a2ab15]83 const std::string getDescription() const;
[45f5d6]84 private:
[a2ab15]85 std::string title; //!< short title of the query
86 std::string description; //!< longer description for tooltips or for help
[f5a86a]87 };
88
[86466e]89 // Empty Query is just meant for showing text, such as version, help, initial message or alike
90 class EmptyQuery : public Query {
91 public:
92 EmptyQuery(std::string title, std::string _description = "");
93 virtual ~EmptyQuery();
94 virtual bool handle()=0;
95 virtual void setResult();
[f5a86a]96 };
97
[45f5d6]98 //Specialized classes for certain types. GUI-Types are not specialized at this time
[97ebf8]99 class BooleanQuery : public Query {
100 public:
[75dc28]101 BooleanQuery(std::string title, std::string _description = "");
[97ebf8]102 virtual ~BooleanQuery();
103 virtual bool handle()=0;
104 virtual void setResult();
105 protected:
106 bool tmp;
107 };
108
[45f5d6]109 class IntQuery : public Query {
110 public:
[75dc28]111 IntQuery(std::string title, std::string _description = "");
[5a7243]112 virtual ~IntQuery();
[45f5d6]113 virtual bool handle()=0;
114 virtual void setResult();
115 protected:
116 int tmp;
117 };
118
[7cd6e7]119 class IntsQuery : public Query {
120 public:
121 IntsQuery(std::string title, std::string _description = "");
122 virtual ~IntsQuery();
123 virtual bool handle()=0;
124 virtual void setResult();
125 protected:
126 int temp;
127 std::vector<int> tmp;
128 };
129
[2ededc2]130 class DoubleQuery : public Query {
131 public:
[75dc28]132 DoubleQuery(std::string title, std::string _description = "");
[5a7243]133 virtual ~DoubleQuery();
[2ededc2]134 virtual bool handle()=0;
135 virtual void setResult();
136 protected:
137 double tmp;
138 };
139
[7cd6e7]140 class DoublesQuery : public Query {
141 public:
142 DoublesQuery(std::string title, std::string _description = "");
143 virtual ~DoublesQuery();
144 virtual bool handle()=0;
145 virtual void setResult();
146 protected:
147 double temp;
148 std::vector<double> tmp;
149 };
150
[45f5d6]151 class StringQuery : public Query {
152 public:
[75dc28]153 StringQuery(std::string title, std::string _description = "");
[5a7243]154 virtual ~StringQuery();
[45f5d6]155 virtual bool handle()=0;
156 virtual void setResult();
157 protected:
158 std::string tmp;
159 };
160
[cd8e55]161 class StringsQuery : public Query {
162 public:
[75dc28]163 StringsQuery(std::string title, std::string _description = "");
[cd8e55]164 virtual ~StringsQuery();
165 virtual bool handle()=0;
166 virtual void setResult();
167 protected:
168 std::string temp;
169 std::vector<std::string> tmp;
170 };
171
[7aa000]172 class MoleculeQuery : public Query {
173 public:
[75dc28]174 MoleculeQuery(std::string title, std::string _description = "");
[5a7243]175 virtual ~MoleculeQuery();
[7aa000]176 virtual bool handle()=0;
177 virtual void setResult();
178 protected:
179 molecule *tmp;
180 };
181
[7cd6e7]182 class MoleculesQuery : public Query {
183 public:
184 MoleculesQuery(std::string title, std::string _description = "");
185 virtual ~MoleculesQuery();
186 virtual bool handle()=0;
187 virtual void setResult();
188 protected:
189 molecule * temp;
190 std::vector<molecule *> tmp;
191 };
192
[97ebf8]193 class AtomQuery : public Query {
194 public:
[75dc28]195 AtomQuery(std::string title, std::string _description = "");
[97ebf8]196 virtual ~AtomQuery();
197 virtual bool handle()=0;
198 virtual void setResult();
199 protected:
200 atom *tmp;
201 };
202
[7cd6e7]203 class AtomsQuery : public Query {
204 public:
205 AtomsQuery(std::string title, std::string _description = "");
206 virtual ~AtomsQuery();
207 virtual bool handle()=0;
208 virtual void setResult();
209 protected:
210 atom *temp;
211 std::vector<atom *> tmp;
212 };
213
[2ededc2]214 class VectorQuery : public Query {
215 public:
[75dc28]216 VectorQuery(std::string title,bool _check, std::string _description = "");
[5a7243]217 virtual ~VectorQuery();
[2ededc2]218 virtual bool handle()=0;
219 virtual void setResult();
220 protected:
[7cd6e7]221 Vector tmp;
222 bool check;
223 };
224
225 class VectorsQuery : public Query {
226 public:
227 VectorsQuery(std::string title,bool _check, std::string _description = "");
228 virtual ~VectorsQuery();
229 virtual bool handle()=0;
230 virtual void setResult();
231 protected:
232 Vector temp;
233 std::vector<Vector> tmp;
[2ededc2]234 bool check;
235 };
236
[97ebf8]237 class BoxQuery : public Query {
238 public:
[75dc28]239 BoxQuery(std::string title, std::string _description = "");
[97ebf8]240 virtual ~BoxQuery();
241 virtual bool handle()=0;
242 virtual void setResult();
243 protected:
[84c494]244 double* tmp;
[97ebf8]245 };
246
[5a7243]247 class ElementQuery : public Query {
248 public:
[75dc28]249 ElementQuery(std::string title, std::string _description = "");
[5a7243]250 virtual ~ElementQuery();
251 virtual bool handle()=0;
252 virtual void setResult();
253 protected:
[7cd6e7]254 element * tmp;
255 };
256
257 class ElementsQuery : public Query {
258 public:
259 ElementsQuery(std::string title, std::string _description = "");
260 virtual ~ElementsQuery();
261 virtual bool handle()=0;
262 virtual void setResult();
263 protected:
264 element *temp;
[3731b4]265 std::vector<element *> tmp;
[5a7243]266 };
267
[45f5d6]268void registerQuery(Query* query);
269
270private:
271 std::list<Query*> queries;
[f5a86a]272
273};
274
[a2ab15]275
[f5a86a]276#endif /* DIALOG_HPP_ */
Note: See TracBrowser for help on using the repository browser.