mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Changed: #1206 Added example plugin.
This commit is contained in:
parent
f609294c1b
commit
16ac4234d8
4 changed files with 92 additions and 1 deletions
|
@ -31,7 +31,7 @@ namespace NLQT
|
|||
class IPlugin
|
||||
{
|
||||
public:
|
||||
virtual ~IPlugin();
|
||||
virtual ~IPlugin() {}
|
||||
|
||||
virtual bool initialize(IPluginManager *pluginManager, QString *errorString) = 0;
|
||||
virtual void extensionsInitialized() = 0;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
TEMPLATE = lib
|
||||
TARGET =
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
CONFIG += plugin
|
||||
# Input
|
||||
HEADERS += plugin1.h \
|
||||
../../extension_system/iplugin.h \
|
||||
../../extension_system/iplugin_manager.h \
|
||||
../../extension_system/plugin_spec.h
|
||||
SOURCES += plugin1.cpp \
|
||||
../../extension_system/plugin_spec.cpp
|
|
@ -0,0 +1,50 @@
|
|||
#include "plugin1.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
using namespace Plugin;
|
||||
|
||||
bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(errorString);
|
||||
QString str;
|
||||
QList<NLQT::CPluginSpec *> listPlug = pluginManager->plugins();
|
||||
|
||||
Q_FOREACH (NLQT::CPluginSpec *plugSpec, listPlug)
|
||||
str += plugSpec->name();
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(str);
|
||||
msgBox.exec();
|
||||
return true;
|
||||
}
|
||||
|
||||
void MyPlugin::extensionsInitialized()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("extensionsInitialize Example Plugin.");
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
QString MyPlugin::name() const
|
||||
{
|
||||
return "ExamplePlugin";
|
||||
}
|
||||
|
||||
QString MyPlugin::version() const
|
||||
{
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
QString MyPlugin::vendor() const
|
||||
{
|
||||
return "dnk";
|
||||
}
|
||||
|
||||
QString MyPlugin::description() const
|
||||
{
|
||||
return "Example plugin";
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(MyPlugin)
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef PLUGIN1_H
|
||||
#define PLUGIN1_H
|
||||
|
||||
#include "../../extension_system/iplugin.h"
|
||||
#include "../../extension_system/plugin_spec.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace Plugin
|
||||
{
|
||||
|
||||
class MyPlugin : public QObject, public NLQT::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(NLQT::IPlugin)
|
||||
public:
|
||||
|
||||
bool initialize(NLQT::IPluginManager *pluginManager, QString *errorString);
|
||||
void extensionsInitialized();
|
||||
|
||||
QString name() const;
|
||||
QString version() const;
|
||||
QString vendor() const;
|
||||
QString description() const;
|
||||
};
|
||||
|
||||
} // namespace Plugin1
|
||||
|
||||
#endif // PLUGIN1_H
|
Loading…
Reference in a new issue