2013-11-24 05:36:16 +00:00
|
|
|
#pragma once
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <memory>
|
|
|
|
|
2015-09-05 17:46:57 +01:00
|
|
|
#include "multimc_logic_export.h"
|
|
|
|
|
2016-01-01 23:35:54 +00:00
|
|
|
#include "JavaVersion.h"
|
2013-12-11 03:54:39 +00:00
|
|
|
|
2016-01-01 23:35:54 +00:00
|
|
|
class JavaChecker;
|
2013-12-12 23:02:58 +00:00
|
|
|
|
2016-01-01 23:35:54 +00:00
|
|
|
struct MULTIMC_LOGIC_EXPORT JavaCheckResult
|
2013-11-24 05:36:16 +00:00
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
QString path;
|
|
|
|
QString mojangPlatform;
|
|
|
|
QString realPlatform;
|
|
|
|
JavaVersion javaVersion;
|
|
|
|
QString outLog;
|
|
|
|
QString errorLog;
|
|
|
|
bool is_64bit = false;
|
|
|
|
int id;
|
|
|
|
enum class Validity
|
|
|
|
{
|
|
|
|
Errored,
|
|
|
|
ReturnedInvalidData,
|
|
|
|
Valid
|
|
|
|
} validity = Validity::Errored;
|
2013-11-24 05:36:16 +00:00
|
|
|
};
|
|
|
|
|
2013-12-11 03:54:39 +00:00
|
|
|
typedef std::shared_ptr<QProcess> QProcessPtr;
|
|
|
|
typedef std::shared_ptr<JavaChecker> JavaCheckerPtr;
|
2015-09-05 17:46:57 +01:00
|
|
|
class MULTIMC_LOGIC_EXPORT JavaChecker : public QObject
|
2013-11-24 05:36:16 +00:00
|
|
|
{
|
2018-07-15 13:51:05 +01:00
|
|
|
Q_OBJECT
|
2013-11-24 05:36:16 +00:00
|
|
|
public:
|
2018-07-15 13:51:05 +01:00
|
|
|
explicit JavaChecker(QObject *parent = 0);
|
|
|
|
void performCheck();
|
2013-12-11 03:54:39 +00:00
|
|
|
|
2018-07-15 13:51:05 +01:00
|
|
|
QString m_path;
|
|
|
|
QString m_args;
|
|
|
|
int m_id = 0;
|
|
|
|
int m_minMem = 0;
|
|
|
|
int m_maxMem = 0;
|
|
|
|
int m_permGen = 64;
|
2013-11-24 05:36:16 +00:00
|
|
|
|
|
|
|
signals:
|
2018-07-15 13:51:05 +01:00
|
|
|
void checkFinished(JavaCheckResult result);
|
2013-11-24 05:36:16 +00:00
|
|
|
private:
|
2018-07-15 13:51:05 +01:00
|
|
|
QProcessPtr process;
|
|
|
|
QTimer killTimer;
|
|
|
|
QString m_stdout;
|
|
|
|
QString m_stderr;
|
2013-11-24 05:36:16 +00:00
|
|
|
public
|
|
|
|
slots:
|
2018-07-15 13:51:05 +01:00
|
|
|
void timeout();
|
|
|
|
void finished(int exitcode, QProcess::ExitStatus);
|
|
|
|
void error(QProcess::ProcessError);
|
|
|
|
void stdoutReady();
|
|
|
|
void stderrReady();
|
2013-11-24 05:36:16 +00:00
|
|
|
};
|