mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-17 11:30:49 +02:00
* DbCmd_SetDynamicPlaylistRevision should check if its parent's exec() succeeded.
This commit is contained in:
committed by
Michael Zanetti
parent
02dee0ec06
commit
045e4df526
@@ -75,6 +75,7 @@ DatabaseCommand_SetDynamicPlaylistRevision::controlsV()
|
|||||||
void
|
void
|
||||||
DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
|
DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
|
||||||
{
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO;
|
||||||
if ( source().isNull() || source()->dbCollection().isNull() )
|
if ( source().isNull() || source()->dbCollection().isNull() )
|
||||||
{
|
{
|
||||||
tDebug() << "Source has gone offline, not emitting to GUI.";
|
tDebug() << "Source has gone offline, not emitting to GUI.";
|
||||||
@@ -90,19 +91,23 @@ DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
|
|||||||
tLog() << "Postcommitting this playlist:" << playlistguid() << source().isNull();
|
tLog() << "Postcommitting this playlist:" << playlistguid() << source().isNull();
|
||||||
|
|
||||||
// private, but we are a friend. will recall itself in its own thread:
|
// private, but we are a friend. will recall itself in its own thread:
|
||||||
|
DynamicPlaylist* rawPl = 0;
|
||||||
dynplaylist_ptr playlist = source()->dbCollection()->autoPlaylist( playlistguid() );
|
dynplaylist_ptr playlist = source()->dbCollection()->autoPlaylist( playlistguid() );
|
||||||
if ( playlist.isNull() )
|
if ( !playlist )
|
||||||
playlist = source()->dbCollection()->station( playlistguid() );
|
playlist = source()->dbCollection()->station( playlistguid() );
|
||||||
// UGH we don't have a sharedptr from DynamicPlaylist+
|
|
||||||
|
|
||||||
DynamicPlaylist* rawPl = playlist.data();
|
if ( playlist )
|
||||||
if( playlist.isNull() ) // if it's neither an auto or station, it must not be auto-loaded, so we MUST have been told about it directly
|
rawPl = playlist.data();
|
||||||
rawPl = m_playlist;
|
else
|
||||||
|
|
||||||
if ( rawPl == 0 )
|
|
||||||
{
|
{
|
||||||
tLog() <<"Got null playlist with guid:" << playlistguid() << "from source and collection:" << source()->friendlyName() << source()->dbCollection()->name() << "and mode is static?:" << (m_mode == Static);
|
// if it's neither an auto or station, it must not be auto-loaded, so we MUST have been told about it directly
|
||||||
Q_ASSERT( false );
|
rawPl = m_playlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !rawPl )
|
||||||
|
{
|
||||||
|
tLog() << "Got null playlist with guid:" << playlistguid() << "from source and collection:" << source()->friendlyName() << source()->dbCollection()->name() << "and mode is static?:" << (m_mode == Static);
|
||||||
|
// Q_ASSERT( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +161,8 @@ void
|
|||||||
DatabaseCommand_SetDynamicPlaylistRevision::exec( DatabaseImpl* lib )
|
DatabaseCommand_SetDynamicPlaylistRevision::exec( DatabaseImpl* lib )
|
||||||
{
|
{
|
||||||
DatabaseCommand_SetPlaylistRevision::exec( lib );
|
DatabaseCommand_SetPlaylistRevision::exec( lib );
|
||||||
|
if ( m_failed )
|
||||||
|
return;
|
||||||
|
|
||||||
QVariantList newcontrols;
|
QVariantList newcontrols;
|
||||||
foreach( const QVariant& v, m_controls )
|
foreach( const QVariant& v, m_controls )
|
||||||
|
@@ -38,6 +38,7 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
|||||||
const QList<plentry_ptr>& addedentries,
|
const QList<plentry_ptr>& addedentries,
|
||||||
const QList<plentry_ptr>& entries )
|
const QList<plentry_ptr>& entries )
|
||||||
: DatabaseCommandLoggable( s )
|
: DatabaseCommandLoggable( s )
|
||||||
|
, m_failed( false )
|
||||||
, m_applied( false )
|
, m_applied( false )
|
||||||
, m_newrev( newrev )
|
, m_newrev( newrev )
|
||||||
, m_oldrev( oldrev )
|
, m_oldrev( oldrev )
|
||||||
@@ -66,6 +67,7 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
|||||||
const QStringList& orderedguids,
|
const QStringList& orderedguids,
|
||||||
const QList<plentry_ptr>& entriesToUpdate )
|
const QList<plentry_ptr>& entriesToUpdate )
|
||||||
: DatabaseCommandLoggable( s )
|
: DatabaseCommandLoggable( s )
|
||||||
|
, m_failed( false )
|
||||||
, m_applied( false )
|
, m_applied( false )
|
||||||
, m_newrev( newrev )
|
, m_newrev( newrev )
|
||||||
, m_oldrev( oldrev )
|
, m_oldrev( oldrev )
|
||||||
@@ -87,7 +89,7 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
|||||||
void
|
void
|
||||||
DatabaseCommand_SetPlaylistRevision::postCommitHook()
|
DatabaseCommand_SetPlaylistRevision::postCommitHook()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
tDebug() << Q_FUNC_INFO;
|
||||||
if ( m_localOnly )
|
if ( m_localOnly )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -136,6 +138,7 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
|||||||
{
|
{
|
||||||
tDebug() << "ERROR: No such playlist:" << m_playlistguid << currentRevision << source()->friendlyName() << source()->id();
|
tDebug() << "ERROR: No such playlist:" << m_playlistguid << currentRevision << source()->friendlyName() << source()->id();
|
||||||
// Q_ASSERT_X( false, "DatabaseCommand_SetPlaylistRevision::exec", "No such playlist, WTF?" );
|
// Q_ASSERT_X( false, "DatabaseCommand_SetPlaylistRevision::exec", "No such playlist, WTF?" );
|
||||||
|
m_failed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,6 +113,7 @@ public:
|
|||||||
QVariantList orderedguids() const { return m_orderedguids; }
|
QVariantList orderedguids() const { return m_orderedguids; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool m_failed;
|
||||||
bool m_applied;
|
bool m_applied;
|
||||||
QStringList m_previous_rev_orderedguids;
|
QStringList m_previous_rev_orderedguids;
|
||||||
QString m_playlistguid;
|
QString m_playlistguid;
|
||||||
|
Reference in New Issue
Block a user