forked from KangLin/RabbitRemoteControl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManagePlugin.h
More file actions
85 lines (71 loc) · 2.27 KB
/
ManagePlugin.h
File metadata and controls
85 lines (71 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Author: Kang Lin <kl222@126.com>
#ifndef CMANAGECONNECTER_H
#define CMANAGECONNECTER_H
#pragma once
#include <QObject>
#include <QDir>
#include <QMap>
#include <QIcon>
#include <QTranslator>
#include "PluginViewer.h"
/**
* \~chinese \brief 管理插件和连接者
* \~english \brief manage plugins and connecter
* \~
* \see CPluginViewer CConnecter
* \ingroup VIEWER_API
*/
class VIEWER_EXPORT CManagePlugin : public QObject
{
Q_OBJECT
public:
explicit CManagePlugin(QObject *parent = nullptr);
virtual ~CManagePlugin();
/*!
* \~chinese
* \brief 新建 CConnecter 指针,所有者是调用者。
* <b>当不在使用时,调用者必须释放指针</b>。
* \param id 插件 ID
* \~english New CConnecter pointer, the owner is caller.
* <b>The caller must delete it, when isn't need it</b>.
* \param id Plugin ID
*/
virtual CConnecter* CreateConnecter(const QString &id);
/*! \~chinese \brief 从文件中新建 CConnecter 指针,所有者是调用者。
* <b>当不再使用时,调用者必须负责删除此指针</b>
* \~english New CConnecter pointer from file, the owner is caller.
* <b>The caller must delete it, when isn't need it</b>.
*/
virtual CConnecter* LoadConnecter(const QString& szFile);
/// \~chinese 保存参数到文件
/// \~english Save parameters to file
virtual int SaveConnecter(QString szFile, CConnecter* pConnecter);
/**
* \~chinese
* \brief 处理连接者。用于客户端得到连接者信号
*
* \~english
* \brief The Handle CConnecter class
*/
class Handle{
public:
Handle(): m_bIgnoreReturn(false){}
/**
* @brief Process plugins
* @param id: plugin id
* @param pFactory: CPluginViewer pointer
* @return
*/
virtual int onProcess(const QString& id, CPluginViewer* pFactory) = 0;
int m_bIgnoreReturn;
};
virtual int EnumPlugins(Handle* handle);
private:
int LoadPlugins();
int FindPlugins(QDir dir, QStringList filters);
private:
QMap<QString, CPluginViewer*> m_Plugins;
qint8 m_FileVersion;
QTranslator m_Translator;
};
#endif // CMANAGECONNECTER_H