core/queue: Move queue_updated() out of the queue struct

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-11-20 08:02:54 -05:00
parent ff0c2a09a8
commit 3e5bef5f3c
4 changed files with 11 additions and 14 deletions

View File

@ -67,7 +67,7 @@ void AudioDriver :: eos()
{
if (cur_track) {
track_played(cur_track);
collection :: get_queue()->updated(cur_track);
queue_updated(collection :: get_queue(), cur_track);
}
_load_track(deck :: next(), continue_playback());

View File

@ -143,11 +143,11 @@ void queue :: del(struct track *track)
}
}
void queue :: updated(struct track *track)
void queue_updated(struct queue *queue, struct track *track)
{
for (unsigned int i = 0; i < q_tracks.size(); i++) {
if (q_tracks[i] == track)
q_notify->on_track_updated(i);
for (unsigned int i = 0; i < queue_size(queue); i++) {
if (queue->q_tracks[i] == track)
queue->q_notify->on_track_updated(i);
}
}

View File

@ -156,13 +156,6 @@ struct queue {
*/
virtual void del(struct track *);
/**
* Signal to the queue that a track has been updated.
*
* @param track The track that has been modified.
*/
void updated(struct track *);
/**
* Add a new sort field to the queue. If the field is already in the
@ -191,6 +184,10 @@ static inline struct track *queue_at(struct queue *queue, unsigned int index)
}
/* Called to tell the queue that a track has been updated. */
void queue_updated(struct queue *, struct track *);
/* Called to tell the queue that a specific index has been selected. */
void queue_selected(struct queue *, unsigned int);

View File

@ -146,9 +146,9 @@ static void test_stress(unsigned int N)
test_equal(q.q_length, ex_length);
test_equal(queue_size(&q), ex_size);
/* Queue :: updated(struct track *) */
/* queue_updated() */
track = track_get(2);
q.updated(track);
queue_updated(&q, track);
test_equal(count_updated, N / 13);
test_equal(queue_next(&q), NULL);