mirror of
https://github.com/redstrate/Astra.git
synced 2025-06-08 15:07:45 +00:00
Show error message when the installer failed to download
This commit is contained in:
parent
18d416011a
commit
6ac00e6a2c
4 changed files with 27 additions and 0 deletions
|
@ -19,6 +19,7 @@ public:
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void installFinished();
|
void installFinished();
|
||||||
|
void error(QString message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LauncherCore &m_launcher;
|
LauncherCore &m_launcher;
|
||||||
|
|
|
@ -96,6 +96,11 @@ void AssetUpdater::update()
|
||||||
Q_EMIT launcher.stageChanged("Checking for Dalamud updates...");
|
Q_EMIT launcher.stageChanged("Checking for Dalamud updates...");
|
||||||
|
|
||||||
QByteArray str = reply->readAll();
|
QByteArray str = reply->readAll();
|
||||||
|
if (str.isEmpty()) {
|
||||||
|
Q_EMIT launcher.loginError("Could not check for Dalamud updates.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// for some god forsaken reason, the version string comes back as raw
|
// for some god forsaken reason, the version string comes back as raw
|
||||||
// bytes, ex: \xFF\xFE{\x00\"\x00""A\x00s\x00s\x00""e\x00m\x00 so we
|
// bytes, ex: \xFF\xFE{\x00\"\x00""A\x00s\x00s\x00""e\x00m\x00 so we
|
||||||
// start at the first character of the json '{' and work our way up.
|
// start at the first character of the json '{' and work our way up.
|
||||||
|
|
|
@ -29,6 +29,11 @@ void GameInstaller::installGame()
|
||||||
|
|
||||||
auto reply = m_launcher.mgr->get(request);
|
auto reply = m_launcher.mgr->get(request);
|
||||||
QObject::connect(reply, &QNetworkReply::finished, [this, reply, installDirectory] {
|
QObject::connect(reply, &QNetworkReply::finished, [this, reply, installDirectory] {
|
||||||
|
if (reply->error() != QNetworkReply::NetworkError::NoError) {
|
||||||
|
Q_EMIT error(QStringLiteral("An error has occurred when downloading the installer:\n%1").arg(reply->errorString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
const QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||||
|
|
||||||
const QByteArray data = reply->readAll();
|
const QByteArray data = reply->readAll();
|
||||||
|
|
|
@ -19,6 +19,17 @@ Kirigami.Page {
|
||||||
text: i18n("Installing...")
|
text: i18n("Installing...")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kirigami.PromptDialog {
|
||||||
|
id: errorDialog
|
||||||
|
title: i18n("Install error")
|
||||||
|
|
||||||
|
showCloseButton: false
|
||||||
|
standardButtons: Kirigami.Dialog.Ok
|
||||||
|
|
||||||
|
onAccepted: applicationWindow().pageStack.layers.pop()
|
||||||
|
onRejected: applicationWindow().pageStack.layers.pop()
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: gameInstaller.installGame()
|
Component.onCompleted: gameInstaller.installGame()
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -27,5 +38,10 @@ Kirigami.Page {
|
||||||
function onInstallFinished() {
|
function onInstallFinished() {
|
||||||
applicationWindow().checkSetup()
|
applicationWindow().checkSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onError(message) {
|
||||||
|
errorDialog.subtitle = message
|
||||||
|
errorDialog.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue