diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2012-10-18 16:15:53 +0200 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2012-10-18 16:15:53 +0200 |
commit | 3b61a0c1abb3f4be7435df12499db15a3a37c535 (patch) | |
tree | a9c1e2258c2281206afe8dd12fc991896be04241 /src/media_library.cpp | |
parent | 33fb33dc8d11dfb453b8232529421672c0b759e3 (diff) |
media library: fix marking songs as in playlist
Diffstat (limited to 'src/media_library.cpp')
-rw-r--r-- | src/media_library.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/media_library.cpp b/src/media_library.cpp index 0e5b4202..355f6b29 100644 --- a/src/media_library.cpp +++ b/src/media_library.cpp @@ -65,6 +65,8 @@ bool AlbumEntryMatcher(const Regex &rx, const NC::Menu<AlbumEntry>::Item &item, bool SongEntryMatcher(const Regex &rx, const MPD::Song &s); struct SortSongs { + typedef NC::Menu<MPD::Song>::Item SongItem; + static const std::array<MPD::Song::GetFunction, 3> GetFuns; LocaleStringComparison m_cmp; @@ -74,6 +76,9 @@ public: SortSongs(bool disc_only) : m_cmp(std::locale(), Config.ignore_leading_the), m_offset(disc_only ? 2 : 0) { } + bool operator()(const SongItem &a, const SongItem &b) { + return (*this)(a.value(), b.value()); + } bool operator()(const MPD::Song &a, const MPD::Song &b) { for (auto get = GetFuns.begin()+m_offset; get != GetFuns.end(); ++get) { int ret = m_cmp(a.getTags(*get, Config.tags_separator), @@ -397,7 +402,7 @@ void MediaLibrary::update() }); if (idx < Songs.size()) Songs.resizeList(idx); - std::sort(Songs.beginV(), Songs.endV(), SortSongs(!album.isAllTracksEntry())); + std::sort(Songs.begin(), Songs.end(), SortSongs(!album.isAllTracksEntry())); }); Songs.refresh(); } |