NOISSUE sanitize loading and downloading of metadata files

This commit is contained in:
Petr Mrázek
2017-03-18 02:22:36 +01:00
parent 0060b50625
commit e46aba9da5
20 changed files with 164 additions and 510 deletions

View File

@ -554,21 +554,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
job->start();
}
// run the things that load and download other things... FIXME: this is NOT the place
// FIXME: invisible actions in the background = NOPE.
// load the news
{
/*
if (!MMC->minecraftlist()->isLoaded())
{
m_versionLoadTask = MMC->minecraftlist()->getLoadTask();
startTask(m_versionLoadTask);
}
if (!MMC->lwjgllist()->isLoaded())
{
MMC->lwjgllist()->loadList();
}
*/
m_newsChecker->reloadNews();
updateNewsLabel();
}

View File

@ -97,7 +97,7 @@ QIcon PackagesPage::icon() const
void PackagesPage::on_refreshIndexBtn_clicked()
{
ProgressDialog(this).execWithTask(ENV.metadataIndex()->remoteUpdateTask());
ENV.metadataIndex()->load();
}
void PackagesPage::on_refreshFileBtn_clicked()
{
@ -106,7 +106,7 @@ void PackagesPage::on_refreshFileBtn_clicked()
{
return;
}
ProgressDialog(this).execWithTask(list->remoteUpdateTask());
list->load();
}
void PackagesPage::on_refreshVersionBtn_clicked()
{
@ -115,7 +115,7 @@ void PackagesPage::on_refreshVersionBtn_clicked()
{
return;
}
ProgressDialog(this).execWithTask(version->remoteUpdateTask());
version->load();
}
void PackagesPage::on_fileSearchEdit_textChanged(const QString &search)
@ -158,19 +158,7 @@ void PackagesPage::updateCurrentVersionList(const QModelIndex &index)
ui->fileName->setText(list->name());
m_versionProxy->setSourceModel(list.get());
ui->refreshFileBtn->setText(tr("Refresh %1").arg(list->humanReadable()));
if (!list->isLocalLoaded())
{
std::unique_ptr<Task> task = list->localUpdateTask();
connect(task.get(), &Task::finished, this, [this, list]()
{
if (list->count() == 0 && !list->isRemoteLoaded())
{
ProgressDialog(this).execWithTask(list->remoteUpdateTask());
}
});
ProgressDialog(this).execWithTask(task);
}
list->load();
}
else
{
@ -227,16 +215,5 @@ void PackagesPage::updateVersion()
void PackagesPage::opened()
{
if (!ENV.metadataIndex()->isLocalLoaded())
{
std::unique_ptr<Task> task = ENV.metadataIndex()->localUpdateTask();
connect(task.get(), &Task::finished, this, [this]()
{
if (!ENV.metadataIndex()->isRemoteLoaded())
{
ProgressDialog(this).execWithTask(ENV.metadataIndex()->remoteUpdateTask());
}
});
ProgressDialog(this).execWithTask(task);
}
ENV.metadataIndex()->load();
}