Qt: Add warning when save state versions change in auto updater

This commit is contained in:
Connor McLaughlin 2020-09-29 23:12:43 +10:00
parent 75734c25c7
commit e88d36513e
2 changed files with 16 additions and 1 deletions

View file

@ -253,9 +253,12 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
{
const QJsonObject doc_object(doc.object());
QString changes_html = QStringLiteral("<ul>");
QString changes_html = tr("<h2>Changes:</h2>");
changes_html += QStringLiteral("<ul>");
const QJsonArray commits(doc_object["commits"].toArray());
bool update_will_break_save_states = false;
for (const QJsonValue& commit : commits)
{
const QJsonObject commit_obj(commit["commit"].toObject());
@ -268,9 +271,20 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
if (!message.isEmpty())
changes_html +=
QStringLiteral("<li>%1 <i>(%2)</i></li>").arg(message.toHtmlEscaped()).arg(author.toHtmlEscaped());
if (message.contains(QStringLiteral("[SAVEVERSION+]")))
update_will_break_save_states = true;
}
changes_html += "</ul>";
if (update_will_break_save_states)
{
changes_html.prepend(tr("<h2>Save State Warning</h2><p>Installing this update will make your save states "
"<b>incompatible</b>. Please ensure you have saved your games to memory card "
"before installing this update or you will lose progress.</p>"));
}
m_ui.updateNotes->setText(changes_html);
}
else

View file

@ -55,4 +55,5 @@ private:
QString m_download_url;
bool m_display_messages = false;
bool m_update_will_break_save_states = false;
};