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