playqueue: Add flags to disable sorting
The history playqueue should never change sort order, so use this flag to prevent user changes. Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
6a227df41b
commit
2962d792d7
|
@ -13,7 +13,8 @@ enum playqueue_flags {
|
|||
PQ_ENABLED = (1 << 0),
|
||||
PQ_RANDOM = (1 << 1),
|
||||
PQ_REPEAT = (1 << 2),
|
||||
PQ_DISABLE_CHANGED_SIZE = (1 << 3),
|
||||
PQ_NEVER_SORT = (1 << 3),
|
||||
PQ_DISABLE_CHANGED_SIZE = (1 << 31),
|
||||
};
|
||||
|
||||
enum sort_t {
|
||||
|
|
|
@ -103,6 +103,7 @@ void audio :: init(int *argc, char ***argv)
|
|||
GstBus *bus;
|
||||
|
||||
o_recently_played.set_flag(PQ_REPEAT);
|
||||
o_recently_played.set_flag(PQ_NEVER_SORT);
|
||||
o_recently_played.set_flag(PQ_DISABLE_CHANGED_SIZE);
|
||||
gst_init(argc, argv);
|
||||
|
||||
|
|
|
@ -283,6 +283,9 @@ void Playqueue :: _add_sort(sort_t field)
|
|||
|
||||
void Playqueue :: add_sort(sort_t field)
|
||||
{
|
||||
if (flags & PQ_NEVER_SORT)
|
||||
return;
|
||||
|
||||
_add_sort(field);
|
||||
std::stable_sort(tracks.begin(), tracks.end(), SortTracks(sort_order));
|
||||
|
||||
|
@ -293,6 +296,8 @@ void Playqueue :: add_sort(sort_t field)
|
|||
|
||||
void Playqueue :: reset_sort(sort_t field)
|
||||
{
|
||||
if (flags & PQ_NEVER_SORT)
|
||||
return;
|
||||
sort_order.clear();
|
||||
add_sort(field);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue