[d3a5ea] | 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 "UIElements/Dialog.hpp"
|
---|
[cef1d7] | 12 | #include <QtGui/QDialog>
|
---|
[d3a5ea] | 13 |
|
---|
| 14 | class QBoxLayout;
|
---|
| 15 | class QLabel;
|
---|
| 16 | class QSpinBox;
|
---|
[b8d1aeb] | 17 | class QDoubleSpinBox;
|
---|
[d3a5ea] | 18 | class QLineEdit;
|
---|
| 19 | class QComboBox;
|
---|
| 20 | class QDialogButtonBox;
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 | // Forward declarations for plumbing
|
---|
| 24 | class StringQTQueryPipe;
|
---|
| 25 | class IntQTQueryPipe;
|
---|
[b8d1aeb] | 26 | class DoubleQTQueryPipe;
|
---|
[d3a5ea] | 27 | class MoleculeQTQueryPipe;
|
---|
[cbf01e] | 28 | class ElementQTQueryPipe;
|
---|
[d3a5ea] | 29 |
|
---|
| 30 | class QTDialog : public QDialog, public Dialog
|
---|
| 31 | {
|
---|
| 32 | Q_OBJECT
|
---|
| 33 | public:
|
---|
| 34 | QTDialog();
|
---|
| 35 | virtual ~QTDialog();
|
---|
| 36 |
|
---|
[257c77] | 37 | virtual void queryEmpty(const char*, std::string);
|
---|
| 38 | virtual void queryBoolean(const char *, bool *, std::string = "");
|
---|
| 39 | virtual void queryInt(const char *, int *,std::string = "");
|
---|
| 40 | virtual void queryDouble(const char*,double *,std::string = "");
|
---|
| 41 | virtual void queryString(const char*, std::string *,std::string = "");
|
---|
| 42 | virtual void queryAtom(const char*,atom**,std::string = "");
|
---|
| 43 | virtual void queryMolecule(const char*,molecule**,std::string = "");
|
---|
[5ec8e3] | 44 | virtual void queryVector(const char*,Vector *,bool,std::string = "");
|
---|
| 45 | virtual void queryBox(const char*,Box*, std::string = "");
|
---|
[257c77] | 46 | virtual void queryElement(const char*,std::vector<element *> *_target,std::string = "");
|
---|
[d3a5ea] | 47 |
|
---|
| 48 | virtual bool display();
|
---|
| 49 |
|
---|
| 50 | virtual void update();
|
---|
| 51 |
|
---|
| 52 | protected:
|
---|
| 53 | class IntQTQuery : public Dialog::IntQuery {
|
---|
| 54 | public:
|
---|
| 55 | IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog);
|
---|
[cbf01e] | 56 | virtual ~IntQTQuery();
|
---|
[d3a5ea] | 57 | virtual bool handle();
|
---|
| 58 | private:
|
---|
| 59 | QBoxLayout *parent;
|
---|
| 60 | QBoxLayout *thisLayout;
|
---|
| 61 | QLabel *titleLabel;
|
---|
| 62 | QSpinBox *inputBox;
|
---|
| 63 |
|
---|
| 64 | IntQTQueryPipe *pipe;
|
---|
| 65 | };
|
---|
| 66 |
|
---|
[b8d1aeb] | 67 | class DoubleQTQuery : public Dialog::DoubleQuery {
|
---|
| 68 | public:
|
---|
| 69 | DoubleQTQuery(std::string title, double *_target,QBoxLayout *_parent,QTDialog *_dialog);
|
---|
[cbf01e] | 70 | virtual ~DoubleQTQuery();
|
---|
[b8d1aeb] | 71 | virtual bool handle();
|
---|
| 72 | private:
|
---|
| 73 | QBoxLayout *parent;
|
---|
| 74 | QBoxLayout *thisLayout;
|
---|
| 75 | QLabel *titleLabel;
|
---|
| 76 | QDoubleSpinBox *inputBox;
|
---|
| 77 |
|
---|
| 78 | DoubleQTQueryPipe *pipe;
|
---|
| 79 | };
|
---|
| 80 |
|
---|
[d3a5ea] | 81 | class StringQTQuery : public Dialog::StringQuery {
|
---|
| 82 | public:
|
---|
| 83 | StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog);
|
---|
[cbf01e] | 84 | virtual ~StringQTQuery();
|
---|
[d3a5ea] | 85 | virtual bool handle();
|
---|
| 86 | private:
|
---|
| 87 | QBoxLayout *parent;
|
---|
| 88 | QBoxLayout *thisLayout;
|
---|
| 89 | QLabel *titleLabel;
|
---|
| 90 | QLineEdit *inputBox;
|
---|
| 91 |
|
---|
| 92 | StringQTQueryPipe *pipe;
|
---|
| 93 | };
|
---|
| 94 |
|
---|
| 95 | class MoleculeQTQuery : public Dialog::MoleculeQuery {
|
---|
| 96 | public:
|
---|
[257c77] | 97 | MoleculeQTQuery(std::string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog);
|
---|
[cbf01e] | 98 | virtual ~MoleculeQTQuery();
|
---|
[d3a5ea] | 99 | virtual bool handle();
|
---|
| 100 | private:
|
---|
| 101 | QBoxLayout *parent;
|
---|
| 102 | QBoxLayout *thisLayout;
|
---|
| 103 | QLabel *titleLabel;
|
---|
| 104 | QComboBox *inputBox;
|
---|
| 105 |
|
---|
| 106 | MoleculeQTQueryPipe *pipe;
|
---|
| 107 | };
|
---|
| 108 |
|
---|
[b8d1aeb] | 109 | class VectorQTQuery : public Dialog::VectorQuery {
|
---|
| 110 | public:
|
---|
[5ec8e3] | 111 | VectorQTQuery(std::string title,Vector *_target,bool _check,QBoxLayout *,QTDialog *);
|
---|
[cbf01e] | 112 | virtual ~VectorQTQuery();
|
---|
[b8d1aeb] | 113 | virtual bool handle();
|
---|
| 114 | private:
|
---|
| 115 | QBoxLayout *parent;
|
---|
| 116 | QBoxLayout *mainLayout;
|
---|
| 117 | QLabel *titleLabel;
|
---|
| 118 | QBoxLayout *subLayout;
|
---|
| 119 | QBoxLayout *coordLayout[3];
|
---|
| 120 | QLabel *coordLabel[3];
|
---|
| 121 | QDoubleSpinBox *coordInput[3];
|
---|
| 122 |
|
---|
| 123 | DoubleQTQueryPipe *pipe[3];
|
---|
| 124 | };
|
---|
| 125 |
|
---|
[cbf01e] | 126 | class ElementQTQuery : public Dialog::ElementQuery {
|
---|
| 127 | public:
|
---|
[257c77] | 128 | ElementQTQuery(std::string _title, std::vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog);
|
---|
[cbf01e] | 129 | virtual ~ElementQTQuery();
|
---|
| 130 | virtual bool handle();
|
---|
| 131 | private:
|
---|
| 132 | QBoxLayout *parent;
|
---|
| 133 | QBoxLayout *thisLayout;
|
---|
| 134 | QLabel *titleLabel;
|
---|
| 135 | QComboBox *inputBox;
|
---|
| 136 |
|
---|
| 137 | ElementQTQueryPipe *pipe;
|
---|
| 138 | };
|
---|
| 139 |
|
---|
[d3a5ea] | 140 | private:
|
---|
| 141 | QBoxLayout *mainLayout;
|
---|
| 142 | QBoxLayout *inputLayout;
|
---|
| 143 | QBoxLayout *buttonLayout;
|
---|
| 144 | QDialogButtonBox *buttons;
|
---|
| 145 | };
|
---|
| 146 |
|
---|
| 147 | // All kinds of plumbing for Queries
|
---|
| 148 | // Plumbing needs to be outside of the class where it is needed,
|
---|
| 149 | // since MOC doesn't like nested classes
|
---|
| 150 |
|
---|
| 151 | class StringQTQueryPipe : public QWidget {
|
---|
| 152 | Q_OBJECT
|
---|
| 153 | public:
|
---|
| 154 | StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
|
---|
[cbf01e] | 155 | virtual ~StringQTQueryPipe();
|
---|
[d3a5ea] | 156 |
|
---|
| 157 | public slots:
|
---|
| 158 | void update(const QString&);
|
---|
| 159 |
|
---|
| 160 | private:
|
---|
| 161 | std::string *content;
|
---|
| 162 | QTDialog *dialog;
|
---|
| 163 |
|
---|
| 164 | };
|
---|
| 165 |
|
---|
| 166 | class IntQTQueryPipe : public QWidget {
|
---|
| 167 | Q_OBJECT
|
---|
| 168 | public:
|
---|
| 169 | IntQTQueryPipe(int *_content, QTDialog *_dialog);
|
---|
[cbf01e] | 170 | virtual ~IntQTQueryPipe();
|
---|
[d3a5ea] | 171 |
|
---|
| 172 | public slots:
|
---|
| 173 | void update(int);
|
---|
| 174 |
|
---|
| 175 | private:
|
---|
| 176 | int *content;
|
---|
| 177 | QTDialog *dialog;
|
---|
| 178 |
|
---|
| 179 | };
|
---|
| 180 |
|
---|
[b8d1aeb] | 181 | class DoubleQTQueryPipe : public QWidget {
|
---|
| 182 | Q_OBJECT
|
---|
| 183 | public:
|
---|
| 184 | DoubleQTQueryPipe(double *_content, QTDialog *_dialog);
|
---|
[cbf01e] | 185 | virtual ~DoubleQTQueryPipe();
|
---|
[b8d1aeb] | 186 |
|
---|
| 187 | public slots:
|
---|
| 188 | void update(double);
|
---|
| 189 |
|
---|
| 190 | private:
|
---|
| 191 | double *content;
|
---|
| 192 | QTDialog *dialog;
|
---|
| 193 |
|
---|
| 194 | };
|
---|
[d3a5ea] | 195 |
|
---|
| 196 | class MoleculeQTQueryPipe : public QWidget {
|
---|
| 197 | Q_OBJECT
|
---|
| 198 | public:
|
---|
[257c77] | 199 | MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox);
|
---|
[cbf01e] | 200 | virtual ~MoleculeQTQueryPipe();
|
---|
[d3a5ea] | 201 |
|
---|
| 202 | public slots:
|
---|
| 203 | void update(int);
|
---|
| 204 |
|
---|
| 205 | private:
|
---|
| 206 | molecule **content;
|
---|
| 207 | QTDialog *dialog;
|
---|
| 208 | QComboBox *theBox;
|
---|
| 209 |
|
---|
| 210 | };
|
---|
[cbf01e] | 211 |
|
---|
| 212 | class ElementQTQueryPipe : public QWidget {
|
---|
| 213 | Q_OBJECT
|
---|
| 214 | public:
|
---|
[257c77] | 215 | ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox);
|
---|
[cbf01e] | 216 | virtual ~ElementQTQueryPipe();
|
---|
| 217 |
|
---|
| 218 | public slots:
|
---|
| 219 | void update(int);
|
---|
| 220 |
|
---|
| 221 | private:
|
---|
[257c77] | 222 | std::vector<element *> *content;
|
---|
[cbf01e] | 223 | QTDialog *dialog;
|
---|
| 224 | QComboBox *theBox;
|
---|
| 225 | };
|
---|
[d3a5ea] | 226 | #endif /* QTDIALOG_HPP_ */
|
---|