| 1838 | } |
| 1839 | |
| 1840 | void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &previous) |
| 1841 | { |
| 1842 | if (!current.isValid()) |
| 1843 | { |
| 1844 | APPLICATION->settings()->set("SelectedInstance", QString()); |
| 1845 | selectionBad(); |
| 1846 | return; |
| 1847 | } |
| 1848 | QString id = current.data(InstanceList::InstanceIDRole).toString(); |
| 1849 | m_selectedInstance = APPLICATION->instances()->getInstanceById(id); |
| 1850 | if (m_selectedInstance) |
| 1851 | { |
| 1852 | ui->instanceToolBar->setEnabled(true); |
| 1853 | if(m_selectedInstance->isRunning()) |
| 1854 | { |
| 1855 | ui->actionLaunchInstance->setEnabled(true); |
| 1856 | ui->setLaunchAction(true); |
| 1857 | } |
| 1858 | else |
| 1859 | { |
| 1860 | ui->actionLaunchInstance->setEnabled(m_selectedInstance->canLaunch()); |
| 1861 | ui->setLaunchAction(false); |
| 1862 | } |
| 1863 | ui->actionLaunchInstanceOffline->setEnabled(m_selectedInstance->canLaunch()); |
| 1864 | ui->actionExportInstance->setEnabled(m_selectedInstance->canExport()); |
| 1865 | ui->renameButton->setText(m_selectedInstance->name()); |
| 1866 | m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); |
| 1867 | updateStatusCenter(); |
| 1868 | updateInstanceToolIcon(m_selectedInstance->iconKey()); |
| 1869 | |
| 1870 | updateToolsMenu(); |
| 1871 | |
| 1872 | APPLICATION->settings()->set("SelectedInstance", m_selectedInstance->id()); |
| 1873 | } |
| 1874 | else |
| 1875 | { |
| 1876 | ui->instanceToolBar->setEnabled(false); |
| 1877 | APPLICATION->settings()->set("SelectedInstance", QString()); |
| 1878 | selectionBad(); |
| 1879 | return; |
| 1880 | } |
| 1881 | } |
| 1882 | |
| 1883 | void MainWindow::instanceSelectRequest(QString id) |
| 1884 | { |
nothing calls this directly
no test coverage detected