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