From 464fd318c3943dffaa9077273118d1a72e658922 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 11 Oct 2017 19:20:55 +0200 Subject: [PATCH] Media library: remove argument to SortSongs contructor to simplify sorting --- src/screens/media_library.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp index 06f4081..24045b4 100644 --- a/src/screens/media_library.cpp +++ b/src/screens/media_library.cpp @@ -99,20 +99,18 @@ struct SortSongs { static const std::array GetFuns; LocaleStringComparison m_cmp; - std::ptrdiff_t m_offset; - + public: - SortSongs(bool disc_only = false) - : m_cmp(std::locale(), Config.ignore_leading_the), m_offset(disc_only ? 2 : 0) { } + SortSongs() + : m_cmp(std::locale(), Config.ignore_leading_the) { } bool operator()(const SongItem &a, const SongItem &b) { return (*this)(a.value(), b.value()); } bool operator()(const MPD::Song &a, const MPD::Song &b) { int ret; - for (auto get = GetFuns.begin()+m_offset; get != GetFuns.end(); ++get) { - ret = m_cmp(a.getTags(*get), - b.getTags(*get)); + for (auto get : GetFuns) { + ret = m_cmp(a.getTags(get), b.getTags(get)); if (ret != 0) return ret < 0; } @@ -453,7 +451,7 @@ void MediaLibrary::update() }; if (idx < Songs.size()) Songs.resizeList(idx); - std::sort(Songs.begin(), Songs.end(), SortSongs(!album.isAllTracksEntry())); + std::sort(Songs.begin(), Songs.end(), SortSongs()); } } -- 2.11.4.GIT