mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 01:54:07 +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
|
||||
DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( source().isNull() || source()->dbCollection().isNull() )
|
||||
{
|
||||
tDebug() << "Source has gone offline, not emitting to GUI.";
|
||||
@@ -90,19 +91,23 @@ DatabaseCommand_SetDynamicPlaylistRevision::postCommitHook()
|
||||
tLog() << "Postcommitting this playlist:" << playlistguid() << source().isNull();
|
||||
|
||||
// private, but we are a friend. will recall itself in its own thread:
|
||||
DynamicPlaylist* rawPl = 0;
|
||||
dynplaylist_ptr playlist = source()->dbCollection()->autoPlaylist( playlistguid() );
|
||||
if ( playlist.isNull() )
|
||||
if ( !playlist )
|
||||
playlist = source()->dbCollection()->station( playlistguid() );
|
||||
// UGH we don't have a sharedptr from DynamicPlaylist+
|
||||
|
||||
DynamicPlaylist* rawPl = playlist.data();
|
||||
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 = m_playlist;
|
||||
|
||||
if ( rawPl == 0 )
|
||||
if ( playlist )
|
||||
rawPl = playlist.data();
|
||||
else
|
||||
{
|
||||
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 );
|
||||
// if it's neither an auto or station, it must not be auto-loaded, so we MUST have been told about it directly
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -156,6 +161,8 @@ void
|
||||
DatabaseCommand_SetDynamicPlaylistRevision::exec( DatabaseImpl* lib )
|
||||
{
|
||||
DatabaseCommand_SetPlaylistRevision::exec( lib );
|
||||
if ( m_failed )
|
||||
return;
|
||||
|
||||
QVariantList newcontrols;
|
||||
foreach( const QVariant& v, m_controls )
|
||||
|
@@ -38,6 +38,7 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
||||
const QList<plentry_ptr>& addedentries,
|
||||
const QList<plentry_ptr>& entries )
|
||||
: DatabaseCommandLoggable( s )
|
||||
, m_failed( false )
|
||||
, m_applied( false )
|
||||
, m_newrev( newrev )
|
||||
, m_oldrev( oldrev )
|
||||
@@ -66,6 +67,7 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
||||
const QStringList& orderedguids,
|
||||
const QList<plentry_ptr>& entriesToUpdate )
|
||||
: DatabaseCommandLoggable( s )
|
||||
, m_failed( false )
|
||||
, m_applied( false )
|
||||
, m_newrev( newrev )
|
||||
, m_oldrev( oldrev )
|
||||
@@ -87,7 +89,7 @@ DatabaseCommand_SetPlaylistRevision::DatabaseCommand_SetPlaylistRevision(
|
||||
void
|
||||
DatabaseCommand_SetPlaylistRevision::postCommitHook()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( m_localOnly )
|
||||
return;
|
||||
|
||||
@@ -136,6 +138,7 @@ DatabaseCommand_SetPlaylistRevision::exec( DatabaseImpl* lib )
|
||||
{
|
||||
tDebug() << "ERROR: No such playlist:" << m_playlistguid << currentRevision << source()->friendlyName() << source()->id();
|
||||
// Q_ASSERT_X( false, "DatabaseCommand_SetPlaylistRevision::exec", "No such playlist, WTF?" );
|
||||
m_failed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -113,6 +113,7 @@ public:
|
||||
QVariantList orderedguids() const { return m_orderedguids; }
|
||||
|
||||
protected:
|
||||
bool m_failed;
|
||||
bool m_applied;
|
||||
QStringList m_previous_rev_orderedguids;
|
||||
QString m_playlistguid;
|
||||
|
Reference in New Issue
Block a user