mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-28 18:19:42 +01:00
Merge pull request #4596 from Homulvas/master
Sorting by disc in advanced grouping
This commit is contained in:
commit
a6514617cf
@ -130,6 +130,8 @@ QStandardItem* GlobalSearchModel::BuildContainers(const Song& s,
|
||||
display_text = s.composer();
|
||||
case LibraryModel::GroupBy_Performer:
|
||||
display_text = s.performer();
|
||||
case LibraryModel::GroupBy_Disc:
|
||||
display_text = s.disc();
|
||||
case LibraryModel::GroupBy_Grouping:
|
||||
display_text = s.grouping();
|
||||
case LibraryModel::GroupBy_Genre:
|
||||
|
@ -78,8 +78,9 @@ GroupByDialog::GroupByDialog(QWidget* parent)
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Year, 7));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_YearAlbum, 8));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Bitrate, 9));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Performer, 10));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Grouping, 11));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Disc, 10));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Performer, 11));
|
||||
p_->mapping_.insert(Mapping(LibraryModel::GroupBy_Grouping, 12));
|
||||
|
||||
connect(ui_->button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
|
||||
SLOT(Reset()));
|
||||
|
@ -93,6 +93,11 @@
|
||||
<string>Bitrate</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disc</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -154,6 +159,11 @@
|
||||
<string>Bitrate</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disc</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@ -215,6 +225,11 @@
|
||||
<string>Bitrate</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disc</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -206,6 +206,9 @@ void LibraryModel::SongsDiscovered(const SongList& songs) {
|
||||
case GroupBy_Performer:
|
||||
key = song.performer();
|
||||
break;
|
||||
case GroupBy_Disc:
|
||||
key = song.disc();
|
||||
break;
|
||||
case GroupBy_Grouping:
|
||||
key = song.grouping();
|
||||
break;
|
||||
@ -296,6 +299,7 @@ QString LibraryModel::DividerKey(GroupBy type, LibraryItem* item) const {
|
||||
case GroupBy_Artist:
|
||||
case GroupBy_Composer:
|
||||
case GroupBy_Performer:
|
||||
case GroupBy_Disc:
|
||||
case GroupBy_Grouping:
|
||||
case GroupBy_Genre:
|
||||
case GroupBy_AlbumArtist:
|
||||
@ -334,6 +338,7 @@ QString LibraryModel::DividerDisplayText(GroupBy type,
|
||||
case GroupBy_Artist:
|
||||
case GroupBy_Composer:
|
||||
case GroupBy_Performer:
|
||||
case GroupBy_Disc:
|
||||
case GroupBy_Grouping:
|
||||
case GroupBy_Genre:
|
||||
case GroupBy_AlbumArtist:
|
||||
@ -783,11 +788,14 @@ void LibraryModel::InitQuery(GroupBy type, LibraryQuery* q) {
|
||||
case GroupBy_Performer:
|
||||
q->SetColumnSpec("DISTINCT performer");
|
||||
break;
|
||||
case GroupBy_Disc:
|
||||
q->SetColumnSpec("DISTINCT disc");
|
||||
break;
|
||||
case GroupBy_Grouping:
|
||||
q->SetColumnSpec("DISTINCT grouping");
|
||||
break;
|
||||
case GroupBy_YearAlbum:
|
||||
q->SetColumnSpec("DISTINCT year, album");
|
||||
q->SetColumnSpec("DISTINCT year, album, grouping");
|
||||
break;
|
||||
case GroupBy_Year:
|
||||
q->SetColumnSpec("DISTINCT year");
|
||||
@ -831,6 +839,7 @@ void LibraryModel::FilterQuery(GroupBy type, LibraryItem* item,
|
||||
case GroupBy_YearAlbum:
|
||||
q->AddWhere("year", item->metadata.year());
|
||||
q->AddWhere("album", item->metadata.album());
|
||||
q->AddWhere("grouping", item->metadata.grouping());
|
||||
break;
|
||||
case GroupBy_Year:
|
||||
q->AddWhere("year", item->key);
|
||||
@ -841,6 +850,9 @@ void LibraryModel::FilterQuery(GroupBy type, LibraryItem* item,
|
||||
case GroupBy_Performer:
|
||||
q->AddWhere("performer", item->key);
|
||||
break;
|
||||
case GroupBy_Disc:
|
||||
q->AddWhere("disc", item->key);
|
||||
break;
|
||||
case GroupBy_Grouping:
|
||||
q->AddWhere("grouping", item->key);
|
||||
break;
|
||||
@ -904,8 +916,9 @@ LibraryItem* LibraryModel::ItemFromQuery(GroupBy type, bool signal,
|
||||
year = qMax(0, row.value(0).toInt());
|
||||
item->metadata.set_year(row.value(0).toInt());
|
||||
item->metadata.set_album(row.value(1).toString());
|
||||
item->metadata.set_grouping(row.value(2).toString());
|
||||
item->key = PrettyYearAlbum(year, item->metadata.album());
|
||||
item->sort_text = SortTextForYear(year) + item->metadata.album();
|
||||
item->sort_text = SortTextForYear(year) + item->metadata.grouping() + item->metadata.album();
|
||||
break;
|
||||
|
||||
case GroupBy_Year:
|
||||
@ -916,6 +929,7 @@ LibraryItem* LibraryModel::ItemFromQuery(GroupBy type, bool signal,
|
||||
|
||||
case GroupBy_Composer:
|
||||
case GroupBy_Performer:
|
||||
case GroupBy_Disc:
|
||||
case GroupBy_Grouping:
|
||||
case GroupBy_Genre:
|
||||
case GroupBy_Album:
|
||||
@ -968,7 +982,7 @@ LibraryItem* LibraryModel::ItemFromSong(GroupBy type, bool signal,
|
||||
item->metadata.set_year(year);
|
||||
item->metadata.set_album(s.album());
|
||||
item->key = PrettyYearAlbum(year, s.album());
|
||||
item->sort_text = SortTextForYear(year) + s.album();
|
||||
item->sort_text = SortTextForYear(year) + s.grouping() + s.album();
|
||||
break;
|
||||
|
||||
case GroupBy_Year:
|
||||
@ -981,6 +995,8 @@ LibraryItem* LibraryModel::ItemFromSong(GroupBy type, bool signal,
|
||||
item->key = s.composer();
|
||||
case GroupBy_Performer:
|
||||
item->key = s.performer();
|
||||
case GroupBy_Disc:
|
||||
item->key = s.disc();
|
||||
case GroupBy_Grouping:
|
||||
item->key = s.grouping();
|
||||
case GroupBy_Genre:
|
||||
|
@ -84,6 +84,7 @@ class LibraryModel : public SimpleTreeModel<LibraryItem> {
|
||||
GroupBy_Performer = 9,
|
||||
GroupBy_Grouping = 10,
|
||||
GroupBy_Bitrate = 11,
|
||||
GroupBy_Disc = 12,
|
||||
};
|
||||
|
||||
struct Grouping {
|
||||
|
Loading…
x
Reference in New Issue
Block a user