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