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
26#include <QtCore/QObject>
27#include <QtCore/QList>
28#include <QtCore/QtPlugin>
29#include <QtCore/QVariantMap>
30
31#include <memory>
32
33class QAction;
34class QWidget;
35
36namespace cc_tools_qt
37{
38
41class CC_TOOLS_API ToolsPlugin : public QObject
42{
43 Q_OBJECT
44public:
45
47 enum Type : unsigned
48 {
52 Type_NumOfValues
53 };
54
56 using ListOfGuiActions = QList<QAction*>;
57
59 explicit ToolsPlugin(Type type);
60
62 virtual ~ToolsPlugin() noexcept;
63
64 Type type() const;
65
71 void getCurrentConfig(QVariantMap& config);
72
78 QVariantMap getCurrentConfig();
79
84 void reconfigure(const QVariantMap& config);
85
90 ToolsSocketPtr createSocket();
91
96 ToolsFilterPtr createFilter();
97
102 ToolsProtocolPtr createProtocol();
103
113 QWidget* createConfigurationWidget();
114
125 ListOfGuiActions createGuiActions();
126
132 void applyInterPluginConfig(const QVariantMap& props);
133
136 void setDebugOutputLevel(unsigned level = 0U);
137
138signals:
141 void sigInterPluginConfigReport(const QVariantMap& props);
142
143protected:
149 virtual void getCurrentConfigImpl(QVariantMap& config);
150
156 virtual void reconfigureImpl(const QVariantMap& config);
157
161 virtual void applyInterPluginConfigImpl(const QVariantMap& props);
162
166 virtual ToolsSocketPtr createSocketImpl();
167
171 virtual ToolsFilterPtr createFilterImpl();
172
176 virtual ToolsProtocolPtr createProtocolImpl();
177
180 virtual QWidget* createConfigurationWidgetImpl();
181
184 virtual ListOfGuiActions createGuiActionsImpl();
185
193 void reportInterPluginConfig(const QVariantMap& props);
194
195private:
196 struct InnerState;
197 std::unique_ptr<InnerState> m_state;
198};
199
200} // namespace cc_tools_qt
201
202Q_DECLARE_INTERFACE(cc_tools_qt::ToolsPlugin, "cc.ToolsPlugin")
203
204
Interface class for plugin definition.
Definition ToolsPlugin.h:42
Type
Type of the plugin.
Definition ToolsPlugin.h:48
@ Type_Filter
Filter.
Definition ToolsPlugin.h:50
@ Type_Protocol
Protocol.
Definition ToolsPlugin.h:51
@ Type_Socket
Socket.
Definition ToolsPlugin.h:49
virtual ~ToolsPlugin() noexcept
Destructor.
QList< QAction * > ListOfGuiActions
List of GUI action buttons.
Definition ToolsPlugin.h:56
Main namespace for all classes / functions of the shared library.
std::shared_ptr< ToolsFilter > ToolsFilterPtr
Pointer to ToolsFilter object.
Definition ToolsFilter.h:178
std::shared_ptr< ToolsProtocol > ToolsProtocolPtr
Pointer to ToolsProtocol object.
Definition ToolsProtocol.h:232
std::shared_ptr< ToolsSocket > ToolsSocketPtr
Pointer to ToolsSocket object.
Definition ToolsSocket.h:216