From e27653374d0ff6479db233365bcd7c9e10389102 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sat, 18 Mar 2023 18:23:33 +0100 Subject: [PATCH] Add printing option for page orientation Strangely enough, half of the infrastructure was already there, it just wasn't hooked up to a UI element Signed-off-by: Robert C. Helling --- CHANGELOG.md | 1 + desktop-widgets/printdialog.cpp | 1 + desktop-widgets/printoptions.cpp | 26 +++++++++++--------------- desktop-widgets/printoptions.h | 2 -- desktop-widgets/printoptions.ui | 7 +++++++ 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a5e0316..9c82119e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ core: fix bug when save sea water salinity given by DC desktop: add column for dive notes to the dive list table +desktop: Add an option for printing in landscape mode desktop: fix bug when printing a dive plan with multiple segments desktop: fix remembering of bluetooth address for remembered dive computers (not MacOS) desktop: fix bug in bailout gas selection for CCR dives diff --git a/desktop-widgets/printdialog.cpp b/desktop-widgets/printdialog.cpp index a4c181c68..25183beaf 100644 --- a/desktop-widgets/printdialog.cpp +++ b/desktop-widgets/printdialog.cpp @@ -155,6 +155,7 @@ void PrintDialog::onFinished() s.setValue("color_selected", printOptions.color_selected); s.setValue("template_selected", printOptions.p_template); s.setValue("resolution", printOptions.resolution); + s.setValue("landscape", printOptions.landscape); // save template settings s.setValue("font", templateOptions.font_index); diff --git a/desktop-widgets/printoptions.cpp b/desktop-widgets/printoptions.cpp index 88cf57c4f..ef3af949c 100644 --- a/desktop-widgets/printoptions.cpp +++ b/desktop-widgets/printoptions.cpp @@ -37,6 +37,7 @@ void PrintOptions::setup() // general print option checkboxes ui.printInColor->setChecked(printOptions.color_selected); ui.printSelected->setChecked(printOptions.print_selected); + ui.printLandscape->setChecked(printOptions.landscape); // resolution ui.resolution->setValue(printOptions.resolution); @@ -45,9 +46,16 @@ void PrintOptions::setup() if (hasSetupSlots) return; - connect(ui.printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(bool))); - connect(ui.printSelected, SIGNAL(clicked(bool)), this, SLOT(printSelectedClicked(bool))); - connect(ui.resolution, QOverload::of(&QSpinBox::valueChanged), [this](int value) { + connect(ui.printInColor, &QCheckBox::clicked, this, [this](bool value) { + printOptions.color_selected = value; + }); + connect(ui.printSelected, &QCheckBox::clicked, this, [this](bool value) { + printOptions.print_selected = value; + }); + connect(ui.printLandscape, &QCheckBox::clicked, this, [this](bool value) { + printOptions.landscape = value; + }); + connect(ui.resolution, QOverload::of(&QSpinBox::valueChanged), this, [this](int value) { printOptions.resolution = value; }); hasSetupSlots = true; @@ -109,18 +117,6 @@ void PrintOptions::on_radioStatisticsPrint_toggled(bool check) } } -// general print option checkboxes -void PrintOptions::printInColorClicked(bool check) -{ - printOptions.color_selected = check; -} - -void PrintOptions::printSelectedClicked(bool check) -{ - printOptions.print_selected = check; -} - - void PrintOptions::on_printTemplate_currentIndexChanged(int index) { printOptions.p_template = ui.printTemplate->itemData(index).toString(); diff --git a/desktop-widgets/printoptions.h b/desktop-widgets/printoptions.h index d155c899d..c4aada160 100644 --- a/desktop-widgets/printoptions.h +++ b/desktop-widgets/printoptions.h @@ -78,8 +78,6 @@ private: private slots: - void printInColorClicked(bool check); - void printSelectedClicked(bool check); void on_radioStatisticsPrint_toggled(bool check); void on_radioDiveListPrint_toggled(bool check); void on_printTemplate_currentIndexChanged(int index); diff --git a/desktop-widgets/printoptions.ui b/desktop-widgets/printoptions.ui index f12236552..0e9e22be9 100644 --- a/desktop-widgets/printoptions.ui +++ b/desktop-widgets/printoptions.ui @@ -93,6 +93,13 @@ + + + + Page orientation landscape + + +