source: src/UIElements/Dialog.cpp@ 2c5765

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 2c5765 was 2c5765, checked in by Frederik Heber <heber@…>, 12 years ago

Added Query for File_s_, i.e. vector of boost::filesystem::path.

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
6 */
7
8/*
9 * Dialog.cpp
10 *
11 * Created on: Jan 5, 2010
12 * Author: crueger
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "CodePatterns/MemDebug.hpp"
21
22#include "Dialog.hpp"
23#include "Actions/ValueStorage.hpp"
24
25#include "CodePatterns/Log.hpp"
26#include "CodePatterns/Verbose.hpp"
27
28class Atom;
29class Box;
30class element;
31class RealSpaceMatrix;
32class molecule;
33class Vector;
34
35using namespace std;
36
37Dialog::Dialog()
38{
39}
40
41Dialog::~Dialog()
42{
43 list<Query*>::iterator iter;
44 for(iter=queries.begin();iter!=queries.end();iter++){
45 delete (*iter);
46 }
47}
48
49void Dialog::registerQuery(Query *query){
50 queries.push_back(query);
51}
52
53bool Dialog::display(){
54 if(checkAll()){
55 setAll();
56 return true;
57 }
58 else{
59 return false;
60 }
61}
62
63bool Dialog::checkAll(){
64 list<Query*>::iterator iter;
65 bool retval = true;
66 for(iter=queries.begin(); iter!=queries.end(); iter++){
67 retval &= (*iter)->handle();
68 // if any query fails (is canceled), we can end the handling process
69 if(!retval) {
70 ELOG(1, "The following query failed: " << (**iter).getTitle() << ".");
71 break;
72 }
73 }
74 return retval;
75}
76
77void Dialog::setAll(){
78 list<Query*>::iterator iter;
79 for(iter=queries.begin(); iter!=queries.end(); iter++) {
80 (*iter)->setResult();
81 }
82}
83
84bool Dialog::hasQueries(){
85 return queries.size();
86}
87
88template <> void Dialog::query<void *>(const char *token, std::string description)
89{
90 queryEmpty(token, description);
91}
92
93template <> void Dialog::query<bool>(const char *token, std::string description)
94{
95 queryBoolean(token, description);
96}
97
98template <> void Dialog::query<int>(const char *token, std::string description)
99{
100 queryInt(token, description);
101}
102
103template <> void Dialog::query< std::vector<int> >(const char *token, std::string description)
104{
105 queryInts(token, description);
106}
107
108template <> void Dialog::query<unsigned int>(const char *token, std::string description)
109{
110 queryUnsignedInt(token, description);
111}
112
113template <> void Dialog::query< std::vector<unsigned int> >(const char *token, std::string description)
114{
115 queryUnsignedInts(token, description);
116}
117
118template <> void Dialog::query<double>(const char *token, std::string description)
119{
120 queryDouble(token, description);
121}
122
123template <> void Dialog::query< std::vector<double> >(const char *token, std::string description)
124{
125 queryDoubles(token, description);
126}
127
128template <> void Dialog::query<std::string>(const char *token, std::string description)
129{
130 queryString(token, description);
131}
132
133template <> void Dialog::query< std::vector<std::string> >(const char *token, std::string description)
134{
135 queryStrings(token, description);
136}
137
138template <> void Dialog::query<const atom *>(const char *token, std::string description)
139{
140 queryAtom(token, description);
141}
142
143template <> void Dialog::query< std::vector<const atom *> >(const char *token, std::string description)
144{
145 queryAtoms(token, description);
146}
147
148template <> void Dialog::query<const molecule *>(const char *token, std::string description)
149{
150 queryMolecule(token, description);
151}
152
153template <> void Dialog::query< std::vector<const molecule *> >(const char *token, std::string description)
154{
155 queryMolecules(token, description);
156}
157
158template <> void Dialog::query<Vector>(const char *token, std::string description)
159{
160 queryVector(token, false, description);
161}
162
163template <> void Dialog::query< std::vector<Vector> >(const char *token, std::string description)
164{
165 queryVectors(token, false, description);
166}
167
168template <> void Dialog::query<BoxVector>(const char *token, std::string description)
169{
170 queryVector(token, true, description);
171}
172
173template <> void Dialog::query< std::vector<BoxVector> >(const char *token, std::string description)
174{
175 queryVectors(token, true, description);
176}
177
178template <> void Dialog::query<Box>(const char *token, std::string description)
179{
180 queryBox(token, description);
181}
182
183template <> void Dialog::query<const element *>(const char *token, std::string description)
184{
185 queryElement(token, description);
186}
187
188template <> void Dialog::query< std::vector<const element *> >(const char *token, std::string description)
189{
190 queryElements(token, description);
191}
192
193template <> void Dialog::query< boost::filesystem::path >(const char *token, std::string description)
194{
195 queryFile(token, description);
196}
197
198template <> void Dialog::query< std::vector<boost::filesystem::path> >(const char *token, std::string description)
199{
200 queryFiles(token, description);
201}
202
203template <> void Dialog::query< RandomNumberDistribution_Parameters >(const char *token, std::string description)
204{
205 queryRandomNumberDistribution_Parameters(token, description);
206}
207
208/************************** Query Infrastructure ************************/
209/* ---> shifted to folder Query */
210/************************************************************************/
Note: See TracBrowser for help on using the repository browser.