From 9e12c70f2119eca5f85d68531fe14caf8c8eff5c Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 15 Sep 2022 15:04:38 +1000 Subject: [PATCH] Remove option to control plugin update check frequency, and hardcode to every 3 days This level of configuration is not warranted here --- python/pyplugin_installer/installer_data.py | 29 ++--------- src/app/pluginmanager/qgspluginmanager.cpp | 13 +---- src/app/pluginmanager/qgspluginmanager.h | 2 - src/ui/qgspluginmanagerbase.ui | 55 +++------------------ 4 files changed, 12 insertions(+), 87 deletions(-) diff --git a/python/pyplugin_installer/installer_data.py b/python/pyplugin_installer/installer_data.py index bb7fe98a43d..9aa4632a071 100644 --- a/python/pyplugin_installer/installer_data.py +++ b/python/pyplugin_installer/installer_data.py @@ -172,6 +172,8 @@ class Repositories(QObject): STATE_UNAVAILABLE = 3 STATE_REJECTED = 4 + CHECK_ON_START_INTERVAL = 3 + anythingChanged = pyqtSignal(str, int, int) repositoryFetched = pyqtSignal(str) checkingDone = pyqtSignal() @@ -235,29 +237,6 @@ class Repositories(QObject): settings = QgsSettings() settings.setValue(settingsGroup + "/checkOnStart", state) - def checkingOnStartInterval(self) -> int: - """ return checking for news and updates interval (in days)""" - settings = QgsSettings() - try: - # QgsSettings may contain non-int value... - i = settings.value(settingsGroup + "/checkOnStartInterval", 3, type=int) - except: - # fallback to 3 days by default - i = 3 - if i < 0: - i = 3 - # allowed values: 0,1,3,7,14,30 days - interval = 0 - for j in [1, 3, 7, 14, 30]: - if i >= j: - interval = j - return interval - - def setCheckingOnStartInterval(self, interval: int): - """ set checking for news and updates interval (in days)""" - settings = QgsSettings() - settings.setValue(settingsGroup + "/checkOnStartInterval", interval) - def saveCheckingOnStartLastDate(self): """ set today's date as the day of last checking """ settings = QgsSettings() @@ -265,15 +244,13 @@ class Repositories(QObject): def timeForChecking(self) -> bool: """ determine whether it's the time for checking for news and updates now """ - if self.checkingOnStartInterval() == 0: - return True settings = QgsSettings() try: # QgsSettings may contain ivalid value... interval = settings.value(settingsGroup + "/checkOnStartLastDate", type=QDate).daysTo(QDate.currentDate()) except: interval = 0 - if interval >= self.checkingOnStartInterval(): + if interval >= Repositories.CHECK_ON_START_INTERVAL: return True else: return False diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index e1b5885d652..9838c681fb7 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -32,13 +32,12 @@ #include #include #include +#include #include "qgsmessagelog.h" #include "qgis.h" -#include "qgisapp.h" #include "qgsapplication.h" -#include "qgsconfig.h" #include "qgsmessagebar.h" #include "qgsproviderregistry.h" #include "qgspluginregistry.h" @@ -239,9 +238,6 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils ) connect( mZipFileWidget, &QgsFileWidget::fileChanged, this, &QgsPluginManager::mZipFileWidget_fileChanged ); connect( buttonInstallFromZip, &QPushButton::clicked, this, &QgsPluginManager::buttonInstallFromZip_clicked ); - // Initialize list of allowed checking intervals - mCheckingOnStartIntervals << 0 << 1 << 3 << 7 << 14 << 30; - // Initialize the "Settings" tab widgets if ( settings.value( settingsGroup + "/checkOnStart", true ).toBool() ) { @@ -257,14 +253,8 @@ void QgsPluginManager::setPythonUtils( QgsPythonUtils *pythonUtils ) { ckbDeprecated->setChecked( true ); } - - const int interval = settings.value( settingsGroup + "/checkOnStartInterval", "3" ).toInt(); - const int indx = mCheckingOnStartIntervals.indexOf( interval ); // if none found, just use -1 index. - comboInterval->setCurrentIndex( indx ); } - - void QgsPluginManager::loadPlugin( const QString &id ) { const QMap *plugin = pluginMetadata( id ); @@ -1298,7 +1288,6 @@ void QgsPluginManager::reject() QgsPythonRunner::eval( QStringLiteral( "pyplugin_installer.instance().exportSettingsGroup()" ), settingsGroup ); QgsSettings settings; settings.setValue( settingsGroup + "/checkOnStart", QVariant( ckbCheckUpdates->isChecked() ) ); - settings.setValue( settingsGroup + "/checkOnStartInterval", QVariant( mCheckingOnStartIntervals.value( comboInterval->currentIndex() ) ) ); QgsPythonRunner::run( QStringLiteral( "pyplugin_installer.instance().onManagerClose()" ) ); } #endif diff --git a/src/app/pluginmanager/qgspluginmanager.h b/src/app/pluginmanager/qgspluginmanager.h index d6d7f4ec378..f56e227c683 100644 --- a/src/app/pluginmanager/qgspluginmanager.h +++ b/src/app/pluginmanager/qgspluginmanager.h @@ -236,8 +236,6 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag QString mCurrentlyDisplayedPlugin; - QList mCheckingOnStartIntervals; - QgsMessageBar *msgBar = nullptr; #ifndef WITH_QTWEBKIT diff --git a/src/ui/qgspluginmanagerbase.ui b/src/ui/qgspluginmanagerbase.ui index a9e2a365c67..1de553c695a 100644 --- a/src/ui/qgspluginmanagerbase.ui +++ b/src/ui/qgspluginmanagerbase.ui @@ -60,7 +60,7 @@ 0 - + 0 @@ -236,7 +236,7 @@ 6 - + 0 @@ -355,7 +355,7 @@ QFrame::Sunken - + 0 @@ -368,7 +368,7 @@ - about:blank + about:blank @@ -811,7 +811,7 @@ 6 - + 0 @@ -834,11 +834,11 @@ 0 0 720 - 612 + 609 - + 0 @@ -865,46 +865,6 @@ 9 - - - - - 0 - 0 - - - - - Every Time QGIS Starts - - - - - Once a Day - - - - - Every 3 Days - - - - - Every Week - - - - - Every 2 Weeks - - - - - Every Month - - - - @@ -1272,6 +1232,7 @@ +