Fixed lockup when checking for updates after start.
This commit is contained in:
parent
7ebf8c6e8c
commit
774167e338
2 changed files with 4 additions and 20 deletions
|
@ -237,8 +237,7 @@ UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const
|
||||||
url.m_os = url_elem.attributes().namedItem("os").toAttr().value();
|
url.m_os = url_elem.attributes().namedItem("os").toAttr().value();
|
||||||
url.m_platform = url_elem.attributes().namedItem("platform").toAttr().value();
|
url.m_platform = url_elem.attributes().namedItem("platform").toAttr().value();
|
||||||
|
|
||||||
update.m_urls.insert(url.m_os,
|
update.m_urls.insert(url.m_os, url);
|
||||||
url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -249,16 +248,8 @@ UpdateInfo SystemFactory::parseUpdatesFile(const QByteArray &updates_file, const
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemFactory::checkForUpdatesAsynchronously() {
|
void SystemFactory::checkForUpdatesOnStartup() {
|
||||||
QFutureWatcher<UpdateCheck> *watcher_for_future = new QFutureWatcher<UpdateCheck>(this);
|
UpdateCheck updates = checkForUpdates();
|
||||||
|
|
||||||
connect(watcher_for_future, SIGNAL(finished()), this, SLOT(handleBackgroundUpdatesCheck()));
|
|
||||||
watcher_for_future->setFuture(QtConcurrent::run(this, &SystemFactory::checkForUpdates));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SystemFactory::handleBackgroundUpdatesCheck() {
|
|
||||||
QFutureWatcher<UpdateCheck> *future_watcher = static_cast<QFutureWatcher<UpdateCheck>*>(sender());
|
|
||||||
UpdateCheck updates = future_watcher->result();
|
|
||||||
|
|
||||||
if (updates.second == QNetworkReply::NoError && isUpdateNewer(updates.first.m_availableVersion)) {
|
if (updates.second == QNetworkReply::NoError && isUpdateNewer(updates.first.m_availableVersion)) {
|
||||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||||
|
|
|
@ -86,14 +86,7 @@ class SystemFactory : public QObject {
|
||||||
static bool isUpdateNewer(const QString &update_version);
|
static bool isUpdateNewer(const QString &update_version);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Performs asynchronous check for updates, result is emitted via updateCheckedAsynchronously(...) signal.
|
void checkForUpdatesOnStartup();
|
||||||
void checkForUpdatesAsynchronously();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void handleBackgroundUpdatesCheck();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void updateCheckedAsynchronously(QPair<UpdateInfo, QNetworkReply::NetworkError> update_info);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Performs parsing of downloaded file with list of updates.
|
// Performs parsing of downloaded file with list of updates.
|
||||||
|
|
Loading…
Add table
Reference in a new issue