From 78b384662f484e946a6a17c96e6c309df0c039da Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Thu, 19 May 2016 23:54:42 +0800 Subject: Added a sample plugin as a template. Implemented scanPlugin for Windows. --- sample-plugin/sample-plugin.pro | 23 +++++++++++++++++++++++ sample-plugin/sampleplugin.cpp | 11 +++++++++++ sample-plugin/sampleplugin.hpp | 24 ++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 sample-plugin/sample-plugin.pro create mode 100644 sample-plugin/sampleplugin.cpp create mode 100644 sample-plugin/sampleplugin.hpp (limited to 'sample-plugin') diff --git a/sample-plugin/sample-plugin.pro b/sample-plugin/sample-plugin.pro new file mode 100644 index 0000000..5ee7c48 --- /dev/null +++ b/sample-plugin/sample-plugin.pro @@ -0,0 +1,23 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2016-05-19T09:25:32 +# +#------------------------------------------------- + +QT -= core gui + +CONFIG += c++11 + +TARGET = sample-plugin +TEMPLATE = lib + +DEFINES += SAMPLEPLUGIN_LIBRARY + +SOURCES += sampleplugin.cpp + +HEADERS += sampleplugin.hpp + +unix { + target.path = /usr/lib + INSTALLS += target +} diff --git a/sample-plugin/sampleplugin.cpp b/sample-plugin/sampleplugin.cpp new file mode 100644 index 0000000..64e5584 --- /dev/null +++ b/sample-plugin/sampleplugin.cpp @@ -0,0 +1,11 @@ +#include +#include "sampleplugin.hpp" + +qmpSamplePlugin::qmpSamplePlugin(qmpPluginAPI* _api){api=_api;} +qmpSamplePlugin::~qmpSamplePlugin(){api=NULL;} +void qmpSamplePlugin::init() +{fputs("Hello world from plugin init!\n",stderr);} +void qmpSamplePlugin::deinit() +{fputs("Bye!\n",stderr);} +const char* qmpSamplePlugin::pluginGetName(){return "QMidiPlayer Sample Plugin";} +const char* qmpSamplePlugin::pluginGetVersion(){return "0.0.0";} diff --git a/sample-plugin/sampleplugin.hpp b/sample-plugin/sampleplugin.hpp new file mode 100644 index 0000000..75a5dcf --- /dev/null +++ b/sample-plugin/sampleplugin.hpp @@ -0,0 +1,24 @@ +#ifndef SAMPLEPLUGIN_H +#define SAMPLEPLUGIN_H + +#include "../include/qmpcorepublic.hpp" + +class qmpSamplePlugin:public qmpPluginIntf +{ + private: + qmpPluginAPI* api; + public: + qmpSamplePlugin(qmpPluginAPI* _api); + ~qmpSamplePlugin(); + void init(); + void deinit(); + const char* pluginGetName(); + const char* pluginGetVersion(); +}; + +extern "C"{ + qmpPluginIntf* qmpPluginGetInterface(qmpPluginAPI* api) + {return new qmpSamplePlugin(api);} +} + +#endif // SAMPLEPLUGIN_H -- cgit v1.2.3