From 6e127eb49d6a71e4d05cbb2e29fc164e718a903c Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Thu, 18 Feb 2021 17:44:17 +1100 Subject: Add unlimited cache life option --- src/dialogs/settingsdialog.cpp | 10 +++++++++- src/dialogs/settingsdialog.hpp | 1 + src/dialogs/settingsdialog.ui | 37 ++++++++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 12 deletions(-) (limited to 'src/dialogs') diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp index 4cc0ed6..b943a56 100644 --- a/src/dialogs/settingsdialog.cpp +++ b/src/dialogs/settingsdialog.cpp @@ -121,7 +121,7 @@ void SettingsDialog::setGeminiStyle(DocumentStyle const &style) this->ui->enable_justify_text->setChecked(this->current_style.justify_text); this->ui->enable_text_width->setChecked(this->current_style.text_width_enabled); - + this->ui->text_width->setEnabled(this->current_style.text_width_enabled); this->ui->text_width->setValue(this->current_style.text_width); this->ui->line_height_p->setValue(this->current_style.line_height_p); @@ -301,6 +301,8 @@ void SettingsDialog::setOptions(const GenericSettings &options) this->ui->cache_limit->setValue(this->current_options.cache_limit); this->ui->cache_threshold->setValue(this->current_options.cache_threshold); 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); } GenericSettings SettingsDialog::options() const @@ -837,3 +839,9 @@ void SettingsDialog::on_cache_life_valueChanged(int life) { this->current_options.cache_life = life; } + +void SettingsDialog::on_enable_unlimited_cache_life_clicked(bool checked) +{ + this->current_options.cache_unlimited_life = checked; + this->ui->cache_life->setEnabled(!checked); +} diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp index 226abed..80afcc6 100644 --- a/src/dialogs/settingsdialog.hpp +++ b/src/dialogs/settingsdialog.hpp @@ -157,6 +157,7 @@ private slots: void on_cache_limit_valueChanged(int limit); void on_cache_threshold_valueChanged(int thres); void on_cache_life_valueChanged(int life); + void on_enable_unlimited_cache_life_clicked(bool checked); private: void reloadStylePreview(); diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui index b1890e3..c32489c 100644 --- a/src/dialogs/settingsdialog.ui +++ b/src/dialogs/settingsdialog.ui @@ -500,17 +500,31 @@ - - - minutes - - - 0 - - - 8760 - - + + + + + minutes + + + 0 + + + 8760 + + + + + + + Unlimited item life + + + Sets cached items to be unexpirable. Items will only be removed if the cache is full. + + + + @@ -1425,6 +1439,7 @@ cache_limit cache_threshold cache_life + enable_unlimited_cache_life bg_change_color style_preview std_change_font -- cgit v1.2.3