summaryrefslogtreecommitdiffstats
path: root/logic/OneSixUpdate.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-02 00:25:40 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-02 00:25:40 +0200
commitf8e8414d544f1227e86099146bba903c9082d09e (patch)
treea0983c2a5a17feda4c2f813d32d0b98111463176 /logic/OneSixUpdate.cpp
parent78e278c1e33e39eb29a26a976b19ea6a8150bfff (diff)
downloadMultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar.gz
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar.lz
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.tar.xz
MultiMC-f8e8414d544f1227e86099146bba903c9082d09e.zip
Speed up the downloads. Massively.
Diffstat (limited to 'logic/OneSixUpdate.cpp')
-rw-r--r--logic/OneSixUpdate.cpp21
1 files changed, 8 insertions, 13 deletions
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<DownloadJob>();
+ 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()