From 7519768cb1a9ed27012111d30cc69238616aba04 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 25 Nov 2014 19:00:06 +0100 Subject: [PATCH] Queue: add "reorder" parameter to SetPriority() --- src/queue/Queue.cxx | 5 +++-- src/queue/Queue.hxx | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/queue/Queue.cxx b/src/queue/Queue.cxx index 99b545ab1..039af096e 100644 --- a/src/queue/Queue.cxx +++ b/src/queue/Queue.cxx @@ -402,7 +402,8 @@ Queue::CountSamePriority(unsigned start_order, uint8_t priority) const } bool -Queue::SetPriority(unsigned position, uint8_t priority, int after_order) +Queue::SetPriority(unsigned position, uint8_t priority, int after_order, + bool reorder) { assert(position < length); @@ -414,7 +415,7 @@ Queue::SetPriority(unsigned position, uint8_t priority, int after_order) item->version = version; item->priority = priority; - if (!random) + if (!random || !reorder) /* don't reorder if not in random mode */ return true; diff --git a/src/queue/Queue.hxx b/src/queue/Queue.hxx index 016619e65..32acac689 100644 --- a/src/queue/Queue.hxx +++ b/src/queue/Queue.hxx @@ -340,10 +340,13 @@ struct Queue { /** * Shuffles a (position) range in the queue. The songs are physically * shuffled, not by using the "order" mapping. + * + * @param reorder false to suppress updating the order list */ void ShuffleRange(unsigned start, unsigned end); - bool SetPriority(unsigned position, uint8_t priority, int after_order); + bool SetPriority(unsigned position, uint8_t priority, int after_order, + bool reorder=true); bool SetPriorityRange(unsigned start_position, unsigned end_position, uint8_t priority, int after_order);