From 23ad19d0ffc56dedc4fab2ddf097d750435756ca Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 14 Jun 2014 17:28:33 +0200 Subject: [PATCH] Split Nel3DWidget and NelGUIWidget. --- .../plugins/gui_editor/gui_editor_window.cpp | 2 +- .../src/plugins/gui_editor/nelgui_widget.cpp | 32 ++++++++++++------- .../src/plugins/gui_editor/nelgui_widget.h | 10 ++++-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp index e48a37ba6..923db1016 100644 --- a/code/studio/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp @@ -66,7 +66,7 @@ namespace GUIEditor addWidgetWidget = new AddWidgetWidget; connect( projectWindow, SIGNAL( projectFilesChanged() ), this, SLOT( onProjectFilesChanged() ) ); viewPort = new NelGUIWidget; - setCentralWidget( viewPort ); + setCentralWidget( viewPort->getViewPort() ); widgetInfoTree = new CWidgetInfoTree; diff --git a/code/studio/src/plugins/gui_editor/nelgui_widget.cpp b/code/studio/src/plugins/gui_editor/nelgui_widget.cpp index d86d31269..f8e34da3b 100644 --- a/code/studio/src/plugins/gui_editor/nelgui_widget.cpp +++ b/code/studio/src/plugins/gui_editor/nelgui_widget.cpp @@ -29,16 +29,19 @@ #include #include "editor_selection_watcher.h" +#include "nel3d_widget.h" + namespace GUIEditor { std::set< std::string > hwCursors; NelGUIWidget::NelGUIWidget( QWidget *parent ) : - Nel3DWidget( parent ) + QWidget( parent ) { timerID = 0; guiLoaded = false; watcher = NULL; + w = new Nel3DWidget(); } NelGUIWidget::~NelGUIWidget() @@ -49,7 +52,9 @@ namespace GUIEditor NLGUI::CViewRenderer::release(); NLMISC::CI18N::setNoResolution( false ); - + + delete w; + w = NULL; } void NelGUIWidget::init() @@ -59,15 +64,15 @@ namespace GUIEditor NLMISC::CPath::remapExtension( "dds", "png", true ); NLMISC::CPath::remapExtension( "png", "tga", true ); - Nel3DWidget::init(); - createTextContext( "Ryzom.ttf" ); + w->init(); + w->createTextContext( "Ryzom.ttf" ); NLGUI::CAHManager::setEditorMode( true ); NLGUI::CLuaManager::setEditorMode( true ); NLGUI::CInterfaceElement::setEditorMode( true ); - NLGUI::CViewRenderer::setDriver( getDriver() ); - NLGUI::CViewRenderer::setTextContext( getTextContext() ); + NLGUI::CViewRenderer::setDriver( w->getDriver() ); + NLGUI::CViewRenderer::setTextContext( w->getTextContext() ); NLGUI::CViewRenderer::hwCursors = &hwCursors; NLGUI::CViewRenderer::getInstance()->init(); @@ -125,21 +130,21 @@ namespace GUIEditor CWidgetManager::getInstance()->reset(); CWidgetManager::getInstance()->getParser()->removeAll(); CViewRenderer::getInstance()->reset(); - clear(); + w->clear(); } void NelGUIWidget::draw() { - getDriver()->clearBuffers( NLMISC::CRGBA::Black ); + w->getDriver()->clearBuffers( NLMISC::CRGBA::Black ); CWidgetManager::getInstance()->checkCoords(); CWidgetManager::getInstance()->drawViews( 0 ); - getDriver()->swapBuffers(); + w->getDriver()->swapBuffers(); } void NelGUIWidget::paintEvent( QPaintEvent *evnt ) { if( !guiLoaded ) - clear(); + w->clear(); } void NelGUIWidget::timerEvent( QTimerEvent *evnt ) @@ -148,7 +153,7 @@ namespace GUIEditor { if( guiLoaded ) { - getDriver()->EventServer.pump(); + w->getDriver()->EventServer.pump(); draw(); } } @@ -165,5 +170,10 @@ namespace GUIEditor if( timerID != 0 ) killTimer( timerID ); } + + QWidget* NelGUIWidget::getViewPort() + { + return w; + } } diff --git a/code/studio/src/plugins/gui_editor/nelgui_widget.h b/code/studio/src/plugins/gui_editor/nelgui_widget.h index 34c510507..a1412257c 100644 --- a/code/studio/src/plugins/gui_editor/nelgui_widget.h +++ b/code/studio/src/plugins/gui_editor/nelgui_widget.h @@ -18,15 +18,16 @@ #ifndef NELGUI_WIDGET_H #define NELGUI_WIDGET_H -#include "nel3d_widget.h" +#include #include "project_files.h" namespace GUIEditor { class CEditorSelectionWatcher; + class Nel3DWidget; /// Qt viewport for the Nel GUI library - class NelGUIWidget : public Nel3DWidget + class NelGUIWidget : public QWidget { Q_OBJECT public: @@ -39,6 +40,8 @@ namespace GUIEditor void reset(); CEditorSelectionWatcher* getWatcher(){ return watcher; } + QWidget* getViewPort(); + Q_SIGNALS: void guiLoadComplete(); @@ -53,6 +56,9 @@ Q_SIGNALS: int timerID; bool guiLoaded; CEditorSelectionWatcher *watcher; + + + Nel3DWidget *w; }; }