/* * QTDialog.hpp * * Created on: Jan 18, 2010 * Author: crueger */ #ifndef QTDIALOG_HPP_ #define QTDIALOG_HPP_ #include "UIElements/Dialog.hpp" #include class QBoxLayout; class QLabel; class QSpinBox; class QLineEdit; class QComboBox; class QDialogButtonBox; // Forward declarations for plumbing class StringQTQueryPipe; class IntQTQueryPipe; class MoleculeQTQueryPipe; class QTDialog : public QDialog, public Dialog { Q_OBJECT public: QTDialog(); virtual ~QTDialog(); virtual void queryInt(const char *, int *); virtual void queryString(const char*, std::string *); virtual void queryMolecule(const char*,molecule**,MoleculeListClass*); virtual bool display(); virtual void update(); protected: class IntQTQuery : public Dialog::IntQuery { public: IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog); ~IntQTQuery(); virtual bool handle(); private: QBoxLayout *parent; QBoxLayout *thisLayout; QLabel *titleLabel; QSpinBox *inputBox; IntQTQueryPipe *pipe; }; class StringQTQuery : public Dialog::StringQuery { public: StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog); ~StringQTQuery(); virtual bool handle(); private: QBoxLayout *parent; QBoxLayout *thisLayout; QLabel *titleLabel; QLineEdit *inputBox; StringQTQueryPipe *pipe; }; class MoleculeQTQuery : public Dialog::MoleculeQuery { public: MoleculeQTQuery(std::string _title, molecule **_target, MoleculeListClass *_molecules, QBoxLayout *_parent,QTDialog *_dialog); ~MoleculeQTQuery(); virtual bool handle(); private: QBoxLayout *parent; QBoxLayout *thisLayout; QLabel *titleLabel; QComboBox *inputBox; MoleculeQTQueryPipe *pipe; }; private: QBoxLayout *mainLayout; QBoxLayout *inputLayout; QBoxLayout *buttonLayout; QDialogButtonBox *buttons; }; // All kinds of plumbing for Queries // Plumbing needs to be outside of the class where it is needed, // since MOC doesn't like nested classes class StringQTQueryPipe : public QWidget { Q_OBJECT public: StringQTQueryPipe(std::string *_content, QTDialog *_dialog); ~StringQTQueryPipe(); public slots: void update(const QString&); private: std::string *content; QTDialog *dialog; }; class IntQTQueryPipe : public QWidget { Q_OBJECT public: IntQTQueryPipe(int *_content, QTDialog *_dialog); ~IntQTQueryPipe(); public slots: void update(int); private: int *content; QTDialog *dialog; }; class MoleculeQTQueryPipe : public QWidget { Q_OBJECT public: MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox, MoleculeListClass *_molecules); ~MoleculeQTQueryPipe(); public slots: void update(int); private: molecule **content; MoleculeListClass *molecules; QTDialog *dialog; QComboBox *theBox; }; #endif /* QTDIALOG_HPP_ */