mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Hopefully the last set of debug spam cleanup :-)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -41,7 +41,7 @@ ACLSystem::ACLSystem( QObject* parent )
|
|||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
//qRegisterMetaType< QHash< QString, QHash< QString, ACL > > >("ACLSystem::ACLCacheHash");
|
//qRegisterMetaType< QHash< QString, QHash< QString, ACL > > >("ACLSystem::ACLCacheHash");
|
||||||
|
|
||||||
QStringList savedEntries = TomahawkSettings::instance()->aclEntries();
|
QStringList savedEntries = TomahawkSettings::instance()->aclEntries();
|
||||||
if( !savedEntries.empty() && savedEntries.size() % 3 == 0 )
|
if( !savedEntries.empty() && savedEntries.size() % 3 == 0 )
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ ACLSystem::ACLSystem( QObject* parent )
|
|||||||
index += 3;
|
index += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_saveTimer.setSingleShot( false );
|
m_saveTimer.setSingleShot( false );
|
||||||
m_saveTimer.setInterval( 60000 );
|
m_saveTimer.setInterval( 60000 );
|
||||||
connect( &m_saveTimer, SIGNAL( timeout() ), this, SLOT( saveTimerFired() ) );
|
connect( &m_saveTimer, SIGNAL( timeout() ), this, SLOT( saveTimerFired() ) );
|
||||||
@@ -70,10 +70,10 @@ ACLSystem::~ACLSystem()
|
|||||||
ACLSystem::ACL
|
ACLSystem::ACL
|
||||||
ACLSystem::isAuthorizedUser( const QString& dbid )
|
ACLSystem::isAuthorizedUser( const QString& dbid )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
QMutexLocker locker( &m_cacheMutex );
|
QMutexLocker locker( &m_cacheMutex );
|
||||||
qDebug() << "Current cache keys = " << m_cache.keys();
|
qDebug() << "Current cache keys =" << m_cache.keys();
|
||||||
qDebug() << "Looking up dbid";
|
// qDebug() << "Looking up dbid";
|
||||||
if( !m_cache.contains( dbid ) )
|
if( !m_cache.contains( dbid ) )
|
||||||
return ACLSystem::NotFound;
|
return ACLSystem::NotFound;
|
||||||
else
|
else
|
||||||
@@ -88,12 +88,12 @@ ACLSystem::isAuthorizedUser( const QString& dbid )
|
|||||||
void
|
void
|
||||||
ACLSystem::authorizeUser( const QString& dbid, ACLSystem::ACL globalType )
|
ACLSystem::authorizeUser( const QString& dbid, ACLSystem::ACL globalType )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
if( globalType == ACLSystem::NotFound )
|
if( globalType == ACLSystem::NotFound )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMutexLocker locker( &m_cacheMutex );
|
QMutexLocker locker( &m_cacheMutex );
|
||||||
|
|
||||||
QHash< QString, ACL > peerHash;
|
QHash< QString, ACL > peerHash;
|
||||||
if( m_cache.contains( dbid ) )
|
if( m_cache.contains( dbid ) )
|
||||||
peerHash = m_cache[dbid];
|
peerHash = m_cache[dbid];
|
||||||
@@ -105,10 +105,10 @@ ACLSystem::ACL
|
|||||||
ACLSystem::isAuthorizedPath( const QString& dbid, const QString& path )
|
ACLSystem::isAuthorizedPath( const QString& dbid, const QString& path )
|
||||||
{
|
{
|
||||||
QMutexLocker locker( &m_cacheMutex );
|
QMutexLocker locker( &m_cacheMutex );
|
||||||
|
|
||||||
if( !m_cache.contains( dbid ) )
|
if( !m_cache.contains( dbid ) )
|
||||||
return ACLSystem::NotFound;
|
return ACLSystem::NotFound;
|
||||||
|
|
||||||
QHash< QString, ACL > peerHash = m_cache[dbid];
|
QHash< QString, ACL > peerHash = m_cache[dbid];
|
||||||
if( !peerHash.contains( path ) )
|
if( !peerHash.contains( path ) )
|
||||||
{
|
{
|
||||||
|
@@ -185,7 +185,7 @@ Collection::station( const QString& guid )
|
|||||||
void
|
void
|
||||||
Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << plists.count();
|
// qDebug() << Q_FUNC_INFO << plists.count();
|
||||||
foreach ( const playlist_ptr& p, plists )
|
foreach ( const playlist_ptr& p, plists )
|
||||||
{
|
{
|
||||||
// qDebug() << "Batch inserting playlist:" << p->guid();
|
// qDebug() << "Batch inserting playlist:" << p->guid();
|
||||||
@@ -198,7 +198,7 @@ Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
|||||||
void
|
void
|
||||||
Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << plists.count();
|
// qDebug() << Q_FUNC_INFO << plists.count();
|
||||||
|
|
||||||
foreach ( const dynplaylist_ptr& p, plists )
|
foreach ( const dynplaylist_ptr& p, plists )
|
||||||
{
|
{
|
||||||
@@ -212,7 +212,7 @@ Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
|
|||||||
void
|
void
|
||||||
Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << stations.count();
|
// qDebug() << Q_FUNC_INFO << stations.count();
|
||||||
|
|
||||||
foreach ( const dynplaylist_ptr& s, stations )
|
foreach ( const dynplaylist_ptr& s, stations )
|
||||||
{
|
{
|
||||||
@@ -226,7 +226,7 @@ Collection::setStations( const QList< dynplaylist_ptr >& stations )
|
|||||||
void
|
void
|
||||||
Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
|
Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << tracks.count() << name();
|
// qDebug() << Q_FUNC_INFO << tracks.count() << name();
|
||||||
|
|
||||||
m_tracks << tracks;
|
m_tracks << tracks;
|
||||||
emit tracksAdded( tracks );
|
emit tracksAdded( tracks );
|
||||||
|
@@ -38,7 +38,6 @@ DatabaseCollection::DatabaseCollection( const source_ptr& src, QObject* parent )
|
|||||||
void
|
void
|
||||||
DatabaseCollection::loadPlaylists()
|
DatabaseCollection::loadPlaylists()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
DatabaseCommand_LoadAllPlaylists* cmd = new DatabaseCommand_LoadAllPlaylists( source() );
|
DatabaseCommand_LoadAllPlaylists* cmd = new DatabaseCommand_LoadAllPlaylists( source() );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( done( const QList<Tomahawk::playlist_ptr>& ) ),
|
connect( cmd, SIGNAL( done( const QList<Tomahawk::playlist_ptr>& ) ),
|
||||||
@@ -51,7 +50,6 @@ DatabaseCollection::loadPlaylists()
|
|||||||
void
|
void
|
||||||
DatabaseCollection::loadAutoPlaylists()
|
DatabaseCollection::loadAutoPlaylists()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
DatabaseCommand_LoadAllAutoPlaylists* cmd = new DatabaseCommand_LoadAllAutoPlaylists( source() );
|
DatabaseCommand_LoadAllAutoPlaylists* cmd = new DatabaseCommand_LoadAllAutoPlaylists( source() );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( autoPlaylistLoaded( Tomahawk::source_ptr, QVariantList ) ),
|
connect( cmd, SIGNAL( autoPlaylistLoaded( Tomahawk::source_ptr, QVariantList ) ),
|
||||||
@@ -60,10 +58,10 @@ DatabaseCollection::loadAutoPlaylists()
|
|||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DatabaseCollection::loadStations()
|
DatabaseCollection::loadStations()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
DatabaseCommand_LoadAllStations* cmd = new DatabaseCommand_LoadAllStations( source() );
|
DatabaseCommand_LoadAllStations* cmd = new DatabaseCommand_LoadAllStations( source() );
|
||||||
|
|
||||||
connect( cmd, SIGNAL( stationLoaded( Tomahawk::source_ptr, QVariantList ) ),
|
connect( cmd, SIGNAL( stationLoaded( Tomahawk::source_ptr, QVariantList ) ),
|
||||||
@@ -110,8 +108,6 @@ DatabaseCollection::removeTracks( const QDir& dir )
|
|||||||
QList< Tomahawk::playlist_ptr >
|
QList< Tomahawk::playlist_ptr >
|
||||||
DatabaseCollection::playlists()
|
DatabaseCollection::playlists()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
|
|
||||||
if ( Collection::playlists().isEmpty() )
|
if ( Collection::playlists().isEmpty() )
|
||||||
{
|
{
|
||||||
loadPlaylists();
|
loadPlaylists();
|
||||||
@@ -124,8 +120,6 @@ DatabaseCollection::playlists()
|
|||||||
QList< dynplaylist_ptr >
|
QList< dynplaylist_ptr >
|
||||||
DatabaseCollection::autoPlaylists()
|
DatabaseCollection::autoPlaylists()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
|
|
||||||
if ( Collection::autoPlaylists().isEmpty() )
|
if ( Collection::autoPlaylists().isEmpty() )
|
||||||
{
|
{
|
||||||
loadAutoPlaylists();
|
loadAutoPlaylists();
|
||||||
@@ -134,11 +128,10 @@ DatabaseCollection::autoPlaylists()
|
|||||||
return Collection::autoPlaylists();
|
return Collection::autoPlaylists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList< dynplaylist_ptr >
|
QList< dynplaylist_ptr >
|
||||||
DatabaseCollection::stations()
|
DatabaseCollection::stations()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
|
|
||||||
if ( Collection::stations().isEmpty() )
|
if ( Collection::stations().isEmpty() )
|
||||||
{
|
{
|
||||||
loadStations();
|
loadStations();
|
||||||
@@ -151,8 +144,6 @@ DatabaseCollection::stations()
|
|||||||
QList< Tomahawk::query_ptr >
|
QList< Tomahawk::query_ptr >
|
||||||
DatabaseCollection::tracks()
|
DatabaseCollection::tracks()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
|
||||||
|
|
||||||
if ( !isLoaded() )
|
if ( !isLoaded() )
|
||||||
{
|
{
|
||||||
loadTracks();
|
loadTracks();
|
||||||
@@ -161,6 +152,7 @@ DatabaseCollection::tracks()
|
|||||||
return Collection::tracks();
|
return Collection::tracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
|
void DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVariantList& data )
|
||||||
{
|
{
|
||||||
dynplaylist_ptr p( new DynamicPlaylist( source, //src
|
dynplaylist_ptr p( new DynamicPlaylist( source, //src
|
||||||
@@ -177,6 +169,7 @@ void DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QV
|
|||||||
addAutoPlaylist( p );
|
addAutoPlaylist( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList& data )
|
void DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList& data )
|
||||||
{
|
{
|
||||||
dynplaylist_ptr p( new DynamicPlaylist( source, //src
|
dynplaylist_ptr p( new DynamicPlaylist( source, //src
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -31,17 +31,18 @@
|
|||||||
class DatabaseCommand_LoadDynamicPlaylist : public DatabaseCommand_LoadPlaylistEntries
|
class DatabaseCommand_LoadDynamicPlaylist : public DatabaseCommand_LoadPlaylistEntries
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseCommand_LoadDynamicPlaylist( QString revision_guid, QObject* parent = 0 )
|
explicit DatabaseCommand_LoadDynamicPlaylist( QString revision_guid, QObject* parent = 0 )
|
||||||
: DatabaseCommand_LoadPlaylistEntries( revision_guid, parent )
|
: DatabaseCommand_LoadPlaylistEntries( revision_guid, parent )
|
||||||
{ qDebug() << "loaded with:" << revision_guid << guid(); }
|
{
|
||||||
|
// qDebug() << "loaded with:" << revision_guid << guid();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void exec( DatabaseImpl* );
|
virtual void exec( DatabaseImpl* );
|
||||||
virtual bool doesMutates() const { return false; }
|
virtual bool doesMutates() const { return false; }
|
||||||
virtual QString commandname() const { return "loaddynamicplaylist"; }
|
virtual QString commandname() const { return "loaddynamicplaylist"; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// used if loading an ondemand playlist
|
// used if loading an ondemand playlist
|
||||||
void done( QString,
|
void done( QString,
|
||||||
@@ -58,7 +59,7 @@ signals:
|
|||||||
bool,
|
bool,
|
||||||
QMap< QString, Tomahawk::plentry_ptr >,
|
QMap< QString, Tomahawk::plentry_ptr >,
|
||||||
bool );
|
bool );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -108,31 +108,31 @@ Servent::startListening( QHostAddress ha, bool upnp, int port )
|
|||||||
defPortAlso = listen( ha, defPort );
|
defPortAlso = listen( ha, defPort );
|
||||||
if( !defPortAlso )
|
if( !defPortAlso )
|
||||||
{
|
{
|
||||||
qDebug() << "Failed to listen on both port " << m_port << " and port " << defPort;
|
qDebug() << "Failed to listen on both port" << m_port << "and port" << defPort;
|
||||||
qDebug() << "Error string is " << errorString();
|
qDebug() << "Error string is" << errorString();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qDebug() << "Servent listening on port " << defPort << " servent thread:" << thread();
|
qDebug() << "Servent listening on port" << defPort << "servent thread:" << thread();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool defPortAlso = listen( ha, defPort );
|
bool defPortAlso = listen( ha, defPort );
|
||||||
qDebug() << "Servent listening on port " << m_port << " servent thread:" << thread();
|
qDebug() << "Servent listening on port" << m_port << "servent thread:" << thread();
|
||||||
if( defPortAlso )
|
if( defPortAlso )
|
||||||
qDebug() << "Servent also listening on port " << defPort << " servent thread:" << thread();
|
qDebug() << "Servent also listening on port" << defPort << "servent thread:" << thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --lanhack means to advertise your LAN IP over jabber as if it were externallyVisible
|
// --lanhack means to advertise your LAN IP over jabber as if it were externallyVisible
|
||||||
qDebug() << "Address mode = " << (int)(TomahawkSettings::instance()->externalAddressMode());
|
qDebug() << "Address mode =" << (int)(TomahawkSettings::instance()->externalAddressMode());
|
||||||
qDebug() << "Static host/port preferred ? = " << ( TomahawkSettings::instance()->preferStaticHostPort() ? "true" : "false" );
|
qDebug() << "Static host/port preferred =" << ( TomahawkSettings::instance()->preferStaticHostPort() ? "true" : "false" );
|
||||||
|
|
||||||
if( TomahawkSettings::instance()->preferStaticHostPort() )
|
if( TomahawkSettings::instance()->preferStaticHostPort() )
|
||||||
{
|
{
|
||||||
qDebug() << "Forcing static preferred host and port";
|
qDebug() << "Forcing static preferred host and port";
|
||||||
m_externalHostname = TomahawkSettings::instance()->externalHostname();
|
m_externalHostname = TomahawkSettings::instance()->externalHostname();
|
||||||
m_externalPort = TomahawkSettings::instance()->externalPort();
|
m_externalPort = TomahawkSettings::instance()->externalPort();
|
||||||
qDebug() << m_externalHostname << m_externalPort;
|
// qDebug() << m_externalHostname << m_externalPort;
|
||||||
emit ready();
|
emit ready();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ Servent::startListening( QHostAddress ha, bool upnp, int port )
|
|||||||
QString
|
QString
|
||||||
Servent::createConnectionKey( const QString& name, const QString &nodeid, const QString &key, bool onceOnly )
|
Servent::createConnectionKey( const QString& name, const QString &nodeid, const QString &key, bool onceOnly )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
Q_ASSERT( this->thread() == QThread::currentThread() );
|
Q_ASSERT( this->thread() == QThread::currentThread() );
|
||||||
|
|
||||||
QString _key = ( key.isEmpty() ? uuid() : key );
|
QString _key = ( key.isEmpty() ? uuid() : key );
|
||||||
@@ -226,7 +226,7 @@ Servent::registerOffer( const QString& key, Connection* conn )
|
|||||||
void
|
void
|
||||||
Servent::registerControlConnection( ControlConnection* conn )
|
Servent::registerControlConnection( ControlConnection* conn )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << conn->id();
|
// qDebug() << Q_FUNC_INFO << conn->id();
|
||||||
m_controlconnections.append( conn );
|
m_controlconnections.append( conn );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ Servent::incomingConnection( int sd )
|
|||||||
|
|
||||||
connect( sock, SIGNAL( readyRead() ), SLOT( readyRead() ), Qt::QueuedConnection );
|
connect( sock, SIGNAL( readyRead() ), SLOT( readyRead() ), Qt::QueuedConnection );
|
||||||
connect( sock, SIGNAL( disconnected() ), sock, SLOT( deleteLater() ), Qt::QueuedConnection );
|
connect( sock, SIGNAL( disconnected() ), sock, SLOT( deleteLater() ), Qt::QueuedConnection );
|
||||||
qDebug() << "connection accepted.";
|
// qDebug() << "connection accepted.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -324,13 +324,13 @@ Servent::readyRead()
|
|||||||
nodeid = m.value( "nodeid" ).toString();
|
nodeid = m.value( "nodeid" ).toString();
|
||||||
controlid = m.value( "controlid" ).toString();
|
controlid = m.value( "controlid" ).toString();
|
||||||
|
|
||||||
qDebug() << "Incoming connection details: " << m;
|
qDebug() << "Incoming connection details:" << m;
|
||||||
|
|
||||||
if( !nodeid.isEmpty() ) // only control connections send nodeid
|
if( !nodeid.isEmpty() ) // only control connections send nodeid
|
||||||
{
|
{
|
||||||
foreach( ControlConnection* con, m_controlconnections )
|
foreach( ControlConnection* con, m_controlconnections )
|
||||||
{
|
{
|
||||||
qDebug() << con->socket() << sock;
|
// qDebug() << con->socket() << sock;
|
||||||
if( con->id() == nodeid )
|
if( con->id() == nodeid )
|
||||||
{
|
{
|
||||||
qDebug() << "Duplicate control connection detected, dropping:" << nodeid << conntype;
|
qDebug() << "Duplicate control connection detected, dropping:" << nodeid << conntype;
|
||||||
@@ -420,7 +420,7 @@ Servent::socketConnected()
|
|||||||
{
|
{
|
||||||
QTcpSocketExtra* sock = (QTcpSocketExtra*)sender();
|
QTcpSocketExtra* sock = (QTcpSocketExtra*)sender();
|
||||||
|
|
||||||
qDebug() << "Servent::SocketConnected" << thread() << "socket:" << sock;
|
// qDebug() << "Servent::SocketConnected" << thread() << "socket:" << sock;
|
||||||
|
|
||||||
Connection* conn = sock->_conn;
|
Connection* conn = sock->_conn;
|
||||||
handoverSocket( conn, sock );
|
handoverSocket( conn, sock );
|
||||||
@@ -565,7 +565,7 @@ Servent::reverseOfferRequest( ControlConnection* orig_conn, const QString &their
|
|||||||
Connection*
|
Connection*
|
||||||
Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString &key, const QHostAddress peer )
|
Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString &key, const QHostAddress peer )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
bool noauth = qApp->arguments().contains( "--noauth" );
|
bool noauth = qApp->arguments().contains( "--noauth" );
|
||||||
|
|
||||||
@@ -722,7 +722,7 @@ Servent::checkACL( const Connection* conn, const QString &nodeid, bool showDialo
|
|||||||
QSharedPointer<QIODevice>
|
QSharedPointer<QIODevice>
|
||||||
Servent::remoteIODeviceFactory( const result_ptr& result )
|
Servent::remoteIODeviceFactory( const result_ptr& result )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << thread();
|
// qDebug() << Q_FUNC_INFO << thread();
|
||||||
QSharedPointer<QIODevice> sp;
|
QSharedPointer<QIODevice> sp;
|
||||||
|
|
||||||
QStringList parts = result->url().mid( QString( "servent://" ).length() ).split( "\t" );
|
QStringList parts = result->url().mid( QString( "servent://" ).length() ).split( "\t" );
|
||||||
@@ -809,10 +809,10 @@ bool
|
|||||||
Servent::connectedToSession( const QString& session )
|
Servent::connectedToSession( const QString& session )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
qDebug() << "Checking against" << session;
|
// qDebug() << "Checking against" << session;
|
||||||
foreach( ControlConnection* cc, m_controlconnections )
|
foreach( ControlConnection* cc, m_controlconnections )
|
||||||
{
|
{
|
||||||
qDebug() << "Checking session" << cc->id();
|
// qDebug() << "Checking session" << cc->id();
|
||||||
if( cc->id() == session )
|
if( cc->id() == session )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ DynamicPlaylist::DynamicPlaylist ( const Tomahawk::source_ptr& src,
|
|||||||
const QString& guid )
|
const QString& guid )
|
||||||
: Playlist( src, currentrevision, title, info, creator, createdOn, shared, lastmod, guid )
|
: Playlist( src, currentrevision, title, info, creator, createdOn, shared, lastmod, guid )
|
||||||
{
|
{
|
||||||
qDebug() << "Creating Dynamic Playlist 1";
|
// qDebug() << "Creating Dynamic Playlist 1";
|
||||||
// TODO instantiate generator
|
// TODO instantiate generator
|
||||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||||
m_generator->setMode( mode );
|
m_generator->setMode( mode );
|
||||||
@@ -74,7 +74,7 @@ DynamicPlaylist::DynamicPlaylist ( const Tomahawk::source_ptr& author,
|
|||||||
bool shared )
|
bool shared )
|
||||||
: Playlist ( author, guid, title, info, creator, shared )
|
: Playlist ( author, guid, title, info, creator, shared )
|
||||||
{
|
{
|
||||||
qDebug() << "Creating Dynamic Playlist 2";
|
// qDebug() << "Creating Dynamic Playlist 2";
|
||||||
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
m_generator = geninterface_ptr( GeneratorFactory::create( type ) );
|
||||||
m_generator->setMode( mode );
|
m_generator->setMode( mode );
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ DynamicPlaylist::createNewRevision( const QString& newrev,
|
|||||||
void
|
void
|
||||||
DynamicPlaylist::loadRevision( const QString& rev )
|
DynamicPlaylist::loadRevision( const QString& rev )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Loading with:" << ( rev.isEmpty() ? currentrevision() : rev );
|
// qDebug() << Q_FUNC_INFO << "Loading with:" << ( rev.isEmpty() ? currentrevision() : rev );
|
||||||
|
|
||||||
setBusy( true );
|
setBusy( true );
|
||||||
DatabaseCommand_LoadDynamicPlaylist* cmd = new DatabaseCommand_LoadDynamicPlaylist( rev.isEmpty() ? currentrevision() : rev );
|
DatabaseCommand_LoadDynamicPlaylist* cmd = new DatabaseCommand_LoadDynamicPlaylist( rev.isEmpty() ? currentrevision() : rev );
|
||||||
@@ -258,7 +258,7 @@ DynamicPlaylist::remove( const Tomahawk::dynplaylist_ptr& playlist )
|
|||||||
void
|
void
|
||||||
DynamicPlaylist::reportCreated( const Tomahawk::dynplaylist_ptr& self )
|
DynamicPlaylist::reportCreated( const Tomahawk::dynplaylist_ptr& self )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
Q_ASSERT( self.data() == this );
|
Q_ASSERT( self.data() == this );
|
||||||
Q_ASSERT( !author().isNull() );
|
Q_ASSERT( !author().isNull() );
|
||||||
Q_ASSERT( !author()->collection().isNull() );
|
Q_ASSERT( !author()->collection().isNull() );
|
||||||
@@ -274,7 +274,7 @@ DynamicPlaylist::reportCreated( const Tomahawk::dynplaylist_ptr& self )
|
|||||||
void
|
void
|
||||||
DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
DynamicPlaylist::reportDeleted( const Tomahawk::dynplaylist_ptr& self )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
Q_ASSERT( self.data() == this );
|
Q_ASSERT( self.data() == this );
|
||||||
// will emit Collection::playlistDeleted(...)
|
// will emit Collection::playlistDeleted(...)
|
||||||
if( self->mode() == Static )
|
if( self->mode() == Static )
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -34,7 +34,7 @@ Tomahawk::EchonestControl::EchonestControl( const QString& selectedType, const Q
|
|||||||
m_editingTimer.setInterval( 500 ); //timeout to edits
|
m_editingTimer.setInterval( 500 ); //timeout to edits
|
||||||
m_editingTimer.setSingleShot( true );
|
m_editingTimer.setSingleShot( true );
|
||||||
connect( &m_editingTimer, SIGNAL( timeout() ), this, SLOT( editTimerFired() ) );
|
connect( &m_editingTimer, SIGNAL( timeout() ), this, SLOT( editTimerFired() ) );
|
||||||
|
|
||||||
m_delayedEditTimer.setInterval( 250 ); // additional timer for "just typing" without enter or focus change
|
m_delayedEditTimer.setInterval( 250 ); // additional timer for "just typing" without enter or focus change
|
||||||
m_delayedEditTimer.setSingleShot( true );
|
m_delayedEditTimer.setSingleShot( true );
|
||||||
connect( &m_delayedEditTimer, SIGNAL( timeout() ), &m_editingTimer, SLOT( start() ) );
|
connect( &m_delayedEditTimer, SIGNAL( timeout() ), &m_editingTimer, SLOT( start() ) );
|
||||||
@@ -54,7 +54,7 @@ Tomahawk::EchonestControl::matchSelector()
|
|||||||
return m_match.data();
|
return m_match.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::setSelectedType ( const QString& type )
|
Tomahawk::EchonestControl::setSelectedType ( const QString& type )
|
||||||
{
|
{
|
||||||
if( type != selectedType() ) {
|
if( type != selectedType() ) {
|
||||||
@@ -62,11 +62,11 @@ Tomahawk::EchonestControl::setSelectedType ( const QString& type )
|
|||||||
delete m_input.data();
|
delete m_input.data();
|
||||||
if( !m_match.isNull() )
|
if( !m_match.isNull() )
|
||||||
delete m_match.data();
|
delete m_match.data();
|
||||||
|
|
||||||
Tomahawk::DynamicControl::setSelectedType ( type );
|
Tomahawk::DynamicControl::setSelectedType ( type );
|
||||||
updateWidgets();
|
updateWidgets();
|
||||||
updateData();
|
updateData();
|
||||||
qDebug() << "Setting new type, set data to:" << m_data.first << m_data.second;
|
// qDebug() << "Setting new type, set data to:" << m_data.first << m_data.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,34 +81,34 @@ Tomahawk::EchonestControl::toENParam() const
|
|||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Tomahawk::EchonestControl::input() const
|
Tomahawk::EchonestControl::input() const
|
||||||
{
|
{
|
||||||
return m_data.second.toString();
|
return m_data.second.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Tomahawk::EchonestControl::match() const
|
Tomahawk::EchonestControl::match() const
|
||||||
{
|
{
|
||||||
return m_matchData;
|
return m_matchData;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Tomahawk::EchonestControl::matchString() const
|
Tomahawk::EchonestControl::matchString() const
|
||||||
{
|
{
|
||||||
return m_matchString;
|
return m_matchString;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Tomahawk::EchonestControl::summary() const
|
Tomahawk::EchonestControl::summary() const
|
||||||
{
|
{
|
||||||
if( m_summary.isEmpty() )
|
if( m_summary.isEmpty() )
|
||||||
const_cast< EchonestControl* >( this )->calculateSummary();
|
const_cast< EchonestControl* >( this )->calculateSummary();
|
||||||
|
|
||||||
return m_summary;
|
return m_summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::setInput(const QString& input)
|
Tomahawk::EchonestControl::setInput(const QString& input)
|
||||||
{
|
{
|
||||||
// TODO generate widgets
|
// TODO generate widgets
|
||||||
@@ -116,7 +116,7 @@ Tomahawk::EchonestControl::setInput(const QString& input)
|
|||||||
updateWidgetsFromData();
|
updateWidgetsFromData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::setMatch(const QString& match)
|
Tomahawk::EchonestControl::setMatch(const QString& match)
|
||||||
{
|
{
|
||||||
// TODO generate widgets
|
// TODO generate widgets
|
||||||
@@ -124,7 +124,7 @@ Tomahawk::EchonestControl::setMatch(const QString& match)
|
|||||||
updateWidgetsFromData();
|
updateWidgetsFromData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::updateWidgets()
|
Tomahawk::EchonestControl::updateWidgets()
|
||||||
{
|
{
|
||||||
if( !m_input.isNull() )
|
if( !m_input.isNull() )
|
||||||
@@ -132,54 +132,54 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
if( !m_match.isNull() )
|
if( !m_match.isNull() )
|
||||||
delete m_match.data();
|
delete m_match.data();
|
||||||
m_overrideType = -1;
|
m_overrideType = -1;
|
||||||
|
|
||||||
// make sure the widgets are the proper kind for the selected type, and hook up to their slots
|
// make sure the widgets are the proper kind for the selected type, and hook up to their slots
|
||||||
if( selectedType() == "Artist" ) {
|
if( selectedType() == "Artist" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Artist;
|
m_currentType = Echonest::DynamicPlaylist::Artist;
|
||||||
|
|
||||||
QComboBox* match = new QComboBox();
|
QComboBox* match = new QComboBox();
|
||||||
QLineEdit* input = new QLineEdit();
|
QLineEdit* input = new QLineEdit();
|
||||||
|
|
||||||
match->addItem( "Limit To", Echonest::DynamicPlaylist::ArtistType );
|
match->addItem( "Limit To", Echonest::DynamicPlaylist::ArtistType );
|
||||||
match->addItem( "Similar To", Echonest::DynamicPlaylist::ArtistRadioType );
|
match->addItem( "Similar To", Echonest::DynamicPlaylist::ArtistRadioType );
|
||||||
m_matchString = match->currentText();
|
m_matchString = match->currentText();
|
||||||
m_matchData = match->itemData( match->currentIndex() ).toString();
|
m_matchData = match->itemData( match->currentIndex() ).toString();
|
||||||
|
|
||||||
input->setPlaceholderText( "Artist name" );
|
input->setPlaceholderText( "Artist name" );
|
||||||
input->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed );
|
input->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed );
|
||||||
|
|
||||||
connect( match, SIGNAL( currentIndexChanged(int) ), this, SLOT( updateData() ) );
|
connect( match, SIGNAL( currentIndexChanged(int) ), this, SLOT( updateData() ) );
|
||||||
connect( match, SIGNAL( currentIndexChanged(int) ), this, SIGNAL( changed() ) );
|
connect( match, SIGNAL( currentIndexChanged(int) ), this, SIGNAL( changed() ) );
|
||||||
connect( input, SIGNAL( textChanged(QString) ), this, SLOT( updateData() ) );
|
connect( input, SIGNAL( textChanged(QString) ), this, SLOT( updateData() ) );
|
||||||
connect( input, SIGNAL( editingFinished() ), this, SLOT( editingFinished() ) );
|
connect( input, SIGNAL( editingFinished() ), this, SLOT( editingFinished() ) );
|
||||||
connect( input, SIGNAL( textEdited( QString ) ), &m_editingTimer, SLOT( stop() ) );
|
connect( input, SIGNAL( textEdited( QString ) ), &m_editingTimer, SLOT( stop() ) );
|
||||||
connect( input, SIGNAL( textEdited( QString ) ), &m_delayedEditTimer, SLOT( start() ) );
|
connect( input, SIGNAL( textEdited( QString ) ), &m_delayedEditTimer, SLOT( start() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
input->hide();
|
input->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( input );
|
m_input = QWeakPointer< QWidget >( input );
|
||||||
} else if( selectedType() == "Artist Description" ) {
|
} else if( selectedType() == "Artist Description" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Description;
|
m_currentType = Echonest::DynamicPlaylist::Description;
|
||||||
|
|
||||||
QLabel* match = new QLabel( tr( "is" ) );
|
QLabel* match = new QLabel( tr( "is" ) );
|
||||||
QLineEdit* input = new QLineEdit();
|
QLineEdit* input = new QLineEdit();
|
||||||
|
|
||||||
m_matchString = QString();
|
m_matchString = QString();
|
||||||
m_matchData = QString::number( (int)Echonest::DynamicPlaylist::ArtistDescriptionType );
|
m_matchData = QString::number( (int)Echonest::DynamicPlaylist::ArtistDescriptionType );
|
||||||
|
|
||||||
connect( input, SIGNAL( textChanged(QString) ), this, SLOT( updateData() ) );
|
connect( input, SIGNAL( textChanged(QString) ), this, SLOT( updateData() ) );
|
||||||
connect( input, SIGNAL( editingFinished() ), this, SLOT( editingFinished() ) );
|
connect( input, SIGNAL( editingFinished() ), this, SLOT( editingFinished() ) );
|
||||||
connect( input, SIGNAL( textEdited( QString ) ), &m_editingTimer, SLOT( stop() ) );
|
connect( input, SIGNAL( textEdited( QString ) ), &m_editingTimer, SLOT( stop() ) );
|
||||||
connect( input, SIGNAL( textEdited( QString ) ), &m_delayedEditTimer, SLOT( start() ) );
|
connect( input, SIGNAL( textEdited( QString ) ), &m_delayedEditTimer, SLOT( start() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
input->hide();
|
input->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( input );
|
m_input = QWeakPointer< QWidget >( input );
|
||||||
} else if( selectedType() == "Variety" ) {
|
} else if( selectedType() == "Variety" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Variety;
|
m_currentType = Echonest::DynamicPlaylist::Variety;
|
||||||
|
|
||||||
QLabel* match = new QLabel( tr( "is" ) );
|
QLabel* match = new QLabel( tr( "is" ) );
|
||||||
LabeledSlider* input = new LabeledSlider( tr( "Less" ), tr( "More" ) );
|
LabeledSlider* input = new LabeledSlider( tr( "Less" ), tr( "More" ) );
|
||||||
input->slider()->setRange( 0, 10000 );
|
input->slider()->setRange( 0, 10000 );
|
||||||
@@ -188,47 +188,47 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
|
|
||||||
m_matchString = match->text();
|
m_matchString = match->text();
|
||||||
m_matchData = match->text();
|
m_matchData = match->text();
|
||||||
|
|
||||||
|
|
||||||
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( updateData() ) );
|
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( editingFinished() ) );
|
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( editingFinished() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
input->hide();
|
input->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( input );
|
m_input = QWeakPointer< QWidget >( input );
|
||||||
} else if( selectedType() == "Tempo" ) {
|
} else if( selectedType() == "Tempo" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinTempo;
|
m_currentType = Echonest::DynamicPlaylist::MinTempo;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinTempo, Echonest::DynamicPlaylist::MaxTempo, tr( "0 BPM" ), tr( "500 BPM" ), 500 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinTempo, Echonest::DynamicPlaylist::MaxTempo, tr( "0 BPM" ), tr( "500 BPM" ), 500 );
|
||||||
} else if( selectedType() == "Duration" ) {
|
} else if( selectedType() == "Duration" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinDuration;
|
m_currentType = Echonest::DynamicPlaylist::MinDuration;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinDuration, Echonest::DynamicPlaylist::MaxDuration, tr( "0 secs" ), tr( "3600 secs" ), 3600 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinDuration, Echonest::DynamicPlaylist::MaxDuration, tr( "0 secs" ), tr( "3600 secs" ), 3600 );
|
||||||
} else if( selectedType() == "Loudness" ) {
|
} else if( selectedType() == "Loudness" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinLoudness;
|
m_currentType = Echonest::DynamicPlaylist::MinLoudness;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinLoudness, Echonest::DynamicPlaylist::MaxLoudness, tr( "-100 dB" ), tr( "100 dB" ), 100 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinLoudness, Echonest::DynamicPlaylist::MaxLoudness, tr( "-100 dB" ), tr( "100 dB" ), 100 );
|
||||||
qobject_cast< LabeledSlider* >( m_input.data() )->slider()->setMinimum( -100 );
|
qobject_cast< LabeledSlider* >( m_input.data() )->slider()->setMinimum( -100 );
|
||||||
} else if( selectedType() == "Danceability" ) {
|
} else if( selectedType() == "Danceability" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinDanceability;
|
m_currentType = Echonest::DynamicPlaylist::MinDanceability;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinDanceability, Echonest::DynamicPlaylist::MaxDanceability, tr( "Less" ), tr( "More" ), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinDanceability, Echonest::DynamicPlaylist::MaxDanceability, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Energy" ) {
|
} else if( selectedType() == "Energy" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::MinEnergy;
|
m_currentType = Echonest::DynamicPlaylist::MinEnergy;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinEnergy, Echonest::DynamicPlaylist::MaxEnergy, tr( "Less" ), tr( "More" ), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::MinEnergy, Echonest::DynamicPlaylist::MaxEnergy, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Artist Familiarity" ) {
|
} else if( selectedType() == "Artist Familiarity" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinFamiliarity;
|
m_currentType = Echonest::DynamicPlaylist::ArtistMinFamiliarity;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinFamiliarity, Echonest::DynamicPlaylist::ArtistMaxFamiliarity, tr( "Less" ), tr( "More" ), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinFamiliarity, Echonest::DynamicPlaylist::ArtistMaxFamiliarity, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Artist Hotttnesss" ) {
|
} else if( selectedType() == "Artist Hotttnesss" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinHotttnesss;
|
m_currentType = Echonest::DynamicPlaylist::ArtistMinHotttnesss;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinHotttnesss, Echonest::DynamicPlaylist::ArtistMaxHotttnesss, tr( "Less" ), tr( "More" ), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::ArtistMinHotttnesss, Echonest::DynamicPlaylist::ArtistMaxHotttnesss, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Song Hotttnesss" ) {
|
} else if( selectedType() == "Song Hotttnesss" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::SongMinHotttnesss;
|
m_currentType = Echonest::DynamicPlaylist::SongMinHotttnesss;
|
||||||
|
|
||||||
setupMinMaxWidgets( Echonest::DynamicPlaylist::SongMinHotttnesss, Echonest::DynamicPlaylist::SongMaxHotttnesss, tr( "Less" ), tr( "More" ), 10000 );
|
setupMinMaxWidgets( Echonest::DynamicPlaylist::SongMinHotttnesss, Echonest::DynamicPlaylist::SongMaxHotttnesss, tr( "Less" ), tr( "More" ), 10000 );
|
||||||
} else if( selectedType() == "Latitude" ) {
|
} else if( selectedType() == "Latitude" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::ArtistMinLatitude;
|
m_currentType = Echonest::DynamicPlaylist::ArtistMinLatitude;
|
||||||
@@ -242,26 +242,26 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
qobject_cast< LabeledSlider* >( m_input.data() )->slider()->setMinimum( -180 );
|
qobject_cast< LabeledSlider* >( m_input.data() )->slider()->setMinimum( -180 );
|
||||||
} else if( selectedType() == "Mode" ) {
|
} else if( selectedType() == "Mode" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Mode;
|
m_currentType = Echonest::DynamicPlaylist::Mode;
|
||||||
|
|
||||||
QLabel* match = new QLabel( tr( "is" ) );
|
QLabel* match = new QLabel( tr( "is" ) );
|
||||||
QComboBox* combo = new QComboBox;
|
QComboBox* combo = new QComboBox;
|
||||||
combo->addItem( tr( "Major" ), QString::number( 1 ) );
|
combo->addItem( tr( "Major" ), QString::number( 1 ) );
|
||||||
combo->addItem( tr( "Minor" ), QString::number( 0 ) );
|
combo->addItem( tr( "Minor" ), QString::number( 0 ) );
|
||||||
|
|
||||||
m_matchString = match->text();
|
m_matchString = match->text();
|
||||||
m_matchData = match->text();
|
m_matchData = match->text();
|
||||||
|
|
||||||
|
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
combo->hide();
|
combo->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( combo );
|
m_input = QWeakPointer< QWidget >( combo );
|
||||||
} else if( selectedType() == "Key" ) {
|
} else if( selectedType() == "Key" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Key;
|
m_currentType = Echonest::DynamicPlaylist::Key;
|
||||||
|
|
||||||
QLabel* match = new QLabel( tr( "is" ) );
|
QLabel* match = new QLabel( tr( "is" ) );
|
||||||
QComboBox* combo = new QComboBox;
|
QComboBox* combo = new QComboBox;
|
||||||
combo->addItem( tr( "C" ), QString::number( 0 ) );
|
combo->addItem( tr( "C" ), QString::number( 0 ) );
|
||||||
@@ -276,25 +276,25 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
combo->addItem( tr( "A" ), QString::number( 9 ) );
|
combo->addItem( tr( "A" ), QString::number( 9 ) );
|
||||||
combo->addItem( tr( "B Flat" ), QString::number( 10 ) );
|
combo->addItem( tr( "B Flat" ), QString::number( 10 ) );
|
||||||
combo->addItem( tr( "B" ), QString::number( 11 ) );
|
combo->addItem( tr( "B" ), QString::number( 11 ) );
|
||||||
|
|
||||||
m_matchString = match->text();
|
m_matchString = match->text();
|
||||||
m_matchData = match->text();
|
m_matchData = match->text();
|
||||||
|
|
||||||
|
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
combo->hide();
|
combo->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( combo );
|
m_input = QWeakPointer< QWidget >( combo );
|
||||||
} else if( selectedType() == "Sorting" ) {
|
} else if( selectedType() == "Sorting" ) {
|
||||||
m_currentType = Echonest::DynamicPlaylist::Key;
|
m_currentType = Echonest::DynamicPlaylist::Key;
|
||||||
|
|
||||||
QComboBox* match = new QComboBox();
|
QComboBox* match = new QComboBox();
|
||||||
match->addItem( tr( "Ascending" ), 0 );
|
match->addItem( tr( "Ascending" ), 0 );
|
||||||
match->addItem( tr( "Descending" ), 1 );
|
match->addItem( tr( "Descending" ), 1 );
|
||||||
|
|
||||||
QComboBox* combo = new QComboBox;
|
QComboBox* combo = new QComboBox;
|
||||||
combo->addItem( tr( "Tempo" ), QString::number( Echonest::DynamicPlaylist::SortTempoAscending ) );
|
combo->addItem( tr( "Tempo" ), QString::number( Echonest::DynamicPlaylist::SortTempoAscending ) );
|
||||||
combo->addItem( tr( "Duration" ), QString::number( Echonest::DynamicPlaylist::SortDurationAscending ) );
|
combo->addItem( tr( "Duration" ), QString::number( Echonest::DynamicPlaylist::SortDurationAscending ) );
|
||||||
@@ -308,15 +308,15 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
combo->addItem( tr( "Key" ), QString::number( Echonest::DynamicPlaylist::SortKeyAscending ) );
|
combo->addItem( tr( "Key" ), QString::number( Echonest::DynamicPlaylist::SortKeyAscending ) );
|
||||||
combo->addItem( tr( "Energy" ), QString::number( Echonest::DynamicPlaylist::SortEnergyAscending ) );
|
combo->addItem( tr( "Energy" ), QString::number( Echonest::DynamicPlaylist::SortEnergyAscending ) );
|
||||||
combo->addItem( tr( "Danceability" ), QString::number( Echonest::DynamicPlaylist::SortDanceabilityAscending ) );
|
combo->addItem( tr( "Danceability" ), QString::number( Echonest::DynamicPlaylist::SortDanceabilityAscending ) );
|
||||||
|
|
||||||
m_matchString = "Ascending"; // default
|
m_matchString = "Ascending"; // default
|
||||||
m_matchData = Echonest::DynamicPlaylist::SortTempoAscending;
|
m_matchData = Echonest::DynamicPlaylist::SortTempoAscending;
|
||||||
|
|
||||||
connect( match, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( match, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( match, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( match, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
combo->hide();
|
combo->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
@@ -329,26 +329,26 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
calculateSummary();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::setupMinMaxWidgets( Echonest::DynamicPlaylist::PlaylistParam min, Echonest::DynamicPlaylist::PlaylistParam max, const QString& leftL, const QString& rightL, int maxRange )
|
Tomahawk::EchonestControl::setupMinMaxWidgets( Echonest::DynamicPlaylist::PlaylistParam min, Echonest::DynamicPlaylist::PlaylistParam max, const QString& leftL, const QString& rightL, int maxRange )
|
||||||
{
|
{
|
||||||
QComboBox* match = new QComboBox;
|
QComboBox* match = new QComboBox;
|
||||||
match->addItem( "At Least", min );
|
match->addItem( "At Least", min );
|
||||||
match->addItem( "At Most", max );
|
match->addItem( "At Most", max );
|
||||||
|
|
||||||
LabeledSlider* input = new LabeledSlider( leftL, rightL );
|
LabeledSlider* input = new LabeledSlider( leftL, rightL );
|
||||||
input->slider()->setRange( 0, maxRange );
|
input->slider()->setRange( 0, maxRange );
|
||||||
input->slider()->setTickInterval( 1 );
|
input->slider()->setTickInterval( 1 );
|
||||||
input->slider()->setTracking( false );
|
input->slider()->setTracking( false );
|
||||||
|
|
||||||
m_matchString = match->currentText();
|
m_matchString = match->currentText();
|
||||||
m_matchData = match->itemData( match->currentIndex() ).toString();
|
m_matchData = match->itemData( match->currentIndex() ).toString();
|
||||||
|
|
||||||
connect( match, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( match, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( match, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( match, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( updateData() ) );
|
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( editingFinished() ) );
|
connect( input->slider(), SIGNAL( valueChanged( int ) ), this, SLOT( editingFinished() ) );
|
||||||
|
|
||||||
match->hide();
|
match->hide();
|
||||||
input->hide();
|
input->hide();
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
@@ -356,7 +356,7 @@ Tomahawk::EchonestControl::setupMinMaxWidgets( Echonest::DynamicPlaylist::Playli
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::updateData()
|
Tomahawk::EchonestControl::updateData()
|
||||||
{
|
{
|
||||||
if( selectedType() == "Artist" ) {
|
if( selectedType() == "Artist" ) {
|
||||||
@@ -394,7 +394,7 @@ Tomahawk::EchonestControl::updateData()
|
|||||||
if( match && input ) {
|
if( match && input ) {
|
||||||
m_matchString = match->currentText();
|
m_matchString = match->currentText();
|
||||||
m_matchData = match->itemData( match->currentIndex() ).toString();
|
m_matchData = match->itemData( match->currentIndex() ).toString();
|
||||||
|
|
||||||
// what a HACK
|
// what a HACK
|
||||||
int enumVal = input->itemData( input->currentIndex() ).toInt() + m_matchData.toInt();
|
int enumVal = input->itemData( input->currentIndex() ).toInt() + m_matchData.toInt();
|
||||||
m_data.first = Echonest::DynamicPlaylist::Sort;
|
m_data.first = Echonest::DynamicPlaylist::Sort;
|
||||||
@@ -402,11 +402,11 @@ Tomahawk::EchonestControl::updateData()
|
|||||||
// qDebug() << "SAVING" << input->currentIndex() << "AS" << enumVal << "(" << input->itemData( input->currentIndex() ).toInt() << "+" << m_matchData.toInt() << ")";
|
// qDebug() << "SAVING" << input->currentIndex() << "AS" << enumVal << "(" << input->itemData( input->currentIndex() ).toInt() << "+" << m_matchData.toInt() << ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateSummary();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::updateFromComboAndSlider( bool smooth )
|
Tomahawk::EchonestControl::updateFromComboAndSlider( bool smooth )
|
||||||
{
|
{
|
||||||
QComboBox* combo = qobject_cast<QComboBox*>( m_match.data() );
|
QComboBox* combo = qobject_cast<QComboBox*>( m_match.data() );
|
||||||
@@ -421,7 +421,7 @@ Tomahawk::EchonestControl::updateFromComboAndSlider( bool smooth )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::updateFromLabelAndCombo()
|
Tomahawk::EchonestControl::updateFromLabelAndCombo()
|
||||||
{
|
{
|
||||||
QComboBox* s = qobject_cast<QComboBox*>( m_input.data() );
|
QComboBox* s = qobject_cast<QComboBox*>( m_input.data() );
|
||||||
@@ -433,7 +433,7 @@ Tomahawk::EchonestControl::updateFromLabelAndCombo()
|
|||||||
|
|
||||||
|
|
||||||
// fills in the current widget with the data from json or dbcmd (m_data.second and m_matchData)
|
// fills in the current widget with the data from json or dbcmd (m_data.second and m_matchData)
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::updateWidgetsFromData()
|
Tomahawk::EchonestControl::updateWidgetsFromData()
|
||||||
{
|
{
|
||||||
if( selectedType() == "Artist" ) {
|
if( selectedType() == "Artist" ) {
|
||||||
@@ -452,7 +452,7 @@ Tomahawk::EchonestControl::updateWidgetsFromData()
|
|||||||
if( s )
|
if( s )
|
||||||
s->slider()->setValue( m_data.second.toDouble() * 10000 );
|
s->slider()->setValue( m_data.second.toDouble() * 10000 );
|
||||||
} else if( selectedType() == "Tempo" || selectedType() == "Duration" || selectedType() == "Loudness" || selectedType() == "Latitude" || selectedType() == "Longitude" ) {
|
} else if( selectedType() == "Tempo" || selectedType() == "Duration" || selectedType() == "Loudness" || selectedType() == "Latitude" || selectedType() == "Longitude" ) {
|
||||||
updateToComboAndSlider();
|
updateToComboAndSlider();
|
||||||
} else if( selectedType() == "Danceability" || selectedType() == "Energy" || selectedType() == "Artist Familiarity" || selectedType() == "Artist Hotttnesss" || selectedType() == "Song Hotttnesss" ) {
|
} else if( selectedType() == "Danceability" || selectedType() == "Energy" || selectedType() == "Artist Familiarity" || selectedType() == "Artist Hotttnesss" || selectedType() == "Song Hotttnesss" ) {
|
||||||
updateToComboAndSlider( true );
|
updateToComboAndSlider( true );
|
||||||
} else if( selectedType() == "Mode" || selectedType() == "Key" ) {
|
} else if( selectedType() == "Mode" || selectedType() == "Key" ) {
|
||||||
@@ -462,7 +462,7 @@ Tomahawk::EchonestControl::updateWidgetsFromData()
|
|||||||
QComboBox* input = qobject_cast< QComboBox* >( m_input.data() );
|
QComboBox* input = qobject_cast< QComboBox* >( m_input.data() );
|
||||||
if( match && input ) {
|
if( match && input ) {
|
||||||
match->setCurrentIndex( match->findData( m_matchData ));
|
match->setCurrentIndex( match->findData( m_matchData ));
|
||||||
|
|
||||||
// HACK alert. if it's odd, subtract 1
|
// HACK alert. if it's odd, subtract 1
|
||||||
int val = ( m_data.second.toInt() - ( m_data.second.toInt() % 2 ) ) / 2;
|
int val = ( m_data.second.toInt() - ( m_data.second.toInt() % 2 ) ) / 2;
|
||||||
input->setCurrentIndex( val );
|
input->setCurrentIndex( val );
|
||||||
@@ -472,7 +472,7 @@ Tomahawk::EchonestControl::updateWidgetsFromData()
|
|||||||
calculateSummary();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::updateToComboAndSlider( bool smooth )
|
Tomahawk::EchonestControl::updateToComboAndSlider( bool smooth )
|
||||||
{
|
{
|
||||||
QComboBox* combo = qobject_cast<QComboBox*>( m_match.data() );
|
QComboBox* combo = qobject_cast<QComboBox*>( m_match.data() );
|
||||||
@@ -491,26 +491,26 @@ void Tomahawk::EchonestControl::updateToLabelAndCombo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::editingFinished()
|
Tomahawk::EchonestControl::editingFinished()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
m_editingTimer.start();
|
m_editingTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::editTimerFired()
|
Tomahawk::EchonestControl::editTimerFired()
|
||||||
{
|
{
|
||||||
// make sure it's really changed
|
// make sure it's really changed
|
||||||
if( m_cacheData != m_data.second ) { // new, so emit changed
|
if( m_cacheData != m_data.second ) { // new, so emit changed
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cacheData = m_data.second;
|
m_cacheData = m_data.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Tomahawk::EchonestControl::calculateSummary()
|
Tomahawk::EchonestControl::calculateSummary()
|
||||||
{
|
{
|
||||||
// turns the current control into an english phrase suitable for embedding into a sentence summary
|
// turns the current control into an english phrase suitable for embedding into a sentence summary
|
||||||
@@ -522,7 +522,7 @@ Tomahawk::EchonestControl::calculateSummary()
|
|||||||
else if( static_cast< Echonest::DynamicPlaylist::ArtistTypeEnum >( m_matchData.toInt() ) == Echonest::DynamicPlaylist::ArtistRadioType )
|
else if( static_cast< Echonest::DynamicPlaylist::ArtistTypeEnum >( m_matchData.toInt() ) == Echonest::DynamicPlaylist::ArtistRadioType )
|
||||||
summary = QString( "similar to ~%1" ).arg( m_data.second.toString() );
|
summary = QString( "similar to ~%1" ).arg( m_data.second.toString() );
|
||||||
} else if( selectedType() == "Artist Description" ) {
|
} else if( selectedType() == "Artist Description" ) {
|
||||||
summary = QString( "with genre ~%1" ).arg( m_data.second.toString() );
|
summary = QString( "with genre ~%1" ).arg( m_data.second.toString() );
|
||||||
} else if( selectedType() == "Variety" || selectedType() == "Danceability" || selectedType() == "Artist Hotttnesss" || selectedType() == "Energy" || selectedType() == "Artist Familiarity" || selectedType() == "Song Hotttnesss" ) {
|
} else if( selectedType() == "Variety" || selectedType() == "Danceability" || selectedType() == "Artist Hotttnesss" || selectedType() == "Energy" || selectedType() == "Artist Familiarity" || selectedType() == "Song Hotttnesss" ) {
|
||||||
QString modifier;
|
QString modifier;
|
||||||
qreal sliderVal = m_data.second.toReal();
|
qreal sliderVal = m_data.second.toReal();
|
||||||
@@ -560,11 +560,11 @@ Tomahawk::EchonestControl::calculateSummary()
|
|||||||
Q_ASSERT( !m_input.isNull() );
|
Q_ASSERT( !m_input.isNull() );
|
||||||
Q_ASSERT( qobject_cast< QComboBox* >( m_input.data() ) );
|
Q_ASSERT( qobject_cast< QComboBox* >( m_input.data() ) );
|
||||||
QString sortType = qobject_cast< QComboBox* >( m_input.data() )->currentText().toLower();
|
QString sortType = qobject_cast< QComboBox* >( m_input.data() )->currentText().toLower();
|
||||||
|
|
||||||
Q_ASSERT( !m_match.isNull() );
|
Q_ASSERT( !m_match.isNull() );
|
||||||
Q_ASSERT( qobject_cast< QComboBox* >( m_match.data() ) );
|
Q_ASSERT( qobject_cast< QComboBox* >( m_match.data() ) );
|
||||||
QString ascdesc = qobject_cast< QComboBox* >( m_match.data() )->currentText().toLower();
|
QString ascdesc = qobject_cast< QComboBox* >( m_match.data() )->currentText().toLower();
|
||||||
|
|
||||||
summary = QString( "sorted in %1 %2 order" ).arg( ascdesc ).arg( sortType );
|
summary = QString( "sorted in %1 %2 order" ).arg( ascdesc ).arg( sortType );
|
||||||
}
|
}
|
||||||
m_summary = summary;
|
m_summary = summary;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -27,27 +27,27 @@ using namespace Tomahawk;
|
|||||||
EchonestFactory::EchonestFactory()
|
EchonestFactory::EchonestFactory()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
GeneratorInterface*
|
GeneratorInterface*
|
||||||
EchonestFactory::create()
|
EchonestFactory::create()
|
||||||
{
|
{
|
||||||
return new EchonestGenerator();
|
return new EchonestGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
dyncontrol_ptr
|
dyncontrol_ptr
|
||||||
EchonestFactory::createControl( const QString& controlType )
|
EchonestFactory::createControl( const QString& controlType )
|
||||||
{
|
{
|
||||||
return dyncontrol_ptr( new EchonestControl( controlType, typeSelectors() ) );
|
return dyncontrol_ptr( new EchonestControl( controlType, typeSelectors() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList
|
QStringList
|
||||||
EchonestFactory::typeSelectors() const
|
EchonestFactory::typeSelectors() const
|
||||||
{
|
{
|
||||||
return QStringList() << "Artist" << "Artist Description" << "Variety" << "Tempo" << "Duration" << "Loudness"
|
return QStringList() << "Artist" << "Artist Description" << "Variety" << "Tempo" << "Duration" << "Loudness"
|
||||||
<< "Danceability" << "Energy" << "Artist Familiarity" << "Artist Hotttnesss" << "Song Hotttnesss"
|
<< "Danceability" << "Energy" << "Artist Familiarity" << "Artist Hotttnesss" << "Song Hotttnesss"
|
||||||
<< "Longitude" << "Latitude" << "Mode" << "Key" << "Sorting";
|
<< "Longitude" << "Latitude" << "Mode" << "Key" << "Sorting";
|
||||||
}
|
}
|
||||||
|
|
||||||
EchonestGenerator::EchonestGenerator ( QObject* parent )
|
EchonestGenerator::EchonestGenerator ( QObject* parent )
|
||||||
: GeneratorInterface ( parent )
|
: GeneratorInterface ( parent )
|
||||||
, m_dynPlaylist( new Echonest::DynamicPlaylist() )
|
, m_dynPlaylist( new Echonest::DynamicPlaylist() )
|
||||||
, m_steeredSinceLastTrack( false )
|
, m_steeredSinceLastTrack( false )
|
||||||
@@ -55,7 +55,7 @@ EchonestGenerator::EchonestGenerator ( QObject* parent )
|
|||||||
m_type = "echonest";
|
m_type = "echonest";
|
||||||
m_mode = OnDemand;
|
m_mode = OnDemand;
|
||||||
m_logo.load( RESPATH "/images/echonest_logo.png" );
|
m_logo.load( RESPATH "/images/echonest_logo.png" );
|
||||||
qDebug() << "ECHONEST:" << m_logo.size();
|
// qDebug() << "ECHONEST:" << m_logo.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
EchonestGenerator::~EchonestGenerator()
|
EchonestGenerator::~EchonestGenerator()
|
||||||
@@ -63,7 +63,7 @@ EchonestGenerator::~EchonestGenerator()
|
|||||||
delete m_dynPlaylist;
|
delete m_dynPlaylist;
|
||||||
}
|
}
|
||||||
|
|
||||||
dyncontrol_ptr
|
dyncontrol_ptr
|
||||||
EchonestGenerator::createControl( const QString& type )
|
EchonestGenerator::createControl( const QString& type )
|
||||||
{
|
{
|
||||||
m_controls << dyncontrol_ptr( new EchonestControl( type, GeneratorFactory::typeSelectors( m_type ) ) );
|
m_controls << dyncontrol_ptr( new EchonestControl( type, GeneratorFactory::typeSelectors( m_type ) ) );
|
||||||
@@ -76,18 +76,18 @@ QPixmap EchonestGenerator::logo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::generate ( int number )
|
EchonestGenerator::generate( int number )
|
||||||
{
|
{
|
||||||
// convert to an echonest query, and fire it off
|
// convert to an echonest query, and fire it off
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
qDebug() << "Generating playlist with " << m_controls.size();
|
qDebug() << "Generating playlist with" << m_controls.size();
|
||||||
foreach( const dyncontrol_ptr& ctrl, m_controls )
|
foreach( const dyncontrol_ptr& ctrl, m_controls )
|
||||||
qDebug() << ctrl->selectedType() << ctrl->match() << ctrl->input();
|
qDebug() << ctrl->selectedType() << ctrl->match() << ctrl->input();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Echonest::DynamicPlaylist::PlaylistParams params = getParams();
|
Echonest::DynamicPlaylist::PlaylistParams params = getParams();
|
||||||
|
|
||||||
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Results, number ) );
|
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Results, number ) );
|
||||||
QNetworkReply* reply = Echonest::DynamicPlaylist::staticPlaylist( params );
|
QNetworkReply* reply = Echonest::DynamicPlaylist::staticPlaylist( params );
|
||||||
qDebug() << "Generating a static playlist from echonest!" << reply->url().toString();
|
qDebug() << "Generating a static playlist from echonest!" << reply->url().toString();
|
||||||
@@ -98,12 +98,12 @@ EchonestGenerator::generate ( int number )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::startOnDemand()
|
EchonestGenerator::startOnDemand()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Echonest::DynamicPlaylist::PlaylistParams params = getParams();
|
Echonest::DynamicPlaylist::PlaylistParams params = getParams();
|
||||||
|
|
||||||
QNetworkReply* reply = m_dynPlaylist->start( params );
|
QNetworkReply* reply = m_dynPlaylist->start( params );
|
||||||
qDebug() << "starting a dynamic playlist from echonest!" << reply->url().toString();
|
qDebug() << "starting a dynamic playlist from echonest!" << reply->url().toString();
|
||||||
connect( reply, SIGNAL( finished() ), this, SLOT( dynamicStarted() ) );
|
connect( reply, SIGNAL( finished() ), this, SLOT( dynamicStarted() ) );
|
||||||
@@ -113,7 +113,7 @@ EchonestGenerator::startOnDemand()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::fetchNext( int rating )
|
EchonestGenerator::fetchNext( int rating )
|
||||||
{
|
{
|
||||||
if( m_dynPlaylist->sessionId().isEmpty() ) {
|
if( m_dynPlaylist->sessionId().isEmpty() ) {
|
||||||
@@ -121,7 +121,7 @@ EchonestGenerator::fetchNext( int rating )
|
|||||||
qWarning() << Q_FUNC_INFO << "asked to fetch next dynamic song when we're not in the middle of a playlist!";
|
qWarning() << Q_FUNC_INFO << "asked to fetch next dynamic song when we're not in the middle of a playlist!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply* reply;
|
QNetworkReply* reply;
|
||||||
if( m_steeredSinceLastTrack ) {
|
if( m_steeredSinceLastTrack ) {
|
||||||
qDebug() << "Steering dynamic playlist!" << m_steerData.first << m_steerData.second;
|
qDebug() << "Steering dynamic playlist!" << m_steerData.first << m_steerData.second;
|
||||||
@@ -135,34 +135,34 @@ EchonestGenerator::fetchNext( int rating )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::staticFinished()
|
EchonestGenerator::staticFinished()
|
||||||
{
|
{
|
||||||
Q_ASSERT( sender() );
|
Q_ASSERT( sender() );
|
||||||
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
||||||
|
|
||||||
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
||||||
|
|
||||||
Echonest::SongList songs;
|
Echonest::SongList songs;
|
||||||
try {
|
try {
|
||||||
songs = Echonest::DynamicPlaylist::parseStaticPlaylist( reply );
|
songs = Echonest::DynamicPlaylist::parseStaticPlaylist( reply );
|
||||||
} catch( const Echonest::ParseError& e ) {
|
} catch( const Echonest::ParseError& e ) {
|
||||||
qWarning() << "libechonest threw an error trying to parse the static playlist! code" << e.errorType() << "error desc:" << e.what();
|
qWarning() << "libechonest threw an error trying to parse the static playlist code" << e.errorType() << "error desc:" << e.what();
|
||||||
|
|
||||||
emit error( "The Echo Nest returned an error creating the playlist", e.what() );
|
emit error( "The Echo Nest returned an error creating the playlist", e.what() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList< query_ptr > queries;
|
QList< query_ptr > queries;
|
||||||
foreach( const Echonest::Song& song, songs ) {
|
foreach( const Echonest::Song& song, songs ) {
|
||||||
qDebug() << "EchonestGenerator got song:" << song;
|
qDebug() << "EchonestGenerator got song:" << song;
|
||||||
queries << queryFromSong( song );
|
queries << queryFromSong( song );
|
||||||
}
|
}
|
||||||
|
|
||||||
emit generated( queries );
|
emit generated( queries );
|
||||||
}
|
}
|
||||||
|
|
||||||
Echonest::DynamicPlaylist::PlaylistParams
|
Echonest::DynamicPlaylist::PlaylistParams
|
||||||
EchonestGenerator::getParams() const throw( std::runtime_error )
|
EchonestGenerator::getParams() const throw( std::runtime_error )
|
||||||
{
|
{
|
||||||
Echonest::DynamicPlaylist::PlaylistParams params;
|
Echonest::DynamicPlaylist::PlaylistParams params;
|
||||||
@@ -173,14 +173,14 @@ EchonestGenerator::getParams() const throw( std::runtime_error )
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::dynamicStarted()
|
EchonestGenerator::dynamicStarted()
|
||||||
{
|
{
|
||||||
Q_ASSERT( sender() );
|
Q_ASSERT( sender() );
|
||||||
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
||||||
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Echonest::Song song = m_dynPlaylist->parseStart( reply );
|
Echonest::Song song = m_dynPlaylist->parseStart( reply );
|
||||||
query_ptr songQuery = queryFromSong( song );
|
query_ptr songQuery = queryFromSong( song );
|
||||||
@@ -191,19 +191,19 @@ EchonestGenerator::dynamicStarted()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::dynamicFetched()
|
EchonestGenerator::dynamicFetched()
|
||||||
{
|
{
|
||||||
Q_ASSERT( sender() );
|
Q_ASSERT( sender() );
|
||||||
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
||||||
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
||||||
|
|
||||||
resetSteering();
|
resetSteering();
|
||||||
|
|
||||||
if( !m_steerer.isNull() )
|
if( !m_steerer.isNull() )
|
||||||
m_steerer.data()->resetSteering( true );
|
m_steerer.data()->resetSteering( true );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Echonest::Song song = m_dynPlaylist->parseNextSong( reply );
|
Echonest::Song song = m_dynPlaylist->parseNextSong( reply );
|
||||||
query_ptr songQuery = queryFromSong( song );
|
query_ptr songQuery = queryFromSong( song );
|
||||||
@@ -214,7 +214,7 @@ EchonestGenerator::dynamicFetched()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::steerDescription( const QString& desc )
|
EchonestGenerator::steerDescription( const QString& desc )
|
||||||
{
|
{
|
||||||
m_steeredSinceLastTrack = true;
|
m_steeredSinceLastTrack = true;
|
||||||
@@ -222,7 +222,7 @@ EchonestGenerator::steerDescription( const QString& desc )
|
|||||||
m_steerData.second = desc;
|
m_steerData.second = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::steerField( const QString& field )
|
EchonestGenerator::steerField( const QString& field )
|
||||||
{
|
{
|
||||||
m_steeredSinceLastTrack = true;
|
m_steeredSinceLastTrack = true;
|
||||||
@@ -230,7 +230,7 @@ EchonestGenerator::steerField( const QString& field )
|
|||||||
m_steerData.second = field;
|
m_steerData.second = field;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::resetSteering()
|
EchonestGenerator::resetSteering()
|
||||||
{
|
{
|
||||||
m_steeredSinceLastTrack = false;
|
m_steeredSinceLastTrack = false;
|
||||||
@@ -239,12 +239,12 @@ EchonestGenerator::resetSteering()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
EchonestGenerator::onlyThisArtistType( Echonest::DynamicPlaylist::ArtistTypeEnum type ) const throw( std::runtime_error )
|
EchonestGenerator::onlyThisArtistType( Echonest::DynamicPlaylist::ArtistTypeEnum type ) const throw( std::runtime_error )
|
||||||
{
|
{
|
||||||
bool only = true;
|
bool only = true;
|
||||||
bool some = false;
|
bool some = false;
|
||||||
|
|
||||||
foreach( const dyncontrol_ptr& control, m_controls ) {
|
foreach( const dyncontrol_ptr& control, m_controls ) {
|
||||||
if( ( control->selectedType() == "Artist" || control->selectedType() == "Artist Description" ) && static_cast<Echonest::DynamicPlaylist::ArtistTypeEnum>( control->match().toInt() ) != type ) {
|
if( ( control->selectedType() == "Artist" || control->selectedType() == "Artist Description" ) && static_cast<Echonest::DynamicPlaylist::ArtistTypeEnum>( control->match().toInt() ) != type ) {
|
||||||
only = false;
|
only = false;
|
||||||
@@ -257,11 +257,11 @@ EchonestGenerator::onlyThisArtistType( Echonest::DynamicPlaylist::ArtistTypeEnum
|
|||||||
} else if( some && !only ) {
|
} else if( some && !only ) {
|
||||||
throw std::runtime_error( "All artist match types must be the same" );
|
throw std::runtime_error( "All artist match types must be the same" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EchonestGenerator::appendRadioType( Echonest::DynamicPlaylist::PlaylistParams& params ) const throw( std::runtime_error )
|
EchonestGenerator::appendRadioType( Echonest::DynamicPlaylist::PlaylistParams& params ) const throw( std::runtime_error )
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -269,9 +269,9 @@ EchonestGenerator::appendRadioType( Echonest::DynamicPlaylist::PlaylistParams& p
|
|||||||
* the types are artist, artist-radio, artist-description, catalog, catalog-radio, song-radio. we don't care about the catalog ones, and
|
* the types are artist, artist-radio, artist-description, catalog, catalog-radio, song-radio. we don't care about the catalog ones, and
|
||||||
* we can't use the song ones since for the moment EN only accepts Song IDs, not names, and we don't want to insert an extra song.search
|
* we can't use the song ones since for the moment EN only accepts Song IDs, not names, and we don't want to insert an extra song.search
|
||||||
* call first.
|
* call first.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// 1. artist: If all the artist controls are Limit-To. If some were but not all, error out.
|
/// 1. artist: If all the artist controls are Limit-To. If some were but not all, error out.
|
||||||
/// 2. artist-description: If all the artist entries are Description. If some were but not all, error out.
|
/// 2. artist-description: If all the artist entries are Description. If some were but not all, error out.
|
||||||
/// 3. artist-radio: If all the artist entries are Similar To. If some were but not all, error out.
|
/// 3. artist-radio: If all the artist entries are Similar To. If some were but not all, error out.
|
||||||
@@ -283,34 +283,34 @@ EchonestGenerator::appendRadioType( Echonest::DynamicPlaylist::PlaylistParams& p
|
|||||||
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistRadioType ) );
|
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistRadioType ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
query_ptr
|
query_ptr
|
||||||
EchonestGenerator::queryFromSong(const Echonest::Song& song)
|
EchonestGenerator::queryFromSong(const Echonest::Song& song)
|
||||||
{
|
{
|
||||||
// track[ "album" ] = song.release(); // TODO should we include it? can be quite specific
|
// track[ "album" ] = song.release(); // TODO should we include it? can be quite specific
|
||||||
return Query::get( song.artistName(), song.title(), QString(), uuid() );
|
return Query::get( song.artistName(), song.title(), QString(), uuid() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget*
|
QWidget*
|
||||||
EchonestGenerator::steeringWidget()
|
EchonestGenerator::steeringWidget()
|
||||||
{
|
{
|
||||||
if( m_steerer.isNull() ) {
|
if( m_steerer.isNull() ) {
|
||||||
m_steerer = QWeakPointer< EchonestSteerer >( new EchonestSteerer );
|
m_steerer = QWeakPointer< EchonestSteerer >( new EchonestSteerer );
|
||||||
|
|
||||||
connect( m_steerer.data(), SIGNAL( steerField( QString ) ), this, SLOT( steerField( QString ) ) );
|
connect( m_steerer.data(), SIGNAL( steerField( QString ) ), this, SLOT( steerField( QString ) ) );
|
||||||
connect( m_steerer.data(), SIGNAL( steerDescription( QString ) ), this, SLOT( steerDescription( QString ) ) );
|
connect( m_steerer.data(), SIGNAL( steerDescription( QString ) ), this, SLOT( steerDescription( QString ) ) );
|
||||||
connect( m_steerer.data(), SIGNAL( reset() ), this, SLOT( resetSteering() ) );
|
connect( m_steerer.data(), SIGNAL( reset() ), this, SLOT( resetSteering() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_steerer.data();
|
return m_steerer.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
EchonestGenerator::sentenceSummary()
|
EchonestGenerator::sentenceSummary()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The idea is we generate an english sentence from the individual phrases of the controls. We have to follow a few rules, but othewise it's quite straightforward.
|
* The idea is we generate an english sentence from the individual phrases of the controls. We have to follow a few rules, but othewise it's quite straightforward.
|
||||||
*
|
*
|
||||||
* Rules:
|
* Rules:
|
||||||
* - Sentence starts with "Songs "
|
* - Sentence starts with "Songs "
|
||||||
* - Artists always go first
|
* - Artists always go first
|
||||||
@@ -318,16 +318,16 @@ EchonestGenerator::sentenceSummary()
|
|||||||
* - sorting always at end
|
* - sorting always at end
|
||||||
* - collapse artists. "Like X, like Y, like Z, ..." -> "Like X, Y, and Z"
|
* - collapse artists. "Like X, like Y, like Z, ..." -> "Like X, Y, and Z"
|
||||||
* - skip empty artist entries
|
* - skip empty artist entries
|
||||||
*
|
*
|
||||||
* NOTE / TODO: In order for the sentence to be grammatically correct, we must follow the EN API rules. That means we can't have multiple of some types of filters,
|
* NOTE / TODO: In order for the sentence to be grammatically correct, we must follow the EN API rules. That means we can't have multiple of some types of filters,
|
||||||
* and all Artist types must be the same. The filters aren't checked at the moment until Generate / Play is pressed. Consider doing a check on hide as well.
|
* and all Artist types must be the same. The filters aren't checked at the moment until Generate / Play is pressed. Consider doing a check on hide as well.
|
||||||
*/
|
*/
|
||||||
QList< dyncontrol_ptr > allcontrols = m_controls;
|
QList< dyncontrol_ptr > allcontrols = m_controls;
|
||||||
QString sentence = "Songs ";
|
QString sentence = "Songs ";
|
||||||
|
|
||||||
/// 1. Collect all artist filters
|
/// 1. Collect all artist filters
|
||||||
/// 2. Get the sorted by filter if it exists.
|
/// 2. Get the sorted by filter if it exists.
|
||||||
QList< dyncontrol_ptr > artists;
|
QList< dyncontrol_ptr > artists;
|
||||||
dyncontrol_ptr sorting;
|
dyncontrol_ptr sorting;
|
||||||
foreach( const dyncontrol_ptr& control, allcontrols ) {
|
foreach( const dyncontrol_ptr& control, allcontrols ) {
|
||||||
if( control->selectedType() == "Artist" || control->selectedType() == "Artist Description" )
|
if( control->selectedType() == "Artist" || control->selectedType() == "Artist Description" )
|
||||||
@@ -337,7 +337,7 @@ EchonestGenerator::sentenceSummary()
|
|||||||
}
|
}
|
||||||
if( !sorting.isNull() )
|
if( !sorting.isNull() )
|
||||||
allcontrols.removeAll( sorting );
|
allcontrols.removeAll( sorting );
|
||||||
|
|
||||||
/// Skip empty artists
|
/// Skip empty artists
|
||||||
QList< dyncontrol_ptr > empty;
|
QList< dyncontrol_ptr > empty;
|
||||||
foreach( const dyncontrol_ptr& artist, artists ) {
|
foreach( const dyncontrol_ptr& artist, artists ) {
|
||||||
@@ -349,20 +349,20 @@ EchonestGenerator::sentenceSummary()
|
|||||||
artists.removeAll( toremove );
|
artists.removeAll( toremove );
|
||||||
allcontrols.removeAll( toremove );
|
allcontrols.removeAll( toremove );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If there are no artists and no filters, show some help text
|
/// If there are no artists and no filters, show some help text
|
||||||
if( artists.isEmpty() && allcontrols.isEmpty() )
|
if( artists.isEmpty() && allcontrols.isEmpty() )
|
||||||
sentence = "No configured filters!";
|
sentence = "No configured filters!";
|
||||||
|
|
||||||
/// Do the assembling. Start with the artists if there are any, then do all the rest.
|
/// Do the assembling. Start with the artists if there are any, then do all the rest.
|
||||||
for( int i = 0; i < artists.size(); i++ ) {
|
for( int i = 0; i < artists.size(); i++ ) {
|
||||||
dyncontrol_ptr artist = artists.value( i );
|
dyncontrol_ptr artist = artists.value( i );
|
||||||
allcontrols.removeAll( artist ); // remove from pool while we're here
|
allcontrols.removeAll( artist ); // remove from pool while we're here
|
||||||
|
|
||||||
/// Collapse artist lists
|
/// Collapse artist lists
|
||||||
QString center, suffix;
|
QString center, suffix;
|
||||||
QString summary = artist.dynamicCast< EchonestControl >()->summary();
|
QString summary = artist.dynamicCast< EchonestControl >()->summary();
|
||||||
|
|
||||||
if( i == 0 ) { // if it's the first.. special casez
|
if( i == 0 ) { // if it's the first.. special casez
|
||||||
center = summary.remove( "~" );
|
center = summary.remove( "~" );
|
||||||
if( artists.size() == 2 ) // special case for 2, no comma. ( X and Y )
|
if( artists.size() == 2 ) // special case for 2, no comma. ( X and Y )
|
||||||
@@ -399,12 +399,12 @@ EchonestGenerator::sentenceSummary()
|
|||||||
sentence += prefix + allcontrols.value( i ).dynamicCast< EchonestControl >()->summary() + suffix;
|
sentence += prefix + allcontrols.value( i ).dynamicCast< EchonestControl >()->summary() + suffix;
|
||||||
}
|
}
|
||||||
qDebug() << "Got artists and contents:" << sentence;
|
qDebug() << "Got artists and contents:" << sentence;
|
||||||
|
|
||||||
if( !sorting.isNull() ) {
|
if( !sorting.isNull() ) {
|
||||||
sentence += "and " + sorting.dynamicCast< EchonestControl >()->summary() + ".";
|
sentence += "and " + sorting.dynamicCast< EchonestControl >()->summary() + ".";
|
||||||
}
|
}
|
||||||
qDebug() << "Got full summary:" << sentence;
|
qDebug() << "Got full summary:" << sentence;
|
||||||
|
|
||||||
return sentence;
|
return sentence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -349,7 +349,7 @@ nam()
|
|||||||
{
|
{
|
||||||
if ( s_nam.isNull() )
|
if ( s_nam.isNull() )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return s_nam.data();
|
return s_nam.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ setProxy( QNetworkProxy* proxy )
|
|||||||
{
|
{
|
||||||
s_proxy = proxy;
|
s_proxy = proxy;
|
||||||
s_nam.data()->setProxy( *proxy );
|
s_nam.data()->setProxy( *proxy );
|
||||||
qDebug() << Q_FUNC_INFO << " setting proxy to use proxy DNS? " << (TomahawkSettings::instance()->proxyDns() ? "true" : "false");
|
qDebug() << Q_FUNC_INFO << "setting proxy to use proxy DNS?" << (TomahawkSettings::instance()->proxyDns() ? "true" : "false");
|
||||||
if ( !TomahawkSettings::instance()->proxyDns() )
|
if ( !TomahawkSettings::instance()->proxyDns() )
|
||||||
s_proxy->setCapabilities( QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability | QNetworkProxy::UdpTunnelingCapability );
|
s_proxy->setCapabilities( QNetworkProxy::TunnelingCapability | QNetworkProxy::ListeningCapability | QNetworkProxy::UdpTunnelingCapability );
|
||||||
}
|
}
|
||||||
@@ -410,8 +410,7 @@ DNSResolver::resolve( QString &host, QString type )
|
|||||||
// For the moment, assume we are looking for XMPP...
|
// For the moment, assume we are looking for XMPP...
|
||||||
QString fullHost( "_xmpp-client._tcp." + host );
|
QString fullHost( "_xmpp-client._tcp." + host );
|
||||||
|
|
||||||
qDebug() << "Looking up SRV record for " << fullHost.toUtf8();
|
qDebug() << "Looking up SRV record for" << fullHost.toUtf8();
|
||||||
|
|
||||||
m_dnsSharedRequest->query( fullHost.toUtf8(), QJDns::Srv );
|
m_dnsSharedRequest->query( fullHost.toUtf8(), QJDns::Srv );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -429,7 +428,7 @@ DNSResolver::resultsReady()
|
|||||||
QList<QJDns::Record> results = m_dnsSharedRequest->results();
|
QList<QJDns::Record> results = m_dnsSharedRequest->results();
|
||||||
foreach( QJDns::Record r, results )
|
foreach( QJDns::Record r, results )
|
||||||
{
|
{
|
||||||
qDebug() << "Found result (of some type): " << QString( r.name );
|
qDebug() << "Found result (of some type):" << QString( r.name );
|
||||||
if( r.type == QJDns::Srv )
|
if( r.type == QJDns::Srv )
|
||||||
{
|
{
|
||||||
QString foundResult( r.name );
|
QString foundResult( r.name );
|
||||||
@@ -438,7 +437,7 @@ DNSResolver::resultsReady()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << "DNS resolve request was NOT successful! Error: " << (int)(m_dnsSharedRequest->error());
|
qDebug() << "DNS resolve request was NOT successful! Error:" << (int)(m_dnsSharedRequest->error());
|
||||||
QString badResult( "NONE" );
|
QString badResult( "NONE" );
|
||||||
emit result( badResult );
|
emit result( badResult );
|
||||||
}
|
}
|
||||||
|
@@ -178,7 +178,7 @@ CollectionItem::playlistsDeletedInternal( SourceTreeItem* parent, const QList< T
|
|||||||
void
|
void
|
||||||
CollectionItem::onPlaylistsAdded( const QList< playlist_ptr >& playlists )
|
CollectionItem::onPlaylistsAdded( const QList< playlist_ptr >& playlists )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << m_source->friendlyName() << playlists.count();
|
// qDebug() << Q_FUNC_INFO << m_source->friendlyName() << playlists.count();
|
||||||
|
|
||||||
if( playlists.isEmpty() )
|
if( playlists.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user