diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-12 21:03:34 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-12 21:03:34 +0000 |
| commit | 7ef8d11baeaf1847ba7f1df5d858f8cffea9300d (patch) | |
| tree | a741fb49db8834efd4b46d760b89082547eb2a9d /src/plugins/General/lyrics | |
| parent | 6f301f5880f7efce76ed46e7b502830642b87370 (diff) | |
| download | qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.tar.gz qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.tar.bz2 qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.zip | |
coding style fixes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9470 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/lyrics')
| -rw-r--r-- | src/plugins/General/lyrics/lyricsprovider.cpp | 6 | ||||
| -rw-r--r-- | src/plugins/General/lyrics/lyricswindow.h | 2 | ||||
| -rw-r--r-- | src/plugins/General/lyrics/ultimatelyricsparser.cpp | 13 | ||||
| -rw-r--r-- | src/plugins/General/lyrics/ultimatelyricsparser.h | 2 |
4 files changed, 10 insertions, 13 deletions
diff --git a/src/plugins/General/lyrics/lyricsprovider.cpp b/src/plugins/General/lyrics/lyricsprovider.cpp index 775d3ee74..abd27a6f7 100644 --- a/src/plugins/General/lyrics/lyricsprovider.cpp +++ b/src/plugins/General/lyrics/lyricsprovider.cpp @@ -101,7 +101,7 @@ QString LyricsProvider::getUrl(const TrackInfo &track) const url.replace(it.key(), it.value()); - it++; + ++it; } return url; @@ -139,7 +139,7 @@ QString LyricsProvider::format(const QByteArray &data, const TrackInfo &track) c { item.begin.replace(it.key(), it.value()); item.url.replace(it.key(), it.value()); - it++; + ++it; } } @@ -197,7 +197,7 @@ QString LyricsProvider::fixCase(const QString &title) const else out.append(*it); - it++; + ++it; } return out; diff --git a/src/plugins/General/lyrics/lyricswindow.h b/src/plugins/General/lyrics/lyricswindow.h index 6aaf5fbef..5ea962461 100644 --- a/src/plugins/General/lyrics/lyricswindow.h +++ b/src/plugins/General/lyrics/lyricswindow.h @@ -37,7 +37,7 @@ class LyricsWindow : public QWidget { Q_OBJECT public: - LyricsWindow(const TrackInfo *info, QWidget *parent = nullptr); + explicit LyricsWindow(const TrackInfo *info, QWidget *parent = nullptr); ~LyricsWindow(); diff --git a/src/plugins/General/lyrics/ultimatelyricsparser.cpp b/src/plugins/General/lyrics/ultimatelyricsparser.cpp index 7f3ffaa14..ef9f70dd7 100644 --- a/src/plugins/General/lyrics/ultimatelyricsparser.cpp +++ b/src/plugins/General/lyrics/ultimatelyricsparser.cpp @@ -24,6 +24,7 @@ #include <QXmlStreamReader> #include <QFile> #include <QtDebug> +#include <algorithm> #if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0)) //qAsConst template #include <qmmp/qmmp.h> #endif @@ -135,17 +136,13 @@ const QList<LyricsProvider *> &UltimateLyricsParser::providers() LyricsProvider *UltimateLyricsParser::provider(const QString &name) const { - for(LyricsProvider *provider : qAsConst(m_providers)) - { - if(provider->name() == name) - return provider; - } - return nullptr; + auto it = std::find_if(m_providers.cbegin(), m_providers.cend(), [name](LyricsProvider *provider){ return provider->name() == name; }); + return it == m_providers.cend() ? nullptr : *it; } -QStringList UltimateLyricsParser::defaultProviders() +const QStringList &UltimateLyricsParser::defaultProviders() { - QStringList out = { + static const QStringList out = { "lyrics.wikia.com", "Encyclopaedia Metallum", "letras.mus.br", diff --git a/src/plugins/General/lyrics/ultimatelyricsparser.h b/src/plugins/General/lyrics/ultimatelyricsparser.h index 994955f87..8d0f13004 100644 --- a/src/plugins/General/lyrics/ultimatelyricsparser.h +++ b/src/plugins/General/lyrics/ultimatelyricsparser.h @@ -40,7 +40,7 @@ public: const QString &errorString() const; const QList<LyricsProvider *> &providers(); LyricsProvider *provider(const QString &name) const; - static QStringList defaultProviders(); + static const QStringList &defaultProviders(); private: QString m_errorString; |
