summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 04:43:52 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 04:43:52 (GMT)
commit205eaf4c369891ca8120d44e9a6c1dddc24b17c4 (patch)
tree89133a7bfe2b3972edeccba93d7c71209f2bbaa6
parentcab850ab6e253c56df3aa6aa7647bfea8e050c77 (diff)
Minor optimization
-rw-r--r--plugins/customtoolsplugins/shorturlplugin/shorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/plugins/customtoolsplugins/shorturlplugin/shorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp b/plugins/customtoolsplugins/shorturlplugin/shorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp
index 817655b..098c7ab 100644
--- a/plugins/customtoolsplugins/shorturlplugin/shorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp
+++ b/plugins/customtoolsplugins/shorturlplugin/shorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp
@@ -53,17 +53,13 @@ public:
{
}
- QString saveName() const;
- KPluginMetaData metaData;
+ QString metaDataFileNameBaseName;
+ QString metaDataFileName;
+ QString pluginName;
ShortUrlEnginePlugin *plugin;
};
-QString ShortUrlEnginePluginInfo::saveName() const
-{
- return QFileInfo(metaData.fileName()).baseName();
-}
-
class ShortUrlEnginePluginManagerPrivate
{
public:
@@ -90,15 +86,18 @@ void ShortUrlEnginePluginManagerPrivate::initializePlugins()
QSet<QString> unique;
while (i.hasPrevious()) {
ShortUrlEnginePluginInfo info;
- info.metaData = i.previous();
+ const KPluginMetaData data = i.previous();
+ info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
+ info.metaDataFileName = data.fileName();
+ info.pluginName = data.name();
// only load plugins once, even if found multiple times!
- if (unique.contains(info.saveName())) {
+ if (unique.contains(info.metaDataFileNameBaseName)) {
continue;
}
info.plugin = Q_NULLPTR;
mPluginList.push_back(info);
- unique.insert(info.saveName());
+ unique.insert(info.metaDataFileNameBaseName);
}
QVector<ShortUrlEnginePluginInfo>::iterator end(mPluginList.end());
for (QVector<ShortUrlEnginePluginInfo>::iterator it = mPluginList.begin(); it != end; ++it) {
@@ -108,10 +107,10 @@ void ShortUrlEnginePluginManagerPrivate::initializePlugins()
void ShortUrlEnginePluginManagerPrivate::loadPlugin(ShortUrlEnginePluginInfo *item)
{
- KPluginLoader pluginLoader(item->metaData.fileName());
+ KPluginLoader pluginLoader(item->metaDataFileName);
if (pluginLoader.factory()) {
- item->plugin = pluginLoader.factory()->create<ShortUrlEnginePlugin>(q, QVariantList() << item->saveName());
- item->plugin->setPluginName(item->metaData.name());
+ item->plugin = pluginLoader.factory()->create<ShortUrlEnginePlugin>(q, QVariantList() << item->metaDataFileNameBaseName);
+ item->plugin->setPluginName(item->pluginName);
}
}