diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-11-12 19:27:11 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-11-12 11:20:54 -0800 |
commit | 0272f118aeff4b9e7e5c08edcc664e9a9ab26368 (patch) | |
tree | 3713a5372b9d496cc3ced0b9725cf3de7abdab62 /desktop-widgets | |
parent | 6d93a14d18923480390e6cd04b3a1542f75480ea (diff) | |
download | subsurface-0272f118aeff4b9e7e5c08edcc664e9a9ab26368.tar.gz |
printing: properly initialize DPI value
The DPI value in the print_options structure was never initialized.
This could lead to random DPI values and crashes. How this ever
worked is a mystery.
Therefore, read and write the DPI value from the settings just
as the other print-options. And initialize the corresponding dialog
widget to this value.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/printdialog.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/printoptions.cpp | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/desktop-widgets/printdialog.cpp b/desktop-widgets/printdialog.cpp index 7ef7d03ec..87507c197 100644 --- a/desktop-widgets/printdialog.cpp +++ b/desktop-widgets/printdialog.cpp @@ -50,6 +50,7 @@ PrintDialog::PrintDialog(QWidget *parent) : printOptions.color_selected = s.value("color_selected", true).toBool(); printOptions.landscape = s.value("landscape", false).toBool(); printOptions.p_template = s.value("template_selected", "one_dive.html").toString(); + printOptions.resolution = s.value("resolution", 600).toInt(); templateOptions.font_index = s.value("font", 0).toInt(); templateOptions.font_size = s.value("font_size", 9).toDouble(); templateOptions.color_palette_index = s.value("color_palette", SSRF_COLORS).toInt(); @@ -150,6 +151,7 @@ void PrintDialog::onFinished() s.setValue("print_selected", printOptions.print_selected); s.setValue("color_selected", printOptions.color_selected); s.setValue("template_selected", printOptions.p_template); + s.setValue("resolution", printOptions.resolution); // save template settings s.setValue("font", templateOptions.font_index); diff --git a/desktop-widgets/printoptions.cpp b/desktop-widgets/printoptions.cpp index fbd03c127..215762db5 100644 --- a/desktop-widgets/printoptions.cpp +++ b/desktop-widgets/printoptions.cpp @@ -38,6 +38,9 @@ void PrintOptions::setup() ui.printInColor->setChecked(printOptions->color_selected); ui.printSelected->setChecked(printOptions->print_selected); + // resolution + ui.resolution->setValue(printOptions->resolution); + // connect slots only once if (hasSetupSlots) return; |