From f8e8414d544f1227e86099146bba903c9082d09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 2 Sep 2013 00:25:40 +0200 Subject: Speed up the downloads. Massively. --- logic/OneSixUpdate.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'logic/OneSixUpdate.cpp') diff --git a/logic/OneSixUpdate.cpp b/logic/OneSixUpdate.cpp index a47beda0..428d6ef7 100644 --- a/logic/OneSixUpdate.cpp +++ b/logic/OneSixUpdate.cpp @@ -72,19 +72,16 @@ void OneSixUpdate::versionFileStart() QString urlstr("http://s3.amazonaws.com/Minecraft.Download/versions/"); urlstr += targetVersion->descriptor + "/" + targetVersion->descriptor + ".json"; - auto dljob = DownloadJob::create(QUrl(urlstr)); - specificVersionDownloadJob.reset(new JobList()); - specificVersionDownloadJob->add(dljob); - connect(specificVersionDownloadJob.data(), SIGNAL(finished()), SLOT(versionFileFinished())); + specificVersionDownloadJob.reset(new DownloadJob(QUrl(urlstr))); + connect(specificVersionDownloadJob.data(), SIGNAL(succeeded()), SLOT(versionFileFinished())); connect(specificVersionDownloadJob.data(), SIGNAL(failed()), SLOT(versionFileFailed())); connect(specificVersionDownloadJob.data(), SIGNAL(progress(qint64,qint64)), SLOT(updateDownloadProgress(qint64,qint64))); - download_queue.enqueue(specificVersionDownloadJob); + specificVersionDownloadJob->start(); } void OneSixUpdate::versionFileFinished() { - JobPtr firstJob = specificVersionDownloadJob->getFirstJob(); - auto DlJob = firstJob.dynamicCast(); + DownloadPtr DlJob = specificVersionDownloadJob->first(); QString version_id = targetVersion->descriptor; QString inst_dir = m_inst->instanceRoot(); @@ -137,9 +134,7 @@ void OneSixUpdate::jarlibStart() QString targetstr ("versions/"); targetstr += version->id + "/" + version->id + ".jar"; - auto dljob = DownloadJob::create(QUrl(urlstr), targetstr); - jarlibDownloadJob.reset(new JobList()); - jarlibDownloadJob->add(dljob); + jarlibDownloadJob.reset(new DownloadJob(QUrl(urlstr), targetstr)); auto libs = version->getActiveNativeLibs(); libs.append(version->getActiveNormalLibs()); @@ -148,13 +143,13 @@ void OneSixUpdate::jarlibStart() { QString download_path = lib->downloadPath(); QString storage_path = "libraries/" + lib->storagePath(); - jarlibDownloadJob->add(DownloadJob::create(download_path, storage_path)); + jarlibDownloadJob->add(download_path, storage_path); } - connect(jarlibDownloadJob.data(), SIGNAL(finished()), SLOT(jarlibFinished())); + connect(jarlibDownloadJob.data(), SIGNAL(succeeded()), SLOT(jarlibFinished())); connect(jarlibDownloadJob.data(), SIGNAL(failed()), SLOT(jarlibFailed())); connect(jarlibDownloadJob.data(), SIGNAL(progress(qint64,qint64)), SLOT(updateDownloadProgress(qint64,qint64))); - download_queue.enqueue(jarlibDownloadJob); + jarlibDownloadJob->start(); } void OneSixUpdate::jarlibFinished() -- cgit v1.2.3