Changed: Merge
This commit is contained in:
commit
0c61d64592
93 changed files with 1534 additions and 631 deletions
|
@ -74,7 +74,7 @@ MACRO(NL_ADD_RUNTIME_FLAGS name)
|
|||
# LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}")
|
||||
ENDIF(WIN32)
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
|
||||
|
||||
|
|
|
@ -2,10 +2,6 @@ FILE(GLOB SRC *.cpp)
|
|||
|
||||
ADD_EXECUTABLE(nl_sample_command ${SRC})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nl_sample_command ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nl_sample_command nelmisc)
|
||||
NL_DEFAULT_PROPS(nl_sample_command "NeL, Samples, Misc: Commands")
|
||||
NL_ADD_RUNTIME_FLAGS(nl_sample_command)
|
||||
|
|
|
@ -691,10 +691,6 @@ NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nel3d ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY})
|
||||
SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D")
|
||||
|
|
|
@ -16,10 +16,6 @@ NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
|
||||
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL")
|
||||
NL_ADD_LIB_SUFFIX(${NLDRV_OGL_LIB})
|
||||
|
|
|
@ -7,10 +7,6 @@ NL_TARGET_LIB(nelgeorges ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelgeorges ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelgeorges ${LIBXML2_LIBRARIES} nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelgeorges PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelgeorges "NeL, Library: NeL Georges")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelligo ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelligo ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelligo ${LIBXML2_LIBRARIES} nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelligo PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelligo "NeL, Library: NeL Ligo")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nellogic ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nellogic ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nellogic ${LIBXML2_LIBRARIES} nelmisc nelnet)
|
||||
SET_TARGET_PROPERTIES(nellogic PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nellogic "NeL, Library: NeL Logic")
|
||||
|
|
|
@ -12,10 +12,6 @@ IF(WITH_GTK)
|
|||
ENDIF(GTK2_FOUND)
|
||||
ENDIF(WITH_GTK)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelnet ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelnet nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelnet PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelnet "NeL, Library: NeL Net")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelpacs ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelpacs ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelpacs nelmisc)
|
||||
SET_TARGET_PROPERTIES(nelpacs PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelpacs "NeL, Library: NeL PACS")
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(nelsound ${HEADERS} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelsound ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(nelsound ${LIBXML2_LIBRARIES} nelmisc nelligo nelgeorges nel3d nelsnd_lowlevel)
|
||||
SET_TARGET_PROPERTIES(nelsound PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelsound "NeL, Library: NeL Sound")
|
||||
|
|
|
@ -12,10 +12,6 @@ IF(WITH_STATIC)
|
|||
TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${OGG_LIBRARY})
|
||||
ENDIF(WITH_STATIC)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
SET_TARGET_PROPERTIES(nelsnd_lowlevel PROPERTIES LINK_INTERFACE_LIBRARIES "")
|
||||
NL_DEFAULT_PROPS(nelsnd_lowlevel "NeL, Library: Sound Lowlevel")
|
||||
NL_ADD_RUNTIME_FLAGS(nelsnd_lowlevel)
|
||||
|
|
|
@ -28,10 +28,6 @@ NL_TARGET_DRIVER(${NLDRV_AL_LIB} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${OPENAL_LIBRARY} nelmisc nelsnd_lowlevel)
|
||||
NL_DEFAULT_PROPS(${NLDRV_AL_LIB} "NeL, Driver, Sound: OpenAL")
|
||||
NL_ADD_RUNTIME_FLAGS(${NLDRV_AL_LIB})
|
||||
|
|
|
@ -22,7 +22,7 @@ SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h
|
|||
vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h
|
||||
vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h
|
||||
vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h
|
||||
tune_mrm_dialog.h tune_timer_dialog.h
|
||||
tune_mrm_dialog.h tune_timer_dialog.h camera_control.h
|
||||
extension_system/iplugin_manager.h extension_system/plugin_manager.h)
|
||||
|
||||
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
||||
|
|
|
@ -46,7 +46,6 @@ public:
|
|||
private Q_SLOTS:
|
||||
void setDegradationExponent(int value);
|
||||
void setSkipParticles(bool state);
|
||||
|
||||
void setDistRatio(float value);
|
||||
void setMaxDistLODBias(float value);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class CBinOpDialog : public QDialog
|
|||
|
||||
public:
|
||||
CBinOpDialog(QWidget *widget1, QWidget *widget2, QWidget *parent = 0);
|
||||
~CBinOpDialog();
|
||||
virtual ~CBinOpDialog();
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
|
@ -86,7 +86,6 @@ public:
|
|||
_SchemeWrapper[k].Index = k ;
|
||||
}
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
uint k ;
|
||||
|
|
285
code/nel/tools/3d/object_viewer_qt/src/camera_control.cpp
Normal file
285
code/nel/tools/3d/object_viewer_qt/src/camera_control.cpp
Normal file
|
@ -0,0 +1,285 @@
|
|||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "stdpch.h"
|
||||
#include "camera_control.h"
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
#include "nel/3d/u_driver.h"
|
||||
#include "nel/3d/u_scene.h"
|
||||
#include <nel/3d/u_camera.h>
|
||||
#include <nel/3d/u_3d_mouse_listener.h>
|
||||
|
||||
// Project includes
|
||||
#include "modules.h"
|
||||
|
||||
static int camId = 0;
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
CCameraItem::CCameraItem(const QString &name):
|
||||
_cameraFocal(75),
|
||||
_speed(5.0),
|
||||
_active(false),
|
||||
_name(name)
|
||||
{
|
||||
_camera = Modules::objView().getScene()->createCamera();
|
||||
_camera.setTransformMode (NL3D::UTransformable::DirectMatrix);
|
||||
reset();
|
||||
}
|
||||
|
||||
CCameraItem::~CCameraItem()
|
||||
{
|
||||
Modules::objView().getScene()->deleteCamera(_camera);
|
||||
}
|
||||
|
||||
void CCameraItem::setActive(bool active)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
sint w = Modules::objView().getDriver()->getWindowWidth();
|
||||
sint h = Modules::objView().getDriver()->getWindowHeight();
|
||||
_camera.setPerspective(_cameraFocal * float(NLMISC::Pi) / 180.f, float(w) / h, 0.1f, 1000);
|
||||
Modules::objView().getScene()->setCam(_camera);
|
||||
setupListener();
|
||||
}
|
||||
else
|
||||
{
|
||||
_hotSpot = Modules::objView().get3dMouseListener()->getHotSpot();
|
||||
}
|
||||
_active = active;
|
||||
}
|
||||
|
||||
void CCameraItem::setSpeed(float value)
|
||||
{
|
||||
_speed = value;
|
||||
Modules::objView().get3dMouseListener()->setSpeed(_speed);
|
||||
}
|
||||
|
||||
void CCameraItem::reset()
|
||||
{
|
||||
_hotSpot = NLMISC::CVector(0, 0, 0);
|
||||
float radius=10.f;
|
||||
|
||||
// Setup camera
|
||||
_camera.lookAt(_hotSpot + NLMISC::CVector(0.57735f, 0.57735f, 0.57735f) * radius, _hotSpot);
|
||||
|
||||
if (_active)
|
||||
setupListener();
|
||||
}
|
||||
|
||||
void CCameraItem::setupListener()
|
||||
{
|
||||
NL3D::U3dMouseListener *_mouseListener = Modules::objView().get3dMouseListener();
|
||||
_mouseListener->setMatrix (_camera.getMatrix());
|
||||
_mouseListener->setFrustrum (_camera.getFrustum());
|
||||
_mouseListener->setViewport (NL3D::CViewport());
|
||||
_mouseListener->setHotSpot (_hotSpot);
|
||||
Modules::objView().get3dMouseListener()->setSpeed(_speed);
|
||||
}
|
||||
|
||||
CCameraControl::CCameraControl(QWidget *parent)
|
||||
: QObject(parent),
|
||||
_currentCamera(0)
|
||||
{
|
||||
_camToolBar = new QToolBar(tr("CameraControl"), parent);
|
||||
|
||||
_fpsAction = _camToolBar->addAction(tr("Fly"));
|
||||
_fpsAction->setStatusTip(tr("Set firstPerson camera mode"));
|
||||
_fpsAction->setCheckable(true);
|
||||
|
||||
_edit3dAction = _camToolBar->addAction(tr("Edit"));
|
||||
_edit3dAction->setStatusTip(tr("Set edit3d camera mode"));
|
||||
_edit3dAction->setCheckable(true);
|
||||
|
||||
QActionGroup *cameraModeGroup = new QActionGroup(this);
|
||||
cameraModeGroup->addAction(_fpsAction);
|
||||
cameraModeGroup->addAction(_edit3dAction);
|
||||
_edit3dAction->setChecked(true);
|
||||
|
||||
connect(_fpsAction, SIGNAL(triggered()), this, SLOT(setFirstPersonMode()));
|
||||
connect(_edit3dAction, SIGNAL(triggered()), this, SLOT(setEditMode()));
|
||||
|
||||
_renderModeMenu = new QMenu(tr("Render Mode"), _camToolBar);
|
||||
_renderModeMenu->setIcon(QIcon(":/images/polymode.png"));
|
||||
_camToolBar->addAction(_renderModeMenu->menuAction());
|
||||
connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode()));
|
||||
|
||||
QSignalMapper *modeMapper = new QSignalMapper(this);
|
||||
|
||||
_pointRenderModeAction = _renderModeMenu->addAction(tr("Point mode"));
|
||||
_pointRenderModeAction->setIcon(QIcon(":/images/rmpoints.png"));
|
||||
_pointRenderModeAction->setStatusTip(tr("Set point render mode"));
|
||||
connect(_pointRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_pointRenderModeAction, 0);
|
||||
|
||||
_lineRenderModeAction = _renderModeMenu->addAction(tr("Line mode"));
|
||||
_lineRenderModeAction->setStatusTip(tr("Set line render mode"));
|
||||
_lineRenderModeAction->setIcon(QIcon(":/images/rmline.png"));
|
||||
connect(_lineRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_lineRenderModeAction, 1);
|
||||
|
||||
_fillRenderModeAction = _renderModeMenu->addAction(tr("Fill mode"));
|
||||
_fillRenderModeAction->setIcon(QIcon(":/images/rmfill.png"));
|
||||
_fillRenderModeAction->setStatusTip(tr("Set fill render mode"));
|
||||
connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_fillRenderModeAction, 2);
|
||||
|
||||
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setRenderMode(int)));
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_speedLabel = new QLabel(tr("Speed:"), _camToolBar);
|
||||
_camToolBar->addWidget(_speedLabel);
|
||||
_speedSpinBox = new QSpinBox(_camToolBar);
|
||||
_speedSpinBox->setMinimum(1);
|
||||
_speedSpinBox->setMaximum(1000);
|
||||
_camToolBar->addWidget(_speedSpinBox);
|
||||
connect(_speedSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setSpeed(int)));
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_addCamAction = _camToolBar->addAction(tr("Create camera"));
|
||||
_addCamAction->setIcon(QIcon(":/images/cam_add.png"));
|
||||
_addCamAction->setStatusTip(tr("Create new camera"));
|
||||
connect(_addCamAction, SIGNAL(triggered()), this, SLOT(addCamera()));
|
||||
|
||||
_delCamAction = _camToolBar->addAction(tr("Delete camera"));
|
||||
_delCamAction->setIcon(QIcon(":/images/cam_del.png"));
|
||||
_delCamAction->setStatusTip(tr("Delete current camera"));
|
||||
connect(_delCamAction, SIGNAL(triggered()), this, SLOT(delCamera()));
|
||||
|
||||
_listCamComboBox = new QComboBox(_camToolBar);
|
||||
connect(_listCamComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCamera(int)));
|
||||
_listCamComboBox->setCurrentIndex(createCamera(tr("defaultCamera")));
|
||||
_camToolBar->addWidget(_listCamComboBox);
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_resetCamAction = _camToolBar->addAction(tr("Reset camera"));
|
||||
_resetCamAction->setStatusTip(tr("Reset current camera"));
|
||||
//_resetCamAction->setShortcut(tr("Ctrl+R"));
|
||||
connect(_resetCamAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
||||
}
|
||||
|
||||
CCameraControl::~CCameraControl()
|
||||
{
|
||||
for(size_t i = 0; i < _cameraList.size(); ++i)
|
||||
delete _cameraList[i];
|
||||
_cameraList.clear();
|
||||
}
|
||||
|
||||
void CCameraControl::setEditMode()
|
||||
{
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::edit3d);
|
||||
}
|
||||
|
||||
void CCameraControl::setFirstPersonMode()
|
||||
{
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::firstPerson);
|
||||
}
|
||||
|
||||
void CCameraControl::addCamera()
|
||||
{
|
||||
_listCamComboBox->setCurrentIndex(createCamera(tr("%1_Camera").arg(++camId)));
|
||||
}
|
||||
|
||||
void CCameraControl::delCamera()
|
||||
{
|
||||
int index = _listCamComboBox->currentIndex();
|
||||
_listCamComboBox->setCurrentIndex(index - 1);
|
||||
|
||||
_listCamComboBox->removeItem(index);
|
||||
delete _cameraList[index];
|
||||
_cameraList.erase(_cameraList.begin() + index);
|
||||
}
|
||||
|
||||
void CCameraControl::setSpeed(int value)
|
||||
{
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->setSpeed(value);
|
||||
}
|
||||
|
||||
void CCameraControl::changeCamera(int index)
|
||||
{
|
||||
if (_currentCamera)
|
||||
_currentCamera->setActive(false);
|
||||
|
||||
if (index == 0)
|
||||
_delCamAction->setEnabled(false);
|
||||
else
|
||||
_delCamAction->setEnabled(true);
|
||||
|
||||
_currentCamera = _cameraList[index];
|
||||
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->setActive(true);
|
||||
_speedSpinBox->setValue(int(_currentCamera->getSpeed()));
|
||||
}
|
||||
|
||||
void CCameraControl::setRenderMode(int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case 1:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case 2:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraControl::setRenderMode()
|
||||
{
|
||||
switch (Modules::objView().getDriver()->getPolygonMode())
|
||||
{
|
||||
case NL3D::UDriver::Filled:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case NL3D::UDriver::Line:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case NL3D::UDriver::Point:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraControl::resetCamera()
|
||||
{
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->reset();
|
||||
}
|
||||
|
||||
int CCameraControl::createCamera(const QString &name)
|
||||
{
|
||||
CCameraItem *newCamera = new CCameraItem(name);
|
||||
_cameraList.push_back(newCamera);
|
||||
_listCamComboBox->addItem(newCamera->getName());
|
||||
return _cameraList.size() - 1;
|
||||
}
|
||||
|
||||
} /* namespace NLQT */
|
125
code/nel/tools/3d/object_viewer_qt/src/camera_control.h
Normal file
125
code/nel/tools/3d/object_viewer_qt/src/camera_control.h
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CAMERA_CONTROL_H
|
||||
#define CAMERA_CONTROL_H
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
// NeL includes
|
||||
#include <nel/3d/u_camera.h>
|
||||
#include "nel/misc/vector.h"
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
class CCameraItem
|
||||
{
|
||||
public:
|
||||
CCameraItem(const QString &name);
|
||||
~CCameraItem();
|
||||
|
||||
void setSpeed(float value);
|
||||
float getSpeed()
|
||||
{
|
||||
return _speed;
|
||||
}
|
||||
void setActive(bool active);
|
||||
void setName(const QString &name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
QString getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
void reset();
|
||||
|
||||
private:
|
||||
void setupListener();
|
||||
|
||||
NL3D::UCamera _camera;
|
||||
NLMISC::CVector _hotSpot;
|
||||
|
||||
float _cameraFocal;
|
||||
float _speed;
|
||||
bool _active;
|
||||
QString _name;
|
||||
};
|
||||
|
||||
class CCameraControl: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CCameraControl(QWidget *parent = 0);
|
||||
~CCameraControl();
|
||||
|
||||
QToolBar *getToolBar() const
|
||||
{
|
||||
return _camToolBar;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void setEditMode();
|
||||
void setFirstPersonMode();
|
||||
void addCamera();
|
||||
void delCamera();
|
||||
void setSpeed(int value);
|
||||
void changeCamera(int index);
|
||||
void setRenderMode(int value);
|
||||
void setRenderMode();
|
||||
void resetCamera();
|
||||
|
||||
private:
|
||||
int createCamera(const QString &name);
|
||||
|
||||
QAction *_fpsAction;
|
||||
QAction *_edit3dAction;
|
||||
QAction *_pointRenderModeAction;
|
||||
QAction *_lineRenderModeAction;
|
||||
QAction *_fillRenderModeAction;
|
||||
QAction *_addCamAction;
|
||||
QAction *_delCamAction;
|
||||
QAction *_resetCamAction;
|
||||
QSpinBox *_speedSpinBox;
|
||||
QComboBox *_listCamComboBox;
|
||||
QMenu *_renderModeMenu;
|
||||
QLabel *_speedLabel;
|
||||
QToolBar *_camToolBar;
|
||||
|
||||
CCameraItem *_currentCamera;
|
||||
std::vector<CCameraItem *> _cameraList;
|
||||
|
||||
}; /* class CCameraControl */
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
#endif // CAMERA_CONTROL_H
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
namespace NLMISC
|
||||
{
|
||||
class INelContext;
|
||||
class INelContext;
|
||||
}
|
||||
|
||||
namespace ExtensionSystem
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
namespace ExtensionSystem
|
||||
{
|
||||
|
@ -54,6 +55,10 @@ public:
|
|||
virtual void setPluginPaths(const QStringList &paths) = 0;
|
||||
virtual QList<ExtensionSystem::IPluginSpec *> plugins() const = 0;
|
||||
|
||||
// Settings
|
||||
virtual void setSettings(QSettings *settings) = 0;
|
||||
virtual QSettings *settings() const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void objectAdded(QObject *obj);
|
||||
void aboutToRemoveObject(QObject *obj);
|
||||
|
|
|
@ -28,14 +28,16 @@
|
|||
namespace ExtensionSystem
|
||||
{
|
||||
|
||||
CPluginManager::CPluginManager(QObject *parent):
|
||||
IPluginManager(parent)
|
||||
CPluginManager::CPluginManager(QObject *parent)
|
||||
:IPluginManager(parent),
|
||||
_settings(0)
|
||||
{
|
||||
}
|
||||
|
||||
CPluginManager::~CPluginManager()
|
||||
{
|
||||
stopAll();
|
||||
deleteAll();
|
||||
qDeleteAll(_pluginSpecs);
|
||||
}
|
||||
|
||||
|
@ -92,8 +94,10 @@ void CPluginManager::loadPlugins()
|
|||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Initialized);
|
||||
|
||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Running);
|
||||
QListIterator<CPluginSpec *> it(_pluginSpecs);
|
||||
it.toBack();
|
||||
while (it.hasPrevious())
|
||||
setPluginState(it.previous(), State::Running);
|
||||
|
||||
Q_EMIT pluginsChanged();
|
||||
}
|
||||
|
@ -114,6 +118,24 @@ QList<IPluginSpec *> CPluginManager::plugins() const
|
|||
return _ipluginSpecs;
|
||||
}
|
||||
|
||||
void CPluginManager::setSettings(QSettings *settings)
|
||||
{
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
QSettings *CPluginManager::settings() const
|
||||
{
|
||||
return _settings;
|
||||
}
|
||||
|
||||
void CPluginManager::readSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void CPluginManager::writeSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void CPluginManager::readPluginPaths()
|
||||
{
|
||||
qDeleteAll(_pluginSpecs);
|
||||
|
@ -176,9 +198,16 @@ void CPluginManager::stopAll()
|
|||
{
|
||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Stopped);
|
||||
}
|
||||
|
||||
Q_FOREACH (CPluginSpec *spec, _pluginSpecs)
|
||||
setPluginState(spec, State::Deleted);
|
||||
void CPluginManager::deleteAll()
|
||||
{
|
||||
QListIterator<CPluginSpec *> it(_pluginSpecs);
|
||||
it.toBack();
|
||||
while (it.hasPrevious())
|
||||
{
|
||||
setPluginState(it.previous(), State::Deleted);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace NLQT
|
|
@ -51,13 +51,21 @@ public:
|
|||
virtual void setPluginPaths(const QStringList &paths);
|
||||
virtual QList<IPluginSpec *> plugins() const;
|
||||
|
||||
// Settings
|
||||
virtual void setSettings(QSettings *settings);
|
||||
virtual QSettings *settings() const;
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
private:
|
||||
void setPluginState(CPluginSpec *spec, int destState);
|
||||
void readPluginPaths();
|
||||
void stopAll();
|
||||
void deleteAll();
|
||||
|
||||
mutable QReadWriteLock _lock;
|
||||
|
||||
QSettings *_settings;
|
||||
QList<CPluginSpec *> _pluginSpecs;
|
||||
QList<IPluginSpec *> _ipluginSpecs;
|
||||
QStringList _pluginPaths;
|
||||
|
|
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_add.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_del.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmfill.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmfill.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmline.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmpoints.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmpoints.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -21,6 +21,7 @@
|
|||
|
||||
// Qt includes
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QSplashScreen>
|
||||
|
@ -112,11 +113,14 @@ sint main(int argc, char **argv)
|
|||
|
||||
#if defined(NL_OS_MAC)
|
||||
QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources"));
|
||||
CLibrary::addLibPath(
|
||||
(qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
|
||||
CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString());
|
||||
#endif
|
||||
|
||||
Modules::init();
|
||||
QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
|
||||
QLatin1String("Ryzom Core"), QLatin1String("ObjectViewerQt"));
|
||||
|
||||
Modules::plugMan().setSettings(settings);
|
||||
|
||||
// load and set remap extensions from config
|
||||
Modules::config().configRemapExtensions();
|
||||
|
@ -141,8 +145,7 @@ sint main(int argc, char **argv)
|
|||
errors.append(spec->fileName() + " : " + spec->errorString());
|
||||
|
||||
if (!errors.isEmpty())
|
||||
QMessageBox::warning(0,
|
||||
QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
|
||||
QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"),
|
||||
errors.join(QString::fromLatin1("\n\n")));
|
||||
|
||||
splash->finish(&Modules::mainWin());
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "sun_color_dialog.h"
|
||||
#include "tune_mrm_dialog.h"
|
||||
#include "tune_timer_dialog.h"
|
||||
#include "camera_control.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
@ -144,6 +145,7 @@ CMainWindow::~CMainWindow()
|
|||
delete _TuneTimerDialog;
|
||||
delete _ParticleControlDialog;
|
||||
delete _ParticleWorkspaceDialog;
|
||||
delete _cameraControl;
|
||||
|
||||
if (_isSoundInitialized)
|
||||
Modules::sound().releaseGraphics();
|
||||
|
@ -220,43 +222,6 @@ void CMainWindow::resetScene()
|
|||
_SkeletonTreeModel->resetTreeModel();
|
||||
}
|
||||
|
||||
void CMainWindow::changeRenderMode()
|
||||
{
|
||||
// Change render mode
|
||||
switch (Modules::objView().getDriver()->getPolygonMode())
|
||||
{
|
||||
case NL3D::UDriver::Filled:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case NL3D::UDriver::Line:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case NL3D::UDriver::Point:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::resetCamera()
|
||||
{
|
||||
Modules::objView().resetCamera();
|
||||
}
|
||||
|
||||
void CMainWindow::changeCameraMode()
|
||||
{
|
||||
switch (_mouseMode)
|
||||
{
|
||||
case NL3D::U3dMouseListener::edit3d:
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::firstPerson);
|
||||
_mouseMode = NL3D::U3dMouseListener::firstPerson;
|
||||
break;
|
||||
case NL3D::U3dMouseListener::firstPerson:
|
||||
_mouseMode = NL3D::U3dMouseListener::edit3d;
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::edit3d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::reloadTextures()
|
||||
{
|
||||
Modules::objView().reloadTextures();
|
||||
|
@ -314,18 +279,11 @@ void CMainWindow::createActions()
|
|||
_resetCameraAction = new QAction(tr("Reset camera"), this);
|
||||
_resetCameraAction->setShortcut(tr("Ctrl+R"));
|
||||
_resetCameraAction->setStatusTip(tr("Reset current camera"));
|
||||
connect(_resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
||||
|
||||
_renderModeAction = new QAction("Change render mode", this);
|
||||
_renderModeAction->setIcon(QIcon(":/images/polymode.png"));
|
||||
_renderModeAction->setShortcut(tr("Ctrl+M"));
|
||||
_renderModeAction->setStatusTip(tr("Change render mode (Line, Point, Filled)"));
|
||||
connect(_renderModeAction, SIGNAL(triggered()), this, SLOT(changeRenderMode()));
|
||||
|
||||
_cameraModeAction = new QAction("Change camera mode", this);
|
||||
_cameraModeAction->setShortcut(tr("Ctrl+W"));
|
||||
_cameraModeAction->setStatusTip(tr("Change camera mode (edit3d, firstPerson)"));
|
||||
connect(_cameraModeAction, SIGNAL(triggered()), this, SLOT(changeCameraMode()));
|
||||
|
||||
_resetSceneAction = new QAction(tr("&Reset scene"), this);
|
||||
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
||||
|
@ -366,7 +324,6 @@ void CMainWindow::createMenus()
|
|||
_viewMenu->addAction(_setBackColorAction);
|
||||
_viewMenu->addAction(_resetCameraAction);
|
||||
_viewMenu->addAction(_renderModeAction);
|
||||
_viewMenu->addAction(_cameraModeAction);
|
||||
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
||||
|
||||
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
||||
|
@ -457,6 +414,12 @@ void CMainWindow::createToolBars()
|
|||
_toolsBar->addAction(_TuneTimerDialog->toggleViewAction());
|
||||
_toolsBar->addAction(_SkeletonScaleDialog->toggleViewAction());
|
||||
_toolsBar->addAction(_TuneMRMDialog->toggleViewAction());
|
||||
|
||||
_cameraControl = new CCameraControl(this);
|
||||
this->addToolBar(_cameraControl->getToolBar());
|
||||
|
||||
connect(_resetCameraAction, SIGNAL(triggered()), _cameraControl, SLOT(resetCamera()));
|
||||
connect(_renderModeAction, SIGNAL(triggered()), _cameraControl, SLOT(setRenderMode()));
|
||||
}
|
||||
|
||||
void CMainWindow::createStatusBar()
|
||||
|
|
|
@ -56,6 +56,8 @@ class CSunColorDialog;
|
|||
class CTuneMRMDialog;
|
||||
class CTuneTimerDialog;
|
||||
|
||||
class CCameraControl;
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -79,9 +81,6 @@ public:
|
|||
private Q_SLOTS:
|
||||
void open();
|
||||
void resetScene();
|
||||
void changeRenderMode();
|
||||
void resetCamera();
|
||||
void changeCameraMode();
|
||||
void reloadTextures();
|
||||
void settings();
|
||||
void about();
|
||||
|
@ -122,6 +121,8 @@ private:
|
|||
CSkeletonTreeModel *_SkeletonTreeModel;
|
||||
CTuneTimerDialog *_TuneTimerDialog;
|
||||
|
||||
CCameraControl *_cameraControl;
|
||||
|
||||
QPalette _originalPalette;
|
||||
QString _lastDir;
|
||||
|
||||
|
@ -143,7 +144,6 @@ private:
|
|||
QAction *_frameDelayAction;
|
||||
QAction *_lightGroupAction;
|
||||
QAction *_reloadTexturesAction;
|
||||
QAction *_cameraModeAction;
|
||||
QAction *_resetCameraAction;
|
||||
QAction *_resetSceneAction;
|
||||
QAction *_saveScreenshotAction;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
// STL includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/debug.h>
|
||||
#include <nel/misc/file.h>
|
||||
#include <nel/misc/bitmap.h>
|
||||
|
@ -115,19 +114,11 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
|||
|
||||
_Scene->enableLightingSystem(true);
|
||||
|
||||
// create the camera
|
||||
UCamera camera = _Scene->getCam();
|
||||
camera.setTransformMode (UTransformable::DirectMatrix);
|
||||
|
||||
setSizeViewport(w, h);
|
||||
|
||||
NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0);
|
||||
|
||||
_MouseListener = _Driver->create3dMouseListener();
|
||||
_MouseListener->setMouseMode(U3dMouseListener::edit3d);
|
||||
|
||||
resetCamera();
|
||||
|
||||
// set the cache size for the font manager(in bytes)
|
||||
_Driver->setFontManagerMaxMemory(2097152);
|
||||
|
||||
|
@ -252,21 +243,6 @@ void CObjectViewer::reloadTextures()
|
|||
}
|
||||
}
|
||||
|
||||
void CObjectViewer::resetCamera()
|
||||
{
|
||||
CVector hotSpot = CVector (0,0,0);
|
||||
float radius=10.f;
|
||||
|
||||
// Setup camera
|
||||
_Scene->getCam().lookAt(hotSpot + CVector(0.57735f, 0.57735f, 0.57735f) * radius, hotSpot);
|
||||
|
||||
// Setup mouse listener
|
||||
_MouseListener->setMatrix (_Scene->getCam().getMatrix());
|
||||
_MouseListener->setFrustrum (_Scene->getCam().getFrustum());
|
||||
_MouseListener->setViewport (CViewport());
|
||||
_MouseListener->setHotSpot (hotSpot);
|
||||
}
|
||||
|
||||
void CObjectViewer::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga)
|
||||
{
|
||||
//H_AUTO2
|
||||
|
|
|
@ -100,8 +100,6 @@ public:
|
|||
|
||||
void reloadTextures();
|
||||
|
||||
void resetCamera();
|
||||
|
||||
/// Make a screenshot of the current scene and save.
|
||||
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@
|
|||
<file>images/save.png</file>
|
||||
<file>images/insert-horizontal.png</file>
|
||||
<file>images/polymode.png</file>
|
||||
<file>images/rmfill.png</file>
|
||||
<file>images/rmline.png</file>
|
||||
<file>images/rmpoints.png</file>
|
||||
<file>images/cam_del.png</file>
|
||||
<file>images/cam_add.png</file>
|
||||
|
||||
<file>images/Emitter.bmp</file>
|
||||
<file>images/Force.bmp</file>
|
||||
|
|
|
@ -126,7 +126,7 @@ bool CParticleTreeItem::replace(const QList<QVariant> &data)
|
|||
|
||||
bool CParticleTreeItem::deleteChild(int row)
|
||||
{
|
||||
_childItems.removeAt(row);
|
||||
delete _childItems.takeAt(row);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ SET(OVQT_CORE_PLUGIN_HDR
|
|||
core_plugin.h
|
||||
main_window.h
|
||||
settings_dialog.h
|
||||
qnel_widget.h
|
||||
search_paths_settings_page.h
|
||||
plugin_view_dialog.h)
|
||||
|
||||
|
@ -37,11 +36,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
|||
|
||||
ADD_LIBRARY(ovqt_plugin_core MODULE ${SRC} ${OVQT_CORE_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_CORE_PLUGIN_RC_SRCS} ${OVQT_CORE_PLUGIN_UI_HDRS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc ${QT_LIBRARIES})
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_core "NeL, Tools, 3D: Object Viewer Qt Plugin: Core")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_core)
|
||||
|
|
|
@ -15,8 +15,18 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Project includes
|
||||
#include "core_plugin.h"
|
||||
#include "settings_dialog.h"
|
||||
#include "core_constants.h"
|
||||
#include "search_paths_settings_page.h"
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
#include "qtwin.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
@ -24,38 +34,27 @@
|
|||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
|
||||
#include "settings_dialog.h"
|
||||
#include "core_constants.h"
|
||||
#include "search_paths_settings_page.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
using namespace Core;
|
||||
|
||||
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
_plugMan = pluginManager;
|
||||
// for old ovqt
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
if (!wnd)
|
||||
{
|
||||
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
||||
return false;
|
||||
}
|
||||
oldOVQT = false;
|
||||
|
||||
//_mainWindow = new CMainWindow(_plugMan);
|
||||
//_mainWindow->show();
|
||||
_plugMan->addObject(new CSearchPathsSettingsPage(wnd));
|
||||
_plugMan->addObject(new CSearchPathsSettingsPage(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CorePlugin::extensionsInitialized()
|
||||
{
|
||||
// for old ovqt
|
||||
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||
|
||||
// for old ovqt
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
if (wnd)
|
||||
{
|
||||
_pluginView = new ExtensionSystem::CPluginView(_plugMan);
|
||||
QMenu *toolsMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
||||
nlassert(toolsMenu);
|
||||
|
@ -67,12 +66,38 @@ void CorePlugin::extensionsInitialized()
|
|||
|
||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execSettings()));
|
||||
connect(newAction2, SIGNAL(triggered()), _pluginView, SLOT(show()));
|
||||
oldOVQT = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mainWindow = new CMainWindow(this);
|
||||
#ifdef Q_WS_X11
|
||||
_mainWindow->setAttribute(Qt::WA_TranslucentBackground);
|
||||
_mainWindow->setAttribute(Qt::WA_NoSystemBackground, false);
|
||||
QPalette pal = _mainWindow->palette();
|
||||
QColor bg = pal.window().color();
|
||||
bg.setAlpha(180);
|
||||
pal.setColor(QPalette::Window, bg);
|
||||
_mainWindow->setPalette(pal);
|
||||
_mainWindow->ensurePolished(); // workaround Oxygen filling the background
|
||||
_mainWindow->setAttribute(Qt::WA_StyledBackground, false);
|
||||
#endif
|
||||
if (QtWin::isCompositionEnabled())
|
||||
{
|
||||
QtWin::extendFrameIntoClientArea(_mainWindow);
|
||||
_mainWindow->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
_mainWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
void CorePlugin::shutdown()
|
||||
{
|
||||
//delete _mainWindow;
|
||||
if (!oldOVQT)
|
||||
{
|
||||
delete _mainWindow;
|
||||
delete _pluginView;
|
||||
}
|
||||
}
|
||||
|
||||
void CorePlugin::execSettings()
|
||||
|
|
|
@ -58,6 +58,24 @@ public:
|
|||
|
||||
QObject *objectByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginManager *pluginManager() const
|
||||
{
|
||||
return _plugMan;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
QList<Type *> getObjects() const
|
||||
{
|
||||
QList<QObject *> all = _plugMan->allObjects();
|
||||
QList<Type *> objects;
|
||||
Q_FOREACH(QObject *obj, all)
|
||||
{
|
||||
Type *typeObj = qobject_cast<Type *>(obj);
|
||||
if (typeObj)
|
||||
objects.append(typeObj);
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
protected:
|
||||
NLMISC::CLibraryContext *_LibContext;
|
||||
|
@ -69,6 +87,8 @@ private:
|
|||
ExtensionSystem::IPluginManager *_plugMan;
|
||||
ExtensionSystem::CPluginView *_pluginView;
|
||||
CMainWindow *_mainWindow;
|
||||
|
||||
bool oldOVQT;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef IAPP_PAGE_H
|
||||
#define IAPP_PAGE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
/**
|
||||
@interface IAppPage
|
||||
@brief The IAppPage is an interface for providing app pages in main window.
|
||||
@details You need to subclass this interface and put an instance of your subclass
|
||||
into the plugin manager object pool.
|
||||
*/
|
||||
class IAppPage
|
||||
{
|
||||
public:
|
||||
virtual ~IAppPage() {}
|
||||
|
||||
/// id() is a unique identifier for referencing this page
|
||||
virtual QString id() const = 0;
|
||||
|
||||
/// trName() is the (translated) name for display.
|
||||
virtual QString trName() const = 0;
|
||||
|
||||
/// icon() is the icon for display
|
||||
virtual QIcon icon() const = 0;
|
||||
|
||||
/// The widget will be destroyed by the widget hierarchy when the main window closes
|
||||
virtual QWidget *widget() = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_INTERFACE(Core::IAppPage, "dev.ryzom.com.IAppPage/0.1")
|
||||
|
||||
#endif // IAPP_PAGE_H
|
|
@ -0,0 +1,56 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef ICORE_LISTENER_H
|
||||
#define ICORE_LISTENER_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
/**
|
||||
@interface ICoreListener
|
||||
@brief The ICoreListener is an interface for providing a hook for plugins to veto on close event emitted from
|
||||
the core plugin.
|
||||
@details You implement this interface if you want to prevent the closing of the whole application.
|
||||
If the application window requests a close, then first ICoreListener::closeMainWindow() is called
|
||||
(in arbitrary order) on all registered objects implementing this interface.
|
||||
If one if these calls returns false, the process is aborted and the event is ignored. If all calls return
|
||||
true, the corresponding signal is emitted and the event is accepted/performed.
|
||||
|
||||
You need to add your implementing object to the plugin managers objects:
|
||||
PluginManager->addObject(yourImplementingObject);
|
||||
Don't forget to remove the object again at deconstruction (e.g. in the destructor of
|
||||
your plugin)
|
||||
*/
|
||||
class ICoreListener
|
||||
{
|
||||
public:
|
||||
virtual ~ICoreListener() {}
|
||||
|
||||
/// Return false from the implemented method if you want to prevent the event.
|
||||
virtual bool closeMainWindow() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_INTERFACE(Core::ICoreListener, "dev.ryzom.com.ICoreListener/0.1")
|
||||
|
||||
#endif // ICORE_LISTENER_H
|
|
@ -63,4 +63,4 @@ public:
|
|||
|
||||
Q_DECLARE_INTERFACE(Core::IOptionsPage, "dev.ryzom.com.IOptionsPage/1.0")
|
||||
|
||||
#endif // IOPTIONSPAGE_H
|
||||
#endif // IOPTIONS_PAGE_H
|
||||
|
|
|
@ -17,43 +17,40 @@
|
|||
|
||||
// Project includes
|
||||
#include "main_window.h"
|
||||
#include "core_plugin.h"
|
||||
#include "iapp_page.h"
|
||||
#include "icore_listener.h"
|
||||
#include "core_constants.h"
|
||||
#include "settings_dialog.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
// Qt includes
|
||||
#include <QtGui/QtGui>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
||||
CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent)
|
||||
CMainWindow::CMainWindow(CorePlugin *corePlugin, QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
_lastDir(".")
|
||||
{
|
||||
_pluginManager = pluginManager;
|
||||
_corePlugin = corePlugin;
|
||||
_pluginManager = _corePlugin->pluginManager();
|
||||
_settings = _pluginManager->settings();
|
||||
|
||||
setObjectName(Constants::MAIN_WINDOW);
|
||||
|
||||
_tabWidget = new QTabWidget(this);
|
||||
_tabWidget->setTabPosition(QTabWidget::South);
|
||||
setCentralWidget(_tabWidget);
|
||||
|
||||
QWidget *qwidg1 = new QWidget(_tabWidget);
|
||||
QWidget *qwidg2 = new QWidget(_tabWidget);
|
||||
QList<IAppPage *> listAppPages = _corePlugin->getObjects<IAppPage>();
|
||||
|
||||
_tabWidget->addTab(qwidg1, "tab1");
|
||||
_tabWidget->addTab(qwidg2, "tab2");
|
||||
|
||||
|
||||
QGridLayout *gridLayout = new QGridLayout(qwidg1);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(qwidg1);
|
||||
_nelWidget->setObjectName(QString::fromUtf8("NELWIdget1"));
|
||||
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||
|
||||
QGridLayout *gridLayout2 = new QGridLayout(qwidg2);
|
||||
NLQT::QNLWidget *_nelWidget2 = new NLQT::QNLWidget(qwidg2);
|
||||
_nelWidget2->setObjectName(QString::fromUtf8("NELWIdget2"));
|
||||
gridLayout2->addWidget(_nelWidget2, 0, 0, 1, 1);
|
||||
Q_FOREACH(IAppPage *appPage, listAppPages)
|
||||
{
|
||||
addAppPage(appPage);
|
||||
}
|
||||
|
||||
setDockNestingEnabled(true);
|
||||
|
||||
|
@ -64,8 +61,12 @@ CMainWindow::CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget
|
|||
createMenus();
|
||||
createStatusBar();
|
||||
|
||||
readSettings();
|
||||
|
||||
setWindowIcon(QIcon(Constants::ICON_NEL));
|
||||
setWindowTitle(tr("Object Viewer Qt"));
|
||||
|
||||
connect(_pluginManager, SIGNAL(objectAdded(QObject *)), this, SLOT(checkObject(QObject *)));
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
|
@ -73,6 +74,13 @@ CMainWindow::~CMainWindow()
|
|||
delete _pluginView;
|
||||
}
|
||||
|
||||
void CMainWindow::checkObject(QObject *obj)
|
||||
{
|
||||
IAppPage *appPage = qobject_cast<IAppPage *>(obj);
|
||||
if (appPage)
|
||||
addAppPage(appPage);
|
||||
}
|
||||
|
||||
bool CMainWindow::showOptionsDialog(const QString &group,
|
||||
const QString &page,
|
||||
QWidget *parent)
|
||||
|
@ -91,6 +99,33 @@ void CMainWindow::about()
|
|||
"<p> Author: dnk-88 <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
||||
}
|
||||
|
||||
void CMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QList<ICoreListener *> listeners = _corePlugin->getObjects<ICoreListener>();
|
||||
Q_FOREACH(ICoreListener *listener, listeners)
|
||||
{
|
||||
if (!listener->closeMainWindow())
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
writeSettings();
|
||||
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void CMainWindow::addAppPage(IAppPage *appPage)
|
||||
{
|
||||
QWidget *tabWidget = new QWidget(_tabWidget);
|
||||
_tabWidget->addTab(tabWidget, appPage->icon(), appPage->trName());
|
||||
QGridLayout *gridLayout = new QGridLayout(tabWidget);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + appPage->id());
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
gridLayout->addWidget(appPage->widget(), 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
void CMainWindow::createActions()
|
||||
{
|
||||
_openAction = new QAction(tr("&Open..."), this);
|
||||
|
@ -150,12 +185,6 @@ void CMainWindow::createMenus()
|
|||
_helpMenu->addAction(_aboutAction);
|
||||
_helpMenu->addAction(_aboutQtAction);
|
||||
_helpMenu->addAction(_pluginViewAction);
|
||||
|
||||
_pluginManager->addObject(_fileMenu);
|
||||
_pluginManager->addObject(_editMenu);
|
||||
_pluginManager->addObject(_viewMenu);
|
||||
_pluginManager->addObject(_toolsMenu);
|
||||
_pluginManager->addObject(_helpMenu);
|
||||
}
|
||||
|
||||
void CMainWindow::createStatusBar()
|
||||
|
@ -168,6 +197,22 @@ void CMainWindow::createDialogs()
|
|||
_pluginView = new ExtensionSystem::CPluginView(_pluginManager, this);
|
||||
}
|
||||
|
||||
void CMainWindow::readSettings()
|
||||
{
|
||||
_settings->beginGroup("MainWindowSettings");
|
||||
restoreState(_settings->value("QtWindowState").toByteArray());
|
||||
restoreGeometry(_settings->value("QtWindowGeometry").toByteArray());
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
void CMainWindow::writeSettings()
|
||||
{
|
||||
_settings->beginGroup("MainWindowSettings");
|
||||
_settings->setValue("QtWindowState", saveState());
|
||||
_settings->setValue("QtWindowGeometry", saveGeometry());
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
} /* namespace Core */
|
||||
|
||||
/* end of file */
|
||||
|
|
|
@ -18,48 +18,53 @@
|
|||
#ifndef MAIN_WINDOW_H
|
||||
#define MAIN_WINDOW_H
|
||||
|
||||
// Project includes
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "plugin_view_dialog.h"
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
// Project includes
|
||||
#include "qnel_widget.h"
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "plugin_view_dialog.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class CSettingsDialog;
|
||||
class CorePlugin;
|
||||
class IAppPage;
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent = 0);
|
||||
CMainWindow(CorePlugin *corePlugin, QWidget *parent = 0);
|
||||
~CMainWindow();
|
||||
|
||||
inline QSettings *settings() const
|
||||
{
|
||||
return _settings;
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
void checkObject(QObject *obj);
|
||||
bool showOptionsDialog(const QString &group = QString(),
|
||||
const QString &page = QString(),
|
||||
QWidget *parent = 0);
|
||||
void about();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
private:
|
||||
void addAppPage(IAppPage *appPage);
|
||||
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void createStatusBar();
|
||||
void createDialogs();
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
|
||||
ExtensionSystem::IPluginManager *_pluginManager;
|
||||
ExtensionSystem::CPluginView *_pluginView;
|
||||
CorePlugin *_corePlugin;
|
||||
|
||||
QPalette _originalPalette;
|
||||
QString _lastDir;
|
||||
|
|
241
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp
Normal file
241
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp
Normal file
|
@ -0,0 +1,241 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Use, modification and distribution is allowed without limitation,
|
||||
** warranty, liability or support of any kind.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qtwin.h"
|
||||
#include <QLibrary>
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QPointer>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#include <qt_windows.h>
|
||||
|
||||
// Blur behind data structures
|
||||
#define DWM_BB_ENABLE 0x00000001 // fEnable has been specified
|
||||
#define DWM_BB_BLURREGION 0x00000002 // hRgnBlur has been specified
|
||||
#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004 // fTransitionOnMaximized has been specified
|
||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E // Composition changed window message
|
||||
|
||||
typedef struct _DWM_BLURBEHIND
|
||||
{
|
||||
DWORD dwFlags;
|
||||
BOOL fEnable;
|
||||
HRGN hRgnBlur;
|
||||
BOOL fTransitionOnMaximized;
|
||||
} DWM_BLURBEHIND, *PDWM_BLURBEHIND;
|
||||
|
||||
typedef struct _MARGINS
|
||||
{
|
||||
int cxLeftWidth;
|
||||
int cxRightWidth;
|
||||
int cyTopHeight;
|
||||
int cyBottomHeight;
|
||||
} MARGINS, *PMARGINS;
|
||||
|
||||
typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled);
|
||||
typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
|
||||
typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
|
||||
typedef HRESULT (WINAPI *PtrDwmGetColorizationColor)(DWORD *pcrColorization, BOOL *pfOpaqueBlend);
|
||||
|
||||
static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled= 0;
|
||||
static PtrDwmEnableBlurBehindWindow pDwmEnableBlurBehindWindow = 0;
|
||||
static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0;
|
||||
static PtrDwmGetColorizationColor pDwmGetColorizationColor = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Internal helper class that notifies windows if the
|
||||
* DWM compositing state changes and updates the widget
|
||||
* flags correspondingly.
|
||||
*/
|
||||
class WindowNotifier : public QWidget
|
||||
{
|
||||
public:
|
||||
WindowNotifier()
|
||||
{
|
||||
winId();
|
||||
}
|
||||
void addWidget(QWidget *widget)
|
||||
{
|
||||
widgets.append(widget);
|
||||
}
|
||||
void removeWidget(QWidget *widget)
|
||||
{
|
||||
widgets.removeAll(widget);
|
||||
}
|
||||
bool winEvent(MSG *message, long *result);
|
||||
|
||||
private:
|
||||
QWidgetList widgets;
|
||||
};
|
||||
|
||||
static bool resolveLibs()
|
||||
{
|
||||
if (!pDwmIsCompositionEnabled)
|
||||
{
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
pDwmIsCompositionEnabled =(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
|
||||
pDwmExtendFrameIntoClientArea = (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
|
||||
pDwmEnableBlurBehindWindow = (PtrDwmEnableBlurBehindWindow)dwmLib.resolve("DwmEnableBlurBehindWindow");
|
||||
pDwmGetColorizationColor = (PtrDwmGetColorizationColor)dwmLib.resolve("DwmGetColorizationColor");
|
||||
}
|
||||
return pDwmIsCompositionEnabled != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Chekcs and returns true if Windows DWM composition
|
||||
* is currently enabled on the system.
|
||||
*
|
||||
* To get live notification on the availability of
|
||||
* this feature, you will currently have to
|
||||
* reimplement winEvent() on your widget and listen
|
||||
* for the WM_DWMCOMPOSITIONCHANGED event to occur.
|
||||
*
|
||||
*/
|
||||
bool QtWin::isCompositionEnabled()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
BOOL isEnabled = false;
|
||||
hr = pDwmIsCompositionEnabled(&isEnabled);
|
||||
if (SUCCEEDED(hr))
|
||||
return isEnabled;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Enables Blur behind on a Widget.
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
bool QtWin::enableBlurBehindWindow(QWidget *widget, bool enable)
|
||||
{
|
||||
Q_ASSERT(widget);
|
||||
bool result = false;
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
DWM_BLURBEHIND bb = {0};
|
||||
HRESULT hr = S_OK;
|
||||
bb.fEnable = enable;
|
||||
bb.dwFlags = DWM_BB_ENABLE;
|
||||
bb.hRgnBlur = NULL;
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, enable);
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, enable);
|
||||
hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* ExtendFrameIntoClientArea.
|
||||
*
|
||||
* This controls the rendering of the frame inside the window.
|
||||
* Note that passing margins of -1 (the default value) will completely
|
||||
* remove the frame from the window.
|
||||
*
|
||||
* \note you should not call enableBlurBehindWindow before calling
|
||||
* this functions
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
bool QtWin::extendFrameIntoClientArea(QWidget *widget, int left, int top, int right, int bottom)
|
||||
{
|
||||
|
||||
Q_ASSERT(widget);
|
||||
Q_UNUSED(left);
|
||||
Q_UNUSED(top);
|
||||
Q_UNUSED(right);
|
||||
Q_UNUSED(bottom);
|
||||
|
||||
bool result = false;
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
MARGINS m = {left, top, right, bottom};
|
||||
hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
}
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, result);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the current colorizationColor for the window.
|
||||
*
|
||||
* \a enable tells if the blur should be enabled or not
|
||||
*/
|
||||
QColor QtWin::colorizatinColor()
|
||||
{
|
||||
QColor resultColor = QApplication::palette().window().color();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
if (resolveLibs())
|
||||
{
|
||||
DWORD color = 0;
|
||||
BOOL opaque = FALSE;
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
hr = pDwmGetColorizationColor(&color, &opaque);
|
||||
if (SUCCEEDED(hr))
|
||||
resultColor = QColor(color);
|
||||
}
|
||||
#endif
|
||||
return resultColor;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
WindowNotifier *QtWin::windowNotifier()
|
||||
{
|
||||
static WindowNotifier *windowNotifierInstance = 0;
|
||||
if (!windowNotifierInstance)
|
||||
windowNotifierInstance = new WindowNotifier;
|
||||
return windowNotifierInstance;
|
||||
}
|
||||
|
||||
|
||||
/* Notify all enabled windows that the DWM state changed */
|
||||
bool WindowNotifier::winEvent(MSG *message, long *result)
|
||||
{
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED)
|
||||
{
|
||||
bool compositionEnabled = QtWin::isCompositionEnabled();
|
||||
Q_FOREACH(QWidget * widget, widgets)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled);
|
||||
}
|
||||
widget->update();
|
||||
}
|
||||
}
|
||||
return QWidget::winEvent(message, result);
|
||||
}
|
||||
#endif
|
37
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.h
Normal file
37
code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Use, modification and distribution is allowed without limitation,
|
||||
** warranty, liability or support of any kind.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTWIN_H
|
||||
#define QTWIN_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QWidget>
|
||||
/**
|
||||
* This is a helper class for using the Desktop Window Manager
|
||||
* functionality on Windows 7 and Windows Vista. On other platforms
|
||||
* these functions will simply not do anything.
|
||||
*/
|
||||
|
||||
class WindowNotifier;
|
||||
|
||||
class QtWin
|
||||
{
|
||||
public:
|
||||
static bool enableBlurBehindWindow(QWidget *widget, bool enable = true);
|
||||
static bool extendFrameIntoClientArea(QWidget *widget,
|
||||
int left = -1, int top = -1,
|
||||
int right = -1, int bottom = -1);
|
||||
static bool isCompositionEnabled();
|
||||
static QColor colorizatinColor();
|
||||
|
||||
private:
|
||||
static WindowNotifier *windowNotifier();
|
||||
};
|
||||
|
||||
#endif // QTWIN_H
|
|
@ -32,7 +32,7 @@ namespace Core
|
|||
/**
|
||||
@class CSearchPathsSettingsPage
|
||||
*/
|
||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||
class CSearchPathsSettingsPage : public QObject, public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::IOptionsPage)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="searchPathsGroupBox">
|
||||
|
|
|
@ -10,7 +10,11 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||
|
||||
SET(OVQT_PLUG_EXAMPLE_HDR plugin1.h
|
||||
qnel_widget.h
|
||||
simple_viewer.h
|
||||
example_settings_page.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../core/iapp_page.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../core/icore_listener.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../core/ioptions_page.h)
|
||||
|
||||
SET(OVQT_PLUG_EXAMPLE_UIS example_settings_page.ui)
|
||||
|
@ -29,11 +33,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
|||
|
||||
ADD_LIBRARY(ovqt_plugin_example MODULE ${SRC} ${OVQT_PLUG_EXAMPLE_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_EXAMPLE_UI_HDRS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example nelmisc ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_example nelmisc nel3d ${QT_LIBRARIES})
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_example "NeL, Tools, 3D: Object Viewer Qt Plugin: Example")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_example)
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
// Project includes
|
||||
#include "plugin1.h"
|
||||
#include "example_settings_page.h"
|
||||
#include "simple_viewer.h"
|
||||
#include "../core/iapp_page.h"
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
@ -7,53 +16,22 @@
|
|||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenuBar>
|
||||
|
||||
|
||||
#include "../../extension_system/iplugin_spec.h"
|
||||
#include "example_settings_page.h"
|
||||
#include "nel/misc/debug.h"
|
||||
|
||||
using namespace Plugin;
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
bool MyPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
_plugMan = pluginManager;
|
||||
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
_plugMan->addObject(new CExampleSettingsPage(wnd));
|
||||
if (!wnd)
|
||||
{
|
||||
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
|
||||
return false;
|
||||
}
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
|
||||
if (!helpMenu)
|
||||
{
|
||||
*errorString = tr("Not found QMenu Help.");
|
||||
return false;
|
||||
}
|
||||
_plugMan->addObject(new CExampleSettingsPage(this));
|
||||
_plugMan->addObject(new CExampleAppPage(this));
|
||||
_plugMan->addObject(new CCoreListener(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
void MyPlugin::extensionsInitialized()
|
||||
{
|
||||
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Help"));
|
||||
nlassert(helpMenu);
|
||||
|
||||
helpMenu->addSeparator();
|
||||
QAction *newAction = helpMenu->addAction("MyPlugin");
|
||||
|
||||
connect(newAction, SIGNAL(triggered()), this, SLOT(execMessageBox()));
|
||||
}
|
||||
|
||||
void MyPlugin::execMessageBox()
|
||||
{
|
||||
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
|
||||
nlassert(wnd);
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(wnd->objectName() + QString(": width=%1,height=%2").arg(wnd->width()).arg(wnd->height()));
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void MyPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||
|
@ -107,4 +85,6 @@ ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(MyPlugin)
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(Plugin::MyPlugin)
|
|
@ -1,11 +1,17 @@
|
|||
#ifndef PLUGIN1_H
|
||||
#define PLUGIN1_H
|
||||
|
||||
// Project includes
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "simple_viewer.h"
|
||||
#include "../core/iapp_page.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/app_context.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
@ -40,9 +46,6 @@ public:
|
|||
QObject *objectByName(const QString &name) const;
|
||||
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void execMessageBox();
|
||||
|
||||
protected:
|
||||
NLMISC::CLibraryContext *_LibContext;
|
||||
|
||||
|
@ -51,6 +54,32 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class CExampleAppPage: public QObject, public Core::IAppPage
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::IAppPage)
|
||||
public:
|
||||
CExampleAppPage(QObject *parent = 0): QObject(parent) {}
|
||||
virtual ~CExampleAppPage() {}
|
||||
|
||||
virtual QString id() const
|
||||
{
|
||||
return QLatin1String("ExampleAppPage");
|
||||
}
|
||||
virtual QString trName() const
|
||||
{
|
||||
return tr("SimpleViewer");
|
||||
}
|
||||
virtual QIcon icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
virtual QWidget *widget()
|
||||
{
|
||||
return new CSimpleViewer();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // PLUGIN1_H
|
||||
|
|
|
@ -38,6 +38,9 @@ QNLWidget::QNLWidget(QWidget *parent)
|
|||
_initialized(false),
|
||||
_interval(25)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
init();
|
||||
_mainTimer = new QTimer(this);
|
||||
connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
|
||||
|
@ -55,8 +58,7 @@ void QNLWidget::init()
|
|||
nlassert(_driver);
|
||||
|
||||
// initialize the nel 3d viewport
|
||||
_driver->setDisplay((nlWindow)winId(),
|
||||
NL3D::UDriver::CMode(width(), height(), 32));
|
||||
_driver->setDisplay((nlWindow)winId(), NL3D::UDriver::CMode(width(), height(), 32));
|
||||
|
||||
// set the cache size for the font manager(in bytes)
|
||||
_driver->setFontManagerMaxMemory(2097152);
|
||||
|
@ -111,39 +113,6 @@ void QNLWidget::showEvent(QShowEvent *showEvent)
|
|||
_mainTimer->stop();
|
||||
}
|
||||
|
||||
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||
// Qt does not provide wheel events through winEvent() and macEvent() (but it
|
||||
// does through x11Event(), which is inconsistent...)
|
||||
// Workaround is to handle wheel events like implemented below.
|
||||
//
|
||||
// TODO: this is not a clean solution, because all but wheel events are
|
||||
// handled using winEvent(), x11Event(), macEvent(). But this seems to be a
|
||||
// limitation of current (4.7.1) Qt versions. (see e.g. qapplication_mac.mm)
|
||||
void QNLWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
// Get relative positions.
|
||||
float fX = 1.0f - (float)event->pos().x() / this->width();
|
||||
float fY = 1.0f - (float)event->pos().y() / this->height();
|
||||
|
||||
// Get the buttons currently pressed.
|
||||
uint32 buttons = NLMISC::noButton;
|
||||
if(event->buttons() & Qt::LeftButton) buttons |= NLMISC::leftButton;
|
||||
if(event->buttons() & Qt::RightButton) buttons |= NLMISC::rightButton;
|
||||
if(event->buttons() & Qt::MidButton) buttons |= NLMISC::middleButton;
|
||||
if(event->modifiers() & Qt::ControlModifier) buttons |= NLMISC::ctrlButton;
|
||||
if(event->modifiers() & Qt::ShiftModifier) buttons |= NLMISC::shiftButton;
|
||||
if(event->modifiers() & Qt::AltModifier) buttons |= NLMISC::altButton;
|
||||
|
||||
if(event->delta() > 0)
|
||||
_driver->EventServer.postEvent(
|
||||
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, true, NULL));
|
||||
else
|
||||
_driver->EventServer.postEvent(
|
||||
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, false, NULL));
|
||||
}
|
||||
#endif // defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
|
||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
@ -65,10 +65,6 @@ private Q_SLOTS:
|
|||
protected:
|
||||
virtual void showEvent(QShowEvent *showEvent);
|
||||
|
||||
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
|
||||
virtual void wheelEvent(QWheelEvent *event);
|
||||
#endif
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
virtual bool winEvent(MSG *message, long *result);
|
||||
#elif defined(NL_OS_MAC)
|
|
@ -0,0 +1,54 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "simple_viewer.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
CSimpleViewer::CSimpleViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QGridLayout *gridLayout = new QGridLayout(this);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayoutSimpleViewer"));
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(this);
|
||||
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
bool CCoreListener::closeMainWindow() const
|
||||
{
|
||||
int ret = QMessageBox::question(0, tr("Example close event hook"),
|
||||
tr("Do you want to close window?"),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (ret == QMessageBox::Yes)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
} /* namespace Plugin */
|
|
@ -0,0 +1,55 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef SIMPLE_VIEWER_H
|
||||
#define SIMPLE_VIEWER_H
|
||||
|
||||
// Project includes
|
||||
#include "qnel_widget.h"
|
||||
#include "../core/icore_listener.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class CSimpleViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSimpleViewer(QWidget *parent = 0);
|
||||
virtual ~CSimpleViewer() {}
|
||||
};
|
||||
|
||||
class CCoreListener : public QObject, public Core::ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Core::ICoreListener)
|
||||
public:
|
||||
CCoreListener(QObject *parent = 0): QObject(parent) {}
|
||||
virtual ~CCoreListener() {}
|
||||
|
||||
virtual bool closeMainWindow() const;
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // SIMPLE_VIEWER_H
|
|
@ -27,10 +27,6 @@ ADD_LIBRARY(ovqt_plugin_log MODULE ${SRC} ${OVQT_PLUG_LOG_MOC_SRC} ${OVQT_EXT_SY
|
|||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_log nelmisc ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_log ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_log "NeL, Tools, 3D: Object Viewer Qt Plugin: Log")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_log)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_log)
|
||||
|
|
|
@ -23,10 +23,6 @@ ADD_LIBRARY(ovqt_plugin_sheet_builder MODULE ${SRC} ${OVQT_PLUG_SHEET_BUILDER_MO
|
|||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder nelmisc ${QT_LIBRARIES})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_sheet_builder "NeL, Tools, 3D: Object Viewer Qt Plugin: Sheet builder")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_sheet_builder)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_sheet_builder)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<item row="0" column="0">
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<enum>QSlider::TicksAbove</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>100</number>
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -96,6 +96,8 @@ template <typename T>
|
|||
class CValueBlenderDialogClientT : public IValueBlenderDialogClient
|
||||
{
|
||||
public:
|
||||
virtual ~CValueBlenderDialogClientT() {}
|
||||
|
||||
// the scheme being used. Must be set by the user
|
||||
NL3D::CPSValueBlendFuncBase<T> *SchemeFunc;
|
||||
|
||||
|
@ -143,6 +145,8 @@ protected:
|
|||
class CFloatBlenderDialogClient : public CValueBlenderDialogClientT<float>
|
||||
{
|
||||
public:
|
||||
~CFloatBlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<float> *wrapper, QWidget *parent)
|
||||
{
|
||||
CEditRangeFloatWidget *erf = new CEditRangeFloatWidget(parent);
|
||||
|
@ -158,6 +162,8 @@ public:
|
|||
class CUIntBlenderDialogClient : public CValueBlenderDialogClientT<uint32>
|
||||
{
|
||||
public:
|
||||
~CUIntBlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<uint32> *wrapper, QWidget *parent)
|
||||
{
|
||||
CEditRangeUIntWidget *erf = new CEditRangeUIntWidget(parent);
|
||||
|
@ -173,6 +179,8 @@ public:
|
|||
class CIntBlenderDialogClient : public CValueBlenderDialogClientT<sint32>
|
||||
{
|
||||
public:
|
||||
~CIntBlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
||||
{
|
||||
CEditRangeIntWidget *erf = new CEditRangeIntWidget(parent);
|
||||
|
@ -188,6 +196,8 @@ public:
|
|||
class CRGBABlenderDialogClient : public CValueBlenderDialogClientT<NLMISC::CRGBA>
|
||||
{
|
||||
public:
|
||||
~CRGBABlenderDialogClient() {}
|
||||
|
||||
QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
||||
{
|
||||
CColorEditWidget *ce = new CColorEditWidget(parent);
|
||||
|
|
|
@ -59,6 +59,7 @@ class IValueGradientClient: public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
IValueGradientClient(QObject *parent = 0): QObject(parent) {}
|
||||
virtual ~IValueGradientClient() {}
|
||||
|
||||
virtual QWidget *createDialog(QWidget *parent) = 0;
|
||||
|
||||
|
@ -168,6 +169,7 @@ class CValueGradientClientT : public IValueGradientClient, public IPSWrapper<T>
|
|||
{
|
||||
public:
|
||||
CValueGradientClientT(QObject *parent = 0): IValueGradientClient(parent) {}
|
||||
virtual ~CValueGradientClientT() {}
|
||||
|
||||
/// the gradient being edited, must be filled by the instancier
|
||||
NL3D::CPSValueGradientFunc<T> *Scheme;
|
||||
|
@ -268,6 +270,7 @@ class CFloatGradientWrapper : public CValueGradientClientT<float>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CFloatGradientWrapper(QObject *parent = 0): CValueGradientClientT<float>(parent) {}
|
||||
~CFloatGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapperFloat *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -304,6 +307,7 @@ class CUIntGradientWrapper : public CValueGradientClientT<uint32>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CUIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<uint32>(parent) {}
|
||||
~CUIntGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapperUInt *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -340,6 +344,7 @@ class CIntGradientWrapper : public CValueGradientClientT<sint32>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CIntGradientWrapper(QObject *parent = 0): CValueGradientClientT<sint32>(parent) {}
|
||||
~CIntGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapper<sint32> *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -376,6 +381,7 @@ class CColorGradientWrapper : public CValueGradientClientT<NLMISC::CRGBA>
|
|||
Q_OBJECT
|
||||
public:
|
||||
CColorGradientWrapper(QObject *parent = 0): CValueGradientClientT<NLMISC::CRGBA>(parent) {}
|
||||
~CColorGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapper<NLMISC::CRGBA> *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -418,6 +424,7 @@ class CPlaneBasisGradientWrapper : public CValueGradientClientT<NL3D::CPlaneBasi
|
|||
Q_OBJECT
|
||||
public:
|
||||
CPlaneBasisGradientWrapper(QObject *parent = 0): CValueGradientClientT<NL3D::CPlaneBasis>(parent) {}
|
||||
~CPlaneBasisGradientWrapper() {}
|
||||
|
||||
virtual QWidget *newDialog(IPSWrapper<NL3D::CPlaneBasis> *wrapper, QWidget *parent)
|
||||
{
|
||||
|
@ -455,6 +462,8 @@ public:
|
|||
|
||||
CTextureGradientInterface(NL3D::CPSTexturedParticle *tp, CWorkspaceNode *ownerNode): Node(ownerNode), TP(tp) {}
|
||||
|
||||
~CTextureGradientInterface() {}
|
||||
|
||||
CWorkspaceNode *Node;
|
||||
NL3D::CPSTexturedParticle *TP;
|
||||
|
||||
|
|
|
@ -27,10 +27,6 @@ TARGET_LINK_LIBRARIES(object_viewer_widget_qt
|
|||
${QT_LIBRARIES}
|
||||
${QT_QTOPENGL_LIBRARY})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(object_viewer_widget_qt ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS})
|
||||
ADD_DEFINITIONS(-DQT_PLUGIN)
|
||||
ADD_DEFINITIONS(-DQT_SHARED)
|
||||
|
|
|
@ -11,10 +11,6 @@ NL_TARGET_LIB(ryzom_gameshare ${PRIV_H} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameshare ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameshare nelmisc nelnet nelligo nelgeorges ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
NL_DEFAULT_PROPS(ryzom_gameshare "Ryzom, Library: Game Share")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_gameshare)
|
||||
|
|
|
@ -4,10 +4,6 @@ NL_TARGET_LIB(ryzom_adminmodules ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_adminmodules ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_adminmodules nelmisc nelnet)
|
||||
NL_DEFAULT_PROPS(ryzom_adminmodules "Ryzom, Library: Service Admin Modules")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_adminmodules)
|
||||
|
|
|
@ -4,10 +4,6 @@ NL_TARGET_LIB(ryzom_gameplaymodule ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameplaymodule ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_gameplaymodule nelmisc)
|
||||
NL_DEFAULT_PROPS(ryzom_gameplaymodule "Ryzom, Library: Gameplay Module")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_gameplaymodule)
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(ryzom_export ${PRIV_H} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_export ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_export nelmisc nelligo nelgeorges nel3d nelpacs ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
NL_DEFAULT_PROPS(ryzom_export "Ryzom, Library, World: Export Tools")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_export)
|
||||
|
|
|
@ -5,10 +5,6 @@ NL_TARGET_LIB(ryzom_landexport ${PRIV_H} ${SRC})
|
|||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
TARGET_LINK_LIBRARIES(ryzom_landexport ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ryzom_landexport ryzom_export nelmisc nelligo nelgeorges nel3d nelpacs ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
NL_DEFAULT_PROPS(ryzom_landexport "Ryzom, Library, World: Land Export")
|
||||
NL_ADD_RUNTIME_FLAGS(ryzom_landexport)
|
||||
|
|
Loading…
Reference in a new issue