[prev in list] [next in list] [prev in thread] [next in thread]
List: amarok
Subject: Re: Stop after
From: David_Dubroviæ <david.dubrovic () globalnet ! hr>
Date: 2008-12-20 17:29:01
Message-ID: 494D2B5D.3090700 () globalnet ! hr
[Download RAW message or body]
Nikolaj Hald Nielsen wrote:
> I tried applying your patch, and functionality wise I don't see
> anything major wrong with it. Interface wise, it might be nice to have
> "stop after current" exposed somewhere i the main toolbar, but I am
> not sure how this should be done.
>
> Even though their might be bigger plans for "stop after foo" ahead, I
> don't have any issues with committing this patch for 2.0.1 if you make
> the code adhere to out coding guidelines a bit better ( info on this
> can be found in the HACKING directory ) nd rsend the patch! :-)
>
> - Nikolaj
>
I corrected what I've found (mostly variable names). I believe It's ok
now. If not please tell me so I can fix it.
--
Gimzo
David Dubrovic
["amarok-stopafter-v2.patch" (text/x-patch)]
Index: src/playlist/PlaylistActions.cpp
===================================================================
--- src/playlist/PlaylistActions.cpp (revision 899388)
+++ src/playlist/PlaylistActions.cpp (working copy)
@@ -75,6 +75,7 @@
m_nextTrackCandidate = m_navigator->requestNextTrack();
}
+
Playlist::Actions::~Actions()
{
DEBUG_BLOCK
@@ -85,9 +86,22 @@
void
Playlist::Actions::requestNextTrack()
{
+ if (m_nextTrackCandidate!=0)return;
m_trackError = false;
+ if (stopAfterMode()==StopAfterQueue && m_currentTrack==m_trackToBeLast)
+ {
+ setStopAfterMode(StopAfterCurrent);
+ }
m_nextTrackCandidate = m_navigator->requestNextTrack();
- play( m_nextTrackCandidate, false );
+ m_currentTrack=m_nextTrackCandidate;
+ if (stopAfterMode()==StopAfterCurrent) //stop after current / stop after track \
starts here + {
+ setStopAfterMode(StopNever);
+ }
+ else
+ {
+ play( m_nextTrackCandidate, false );
+ }
}
void
Index: src/playlist/PlaylistActions.h
===================================================================
--- src/playlist/PlaylistActions.h (revision 899388)
+++ src/playlist/PlaylistActions.h (working copy)
@@ -84,6 +84,7 @@
StopAfterMode stopAfterMode() const { return m_stopAfterMode; }
void setStopAfterMode( StopAfterMode m ) { m_stopAfterMode = m; }
+ void setTrackToBeLast(quint64 id) { m_trackToBeLast = id; }
// This shouldn't be in Actions, it doesn't make sense
int queuePosition( quint64 id );
@@ -108,6 +109,8 @@
void engineNewTrackPlaying(); //from EngineObserver
quint64 m_nextTrackCandidate;
+ quint64 m_currentTrack;
+ quint64 m_trackToBeLast;
TrackNavigator* m_navigator; //! the strategy of what to \
do when a track finishes playing Playlist::StopAfterMode m_stopAfterMode;
bool m_trackError;
Index: src/playlist/view/listview/PrettyListView.cpp
===================================================================
--- src/playlist/view/listview/PrettyListView.cpp (revision 899388)
+++ src/playlist/view/listview/PrettyListView.cpp (working copy)
@@ -161,6 +161,14 @@
}
void
+Playlist::PrettyListView::stopAfterTrack()
+{
+ DEBUG_BLOCK
+ debug()<<"set stop after queue on track \
"<<currentIndex().data(UniqueIdRole).value<quint64>()<<endl; + \
Actions::instance()->setStopAfterMode(StopAfterQueue); + \
Actions::instance()->setTrackToBeLast(currentIndex().data( UniqueIdRole \
).value<quint64>()); +}
+void
Playlist::PrettyListView::dragMoveEvent( QDragMoveEvent* event )
{
QPoint mousept = event->pos() + QPoint( horizontalOffset(), verticalOffset() );
Index: src/playlist/view/listview/PrettyListView.h
===================================================================
--- src/playlist/view/listview/PrettyListView.h (revision 899388)
+++ src/playlist/view/listview/PrettyListView.h (working copy)
@@ -56,6 +56,7 @@
void dequeueSelection();
void queueSelection();
void removeSelection();
+ void stopAfterTrack();
void scrollToActiveTrack();
void find( const QString & searchTerm, int fields );
Index: src/playlist/view/PlaylistViewCommon.cpp
===================================================================
--- src/playlist/view/PlaylistViewCommon.cpp (revision 899388)
+++ src/playlist/view/PlaylistViewCommon.cpp (working copy)
@@ -72,7 +72,7 @@
else
menu->addAction( KIcon( "media-track-queue-amarok" ), i18n( "Dequeue Track" \
), parent, SLOT( dequeueSelection() ) );
- //( menu->addAction( KIcon( "media-playback-stop-amarok" ), i18n( "Stop Playing \
After Track" ), parent, SLOT( stopAfterTrack() ) ) )->setEnabled( false ); + ( \
menu->addAction( KIcon( "media-playback-stop-amarok" ), i18n( "Stop Playing After \
Track" ), parent, SLOT( stopAfterTrack() ) ) )->setEnabled( true );
menu->addSeparator();
( menu->addAction( KIcon( "media-track-remove-amarok" ), i18n( "Remove From \
Playlist" ), parent, SLOT( removeSelection() ) ) )->setEnabled( true );
_______________________________________________
Amarok mailing list
Amarok@kde.org
https://mail.kde.org/mailman/listinfo/amarok
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic