SceneEditorMainWindow.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::SceneEditor
19  * @date 2015
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 #include "SceneEditorMainWindow.h"
25 
26 #include <QDockWidget>
27 #include <QActionGroup>
29 
30 gui::SceneEditorMainWindow::SceneEditorMainWindow(const controller::ControllerPtr& control, QPointer<dialog::GroupExplorerDialog> groupEditorDialog, QWidget* parent) :
31  QMainWindow(parent), groupEditorDialog(groupEditorDialog)
32 {
33  // create DockWidget for Object Inspector
34  objectInspectorDock = new gui::CollapsibleDockWidget(tr("Object Inspector"), this);
35  objectInspectorDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
36  objectInspectorDock->setAllowedAreas(Qt::LeftDockWidgetArea);
37  objectInspector = new ObjectInspectorWidget(control, objectInspectorDock);
38  objectInspectorDock->setCollapsibleWidget(objectInspector);
39  addDockWidget(Qt::LeftDockWidgetArea, objectInspectorDock);
40 
41  // create DockWidget for Object Explorer
42  objectExplorerDock = new gui::CollapsibleDockWidget(tr("Object Explorer"), this);
43  objectExplorerDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
44  objectExplorerDock->setAllowedAreas(Qt::RightDockWidgetArea);
45  objectExplorer = new ObjectExplorerWidget(control, objectExplorerDock);
46  objectExplorerDock->setCollapsibleWidget(objectExplorer);
47  addDockWidget(Qt::RightDockWidgetArea, objectExplorerDock);
48 
49  // create DockWidget for Minimap
50  minimapDock = new gui::CollapsibleDockWidget(tr("Minimap"), this);
51  minimapDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
52  minimapDock->setAllowedAreas(Qt::LeftDockWidgetArea);
53  minimap = new MinimapWidget(control, minimapDock);
54  minimapDock->setCollapsibleWidget(minimap);
55  addDockWidget(Qt::LeftDockWidgetArea, minimapDock);
56 
57  // create DockWidget for Group Explorer
58  groupExplorerDock = new gui::CollapsibleDockWidget(tr("Group Explorer"), this);
59  groupExplorerDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
60  groupExplorerDock->setAllowedAreas(Qt::RightDockWidgetArea);
61  groupExplorer = new GroupExplorerWidget(control, groupEditorDialog, groupExplorerDock);
62  groupExplorerDock->setCollapsibleWidget(groupExplorer);
63  addDockWidget(Qt::RightDockWidgetArea, groupExplorerDock);
64 
65  mainControl = control;
66 }
67 
69 {
70 
71 }
72 
74 {
75  // set SceneEditorWidget as centralWidget
76  scene = new SceneEditorWidget(mainControl, this->centralWidget());
77  setCentralWidget(scene);
78  this->setEnabled(false);
79 
80  scene->postDocking();
81 }
82 
84 {
85  objectExplorer->onConnect();
86 }
87 
89 {
90 }
91 
93 {
94  if (event->type() == QEvent::LanguageChange)
95  {
96  groupExplorer->retranslate();
97  objectInspector->retranslate();
98  objectExplorer->retranslate();
99  scene->retranslate();
100  groupEditorDialog->retranslate();
101  objectExplorerDock->setWindowTitle(tr("Object Explorer"));
102  objectExplorerDock->windowTitleChanged();
103  objectInspectorDock->setWindowTitle(tr("Object Inspector"));
104  objectInspectorDock->windowTitleChanged();
105  groupExplorerDock->setWindowTitle(tr("Group Explorer"));
106  groupExplorerDock->windowTitleChanged();
107  minimapDock->setWindowTitle(tr("Minimap"));
108  minimapDock->windowTitleChanged();
109 
110  emit languageChangedByUser();
111  }
112  else
113  {
114  QMainWindow::changeEvent(event);
115  }
116 
117 }
gui::GroupExplorerWidget
This class provides a QWidget which displays all existing groups in the local scene.
Definition: GroupExplorerWidget.h:46
gui::SceneEditorMainWindow::postDocking
void postDocking()
Definition: SceneEditorMainWindow.cpp:73
gui::SceneEditorMainWindow::~SceneEditorMainWindow
~SceneEditorMainWindow() override
Destructor.
Definition: SceneEditorMainWindow.cpp:68
GroupExplorerDialog.h
gui::SceneEditorWidget
This class provides a widget which contains all buttons for the scene.
Definition: SceneEditorWidget.h:51
gui::SceneEditorMainWindow::onDisconnect
void onDisconnect()
Disables main window.
Definition: SceneEditorMainWindow.cpp:88
gui::SceneEditorMainWindow::onConnect
void onConnect()
Enables main window and updates its widgets.
Definition: SceneEditorMainWindow.cpp:83
gui::SceneEditorMainWindow::changeEvent
void changeEvent(QEvent *event) override
Reimplements Qt::QWidget:changeEvent().
Definition: SceneEditorMainWindow.cpp:92
gui::ObjectInspectorWidget
This class provides a widget which displays all class and instance attributes of a currently selected...
Definition: ObjectInspectorWidget.h:48
controller::ControllerPtr
std::shared_ptr< Controller > ControllerPtr
Definition: ClassDefinitions.h:41
gui::ObjectExplorerWidget
This class provides a QWidget which displays all object classes from PriorKnowledge in their collecti...
Definition: ObjectExplorerWidget.h:51
gui::SceneEditorMainWindow::SceneEditorMainWindow
SceneEditorMainWindow(const controller::ControllerPtr &control, QPointer< dialog::GroupExplorerDialog > groupEditorDialog, QWidget *parent=0)
Constructor.
Definition: SceneEditorMainWindow.cpp:30
gui::MinimapWidget
This class is a widget which provides a scene3D::MinimapViewer to render the scene graph in bird pers...
Definition: MinimapWidget.h:42
gui::CollapsibleDockWidget
A QDockWidget which provides the possibility to collapse the dock.
Definition: CollapsibleDockWidget.h:41
SceneEditorMainWindow.h
control
This file is part of ArmarX.