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