MainWindow.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 
83  public: gui::RenderWidget *RenderWidget() const;
84 
87  public: bool IsPaused() const;
88 
90  public slots: void Play();
91 
93  public slots: void Pause();
94 
97  public: void SetLeftPaneVisibility(bool _on);
98 
101  public: void AddMenu(QMenu *_menu);
102 
107  public: void ShowMenuBar(QMenuBar *_bar = NULL);
108 
117  public: QAction *CloneAction(QAction *_action, QObject *_parent);
118 
122  public: gui::Editor *Editor(const std::string &_name) const;
123 
125  signals: void AddPlugins();
126 
129  signals: void TrackVisual(const std::string &_visualName);
130 
132  signals: void Close();
133 
134  protected: void closeEvent(QCloseEvent *_event);
135 
136  private: void OnGUI(ConstGUIPtr &_msg);
137 
138  private slots: void ItemSelected(QTreeWidgetItem *, int);
139  private slots: void New();
140  private slots: void Open();
141  private slots: void Save();
142  private slots: void SaveAs();
143 
145  private slots: void SaveINI();
146 
148  private slots: void Clone();
149 
151  private slots: void HotkeyChart();
152 
154  private slots: void About();
155 
156  private slots: void Step();
157 
159  private slots: void Arrow();
160 
162  private slots: void Translate();
163 
165  private slots: void Rotate();
166 
168  private slots: void Scale();
169 
172  private slots: void Align();
173 
175  private slots: void Snap();
176 
177  private slots: void CreateBox();
178  private slots: void CreateSphere();
179  private slots: void CreateCylinder();
180  private slots: void CreateMesh();
181  private slots: void CreatePointLight();
182  private slots: void CreateSpotLight();
183  private slots: void CreateDirectionalLight();
184 
186  private slots: void CaptureScreenshot();
187 
188  private slots: void InsertModel();
189 
191  private slots: void ShowGrid();
192 
194  private slots: void ShowOrigin();
195 
197  private slots: void ShowCollisions();
198 
200  private slots: void ShowJoints();
201 
203  private slots: void ShowContacts();
204 
206  private slots: void ShowCOM();
207 
209  private slots: void ShowInertia();
210 
212  private slots: void ShowLinkFrame();
213 
215  private slots: void ShowSkeleton();
216 
218  private slots: void FullScreen();
219 
221  private slots: void ShowToolbars();
222 
223  private slots: void FPS();
224  private slots: void Orbit();
225  private slots: void ViewOculus();
226  private slots: void OnResetModelOnly();
227  private slots: void OnResetWorld();
228  private slots: void SetTransparent();
229  private slots: void SetWireframe();
230 
232  private slots: void ShowGUIOverlays();
233 
235  private slots: void DataLogger();
236 
238  private slots: void OnDataLoggerClosed();
239 
241  private slots: void SelectTopic();
242 
244  private slots: void Plot();
245 
247  private slots: void OnAddPlugins();
248 
251  private slots: void OnTrackVisual(const std::string &_visualName);
252 
255  private slots: void OnEditorGroup(QAction *_action);
256 
259  private: void OnFullScreen(bool _value);
260 
263  private: void OnShowToolbars(bool _value);
264 
265  private: void OnMoveMode(bool _mode);
266 
268  private: void CreateActions();
269 
271  private: void DeleteActions();
272 
274  private: void CreateMenus();
275 
277  private: void CreateMenuBar();
278 
280  private: void CreateEditors();
281 
282  private: void OnModel(ConstModelPtr &_msg);
283 
286  private: void OnLight(ConstLightPtr &_msg);
287 
288  private: void OnResponse(ConstResponsePtr &_msg);
289  private: void OnWorldModify(ConstWorldModifyPtr &_msg);
290  private: void OnManipMode(const std::string &_mode);
291  private: void OnSetSelectedEntity(const std::string &_name,
292  const std::string &_mode);
293 
296  private: void OnInputStepSizeChanged(int _value);
297 
300  private: void OnFollow(const std::string &_modelName);
301 
306  private: void CreateDisabledIcon(const std::string &_pixmap,
307  QAction *_act);
308 
311  private: void OnWindowMode(const std::string &_mode);
312 
315  private: std::unique_ptr<MainWindowPrivate> dataPtr;
316  };
317  }
318 }
319 #endif
A widget that provides data logging functionality.
Definition: DataLogger.hh:37
Forward declarations for the common classes.
Definition: Animation.hh:26
Definition: RenderWidget.hh:37
gui
Definition: KeyEventHandler.hh:29
#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