Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
Client.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CMANAGECONNECTER_H
4#define CMANAGECONNECTER_H
5
6#pragma once
7
8#include <QObject>
9#include <QDir>
10#include <QMap>
11#include <QIcon>
12#include <QTranslator>
13#include <QSharedPointer>
14
15#include "PluginClient.h"
16#include "Hook.h"
17#include "ParameterClient.h"
18
19#if defined(__clang__) || defined(__GNUC__)
20 #define CPP_STANDARD __cplusplus
21#elif defined(_MSC_VER)
22 #define CPP_STANDARD _MSVC_LANG
23#endif
24#if CPP_STANDARD >= 199711L
25 #define HAS_CPP_03 1
26#endif
27#if CPP_STANDARD >= 201103L
28 #define HAS_CPP_11 1
29#endif
30#if CPP_STANDARD >= 201402L
31 #define HAS_CPP_14 1
32#endif
33#if CPP_STANDARD >= 201703L
34 #define HAS_CPP_17 1
35#endif
36
37#if HAS_CPP_11
38 #include <functional>
39#endif
40
48class CLIENT_EXPORT CClient : public QObject
49{
50 Q_OBJECT
51
52public:
53 explicit CClient(QObject *parent = nullptr);
54 virtual ~CClient();
55
73 virtual CConnecter* CreateConnecter(const QString &id);
77 virtual int DeleteConnecter(CConnecter* p);
78
92 virtual CConnecter* LoadConnecter(const QString& szFile);
93
99 virtual int SaveConnecter(QString szFile, CConnecter* pConnecter);
100
126 virtual QList<QWidget*> GetSettingsWidgets(QWidget *parent);
134 virtual int LoadSettings(QString szFile = QString());
142 virtual int SaveSettings(QString szFile = QString());
143
151 class Handle{
152 public:
153 Handle(){}
159 virtual int onProcess(const QString& id, CPluginClient* pPlug) = 0;
160 };
164 virtual int EnumPlugins(Handle* handle);
165#if HAS_CPP_11
170 virtual int EnumPlugins(
176 std::function<int(const QString& id, CPluginClient* pPlug)> cb);
177#endif
178
179 const QString Details() const;
180
181private:
182 int LoadPlugins();
183 int FindPlugins(QDir dir, QStringList filters);
184 int AppendPlugin(CPluginClient* plugin);
185
186private Q_SLOTS:
187 void slotHookKeyboardChanged();
188
189private:
190 QMap<QString, CPluginClient*> m_Plugins;
191 qint8 m_FileVersion;
192 QSharedPointer<QTranslator> m_Translator;
193 QSharedPointer<CHook> m_Hook;
194 CParameterClient* m_pParameterClient;
195 QString m_szDetails;
196
197public:
198 // QObject interface
199 virtual bool eventFilter(QObject *watched, QEvent *event) override;
200};
201
202#endif // CMANAGECONNECTER_H
The Handle CConnecter class.
Definition Client.h:151
virtual int onProcess(const QString &id, CPluginClient *pPlug)=0
Process plugins.
manage plugins and connecter
Definition Client.h:49
virtual int EnumPlugins(std::function< int(const QString &id, CPluginClient *pPlug)> cb)
Enum plugins.
Connecter interface.
Definition Connecter.h:62
The parameters of client.
The plugin interface.