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"
|
|
|
|
|
2013-12-11 03:54:39 +00:00
|
|
|
class JavaChecker;
|
|
|
|
|
2013-12-12 23:02:58 +00:00
|
|
|
|
2013-11-24 05:36:16 +00:00
|
|
|
struct JavaCheckResult
|
|
|
|
{
|
2013-12-11 03:54:39 +00:00
|
|
|
QString path;
|
2013-11-24 05:36:16 +00:00
|
|
|
QString mojangPlatform;
|
|
|
|
QString realPlatform;
|
2013-12-11 03:54:39 +00:00
|
|
|
QString javaVersion;
|
2015-05-04 00:28:16 +01:00
|
|
|
QString errorLog;
|
2013-11-24 05:36:16 +00:00
|
|
|
bool valid = false;
|
|
|
|
bool is_64bit = false;
|
2014-01-07 03:16:47 +00:00
|
|
|
int id;
|
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
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit JavaChecker(QObject *parent = 0);
|
2013-12-11 03:54:39 +00:00
|
|
|
void performCheck();
|
|
|
|
|
2015-05-04 00:20:48 +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:
|
|
|
|
void checkFinished(JavaCheckResult result);
|
|
|
|
private:
|
|
|
|
QProcessPtr process;
|
|
|
|
QTimer killTimer;
|
2015-05-04 00:20:48 +01:00
|
|
|
QString m_stdout;
|
|
|
|
QString m_stderr;
|
2013-11-24 05:36:16 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void timeout();
|
|
|
|
void finished(int exitcode, QProcess::ExitStatus);
|
|
|
|
void error(QProcess::ProcessError);
|
2015-05-04 00:20:48 +01:00
|
|
|
void stdoutReady();
|
|
|
|
void stderrReady();
|
2013-11-24 05:36:16 +00:00
|
|
|
};
|