From 20b9f2b42a3b58b6081af271774fbcc34025dccb Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Sun, 25 Jul 2021 19:11:59 +0200 Subject: NOISSUE Flatten gui and logic libraries into MultiMC --- launcher/java/JavaChecker.h | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 launcher/java/JavaChecker.h (limited to 'launcher/java/JavaChecker.h') diff --git a/launcher/java/JavaChecker.h b/launcher/java/JavaChecker.h new file mode 100644 index 00000000..122861cf --- /dev/null +++ b/launcher/java/JavaChecker.h @@ -0,0 +1,61 @@ +#pragma once +#include +#include +#include + +#include "QObjectPtr.h" + +#include "JavaVersion.h" + +class JavaChecker; + +struct JavaCheckResult +{ + QString path; + QString mojangPlatform; + QString realPlatform; + JavaVersion javaVersion; + QString javaVendor; + QString outLog; + QString errorLog; + bool is_64bit = false; + int id; + enum class Validity + { + Errored, + ReturnedInvalidData, + Valid + } validity = Validity::Errored; +}; + +typedef shared_qobject_ptr QProcessPtr; +typedef shared_qobject_ptr JavaCheckerPtr; +class JavaChecker : public QObject +{ + Q_OBJECT +public: + explicit JavaChecker(QObject *parent = 0); + void performCheck(); + + QString m_path; + QString m_args; + int m_id = 0; + int m_minMem = 0; + int m_maxMem = 0; + int m_permGen = 64; + +signals: + void checkFinished(JavaCheckResult result); +private: + QProcessPtr process; + QTimer killTimer; + QString m_stdout; + QString m_stderr; +public +slots: + void timeout(); + void finished(int exitcode, QProcess::ExitStatus); + void error(QProcess::ProcessError); + void stdoutReady(); + void stderrReady(); +}; -- cgit