| 352 | } |
| 353 | |
| 354 | void InstanceManagerDialog::openSelectedInstance() |
| 355 | { |
| 356 | const auto i = singleSelectionIndex(); |
| 357 | if (i == NoSelection) { |
| 358 | return; |
| 359 | } |
| 360 | |
| 361 | const auto& to = *m_instances[i]; |
| 362 | |
| 363 | if (!confirmSwitch(to)) { |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | if (to.isPortable()) { |
| 368 | InstanceManager::singleton().setCurrentInstance(""); |
| 369 | } else { |
| 370 | InstanceManager::singleton().setCurrentInstance(to.displayName()); |
| 371 | } |
| 372 | |
| 373 | if (m_restartOnSelect) { |
| 374 | ExitModOrganizer(Exit::Restart); |
| 375 | } |
| 376 | |
| 377 | accept(); |
| 378 | } |
| 379 | |
| 380 | bool InstanceManagerDialog::confirmSwitch(const Instance& to) |
| 381 | { |
nothing calls this directly
no test coverage detected