2014-02-16 09:46:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QObject>
|
2014-03-30 19:11:05 +01:00
|
|
|
#include <logic/BaseInstance.h>
|
2014-02-16 09:46:14 +00:00
|
|
|
|
|
|
|
class BaseInstance;
|
|
|
|
class SettingsObject;
|
|
|
|
class MinecraftProcess;
|
|
|
|
class QProcess;
|
|
|
|
|
|
|
|
class BaseExternalTool : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-03-30 19:11:05 +01:00
|
|
|
explicit BaseExternalTool(InstancePtr instance, QObject *parent = 0);
|
2014-02-16 09:46:14 +00:00
|
|
|
virtual ~BaseExternalTool();
|
|
|
|
|
|
|
|
protected:
|
2014-03-30 19:11:05 +01:00
|
|
|
InstancePtr m_instance;
|
2014-02-16 09:46:14 +00:00
|
|
|
|
|
|
|
qint64 pid(QProcess *process);
|
2014-02-16 11:08:39 +00:00
|
|
|
QString getSave() const;
|
2014-02-16 09:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class BaseDetachedTool : public BaseExternalTool
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-03-30 19:11:05 +01:00
|
|
|
explicit BaseDetachedTool(InstancePtr instance, QObject *parent = 0);
|
2014-02-16 09:46:14 +00:00
|
|
|
|
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void run();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void runImpl() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BaseExternalToolFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BaseExternalToolFactory();
|
|
|
|
|
|
|
|
virtual QString name() const = 0;
|
|
|
|
|
2014-09-06 17:16:56 +01:00
|
|
|
virtual void registerSettings(std::shared_ptr<SettingsObject> settings) = 0;
|
2014-02-16 09:46:14 +00:00
|
|
|
|
2014-03-30 19:11:05 +01:00
|
|
|
virtual BaseExternalTool *createTool(InstancePtr instance, QObject *parent = 0) = 0;
|
2014-02-16 09:46:14 +00:00
|
|
|
|
|
|
|
virtual bool check(QString *error) = 0;
|
|
|
|
virtual bool check(const QString &path, QString *error) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class BaseDetachedToolFactory : public BaseExternalToolFactory
|
|
|
|
{
|
|
|
|
public:
|
2014-03-30 19:11:05 +01:00
|
|
|
virtual BaseDetachedTool *createDetachedTool(InstancePtr instance, QObject *parent = 0);
|
2014-02-16 09:46:14 +00:00
|
|
|
};
|