From d240ff44bc38880c5917f053495b4093f5749a28 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 29 Jan 2014 22:11:03 -0500 Subject: [PATCH] playqueue: Change cur when tracks are directly selected Signed-off-by: Anna Schumaker --- gui/model.cpp | 1 + include/playqueue.h | 2 +- lib/audio.cpp | 4 ++-- lib/playqueue.cpp | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gui/model.cpp b/gui/model.cpp index 9cfe28a5..27c3568c 100644 --- a/gui/model.cpp +++ b/gui/model.cpp @@ -49,6 +49,7 @@ void PlayqueueModel::on_row_changed(unsigned int row) void PlayqueueModel::on_path_selected(const Gtk::TreePath &path) { audio :: load_trackid(queue->operator[](path[0])); + queue->set_cur(path[0]); audio :: play(); } diff --git a/include/playqueue.h b/include/playqueue.h index 0c4e11c3..0f5a3b39 100644 --- a/include/playqueue.h +++ b/include/playqueue.h @@ -71,7 +71,7 @@ public: unsigned int operator[](unsigned int); unsigned int next(); - void reset_cur(); + void set_cur(unsigned int); #ifdef CONFIG_TEST void reset(); #endif /* CONFIG_TEST */ diff --git a/lib/audio.cpp b/lib/audio.cpp index ac81c5c5..143eb725 100644 --- a/lib/audio.cpp +++ b/lib/audio.cpp @@ -167,7 +167,7 @@ void audio :: next() cur_trackid = id; o_recently_played.add_front(id); - o_recently_played.reset_cur(); + o_recently_played.set_cur(0); } void audio :: previous() @@ -198,7 +198,7 @@ void audio :: load_trackid(unsigned int track_id) cur_trackid = track_id; o_recently_played.add_front(track_id); - o_recently_played.reset_cur(); + o_recently_played.set_cur(0); } unsigned int audio :: current_trackid() diff --git a/lib/playqueue.cpp b/lib/playqueue.cpp index a31bc27c..bcb7ab25 100644 --- a/lib/playqueue.cpp +++ b/lib/playqueue.cpp @@ -361,9 +361,9 @@ unsigned int Playqueue :: next() return res; } -void Playqueue :: reset_cur() +void Playqueue :: set_cur(unsigned int c) { - cur = 0; + cur = c; } #ifdef CONFIG_TEST