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