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 7471561ba0
commit 5f8789e98f
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));
return;
}
// Read version dependency plugin
// TODO: Read version dependency plugin
QString dependencyVersion = reader.attributes().value(PLUGIN_SPEC_DEPENDENCY_VERSION).toString();
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})
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)
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 "sheet_id_view.h"
#include "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
// Qt includes
@ -37,13 +37,13 @@ using namespace SheetIdViewPlugin;
bool DispSheetIdPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
m_plugMan = pluginManager;
return true;
}
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);
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.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
_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;
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
Q_EXPORT_PLUGIN(DispSheetIdPlugin)

View file

@ -28,11 +28,6 @@ namespace NLMISC
class CLibraryContext;
}
namespace NLQT
{
class IPluginSpec;
}
namespace SheetIdViewPlugin
{
@ -44,23 +39,16 @@ public:
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;
private Q_SLOTS:
void execMessageBox();
protected:
NLMISC::CLibraryContext *_LibContext;
NLMISC::CLibraryContext *m_LibContext;
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

@ -65,8 +65,8 @@ void SheetIdView::pushToTable()
m_ui.table->setColumnCount(2);
for (size_t i = 0; i < m_sheetList.size(); i++)
{
QTableWidgetItem* item1 = new QTableWidgetItem(QString(m_sheetList[i].toString().c_str()));
QTableWidgetItem* item2 = new QTableWidgetItem(QString("%1").arg(m_sheetList[i].asInt()));
QTableWidgetItem *item1 = new QTableWidgetItem(QString(m_sheetList[i].toString().c_str()));
QTableWidgetItem *item2 = new QTableWidgetItem(QString("%1").arg(m_sheetList[i].asInt()));
m_ui.table->setItem(i,1,item1);
m_ui.table->setItem(i,2,item2);
}

View file

@ -9,10 +9,10 @@ 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_spec.h)
SET(OVQT_PLUG_EXAMPLE_HDR plugin1.h
qnel_widget.h
simple_viewer.h
example_settings_page.h)
SET(OVQT_PLUG_EXAMPLE_HDR example_plugin.h
qnel_widget.h
simple_viewer.h
example_settings_page.h)
SET(OVQT_PLUG_EXAMPLE_UIS example_settings_page.ui)

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;
}
namespace ExtensionSystem
{
class IPluginSpec;
}
namespace Plugin
{
class MyPlugin : public QObject, public ExtensionSystem::IPlugin
class ExamplePlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
virtual ~MyPlugin();
ExamplePlugin();
virtual ~ExamplePlugin();
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;
NLMISC::CLibraryContext *m_LibContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
QList<QObject *> _autoReleaseObjects;
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
};
class CExampleContext: public Core::IContext
class ExampleContext: public Core::IContext
{
Q_OBJECT
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
{
@ -95,7 +80,7 @@ public:
{
}
CSimpleViewer *m_simpleViewer;
SimpleViewer *m_simpleViewer;
};
} // namespace Plugin

View file

@ -27,45 +27,45 @@
namespace Plugin
{
CExampleSettingsPage::CExampleSettingsPage(QObject *parent)
ExampleSettingsPage::ExampleSettingsPage(QObject *parent)
: IOptionsPage(parent),
_currentPage(NULL)
m_currentPage(0)
{
}
QString CExampleSettingsPage::id() const
QString ExampleSettingsPage::id() const
{
return QLatin1String("ExamplePage");
}
QString CExampleSettingsPage::trName() const
QString ExampleSettingsPage::trName() const
{
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();
}
QWidget *CExampleSettingsPage::createPage(QWidget *parent)
QWidget *ExampleSettingsPage::createPage(QWidget *parent)
{
_currentPage = new QWidget(parent);
_ui.setupUi(_currentPage);
return _currentPage;
m_currentPage = new QWidget(parent);
m_ui.setupUi(m_currentPage);
return m_currentPage;
}
void CExampleSettingsPage::apply()
void ExampleSettingsPage::apply()
{
}

View file

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

View file

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

@ -82,7 +82,7 @@ public:
return m_driver;
}
virtual QPaintEngine* paintEngine() const
virtual QPaintEngine *paintEngine() const
{
return NULL;
}

View file

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

View file

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

View file

@ -21,7 +21,7 @@
#include "georges_treeview_dialog.h"
#include "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
// NeL includes
@ -63,7 +63,7 @@ namespace Plugin
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_newAction = new QAction(tr("&New..."), this);

View file

@ -67,35 +67,6 @@ void GeorgesEditorPlugin::setNelContext(NLMISC::INelContext *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)
{
m_plugMan->addObject(obj);

View file

@ -52,15 +52,8 @@ public:
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized();
void shutdown();
void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
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 "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
#include <nel/misc/common.h>

View file

@ -2,7 +2,7 @@
#include "mission_compiler_plugin.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h"
// NeL includes
@ -24,18 +24,18 @@ namespace MissionCompiler
MissionCompilerPlugin::~MissionCompilerPlugin()
{
Q_FOREACH(QObject *obj, _autoReleaseObjects)
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
_plugMan->removeObject(obj);
m_plugMan->removeObject(obj);
}
qDeleteAll(_autoReleaseObjects);
_autoReleaseObjects.clear();
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
}
bool MissionCompilerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
m_plugMan = pluginManager;
addAutoReleasedObject(new MissionCompilerSettingsPage(this));
addAutoReleasedObject(new CMissionCompilerContext(this));
@ -47,18 +47,7 @@ void MissionCompilerPlugin::extensionsInitialized()
{
Core::ICore *core = Core::ICore::instance();
QSettings *settings = Core::ICore::instance()->settings();
Core::IMenuManager *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);
Core::MenuManager *menuManager = core->menuManager();
// Initialize Ligo.
//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.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
_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;
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
void MissionCompilerPlugin::addAutoReleasedObject(QObject *obj)
{
_plugMan->addObject(obj);
_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;
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
}

