diff options
Diffstat (limited to 'launcher/minecraft/auth')
-rw-r--r-- | launcher/minecraft/auth/AccountList.cpp | 10 | ||||
-rw-r--r-- | launcher/minecraft/auth/AccountList.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp index 76af0ac0..a76cac55 100644 --- a/launcher/minecraft/auth/AccountList.cpp +++ b/launcher/minecraft/auth/AccountList.cpp @@ -47,6 +47,16 @@ int AccountList::findAccountByProfileId(const QString& profileId) const { return -1; } +MinecraftAccountPtr AccountList::getAccountByProfileName(const QString& profileName) const { + for (int i = 0; i < count(); i++) { + MinecraftAccountPtr account = at(i); + if (account->profileName() == profileName) { + return account; + } + } + return nullptr; +} + const MinecraftAccountPtr AccountList::at(int i) const { return MinecraftAccountPtr(m_accounts.at(i)); diff --git a/launcher/minecraft/auth/AccountList.h b/launcher/minecraft/auth/AccountList.h index ed08bb1d..e275eb17 100644 --- a/launcher/minecraft/auth/AccountList.h +++ b/launcher/minecraft/auth/AccountList.h @@ -62,6 +62,7 @@ public: void addAccount(const MinecraftAccountPtr account); void removeAccount(QModelIndex index); int findAccountByProfileId(const QString &profileId) const; + MinecraftAccountPtr getAccountByProfileName(const QString &profileName) const; /*! * Sets the path to load/save the list file from/to. |