Skip to content

Commit

Permalink
profile: ignore animation-speed setting when printing
Browse files Browse the repository at this point in the history
When printing, the animation speed was set to 0 by the
caller and later reset to the original value. Instead of
modifying global state, set it internally (in the profile-code)
to zero when in print mode.

This is another small step in making the printing independent
from the shown profile.

Signed-off-by: Berthold Stoeger <[email protected]>
  • Loading branch information
bstoeger authored and dirkhh committed Apr 25, 2021
1 parent 757eece commit bd6b714
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
3 changes: 0 additions & 3 deletions desktop-widgets/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,13 @@ void Printer::render(int pages)
// keep original preferences
ProfileWidget2 *profile = MainWindow::instance()->graphics;
int profileFrameStyle = profile->frameStyle();
int animationOriginal = qPrefDisplay::animation_speed();
double fontScale = profile->getFontPrintScale();
double printFontScale = 1.0;

// apply printing settings to profile
profile->setFrameStyle(QFrame::NoFrame);
profile->setPrintMode(true, !printOptions.color_selected);
profile->setToolTipVisibile(false);
qPrefDisplay::set_animation_speed(0);

// render the Qwebview
QPainter painter;
Expand Down Expand Up @@ -190,7 +188,6 @@ void Printer::render(int pages)
profile->setFontPrintScale(fontScale);
profile->setToolTipVisibile(true);
profile->resize(originalSize);
qPrefDisplay::set_animation_speed(animationOriginal);

//replot the dive after returning the settings
profile->plotDive(current_dive, dc_number, true);
Expand Down
2 changes: 1 addition & 1 deletion profile-widget/profilewidget2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool doClearPict
return;

// special handling when switching from empty state
animSpeed = instant || currentState == EMPTY ? 0 : qPrefDisplay::animation_speed();
animSpeed = instant || currentState == EMPTY || printMode ? 0 : qPrefDisplay::animation_speed();

// restore default zoom level
resetZoom();
Expand Down
1 change: 0 additions & 1 deletion subsurface-mobile-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ int main(int argc, char **argv)
set_filename(NULL);

// some hard coded settings
qPrefDisplay::set_animation_speed(0); // we render the profile to pixmap, no animations
qPrefCloudStorage::set_save_password_local(true);

// always show the divecomputer reported ceiling in red
Expand Down

0 comments on commit bd6b714

Please sign in to comment.