MainWindow.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 _GAZEBO_GUI_MAINWINDOW_HH_
18 #define _GAZEBO_GUI_MAINWINDOW_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include "gazebo/gazebo_config.h"
25 #include "gazebo/msgs/MessageTypes.hh"
26 #include "gazebo/gui/qt.h"
27 #include "gazebo/util/system.hh"
28 
29 #ifdef HAVE_OCULUS
31 #endif
32 
33 namespace gazebo
34 {
35  namespace gui
36  {
37  class Editor;
38  class RenderWidget;
39 
40  // Forward declare private data
41  class MainWindowPrivate;
42 
43  class GZ_GUI_VISIBLE MainWindow : public QMainWindow
44  {
45  Q_OBJECT
46 
48  public: MainWindow();
49 
51  public: virtual ~MainWindow();
52 
54  public: void Load();
55 
57  public: void Init();
58 
62  public: unsigned int EntityId(const std::string &_name);
63 
67  public: bool HasEntityName(const std::string &_name);
68 
72  public: void AddToLeftColumn(const std::string &_name, QWidget *_widget);
73 
79  public: void ShowLeftColumnWidget(const std::string &_name = "default");
80 
81 
85  public: gui::RenderWidget *GetRenderWidget() const GAZEBO_DEPRECATED(7.0);
86 
89  public: gui::RenderWidget *RenderWidget() const;
90 
93  public: bool IsPaused() const;
94 
96  public slots: void Play();
97 
99  public slots: void Pause();
100 
103  public: void SetLeftPaneVisibility(bool _on);
104 
107  public: void AddMenu(QMenu *_menu);
108 
113  public: void ShowMenuBar(QMenuBar *_bar = NULL);
114 
123  public: QAction *CloneAction(QAction *_action, QObject *_parent);
124 
129  public: gui::Editor *GetEditor(
130  const std::string &_name) const GAZEBO_DEPRECATED(7.0);
131 
135  public: gui::Editor *Editor(const std::string &_name) const;
136 
138  signals: void AddPlugins();
139 
141  signals: void Close();
142 
143  protected: void closeEvent(QCloseEvent *_event);
144 
145  private: void OnGUI(ConstGUIPtr &_msg);
146 
147  private slots: void ItemSelected(QTreeWidgetItem *, int);
148  private slots: void New();
149  private slots: void Open();
150  private slots: void Save();
151  private slots: void SaveAs();
152 
154  private slots: void SaveINI();
155 
157  private slots: void Clone();
158 
160  private slots: void HotkeyChart();
161 
163  private slots: void About();
164 
165  private slots: void Step();
166 
168  private slots: void Arrow();
169 
171  private slots: void Translate();
172 
174  private slots: void Rotate();
175 
177  private slots: void Scale();
178 
181  private slots: void Align();
182 
184  private slots: void Snap();
185 
186  private slots: void CreateBox();
187  private slots: void CreateSphere();
188  private slots: void CreateCylinder();
189  private slots: void CreateMesh();
190  private slots: void CreatePointLight();
191  private slots: void CreateSpotLight();
192  private slots: void CreateDirectionalLight();
193 
195  private slots: void CaptureScreenshot();
196 
197  private slots: void InsertModel();
198 
200  private slots: void ShowGrid();
201 
203  private slots: void ShowOrigin();
204 
206  private slots: void ShowCollisions();
207 
209  private slots: void ShowJoints();
210 
212  private slots: void ShowContacts();
213 
215  private slots: void ShowCOM();
216 
218  private slots: void ShowInertia();
219 
221  private slots: void ShowLinkFrame();
222 
224  private slots: void FullScreen();
225 
227  private slots: void ShowToolbars();
228 
229  private slots: void FPS();
230  private slots: void Orbit();
231  private slots: void ViewOculus();
232  private slots: void OnResetModelOnly();
233  private slots: void OnResetWorld();
234  private slots: void SetTransparent();
235  private slots: void SetWireframe();
236 
238  private slots: void ShowGUIOverlays();
239 
241  private slots: void DataLogger();
242 
244  private slots: void OnDataLoggerClosed();
245 
247  private slots: void SelectTopic();
248 
250  private slots: void Diagnostics();
251 
253  private slots: void OnAddPlugins();
254 
257  private slots: void OnEditorGroup(QAction *_action);
258 
261  private: void OnFullScreen(bool _value);
262 
265  private: void OnShowToolbars(bool _value);
266 
267  private: void OnMoveMode(bool _mode);
268 
270  private: void CreateActions();
271 
273  private: void DeleteActions();
274 
276  private: void CreateMenus();
277 
279  private: void CreateMenuBar();
280 
282  private: void CreateEditors();
283 
284  private: void OnModel(ConstModelPtr &_msg);
285 
288  private: void OnLight(ConstLightPtr &_msg);
289 
290  private: void OnResponse(ConstResponsePtr &_msg);
291  private: void OnWorldModify(ConstWorldModifyPtr &_msg);
292  private: void OnManipMode(const std::string &_mode);
293  private: void OnSetSelectedEntity(const std::string &_name,
294  const std::string &_mode);
295 
298  private: void OnInputStepSizeChanged(int _value);
299 
302  private: void OnFollow(const std::string &_modelName);
303 
308  private: void CreateDisabledIcon(const std::string &_pixmap,
309  QAction *_act);
310 
313  private: void OnWindowMode(const std::string &_mode);
314 
317  private: std::unique_ptr<MainWindowPrivate> dataPtr;
318  };
319  }
320 }
321 #endif
A widget that provides data logging functionality.
Definition: DataLogger.hh:37
Forward declarations for the common classes.
Definition: Animation.hh:33
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
Plot diagnostic information.
Definition: gui/Diagnostics.hh:34
Definition: RenderWidget.hh:37
#define NULL
Definition: CommonTypes.hh:31
Definition: MainWindow.hh:43
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Base class for editors, such as BuildingEditor and TerrainEditor.
Definition: Editor.hh:35