diff options
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r-- | api/logic/minecraft/AssetsUtils.cpp | 2 | ||||
-rw-r--r-- | api/logic/minecraft/SkinUpload.cpp | 2 | ||||
-rw-r--r-- | api/logic/minecraft/auth/YggdrasilTask.cpp | 2 | ||||
-rw-r--r-- | api/logic/minecraft/flame/FileResolvingTask.cpp | 2 | ||||
-rw-r--r-- | api/logic/minecraft/forge/ForgeXzDownload.cpp | 56 | ||||
-rw-r--r-- | api/logic/minecraft/forge/ForgeXzDownload.h | 4 | ||||
-rw-r--r-- | api/logic/minecraft/legacy/LegacyInstance.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/legacy/LegacyUpdate.cpp | 16 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/OneSixUpdate.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/update/AssetUpdateTask.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/update/FMLLibrariesTask.cpp | 6 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/update/LibrariesTask.cpp | 2 |
12 files changed, 52 insertions, 52 deletions
diff --git a/api/logic/minecraft/AssetsUtils.cpp b/api/logic/minecraft/AssetsUtils.cpp index 5191e5bd..ad864d51 100644 --- a/api/logic/minecraft/AssetsUtils.cpp +++ b/api/logic/minecraft/AssetsUtils.cpp @@ -199,7 +199,7 @@ NetActionPtr AssetObject::getDownloadAction() auto rawHash = QByteArray::fromHex(hash.toLatin1()); objectDL->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawHash)); } - objectDL->m_total_progress = size; + objectDL->setProgress(0, size); return objectDL; } return nullptr; diff --git a/api/logic/minecraft/SkinUpload.cpp b/api/logic/minecraft/SkinUpload.cpp index 1d1e38f3..dafd3a85 100644 --- a/api/logic/minecraft/SkinUpload.cpp +++ b/api/logic/minecraft/SkinUpload.cpp @@ -43,7 +43,7 @@ void SkinUpload::executeTask() QNetworkReply *rep = ENV.qnam().put(request, multiPart); m_reply = std::shared_ptr<QNetworkReply>(rep); - setStatus(tr("Uploading skin")); + setStatusText(tr("Uploading skin")); connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress); connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished())); diff --git a/api/logic/minecraft/auth/YggdrasilTask.cpp b/api/logic/minecraft/auth/YggdrasilTask.cpp index 425da76a..72c1c66f 100644 --- a/api/logic/minecraft/auth/YggdrasilTask.cpp +++ b/api/logic/minecraft/auth/YggdrasilTask.cpp @@ -237,7 +237,7 @@ QString YggdrasilTask::getStateMessage() const void YggdrasilTask::changeState(YggdrasilTask::State newState, QString reason) { m_state = newState; - setStatus(getStateMessage()); + setStatusText(getStateMessage()); if (newState == STATE_SUCCEEDED) { emitSucceeded(); diff --git a/api/logic/minecraft/flame/FileResolvingTask.cpp b/api/logic/minecraft/flame/FileResolvingTask.cpp index 582e4a07..093de3ec 100644 --- a/api/logic/minecraft/flame/FileResolvingTask.cpp +++ b/api/logic/minecraft/flame/FileResolvingTask.cpp @@ -10,7 +10,7 @@ Flame::FileResolvingTask::FileResolvingTask(Flame::Manifest& toProcess) void Flame::FileResolvingTask::executeTask() { - setStatus(tr("Resolving mod IDs...")); + setStatusText(tr("Resolving mod IDs...")); setProgress(0, m_toProcess.files.size()); m_dljob.reset(new NetJob("Mod id resolver")); results.resize(m_toProcess.files.size()); diff --git a/api/logic/minecraft/forge/ForgeXzDownload.cpp b/api/logic/minecraft/forge/ForgeXzDownload.cpp index 4d94dd12..8bcd43aa 100644 --- a/api/logic/minecraft/forge/ForgeXzDownload.cpp +++ b/api/logic/minecraft/forge/ForgeXzDownload.cpp @@ -28,31 +28,31 @@ ForgeXzDownload::ForgeXzDownload(QString relative_path, MetaEntryPtr entry) : Ne m_entry = entry; m_target_path = entry->getFullPath(); m_pack200_xz_file.setFileTemplate("./dl_temp.XXXXXX"); - m_status = Job_NotStarted; + m_status = Status::NotStarted; m_url_path = relative_path; m_url = "http://files.minecraftforge.net/maven/" + m_url_path + ".pack.xz"; } -void ForgeXzDownload::start() +void ForgeXzDownload::executeTask() { - if(m_status == Job_Aborted) + if(m_status == Status::Aborted) { qWarning() << "Attempt to start an aborted Download:" << m_url.toString(); - emit aborted(m_index_within_job); + emit aborted(); return; } - m_status = Job_InProgress; + m_status = Status::InProgress; if (!m_entry->isStale()) { - m_status = Job_Finished; - emit succeeded(m_index_within_job); + m_status = Status::Finished; + emit succeeded(); return; } // can we actually create the real, final file? if (!FS::ensureFilePathExists(m_target_path)) { - m_status = Job_Failed; - emit failed(m_index_within_job); + m_status = Status::Failed; + emit failed(); return; } @@ -72,9 +72,9 @@ void ForgeXzDownload::start() void ForgeXzDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { - m_total_progress = bytesTotal; + m_progressTotal = bytesTotal; m_progress = bytesReceived; - emit netActionProgress(m_index_within_job, bytesReceived, bytesTotal); + emit progress(bytesReceived, bytesTotal); } void ForgeXzDownload::downloadError(QNetworkReply::NetworkError error) @@ -82,29 +82,29 @@ void ForgeXzDownload::downloadError(QNetworkReply::NetworkError error) if(error == QNetworkReply::OperationCanceledError) { qCritical() << "Aborted " << m_url.toString(); - m_status = Job_Aborted; + m_status = Status::Aborted; } else { // error happened during download. qCritical() << "Failed " << m_url.toString() << " with reason " << error; - m_status = Job_Failed; + m_status = Status::Failed; } } void ForgeXzDownload::failAndTryNextMirror() { - m_status = Job_Failed; - emit failed(m_index_within_job); + m_status = Status::Failed; + emit failed(); } void ForgeXzDownload::downloadFinished() { // if the download succeeded - if (m_status != Job_Failed && m_status != Job_Aborted) + if (m_status != Status::Failed && m_status != Status::Aborted) { // nothing went wrong... - m_status = Job_Finished; + m_status = Status::Finished; if (m_pack200_xz_file.isOpen()) { // we actually downloaded something! process and isntall it @@ -114,25 +114,25 @@ void ForgeXzDownload::downloadFinished() else { // something bad happened -- on the local machine! - m_status = Job_Failed; + m_status = Status::Failed; m_pack200_xz_file.remove(); m_reply.reset(); - emit failed(m_index_within_job); + emit failed(); return; } } - else if(m_status == Job_Aborted) + else if(m_status == Status::Aborted) { m_pack200_xz_file.remove(); m_reply.reset(); - emit failed(m_index_within_job); - emit aborted(m_index_within_job); + emit failed(); + emit aborted(); return; } // else the download failed else { - m_status = Job_Failed; + m_status = Status::Failed; m_pack200_xz_file.close(); m_pack200_xz_file.remove(); m_reply.reset(); @@ -152,7 +152,7 @@ void ForgeXzDownload::downloadReadyRead() * Can't open the file... the job failed */ m_reply->abort(); - emit failed(m_index_within_job); + emit failed(); return; } } @@ -345,7 +345,7 @@ void ForgeXzDownload::decompressAndInstall() } catch (std::runtime_error &err) { - m_status = Job_Failed; + m_status = Status::Failed; qCritical() << "Error unpacking " << pack200_file.fileName() << " : " << err.what(); QFile f(m_target_path); if (f.exists()) @@ -374,18 +374,18 @@ void ForgeXzDownload::decompressAndInstall() ENV.metacache()->updateEntry(m_entry); m_reply.reset(); - emit succeeded(m_index_within_job); + emit succeeded(); } bool ForgeXzDownload::abort() { if(m_reply) m_reply->abort(); - m_status = Job_Aborted; + m_status = Status::Aborted; return true; } -bool ForgeXzDownload::canAbort() +bool ForgeXzDownload::canAbort() const { return true; } diff --git a/api/logic/minecraft/forge/ForgeXzDownload.h b/api/logic/minecraft/forge/ForgeXzDownload.h index ef23809b..ede4e6ce 100644 --- a/api/logic/minecraft/forge/ForgeXzDownload.h +++ b/api/logic/minecraft/forge/ForgeXzDownload.h @@ -41,7 +41,7 @@ public: return ForgeXzDownloadPtr(new ForgeXzDownload(relative_path, entry)); } virtual ~ForgeXzDownload(){}; - bool canAbort() override; + bool canAbort() const override; protected slots: @@ -52,7 +52,7 @@ slots: public slots: - void start() override; + void executeTask() override; bool abort() override; private: diff --git a/api/logic/minecraft/legacy/LegacyInstance.cpp b/api/logic/minecraft/legacy/LegacyInstance.cpp index 0987d56f..5894d7f0 100644 --- a/api/logic/minecraft/legacy/LegacyInstance.cpp +++ b/api/logic/minecraft/legacy/LegacyInstance.cpp @@ -131,7 +131,7 @@ std::shared_ptr<Task> LegacyInstance::createJarModdingTask() return; } - setStatus(tr("Installing mods: Backing up minecraft.jar ...")); + setStatusText(tr("Installing mods: Backing up minecraft.jar ...")); if (!baseJar.exists() && !QFile::copy(runnableJar.filePath(), baseJar.filePath())) { emitFailed("It seems both the active and base jar are gone. A fresh base jar will " @@ -155,7 +155,7 @@ std::shared_ptr<Task> LegacyInstance::createJarModdingTask() return; } - setStatus(tr("Installing mods: Opening minecraft.jar ...")); + setStatusText(tr("Installing mods: Opening minecraft.jar ...")); QString outputJarPath = runnableJar.filePath(); QString inputJarPath = baseJar.filePath(); diff --git a/api/logic/minecraft/legacy/LegacyUpdate.cpp b/api/logic/minecraft/legacy/LegacyUpdate.cpp index 337a3e4e..4bde6ff8 100644 --- a/api/logic/minecraft/legacy/LegacyUpdate.cpp +++ b/api/logic/minecraft/legacy/LegacyUpdate.cpp @@ -58,7 +58,7 @@ void LegacyUpdate::fmllibsStart() auto &libList = fmlLibsMapping[version]; // determine if we need some libs for FML or forge - setStatus(tr("Checking for FML libraries...")); + setStatusText(tr("Checking for FML libraries...")); for (unsigned i = 0; i < modList->size(); i++) { auto &mod = modList->operator[](i); @@ -105,7 +105,7 @@ void LegacyUpdate::fmllibsStart() } // download missing libs to our place - setStatus(tr("Dowloading FML libraries...")); + setStatusText(tr("Dowloading FML libraries...")); auto dljob = new NetJob("FML libraries"); auto metacache = ENV.metacache(); for (auto &lib : fmlLibsToProcess) @@ -128,7 +128,7 @@ void LegacyUpdate::fmllibsFinished() legacyDownloadJob.reset(); if(!fmlLibsToProcess.isEmpty()) { - setStatus(tr("Copying FML libraries into the instance...")); + setStatusText(tr("Copying FML libraries into the instance...")); LegacyInstance *inst = (LegacyInstance *)m_inst; auto metacache = ENV.metacache(); int index = 0; @@ -183,7 +183,7 @@ void LegacyUpdate::lwjglStart() return; } - setStatus(tr("Downloading new LWJGL...")); + setStatusText(tr("Downloading new LWJGL...")); auto version = std::dynamic_pointer_cast<LWJGLVersion>(list->findVersion(lwjglVersion)); if (!version) { @@ -247,7 +247,7 @@ void LegacyUpdate::lwjglFinished(QNetworkReply *reply) saveMe.open(QIODevice::WriteOnly); saveMe.write(m_reply->readAll()); saveMe.close(); - setStatus(tr("Installing new LWJGL...")); + setStatusText(tr("Installing new LWJGL...")); extractLwjgl(); jarStart(); } @@ -323,7 +323,7 @@ void LegacyUpdate::extractLwjgl() // Now if destFileName is still empty, go to the next file. if (!destFileName.isEmpty()) { - setStatus(tr("Installing new LWJGL - extracting ") + name + "..."); + setStatusText(tr("Installing new LWJGL - extracting ") + name + "..."); QFile output(destFileName); output.open(QIODevice::WriteOnly); output.write(file.readAll()); @@ -353,7 +353,7 @@ void LegacyUpdate::jarStart() return; } - setStatus(tr("Checking for jar updates...")); + setStatusText(tr("Checking for jar updates...")); // Make directories QDir binDir(inst->binRoot()); if (!binDir.exists() && !binDir.mkpath(".")) @@ -363,7 +363,7 @@ void LegacyUpdate::jarStart() } // Build a list of URLs that will need to be downloaded. - setStatus(tr("Downloading new minecraft.jar ...")); + setStatusText(tr("Downloading new minecraft.jar ...")); QString version_id = inst->intendedVersionId(); diff --git a/api/logic/minecraft/onesix/OneSixUpdate.cpp b/api/logic/minecraft/onesix/OneSixUpdate.cpp index e0027032..c45dada1 100644 --- a/api/logic/minecraft/onesix/OneSixUpdate.cpp +++ b/api/logic/minecraft/onesix/OneSixUpdate.cpp @@ -116,7 +116,7 @@ void OneSixUpdate::next() disconnect(task.get(), &Task::succeeded, this, &OneSixUpdate::subtaskSucceeded); disconnect(task.get(), &Task::failed, this, &OneSixUpdate::subtaskFailed); disconnect(task.get(), &Task::progress, this, &OneSixUpdate::progress); - disconnect(task.get(), &Task::status, this, &OneSixUpdate::setStatus); + disconnect(task.get(), &Task::status, this, &OneSixUpdate::setStatusText); } if(m_currentTask == m_tasks.size()) { @@ -132,7 +132,7 @@ void OneSixUpdate::next() connect(task.get(), &Task::succeeded, this, &OneSixUpdate::subtaskSucceeded); connect(task.get(), &Task::failed, this, &OneSixUpdate::subtaskFailed); connect(task.get(), &Task::progress, this, &OneSixUpdate::progress); - connect(task.get(), &Task::status, this, &OneSixUpdate::setStatus); + connect(task.get(), &Task::status, this, &OneSixUpdate::setStatusText); // if the task is already running, do not start it again if(!task->isRunning()) { diff --git a/api/logic/minecraft/onesix/update/AssetUpdateTask.cpp b/api/logic/minecraft/onesix/update/AssetUpdateTask.cpp index 21600ff0..bdd50fd1 100644 --- a/api/logic/minecraft/onesix/update/AssetUpdateTask.cpp +++ b/api/logic/minecraft/onesix/update/AssetUpdateTask.cpp @@ -10,7 +10,7 @@ AssetUpdateTask::AssetUpdateTask(OneSixInstance * inst) } void AssetUpdateTask::executeTask() { - setStatus(tr("Updating assets index...")); + setStatusText(tr("Updating assets index...")); auto profile = m_inst->getMinecraftProfile(); auto assets = profile->getMinecraftAssets(); QUrl indexUrl = assets->url; @@ -63,7 +63,7 @@ void AssetUpdateTask::assetIndexFinished() auto job = index.getDownloadJob(); if(job) { - setStatus(tr("Getting the assets files from Mojang...")); + setStatusText(tr("Getting the assets files from Mojang...")); downloadJob = job; connect(downloadJob.get(), &NetJob::succeeded, this, &AssetUpdateTask::emitSucceeded); connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetsFailed); diff --git a/api/logic/minecraft/onesix/update/FMLLibrariesTask.cpp b/api/logic/minecraft/onesix/update/FMLLibrariesTask.cpp index 1cbee95e..4a0a97ea 100644 --- a/api/logic/minecraft/onesix/update/FMLLibrariesTask.cpp +++ b/api/logic/minecraft/onesix/update/FMLLibrariesTask.cpp @@ -32,7 +32,7 @@ void FMLLibrariesTask::executeTask() auto &libList = fmlLibsMapping[version]; // determine if we need some libs for FML or forge - setStatus(tr("Checking for FML libraries...")); + setStatusText(tr("Checking for FML libraries...")); forge_present = (profile->versionPatch("net.minecraftforge") != nullptr); // we don't... if (!forge_present) @@ -58,7 +58,7 @@ void FMLLibrariesTask::executeTask() } // download missing libs to our place - setStatus(tr("Dowloading FML libraries...")); + setStatusText(tr("Dowloading FML libraries...")); auto dljob = new NetJob("FML libraries"); auto metacache = ENV.metacache(); for (auto &lib : fmlLibsToProcess) @@ -86,7 +86,7 @@ void FMLLibrariesTask::fmllibsFinished() downloadJob.reset(); if (!fmlLibsToProcess.isEmpty()) { - setStatus(tr("Copying FML libraries into the instance...")); + setStatusText(tr("Copying FML libraries into the instance...")); OneSixInstance *inst = (OneSixInstance *)m_inst; auto metacache = ENV.metacache(); int index = 0; diff --git a/api/logic/minecraft/onesix/update/LibrariesTask.cpp b/api/logic/minecraft/onesix/update/LibrariesTask.cpp index 2cd41ded..748ab10c 100644 --- a/api/logic/minecraft/onesix/update/LibrariesTask.cpp +++ b/api/logic/minecraft/onesix/update/LibrariesTask.cpp @@ -9,7 +9,7 @@ LibrariesTask::LibrariesTask(OneSixInstance * inst) void LibrariesTask::executeTask() { - setStatus(tr("Getting the library files from Mojang...")); + setStatusText(tr("Getting the library files from Mojang...")); qDebug() << m_inst->name() << ": downloading libraries"; OneSixInstance *inst = (OneSixInstance *)m_inst; inst->reloadProfile(); |