Move plugins "automatically check for updates" settings key to

a new key

This change moves the old "app/plugin_installer/checkOnStart" setting
key to a new "plugins/automatically-check-for-updates" key, and
switches the default value to enable automatic checks

This is designed to switch all existing QGIS users to the new
default behavior of checking for plugin updates at startup (at
a maximum of once every 3 days).

It is intended to offer a better QGIS experience to our users,
by proactively informing all users when plugins should be
updated, ensuring that ALL users are more likely to upgrade
plugins and get the bug fixes for plugins promptly.

Enterprise users who have customised this setting in their
deployments will need to adapt their scripts for the new
setting key.
This commit is contained in:
Nyall Dawson 2022-09-15 15:21:14 +10:00
parent 9e12c70f21
commit 094cd30650
4 changed files with 12 additions and 7 deletions

View File

@ -41,6 +41,7 @@ import re
import configparser
import qgis.utils
from qgis.core import QgsNetworkAccessManager, QgsApplication
from qgis.gui import QgsGui
from qgis.utils import iface, plugin_paths
from .version_compare import pyQgisVersion, compareVersions, normalizeVersion, isCompatible
@ -229,13 +230,11 @@ class Repositories(QObject):
def checkingOnStart(self) -> bool:
""" return true if checking for news and updates is enabled """
settings = QgsSettings()
return settings.value(settingsGroup + "/checkOnStart", True, type=bool)
return QgsGui.settingsRegistryGui().settingsEntry('plugins/automatically-check-for-updates').value()
def setCheckingOnStart(self, state: bool):
""" set state of checking for news and updates """
settings = QgsSettings()
settings.setValue(settingsGroup + "/checkOnStart", state)
QgsGui.settingsRegistryGui().settingsEntry('plugins/automatically-check-for-updates').setValue(state)
def saveCheckingOnStartLastDate(self):
""" set today's date as the day of last checking """

View File

@ -48,6 +48,8 @@
#include "qgslogger.h"
#include "qgspluginitemdelegate.h"
#include "qgssettings.h"
#include "qgsgui.h"
#include "qgssettingsregistrygui.h"
#ifdef WITH_BINDINGS
#include "qgspythonutils.h"
#endif
@ -239,7 +241,7 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils )
connect( buttonInstallFromZip, &QPushButton::clicked, this, &QgsPluginManager::buttonInstallFromZip_clicked );
// Initialize the "Settings" tab widgets
if ( settings.value( settingsGroup + "/checkOnStart", true ).toBool() )
if ( QgsSettingsRegistryGui::settingsAutomaticallyCheckForPluginUpdates.value() )
{
ckbCheckUpdates->setChecked( true );
}
@ -1286,8 +1288,7 @@ void QgsPluginManager::reject()
// get the QgsSettings group from the installer
QString settingsGroup;
QgsPythonRunner::eval( QStringLiteral( "pyplugin_installer.instance().exportSettingsGroup()" ), settingsGroup );
QgsSettings settings;
settings.setValue( settingsGroup + "/checkOnStart", QVariant( ckbCheckUpdates->isChecked() ) );
QgsSettingsRegistryGui::settingsAutomaticallyCheckForPluginUpdates.setValue( ckbCheckUpdates->isChecked() );
QgsPythonRunner::run( QStringLiteral( "pyplugin_installer.instance().onManagerClose()" ) );
}
#endif

View File

@ -23,6 +23,7 @@ QgsSettingsRegistryGui::QgsSettingsRegistryGui()
: QgsSettingsRegistry()
{
addSettingsEntry( &settingsRespectScreenDPI );
addSettingsEntry( &settingsAutomaticallyCheckForPluginUpdates );
addSettingsEntry( &QgsStyleManagerDialog::settingLastStyleDatabaseFolder );
QgsApplication::settingsRegistryCore()->addSubRegistry( this );

View File

@ -47,6 +47,10 @@ class GUI_EXPORT QgsSettingsRegistryGui : public QgsSettingsRegistry
#ifndef SIP_RUN
//! Settings entry respect screen dpi
static const inline QgsSettingsEntryBool settingsRespectScreenDPI = QgsSettingsEntryBool( QStringLiteral( "respect_screen_dpi" ), QgsSettings::Prefix::GUI_QGIS, false );
//! Check for plugin updates automatically on startup
static const inline QgsSettingsEntryBool settingsAutomaticallyCheckForPluginUpdates = QgsSettingsEntryBool( QStringLiteral( "automatically-check-for-updates" ), QgsSettings::Prefix::PLUGINS, true, QStringLiteral( "Automatically check for plugin updates on startup" ) );
#endif
};