diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-03 09:01:05 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-03 09:01:05 +0100 |
commit | 4d9746c828558c9f872e0aed52442863affb25d5 (patch) | |
tree | 507d7c2ba67f47d3cbbcf01a722236ff1b48426b /common/resource.cpp | |
parent | 9cea920b7dd51867a0be0fed2f461b6be73c103e (diff) | |
download | sink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz sink-4d9746c828558c9f872e0aed52442863affb25d5.zip |
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'common/resource.cpp')
-rw-r--r-- | common/resource.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/common/resource.cpp b/common/resource.cpp index 5cbb2f2..6713686 100644 --- a/common/resource.cpp +++ b/common/resource.cpp | |||
@@ -27,19 +27,16 @@ | |||
27 | 27 | ||
28 | #include "facadefactory.h" | 28 | #include "facadefactory.h" |
29 | 29 | ||
30 | namespace Sink | 30 | namespace Sink { |
31 | { | ||
32 | 31 | ||
33 | Resource::Resource() | 32 | Resource::Resource() : QObject(), d(0) |
34 | : QObject(), | ||
35 | d(0) | ||
36 | { | 33 | { |
37 | Q_UNUSED(d); | 34 | Q_UNUSED(d); |
38 | } | 35 | } |
39 | 36 | ||
40 | Resource::~Resource() | 37 | Resource::~Resource() |
41 | { | 38 | { |
42 | //delete d; | 39 | // delete d; |
43 | } | 40 | } |
44 | 41 | ||
45 | void Resource::processCommand(int commandId, const QByteArray &data) | 42 | void Resource::processCommand(int commandId, const QByteArray &data) |
@@ -71,21 +68,19 @@ void Resource::removeDataFromDisk() | |||
71 | class ResourceFactory::Private | 68 | class ResourceFactory::Private |
72 | { | 69 | { |
73 | public: | 70 | public: |
74 | static QHash<QString, QPointer<ResourceFactory> > s_loadedFactories; | 71 | static QHash<QString, QPointer<ResourceFactory>> s_loadedFactories; |
75 | }; | 72 | }; |
76 | 73 | ||
77 | QHash<QString, QPointer<ResourceFactory> > ResourceFactory::Private::s_loadedFactories; | 74 | QHash<QString, QPointer<ResourceFactory>> ResourceFactory::Private::s_loadedFactories; |
78 | 75 | ||
79 | ResourceFactory::ResourceFactory(QObject *parent) | 76 | ResourceFactory::ResourceFactory(QObject *parent) : QObject(parent), d(0) |
80 | : QObject(parent), | ||
81 | d(0) | ||
82 | { | 77 | { |
83 | Q_UNUSED(d); | 78 | Q_UNUSED(d); |
84 | } | 79 | } |
85 | 80 | ||
86 | ResourceFactory::~ResourceFactory() | 81 | ResourceFactory::~ResourceFactory() |
87 | { | 82 | { |
88 | //delete d; | 83 | // delete d; |
89 | } | 84 | } |
90 | 85 | ||
91 | ResourceFactory *ResourceFactory::load(const QString &resourceName) | 86 | ResourceFactory *ResourceFactory::load(const QString &resourceName) |
@@ -95,15 +90,15 @@ ResourceFactory *ResourceFactory::load(const QString &resourceName) | |||
95 | return factory; | 90 | return factory; |
96 | } | 91 | } |
97 | 92 | ||
98 | for (auto const &path: QCoreApplication::instance()->libraryPaths()) { | 93 | for (auto const &path : QCoreApplication::instance()->libraryPaths()) { |
99 | if (path.endsWith(QLatin1String("plugins"))) { | 94 | if (path.endsWith(QLatin1String("plugins"))) { |
100 | QDir pluginDir(path); | 95 | QDir pluginDir(path); |
101 | //TODO: centralize this so that it is easy to change centrally | 96 | // TODO: centralize this so that it is easy to change centrally |
102 | // also ref'd in cmake as ${SINK_RESOURCE_PLUGINS_PATH} | 97 | // also ref'd in cmake as ${SINK_RESOURCE_PLUGINS_PATH} |
103 | pluginDir.cd(QStringLiteral("sink")); | 98 | pluginDir.cd(QStringLiteral("sink")); |
104 | pluginDir.cd(QStringLiteral("resources")); | 99 | pluginDir.cd(QStringLiteral("resources")); |
105 | 100 | ||
106 | for (const QString &fileName: pluginDir.entryList(QDir::Files)) { | 101 | for (const QString &fileName : pluginDir.entryList(QDir::Files)) { |
107 | const QString path = pluginDir.absoluteFilePath(fileName); | 102 | const QString path = pluginDir.absoluteFilePath(fileName); |
108 | QPluginLoader loader(path); | 103 | QPluginLoader loader(path); |
109 | 104 | ||
@@ -115,7 +110,7 @@ ResourceFactory *ResourceFactory::load(const QString &resourceName) | |||
115 | if (factory) { | 110 | if (factory) { |
116 | Private::s_loadedFactories.insert(resourceName, factory); | 111 | Private::s_loadedFactories.insert(resourceName, factory); |
117 | factory->registerFacades(FacadeFactory::instance()); | 112 | factory->registerFacades(FacadeFactory::instance()); |
118 | //TODO: if we need more data on it const QJsonObject json = loader.metaData()[QStringLiteral("MetaData")].toObject(); | 113 | // TODO: if we need more data on it const QJsonObject json = loader.metaData()[QStringLiteral("MetaData")].toObject(); |
119 | return factory; | 114 | return factory; |
120 | } else { | 115 | } else { |
121 | qWarning() << "Plugin for" << resourceName << "from plugin" << loader.fileName() << "produced the wrong object type:" << object; | 116 | qWarning() << "Plugin for" << resourceName << "from plugin" << loader.fileName() << "produced the wrong object type:" << object; |
@@ -135,7 +130,7 @@ ResourceFactory *ResourceFactory::load(const QString &resourceName) | |||
135 | 130 | ||
136 | } // namespace Sink | 131 | } // namespace Sink |
137 | 132 | ||
138 | //Ignore warning I don't know how to fix in a moc file | 133 | // Ignore warning I don't know how to fix in a moc file |
139 | #pragma clang diagnostic push | 134 | #pragma clang diagnostic push |
140 | #pragma clang diagnostic ignored "-Wundefined-reinterpret-cast" | 135 | #pragma clang diagnostic ignored "-Wundefined-reinterpret-cast" |
141 | #include "moc_resource.cpp" | 136 | #include "moc_resource.cpp" |