PrismLauncher/launcher/java/JavaCheckerJob.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.7 KiB
C
Raw Permalink Normal View History

2021-01-18 07:28:54 +00:00
/* Copyright 2013-2021 MultiMC Contributors
2013-12-11 03:54:39 +00:00
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QtNetwork>
#include "JavaChecker.h"
2015-04-26 22:04:50 +01:00
#include "tasks/Task.h"
2013-12-11 03:54:39 +00:00
class JavaCheckerJob;
using JavaCheckerJobPtr = shared_qobject_ptr<JavaCheckerJob>;
2013-12-11 03:54:39 +00:00
// FIXME: this just seems horribly redundant
class JavaCheckerJob : public Task {
2013-12-11 03:54:39 +00:00
Q_OBJECT
public:
explicit JavaCheckerJob(QString job_name) : Task(), m_job_name(job_name){};
virtual ~JavaCheckerJob(){};
2018-07-15 13:51:05 +01:00
2013-12-11 03:54:39 +00:00
bool addJavaCheckerAction(JavaCheckerPtr base)
{
javacheckers.append(base);
// if this is already running, the action needs to be started right away!
if (isRunning()) {
setProgress(num_finished, javacheckers.size());
connect(base.get(), &JavaChecker::checkFinished, this, &JavaCheckerJob::partFinished);
2013-12-11 03:54:39 +00:00
base->performCheck();
}
return true;
}
QList<JavaCheckResult> getResults() { return javaresults; }
2015-04-26 22:04:50 +01:00
private slots:
2013-12-11 03:54:39 +00:00
void partFinished(JavaCheckResult result);
protected:
2015-04-26 22:04:50 +01:00
virtual void executeTask() override;
private:
2013-12-11 03:54:39 +00:00
QString m_job_name;
QList<JavaCheckerPtr> javacheckers;
QList<JavaCheckResult> javaresults;
int num_finished = 0;
};