Commit 91c96443 authored by WINTZ Julien's avatar WINTZ Julien

Merging pull request #27.

parent cfa24104
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkComposer.h"
#include "dtkComposerCompass.h"
#include "dtkComposerControls.h"
......@@ -71,3 +85,6 @@
#include "dtkComposerReader.h"
#include "dtkComposerReaderNoScene.h"
#include "dtkComposerWriter.h"
//
// dtkComposer ends here
......@@ -24,9 +24,11 @@ namespace dtkComposer
namespace _private {
dtkComposerNodeFactory factory;
}
dtkComposerNodeFactory& factory(void) {
return _private::factory;
}
void initialize(void) {
dtkComposerBaseExtension baseExt;
baseExt.extend(&(_private::factory));
......
/* dtkComposer.h ---
*
* Author: Thibaud Kloczko
* Created: Tue Apr 9 12:43:49 2013 (+0200)
* Version:
* Last-Updated: Mon Apr 15 10:30:06 2013 (+0200)
* By: Julien Wintz
* Update #: 32
*/
/* Change Log:
*
*/
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include "dtkComposerExport.h"
#include <QtCore>
class dtkComposerNodeFactory;
......@@ -34,3 +35,6 @@ namespace dtkComposer
DTKCOMPOSER_EXPORT void initialize(const QString& path = "");
}
}
//
// dtkComposer.h ends here
......@@ -51,7 +51,7 @@
class DTKCOMPOSER_EXPORT dtkComposerBaseExtension : public dtkComposerExtension
{
public:
dtkComposerBaseExtension(void) {};
dtkComposerBaseExtension(void) {};
~dtkComposerBaseExtension(void) {};
public:
......@@ -70,7 +70,7 @@ void dtkComposerBaseExtension::extend(dtkComposerNodeFactory *factory)
class DTKCOMPOSER_EXPORT dtkComposerFileExtension : public dtkComposerExtension
{
public:
dtkComposerFileExtension(void) {};
dtkComposerFileExtension(void) {};
~dtkComposerFileExtension(void) {};
public:
......@@ -93,7 +93,7 @@ void dtkComposerFileExtension::extend(dtkComposerNodeFactory *factory)
class DTKCOMPOSER_EXPORT dtkComposerDistributedExtension : public dtkComposerExtension
{
public:
dtkComposerDistributedExtension(void) {};
dtkComposerDistributedExtension(void) {};
~dtkComposerDistributedExtension(void) {};
public:
......@@ -119,7 +119,7 @@ void dtkComposerDistributedExtension::extend(dtkComposerNodeFactory *factory)
class DTKCOMPOSER_EXPORT dtkComposerConstantsExtension : public dtkComposerExtension
{
public:
dtkComposerConstantsExtension(void) {};
dtkComposerConstantsExtension(void) {};
~dtkComposerConstantsExtension(void) {};
public:
......@@ -132,13 +132,12 @@ void dtkComposerConstantsExtension::extend(dtkComposerNodeFactory *factory)
factory->record(":dtkComposer/dtkComposerNodeE.json", dtkComposerNodeCreator<dtkComposerNodeE>);
}
// -- Control nodes
class DTKCOMPOSER_EXPORT dtkComposerControlExtension : public dtkComposerExtension
{
public:
dtkComposerControlExtension(void) {};
dtkComposerControlExtension(void) {};
~dtkComposerControlExtension(void) {};
public:
......@@ -156,13 +155,12 @@ void dtkComposerControlExtension::extend(dtkComposerNodeFactory *factory)
factory->record(":dtkComposer/dtkComposerNodeControlWhile.json", dtkComposerNodeCreator<dtkComposerNodeControlWhile>);
}
// -- Boolean nodes
class DTKCOMPOSER_EXPORT dtkComposerBooleanExtension : public dtkComposerExtension
{
public:
dtkComposerBooleanExtension(void) {};
dtkComposerBooleanExtension(void) {};
~dtkComposerBooleanExtension(void) {};
public:
......@@ -185,20 +183,18 @@ void dtkComposerBooleanExtension::extend(dtkComposerNodeFactory *factory)
factory->record(":dtkComposer/dtkComposerNodeBooleanOperatorBinaryNimp.json", dtkComposerNodeCreator<dtkComposerNodeBooleanOperatorBinaryNimp>);
}
// -- Number nodes
class DTKCOMPOSER_EXPORT dtkComposerNumberExtension : public dtkComposerExtension
{
public:
dtkComposerNumberExtension(void) {};
dtkComposerNumberExtension(void) {};
~dtkComposerNumberExtension(void) {};
public:
void extend(dtkComposerNodeFactory *factory);
};
void dtkComposerNumberExtension::extend(dtkComposerNodeFactory *factory)
{
factory->record(":dtkComposer/dtkComposerNodeInteger.json", dtkComposerNodeCreator<dtkComposerNodeInteger>);
......@@ -265,14 +261,12 @@ void dtkComposerNumberExtension::extend(dtkComposerNodeFactory *factory)
}
// -- String nodes
class DTKCOMPOSER_EXPORT dtkComposerStringExtension : public dtkComposerExtension
{
public:
dtkComposerStringExtension(void) {};
dtkComposerStringExtension(void) {};
~dtkComposerStringExtension(void) {};
public:
......@@ -287,13 +281,12 @@ void dtkComposerStringExtension::extend(dtkComposerNodeFactory *factory)
factory->record(":dtkComposer/dtkComposerNodeStringOperatorBinaryLogicEquality.json", dtkComposerNodeCreator<dtkComposerNodeStringOperatorBinaryLogicEquality>);
}
// -- Containers nodes
class DTKCOMPOSER_EXPORT dtkComposerContainerExtension : public dtkComposerExtension
{
public:
dtkComposerContainerExtension(void) {};
dtkComposerContainerExtension(void) {};
~dtkComposerContainerExtension(void) {};
public:
......
/* @(#)dtkComposerSettings.h ---
*
* Author: Nicolas Niclausse
* Copyright (C) 2016 - Nicolas Niclausse, Inria.
* Created: 2016/02/15 12:38:05
*/
// Version: $Id$
//
//
/* Commentary:
*
*/
// Commentary:
//
//
/* Change log:
*
*/
// Change Log:
//
//
// Code:
#pragma once
#include "dtkComposerExport.h"
#include <QtCore>
class DTKCOMPOSER_EXPORT dtkComposerSettings : public QSettings
......@@ -23,10 +23,7 @@ class DTKCOMPOSER_EXPORT dtkComposerSettings : public QSettings
public:
dtkComposerSettings(void);
~dtkComposerSettings(void);
};
//
// dtkComposerSettings.h ends here
/* dtkCorePluginManager.cpp ---
*
*
* Author: Thibaud Kloczko
* Created: jeu. avril 3 08:45:28 2014 (+0200)
*/
......@@ -10,7 +10,7 @@
\brief The dtkCorePluginManagerPrivate class is the private implementation of dtkCorePluginManager.
*/
/*! \fn bool dtkCorePluginManagerPrivate::check(const QString& path)
/*! \fn bool dtkCorePluginManagerPrivate::check(const QString& path)
\internal
Checks validity of the plugin library \a path (name, version, dependencies).
*/
......@@ -21,7 +21,7 @@
\brief The dtkCorePluginManager class is a template class that handles plugins.
*/
/*! \fn dtkCorePluginManager::dtkCorePluginManager(void)
/*! \fn dtkCorePluginManager::dtkCorePluginManager(void)
Constructs the plugin manager.
*/
......
......@@ -52,12 +52,11 @@ public:
#pragma mark Plugin Queries
QStringList plugins(void);
#pragma mark -
#pragma mark MetaData Queries
QJsonObject metaData(const QString& pluginKey);
protected:
dtkCorePluginManagerPrivate<T> *d;
......
......@@ -15,6 +15,7 @@
#pragma once
#include <QtDebug>
#include <dtkLog>
// ///////////////////////////////////////////////////////////////////
......@@ -47,6 +48,7 @@ public:
template <typename T> bool dtkCorePluginManagerPrivate<T>::check(const QString& path)
{
bool status = true;
QString conceptName = QMetaType::typeName(qMetaTypeId<T*>());
conceptName.remove("Plugin*");
......@@ -69,18 +71,23 @@ template <typename T> bool dtkCorePluginManagerPrivate<T>::check(const QString&
if(!this->names.values().contains(na_mitem)) {
dtkWarn() << " Missing dependency:" << na_mitem.toString() << "for plugin" << path;
status = false;
continue;
}
if (this->versions.value(key) != ve_mitem) {
dtkWarn() << " Version mismatch:" << na_mitem.toString() << "version" << this->versions.value(this->names.key(na_mitem)).toString() << "but" << ve_mitem.toString() << "required for plugin" << path;
status = false;
continue;
}
if(!check(key)) {
dtkWarn() << "Corrupted dependency:" << na_mitem.toString() << "for plugin" << path;
status = false;
continue;
}
}
......@@ -136,7 +143,9 @@ template <typename T> bool dtkCorePluginManager<T>::autoLoading(void) const
template <typename T> void dtkCorePluginManager<T>::loadFromName(const QString & plugin_name)
{
QString full_name = plugin_name % "Plugin";
QHash<QString, QVariant>::const_iterator i = d->names.constBegin();
while (i != d->names.constEnd()) {
if(QString::compare(i.value().toString(), full_name) == 0) {
this->load(i.key());
......@@ -156,9 +165,12 @@ template <typename T> void dtkCorePluginManager<T>::loadFromName(const QString &
template <typename T> void dtkCorePluginManager<T>::initialize(const QString& path)
{
foreach(QString path2, path.split(":",QString::SkipEmptyParts )) {
foreach(QString path2, path.split(":", QString::SkipEmptyParts)) {
QDir dir(path2);
if(d->verboseLoading) {dtkTrace() << "scanning directory for plugins:" << path2; }
if(d->verboseLoading)
dtkTrace() << "scanning directory for plugins:" << path2;
foreach(QFileInfo info, dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot))
this->scan(info.absoluteFilePath());
......
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