mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
81f1238ab9
commit
6d7eefd52d
3 changed files with 29 additions and 16 deletions
|
@ -74,10 +74,11 @@ void DiveCartesianAxis::setTextColor(const QColor &color)
|
||||||
textColor = color;
|
textColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveCartesianAxis::DiveCartesianAxis() : QObject(),
|
DiveCartesianAxis::DiveCartesianAxis(ProfileWidget2 *widget) : QObject(),
|
||||||
QGraphicsLineItem(),
|
QGraphicsLineItem(),
|
||||||
printMode(false),
|
printMode(false),
|
||||||
unitSystem(0),
|
unitSystem(0),
|
||||||
|
profileWidget(widget),
|
||||||
orientation(LeftToRight),
|
orientation(LeftToRight),
|
||||||
min(0),
|
min(0),
|
||||||
max(0),
|
max(0),
|
||||||
|
@ -149,7 +150,7 @@ void emptyList(QList<T *> &list, double steps)
|
||||||
void DiveCartesianAxis::updateTicks(color_indice_t color)
|
void DiveCartesianAxis::updateTicks(color_indice_t color)
|
||||||
{
|
{
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
if (!scene() || (!changed && !MainWindow::instance()->graphics()->getPrintMode()))
|
if (!scene() || (!changed && !profileWidget->getPrintMode()))
|
||||||
#else
|
#else
|
||||||
if (!scene() || !changed)
|
if (!scene() || !changed)
|
||||||
#endif
|
#endif
|
||||||
|
@ -382,7 +383,7 @@ QColor DepthAxis::colorForValue(double value)
|
||||||
return QColor(Qt::red);
|
return QColor(Qt::red);
|
||||||
}
|
}
|
||||||
|
|
||||||
DepthAxis::DepthAxis()
|
DepthAxis::DepthAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget)
|
||||||
{
|
{
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
changed = true;
|
changed = true;
|
||||||
|
@ -399,6 +400,10 @@ void DepthAxis::settingsChanged()
|
||||||
unitSystem = prefs.units.length;
|
unitSystem = prefs.units.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimeAxis::TimeAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QColor TimeAxis::colorForValue(double value)
|
QColor TimeAxis::colorForValue(double value)
|
||||||
{
|
{
|
||||||
Q_UNUSED(value);
|
Q_UNUSED(value);
|
||||||
|
@ -423,13 +428,17 @@ void TimeAxis::updateTicks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TemperatureAxis::TemperatureAxis(ProfileWidget2 *widget) : DiveCartesianAxis(widget)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QString TemperatureAxis::textForValue(double value)
|
QString TemperatureAxis::textForValue(double value)
|
||||||
{
|
{
|
||||||
return QString::number(mkelvin_to_C((int)value));
|
return QString::number(mkelvin_to_C((int)value));
|
||||||
}
|
}
|
||||||
|
|
||||||
PartialGasPressureAxis::PartialGasPressureAxis() :
|
PartialGasPressureAxis::PartialGasPressureAxis(ProfileWidget2 *widget) :
|
||||||
DiveCartesianAxis(),
|
DiveCartesianAxis(widget),
|
||||||
model(NULL)
|
model(NULL)
|
||||||
{
|
{
|
||||||
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QGraphicsLineItem>
|
#include <QGraphicsLineItem>
|
||||||
#include "subsurface-core/color.h"
|
#include "subsurface-core/color.h"
|
||||||
|
#include "profilewidget2.h"
|
||||||
|
|
||||||
class QPropertyAnimation;
|
class QPropertyAnimation;
|
||||||
class DiveTextItem;
|
class DiveTextItem;
|
||||||
|
@ -26,7 +27,7 @@ public:
|
||||||
LeftToRight,
|
LeftToRight,
|
||||||
RightToLeft
|
RightToLeft
|
||||||
};
|
};
|
||||||
DiveCartesianAxis();
|
DiveCartesianAxis(ProfileWidget2 *widget);
|
||||||
virtual ~DiveCartesianAxis();
|
virtual ~DiveCartesianAxis();
|
||||||
void setPrintMode(bool mode);
|
void setPrintMode(bool mode);
|
||||||
void setMinimum(double minimum);
|
void setMinimum(double minimum);
|
||||||
|
@ -60,6 +61,7 @@ signals:
|
||||||
void maxChanged();
|
void maxChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ProfileWidget2 *profileWidget;
|
||||||
virtual QString textForValue(double value);
|
virtual QString textForValue(double value);
|
||||||
virtual QColor colorForValue(double value);
|
virtual QColor colorForValue(double value);
|
||||||
Orientation orientation;
|
Orientation orientation;
|
||||||
|
@ -80,8 +82,7 @@ protected:
|
||||||
class DepthAxis : public DiveCartesianAxis {
|
class DepthAxis : public DiveCartesianAxis {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DepthAxis();
|
DepthAxis(ProfileWidget2 *widget);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value);
|
||||||
QColor colorForValue(double value);
|
QColor colorForValue(double value);
|
||||||
|
@ -93,6 +94,7 @@ slots:
|
||||||
class TimeAxis : public DiveCartesianAxis {
|
class TimeAxis : public DiveCartesianAxis {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
TimeAxis(ProfileWidget2 *widget);
|
||||||
virtual void updateTicks();
|
virtual void updateTicks();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -102,6 +104,8 @@ protected:
|
||||||
|
|
||||||
class TemperatureAxis : public DiveCartesianAxis {
|
class TemperatureAxis : public DiveCartesianAxis {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
TemperatureAxis(ProfileWidget2 *widget);
|
||||||
protected:
|
protected:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value);
|
||||||
};
|
};
|
||||||
|
@ -109,7 +113,7 @@ protected:
|
||||||
class PartialGasPressureAxis : public DiveCartesianAxis {
|
class PartialGasPressureAxis : public DiveCartesianAxis {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PartialGasPressureAxis();
|
PartialGasPressureAxis(ProfileWidget2 *widget);
|
||||||
void setModel(DivePlotDataModel *model);
|
void setModel(DivePlotDataModel *model);
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
|
|
|
@ -82,14 +82,14 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
backgroundFile(":poster"),
|
backgroundFile(":poster"),
|
||||||
toolTipItem(new ToolTipItem()),
|
toolTipItem(new ToolTipItem()),
|
||||||
isPlotZoomed(prefs.zoomed_plot),// no! bad use of prefs. 'PreferencesDialog::loadSettings' NOT CALLED yet.
|
isPlotZoomed(prefs.zoomed_plot),// no! bad use of prefs. 'PreferencesDialog::loadSettings' NOT CALLED yet.
|
||||||
profileYAxis(new DepthAxis()),
|
profileYAxis(new DepthAxis(this)),
|
||||||
gasYAxis(new PartialGasPressureAxis()),
|
gasYAxis(new PartialGasPressureAxis(this)),
|
||||||
temperatureAxis(new TemperatureAxis()),
|
temperatureAxis(new TemperatureAxis(this)),
|
||||||
timeAxis(new TimeAxis()),
|
timeAxis(new TimeAxis(this)),
|
||||||
diveProfileItem(new DiveProfileItem()),
|
diveProfileItem(new DiveProfileItem()),
|
||||||
temperatureItem(new DiveTemperatureItem()),
|
temperatureItem(new DiveTemperatureItem()),
|
||||||
meanDepthItem(new DiveMeanDepthItem()),
|
meanDepthItem(new DiveMeanDepthItem()),
|
||||||
cylinderPressureAxis(new DiveCartesianAxis()),
|
cylinderPressureAxis(new DiveCartesianAxis(this)),
|
||||||
gasPressureItem(new DiveGasPressureItem()),
|
gasPressureItem(new DiveGasPressureItem()),
|
||||||
diveComputerText(new DiveTextItem()),
|
diveComputerText(new DiveTextItem()),
|
||||||
diveCeiling(new DiveCalculatedCeiling()),
|
diveCeiling(new DiveCalculatedCeiling()),
|
||||||
|
@ -102,9 +102,9 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
ccrsensor1GasItem(new PartialPressureGasItem()),
|
ccrsensor1GasItem(new PartialPressureGasItem()),
|
||||||
ccrsensor2GasItem(new PartialPressureGasItem()),
|
ccrsensor2GasItem(new PartialPressureGasItem()),
|
||||||
ccrsensor3GasItem(new PartialPressureGasItem()),
|
ccrsensor3GasItem(new PartialPressureGasItem()),
|
||||||
heartBeatAxis(new DiveCartesianAxis()),
|
heartBeatAxis(new DiveCartesianAxis(this)),
|
||||||
heartBeatItem(new DiveHeartrateItem()),
|
heartBeatItem(new DiveHeartrateItem()),
|
||||||
percentageAxis(new DiveCartesianAxis()),
|
percentageAxis(new DiveCartesianAxis(this)),
|
||||||
ambPressureItem(new DiveAmbPressureItem()),
|
ambPressureItem(new DiveAmbPressureItem()),
|
||||||
gflineItem(new DiveGFLineItem()),
|
gflineItem(new DiveGFLineItem()),
|
||||||
mouseFollowerVertical(new DiveLineItem()),
|
mouseFollowerVertical(new DiveLineItem()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue