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
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:
1 parent
f57d6d02fe
commit
efb56a8411
5 files changed
+126
-22
No files matched your search
@@ -26,8 +26,11 @@ Dialog {
|
||||
width: Math.min(720, parent.width - 24)
|
||||
height: Math.min(480, parent.height - 24)
|
||||
padding: 0
|
||||
closePolicy: updates.installing ? Popup.NoAutoClose : Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||
onAboutToShow: selectChannel(updates.channel === "rc" ? "rc" : "release")
|
||||
focus: true
|
||||
onAboutToShow: {
|
||||
if (!updates.installing)
|
||||
selectChannel(updates.channel === "rc" ? "rc" : "release")
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "#1e1e1e"
|
||||
@@ -224,7 +227,6 @@ Dialog {
|
||||
width: 130
|
||||
height: 36
|
||||
text: Loc.t.common.button.close
|
||||
enabled: !picker.updates.installing
|
||||
contentItem: Text {
|
||||
text: closeButton.text
|
||||
color: "#ffffff"
|
||||
@@ -245,7 +247,7 @@ Dialog {
|
||||
text: picker.updates.installing ? Loc.t.app.status.downloadingInstaller : Loc.t.common.button.install
|
||||
enabled: !picker.updates.installing && picker.state === "ready"
|
||||
&& picker.entries.some(entry => entry.version === picker.selectedVersion && entry.download)
|
||||
opacity: enabled || picker.updates.installing ? 1 : 0.45
|
||||
opacity: enabled ? 1 : 0.45
|
||||
contentItem: Text {
|
||||
text: installButton.text
|
||||
color: "#ffffff"
|
||||
|
||||
@@ -204,26 +204,32 @@ Window {
|
||||
// ── Панели хода работ ──────────────────────────────────────────────────
|
||||
ProgressPanel {
|
||||
id: downloadPanel
|
||||
visible: backend.downloading
|
||||
visible: launcherUpdates.installing || backend.downloading
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.leftMargin: 24
|
||||
anchors.bottomMargin: 24
|
||||
|
||||
title: Loc.t.common.progress.downloadingNamed.arg(backend.downloadVersion)
|
||||
fraction: backend.downloadProgress
|
||||
status: backend.downloadStatus
|
||||
detail: backend.downloadBytesTotal > 0
|
||||
title: Loc.t.common.progress.downloadingNamed.arg(launcherUpdates.installing
|
||||
? launcherVersions.selectedVersion : backend.downloadVersion)
|
||||
fraction: launcherUpdates.installing ? launcherUpdates.downloadProgress : backend.downloadProgress
|
||||
status: launcherUpdates.installing ? Loc.t.app.status.downloadingInstaller : backend.downloadStatus
|
||||
detail: !launcherUpdates.installing && backend.downloadBytesTotal > 0
|
||||
? Loc.t.common.progress.bytes.arg(backend.downloadStatus)
|
||||
.arg(window.formatMb(backend.downloadBytesDone))
|
||||
.arg(window.formatMb(backend.downloadBytesTotal))
|
||||
: ""
|
||||
onCancelRequested: backend.cancelDownload()
|
||||
onCancelRequested: {
|
||||
if (launcherUpdates.installing)
|
||||
launcherUpdates.cancelDownload()
|
||||
else
|
||||
backend.cancelDownload()
|
||||
}
|
||||
}
|
||||
|
||||
ProgressPanel {
|
||||
id: switchPanel
|
||||
visible: backend.switching
|
||||
visible: backend.switching && !launcherUpdates.installing
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.leftMargin: 24
|
||||
@@ -242,7 +248,7 @@ Window {
|
||||
height: 170
|
||||
anchors.centerIn: parent
|
||||
hoverEnabled: false
|
||||
enabled: !backend.busy && !backend.gameRunning
|
||||
enabled: !launcherUpdates.installing && !backend.busy && !backend.gameRunning
|
||||
|
||||
background: Image {
|
||||
id: buttonImage
|
||||
@@ -268,7 +274,7 @@ Window {
|
||||
rotation: 0
|
||||
editable: false
|
||||
hoverEnabled: true
|
||||
enabled: !backend.busy && !backend.gameRunning
|
||||
enabled: !launcherUpdates.installing && !backend.busy && !backend.gameRunning
|
||||
opacity: enabled ? 1.0 : 0.45
|
||||
|
||||
model: backend.profileNames
|
||||
@@ -453,7 +459,7 @@ Window {
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottomMargin: -218
|
||||
hoverEnabled: true
|
||||
enabled: !backend.gameRunning && !backend.switching && !backend.seasonalInstalling
|
||||
enabled: !launcherUpdates.installing && !backend.gameRunning && !backend.switching && !backend.seasonalInstalling
|
||||
opacity: enabled ? 1.0 : 0.45
|
||||
|
||||
contentItem: Text {
|
||||
@@ -503,6 +509,7 @@ Window {
|
||||
anchors.leftMargin: -59
|
||||
anchors.bottomMargin: -45
|
||||
hoverEnabled: true
|
||||
enabled: !launcherUpdates.installing
|
||||
|
||||
background: Image {
|
||||
id: folderButtonImage
|
||||
@@ -528,7 +535,7 @@ Window {
|
||||
anchors.verticalCenter: folderButton.verticalCenter
|
||||
anchors.leftMargin: 8
|
||||
hoverEnabled: true
|
||||
enabled: !backend.busy && !backend.gameRunning
|
||||
enabled: !launcherUpdates.installing && !backend.busy && !backend.gameRunning
|
||||
|
||||
background: Image {
|
||||
anchors.fill: parent
|
||||
@@ -554,6 +561,8 @@ Window {
|
||||
anchors.rightMargin: 24
|
||||
anchors.bottomMargin: 24
|
||||
hoverEnabled: true
|
||||
enabled: !launcherUpdates.installing
|
||||
opacity: enabled ? 1.0 : 0.45
|
||||
|
||||
contentItem: Text {
|
||||
text: Loc.t.common.title.seasonalBuilds
|
||||
|
||||
+26
-2
@@ -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();
|
||||
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
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <memory>
|
||||
|
||||
class QFile;
|
||||
class QNetworkReply;
|
||||
|
||||
class LauncherUpdates : public QObject
|
||||
{
|
||||
@@ -17,6 +18,7 @@ class LauncherUpdates : public QObject
|
||||
Q_PROPERTY(QVariantMap states READ states NOTIFY catalogChanged)
|
||||
Q_PROPERTY(QString latest READ latest NOTIFY catalogChanged)
|
||||
Q_PROPERTY(bool installing READ installing NOTIFY installationChanged)
|
||||
Q_PROPERTY(double downloadProgress READ downloadProgress NOTIFY downloadProgressChanged)
|
||||
|
||||
public:
|
||||
explicit LauncherUpdates(QObject *parent = nullptr);
|
||||
@@ -27,13 +29,16 @@ public:
|
||||
QVariantMap states() const { return m_states; }
|
||||
QString latest() const { return m_latest; }
|
||||
bool installing() const { return bool(m_download); }
|
||||
double downloadProgress() const { return m_downloadProgress; }
|
||||
|
||||
Q_INVOKABLE void refresh(const QString &channel);
|
||||
Q_INVOKABLE void install(const QString &channel, const QString &version);
|
||||
Q_INVOKABLE void cancelDownload();
|
||||
|
||||
signals:
|
||||
void catalogChanged();
|
||||
void installationChanged();
|
||||
void downloadProgressChanged();
|
||||
void installationFailed();
|
||||
|
||||
private:
|
||||
@@ -46,4 +51,7 @@ private:
|
||||
QString m_latest;
|
||||
std::unique_ptr<QTemporaryDir> m_temp;
|
||||
std::unique_ptr<QFile> m_download;
|
||||
QNetworkReply *m_downloadReply = nullptr;
|
||||
double m_downloadProgress = -1;
|
||||
bool m_cancelRequested = false;
|
||||
};
|
||||
@@ -8,14 +8,19 @@
|
||||
#include "fixtures.h"
|
||||
|
||||
#include "launcherpaths.h"
|
||||
#include "launcherupdates.h"
|
||||
#include "launcherversion.h"
|
||||
#include "localization.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QJSValue>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
#include <QQuickWindow>
|
||||
#include <QSignalSpy>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
|
||||
Q_IMPORT_QML_PLUGIN(BiLauncherPlugin)
|
||||
@@ -71,9 +76,22 @@ private slots:
|
||||
const QString releasesUrl = QStringLiteral(
|
||||
"https://projects-live.galeonworx.com/api/v1/repos/galeon/BiLauncher/releases");
|
||||
const bool candidate = QStringLiteral(LAUNCHER_CHANNEL) == "rc";
|
||||
const auto release = candidate
|
||||
? R"([{"tag_name":"v1.0.0-rc1","prerelease":true,"published_at":"2026-10-14T10:52:02Z"}])"
|
||||
: R"([{"tag_name":"v1.0.0","prerelease":false,"published_at":"2026-10-14T10:52:02Z"}])";
|
||||
const QString version = candidate ? QStringLiteral("1.0.0-rc1") : QStringLiteral("1.0.0");
|
||||
const QString tag = "v" + version;
|
||||
QJsonArray assets;
|
||||
for (const QString &suffix : {QStringLiteral("-win64-setup.exe"), QStringLiteral("-macOS-universal.dmg"),
|
||||
QStringLiteral("-x86_64.AppImage")}) {
|
||||
const QString name = "BiLauncher-" + version + suffix;
|
||||
const QString url = "https://projects-live.galeonworx.com/galeon/BiLauncher/releases/download/"
|
||||
+ tag + "/" + name;
|
||||
assets.append(QJsonObject{{"name", name}, {"browser_download_url", url}, {"size", 1024}});
|
||||
FakeResponse pending;
|
||||
pending.hang = true;
|
||||
m_net.route(url, pending);
|
||||
}
|
||||
const auto release = QJsonDocument(QJsonArray{QJsonObject{
|
||||
{"tag_name", tag}, {"prerelease", candidate}, {"published_at", "2026-10-14T10:52:02Z"}, {"assets", assets}
|
||||
}}).toJson();
|
||||
m_net.route(releasesUrl, [candidate, release](const FakeRequest &request) {
|
||||
const auto query = request.queryItems();
|
||||
if (query.queryItemValue("pre-release") != (candidate ? "true" : "false"))
|
||||
@@ -107,9 +125,52 @@ private slots:
|
||||
? entriesProperty.value<QJSValue>().toVariant().toList()
|
||||
: entriesProperty.toList();
|
||||
QCOMPARE(entries.size(), 1);
|
||||
QCOMPARE(entries.first().toMap().value("version").toString(),
|
||||
candidate ? QStringLiteral("1.0.0-rc1") : QStringLiteral("1.0.0"));
|
||||
QCOMPARE(entries.first().toMap().value("version").toString(), version);
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) || (defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_64))
|
||||
auto *mainContext = qmlContext(window);
|
||||
auto *updates = qobject_cast<LauncherUpdates *>(mainContext->objectForName("launcherUpdates"));
|
||||
auto *panel = mainContext->objectForName("downloadPanel");
|
||||
auto *content = versions->property("contentItem").value<QObject *>();
|
||||
QVERIFY(content);
|
||||
auto *dialogContext = qmlContext(content);
|
||||
auto *installButton = dialogContext->objectForName("installButton");
|
||||
auto *closeButton = dialogContext->objectForName("closeButton");
|
||||
QVERIFY(updates);
|
||||
QVERIFY(panel);
|
||||
QVERIFY(installButton);
|
||||
QVERIFY(closeButton);
|
||||
QSignalSpy failed(updates, &LauncherUpdates::installationFailed);
|
||||
|
||||
QVERIFY(versions->setProperty("selectedVersion", version));
|
||||
QVERIFY(installButton->property("enabled").toBool());
|
||||
QVERIFY(QMetaObject::invokeMethod(installButton, "clicked"));
|
||||
const auto url = entries.first().toMap().value("download").toString();
|
||||
QTRY_COMPARE(m_net.hits(url), 1);
|
||||
QVERIFY(!installButton->property("enabled").toBool());
|
||||
QVERIFY(installButton->property("opacity").toDouble() < 1.0);
|
||||
QVERIFY(closeButton->property("enabled").toBool());
|
||||
QVERIFY(QMetaObject::invokeMethod(closeButton, "clicked"));
|
||||
QTRY_VERIFY(!versions->property("visible").toBool());
|
||||
QVERIFY(updates->installing());
|
||||
QVERIFY(panel->property("visible").toBool());
|
||||
QVERIFY(panel->property("title").toString().contains(version));
|
||||
for (const auto *id : {"button", "profileBox", "buildButton", "folderButton", "settingsButton", "seasonsButton"}) {
|
||||
auto *control = mainContext->objectForName(QString::fromLatin1(id));
|
||||
QVERIFY(control);
|
||||
QVERIFY2(!control->property("enabled").toBool(), id);
|
||||
}
|
||||
auto *seasonsButton = mainContext->objectForName("seasonsButton");
|
||||
QCOMPARE(seasonsButton->property("opacity").toDouble(), 0.45);
|
||||
QVERIFY(QMetaObject::invokeMethod(panel, "cancelRequested"));
|
||||
QTRY_VERIFY(!updates->installing());
|
||||
QVERIFY(!panel->property("visible").toBool());
|
||||
QVERIFY(seasonsButton->property("enabled").toBool());
|
||||
QCOMPARE(seasonsButton->property("opacity").toDouble(), 1.0);
|
||||
QCOMPARE(failed.count(), 0);
|
||||
#else
|
||||
QVERIFY(QMetaObject::invokeMethod(versions, "close"));
|
||||
#endif
|
||||
|
||||
// Смена языка на лету перестраивает Loc.t — биндинги не должны ломаться.
|
||||
const QString titleEn = window->title();
|
||||
|
||||
Reference in new issue
Block a user