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