From 92d74a2dbd563407372deae038883d79c9a67267 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 24 Jul 2012 04:48:12 +0200 Subject: [PATCH] CHANGED: #1471 Forgot to add new files in previous commit. Also when the GUI is loaded the NelGUIWidget emits a signal now. --- .../plugins/gui_editor/gui_editor_window.cpp | 9 +- .../src/plugins/gui_editor/nelgui_widget.cpp | 1 + .../src/plugins/gui_editor/nelgui_widget.h | 3 + .../src/plugins/gui_editor/proc_list.cpp | 54 +++++++++++ .../src/plugins/gui_editor/proc_list.h | 48 ++++++++++ .../src/plugins/gui_editor/proc_list.ui | 96 +++++++++++++++++++ .../plugins/gui_editor/widget_hierarchy.cpp | 7 ++ .../src/plugins/gui_editor/widget_hierarchy.h | 8 +- 8 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.cpp create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.h create mode 100644 code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.ui 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 955bfa39a..27c10107f 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 @@ -82,6 +82,9 @@ namespace GUIEditor addDockWidget( Qt::RightDockWidgetArea, dock ); viewPort->init(); + + connect( viewPort, SIGNAL( guiLoadComplete() ), hierarchyView, SLOT( onGUILoaded() ) ); + connect( viewPort, SIGNAL( guiLoadComplete() ), procList, SLOT( onGUILoaded() ) ); } GUIEditorWindow::~GUIEditorWindow() @@ -151,7 +154,6 @@ namespace GUIEditor if( viewPort->parse( projectFiles ) ) { hierarchyView->buildHierarchy( projectFiles.masterGroup ); - viewPort->draw(); } else { @@ -174,11 +176,6 @@ namespace GUIEditor tr( "Error parsing GUI XML files" ), 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/nelgui_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp index 2313c20c8..6d834bab6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp @@ -105,6 +105,7 @@ namespace GUIEditor timerID = startTimer( 200 ); guiLoaded = true; + Q_EMIT guiLoadComplete(); return true; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h index 18f0e8194..bfd2f56d2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h @@ -35,6 +35,9 @@ namespace GUIEditor bool parse( SProjectFiles &files ); void draw(); +Q_SIGNALS: + void guiLoadComplete(); + protected: void paintEvent( QPaintEvent *evnt ); void timerEvent( QTimerEvent *evnt ); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.cpp new file mode 100644 index 000000000..ed39ef31e --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.cpp @@ -0,0 +1,54 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "proc_list.h" +#include "proc_editor.h" + +namespace GUIEditor +{ + ProcList::ProcList( QWidget *parent ) : + QWidget( parent ) + { + setupUi( this ); + procEditor = new ProcEditor; + + connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOkButtonClicked() ) ); + connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) ); + connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditButtonClicked() ) ); + } + + ProcList::~ProcList() + { + delete procEditor; + } + + void ProcList::onGUILoaded() + { + + } + + void ProcList::onOkButtonClicked() + { + hide(); + } + + void ProcList::onEditButtonClicked() + { + procEditor->show(); + } +} + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.h new file mode 100644 index 000000000..e26b03e06 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.h @@ -0,0 +1,48 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef PROC_LIST_H +#define PROC_LIST_H + +#include "ui_proc_list.h" + +namespace GUIEditor +{ + class ProcEditor; + + class ProcList : public QWidget, public Ui::ProcList + { + Q_OBJECT + public: + ProcList( QWidget *parent = NULL ); + ~ProcList(); + + public Q_SLOTS: + void onGUILoaded(); + + private Q_SLOTS: + void onOkButtonClicked(); + void onEditButtonClicked(); + + private: + ProcEditor *procEditor; + }; +} + +#endif + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.ui new file mode 100644 index 000000000..9e03a65a6 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.ui @@ -0,0 +1,96 @@ + + + ProcList + + + Qt::ApplicationModal + + + + 0 + 0 + 299 + 265 + + + + Procedure List + + + + + + + + + + + Add + + + + + + + Remove + + + + + + + Edit + + + + + + + + + Qt::Vertical + + + + 20 + 124 + + + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + Qt::Horizontal + + + + 114 + 20 + + + + + + + + + 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 2eaa3dcd0..883e5cfdc 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 @@ -125,6 +125,13 @@ namespace GUIEditor } } + void WidgetHierarchy::onGUILoaded() + { + if( masterGroup.empty() ) + return; + buildHierarchy( masterGroup ); + } + void WidgetHierarchy::onItemDblClicked( QTreeWidgetItem *item ) { if( item->parent() == NULL ) 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 b28f994c4..f634bba91 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 @@ -35,17 +35,23 @@ namespace GUIEditor WidgetHierarchy( QWidget *parent = NULL ); ~WidgetHierarchy(); + void setMasterGroup( const std::string &name ){ masterGroup = name; } + void clearHierarchy(); void buildHierarchy( std::string &masterGroup ); - + private: void buildHierarchy( QTreeWidgetItem *parent, NLGUI::CInterfaceGroup *group ); + public Q_SLOTS: + void onGUILoaded(); + private Q_SLOTS: void onItemDblClicked( QTreeWidgetItem *item ); private: std::string currentSelection; + std::string masterGroup; }; }