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 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/dialogs/settingsdialog.cpp') 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; -- cgit v1.2.3