Changed: #1193 Updated other plugins with latest API changes to OVQT plugin system. Added the plugin-spec files for each plugin.

This commit is contained in:
dnk-88 2011-09-26 02:32:14 +03:00
parent 9a420946f8
commit 16300c5776
35 changed files with 256 additions and 486 deletions

View file

@ -223,7 +223,7 @@ void PluginSpec::parseDependency(QXmlStreamReader &reader)
.arg(PLUGIN_SPEC_DEPENDENCY_NAME)); .arg(PLUGIN_SPEC_DEPENDENCY_NAME));
return; return;
} }
// Read version dependency plugin // TODO: Read version dependency plugin
QString dependencyVersion = reader.attributes().value(PLUGIN_SPEC_DEPENDENCY_VERSION).toString(); QString dependencyVersion = reader.attributes().value(PLUGIN_SPEC_DEPENDENCY_VERSION).toString();
m_dependencies.push_back(dependencyName); m_dependencies.push_back(dependencyName);

View file

@ -28,7 +28,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_disp_sheet_id MODULE ${SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS}) ADD_LIBRARY(ovqt_plugin_disp_sheet_id MODULE ${SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS})
TARGET_LINK_LIBRARIES(ovqt_plugin_disp_sheet_id ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES}) TARGET_LINK_LIBRARIES(ovqt_plugin_disp_sheet_id ovqt_plugin_core nelmisc ${QT_LIBRARIES})
IF(WITH_STLPORT) IF(WITH_STLPORT)
TARGET_LINK_LIBRARIES(ovqt_plugin_disp_sheet_id ${CMAKE_THREAD_LIBS_INIT}) TARGET_LINK_LIBRARIES(ovqt_plugin_disp_sheet_id ${CMAKE_THREAD_LIBS_INIT})

View file

@ -18,7 +18,7 @@
#include "disp_sheet_id_plugin.h" #include "disp_sheet_id_plugin.h"
#include "sheet_id_view.h" #include "sheet_id_view.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
// Qt includes // Qt includes
@ -37,13 +37,13 @@ using namespace SheetIdViewPlugin;
bool DispSheetIdPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) bool DispSheetIdPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{ {
Q_UNUSED(errorString); Q_UNUSED(errorString);
_plugMan = pluginManager; m_plugMan = pluginManager;
return true; return true;
} }
void DispSheetIdPlugin::extensionsInitialized() void DispSheetIdPlugin::extensionsInitialized()
{ {
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); Core::MenuManager *menuManager = Core::ICore::instance()->menuManager();
QMenu *sheetMenu = menuManager->menu(Core::Constants::M_SHEET); QMenu *sheetMenu = menuManager->menu(Core::Constants::M_SHEET);
QAction *sheetIdViewAction = sheetMenu->addAction(tr("Sheet id view")); QAction *sheetIdViewAction = sheetMenu->addAction(tr("Sheet id view"));
@ -67,34 +67,7 @@ void DispSheetIdPlugin::setNelContext(NLMISC::INelContext *nelContext)
// This only applies to platforms without PIC, e.g. Windows. // This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised()); nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
_LibContext = new NLMISC::CLibraryContext(*nelContext); m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
QString DispSheetIdPlugin::name() const
{
return "Display sheet id";
}
QString DispSheetIdPlugin::version() const
{
return "1.0";
}
QString DispSheetIdPlugin::vendor() const
{
return "pemeon";
}
QString DispSheetIdPlugin::description() const
{
return "Display sheet id";
}
QStringList DispSheetIdPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
} }
Q_EXPORT_PLUGIN(DispSheetIdPlugin) Q_EXPORT_PLUGIN(DispSheetIdPlugin)

View file

@ -28,11 +28,6 @@ namespace NLMISC
class CLibraryContext; class CLibraryContext;
} }
namespace NLQT
{
class IPluginSpec;
}
namespace SheetIdViewPlugin namespace SheetIdViewPlugin
{ {
@ -44,23 +39,16 @@ public:
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext); void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
private Q_SLOTS: private Q_SLOTS:
void execMessageBox(); void execMessageBox();
protected: protected:
NLMISC::CLibraryContext *_LibContext; NLMISC::CLibraryContext *m_LibContext;
private: private:
ExtensionSystem::IPluginManager *_plugMan; ExtensionSystem::IPluginManager *m_plugMan;
}; };

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_disp_sheet_id</library-name>
<name>DisplaySheetId</name>
<version>1.0</version>
<vendor>pemeon</vendor>
<description>Display sheet id.</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -9,7 +9,7 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h) ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
SET(OVQT_PLUG_EXAMPLE_HDR plugin1.h SET(OVQT_PLUG_EXAMPLE_HDR example_plugin.h
qnel_widget.h qnel_widget.h
simple_viewer.h simple_viewer.h
example_settings_page.h) example_settings_page.h)

View file

@ -0,0 +1,83 @@
// Project includes
#include "example_plugin.h"
#include "example_settings_page.h"
#include "simple_viewer.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/menu_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
{
ExamplePlugin::ExamplePlugin()
{
}
ExamplePlugin::~ExamplePlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
}
bool ExamplePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
addAutoReleasedObject(new ExampleSettingsPage(this));
addAutoReleasedObject(new ExampleContext(this));
addAutoReleasedObject(new ExampleCoreListener(this));
return true;
}
void ExamplePlugin::extensionsInitialized()
{
Core::ICore *core = Core::ICore::instance();
Core::MenuManager *menuManager = core->menuManager();
QAction *exampleAction1 = new QAction("Example1", this);
QAction *exampleAction2 = new QAction("Example2", 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);
menuManager->menuBar()->addMenu("ExampleMenu");
}
void ExamplePlugin::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
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
void ExamplePlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
}
Q_EXPORT_PLUGIN(Plugin::ExamplePlugin)

View file

@ -18,56 +18,41 @@ namespace NLMISC
class CLibraryContext; class CLibraryContext;
} }
namespace ExtensionSystem
{
class IPluginSpec;
}
namespace Plugin namespace Plugin
{ {
class MyPlugin : public QObject, public ExtensionSystem::IPlugin class ExamplePlugin : public QObject, public ExtensionSystem::IPlugin
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin) Q_INTERFACES(ExtensionSystem::IPlugin)
public: public:
ExamplePlugin();
virtual ~MyPlugin(); virtual ~ExamplePlugin();
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext); void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj); void addAutoReleasedObject(QObject *obj);
QObject *objectByName(const QString &name) const;
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
protected: protected:
NLMISC::CLibraryContext *_LibContext; NLMISC::CLibraryContext *m_LibContext;
private: private:
ExtensionSystem::IPluginManager *_plugMan; ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> _autoReleaseObjects; QList<QObject *> m_autoReleaseObjects;
}; };
class CExampleContext: public Core::IContext class ExampleContext: public Core::IContext
{ {
Q_OBJECT Q_OBJECT
public: public:
CExampleContext(QObject *parent = 0): IContext(parent) ExampleContext(QObject *parent = 0): IContext(parent)
{ {
m_simpleViewer = new CSimpleViewer(); m_simpleViewer = new SimpleViewer();
} }
virtual ~CExampleContext() {} virtual ~ExampleContext() {}
virtual QString id() const virtual QString id() const
{ {
@ -95,7 +80,7 @@ public:
{ {
} }
CSimpleViewer *m_simpleViewer; SimpleViewer *m_simpleViewer;
}; };
} // namespace Plugin } // namespace Plugin

View file

@ -27,45 +27,45 @@
namespace Plugin namespace Plugin
{ {
CExampleSettingsPage::CExampleSettingsPage(QObject *parent) ExampleSettingsPage::ExampleSettingsPage(QObject *parent)
: IOptionsPage(parent), : IOptionsPage(parent),
_currentPage(NULL) m_currentPage(0)
{ {
} }
QString CExampleSettingsPage::id() const QString ExampleSettingsPage::id() const
{ {
return QLatin1String("ExamplePage"); return QLatin1String("ExamplePage");
} }
QString CExampleSettingsPage::trName() const QString ExampleSettingsPage::trName() const
{ {
return tr("Example page"); return tr("Example page");
} }
QString CExampleSettingsPage::category() const QString ExampleSettingsPage::category() const
{ {
return QLatin1String("General"); return QLatin1String("Example");
} }
QString CExampleSettingsPage::trCategory() const QString ExampleSettingsPage::trCategory() const
{ {
return tr("General"); return tr("Example");
} }
QIcon CExampleSettingsPage::categoryIcon() const QIcon ExampleSettingsPage::categoryIcon() const
{ {
return QIcon(); return QIcon();
} }
QWidget *CExampleSettingsPage::createPage(QWidget *parent) QWidget *ExampleSettingsPage::createPage(QWidget *parent)
{ {
_currentPage = new QWidget(parent); m_currentPage = new QWidget(parent);
_ui.setupUi(_currentPage); m_ui.setupUi(m_currentPage);
return _currentPage; return m_currentPage;
} }
void CExampleSettingsPage::apply() void ExampleSettingsPage::apply()
{ {
} }

View file

@ -29,15 +29,13 @@ class QWidget;
namespace Plugin namespace Plugin
{ {
/**
@class CExampleSettingsPage class ExampleSettingsPage : public Core::IOptionsPage
*/
class CExampleSettingsPage : public Core::IOptionsPage
{ {
Q_OBJECT Q_OBJECT
public: public:
CExampleSettingsPage(QObject *parent = 0); ExampleSettingsPage(QObject *parent = 0);
virtual ~CExampleSettingsPage() {} virtual ~ExampleSettingsPage() {}
virtual QString id() const; virtual QString id() const;
virtual QString trName() const; virtual QString trName() const;
@ -50,8 +48,8 @@ public:
virtual void finish() {} virtual void finish() {}
private: private:
QWidget *_currentPage; QWidget *m_currentPage;
Ui::CExampleSettingsPage _ui; Ui::ExampleSettingsPage m_ui;
}; };
} // namespace Plugin } // namespace Plugin

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>CExampleSettingsPage</class> <class>ExampleSettingsPage</class>
<widget class="QWidget" name="CExampleSettingsPage"> <widget class="QWidget" name="ExampleSettingsPage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_example</library-name>
<name>ExamplePlugin</name>
<version>0.2</version>
<vendor>dnk-88</vendor>
<description>Example ovqt plugin.</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -1,120 +0,0 @@
// Project includes
#include "plugin1.h"
#include "example_settings_page.h"
#include "simple_viewer.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
{
MyPlugin::~MyPlugin()
{
Q_FOREACH(QObject *obj, _autoReleaseObjects)
{
_plugMan->removeObject(obj);
}
qDeleteAll(_autoReleaseObjects);
_autoReleaseObjects.clear();
}
bool MyPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
addAutoReleasedObject(new CExampleSettingsPage(this));
addAutoReleasedObject(new CExampleContext(this));
addAutoReleasedObject(new CCoreListener(this));
return true;
}
void MyPlugin::extensionsInitialized()
{
Core::ICore *core = Core::ICore::instance();
Core::IMenuManager *menuManager = core->menuManager();
//menuManager = _plugMan->getObject<Core::IMenuManager>();
QAction *exampleAction1 = new QAction("Example1", this);
QAction *exampleAction2 = new QAction("Example2", 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);
menuManager->menuBar()->addMenu("ExampleMenu");
}
void MyPlugin::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 MyPlugin::name() const
{
return "ExamplePlugin";
}
QString MyPlugin::version() const
{
return "0.2";
}
QString MyPlugin::vendor() const
{
return "dnk-88";
}
QString MyPlugin::description() const
{
return "Example ovqt plugin.";
}
QStringList MyPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
void MyPlugin::addAutoReleasedObject(QObject *obj)
{
_plugMan->addObject(obj);
_autoReleaseObjects.prepend(obj);
}
QObject* MyPlugin::objectByName(const QString &name) const
{
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
if (qobj->objectName() == name)
return qobj;
return 0;
}
ExtensionSystem::IPluginSpec *MyPlugin::pluginByName(const QString &name) const
{
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
if (spec->name() == name)
return spec;
return 0;
}
}
Q_EXPORT_PLUGIN(Plugin::MyPlugin)

View file

@ -29,19 +29,19 @@
namespace Plugin namespace Plugin
{ {
CSimpleViewer::CSimpleViewer(QWidget *parent) SimpleViewer::SimpleViewer(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
QGridLayout *gridLayout = new QGridLayout(this); QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->setObjectName(QString::fromUtf8("gridLayoutSimpleViewer")); gridLayout->setObjectName(QString::fromUtf8("gridLayoutSimpleViewer"));
gridLayout->setContentsMargins(0, 0, 0, 0); gridLayout->setContentsMargins(0, 0, 0, 0);
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(this); NLQT::QNLWidget *m_nelWidget = new NLQT::QNLWidget(this);
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1); gridLayout->addWidget(m_nelWidget, 0, 0, 1, 1);
m_undoStack = new QUndoStack(this); m_undoStack = new QUndoStack(this);
} }
bool CCoreListener::closeMainWindow() const bool ExampleCoreListener::closeMainWindow() const
{ {
int ret = QMessageBox::question(0, tr("Example close event hook"), int ret = QMessageBox::question(0, tr("Example close event hook"),
tr("Do you want to close window?"), tr("Do you want to close window?"),

View file

@ -31,22 +31,22 @@ class QWidget;
namespace Plugin namespace Plugin
{ {
class CSimpleViewer : public QWidget class SimpleViewer : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
CSimpleViewer(QWidget *parent = 0); SimpleViewer(QWidget *parent = 0);
virtual ~CSimpleViewer() {} virtual ~SimpleViewer() {}
QUndoStack *m_undoStack; QUndoStack *m_undoStack;
}; };
class CCoreListener : public Core::ICoreListener class ExampleCoreListener : public Core::ICoreListener
{ {
Q_OBJECT Q_OBJECT
public: public:
CCoreListener(QObject *parent = 0): ICoreListener(parent) {} ExampleCoreListener(QObject *parent = 0): ICoreListener(parent) {}
virtual ~CCoreListener() {} virtual ~ExampleCoreListener() {}
virtual bool closeMainWindow() const; virtual bool closeMainWindow() const;
}; };

View file

@ -21,7 +21,7 @@
#include "georges_treeview_dialog.h" #include "georges_treeview_dialog.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
// NeL includes // NeL includes
@ -63,7 +63,7 @@ namespace Plugin
m_undoStack = new QUndoStack(this); m_undoStack = new QUndoStack(this);
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); Core::MenuManager *menuManager = Core::ICore::instance()->menuManager();
m_openAction = menuManager->action(Core::Constants::OPEN); m_openAction = menuManager->action(Core::Constants::OPEN);
m_newAction = new QAction(tr("&New..."), this); m_newAction = new QAction(tr("&New..."), this);

View file

@ -67,35 +67,6 @@ void GeorgesEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
m_libContext = new NLMISC::CLibraryContext(*nelContext); m_libContext = new NLMISC::CLibraryContext(*nelContext);
} }
QString GeorgesEditorPlugin::name() const
{
return tr("Georges Editor");
}
QString GeorgesEditorPlugin::version() const
{
return "0.4";
}
QString GeorgesEditorPlugin::vendor() const
{
return "aquiles";
}
QString GeorgesEditorPlugin::description() const
{
return tr("Tool to create & edit sheets or forms.");
}
QStringList GeorgesEditorPlugin::dependencies() const
{
QStringList list;
// TODO
//list.append(Core::Constants::OVQT_CORE_PLUGIN);
//list.append("ObjectViewer");
return list;
}
void GeorgesEditorPlugin::addAutoReleasedObject(QObject *obj) void GeorgesEditorPlugin::addAutoReleasedObject(QObject *obj)
{ {
m_plugMan->addObject(obj); m_plugMan->addObject(obj);

View file

@ -52,15 +52,8 @@ public:
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void shutdown(); void shutdown();
void setNelContext(NLMISC::INelContext *nelContext); void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj); void addAutoReleasedObject(QObject *obj);
protected: protected:

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_georges_editor</library-name>
<name>GeorgesEditor</name>
<version>0.4</version>
<vendor>aquiles</vendor>
<description>Tool to create and edit sheets or forms.</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_log</library-name>
<name>LogPlugin</name>
<version>1.1</version>
<vendor>aquiles</vendor>
<description>DockWidget to display all log messages from NeL.</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -16,7 +16,7 @@
#include <QTableWidgetItem> #include <QTableWidgetItem>
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
#include <nel/misc/common.h> #include <nel/misc/common.h>

View file

@ -2,7 +2,7 @@
#include "mission_compiler_plugin.h" #include "mission_compiler_plugin.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h" #include "../../extension_system/iplugin_spec.h"
// NeL includes // NeL includes
@ -24,18 +24,18 @@ namespace MissionCompiler
MissionCompilerPlugin::~MissionCompilerPlugin() MissionCompilerPlugin::~MissionCompilerPlugin()
{ {
Q_FOREACH(QObject *obj, _autoReleaseObjects) Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{ {
_plugMan->removeObject(obj); m_plugMan->removeObject(obj);
} }
qDeleteAll(_autoReleaseObjects); qDeleteAll(m_autoReleaseObjects);
_autoReleaseObjects.clear(); m_autoReleaseObjects.clear();
} }
bool MissionCompilerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) bool MissionCompilerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{ {
Q_UNUSED(errorString); Q_UNUSED(errorString);
_plugMan = pluginManager; m_plugMan = pluginManager;
addAutoReleasedObject(new MissionCompilerSettingsPage(this)); addAutoReleasedObject(new MissionCompilerSettingsPage(this));
addAutoReleasedObject(new CMissionCompilerContext(this)); addAutoReleasedObject(new CMissionCompilerContext(this));
@ -47,18 +47,7 @@ void MissionCompilerPlugin::extensionsInitialized()
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
QSettings *settings = Core::ICore::instance()->settings(); QSettings *settings = Core::ICore::instance()->settings();
Core::IMenuManager *menuManager = core->menuManager(); Core::MenuManager *menuManager = core->menuManager();
//menuManager = _plugMan->getObject<Core::IMenuManager>();
//QAction *exampleAction1 = new QAction("Zone1", this);
//QAction *exampleAction2 = new QAction("Zone2", this);
//QMenu *toolsMenu = menuManager->menu(Core::Constants::M_TOOLS);
//helpMenu->insertAction(aboutQtAction, exampleAction1);
//helpMenu->addSeparator();
//helpMenu->addAction(exampleAction2);
//QMenu *zoneMenu = menuManager->menuBar()->addMenu("ZoneMenu");
//zoneMenu->insertAction(aboutQtAction, exampleAction1);
//zoneMenu->addSeparator();
//zoneMenu->addAction(exampleAction2);
// Initialize Ligo. // Initialize Ligo.
//settings->beginGroup(Core::Constants::DATA_PATH_SECTION); //settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
@ -73,57 +62,13 @@ void MissionCompilerPlugin::setNelContext(NLMISC::INelContext *nelContext)
// This only applies to platforms without PIC, e.g. Windows. // This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised()); nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
_LibContext = new NLMISC::CLibraryContext(*nelContext); m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
QString MissionCompilerPlugin::name() const
{
return "MissionCompilerPlugin";
}
QString MissionCompilerPlugin::version() const
{
return "0.1";
}
QString MissionCompilerPlugin::vendor() const
{
return "Ryzom Core";
}
QString MissionCompilerPlugin::description() const
{
return "Mission Compiler Plugin";
}
QStringList MissionCompilerPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
//list.append("ObjectViewer");
return list;
} }
void MissionCompilerPlugin::addAutoReleasedObject(QObject *obj) void MissionCompilerPlugin::addAutoReleasedObject(QObject *obj)
{ {
_plugMan->addObject(obj); m_plugMan->addObject(obj);
_autoReleaseObjects.prepend(obj); m_autoReleaseObjects.prepend(obj);
}
QObject* MissionCompilerPlugin::objectByName(const QString &name) const
{
Q_FOREACH (QObject *qobj, _plugMan->allObjects())
if (qobj->objectName() == name)
return qobj;
return 0;
}
ExtensionSystem::IPluginSpec *MissionCompilerPlugin::pluginByName(const QString &name) const
{
Q_FOREACH (ExtensionSystem::IPluginSpec *spec, _plugMan->plugins())
if (spec->name() == name)
return spec;
return 0;
} }
} }

View file

@ -37,26 +37,16 @@ public:
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext); void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj); void addAutoReleasedObject(QObject *obj);
QObject *objectByName(const QString &name) const;
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
protected: protected:
NLMISC::CLibraryContext *_LibContext; NLMISC::CLibraryContext *m_LibContext;
private: private:
ExtensionSystem::IPluginManager *_plugMan; ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> _autoReleaseObjects; QList<QObject *> m_autoReleaseObjects;
}; };
class CMissionCompilerContext: public Core::IContext class CMissionCompilerContext: public Core::IContext

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_mission_compiler</library-name>
<name>MissionCompiler</name>
<version>0.1</version>
<vendor>Ryzom Core</vendor>
<description>Mission Compiler Plugin</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_sheet_builder</library-name>
<name>SheetBuilder</name>
<version>1.0</version>
<vendor>kharvd</vendor>
<description>make_sheet_id equivalent</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -19,7 +19,7 @@
#include "sheetbuilderdialog.h" #include "sheetbuilderdialog.h"
#include "sheetbuilderconfgdialog.h" #include "sheetbuilderconfgdialog.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
// NeL includes // NeL includes
@ -38,14 +38,14 @@ using namespace Plugin;
bool SheetBuilderPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) bool SheetBuilderPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{ {
Q_UNUSED(errorString); Q_UNUSED(errorString);
_plugMan = pluginManager; m_plugMan = pluginManager;
return true; return true;
} }
void SheetBuilderPlugin::extensionsInitialized() void SheetBuilderPlugin::extensionsInitialized()
{ {
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); Core::MenuManager *menuManager = Core::ICore::instance()->menuManager();
QMenu *sheetMenu = menuManager->menu(Core::Constants::M_SHEET); QMenu *sheetMenu = menuManager->menu(Core::Constants::M_SHEET);
QAction *sheetBuilderAction = sheetMenu->addAction(tr("Sheet builder")); QAction *sheetBuilderAction = sheetMenu->addAction(tr("Sheet builder"));
@ -69,34 +69,7 @@ void SheetBuilderPlugin::setNelContext(NLMISC::INelContext *nelContext)
// This only applies to platforms without PIC, e.g. Windows. // This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised()); nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
_LibContext = new NLMISC::CLibraryContext(*nelContext); m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
QString SheetBuilderPlugin::name() const
{
return "Sheet builder";
}
QString SheetBuilderPlugin::version() const
{
return "1.0";
}
QString SheetBuilderPlugin::vendor() const
{
return "kharvd";
}
QString SheetBuilderPlugin::description() const
{
return "make_sheet_id equivalent";
}
QStringList SheetBuilderPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
} }
Q_EXPORT_PLUGIN(SheetBuilderPlugin) Q_EXPORT_PLUGIN(SheetBuilderPlugin)

