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