cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsPlugin.h
1//
2// Copyright 2014 - 2025 (C). Alex Robenko. All rights reserved.
3//
4
5// This file is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19#pragma once
20
21#include "cc_tools_qt/ToolsApi.h"
22#include "cc_tools_qt/ToolsFilter.h"
23#include "cc_tools_qt/ToolsProtocol.h"
24#include "cc_tools_qt/ToolsSocket.h"
25#include "cc_tools_qt/version.h"
26
27#include <QtCore/QObject>
28#include <QtCore/QList>
29#include <QtCore/QtPlugin>
30#include <QtCore/QVariantMap>
31
32#include <memory>
33
34class QAction;
35class QWidget;
36
37namespace cc_tools_qt
38{
39
42class CC_TOOLS_API ToolsPlugin : public QObject
43{
44 Q_OBJECT
45public:
46
48 enum Type : unsigned
49 {
53 Type_NumOfValues
54 };
55
57 using ListOfGuiActions = QList<QAction*>;
58
60 explicit ToolsPlugin(Type type);
61
63 virtual ~ToolsPlugin() noexcept;
64
65 Type type() const;
66
72 void getCurrentConfig(QVariantMap& config);
73
79 QVariantMap getCurrentConfig();
80
85 void reconfigure(const QVariantMap& config);
86
91 ToolsSocketPtr createSocket();
92
97 ToolsFilterPtr createFilter();
98
103 ToolsProtocolPtr createProtocol();
104
114 QWidget* createConfigurationWidget();
115
126 ListOfGuiActions createGuiActions();
127
133 void applyInterPluginConfig(const QVariantMap& props);
134
137 void setDebugOutputLevel(unsigned level = 0U);
138
139signals:
142 void sigInterPluginConfigReport(const QVariantMap& props);
143
144protected:
150 virtual void getCurrentConfigImpl(QVariantMap& config);
151
157 virtual void reconfigureImpl(const QVariantMap& config);
158
162 virtual void applyInterPluginConfigImpl(const QVariantMap& props);
163
167 virtual ToolsSocketPtr createSocketImpl();
168
172 virtual ToolsFilterPtr createFilterImpl();
173
177 virtual ToolsProtocolPtr createProtocolImpl();
178
181 virtual QWidget* createConfigurationWidgetImpl();
182
185 virtual ListOfGuiActions createGuiActionsImpl();
186
187protected slots:
195 void reportInterPluginConfig(const QVariantMap& props);
196
197private:
198 struct InnerState;
199 std::unique_ptr<InnerState> m_state;
200};
201
202} // namespace cc_tools_qt
203
204Q_DECLARE_INTERFACE(cc_tools_qt::ToolsPlugin, "cc.ToolsPlugin")
205
206
Interface class for plugin definition.
Definition ToolsPlugin.h:43
Type
Type of the plugin.
Definition ToolsPlugin.h:49
@ Type_Filter
Filter.
Definition ToolsPlugin.h:51
@ Type_Protocol
Protocol.
Definition ToolsPlugin.h:52
@ Type_Socket
Socket.
Definition ToolsPlugin.h:50
virtual ~ToolsPlugin() noexcept
Destructor.
QList< QAction * > ListOfGuiActions
List of GUI action buttons.
Definition ToolsPlugin.h:57
Main namespace for all classes / functions of the shared library.
std::shared_ptr< ToolsFilter > ToolsFilterPtr
Pointer to ToolsFilter object.
Definition ToolsFilter.h:180
std::shared_ptr< ToolsProtocol > ToolsProtocolPtr
Pointer to ToolsProtocol object.
Definition ToolsProtocol.h:234
std::shared_ptr< ToolsSocket > ToolsSocketPtr
Pointer to ToolsSocket object.
Definition ToolsSocket.h:218