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

Simplify dtkCorePluginFactoryBase.

parent ca76b316
...@@ -4,6 +4,24 @@ ...@@ -4,6 +4,24 @@
* Created: jeu. avril 3 08:44:47 2014 (+0200) * 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 \class dtkCorePluginFactory
\inmodule dtkCore \inmodule dtkCore
......
...@@ -30,13 +30,8 @@ class DTKCORE_EXPORT dtkCorePluginFactoryBase : public QObject ...@@ -30,13 +30,8 @@ class DTKCORE_EXPORT dtkCorePluginFactoryBase : public QObject
signals: signals:
void created(QVariant); void created(QVariant);
public:
void touch(void *t) {
emit created(QVariant(this->type(), t));
};
protected: protected:
virtual int type(void) const = 0; void touch(int type, void *t);
}; };
// /////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////
...@@ -67,7 +62,7 @@ public: ...@@ -67,7 +62,7 @@ public:
QStringList keys(void) const; QStringList keys(void) const;
public: public:
int type(void) const; void touch(T *t);
private: private:
QHash<QString, creator> creators; QHash<QString, creator> creators;
......
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
#pragma once #pragma once
// ///////////////////////////////////////////////////////////////////
// dtkCorePluginFactoryBase implementation
// ///////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////
// dtkCorePluginFactory implementation
// ///////////////////////////////////////////////////////////////////
template <typename T> dtkCorePluginFactory<T>::dtkCorePluginFactory(void) template <typename T> dtkCorePluginFactory<T>::dtkCorePluginFactory(void)
{ {
...@@ -72,9 +80,9 @@ template <typename T> dtkCorePluginTuner<T> *dtkCorePluginFactory<T>::createTune ...@@ -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