Added: Initial UI work for Zone Painter conversion.

This commit is contained in:
sfb 2011-04-06 15:45:47 -05:00
parent eaf5f1179b
commit a9a5731d86
24 changed files with 1134 additions and 1 deletions

View file

@ -4,3 +4,4 @@ ADD_SUBDIRECTORY(ovqt_sheet_builder)
ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(zone_painter)

View file

@ -0,0 +1,45 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${QT_INCLUDES})
FILE(GLOB SRC *.cpp *.h)
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
SET(OVQT_PLUG_ZONE_PAINTER_HDR zone_painter_plugin.h
qnel_widget.h
zone_painter_settings_page.h
zone_painter_main_window.h
painter_dock_widget.h)
SET(OVQT_PLUG_ZONE_PAINTER_UIS zone_painter_settings_page.ui zone_painter_main_window.ui painter_dock_widget.ui)
SET(OVQT_PLUG_ZONE_PAINTER_RCS zone_painter.qrc)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
QT4_WRAP_CPP(OVQT_PLUG_ZONE_PAINTER_MOC_SRC ${OVQT_PLUG_ZONE_PAINTER_HDR})
QT4_ADD_RESOURCES( OVQT_PLUG_ZONE_PAINTER_RC_SRCS ${OVQT_PLUG_ZONE_PAINTER_RCS})
QT4_WRAP_UI(OVQT_PLUG_ZONE_PAINTER_UI_HDRS ${OVQT_PLUG_ZONE_PAINTER_UIS})
SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_ZONE_PAINTER_UIS} ${OVQT_PLUG_ZONE_PAINTER_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_ZONE_PAINTER_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_ZONE_PAINTER_MOC_SRC} ${OVQT_PLUG_ZONE_PAINTER_RC_SRCS})
SOURCE_GROUP("Zone Painter Plugin" FILES ${SRC})
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_zone_painter MODULE ${SRC} ${OVQT_PLUG_ZONE_PAINTER_MOC_SRC} ${OVQT_PLUG_ZONE_PAINTER_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_ZONE_PAINTER_UI_HDRS})
TARGET_LINK_LIBRARIES(ovqt_plugin_zone_painter ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
NL_DEFAULT_PROPS(ovqt_plugin_zone_painter "NeL, Tools, 3D: Object Viewer Qt Plugin: Zone Painter")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_zone_painter)
NL_ADD_LIB_SUFFIX(ovqt_plugin_zone_painter)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,16 @@
#include "painter_dock_widget.h"
#include "ui_painter_dock_widget.h"
#include "qnel_widget.h"
PainterDockWidget::PainterDockWidget(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::PainterDockWidget)
{
ui->setupUi(this);
}
PainterDockWidget::~PainterDockWidget()
{
delete ui;
}

View file

@ -0,0 +1,22 @@
#ifndef PAINTER_DOCK_WIDGET_H
#define PAINTER_DOCK_WIDGET_H
#include <QDockWidget>
namespace Ui {
class PainterDockWidget;
}
class PainterDockWidget : public QDockWidget
{
Q_OBJECT
public:
explicit PainterDockWidget(QWidget *parent = 0);
~PainterDockWidget();
private:
Ui::PainterDockWidget *ui;
};
#endif // PAINTER_DOCK_WIDGET_H

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PainterDockWidget</class>
<widget class="QDockWidget" name="PainterDockWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>304</width>
<height>510</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>80</height>
</size>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="windowTitle">
<string>Painter Modes</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>480</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tileTab">
<attribute name="title">
<string>Paint Tiles</string>
</attribute>
</widget>
<widget class="QWidget" name="colorTab">
<attribute name="title">
<string>Paint Colors</string>
</attribute>
</widget>
<widget class="QWidget" name="displaceTab">
<attribute name="title">
<string>Paint Displacement</string>
</attribute>
</widget>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,197 @@
// 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 "qnel_widget.h"
// STL includes
// Qt includes
#include <QtCore/QTimer>
#include <QtGui/QResizeEvent>
// NeL includes
#include <nel/misc/event_server.h>
#include <nel/misc/debug.h>
#include <nel/3d/u_driver.h>
#include <nel/3d/driver_user.h>
namespace NLQT
{
QNLWidget::QNLWidget(QWidget *parent)
: QNeLWidget(parent),
m_driver(NULL),
m_initialized(false),
m_interval(25)
{
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
init();
#ifdef Q_OS_LINUX
makeCurrent();
#endif
m_mainTimer = new QTimer(this);
connect(m_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender()));
}
QNLWidget::~QNLWidget()
{
release();
}
void QNLWidget::init()
{
// create the driver
m_driver = NL3D::UDriver::createDriver(NULL, false, NULL);
nlassert(m_driver);
// initialize the nel 3d viewport
m_driver->setDisplay((nlWindow)winId(), NL3D::UDriver::CMode(width(), height(), 32));
// set the cache size for the font manager(in bytes)
m_driver->setFontManagerMaxMemory(2097152);
m_initialized = true;
}
void QNLWidget::release()
{
m_mainTimer->stop();
delete m_mainTimer;
if (m_initialized)
{
m_driver->release();
delete m_driver;
m_driver = NULL;
}
}
void QNLWidget::setInterval(int msec)
{
m_interval = msec;
m_mainTimer->setInterval(msec);
}
void QNLWidget::setBackgroundColor(NLMISC::CRGBA backgroundColor)
{
m_backgroundColor = backgroundColor;
}
void QNLWidget::updateRender()
{
if (isVisible())
{
if (m_initialized)
m_driver->EventServer.pump();
Q_EMIT updateData();
// Calc FPS
static sint64 lastTime = NLMISC::CTime::getPerformanceTime ();
sint64 newTime = NLMISC::CTime::getPerformanceTime ();
m_fps = float(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime));
lastTime = newTime;
if (m_initialized && !m_driver->isLost())
{
//_driver->activate();
m_driver->clearBuffers(m_backgroundColor);
Q_EMIT updatePreRender();
Q_EMIT updatePostRender();
// swap 3d buffers
m_driver->swapBuffers();
}
}
}
void QNLWidget::showEvent(QShowEvent *showEvent)
{
QWidget::showEvent(showEvent);
m_driver->activate();
m_mainTimer->start(m_interval);
}
void QNLWidget::hideEvent(QHideEvent *hideEvent)
{
m_mainTimer->stop();
QWidget::hideEvent(hideEvent);
}
#if defined(NL_OS_WINDOWS)
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
bool QNLWidget::winEvent(MSG *message, long *result)
{
if (m_driver && m_driver->isActive())
{
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(m_driver)->getDriver();
if (driver)
{
winProc proc = (winProc)driver->getWindowProc();
return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
}
}
return false;
}
#elif defined(NL_OS_MAC)
typedef bool (*cocoaProc)(NL3D::IDriver *, const void *e);
bool QNLWidget::macEvent(EventHandlerCallRef caller, EventRef event)
{
if(caller)
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
if (m_driver && m_driver->isActive())
{
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(m_driver)->getDriver();
if (driver)
{
cocoaProc proc = (cocoaProc)driver->getWindowProc();
return proc(driver, event);
}
}
return false;
}
#elif defined(NL_OS_UNIX)
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
bool QNLWidget::x11Event(XEvent *event)
{
if (m_driver && m_driver->isActive())
{
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser *>(m_driver)->getDriver();
if (driver)
{
x11Proc proc = (x11Proc)driver->getWindowProc();
return proc(driver, event);
}
}
return false;
}
#endif
} /* namespace NLQT */

View file

@ -0,0 +1,130 @@
// 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 QNEL_WIDGET_H
#define QNEL_WIDGET_H
// NeL includes
#include <nel/misc/types_nl.h>
#include <nel/misc/rgba.h>
#include <nel/misc/event_emitter.h>
// Qt includes
#include <QtOpenGL/QGLWidget>
#include <QtGui/QWidget>
class QAction;
/* TODO every platform should use QWidget */
#if defined(NL_OS_WINDOWS)
typedef QWidget QNeLWidget;
#elif defined(NL_OS_MAC)
typedef QWidget QNeLWidget;
#elif defined(NL_OS_UNIX)
typedef QGLWidget QNeLWidget;
#endif // NL_OS_UNIX
namespace NL3D
{
class UDriver;
class UScene;
}
namespace NLQT
{
/**
@class QNLWidget
@brief Responsible for interaction between Qt and NeL.
@details Automatically begins to update the render if the widget is visible
or suspends the updating of render if the widget is hidden.
*/
class QNLWidget : public QNeLWidget
{
Q_OBJECT
public:
QNLWidget(QWidget *parent);
virtual ~QNLWidget();
/// Set the update interval renderer
void setInterval(int msec);
/// Set the background color.
void setBackgroundColor(NLMISC::CRGBA backgroundColor);
float fps() const
{
return m_fps;
}
inline NLMISC::CRGBA backgroundColor() const
{
return m_backgroundColor;
}
NL3D::UDriver *driver() const
{
return m_driver;
}
virtual QPaintEngine* paintEngine() const
{
return NULL;
}
Q_SIGNALS:
void updateData();
void updatePreRender();
void updatePostRender();
private Q_SLOTS:
void updateRender();
protected:
virtual void showEvent(QShowEvent *showEvent);
virtual void hideEvent(QHideEvent *hideEvent);
#if defined(NL_OS_WINDOWS)
virtual bool winEvent(MSG *message, long *result);
#elif defined(NL_OS_MAC)
virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
#elif defined(NL_OS_UNIX)
virtual bool x11Event(XEvent *event);
#endif
private:
void init();
void release();
QNLWidget(const QNLWidget &);
QNLWidget &operator=(const QNLWidget &);
NL3D::UDriver *m_driver;
NLMISC::CRGBA m_backgroundColor;
QTimer *m_mainTimer;
bool m_initialized;
int m_interval;
float m_fps;
}; /* class QNLWidget */
} /* namespace NLQT */
#endif // QNEL_WIDGET_H

View file

@ -0,0 +1,12 @@
<RCC>
<qresource prefix="painterTools">
<file>images/color-picker-black.png</file>
<file>images/colorize.png</file>
<file>images/draw-brush.png</file>
<file>images/go-down-7.png</file>
<file>images/go-jump-4.png</file>
<file>images/lock-6.png</file>
<file>images/lock-silver.png</file>
<file>images/color-fill.png</file>
</qresource>
</RCC>

View file

@ -0,0 +1,61 @@
#include "zone_painter_main_window.h"
#include "ui_zone_painter_main_window.h"
#include "qnel_widget.h"
#include "painter_dock_widget.h"
ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ZonePainterMainWindow)
{
ui->setupUi(this);
m_nelWidget = new NLQT::QNLWidget(this);
setCentralWidget(m_nelWidget);
// Set up dock widget(s) and toolbar.
m_painterDockWidget = new PainterDockWidget(this);
addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget);
m_painterDockWidget->setVisible(true);
// Insert tool modes
_toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar);
_toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png"));
ui->painterToolBar->addAction(_toolModeMenu->menuAction());
//connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode()));
//QSignalMapper *modeMapper = new QSignalMapper(this);
_toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode"));
_toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png"));
_toolPaintModeAction->setStatusTip(tr("Set paint mode"));
//connect(_pointRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
//modeMapper->setMapping(_pointRenderModeAction, 0);
_toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode"));
_toolFillModeAction->setStatusTip(tr("Set fill mode"));
_toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png"));
//connect(_lineRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
//modeMapper->setMapping(_lineRenderModeAction, 1);
_toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode"));
_toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png"));
_toolSelectModeAction->setStatusTip(tr("Set select mode"));
//connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
//modeMapper->setMapping(_fillRenderModeAction, 2);
_toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode"));
_toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png"));
_toolPickModeAction->setStatusTip(tr("Set color picking mode"));
//connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
//modeMapper->setMapping(_fillRenderModeAction, 2);
//connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setRenderMode(int)));
}
ZonePainterMainWindow::~ZonePainterMainWindow()
{
delete ui;
delete m_nelWidget;
delete m_painterDockWidget;
}

View file

@ -0,0 +1,36 @@
#ifndef ZONE_PAINTER_MAIN_WINDOW_H
#define ZONE_PAINTER_MAIN_WINDOW_H
#include <QMainWindow>
namespace NLQT {
class QNLWidget;
}
namespace Ui {
class ZonePainterMainWindow;
}
class PainterDockWidget;
class ZonePainterMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit ZonePainterMainWindow(QWidget *parent = 0);
~ZonePainterMainWindow();
private:
Ui::ZonePainterMainWindow *ui;
NLQT::QNLWidget *m_nelWidget;
PainterDockWidget *m_painterDockWidget;
QAction *_toolPaintModeAction;
QAction *_toolFillModeAction;
QAction *_toolSelectModeAction;
QAction *_toolPickModeAction;
QMenu *_toolModeMenu;
};
#endif // ZONE_PAINTER_MAIN_WINDOW_H

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ZonePainterMainWindow</class>
<widget class="QMainWindow" name="ZonePainterMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="mainToolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="floatable">
<bool>false</bool>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionBackground_Dlg"/>
<addaction name="actionShowArrows_Dlg"/>
<addaction name="actionToggleLighting"/>
<addaction name="actionLockBorders"/>
</widget>
<widget class="QToolBar" name="painterToolBar">
<property name="windowTitle">
<string>toolBar_2</string>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="actionBackground_Dlg">
<property name="icon">
<iconset resource="zone_painter.qrc">
<normaloff>:/painterTools/images/colorize.png</normaloff>:/painterTools/images/colorize.png</iconset>
</property>
<property name="text">
<string>Background</string>
</property>
<property name="toolTip">
<string>Background Color Dialog</string>
</property>
</action>
<action name="actionShowArrows_Dlg">
<property name="icon">
<iconset resource="zone_painter.qrc">
<normaloff>:/painterTools/images/go-down-7.png</normaloff>:/painterTools/images/go-down-7.png</iconset>
</property>
<property name="text">
<string>ShowArrows</string>
</property>
<property name="toolTip">
<string>Show Landscape Orientation Arrows</string>
</property>
</action>
<action name="actionToggleLighting">
<property name="text">
<string>Toggle Lighting</string>
</property>
<property name="toolTip">
<string>Toggle automatic lighting</string>
</property>
</action>
<action name="actionLockBorders">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="zone_painter.qrc">
<normaloff>:/painterTools/images/lock-silver.png</normaloff>
<normalon>:/painterTools/images/lock-6.png</normalon>:/painterTools/images/lock-silver.png</iconset>
</property>
<property name="text">
<string>Lock Borders</string>
</property>
<property name="toolTip">
<string>Lock Landscape Borders</string>
</property>
</action>
</widget>
<resources>
<include location="zone_painter.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,123 @@
// Project includes
#include "zone_painter_plugin.h"
#include "zone_painter_settings_page.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/imenu_manager.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>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMenuBar>
namespace Plugin
{
ZonePainterPlugin::~ZonePainterPlugin()
{
Q_FOREACH(QObject *obj, _autoReleaseObjects)
{
_plugMan->removeObject(obj);
}
qDeleteAll(_autoReleaseObjects);
_autoReleaseObjects.clear();
}
bool ZonePainterPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
addAutoReleasedObject(new CZonePainterSettingsPage(this));
addAutoReleasedObject(new CZonePainterContext(this));
//addAutoReleasedObject(new CCoreListener(this));
return true;
}
void ZonePainterPlugin::extensionsInitialized()
{
Core::ICore *core = Core::ICore::instance();
Core::IMenuManager *menuManager = core->menuManager();
//menuManager = _plugMan->getObject<Core::IMenuManager>();
QAction *exampleAction1 = new QAction("Zone1", this);
QAction *exampleAction2 = new QAction("Zone2", this);
QAction *aboutQtAction = menuManager->action(Core::Constants::ABOUT_QT);
QMenu *helpMenu = menuManager->menu(Core::Constants::M_HELP);
helpMenu->insertAction(aboutQtAction, exampleAction1);
helpMenu->addSeparator();
helpMenu->addAction(exampleAction2);
QMenu *zoneMenu = menuManager->menuBar()->addMenu("ZoneMenu");
zoneMenu->insertAction(aboutQtAction, exampleAction1);
zoneMenu->addSeparator();
zoneMenu->addAction(exampleAction2);
}
void ZonePainterPlugin::setNelContext(NLMISC::INelContext *nelContext)
{
#ifdef NL_OS_WINDOWS
// Ensure that a context doesn't exist yet.
// This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
QString ZonePainterPlugin::name() const
{
return "ZonePainterPlugin";
}
QString ZonePainterPlugin::version() const
{
return "0.2";
}
QString ZonePainterPlugin::vendor() const
{
return "Ryzom Core";
}
QString ZonePainterPlugin::description() const
{
return "Zone Painter Plugin";
}
QStringList ZonePainterPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
//list.append("ObjectViewer");
return list;
}
void ZonePainterPlugin::addAutoReleasedObject(QObject *obj)
{
_plugMan->addObject(obj);
_autoReleaseObjects.prepend(obj);
}
QObject* ZonePainterPlugin::objectByName(const QString &name) const
{
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
if (qobj->objectName() == name)
return qobj;
return 0;
}
ExtensionSystem::IPluginSpec *ZonePainterPlugin::pluginByName(const QString &name) const
{
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
if (spec->name() == name)
return spec;
return 0;
}
}
Q_EXPORT_PLUGIN(Plugin::ZonePainterPlugin)

View file

@ -0,0 +1,105 @@
#ifndef ZONE_PAINTER_PLUGIN_H
#define ZONE_PAINTER_PLUGIN_H
// Project includes
#include "../../extension_system/iplugin.h"
#include "../core/icontext.h"
#include "zone_painter_main_window.h"
// NeL includes
#include "nel/misc/app_context.h"
#include <nel/3d/landscape.h>
#include <nel/3d/patch.h>
#include <nel/3d/zone.h>
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QIcon>
namespace NLMISC
{
class CLibraryContext;
}
namespace ExtensionSystem
{
class IPluginSpec;
}
namespace Plugin
{
class CZoneManager {
public:
NL3D::CZone zone;
std::string getZoneInfo() {
NL3D::CZone zone;
zone.getNumPatchs();
return "";
}
};
class ZonePainterPlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
virtual ~ZonePainterPlugin();
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
QObject *objectByName(const QString &name) const;
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
protected:
NLMISC::CLibraryContext *_LibContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
QList<QObject *> _autoReleaseObjects;
};
class CZonePainterContext: public Core::IContext
{
Q_OBJECT
public:
CZonePainterContext(QObject *parent = 0): IContext(parent) {}
virtual ~CZonePainterContext() {}
virtual QString id() const
{
return QLatin1String("ZonePainterContext");
}
virtual QString trName() const
{
return tr("Zone Painter");
}
virtual QIcon icon() const
{
return QIcon();
}
virtual QWidget *widget()
{
return new ZonePainterMainWindow();
}
};
} // namespace Plugin
#endif // ZONE_PAINTER_PLUGIN_H

View file

@ -0,0 +1,67 @@
// 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 "zone_painter_settings_page.h"
// Qt includes
#include <QtGui/QWidget>
// NeL includes
// Project includes
namespace Plugin
{
CZonePainterSettingsPage::CZonePainterSettingsPage(QObject *parent)
: IOptionsPage(parent),
_currentPage(NULL)
{
}
QString CZonePainterSettingsPage::id() const
{
return QLatin1String("ZonePainterPage");
}
QString CZonePainterSettingsPage::trName() const
{
return tr("Zone Painter page");
}
QString CZonePainterSettingsPage::category() const
{
return QLatin1String("General");
}
QString CZonePainterSettingsPage::trCategory() const
{
return tr("General");
}
QWidget *CZonePainterSettingsPage::createPage(QWidget *parent)
{
_currentPage = new QWidget(parent);
_ui.setupUi(_currentPage);
return _currentPage;
}
void CZonePainterSettingsPage::apply()
{
}
} /* namespace Plugin */

View file

@ -0,0 +1,58 @@
// 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 ZONE_PAINTER_SETTINGS_PAGE_H
#define ZONE_PAINTER_SETTINGS_PAGE_H
#include <QtCore/QObject>
#include "../core/ioptions_page.h"
#include "ui_zone_painter_settings_page.h"
class QWidget;
namespace Plugin
{
/**
@class CZonePainterSettingsPage
*/
class CZonePainterSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
CZonePainterSettingsPage(QObject *parent = 0);
virtual ~CZonePainterSettingsPage() {}
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish() {}
private:
QWidget *_currentPage;
Ui::CZonePainterSettingsPage _ui;
};
} // namespace Plugin
#endif // EXAMPLE_SETTINGS_H

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CZonePainterSettingsPage</class>
<widget class="QWidget" name="CZonePainterSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>479</height>
</rect>
</property>
<property name="windowTitle">
<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">
<string>GroupBox</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="5">
<widget class="QListView" name="listView"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QRadioButton" name="radioButton_2">
<property name="text">
<string>RadioButton</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="comboBox"/>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBox"/>
</item>
</layout>
</widget>
<resources>
<include location="../../object_viewer_qt.qrc"/>
</resources>
<connections/>
</ui>