MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / instanceChanged

Method instanceChanged

launcher/ui/MainWindow.cpp:1659–1695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1657}
1658
1659void 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
1697void MainWindow::instanceSelectRequest(QString id)
1698{

Callers

nothing calls this directly

Calls 15

QStringClass · 0.85
getInstanceByIdMethod · 0.80
instancesMethod · 0.80
setEnabledMethod · 0.80
isValidMethod · 0.45
setMethod · 0.45
settingsMethod · 0.45
getMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
canLaunchMethod · 0.45
isRunningMethod · 0.45

Tested by

no test coverage detected