Go to the documentation of this file.00001 #ifndef BUILDERVIEW_H
00002 #define BUILDERVIEW_H
00003
00004 #include <QFrame>
00005
00009 class HeaderSection : public QFrame
00010 {
00011 Q_OBJECT
00012 public:
00013 HeaderSection(QWidget *parent = 0);
00014 QSize sizeHint() const;
00015 virtual QVariant data(int role) const;
00016
00017 public slots:
00018 void slot_underLyingColumnWidth_changed(int width);
00019
00020 signals:
00021 void signal_minimumSectionSize_reached(int minimumSize);
00022 void signal_minimumSectionSize_changed(int newSize);
00023 void signal_userSetting_changed();
00024
00025 private:
00026 int columnWidth;
00027 };
00028
00029 class TreeItem;
00030 class CalibrationsCheckBox;
00031 class CalibrationsView;
00032 class UnitComboBox;
00033 class DataHeaderViewPort;
00034 class QLabel;
00035 class QVBoxLayout;
00036
00058 class DataHeaderSection : public HeaderSection
00059 {
00060 Q_OBJECT
00061 public:
00062 DataHeaderSection(TreeItem *treeItem, QWidget *parent = 0);
00063 ~DataHeaderSection();
00064 CalibrationsCheckBox *calibrationsCheckBox();
00065 QString getName();
00066 virtual QVariant data(int role) const;
00067 QString getSqlForColumn();
00068 int getTreeId();
00069 QString getTitle();
00070 DataHeaderViewPort *parentHeader();
00071 int logicalIndex();
00072
00073 public slots:
00074 void slot_updateTitle();
00075 void slot_caliChkBoxCheckEnable();
00076 void onCalibrationSelectionChange();
00077
00078 protected:
00079 bool eventFilter(QObject *object, QEvent *event);
00080
00081 signals:
00082 void signal_removalRequested();
00083 void signal_curve_setEnabled(bool);
00084
00085 private:
00086 void setupUniqueSectionName();
00087
00088 private:
00089 QLabel *sectionName;
00090 CalibrationsCheckBox *caliChkBox;
00091 QVBoxLayout *vLayout;
00092 TreeItem *m_treeItem;
00093 CalibrationsView *cView;
00094 QAction *graphAction;
00095 QAction *deleteAction;
00096 UnitComboBox *unitCB;
00097 };
00098
00099 class QComboBox;
00100 class QSpinBox;
00101
00105 class TimestampHeaderSection : public HeaderSection
00106 {
00107 Q_OBJECT
00108 public:
00109 enum TimestampType{
00110 TypeRaw,
00111 TypeCustom,
00112 };
00113
00114 TimestampHeaderSection(QWidget *parent = 0);
00115 TimestampHeaderSection::TimestampType getTimestampType();
00116 int getCustomValue();
00117
00118 private slots:
00119 void slot_timestampTypeAssigned(int index);
00120
00121 private:
00122 QLabel *sectionName;
00123 QVBoxLayout *vLayout;
00124 QComboBox *timestampType;
00125 QSpinBox *avgInterval;
00126 };
00127
00128 #include <QAbstractProxyModel>
00129
00135 class ConnectedProxyModel : public QAbstractProxyModel
00136 {
00137 public:
00138 ConnectedProxyModel(QObject *parent = 0);
00139 void setSourceModel(QAbstractItemModel *sourceModel);
00140 };
00141
00145 class TimestampProxy : public ConnectedProxyModel
00146 {
00147 public:
00148 TimestampProxy(QObject *parent = 0);
00149 QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
00150 QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
00151 QModelIndex index(int row, int column, const QModelIndex &parent) const;
00152 QModelIndex parent(const QModelIndex &child) const;
00153 int rowCount(const QModelIndex &parent) const;
00154 int columnCount(const QModelIndex &parent) const;
00155 };
00156
00160 class DataProxy : public ConnectedProxyModel
00161 {
00162 public:
00163 DataProxy(QObject *parent );
00164 QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
00165 QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
00166 QModelIndex index(int row, int column, const QModelIndex &parent) const;
00167 QModelIndex parent(const QModelIndex &child) const;
00168 int rowCount(const QModelIndex &parent) const;
00169 int columnCount(const QModelIndex &parent) const;
00170 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex & parent);
00171 QStringList mimeTypes() const;
00172 Qt::DropActions supportedDropActions() const;
00173 Qt::ItemFlags flags(const QModelIndex &index) const;
00174 };
00175
00176 #include <QTableView>
00177
00181 class ViewPort : public QTableView
00182 {
00183 public:
00184 ViewPort(QWidget *parent = 0);
00185 };
00186
00190 class DataViewPort : public ViewPort
00191 {
00192 Q_OBJECT
00193 public:
00194 DataViewPort(QWidget *parent = 0);
00195
00196 protected:
00197 bool viewportEvent(QEvent *event);
00198
00199 signals:
00200 void signal_viewportWidthChanged(int);
00201 };
00202
00206 class TimestampViewPort : public ViewPort
00207 {
00208 public:
00209 TimestampViewPort(QWidget *parent = 0);
00210 };
00211
00212 #include <QHBoxLayout>
00213
00217 class DataHeaderViewPortLayout : public QHBoxLayout
00218 {
00219 public:
00220 DataHeaderViewPortLayout(QWidget *parent = 0);
00221 DataHeaderSection *getSection(const int logicalIndex) const;
00222 };
00223
00224 #include <QWidget>
00225
00226 class BaseQueryModel;
00227
00231 class DataHeaderViewPort : public QWidget
00232 {
00233 Q_OBJECT
00234 public:
00235 DataHeaderViewPort(BaseQueryModel *base, QWidget *parent = 0);
00236 QStringList getHeaderNames();
00237 BaseQueryModel *model();
00238 int logicalIndex(DataHeaderSection *section) const;
00239 DataHeaderSection* section(int logicalIndex);
00240 QVector<DataHeaderSection*> sections(int tree_id);
00241 int sectionCount() const;
00242 void resetSectionSizes();
00243
00244 public slots:
00245 void slot_curve_setEnabled(bool enable);
00246 void addSection(TreeItem *item);
00247 void removeSection(int position);
00248 void slot_resizeSection_request(int index, int, int width);
00249 QString getSql();
00250 DataHeaderViewPortLayout *layout() const;
00251
00252 signals:
00253 void signal_minimumSectionSize_reached(int minimumSize, int section = -1);
00254 void signal_userSetting_changed();
00255 void signal_curve_requested(DataHeaderSection *section, bool enable);
00256 void signal_dataHeaderSection_destroyed(QObject *section);
00257
00258 private:
00259 BaseQueryModel *m_base;
00260 };
00261
00262 #include <QScrollArea>
00263
00267 class DataHeader: public QScrollArea
00268 {
00269 Q_OBJECT
00270 public:
00271 DataHeader(BaseQueryModel *base, QWidget *parent = 0);
00272 QSize sizeHint() const;
00273 DataHeaderViewPort *viewPort() const;
00274 int sectionCount() const;
00275 QVariant data(const int section, const int role) const;
00276
00277 protected:
00278 bool viewportEvent(QEvent *event);
00279 };
00280
00281 #include <QTextEdit>
00282
00286 class AdvancedQueryEdit : public QTextEdit
00287 {
00288 public:
00289 AdvancedQueryEdit(QWidget *parent = 0);
00290 virtual QSize sizeHint() const;
00291 };
00292
00296 class BuilderViewComponent : public QWidget
00297 {
00298 public:
00299 BuilderViewComponent(QWidget *parent = 0);
00300 virtual QWidget *header() = 0;
00301 virtual QWidget *viewPort() = 0;
00302 };
00303
00307 class DataBuilderView : public BuilderViewComponent
00308 {
00309 public:
00310 DataBuilderView(BaseQueryModel *base, QWidget *parent = 0);
00311 DataViewPort *viewPort();
00312 DataHeader *header();
00313
00314 private:
00315 private:
00316 DataHeader *dhs;
00317 DataViewPort *dView;
00318 };
00319
00323 class TimestampBuiderView : public BuilderViewComponent
00324 {
00325 public:
00326 TimestampBuiderView(QWidget *parent = 0);
00327 TimestampViewPort *viewPort();
00328 TimestampHeaderSection *header();
00329
00330 private:
00331 private:
00332 TimestampHeaderSection *ths;
00333 TimestampViewPort *tView;
00334 };
00335
00336 #include <QSplitter>
00337
00341 class BuilderView : public QSplitter
00342 {
00343 Q_OBJECT
00344 public:
00345 BuilderView(BaseQueryModel *base, QWidget *parent = 0);
00346 DataViewPort *dataView();
00347 TimestampViewPort *timestampView();
00348 DataHeader *dataHeader();
00349 TimestampHeaderSection *timestampHeader();
00350
00351 protected:
00352 bool event(QEvent *event);
00353
00354 private:
00355 private slots:
00356 void syncHeaderSize();
00357
00358 private:
00359 TimestampBuiderView *tView;
00360 DataBuilderView *dView;
00361 };
00362
00363 #endif // BUILDERVIEW_H