| 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 |
|
|---|
| 11 | // include config.h
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | #include <Qt/qwidget.h>
|
|---|
| 18 | #include "Qt4/QtDialog.hpp"
|
|---|
| 19 | #include "Parameters/Parameter.hpp"
|
|---|
| 20 | #include "QtQueryList.hpp"
|
|---|
| 21 |
|
|---|
| 22 | class QHBoxLayout;
|
|---|
| 23 | class QBoxLayout;
|
|---|
| 24 | class QDialogButtonBox;
|
|---|
| 25 | class QLabel;
|
|---|
| 26 | class QSpinBox;
|
|---|
| 27 | class QDoubleSpinBox;
|
|---|
| 28 | class QLineEdit;
|
|---|
| 29 | class QListWidget;
|
|---|
| 30 | class QPushButton;
|
|---|
| 31 | class QTableWidget;
|
|---|
| 32 | class QTextEdit;
|
|---|
| 33 | class QComboBox;
|
|---|
| 34 | class QCheckBox;
|
|---|
| 35 | class QFileDialog;
|
|---|
| 36 |
|
|---|
| 37 | class QtDialog::AtomQtQuery : public QWidget, public Dialog::AtomQuery {
|
|---|
| 38 | Q_OBJECT
|
|---|
| 39 | public:
|
|---|
| 40 | AtomQtQuery(Parameter<const atom *> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 41 | virtual ~AtomQtQuery();
|
|---|
| 42 | virtual bool handle();
|
|---|
| 43 |
|
|---|
| 44 | public slots:
|
|---|
| 45 | void onUpdate(int);
|
|---|
| 46 |
|
|---|
| 47 | private:
|
|---|
| 48 | QBoxLayout *parent;
|
|---|
| 49 | QBoxLayout *thisLayout;
|
|---|
| 50 | QLabel *titleLabel;
|
|---|
| 51 | QComboBox *inputBox;
|
|---|
| 52 | Dialog *dialog;
|
|---|
| 53 | };
|
|---|
| 54 |
|
|---|
| 55 | class QtDialog::AtomsQtQuery : public QWidget, public Dialog::AtomsQuery {
|
|---|
| 56 | Q_OBJECT
|
|---|
| 57 | public:
|
|---|
| 58 | AtomsQtQuery(Parameter<std::vector<const atom *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 59 | virtual ~AtomsQtQuery();
|
|---|
| 60 | virtual bool handle();
|
|---|
| 61 |
|
|---|
| 62 | public slots:
|
|---|
| 63 | void onUpdate();
|
|---|
| 64 |
|
|---|
| 65 | private:
|
|---|
| 66 | QBoxLayout *parent;
|
|---|
| 67 | QBoxLayout *thisLayout;
|
|---|
| 68 | QLabel *titleLabel;
|
|---|
| 69 | QLabel *inputLabel;
|
|---|
| 70 | QListWidget *inputList;
|
|---|
| 71 | Dialog *dialog;
|
|---|
| 72 | };
|
|---|
| 73 |
|
|---|
| 74 | class QtDialog::BooleanQtQuery : public QWidget, public Dialog::BooleanQuery {
|
|---|
| 75 | Q_OBJECT
|
|---|
| 76 | public:
|
|---|
| 77 | BooleanQtQuery(Parameter<bool> &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
|---|
| 78 | virtual ~BooleanQtQuery();
|
|---|
| 79 | virtual bool handle();
|
|---|
| 80 |
|
|---|
| 81 | public slots:
|
|---|
| 82 | void onUpdate(int);
|
|---|
| 83 |
|
|---|
| 84 | private:
|
|---|
| 85 | QBoxLayout *parent;
|
|---|
| 86 | QBoxLayout *thisLayout;
|
|---|
| 87 | QLabel *titleLabel;
|
|---|
| 88 | QCheckBox *booleanCheckBox;
|
|---|
| 89 | Dialog *dialog;
|
|---|
| 90 | };
|
|---|
| 91 |
|
|---|
| 92 | class QtDialog::RealSpaceMatrixQtQuery : public QWidget, public Dialog::RealSpaceMatrixQuery {
|
|---|
| 93 | Q_OBJECT
|
|---|
| 94 | public:
|
|---|
| 95 | RealSpaceMatrixQtQuery(Parameter<RealSpaceMatrix> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 96 | virtual ~RealSpaceMatrixQtQuery();
|
|---|
| 97 | virtual bool handle();
|
|---|
| 98 |
|
|---|
| 99 | public slots:
|
|---|
| 100 | void onUpdate(int, int);
|
|---|
| 101 |
|
|---|
| 102 | private:
|
|---|
| 103 | QBoxLayout *parent;
|
|---|
| 104 | QBoxLayout *thisLayout;
|
|---|
| 105 | QLabel *titleLabel;
|
|---|
| 106 | QTableWidget *inputTable;
|
|---|
| 107 | Dialog *dialog;
|
|---|
| 108 | };
|
|---|
| 109 |
|
|---|
| 110 | class QtDialog::DoubleQtQuery : public QWidget, public Dialog::DoubleQuery {
|
|---|
| 111 | Q_OBJECT
|
|---|
| 112 | public:
|
|---|
| 113 | DoubleQtQuery(Parameter<double> &, std::string title,QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 114 | virtual ~DoubleQtQuery();
|
|---|
| 115 | virtual bool handle();
|
|---|
| 116 |
|
|---|
| 117 | public slots:
|
|---|
| 118 | void onUpdate(double);
|
|---|
| 119 |
|
|---|
| 120 | private:
|
|---|
| 121 | QBoxLayout *parent;
|
|---|
| 122 | QBoxLayout *thisLayout;
|
|---|
| 123 | QLabel *titleLabel;
|
|---|
| 124 | QDoubleSpinBox *inputBox;
|
|---|
| 125 | Dialog *dialog;
|
|---|
| 126 | };
|
|---|
| 127 |
|
|---|
| 128 | class QtDialog::DoublesQtQuery : public QWidget, public Dialog::DoublesQuery {
|
|---|
| 129 | Q_OBJECT
|
|---|
| 130 | public:
|
|---|
| 131 | DoublesQtQuery(Parameter<std::vector<double> > &, std::string title,QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 132 | virtual ~DoublesQtQuery();
|
|---|
| 133 | virtual bool handle();
|
|---|
| 134 |
|
|---|
| 135 | public slots:
|
|---|
| 136 | void onUpdate();
|
|---|
| 137 |
|
|---|
| 138 | private:
|
|---|
| 139 | QBoxLayout *parent;
|
|---|
| 140 | QBoxLayout *thisLayout;
|
|---|
| 141 | QLabel *titleLabel;
|
|---|
| 142 | QDoubleSpinBox *inputBox;
|
|---|
| 143 | Dialog *dialog;
|
|---|
| 144 | };
|
|---|
| 145 |
|
|---|
| 146 | class QtDialog::ElementQtQuery : public QWidget, public Dialog::ElementQuery {
|
|---|
| 147 | Q_OBJECT
|
|---|
| 148 | public:
|
|---|
| 149 | ElementQtQuery(Parameter<const element *> &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
|---|
| 150 | virtual ~ElementQtQuery();
|
|---|
| 151 | virtual bool handle();
|
|---|
| 152 |
|
|---|
| 153 | public slots:
|
|---|
| 154 | void onUpdate(int);
|
|---|
| 155 |
|
|---|
| 156 | private:
|
|---|
| 157 | QBoxLayout *parent;
|
|---|
| 158 | QBoxLayout *thisLayout;
|
|---|
| 159 | QLabel *titleLabel;
|
|---|
| 160 | QComboBox *inputBox;
|
|---|
| 161 | Dialog *dialog;
|
|---|
| 162 | };
|
|---|
| 163 |
|
|---|
| 164 | class QtDialog::ElementsQtQuery : public QWidget, public Dialog::ElementsQuery, public QtQueryList<const element *> {
|
|---|
| 165 | Q_OBJECT
|
|---|
| 166 | public:
|
|---|
| 167 | ElementsQtQuery(Parameter<std::vector<const element *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 168 | virtual ~ElementsQtQuery();
|
|---|
| 169 | virtual bool handle();
|
|---|
| 170 |
|
|---|
| 171 | virtual void onSubUpdate();
|
|---|
| 172 |
|
|---|
| 173 | public slots:
|
|---|
| 174 | void onAddElement();
|
|---|
| 175 | void onRemoveElement();
|
|---|
| 176 | void onElementSelected();
|
|---|
| 177 |
|
|---|
| 178 | private:
|
|---|
| 179 | ElementQtQuery *subQuery;
|
|---|
| 180 | };
|
|---|
| 181 |
|
|---|
| 182 | class QtDialog::EmptyQtQuery : public Dialog::EmptyQuery {
|
|---|
| 183 | public:
|
|---|
| 184 | EmptyQtQuery(std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
|---|
| 185 | virtual ~EmptyQtQuery();
|
|---|
| 186 | virtual bool handle();
|
|---|
| 187 | private:
|
|---|
| 188 | QBoxLayout *parent;
|
|---|
| 189 | QBoxLayout *thisLayout;
|
|---|
| 190 | QLabel *titleLabel;
|
|---|
| 191 | Dialog *dialog;
|
|---|
| 192 | };
|
|---|
| 193 |
|
|---|
| 194 | class QtDialog::FileQtQuery : public QWidget, public Dialog::FileQuery {
|
|---|
| 195 | Q_OBJECT
|
|---|
| 196 | public:
|
|---|
| 197 | FileQtQuery(Parameter<boost::filesystem::path> &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
|---|
| 198 | virtual ~FileQtQuery();
|
|---|
| 199 | virtual bool handle();
|
|---|
| 200 |
|
|---|
| 201 | public slots:
|
|---|
| 202 | void onUpdate();
|
|---|
| 203 | void showFileDialog();
|
|---|
| 204 |
|
|---|
| 205 | private:
|
|---|
| 206 | QBoxLayout *parent;
|
|---|
| 207 | QBoxLayout *thisLayout;
|
|---|
| 208 | QLabel *filenameLabel;
|
|---|
| 209 | QLineEdit *filenameLineEdit;
|
|---|
| 210 | QPushButton *filedialogButton;
|
|---|
| 211 | QFileDialog *theFileDialog;
|
|---|
| 212 | Dialog *dialog;
|
|---|
| 213 | };
|
|---|
| 214 |
|
|---|
| 215 | class QtDialog::FilesQtQuery : public QWidget, public Dialog::FilesQuery {
|
|---|
| 216 | Q_OBJECT
|
|---|
| 217 | public:
|
|---|
| 218 | FilesQtQuery(Parameter<std::vector< boost::filesystem::path> > &, std::string _title, QBoxLayout *_parent, Dialog *_dialog);
|
|---|
| 219 | virtual ~FilesQtQuery();
|
|---|
| 220 | virtual bool handle();
|
|---|
| 221 | void IntegerEntered(const QString&);
|
|---|
| 222 | void IntegerSelected();
|
|---|
| 223 | void AddInteger();
|
|---|
| 224 | void RemoveInteger();
|
|---|
| 225 |
|
|---|
| 226 | public slots:
|
|---|
| 227 | void onUpdate();
|
|---|
| 228 |
|
|---|
| 229 | private:
|
|---|
| 230 | QBoxLayout *parent;
|
|---|
| 231 | QBoxLayout *thisLayout;
|
|---|
| 232 | QLabel *titleLabel;
|
|---|
| 233 | Dialog *dialog;
|
|---|
| 234 | };
|
|---|
| 235 |
|
|---|
| 236 | class QtDialog::IntQtQuery : public QWidget, public Dialog::IntQuery {
|
|---|
| 237 | Q_OBJECT
|
|---|
| 238 | public:
|
|---|
| 239 | IntQtQuery(Parameter<int> &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 240 | virtual ~IntQtQuery();
|
|---|
| 241 | virtual bool handle();
|
|---|
| 242 |
|
|---|
| 243 | public slots:
|
|---|
| 244 | void onUpdate(int);
|
|---|
| 245 |
|
|---|
| 246 | private:
|
|---|
| 247 | QBoxLayout *parent;
|
|---|
| 248 | QBoxLayout *thisLayout;
|
|---|
| 249 | QLabel *titleLabel;
|
|---|
| 250 | QSpinBox *inputBox;
|
|---|
| 251 | Dialog *dialog;
|
|---|
| 252 | };
|
|---|
| 253 |
|
|---|
| 254 | class QtDialog::IntsQtQuery : public QWidget, public Dialog::IntsQuery {
|
|---|
| 255 | Q_OBJECT
|
|---|
| 256 | public:
|
|---|
| 257 | IntsQtQuery(Parameter<std::vector<int> > &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 258 | virtual ~IntsQtQuery();
|
|---|
| 259 | virtual bool handle();
|
|---|
| 260 | void IntegerEntered(const QString&);
|
|---|
| 261 | void IntegerSelected();
|
|---|
| 262 | void AddInteger();
|
|---|
| 263 | void RemoveInteger();
|
|---|
| 264 |
|
|---|
| 265 | public slots:
|
|---|
| 266 | void onUpdate();
|
|---|
| 267 |
|
|---|
| 268 | private:
|
|---|
| 269 | QBoxLayout *parent;
|
|---|
| 270 | QBoxLayout *thisLayout;
|
|---|
| 271 | QLabel *titleLabel;
|
|---|
| 272 | Dialog *dialog;
|
|---|
| 273 | };
|
|---|
| 274 |
|
|---|
| 275 | class QtDialog::MoleculeQtQuery : public QWidget, public Dialog::MoleculeQuery {
|
|---|
| 276 | Q_OBJECT
|
|---|
| 277 | public:
|
|---|
| 278 | MoleculeQtQuery(Parameter<const molecule *> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 279 | virtual ~MoleculeQtQuery();
|
|---|
| 280 | virtual bool handle();
|
|---|
| 281 |
|
|---|
| 282 | public slots:
|
|---|
| 283 | void onUpdate(int);
|
|---|
| 284 |
|
|---|
| 285 | private:
|
|---|
| 286 | QBoxLayout *parent;
|
|---|
| 287 | QBoxLayout *thisLayout;
|
|---|
| 288 | QLabel *titleLabel;
|
|---|
| 289 | QComboBox *inputBox;
|
|---|
| 290 | Dialog *dialog;
|
|---|
| 291 | };
|
|---|
| 292 |
|
|---|
| 293 | class QtDialog::MoleculesQtQuery : public QWidget, public Dialog::MoleculesQuery {
|
|---|
| 294 | Q_OBJECT
|
|---|
| 295 | public:
|
|---|
| 296 | MoleculesQtQuery(Parameter<std::vector<const molecule *> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 297 | virtual ~MoleculesQtQuery();
|
|---|
| 298 | virtual bool handle();
|
|---|
| 299 |
|
|---|
| 300 | public slots:
|
|---|
| 301 | void onUpdate();
|
|---|
| 302 |
|
|---|
| 303 | private:
|
|---|
| 304 | QBoxLayout *parent;
|
|---|
| 305 | QBoxLayout *thisLayout;
|
|---|
| 306 | QLabel *titleLabel;
|
|---|
| 307 | QComboBox *inputBox;
|
|---|
| 308 | Dialog *dialog;
|
|---|
| 309 | };
|
|---|
| 310 |
|
|---|
| 311 | class QtDialog::StringQtQuery : public QWidget, public Dialog::StringQuery {
|
|---|
| 312 | Q_OBJECT
|
|---|
| 313 | public:
|
|---|
| 314 | StringQtQuery(Parameter<std::string> &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 315 | virtual ~StringQtQuery();
|
|---|
| 316 | virtual bool handle();
|
|---|
| 317 |
|
|---|
| 318 | public slots:
|
|---|
| 319 | void onUpdate(const QString&);
|
|---|
| 320 |
|
|---|
| 321 | private:
|
|---|
| 322 | QBoxLayout *parent;
|
|---|
| 323 | QBoxLayout *thisLayout;
|
|---|
| 324 | QLabel *titleLabel;
|
|---|
| 325 | QLineEdit *inputBox;
|
|---|
| 326 | Dialog *dialog;
|
|---|
| 327 | };
|
|---|
| 328 |
|
|---|
| 329 | class QtDialog::StringsQtQuery : public QWidget, public Dialog::StringsQuery, public QtQueryList<std::string> {
|
|---|
| 330 | Q_OBJECT
|
|---|
| 331 | public:
|
|---|
| 332 | StringsQtQuery(Parameter<std::vector<std::string> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 333 | virtual ~StringsQtQuery();
|
|---|
| 334 | virtual bool handle();
|
|---|
| 335 |
|
|---|
| 336 | virtual void onSubUpdate();
|
|---|
| 337 |
|
|---|
| 338 | public slots:
|
|---|
| 339 | void onAddElement();
|
|---|
| 340 | void onRemoveElement();
|
|---|
| 341 | void onElementSelected();
|
|---|
| 342 |
|
|---|
| 343 | private:
|
|---|
| 344 | StringQtQuery *subQuery;
|
|---|
| 345 | };
|
|---|
| 346 |
|
|---|
| 347 | class QtDialog::UnsignedIntQtQuery : public QWidget, public Dialog::UnsignedIntQuery {
|
|---|
| 348 | Q_OBJECT
|
|---|
| 349 | public:
|
|---|
| 350 | UnsignedIntQtQuery(Parameter<unsigned int> &, std::string _title,QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 351 | virtual ~UnsignedIntQtQuery();
|
|---|
| 352 | virtual bool handle();
|
|---|
| 353 |
|
|---|
| 354 | public slots:
|
|---|
| 355 | void onUpdate(int);
|
|---|
| 356 |
|
|---|
| 357 | private:
|
|---|
| 358 | QBoxLayout *parent;
|
|---|
| 359 | QBoxLayout *thisLayout;
|
|---|
| 360 | QLabel *titleLabel;
|
|---|
| 361 | QSpinBox *inputBox;
|
|---|
| 362 | Dialog *dialog;
|
|---|
| 363 | };
|
|---|
| 364 |
|
|---|
| 365 | class QtDialog::UnsignedIntsQtQuery : public QWidget, public Dialog::UnsignedIntsQuery, public QtQueryList<unsigned int> {
|
|---|
| 366 | Q_OBJECT
|
|---|
| 367 | public:
|
|---|
| 368 | UnsignedIntsQtQuery(Parameter<std::vector<unsigned int> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 369 | virtual ~UnsignedIntsQtQuery();
|
|---|
| 370 | virtual bool handle();
|
|---|
| 371 |
|
|---|
| 372 | virtual void onSubUpdate();
|
|---|
| 373 |
|
|---|
| 374 | public slots:
|
|---|
| 375 | void onAddElement();
|
|---|
| 376 | void onRemoveElement();
|
|---|
| 377 | void onElementSelected();
|
|---|
| 378 |
|
|---|
| 379 | private:
|
|---|
| 380 | UnsignedIntQtQuery *subQuery;
|
|---|
| 381 | };
|
|---|
| 382 |
|
|---|
| 383 | class QtDialog::VectorQtQuery : public QWidget, public Dialog::VectorQuery {
|
|---|
| 384 | Q_OBJECT
|
|---|
| 385 | public:
|
|---|
| 386 | VectorQtQuery(Parameter<Vector> &, std::string title,QBoxLayout *,Dialog *);
|
|---|
| 387 | virtual ~VectorQtQuery();
|
|---|
| 388 | virtual bool handle();
|
|---|
| 389 |
|
|---|
| 390 | public slots:
|
|---|
| 391 | void onUpdateX(double);
|
|---|
| 392 | void onUpdateY(double);
|
|---|
| 393 | void onUpdateZ(double);
|
|---|
| 394 |
|
|---|
| 395 | private:
|
|---|
| 396 | QBoxLayout *parent;
|
|---|
| 397 | QBoxLayout *mainLayout;
|
|---|
| 398 | QLabel *titleLabel;
|
|---|
| 399 | QBoxLayout *subLayout;
|
|---|
| 400 | QBoxLayout *coordLayout;
|
|---|
| 401 | QLabel *coordLabel;
|
|---|
| 402 | QDoubleSpinBox *coordInputX;
|
|---|
| 403 | QDoubleSpinBox *coordInputY;
|
|---|
| 404 | QDoubleSpinBox *coordInputZ;
|
|---|
| 405 | Dialog *dialog;
|
|---|
| 406 | };
|
|---|
| 407 |
|
|---|
| 408 | class QtDialog::VectorsQtQuery : public QWidget, public Dialog::VectorsQuery, public QtQueryList<Vector> {
|
|---|
| 409 | Q_OBJECT
|
|---|
| 410 | public:
|
|---|
| 411 | VectorsQtQuery(Parameter<std::vector<Vector> > &, std::string _title, QBoxLayout *_parent,Dialog *_dialog);
|
|---|
| 412 | virtual ~VectorsQtQuery();
|
|---|
| 413 | virtual bool handle();
|
|---|
| 414 |
|
|---|
| 415 | virtual void onSubUpdate();
|
|---|
| 416 |
|
|---|
| 417 | public slots:
|
|---|
| 418 | void onAddElement();
|
|---|
| 419 | void onRemoveElement();
|
|---|
| 420 | void onElementSelected();
|
|---|
| 421 |
|
|---|
| 422 | private:
|
|---|
| 423 | VectorQtQuery *subQuery;
|
|---|
| 424 | };
|
|---|
| 425 |
|
|---|
| 426 | class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public Dialog::RandomNumberDistribution_ParametersQuery {
|
|---|
| 427 | Q_OBJECT
|
|---|
| 428 | public:
|
|---|
| 429 | RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, std::string title,QBoxLayout *,Dialog *);
|
|---|
| 430 | virtual ~RandomNumberDistribution_ParametersQtQuery();
|
|---|
| 431 | virtual bool handle();
|
|---|
| 432 |
|
|---|
| 433 | public slots:
|
|---|
| 434 | void onUpdate();
|
|---|
| 435 |
|
|---|
| 436 | private:
|
|---|
| 437 | QBoxLayout *parent;
|
|---|
| 438 | QHBoxLayout *thisLayout;
|
|---|
| 439 | QLabel *titleLabel;
|
|---|
| 440 | QTextEdit *inputBox;
|
|---|
| 441 | QPushButton *okButton;
|
|---|
| 442 | Dialog *dialog;
|
|---|
| 443 | };
|
|---|
| 444 |
|
|---|
| 445 | #endif /* QTQUERY_HPP_ */
|
|---|