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] _argc Argument count. [in] _argv Argument values. [in] _type Window type, by default it's a main window.
◆ ~Application()
|
virtual |
Destructor.
Member Function Documentation
◆ AddPluginPath()
void AddPluginPath | ( | const std::string & | _path | ) |
Add an path to look for plugins.
- Parameters
-
[in] _path Full path.
◆ DefaultConfigPath()
std::string DefaultConfigPath | ( | ) |
Get the location of the default configuration file.
- Returns
- The default configuration path.
◆ 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] _config Full 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
◆ 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] _filename Plugin filename. [in] _pluginElem Element containing plugin configuration
- Returns
- True if successful
- See also
- LoadConfig
- AddPluginsToWindow
◆ OnPluginClose
|
slot |
Callback when user requests to close a plugin.
◆ PluginList()
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:
- Paths given by the environment variable
- Paths added by calling addPluginPath
- Path ~/.ignition/gui/plugins
- 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] _pluginName Plugn 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] _path The 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] _env Name of environment variable.
The documentation for this class was generated from the following file: