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()
{
auto profile = std::make_unique<ProfileWidget2>(nullptr, (double)profileScale, nullptr);
profile->setPrintMode(true);
profile->setPrintMode();
return profile;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -70,7 +70,7 @@ public:
void setProfileState(const struct dive *d, int dc);
void setPlanState(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;
void draw(QPainter *painter, const QRect &pos);
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->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