diff --git a/launcher/include/gameinstaller.h b/launcher/include/gameinstaller.h index d54f2ac..2ec9cef 100644 --- a/launcher/include/gameinstaller.h +++ b/launcher/include/gameinstaller.h @@ -19,6 +19,7 @@ public: Q_SIGNALS: void installFinished(); + void error(QString message); private: LauncherCore &m_launcher; diff --git a/launcher/src/assetupdater.cpp b/launcher/src/assetupdater.cpp index 347ea3c..b9a6f40 100644 --- a/launcher/src/assetupdater.cpp +++ b/launcher/src/assetupdater.cpp @@ -96,6 +96,11 @@ void AssetUpdater::update() Q_EMIT launcher.stageChanged("Checking for Dalamud updates..."); 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 // 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. diff --git a/launcher/src/gameinstaller.cpp b/launcher/src/gameinstaller.cpp index bc1fc57..fdcbcd3 100644 --- a/launcher/src/gameinstaller.cpp +++ b/launcher/src/gameinstaller.cpp @@ -29,6 +29,11 @@ void GameInstaller::installGame() auto reply = m_launcher.mgr->get(request); 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 QByteArray data = reply->readAll(); diff --git a/launcher/ui/Setup/InstallProgress.qml b/launcher/ui/Setup/InstallProgress.qml index e32f326..3165e9a 100644 --- a/launcher/ui/Setup/InstallProgress.qml +++ b/launcher/ui/Setup/InstallProgress.qml @@ -19,6 +19,17 @@ Kirigami.Page { 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() Connections { @@ -27,5 +38,10 @@ Kirigami.Page { function onInstallFinished() { applicationWindow().checkSetup() } + + function onError(message) { + errorDialog.subtitle = message + errorDialog.open() + } } } \ No newline at end of file