mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Printing: add a "one dive per page" option
Add another printing option to the print dialog. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
cd30e11672
commit
17470f6822
4 changed files with 35 additions and 0 deletions
|
@ -20,12 +20,14 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
|
|||
printOptions.print_selected = true;
|
||||
printOptions.color_selected = true;
|
||||
printOptions.landscape = false;
|
||||
printOptions.p_template = print_options::ONE_DIVE;
|
||||
} else {
|
||||
s.beginGroup(SETTINGS_GROUP);
|
||||
printOptions.type = (print_options::print_type)s.value("type").toInt();
|
||||
printOptions.print_selected = s.value("print_selected").toBool();
|
||||
printOptions.color_selected = s.value("color_selected").toBool();
|
||||
printOptions.landscape = s.value("landscape").toBool();
|
||||
printOptions.p_template = (print_options::print_template)s.value("template_selected").toInt();
|
||||
qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape);
|
||||
}
|
||||
|
||||
|
@ -85,6 +87,7 @@ void PrintDialog::onFinished()
|
|||
s.setValue("type", printOptions.type);
|
||||
s.setValue("print_selected", printOptions.print_selected);
|
||||
s.setValue("color_selected", printOptions.color_selected);
|
||||
s.setValue("template_selected", printOptions.p_template);
|
||||
}
|
||||
|
||||
void PrintDialog::previewClicked(void)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "printoptions.h"
|
||||
#include <QDebug>
|
||||
|
||||
PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt)
|
||||
{
|
||||
|
@ -26,6 +27,14 @@ void PrintOptions::setup(struct print_options *printOpt)
|
|||
ui.radioStatisticsPrint->setChecked(true);
|
||||
break;
|
||||
}
|
||||
switch (printOptions->p_template) {
|
||||
case print_options::ONE_DIVE:
|
||||
ui.printTemplate->setCurrentIndex(0);
|
||||
break;
|
||||
case print_options::TWO_DIVE:
|
||||
ui.printTemplate->setCurrentIndex(1);
|
||||
break;
|
||||
}
|
||||
|
||||
// general print option checkboxes
|
||||
if (printOptions->color_selected)
|
||||
|
@ -75,3 +84,16 @@ void PrintOptions::printSelectedClicked(bool check)
|
|||
{
|
||||
printOptions->print_selected = check;
|
||||
}
|
||||
|
||||
|
||||
void PrintOptions::on_printTemplate_currentIndexChanged(int index)
|
||||
{
|
||||
switch(index){
|
||||
case 0:
|
||||
printOptions->p_template = print_options::ONE_DIVE;
|
||||
break;
|
||||
case 1:
|
||||
printOptions->p_template = print_options::TWO_DIVE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,10 @@ struct print_options {
|
|||
TABLE,
|
||||
STATISTICS
|
||||
} type;
|
||||
enum print_template {
|
||||
ONE_DIVE,
|
||||
TWO_DIVE
|
||||
} p_template;
|
||||
bool print_selected;
|
||||
bool color_selected;
|
||||
bool landscape;
|
||||
|
@ -36,6 +40,7 @@ slots:
|
|||
void on_radioStatisticsPrint_clicked(bool check);
|
||||
void on_radioTablePrint_clicked(bool check);
|
||||
void on_radioDiveListPrint_clicked(bool check);
|
||||
void on_printTemplate_currentIndexChanged(int index);
|
||||
};
|
||||
|
||||
#endif // PRINTOPTIONS_H
|
||||
|
|
|
@ -130,6 +130,11 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="printTemplate">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1 Dive per page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2 Dives per page</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue