Separe oplugin header

parent 394b77b8
...@@ -32,25 +32,12 @@ ...@@ -32,25 +32,12 @@
* Purpose: * Purpose:
* *
*/ */
#include <QObject> #include "pluginsinterfaces.h"
#include <QtPlugin>
#include "../src/pluginsinterfaces.h"
#include <iostream> #include <iostream>
#include "skproto.h"
class SkyliveProtocol : public QObject, SkylivexPluginInterface
{
Q_OBJECT
Q_INTERFACES(SkylivexPluginInterface)
//Q_PLUGIN_METADATA(IID "com.skylivex.SkylivexPlugin/1.0" FILE skproto.json)
public:
void startPlugin();
};
void SkyliveProtocol::startPlugin() void SkyliveProtocol::startPlugin()
{ {
std::cout << "SkyliveProtocol initialized" << std::endl; std::cout << "SkyliveProtocol initialized" << std::endl;
} }
// Qt 5.0 broke compatibility with old metadata macro
//Q_EXPORT_PLUGIN2(skproto, SkyliveProtocol)
/* ____ _ _ _ __ __
* / ___|| | ___ _| (_)_ _____\ \/ /
* \___ \| |/ / | | | | \ \ / / _ \\ /
* ___) | <| |_| | | |\ V / __// \ Remote Telescopes
* |____/|_|\_\\__, |_|_| \_/ \___/_/\_\ For the masses
* |___/
*
* Copyright (C) 2013 Franco (nextime) Lanza <nextime@nexlab.it>
* Copyright (C) 2013 Ivan Bellia <skylive@skylive.it>
*
* All rights reserved.
*
* This file is part of SkyliveX.
*
* SkyliveX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*
********************************************************************
*
* File:
*
* Purpose:
*
*/
#include <QObject>
#include <QtPlugin>
#include "pluginsinterfaces.h"
class SkyliveProtocol : public QObject, SkylivexPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "com.skylivex.SkylivexPlugin/1.0")
Q_INTERFACES(SkylivexPluginInterface)
public:
void startPlugin();
};
TEMPLATE = lib TEMPLATE = lib
SOURCES = skproto.cpp SOURCES = skproto.cpp
CONFIG += plugin
HEADERS = ../src/pluginsinterfaces.h HEADERS = skproto.h
INCLUDEPATH = ../src
QT += core network widgets QT += core network widgets
DESTDIR = ../plugins
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS = src/skylivex.pro \ SUBDIRS = src/skylivex.pro \
plugins/skproto.pro plugins/skproto.pro
DESTDIR = release
...@@ -67,5 +67,5 @@ MainWin::~MainWin() ...@@ -67,5 +67,5 @@ MainWin::~MainWin()
void MainWin::msgFromCore(std::string &msg) void MainWin::msgFromCore(std::string &msg)
{ {
std::cout << "Message from core: " << msg << std::endl; //std::cout << "Message from core: " << msg << std::endl;
} }
...@@ -50,7 +50,7 @@ class SkylivexPluginInterface ...@@ -50,7 +50,7 @@ class SkylivexPluginInterface
}; };
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(SkylivexPluginInterface, #define skylivexplugin_iid "com.skylivex.SkylivexPlugin/1.0"
"com.skylivex.SkylivexPlugin/1.0") Q_DECLARE_INTERFACE(SkylivexPluginInterface, skylivexplugin_iid)
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif
...@@ -71,8 +71,8 @@ void SkyliveX::loadPlugins() ...@@ -71,8 +71,8 @@ void SkyliveX::loadPlugins()
foreach(QString fileName, pluginsDir.entryList(QDir::Files)) foreach(QString fileName, pluginsDir.entryList(QDir::Files))
{ {
std::cout << "Testing " << pluginsDir.absoluteFilePath(fileName).toStdString() << std::endl; std::cout << "Testing " << pluginsDir.absoluteFilePath(fileName).toStdString() << std::endl;
QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
QObject *plugin = loader.instance(); QObject *plugin = pluginLoader.instance();
if (plugin) if (plugin)
{ {
std::cout << "Loading " << fileName.toStdString() << std::endl; std::cout << "Loading " << fileName.toStdString() << std::endl;
...@@ -81,7 +81,7 @@ void SkyliveX::loadPlugins() ...@@ -81,7 +81,7 @@ void SkyliveX::loadPlugins()
} }
else else
{ {
std::cout << loader.errorString().toStdString() << std::endl; std::cout << pluginLoader.errorString().toStdString() << std::endl;
std::cout << plugin << std::endl; std::cout << plugin << std::endl;
} }
} }
......
...@@ -11,3 +11,4 @@ QT += core network webkitwidgets widgets ...@@ -11,3 +11,4 @@ QT += core network webkitwidgets widgets
OTHER_FILES += \ OTHER_FILES += \
../gui/splash.html \ ../gui/splash.html \
../gui/img/logo.png ../gui/img/logo.png
DESTDIR = ./
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment