mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 02:43:23 +00:00
Printing: add template_options struct that contains template
The template_options struct holds the settings variables in the code. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
ff594c65e3
commit
a600ea5201
6 changed files with 18 additions and 7 deletions
|
@ -34,7 +34,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a print options object and pass our options struct
|
// 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
|
// create a new printer object
|
||||||
printer = new Printer(&qprinter, &printOptions);
|
printer = new Printer(&qprinter, &printOptions);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include "printoptions.h"
|
#include "printoptions.h"
|
||||||
#include "printer.h"
|
#include "printer.h"
|
||||||
|
#include "templateedit.h"
|
||||||
|
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
class PrintOptions;
|
class PrintOptions;
|
||||||
|
@ -24,6 +25,7 @@ private:
|
||||||
Printer *printer;
|
Printer *printer;
|
||||||
QPrinter qprinter;
|
QPrinter qprinter;
|
||||||
struct print_options printOptions;
|
struct print_options printOptions;
|
||||||
|
struct template_options templateOptions;
|
||||||
|
|
||||||
private
|
private
|
||||||
slots:
|
slots:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "templateedit.h"
|
#include "templateedit.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt)
|
PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt, struct template_options *templateOpt)
|
||||||
{
|
{
|
||||||
hasSetupSlots = false;
|
hasSetupSlots = false;
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
@ -11,6 +11,7 @@ PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt)
|
||||||
if (!printOpt)
|
if (!printOpt)
|
||||||
return;
|
return;
|
||||||
setup(printOpt);
|
setup(printOpt);
|
||||||
|
templateOptions = templateOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintOptions::setup(struct print_options *printOpt)
|
void PrintOptions::setup(struct print_options *printOpt)
|
||||||
|
@ -101,6 +102,6 @@ void PrintOptions::on_printTemplate_currentIndexChanged(int index)
|
||||||
|
|
||||||
void PrintOptions::on_editButton_clicked()
|
void PrintOptions::on_editButton_clicked()
|
||||||
{
|
{
|
||||||
TemplateEdit te;
|
TemplateEdit te(this, templateOptions);
|
||||||
te.exec();
|
te.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,13 @@ class PrintOptions : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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);
|
void setup(struct print_options *printOpt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PrintOptions ui;
|
Ui::PrintOptions ui;
|
||||||
struct print_options *printOptions;
|
struct print_options *printOptions;
|
||||||
|
struct template_options *templateOptions;
|
||||||
bool hasSetupSlots;
|
bool hasSetupSlots;
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "templateedit.h"
|
#include "templateedit.h"
|
||||||
#include "ui_templateedit.h"
|
#include "ui_templateedit.h"
|
||||||
|
|
||||||
TemplateEdit::TemplateEdit(QWidget *parent) :
|
TemplateEdit::TemplateEdit(QWidget *parent, struct template_options *templateOptions) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::TemplateEdit)
|
ui(new Ui::TemplateEdit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
#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;
|
||||||
}
|
}
|
||||||
|
@ -12,11 +19,11 @@ class TemplateEdit : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TemplateEdit(QWidget *parent = 0);
|
explicit TemplateEdit(QWidget *parent, struct template_options *templateOptions);
|
||||||
~TemplateEdit();
|
~TemplateEdit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TemplateEdit *ui;
|
Ui::TemplateEdit *ui;
|
||||||
|
struct template_options *templateOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEMPLATEEDIT_H
|
#endif // TEMPLATEEDIT_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue