From e88d36513e0f66f83d160002cb3afe0d64f07751 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin <stenzek@gmail.com> Date: Tue, 29 Sep 2020 23:12:43 +1000 Subject: [PATCH] Qt: Add warning when save state versions change in auto updater --- src/duckstation-qt/autoupdaterdialog.cpp | 16 +++++++++++++++- src/duckstation-qt/autoupdaterdialog.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/autoupdaterdialog.cpp b/src/duckstation-qt/autoupdaterdialog.cpp index 7140b1e32..7cd21d6f4 100644 --- a/src/duckstation-qt/autoupdaterdialog.cpp +++ b/src/duckstation-qt/autoupdaterdialog.cpp @@ -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 diff --git a/src/duckstation-qt/autoupdaterdialog.h b/src/duckstation-qt/autoupdaterdialog.h index 475dd9403..9b2ca4808 100644 --- a/src/duckstation-qt/autoupdaterdialog.h +++ b/src/duckstation-qt/autoupdaterdialog.h @@ -55,4 +55,5 @@ private: QString m_download_url; bool m_display_messages = false; + bool m_update_will_break_save_states = false; };