pollymc/logic/tools/BaseExternalTool.h

57 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#include <QObject>
2014-03-30 23:41:05 +05:30
#include <logic/BaseInstance.h>
class BaseInstance;
class SettingsObject;
class QProcess;
class BaseExternalTool : public QObject
{
Q_OBJECT
public:
2014-03-30 23:41:05 +05:30
explicit BaseExternalTool(InstancePtr instance, QObject *parent = 0);
virtual ~BaseExternalTool();
protected:
2014-03-30 23:41:05 +05:30
InstancePtr m_instance;
qint64 pid(QProcess *process);
};
class BaseDetachedTool : public BaseExternalTool
{
Q_OBJECT
public:
2014-03-30 23:41:05 +05:30
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 21:46:56 +05:30
virtual void registerSettings(std::shared_ptr<SettingsObject> settings) = 0;
2014-03-30 23:41:05 +05:30
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 23:41:05 +05:30
virtual BaseDetachedTool *createDetachedTool(InstancePtr instance, QObject *parent = 0);
};