aboutsummaryrefslogtreecommitdiff
path: root/src/dialogs
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-01-08 15:34:54 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-01-08 11:12:14 +0100
commit35756f7a1b49f8d7aa603dd3bbe3c0a2c2d234a6 (patch)
treec9a8fd3bc483623cd1fa294ee8eb866dd189b93c /src/dialogs
parent443da5e34a3b858a2a32c6ca6846e351fa11f389 (diff)
downloadkristall-35756f7a1b49f8d7aa603dd3bbe3c0a2c2d234a6.tar.gz
cache: item expiry and max item size
currently no total limit yet
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/settingsdialog.cpp22
-rw-r--r--src/dialogs/settingsdialog.hpp6
-rw-r--r--src/dialogs/settingsdialog.ui73
3 files changed, 99 insertions, 2 deletions
diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp
index f18065f..0925578 100644
--- a/src/dialogs/settingsdialog.cpp
+++ b/src/dialogs/settingsdialog.cpp
@@ -250,6 +250,10 @@ void SettingsDialog::setOptions(const GenericSettings &options)
this->ui->network_timeout->setValue(this->current_options.network_timeout);
this->ui->enable_home_btn->setChecked(this->current_options.enable_home_btn);
+
+ 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);
}
GenericSettings SettingsDialog::options() const
@@ -660,8 +664,7 @@ void SettingsDialog::on_redirection_mode_currentIndexChanged(int index)
this->current_options.redirection_policy = GenericSettings::RedirectionWarning(this->ui->redirection_mode->itemData(index).toInt());
}
-void SettingsDialog::on_max_redirects_valueChanged(int max_redirections)
-{
+void SettingsDialog::on_max_redirects_valueChanged(int max_redirections) {
this->current_options.max_redirections = max_redirections;
}
@@ -674,3 +677,18 @@ void SettingsDialog::on_enable_home_btn_clicked(bool checked)
{
this->current_options.enable_home_btn = checked;
}
+
+void SettingsDialog::on_cache_limit_valueChanged(int limit)
+{
+ this->current_options.cache_limit = limit;
+}
+
+void SettingsDialog::on_cache_threshold_valueChanged(int thres)
+{
+ this->current_options.cache_threshold = thres;
+}
+
+void SettingsDialog::on_cache_life_valueChanged(int life)
+{
+ this->current_options.cache_life = life;
+}
diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp
index fd1d7cb..dac7a10 100644
--- a/src/dialogs/settingsdialog.hpp
+++ b/src/dialogs/settingsdialog.hpp
@@ -132,6 +132,12 @@ private slots:
void on_enable_home_btn_clicked(bool arg1);
+ void on_cache_limit_valueChanged(int limit);
+
+ void on_cache_threshold_valueChanged(int thres);
+
+ void on_cache_life_valueChanged(int life);
+
private:
void reloadStylePreview();
diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui
index c61b62a..a194f40 100644
--- a/src/dialogs/settingsdialog.ui
+++ b/src/dialogs/settingsdialog.ui
@@ -371,6 +371,79 @@
</property>
</widget>
</item>
+
+ <item row="14" column="0">
+ <widget class="QLabel" name="label_30">
+ <property name="text">
+ <string>Total cache size limit</string>
+ </property>
+ <property name="toolTip">
+ <string>The total amount of memory that can be occupied by cached items. Set to zero to disable in-memory caching.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="14" column="1">
+ <widget class="QSpinBox" name="cache_limit">
+ <property name="suffix">
+ <string> MiB</string>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>4000</number>
+ </property>
+ </widget>
+ </item>
+
+ <item row="15" column="0">
+ <widget class="QLabel" name="label_31">
+ <property name="text">
+ <string>Cached item size threshold</string>
+ </property>
+ <property name="toolTip">
+ <string>Items which are below this threshold are cached in memory. Any above are simply discarded.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="15" column="1">
+ <widget class="QSpinBox" name="cache_threshold">
+ <property name="suffix">
+ <string> KiB</string>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>102400</number>
+ </property>
+ </widget>
+ </item>
+
+ <item row="16" column="0">
+ <widget class="QLabel" name="label_31">
+ <property name="text">
+ <string>Cached item life</string>
+ </property>
+ <property name="toolTip">
+ <string>How long cached items last before they are expired and require a reload.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="16" 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>
+ </item>
+
</layout>
</widget>
<widget class="QWidget" name="style_tab">