Qt: fix signal_update_available

m_update_message has to be non empty
This commit is contained in:
Megamouse 2020-07-02 23:29:26 +02:00
parent 78eb7e73bc
commit ddd202b5ff
2 changed files with 6 additions and 2 deletions

View File

@ -41,6 +41,8 @@ update_manager::update_manager()
void update_manager::check_for_updates(bool automatic, bool check_only, QWidget* parent) void update_manager::check_for_updates(bool automatic, bool check_only, QWidget* parent)
{ {
m_update_message.clear();
#ifdef __linux__ #ifdef __linux__
if (automatic && !::getenv("APPIMAGE")) if (automatic && !::getenv("APPIMAGE"))
{ {
@ -75,7 +77,7 @@ void update_manager::check_for_updates(bool automatic, bool check_only, QWidget*
} }
} }
Q_EMIT signal_update_available(result_json); Q_EMIT signal_update_available(result_json && !m_update_message.isEmpty());
}); });
const std::string url = "https://update.rpcs3.net/?api=v1&c=" + rpcs3::get_commit_and_hash().second; const std::string url = "https://update.rpcs3.net/?api=v1&c=" + rpcs3::get_commit_and_hash().second;
@ -205,7 +207,8 @@ bool update_manager::handle_json(bool automatic, bool check_only, const QByteArr
void update_manager::update() void update_manager::update()
{ {
if (QMessageBox::question(m_downloader->get_progress_dialog(), tr("Update Available"), m_update_message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) if (m_update_message.isEmpty() ||
QMessageBox::question(m_downloader->get_progress_dialog(), tr("Update Available"), m_update_message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
{ {
m_downloader->close_progress_dialog(); m_downloader->close_progress_dialog();
return; return;

View File

@ -14,6 +14,7 @@ private:
downloader* m_downloader = nullptr; downloader* m_downloader = nullptr;
QWidget* m_parent = nullptr; QWidget* m_parent = nullptr;
// This message is empty if there is no download available
QString m_update_message; QString m_update_message;
std::string m_request_url; std::string m_request_url;