mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 11:35:24 +01:00
Group things in the library model by the unicode decomposition of their
first character, and do a locale aware sort. Fixes issue #668 (again).
This commit is contained in:
parent
e940f9c5d2
commit
d337ffc6e4
@ -160,12 +160,18 @@ QString LibraryModel::DividerKey(GroupBy type, LibraryItem* item) const {
|
||||
case GroupBy_Composer:
|
||||
case GroupBy_Genre:
|
||||
case GroupBy_AlbumArtist:
|
||||
case GroupBy_FileType:
|
||||
case GroupBy_FileType: {
|
||||
if (item->sort_text[0].isDigit())
|
||||
return "0";
|
||||
if (item->sort_text[0] == ' ')
|
||||
return QString();
|
||||
return QString(item->sort_text[0]);
|
||||
|
||||
QChar c = item->sort_text[0];
|
||||
if (c.decompositionTag() != QChar::NoDecomposition)
|
||||
c = c.decomposition()[0];
|
||||
|
||||
return c.toLower();
|
||||
}
|
||||
|
||||
case GroupBy_Year:
|
||||
return SortTextForYear(item->sort_text.toInt() / 10 * 10);
|
||||
|
@ -202,6 +202,7 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
|
||||
library_sort_model_->setSourceModel(library_->model());
|
||||
library_sort_model_->setSortRole(LibraryModel::Role_SortText);
|
||||
library_sort_model_->setDynamicSortFilter(true);
|
||||
library_sort_model_->setSortLocaleAware(true);
|
||||
library_sort_model_->sort(0);
|
||||
|
||||
ui_->playlist->SetManager(playlists_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user