Add group by version check in internet search view too

This commit is contained in:
Jonas Kvinge 2020-09-12 00:32:50 +02:00
parent 52cff01b9c
commit 41b94233c6
1 changed files with 11 additions and 4 deletions

View File

@ -240,10 +240,16 @@ void InternetSearchView::ReloadSettings() {
break; break;
} }
int group_by_version = s.value("search_group_by_version", 0).toInt();
if (group_by_version == 1 && s.contains("search_group_by1") && s.contains("search_group_by2") && s.contains("search_group_by3")) {
SetGroupBy(CollectionModel::Grouping( SetGroupBy(CollectionModel::Grouping(
CollectionModel::GroupBy(s.value("search_group_by1", int(CollectionModel::GroupBy_AlbumArtist)).toInt()), CollectionModel::GroupBy(s.value("search_group_by1", int(CollectionModel::GroupBy_AlbumArtist)).toInt()),
CollectionModel::GroupBy(s.value("search_group_by2", int(CollectionModel::GroupBy_AlbumDisc)).toInt()), CollectionModel::GroupBy(s.value("search_group_by2", int(CollectionModel::GroupBy_AlbumDisc)).toInt()),
CollectionModel::GroupBy(s.value("search_group_by3", int(CollectionModel::GroupBy_None)).toInt()))); CollectionModel::GroupBy(s.value("search_group_by3", int(CollectionModel::GroupBy_None)).toInt())));
}
else {
SetGroupBy(CollectionModel::Grouping(CollectionModel::GroupBy(CollectionModel::GroupBy_AlbumArtist), CollectionModel::GroupBy(CollectionModel::GroupBy_AlbumDisc), CollectionModel::GroupBy(CollectionModel::GroupBy_None)));
}
s.endGroup(); s.endGroup();
s.beginGroup(AppearanceSettingsPage::kSettingsGroup); s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
@ -694,6 +700,7 @@ void InternetSearchView::SetGroupBy(const CollectionModel::Grouping &g) {
// Save the setting // Save the setting
QSettings s; QSettings s;
s.beginGroup(service_->settings_group()); s.beginGroup(service_->settings_group());
s.setValue("search_group_by_version", 1);
s.setValue("search_group_by1", int(g.first)); s.setValue("search_group_by1", int(g.first));
s.setValue("search_group_by2", int(g.second)); s.setValue("search_group_by2", int(g.second));
s.setValue("search_group_by3", int(g.third)); s.setValue("search_group_by3", int(g.third));