mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-30 07:35:59 +00:00
Split Nel3DWidget and NelGUIWidget.
--HG-- branch : gsoc2014-dfighter
This commit is contained in:
parent
fe7c3e4edf
commit
c692b168d7
3 changed files with 30 additions and 14 deletions
|
@ -66,7 +66,7 @@ namespace GUIEditor
|
||||||
addWidgetWidget = new AddWidgetWidget;
|
addWidgetWidget = new AddWidgetWidget;
|
||||||
connect( projectWindow, SIGNAL( projectFilesChanged() ), this, SLOT( onProjectFilesChanged() ) );
|
connect( projectWindow, SIGNAL( projectFilesChanged() ), this, SLOT( onProjectFilesChanged() ) );
|
||||||
viewPort = new NelGUIWidget;
|
viewPort = new NelGUIWidget;
|
||||||
setCentralWidget( viewPort );
|
setCentralWidget( viewPort->getViewPort() );
|
||||||
|
|
||||||
widgetInfoTree = new CWidgetInfoTree;
|
widgetInfoTree = new CWidgetInfoTree;
|
||||||
|
|
||||||
|
|
|
@ -29,16 +29,19 @@
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
#include "editor_selection_watcher.h"
|
#include "editor_selection_watcher.h"
|
||||||
|
|
||||||
|
#include "nel3d_widget.h"
|
||||||
|
|
||||||
namespace GUIEditor
|
namespace GUIEditor
|
||||||
{
|
{
|
||||||
std::set< std::string > hwCursors;
|
std::set< std::string > hwCursors;
|
||||||
|
|
||||||
NelGUIWidget::NelGUIWidget( QWidget *parent ) :
|
NelGUIWidget::NelGUIWidget( QWidget *parent ) :
|
||||||
Nel3DWidget( parent )
|
QWidget( parent )
|
||||||
{
|
{
|
||||||
timerID = 0;
|
timerID = 0;
|
||||||
guiLoaded = false;
|
guiLoaded = false;
|
||||||
watcher = NULL;
|
watcher = NULL;
|
||||||
|
w = new Nel3DWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
NelGUIWidget::~NelGUIWidget()
|
NelGUIWidget::~NelGUIWidget()
|
||||||
|
@ -50,6 +53,8 @@ namespace GUIEditor
|
||||||
NLGUI::CViewRenderer::release();
|
NLGUI::CViewRenderer::release();
|
||||||
NLMISC::CI18N::setNoResolution( false );
|
NLMISC::CI18N::setNoResolution( false );
|
||||||
|
|
||||||
|
delete w;
|
||||||
|
w = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NelGUIWidget::init()
|
void NelGUIWidget::init()
|
||||||
|
@ -59,15 +64,15 @@ namespace GUIEditor
|
||||||
NLMISC::CPath::remapExtension( "dds", "png", true );
|
NLMISC::CPath::remapExtension( "dds", "png", true );
|
||||||
NLMISC::CPath::remapExtension( "png", "tga", true );
|
NLMISC::CPath::remapExtension( "png", "tga", true );
|
||||||
|
|
||||||
Nel3DWidget::init();
|
w->init();
|
||||||
createTextContext( "Ryzom.ttf" );
|
w->createTextContext( "Ryzom.ttf" );
|
||||||
|
|
||||||
NLGUI::CAHManager::setEditorMode( true );
|
NLGUI::CAHManager::setEditorMode( true );
|
||||||
NLGUI::CLuaManager::setEditorMode( true );
|
NLGUI::CLuaManager::setEditorMode( true );
|
||||||
NLGUI::CInterfaceElement::setEditorMode( true );
|
NLGUI::CInterfaceElement::setEditorMode( true );
|
||||||
|
|
||||||
NLGUI::CViewRenderer::setDriver( getDriver() );
|
NLGUI::CViewRenderer::setDriver( w->getDriver() );
|
||||||
NLGUI::CViewRenderer::setTextContext( getTextContext() );
|
NLGUI::CViewRenderer::setTextContext( w->getTextContext() );
|
||||||
NLGUI::CViewRenderer::hwCursors = &hwCursors;
|
NLGUI::CViewRenderer::hwCursors = &hwCursors;
|
||||||
NLGUI::CViewRenderer::getInstance()->init();
|
NLGUI::CViewRenderer::getInstance()->init();
|
||||||
|
|
||||||
|
@ -125,21 +130,21 @@ namespace GUIEditor
|
||||||
CWidgetManager::getInstance()->reset();
|
CWidgetManager::getInstance()->reset();
|
||||||
CWidgetManager::getInstance()->getParser()->removeAll();
|
CWidgetManager::getInstance()->getParser()->removeAll();
|
||||||
CViewRenderer::getInstance()->reset();
|
CViewRenderer::getInstance()->reset();
|
||||||
clear();
|
w->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NelGUIWidget::draw()
|
void NelGUIWidget::draw()
|
||||||
{
|
{
|
||||||
getDriver()->clearBuffers( NLMISC::CRGBA::Black );
|
w->getDriver()->clearBuffers( NLMISC::CRGBA::Black );
|
||||||
CWidgetManager::getInstance()->checkCoords();
|
CWidgetManager::getInstance()->checkCoords();
|
||||||
CWidgetManager::getInstance()->drawViews( 0 );
|
CWidgetManager::getInstance()->drawViews( 0 );
|
||||||
getDriver()->swapBuffers();
|
w->getDriver()->swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NelGUIWidget::paintEvent( QPaintEvent *evnt )
|
void NelGUIWidget::paintEvent( QPaintEvent *evnt )
|
||||||
{
|
{
|
||||||
if( !guiLoaded )
|
if( !guiLoaded )
|
||||||
clear();
|
w->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NelGUIWidget::timerEvent( QTimerEvent *evnt )
|
void NelGUIWidget::timerEvent( QTimerEvent *evnt )
|
||||||
|
@ -148,7 +153,7 @@ namespace GUIEditor
|
||||||
{
|
{
|
||||||
if( guiLoaded )
|
if( guiLoaded )
|
||||||
{
|
{
|
||||||
getDriver()->EventServer.pump();
|
w->getDriver()->EventServer.pump();
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,5 +170,10 @@ namespace GUIEditor
|
||||||
if( timerID != 0 )
|
if( timerID != 0 )
|
||||||
killTimer( timerID );
|
killTimer( timerID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget* NelGUIWidget::getViewPort()
|
||||||
|
{
|
||||||
|
return w;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,16 @@
|
||||||
#ifndef NELGUI_WIDGET_H
|
#ifndef NELGUI_WIDGET_H
|
||||||
#define NELGUI_WIDGET_H
|
#define NELGUI_WIDGET_H
|
||||||
|
|
||||||
#include "nel3d_widget.h"
|
#include <QWidget>
|
||||||
#include "project_files.h"
|
#include "project_files.h"
|
||||||
|
|
||||||
namespace GUIEditor
|
namespace GUIEditor
|
||||||
{
|
{
|
||||||
class CEditorSelectionWatcher;
|
class CEditorSelectionWatcher;
|
||||||
|
class Nel3DWidget;
|
||||||
|
|
||||||
/// Qt viewport for the Nel GUI library
|
/// Qt viewport for the Nel GUI library
|
||||||
class NelGUIWidget : public Nel3DWidget
|
class NelGUIWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -39,6 +40,8 @@ namespace GUIEditor
|
||||||
void reset();
|
void reset();
|
||||||
CEditorSelectionWatcher* getWatcher(){ return watcher; }
|
CEditorSelectionWatcher* getWatcher(){ return watcher; }
|
||||||
|
|
||||||
|
QWidget* getViewPort();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void guiLoadComplete();
|
void guiLoadComplete();
|
||||||
|
|
||||||
|
@ -53,6 +56,9 @@ Q_SIGNALS:
|
||||||
int timerID;
|
int timerID;
|
||||||
bool guiLoaded;
|
bool guiLoaded;
|
||||||
CEditorSelectionWatcher *watcher;
|
CEditorSelectionWatcher *watcher;
|
||||||
|
|
||||||
|
|
||||||
|
Nel3DWidget *w;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue