diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-13 10:46:51 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-13 10:46:51 +0000 |
| commit | 6cf6bc2f667ea229d3864a8767982bdecab7b146 (patch) | |
| tree | afd9602f80bad18e6c69d74feb9d85c561cf65ff /src/qmmpui/uiloader.cpp | |
| parent | 90dedc4493d21f3057d86ce4289eee6471a243b5 (diff) | |
| download | qmmp-6cf6bc2f667ea229d3864a8767982bdecab7b146.tar.gz qmmp-6cf6bc2f667ea229d3864a8767982bdecab7b146.tar.bz2 qmmp-6cf6bc2f667ea229d3864a8767982bdecab7b146.zip | |
coding style fixes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9472 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/qmmpui/uiloader.cpp')
| -rw-r--r-- | src/qmmpui/uiloader.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/qmmpui/uiloader.cpp b/src/qmmpui/uiloader.cpp index 8a3ef0c7a..4d64c23bf 100644 --- a/src/qmmpui/uiloader.cpp +++ b/src/qmmpui/uiloader.cpp @@ -20,6 +20,7 @@ #include <QDir> #include <qmmp/qmmp.h> +#include <algorithm> #include "qmmpuiplugincache_p.h" #include "uiloader.h" @@ -74,12 +75,9 @@ QStringList UiLoader::names() QString UiLoader::file(UiFactory *factory) { loadPlugins(); - for(const QmmpUiPluginCache *item : qAsConst(*m_cache)) - { - if(item->shortName() == factory->properties().shortName) - return item->file(); - } - return QString(); + auto it = std::find_if(m_cache->cbegin(), m_cache->cend(), + [factory](QmmpUiPluginCache *item) { return item->shortName() == factory->properties().shortName; } ); + return it == m_cache->cend() ? QString() : (*it)->file(); } void UiLoader::select(UiFactory* factory) @@ -90,14 +88,10 @@ void UiLoader::select(UiFactory* factory) void UiLoader::select(const QString &name) { loadPlugins(); - for(const QmmpUiPluginCache *item : qAsConst(*m_cache)) + if(std::any_of(m_cache->cbegin(), m_cache->cend(), [name](QmmpUiPluginCache *item) { return item->shortName() == name; } )) { - if(item->shortName() == name) - { - QSettings settings (Qmmp::configFile(), QSettings::IniFormat); - settings.setValue ("Ui/current_plugin", name); - break; - } + QSettings settings (Qmmp::configFile(), QSettings::IniFormat); + settings.setValue ("Ui/current_plugin", name); } } |
