mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
* Fixed TWK-537: Adding social actions for remote sources was broken.
This commit is contained in:
@@ -49,22 +49,17 @@ DatabaseCommand_SocialAction::exec( DatabaseImpl* dbi )
|
|||||||
|
|
||||||
TomahawkSqlQuery query = dbi->newquery();
|
TomahawkSqlQuery query = dbi->newquery();
|
||||||
|
|
||||||
|
|
||||||
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
QVariant srcid = source()->isLocal() ? QVariant( QVariant::Int ) : source()->id();
|
||||||
|
|
||||||
int trkid = -2;
|
if ( m_artist.isNull() || m_track.isEmpty() )
|
||||||
if ( !m_result.isNull() && !m_artist.isNull() && !m_track.isEmpty() )
|
|
||||||
{
|
|
||||||
bool autoCreate = true;
|
|
||||||
int artid = dbi->artistId( m_artist, autoCreate );
|
|
||||||
if ( artid < 1 )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
autoCreate = true; // artistId overwrites autoCreate (reference)
|
int artid = dbi->artistId( m_artist, true );
|
||||||
trkid = dbi->trackId( artid, m_track, autoCreate );
|
if ( artid < 1 )
|
||||||
|
return;
|
||||||
|
int trkid = dbi->trackId( artid, m_track, true );
|
||||||
if ( trkid < 1 )
|
if ( trkid < 1 )
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// update if it already exists
|
// update if it already exists
|
||||||
TomahawkSqlQuery find = dbi->newquery();
|
TomahawkSqlQuery find = dbi->newquery();
|
||||||
@@ -80,12 +75,13 @@ DatabaseCommand_SocialAction::exec( DatabaseImpl* dbi )
|
|||||||
.arg( trkid )
|
.arg( trkid )
|
||||||
.arg( source()->isLocal() ? "IS NULL" : QString( "=%1" ).arg( source()->id() ) )
|
.arg( source()->isLocal() ? "IS NULL" : QString( "=%1" ).arg( source()->id() ) )
|
||||||
.arg( m_action ) );
|
.arg( m_action ) );
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
query.prepare( "INSERT INTO social_attributes(id, source, k, v, timestamp) "
|
query.prepare( "INSERT INTO social_attributes(id, source, k, v, timestamp) "
|
||||||
"VALUES (?, ?, ?, ?, ?)" );
|
"VALUES (?, ?, ?, ?, ?)" );
|
||||||
|
|
||||||
query.bindValue( 0, trkid >= -1 ? trkid : QVariant() );
|
query.bindValue( 0, trkid );
|
||||||
query.bindValue( 1, srcid );
|
query.bindValue( 1, srcid );
|
||||||
query.bindValue( 2, m_action );
|
query.bindValue( 2, m_action );
|
||||||
query.bindValue( 3, m_comment );
|
query.bindValue( 3, m_comment );
|
||||||
|
@@ -52,8 +52,11 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CustomPlaylistView::~CustomPlaylistView()
|
CustomPlaylistView::~CustomPlaylistView()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CustomPlaylistView::isBeingPlayed() const
|
CustomPlaylistView::isBeingPlayed() const
|
||||||
@@ -61,6 +64,7 @@ CustomPlaylistView::isBeingPlayed() const
|
|||||||
return AudioEngine::instance()->currentTrackPlaylist() == playlistInterface();
|
return AudioEngine::instance()->currentTrackPlaylist() == playlistInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CustomPlaylistView::jumpToCurrentTrack()
|
CustomPlaylistView::jumpToCurrentTrack()
|
||||||
{
|
{
|
||||||
@@ -96,6 +100,7 @@ CustomPlaylistView::generateTracks()
|
|||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CustomPlaylistView::tracksGenerated( QList< query_ptr > tracks )
|
CustomPlaylistView::tracksGenerated( QList< query_ptr > tracks )
|
||||||
{
|
{
|
||||||
@@ -103,6 +108,7 @@ CustomPlaylistView::tracksGenerated( QList< query_ptr > tracks )
|
|||||||
m_model->append( q );
|
m_model->append( q );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
CustomPlaylistView::title() const
|
CustomPlaylistView::title() const
|
||||||
{
|
{
|
||||||
@@ -132,18 +138,21 @@ CustomPlaylistView::description() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
CustomPlaylistView::longDescription() const
|
CustomPlaylistView::longDescription() const
|
||||||
{
|
{
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
CustomPlaylistView::pixmap() const
|
CustomPlaylistView::pixmap() const
|
||||||
{
|
{
|
||||||
return QPixmap( RESPATH "images/loved_playlist.png" );
|
return QPixmap( RESPATH "images/loved_playlist.png" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CustomPlaylistView::reload()
|
CustomPlaylistView::reload()
|
||||||
{
|
{
|
||||||
|
@@ -115,8 +115,11 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
|||||||
connect( this, SIGNAL( catchUpRequest() ), m_latchManager, SLOT( catchUpRequest() ) );
|
connect( this, SIGNAL( catchUpRequest() ), m_latchManager, SLOT( catchUpRequest() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SourceTreeView::~SourceTreeView()
|
SourceTreeView::~SourceTreeView()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeView::setupMenus()
|
SourceTreeView::setupMenus()
|
||||||
@@ -231,6 +234,7 @@ SourceTreeView::selectRequest( const QPersistentModelIndex& idx )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeView::expandRequest( const QPersistentModelIndex &idx )
|
SourceTreeView::expandRequest( const QPersistentModelIndex &idx )
|
||||||
{
|
{
|
||||||
@@ -245,6 +249,7 @@ SourceTreeView::loadPlaylist()
|
|||||||
onItemActivated( m_contextMenuIndex );
|
onItemActivated( m_contextMenuIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeView::deletePlaylist( const QModelIndex& idxIn )
|
SourceTreeView::deletePlaylist( const QModelIndex& idxIn )
|
||||||
{
|
{
|
||||||
@@ -353,6 +358,7 @@ SourceTreeView::latchOnOrCatchUp()
|
|||||||
emit latchRequest( source );
|
emit latchRequest( source );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourceTreeView::latchOff()
|
SourceTreeView::latchOff()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user