MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / loadV2

Method loadV2

launcher/minecraft/auth/AccountList.cpp:523–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523bool AccountList::loadV2(QJsonObject& root) {
524 beginResetModel();
525 auto defaultUserName = root.value("activeAccount").toString("");
526 QJsonArray accounts = root.value("accounts").toArray();
527 for (QJsonValue accountVal : accounts)
528 {
529 QJsonObject accountObj = accountVal.toObject();
530 MinecraftAccountPtr account = MinecraftAccount::loadFromJsonV2(accountObj);
531 if (account.get() != nullptr)
532 {
533 auto profileId = account->profileId();
534 if(!profileId.size()) {
535 continue;
536 }
537 if(findAccountByProfileId(profileId) != -1) {
538 continue;
539 }
540 connect(account.get(), &MinecraftAccount::changed, this, &AccountList::accountChanged);
541 connect(account.get(), &MinecraftAccount::activityChanged, this, &AccountList::accountActivityChanged);
542 m_accounts.append(account);
543 if (defaultUserName.size() && account->mojangUserName() == defaultUserName) {
544 m_defaultAccount = account;
545 }
546 }
547 else
548 {
549 qWarning() << "Failed to load an account.";
550 }
551 }
552 endResetModel();
553 return true;
554}
555
556bool AccountList::loadV3(QJsonObject& root) {
557 beginResetModel();

Callers

nothing calls this directly

Calls 6

appendMethod · 0.80
mojangUserNameMethod · 0.80
toStringMethod · 0.45
getMethod · 0.45
profileIdMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected