mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-25 16:26:18 +00:00
first stage for my plugin
This commit is contained in:
parent
7ae5035662
commit
86c3b0c472
10 changed files with 909 additions and 0 deletions
|
@ -0,0 +1,41 @@
|
|||
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_TRANSLATION_MANAGER_HDR translation_manager_plugin.h
|
||||
qnel_widget.h
|
||||
simple_viewer.h
|
||||
translation_manager_settings_page.h)
|
||||
|
||||
SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui)
|
||||
|
||||
SET(QT_USE_QTGUI TRUE)
|
||||
SET(QT_USE_QTOPENGL TRUE)
|
||||
|
||||
QT4_WRAP_CPP(OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC ${OVQT_PLUG_TRANSLATION_MANAGER_HDR})
|
||||
QT4_WRAP_UI(OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS ${OVQT_PLUG_TRANSLATION_MANAGER_UIS})
|
||||
|
||||
SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_TRANSLATION_MANAGER_UIS})
|
||||
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS})
|
||||
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC})
|
||||
SOURCE_GROUP("Translation Manager Plugin" FILES ${SRC})
|
||||
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||
|
||||
ADD_LIBRARY(ovqt_plugin_translation_manager MODULE ${SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS})
|
||||
|
||||
TARGET_LINK_LIBRARIES(ovqt_plugin_translation_manager ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
|
||||
|
||||
NL_DEFAULT_PROPS(ovqt_plugin_translation_manager "NeL, Tools, 3D: Object Viewer Qt Plugin: Translation Manager")
|
||||
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_translation_manager)
|
||||
NL_ADD_LIB_SUFFIX(ovqt_plugin_translation_manager)
|
||||
|
||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||
|
||||
INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
|
@ -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 */
|
||||
|
|
@ -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
|
|
@ -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,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/>.
|
||||
|
||||
|
||||
#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 Core::ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CCoreListener(QObject *parent = 0): ICoreListener(parent) {}
|
||||
virtual ~CCoreListener() {}
|
||||
|
||||
virtual bool closeMainWindow() const;
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // SIMPLE_VIEWER_H
|
|
@ -0,0 +1,122 @@
|
|||
// Project includes
|
||||
#include "translation_manager_plugin.h"
|
||||
#include "translation_manager_settings_page.h"
|
||||
#include "simple_viewer.h"
|
||||
// Project system includes
|
||||
#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
|
||||
{
|
||||
TranslationManagerPlugin::~TranslationManagerPlugin()
|
||||
{
|
||||
Q_FOREACH(QObject *obj, _autoReleaseObjects)
|
||||
{
|
||||
_plugMan->removeObject(obj);
|
||||
}
|
||||
qDeleteAll(_autoReleaseObjects);
|
||||
_autoReleaseObjects.clear();
|
||||
}
|
||||
|
||||
bool TranslationManagerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
_plugMan = pluginManager;
|
||||
|
||||
addAutoReleasedObject(new CTranslationManagerSettingsPage(this));
|
||||
addAutoReleasedObject(new CTranslationManagerContext(this));
|
||||
addAutoReleasedObject(new CCoreListener(this));
|
||||
return true;
|
||||
}
|
||||
|
||||
void TranslationManagerPlugin::extensionsInitialized()
|
||||
{
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
Core::IMenuManager *menuManager = core->menuManager();
|
||||
//menuManager = _plugMan->getObject<Core::IMenuManager>();
|
||||
// Menu Actions for plugin
|
||||
QAction *aboutTManPlugin = new QAction("Translation Manager", this);
|
||||
// Locations
|
||||
QMenu *helpMenu = menuManager->menu(Core::Constants::M_HELP);
|
||||
QAction *aboutQtAction = menuManager->action(Core::Constants::ABOUT_QT);
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->insertAction(aboutQtAction, aboutTManPlugin);
|
||||
menuManager->menuBar()->addMenu("Translation Manager");
|
||||
}
|
||||
|
||||
void TranslationManagerPlugin::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 TranslationManagerPlugin::name() const
|
||||
{
|
||||
return "Translation Manager";
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::version() const
|
||||
{
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::vendor() const
|
||||
{
|
||||
return "cemycc";
|
||||
}
|
||||
|
||||
QString TranslationManagerPlugin::description() const
|
||||
{
|
||||
return "OVQT plugin for translation files.";
|
||||
}
|
||||
|
||||
QStringList TranslationManagerPlugin::dependencies() const
|
||||
{
|
||||
QStringList list;
|
||||
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||
list.append("ObjectViewer");
|
||||
return list;
|
||||
}
|
||||
|
||||
void TranslationManagerPlugin::addAutoReleasedObject(QObject *obj)
|
||||
{
|
||||
_plugMan->addObject(obj);
|
||||
_autoReleaseObjects.prepend(obj);
|
||||
}
|
||||
|
||||
QObject* TranslationManagerPlugin::objectByName(const QString &name) const
|
||||
{
|
||||
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
|
||||
if (qobj->objectName() == name)
|
||||
return qobj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExtensionSystem::IPluginSpec *TranslationManagerPlugin::pluginByName(const QString &name) const
|
||||
{
|
||||
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
|
||||
if (spec->name() == name)
|
||||
return spec;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(Plugin::TranslationManagerPlugin)
|
|
@ -0,0 +1,94 @@
|
|||
#ifndef TRANSLATION_MANAGER_PLUGIN_H
|
||||
#define TRANSLATION_MANAGER_PLUGIN_H
|
||||
|
||||
// Project includes
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "../core/icontext.h"
|
||||
#include "simple_viewer.h"
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/app_context.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
class CLibraryContext;
|
||||
}
|
||||
|
||||
namespace ExtensionSystem
|
||||
{
|
||||
class IPluginSpec;
|
||||
}
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class TranslationManagerPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||
public:
|
||||
|
||||
virtual ~TranslationManagerPlugin();
|
||||
|
||||
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 CTranslationManagerContext: public Core::IContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTranslationManagerContext(QObject *parent = 0): IContext(parent)
|
||||
{
|
||||
m_simpleViewer = new CSimpleViewer();
|
||||
}
|
||||
|
||||
virtual ~CTranslationManagerContext() {}
|
||||
|
||||
virtual QString id() const
|
||||
{
|
||||
return QLatin1String("TranslationManagerContext");
|
||||
}
|
||||
virtual QString trName() const
|
||||
{
|
||||
return tr("Translation Manager");
|
||||
}
|
||||
virtual QIcon icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
virtual QWidget *widget()
|
||||
{
|
||||
return m_simpleViewer;
|
||||
}
|
||||
|
||||
CSimpleViewer *m_simpleViewer;
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // TRANSLATION_MANAGER_PLUGIN_H
|
|
@ -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 "translation_manager_settings_page.h"
|
||||
|
||||
// Qt includes
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
// NeL includes
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
CTranslationManagerSettingsPage::CTranslationManagerSettingsPage(QObject *parent)
|
||||
: IOptionsPage(parent),
|
||||
_currentPage(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::id() const
|
||||
{
|
||||
return QLatin1String("TranslationManagerPage");
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::trName() const
|
||||
{
|
||||
return tr("Translation Manager page");
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::category() const
|
||||
{
|
||||
return QLatin1String("General");
|
||||
}
|
||||
|
||||
QString CTranslationManagerSettingsPage::trCategory() const
|
||||
{
|
||||
return tr("General");
|
||||
}
|
||||
|
||||
QWidget *CTranslationManagerSettingsPage::createPage(QWidget *parent)
|
||||
{
|
||||
_currentPage = new QWidget(parent);
|
||||
_ui.setupUi(_currentPage);
|
||||
return _currentPage;
|
||||
}
|
||||
|
||||
void CTranslationManagerSettingsPage::apply()
|
||||
{
|
||||
}
|
||||
|
||||
} /* namespace Plugin */
|
|
@ -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 TRANSLATION_MANAGER_SETTINGS_PAGE_H
|
||||
#define TRANSLATION_MANAGER_SETTINGS_PAGE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include "../core/ioptions_page.h"
|
||||
|
||||
#include "ui_translation_manager_settings_page.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
/**
|
||||
@class CTranslationManagerSettingsPage
|
||||
*/
|
||||
class CTranslationManagerSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CTranslationManagerSettingsPage(QObject *parent = 0);
|
||||
virtual ~CTranslationManagerSettingsPage() {}
|
||||
|
||||
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::CTranslationManagerSettingsPage _ui;
|
||||
};
|
||||
|
||||
} // namespace Plugin
|
||||
|
||||
#endif // TRANSLATION_MANAGER_SETTINGS_H
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CTranslationManagerSettingsPage</class>
|
||||
<widget class="QWidget" name="CTranslationManagerSettingsPage">
|
||||
<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>
|
Loading…
Reference in a new issue