2013-11-24 11:06:16 +05:30
|
|
|
#pragma once
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <memory>
|
|
|
|
|
2015-09-05 22:16:57 +05:30
|
|
|
#include "multimc_logic_export.h"
|
|
|
|
|
2016-01-02 05:05:54 +05:30
|
|
|
#include "JavaVersion.h"
|
2013-12-11 09:24:39 +05:30
|
|
|
|
2016-01-02 05:05:54 +05:30
|
|
|
class JavaChecker;
|
2013-12-13 04:32:58 +05:30
|
|
|
|
2016-01-02 05:05:54 +05:30
|
|
|
struct MULTIMC_LOGIC_EXPORT JavaCheckResult
|
2013-11-24 11:06:16 +05:30
|
|
|
{
|
2013-12-11 09:24:39 +05:30
|
|
|
QString path;
|
2013-11-24 11:06:16 +05:30
|
|
|
QString mojangPlatform;
|
|
|
|
QString realPlatform;
|
2016-01-02 05:05:54 +05:30
|
|
|
JavaVersion javaVersion;
|
2015-05-04 04:58:16 +05:30
|
|
|
QString errorLog;
|
2013-11-24 11:06:16 +05:30
|
|
|
bool valid = false;
|
|
|
|
bool is_64bit = false;
|
2014-01-07 08:46:47 +05:30
|
|
|
int id;
|
2013-11-24 11:06:16 +05:30
|
|
|
};
|
|
|
|
|
2013-12-11 09:24:39 +05:30
|
|
|
typedef std::shared_ptr<QProcess> QProcessPtr;
|
|
|
|
typedef std::shared_ptr<JavaChecker> JavaCheckerPtr;
|
2015-09-05 22:16:57 +05:30
|
|
|
class MULTIMC_LOGIC_EXPORT JavaChecker : public QObject
|
2013-11-24 11:06:16 +05:30
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit JavaChecker(QObject *parent = 0);
|
2013-12-11 09:24:39 +05:30
|
|
|
void performCheck();
|
|
|
|
|
2015-05-04 04:50:48 +05:30
|
|
|
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 11:06:16 +05:30
|
|
|
|
|
|
|
signals:
|
|
|
|
void checkFinished(JavaCheckResult result);
|
|
|
|
private:
|
|
|
|
QProcessPtr process;
|
|
|
|
QTimer killTimer;
|
2015-05-04 04:50:48 +05:30
|
|
|
QString m_stdout;
|
|
|
|
QString m_stderr;
|
2013-11-24 11:06:16 +05:30
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void timeout();
|
|
|
|
void finished(int exitcode, QProcess::ExitStatus);
|
|
|
|
void error(QProcess::ProcessError);
|
2015-05-04 04:50:48 +05:30
|
|
|
void stdoutReady();
|
|
|
|
void stderrReady();
|
2013-11-24 11:06:16 +05:30
|
|
|
};
|