Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
pqProxyGroupMenuManager Class Reference

pqProxyGroupMenuManager is a menu-populator that fills up a menu with proxies defined in an XML configuration file. More...

#include <pqProxyGroupMenuManager.h>

Inherits QObject.

Collaboration diagram for pqProxyGroupMenuManager:
Collaboration graph
[legend]

Public Slots

void setEnabled (bool)
 
void loadConfiguration (vtkPVXMLElement *)
 Update from servermanager. More...
 
void lookForNewDefinitions ()
 Look for new proxy definition to add inside the menu Iter over known proxy definitions to parse Hints tag. More...
 
void removeProxyDefinitionUpdateObservers ()
 Remove all ProxyDefinitionUpdate observers to active server. More...
 
void addProxyDefinitionUpdateObservers ()
 Update the list of ProxyDefinitionUpdate observers to server. More...
 

Signals

void triggered (const QString &group, const QString &name)
 
void menuPopulated ()
 fired when the menu gets repopulated,typically means that the actions have been updated. More...
 
void categoriesUpdated ()
 Fired when categories were updated. More...
 

Public Member Functions

 pqProxyGroupMenuManager (QMenu *menu, const QString &resourceTagName, bool supportsQuickLaunch=true, bool enableFavorites=false)
 Constructor. More...
 
 ~pqProxyGroupMenuManager () override
 
QMenu * menu () const
 Access the menu. More...
 
QWidget * widgetActionsHolder () const
 returns the widget that hold actions created by this menu manager. More...
 
QMenu * getFavoritesMenu ()
 
void setRecentlyUsedMenuSize (unsigned int val)
 When size>0 a recently used category will be added to the menu. More...
 
unsigned int recentlyUsedMenuSize () const
 
bool supportsQuickLaunch () const
 Returns true if the pqProxyGroupMenuManager has been registered with quick-launch mechanism maintained by pqApplicationCore. More...
 
void setEnableFavorites (bool enable)
 
vtkSMProxygetPrototype (QAction *action) const
 Returns the prototype proxy for the action. More...
 
void addProxy (const QString &xmlgroup, const QString &xmlname)
 Provides mechanism to explicitly add a proxy to the menu. More...
 
void removeProxy (const QString &xmlgroup, const QString &xmlname)
 Provides mechanism to explicitly remove a proxy to the menu. More...
 
void addProxyDefinitionUpdateListener (const QString &proxyGroupName)
 Attach an observer to proxy manager to monitor any proxy definition update The detected proxy have to own a hint: More...
 
void removeProxyDefinitionUpdateListener (const QString &proxyGroupName)
 
virtual void populateMenu ()
 Forces a re-population of the menu. More...
 
void writeCategoryToSettings ()
 Write categories to settings. More...
 
QStringList getToolbarCategories () const
 Categories information. More...
 
QString getToolbarName (pqProxyCategory *category)
 Return a name for the toolbar. More...
 
QString categoryLabel (const QString &category)
 Given a category name, return the category label. More...
 
bool hideForTests (const QString &) const
 Returns whether or not the category's toolbar should be hidden initially. More...
 
QList< QAction * > actions () const
 List actions. More...
 
QList< QAction * > categoryActions (const QString &category)
 Returns actions from given category. More...
 
QList< QAction * > categoryActions (pqProxyCategory *category)
 Returns actions from given category. More...
 
QList< QAction * > actionsInToolbars ()
 Returns this list of actions that appear in toolbars. More...
 
QAction * getAction (pqProxyInfo *proxy)
 Return the action for a given proxy. More...
 
void updateActionIcon (pqProxyInfo *proxy)
 Update action icon from proxy info. More...
 
pqProxyCategorygetApplicationCategory ()
 Specific-meaning categories. More...
 
pqProxyCategorygetMenuCategory ()
 Returns the invisible root category containing all categories to display. More...
 
pqProxyCategorygetFavoritesCategory ()
 Returns the Favorites category. More...
 
bool isFavorites (pqProxyCategory *category)
 Returns true if the given category is a favorites. More...
 

Protected Slots

void triggered ()
 
void quickLaunch ()
 
void switchActiveServer ()
 
void updateMenuStyle ()
 
void updateActionsStyle ()
 
void populateRecentlyUsedMenu ()
 Fill recently used submenu. More...
 
void populateFavoritesMenu ()
 called when "favorites" menu is being shown. More...
 

Protected Member Functions

void loadRecentlyUsedItems ()
 
void saveRecentlyUsedItems ()
 
void loadFavoritesItems ()
 Load the favorites from settings. More...
 
QAction * getAddToFavoritesAction (const QString &path)
 
QAction * getAction (const QString &pgroup, const QString &proxyname)
 Return the action for a given proxy. More...
 

Protected Attributes

QString ResourceTagName
 
vtkPVXMLElementMenuRoot = nullptr
 
int RecentlyUsedMenuSize = 0
 
bool Enabled = true
 
bool EnableFavorites = false
 

Detailed Description

pqProxyGroupMenuManager is a menu-populator that fills up a menu with proxies defined in an XML configuration file.

This is use to automatically build the sources and filters menu in ParaView.

Definition at line 25 of file pqProxyGroupMenuManager.h.

Constructor & Destructor Documentation

◆ pqProxyGroupMenuManager()

pqProxyGroupMenuManager::pqProxyGroupMenuManager ( QMenu *  menu,
const QString &  resourceTagName,
bool  supportsQuickLaunch = true,
bool  enableFavorites = false 
)

Constructor.

menu is the Menu to be populated. resourceTagName is the tag name eg. "ParaViewSources" in the client configuration files which contains lists the items shown by this menu. supportsQuickLaunch, set to false if quick-launch is not to be supported for this menu.

◆ ~pqProxyGroupMenuManager()

pqProxyGroupMenuManager::~pqProxyGroupMenuManager ( )
override

Member Function Documentation

◆ menu()

QMenu* pqProxyGroupMenuManager::menu ( ) const
inline

Access the menu.

Definition at line 46 of file pqProxyGroupMenuManager.h.

◆ widgetActionsHolder()

QWidget* pqProxyGroupMenuManager::widgetActionsHolder ( ) const

returns the widget that hold actions created by this menu manager.

◆ getFavoritesMenu()

QMenu* pqProxyGroupMenuManager::getFavoritesMenu ( )

◆ setRecentlyUsedMenuSize()

void pqProxyGroupMenuManager::setRecentlyUsedMenuSize ( unsigned int  val)
inline

When size>0 a recently used category will be added to the menu.

One must call update() or initialize() after changing this value.

Definition at line 58 of file pqProxyGroupMenuManager.h.

◆ recentlyUsedMenuSize()

unsigned int pqProxyGroupMenuManager::recentlyUsedMenuSize ( ) const
inline

Definition at line 59 of file pqProxyGroupMenuManager.h.

◆ supportsQuickLaunch()

bool pqProxyGroupMenuManager::supportsQuickLaunch ( ) const
inline

Returns true if the pqProxyGroupMenuManager has been registered with quick-launch mechanism maintained by pqApplicationCore.

Definition at line 64 of file pqProxyGroupMenuManager.h.

◆ setEnableFavorites()

void pqProxyGroupMenuManager::setEnableFavorites ( bool  enable)
inline

Definition at line 65 of file pqProxyGroupMenuManager.h.

◆ getPrototype()

vtkSMProxy* pqProxyGroupMenuManager::getPrototype ( QAction *  action) const

Returns the prototype proxy for the action.

◆ addProxy()

void pqProxyGroupMenuManager::addProxy ( const QString &  xmlgroup,
const QString &  xmlname 
)

Provides mechanism to explicitly add a proxy to the menu.

◆ removeProxy()

