aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/profile/diveprofileitem.cpp39
-rw-r--r--qt-ui/profile/diveprofileitem.h7
-rw-r--r--qt-ui/profile/profilewidget2.cpp15
-rw-r--r--qt-ui/profile/profilewidget2.h3
4 files changed, 63 insertions, 1 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index 5cb064983..bf8af7956 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -364,3 +364,42 @@ void DiveCalculatedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsI
{
QGraphicsPolygonItem::paint(painter, option, widget);
}
+
+
+void DiveReportedCeiling::modelDataChanged()
+{
+ if (!hAxis || !vAxis || !dataModel || hDataColumn == -1 || vDataColumn == -1)
+ return;
+
+ if (prefs.profile_dc_ceiling){
+ setVisible(prefs.profile_red_ceiling);
+ }else{
+ setVisible(false);
+ }
+
+ QPolygonF p;
+ p.append(QPointF(hAxis->posAtValue(0), vAxis->posAtValue(0)));
+ plot_data *entry = dataModel->data();
+ for (int i = 0, count = dataModel->rowCount(); i < count; i++, entry++) {
+ if (entry->in_deco && entry->stopdepth) {
+ if (entry->stopdepth < entry->depth) {
+ p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->stopdepth)));
+ } else {
+ p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(entry->depth)));
+ }
+ } else {
+ p.append(QPointF(hAxis->posAtValue(entry->sec), vAxis->posAtValue(0)));
+ }
+ }
+ setPolygon(p);
+ QLinearGradient pat(0, p.boundingRect().top(), 0, p.boundingRect().bottom());
+ pat.setColorAt(0, getColor(CEILING_SHALLOW));
+ pat.setColorAt(1, getColor(CEILING_DEEP));
+ setPen(QPen(QBrush(Qt::NoBrush),0));
+ setBrush(pat);
+}
+
+void DiveReportedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
+{
+ QGraphicsPolygonItem::paint(painter, option, widget);
+}
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index 9e71eac19..9b737db5e 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -87,4 +87,11 @@ public:
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
};
+class DiveReportedCeiling : public AbstractProfilePolygonItem{
+ Q_OBJECT
+
+public:
+ virtual void modelDataChanged();
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+};
#endif \ No newline at end of file
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 790b2c611..b5610e4cf 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -39,7 +39,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
cartesianPlane(new DiveCartesianPlane()),
meanDepth(new DiveLineItem()),
diveComputerText(new DiveTextItem()),
- diveCeiling(NULL)
+ diveCeiling(NULL),
+ reportedCeiling(NULL)
{
setScene(new QGraphicsScene());
scene()->setSceneRect(0, 0, 100, 100);
@@ -386,6 +387,18 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
allTissues.append(tissueItem);
scene()->addItem(tissueItem);
}
+
+ if(reportedCeiling){
+ scene()->removeItem(reportedCeiling);
+ delete reportedCeiling;
+ }
+ reportedCeiling = new DiveReportedCeiling();
+ reportedCeiling->setHorizontalAxis(timeAxis);
+ reportedCeiling->setVerticalAxis(profileYAxis);
+ reportedCeiling->setModel(dataModel);
+ reportedCeiling->setVerticalDataColumn(DivePlotDataModel::CEILING);
+ reportedCeiling->setHorizontalDataColumn(DivePlotDataModel::TIME);
+ scene()->addItem(reportedCeiling);
emit startProfileState();
}
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 37508cea4..369941930 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -16,6 +16,7 @@
#include "graphicsview-common.h"
#include "divelineitem.h"
+class DiveReportedCeiling;
class DiveTextItem;
class TemperatureAxis;
class DiveEventItem;
@@ -33,6 +34,7 @@ struct DiveTemperatureItem;
struct plot_info;
struct DiveGasPressureItem;
struct DiveCalculatedCeiling;
+struct DiveReportedCeiling;
class ProfileWidget2 : public QGraphicsView {
Q_OBJECT
@@ -86,6 +88,7 @@ private:
DiveTextItem *diveComputerText;
DiveCalculatedCeiling *diveCeiling;
QList<DiveCalculatedCeiling*> allTissues;
+ DiveReportedCeiling *reportedCeiling;
};
#endif