New profile: Make the ruler work. (caution, fonts are BIIIG )

This patch makes the ruler work again, the problem is that the fonts are
*terribly* big, I'll fix that on the next commit.

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 16:42:00 -03:00 committed by Dirk Hohndel
parent 0a24e13469
commit a4d0f7bdb3
2 changed files with 16 additions and 5 deletions

View file

@ -172,6 +172,8 @@ void ProfileWidget2::setupItemOnScene()
diveComputerText->setAlignment(Qt::AlignRight | Qt::AlignTop);
diveComputerText->setBrush(getColor(TIME_TEXT));
rulerItem->setAxis(timeAxis, profileYAxis);
setupItem(reportedCeiling, timeAxis, profileYAxis, dataModel, DivePlotDataModel::CEILING, DivePlotDataModel::TIME, 1);
setupItem(diveCeiling, timeAxis, profileYAxis, dataModel, DivePlotDataModel::CEILING, DivePlotDataModel::TIME, 1);
for(int i = 0; i < 16; i++){
@ -364,7 +366,7 @@ void ProfileWidget2::plotDives(QList<dive*> dives)
heartBeatAxis->setVisible(false);
}
timeAxis->setMaximum(maxtime);
rulerItem->setPlotInfo(pInfo);
int i, incr;
static int increments[8] = { 10, 20, 30, 60, 5*60, 10*60, 15*60, 30*60 };
/* Time markers: at most every 10 seconds, but no more than 12 markers.
@ -434,10 +436,16 @@ void ProfileWidget2::settingsChanged()
plotDives(QList<dive*>() << getDiveById(diveId));
}
bool rulerVisible = s.value("rulergraph", false).toBool();
rulerItem->setVisible(rulerVisible);
rulerItem->destNode()->setVisible(rulerVisible );
rulerItem->sourceNode()->setVisible(rulerVisible );
if(currentState == PROFILE){
bool rulerVisible = s.value("rulergraph", false).toBool();
rulerItem->setVisible(rulerVisible);
rulerItem->destNode()->setVisible(rulerVisible );
rulerItem->sourceNode()->setVisible(rulerVisible );
}else{
rulerItem->setVisible(false);
rulerItem->destNode()->setVisible(false);
rulerItem->sourceNode()->setVisible(false);
}
}
void ProfileWidget2::resizeEvent(QResizeEvent* event)

View file

@ -3,6 +3,7 @@
#include <QFontMetrics>
#include <QPainter>
#include <QGraphicsScene>
#include <QDebug>
#include <stdint.h>
@ -171,6 +172,8 @@ void RulerItem2::setPlotInfo(plot_info info)
{
pInfo = info;
recalculate();
dest->recalculate();
source->recalculate();
}
void RulerItem2::setAxis(DiveCartesianAxis* time, DiveCartesianAxis* depth)