Separe oplugin header

parent 394b77b8
......@@ -32,25 +32,12 @@
* Purpose:
*
*/
#include <QObject>
#include <QtPlugin>
#include "../src/pluginsinterfaces.h"
#include "pluginsinterfaces.h"
#include <iostream>
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();
};
#include "skproto.h"
void SkyliveProtocol::startPlugin()
{
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
SOURCES = skproto.cpp
HEADERS = ../src/pluginsinterfaces.h
CONFIG += plugin
HEADERS = skproto.h
INCLUDEPATH = ../src
QT += core network widgets
DESTDIR = ../plugins
TEMPLATE = subdirs
SUBDIRS = src/skylivex.pro \
plugins/skproto.pro
DESTDIR = release
......@@ -67,5 +67,5 @@ MainWin::~MainWin()
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
};
QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(SkylivexPluginInterface,
"com.skylivex.SkylivexPlugin/1.0")
#define skylivexplugin_iid "com.skylivex.SkylivexPlugin/1.0"
Q_DECLARE_INTERFACE(SkylivexPluginInterface, skylivexplugin_iid)
QT_END_NAMESPACE
#endif
......@@ -71,8 +71,8 @@ void SkyliveX::loadPlugins()
foreach(QString fileName, pluginsDir.entryList(QDir::Files))
{
std::cout << "Testing " << pluginsDir.absoluteFilePath(fileName).toStdString() << std::endl;
QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
QObject *plugin = loader.instance();
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
QObject *plugin = pluginLoader.instance();
if (plugin)
{
std::cout << "Loading " << fileName.toStdString() << std::endl;
......@@ -81,7 +81,7 @@ void SkyliveX::loadPlugins()
}
else
{
std::cout << loader.errorString().toStdString() << std::endl;
std::cout << pluginLoader.errorString().toStdString() << std::endl;
std::cout << plugin << std::endl;
}
}
......
......@@ -11,3 +11,4 @@ QT += core network webkitwidgets widgets
OTHER_FILES += \
../gui/splash.html \
../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