updater hotfix
tests / package-smoke-linux (push) Skipped
tests / package-smoke-windows (push) Skipped
tests / package-smoke-macos (push) Skipped
tests / macos (push) Successful in 1m15s
tests / linux (push) Failing after 2m3s
tests / windows (push) Failing after 2m7s
release / create-release (push) Failing after 2s
release / build-linux (push) Skipped
release / build-windows (push) Skipped
release / build-macos (push) Skipped
release / publish (push) Skipped

Signed-off-by: galeon <dertiellis@gmail.com>
This commit is contained in:
galeon committed 2026-11-05 23:36:58 +03:00
1 parent f57d6d02fe
commit efb56a8411
5 files changed
+127 -23

No files matched your search

+27 -3
View File
@@ -202,7 +202,16 @@ void LauncherUpdates::install(const QString &channel, const QString &version)
const qint64 size = release.value("size").toLongLong();
auto *reply = m_network.get(request(url));
m_downloadReply = reply;
m_cancelRequested = false;
reply->setReadBufferSize(256 * 1024);
connect(reply, &QNetworkReply::downloadProgress, this, [this](qint64 received, qint64 total) {
const double progress = total > 0 ? std::clamp(double(received) / total, 0.0, 1.0) : -1.0;
if (m_downloadProgress != progress) {
m_downloadProgress = progress;
emit downloadProgressChanged();
}
});
const auto writeChunk = [this, reply, size] {
const auto chunk = reply->readAll();
if (m_download->pos() + chunk.size() > size || m_download->write(chunk) != chunk.size()) {
@@ -217,7 +226,9 @@ void LauncherUpdates::install(const QString &channel, const QString &version)
});
connect(reply, &QNetworkReply::finished, this, [this, reply, path, size, writeChunk] {
reply->deleteLater();
const bool downloaded = reply->error() == QNetworkReply::NoError
m_downloadReply = nullptr;
const bool cancelled = m_cancelRequested;
const bool downloaded = !cancelled && reply->error() == QNetworkReply::NoError
&& writeChunk() && m_download->pos() == size && m_download->flush();
m_download.reset();
@@ -230,14 +241,27 @@ void LauncherUpdates::install(const QString &channel, const QString &version)
return;
}
qWarning() << "BiLauncher update failed:" << path << reply->errorString();
m_temp.reset();
m_downloadProgress = -1;
emit downloadProgressChanged();
emit installationChanged();
emit installationFailed();
if (!cancelled) {
qWarning() << "BiLauncher update failed:" << path << reply->errorString();
emit installationFailed();
}
});
emit installationChanged();
}
void LauncherUpdates::cancelDownload()
{
if (!m_downloadReply || m_cancelRequested)
return;
m_cancelRequested = true;
m_downloadReply->abort();
}
bool LauncherUpdates::startInstallation(const QString &path)
{
#ifdef Q_OS_WIN