* Assumes the sender is a QAction */
| 1121 | * Assumes the sender is a QAction |
| 1122 | */ |
| 1123 | void MainWindow::changeActiveAccount() |
| 1124 | { |
| 1125 | QAction *sAction = (QAction *)sender(); |
| 1126 | |
| 1127 | // Profile's associated Mojang username |
| 1128 | if (sAction->data().type() != QVariant::Type::Int) |
| 1129 | return; |
| 1130 | |
| 1131 | QVariant data = sAction->data(); |
| 1132 | bool valid = false; |
| 1133 | int index = data.toInt(&valid); |
| 1134 | if(!valid) { |
| 1135 | index = -1; |
| 1136 | } |
| 1137 | auto accounts = APPLICATION->accounts(); |
| 1138 | accounts->setDefaultAccount(index == -1 ? nullptr : accounts->at(index)); |
| 1139 | defaultAccountChanged(); |
| 1140 | } |
| 1141 | |
| 1142 | void MainWindow::defaultAccountChanged() |
| 1143 | { |
nothing calls this directly
no test coverage detected