mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'custom-print' of https://github.com/neolit123/subsurface
This commit is contained in:
commit
56d701dfff
11 changed files with 374 additions and 47 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);
|
||||
}
|
||||
|
||||
|
@ -33,7 +35,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
|
|||
optionsWidget = new PrintOptions(this, &printOptions);
|
||||
|
||||
// create a new printer object
|
||||
printer = new Printer(&qprinter);
|
||||
printer = new Printer(&qprinter, &printOptions);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
@ -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
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Dive list Print</string>
|
||||
<string>&Dive list print</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@ -54,7 +54,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Table Print</string>
|
||||
<string>&Table print</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -67,7 +67,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Statistics Print</string>
|
||||
<string>&Statistics print</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -132,7 +132,12 @@
|
|||
<widget class="QComboBox" name="printTemplate">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2 Dives per page</string>
|
||||
<string>One dive per page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Two dives per page</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue