[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src
From: Gary David Steinert <fatlardo () gmail ! com>
Date: 2008-11-20 4:31:54
Message-ID: 1227155514.012736.3818.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 886800 by gsteinert:
Remembers the last playing song on restart.
I think I've fixed the problems with the OSD appearing briefly at startup. At
least, there is no sign of metaDataChanged() in the console output.
This does however expose Playlist::Actions::m_nextTrackCandidate with the
requestTrack() function. I'm hoping nobody has a problem with this =)
BUG:168789
M +4 -0 App.cpp
M +4 -0 amarok.kcfg
M +7 -0 playlist/PlaylistActions.cpp
M +5 -0 playlist/PlaylistActions.h
M +12 -0 playlist/PlaylistModel.cpp
--- trunk/extragear/multimedia/amarok/src/App.cpp #886799:886800
@@ -239,6 +239,10 @@
// I asked Trolltech! *smug*
Amarok::OSD::destroy();
+ //I tried this in the destructor for the Model but the object is destroyed after \
the + //Config is written. Go figure!
+ AmarokConfig::setLastPlaying( Playlist::Model::instance()->rowForTrack( \
Playlist::Model::instance()->activeTrack() ) ); +
AmarokConfig::setVersion( APP_VERSION );
AmarokConfig::self()->writeConfig();
--- trunk/extragear/multimedia/amarok/src/amarok.kcfg #886799:886800
@@ -378,6 +378,10 @@
<entry key="Visible Browsers" type="IntList">
<label>List of bools describing which browsers are visible, from top to \
bottom.</label> </entry>
+ <entry key="LastPlaying" type="Int">
+ <label>Track playing on last exit. Value is -1 if no track was \
playing.</label> + <default>-1</default>
+ </entry>
<entry key="Active Browser" type="Int">
<label>Number (from the top) of the last active browser.</label>
</entry>
--- trunk/extragear/multimedia/amarok/src/playlist/PlaylistActions.cpp #886799:886800
@@ -107,7 +107,14 @@
play( m_nextTrackCandidate );
}
+void
+Playlist::Actions::requestTrack( quint64 id )
+{
+ m_trackError = false;
+ m_nextTrackCandidate = id;
+}
+
void
Playlist::Actions::play()
{
--- trunk/extragear/multimedia/amarok/src/playlist/PlaylistActions.h #886799:886800
@@ -77,6 +77,11 @@
*/
void requestPrevTrack();
+ /**
+ * Set next track from track id, but don't start playing immediately
+ */
+ void requestTrack( quint64 id );
+
StopAfterMode stopAfterMode() const { return m_stopAfterMode; }
void setStopAfterMode( StopAfterMode m ) { m_stopAfterMode = m; }
--- trunk/extragear/multimedia/amarok/src/playlist/PlaylistModel.cpp #886799:886800
@@ -31,6 +31,7 @@
#include "Debug.h"
#include "DirectoryLoader.h"
#include "EngineController.h"
+#include "PlaylistActions.h"
#include "PlaylistController.h"
#include "PlaylistItem.h"
#include "PlaylistFileSupport.h"
@@ -115,6 +116,17 @@
m_itemIds.insert( i->id(), i );
}
}
+
+ //Select previously saved track
+ const int playingTrack = AmarokConfig::lastPlaying();
+
+ if ( playingTrack > -1 )
+ setActiveRow( playingTrack );
+
+ //Stop Amarok from advancing to the next track when play
+ //is pressed.
+ Playlist::Actions::instance()->requestTrack( idAt( playingTrack ) );
+
}
Playlist::Model::~Model()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic