Made updater interval configurable

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-01-22 21:26:46 +02:00
parent 78482d0d3e
commit 9bbeb5ef3a
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
3 changed files with 30 additions and 1 deletions

View File

@ -185,6 +185,7 @@ void LauncherPage::applySettings()
// Updates
if (APPLICATION->updater()) {
APPLICATION->updater()->setAutomaticallyChecksForUpdates(ui->autoUpdateCheckBox->isChecked());
APPLICATION->updater()->setUpdateCheckInterval(ui->updateIntervalSpinBox->value() * 3600);
}
s->set("MenuBarInsteadOfToolBar", ui->preferMenuBarCheckBox->isChecked());
@ -234,6 +235,7 @@ void LauncherPage::loadSettings()
// Updates
if (APPLICATION->updater()) {
ui->autoUpdateCheckBox->setChecked(APPLICATION->updater()->getAutomaticallyChecksForUpdates());
ui->updateIntervalSpinBox->setValue(APPLICATION->updater()->getUpdateCheckInterval() / 3600);
}
// Toolbar/menu bar settings (not applicable if native menu bar is present)

View File

@ -58,6 +58,33 @@
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="updateSetingsLayout">
<item row="0" column="0">
<widget class="QLabel" name="updateIntervalLabel">
<property name="text">
<string>Update interval</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="updateIntervalSpinBox">
<property name="toolTip">
<string>Set it to 0 to only check on launch</string>
</property>
<property name="suffix">
<string>h</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>99999999</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View File

@ -257,7 +257,7 @@ void PrismExternalUpdater::setBetaAllowed(bool allowed)
void PrismExternalUpdater::resetAutoCheckTimer()
{
if (priv->autoCheck) {
if (priv->autoCheck && priv->updateInterval > 0) {
int timeoutDuration = 0;
auto now = QDateTime::currentDateTime();
if (priv->lastCheck.isValid()) {