| 1 | /*
|
|---|
| 2 | * QtDialog.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 18, 2010
|
|---|
| 5 | * Author: crueger
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef QTDIALOG_HPP_
|
|---|
| 9 | #define QTDIALOG_HPP_
|
|---|
| 10 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #include <QObject>
|
|---|
| 17 |
|
|---|
| 18 | #include "Parameters/Parameter.hpp"
|
|---|
| 19 | #include "UIElements/Dialog.hpp"
|
|---|
| 20 | #include <QtGui/QDialog>
|
|---|
| 21 |
|
|---|
| 22 | #include <map>
|
|---|
| 23 | #include <set>
|
|---|
| 24 | #include <vector>
|
|---|
| 25 |
|
|---|
| 26 | class QBoxLayout;
|
|---|
| 27 | class QDialogButtonBox;
|
|---|
| 28 |
|
|---|
| 29 | class QtDialog : public QDialog, public Dialog
|
|---|
| 30 | {
|
|---|
| 31 | Q_OBJECT
|
|---|
| 32 | public:
|
|---|
| 33 | QtDialog(const std::string &_title);
|
|---|
| 34 | virtual ~QtDialog();
|
|---|
| 35 |
|
|---|
| 36 | virtual void queryEmpty(const std::string ="", const std::string = "");
|
|---|
| 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 |
|
|---|
| 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 */
|
|---|
| 61 |
|
|---|
| 62 | virtual bool display();
|
|---|
| 63 |
|
|---|
| 64 | virtual void update();
|
|---|
| 65 |
|
|---|
| 66 | protected:
|
|---|
| 67 |
|
|---|
| 68 | class EmptyQtQuery;
|
|---|
| 69 |
|
|---|
| 70 | class VectorQtQuery;
|
|---|
| 71 | class VectorsQtQuery;
|
|---|
| 72 |
|
|---|
| 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 */
|
|---|
| 92 |
|
|---|
| 93 | private:
|
|---|
| 94 | QBoxLayout *mainLayout;
|
|---|
| 95 | QBoxLayout *inputLayout;
|
|---|
| 96 | QBoxLayout *buttonLayout;
|
|---|
| 97 | QDialogButtonBox *buttons;
|
|---|
| 98 | };
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 | #endif /* QTDIALOG_HPP_ */
|
|---|