From f1615e725c7a5562b5fcaac2cd0701dae61b89ca Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Sat, 11 Jul 2015 01:37:27 +0200 Subject: Printing: add apply button to TemplateEdit class Add apply button to the dialog, Update the preview after applying the new settings. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov --- qt-ui/templateedit.cpp | 17 ++++++++++++++++- qt-ui/templateedit.h | 3 ++- qt-ui/templateedit.ui | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp index 0354131ef..2d09cb947 100644 --- a/qt-ui/templateedit.cpp +++ b/qt-ui/templateedit.cpp @@ -64,7 +64,7 @@ void TemplateEdit::on_colorpalette_currentIndexChanged(int index) newTemplateOptions.color_palette_index = index; } -void TemplateEdit::on_TemplateEdit_finished(int result) +void TemplateEdit::saveSettings() { if ((*templateOptions) != newTemplateOptions || grantlee_template.compare(ui->plainTextEdit->toPlainText())) { QMessageBox msgBox; @@ -78,3 +78,18 @@ void TemplateEdit::on_TemplateEdit_finished(int result) } } } + +void TemplateEdit::on_buttonBox_clicked(QAbstractButton *button) +{ + QDialogButtonBox::StandardButton standardButton = ui->buttonBox->standardButton(button); + switch (standardButton) { + case QDialogButtonBox::Ok: + saveSettings(); + break; + case QDialogButtonBox::Cancel: + break; + case QDialogButtonBox::Apply: + saveSettings(); + break; + } +} diff --git a/qt-ui/templateedit.h b/qt-ui/templateedit.h index 325d7eef3..9b6d9167f 100644 --- a/qt-ui/templateedit.h +++ b/qt-ui/templateedit.h @@ -24,7 +24,7 @@ private slots: void on_colorpalette_currentIndexChanged(int index); - void on_TemplateEdit_finished(int result); + void on_buttonBox_clicked(QAbstractButton *button); private: Ui::TemplateEdit *ui; @@ -32,6 +32,7 @@ private: struct template_options newTemplateOptions; struct print_options *printOptions; QString grantlee_template; + void saveSettings(); }; #endif // TEMPLATEEDIT_H diff --git a/qt-ui/templateedit.ui b/qt-ui/templateedit.ui index fa27eb324..de007c9b7 100644 --- a/qt-ui/templateedit.ui +++ b/qt-ui/templateedit.ui @@ -26,7 +26,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok -- cgit v1.2.3-70-g09d2