mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-11 09:40:26 +00:00
Fixed some minor sorting and grouping issues.
This commit is contained in:
parent
1e5944fe41
commit
f485c3a052
@ -106,6 +106,7 @@ CategoryTrackListQuery::CategoryTrackListQuery(
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->orderBy = "ORDER BY " + kTrackListSortOrderBy.find(sortType)->second;
|
this->orderBy = "ORDER BY " + kTrackListSortOrderBy.find(sortType)->second;
|
||||||
|
this->parseHeaders = kTrackSortTypeWithAlbumGrouping.find(sortType) != kTrackSortTypeWithAlbumGrouping.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryTrackListQuery::~CategoryTrackListQuery() {
|
CategoryTrackListQuery::~CategoryTrackListQuery() {
|
||||||
@ -170,7 +171,7 @@ void CategoryTrackListQuery::ProcessResult(musik::core::db::Statement& trackQuer
|
|||||||
int64_t id = trackQuery.ColumnInt64(0);
|
int64_t id = trackQuery.ColumnInt64(0);
|
||||||
std::string album = trackQuery.ColumnText(1);
|
std::string album = trackQuery.ColumnText(1);
|
||||||
|
|
||||||
if (album != lastAlbum) {
|
if (this->parseHeaders && album != lastAlbum) {
|
||||||
headers->insert(index);
|
headers->insert(index);
|
||||||
lastAlbum = album;
|
lastAlbum = album;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
|||||||
void ProcessResult(musik::core::db::Statement& stmt);
|
void ProcessResult(musik::core::db::Statement& stmt);
|
||||||
|
|
||||||
musik::core::ILibraryPtr library;
|
musik::core::ILibraryPtr library;
|
||||||
|
bool parseHeaders;
|
||||||
Result result;
|
Result result;
|
||||||
Headers headers;
|
Headers headers;
|
||||||
Type type;
|
Type type;
|
||||||
|
@ -69,6 +69,7 @@ SearchTrackListQuery::SearchTrackListQuery(
|
|||||||
this->orderByPredicate = kTrackSearchSortOrderByPredicate.find(sort)->second + " AND ";
|
this->orderByPredicate = kTrackSearchSortOrderByPredicate.find(sort)->second + " AND ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->parseHeaders = kTrackSortTypeWithAlbumGrouping.find(sort) != kTrackSortTypeWithAlbumGrouping.end();
|
||||||
this->displayString = _TSTR(kTrackListOrderByToDisplayKey.find(sort)->second);
|
this->displayString = _TSTR(kTrackListOrderByToDisplayKey.find(sort)->second);
|
||||||
this->orderBy = kTrackListSortOrderBy.find(sort)->second;
|
this->orderBy = kTrackListSortOrderBy.find(sort)->second;
|
||||||
this->result.reset(new musik::core::TrackList(library));
|
this->result.reset(new musik::core::TrackList(library));
|
||||||
@ -152,7 +153,7 @@ bool SearchTrackListQuery::OnRun(Connection& db) {
|
|||||||
album = _TSTR("tracklist_unknown_album");
|
album = _TSTR("tracklist_unknown_album");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (album != lastAlbum) {
|
if (this->parseHeaders && album != lastAlbum) {
|
||||||
headers->insert(index);
|
headers->insert(index);
|
||||||
lastAlbum = album;
|
lastAlbum = album;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ namespace musik { namespace core { namespace db { namespace local {
|
|||||||
musik::core::ILibraryPtr library;
|
musik::core::ILibraryPtr library;
|
||||||
Result result;
|
Result result;
|
||||||
Headers headers;
|
Headers headers;
|
||||||
|
bool parseHeaders;
|
||||||
std::string filter;
|
std::string filter;
|
||||||
std::string orderBy;
|
std::string orderBy;
|
||||||
std::string orderByPredicate;
|
std::string orderByPredicate;
|
||||||
|
@ -75,7 +75,7 @@ namespace musik {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const std::map<TrackSortType, std::string> kTrackListSortOrderBy = {
|
static const std::map<TrackSortType, std::string> kTrackListSortOrderBy = {
|
||||||
{ TrackSortType::Title, "track, ar.name, al.name" },
|
{ TrackSortType::Title, "tracks.title, ar.name, al.name" },
|
||||||
{ TrackSortType::Album, "al.name, disc, track, ar.name" },
|
{ TrackSortType::Album, "al.name, disc, track, ar.name" },
|
||||||
{ TrackSortType::Artist, "ar.name, al.name, disc, track" },
|
{ TrackSortType::Artist, "ar.name, al.name, disc, track" },
|
||||||
{ TrackSortType::DateAddedAsc, "date(tracks.date_added) ASC, al.name, disc, track, ar.name" },
|
{ TrackSortType::DateAddedAsc, "date(tracks.date_added) ASC, al.name, disc, track, ar.name" },
|
||||||
@ -100,6 +100,15 @@ namespace musik {
|
|||||||
{ TrackSortType::PlayCountDesc, "tracks.play_count IS NOT NULL AND tracks.play_count > 0" },
|
{ TrackSortType::PlayCountDesc, "tracks.play_count IS NOT NULL AND tracks.play_count > 0" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const std::set<TrackSortType> kTrackSortTypeWithAlbumGrouping = {
|
||||||
|
TrackSortType::Album,
|
||||||
|
TrackSortType::Artist,
|
||||||
|
TrackSortType::DateAddedAsc,
|
||||||
|
TrackSortType::DateAddedDesc,
|
||||||
|
TrackSortType::DateUpdatedAsc,
|
||||||
|
TrackSortType::DateUpdatedDesc,
|
||||||
|
TrackSortType::Genre,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user