void pqProxyGroupMenuManager::removeProxy ( const QString &  xmlgroup,
const QString &  xmlname 
)

Provides mechanism to explicitly remove a proxy to the menu.

◆ getToolbarCategories()

QStringList pqProxyGroupMenuManager::getToolbarCategories ( ) const

Categories information.

Returns a list of categories that have the "show_in_toolbar" attribute set to 1.

◆ getToolbarName()

QString pqProxyGroupMenuManager::getToolbarName ( pqProxyCategory category)

Return a name for the toolbar.

This is based on category name and proxy group.

◆ categoryLabel()

QString pqProxyGroupMenuManager::categoryLabel ( const QString &  category)

Given a category name, return the category label.

◆ hideForTests()

bool pqProxyGroupMenuManager::hideForTests ( const QString &  ) const
inline

Returns whether or not the category's toolbar should be hidden initially.

Definition at line 104 of file pqProxyGroupMenuManager.h.

◆ actions()

QList<QAction*> pqProxyGroupMenuManager::actions ( ) const

List actions.

returns the actions holds by the widgetActionsHolder

◆ categoryActions() [1/2]

QList<QAction*> pqProxyGroupMenuManager::categoryActions ( const QString &  category)

Returns actions from given category.

Create actions as needed. Looks for category in the default categories list.

◆ categoryActions() [2/2]

QList<QAction*> pqProxyGroupMenuManager::categoryActions ( pqProxyCategory category)

Returns actions from given category.

Create actions as needed.

◆ actionsInToolbars()

QList<QAction*> pqProxyGroupMenuManager::actionsInToolbars ( )

Returns this list of actions that appear in toolbars.

◆ getAction() [1/2]

QAction* pqProxyGroupMenuManager::getAction ( pqProxyInfo proxy)

Return the action for a given proxy.

◆ updateActionIcon()

void pqProxyGroupMenuManager::updateActionIcon ( pqProxyInfo proxy)

Update action icon from proxy info.

◆ addProxyDefinitionUpdateListener()

void pqProxyGroupMenuManager::addProxyDefinitionUpdateListener ( const QString &  proxyGroupName)

Attach an observer to proxy manager to monitor any proxy definition update The detected proxy have to own a hint:

<ShowInMenu category="" icon=""/>

where all the attribute are fully optional.

◆ removeProxyDefinitionUpdateListener()

void pqProxyGroupMenuManager::removeProxyDefinitionUpdateListener ( const QString &  proxyGroupName)

◆ getApplicationCategory()

pqProxyCategory* pqProxyGroupMenuManager::getApplicationCategory ( )

Specific-meaning categories.

Returns the invisible root category containing all categories to display, as defined by the application.

◆ getMenuCategory()

pqProxyCategory* pqProxyGroupMenuManager::getMenuCategory ( )

Returns the invisible root category containing all categories to display.

Use settings if existing.

◆ getFavoritesCategory()

pqProxyCategory* pqProxyGroupMenuManager::getFavoritesCategory ( )

Returns the Favorites category.

◆ isFavorites()

bool pqProxyGroupMenuManager::isFavorites ( pqProxyCategory category)

Returns true if the given category is a favorites.

Based on name.

◆ loadConfiguration

void pqProxyGroupMenuManager::loadConfiguration ( vtkPVXMLElement )
slot

Update from servermanager.

Load a configuration XML. It will find the elements with resourceTagName in the XML and populate the menu accordingly. Applications do not need to call this method directly, it's by default connected to pqApplicationCore::loadXML()

◆ lookForNewDefinitions

void pqProxyGroupMenuManager::lookForNewDefinitions ( )
slot

Look for new proxy definition to add inside the menu Iter over known proxy definitions to parse Hints tag.

◆ removeProxyDefinitionUpdateObservers

void pqProxyGroupMenuManager::removeProxyDefinitionUpdateObservers ( )
slot

Remove all ProxyDefinitionUpdate observers to active server.

