summaryrefslogtreecommitdiffstats
path: root/qt-ui/printdialog.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-06-29 03:24:29 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-05 21:00:28 +0300
commit71561e720dbfd85b3cb724dd1eb509b0d230d5db (patch)
treed7fedba86fd42877b766d8a4e719804a5e516676 /qt-ui/printdialog.cpp
parenta600ea5201f55a3182cb24a0553d02aefad2c51b (diff)
downloadsubsurface-71561e720dbfd85b3cb724dd1eb509b0d230d5db.tar.gz
Printing: add QSettings for TemplateEdit class
TemplateOptions struct must be saved to QSettings after the window is closed, also it must be recalled when initializing the window. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/printdialog.cpp')
-rw-r--r--qt-ui/printdialog.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp
index 341a84083..23c6f225e 100644
--- a/qt-ui/printdialog.cpp
+++ b/qt-ui/printdialog.cpp
@@ -23,6 +23,10 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
printOptions.landscape = false;
printOptions.p_template = print_options::ONE_DIVE;
printOptions.type = print_options::DIVELIST;
+ templateOptions.font_index = 0;
+ templateOptions.font_size = 9;
+ templateOptions.color_palette_index = 0;
+ templateOptions.line_spacing = 1;
} else {
s.beginGroup(SETTINGS_GROUP);
printOptions.type = (print_options::print_type)s.value("type").toInt();
@@ -31,6 +35,10 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
printOptions.landscape = s.value("landscape").toBool();
printOptions.p_template = (print_options::print_template)s.value("template_selected").toInt();
qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape);
+ templateOptions.font_index = s.value("font").toInt();
+ templateOptions.font_size = s.value("font_size").toDouble();
+ templateOptions.color_palette_index = s.value("color_palette").toInt();
+ templateOptions.line_spacing = s.value("line_spacing").toDouble();
}
// create a print options object and pass our options struct
@@ -83,13 +91,20 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
void PrintDialog::onFinished()
{
- // save the settings
QSettings s;
s.beginGroup(SETTINGS_GROUP);
+
+ // save print paper settings
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);
+
+ // save template settings
+ s.setValue("font", templateOptions.font_index);
+ s.setValue("font_size", templateOptions.font_size);
+ s.setValue("color_palette", templateOptions.color_palette_index);
+ s.setValue("line_spacing", templateOptions.line_spacing);
}
void PrintDialog::previewClicked(void)