summaryrefslogtreecommitdiffstats
path: root/logic/JavaChecker.h
diff options
context:
space:
mode:
Diffstat (limited to 'logic/JavaChecker.h')
-rw-r--r--logic/JavaChecker.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/logic/JavaChecker.h b/logic/JavaChecker.h
new file mode 100644
index 00000000..60f8b56f
--- /dev/null
+++ b/logic/JavaChecker.h
@@ -0,0 +1,32 @@
+#pragma once
+#include <QProcess>
+#include <QTimer>
+#include <memory>
+
+struct JavaCheckResult
+{
+ QString mojangPlatform;
+ QString realPlatform;
+ bool valid = false;
+ bool is_64bit = false;
+};
+typedef std::shared_ptr<QProcess> QProcessPtr;
+
+class JavaChecker : public QObject
+{
+ Q_OBJECT
+public:
+ explicit JavaChecker(QObject *parent = 0);
+ int performCheck(QString path);
+
+signals:
+ void checkFinished(JavaCheckResult result);
+private:
+ QProcessPtr process;
+ QTimer killTimer;
+public
+slots:
+ void timeout();
+ void finished(int exitcode, QProcess::ExitStatus);
+ void error(QProcess::ProcessError);
+};