Robert C. Helling 9583173425 desktop: implement template previewing for WebEngine
This allows the template editor to preview in a QWebEngineView. It also
improves the logic of the buttons (Apply updates the preview but does not force
a save first).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-26 12:35:34 -08:00

47 lines
1.1 KiB
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef TEMPLATEEDIT_H
#define TEMPLATEEDIT_H
#include <QDialog>
#include "printoptions.h"
#ifdef USE_WEBENGINE
#include "printerwebengine.h"
#endif
namespace Ui {
class TemplateEdit;
}
class TemplateEdit : public QDialog
{
Q_OBJECT
public:
explicit TemplateEdit(QWidget *parent, print_options &printOptions, template_options &templateOptions);
~TemplateEdit();
private slots:
void on_fontsize_valueChanged(int font_size);
void on_linespacing_valueChanged(double line_spacing);
void on_borderwidth_valueChanged(double border_width);
void on_fontSelection_currentIndexChanged(int index);
void on_colorpalette_currentIndexChanged(int index);
void on_buttonBox_clicked(QAbstractButton *button);
void colorSelect(QAbstractButton *button);
private:
Ui::TemplateEdit *ui;
QButtonGroup *btnGroup;
bool editingCustomColors;
print_options &printOptions;
template_options &templateOptions;
struct template_options newTemplateOptions;
QString grantlee_template;
void saveSettings();
void updatePreview();
#ifdef USE_WEBENGINE
Printer *preview;
#endif
};
#endif // TEMPLATEEDIT_H