Remove unused "notes" field from update mechanism and refactor version availability prompts for improved clarity.
This commit is contained in:
parent
92e754ef6b
commit
63fa25a087
@ -128,7 +128,7 @@ if %ERRORLEVEL% neq 0 (
|
||||
|
||||
REM Генерируем version.json (UTF-8 без BOM — иначе QJsonDocument::fromJson падает)
|
||||
REM и заливаем последним.
|
||||
powershell -NoProfile -Command "$j = @{ latestVersion='!CURRENT_VERSION!'; zipUrl='!DOWNLOAD_URL!'; sha256='!ZIP_SHA256!'; minVersion='1.0.0'; notes='Обновление ARC'; mandatory=$false } | ConvertTo-Json; [System.IO.File]::WriteAllText('%PROJECT_DIR%version.json', $j, (New-Object System.Text.UTF8Encoding($false)))"
|
||||
powershell -NoProfile -Command "$j = @{ latestVersion='!CURRENT_VERSION!'; zipUrl='!DOWNLOAD_URL!'; sha256='!ZIP_SHA256!'; minVersion='1.0.0'; mandatory=$false } | ConvertTo-Json; [System.IO.File]::WriteAllText('%PROJECT_DIR%version.json', $j, (New-Object System.Text.UTF8Encoding($false)))"
|
||||
curl -f -s -S -T "%PROJECT_DIR%version.json" -u "%UPDATE_USER%:%UPDATE_PASS%" "%UPDATE_BASE%/version.json"
|
||||
if %ERRORLEVEL% neq 0 (
|
||||
echo ERROR: Failed to upload version.json to update server
|
||||
|
||||
@ -92,7 +92,6 @@ void UpdateService::checkForUpdates() {
|
||||
const QString latest = o.value("latestVersion").toString();
|
||||
const QString zipUrl = o.value("zipUrl").toString();
|
||||
const QString sha = o.value("sha256").toString();
|
||||
const QString notes = o.value("notes").toString();
|
||||
if (latest.isEmpty() || zipUrl.isEmpty()) {
|
||||
emit checkFailed(QStringLiteral("В манифесте нет latestVersion/zipUrl"));
|
||||
return;
|
||||
@ -102,7 +101,7 @@ void UpdateService::checkForUpdates() {
|
||||
emit upToDate(m_currentVersion);
|
||||
return;
|
||||
}
|
||||
emit updateAvailable(latest, notes, zipUrl, sha);
|
||||
emit updateAvailable(latest, zipUrl, sha);
|
||||
}
|
||||
|
||||
void UpdateService::downloadAndApply(const QString &zipUrl,
|
||||
|
||||
@ -39,7 +39,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void upToDate(const QString ¤tVersion);
|
||||
void updateAvailable(const QString &newVersion, const QString ¬es,
|
||||
void updateAvailable(const QString &newVersion,
|
||||
const QString &zipUrl, const QString &sha256);
|
||||
void checkFailed(const QString &reason);
|
||||
void downloadProgress(qint64 received, qint64 total);
|
||||
|
||||
@ -199,14 +199,20 @@ void MainWindow::checkForUpdates() {
|
||||
});
|
||||
|
||||
connect(svc, &UpdateService::updateAvailable, this,
|
||||
[this, svc, reEnable](const QString &ver, const QString ¬es,
|
||||
[this, svc, reEnable](const QString &ver,
|
||||
const QString &zipUrl, const QString &sha) {
|
||||
QString text = QString("Доступна новая версия: %1.\nУстановить сейчас?\n\n"
|
||||
"Приложение перезапустится автоматически.").arg(ver);
|
||||
if (!notes.isEmpty()) text += "\n\n" + notes;
|
||||
const auto btn = QMessageBox::question(this, "Обновление", text,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (btn != QMessageBox::Yes) {
|
||||
const QString text = QString("Доступна новая версия: %1.\nУстановить сейчас?\n\n"
|
||||
"Приложение перезапустится автоматически.").arg(ver);
|
||||
// Кнопки задаём вручную — стандартные Yes/No берут английские подписи
|
||||
// из локализации Qt (как в остальных диалогах приложения).
|
||||
QMessageBox confirmBox(this);
|
||||
confirmBox.setWindowTitle("Обновление");
|
||||
confirmBox.setText(text);
|
||||
confirmBox.setIcon(QMessageBox::Question);
|
||||
auto *yesBtn = confirmBox.addButton("Обновить", QMessageBox::YesRole);
|
||||
confirmBox.addButton("Позже", QMessageBox::NoRole);
|
||||
confirmBox.exec();
|
||||
if (confirmBox.clickedButton() != yesBtn) {
|
||||
reEnable();
|
||||
svc->deleteLater();
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user