Tweak version page: select first item by default, allow changing version of 'version.json'.

This commit is contained in:
Petr Mrázek 2014-06-10 08:39:11 +02:00
parent c08bfce5f2
commit 478815dae6

View File

@ -84,6 +84,10 @@ VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
connect(ui->libraryTreeView->selectionModel(), &QItemSelectionModel::currentChanged, connect(ui->libraryTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
this, &VersionPage::versionCurrent); this, &VersionPage::versionCurrent);
updateVersionControls(); updateVersionControls();
// select first item.
auto index = main_model->index(0,0);
if(index.isValid())
ui->libraryTreeView->setCurrentIndex(index);
} }
else else
{ {
@ -373,7 +377,8 @@ void VersionPage::versionCurrent(const QModelIndex &current, const QModelIndex &
ui->moveLibraryUpBtn->setEnabled(enabled); ui->moveLibraryUpBtn->setEnabled(enabled);
} }
QString selectedId = m_version->versionFileId(current.row()); QString selectedId = m_version->versionFileId(current.row());
if (selectedId == "net.minecraft" || selectedId == "org.multimc.custom.json") if (selectedId == "net.minecraft" || selectedId == "org.multimc.custom.json" ||
selectedId == "org.multimc.version.json")
{ {
ui->changeMCVersionBtn->setEnabled(true); ui->changeMCVersionBtn->setEnabled(true);
} }