Changeset View
Changeset View
Standalone View
Standalone View
src/extractorcollection.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * <one line to give the library's name and an idea of what it does.> | | |||
3 | * Copyright (C) 2012 Vishesh Handa <me@vhanda.in> | 2 | * Copyright (C) 2012 Vishesh Handa <me@vhanda.in> | ||
4 | * Copyright (C) 2016 Varun Joshi <varunj.1011@gmail.com> | 3 | * Copyright (C) 2016 Varun Joshi <varunj.1011@gmail.com> | ||
5 | * | 4 | * | ||
6 | * This library is free software; you can redistribute it and/or | 5 | * This library is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | 6 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | 7 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | 8 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | 9 | * | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
58 | 57 | | |||
59 | ExtractorCollection::~ExtractorCollection() | 58 | ExtractorCollection::~ExtractorCollection() | ||
60 | { | 59 | { | ||
61 | qDeleteAll(d->m_allExtractors.begin(), d->m_allExtractors.end()); | 60 | qDeleteAll(d->m_allExtractors.begin(), d->m_allExtractors.end()); | ||
62 | delete d; | 61 | delete d; | ||
63 | } | 62 | } | ||
64 | 63 | | |||
65 | 64 | | |||
65 | QList<Extractor*> ExtractorCollection::allExtractors() const | ||||
66 | { | ||||
67 | return d->m_allExtractors; | ||||
68 | } | ||||
69 | | ||||
66 | QList<Extractor*> ExtractorCollection::Private::allExtractors() const | 70 | QList<Extractor*> ExtractorCollection::Private::allExtractors() const | ||
67 | { | 71 | { | ||
68 | QStringList plugins; | 72 | QStringList plugins; | ||
69 | QStringList pluginPaths; | 73 | QStringList pluginPaths; | ||
70 | QStringList externalPlugins; | 74 | QStringList externalPlugins; | ||
71 | QStringList externalPluginPaths; | 75 | QStringList externalPluginPaths; | ||
72 | 76 | | |||
73 | QStringList paths = QCoreApplication::libraryPaths(); | 77 | QStringList paths = QCoreApplication::libraryPaths(); | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 112 | Q_FOREACH (const QString& pluginPath, pluginPaths) { | |||
116 | 120 | | |||
117 | QObject* obj = loader.instance(); | 121 | QObject* obj = loader.instance(); | ||
118 | if (obj) { | 122 | if (obj) { | ||
119 | ExtractorPlugin* plugin = qobject_cast<ExtractorPlugin*>(obj); | 123 | ExtractorPlugin* plugin = qobject_cast<ExtractorPlugin*>(obj); | ||
120 | if (plugin) { | 124 | if (plugin) { | ||
121 | Extractor* ex= new Extractor; | 125 | Extractor* ex= new Extractor; | ||
122 | ex->setExtractorPlugin(plugin); | 126 | ex->setExtractorPlugin(plugin); | ||
123 | ex->setAutoDeletePlugin(Extractor::DoNotDeletePlugin); | 127 | ex->setAutoDeletePlugin(Extractor::DoNotDeletePlugin); | ||
128 | auto metadata = loader.metaData().value(QLatin1String("MetaData")); | ||||
129 | if (metadata.type() == QJsonValue::Object) { | ||||
130 | qCDebug(KFILEMETADATA_LOG) << "Created Plugin with metadata:" << metadata; | ||||
131 | ex->setMetaData(metadata.toObject().toVariantMap()); | ||||
132 | } | ||||
124 | 133 | | |||
125 | extractors << ex; | 134 | extractors << ex; | ||
126 | } else { | 135 | } else { | ||
127 | qCDebug(KFILEMETADATA_LOG) << "Plugin could not be converted to an ExtractorPlugin"; | 136 | qCDebug(KFILEMETADATA_LOG) << "Plugin could not be converted to an ExtractorPlugin"; | ||
128 | qCDebug(KFILEMETADATA_LOG) << pluginPath; | 137 | qCDebug(KFILEMETADATA_LOG) << pluginPath; | ||
129 | } | 138 | } | ||
130 | } | 139 | } | ||
131 | else { | 140 | else { | ||
Show All 38 Lines |