diff options
author | swirl <swurl@swurl.xyz> | 2022-02-03 13:54:27 -0500 |
---|---|---|
committer | swirl <swurl@swurl.xyz> | 2022-02-03 13:54:27 -0500 |
commit | 2177aa2a6b248088f76b463c43d04c65126195bf (patch) | |
tree | dfa09fc140c9757b52ceffff9a61c19accd22036 /launcher/ui/pages/global/AccountListPage.cpp | |
parent | e8a4902a3dddd08d65bd1284951ae5954439d1f5 (diff) | |
parent | e0a04c50316089b9a443355394c5babf39a1771d (diff) | |
download | PrismLauncher-2177aa2a6b248088f76b463c43d04c65126195bf.tar.gz PrismLauncher-2177aa2a6b248088f76b463c43d04c65126195bf.tar.bz2 PrismLauncher-2177aa2a6b248088f76b463c43d04c65126195bf.zip |
Merge branch 'offline-mode-accounts' of git://github.com/NyaomiDEV/PolyMC into feature/offline_mode
Diffstat (limited to 'launcher/ui/pages/global/AccountListPage.cpp')
-rw-r--r-- | launcher/ui/pages/global/AccountListPage.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp index b8da6c75..396d320f 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" @@ -153,6 +154,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(); |