NOISSUE make vanilla refresh button work

This commit is contained in:
Petr Mrázek 2018-03-27 23:19:29 +02:00
parent 6188c577e3
commit b46a34d0ae
2 changed files with 7 additions and 27 deletions

View File

@ -25,6 +25,7 @@ VanillaPage::VanillaPage(NewInstanceDialog *dialog, QWidget *parent)
connect(ui->snapshotFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
connect(ui->oldSnapshotFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
connect(ui->releaseFilter, &QCheckBox::stateChanged, this, &VanillaPage::filterChanged);
connect(ui->refreshBtn, &QPushButton::clicked, this, &VanillaPage::refresh);
}
void VanillaPage::openedImpl()
@ -33,23 +34,6 @@ void VanillaPage::openedImpl()
{
auto vlist = ENV.metadataIndex()->get("net.minecraft");
ui->versionList->initialize(vlist.get());
if(vlist->isLoaded())
{
setSelectedVersion(vlist->getRecommended());
}
else
{
vlist->load(Net::Mode::Online);
auto task = vlist->getLoadTask();
if(vlist->isLoaded())
{
setSelectedVersion(vlist->getRecommended());
}
if(task)
{
connect(task.get(), &Task::succeeded, this, &VanillaPage::versionListUpdated);
}
}
initialized = true;
}
else
@ -58,6 +42,11 @@ void VanillaPage::openedImpl()
}
}
void VanillaPage::refresh()
{
ui->versionList->loadList();
}
void VanillaPage::filterChanged()
{
QStringList out;
@ -90,15 +79,6 @@ BaseVersionPtr VanillaPage::selectedVersion() const
return m_selectedVersion;
}
void VanillaPage::versionListUpdated()
{
if(!m_versionSetByUser)
{
auto vlist = ENV.metadataIndex()->get("net.minecraft");
setSelectedVersion(vlist->getRecommended());
}
}
void VanillaPage::suggestCurrent()
{
if(m_selectedVersion && isOpened)

View File

@ -60,10 +60,10 @@ public slots:
void setSelectedVersion(BaseVersionPtr version);
private slots:
void versionListUpdated();
void filterChanged();
private:
void refresh();
void suggestCurrent();
private: