From d668a8aee295f8b8b69cdefd5597e7ff61396d86 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 12 Sep 2020 13:30:45 +0200 Subject: [PATCH] Change sort text for divider keys Fixes problems on Windows with specific regionale settings, where divider keys are all on the top, while albums are on the bottom --- src/collection/collectionmodel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index 221846350..23b6b4706 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -397,7 +397,7 @@ QString CollectionModel::DividerKey(const GroupBy type, CollectionItem *item) co case GroupBy_Genre: case GroupBy_Format: case GroupBy_FileType: { - QChar c = item->sort_text[0]; + QChar c = item->sort_text[0].toUpper(); if (c.isDigit()) return "0"; if (c == ' ') return QString(); if (c.decompositionTag() != QChar::NoDecomposition) @@ -1564,7 +1564,8 @@ void CollectionModel::FinishItem(const GroupBy type, const bool signal, const bo // Create the divider entry if we're supposed to if (create_divider && show_dividers_) { QString divider_key = DividerKey(type, item); - item->sort_text.prepend(divider_key); + if (item->sort_text.isEmpty() || item->sort_text[0].toUpper() != divider_key) + item->sort_text.prepend(divider_key); if (!divider_key.isEmpty() && !divider_nodes_.contains(divider_key)) { if (signal) @@ -1573,7 +1574,7 @@ void CollectionModel::FinishItem(const GroupBy type, const bool signal, const bo CollectionItem *divider = new CollectionItem(CollectionItem::Type_Divider, root_); divider->key = divider_key; divider->display_text = DividerDisplayText(type, divider_key); - divider->sort_text = divider_key; + divider->sort_text = divider_key + "0000"; divider->lazy_loaded = true; divider_nodes_[divider_key] = divider;