Gazebo Gui

API Reference

3.12.0

An Gazebo GUI application loads a QML engine and provides an API to load plugins and configuration files. The application supports either running a single main window or several plugins as standalone dialogs. More...

#include <Application.hh>

Public Slots

void OnPluginClose ()
 Callback when user requests to close a plugin. More...
 

Signals

void PluginAdded (const QString &_objectName)
 Notify that a plugin has been added. More...
 

Public Member Functions

 Application (int &_argc, char **_argv, const WindowType _type=WindowType::kMainWindow)
 Constructor. More...
 
virtual ~Application ()
 Destructor. More...
 
void AddPluginPath (const std::string &_path)
 Add an path to look for plugins. More...
 
bool CreateMainWindow ()
 Create a main window. Just calls InitializeMainWindow. More...
 
std::string DefaultConfigPath ()
 Get the location of the default configuration file. More...
 
QQmlApplicationEngine * Engine () const
 Get the QML engine. More...
 
bool LoadConfig (const std::string &_path)
 Load a configuration file, which includes window configurations and plugins. This function doesn't instantiate the plugins, it just keeps them in memory and they can be applied later by either instantiating a window or several dialogs. and plugins. More...
 
bool LoadDefaultConfig ()
 Load the configuration from the default config file. More...
 
bool LoadPlugin (const std::string &_filename, const tinyxml2::XMLElement *_pluginElem=nullptr)
 Load a plugin from a file name. The plugin file must be in the path. If a window has been initialized, the plugin is added to the window. Otherwise, the plugin is stored and can be later added to a window or dialog. More...
 
std::shared_ptr< PluginPluginByName (const std::string &_pluginName) const
 Get a plugin by its unique name. More...
 
std::vector< std::pair< std::string, std::vector< std::string > > > PluginList ()
 Get the list of available plugins, organized by path. The paths are given in the following order: More...
 
bool RemovePlugin (const std::string &_pluginName)
 Remove plugin by name. The plugin is removed from the application and its shared library unloaded if this was its last instance. More...
 
void SetDefaultConfigPath (const std::string &_path)
 Specifies the location of the default configuration file. This is the file that stores the user settings when pressing "Save configuration". More...
 
void SetPluginPathEnv (const std::string &_env)
 Set the environment variable which defines the paths to look for plugins. More...
 

Detailed Description

An Gazebo GUI application loads a QML engine and provides an API to load plugins and configuration files. The application supports either running a single main window or several plugins as standalone dialogs.

Constructor & Destructor Documentation

◆ Application()

Application ( int &  _argc,
char **  _argv,
const WindowType  _type = WindowType::kMainWindow 
)

Constructor.

Parameters
[in]_argcArgument count.
[in]_argvArgument values.
[in]_typeWindow type, by default it's a main window.

◆ ~Application()

virtual ~Application ( )
virtual

Destructor.

Member Function Documentation

◆ AddPluginPath()

void AddPluginPath ( const std::string _path)

Add an path to look for plugins.

Parameters
[in]_pathFull path.

◆ CreateMainWindow()

bool CreateMainWindow ( )

Create a main window. Just calls InitializeMainWindow.

Returns
True if successful
See also
InitializeMainWindow

◆ DefaultConfigPath()

std::string DefaultConfigPath ( )

Get the location of the default configuration file.

Returns
The default configuration path.
See also
LoadDefaultConfig
SetDefaultConfigPath

◆ Engine()

QQmlApplicationEngine* Engine ( ) const

Get the QML engine.

Returns
Pointer to QML engine

◆ LoadConfig()

bool LoadConfig ( const std::string _path)

Load a configuration file, which includes window configurations and plugins. This function doesn't instantiate the plugins, it just keeps them in memory and they can be applied later by either instantiating a window or several dialogs. and plugins.

Parameters
[in]_pathFull path to configuration file.
Returns
True if successful
See also
InitializeMainWindow
InitializeDialogs

◆ LoadDefaultConfig()

bool LoadDefaultConfig ( )

Load the configuration from the default config file.

Returns
True if successful
See also
SetDefaultConfigPath
DefaultConfigPath
LoadConfig

◆ LoadPlugin()

bool LoadPlugin ( const std::string _filename,
const tinyxml2::XMLElement *  _pluginElem = nullptr 
)

Load a plugin from a file name. The plugin file must be in the path. If a window has been initialized, the plugin is added to the window. Otherwise, the plugin is stored and can be later added to a window or dialog.

Parameters
[in]_filenamePlugin filename.
[in]_pluginElemElement containing plugin configuration
Returns
True if successful
See also
LoadConfig
AddPluginsToWindow

◆ OnPluginClose

void OnPluginClose ( )
slot

Callback when user requests to close a plugin.

◆ PluginAdded

void PluginAdded ( const QString _objectName)
signal

Notify that a plugin has been added.

Parameters
[in]_objectNamePlugin's object name.

◆ PluginByName()

std::shared_ptr<Plugin> PluginByName ( const std::string _pluginName) const

Get a plugin by its unique name.

Parameters
[in]_pluginNamePlugn instance's unique name. This is the plugin card's object name.
Returns
Pointer to plugin object, null if not found.

◆ PluginList()

Get the list of available plugins, organized by path. The paths are given in the following order:

  1. Paths given by the environment variable
  2. Paths added by calling addPluginPath
  3. Path ~/.ignition/gui/plugins
  4. The path where Gazebo GUI plugins are installed
Returns
A vector of pairs, where each pair contains:
  • A path
  • A vector of plugins in that path

◆ RemovePlugin()

bool RemovePlugin ( const std::string _pluginName)

Remove plugin by name. The plugin is removed from the application and its shared library unloaded if this was its last instance.

Parameters
[in]_pluginNamePlugn instance's unique name. This is the plugin card's object name.
Returns
True if successful

◆ SetDefaultConfigPath()

void SetDefaultConfigPath ( const std::string _path)

Specifies the location of the default configuration file. This is the file that stores the user settings when pressing "Save configuration".

Parameters
[in]_pathThe default configuration full path including filename.
See also
LoadDefaultConfig
defaultConfigPath

◆ SetPluginPathEnv()

void SetPluginPathEnv ( const std::string _env)

Set the environment variable which defines the paths to look for plugins.

Parameters
[in]_envName of environment variable.

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