update manager
This commit is contained in:
@@ -60,6 +60,7 @@ void UpdateManager::installUpdates()
|
|||||||
"Failed while trying to download the update.");
|
"Failed while trying to download the update.");
|
||||||
box->setAttribute(Qt::WA_DeleteOnClose);
|
box->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
box->show();
|
box->show();
|
||||||
|
box->raise();
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -109,6 +110,7 @@ void UpdateManager::checkForUpdates()
|
|||||||
"temporarily or everything is broken.");
|
"temporarily or everything is broken.");
|
||||||
box->setAttribute(Qt::WA_DeleteOnClose);
|
box->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
box->show();
|
box->show();
|
||||||
|
box->raise();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -118,16 +120,19 @@ void UpdateManager::checkForUpdates()
|
|||||||
|
|
||||||
if (this->currentVersion_ != this->onlineVersion_) {
|
if (this->currentVersion_ != this->onlineVersion_) {
|
||||||
this->setStatus_(UpdateAvailable);
|
this->setStatus_(UpdateAvailable);
|
||||||
|
util::postToThread([this] {
|
||||||
QMessageBox *box = new QMessageBox(QMessageBox::Information, "Chatterino Update",
|
QMessageBox *box =
|
||||||
"An update for chatterino is available.\n\nDo you "
|
new QMessageBox(QMessageBox::Information, "Chatterino Update",
|
||||||
"want to download and install it?",
|
"An update for chatterino is available.\n\nDo you "
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
"want to download and install it?",
|
||||||
box->setAttribute(Qt::WA_DeleteOnClose);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
box->show();
|
box->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
if (box->exec() == QMessageBox::Yes) {
|
box->show();
|
||||||
util::postToThread([this] { this->installUpdates(); });
|
box->raise();
|
||||||
}
|
if (box->exec() == QMessageBox::Yes) {
|
||||||
|
this->installUpdates();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this->setStatus_(NoUpdateAvailable);
|
this->setStatus_(NoUpdateAvailable);
|
||||||
}
|
}
|
||||||
@@ -146,7 +151,7 @@ void UpdateManager::setStatus_(UpdateStatus status)
|
|||||||
{
|
{
|
||||||
if (this->status_ != status) {
|
if (this->status_ != status) {
|
||||||
this->status_ = status;
|
this->status_ = status;
|
||||||
this->statusUpdated.invoke(status);
|
util::postToThread([this, status] { this->statusUpdated.invoke(status); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user