source: src/UIElements/Dialog.cpp@ 8467df

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

BoxQuery contains Box not double[6].

  • BUGFIX: VectorCommandLineQuery - isInside..() should have been !isInside...()
  • BoxCommandLineQuery::handle(),BoxTextQuery::handle() - use box class
  • BoxQuery has class Box as member variable
  • Property mode set to 100644
File size: 6.3 KB
Line 
1/*
2 * Dialog.cpp
3 *
4 * Created on: Jan 5, 2010
5 * Author: crueger
6 */
7
8#include "Helpers/MemDebug.hpp"
9
10#include "Dialog.hpp"
11#include "ValueStorage.hpp"
12
13#include "verbose.hpp"
14#include "atom.hpp"
15#include "element.hpp"
16#include "molecule.hpp"
17#include "vector.hpp"
18#include "Matrix.hpp"
19#include "Box.hpp"
20
21using namespace std;
22
23Dialog::Dialog()
24{
25}
26
27Dialog::~Dialog()
28{
29 list<Query*>::iterator iter;
30 for(iter=queries.begin();iter!=queries.end();iter++){
31 delete (*iter);
32 }
33}
34
35void Dialog::registerQuery(Query *query){
36 queries.push_back(query);
37}
38
39bool Dialog::display(){
40 if(checkAll()){
41 setAll();
42 return true;
43 }
44 else{
45 return false;
46 }
47}
48
49bool Dialog::checkAll(){
50 list<Query*>::iterator iter;
51 bool retval = true;
52 for(iter=queries.begin(); iter!=queries.end(); iter++){
53 retval &= (*iter)->handle();
54 // if any query fails (is canceled), we can end the handling process
55 if(!retval) {
56 DoeLog(1) && (eLog() << Verbose(1) << "The following query failed: " << (**iter).getTitle() << "." << endl);
57 break;
58 }
59 }
60 return retval;
61}
62
63void Dialog::setAll(){
64 list<Query*>::iterator iter;
65 for(iter=queries.begin(); iter!=queries.end(); iter++) {
66 (*iter)->setResult();
67 }
68}
69
70/****************** Query types Infrastructure **************************/
71
72// Base class
73Dialog::Query::Query(string _title, string _description) :
74 title(_title),
75 description(_description)
76{}
77
78Dialog::Query::~Query() {}
79
80const std::string Dialog::Query::getTitle() const{
81 return title;
82}
83
84const std::string Dialog::Query::getDescription() const{
85 return description;
86}
87// empty Queries
88
89Dialog::EmptyQuery::EmptyQuery(string title, std::string description) :
90 Query(title, description)
91{}
92
93Dialog::EmptyQuery::~EmptyQuery() {}
94
95void Dialog::EmptyQuery::setResult() {
96}
97
98// Int Queries
99
100Dialog::IntQuery::IntQuery(string title, std::string description) :
101 Query(title, description)
102{}
103
104Dialog::IntQuery::~IntQuery() {}
105
106void Dialog::IntQuery::setResult() {
107 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
108}
109
110// Ints Queries
111
112Dialog::IntsQuery::IntsQuery(string title, std::string description) :
113 Query(title, description)
114{}
115
116Dialog::IntsQuery::~IntsQuery() {}
117
118void Dialog::IntsQuery::setResult() {
119 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
120}
121
122// Bool Queries
123
124Dialog::BooleanQuery::BooleanQuery(string title,std::string description) :
125 Query(title, description)
126{}
127
128Dialog::BooleanQuery::~BooleanQuery() {}
129
130void Dialog::BooleanQuery::setResult() {
131 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
132}
133
134// String Queries
135
136Dialog::StringQuery::StringQuery(string title,std::string _description) :
137 Query(title, _description)
138{}
139
140Dialog::StringQuery::~StringQuery() {};
141
142void Dialog::StringQuery::setResult() {
143 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
144}
145
146// Strings Queries
147
148Dialog::StringsQuery::StringsQuery(string title,std::string _description) :
149 Query(title, _description)
150{}
151
152Dialog::StringsQuery::~StringsQuery() {};
153
154void Dialog::StringsQuery::setResult() {
155 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
156}
157
158// Double Queries
159
160Dialog::DoubleQuery::DoubleQuery(string title, std::string _description) :
161 Query(title, _description)
162{}
163
164Dialog::DoubleQuery::~DoubleQuery() {};
165
166void Dialog::DoubleQuery::setResult() {
167 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
168}
169
170// Doubles Queries
171
172Dialog::DoublesQuery::DoublesQuery(string title, std::string _description) :
173 Query(title, _description)
174{}
175
176Dialog::DoublesQuery::~DoublesQuery() {};
177
178void Dialog::DoublesQuery::setResult() {
179 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
180}
181
182
183// Atom Queries
184
185Dialog::AtomQuery::AtomQuery(string title, std::string _description) :
186 Query(title, _description),
187 tmp(0)
188{}
189
190Dialog::AtomQuery::~AtomQuery() {}
191
192void Dialog::AtomQuery::setResult() {
193 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
194}
195
196// Atoms Queries
197
198Dialog::AtomsQuery::AtomsQuery(string title, std::string _description) :
199 Query(title, _description),
200 tmp(0)
201{}
202
203Dialog::AtomsQuery::~AtomsQuery() {}
204
205void Dialog::AtomsQuery::setResult() {
206 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
207}
208
209// Molecule Queries
210
211Dialog::MoleculeQuery::MoleculeQuery(string title, std::string _description) :
212 Query(title, _description),
213 tmp(0)
214{}
215
216Dialog::MoleculeQuery::~MoleculeQuery() {}
217
218void Dialog::MoleculeQuery::setResult() {
219 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
220}
221
222// Molecules Queries
223
224Dialog::MoleculesQuery::MoleculesQuery(string title, std::string _description) :
225 Query(title, _description),
226 tmp(0)
227{}
228
229Dialog::MoleculesQuery::~MoleculesQuery() {}
230
231void Dialog::MoleculesQuery::setResult() {
232 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
233}
234
235// Vector Queries
236
237Dialog::VectorQuery::VectorQuery(std::string title,bool _check, std::string _description) :
238 Query(title, _description),
239 check(_check)
240{}
241
242Dialog::VectorQuery::~VectorQuery()
243{}
244
245void Dialog::VectorQuery::setResult() {
246 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
247}
248
249// Vectors Queries
250
251Dialog::VectorsQuery::VectorsQuery(std::string title,bool _check, std::string _description) :
252 Query(title, _description),
253 check(_check)
254{}
255
256Dialog::VectorsQuery::~VectorsQuery()
257{}
258
259void Dialog::VectorsQuery::setResult() {
260 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
261}
262
263// Box Queries
264
265Dialog::BoxQuery::BoxQuery(std::string title, std::string _description) :
266 Query(title, _description)
267{}
268
269Dialog::BoxQuery::~BoxQuery()
270{}
271
272void Dialog::BoxQuery::setResult() {
273 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
274}
275
276// Element Queries
277Dialog::ElementQuery::ElementQuery(std::string title, std::string _description) :
278 Query(title, _description)
279 {}
280
281Dialog::ElementQuery::~ElementQuery(){}
282
283void Dialog::ElementQuery::setResult(){
284 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
285}
286
287// Elements Queries
288Dialog::ElementsQuery::ElementsQuery(std::string title, std::string _description) :
289 Query(title, _description)
290 {}
291
292Dialog::ElementsQuery::~ElementsQuery(){}
293
294void Dialog::ElementsQuery::setResult(){
295 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
296}
Note: See TracBrowser for help on using the repository browser.