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