mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Move the automatic update check back into the main window class
See issue #1595.
This commit is contained in:
@@ -167,6 +167,15 @@ void MainWindow::init()
|
||||
ogl->setHidden(true);
|
||||
#endif
|
||||
|
||||
// Automatic update check
|
||||
#ifdef CHECKNEWVERSION
|
||||
connect(m_remoteDb, &RemoteDatabase::networkReady, [this]() {
|
||||
// Check for a new version if automatic update check aren't disabled in the settings dialog
|
||||
if(Settings::getValue("checkversion", "enabled").toBool())
|
||||
m_remoteDb->fetch("https://download.sqlitebrowser.org/currentrelease", RemoteDatabase::RequestTypeNewVersionCheck);
|
||||
});
|
||||
#endif
|
||||
|
||||
// Connect SQL logging and database state setting to main window
|
||||
connect(&db, &DBBrowserDB::dbChanged, this, &MainWindow::dbState, Qt::QueuedConnection);
|
||||
connect(&db, &DBBrowserDB::sqlExecuted, this, &MainWindow::logSql, Qt::QueuedConnection);
|
||||
|
||||
@@ -30,11 +30,7 @@ RemoteDatabase::RemoteDatabase() :
|
||||
connect(m_configurationManager, &QNetworkConfigurationManager::updateCompleted, [this]() {
|
||||
m_manager->setConfiguration(m_configurationManager->defaultConfiguration());
|
||||
|
||||
#ifdef CHECKNEWVERSION
|
||||
// Check for a new version if automatic update check aren't disabled in the settings dialog
|
||||
if(Settings::getValue("checkversion", "enabled").toBool())
|
||||
fetch("https://download.sqlitebrowser.org/currentrelease", RemoteDatabase::RequestTypeNewVersionCheck);
|
||||
#endif
|
||||
emit networkReady();
|
||||
});
|
||||
|
||||
// Set up SSL configuration
|
||||
|
||||
@@ -51,6 +51,10 @@ public:
|
||||
const QString& branch = QString("master"), bool forcePush = false);
|
||||
|
||||
signals:
|
||||
// As soon as you can safely open a network connection, this signal is emitted. This can be used to delay early network requests
|
||||
// which might otherwise fail.
|
||||
void networkReady();
|
||||
|
||||
// The openFile signal is emitted whenever a remote database file shall be opened in the main window. This happens when the
|
||||
// fetch() call for a database is finished, either by actually downloading the database or opening the local clone.
|
||||
void openFile(QString path);
|
||||
|
||||
Reference in New Issue
Block a user