make sorting items in browser case insensitive
This commit is contained in:
@@ -554,6 +554,20 @@ bool GetSongInfo(Song &s)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SortDirectory(const Item &a, const Item &b)
|
||||||
|
{
|
||||||
|
if (a.type == b.type)
|
||||||
|
{
|
||||||
|
string sa = a.type == itSong ? a.song->GetShortFilename() : a.name;
|
||||||
|
string sb = b.type == itSong ? b.song->GetShortFilename() : b.name;
|
||||||
|
transform(sa.begin(), sa.end(), sa.begin(), tolower);
|
||||||
|
transform(sb.begin(), sb.end(), sb.begin(), tolower);
|
||||||
|
return sa < sb;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return a.type < b.type;
|
||||||
|
}
|
||||||
|
|
||||||
void GetDirectory(string dir)
|
void GetDirectory(string dir)
|
||||||
{
|
{
|
||||||
int highlightme = -1;
|
int highlightme = -1;
|
||||||
@@ -571,6 +585,9 @@ void GetDirectory(string dir)
|
|||||||
vBrowser.push_back(parent);
|
vBrowser.push_back(parent);
|
||||||
}
|
}
|
||||||
Mpd->GetDirectory(dir, vBrowser);
|
Mpd->GetDirectory(dir, vBrowser);
|
||||||
|
|
||||||
|
sort(vBrowser.begin(), vBrowser.end(), SortDirectory);
|
||||||
|
|
||||||
for (ItemList::iterator it = vBrowser.begin()+(dir != "/" ? 1 : 0); it != vBrowser.end(); it++)
|
for (ItemList::iterator it = vBrowser.begin()+(dir != "/" ? 1 : 0); it != vBrowser.end(); it++)
|
||||||
{
|
{
|
||||||
switch (it->type)
|
switch (it->type)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ void WindowTitle(const string &);
|
|||||||
string TotalPlaylistLength();
|
string TotalPlaylistLength();
|
||||||
string DisplaySong(const Song &, const string & = Config.song_list_format);
|
string DisplaySong(const Song &, const string & = Config.song_list_format);
|
||||||
void ShowMessage(const string &, int = Config.message_delay_time);
|
void ShowMessage(const string &, int = Config.message_delay_time);
|
||||||
|
bool SortDirectory(const Item &a, const Item &b);
|
||||||
void GetDirectory(string);
|
void GetDirectory(string);
|
||||||
bool GetSongInfo(Song &);
|
bool GetSongInfo(Song &);
|
||||||
void PrepareSearchEngine(Song &s);
|
void PrepareSearchEngine(Song &s);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
|
||||||
enum QueueCommandType { qctAdd, qctDelete, qctDeleteID };
|
enum QueueCommandType { qctAdd, qctDelete, qctDeleteID };
|
||||||
enum ItemType { itSong, itDirectory, itPlaylist };
|
enum ItemType { itDirectory, itSong, itPlaylist };
|
||||||
enum PlayerState { psUnknown, psStop, psPlay, psPause };
|
enum PlayerState { psUnknown, psStop, psPlay, psPause };
|
||||||
|
|
||||||
struct MPDStatusChanges
|
struct MPDStatusChanges
|
||||||
|
|||||||
Reference in New Issue
Block a user