ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvPluginUIManager.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <QActionGroup>
11 #include <QList>
12 #include <QObject>
13 
14 #include "ecvPluginManager.h"
15 
16 class QAction;
17 class QMenu;
18 class QString;
19 class QToolBar;
20 class QWidget;
21 
23 class ccPluginInterface;
26 
28 class ccPluginUIManager : public QObject {
29  Q_OBJECT
30 
31 public:
32  ccPluginUIManager(ecvMainAppInterface *appInterface, QWidget *parent);
34 
35  void init();
36 
37  QMenu *pluginMenu() const;
38  QMenu *pclAlgorithmMenu() const;
39 
40  QToolBar *mainPluginToolbar();
41  QList<QToolBar *> &additionalPluginToolbars();
42  QAction *actionShowMainPluginToolbar();
43 
44  QToolBar *glPclToolbar();
46 
47  void updateMenus();
49 
50  void showAboutDialog() const;
51 
52  // Helper method to check if a toolbar belongs to Python plugin
53  static bool isPythonPluginToolbar(QToolBar *toolbar);
54 
55 private:
56  void setupActions();
57 
58  void setupMenus();
59  void addActionsToMenu(ccStdPluginInterface *stdPlugin,
60  const QList<QAction *> &actions);
61  void addActionsToMenu(const QString &moduleName,
62  const QList<QAction *> &actions);
63 
64  void setupToolbars();
65  void addActionsToToolBar(ccStdPluginInterface *stdPlugin,
66  const QList<QAction *> &actions);
67  void addActionsToToolBar(const QString &moduleName,
68  const QList<QAction *> &actions);
69 
70  void enablePCLAlgorithm();
71  void disablePCLAlgorithm();
72 
73  QWidget *m_parentWidget; // unfortunately we need this when creating new
74  // menus & toolbars
75 
76  ecvMainAppInterface *m_appInterface;
77 
78  QMenu *m_pluginMenu;
79  QMenu *m_pclAlgorithmMenu;
80 
81  QAction *m_actionRemovePCLAlgorithm;
82  QActionGroup m_pclAlgorithmActions;
83 
84  QList<ccPluginInterface *> m_plugins;
85 
86  QToolBar *m_mainPluginToolbar; // if a plugin only has one action it goes
87  // here
88  QList<QToolBar *>
89  m_additionalPluginToolbars; // if a plugin has multiple actions it
90  // gets its own toolbar
91  QAction *m_showPluginToolbar;
92 
93  QToolBar *m_pclAlgorithmsToolbar;
94  QAction *m_showPCLAlgorithmToolbar;
95 };
Pcl ECV plugin interface.
Standard ECV plugin interface.
Plugin UI manager.
void showAboutDialog() const
QList< QToolBar * > & additionalPluginToolbars()
QToolBar * mainPluginToolbar()
QMenu * pluginMenu() const
QMenu * pclAlgorithmMenu() const
ccPluginUIManager(ecvMainAppInterface *appInterface, QWidget *parent)
QAction * actionShowPCLAlgorithmToolbar()
static bool isPythonPluginToolbar(QToolBar *toolbar)
QAction * actionShowMainPluginToolbar()
Standard ECV plugin interface.
Main application interface (for plugins)