Add skeleton for auth plugin and move plugins to threads

parent d2c73941
/* ____ _ _ _ __ __
* / ___|| | ___ _| (_)_ _____\ \/ /
* \___ \| |/ / | | | | \ \ / / _ \\ /
* ___) | <| |_| | | |\ 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 "pluginsinterfaces.h"
#include <iostream>
#include "skauth.h"
void SkyliveAuth::startPlugin()
{
std::cout << "SkyliveAuth initialized" << std::endl;
}
/* ____ _ _ _ __ __
* / ___|| | ___ _| (_)_ _____\ \/ /
* \___ \| |/ / | | | | \ \ / / _ \\ /
* ___) | <| |_| | | |\ 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 SkyliveAuth : public QObject, SkylivexPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "com.skylivex.SkylivexPlugin/1.0" FILE "skauth.json")
Q_INTERFACES(SkylivexPluginInterface)
public:
void startPlugin();
};
{
"name": "skauth",
"version": "0.0.1",
"dependencies": []
}
TEMPLATE = lib
SOURCES = skauth.cpp
CONFIG += plugin
HEADERS = skauth.h
INCLUDEPATH = ../src
QT += core network widgets
DESTDIR = ../build/plugins
TEMPLATE = subdirs
SUBDIRS = src/skylivex.pro \
plugins/skproto.pro
plugins/skproto.pro \
plugins/skauth.pro
DATAFILES.path = build
DATAFILES.files = doc gui LICENSE.txt COPYING
......
......@@ -38,6 +38,7 @@
#include <QDir>
#include <QObject>
#include <QString>
#include <QThread>
#include "skylivex.h"
#include "pluginsinterfaces.h"
#include <iostream>
......@@ -77,7 +78,6 @@ void SkyliveX::loadPlugins()
{
std::cout << "Loading " << fileName.toStdString() << std::endl;
initializePlugin(plugin, fileName);
//pluginFileNames += fileName;SkylivexPluginInterface
}
else
{
......@@ -93,7 +93,15 @@ void SkyliveX::initializePlugin(QObject *plugin, QString filename)
if (skylivexPluginInterface)
{
std::cout << "Plugin file " << filename.toStdString() << " is valid." << std::endl;
// Create a new thread for the plugin
QThread* consumer = new QThread();
plugin->moveToThread(consumer);
consumer->start();
// Save plugin in the plugin list hash
skylivexPluginList.insert(filename, plugin);
// now the plugin can be initialized and used
skylivexPluginInterface->startPlugin();
}
}
......
......@@ -37,6 +37,7 @@
#include <QObject>
#include <QString>
#include <QHash>
#include "pluginsinterfaces.h"
#include <iostream>
#include <string>
......@@ -53,6 +54,7 @@ class SkyliveX : public QObject
private:
SkylivexPluginInterface *skylivexPluginInterface;
QHash<QString, QObject*> skylivexPluginList;
public:
SkyliveX(QObject *parent=0) : QObject(parent) {}
......
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