Qt: Provide warning in auto updater on settings version increase

This commit is contained in:
Albert Liu 2020-10-07 07:59:39 -07:00
parent 6a4a47fbdf
commit 9d2687e7d4
1 changed files with 11 additions and 0 deletions

View File

@ -256,6 +256,7 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
const QJsonArray commits(doc_object["commits"].toArray()); const QJsonArray commits(doc_object["commits"].toArray());
bool update_will_break_save_states = false; bool update_will_break_save_states = false;
bool update_increases_settings_version = false;
for (const QJsonValue& commit : commits) for (const QJsonValue& commit : commits)
{ {
@ -274,6 +275,9 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
if (message.contains(QStringLiteral("[SAVEVERSION+]"))) if (message.contains(QStringLiteral("[SAVEVERSION+]")))
update_will_break_save_states = true; update_will_break_save_states = true;
if (message.contains(QStringLiteral("[SETTINGSVERSION+]")))
update_increases_settings_version = true;
} }
changes_html += "</ul>"; changes_html += "</ul>";
@ -285,6 +289,13 @@ void AutoUpdaterDialog::getChangesComplete(QNetworkReply* reply)
"before installing this update or you will lose progress.</p>")); "before installing this update or you will lose progress.</p>"));
} }
if (update_increases_settings_version)
{
changes_html.prepend(
tr("<h2>Settings Warning</h2><p>Installing this update will reset your program configuration. Please note "
"that you will have to reconfigure your settings after this update.</p>"));
}
changes_html += tr("<h4>Installing this update will download %1 MB through your internet connection.</h4>") changes_html += tr("<h4>Installing this update will download %1 MB through your internet connection.</h4>")
.arg(static_cast<double>(m_download_size) / 1000000.0, 0, 'f', 2); .arg(static_cast<double>(m_download_size) / 1000000.0, 0, 'f', 2);