aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-02-27 15:20:03 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-27 10:48:47 -0800
commit35e102b1760a8aa4c589fedeada3914fa54a4d64 (patch)
treef76252e26a6b80ecd887fcfdf2fc303505aeb669
parent250653a67f11517acd52fd0e933de03452d96031 (diff)
downloadsubsurface-35e102b1760a8aa4c589fedeada3914fa54a4d64.tar.gz
New profile: add the RulerItem
This patch adds the RulerItem inside of the new profile, and already takes settings into consideration. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/profilewidget2.cpp15
-rw-r--r--qt-ui/profile/profilewidget2.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 2ec069452..c2de05d3c 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -12,6 +12,7 @@
#include "animationfunctions.h"
#include "planner.h"
#include "device.h"
+#include "ruleritem.h"
#include <QSignalTransition>
#include <QPropertyAnimation>
#include <QMenu>
@@ -78,7 +79,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) :
po2GasItem( new PartialPressureGasItem()),
heartBeatAxis(new DiveCartesianAxis()),
heartBeatItem(new DiveHeartrateItem()),
- isPlotZoomed(prefs.zoomed_plot)
+ isPlotZoomed(prefs.zoomed_plot),
+ rulerItem(new RulerItem2())
{
memset(&plotInfo, 0, sizeof(plotInfo));
@@ -118,6 +120,9 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(po2GasItem);
scene()->addItem(heartBeatAxis);
scene()->addItem(heartBeatItem);
+ scene()->addItem(rulerItem);
+ scene()->addItem(rulerItem->sourceNode());
+ scene()->addItem(rulerItem->destNode());
Q_FOREACH(DiveCalculatedTissue *tissue, allTissues){
scene()->addItem(tissue);
}
@@ -526,6 +531,9 @@ void ProfileWidget2::setEmptyState()
diveComputerText->setVisible(false);
diveCeiling->setVisible(false);
reportedCeiling->setVisible(false);
+ rulerItem->setVisible(false);
+ rulerItem->destNode()->setVisible(false);
+ rulerItem->sourceNode()->setVisible(false);
Q_FOREACH(DiveCalculatedTissue *tissue, allTissues){
tissue->setVisible(false);
}
@@ -582,6 +590,11 @@ void ProfileWidget2::setProfileState()
tissue->setVisible(true);
}
}
+
+ bool rulerVisible = s.value("rulervisible", false).toBool();
+ rulerItem->setVisible(rulerVisible);
+ rulerItem->destNode()->setVisible(rulerVisible );
+ rulerItem->sourceNode()->setVisible(rulerVisible );
}
extern struct ev_select *ev_namelist;
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 2b5d19d71..e8246980d 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 RulerItem2;
struct dive;
struct plot_info;
class ToolTipItem;
@@ -101,6 +102,7 @@ private:
PartialPressureGasItem *po2GasItem;
DiveCartesianAxis *heartBeatAxis;
DiveHeartrateItem *heartBeatItem;
+ RulerItem2 *rulerItem;
};
#endif // PROFILEWIDGET2_H