1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

* Fixed DbCmds for offline sources. Well hopefully.

This commit is contained in:
Christian Muehlhaeuser
2011-02-16 05:52:17 +01:00
parent a7f90d097d
commit e1d5d8ec22
10 changed files with 50 additions and 5 deletions

View File

@@ -33,6 +33,11 @@ void
DatabaseCommand_AddFiles::postCommitHook() DatabaseCommand_AddFiles::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
// make the collection object emit its tracksAdded signal, so the // make the collection object emit its tracksAdded signal, so the
// collection browser will update/fade in etc. // collection browser will update/fade in etc.

View File

@@ -79,6 +79,12 @@ void
DatabaseCommand_CreateDynamicPlaylist::postCommitHook() DatabaseCommand_CreateDynamicPlaylist::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
if( report() == false ) if( report() == false )
return; return;

View File

@@ -38,6 +38,11 @@ void
DatabaseCommand_CreatePlaylist::postCommitHook() DatabaseCommand_CreatePlaylist::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
if( m_report == false ) if( m_report == false )
return; return;

View File

@@ -46,6 +46,11 @@ void
DatabaseCommand_DeleteDynamicPlaylist::postCommitHook() DatabaseCommand_DeleteDynamicPlaylist::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO << "..reporting..:" << m_playlistguid; qDebug() << Q_FUNC_INFO << "..reporting..:" << m_playlistguid;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
dynplaylist_ptr playlist = source()->collection()->dynamicPlaylist( m_playlistguid ); dynplaylist_ptr playlist = source()->collection()->dynamicPlaylist( m_playlistguid );
Q_ASSERT( !playlist.isNull() ); Q_ASSERT( !playlist.isNull() );

View File

@@ -34,7 +34,12 @@ void
DatabaseCommand_DeletePlaylist::postCommitHook() DatabaseCommand_DeletePlaylist::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO << "..reporting.."; qDebug() << Q_FUNC_INFO << "..reporting..";
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
playlist_ptr playlist = source()->collection()->playlist( m_playlistguid ); playlist_ptr playlist = source()->collection()->playlist( m_playlistguid );
Q_ASSERT( !playlist.isNull() ); Q_ASSERT( !playlist.isNull() );

View File

@@ -15,7 +15,12 @@ void
DatabaseCommand_LogPlayback::postCommitHook() DatabaseCommand_LogPlayback::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
connect( this, SIGNAL( trackPlaying( Tomahawk::query_ptr ) ), connect( this, SIGNAL( trackPlaying( Tomahawk::query_ptr ) ),
source().data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), Qt::QueuedConnection ); source().data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), Qt::QueuedConnection );
connect( this, SIGNAL( trackPlayed( Tomahawk::query_ptr ) ), connect( this, SIGNAL( trackPlayed( Tomahawk::query_ptr ) ),

View File

@@ -37,7 +37,12 @@ void
DatabaseCommand_RenamePlaylist::postCommitHook() DatabaseCommand_RenamePlaylist::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO << "..reporting.."; qDebug() << Q_FUNC_INFO << "..reporting..";
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
playlist_ptr playlist = source()->collection()->playlist( m_playlistguid ); playlist_ptr playlist = source()->collection()->playlist( m_playlistguid );
Q_ASSERT( !playlist.isNull() ); Q_ASSERT( !playlist.isNull() );

View File

@@ -60,6 +60,11 @@ void
DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook() DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
QStringList orderedentriesguids; QStringList orderedentriesguids;
foreach( const QVariant& v, orderedguids() ) foreach( const QVariant& v, orderedguids() )

View File

@@ -37,7 +37,12 @@ void
DatabaseCommand_SetPlaylistRevision::postCommitHook() DatabaseCommand_SetPlaylistRevision::postCommitHook()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
if ( source().isNull() || source()->collection().isNull() )
{
qDebug() << "Source has gone offline, not emitting to GUI.";
return;
}
if ( m_localOnly ) if ( m_localOnly )
return; return;

View File

@@ -87,7 +87,6 @@ DatabaseWorker::doWork()
} }
try try
{ {
if ( !cmd->source().isNull() && !cmd->source()->collection().isNull() )
{ {
cmd->_exec( m_dbimpl ); // runs actual SQL stuff cmd->_exec( m_dbimpl ); // runs actual SQL stuff