[308aa4] | 1 | /*
|
---|
| 2 | * QtQuery.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Nov 8, 2010
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef QTQUERY_HPP_
|
---|
| 9 | #define QTQUERY_HPP_
|
---|
| 10 |
|
---|
[56f73b] | 11 | // include config.h
|
---|
| 12 | #ifdef HAVE_CONFIG_H
|
---|
| 13 | #include <config.h>
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 |
|
---|
[308aa4] | 17 | #include "Qt4/QtDialog.hpp"
|
---|
[f10b0c] | 18 | #include "Parameters/Parameter.hpp"
|
---|
[308aa4] | 19 |
|
---|
[0275ad] | 20 | class QHBoxLayout;
|
---|
[a5ddf0] | 21 | class QBoxLayout;
|
---|
| 22 | class QDialogButtonBox;
|
---|
| 23 | class QLabel;
|
---|
| 24 | class QSpinBox;
|
---|
| 25 | class QDoubleSpinBox;
|
---|
| 26 | class QLineEdit;
|
---|
| 27 | class QListWidget;
|
---|
[0275ad] | 28 | class QPushButton;
|
---|
[a5ddf0] | 29 | class QTableWidget;
|
---|
[0275ad] | 30 | class QTextEdit;
|
---|
[a5ddf0] | 31 | class QComboBox;
|
---|
[85b112] | 32 | class QCheckBox;
|
---|
[a5ddf0] | 33 |
|
---|
[308aa4] | 34 | // Forward declarations for plumbing
|
---|
| 35 | template<typename T> class QtQueryListPipe;
|
---|
[a5ddf0] | 36 | class AtomQtQueryPipe;
|
---|
| 37 | class AtomsQtQueryPipe;
|
---|
[308aa4] | 38 | class BooleanQtQueryPipe;
|
---|
| 39 | class BoxQtQueryPipe;
|
---|
| 40 | class DoubleQtQueryPipe;
|
---|
| 41 | class DoublesQtQueryPipe;
|
---|
| 42 | class ElementQtQueryPipe;
|
---|
| 43 | class ElementsQtQueryPipe;
|
---|
[a5ddf0] | 44 | class EmptyQtQueryPipe;
|
---|
| 45 | class FileQtQueryPipe;
|
---|
| 46 | class IntQtQueryPipe;
|
---|
| 47 | class MoleculeQtQueryPipe;
|
---|
| 48 | class MoleculesQtQueryPipe;
|
---|
| 49 | class StringQtQueryPipe;
|
---|
| 50 | class StringsQtQueryPipe;
|
---|
[838cd0] | 51 | class UnsignedIntQtQueryPipe;
|
---|
[12948c] | 52 | class UnsignedIntsQtQueryPipe;
|
---|
[308aa4] | 53 | class VectorQtQueryPipe;
|
---|
| 54 | class VectorsQtQueryPipe;
|
---|
[0275ad] | 55 | class RandomNumberDistribution_ParametersQtQueryPipe;
|
---|
[308aa4] | 56 |
|
---|
| 57 | class QtDialog::AtomQtQuery : public Dialog::AtomQuery {
|
---|
| 58 | public:
|
---|
[f10b0c] | 59 | AtomQtQuery(Parameter<const atom *> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 60 | virtual ~AtomQtQuery();
|
---|
| 61 | virtual bool handle();
|
---|
| 62 | private:
|
---|
| 63 | QBoxLayout *parent;
|
---|
| 64 | QBoxLayout *thisLayout;
|
---|
| 65 | QLabel *titleLabel;
|
---|
| 66 | QComboBox *inputBox;
|
---|
| 67 |
|
---|
| 68 | AtomQtQueryPipe *pipe;
|
---|
| 69 | };
|
---|
| 70 |
|
---|
| 71 | class QtDialog::AtomsQtQuery : public Dialog::AtomsQuery {
|
---|
| 72 | public:
|
---|
[f10b0c] | 73 | AtomsQtQuery(Parameter<std::vector<const atom *> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 74 | virtual ~AtomsQtQuery();
|
---|
| 75 | virtual bool handle();
|
---|
| 76 | private:
|
---|
| 77 | QBoxLayout *parent;
|
---|
| 78 | QBoxLayout *thisLayout;
|
---|
| 79 | QLabel *titleLabel;
|
---|
| 80 | QLabel *inputLabel;
|
---|
| 81 | QListWidget *inputList;
|
---|
| 82 |
|
---|
| 83 | AtomsQtQueryPipe *pipe;
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | class QtDialog::BooleanQtQuery : public Dialog::BooleanQuery {
|
---|
| 87 | public:
|
---|
[f10b0c] | 88 | BooleanQtQuery(Parameter<bool> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
[308aa4] | 89 | virtual ~BooleanQtQuery();
|
---|
| 90 | virtual bool handle();
|
---|
| 91 | private:
|
---|
| 92 | QBoxLayout *parent;
|
---|
| 93 | QBoxLayout *thisLayout;
|
---|
| 94 | QLabel *titleLabel;
|
---|
[85b112] | 95 | QCheckBox *booleanCheckBox;
|
---|
[308aa4] | 96 |
|
---|
| 97 | BooleanQtQueryPipe *pipe;
|
---|
| 98 | };
|
---|
| 99 |
|
---|
| 100 | class QtDialog::BoxQtQuery : public Dialog::BoxQuery {
|
---|
| 101 | public:
|
---|
[f10b0c] | 102 | BoxQtQuery(Parameter<Box> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 103 | virtual ~BoxQtQuery();
|
---|
| 104 | virtual bool handle();
|
---|
| 105 | private:
|
---|
| 106 | QBoxLayout *parent;
|
---|
| 107 | QBoxLayout *thisLayout;
|
---|
| 108 | QLabel *titleLabel;
|
---|
| 109 | QTableWidget *inputTable;
|
---|
| 110 |
|
---|
| 111 | BoxQtQueryPipe *pipe;
|
---|
| 112 | };
|
---|
| 113 |
|
---|
| 114 | class QtDialog::DoubleQtQuery : public Dialog::DoubleQuery {
|
---|
| 115 | public:
|
---|
[f10b0c] | 116 | DoubleQtQuery(Parameter<double> &, std::string title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 117 | virtual ~DoubleQtQuery();
|
---|
| 118 | virtual bool handle();
|
---|
| 119 | private:
|
---|
| 120 | QBoxLayout *parent;
|
---|
| 121 | QBoxLayout *thisLayout;
|
---|
| 122 | QLabel *titleLabel;
|
---|
| 123 | QDoubleSpinBox *inputBox;
|
---|
| 124 |
|
---|
| 125 | DoubleQtQueryPipe *pipe;
|
---|
| 126 | };
|
---|
| 127 |
|
---|
| 128 | class QtDialog::DoublesQtQuery : public Dialog::DoublesQuery {
|
---|
| 129 | public:
|
---|
[f10b0c] | 130 | DoublesQtQuery(Parameter<std::vector<double> > &, std::string title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 131 | virtual ~DoublesQtQuery();
|
---|
| 132 | virtual bool handle();
|
---|
| 133 | private:
|
---|
| 134 | QBoxLayout *parent;
|
---|
| 135 | QBoxLayout *thisLayout;
|
---|
| 136 | QLabel *titleLabel;
|
---|
| 137 | QDoubleSpinBox *inputBox;
|
---|
| 138 |
|
---|
| 139 | QtQueryListPipe<double> *pipe;
|
---|
| 140 | };
|
---|
| 141 |
|
---|
| 142 | class QtDialog::ElementQtQuery : public Dialog::ElementQuery {
|
---|
| 143 | public:
|
---|
[f10b0c] | 144 | ElementQtQuery(Parameter<const element *> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
[308aa4] | 145 | virtual ~ElementQtQuery();
|
---|
| 146 | virtual bool handle();
|
---|
| 147 | private:
|
---|
| 148 | QBoxLayout *parent;
|
---|
| 149 | QBoxLayout *thisLayout;
|
---|
| 150 | QLabel *titleLabel;
|
---|
| 151 | QComboBox *inputBox;
|
---|
| 152 |
|
---|
| 153 | ElementQtQueryPipe *pipe;
|
---|
| 154 | };
|
---|
| 155 |
|
---|
| 156 | class QtDialog::ElementsQtQuery : public Dialog::ElementsQuery {
|
---|
| 157 | public:
|
---|
[f10b0c] | 158 | ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
[308aa4] | 159 | virtual ~ElementsQtQuery();
|
---|
| 160 | virtual bool handle();
|
---|
| 161 | private:
|
---|
| 162 | QBoxLayout *parent;
|
---|
| 163 | QBoxLayout *thisLayout;
|
---|
| 164 | QLabel *titleLabel;
|
---|
| 165 | QComboBox *inputBox;
|
---|
| 166 |
|
---|
| 167 | ElementsQtQueryPipe *pipe;
|
---|
| 168 | };
|
---|
| 169 |
|
---|
| 170 | class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
|
---|
| 171 | public:
|
---|
| 172 | EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
| 173 | virtual ~EmptyQtQuery();
|
---|
| 174 | virtual bool handle();
|
---|
| 175 | private:
|
---|
| 176 | QBoxLayout *parent;
|
---|
| 177 | QBoxLayout *thisLayout;
|
---|
| 178 | QLabel *titleLabel;
|
---|
| 179 |
|
---|
| 180 | EmptyQtQueryPipe *pipe;
|
---|
| 181 | };
|
---|
| 182 |
|
---|
| 183 | class QtDialog::FileQtQuery : public Dialog::FileQuery {
|
---|
| 184 | public:
|
---|
[f10b0c] | 185 | FileQtQuery(Parameter<boost::filesystem::path> &, std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
|
---|
[308aa4] | 186 | virtual ~FileQtQuery();
|
---|
| 187 | virtual bool handle();
|
---|
| 188 | private:
|
---|
| 189 | QBoxLayout *parent;
|
---|
| 190 | QBoxLayout *thisLayout;
|
---|
| 191 | QLabel *filenameLabel;
|
---|
| 192 | QLineEdit *filenameLineEdit;
|
---|
| 193 | QPushButton *filedialogButton;
|
---|
| 194 |
|
---|
| 195 | FileQtQueryPipe *pipe;
|
---|
| 196 | };
|
---|
| 197 |
|
---|
| 198 | class QtDialog::IntQtQuery : public Dialog::IntQuery {
|
---|
| 199 | public:
|
---|
[f10b0c] | 200 | IntQtQuery(Parameter<int> &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 201 | virtual ~IntQtQuery();
|
---|
| 202 | virtual bool handle();
|
---|
| 203 | private:
|
---|
| 204 | QBoxLayout *parent;
|
---|
| 205 | QBoxLayout *thisLayout;
|
---|
| 206 | QLabel *titleLabel;
|
---|
| 207 | QSpinBox *inputBox;
|
---|
| 208 |
|
---|
| 209 | IntQtQueryPipe *pipe;
|
---|
| 210 | };
|
---|
| 211 |
|
---|
| 212 | class QtDialog::IntsQtQuery : public Dialog::IntsQuery {
|
---|
| 213 | public:
|
---|
[f10b0c] | 214 | IntsQtQuery(Parameter<std::vector<int> > &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 215 | virtual ~IntsQtQuery();
|
---|
| 216 | virtual bool handle();
|
---|
| 217 | void IntegerEntered(const QString&);
|
---|
| 218 | void IntegerSelected();
|
---|
| 219 | void AddInteger();
|
---|
| 220 | void RemoveInteger();
|
---|
| 221 | private:
|
---|
| 222 | QBoxLayout *parent;
|
---|
| 223 | QBoxLayout *thisLayout;
|
---|
| 224 | QLabel *titleLabel;
|
---|
| 225 |
|
---|
| 226 | QtQueryListPipe<int> *pipe;
|
---|
| 227 | };
|
---|
| 228 |
|
---|
| 229 | class QtDialog::MoleculeQtQuery : public Dialog::MoleculeQuery {
|
---|
| 230 | public:
|
---|
[f10b0c] | 231 | MoleculeQtQuery(Parameter<const molecule *> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 232 | virtual ~MoleculeQtQuery();
|
---|
| 233 | virtual bool handle();
|
---|
| 234 | private:
|
---|
| 235 | QBoxLayout *parent;
|
---|
| 236 | QBoxLayout *thisLayout;
|
---|
| 237 | QLabel *titleLabel;
|
---|
| 238 | QComboBox *inputBox;
|
---|
| 239 |
|
---|
| 240 | MoleculeQtQueryPipe *pipe;
|
---|
| 241 | };
|
---|
| 242 |
|
---|
| 243 | class QtDialog::MoleculesQtQuery : public Dialog::MoleculesQuery {
|
---|
| 244 | public:
|
---|
[f10b0c] | 245 | MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 246 | virtual ~MoleculesQtQuery();
|
---|
| 247 | virtual bool handle();
|
---|
| 248 | private:
|
---|
| 249 | QBoxLayout *parent;
|
---|
| 250 | QBoxLayout *thisLayout;
|
---|
| 251 | QLabel *titleLabel;
|
---|
| 252 | QComboBox *inputBox;
|
---|
| 253 |
|
---|
| 254 | MoleculesQtQueryPipe *pipe;
|
---|
| 255 | };
|
---|
| 256 |
|
---|
| 257 | class QtDialog::StringQtQuery : public Dialog::StringQuery {
|
---|
| 258 | public:
|
---|
[f10b0c] | 259 | StringQtQuery(Parameter<std::string> &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 260 | virtual ~StringQtQuery();
|
---|
| 261 | virtual bool handle();
|
---|
| 262 | private:
|
---|
| 263 | QBoxLayout *parent;
|
---|
| 264 | QBoxLayout *thisLayout;
|
---|
| 265 | QLabel *titleLabel;
|
---|
| 266 | QLineEdit *inputBox;
|
---|
| 267 |
|
---|
| 268 | StringQtQueryPipe *pipe;
|
---|
| 269 | };
|
---|
| 270 |
|
---|
| 271 | class QtDialog::StringsQtQuery : public Dialog::StringsQuery {
|
---|
| 272 | public:
|
---|
[f10b0c] | 273 | StringsQtQuery(Parameter<std::vector<std::string> > &, std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[308aa4] | 274 | virtual ~StringsQtQuery();
|
---|
| 275 | virtual bool handle();
|
---|
| 276 | private:
|
---|
| 277 | QBoxLayout *parent;
|
---|
| 278 | QBoxLayout *thisLayout;
|
---|
| 279 | QLabel *titleLabel;
|
---|
| 280 | QLineEdit *inputBox;
|
---|
| 281 |
|
---|
| 282 | QtQueryListPipe<std::string> *pipe;
|
---|
| 283 | };
|
---|
| 284 |
|
---|
[838cd0] | 285 | class QtDialog::UnsignedIntQtQuery : public Dialog::UnsignedIntQuery {
|
---|
| 286 | public:
|
---|
[f10b0c] | 287 | UnsignedIntQtQuery(Parameter<unsigned int> &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[838cd0] | 288 | virtual ~UnsignedIntQtQuery();
|
---|
| 289 | virtual bool handle();
|
---|
| 290 | private:
|
---|
| 291 | QBoxLayout *parent;
|
---|
| 292 | QBoxLayout *thisLayout;
|
---|
| 293 | QLabel *titleLabel;
|
---|
| 294 | QSpinBox *inputBox;
|
---|
| 295 |
|
---|
| 296 | UnsignedIntQtQueryPipe *pipe;
|
---|
| 297 | };
|
---|
| 298 |
|
---|
[12948c] | 299 | class QtDialog::UnsignedIntsQtQuery : public Dialog::UnsignedIntsQuery {
|
---|
| 300 | public:
|
---|
[f10b0c] | 301 | UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
|
---|
[12948c] | 302 | virtual ~UnsignedIntsQtQuery();
|
---|
| 303 | virtual bool handle();
|
---|
| 304 | void IntegerEntered(const QString&);
|
---|
| 305 | void IntegerSelected();
|
---|
| 306 | void AddInteger();
|
---|
| 307 | void RemoveInteger();
|
---|
| 308 | private:
|
---|
| 309 | QBoxLayout *parent;
|
---|
| 310 | QBoxLayout *thisLayout;
|
---|
| 311 | QLabel *titleLabel;
|
---|
| 312 |
|
---|
| 313 | QtQueryListPipe<unsigned int> *pipe;
|
---|
| 314 | };
|
---|
| 315 |
|
---|
| 316 |
|
---|
[308aa4] | 317 | class QtDialog::VectorQtQuery : public Dialog::VectorQuery {
|
---|
| 318 | public:
|
---|
[f10b0c] | 319 | VectorQtQuery(Parameter<Vector> &, std::string title,bool _check,QBoxLayout *,QtDialog *);
|
---|
[308aa4] | 320 | virtual ~VectorQtQuery();
|
---|
| 321 | virtual bool handle();
|
---|
| 322 | private:
|
---|
| 323 | QBoxLayout *parent;
|
---|
| 324 | QBoxLayout *mainLayout;
|
---|
| 325 | QLabel *titleLabel;
|
---|
| 326 | QBoxLayout *subLayout;
|
---|
| 327 | QBoxLayout *coordLayout;
|
---|
| 328 | QLabel *coordLabel;
|
---|
[a14fe3] | 329 | QDoubleSpinBox *coordInputX;
|
---|
| 330 | QDoubleSpinBox *coordInputY;
|
---|
| 331 | QDoubleSpinBox *coordInputZ;
|
---|
[308aa4] | 332 |
|
---|
| 333 | VectorQtQueryPipe *pipe;
|
---|
| 334 | };
|
---|
| 335 |
|
---|
| 336 | class QtDialog::VectorsQtQuery : public Dialog::VectorsQuery {
|
---|
| 337 | public:
|
---|
[f10b0c] | 338 | VectorsQtQuery(Parameter<std::vector<Vector> > &, std::string title,bool _check,QBoxLayout *,QtDialog *);
|
---|
[308aa4] | 339 | virtual ~VectorsQtQuery();
|
---|
| 340 | virtual bool handle();
|
---|
| 341 | private:
|
---|
| 342 | QBoxLayout *parent;
|
---|
| 343 | QBoxLayout *mainLayout;
|
---|
| 344 | QLabel *titleLabel;
|
---|
| 345 | QBoxLayout *subLayout;
|
---|
| 346 | QBoxLayout *coordLayout;
|
---|
| 347 | QLabel *coordLabel;
|
---|
| 348 | QDoubleSpinBox *coordInput;
|
---|
| 349 |
|
---|
| 350 | VectorsQtQueryPipe *pipe;
|
---|
| 351 | };
|
---|
| 352 |
|
---|
[0275ad] | 353 | class QtDialog::RandomNumberDistribution_ParametersQtQuery : public Dialog::RandomNumberDistribution_ParametersQuery {
|
---|
| 354 | public:
|
---|
[f10b0c] | 355 | RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title,QBoxLayout *,QtDialog *);
|
---|
[0275ad] | 356 | virtual ~RandomNumberDistribution_ParametersQtQuery();
|
---|
| 357 | virtual bool handle();
|
---|
| 358 | private:
|
---|
| 359 | QBoxLayout *parent;
|
---|
| 360 | QHBoxLayout *thisLayout;
|
---|
| 361 | QLabel *titleLabel;
|
---|
| 362 | QTextEdit *inputBox;
|
---|
| 363 | QPushButton *okButton;
|
---|
| 364 |
|
---|
| 365 | RandomNumberDistribution_ParametersQtQueryPipe *pipe;
|
---|
| 366 | };
|
---|
| 367 |
|
---|
[308aa4] | 368 | #endif /* QTQUERY_HPP_ */
|
---|