| 1647 | } |
| 1648 | |
| 1649 | void MainWindow::instanceChanged(const QModelIndex& current, [[maybe_unused]] const QModelIndex& previous) |
| 1650 | { |
| 1651 | if (!current.isValid()) { |
| 1652 | APPLICATION->settings()->set("SelectedInstance", QString()); |
| 1653 | selectionBad(); |
| 1654 | return; |
| 1655 | } |
| 1656 | if (m_selectedInstance) { |
| 1657 | disconnect(m_selectedInstance, &BaseInstance::runningStatusChanged, this, &MainWindow::refreshCurrentInstance); |
| 1658 | disconnect(m_selectedInstance, &BaseInstance::profilerChanged, this, &MainWindow::refreshCurrentInstance); |
| 1659 | } |
| 1660 | QString id = current.data(InstanceList::InstanceIDRole).toString(); |
| 1661 | m_selectedInstance = APPLICATION->instances()->getInstanceById(id); |
| 1662 | if (m_selectedInstance) { |
| 1663 | ui->instanceToolBar->setEnabled(true); |
| 1664 | setInstanceActionsEnabled(true); |
| 1665 | ui->actionLaunchInstance->setEnabled(m_selectedInstance->canLaunch()); |
| 1666 | |
| 1667 | ui->actionKillInstance->setEnabled(m_selectedInstance->isRunning()); |
| 1668 | ui->actionExportInstance->setEnabled(m_selectedInstance->canExport()); |
| 1669 | renameButton->setText(m_selectedInstance->name()); |
| 1670 | m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); |
| 1671 | updateStatusCenter(); |
| 1672 | updateInstanceToolIcon(m_selectedInstance->iconKey()); |
| 1673 | |
| 1674 | updateLaunchButton(); |
| 1675 | |
| 1676 | APPLICATION->settings()->set("SelectedInstance", m_selectedInstance->id()); |
| 1677 | |
| 1678 | connect(m_selectedInstance, &BaseInstance::runningStatusChanged, this, &MainWindow::refreshCurrentInstance); |
| 1679 | connect(m_selectedInstance, &BaseInstance::profilerChanged, this, &MainWindow::refreshCurrentInstance); |
| 1680 | } else { |
| 1681 | APPLICATION->settings()->set("SelectedInstance", QString()); |
| 1682 | selectionBad(); |
| 1683 | return; |
| 1684 | } |
| 1685 | } |
| 1686 | |
| 1687 | void MainWindow::instanceSelectRequest(QString id) |
| 1688 | { |
nothing calls this directly
no test coverage detected