summaryrefslogtreecommitdiffstats
path: root/profile-widget/divecartesianaxis.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-11-06 13:54:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-06 09:58:08 -0800
commit6d7eefd52da50fb76a1f817a871ef21b77af20dc (patch)
treef5f110188db0d51910fa5cd04bc73f199fe26933 /profile-widget/divecartesianaxis.cpp
parent81f1238ab9e82ad158e00b98f59d8ddb497ee7c8 (diff)
downloadsubsurface-6d7eefd52da50fb76a1f817a871ef21b77af20dc.tar.gz
Untagle DiveCartesianAxis from MainWindow
DiveCartesianAxis and derivatives can recieve ProfileWidget2 as an instance in their constructor. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile-widget/divecartesianaxis.cpp')
-rw-r--r--profile-widget/divecartesianaxis.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp
index 0336ed129..4a7b029ad 100644
--- a/profile-widget/divecartesianaxis.cpp
+++ b/profile-widget/divecartesianaxis.cpp
@@ -74,10 +74,11 @@ void DiveCartesianAxis::setTextColor(const QColor &color)
textColor = color;
}
-DiveCartesianAxis::DiveCartesianAxis() : QObject(),
+DiveCartesianAxis::DiveCartesianAxis(ProfileWidget2 *widget) : QObject(),
QGraphicsLineItem(),
printMode(false),
unitSystem(0),
+ profileWidget(widget),
orientation(LeftToRight),
min(0),
max(0),
@@ -149,7 +150,7 @@ void emptyList(QList<T *> &list, double steps)
void DiveCartesianAxis::updateTicks(color_indice_t color)
{
#ifndef SUBSURFACE_MOBILE
- if (!scene() || (!changed && !MainWindow::instance()->graphics()->getPrintMode()))
+ if (!scene() || (!changed && !profileWidget->getPrintMode()))
#else
if (!scene() || !changed)
#endif
@@ -382,7 +383,7 @@ QColor DepthAxis::colorForValue(double value)
return QColor(Qt::red);
}
-DepthAxis::DepthAxis()
+DepthAxis::DepthAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget)
{
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
changed = true;
@@ -399,6 +400,10 @@ void DepthAxis::settingsChanged()
unitSystem = prefs.units.length;
}
+TimeAxis::TimeAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget)
+{
+}
+
QColor TimeAxis::colorForValue(double value)
{
Q_UNUSED(value);
@@ -423,13 +428,17 @@ void TimeAxis::updateTicks()
}
}
+TemperatureAxis::TemperatureAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget)
+{
+}
+
QString TemperatureAxis::textForValue(double value)
{
return QString::number(mkelvin_to_C((int)value));
}
-PartialGasPressureAxis::PartialGasPressureAxis() :
- DiveCartesianAxis(),
+PartialGasPressureAxis::PartialGasPressureAxis(ProfileWidget2 *widget) :
+ DiveCartesianAxis(widget),
model(NULL)
{
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));