Change the Ruler text values when metric system changes.

"ups", as I did this in Metric system I forgot to update
to imperial when the user selected it.

Fixes #665

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-07-29 16:34:57 -03:00 committed by Dirk Hohndel
parent 936f057ddc
commit 078332bae1
3 changed files with 11 additions and 22 deletions

View file

@ -308,9 +308,9 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
double retValue = realSize * percent; double retValue = realSize * percent;
double adjusted = double adjusted =
orientation == LeftToRight ? retValue + m.x1() + p.x() : orientation == LeftToRight ? retValue + m.x1() + p.x() :
orientation == RightToLeft ? retValue + m.x1() + p.x() : orientation == RightToLeft ? retValue + m.x1() + p.x() :
orientation == TopToBottom ? retValue + m.y1() + p.y() : orientation == TopToBottom ? retValue + m.y1() + p.y() :
/* entation == BottomToTop */ retValue + m.y1() + p.y(); /* entation == BottomToTop */ retValue + m.y1() + p.y();
return adjusted; return adjusted;
} }
@ -365,28 +365,21 @@ static bool isPPGraphEnabled()
return prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe; return prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe;
} }
DepthAxis::DepthAxis() : showWithPPGraph(false) DepthAxis::DepthAxis()
{ {
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
changed = true;
// force the correct size of the line.
showWithPPGraph = !isPPGraphEnabled();
settingsChanged(); settingsChanged();
} }
void DepthAxis::settingsChanged() void DepthAxis::settingsChanged()
{ {
// bool ppGraph = isPPGraphEnabled(); static int unitSystem = prefs.units.length;
// if ( ppGraph == showWithPPGraph){ if ( unitSystem == prefs.units.length )
// return; return;
// } changed = true;
// updateTicks();
// if (ppGraph) { unitSystem = prefs.units.length;
// animateChangeLine(shrinkedLine);
// } else {
// animateChangeLine(expandedLine);
// }
// showWithPPGraph = ppGraph;
} }
QColor TimeAxis::colorForValue(double value) QColor TimeAxis::colorForValue(double value)

View file

@ -83,9 +83,6 @@ protected:
private private
slots: slots:
void settingsChanged(); void settingsChanged();
private:
bool showWithPPGraph;
}; };
class TimeAxis : public DiveCartesianAxis { class TimeAxis : public DiveCartesianAxis {

View file

@ -450,7 +450,6 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
temperatureAxis->setMinimum(pInfo.mintemp); temperatureAxis->setMinimum(pInfo.mintemp);
temperatureAxis->setMaximum(pInfo.maxtemp); temperatureAxis->setMaximum(pInfo.maxtemp);
if (pInfo.maxhr) { if (pInfo.maxhr) {
heartBeatAxis->setMinimum(pInfo.minhr); heartBeatAxis->setMinimum(pInfo.minhr);
heartBeatAxis->setMaximum(pInfo.maxhr); heartBeatAxis->setMaximum(pInfo.maxhr);