NOISSUE refactor *Download into more, smaller pieces

* Download is now Download.
* Download uses Sink subclasses to process various events.
* Validators can be used to further customize the Sink behaviour.
This commit is contained in:
Petr Mrázek
2016-05-28 19:54:17 +02:00
parent a750f6e63c
commit a1abbd9e05
51 changed files with 824 additions and 765 deletions

View File

@ -109,16 +109,16 @@ AboutDialog::~AboutDialog()
void AboutDialog::loadPatronList()
{
NetJob* job = new NetJob("Patreon Patron List");
patronListDownload = ByteArrayDownload::make(QUrl("http://files.multimc.org/patrons.txt"));
job->addNetAction(patronListDownload);
connect(job, &NetJob::succeeded, this, &AboutDialog::patronListLoaded);
job->start();
netJob.reset(new NetJob("Patreon Patron List"));
netJob->addNetAction(Net::Download::makeByteArray(QUrl("http://files.multimc.org/patrons.txt"), &dataSink));
connect(netJob.get(), &NetJob::succeeded, this, &AboutDialog::patronListLoaded);
netJob->start();
}
void AboutDialog::patronListLoaded()
{
QString patronListStr(patronListDownload->m_data);
QString patronListStr(dataSink);
dataSink.clear();
QString html = getCreditsHtml(patronListStr.split("\n", QString::SkipEmptyParts));
ui->creditsText->setHtml(html);
}