diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp index 491a33b30..cfda8f764 100644 --- a/profile-widget/divecartesianaxis.cpp +++ b/profile-widget/divecartesianaxis.cpp @@ -50,8 +50,10 @@ void DiveCartesianAxis::setTextColor(const QColor &color) textColor = color; } -DiveCartesianAxis::DiveCartesianAxis(double dpr, bool printMode, ProfileScene &scene) : +DiveCartesianAxis::DiveCartesianAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene) : printMode(printMode), + position(position), + gridColor(gridColor), scene(scene), orientation(LeftToRight), min(0), @@ -359,7 +361,8 @@ QColor DepthAxis::colorForValue(double) const return QColor(Qt::red); } -DepthAxis::DepthAxis(double dpr, bool printMode, ProfileScene &scene) : DiveCartesianAxis(dpr, printMode, scene) +DepthAxis::DepthAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene) : + DiveCartesianAxis(position, gridColor, dpr, printMode, scene) { changed = true; } @@ -392,8 +395,9 @@ QString TemperatureAxis::textForValue(double value) const return QString::number(mkelvin_to_C((int)value)); } -PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, double dpr, bool printMode, ProfileScene &scene) : - DiveCartesianAxis(dpr, printMode, scene), +PartialGasPressureAxis::PartialGasPressureAxis(const DivePlotDataModel &model, Position position, color_index_t gridColor, + double dpr, bool printMode, ProfileScene &scene) : + DiveCartesianAxis(position, gridColor, dpr, printMode, scene), model(model) { } diff --git a/profile-widget/divecartesianaxis.h b/profile-widget/divecartesianaxis.h index b0410d0ef..eae0f8b77 100644 --- a/profile-widget/divecartesianaxis.h +++ b/profile-widget/divecartesianaxis.h @@ -32,7 +32,7 @@ public: enum class Position { Left, Right, Bottom }; - DiveCartesianAxis(double dpr, bool printMode, ProfileScene &scene); + DiveCartesianAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene); ~DiveCartesianAxis(); void setMinimum(double minimum); void setMaximum(double maximum); @@ -59,6 +59,8 @@ signals: void sizeChanged(); protected: + Position position; + color_index_t gridColor; ProfileScene &scene; virtual QString textForValue(double value) const; virtual QColor colorForValue(double value) const; @@ -82,7 +84,7 @@ protected: class DepthAxis : public DiveCartesianAxis { Q_OBJECT public: - DepthAxis(double dpr, bool printMode, ProfileScene &scene); + DepthAxis(Position position, color_index_t gridColor, double dpr, bool printMode, ProfileScene &scene); private: QString textForValue(double value) const override; QColor colorForValue(double value) const override; @@ -109,7 +111,8 @@ private: class PartialGasPressureAxis : public DiveCartesianAxis { Q_OBJECT public: - PartialGasPressureAxis(const DivePlotDataModel &model, double dpr, bool printMode, ProfileScene &scene); + PartialGasPressureAxis(const DivePlotDataModel &model, Position position, color_index_t gridColor, + double dpr, bool printMode, ProfileScene &scene); void update(int animSpeed); double width() const; private: diff --git a/profile-widget/profilescene.cpp b/profile-widget/profilescene.cpp index 9734ed9df..974b177e1 100644 --- a/profile-widget/profilescene.cpp +++ b/profile-widget/profilescene.cpp @@ -70,13 +70,13 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) : maxtime(-1), maxdepth(-1), dataModel(new DivePlotDataModel(this)), - profileYAxis(new DepthAxis(dpr, printMode, *this)), - gasYAxis(new PartialGasPressureAxis(*dataModel, dpr, printMode, *this)), - temperatureAxis(new TemperatureAxis(dpr, printMode, *this)), - timeAxis(new TimeAxis(dpr, printMode, *this)), - cylinderPressureAxis(new DiveCartesianAxis(dpr, printMode, *this)), - heartBeatAxis(new DiveCartesianAxis(dpr, printMode, *this)), - percentageAxis(new DiveCartesianAxis(dpr, printMode, *this)), + profileYAxis(new DepthAxis(DiveCartesianAxis::Position::Left, TIME_GRID, dpr, printMode, *this)), + gasYAxis(new PartialGasPressureAxis(*dataModel, DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)), + temperatureAxis(new TemperatureAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)), + timeAxis(new TimeAxis(DiveCartesianAxis::Position::Bottom, TIME_GRID, dpr, printMode, *this)), + cylinderPressureAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)), + heartBeatAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Left, HR_AXIS, dpr, printMode, *this)), + percentageAxis(new DiveCartesianAxis(DiveCartesianAxis::Position::Right, TIME_GRID, dpr, printMode, *this)), diveProfileItem(createItem(*profileYAxis, DivePlotDataModel::DEPTH, 0, dpr)), temperatureItem(createItem(*temperatureAxis, DivePlotDataModel::TEMPERATURE, 1, dpr)), meanDepthItem(createItem(*profileYAxis, DivePlotDataModel::INSTANT_MEANDEPTH, 1, dpr)),