From 4e08299eb75776424d5f100d428fc053548d3055 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 20 Jul 2012 04:25:30 +0200 Subject: [PATCH] CHANGED: #1471 Extended the project file parser a little, now it also takes a MasterGroup name, and the name of a group that's activated after parsing. These are used to activate the groups, so that the Nel GUI widgets can be drawn. --- .../plugins/gui_editor/gui_editor_window.cpp | 4 +- .../src/plugins/gui_editor/nelgui_widget.cpp | 6 +++ .../gui_editor/project_file_parser.cpp | 42 ++++++++++++++----- .../plugins/gui_editor/project_file_parser.h | 2 - .../src/plugins/gui_editor/project_files.h | 13 +++++- .../gui_editor/project_files/login.xml | 13 ++++-- .../src/plugins/gui_editor/project_window.cpp | 2 +- 7 files changed, 62 insertions(+), 20 deletions(-) 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 c85671d39..f41d122f3 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 @@ -140,9 +140,9 @@ namespace GUIEditor setCursor( Qt::ArrowCursor ); return; } - projectFiles.clear(); + projectFiles.clearAll(); parser.getProjectFiles( projectFiles ); - currentProject = parser.getProjectName().c_str(); + currentProject = projectFiles.projectName.c_str(); projectWindow->setupFiles( projectFiles ); if( viewPort->parse( projectFiles ) ) viewPort->draw(); 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 21a8d4a1f..c8ce78123 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 @@ -80,6 +80,12 @@ namespace GUIEditor return false; CWidgetManager::getInstance()->updateAllLocalisedElements(); + CWidgetManager::getInstance()->activateMasterGroup( files.masterGroup, true ); + + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( files.activeGroup ); + if( e != NULL ) + e->setActive( true ); + return true; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.cpp index e0a7a4885..6ccc1f4b5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.cpp @@ -50,6 +50,9 @@ namespace GUIEditor projectFiles.mapFiles.resize( files.mapFiles.size() ); std::copy( files.guiFiles.begin(), files.guiFiles.end(), projectFiles.guiFiles.begin() ); std::copy( files.mapFiles.begin(), files.mapFiles.end(), projectFiles.mapFiles.begin() ); + projectFiles.projectName = files.projectName; + projectFiles.masterGroup = files.masterGroup; + projectFiles.activeGroup = files.activeGroup; } bool CProjectFileParser::parseXMLFile(QFile &f) @@ -85,18 +88,37 @@ namespace GUIEditor bool CProjectFileParser::parseHeader( QXmlStreamReader &reader ) { - while( !reader.atEnd() && !( reader.isStartElement() && ( reader.name() == "name" ) ) ) - reader.readNext(); - if( reader.atEnd() ) - return false; + while( !reader.atEnd() && !( reader.isEndElement() && ( reader.name() == "header" ) ) ) + { + if( reader.isStartElement() ) + { + if( reader.name() == "name" ) + { + QString name = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement ); + if( name.isEmpty() ) + return false; + files.projectName = name.toStdString(); + } + else + if( reader.name() == "mastergroup" ) + { + QString mg = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement ); + if( mg.isEmpty() ) + return false; + files.masterGroup = mg.toStdString(); + } + else + if( reader.name() == "activegroup" ) + { + QString ag = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement ); + if( ag.isEmpty() ) + return false; + files.activeGroup = ag.toStdString(); + } + } - QString name = reader.readElementText( QXmlStreamReader::ErrorOnUnexpectedElement ); - if( name.isEmpty() ) - return false; - projectName = name.toStdString(); - - while( !reader.atEnd() && !( reader.isEndElement() ) && ( reader.name() == "header" ) ) reader.readNext(); + } if( reader.atEnd() ) return false; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.h index 6e739025a..f8398ad19 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.h @@ -34,7 +34,6 @@ namespace GUIEditor ~CProjectFileParser(); bool parseProjectFile( std::string &name ); - const std::string& getProjectName() const{ return projectName; } void getProjectFiles( SProjectFiles &projectFiles ) const; private: @@ -44,7 +43,6 @@ namespace GUIEditor bool parseMapFiles( QXmlStreamReader &reader ); SProjectFiles files; - std::string projectName; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files.h index 9decad3c9..2479f16da 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files.h @@ -26,14 +26,25 @@ namespace GUIEditor struct SProjectFiles { public: + std::string projectName; + std::string masterGroup; + std::string activeGroup; std::vector< std::string > guiFiles; std::vector< std::string > mapFiles; - void clear() + void clearFiles() { guiFiles.clear(); mapFiles.clear(); } + + void clearAll() + { + clearFiles(); + projectName = ""; + masterGroup = ""; + activeGroup = ""; + } }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files/login.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files/login.xml index d8cea9dbc..0d0872ece 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files/login.xml +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files/login.xml @@ -1,11 +1,16 @@
login + ui:login + ui:login:checkpass
- + login_config.xml - login_keys.xml - login_main.xml login_widgets.xml - + login_main.xml + login_keys.xml + + + texture_interfaces_v3_login.tga +
\ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp index 4aec6cea8..ebce92c33 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp @@ -77,7 +77,7 @@ namespace GUIEditor void ProjectWindow::updateFiles( SProjectFiles &projectFiles ) { - projectFiles.clear(); + projectFiles.clearFiles(); QTreeWidgetItem *topItem;