diff options
-rw-r--r-- | qt-ui/printdialog.cpp | 24 | ||||
-rw-r--r-- | qt-ui/printoptions.h | 2 |
2 files changed, 23 insertions, 3 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) diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h index 92064d223..3a55c6994 100644 --- a/qt-ui/printoptions.h +++ b/qt-ui/printoptions.h @@ -49,7 +49,7 @@ struct template_options { } }; -extern template_options::color_palette_struct almond_colors; +extern template_options::color_palette_struct almond_colors, custom_colors; // should be based on a custom QPrintDialog class class PrintOptions : public QWidget { |