View file

@ -28,11 +28,6 @@ namespace NLMISC
class CLibraryContext; class CLibraryContext;
} }
namespace ExtensionSystem
{
class IPluginSpec;
}
namespace Plugin namespace Plugin
{ {
@ -43,25 +38,18 @@ class SheetBuilderPlugin : public QObject, public ExtensionSystem::IPlugin
public: public:
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext); void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void buildSheet(bool clean); void buildSheet(bool clean);
private Q_SLOTS: private Q_SLOTS:
void execBuilderDialog(); void execBuilderDialog();
protected: protected:
NLMISC::CLibraryContext *_LibContext; NLMISC::CLibraryContext *m_LibContext;
private: private:
ExtensionSystem::IPluginManager *_plugMan; ExtensionSystem::IPluginManager *m_plugMan;
}; };

View file

@ -0,0 +1,10 @@
<plugin-spec>
<library-name>ovqt_plugin_zone_painter</library-name>
<name>ZonePainter</name>
<version>0.0</version>
<vendor>Ryzom Core</vendor>
<description>Zone Painter Plugin</description>
<dependencies>
<dependency plugin-name="Core" version="0.8"/>
</dependencies>
</plugin-spec>

View file

@ -11,7 +11,7 @@
#include "painter_dock_widget.h" #include "painter_dock_widget.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) :
@ -145,6 +145,7 @@ void ZonePainterMainWindow::loadConfig() {
QColor color; QColor color;
color = settings->value("BackgroundColor", QColor(80, 80, 80)).value<QColor>(); color = settings->value("BackgroundColor", QColor(80, 80, 80)).value<QColor>();
settings->endGroup();
m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha()));
} }

View file

@ -3,7 +3,7 @@
#include "zone_painter_settings_page.h" #include "zone_painter_settings_page.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/core_constants.h" #include "../core/core_constants.h"
#include "../core/imenu_manager.h" #include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h" #include "../../extension_system/iplugin_spec.h"
// NeL includes // NeL includes
@ -19,22 +19,22 @@
namespace Plugin namespace Plugin
{ {
NLMISC_SAFE_SINGLETON_IMPL(CZoneManager) // NLMISC_SAFE_SINGLETON_IMPL(CZoneManager)
ZonePainterPlugin::~ZonePainterPlugin() ZonePainterPlugin::~ZonePainterPlugin()
{ {
Q_FOREACH(QObject *obj, _autoReleaseObjects) Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{ {
_plugMan->removeObject(obj); m_plugMan->removeObject(obj);
} }
qDeleteAll(_autoReleaseObjects); qDeleteAll(m_autoReleaseObjects);
_autoReleaseObjects.clear(); m_autoReleaseObjects.clear();
} }
bool ZonePainterPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) bool ZonePainterPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{ {
Q_UNUSED(errorString); Q_UNUSED(errorString);
_plugMan = pluginManager; m_plugMan = pluginManager;
addAutoReleasedObject(new CZonePainterSettingsPage(this)); addAutoReleasedObject(new CZonePainterSettingsPage(this));
addAutoReleasedObject(new CZonePainterContext(this)); addAutoReleasedObject(new CZonePainterContext(this));
@ -45,19 +45,7 @@ bool ZonePainterPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage
void ZonePainterPlugin::extensionsInitialized() void ZonePainterPlugin::extensionsInitialized()
{ {
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
Core::IMenuManager *menuManager = core->menuManager(); Core::MenuManager *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) void ZonePainterPlugin::setNelContext(NLMISC::INelContext *nelContext)
@ -67,57 +55,13 @@ void ZonePainterPlugin::setNelContext(NLMISC::INelContext *nelContext)
// This only applies to platforms without PIC, e.g. Windows. // This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised()); nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
_LibContext = new NLMISC::CLibraryContext(*nelContext); m_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) void ZonePainterPlugin::addAutoReleasedObject(QObject *obj)
{ {
_plugMan->addObject(obj); m_plugMan->addObject(obj);
_autoReleaseObjects.prepend(obj); m_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;
} }
} }

View file

@ -31,7 +31,7 @@ class IPluginSpec;
namespace Plugin namespace Plugin
{ {
class CZoneManager /* class CZoneManager
{ {
NLMISC_SAFE_SINGLETON_DECL(CZoneManager) NLMISC_SAFE_SINGLETON_DECL(CZoneManager)
public: public:
@ -41,7 +41,7 @@ namespace Plugin
NL3D::CLandscapeModel *m_painterLandscape; NL3D::CLandscapeModel *m_painterLandscape;
NL3D::CZone *m_currentZone; NL3D::CZone *m_currentZone;
}; };
*/
class ZonePainterPlugin : public QObject, public ExtensionSystem::IPlugin class ZonePainterPlugin : public QObject, public ExtensionSystem::IPlugin
{ {
Q_OBJECT Q_OBJECT
@ -52,28 +52,16 @@ public:
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized(); void extensionsInitialized();
void setNelContext(NLMISC::INelContext *nelContext); void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj); void addAutoReleasedObject(QObject *obj);
QObject *objectByName(const QString &name) const;
ExtensionSystem::IPluginSpec *pluginByName(const QString &name) const;
protected: protected:
NLMISC::CLibraryContext *_LibContext; NLMISC::CLibraryContext *m_LibContext;
private: private:
ExtensionSystem::IPluginManager *_plugMan; ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> _autoReleaseObjects; QList<QObject *> m_autoReleaseObjects;
}; };
class CZonePainterContext: public Core::IContext class CZonePainterContext: public Core::IContext