From f60dac9d7ebb5b989aad67d67d5ab3ccef7d278c Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Mon, 15 Mar 2021 12:57:36 +0100 Subject: Adds option to have old or new session behaviour. Closes #187 --- src/dialogs/settingsdialog.cpp | 18 ++++++ src/dialogs/settingsdialog.hpp | 2 + src/dialogs/settingsdialog.ui | 130 ++++++++++++++++++++++------------------- 3 files changed, 90 insertions(+), 60 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp index f6d4728..ea30d4f 100644 --- a/src/dialogs/settingsdialog.cpp +++ b/src/dialogs/settingsdialog.cpp @@ -54,6 +54,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) : this->ui->list_symbol->addItem(tr("Circle"), QVariant::fromValue(int(QTextListFormat::Style::ListCircle))); this->ui->list_symbol->addItem(tr("Square"), QVariant::fromValue(int(QTextListFormat::Style::ListSquare))); + this->ui->session_restore_behaviour->clear(); + this->ui->session_restore_behaviour->addItem(tr("Start Page"), QVariant::fromValue(GenericSettings::NoSessionRestore)); + this->ui->session_restore_behaviour->addItem(tr("Restore Last Session"), QVariant::fromValue(GenericSettings::RestoreLastSession)); + setGeminiStyle(DocumentStyle { }); this->predefined_styles.clear(); @@ -372,6 +376,15 @@ void SettingsDialog::setOptions(const GenericSettings &options) this->ui->cache_life->setValue(this->current_options.cache_life); this->ui->enable_unlimited_cache_life->setChecked(this->current_options.cache_unlimited_life); this->ui->cache_life->setEnabled(!this->current_options.cache_unlimited_life); + + this->ui->session_restore_behaviour->setCurrentIndex(0); + for(int i = 0; i < this->ui->session_restore_behaviour->count(); ++i) + { + if(this->ui->session_restore_behaviour->itemData(i).toInt() == int(options.session_restore_behaviour)) { + this->ui->session_restore_behaviour->setCurrentIndex(i); + break; + } + } } GenericSettings SettingsDialog::options() const @@ -970,3 +983,8 @@ void SettingsDialog::on_strip_nav_off_clicked() { this->current_options.strip_nav = false; } + +void SettingsDialog::on_session_restore_behaviour_currentIndexChanged(int index) +{ + this->current_options.session_restore_behaviour = GenericSettings::SessionRestoreBehaviour(this->ui->session_restore_behaviour->itemData(index).toInt()); +} diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp index 9f996b1..97b1549 100644 --- a/src/dialogs/settingsdialog.hpp +++ b/src/dialogs/settingsdialog.hpp @@ -176,6 +176,8 @@ private slots: void on_strip_nav_off_clicked(); + void on_session_restore_behaviour_currentIndexChanged(int index); + private: void reloadStylePreview(); diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui index e33ec43..97121c3 100644 --- a/src/dialogs/settingsdialog.ui +++ b/src/dialogs/settingsdialog.ui @@ -60,44 +60,93 @@ + + + + Additional toolbar buttons + + + + + + + + + Home + + + + + + + New tab + + + + + + + Root (/) + + + + + + + Parent (..) + + + + + + + + Startup Behaviour + + + + + + + UI Theme - + - + Icon Theme - + - + UI Density - + - + Enabled Protocols - + @@ -142,14 +191,14 @@ - + Unknown Scheme - + @@ -173,38 +222,38 @@ - + Max. Number of Redirections - + 5 - + Redirection Handling - + - + Network Timeout - + ms @@ -217,45 +266,6 @@ - - - - Additional toolbar buttons - - - - - - - - - Home - - - - - - - New tab - - - - - - - Root (/) - - - - - - - Parent (..) - - - - - @@ -1663,14 +1673,14 @@ + + + - + + - - - - - + -- cgit v1.2.3