Collection: Use sort tags and add sort behaviour

This commit is contained in:
Mark
2025-07-25 12:35:43 +02:00
committed by Jonas Kvinge
parent 6dea1a2149
commit e7fc4b1706
6 changed files with 137 additions and 54 deletions

View File

@@ -87,6 +87,11 @@ CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog,
setWindowIcon(IconLoader::Load(u"library-music"_s, true, 0, 32));
ui_->add_directory->setIcon(IconLoader::Load(u"document-open-folder"_s));
ui_->combobox_sort->setItemData(0, static_cast<int>(SortBehaviour::AsIs));
ui_->combobox_sort->setItemData(1, static_cast<int>(SortBehaviour::SkipArticles));
ui_->combobox_sort->setItemData(2, static_cast<int>(SortBehaviour::UseSortTagForSort));
ui_->combobox_sort->setItemData(3, static_cast<int>(SortBehaviour::UseSortTagForDisplayAndSort));
ui_->combobox_cache_size->addItem(u"KB"_s, static_cast<int>(CacheSizeUnit::KB));
ui_->combobox_cache_size->addItem(u"MB"_s, static_cast<int>(CacheSizeUnit::MB));
@@ -152,7 +157,7 @@ void CollectionSettingsPage::Load() {
ui_->show_dividers->setChecked(s.value(kShowDividers, true).toBool());
ui_->pretty_covers->setChecked(s.value(kPrettyCovers, true).toBool());
ui_->various_artists->setChecked(s.value(kVariousArtists, true).toBool());
ui_->sort_skips_articles->setChecked(s.value(kSortSkipsArticles, true).toBool());
ui_->combobox_sort->setCurrentIndex(ui_->combobox_sort->findData(s.value(kSortBehaviour, static_cast<int>(SortBehaviour::SkipArticles)).toInt()));
ui_->startup_scan->setChecked(s.value(kStartupScan, true).toBool());
ui_->monitor->setChecked(s.value(kMonitor, true).toBool());
ui_->song_tracking->setChecked(s.value(kSongTracking, false).toBool());
@@ -196,7 +201,8 @@ void CollectionSettingsPage::Save() {
s.setValue(kShowDividers, ui_->show_dividers->isChecked());
s.setValue(kPrettyCovers, ui_->pretty_covers->isChecked());
s.setValue(kVariousArtists, ui_->various_artists->isChecked());
s.setValue(kSortSkipsArticles, ui_->sort_skips_articles->isChecked());
const SortBehaviour menu_sort = static_cast<SortBehaviour>(ui_->combobox_sort->currentData().toInt());
s.setValue(kSortBehaviour, static_cast<int>(menu_sort));
s.setValue(kStartupScan, ui_->startup_scan->isChecked());
s.setValue(kMonitor, ui_->monitor->isChecked());
s.setValue(kSongTracking, ui_->song_tracking->isChecked());

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>565</width>
<height>1003</height>
<width>604</width>
<height>1035</height>
</rect>
</property>
<property name="windowTitle">
@@ -235,11 +235,37 @@ If there are no matches then it will use the largest image in the directory.</st
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupbox_sort">
<property name="title">
<string>When sorting names like &quot;The Beatles&quot;...</string>
</property>
<layout class="QVBoxLayout" name="layout_sort">
<item>
<widget class="QCheckBox" name="sort_skips_articles">
<property name="text">
<string>Skip leading articles (&quot;the&quot;, &quot;a&quot;, &quot;an&quot;) when sorting artist names</string>
</property>
<widget class="QComboBox" name="combobox_sort">
<item>
<property name="text">
<string>Sort and show name as is</string>
</property>
</item>
<item>
<property name="text">
<string>Skip articles &quot;The, A, An&quot; for sorting but show name as is</string>
</property>
</item>
<item>
<property name="text">
<string>Use sort tag for sorting and show name as is</string>
</property>
</item>
<item>
<property name="text">
<string>Use sort tag for sorting and display</string>
</property>
</item>
</widget>
</item>
</layout>
@@ -525,7 +551,7 @@ If there are no matches then it will use the largest image in the directory.</st
<tabstop>show_dividers</tabstop>
<tabstop>pretty_covers</tabstop>
<tabstop>various_artists</tabstop>
<tabstop>sort_skips_articles</tabstop>
<tabstop>combobox_sort</tabstop>
<tabstop>spinbox_cache_size</tabstop>
<tabstop>combobox_cache_size</tabstop>
<tabstop>checkbox_disk_cache</tabstop>