◆ addProxyDefinitionUpdateObservers

void pqProxyGroupMenuManager::addProxyDefinitionUpdateObservers ( )
slot

Update the list of ProxyDefinitionUpdate observers to server.

◆ setEnabled

void pqProxyGroupMenuManager::setEnabled ( bool  )
inlineslot

Definition at line 202 of file pqProxyGroupMenuManager.h.

◆ populateMenu()

virtual void pqProxyGroupMenuManager::populateMenu ( )
virtual

Forces a re-population of the menu.

Create the main submenu entries. Actions are mostly created on "aboutToShow" signal, as menu should present the currently available proxies. See also populateRecentlyUsedMenu, populateAlphabeticalMenu, populateMiscMenu, populateCategoriesMenus, clearMenu

◆ writeCategoryToSettings()

void pqProxyGroupMenuManager::writeCategoryToSettings ( )

Write categories to settings.

◆ triggered [1/2]

void pqProxyGroupMenuManager::triggered ( const QString &  group,
const QString &  name 
)
signal

◆ menuPopulated

void pqProxyGroupMenuManager::menuPopulated ( )
signal

fired when the menu gets repopulated,typically means that the actions have been updated.

◆ categoriesUpdated

void pqProxyGroupMenuManager::categoriesUpdated ( )
signal

Fired when categories were updated.

◆ triggered [2/2]

void pqProxyGroupMenuManager::triggered ( )
protectedslot

◆ quickLaunch

void pqProxyGroupMenuManager::quickLaunch ( )
protectedslot

◆ switchActiveServer

void pqProxyGroupMenuManager::switchActiveServer ( )
protectedslot

◆ updateMenuStyle

void pqProxyGroupMenuManager::updateMenuStyle ( )
protectedslot

◆ updateActionsStyle

void pqProxyGroupMenuManager::updateActionsStyle ( )
protectedslot

◆ populateRecentlyUsedMenu

void pqProxyGroupMenuManager::populateRecentlyUsedMenu ( )
protectedslot

Fill recently used submenu.

◆ populateFavoritesMenu

void pqProxyGroupMenuManager::populateFavoritesMenu ( )
protectedslot

called when "favorites" menu is being shown.

create the menu (and submenu) with actions for the filters in the favorites list.

◆ loadRecentlyUsedItems()

void pqProxyGroupMenuManager::loadRecentlyUsedItems ( )
protected

◆ saveRecentlyUsedItems()

void pqProxyGroupMenuManager::saveRecentlyUsedItems ( )
protected

◆ loadFavoritesItems()

void pqProxyGroupMenuManager::loadFavoritesItems ( )
protected

Load the favorites from settings.

◆ getAddToFavoritesAction()

QAction* pqProxyGroupMenuManager::getAddToFavoritesAction ( const QString &  path)
protected

◆ getAction() [2/2]

QAction* pqProxyGroupMenuManager::getAction ( const QString &  pgroup,
const QString &  proxyname 
)
protected

Return the action for a given proxy.

Member Data Documentation

◆ ResourceTagName

QString pqProxyGroupMenuManager::ResourceTagName
protected

Definition at line 251 of file pqProxyGroupMenuManager.h.

◆ MenuRoot

vtkPVXMLElement* pqProxyGroupMenuManager::MenuRoot = nullptr
protected

Definition at line 252 of file pqProxyGroupMenuManager.h.

◆ RecentlyUsedMenuSize

int pqProxyGroupMenuManager::RecentlyUsedMenuSize = 0
protected

Definition at line 253 of file pqProxyGroupMenuManager.h.

◆ Enabled

bool pqProxyGroupMenuManager::Enabled = true
protected

Definition at line 255 of file pqProxyGroupMenuManager.h.

◆ EnableFavorites

bool pqProxyGroupMenuManager::EnableFavorites = false
protected

Definition at line 256 of file pqProxyGroupMenuManager.h.


The documentation for this class was generated from the following file: