Changeset 6af6470 for src/UIElements
- Timestamp:
- Jun 19, 2017, 8:24:16 AM (8 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChangeBugEmailaddress, ChemicalSpaceEvaluator, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_oldresults, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
- Children:
- d8c6c7
- Parents:
- d6d2129
- git-author:
- Frederik Heber <heber@…> (03/30/17 14:37:42)
- git-committer:
- Frederik Heber <frederik.heber@…> (06/19/17 08:24:16)
- Location:
- src/UIElements
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/CommandLineUI/CommandLineDialog.hpp
rd6d2129 r6af6470 48 48 #include <boost/preprocessor/facilities/empty.hpp> 49 49 50 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 51 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = ""); 52 50 53 // iterate over all parameter query types for query declarations 51 54 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type … … 57 60 #undef SUFFIX 58 61 #endif 62 63 class VectorCommandLineQuery; 64 class VectorsCommandLineQuery; 59 65 60 66 // iterate over all parameter query types for forward declarations -
src/UIElements/CommandLineUI/Query/CommandLineQuery.hpp
rd6d2129 r6af6470 24 24 }; 25 25 26 class CommandLineDialog::VectorCommandLineQuery : public Dialog::TQuery<Vector> { 27 public: 28 VectorCommandLineQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = ""); 29 virtual ~VectorCommandLineQuery(); 30 virtual bool handle(); 31 }; 32 33 class CommandLineDialog::VectorsCommandLineQuery : public Dialog::TQuery< std::vector<Vector> > { 34 public: 35 VectorsCommandLineQuery(Parameter< std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = ""); 36 virtual ~VectorsCommandLineQuery(); 37 virtual bool handle(); 38 }; 39 26 40 /** With the following boost::preprocessor code we generate forward declarations 27 41 * of query class for all desired query types in the Qt specialization class of -
src/UIElements/Dialog.cpp
rd6d2129 r6af6470 134 134 queryEmpty(param, title, description); 135 135 }*/ 136 template <> 137 void Dialog::query<Vector>(Parameter<Vector> ¶m, const std::string title, const std::string description) 138 { 139 queryVector(param, title, description); 140 } 141 template <> 142 void Dialog::query< std::vector<Vector> >(Parameter< std::vector<Vector> > ¶m, const std::string title, const std::string description) 143 { 144 queryVectors(param, title, description); 145 } 136 146 137 147 /** With the following boost::preprocessor code we generate template -
src/UIElements/Dialog.hpp
rd6d2129 r6af6470 158 158 virtual void queryEmpty(const std::string ="", const std::string = "")=0; 159 159 160 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "")=0; 161 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = "")=0; 162 160 163 /** With the following boost::preprocessor code we generate virtual function 161 164 * definitions for all desired query types in the abstract class Dialog. … … 250 253 }; 251 254 252 253 255 template<class T> 254 256 class TQuery : public Query { … … 282 284 }; 283 285 286 // we have specialization of Vector to allow internal storing as string 287 template <> 288 void Dialog::query<Vector>(Parameter<Vector> &, const std::string, const std::string); 289 template <> 290 void Dialog::query< std::vector<Vector> >(Parameter< std::vector<Vector> > &, const std::string, const std::string); 291 292 /** Template specialization for Query<Vector> to allow internal storing of a 293 * string instead of a Vector. 294 * 295 * Because we need to evaluate the string as a possible GeometryRegistry key 296 * and we may do this only when the Action (whose options we are querying) 297 * is executed, not before. 298 */ 299 template <> 300 class Dialog::TQuery<Vector> : public Query { 301 public: 302 TQuery(Parameter<Vector> &_param, const std::string title, const std::string _description = "") : 303 Query(title, _description), param(_param) {} 304 virtual ~TQuery(){} 305 virtual bool handle()=0; 306 virtual bool isValid(){ return param.isValid(temp); } 307 virtual void setResult(){ param.set(temp); } 308 protected: 309 Vector temp; 310 Parameter<Vector> ¶m; 311 }; 312 313 template <> 314 class Dialog::TQuery< std::vector<Vector> > : public Query { 315 public: 316 TQuery(Parameter< std::vector<Vector> > &_param, const std::string title, const std::string _description = "") : 317 Query(title, _description), param(_param) {} 318 virtual ~TQuery(){} 319 virtual bool handle()=0; 320 virtual bool isValid(){ return param.isValid(temp); } 321 virtual void setResult(){ param.set(temp); } 322 protected: 323 std::vector<Vector> temp; 324 Parameter< std::vector<Vector> > ¶m; 325 }; 326 327 284 328 #endif /* DIALOG_HPP_ */ -
src/UIElements/GlobalListOfParameterQueries.hpp
rd6d2129 r6af6470 28 28 (Molecule) \ 29 29 (Molecules) \ 30 (Vector) \31 (Vectors) \32 30 (RealSpaceMatrix) \ 33 31 (Element) \ … … 52 50 (const molecule *) \ 53 51 (std::vector<const molecule *> ) \ 54 (Vector) \55 (std::vector<Vector> ) \56 52 (RealSpaceMatrix) \ 57 53 (const element *) \ -
src/UIElements/Qt4/QtDialog.hpp
rd6d2129 r6af6470 36 36 virtual void queryEmpty(const std::string ="", const std::string = ""); 37 37 38 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 39 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = ""); 40 38 41 /** With the following boost::preprocessor code we generate virtual function 39 42 * definitions for all desired query types in the abstract class Dialog. … … 64 67 65 68 class EmptyQtQuery; 69 70 class VectorQtQuery; 71 class VectorsQtQuery; 66 72 67 73 /** With the following boost::preprocessor code we generate forward declarations -
src/UIElements/Qt4/Query/QtQueryList.hpp
rd6d2129 r6af6470 100 100 std::vector<T> &tempRef; 101 101 Parameter<T> *subParam; 102 }; 103 104 template<> 105 class QtQueryList<Vector> : public QtQueryListUntyped { 106 public: 107 QtQueryList(Parameter<std::vector<Vector> > &parentParam, QBoxLayout *parent, Dialog *_dialog, std::vector<Vector> &_temp) : QtQueryListUntyped(parent, _dialog), tempRef(_temp) 108 { 109 // do we have an STLVectorValidator? 110 Validator<std::vector<Vector> > *val = &parentParam.getValidator(); 111 STLVectorValidator<std::vector<Vector> > *vector_val = NULL; 112 113 // might be hidden inside an And_Validator 114 And_Validator<std::vector<Vector> > * and_val = dynamic_cast<And_Validator<std::vector<Vector> > *>(val); 115 if (and_val){ 116 if (dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getA())) 117 vector_val = dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getA()); 118 else if (dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getB())) 119 vector_val = dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(and_val->getB()); 120 }else{ 121 vector_val = dynamic_cast<STLVectorValidator<std::vector<Vector> > *>(val); 122 } 123 124 if (vector_val){ 125 // if so, try to use its ElementwiseValidator 126 subParam = new Parameter<Vector>("sub-param", *(vector_val->getElementwiseValidator())); 127 }else{ 128 subParam = new Parameter<Vector>("sub-param"); 129 } 130 } 131 virtual ~QtQueryList() 132 { 133 delete(subParam); 134 } 135 136 void addElement() { 137 // add item to both 138 addElementToListWidget(subParam->getAsString()); 139 tempRef.push_back(subParam->get()); 140 onUpdate(); 141 } 142 void removeElements() 143 { 144 std::vector<int> rows = getSelectedRows(); 145 removeSelectedRows(rows); 146 for (int i = rows.size() - 1; i >= 0; i --){ 147 ASSERT((size_t)(rows[i]) < tempRef.size(), "QtQueryList<Vector>::removeElements() trying to remove invalid element."); 148 tempRef.erase(tempRef.begin() + rows[i]); 149 } 150 onUpdate(); 151 } 152 protected: 153 std::vector<Vector> &tempRef; 154 Parameter<Vector> *subParam; 102 155 }; 103 156 -
src/UIElements/TextUI/Query/TextQuery.hpp
rd6d2129 r6af6470 24 24 }; 25 25 26 class TextDialog::VectorTextQuery : public Dialog::TQuery<Vector> { 27 public: 28 VectorTextQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = ""); 29 virtual ~VectorTextQuery(); 30 virtual bool handle(); 31 }; 32 33 class TextDialog::VectorsTextQuery : public Dialog::TQuery< std::vector<Vector> > { 34 public: 35 VectorsTextQuery(Parameter< std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = ""); 36 virtual ~VectorsTextQuery(); 37 virtual bool handle(); 38 }; 26 39 27 40 /** With the following boost::preprocessor code we generate forward declarations -
src/UIElements/TextUI/TextDialog.hpp
rd6d2129 r6af6470 34 34 virtual void queryEmpty(const std::string ="", const std::string = ""); 35 35 36 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 37 virtual void queryVectors(Parameter< std::vector<Vector> > &, const std::string ="", const std::string = ""); 38 36 39 /** With the following boost::preprocessor code we generate virtual function 37 40 * definitions for all desired query types in the abstract class Dialog. … … 59 62 class EmptyTextQuery; 60 63 64 class VectorTextQuery; 65 class VectorsTextQuery; 66 61 67 /** With the following boost::preprocessor code we generate forward declarations 62 68 * of query class for all desired query types in the Qt specialization class of
Note:
See TracChangeset
for help on using the changeset viewer.