mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
Remove option to control plugin update check frequency, and hardcode
to every 3 days This level of configuration is not warranted here
This commit is contained in:
parent
efea4b4e29
commit
9e12c70f21
@ -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
|
||||
|
@ -32,13 +32,12 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
#include <QCheckBox>
|
||||
|
||||
#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<QString, QString> *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
|
||||
|
@ -236,8 +236,6 @@ class QgsPluginManager : public QgsOptionsDialogBase, private Ui::QgsPluginManag
|
||||
|
||||
QString mCurrentlyDisplayedPlugin;
|
||||
|
||||
QList<int> mCheckingOnStartIntervals;
|
||||
|
||||
QgsMessageBar *msgBar = nullptr;
|
||||
|
||||
#ifndef WITH_QTWEBKIT
|
||||
|
@ -60,7 +60,7 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -236,7 +236,7 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -355,7 +355,7 @@
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<property name="margin">
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -368,7 +368,7 @@
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string notr="true">about:blank</string>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
@ -811,7 +811,7 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -834,11 +834,11 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>720</width>
|
||||
<height>612</height>
|
||||
<height>609</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<property name="margin">
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -865,46 +865,6 @@
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboInterval">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Every Time QGIS Starts</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Once a Day</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Every 3 Days</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Every Week</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Every 2 Weeks</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Every Month</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCheckUpdates">
|
||||
<property name="sizePolicy">
|
||||
@ -1272,6 +1232,7 @@
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../images/images.qrc"/>
|
||||
<include location="../../images/images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user