summaryrefslogtreecommitdiffstats
path: root/qt-ui/printdialog.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-12 06:42:50 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-20 15:28:26 +0300
commited09b80c121764aba5e26b798b09f80f7abdd228 (patch)
treeeadbd528735f1a976815d3d5a2288e23e332cc30 /qt-ui/printdialog.cpp
parente1dda8df636058734ff8ab79ade210c08339b978 (diff)
downloadsubsurface-ed09b80c121764aba5e26b798b09f80f7abdd228.tar.gz
Printing: save custom color palette to QSettings
- save custom colors to QSettings. - load custom colors from QSettings. - set almond color palette as default palette. 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.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp
index c999e8f25..31ec354c8 100644
--- a/qt-ui/printdialog.cpp
+++ b/qt-ui/printdialog.cpp
@@ -12,7 +12,7 @@
#define SETTINGS_GROUP "PrintDialog"
-template_options::color_palette_struct almond_colors;
+template_options::color_palette_struct almond_colors, custom_colors;
PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
@@ -36,6 +36,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
templateOptions.font_size = 9;
templateOptions.color_palette_index = 0;
templateOptions.line_spacing = 1;
+ custom_colors = almond_colors;
} else {
s.beginGroup(SETTINGS_GROUP);
printOptions.type = (print_options::print_type)s.value("type").toInt();
@@ -48,9 +49,21 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
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();
+ custom_colors.color1 = QColor(s.value("custom_color_1").toString());
+ custom_colors.color2 = QColor(s.value("custom_color_2").toString());
+ custom_colors.color3 = QColor(s.value("custom_color_3").toString());
+ custom_colors.color4 = QColor(s.value("custom_color_4").toString());
+ custom_colors.color5 = QColor(s.value("custom_color_5").toString());
}
- templateOptions.color_palette = almond_colors;
+ switch (templateOptions.color_palette_index) {
+ case 0: // almond
+ templateOptions.color_palette = almond_colors;
+ break;
+ case 1: // custom
+ templateOptions.color_palette = custom_colors;
+ break;
+ }
// create a print options object and pass our options struct
optionsWidget = new PrintOptions(this, &printOptions, &templateOptions);
@@ -116,6 +129,13 @@ void PrintDialog::onFinished()
s.setValue("font_size", templateOptions.font_size);
s.setValue("color_palette", templateOptions.color_palette_index);
s.setValue("line_spacing", templateOptions.line_spacing);
+
+ // save custom colors
+ s.setValue("custom_color_1", custom_colors.color1.name());
+ s.setValue("custom_color_2", custom_colors.color2.name());
+ s.setValue("custom_color_3", custom_colors.color3.name());
+ s.setValue("custom_color_4", custom_colors.color4.name());
+ s.setValue("custom_color_5", custom_colors.color5.name());
}
void PrintDialog::previewClicked(void)