| [d3a5ea] | 1 | /*
|
|---|
| 2 | * QTDialog.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 18, 2010
|
|---|
| 5 | * Author: crueger
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef QTDIALOG_HPP_
|
|---|
| 9 | #define QTDIALOG_HPP_
|
|---|
| 10 |
|
|---|
| 11 | #include "UIElements/Dialog.hpp"
|
|---|
| 12 | #include <Qt/qdialog.h>
|
|---|
| 13 |
|
|---|
| 14 | class QBoxLayout;
|
|---|
| 15 | class QLabel;
|
|---|
| 16 | class QSpinBox;
|
|---|
| 17 | class QLineEdit;
|
|---|
| 18 | class QComboBox;
|
|---|
| 19 | class QDialogButtonBox;
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | // Forward declarations for plumbing
|
|---|
| 23 | class StringQTQueryPipe;
|
|---|
| 24 | class IntQTQueryPipe;
|
|---|
| 25 | class MoleculeQTQueryPipe;
|
|---|
| 26 |
|
|---|
| 27 | class QTDialog : public QDialog, public Dialog
|
|---|
| 28 | {
|
|---|
| 29 | Q_OBJECT
|
|---|
| 30 | public:
|
|---|
| 31 | QTDialog();
|
|---|
| 32 | virtual ~QTDialog();
|
|---|
| 33 |
|
|---|
| 34 | virtual void queryInt(const char *, int *);
|
|---|
| 35 | virtual void queryString(const char*, std::string *);
|
|---|
| 36 | virtual void queryMolecule(const char*,molecule**,MoleculeListClass*);
|
|---|
| 37 |
|
|---|
| 38 | virtual bool display();
|
|---|
| 39 |
|
|---|
| 40 | virtual void update();
|
|---|
| 41 |
|
|---|
| 42 | protected:
|
|---|
| 43 | class IntQTQuery : public Dialog::IntQuery {
|
|---|
| 44 | public:
|
|---|
| 45 | IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog);
|
|---|
| 46 | ~IntQTQuery();
|
|---|
| 47 | virtual bool handle();
|
|---|
| 48 | private:
|
|---|
| 49 | QBoxLayout *parent;
|
|---|
| 50 | QBoxLayout *thisLayout;
|
|---|
| 51 | QLabel *titleLabel;
|
|---|
| 52 | QSpinBox *inputBox;
|
|---|
| 53 |
|
|---|
| 54 | IntQTQueryPipe *pipe;
|
|---|
| 55 | };
|
|---|
| 56 |
|
|---|
| 57 | class StringQTQuery : public Dialog::StringQuery {
|
|---|
| 58 | public:
|
|---|
| 59 | StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog);
|
|---|
| 60 | ~StringQTQuery();
|
|---|
| 61 | virtual bool handle();
|
|---|
| 62 | private:
|
|---|
| 63 | QBoxLayout *parent;
|
|---|
| 64 | QBoxLayout *thisLayout;
|
|---|
| 65 | QLabel *titleLabel;
|
|---|
| 66 | QLineEdit *inputBox;
|
|---|
| 67 |
|
|---|
| 68 | StringQTQueryPipe *pipe;
|
|---|
| 69 | };
|
|---|
| 70 |
|
|---|
| 71 | class MoleculeQTQuery : public Dialog::MoleculeQuery {
|
|---|
| 72 | public:
|
|---|
| 73 | MoleculeQTQuery(std::string _title, molecule **_target, MoleculeListClass *_molecules, QBoxLayout *_parent,QTDialog *_dialog);
|
|---|
| 74 | ~MoleculeQTQuery();
|
|---|
| 75 | virtual bool handle();
|
|---|
| 76 | private:
|
|---|
| 77 | QBoxLayout *parent;
|
|---|
| 78 | QBoxLayout *thisLayout;
|
|---|
| 79 | QLabel *titleLabel;
|
|---|
| 80 | QComboBox *inputBox;
|
|---|
| 81 |
|
|---|
| 82 | MoleculeQTQueryPipe *pipe;
|
|---|
| 83 | };
|
|---|
| 84 |
|
|---|
| 85 | private:
|
|---|
| 86 | QBoxLayout *mainLayout;
|
|---|
| 87 | QBoxLayout *inputLayout;
|
|---|
| 88 | QBoxLayout *buttonLayout;
|
|---|
| 89 | QDialogButtonBox *buttons;
|
|---|
| 90 | };
|
|---|
| 91 |
|
|---|
| 92 | // All kinds of plumbing for Queries
|
|---|
| 93 | // Plumbing needs to be outside of the class where it is needed,
|
|---|
| 94 | // since MOC doesn't like nested classes
|
|---|
| 95 |
|
|---|
| 96 | class StringQTQueryPipe : public QWidget {
|
|---|
| 97 | Q_OBJECT
|
|---|
| 98 | public:
|
|---|
| 99 | StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
|
|---|
| 100 | ~StringQTQueryPipe();
|
|---|
| 101 |
|
|---|
| 102 | public slots:
|
|---|
| 103 | void update(const QString&);
|
|---|
| 104 |
|
|---|
| 105 | private:
|
|---|
| 106 | std::string *content;
|
|---|
| 107 | QTDialog *dialog;
|
|---|
| 108 |
|
|---|
| 109 | };
|
|---|
| 110 |
|
|---|
| 111 | class IntQTQueryPipe : public QWidget {
|
|---|
| 112 | Q_OBJECT
|
|---|
| 113 | public:
|
|---|
| 114 | IntQTQueryPipe(int *_content, QTDialog *_dialog);
|
|---|
| 115 | ~IntQTQueryPipe();
|
|---|
| 116 |
|
|---|
| 117 | public slots:
|
|---|
| 118 | void update(int);
|
|---|
| 119 |
|
|---|
| 120 | private:
|
|---|
| 121 | int *content;
|
|---|
| 122 | QTDialog *dialog;
|
|---|
| 123 |
|
|---|
| 124 | };
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 | class MoleculeQTQueryPipe : public QWidget {
|
|---|
| 128 | Q_OBJECT
|
|---|
| 129 | public:
|
|---|
| 130 | MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox, MoleculeListClass *_molecules);
|
|---|
| 131 | ~MoleculeQTQueryPipe();
|
|---|
| 132 |
|
|---|
| 133 | public slots:
|
|---|
| 134 | void update(int);
|
|---|
| 135 |
|
|---|
| 136 | private:
|
|---|
| 137 | molecule **content;
|
|---|
| 138 | MoleculeListClass *molecules;
|
|---|
| 139 | QTDialog *dialog;
|
|---|
| 140 | QComboBox *theBox;
|
|---|
| 141 |
|
|---|
| 142 | };
|
|---|
| 143 | #endif /* QTDIALOG_HPP_ */
|
|---|