From 19c8bf98885074617f9cc0a0b2f60ebf47ddf714 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Fri, 1 Jan 2021 19:26:15 +1100 Subject: Added UI density option. 'Compact' is the default - saves screen space a bit. The old layout is available in the 'Classic' option --- src/dialogs/settingsdialog.cpp | 19 ++++++++++++++ src/dialogs/settingsdialog.hpp | 2 ++ src/dialogs/settingsdialog.ui | 59 ++++++++++++++++++++++++++---------------- 3 files changed, 57 insertions(+), 23 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp index 95fc0e9..f18065f 100644 --- a/src/dialogs/settingsdialog.cpp +++ b/src/dialogs/settingsdialog.cpp @@ -34,6 +34,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) : this->ui->ui_theme->addItem(tr("Light"), QVariant::fromValue(int(Theme::light))); this->ui->ui_theme->addItem(tr("Dark"), QVariant::fromValue(int(Theme::dark))); + this->ui->ui_density->clear(); + this->ui->ui_density->addItem(tr("Compact"), QVariant::fromValue(int(UIDensity::compact))); + this->ui->ui_density->addItem(tr("Classic"), QVariant::fromValue(int(UIDensity::classic))); + setGeminiStyle(DocumentStyle { }); this->predefined_styles.clear(); @@ -186,6 +190,14 @@ void SettingsDialog::setOptions(const GenericSettings &options) } } + this->ui->ui_density->setCurrentIndex(0); + for(int i = 0; i < this->ui->ui_density->count(); ++i) { + if (this->ui->ui_density->itemData(i).toInt() == int(options.ui_density)) { + this->ui->ui_density->setCurrentIndex(i); + break; + } + } + this->ui->start_page->setText(this->current_options.start_page); if(this->current_options.gophermap_display == GenericSettings::PlainText) { @@ -576,6 +588,13 @@ void SettingsDialog::on_ui_theme_currentIndexChanged(int index) kristall::setTheme(this->current_options.theme); } +void SettingsDialog::on_ui_density_currentIndexChanged(int index) +{ + this->current_options.ui_density = UIDensity(this->ui->ui_density->itemData(index).toInt()); + + kristall::setUiDensity(this->current_options.ui_density, true); +} + void SettingsDialog::on_fancypants_on_clicked() { this->current_options.text_display = GenericSettings::FormattedText; diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp index 004cfd0..fd1d7cb 100644 --- a/src/dialogs/settingsdialog.hpp +++ b/src/dialogs/settingsdialog.hpp @@ -98,6 +98,8 @@ private slots: void on_ui_theme_currentIndexChanged(int index); + void on_ui_density_currentIndexChanged(int index); + void on_fancypants_on_clicked(); void on_fancypants_off_clicked(); diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui index b733960..c61b62a 100644 --- a/src/dialogs/settingsdialog.ui +++ b/src/dialogs/settingsdialog.ui @@ -43,27 +43,37 @@ + + + UI Density + + + + + + + Start Page: - + about://blank - + Enabled Protocols - + @@ -108,14 +118,14 @@ - + Text Rendering - + @@ -142,14 +152,14 @@ - + Enable text highlights - + @@ -176,14 +186,14 @@ - + Gopher Map - + @@ -210,14 +220,14 @@ - + Unknown Scheme - + @@ -241,14 +251,14 @@ - + Hidden files in file:// directories - + @@ -272,14 +282,14 @@ - + URL bar highlights - + @@ -303,38 +313,38 @@ - + Max. Number of Redirections - + 5 - + Redirection Handling - + - + Network Timeout - + ms @@ -347,14 +357,14 @@ - + Additional toolbar buttons - + Home @@ -969,6 +979,7 @@ tabWidget ui_theme + ui_density start_page enable_gemini enable_gopher @@ -1059,5 +1070,7 @@ + + -- cgit v1.2.3