diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2014-01-21 15:31:56 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-21 11:35:24 -0800 |
commit | ce7c3f8314ceedd82364ce441b73983ee62f3aaf (patch) | |
tree | 58d212a52ef48b630388dec5d76b3c892e74fc5b /qt-ui | |
parent | 8065374793908894b47cfd1c2bb0b9913d404bb4 (diff) | |
download | subsurface-ce7c3f8314ceedd82364ce441b73983ee62f3aaf.tar.gz |
Add the tissues to the profile graph
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/diveplotdatamodel.cpp | 8 | ||||
-rw-r--r-- | qt-ui/profile/diveplotdatamodel.h | 3 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 10 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.h | 1 |
4 files changed, 21 insertions, 1 deletions
diff --git a/qt-ui/profile/diveplotdatamodel.cpp b/qt-ui/profile/diveplotdatamodel.cpp index b32918bc5..6635ff1d0 100644 --- a/qt-ui/profile/diveplotdatamodel.cpp +++ b/qt-ui/profile/diveplotdatamodel.cpp @@ -38,6 +38,11 @@ QVariant DivePlotDataModel::data(const QModelIndex& index, int role) const case SAC: return item.sac; } } + + if (role == Qt::DisplayRole && index.column() >= TISSUE_1 && index.column() <= TISSUE_16){ + return item.ceilings[ index.column() - TISSUE_1]; + } + if (role == Qt::BackgroundRole) { switch (index.column()) { case COLOR: return getColor((color_indice_t)(VELOCITY_COLORS_START_IDX + item.velocity)); @@ -77,6 +82,9 @@ QVariant DivePlotDataModel::headerData(int section, Qt::Orientation orientation, case CEILING: return tr("Ceiling"); case SAC: return tr("SAC"); } + if (role == Qt::DisplayRole && section >= TISSUE_1 && section <= TISSUE_16){ + return QString("Ceiling: %1").arg(section - TISSUE_1); + } return QVariant(); } diff --git a/qt-ui/profile/diveplotdatamodel.h b/qt-ui/profile/diveplotdatamodel.h index cc391097d..b188396ed 100644 --- a/qt-ui/profile/diveplotdatamodel.h +++ b/qt-ui/profile/diveplotdatamodel.h @@ -11,7 +11,8 @@ class DivePlotDataModel : public QAbstractTableModel{ Q_OBJECT public: enum {DEPTH, TIME, PRESSURE, TEMPERATURE, USERENTERED, COLOR, CYLINDERINDEX, SENSOR_PRESSURE, INTERPOLATED_PRESSURE, - SAC, CEILING, COLUMNS}; + SAC, CEILING, TISSUE_1,TISSUE_2,TISSUE_3,TISSUE_4,TISSUE_5,TISSUE_6,TISSUE_7,TISSUE_8,TISSUE_9,TISSUE_10, + TISSUE_11,TISSUE_12,TISSUE_13,TISSUE_14,TISSUE_15,TISSUE_16,COLUMNS}; explicit DivePlotDataModel(QObject* parent = 0); virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 46856ba76..045e7ee54 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -374,6 +374,16 @@ void ProfileWidget2::plotDives(QList<dive*> dives) diveComputerText->setText(currentdc->model); diveComputerText->animateMoveTo(1 , sceneRect().height()); + qDeleteAll(allTissues); + for(int i = 0; i < 16; i++){ + DiveCalculatedCeiling *tissueItem = new DiveCalculatedCeiling(); + tissueItem->setHorizontalAxis(timeAxis); + tissueItem->setVerticalAxis(profileYAxis); + tissueItem->setModel(dataModel); + tissueItem->setVerticalDataColumn(DivePlotDataModel::TISSUE_1 + i); + tissueItem->setHorizontalDataColumn(DivePlotDataModel::TIME); + scene()->addItem(tissueItem); + } emit startProfileState(); } diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index d5d657d40..37508cea4 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -85,6 +85,7 @@ private: QList<DiveEventItem*> eventItems; DiveTextItem *diveComputerText; DiveCalculatedCeiling *diveCeiling; + QList<DiveCalculatedCeiling*> allTissues; }; #endif |