* Assumes the sender is a QAction */
| 1103 | * Assumes the sender is a QAction |
| 1104 | */ |
| 1105 | void MainWindow::changeActiveAccount() |
| 1106 | { |
| 1107 | QAction *sAction = (QAction *)sender(); |
| 1108 | |
| 1109 | // Profile's associated Mojang username |
| 1110 | if (sAction->data().type() != QVariant::Type::Int) |
| 1111 | return; |
| 1112 | |
| 1113 | QVariant data = sAction->data(); |
| 1114 | bool valid = false; |
| 1115 | int index = data.toInt(&valid); |
| 1116 | if(!valid) { |
| 1117 | index = -1; |
| 1118 | } |
| 1119 | auto accounts = APPLICATION->accounts(); |
| 1120 | accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index)); |
| 1121 | defaultAccountChanged(); |
| 1122 | } |
| 1123 | |
| 1124 | void MainWindow::defaultAccountChanged() |
| 1125 | { |
nothing calls this directly
no test coverage detected