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

Method data

launcher/minecraft/auth/AccountList.cpp:277–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277QVariant AccountList::data(const QModelIndex &index, int role) const
278{
279 if (!index.isValid())
280 return QVariant();
281
282 if (index.row() > count())
283 return QVariant();
284
285 MinecraftAccountPtr account = at(index.row());
286
287 switch (role)
288 {
289 case Qt::DisplayRole:
290 switch (index.column())
291 {
292 case ProfileNameColumn: {
293 return account->profileName();
294 }
295
296 case NameColumn:
297 return account->accountDisplayString();
298
299 case TypeColumn: {
300 auto typeStr = account->typeString();
301 typeStr[0] = typeStr[0].toUpper();
302 return typeStr;
303 }
304
305 case StatusColumn: {
306 switch(account->accountState()) {
307 case AccountState::Unchecked: {
308 return tr("Unchecked", "Account status");
309 }
310 case AccountState::Offline: {
311 return tr("Offline", "Account status");
312 }
313 case AccountState::Online: {
314 return tr("Ready", "Account status");
315 }
316 case AccountState::Working: {
317 return tr("Working", "Account status");
318 }
319 case AccountState::Errored: {
320 return tr("Errored", "Account status");
321 }
322 case AccountState::Expired: {
323 return tr("Expired", "Account status");
324 }
325 case AccountState::Disabled: {
326 return tr("Disabled", "Account status");
327 }
328 case AccountState::Gone: {
329 return tr("Gone", "Account status");
330 }
331 case AccountState::Queued: {
332 qWarning() << "Unhandled account state Queued";
333 [[fallthrough]];
334 }

Callers

nothing calls this directly

Calls 8

accountStateMethod · 0.80
isMSAMethod · 0.80
isOfflineMethod · 0.80
canMigrateMethod · 0.80
isValidMethod · 0.45
profileNameMethod · 0.45
accountDisplayStringMethod · 0.45
typeStringMethod · 0.45

Tested by

no test coverage detected