diff options
author | Sky <git@bunnies.cc> | 2014-01-07 03:16:47 +0000 |
---|---|---|
committer | Sky <git@bunnies.cc> | 2014-01-07 03:16:47 +0000 |
commit | 5fe0ed7e8fad7654f9fe61669e596fe74bac8740 (patch) | |
tree | da856ba43a437caf546d8a2b9e03c15ce5430b93 /logic | |
parent | 012b007e56c8121e5dc6434765f16647edd23585 (diff) | |
download | MultiMC-5fe0ed7e8fad7654f9fe61669e596fe74bac8740.tar MultiMC-5fe0ed7e8fad7654f9fe61669e596fe74bac8740.tar.gz MultiMC-5fe0ed7e8fad7654f9fe61669e596fe74bac8740.tar.lz MultiMC-5fe0ed7e8fad7654f9fe61669e596fe74bac8740.tar.xz MultiMC-5fe0ed7e8fad7654f9fe61669e596fe74bac8740.zip |
Return a properly sorted list of checked javas
Diffstat (limited to 'logic')
-rw-r--r-- | logic/JavaChecker.cpp | 2 | ||||
-rw-r--r-- | logic/JavaChecker.h | 2 | ||||
-rw-r--r-- | logic/JavaCheckerJob.cpp | 7 | ||||
-rw-r--r-- | logic/lists/JavaVersionList.cpp | 4 |
4 files changed, 11 insertions, 4 deletions
diff --git a/logic/JavaChecker.cpp b/logic/JavaChecker.cpp index 113974ff..a470bfa2 100644 --- a/logic/JavaChecker.cpp +++ b/logic/JavaChecker.cpp @@ -47,6 +47,7 @@ void JavaChecker::finished(int exitcode, QProcess::ExitStatus status) JavaCheckResult result; { result.path = path; + result.id = id; } if (status == QProcess::CrashExit || exitcode == 1) @@ -104,6 +105,7 @@ void JavaChecker::error(QProcess::ProcessError err) JavaCheckResult result; { result.path = path; + result.id = id; } emit checkFinished(result); diff --git a/logic/JavaChecker.h b/logic/JavaChecker.h index 291bf46c..4705381c 100644 --- a/logic/JavaChecker.h +++ b/logic/JavaChecker.h @@ -15,6 +15,7 @@ struct JavaCheckResult QString javaVersion; bool valid = false; bool is_64bit = false; + int id; }; typedef std::shared_ptr<QProcess> QProcessPtr; @@ -27,6 +28,7 @@ public: void performCheck(); QString path; + int id; signals: void checkFinished(JavaCheckResult result); diff --git a/logic/JavaCheckerJob.cpp b/logic/JavaCheckerJob.cpp index 36a8a050..bb39bf62 100644 --- a/logic/JavaCheckerJob.cpp +++ b/logic/JavaCheckerJob.cpp @@ -26,10 +26,8 @@ void JavaCheckerJob::partFinished(JavaCheckResult result) << javacheckers.size(); emit progress(num_finished, javacheckers.size()); - javaresults.append(result); - int result_size = javacheckers.size(); - - emit progress(num_finished, result_size); + QLOG_INFO() << "after replace" << result.id << javaresults.size(); + javaresults.replace(result.id, result); if (num_finished == javacheckers.size()) { @@ -43,6 +41,7 @@ void JavaCheckerJob::start() m_running = true; for (auto iter : javacheckers) { + javaresults.append(JavaCheckResult()); connect(iter.get(), SIGNAL(checkFinished(JavaCheckResult)), SLOT(partFinished(JavaCheckResult))); iter->performCheck(); } diff --git a/logic/lists/JavaVersionList.cpp b/logic/lists/JavaVersionList.cpp index e8c5acd0..eb1c5650 100644 --- a/logic/lists/JavaVersionList.cpp +++ b/logic/lists/JavaVersionList.cpp @@ -182,13 +182,17 @@ void JavaListLoadTask::executeTask() connect(m_job.get(), SIGNAL(progress(int, int)), this, SLOT(checkerProgress(int, int))); QLOG_DEBUG() << "Probing the following Java paths: "; + int id = 0; for(QString candidate : candidate_paths) { QLOG_DEBUG() << " " << candidate; auto candidate_checker = new JavaChecker(); candidate_checker->path = candidate; + candidate_checker->id = id; m_job->addJavaCheckerAction(JavaCheckerPtr(candidate_checker)); + + id++; } m_job->start(); |