browser: make sorting optional

This adds a new option, "noop", to browser_sort_mode. If this mode
is selected, no sorting is done in the browser view, and the elements
are shown in the same order as received from the MPD server.
This commit is contained in:
Trygve Aaberge
2014-08-29 17:10:40 +02:00
committed by Andrzej Rybczak
parent 49f53c07bb
commit 9e8dc741e5
7 changed files with 29 additions and 13 deletions

View File

@@ -2060,19 +2060,24 @@ void ToggleBrowserSortMode::run()
{
case SortMode::Name:
Config.browser_sort_mode = SortMode::ModificationTime;
Statusbar::print("Sort songs by: Modification time");
Statusbar::print("Sort songs by: modification time");
break;
case SortMode::ModificationTime:
Config.browser_sort_mode = SortMode::CustomFormat;
Statusbar::print("Sort songs by: Custom format");
Statusbar::print("Sort songs by: custom format");
break;
case SortMode::CustomFormat:
Config.browser_sort_mode = SortMode::Name;
Statusbar::print("Sort songs by: Name");
Config.browser_sort_mode = SortMode::NoOp;
Statusbar::print("Do not sort songs");
break;
case SortMode::NoOp:
Config.browser_sort_mode = SortMode::Name;
Statusbar::print("Sort songs by: name");
}
std::sort(myBrowser->main().begin()+(myBrowser->CurrentDir() != "/"), myBrowser->main().end(),
LocaleBasedItemSorting(std::locale(), Config.ignore_leading_the, Config.browser_sort_mode));
if (Config.browser_sort_mode != SortMode::NoOp)
std::sort(myBrowser->main().begin()+(myBrowser->CurrentDir() != "/"), myBrowser->main().end(),
LocaleBasedItemSorting(std::locale(), Config.ignore_leading_the, Config.browser_sort_mode)
);
}
bool ToggleLibraryTagType::canBeRun() const