From 811c0e618d42f87acdd7d5aba7928374759c4a48 Mon Sep 17 00:00:00 2001 From: Lucas Lira Gomes Date: Mon, 23 Jul 2012 23:39:25 -0300 Subject: [PATCH] * Made DatabaseCommand_CreateDynamicPlaylist and DatabaseCommand_CreatePlaylist independent of ViewManager --- .../DatabaseCommand_CreateDynamicPlaylist.cpp | 15 +++++++-------- .../database/DatabaseCommand_CreatePlaylist.cpp | 11 ++++------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/libtomahawk/database/DatabaseCommand_CreateDynamicPlaylist.cpp b/src/libtomahawk/database/DatabaseCommand_CreateDynamicPlaylist.cpp index ad8d8e374..b64c45b5f 100644 --- a/src/libtomahawk/database/DatabaseCommand_CreateDynamicPlaylist.cpp +++ b/src/libtomahawk/database/DatabaseCommand_CreateDynamicPlaylist.cpp @@ -114,14 +114,13 @@ DatabaseCommand_CreateDynamicPlaylist::postCommitHook() qDebug() << Q_FUNC_INFO << "..reporting.."; if( m_playlist.isNull() ) { source_ptr src = source(); -#ifndef ENABLE_HEADLESS - QMetaObject::invokeMethod( ViewManager::instance(), - "createDynamicPlaylist", - Qt::BlockingQueuedConnection, - QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ), - Q_ARG( QVariant, m_v ) ); -#endif - } else { + + Tomahawk::dynplaylist_ptr p = Tomahawk::dynplaylist_ptr( new Tomahawk::DynamicPlaylist( src, m_v.toMap().value( "type", QString() ).toString() ) ); + QJson::QObjectHelper::qvariant2qobject( m_v.toMap(), p.data() ); + p->reportCreated( p ); + } + else + { m_playlist->reportCreated( m_playlist ); } if( source()->isLocal() ) diff --git a/src/libtomahawk/database/DatabaseCommand_CreatePlaylist.cpp b/src/libtomahawk/database/DatabaseCommand_CreatePlaylist.cpp index 31fb7e285..f2e2ce771 100644 --- a/src/libtomahawk/database/DatabaseCommand_CreatePlaylist.cpp +++ b/src/libtomahawk/database/DatabaseCommand_CreatePlaylist.cpp @@ -82,13 +82,10 @@ DatabaseCommand_CreatePlaylist::postCommitHook() if ( m_playlist.isNull() ) { source_ptr src = source(); -#ifndef ENABLE_HEADLESS - QMetaObject::invokeMethod( ViewManager::instance(), - "createPlaylist", - Qt::BlockingQueuedConnection, - QGenericArgument( "Tomahawk::source_ptr", (const void*)&src ), - Q_ARG( QVariant, m_v ) ); -#endif + + Tomahawk::playlist_ptr p = Tomahawk::playlist_ptr( new Tomahawk::Playlist( src ) ); + QJson::QObjectHelper::qvariant2qobject( m_v.toMap(), p.data() ); + p->reportCreated( p ); } else {