* Assumes the sender is a QAction */
| 1419 | * Assumes the sender is a QAction |
| 1420 | */ |
| 1421 | void MainWindow::changeActiveAccount() |
| 1422 | { |
| 1423 | QAction *sAction = (QAction *)sender(); |
| 1424 | |
| 1425 | // Profile's associated Mojang username |
| 1426 | if (sAction->data().type() != QVariant::Type::Int) |
| 1427 | return; |
| 1428 | |
| 1429 | QVariant data = sAction->data(); |
| 1430 | bool valid = false; |
| 1431 | int index = data.toInt(&valid); |
| 1432 | if(!valid) { |
| 1433 | index = -1; |
| 1434 | } |
| 1435 | auto accounts = APPLICATION->accounts(); |
| 1436 | accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index)); |
| 1437 | defaultAccountChanged(); |
| 1438 | } |
| 1439 | |
| 1440 | void MainWindow::defaultAccountChanged() |
| 1441 | { |
nothing calls this directly
no test coverage detected