aboutsummaryrefslogtreecommitdiff
path: root/src/dialogs
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-02-18 17:44:17 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-02-18 11:23:23 +0100
commit6e127eb49d6a71e4d05cbb2e29fc164e718a903c (patch)
treea11e635dd5ae465c1173fe85e992c8e618fe2e7c /src/dialogs
parentfb230927ab64ebcb4f2fe75f33658127421738b9 (diff)
downloadkristall-6e127eb49d6a71e4d05cbb2e29fc164e718a903c.tar.gz
Add unlimited cache life option
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/settingsdialog.cpp10
-rw-r--r--src/dialogs/settingsdialog.hpp1
-rw-r--r--src/dialogs/settingsdialog.ui37
3 files changed, 36 insertions, 12 deletions
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 @@
</widget>
</item>
<item row="19" column="1">
- <widget class="QSpinBox" name="cache_life">
- <property name="suffix">
- <string> minutes</string>
- </property>
- <property name="minimum">
- <number>0</number>
- </property>
- <property name="maximum">
- <number>8760</number>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout_25">
+ <item>
+ <widget class="QSpinBox" name="cache_life">
+ <property name="suffix">
+ <string> minutes</string>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>8760</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="enable_unlimited_cache_life">
+ <property name="text">
+ <string>Unlimited item life</string>
+ </property>
+ <property name="toolTip">
+ <string>Sets cached items to be unexpirable. Items will only be removed if the cache is full.</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
@@ -1425,6 +1439,7 @@
<tabstop>cache_limit</tabstop>
<tabstop>cache_threshold</tabstop>
<tabstop>cache_life</tabstop>
+ <tabstop>enable_unlimited_cache_life</tabstop>
<tabstop>bg_change_color</tabstop>
<tabstop>style_preview</tabstop>
<tabstop>std_change_font</tabstop>