Underp. Don't depend on OneSix. Nicer "menu" style choosing.
This commit is contained in:
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user