| [d3a5ea] | 1 | /* | 
|---|
| [4cf323d] | 2 | * QtDialog.hpp | 
|---|
| [d3a5ea] | 3 | * | 
|---|
|  | 4 | *  Created on: Jan 18, 2010 | 
|---|
|  | 5 | *      Author: crueger | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | #ifndef QTDIALOG_HPP_ | 
|---|
|  | 9 | #define QTDIALOG_HPP_ | 
|---|
|  | 10 |  | 
|---|
| [56f73b] | 11 | // include config.h | 
|---|
|  | 12 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 13 | #include <config.h> | 
|---|
|  | 14 | #endif | 
|---|
|  | 15 |  | 
|---|
| [454b555] | 16 | #include <QtCore/QObject> | 
|---|
| [56f73b] | 17 |  | 
|---|
| [f10b0c] | 18 | #include "Parameters/Parameter.hpp" | 
|---|
| [d3a5ea] | 19 | #include "UIElements/Dialog.hpp" | 
|---|
| [cef1d7] | 20 | #include <QtGui/QDialog> | 
|---|
| [d3a5ea] | 21 |  | 
|---|
| [c96c66] | 22 | #include <map> | 
|---|
|  | 23 | #include <set> | 
|---|
|  | 24 | #include <vector> | 
|---|
|  | 25 |  | 
|---|
| [d3a5ea] | 26 | class QBoxLayout; | 
|---|
|  | 27 | class QDialogButtonBox; | 
|---|
|  | 28 |  | 
|---|
| [4cf323d] | 29 | class QtDialog : public QDialog, public Dialog | 
|---|
| [d3a5ea] | 30 | { | 
|---|
|  | 31 | Q_OBJECT | 
|---|
|  | 32 | public: | 
|---|
| [163110] | 33 | QtDialog(const std::string &_title); | 
|---|
| [4cf323d] | 34 | virtual ~QtDialog(); | 
|---|
| [d3a5ea] | 35 |  | 
|---|
| [f130d4] | 36 | virtual void queryEmpty(const std::string ="", const std::string = ""); | 
|---|
| [37a67f] | 37 |  | 
|---|
| [6af6470] | 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 |  | 
|---|
| [37a67f] | 41 | /** With the following boost::preprocessor code we generate virtual function | 
|---|
|  | 42 | * definitions for all desired query types in the abstract class Dialog. | 
|---|
|  | 43 | */ | 
|---|
|  | 44 | #include "UIElements/GlobalListOfParameterQueries.hpp" | 
|---|
|  | 45 | #include "UIElements/Dialog_impl_pre.hpp" | 
|---|
|  | 46 |  | 
|---|
|  | 47 | #include <boost/preprocessor/facilities/empty.hpp> | 
|---|
|  | 48 |  | 
|---|
|  | 49 | // iterate over all parameter query types | 
|---|
|  | 50 | #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type | 
|---|
|  | 51 | #define SUFFIX BOOST_PP_EMPTY() | 
|---|
|  | 52 | #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type) | 
|---|
|  | 53 | #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1) | 
|---|
|  | 54 | #include BOOST_PP_LOCAL_ITERATE() | 
|---|
|  | 55 | #undef dialog_declaration | 
|---|
|  | 56 | #undef SUFFIX | 
|---|
|  | 57 | #endif | 
|---|
|  | 58 |  | 
|---|
|  | 59 | #include "Dialog_impl_undef.hpp" | 
|---|
|  | 60 | /* End of preprocessor code piece */ | 
|---|
| [d3a5ea] | 61 |  | 
|---|
|  | 62 | virtual bool display(); | 
|---|
|  | 63 |  | 
|---|
|  | 64 | virtual void update(); | 
|---|
|  | 65 |  | 
|---|
|  | 66 | protected: | 
|---|
| [37a67f] | 67 |  | 
|---|
| [308aa4] | 68 | class EmptyQtQuery; | 
|---|
| [37a67f] | 69 |  | 
|---|
| [6af6470] | 70 | class VectorQtQuery; | 
|---|
|  | 71 | class VectorsQtQuery; | 
|---|
|  | 72 |  | 
|---|
| [37a67f] | 73 | /** With the following boost::preprocessor code we generate forward declarations | 
|---|
|  | 74 | * of query class for all desired query types in the Qt specialization class of | 
|---|
|  | 75 | * Dialog. | 
|---|
|  | 76 | */ | 
|---|
|  | 77 | #include "UIElements/GlobalListOfParameterQueries.hpp" | 
|---|
|  | 78 | #include "UIElements/Dialog_impl_pre.hpp" | 
|---|
|  | 79 |  | 
|---|
|  | 80 | #include <boost/preprocessor/facilities/empty.hpp> | 
|---|
|  | 81 |  | 
|---|
|  | 82 | // iterate over all parameter query types for forward declarations | 
|---|
|  | 83 | #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type | 
|---|
|  | 84 | #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, QtQuery) | 
|---|
|  | 85 | #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMETERTOKENS-1) | 
|---|
|  | 86 | #include BOOST_PP_LOCAL_ITERATE() | 
|---|
|  | 87 | #undef forward_declaration | 
|---|
|  | 88 | #endif | 
|---|
|  | 89 |  | 
|---|
|  | 90 | #include "Dialog_impl_undef.hpp" | 
|---|
|  | 91 | /* End of preprocessor code piece */ | 
|---|
| [6f5dfe] | 92 |  | 
|---|
| [d3a5ea] | 93 | private: | 
|---|
|  | 94 | QBoxLayout *mainLayout; | 
|---|
|  | 95 | QBoxLayout *inputLayout; | 
|---|
|  | 96 | QBoxLayout *buttonLayout; | 
|---|
|  | 97 | QDialogButtonBox *buttons; | 
|---|
|  | 98 | }; | 
|---|
|  | 99 |  | 
|---|
| [6f5dfe] | 100 |  | 
|---|
| [d3a5ea] | 101 | #endif /* QTDIALOG_HPP_ */ | 
|---|