summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-02-15 22:26:44 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-02-15 22:26:44 +0100
commit8219dbf612f4e6f603d304348fc388e364602f98 (patch)
tree2d0bafeb9ff7019f5b9b19bbf034665285d836ae /logic
parent3b236483dfe00f87c5f3b03220d78620f0f99f4d (diff)
downloadMultiMC-8219dbf612f4e6f603d304348fc388e364602f98.tar
MultiMC-8219dbf612f4e6f603d304348fc388e364602f98.tar.gz
MultiMC-8219dbf612f4e6f603d304348fc388e364602f98.tar.lz
MultiMC-8219dbf612f4e6f603d304348fc388e364602f98.tar.xz
MultiMC-8219dbf612f4e6f603d304348fc388e364602f98.zip
Underp. Don't depend on OneSix. Nicer "menu" style choosing.
Diffstat (limited to 'logic')
-rw-r--r--logic/OneSixInstance.cpp1
-rw-r--r--logic/profiler/BaseProfiler.cpp2
-rw-r--r--logic/profiler/BaseProfiler.h11
-rw-r--r--logic/profiler/JProfiler.cpp16
-rw-r--r--logic/profiler/JProfiler.h6
-rw-r--r--logic/profiler/JVisualVM.cpp17
-rw-r--r--logic/profiler/JVisualVM.h6
7 files changed, 44 insertions, 15 deletions
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index d987b693..dbae891d 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -228,6 +228,7 @@ MinecraftProcess *OneSixInstance::prepareForLaunch(AuthSessionPtr session)
launchScript += "ext " + finfo.absoluteFilePath() + "\n";
}
launchScript += "natives " + natives_dir.absolutePath() + "\n";
+ launchScript += "launcher onesix\n";
// create the process and set its parameters
MinecraftProcess *proc = new MinecraftProcess(this);
diff --git a/logic/profiler/BaseProfiler.cpp b/logic/profiler/BaseProfiler.cpp
index 94891fc4..4765c67d 100644
--- a/logic/profiler/BaseProfiler.cpp
+++ b/logic/profiler/BaseProfiler.cpp
@@ -5,7 +5,7 @@
#include <windows.h>
#endif
-BaseProfiler::BaseProfiler(OneSixInstance *instance, QObject *parent)
+BaseProfiler::BaseProfiler(BaseInstance *instance, QObject *parent)
: QObject(parent), m_instance(instance)
{
}
diff --git a/logic/profiler/BaseProfiler.h b/logic/profiler/BaseProfiler.h
index e7bc4c2d..4c5f63fc 100644
--- a/logic/profiler/BaseProfiler.h
+++ b/logic/profiler/BaseProfiler.h
@@ -2,7 +2,7 @@
#include <QObject>
-class OneSixInstance;
+class BaseInstance;
class SettingsObject;
class MinecraftProcess;
class QProcess;
@@ -11,7 +11,7 @@ class BaseProfiler : public QObject
{
Q_OBJECT
public:
- explicit BaseProfiler(OneSixInstance *instance, QObject *parent = 0);
+ explicit BaseProfiler(BaseInstance *instance, QObject *parent = 0);
virtual ~BaseProfiler();
public
@@ -19,7 +19,7 @@ slots:
void beginProfiling(MinecraftProcess *process);
protected:
- OneSixInstance *m_instance;
+ BaseInstance *m_instance;
virtual void beginProfilingImpl(MinecraftProcess *process) = 0;
@@ -34,9 +34,12 @@ class BaseProfilerFactory
public:
virtual ~BaseProfilerFactory();
+ virtual QString name() const = 0;
+
virtual void registerSettings(SettingsObject *settings) = 0;
- virtual BaseProfiler *createProfiler(OneSixInstance *instance, QObject *parent = 0) = 0;
+ virtual BaseProfiler *createProfiler(BaseInstance *instance, QObject *parent = 0) = 0;
+ virtual bool check(QString *error) = 0;
virtual bool check(const QString &path, QString *error) = 0;
};
diff --git a/logic/profiler/JProfiler.cpp b/logic/profiler/JProfiler.cpp
index eddf46d9..cec614ae 100644
--- a/logic/profiler/JProfiler.cpp
+++ b/logic/profiler/JProfiler.cpp
@@ -5,10 +5,10 @@
#include "settingsobject.h"
#include "logic/MinecraftProcess.h"
-#include "logic/OneSixInstance.h"
+#include "logic/BaseInstance.h"
#include "MultiMC.h"
-JProfiler::JProfiler(OneSixInstance *instance, QObject *parent) : BaseProfiler(instance, parent)
+JProfiler::JProfiler(BaseInstance *instance, QObject *parent) : BaseProfiler(instance, parent)
{
}
@@ -32,13 +32,23 @@ void JProfilerFactory::registerSettings(SettingsObject *settings)
settings->registerSetting("JProfilerPort", 42042);
}
-BaseProfiler *JProfilerFactory::createProfiler(OneSixInstance *instance, QObject *parent)
+BaseProfiler *JProfilerFactory::createProfiler(BaseInstance *instance, QObject *parent)
{
return new JProfiler(instance, parent);
}
+bool JProfilerFactory::check(QString *error)
+{
+ return check(MMC->settings()->get("JProfilerPath").toString(), error);
+}
+
bool JProfilerFactory::check(const QString &path, QString *error)
{
+ if (path.isEmpty())
+ {
+ *error = QObject::tr("Empty path");
+ return false;
+ }
QDir dir(path);
if (!dir.exists())
{
diff --git a/logic/profiler/JProfiler.h b/logic/profiler/JProfiler.h
index 9fa3591a..8a5bc561 100644
--- a/logic/profiler/JProfiler.h
+++ b/logic/profiler/JProfiler.h
@@ -6,7 +6,7 @@ class JProfiler : public BaseProfiler
{
Q_OBJECT
public:
- JProfiler(OneSixInstance *instance, QObject *parent = 0);
+ JProfiler(BaseInstance *instance, QObject *parent = 0);
protected:
void beginProfilingImpl(MinecraftProcess *process);
@@ -15,7 +15,9 @@ protected:
class JProfilerFactory : public BaseProfilerFactory
{
public:
+ QString name() const override { return "JProfiler"; }
void registerSettings(SettingsObject *settings) override;
- BaseProfiler *createProfiler(OneSixInstance *instance, QObject *parent = 0) override;
+ BaseProfiler *createProfiler(BaseInstance *instance, QObject *parent = 0) override;
+ bool check(QString *error) override;
bool check(const QString &path, QString *error) override;
};
diff --git a/logic/profiler/JVisualVM.cpp b/logic/profiler/JVisualVM.cpp
index a1aa6951..3850ff40 100644
--- a/logic/profiler/JVisualVM.cpp
+++ b/logic/profiler/JVisualVM.cpp
@@ -5,9 +5,10 @@
#include "settingsobject.h"
#include "logic/MinecraftProcess.h"
-#include "logic/OneSixInstance.h"
+#include "logic/BaseInstance.h"
+#include "MultiMC.h"
-JVisualVM::JVisualVM(OneSixInstance *instance, QObject *parent) : BaseProfiler(instance, parent)
+JVisualVM::JVisualVM(BaseInstance *instance, QObject *parent) : BaseProfiler(instance, parent)
{
}
@@ -27,13 +28,23 @@ void JVisualVMFactory::registerSettings(SettingsObject *settings)
settings->registerSetting("JVisualVMPath");
}
-BaseProfiler *JVisualVMFactory::createProfiler(OneSixInstance *instance, QObject *parent)
+BaseProfiler *JVisualVMFactory::createProfiler(BaseInstance *instance, QObject *parent)
{
return new JVisualVM(instance, parent);
}
+bool JVisualVMFactory::check(QString *error)
+{
+ return check(MMC->settings()->get("JVisualVMPath").toString(), error);
+}
+
bool JVisualVMFactory::check(const QString &path, QString *error)
{
+ if (path.isEmpty())
+ {
+ *error = QObject::tr("Empty path");
+ return false;
+ }
QString resolved = QStandardPaths::findExecutable(path);
if (resolved.isEmpty() && !QDir::isAbsolutePath(path))
{
diff --git a/logic/profiler/JVisualVM.h b/logic/profiler/JVisualVM.h
index e72b75d9..154180b4 100644
--- a/logic/profiler/JVisualVM.h
+++ b/logic/profiler/JVisualVM.h
@@ -6,7 +6,7 @@ class JVisualVM : public BaseProfiler
{
Q_OBJECT
public:
- JVisualVM(OneSixInstance *instance, QObject *parent = 0);
+ JVisualVM(BaseInstance *instance, QObject *parent = 0);
protected:
void beginProfilingImpl(MinecraftProcess *process);
@@ -15,7 +15,9 @@ protected:
class JVisualVMFactory : public BaseProfilerFactory
{
public:
+ QString name() const override { return "JVisualVM"; }
void registerSettings(SettingsObject *settings) override;
- BaseProfiler *createProfiler(OneSixInstance *instance, QObject *parent = 0) override;
+ BaseProfiler *createProfiler(BaseInstance *instance, QObject *parent = 0) override;
+ bool check(QString *error) override;
bool check(const QString &path, QString *error) override;
};