PrismLauncher/logic/tools/BaseExternalTool.h

57 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <QObject>
2014-03-30 19:11:05 +01:00
#include <logic/BaseInstance.h>
class BaseInstance;
class SettingsObject;
class QProcess;
class BaseExternalTool : public QObject
{
Q_OBJECT
public:
2014-03-30 19:11:05 +01:00
explicit BaseExternalTool(InstancePtr instance, QObject *parent = 0);
virtual ~BaseExternalTool();
protected:
2014-03-30 19:11:05 +01:00
InstancePtr m_instance;
qint64 pid(QProcess *process);
};
class BaseDetachedTool : public BaseExternalTool
{
Q_OBJECT
public:
2014-03-30 19:11:05 +01:00
explicit BaseDetachedTool(InstancePtr instance, QObject *parent = 0);
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-03-30 19:11:05 +01:00
virtual BaseExternalTool *createTool(InstancePtr instance, QObject *parent = 0) = 0;
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);
};