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