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