Printing: move template_options to print_options.h

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Gehad elrobey 2015-07-05 07:26:39 +02:00 committed by Lubomir I. Ivanov
parent a70cea95e8
commit c44496e23d
5 changed files with 13 additions and 11 deletions

View file

@ -108,6 +108,6 @@ void PrintOptions::on_printTemplate_currentIndexChanged(int index)
void PrintOptions::on_editButton_clicked() void PrintOptions::on_editButton_clicked()
{ {
TemplateEdit te(this, templateOptions); TemplateEdit te(this, printOptions, templateOptions);
te.exec(); te.exec();
} }

View file

@ -21,6 +21,13 @@ struct print_options {
bool landscape; bool landscape;
}; };
struct template_options {
int font_index;
int color_palette_index;
double font_size;
double line_spacing;
};
// should be based on a custom QPrintDialog class // should be based on a custom QPrintDialog class
class PrintOptions : public QWidget { class PrintOptions : public QWidget {
Q_OBJECT Q_OBJECT

View file

@ -1,12 +1,14 @@
#include "templateedit.h" #include "templateedit.h"
#include "printoptions.h"
#include "ui_templateedit.h" #include "ui_templateedit.h"
TemplateEdit::TemplateEdit(QWidget *parent, struct template_options *templateOptions) : TemplateEdit::TemplateEdit(QWidget *parent, struct print_options *printOptions, struct template_options *templateOptions) :
QDialog(parent), QDialog(parent),
ui(new Ui::TemplateEdit) ui(new Ui::TemplateEdit)
{ {
ui->setupUi(this); ui->setupUi(this);
this->templateOptions = templateOptions; this->templateOptions = templateOptions;
this->printOptions = printOptions;
// restore the settings and init the UI // restore the settings and init the UI
ui->fontSelection->setCurrentIndex(templateOptions->font_index); ui->fontSelection->setCurrentIndex(templateOptions->font_index);

View file

@ -3,13 +3,6 @@
#include <QDialog> #include <QDialog>
struct template_options {
int font_index;
int color_palette_index;
double font_size;
double line_spacing;
};
namespace Ui { namespace Ui {
class TemplateEdit; class TemplateEdit;
} }
@ -19,7 +12,7 @@ class TemplateEdit : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit TemplateEdit(QWidget *parent, struct template_options *templateOptions); explicit TemplateEdit(QWidget *parent, struct print_options *printOptions, struct template_options *templateOptions);
~TemplateEdit(); ~TemplateEdit();
private slots: private slots:
void on_fontsize_valueChanged(int font_size); void on_fontsize_valueChanged(int font_size);
@ -33,6 +26,7 @@ private slots:
private: private:
Ui::TemplateEdit *ui; Ui::TemplateEdit *ui;
struct template_options *templateOptions; struct template_options *templateOptions;
struct print_options *printOptions;
}; };
#endif // TEMPLATEEDIT_H #endif // TEMPLATEEDIT_H

View file

@ -4,7 +4,6 @@
#include <grantlee_templates.h> #include <grantlee_templates.h>
#include "mainwindow.h" #include "mainwindow.h"
#include "printoptions.h" #include "printoptions.h"
#include "templateedit.h"
int getTotalWork(print_options *printOptions); int getTotalWork(print_options *printOptions);