mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:13:23 +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.print_selected = true;
|
||||||
printOptions.color_selected = true;
|
printOptions.color_selected = true;
|
||||||
printOptions.landscape = false;
|
printOptions.landscape = false;
|
||||||
|
printOptions.p_template = print_options::ONE_DIVE;
|
||||||
} else {
|
} else {
|
||||||
s.beginGroup(SETTINGS_GROUP);
|
s.beginGroup(SETTINGS_GROUP);
|
||||||
printOptions.type = (print_options::print_type)s.value("type").toInt();
|
printOptions.type = (print_options::print_type)s.value("type").toInt();
|
||||||
printOptions.print_selected = s.value("print_selected").toBool();
|
printOptions.print_selected = s.value("print_selected").toBool();
|
||||||
printOptions.color_selected = s.value("color_selected").toBool();
|
printOptions.color_selected = s.value("color_selected").toBool();
|
||||||
printOptions.landscape = s.value("landscape").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);
|
qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@ void PrintDialog::onFinished()
|
||||||
s.setValue("type", printOptions.type);
|
s.setValue("type", printOptions.type);
|
||||||
s.setValue("print_selected", printOptions.print_selected);
|
s.setValue("print_selected", printOptions.print_selected);
|
||||||
s.setValue("color_selected", printOptions.color_selected);
|
s.setValue("color_selected", printOptions.color_selected);
|
||||||
|
s.setValue("template_selected", printOptions.p_template);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintDialog::previewClicked(void)
|
void PrintDialog::previewClicked(void)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "printoptions.h"
|
#include "printoptions.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt)
|
PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt)
|
||||||
{
|
{
|
||||||
|
@ -26,6 +27,14 @@ void PrintOptions::setup(struct print_options *printOpt)
|
||||||
ui.radioStatisticsPrint->setChecked(true);
|
ui.radioStatisticsPrint->setChecked(true);
|
||||||
break;
|
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
|
// general print option checkboxes
|
||||||
if (printOptions->color_selected)
|
if (printOptions->color_selected)
|
||||||
|
@ -75,3 +84,16 @@ void PrintOptions::printSelectedClicked(bool check)
|
||||||
{
|
{
|
||||||
printOptions->print_selected = 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,
|
TABLE,
|
||||||
STATISTICS
|
STATISTICS
|
||||||
} type;
|
} type;
|
||||||
|
enum print_template {
|
||||||
|
ONE_DIVE,
|
||||||
|
TWO_DIVE
|
||||||
|
} p_template;
|
||||||
bool print_selected;
|
bool print_selected;
|
||||||
bool color_selected;
|
bool color_selected;
|
||||||
bool landscape;
|
bool landscape;
|
||||||
|
@ -36,6 +40,7 @@ slots:
|
||||||
void on_radioStatisticsPrint_clicked(bool check);
|
void on_radioStatisticsPrint_clicked(bool check);
|
||||||
void on_radioTablePrint_clicked(bool check);
|
void on_radioTablePrint_clicked(bool check);
|
||||||
void on_radioDiveListPrint_clicked(bool check);
|
void on_radioDiveListPrint_clicked(bool check);
|
||||||
|
void on_printTemplate_currentIndexChanged(int index);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRINTOPTIONS_H
|
#endif // PRINTOPTIONS_H
|
||||||
|
|
|
@ -130,6 +130,11 @@
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="printTemplate">
|
<widget class="QComboBox" name="printTemplate">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1 Dive per page</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>2 Dives per page</string>
|
<string>2 Dives per page</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue