-
Notifications
You must be signed in to change notification settings - Fork 39
/
Iface.hh
196 lines (169 loc) · 6.59 KB
/
Iface.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
* Copyright (C) 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef IGNITION_GUI_IFACE_HH_
#define IGNITION_GUI_IFACE_HH_
#include <string>
#include <utility>
#include <vector>
#include "ignition/gui/MainWindow.hh"
#include "ignition/gui/System.hh"
// Forward declarations.
namespace tinyxml2
{
class XMLElement;
}
namespace ignition
{
namespace gui
{
/// \brief Initialize the application. This must be run before everything
/// else.
/// \return True on success.
IGNITION_GUI_VISIBLE
bool initApp();
/// \brief Stop the graphical interface.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool stop();
/// \brief Load plugins from a configuration file.
/// \param[in] _config Path to configuration file.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool loadConfig(const std::string &_config);
/// \brief Load the configuration from the default config file.
/// \return True if successful
/// \sa setDefaultConfigPath
/// \sa defaultConfigPath
IGNITION_GUI_VISIBLE
bool loadDefaultConfig();
/// \brief Load a plugin from a file name. The plugin file must be in the
/// path.
/// \param[in] _filename Plugin filename.
/// \param[in[ _pluginElem Element containing plugin configuration
/// \return True if successful
IGNITION_GUI_VISIBLE
bool loadPlugin(const std::string &_filename,
const tinyxml2::XMLElement *_pluginElem = nullptr);
/// \brief Set the global style sheet from a file.
/// \param[in] _qssFile Path to QSS file. Use `:/style.qss` for Ignition
/// GUI's default style sheet.
/// \sa setStyleFromString
IGNITION_GUI_VISIBLE
bool setStyleFromFile(const std::string &_qssFile);
/// \brief Set the global style sheet from a string.
/// \param[in] _styleSheet Style sheet in QSS format. Pass an empty string
/// to use Qt's default style.
/// \return True if successful.
/// \sa setStyleFromFile
IGNITION_GUI_VISIBLE
bool setStyleFromString(const std::string &_styleSheet);
/// \brief Specifies the location of the default configuration file.
/// This is the file that stores the user settings when pressing
/// "Save configuration".
/// \param[in] _path The default configuration full path including filename.
/// \sa loadDefaultConfig
/// \sa defaultConfigPath
IGNITION_GUI_VISIBLE
void setDefaultConfigPath(const std::string &_path);
/// \brief Get the location of the default configuration file.
/// \return The default configuration path.
/// \sa loadDefaultConfig
/// \sa setDefaultConfigPath
IGNITION_GUI_VISIBLE
std::string defaultConfigPath();
/// \brief Add previously loaded plugins to the main window.
/// * Make sure the window is created first
/// * Be sure to call loadPlugin() for each plugin first
/// * Plugins previously added must be loaded again
/// \return True if successful
IGNITION_GUI_VISIBLE
bool addPluginsToWindow();
/// \brief Apply previously loaded config to the main window.
/// * Make sure the window is created first
/// * Be sure to call loadConfig() for each plugin first
/// \return True if successful
IGNITION_GUI_VISIBLE
bool applyConfig();
/// \brief Run a main window using the given configuration file. This is
/// the main entry point for the command line tool "ign gui -c".
/// \param[in] _config Full path to configuration file.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool runConfig(const std::string &_config);
/// \brief Run a given plugin as a standalone window. This is the main
/// entry point for the command line tool "ign gui -s".
/// \param[in] _filename Plugin file name. The file must be in the path.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool runStandalone(const std::string &_filename);
/// \brief Run previously loaded plugins as individual dialogs.
/// This has no effect if no plugins have been loaded.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool runDialogs();
/// \brief Run an empty window.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool runEmptyWindow();
/// \brief Run previously loaded plugins on a single main window.
/// An empty window will be created if no plugins have been loaded.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool createMainWindow();
/// \brief Get the main window, if one has been generated. Use this to
/// customize the window before running it.
IGNITION_GUI_VISIBLE
ignition::gui::MainWindow *mainWindow();
/// \brief Get the dialogs, if they have been generated.
IGNITION_GUI_VISIBLE
std::vector<QDialog *> dialogs();
/// \brief Run previously created window.
/// \return True if successful
IGNITION_GUI_VISIBLE
bool runMainWindow();
/// \brief Set the environment variable which defines the paths to look for
/// plugins.
/// \param[in] _env Name of environment variable.
IGNITION_GUI_VISIBLE
void setPluginPathEnv(const std::string &_env);
/// \brief Add an path to look for plugins.
/// \param[in] _path Full path.
IGNITION_GUI_VISIBLE
void addPluginPath(const std::string &_path);
/// \brief Set the verbosity level (from 0 to 4).
IGNITION_GUI_VISIBLE
void setVerbosity(const unsigned int _verbosity);
/// \brief Print the available plugins, organized by path.
IGNITION_GUI_VISIBLE
void listPlugins();
/// \brief 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
///
/// \return A vector of pairs, where each pair contains:
/// * A path
/// * A vector of plugins in that path
IGNITION_GUI_VISIBLE
std::vector<std::pair<std::string, std::vector<std::string>>>
getPluginList();
}
}
#endif