profile: remove redundant parameter in setPrintMode()

Since using separate profile-instances for print/export,
we never exit print mode. Therefore, the mode parameter
can be removed. This is a preparatory commit for passing
the printMode at construction time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-06-28 20:46:49 +02:00 committed by Dirk Hohndel
parent db726862ae
commit 9f6e487790
8 changed files with 21 additions and 21 deletions

View file

@ -53,7 +53,7 @@ static void exportProfile(ProfileWidget2 *profile, const struct dive *dive, cons
static std::unique_ptr<ProfileWidget2> getPrintProfile() static std::unique_ptr<ProfileWidget2> getPrintProfile()
{ {
auto profile = std::make_unique<ProfileWidget2>(nullptr, (double)profileScale, nullptr); auto profile = std::make_unique<ProfileWidget2>(nullptr, (double)profileScale, nullptr);
profile->setPrintMode(true); profile->setPrintMode();
return profile; return profile;
} }

View file

@ -612,7 +612,7 @@ void PlannerWidgets::printDecoPlan()
auto profile = std::make_unique<ProfileWidget2>(DivePlannerPointsModel::instance(), 1.0, nullptr); auto profile = std::make_unique<ProfileWidget2>(DivePlannerPointsModel::instance(), 1.0, nullptr);
profile->setPlanState(&displayed_dive, 0); profile->setPlanState(&displayed_dive, 0);
profile->plotDive(&displayed_dive, 0, true, true); profile->plotDive(&displayed_dive, 0, true, true);
profile->setPrintMode(true); profile->setPrintMode();
profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height())); profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height()));
QByteArray byteArray; QByteArray byteArray;

View file

@ -113,7 +113,7 @@ void Printer::render(int pages)
// apply printing settings to profile // apply printing settings to profile
profile->setFrameStyle(QFrame::NoFrame); profile->setFrameStyle(QFrame::NoFrame);
profile->setPrintMode(true, !printOptions.color_selected); profile->setPrintMode(!printOptions.color_selected);
// render the Qwebview // render the Qwebview
QPainter painter; QPainter painter;

View file

@ -27,9 +27,9 @@ void DiveCartesianAxis::setFontLabelScale(qreal scale)
changed = true; changed = true;
} }
void DiveCartesianAxis::setPrintMode(bool mode) void DiveCartesianAxis::setPrintMode()
{ {
printMode = mode; printMode = true;
// update the QPen of all lines depending on printMode // update the QPen of all lines depending on printMode
QPen newPen = gridPen(); QPen newPen = gridPen();
QColor oldColor = pen().brush().color(); QColor oldColor = pen().brush().color();

View file

@ -31,7 +31,7 @@ public:
}; };
DiveCartesianAxis(double fontPrintScale, ProfileScene &scene); DiveCartesianAxis(double fontPrintScale, ProfileScene &scene);
~DiveCartesianAxis(); ~DiveCartesianAxis();
void setPrintMode(bool mode); void setPrintMode();
void setMinimum(double minimum); void setMinimum(double minimum);
void setMaximum(double maximum); void setMaximum(double maximum);
void setTickInterval(double interval); void setTickInterval(double interval);

View file

@ -1262,25 +1262,25 @@ void ProfileWidget2::changeGas(int tank, int seconds)
} }
#endif #endif
void ProfileWidget2::setPrintMode(bool mode, bool grayscale) void ProfileWidget2::setPrintMode(bool grayscale)
{ {
printMode = mode; printMode = true;
resetZoom(); resetZoom();
// set printMode for axes // set printMode for axes
profileScene->profileYAxis->setPrintMode(mode); profileScene->profileYAxis->setPrintMode();
profileScene->gasYAxis->setPrintMode(mode); profileScene->gasYAxis->setPrintMode();
profileScene->temperatureAxis->setPrintMode(mode); profileScene->temperatureAxis->setPrintMode();
profileScene->timeAxis->setPrintMode(mode); profileScene->timeAxis->setPrintMode();
profileScene->cylinderPressureAxis->setPrintMode(mode); profileScene->cylinderPressureAxis->setPrintMode();
isGrayscale = mode ? grayscale : false; isGrayscale = grayscale;
#ifndef SUBSURFACE_MOBILE #ifndef SUBSURFACE_MOBILE
profileScene->heartBeatAxis->setPrintMode(mode); profileScene->heartBeatAxis->setPrintMode();
profileScene->percentageAxis->setPrintMode(mode); profileScene->percentageAxis->setPrintMode();
mouseFollowerHorizontal->setVisible(!mode); mouseFollowerHorizontal->setVisible(false);
mouseFollowerVertical->setVisible(!mode); mouseFollowerVertical->setVisible(false);
toolTipItem->setVisible(!mode); toolTipItem->setVisible(false);
#endif #endif
} }

View file

@ -70,7 +70,7 @@ public:
void setProfileState(const struct dive *d, int dc); void setProfileState(const struct dive *d, int dc);
void setPlanState(const struct dive *d, int dc); void setPlanState(const struct dive *d, int dc);
void setEditState(const struct dive *d, int dc); void setEditState(const struct dive *d, int dc);
void setPrintMode(bool mode, bool grayscale = false); void setPrintMode(bool grayscale = false);
bool isPlanner() const; bool isPlanner() const;
void draw(QPainter *painter, const QRect &pos); void draw(QPainter *painter, const QRect &pos);
QImage toImage(QSize size); QImage toImage(QSize size);

View file

@ -30,7 +30,7 @@ void QMLProfile::createProfileView()
{ {
m_profileWidget.reset(new ProfileWidget2(nullptr, fontScale * m_devicePixelRatio, nullptr)); m_profileWidget.reset(new ProfileWidget2(nullptr, fontScale * m_devicePixelRatio, nullptr));
m_profileWidget->setProfileState(nullptr, 0); m_profileWidget->setProfileState(nullptr, 0);
m_profileWidget->setPrintMode(true); m_profileWidget->setPrintMode();
} }
// we need this so we can connect update() to the scaleChanged() signal - which the connect above cannot do // we need this so we can connect update() to the scaleChanged() signal - which the connect above cannot do