Merge pull request #2054 from Trial97/add_configurable_updater_interval

Made updater interval configurable
This commit is contained in:
Alexandru Ionut Tripon 2024-06-10 09:22:54 +03:00 committed by GitHub
commit 95e7f36732
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 1 deletions

View File

@ -196,6 +196,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());
@ -246,6 +247,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()) {