View file

@ -37,26 +37,16 @@ public:
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;
NLMISC::CLibraryContext *m_LibContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
QList<QObject *> _autoReleaseObjects;
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
};
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 "sheetbuilderconfgdialog.h"
#include "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
// NeL includes
@ -38,14 +38,14 @@ using namespace Plugin;
bool SheetBuilderPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
m_plugMan = pluginManager;
return true;
}
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);
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.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
_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;
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
Q_EXPORT_PLUGIN(SheetBuilderPlugin)

View file

@ -28,11 +28,6 @@ namespace NLMISC
class CLibraryContext;
}
namespace ExtensionSystem
{
class IPluginSpec;
}
namespace Plugin
{
@ -43,25 +38,18 @@ class SheetBuilderPlugin : public QObject, public ExtensionSystem::IPlugin
public:
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 buildSheet(bool clean);
private Q_SLOTS:
void execBuilderDialog();
protected:
NLMISC::CLibraryContext *_LibContext;
NLMISC::CLibraryContext *m_LibContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
ExtensionSystem::IPluginManager *m_plugMan;
};

View file

@ -54,7 +54,7 @@ union TFormId
}
};
bool operator<(const TFormId& fid1, const TFormId& fid2)
bool operator<(const TFormId &fid1, const TFormId &fid2)
{
return fid1.Id<fid2.Id;
}
@ -82,7 +82,7 @@ uint32 NbFilesDiscarded = 0;
void addId( string fileName );
// getFileType
bool getFileType( string& fileName, string& fileType );
bool getFileType( string &fileName, string &fileType );
//-----------------------------------------------
// getFirstFreeFileTypeId
@ -107,7 +107,7 @@ sint16 getFirstFreeFileTypeId()
// readFormId
//
//-----------------------------------------------
void readFormId( string& outputFileName )
void readFormId( string &outputFileName )
{
CIFile f;
if( f.open( outputFileName ) )
@ -315,7 +315,7 @@ void addId( string fileName )
// getFileType
//
//-----------------------------------------------
bool getFileType( string& fileName, string& fileType )
bool getFileType( string &fileName, string &fileType )
{
fileType = CFile::getExtension(CFile::getFilename(fileName));
return !fileType.empty();

View file

@ -195,7 +195,7 @@ void SheetBuilderDialog::buildSheet()
for( it1 = IdToForm.begin(); it1 != IdToForm.end(); ++it1 )
{
string outputLine = " id: " + toString((*it1).first.Id) + " file: " + (*it1).second +"\n";
output.serialBuffer((uint8*)(const_cast<char*>(outputLine.data())),(uint)outputLine.size());
output.serialBuffer((uint8 *)(const_cast<char *>(outputLine.data())),(uint)outputLine.size());
}
displayInfo (tr("------------- results ----------------"));

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 "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../core/core_constants.h"
ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) :
@ -145,6 +145,7 @@ void ZonePainterMainWindow::loadConfig() {
QColor color;
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()));
}

View file

@ -3,7 +3,7 @@
#include "zone_painter_settings_page.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
#include "../core/imenu_manager.h"
#include "../core/menu_manager.h"
#include "../../extension_system/iplugin_spec.h"
// NeL includes
@ -19,22 +19,22 @@
namespace Plugin
{
NLMISC_SAFE_SINGLETON_IMPL(CZoneManager)
// NLMISC_SAFE_SINGLETON_IMPL(CZoneManager)
ZonePainterPlugin::~ZonePainterPlugin()
{
Q_FOREACH(QObject *obj, _autoReleaseObjects)
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
_plugMan->removeObject(obj);
m_plugMan->removeObject(obj);
}
qDeleteAll(_autoReleaseObjects);
_autoReleaseObjects.clear();
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
}
bool ZonePainterPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
m_plugMan = pluginManager;
addAutoReleasedObject(new CZonePainterSettingsPage(this));
addAutoReleasedObject(new CZonePainterContext(this));
@ -45,19 +45,7 @@ bool ZonePainterPlugin::initialize(ExtensionSystem::IPluginManager *pluginManage
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);
Core::MenuManager *menuManager = core->menuManager();
}
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.
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;
m_LibContext = new NLMISC::CLibraryContext(*nelContext);
}
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;
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
}

View file

@ -31,7 +31,7 @@ class IPluginSpec;
namespace Plugin
{
class CZoneManager
/* class CZoneManager
{
NLMISC_SAFE_SINGLETON_DECL(CZoneManager)
public:
@ -41,7 +41,7 @@ namespace Plugin
NL3D::CLandscapeModel *m_painterLandscape;
NL3D::CZone *m_currentZone;
};
*/
class ZonePainterPlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
@ -52,28 +52,16 @@ public:
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;
NLMISC::CLibraryContext *m_LibContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
QList<QObject *> _autoReleaseObjects;
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
};
class CZonePainterContext: public Core::IContext