pqProxyGroupMenuManager.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqProxyGroupMenuManager_h
5 #define pqProxyGroupMenuManager_h
6 
7 #include "pqApplicationComponentsModule.h"
8 #include <QMenu>
9 
10 class vtkPVXMLElement;
11 class vtkSMProxy;
12 
18 class PQAPPLICATIONCOMPONENTS_EXPORT pqProxyGroupMenuManager : public QObject
19 {
20  Q_OBJECT
21  typedef QObject Superclass;
22 
23 public:
33  QMenu* menu, const QString& resourceTagName, bool supportsQuickLaunch = true);
34  ~pqProxyGroupMenuManager() override;
35 
39  QMenu* menu() const { return static_cast<QMenu*>(this->parent()); }
40 
45  void setRecentlyUsedMenuSize(unsigned int val) { this->RecentlyUsedMenuSize = val; }
46 
47  unsigned int recentlyUsedMenuSize() const { return this->RecentlyUsedMenuSize; }
48 
52  QWidget* widgetActionsHolder() const;
53 
57  QList<QAction*> actions() const;
58 
62  vtkSMProxy* getPrototype(QAction* action) const;
63 
67  void addProxy(const QString& xmlgroup, const QString& xmlname);
68 
72  void removeProxy(const QString& xmlgroup, const QString& xmlname);
73 
78  QStringList getToolbarCategories() const;
79 
83  QList<QAction*> actions(const QString& category);
84 
88  QList<QAction*> actionsInToolbars();
89 
93  bool hideForTests(const QString& category) const;
94 
103  void addProxyDefinitionUpdateListener(const QString& proxyGroupName);
104  void removeProxyDefinitionUpdateListener(const QString& proxyGroupName);
105 
110  bool supportsQuickLaunch() const { return this->SupportsQuickLaunch; }
111 
112  void setEnableFavorites(bool enable) { this->EnableFavorites = enable; }
113 
114  QMenu* getFavoritesMenu();
115 
119  QString categoryLabel(const QString& category);
120 
121 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
128  void loadConfiguration(vtkPVXMLElement*);
129 
133  void lookForNewDefinitions();
134 
138  void removeProxyDefinitionUpdateObservers();
139 
143  void addProxyDefinitionUpdateObservers();
144 
148  void setEnabled(bool enable);
149 
154  virtual void populateMenu();
155 
156 Q_SIGNALS:
157  void triggered(const QString& group, const QString& name);
158 
163  void menuPopulated();
164 
165 protected Q_SLOTS:
166  void triggered();
167  void quickLaunch();
168  void switchActiveServer();
169  void updateMenuStyle();
170 
175  void populateRecentlyUsedMenu();
176 
181  void populateFavoritesMenu();
182 
183 protected: // NOLINT(readability-redundant-access-specifiers)
187  bool Enabled;
189 
190  void loadRecentlyUsedItems();
191  void saveRecentlyUsedItems();
192 
196  void loadFavoritesItems();
197 
201  QAction* getAction(const QString& pgroup, const QString& proxyname);
202 
203  QAction* getAddToCategoryAction(const QString& path);
204 
205 private:
206  Q_DISABLE_COPY(pqProxyGroupMenuManager)
207 
208  class pqInternal;
209  pqInternal* Internal;
210  bool SupportsQuickLaunch;
211 };
212 
213 #endif
pqProxyGroupMenuManager::Enabled
bool Enabled
Definition: pqProxyGroupMenuManager.h:187
pqProxyGroupMenuManager::RecentlyUsedMenuSize
int RecentlyUsedMenuSize
Definition: pqProxyGroupMenuManager.h:186
pqProxyGroupMenuManager::menu
QMenu * menu() const
Access the menu.
Definition: pqProxyGroupMenuManager.h:39
pqProxyGroupMenuManager::ResourceTagName
QString ResourceTagName
Definition: pqProxyGroupMenuManager.h:184
vtkSMProxy
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
pqProxyGroupMenuManager::recentlyUsedMenuSize
unsigned int recentlyUsedMenuSize() const
Definition: pqProxyGroupMenuManager.h:47
pqProxyGroupMenuManager::setRecentlyUsedMenuSize
void setRecentlyUsedMenuSize(unsigned int val)
When size>0 a recently used category will be added to the menu.
Definition: pqProxyGroupMenuManager.h:45
vtkPVXMLElement
Definition: vtkPVXMLElement.h:23
pqProxyGroupMenuManager::supportsQuickLaunch
bool supportsQuickLaunch() const
Returns true if the pqProxyGroupMenuManager has been registered with quick-launch mechanism maintaine...
Definition: pqProxyGroupMenuManager.h:110
pqProxyGroupMenuManager::setEnableFavorites
void setEnableFavorites(bool enable)
Definition: pqProxyGroupMenuManager.h:112
pqProxyGroupMenuManager::EnableFavorites
bool EnableFavorites
Definition: pqProxyGroupMenuManager.h:188
pqProxyGroupMenuManager
pqProxyGroupMenuManager is a menu-populator that fills up a menu with proxies defined in an XML confi...
Definition: pqProxyGroupMenuManager.h:18
pqProxyGroupMenuManager::MenuRoot
vtkPVXMLElement * MenuRoot
Definition: pqProxyGroupMenuManager.h:185