mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
* Remove more of the crazy amounts of debug output we've collected in the past few weeks.
This commit is contained in:
@@ -341,7 +341,7 @@ Servent::readyRead()
|
|||||||
|
|
||||||
foreach( ControlConnection* con, m_controlconnections )
|
foreach( ControlConnection* con, m_controlconnections )
|
||||||
{
|
{
|
||||||
qDebug() << "conid:" << con->id();
|
// qDebug() << "conid:" << con->id();
|
||||||
|
|
||||||
if ( con->id() == controlid )
|
if ( con->id() == controlid )
|
||||||
{
|
{
|
||||||
@@ -660,10 +660,12 @@ Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Servent::checkACL( const Connection* conn, const QString &nodeid, bool showDialog ) const
|
Servent::checkACL( const Connection* conn, const QString &nodeid, bool showDialog ) const
|
||||||
{
|
{
|
||||||
qDebug() << "Checking ACLs";
|
qDebug() << "Checking ACLs";
|
||||||
|
|
||||||
ACLSystem* aclSystem = ACLSystem::instance();
|
ACLSystem* aclSystem = ACLSystem::instance();
|
||||||
ACLSystem::ACL peerStatus = aclSystem->isAuthorizedUser( nodeid );
|
ACLSystem::ACL peerStatus = aclSystem->isAuthorizedUser( nodeid );
|
||||||
if( peerStatus == ACLSystem::Deny )
|
if( peerStatus == ACLSystem::Deny )
|
||||||
@@ -716,6 +718,7 @@ Servent::checkACL( const Connection* conn, const QString &nodeid, bool showDialo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QSharedPointer<QIODevice>
|
QSharedPointer<QIODevice>
|
||||||
Servent::remoteIODeviceFactory( const result_ptr& result )
|
Servent::remoteIODeviceFactory( const result_ptr& result )
|
||||||
{
|
{
|
||||||
@@ -769,7 +772,7 @@ void
|
|||||||
Servent::printCurrentTransfers()
|
Servent::printCurrentTransfers()
|
||||||
{
|
{
|
||||||
int k = 1;
|
int k = 1;
|
||||||
qDebug() << "~~~ Active file transfer connections:" << m_scsessions.length();
|
// qDebug() << "~~~ Active file transfer connections:" << m_scsessions.length();
|
||||||
foreach( StreamConnection* i, m_scsessions )
|
foreach( StreamConnection* i, m_scsessions )
|
||||||
{
|
{
|
||||||
qDebug() << k << ") " << i->id();
|
qDebug() << k << ") " << i->id();
|
||||||
@@ -806,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;
|
||||||
}
|
}
|
||||||
@@ -857,7 +860,7 @@ Servent::getIODeviceForUrl( const Tomahawk::result_ptr& result )
|
|||||||
|
|
||||||
const QString proto = rx.cap( 1 );
|
const QString proto = rx.cap( 1 );
|
||||||
//const QString urlpart = rx.cap( 2 );
|
//const QString urlpart = rx.cap( 2 );
|
||||||
qDebug() << "Getting IODevice for URL:" << proto << m_iofactories.contains( proto );
|
// qDebug() << "Getting IODevice for URL:" << proto << m_iofactories.contains( proto );
|
||||||
if ( !m_iofactories.contains( proto ) )
|
if ( !m_iofactories.contains( proto ) )
|
||||||
return sp;
|
return sp;
|
||||||
return m_iofactories.value( proto )( result );
|
return m_iofactories.value( proto )( result );
|
||||||
|
@@ -320,7 +320,7 @@ Pipeline::shunt( const query_ptr& q )
|
|||||||
|
|
||||||
if ( thisResolver < m_resolvers.count() )
|
if ( thisResolver < m_resolvers.count() )
|
||||||
{
|
{
|
||||||
qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();
|
// qDebug() << "Shunting in" << lasttimeout << "ms, q:" << q->toString();
|
||||||
|
|
||||||
m_qidsTimeout.insert( q->id(), true );
|
m_qidsTimeout.insert( q->id(), true );
|
||||||
new FuncTimeout( lasttimeout, boost::bind( &Pipeline::timeoutShunt, this, q ), this );
|
new FuncTimeout( lasttimeout, boost::bind( &Pipeline::timeoutShunt, this, q ), this );
|
||||||
@@ -361,9 +361,8 @@ Pipeline::setQIDState( const Tomahawk::query_ptr& query, int state )
|
|||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
|
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
|
||||||
m_qidsState.remove( query->id() );
|
m_qidsState.remove( query->id() );
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "Queries running:" << m_qidsState.count();
|
qDebug() << "Queries running:" << m_qidsState.count();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -381,7 +380,6 @@ Pipeline::incQIDState( const Tomahawk::query_ptr& query )
|
|||||||
// qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
|
// qDebug() << Q_FUNC_INFO << "inserting to qidsstate:" << query->id() << state;
|
||||||
m_qidsState.insert( query->id(), state );
|
m_qidsState.insert( query->id(), state );
|
||||||
|
|
||||||
qDebug() << "Queries running:" << m_qidsState.count();
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,8 +402,8 @@ Pipeline::decQIDState( const Tomahawk::query_ptr& query )
|
|||||||
{
|
{
|
||||||
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
|
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
|
||||||
m_qidsState.remove( query->id() );
|
m_qidsState.remove( query->id() );
|
||||||
|
qDebug() << "Queries running:" << m_qidsState.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Queries running:" << m_qidsState.count();
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@@ -451,7 +451,7 @@ QList< dyncontrol_ptr > DynamicPlaylist::variantsToControl( const QList< QVarian
|
|||||||
QList<dyncontrol_ptr> realControls;
|
QList<dyncontrol_ptr> realControls;
|
||||||
foreach( QVariantMap controlV, controlsV ) {
|
foreach( QVariantMap controlV, controlsV ) {
|
||||||
dyncontrol_ptr control = GeneratorFactory::createControl( controlV.value( "type" ).toString(), controlV.value( "selectedType" ).toString() );
|
dyncontrol_ptr control = GeneratorFactory::createControl( controlV.value( "type" ).toString(), controlV.value( "selectedType" ).toString() );
|
||||||
qDebug() << "Creating control with data:" << controlV;
|
// qDebug() << "Creating control with data:" << controlV;
|
||||||
QJson::QObjectHelper::qvariant2qobject( controlV, control.data() );
|
QJson::QObjectHelper::qvariant2qobject( controlV, control.data() );
|
||||||
realControls << control;
|
realControls << control;
|
||||||
}
|
}
|
||||||
|
@@ -69,12 +69,12 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
|||||||
{
|
{
|
||||||
if ( QThread::currentThread() != thread() )
|
if ( QThread::currentThread() != thread() )
|
||||||
{
|
{
|
||||||
qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
// qDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO;
|
||||||
QMetaObject::invokeMethod( this, "resolve", Qt::QueuedConnection, Q_ARG(Tomahawk::query_ptr, query) );
|
QMetaObject::invokeMethod( this, "resolve", Qt::QueuedConnection, Q_ARG(Tomahawk::query_ptr, query) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << query->toString();
|
// qDebug() << Q_FUNC_INFO << query->toString();
|
||||||
QString eval = QString( "resolve( '%1', '%2', '%3', '%4' );" )
|
QString eval = QString( "resolve( '%1', '%2', '%3', '%4' );" )
|
||||||
.arg( query->id().replace( "'", "\\'" ) )
|
.arg( query->id().replace( "'", "\\'" ) )
|
||||||
.arg( query->artist().replace( "'", "\\'" ) )
|
.arg( query->artist().replace( "'", "\\'" ) )
|
||||||
@@ -92,7 +92,6 @@ QtScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
|||||||
foreach( const QVariant& rv, reslist )
|
foreach( const QVariant& rv, reslist )
|
||||||
{
|
{
|
||||||
QVariantMap m = rv.toMap();
|
QVariantMap m = rv.toMap();
|
||||||
qDebug() << "RES" << m;
|
|
||||||
|
|
||||||
Tomahawk::result_ptr rp( new Tomahawk::Result() );
|
Tomahawk::result_ptr rp( new Tomahawk::Result() );
|
||||||
Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() );
|
Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() );
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#include "album.h"
|
#include "album.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
#include "functimeout.h"
|
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -65,14 +64,15 @@ ScriptResolver::readStderr()
|
|||||||
void
|
void
|
||||||
ScriptResolver::readStdout()
|
ScriptResolver::readStdout()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << m_proc.bytesAvailable();
|
// qDebug() << Q_FUNC_INFO << m_proc.bytesAvailable();
|
||||||
|
|
||||||
if( m_msgsize == 0 )
|
if( m_msgsize == 0 )
|
||||||
{
|
{
|
||||||
if( m_proc.bytesAvailable() < 4 ) return;
|
if( m_proc.bytesAvailable() < 4 ) return;
|
||||||
quint32 len_nbo;
|
quint32 len_nbo;
|
||||||
m_proc.read( (char*) &len_nbo, 4 );
|
m_proc.read( (char*) &len_nbo, 4 );
|
||||||
m_msgsize = qFromBigEndian( len_nbo );
|
m_msgsize = qFromBigEndian( len_nbo );
|
||||||
qDebug() << Q_FUNC_INFO << "msgsize" << m_msgsize;
|
// qDebug() << Q_FUNC_INFO << "msgsize" << m_msgsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_msgsize > 0 )
|
if( m_msgsize > 0 )
|
||||||
@@ -108,6 +108,7 @@ void
|
|||||||
ScriptResolver::handleMsg( const QByteArray& msg )
|
ScriptResolver::handleMsg( const QByteArray& msg )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << msg.size() << QString::fromAscii( msg );
|
qDebug() << Q_FUNC_INFO << msg.size() << QString::fromAscii( msg );
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QVariant v = m_parser.parse( msg, &ok );
|
QVariant v = m_parser.parse( msg, &ok );
|
||||||
if( !ok || v.type() != QVariant::Map )
|
if( !ok || v.type() != QVariant::Map )
|
||||||
@@ -122,7 +123,9 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
{
|
{
|
||||||
doSetup( m );
|
doSetup( m );
|
||||||
return;
|
return;
|
||||||
} else if( msgtype == "confwidget" ) {
|
}
|
||||||
|
else if( msgtype == "confwidget" )
|
||||||
|
{
|
||||||
setupConfWidget( m );
|
setupConfWidget( m );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -130,21 +133,13 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
if( msgtype == "results" )
|
if( msgtype == "results" )
|
||||||
{
|
{
|
||||||
const QString qid = m.value( "qid" ).toString();
|
const QString qid = m.value( "qid" ).toString();
|
||||||
if ( !m_queryState.contains( qid ) )
|
|
||||||
{
|
|
||||||
//FIXME: We should always accept results, even if they arrive too late. Needs some work in Pipeline.
|
|
||||||
qDebug() << "Ignoring results for" << qid << "- arrived after timeout.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_queryState.remove( qid );
|
|
||||||
|
|
||||||
QList< Tomahawk::result_ptr > results;
|
QList< Tomahawk::result_ptr > results;
|
||||||
const QVariantList reslist = m.value( "results" ).toList();
|
const QVariantList reslist = m.value( "results" ).toList();
|
||||||
|
|
||||||
foreach( const QVariant& rv, reslist )
|
foreach( const QVariant& rv, reslist )
|
||||||
{
|
{
|
||||||
QVariantMap m = rv.toMap();
|
QVariantMap m = rv.toMap();
|
||||||
qDebug() << "RES" << m;
|
qDebug() << "Found result:" << m;
|
||||||
|
|
||||||
Tomahawk::result_ptr rp( new Tomahawk::Result() );
|
Tomahawk::result_ptr rp( new Tomahawk::Result() );
|
||||||
Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() );
|
Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() );
|
||||||
@@ -220,9 +215,6 @@ ScriptResolver::resolve( const Tomahawk::query_ptr& query )
|
|||||||
const QByteArray msg = m_serializer.serialize( QVariant( m ) );
|
const QByteArray msg = m_serializer.serialize( QVariant( m ) );
|
||||||
qDebug() << "ASKING SCRIPT RESOLVER TO RESOLVE:" << msg;
|
qDebug() << "ASKING SCRIPT RESOLVER TO RESOLVE:" << msg;
|
||||||
sendMsg( msg );
|
sendMsg( msg );
|
||||||
|
|
||||||
m_queryState.insert( query->id(), 1 );
|
|
||||||
new Tomahawk::FuncTimeout( m_timeout, boost::bind( &ScriptResolver::onTimeout, this, query ), this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -291,17 +283,3 @@ ScriptResolver::stop()
|
|||||||
qDebug() << "KILLING PROCESS!";
|
qDebug() << "KILLING PROCESS!";
|
||||||
m_proc.kill();
|
m_proc.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ScriptResolver::onTimeout( const Tomahawk::query_ptr& query )
|
|
||||||
{
|
|
||||||
// check if this query has already been processed
|
|
||||||
if ( !m_queryState.contains( query->id() ) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// if not, it's time to emit an empty result list
|
|
||||||
m_queryState.remove( query->id() );
|
|
||||||
QList< Tomahawk::result_ptr > results;
|
|
||||||
Tomahawk::Pipeline::instance()->reportResults( query->id(), results );
|
|
||||||
}
|
|
||||||
|
@@ -58,8 +58,6 @@ private slots:
|
|||||||
void readStdout();
|
void readStdout();
|
||||||
void cmdExited( int code, QProcess::ExitStatus status );
|
void cmdExited( int code, QProcess::ExitStatus status );
|
||||||
|
|
||||||
void onTimeout( const Tomahawk::query_ptr& query );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleMsg( const QByteArray& msg );
|
void handleMsg( const QByteArray& msg );
|
||||||
void sendMsg( const QByteArray& msg );
|
void sendMsg( const QByteArray& msg );
|
||||||
@@ -76,8 +74,6 @@ private:
|
|||||||
|
|
||||||
bool m_ready, m_stopped;
|
bool m_ready, m_stopped;
|
||||||
|
|
||||||
QHash< QString /* QID */, unsigned int /* state */ > m_queryState;
|
|
||||||
|
|
||||||
QJson::Parser m_parser;
|
QJson::Parser m_parser;
|
||||||
QJson::Serializer m_serializer;
|
QJson::Serializer m_serializer;
|
||||||
};
|
};
|
||||||
|
@@ -38,7 +38,7 @@ void AvatarManager::onNewConnection()
|
|||||||
|
|
||||||
void AvatarManager::fetchVCard(const QString &jid)
|
void AvatarManager::fetchVCard(const QString &jid)
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
// qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
Jreen::IQ iq(Jreen::IQ::Get, jid );
|
Jreen::IQ iq(Jreen::IQ::Get, jid );
|
||||||
iq.addExtension(new Jreen::VCard());
|
iq.addExtension(new Jreen::VCard());
|
||||||
@@ -50,15 +50,15 @@ void AvatarManager::onNewPresence(const Jreen::Presence& presence)
|
|||||||
Jreen::VCardUpdate::Ptr update = presence.findExtension<Jreen::VCardUpdate>();
|
Jreen::VCardUpdate::Ptr update = presence.findExtension<Jreen::VCardUpdate>();
|
||||||
if(update)
|
if(update)
|
||||||
{
|
{
|
||||||
qDebug() << "vcard: found update for " << presence.from().full();
|
// qDebug() << "vcard: found update for" << presence.from().full();
|
||||||
if(!isCached(update->photoHash()))
|
if(!isCached(update->photoHash()))
|
||||||
{
|
{
|
||||||
qDebug() << presence.from().full() << "vcard: photo not cached, starting request..." << update->photoHash();
|
// qDebug() << presence.from().full() << "vcard: photo not cached, starting request..." << update->photoHash();
|
||||||
fetchVCard( presence.from().bare() );
|
fetchVCard( presence.from().bare() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << presence.from().full() << "vcard: photo already cached no request necessary " << update->photoHash();
|
// qDebug() << presence.from().full() << "vcard: photo already cached no request necessary " << update->photoHash();
|
||||||
m_JidsAvatarHashes.insert( update->photoHash(), presence.from().bare() );
|
m_JidsAvatarHashes.insert( update->photoHash(), presence.from().bare() );
|
||||||
|
|
||||||
Q_ASSERT(!this->avatar(presence.from().bare()).isNull());
|
Q_ASSERT(!this->avatar(presence.from().bare()).isNull());
|
||||||
@@ -67,7 +67,7 @@ void AvatarManager::onNewPresence(const Jreen::Presence& presence)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "got no statusupdateextension";
|
// qDebug() << Q_FUNC_INFO << presence.from().full() << "got no statusupdateextension";
|
||||||
|
|
||||||
//TODO: do we want this? might fetch avatars for broken clients
|
//TODO: do we want this? might fetch avatars for broken clients
|
||||||
fetchVCard( presence.from().bare() );
|
fetchVCard( presence.from().bare() );
|
||||||
|
@@ -621,8 +621,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
|||||||
Jreen::JID jid = presence.from();
|
Jreen::JID jid = presence.from();
|
||||||
QString fulljid( jid.full() );
|
QString fulljid( jid.full() );
|
||||||
|
|
||||||
|
// qDebug() << Q_FUNC_INFO << "* New presence:" << fulljid << presence.subtype();
|
||||||
qDebug() << Q_FUNC_INFO << "* New presence:" << fulljid << presence.subtype();
|
|
||||||
|
|
||||||
if( jid == m_client->jid() )
|
if( jid == m_client->jid() )
|
||||||
return;
|
return;
|
||||||
@@ -656,7 +655,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
|
|||||||
}
|
}
|
||||||
else if( !caps )
|
else if( !caps )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Running tomahawk: no" << "no caps";
|
// qDebug() << Q_FUNC_INFO << "Running tomahawk: no" << "no caps";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,7 +664,7 @@ void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, co
|
|||||||
if ( m_state != Connected )
|
if ( m_state != Connected )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << "presence type:" << presence.subtype();
|
// qDebug() << Q_FUNC_INFO << "presence type:" << presence.subtype();
|
||||||
if(item)
|
if(item)
|
||||||
qDebug() << Q_FUNC_INFO << presence.from().full() << "subs" << item->subscription() << "ask" << item->ask();
|
qDebug() << Q_FUNC_INFO << presence.from().full() << "subs" << item->subscription() << "ask" << item->ask();
|
||||||
else
|
else
|
||||||
@@ -772,7 +771,7 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq, int context)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << jid.full() << "Running tomahawk/feature enabled: no";
|
// qDebug() << Q_FUNC_INFO << jid.full() << "Running tomahawk/feature enabled: no";
|
||||||
|
|
||||||
//LEGACY: accept resources starting with tomahawk too
|
//LEGACY: accept resources starting with tomahawk too
|
||||||
if( jid.resource().startsWith("tomahawk") )
|
if( jid.resource().startsWith("tomahawk") )
|
||||||
|
@@ -146,7 +146,7 @@ CollectionItem::playlistsAddedInternal( SourceTreeItem* parent, const QList< dyn
|
|||||||
foreach( const dynplaylist_ptr& p, playlists )
|
foreach( const dynplaylist_ptr& p, playlists )
|
||||||
{
|
{
|
||||||
DynamicPlaylistItem* plItem = new DynamicPlaylistItem( model(), parent, p, parent->children().count() - addOffset );
|
DynamicPlaylistItem* plItem = new DynamicPlaylistItem( model(), parent, p, parent->children().count() - addOffset );
|
||||||
qDebug() << "Dynamic Playlist added:" << p->title() << p->creator() << p->info();
|
// qDebug() << "Dynamic Playlist added:" << p->title() << p->creator() << p->info();
|
||||||
p->loadRevision();
|
p->loadRevision();
|
||||||
items << plItem;
|
items << plItem;
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ CollectionItem::onPlaylistsAdded( const QList< playlist_ptr >& playlists )
|
|||||||
foreach( const playlist_ptr& p, playlists )
|
foreach( const playlist_ptr& p, playlists )
|
||||||
{
|
{
|
||||||
PlaylistItem* plItem = new PlaylistItem( model(), m_playlists, p, m_playlists->children().count() - addOffset );
|
PlaylistItem* plItem = new PlaylistItem( model(), m_playlists, p, m_playlists->children().count() - addOffset );
|
||||||
qDebug() << "Playlist added:" << p->title() << p->creator() << p->info();
|
// qDebug() << "Playlist added:" << p->title() << p->creator() << p->info();
|
||||||
p->loadRevision();
|
p->loadRevision();
|
||||||
items << plItem;
|
items << plItem;
|
||||||
}
|
}
|
||||||
|
@@ -251,9 +251,11 @@ DynamicPlaylistItem::checkReparentHackNeeded( const DynamicPlaylistRevision& rev
|
|||||||
// HACK HACK HACK workaround for an ugly hack where we have to be compatible with older tomahawks (pre-0.1.0) that created dynplaylists as OnDemand then changed them to Static if they were static.
|
// HACK HACK HACK workaround for an ugly hack where we have to be compatible with older tomahawks (pre-0.1.0) that created dynplaylists as OnDemand then changed them to Static if they were static.
|
||||||
// we need to reparent this playlist to the correct category :-/.
|
// we need to reparent this playlist to the correct category :-/.
|
||||||
CategoryItem* cat = qobject_cast< CategoryItem* >( parent() );
|
CategoryItem* cat = qobject_cast< CategoryItem* >( parent() );
|
||||||
qDebug() << "with category" << cat;
|
|
||||||
if( cat ) qDebug() << "and cat type:" << cat->categoryType();
|
// qDebug() << "with category" << cat;
|
||||||
if( cat ) {
|
// if( cat ) qDebug() << "and cat type:" << cat->categoryType();
|
||||||
|
if( cat )
|
||||||
|
{
|
||||||
CategoryItem* from = cat;
|
CategoryItem* from = cat;
|
||||||
CategoryItem* to = 0;
|
CategoryItem* to = 0;
|
||||||
if( cat->categoryType() == SourcesModel::PlaylistsCategory && revision.mode == OnDemand ) { // WRONG
|
if( cat->categoryType() == SourcesModel::PlaylistsCategory && revision.mode == OnDemand ) { // WRONG
|
||||||
@@ -270,7 +272,7 @@ DynamicPlaylistItem::checkReparentHackNeeded( const DynamicPlaylistRevision& rev
|
|||||||
} else if( cat->categoryType() == SourcesModel::StationsCategory && revision.mode == Static ) { // WRONG
|
} else if( cat->categoryType() == SourcesModel::StationsCategory && revision.mode == Static ) { // WRONG
|
||||||
CollectionItem* col = qobject_cast< CollectionItem* >( cat->parent() );
|
CollectionItem* col = qobject_cast< CollectionItem* >( cat->parent() );
|
||||||
to = col->playlistsCategory();
|
to = col->playlistsCategory();
|
||||||
qDebug() << "TRYING TO HACK TO:" << to;
|
// qDebug() << "TRYING TO HACK TO:" << to;
|
||||||
if( !to ) { // you have got to be fucking kidding me
|
if( !to ) { // you have got to be fucking kidding me
|
||||||
int fme = col->children().count();
|
int fme = col->children().count();
|
||||||
col->beginRowsAdded( fme, fme );
|
col->beginRowsAdded( fme, fme );
|
||||||
@@ -281,7 +283,7 @@ DynamicPlaylistItem::checkReparentHackNeeded( const DynamicPlaylistRevision& rev
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( to ) {
|
if( to ) {
|
||||||
qDebug() << "HACKING! moving dynamic playlist from" << from->text() << "to:" << to->text();
|
// qDebug() << "HACKING! moving dynamic playlist from" << from->text() << "to:" << to->text();
|
||||||
// remove and add
|
// remove and add
|
||||||
int idx = from->children().indexOf( this );
|
int idx = from->children().indexOf( this );
|
||||||
from->beginRowsRemoved( idx, idx );
|
from->beginRowsRemoved( idx, idx );
|
||||||
|
Reference in New Issue
Block a user