From 3b064297512692ecb96975c5a068ec87d653e7e0 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Wed, 10 Feb 2021 19:07:42 +1100 Subject: Add preferences for new gemini formatting options --- src/dialogs/settingsdialog.cpp | 56 ++++++++++++++ src/dialogs/settingsdialog.hpp | 11 +++ src/dialogs/settingsdialog.ui | 170 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 235 insertions(+), 2 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp index 229a728..d979bbe 100644 --- a/src/dialogs/settingsdialog.cpp +++ b/src/dialogs/settingsdialog.cpp @@ -107,8 +107,21 @@ void SettingsDialog::setGeminiStyle(DocumentStyle const &style) this->ui->auto_theme->setCurrentIndex(this->current_style.theme); + this->ui->link_local_prefix->setText(this->current_style.internal_link_prefix); + this->ui->link_foreign_prefix->setText(this->current_style.external_link_prefix); + this->ui->page_margin->setValue(this->current_style.margin); + this->ui->enable_justify_text->setChecked(this->current_style.justify_text); + + this->ui->line_height_p->setValue(this->current_style.line_height_p); + this->ui->line_height_h->setValue(this->current_style.line_height_h); + + this->ui->indent_bq->setValue(this->current_style.indent_bq); + this->ui->indent_p->setValue(this->current_style.indent_p); + this->ui->indent_h->setValue(this->current_style.indent_h); + this->ui->indent_l->setValue(this->current_style.indent_l); + auto setFontAndColor = [this](QLabel * label, const QFont &font, QColor color) { label->setText(formatFont(font)); @@ -420,6 +433,49 @@ void SettingsDialog::on_page_margin_valueChanged(double value) this->reloadStylePreview(); } +void SettingsDialog::on_enable_justify_text_clicked(bool checked) +{ + this->current_style.justify_text = checked; + this->reloadStylePreview(); +} + +void SettingsDialog::on_line_height_p_valueChanged(double value) +{ + this->current_style.line_height_p = value; + this->reloadStylePreview(); +} + +void SettingsDialog::on_line_height_h_valueChanged(double value) +{ + this->current_style.line_height_h = value; + this->reloadStylePreview(); +} + +void SettingsDialog::on_indent_bq_valueChanged(int value) +{ + this->current_style.indent_bq = value; + this->reloadStylePreview(); +} + +void SettingsDialog::on_indent_h_valueChanged(int value) +{ + this->current_style.indent_h = value; + this->reloadStylePreview(); +} + +void SettingsDialog::on_indent_p_valueChanged(int value) +{ + this->current_style.indent_p = value; + this->reloadStylePreview(); +} + +void SettingsDialog::on_indent_l_valueChanged(int value) +{ + this->current_style.indent_l = value; + this->reloadStylePreview(); +} + + void SettingsDialog::on_presets_currentIndexChanged(int index) { this->ui->preset_load->setEnabled(index >= 0); diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp index 6638583..6768ab4 100644 --- a/src/dialogs/settingsdialog.hpp +++ b/src/dialogs/settingsdialog.hpp @@ -78,6 +78,17 @@ private slots: void on_page_margin_valueChanged(double arg1); + void on_enable_justify_text_clicked(bool arg1); + + void on_line_height_p_valueChanged(double arg1); + + void on_line_height_h_valueChanged(double arg1); + + void on_indent_bq_valueChanged(int value); + void on_indent_p_valueChanged(int value); + void on_indent_h_valueChanged(int value); + void on_indent_l_valueChanged(int value); + void on_presets_currentIndexChanged(int index); void on_preset_new_clicked(); diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui index 9678166..b36da92 100644 --- a/src/dialogs/settingsdialog.ui +++ b/src/dialogs/settingsdialog.ui @@ -6,7 +6,7 @@ 0 0 - 850 + 1100 650 @@ -877,7 +877,166 @@ + + + + Other options + + + + + + + + Justify text + + + Justify text on the page, instead of left-aligning it. + + + + + + + + + Line height (paragraph) + + + + + + + px + + + 0 + + + 30 + + + + + + + Line height (header) + + + + + + + px + + + 0 + + + 30 + + + + + + + + Indentation + + + + + + + + + + Par: + + + + + + + 1 + + + 0 + + + 7 + + + + + + + + Hea: + + + + + + + 0 + + + 0 + + + 7 + + + + + + + + Quo: + + + + + + + 2 + + + 0 + + + 7 + + + + + + + + Lst: + + + + + + + 2 + + + 0 + + + 7 + + + + + + + + @@ -953,7 +1112,7 @@ - + Presets @@ -1106,6 +1265,13 @@ quote_change_color auto_theme page_margin + enable_justify_text + line_height_p + line_height_h + indent_p + indent_h + indent_bq + indent_l presets preset_new preset_save -- cgit v1.2.3