* Assumes the sender is a QAction */
| 702 | * Assumes the sender is a QAction |
| 703 | */ |
| 704 | void MainWindow::changeActiveAccount() |
| 705 | { |
| 706 | QAction* sAction = (QAction*)sender(); |
| 707 | |
| 708 | // Profile's associated Mojang username |
| 709 | if (sAction->data().type() != QVariant::Type::Int) |
| 710 | return; |
| 711 | |
| 712 | QVariant action_data = sAction->data(); |
| 713 | bool valid = false; |
| 714 | int index = action_data.toInt(&valid); |
| 715 | if (!valid) { |
| 716 | index = -1; |
| 717 | } |
| 718 | auto accounts = APPLICATION->accounts(); |
| 719 | accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index)); |
| 720 | defaultAccountChanged(); |
| 721 | } |
| 722 | |
| 723 | void MainWindow::defaultAccountChanged() |
| 724 | { |
nothing calls this directly
no test coverage detected