Commit 901170ce authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud
Browse files

Simplify dtkCorePluginFactoryBase.

parent ca76b316
......@@ -4,6 +4,24 @@
* Created: jeu. avril 3 08:44:47 2014 (+0200)
*/
/*!
\class dtkCorePluginFactoryBase
\inmodule dtkCore
\brief The dtkCorePluginFactoryBase class add signals to register object to object manager.
*/
#include "dtkCorePluginFactory.h"
/*! \fn void dtkCorePluginFactoryBase::touch(int type, void *t)
Emits signal created(QVariant).
The QVariant is defined by the QMetaType \a type and the address of the object \a t.
*/
void dtkCorePluginFactoryBase::touch(int type, void *t)
{
emit created(QVariant(type, t));
}
/*!
\class dtkCorePluginFactory
\inmodule dtkCore
......
......@@ -30,13 +30,8 @@ class DTKCORE_EXPORT dtkCorePluginFactoryBase : public QObject
signals:
void created(QVariant);
public:
void touch(void *t) {
emit created(QVariant(this->type(), t));
};
protected:
virtual int type(void) const = 0;
void touch(int type, void *t);
};
// ///////////////////////////////////////////////////////////////////
......@@ -67,7 +62,7 @@ public:
QStringList keys(void) const;
public:
int type(void) const;
void touch(T *t);
private:
QHash<QString, creator> creators;
......
......@@ -14,6 +14,14 @@
#pragma once
// ///////////////////////////////////////////////////////////////////
// dtkCorePluginFactoryBase implementation
// ///////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////
// dtkCorePluginFactory implementation
// ///////////////////////////////////////////////////////////////////
template <typename T> dtkCorePluginFactory<T>::dtkCorePluginFactory(void)
{
......@@ -72,9 +80,9 @@ template <typename T> dtkCorePluginTuner<T> *dtkCorePluginFactory<T>::createTune
//
// ///////////////////////////////////////////////////////////////////
template <typename T> int dtkCorePluginFactory<T>::type(void) const
template <typename T> void dtkCorePluginFactory<T>::touch(T *t)
{
return qMetaTypeId<T *>();
this->dtkCorePluginFactoryBase::touch(qMetaTypeId<T *>(), t);
}
// /////////////////////////////////////////////////////////////////
......
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