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 <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2023-03-18 18:23:33 +01:00 committed by Dirk Hohndel
parent 2f4b415e91
commit e27653374d
5 changed files with 20 additions and 17 deletions

View file

@ -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

View file

@ -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);

View file

@ -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<int>::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<int>::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();

View file

@ -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);

View file

@ -93,6 +93,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="printLandscape">
<property name="text">
<string>Page orientation landscape</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>