From a600ea5201f55a3182cb24a0553d02aefad2c51b Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Mon, 29 Jun 2015 03:16:19 +0200 Subject: Printing: add template_options struct that contains template The template_options struct holds the settings variables in the code. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov --- qt-ui/printdialog.cpp | 2 +- qt-ui/printdialog.h | 2 ++ qt-ui/printoptions.cpp | 5 +++-- qt-ui/printoptions.h | 3 ++- qt-ui/templateedit.cpp | 2 +- qt-ui/templateedit.h | 11 +++++++++-- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index 6e193d9bd..341a84083 100644 --- a/qt-ui/printdialog.cpp +++ b/qt-ui/printdialog.cpp @@ -34,7 +34,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f } // create a print options object and pass our options struct - optionsWidget = new PrintOptions(this, &printOptions); + optionsWidget = new PrintOptions(this, &printOptions, &templateOptions); // create a new printer object printer = new Printer(&qprinter, &printOptions); diff --git a/qt-ui/printdialog.h b/qt-ui/printdialog.h index a34037442..a00c4c5d9 100644 --- a/qt-ui/printdialog.h +++ b/qt-ui/printdialog.h @@ -6,6 +6,7 @@ #include #include "printoptions.h" #include "printer.h" +#include "templateedit.h" class QProgressBar; class PrintOptions; @@ -24,6 +25,7 @@ private: Printer *printer; QPrinter qprinter; struct print_options printOptions; + struct template_options templateOptions; private slots: diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index 0609b2b13..a7c520b21 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -2,7 +2,7 @@ #include "templateedit.h" #include -PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt) +PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt, struct template_options *templateOpt) { hasSetupSlots = false; ui.setupUi(this); @@ -11,6 +11,7 @@ PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt) if (!printOpt) return; setup(printOpt); + templateOptions = templateOpt; } void PrintOptions::setup(struct print_options *printOpt) @@ -101,6 +102,6 @@ void PrintOptions::on_printTemplate_currentIndexChanged(int index) void PrintOptions::on_editButton_clicked() { - TemplateEdit te; + TemplateEdit te(this, templateOptions); te.exec(); } diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h index 324697762..9bacd4e90 100644 --- a/qt-ui/printoptions.h +++ b/qt-ui/printoptions.h @@ -25,12 +25,13 @@ class PrintOptions : public QWidget { Q_OBJECT public: - explicit PrintOptions(QWidget *parent = 0, struct print_options *printOpt = 0); + explicit PrintOptions(QWidget *parent, struct print_options *printOpt, struct template_options *templateOpt); void setup(struct print_options *printOpt); private: Ui::PrintOptions ui; struct print_options *printOptions; + struct template_options *templateOptions; bool hasSetupSlots; private diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index 1db62b619..40e14c221 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -1,7 +1,7 @@ #include "templateedit.h" #include "ui_templateedit.h" -TemplateEdit::TemplateEdit(QWidget *parent) : +TemplateEdit::TemplateEdit(QWidget *parent, struct template_options *templateOptions) : QDialog(parent), ui(new Ui::TemplateEdit) { diff --git a/qt-ui/templateedit.h b/qt-ui/templateedit.h index f1003e461..2790c619b 100644 --- a/qt-ui/templateedit.h +++ b/qt-ui/templateedit.h @@ -3,6 +3,13 @@ #include +struct template_options { + int font_index; + int color_palette_index; + double font_size; + double line_spacing; +}; + namespace Ui { class TemplateEdit; } @@ -12,11 +19,11 @@ class TemplateEdit : public QDialog Q_OBJECT public: - explicit TemplateEdit(QWidget *parent = 0); + explicit TemplateEdit(QWidget *parent, struct template_options *templateOptions); ~TemplateEdit(); - private: Ui::TemplateEdit *ui; + struct template_options *templateOptions; }; #endif // TEMPLATEEDIT_H -- cgit v1.2.3-70-g09d2