From 4877862da05a71d7f4ddbff4abb3bbeccce0387f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 1 Apr 2024 14:56:58 -0400 Subject: [PATCH] Prompt for error messages when DXVK/Wine updating fails --- launcher/src/assetupdater.cpp | 14 ++++++++++++-- launcher/ui/Pages/StatusPage.qml | 12 +++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/launcher/src/assetupdater.cpp b/launcher/src/assetupdater.cpp index bb63d2b..8694ec1 100644 --- a/launcher/src/assetupdater.cpp +++ b/launcher/src/assetupdater.cpp @@ -201,6 +201,11 @@ QCoro::Task AssetUpdater::installCompatibilityTool() const auto reply = launcher.mgr()->get(request); co_await reply; + if (reply->error() != QNetworkReply::NetworkError::NoError) { + Q_EMIT launcher.miscError(i18n("Could not update compatibility tool:\n\n%1", reply->errorString())); + co_return false; + } + qInfo(ASTRA_LOG) << "Finished downloading compatibility tool"; QFile file(m_tempDir.filePath(QStringLiteral("wine.tar.xz"))); @@ -211,7 +216,7 @@ QCoro::Task AssetUpdater::installCompatibilityTool() KTar archive(m_tempDir.filePath(QStringLiteral("wine.tar.xz"))); if (!archive.open(QIODevice::ReadOnly)) { qCritical(ASTRA_LOG) << "Failed to install compatibility tool"; - Q_EMIT launcher.dalamudError(i18n("Failed to install compatibility tool.")); + Q_EMIT launcher.miscError(i18n("Failed to install compatibility tool.")); co_return false; } @@ -240,6 +245,11 @@ QCoro::Task AssetUpdater::installDxvkTool() qInfo(ASTRA_LOG) << "Finished downloading DXVK"; + if (reply->error() != QNetworkReply::NetworkError::NoError) { + Q_EMIT launcher.miscError(i18n("Could not update DXVK:\n\n%1", reply->errorString())); + co_return false; + } + QFile file(m_tempDir.filePath(QStringLiteral("dxvk.tar.xz"))); file.open(QIODevice::WriteOnly); file.write(reply->readAll()); @@ -248,7 +258,7 @@ QCoro::Task AssetUpdater::installDxvkTool() KTar archive(m_tempDir.filePath(QStringLiteral("dxvk.tar.xz"))); if (!archive.open(QIODevice::ReadOnly)) { qCritical(ASTRA_LOG) << "Failed to install DXVK"; - Q_EMIT launcher.dalamudError(i18n("Failed to install DXVK.")); + Q_EMIT launcher.miscError(i18n("Failed to install DXVK.")); co_return false; } diff --git a/launcher/ui/Pages/StatusPage.qml b/launcher/ui/Pages/StatusPage.qml index b93c42b..5c0cb60 100644 --- a/launcher/ui/Pages/StatusPage.qml +++ b/launcher/ui/Pages/StatusPage.qml @@ -30,7 +30,6 @@ Kirigami.Page { Kirigami.PromptDialog { id: errorDialog - title: i18n("Login Error") showCloseButton: false standardButtons: Kirigami.Dialog.Ok @@ -73,8 +72,15 @@ Kirigami.Page { } function onLoginError(message) { - errorDialog.subtitle = message - errorDialog.open() + errorDialog.title = i18n("Login Error"); + errorDialog.subtitle = message; + errorDialog.open(); + } + + function onMiscError(message) { + errorDialog.title = i18n("Error"); + errorDialog.subtitle = message; + errorDialog.open(); } function onDalamudError(message) {