summaryrefslogtreecommitdiff
path: root/Source/QtDialog/QCMakeCacheView.h
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2007-11-02 11:50:17 -0400
committerClinton Stimpson <clinton@elemtech.com>2007-11-02 11:50:17 -0400
commit800cbd0550466794cf853c6fb4dc0349e245220c (patch)
tree6a55206bc76ac9a72f99906f341a8b7115879f8d /Source/QtDialog/QCMakeCacheView.h
parentdcf21dd90b816d06b43716ce96e496fe3d591594 (diff)
downloadcmake-800cbd0550466794cf853c6fb4dc0349e245220c.tar.gz
ENH: Beginnings of a Qt UI for CMake.
Diffstat (limited to 'Source/QtDialog/QCMakeCacheView.h')
-rw-r--r--Source/QtDialog/QCMakeCacheView.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
new file mode 100644
index 0000000000..a284ecdecf
--- /dev/null
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -0,0 +1,100 @@
+
+#ifndef QCMakeCacheView_h
+#define QCMakeCacheView_h
+
+#include <QTableView>
+#include <QAbstractTableModel>
+#include <QComboBox>
+#include <QLineEdit>
+#include <QItemDelegate>
+
+#include "QCMake.h"
+class QCMakeCacheModel;
+
+
+/// Qt view class for cache properties
+class QCMakeCacheView : public QTableView
+{
+ Q_OBJECT
+public:
+ QCMakeCacheView(QWidget* p);
+
+ QCMakeCacheModel* cacheModel() const;
+
+protected:
+ bool event(QEvent*);
+};
+
+/// Qt model class for cache properties
+class QCMakeCacheModel : public QAbstractTableModel
+{
+ Q_OBJECT
+public:
+ QCMakeCacheModel(QObject* parent);
+ ~QCMakeCacheModel();
+
+ enum { HelpRole = Qt::UserRole, TypeRole, AdvancedRole };
+
+public slots:
+ void setProperties(const QCMakeCachePropertyList& props);
+
+public:
+ int columnCount ( const QModelIndex & parent ) const;
+ QVariant data ( const QModelIndex & index, int role ) const;
+ QModelIndex parent ( const QModelIndex & index ) const;
+ int rowCount ( const QModelIndex & parent ) const;
+ QVariant headerData ( int section, Qt::Orientation orient, int role ) const;
+ Qt::ItemFlags flags ( const QModelIndex& index ) const;
+ bool setData ( const QModelIndex& index, const QVariant& value, int role );
+
+ QCMakeCachePropertyList properties() const;
+
+protected:
+ QCMakeCachePropertyList Properties;
+};
+
+/// Qt delegate class for interaction (or other customization) with cache properties
+class QCMakeCacheModelDelegate : public QItemDelegate
+{
+ Q_OBJECT
+public:
+ QCMakeCacheModelDelegate(QObject* p);
+ QWidget* createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
+};
+
+/// Editor widget for editing paths
+class QCMakeCachePathEditor : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ value USER true)
+public:
+ QCMakeCachePathEditor(const QString& file, QWidget* p);
+ QString value() const;
+protected slots:
+ void chooseFile();
+protected:
+ QLineEdit LineEdit;
+};
+
+/// Editor widget for editing file paths
+class QCMakeCacheFilePathEditor : public QWidget
+{
+};
+
+/// Editor widget for editing booleans
+class QCMakeCacheBoolEditor : public QComboBox
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ currentText USER true)
+public:
+ QCMakeCacheBoolEditor(const QString& val, QWidget* p)
+ : QComboBox(p)
+ {
+ this->addItem("ON");
+ this->addItem("OFF");
+ this->setCurrentIndex(val == "ON" ? 0 : 1);
+ }
+};
+
+#endif
+