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