swift
pluginselector.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_PLUGINSELECTOR_H
7 #define SWIFT_GUI_PLUGINSELECTOR_H
8 
9 #include <QObject>
10 #include <QSignalMapper>
11 #include <QString>
12 #include <QWidget>
13 
14 #include "gui/swiftguiexport.h"
15 
16 namespace swift::gui
17 {
22  class SWIFT_GUI_EXPORT CPluginSelector : public QWidget
23  {
24  Q_OBJECT
25 
26  public:
28  explicit CPluginSelector(QWidget *parent = nullptr);
29 
35  void addPlugin(const QString &identifier, const QString &name, bool hasConfig = false, bool enabled = true);
36 
38  void setEnabled(const QString &identifier, bool enabled);
39 
40  signals:
42  void pluginStateChanged(const QString &identifier, bool enabled);
43 
45  void pluginConfigRequested(const QString &identifier);
46 
47  private:
48  void handlePluginStateChange();
49 
50  QSignalMapper *m_configButtonMapper = new QSignalMapper(this);
51  };
52 } // namespace swift::gui
53 
54 #endif // SWIFT_GUI_PLUGINSELECTOR_H
Shows all available plugins in a nice list and lets user enable, disable and configure each of them.
void pluginStateChanged(const QString &identifier, bool enabled)
Emitted when user enables/disables the particular plugin.
void pluginConfigRequested(const QString &identifier)
Emitted when user clicks the "Settings" button.
GUI related classes.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.