Gazebo Gui

API Reference

8.1.0
Application.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_GUI_APPLICATION_HH_
18#define GZ_GUI_APPLICATION_HH_
19
20#include <memory>
21#include <string>
22#include <utility>
23#include <vector>
24
25#include "gz/gui/qt.h"
26#include "gz/gui/Export.hh"
27
28#ifdef _WIN32
29// Disable warning C4251 which is triggered by
30// std::unique_ptr
31#pragma warning(push)
32#pragma warning(disable: 4251)
33#endif
34
35namespace tinyxml2
36{
37 class XMLElement;
38}
39
40namespace gz::gui
41{
42 class ApplicationPrivate;
43 class Dialog;
44 class MainWindow;
45 class Plugin;
46
48 enum class WindowType : int
49 {
52 kMainWindow = 0,
53
56 kDialog = 1
57 };
58
63 class GZ_GUI_VISIBLE Application : public QApplication
64 {
65 Q_OBJECT
66
73 public: Application(int &_argc, char **_argv,
74 const WindowType _type = WindowType::kMainWindow,
75 const char *_renderEngineGuiApiBackend = nullptr);
76
78 public: virtual ~Application();
79
82 public: QQmlApplicationEngine *Engine() const;
83
94 public: bool LoadPlugin(const std::string &_filename,
95 const tinyxml2::XMLElement *_pluginElem = nullptr);
96
105 public: bool LoadConfig(const std::string &_path);
106
112 public: bool LoadDefaultConfig();
113
121 public: void SetDefaultConfigPath(const std::string &_path);
122
128
132 public: void SetPluginPathEnv(const std::string &_env);
133
136 public: void AddPluginPath(const std::string &_path);
137
151
158 public: bool RemovePlugin(const std::string &_pluginName);
159
165 const std::string &_pluginName) const;
166
169 signals: void PluginAdded(const QString &_objectName);
170
172 public slots: void OnPluginClose();
173
177 public: bool CreateMainWindow();
178
185 private: bool InitializeMainWindow();
186
192 private: bool InitializeDialogs();
193
196 private: void RemovePlugin(std::shared_ptr<Plugin> _plugin);
197
202 private: bool AddPluginsToWindow();
203
207 private: bool ApplyConfig();
208
212 };
213
216 GZ_GUI_VISIBLE
218} // namespace gz::gui
219
220#ifdef _MSC_VER
221#pragma warning(pop)
222#endif
223
224#endif // GZ_GUI_APPLICATION_HH_