aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/global/AccountListPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages/global/AccountListPage.cpp')
-rw-r--r--launcher/ui/pages/global/AccountListPage.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index d3eb2655..eb1ee8d3 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -24,6 +24,7 @@
#include "net/NetJob.h"
#include "ui/dialogs/ProgressDialog.h"
+#include "ui/dialogs/OfflineLoginDialog.h"
#include "ui/dialogs/LoginDialog.h"
#include "ui/dialogs/MSALoginDialog.h"
#include "ui/dialogs/CustomMessageBox.h"
@@ -37,8 +38,6 @@
#include "BuildConfig.h"
-#include "Secrets.h"
-
AccountListPage::AccountListPage(QWidget *parent)
: QMainWindow(parent), ui(new Ui::AccountListPage)
{
@@ -74,7 +73,10 @@ AccountListPage::AccountListPage(QWidget *parent)
updateButtonStates();
// Xbox authentication won't work without a client identifier, so disable the button if it is missing
- ui->actionAddMicrosoft->setVisible(Secrets::hasMSAClientID());
+ if (APPLICATION->getMSAClientID().isEmpty()) {
+ ui->actionAddMicrosoft->setVisible(false);
+ ui->actionAddMicrosoft->setToolTip(tr("No Microsoft Authentication client ID was set."));
+ }
}
AccountListPage::~AccountListPage()
@@ -134,8 +136,8 @@ void AccountListPage::on_actionAddMicrosoft_triggered()
this,
tr("Microsoft Accounts not available"),
tr(
- "Microsoft accounts are only usable on macOS 10.13 or newer, with fully updated MultiMC.\n\n"
- "Please update both your operating system and MultiMC."
+ "Microsoft accounts are only usable on macOS 10.13 or newer, with fully updated PolyMC.\n\n"
+ "Please update both your operating system and PolyMC."
),
QMessageBox::Warning
)->exec();
@@ -155,6 +157,35 @@ void AccountListPage::on_actionAddMicrosoft_triggered()
}
}
+void AccountListPage::on_actionAddOffline_triggered()
+{
+ if (!m_accounts->anyAccountIsValid()) {
+ QMessageBox::warning(
+ this,
+ tr("Error"),
+ tr(
+ "You must add a Microsoft or Mojang account that owns Minecraft before you can add an offline account."
+ "<br><br>"
+ "If you have lost your account you can contact Microsoft for support."
+ )
+ );
+ return;
+ }
+
+ MinecraftAccountPtr account = OfflineLoginDialog::newAccount(
+ this,
+ tr("Please enter your desired username to add your offline account.")
+ );
+
+ if (account)
+ {
+ m_accounts->addAccount(account);
+ if (m_accounts->count() == 1) {
+ m_accounts->setDefaultAccount(account);
+ }
+ }
+}
+
void AccountListPage::on_actionRemove_triggered()
{
QModelIndexList selection = ui->listView->selectionModel()->selectedIndexes();