mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
show error code in dialog, change text for no internet
Signed-off-by: Tayou <git@tayou.org>
(cherry picked from commit d71cfc33a2)
This commit is contained in:
parent
f490d4f77f
commit
3fd432153c
6 changed files with 17 additions and 2 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "minecraft/auth/AccountList.h"
|
||||
|
||||
#include "ui/InstanceWindow.h"
|
||||
#include "net/NetUtils.h"
|
||||
#include "ui/dialogs/CustomMessageBox.h"
|
||||
#include "ui/dialogs/MSALoginDialog.h"
|
||||
#include "ui/dialogs/ProfileSelectDialog.h"
|
||||
|
|
@ -185,8 +186,16 @@ LaunchDecision LaunchController::decideLaunchMode()
|
|||
case AccountState::Offline: {
|
||||
if (m_wantedLaunchMode == LaunchMode::Normal) {
|
||||
QMessageBox msg(m_parentWidget);
|
||||
msg.setWindowTitle(tr("Auth servers offline"));
|
||||
msg.setText(tr("The Minecraft authentication servers are currently unavailable."));
|
||||
|
||||
auto netErr = accountToCheck->accountData()->networkError;
|
||||
if (Net::isServerError(netErr)) {
|
||||
msg.setWindowTitle(tr("Auth servers offline"));
|
||||
msg.setText(tr("The Minecraft authentication servers are currently unavailable.\n\n%1").arg(accountToCheck->lastError()));
|
||||
} else {
|
||||
msg.setWindowTitle(tr("No internet connection"));
|
||||
msg.setText(tr("Unable to connect to the internet.\n\n%1").arg(accountToCheck->lastError()));
|
||||
}
|
||||
|
||||
msg.setIcon(QMessageBox::Warning);
|
||||
|
||||
auto* launchOfflineButton = msg.addButton(tr("Launch Offline"), QMessageBox::AcceptRole);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
#include <QVariantMap>
|
||||
|
||||
enum class Validity { None, Assumed, Certain };
|
||||
|
|
@ -118,5 +119,6 @@ struct AccountData {
|
|||
// runtime only information (not saved with the account)
|
||||
QString internalId;
|
||||
QString errorString;
|
||||
QNetworkReply::NetworkError networkError = QNetworkReply::NoError;
|
||||
AccountState accountState = AccountState::Unchecked;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ void LauncherLoginStep::onRequestDone(QByteArray* response)
|
|||
emit finished(AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Failed to get Minecraft access token: %1").arg(m_request->errorString()));
|
||||
} else {
|
||||
m_data->networkError = m_request->error();
|
||||
emit finished(AccountTaskState::STATE_OFFLINE, tr("Failed to get Minecraft access token: %1").arg(m_request->errorString()));
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ void MinecraftProfileStep::onRequestDone(QByteArray* response)
|
|||
emit finished(AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Minecraft Java profile acquisition failed: %1").arg(m_request->errorString()));
|
||||
} else {
|
||||
m_data->networkError = m_request->error();
|
||||
emit finished(AccountTaskState::STATE_OFFLINE,
|
||||
tr("Minecraft Java profile acquisition failed: %1").arg(m_request->errorString()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ void XboxAuthorizationStep::onRequestDone(QByteArray* response)
|
|||
emit finished(AccountTaskState::STATE_FAILED_SOFT,
|
||||
tr("Unknown STS error for %1 services: %2").arg(m_authorizationKind, m_request->errorString()));
|
||||
} else {
|
||||
m_data->networkError = m_request->error();
|
||||
emit finished(AccountTaskState::STATE_OFFLINE,
|
||||
tr("Failed to get authorization for %1 services: %2").arg(m_authorizationKind, m_request->errorString()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ void XboxUserStep::onRequestDone(QByteArray* response)
|
|||
if (Net::isApplicationError(m_request->error()) && !Net::isServerError(m_request->error())) {
|
||||
emit finished(AccountTaskState::STATE_FAILED_SOFT, tr("Xbox user authentication failed: %1").arg(m_request->errorString()));
|
||||
} else {
|
||||
m_data->networkError = m_request->error();
|
||||
emit finished(AccountTaskState::STATE_OFFLINE, tr("Xbox user authentication failed: %1").arg(m_request->errorString()));
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue