dtkComposer.cpp 1.39 KB
Newer Older
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
1
/* dtkComposer.cpp ---
2
 *
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
3 4 5 6 7
 * Author: Thibaud Kloczko
 * Created: Tue Apr  9 12:49:06 2013 (+0200)
 */

/* Change Log:
8
 *
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
9 10 11
 */

#include "dtkComposer.h"
12 13 14

#include <dtkConfig.h>

KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
15
#include "dtkComposerNodeFactory.h"
16 17
#include "dtkComposerFactory.h"
#include "dtkComposerExtension.h"
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
18 19 20

namespace dtkComposer
{
21
    namespace node
22 23 24 25 26 27 28
    {
        dtkComposerNodeFactory *factory(void) {
            return dtkComposerFactory::instance();
        }
    }

    namespace extension
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
29
    {
30
        namespace _private {
31 32 33 34 35 36
            dtkComposerExtensionPluginFactory factory;
            dtkComposerExtensionPluginManager manager;
        }

        dtkComposerExtensionPluginFactory& pluginFactory(void) {
            return _private::factory;
37
        }
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
38

39 40 41 42 43 44 45 46 47 48 49 50 51
        dtkComposerExtensionPluginManager& pluginManager(void) {
            return _private::manager;
        }
        void initialize(const QString& path) {
            if (path.isEmpty()) {
                QString default_path = QDir(DTK_INSTALL_PREFIX).filePath("plugins/dtkComposer");
                dtkDebug() << "no composer plugin path configured, use default:" << default_path ;
                pluginManager().setVerboseLoading(true);
                pluginManager().initialize(default_path);
            } else {
                dtkDebug() << "initialize composer plugins using path:" << path ;
                pluginManager().initialize(path);
            }
52
        }
KLOCZKO Thibaud's avatar
KLOCZKO Thibaud committed
53 54
    }
}