| 1874 | } |
| 1875 | |
| 1876 | void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &previous) |
| 1877 | { |
| 1878 | if (!current.isValid()) |
| 1879 | { |
| 1880 | APPLICATION->settings()->set("SelectedInstance", QString()); |
| 1881 | selectionBad(); |
| 1882 | return; |
| 1883 | } |
| 1884 | QString id = current.data(InstanceList::InstanceIDRole).toString(); |
| 1885 | m_selectedInstance = APPLICATION->instances()->getInstanceById(id); |
| 1886 | if (m_selectedInstance) |
| 1887 | { |
| 1888 | ui->instanceToolBar->setEnabled(true); |
| 1889 | if(m_selectedInstance->isRunning()) |
| 1890 | { |
| 1891 | ui->actionLaunchInstance->setEnabled(true); |
| 1892 | ui->setLaunchAction(true); |
| 1893 | } |
| 1894 | else |
| 1895 | { |
| 1896 | ui->actionLaunchInstance->setEnabled(m_selectedInstance->canLaunch()); |
| 1897 | ui->setLaunchAction(false); |
| 1898 | } |
| 1899 | ui->actionLaunchInstanceOffline->setEnabled(m_selectedInstance->canLaunch()); |
| 1900 | ui->actionExportInstance->setEnabled(m_selectedInstance->canExport()); |
| 1901 | ui->renameButton->setText(m_selectedInstance->name()); |
| 1902 | m_statusLeft->setText(m_selectedInstance->getStatusbarDescription()); |
| 1903 | updateStatusCenter(); |
| 1904 | updateInstanceToolIcon(m_selectedInstance->iconKey()); |
| 1905 | |
| 1906 | updateToolsMenu(); |
| 1907 | |
| 1908 | APPLICATION->settings()->set("SelectedInstance", m_selectedInstance->id()); |
| 1909 | } |
| 1910 | else |
| 1911 | { |
| 1912 | ui->instanceToolBar->setEnabled(false); |
| 1913 | APPLICATION->settings()->set("SelectedInstance", QString()); |
| 1914 | selectionBad(); |
| 1915 | return; |
| 1916 | } |
| 1917 | } |
| 1918 | |
| 1919 | void MainWindow::instanceSelectRequest(QString id) |
| 1920 | { |
nothing calls this directly
no test coverage detected