From 06423c7cc220b66a207bcdba772c64e013220b04 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 14 Jul 2012 03:57:23 +0200 Subject: [PATCH] CHANGED: #1471 the GUI library starts up from the GUI editor, altough can't exactly say yet that it works. --HG-- branch : gsoc2012-gui-editor --- .../src/plugins/gui_editor/CMakeLists.txt | 13 ++++- .../plugins/gui_editor/gui_editor_window.cpp | 51 +++++++++++++++++-- .../plugins/gui_editor/gui_editor_window.h | 1 + 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt index 4d2aebd0b..a1e1c5727 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt @@ -50,7 +50,18 @@ ADD_LIBRARY(ovqt_plugin_gui_editor MODULE ${SRC} ${OVQT_PLUGIN_GUI_EDITOR_RC_SRCS} ) -TARGET_LINK_LIBRARIES(ovqt_plugin_gui_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} qt_property_browser) +TARGET_LINK_LIBRARIES( + ovqt_plugin_gui_editor + ovqt_plugin_core + nelmisc + nel3d + nelgui + ${QT_LIBRARIES} + ${QT_QTOPENGL_LIBRARY} + qt_property_browser + ${LUA_LIBRARIES} + ${LUABIND_LIBRARIES} + ) NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor") NL_ADD_RUNTIME_FLAGS(ovqt_plugin_gui_editor) 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 094d780be..10c7ad30a 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 @@ -35,11 +35,16 @@ #include "link_editor.h" #include "proc_editor.h" +#include "nel/gui/interface_group.h" +#include "nel/gui/widget_manager.h" +#include "nel/gui/view_renderer.h" + namespace GUIEditor { QString _lastDir; std::map< std::string, SWidgetInfo > widgetInfo; - + std::set< std::string > hwCurs; + GUIEditorWindow::GUIEditorWindow(QWidget *parent) : QMainWindow(parent) { @@ -69,8 +74,23 @@ namespace GUIEditor browserCtrl.setBrowser( tb ); browserCtrl.setup(); dock->setWidget( tb ); - addDockWidget( Qt::RightDockWidgetArea, dock ); - + addDockWidget( Qt::RightDockWidgetArea, dock ); + + CWidgetManager::getInstance(); + NLMISC::CPath::addSearchPath( "z:/ryzom/data", true, false, NULL ); + NLMISC::CPath::remapExtension ("dds", "tga", true); + NLMISC::CPath::remapExtension ("dds", "png", true); + NLMISC::CPath::remapExtension ("png", "tga", true); + + NLGUI::_UIStringMapper = + NLMISC::CStringMapper::createLocalMapper(); + + NL3D::UDriver *driver = NL3D::UDriver::createDriver(); + CViewRenderer::setDriver( driver ); + CViewRenderer::setTextContext( driver->createTextContext( NLMISC::CPath::lookup( "ryzom.ttf" ) ) ); + hwCurs.insert( "curs_default.tga" ); + CViewRenderer::hwCursors = &hwCurs; + CViewRenderer::getInstance(); } GUIEditorWindow::~GUIEditorWindow() @@ -85,6 +105,8 @@ namespace GUIEditor delete procEditor; procEditor = NULL; + + CWidgetManager::release(); } QUndoStack *GUIEditorWindow::undoStack() const @@ -107,6 +129,25 @@ namespace GUIEditor } setCursor(Qt::ArrowCursor); } + + + void GUIEditorWindow::parse() + { + std::vector< std::string > files; + files.push_back( "login_config.xml" ); + files.push_back( "login_widgets.xml" ); + files.push_back( "login_main.xml" ); + files.push_back( "login_keys.xml" ); + + CViewRenderer::getInstance()->loadTextures( + "texture_interfaces_v3_login.tga", + "texture_interfaces_v3_login.txt", + false ); + + setCursor( Qt::WaitCursor ); + CWidgetManager::getInstance()->getParser()->parseInterface( files, false ); + setCursor( Qt::ArrowCursor ); + } void GUIEditorWindow::createMenus() { @@ -124,6 +165,10 @@ namespace GUIEditor a = new QAction( "Proc Editor", this ); connect( a, SIGNAL( triggered( bool ) ), procEditor, SLOT( show() ) ); + menu->addAction( a ); + + a = new QAction( "parse", this ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( parse() ) ); menu->addAction( a ); } } 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 25f454fb4..8ddb4de5a 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 @@ -47,6 +47,7 @@ public Q_SLOTS: void open(); private Q_SLOTS: + void parse(); private: void createMenus();