mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-21 05:11:44 +02:00
Change latch menu item to "Catch Up" if you're already listening to that source, and allow Next button to catch you up too.
This commit is contained in:
@@ -155,9 +155,11 @@ void
|
||||
AudioEngine::previous()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( m_playlist->skipSeekRestrictions() != PlaylistInterface::NoSkip &&
|
||||
m_playlist->skipSeekRestrictions() != PlaylistInterface::NoSkipSeek )
|
||||
loadPreviousTrack();
|
||||
if ( m_playlist->skipRestrictions() == PlaylistInterface::NoSkip ||
|
||||
m_playlist->skipRestrictions() == PlaylistInterface::NoSkipBackwards )
|
||||
return;
|
||||
|
||||
loadPreviousTrack();
|
||||
}
|
||||
|
||||
|
||||
@@ -165,18 +167,19 @@ void
|
||||
AudioEngine::next()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( m_playlist->skipSeekRestrictions() != PlaylistInterface::NoSkip &&
|
||||
m_playlist->skipSeekRestrictions() != PlaylistInterface::NoSkipSeek )
|
||||
loadNextTrack();
|
||||
if ( m_playlist->skipRestrictions() == PlaylistInterface::NoSkip ||
|
||||
m_playlist->skipRestrictions() == PlaylistInterface::NoSkipForwards )
|
||||
return;
|
||||
|
||||
loadNextTrack();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::seek( int ms )
|
||||
{
|
||||
if ( m_playlist->skipSeekRestrictions() == PlaylistInterface::NoSeek ||
|
||||
m_playlist->skipSeekRestrictions() == PlaylistInterface::NoSkipSeek )
|
||||
return;
|
||||
if ( m_playlist->seekRestrictions() == PlaylistInterface::NoSeek )
|
||||
return;
|
||||
|
||||
if ( isPlaying() || isPaused() )
|
||||
{
|
||||
|
@@ -59,6 +59,8 @@ public:
|
||||
/* Returns the PlaylistInterface of the current playlist. Note: The currently playing track might still be from a different playlist! */
|
||||
Tomahawk::PlaylistInterface* playlist() const { return m_playlist; }
|
||||
|
||||
Tomahawk::result_ptr currentTrack() const { return m_currentTrack; }
|
||||
|
||||
public slots:
|
||||
void playPause();
|
||||
void play();
|
||||
|
@@ -35,7 +35,8 @@ class DLLEXPORT PlaylistInterface
|
||||
public:
|
||||
enum RepeatMode { NoRepeat, RepeatOne, RepeatAll };
|
||||
enum ViewMode { Unknown, Tree, Flat, Album };
|
||||
enum SkipSeekRestrictions { NoRestrictions, NoSkip, NoSeek, NoSkipSeek };
|
||||
enum SeekRestrictions { NoSeekRestrictions, NoSeek };
|
||||
enum SkipRestrictions { NoSkipRestrictions, NoSkipForwards, NoSkipBackwards, NoSkip };
|
||||
enum RetryMode { NoRetry, Retry };
|
||||
|
||||
PlaylistInterface( QObject* parent = 0 ) : m_object( parent ) {}
|
||||
@@ -53,7 +54,8 @@ public:
|
||||
virtual PlaylistInterface::RepeatMode repeatMode() const = 0;
|
||||
virtual bool shuffled() const = 0;
|
||||
virtual PlaylistInterface::ViewMode viewMode() const { return Unknown; }
|
||||
virtual PlaylistInterface::SkipSeekRestrictions skipSeekRestrictions() const { return NoRestrictions; }
|
||||
virtual PlaylistInterface::SeekRestrictions seekRestrictions() const { return NoSeekRestrictions; }
|
||||
virtual PlaylistInterface::SkipRestrictions skipRestrictions() const { return NoSkipRestrictions; }
|
||||
|
||||
virtual PlaylistInterface::RetryMode retryMode() const { return NoRetry; }
|
||||
virtual quint32 retryInterval() const { return 30000; }
|
||||
|
@@ -47,13 +47,16 @@ public:
|
||||
virtual Tomahawk::result_ptr nextItem();
|
||||
|
||||
virtual PlaylistInterface::RepeatMode repeatMode() const { return PlaylistInterface::NoRepeat; }
|
||||
virtual PlaylistInterface::SkipSeekRestrictions skipSeekRestrictions() const { return PlaylistInterface::NoSkipSeek; }
|
||||
virtual PlaylistInterface::SeekRestrictions seekRestrictions() const { return PlaylistInterface::NoSeek; }
|
||||
virtual PlaylistInterface::SkipRestrictions skipRestrictions() const { return PlaylistInterface::NoSkipBackwards; }
|
||||
virtual PlaylistInterface::RetryMode retryMode() const { return Retry; }
|
||||
virtual quint32 retryInterval() const { return 5000; }
|
||||
|
||||
virtual bool shuffled() const { return false; }
|
||||
virtual void setFilter( const QString& /*pattern*/ ) {}
|
||||
|
||||
virtual Tomahawk::source_ptr source() const { return m_source; }
|
||||
|
||||
public slots:
|
||||
virtual void setRepeatMode( PlaylistInterface::RepeatMode ) {}
|
||||
virtual void setShuffled( bool ) {}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "sourcetree/items/playlistitems.h"
|
||||
#include "sourcetree/items/collectionitem.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "sourceplaylistinterface.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
@@ -141,7 +142,25 @@ SourceTreeView::setupMenus()
|
||||
}
|
||||
}
|
||||
|
||||
m_followAction = m_followMenu.addAction( tr( "&Follow Music Stream" ) );
|
||||
if ( type == SourcesModel::Collection )
|
||||
{
|
||||
CollectionItem* item = itemFromIndex< CollectionItem >( m_contextMenuIndex );
|
||||
source_ptr source = item->source();
|
||||
if ( !source.isNull() )
|
||||
{
|
||||
PlaylistInterface* pi = AudioEngine::instance()->playlist();
|
||||
if ( pi && dynamic_cast< SourcePlaylistInterface* >( pi ) )
|
||||
{
|
||||
SourcePlaylistInterface* sourcepi = dynamic_cast< SourcePlaylistInterface* >( pi );
|
||||
if ( !sourcepi->source().isNull() && sourcepi->source()->id() == source->id() )
|
||||
m_followAction = m_followMenu.addAction( tr( "&Catch Up" ) );
|
||||
else
|
||||
m_followAction = m_followMenu.addAction( tr( "&Listen Along" ) );
|
||||
}
|
||||
else
|
||||
m_followAction = m_followMenu.addAction( tr( "&Listen Along" ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_loadPlaylistAction = m_playlistMenu.addAction( tr( "&Load Playlist" ) );
|
||||
m_renamePlaylistAction = m_playlistMenu.addAction( tr( "&Rename Playlist" ) );
|
||||
|
Reference in New Issue
Block a user