mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Better handling of sourcepli
This commit is contained in:
@@ -372,13 +372,31 @@ SourceTreeView::latchOn()
|
|||||||
void
|
void
|
||||||
SourceTreeView::playlistChanged( PlaylistInterface* newInterface )
|
SourceTreeView::playlistChanged( PlaylistInterface* newInterface )
|
||||||
{
|
{
|
||||||
|
const PlaylistInterface* pi = AudioEngine::instance()->playlist();
|
||||||
|
bool listeningAlong = false;
|
||||||
|
source_ptr newSource;
|
||||||
|
|
||||||
|
if ( pi && dynamic_cast< const SourcePlaylistInterface* >( pi ) )
|
||||||
|
{
|
||||||
|
const SourcePlaylistInterface* sourcepi = dynamic_cast< const SourcePlaylistInterface* >( pi );
|
||||||
|
if ( !AudioEngine::instance()->state() == AudioEngine::Stopped )
|
||||||
|
{
|
||||||
|
listeningAlong = true;
|
||||||
|
newSource = sourcepi->source();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we were latched on and changed, send the listening along stop
|
// If we were latched on and changed, send the listening along stop
|
||||||
if ( !m_latch.isNull() )
|
if ( !m_latch.isNull() )
|
||||||
{
|
{
|
||||||
SourcePlaylistInterface* sourcepi = dynamic_cast< SourcePlaylistInterface* >( m_latch.data() );
|
SourcePlaylistInterface* origsourcepi = dynamic_cast< SourcePlaylistInterface* >( m_latch.data() );
|
||||||
Q_ASSERT( sourcepi );
|
Q_ASSERT( origsourcepi );
|
||||||
|
const source_ptr source = origsourcepi->source();
|
||||||
|
|
||||||
|
// if we're currently listening along to the same source, no change
|
||||||
|
if ( listeningAlong && ( !origsourcepi->source().isNull() && origsourcepi->source()->id() == newSource->id() ) )
|
||||||
|
return;
|
||||||
|
|
||||||
const source_ptr source = sourcepi->source();
|
|
||||||
DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction();
|
DatabaseCommand_SocialAction* cmd = new DatabaseCommand_SocialAction();
|
||||||
cmd->setSource( SourceList::instance()->getLocal() );
|
cmd->setSource( SourceList::instance()->getLocal() );
|
||||||
cmd->setAction( "latchOff");
|
cmd->setAction( "latchOff");
|
||||||
|
@@ -20,14 +20,11 @@
|
|||||||
#define SOURCETREEVIEW_H
|
#define SOURCETREEVIEW_H
|
||||||
|
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
|
#include "sourceplaylistinterface.h"
|
||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
namespace Tomahawk {
|
|
||||||
class PlaylistInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
class CollectionModel;
|
class CollectionModel;
|
||||||
class PlaylistModel;
|
class PlaylistModel;
|
||||||
class SourcesModel;
|
class SourcesModel;
|
||||||
|
Reference in New Issue
Block a user