Ignition Gui

API Reference

1.0.0
Application Class Reference

An Ignition 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...
 

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...
 
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 &_config)
 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. 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::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 Ignition 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.

◆ 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 _config)

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.

Parameters
[in]_configFull 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.

◆ 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 Ignition 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
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: