source: src/UIElements/Dialog.cpp@ ff58f1

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 ff58f1 was bf3817, checked in by Frederik Heber <heber@…>, 15 years ago

Added ifdef HAVE_CONFIG and config.h include to each and every cpp file.

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