diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp
index f41d122f3..d5d7b7dc8 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp
@@ -69,16 +69,16 @@ namespace GUIEditor
QDockWidget *dock = new QDockWidget( "Widget Hierarchy", this );
dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
- WidgetHierarchy *ha = new WidgetHierarchy;
- dock->setWidget( ha );
+ hierarchyView = new WidgetHierarchy;
+ dock->setWidget( hierarchyView );
addDockWidget( Qt::LeftDockWidgetArea, dock );
dock = new QDockWidget( "Widget Properties", this );
dock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
- QtTreePropertyBrowser *tb = new QtTreePropertyBrowser;
- browserCtrl.setBrowser( tb );
+ QtTreePropertyBrowser *propBrowser = new QtTreePropertyBrowser;
+ browserCtrl.setBrowser( propBrowser );
browserCtrl.setup();
- dock->setWidget( tb );
+ dock->setWidget( propBrowser );
addDockWidget( Qt::RightDockWidgetArea, dock );
viewPort->init();
@@ -102,6 +102,10 @@ namespace GUIEditor
delete viewPort;
viewPort = NULL;
+
+ // no deletion needed for these, since dockwidget owns them
+ hierarchyView = NULL;
+ propBrowser = NULL;
}
QUndoStack *GUIEditorWindow::undoStack() const
@@ -145,7 +149,10 @@ namespace GUIEditor
currentProject = projectFiles.projectName.c_str();
projectWindow->setupFiles( projectFiles );
if( viewPort->parse( projectFiles ) )
- viewPort->draw();
+ {
+ hierarchyView->buildHierarchy( projectFiles.masterGroup );
+ viewPort->draw();
+ }
else
{
QMessageBox::critical( this,
@@ -168,7 +175,10 @@ namespace GUIEditor
tr( "There was an error while parsing the GUI XML files. See the log file for details." ) );
}
else
+ {
+ hierarchyView->buildHierarchy( projectFiles.masterGroup );
viewPort->draw();
+ }
setCursor( Qt::ArrowCursor );
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h
index 86766e7ae..83a0f04ed 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h
@@ -24,10 +24,13 @@
#include "widget_info.h"
#include "property_browser_ctrl.h"
+class QtTreePropertyBrowser;
+
namespace GUIEditor
{
class CWidgetProperties;
+ class WidgetHierarchy;
class LinkEditor;
class ProcEditor;
class ProjectWindow;
@@ -62,6 +65,8 @@ private:
Ui::GUIEditorWindow m_ui;
CWidgetProperties *widgetProps;
+ WidgetHierarchy *hierarchyView;
+ QtTreePropertyBrowser *propBrowser;
LinkEditor *linkEditor;
ProcEditor *procEditor;
ProjectWindow *projectWindow;
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp
index 6bcd5cf0a..3dafa6e04 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp
@@ -16,6 +16,8 @@
#include "widget_hierarchy.h"
+#include "nel/gui/interface_group.h"
+#include "nel/gui/widget_manager.h"
namespace GUIEditor
{
@@ -28,4 +30,57 @@ namespace GUIEditor
WidgetHierarchy::~WidgetHierarchy()
{
}
+
+ void WidgetHierarchy::clearHierarchy()
+ {
+ widgetHT->clear();
+ }
+
+ void WidgetHierarchy::buildHierarchy( std::string &masterGroup )
+ {
+ clearHierarchy();
+
+ CInterfaceGroup *mg = CWidgetManager::getInstance()->getMasterGroupFromId( masterGroup );
+ if( mg != NULL )
+ {
+ QTreeWidgetItem *item = new QTreeWidgetItem( NULL );
+ item->setText( 0, "root" );
+ widgetHT->addTopLevelItem( item );
+
+ buildHierarchy( item, mg );
+ }
+ }
+
+ void WidgetHierarchy::buildHierarchy( QTreeWidgetItem *parent, CInterfaceGroup *group )
+ {
+ // First add ourselves
+ QTreeWidgetItem *item = new QTreeWidgetItem( parent );
+ item->setText( 0, group->getId().c_str() );
+
+ // Then add recursively our subgroups
+ const std::vector< CInterfaceGroup* > &groups = group->getGroups();
+ std::vector< CInterfaceGroup* >::const_iterator gitr;
+ for( gitr = groups.begin(); gitr != groups.end(); ++gitr )
+ {
+ buildHierarchy( item, *gitr );
+ }
+
+ // Add our controls
+ const std::vector< CCtrlBase* > &controls = group->getControls();
+ std::vector< CCtrlBase* >::const_iterator citr;
+ for( citr = controls.begin(); citr != controls.end(); ++citr )
+ {
+ QTreeWidgetItem *subItem = new QTreeWidgetItem( item );
+ subItem->setText( 0, (*citr)->getId().c_str() );
+ }
+
+ // Add our views
+ const std::vector< CViewBase* > &views = group->getViews();
+ std::vector< CViewBase* >::const_iterator vitr;
+ for( vitr = views.begin(); vitr != views.end(); ++vitr )
+ {
+ QTreeWidgetItem *subItem = new QTreeWidgetItem( item );
+ subItem->setText( 0, (*vitr)->getId().c_str() );
+ }
+ }
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.h
index 17fde2c29..00996f6ab 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.h
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.h
@@ -19,6 +19,13 @@
#include "ui_widget_hierarchy.h"
+namespace NLGUI
+{
+ class CInterfaceGroup;
+}
+
+class QTreeWidgetItem;
+
namespace GUIEditor
{
class WidgetHierarchy : public QWidget, public Ui::WidgetHierarchyTree
@@ -28,6 +35,11 @@ namespace GUIEditor
WidgetHierarchy( QWidget *parent = NULL );
~WidgetHierarchy();
+ void clearHierarchy();
+ void buildHierarchy( std::string &masterGroup );
+
+ private:
+ void buildHierarchy( QTreeWidgetItem *parent, NLGUI::CInterfaceGroup *group );
};
}
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.ui
index d0c1d9db5..34e48419c 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.ui
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.ui
@@ -21,66 +21,6 @@
Widgets
- -
-
- root
-
-
-
-
- container1
-
-
-
-
- group1
-
-
-
-
- group3
-
-
- -
-
- group4
-
-
-
-
- button1
-
-
- -
-
- button2
-
-
- -
-
- text1
-
-
- -
-
- bitmap1
-
-
-
-
- -
-
- group2
-
-
-
- -
-
- container2
-
-
- -
-
- container3
-
-
-