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
RevLine 
[f5a86a]1/*
2 * Dialog.cpp
3 *
4 * Created on: Jan 5, 2010
5 * Author: crueger
6 */
7
[112b09]8#include "Helpers/MemDebug.hpp"
9
[5079a0]10#include "Dialog.hpp"
[75dc28]11#include "ValueStorage.hpp"
[f5a86a]12
[36166d]13#include "verbose.hpp"
[97ebf8]14#include "atom.hpp"
15#include "element.hpp"
16#include "molecule.hpp"
[2ededc2]17#include "vector.hpp"
[84c494]18#include "Matrix.hpp"
19#include "Box.hpp"
[2ededc2]20
[f5a86a]21using namespace std;
22
23Dialog::Dialog()
24{
25}
26
27Dialog::~Dialog()
28{
[45f5d6]29 list<Query*>::iterator iter;
30 for(iter=queries.begin();iter!=queries.end();iter++){
31 delete (*iter);
32 }
[f5a86a]33}
34
[45f5d6]35void Dialog::registerQuery(Query *query){
36 queries.push_back(query);
37}
[f5a86a]38
[45f5d6]39bool Dialog::display(){
[d3a5ea]40 if(checkAll()){
41 setAll();
42 return true;
43 }
44 else{
45 return false;
46 }
47}
48
49bool Dialog::checkAll(){
[45f5d6]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
[94d131]55 if(!retval) {
56 DoeLog(1) && (eLog() << Verbose(1) << "The following query failed: " << (**iter).getTitle() << "." << endl);
[45f5d6]57 break;
[94d131]58 }
[45f5d6]59 }
60 return retval;
[f5a86a]61}
62
[d3a5ea]63void Dialog::setAll(){
64 list<Query*>::iterator iter;
65 for(iter=queries.begin(); iter!=queries.end(); iter++) {
66 (*iter)->setResult();
67 }
68}
69
[7aa000]70/****************** Query types Infrastructure **************************/
71
72// Base class
[a2ab15]73Dialog::Query::Query(string _title, string _description) :
74 title(_title),
75 description(_description)
[45f5d6]76{}
[f5a86a]77
[45f5d6]78Dialog::Query::~Query() {}
79
80const std::string Dialog::Query::getTitle() const{
81 return title;
[f5a86a]82}
83
[a2ab15]84const std::string Dialog::Query::getDescription() const{
85 return description;
86}
[86466e]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
[7aa000]98// Int Queries
99
[75dc28]100Dialog::IntQuery::IntQuery(string title, std::string description) :
101 Query(title, description)
[45f5d6]102{}
103
104Dialog::IntQuery::~IntQuery() {}
105
106void Dialog::IntQuery::setResult() {
[3731b4]107 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[f5a86a]108}
[45f5d6]109
[7cd6e7]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
[97ebf8]123
[75dc28]124Dialog::BooleanQuery::BooleanQuery(string title,std::string description) :
125 Query(title, description)
[97ebf8]126{}
127
128Dialog::BooleanQuery::~BooleanQuery() {}
129
130void Dialog::BooleanQuery::setResult() {
[3731b4]131 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[97ebf8]132}
133
[7aa000]134// String Queries
135
[75dc28]136Dialog::StringQuery::StringQuery(string title,std::string _description) :
137 Query(title, _description)
[45f5d6]138{}
139
140Dialog::StringQuery::~StringQuery() {};
141
142void Dialog::StringQuery::setResult() {
[3731b4]143 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[45f5d6]144}
145
[cd8e55]146// Strings Queries
147
[75dc28]148Dialog::StringsQuery::StringsQuery(string title,std::string _description) :
149 Query(title, _description)
[cd8e55]150{}
151
152Dialog::StringsQuery::~StringsQuery() {};
153
154void Dialog::StringsQuery::setResult() {
[3731b4]155 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[cd8e55]156}
157
[2ededc2]158// Double Queries
159
[75dc28]160Dialog::DoubleQuery::DoubleQuery(string title, std::string _description) :
161 Query(title, _description)
[2ededc2]162{}
163
164Dialog::DoubleQuery::~DoubleQuery() {};
165
166void Dialog::DoubleQuery::setResult() {
[3731b4]167 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[2ededc2]168}
169
[7cd6e7]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
[2ededc2]182
[97ebf8]183// Atom Queries
184
[75dc28]185Dialog::AtomQuery::AtomQuery(string title, std::string _description) :
[97ebf8]186 Query(title, _description),
[75dc28]187 tmp(0)
[97ebf8]188{}
189
190Dialog::AtomQuery::~AtomQuery() {}
191
192void Dialog::AtomQuery::setResult() {
[3731b4]193 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[97ebf8]194}
195
[7cd6e7]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
[7aa000]209// Molecule Queries
210
[75dc28]211Dialog::MoleculeQuery::MoleculeQuery(string title, std::string _description) :
[a2ab15]212 Query(title, _description),
[75dc28]213 tmp(0)
[7aa000]214{}
215
216Dialog::MoleculeQuery::~MoleculeQuery() {}
217
218void Dialog::MoleculeQuery::setResult() {
[3731b4]219 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[7aa000]220}
[2ededc2]221
[7cd6e7]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
[2ededc2]235// Vector Queries
236
[75dc28]237Dialog::VectorQuery::VectorQuery(std::string title,bool _check, std::string _description) :
[a2ab15]238 Query(title, _description),
[75dc28]239 check(_check)
[7cd6e7]240{}
[2ededc2]241
242Dialog::VectorQuery::~VectorQuery()
[7cd6e7]243{}
[2ededc2]244
245void Dialog::VectorQuery::setResult() {
[3731b4]246 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[2ededc2]247}
[5a7243]248
[7cd6e7]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
[97ebf8]263// Box Queries
264
[75dc28]265Dialog::BoxQuery::BoxQuery(std::string title, std::string _description) :
266 Query(title, _description)
[8bc733]267{}
[97ebf8]268
269Dialog::BoxQuery::~BoxQuery()
[8bc733]270{}
[97ebf8]271
272void Dialog::BoxQuery::setResult() {
[3731b4]273 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[97ebf8]274}
275
[5a7243]276// Element Queries
[75dc28]277Dialog::ElementQuery::ElementQuery(std::string title, std::string _description) :
278 Query(title, _description)
[5a7243]279 {}
280
281Dialog::ElementQuery::~ElementQuery(){}
282
283void Dialog::ElementQuery::setResult(){
[3731b4]284 ValueStorage::getInstance().setCurrentValue(title.c_str(), tmp);
[5a7243]285}
[7cd6e7]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.