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 Генерируем version.json (UTF-8 без BOM — иначе QJsonDocument::fromJson падает)
|
||||||
REM и заливаем последним.
|
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"
|
curl -f -s -S -T "%PROJECT_DIR%version.json" -u "%UPDATE_USER%:%UPDATE_PASS%" "%UPDATE_BASE%/version.json"
|
||||||
if %ERRORLEVEL% neq 0 (
|
if %ERRORLEVEL% neq 0 (
|
||||||
echo ERROR: Failed to upload version.json to update server
|
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 latest = o.value("latestVersion").toString();
|
||||||
const QString zipUrl = o.value("zipUrl").toString();
|
const QString zipUrl = o.value("zipUrl").toString();
|
||||||
const QString sha = o.value("sha256").toString();
|
const QString sha = o.value("sha256").toString();
|
||||||
const QString notes = o.value("notes").toString();
|
|
||||||
if (latest.isEmpty() || zipUrl.isEmpty()) {
|
if (latest.isEmpty() || zipUrl.isEmpty()) {
|
||||||
emit checkFailed(QStringLiteral("В манифесте нет latestVersion/zipUrl"));
|
emit checkFailed(QStringLiteral("В манифесте нет latestVersion/zipUrl"));
|
||||||
return;
|
return;
|
||||||
@ -102,7 +101,7 @@ void UpdateService::checkForUpdates() {
|
|||||||
emit upToDate(m_currentVersion);
|
emit upToDate(m_currentVersion);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit updateAvailable(latest, notes, zipUrl, sha);
|
emit updateAvailable(latest, zipUrl, sha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateService::downloadAndApply(const QString &zipUrl,
|
void UpdateService::downloadAndApply(const QString &zipUrl,
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void upToDate(const QString ¤tVersion);
|
void upToDate(const QString ¤tVersion);
|
||||||
void updateAvailable(const QString &newVersion, const QString ¬es,
|
void updateAvailable(const QString &newVersion,
|
||||||
const QString &zipUrl, const QString &sha256);
|
const QString &zipUrl, const QString &sha256);
|
||||||
void checkFailed(const QString &reason);
|
void checkFailed(const QString &reason);
|
||||||
void downloadProgress(qint64 received, qint64 total);
|
void downloadProgress(qint64 received, qint64 total);
|
||||||
|
|||||||
@ -199,14 +199,20 @@ void MainWindow::checkForUpdates() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(svc, &UpdateService::updateAvailable, this,
|
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) {
|
const QString &zipUrl, const QString &sha) {
|
||||||
QString text = QString("Доступна новая версия: %1.\nУстановить сейчас?\n\n"
|
const QString text = QString("Доступна новая версия: %1.\nУстановить сейчас?\n\n"
|
||||||
"Приложение перезапустится автоматически.").arg(ver);
|
"Приложение перезапустится автоматически.").arg(ver);
|
||||||
if (!notes.isEmpty()) text += "\n\n" + notes;
|
// Кнопки задаём вручную — стандартные Yes/No берут английские подписи
|
||||||
const auto btn = QMessageBox::question(this, "Обновление", text,
|
// из локализации Qt (как в остальных диалогах приложения).
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox confirmBox(this);
|
||||||
if (btn != QMessageBox::Yes) {
|
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();
|
reEnable();
|
||||||
svc->deleteLater();
|
svc->deleteLater();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user