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>
This commit is contained in:
Tomaz Canabrava 2014-02-27 15:20:03 -03:00 committed by Dirk Hohndel
parent 250653a67f
commit 35e102b176
2 changed files with 16 additions and 1 deletions

View file

@ -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;

View file

@ -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