mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-25 15:16:02 +00:00
Return a properly sorted list of checked javas
This commit is contained in:
parent
012b007e56
commit
5fe0ed7e8f
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user