sneedmc/logic/tools/BaseExternalTool.h

59 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <QObject>
2015-02-09 00:51:14 +00:00
#include <BaseInstance.h>
class BaseInstance;
class SettingsObject;
class QProcess;
class BaseExternalTool : public QObject
{
Q_OBJECT
public:
2015-02-09 00:51:14 +00:00
explicit BaseExternalTool(SettingsObjectPtr settings, InstancePtr instance, QObject *parent = 0);
virtual ~BaseExternalTool();
protected:
2014-03-30 18:11:05 +00:00
InstancePtr m_instance;
2015-02-09 00:51:14 +00:00
SettingsObjectPtr globalSettings;
};
class BaseDetachedTool : public BaseExternalTool
{
Q_OBJECT
public:
2015-02-09 00:51:14 +00:00
explicit BaseDetachedTool(SettingsObjectPtr settings, InstancePtr instance, QObject *parent = 0);
public
slots:
void run();
protected:
virtual void runImpl() = 0;
};
class BaseExternalToolFactory
{
public:
virtual ~BaseExternalToolFactory();
virtual QString name() const = 0;
2015-02-09 00:51:14 +00:00
virtual void registerSettings(SettingsObjectPtr settings) = 0;
2014-03-30 18:11:05 +00: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;
2015-02-09 00:51:14 +00:00
protected:
SettingsObjectPtr globalSettings;
};
class BaseDetachedToolFactory : public BaseExternalToolFactory
{
public:
2014-03-30 18:11:05 +00:00
virtual BaseDetachedTool *createDetachedTool(InstancePtr instance, QObject *parent = 0);
};