mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 02:09:48 +01:00
* Added methods to create playlists in SourceList class
This commit is contained in:
parent
16ef203411
commit
7966926d0c
@ -216,6 +216,24 @@ SourceList::get( const QString& username, const QString& friendlyName, bool auto
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceList::createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents )
|
||||
{
|
||||
Tomahawk::playlist_ptr p = Tomahawk::playlist_ptr( new Tomahawk::Playlist( src ) );
|
||||
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
||||
p->reportCreated( p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceList::createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents )
|
||||
{
|
||||
Tomahawk::dynplaylist_ptr p = Tomahawk::dynplaylist_ptr( new Tomahawk::DynamicPlaylist( src, contents.toMap().value( "type", QString() ).toString() ) );
|
||||
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
||||
p->reportCreated( p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceList::sourceSynced()
|
||||
{
|
||||
|
@ -54,6 +54,11 @@ public:
|
||||
Tomahawk::source_ptr get( const QString& username, const QString& friendlyName = QString(), bool autoCreate = false );
|
||||
Tomahawk::source_ptr get( int id ) const;
|
||||
|
||||
public slots:
|
||||
// called by the playlist creation dbcmds
|
||||
void createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
void createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
|
||||
signals:
|
||||
void ready();
|
||||
|
||||
|
@ -666,24 +666,6 @@ ViewManager::onWidgetDestroyed( QWidget* widget )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents )
|
||||
{
|
||||
Tomahawk::playlist_ptr p = Tomahawk::playlist_ptr( new Tomahawk::Playlist( src ) );
|
||||
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
||||
p->reportCreated( p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents )
|
||||
{
|
||||
Tomahawk::dynplaylist_ptr p = Tomahawk::dynplaylist_ptr( new Tomahawk::DynamicPlaylist( src, contents.toMap().value( "type", QString() ).toString() ) );
|
||||
QJson::QObjectHelper::qvariant2qobject( contents.toMap(), p.data() );
|
||||
p->reportCreated( p );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ViewManager::setTomahawkLoaded()
|
||||
{
|
||||
|
@ -153,10 +153,6 @@ public slots:
|
||||
|
||||
void playlistInterfaceChanged( Tomahawk::playlistinterface_ptr );
|
||||
|
||||
// called by the playlist creation dbcmds
|
||||
void createPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
void createDynamicPlaylist( const Tomahawk::source_ptr& src, const QVariant& contents );
|
||||
|
||||
void setTomahawkLoaded();
|
||||
|
||||
private slots:
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "playlist/dynamic/DynamicControl.h"
|
||||
#include "playlist/dynamic/GeneratorInterface.h"
|
||||
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@ -113,11 +113,11 @@ DatabaseCommand_CreateDynamicPlaylist::postCommitHook()
|
||||
|
||||
qDebug() << Q_FUNC_INFO << "..reporting..";
|
||||
if( m_playlist.isNull() ) {
|
||||
source_ptr src = source();
|
||||
|
||||
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 );
|
||||
QMetaObject::invokeMethod( SourceList::instance(),
|
||||
"createDynamicPlaylist",
|
||||
Qt::BlockingQueuedConnection,
|
||||
QGenericArgument( "Tomahawk::source_ptr", (const void*)&source() ),
|
||||
Q_ARG( QVariant, m_v ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -20,16 +20,12 @@
|
||||
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "Source.h"
|
||||
#include "SourceList.h"
|
||||
#include "DatabaseImpl.h"
|
||||
#include "TomahawkSqlQuery.h"
|
||||
#include "network/Servent.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include "ViewManager.h"
|
||||
#endif
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
@ -81,11 +77,11 @@ DatabaseCommand_CreatePlaylist::postCommitHook()
|
||||
tDebug() << Q_FUNC_INFO << "reporting...";
|
||||
if ( m_playlist.isNull() )
|
||||
{
|
||||
source_ptr src = source();
|
||||
|
||||
Tomahawk::playlist_ptr p = Tomahawk::playlist_ptr( new Tomahawk::Playlist( src ) );
|
||||
QJson::QObjectHelper::qvariant2qobject( m_v.toMap(), p.data() );
|
||||
p->reportCreated( p );
|
||||
QMetaObject::invokeMethod( SourceList::instance(),
|
||||
"createPlaylist",
|
||||
Qt::BlockingQueuedConnection,
|
||||
QGenericArgument( "Tomahawk::source_ptr", (const void*)&source() ),
|
||||
Q_ARG( QVariant, m_v ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user