]> git.tdb.fi Git - libs/al.git/commitdiff
Add a previous() method to Jukebox
authorMikko Rasa <tdb@tdb.fi>
Mon, 13 Dec 2010 10:06:24 +0000 (10:06 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 13 Dec 2010 10:06:24 +0000 (10:06 +0000)
source/jukebox.cpp
source/jukebox.h

index 391edd14a305a6485f9a0741cd672bde0fef3c2e..b8224b29596acd234f67c5cb22c7104cbb6eb83d 100644 (file)
@@ -111,6 +111,22 @@ void Jukebox::next()
        play();
 }
 
+void Jukebox::previous()
+{
+       if(shuffle)
+               return next();
+
+       stop();
+       if(tracks.size()>1)
+       {
+               if(current_track==tracks.begin())
+                       current_track=tracks.end();
+               --current_track;
+               signal_track_changed.emit(*current_track);
+       }
+       play();
+}
+
 void Jukebox::stop()
 {
        streamer.stop();
index 85a2b03201280e172e24828bf29b0771ad32c7ec..c4e0aaffaa017a1609e5d568d837d6cd724073e6 100644 (file)
@@ -45,6 +45,7 @@ public:
 
        void play();
        void next();
+       void previous();
        void stop();
        void tick();
 };