NOISSUE remove some bad code in various Task related classes
This commit is contained in:
parent
89d3a66658
commit
36f3e24cf3
@ -28,7 +28,7 @@ void JavaCheckerJob::partFinished(JavaCheckResult result)
|
||||
|
||||
if (num_finished == javacheckers.size())
|
||||
{
|
||||
emit finished(javaresults);
|
||||
emitSucceeded();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
class JavaCheckerJob;
|
||||
typedef std::shared_ptr<JavaCheckerJob> JavaCheckerJobPtr;
|
||||
|
||||
// FIXME: this just seems horribly redundant
|
||||
class JavaCheckerJob : public Task
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -31,37 +32,19 @@ public:
|
||||
bool addJavaCheckerAction(JavaCheckerPtr base)
|
||||
{
|
||||
javacheckers.append(base);
|
||||
total_progress++;
|
||||
// if this is already running, the action needs to be started right away!
|
||||
if (isRunning())
|
||||
{
|
||||
setProgress(current_progress, total_progress);
|
||||
connect(base.get(), SIGNAL(checkFinished(JavaCheckResult)), SLOT(partFinished(JavaCheckResult)));
|
||||
|
||||
setProgress(num_finished, javacheckers.size());
|
||||
connect(base.get(), &JavaChecker::checkFinished, this, &JavaCheckerJob::partFinished);
|
||||
base->performCheck();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
JavaCheckerPtr operator[](int index)
|
||||
QList<JavaCheckResult> getResults()
|
||||
{
|
||||
return javacheckers[index];
|
||||
return javaresults;
|
||||
}
|
||||
;
|
||||
JavaCheckerPtr first()
|
||||
{
|
||||
if (javacheckers.size())
|
||||
return javacheckers[0];
|
||||
return JavaCheckerPtr();
|
||||
}
|
||||
int size() const
|
||||
{
|
||||
return javacheckers.size();
|
||||
}
|
||||
|
||||
signals:
|
||||
void started();
|
||||
void finished(QList<JavaCheckResult>);
|
||||
|
||||
private slots:
|
||||
void partFinished(JavaCheckResult result);
|
||||
@ -73,7 +56,5 @@ private:
|
||||
QString m_job_name;
|
||||
QList<JavaCheckerPtr> javacheckers;
|
||||
QList<JavaCheckResult> javaresults;
|
||||
qint64 current_progress = 0;
|
||||
qint64 total_progress = 0;
|
||||
int num_finished = 0;
|
||||
};
|
||||
|
@ -150,7 +150,7 @@ void JavaListLoadTask::executeTask()
|
||||
QList<QString> candidate_paths = ju.FindJavaPaths();
|
||||
|
||||
m_job = std::shared_ptr<JavaCheckerJob>(new JavaCheckerJob("Java detection"));
|
||||
connect(m_job.get(), SIGNAL(finished(QList<JavaCheckResult>)), this, SLOT(javaCheckerFinished(QList<JavaCheckResult>)));
|
||||
connect(m_job.get(), &Task::finished, this, &JavaListLoadTask::javaCheckerFinished);
|
||||
connect(m_job.get(), &Task::progress, this, &Task::setProgress);
|
||||
|
||||
qDebug() << "Probing the following Java paths: ";
|
||||
@ -170,9 +170,10 @@ void JavaListLoadTask::executeTask()
|
||||
m_job->start();
|
||||
}
|
||||
|
||||
void JavaListLoadTask::javaCheckerFinished(QList<JavaCheckResult> results)
|
||||
void JavaListLoadTask::javaCheckerFinished()
|
||||
{
|
||||
QList<JavaInstallPtr> candidates;
|
||||
auto results = m_job->getResults();
|
||||
|
||||
qDebug() << "Found the following valid Java installations:";
|
||||
for(JavaCheckResult result : results)
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
|
||||
void executeTask() override;
|
||||
public slots:
|
||||
void javaCheckerFinished(QList<JavaCheckResult> results);
|
||||
void javaCheckerFinished();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<JavaCheckerJob> m_job;
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include "java/JavaUtils.h"
|
||||
#include "java/JavaCheckerJob.h"
|
||||
#include "java/JavaInstallList.h"
|
||||
#include "FileSystem.h"
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#include "JavaCheckerJob.h"
|
||||
#include "JavaChecker.h"
|
||||
#include "JavaInstallList.h"
|
||||
|
||||
|
@ -76,7 +76,6 @@ private:
|
||||
qint64 current_progress = 0;
|
||||
qint64 total_progress = 1;
|
||||
int failures = 0;
|
||||
bool connected = false;
|
||||
};
|
||||
QString m_job_name;
|
||||
QList<NetActionPtr> downloads;
|
||||
|
Loading…
Reference in New Issue
Block a user