Move the automatic update check back into the main window class

See issue #1595.
This commit is contained in:
Martin Kleusberg
2019-02-18 17:54:02 +01:00
parent c6567f910c
commit a75acc01ef
3 changed files with 14 additions and 5 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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);