Changes in src/UIElements/Dialog.hpp [9ee38b:4cf323d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Dialog.hpp
r9ee38b r4cf323d 13 13 #include<vector> 14 14 15 #include <boost/filesystem.hpp> 16 15 17 #include "Box.hpp" 16 18 #include "LinearAlgebra/Vector.hpp" … … 24 26 /** Dialog is one of the two main classes of the UIFactory base class. 25 27 * 26 * The Dialog is meant for asking the user for information needed to perform actions he27 * desires, such as asking for a position in space or a length.28 * The Dialog is meant for asking the user for information needed to perform 29 * actions he desires, such as asking for a position in space or a length. 28 30 * 29 * For this purpose there is the base class Query and numerous specializations for each30 * of the types to be asked. There are primitives integer, doubles and string, but also31 * advanced types such as element, molecule or Vector. There is also an empty query for32 * displaying text.31 * For this purpose there is the base class Query and numerous specializations 32 * for each of the types to be asked. There are primitives integer, doubles and 33 * string, but also advanced types such as element, molecule or Vector. There 34 * is also an empty query for displaying text. 33 35 */ 34 36 class Dialog … … 57 59 virtual void queryElement(const char*, std::string = "")=0; 58 60 virtual void queryElements(const char*, std::string = "")=0; 61 virtual void queryFile(const char*, std::string = "")=0; 59 62 60 63 virtual bool display(); … … 76 79 //due to lack of common code for query types as well as GUI-Types (all subtypes differ a lot) 77 80 78 //base class for all queries 81 /** Base class for all queries. 82 * 83 * 84 * <h1>How to add another query?</h1> 85 * 86 * Let's say we want to query for a type called \a Value. 87 * 88 * Then, we do the following: 89 * -# Add a class ValueQuery inside class Dialog, the class contains 90 * -# constructor/destructor (latter virtual! because of derived class) 91 * -# virtual bool handle() and virtual void setResult() 92 * -# a protected member tmp of type Value (NOTE: herein the result is stored) 93 * -# if temporaries for conversion are needed put them in here 94 * -# add a function queryValue 95 * -# now, for each of the GUIs we basically have to repeat the above, i.e. 96 * add the class and the function that implement the virtual ones above. 97 * -# QT: an extra class called ValueQtQueryPipe that actually handles 98 * showing dialogs to obtain the value and placing it into the \a tmp 99 * variable (via a given pointer to it as reference). handle() will 100 * simply return true. This is needed because of a restriction of Qt4: 101 * its meta-object-compiler does not like nested classes. 102 * -# CommandLine: nothing special, handle() imports value from \a 103 * CommandLineParser and sets the tmp variable. 104 * -# Text: nothing special, handle() queries the user and sets the tmp 105 * variable 106 */ 79 107 class Query { 80 108 friend class Dialog; … … 271 299 }; 272 300 301 class FileQuery : public Query { 302 public: 303 FileQuery(std::string title, std::string _description = ""); 304 virtual ~FileQuery(); 305 virtual bool handle()=0; 306 virtual void setResult(); 307 protected: 308 boost::filesystem::path tmp; 309 }; 310 273 311 void registerQuery(Query* query); 274 312
Note:
See TracChangeset
for help on using the changeset viewer.