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