ccPluginUIManager.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef CCPLUGINUIMANAGER_H
  2. #define CCPLUGINUIMANAGER_H
  3. //##########################################################################
  4. //# #
  5. //# CLOUDCOMPARE #
  6. //# #
  7. //# This program 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; version 2 or later of the License. #
  10. //# #
  11. //# This program is distributed in the hope that it will be useful, #
  12. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  13. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  14. //# GNU General Public License for more details. #
  15. //# #
  16. //# COPYRIGHT: CloudCompare project #
  17. //# #
  18. //##########################################################################
  19. #include <QActionGroup>
  20. #include <QList>
  21. #include <QObject>
  22. class QAction;
  23. class QMenu;
  24. class QString;
  25. class QToolBar;
  26. class QWidget;
  27. class ccMainAppInterface;
  28. class ccPluginInterface;
  29. class ccStdPluginInterface;
  30. //! Plugin UI manager
  31. class ccPluginUIManager : public QObject
  32. {
  33. Q_OBJECT
  34. public:
  35. ccPluginUIManager( ccMainAppInterface *appInterface, QWidget *parent );
  36. ~ccPluginUIManager() override = default;
  37. void init();
  38. QMenu *pluginMenu() const;
  39. QMenu *shaderAndFilterMenu() const;
  40. QToolBar *mainPluginToolbar();
  41. QList<QToolBar *> &additionalPluginToolbars();
  42. QAction *actionShowMainPluginToolbar();
  43. QToolBar *glFiltersToolbar();
  44. QAction *actionShowGLFilterToolbar();
  45. void updateMenus();
  46. void handleSelectionChanged();
  47. void showAboutDialog() const;
  48. private:
  49. void setupActions();
  50. void setupMenus();
  51. void addActionsToMenu( ccStdPluginInterface *stdPlugin, const QList<QAction *> &actions );
  52. void setupToolbars();
  53. void addActionsToToolBar( ccStdPluginInterface *stdPlugin, const QList<QAction *> &actions );
  54. void enableGLFilter();
  55. void disableGLFilter();
  56. QWidget *m_parentWidget; // unfortunately we need this when creating new menus & toolbars
  57. ccMainAppInterface *m_appInterface;
  58. QMenu *m_pluginMenu;
  59. QMenu *m_glFilterMenu;
  60. QAction *m_actionRemoveFilter;
  61. QActionGroup m_glFilterActions;
  62. QList<ccPluginInterface *> m_plugins;
  63. QToolBar *m_mainPluginToolbar; // if a plugin only has one action it goes here
  64. QList<QToolBar *> m_additionalPluginToolbars; // if a plugin has multiple actions it gets its own toolbar
  65. QAction *m_showPluginToolbar;
  66. QToolBar *m_glFiltersToolbar;
  67. QAction *m_showGLFilterToolbar;
  68. };
  69. #endif