1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 08:19:42 +01:00

* Removed debug output and cleaned up sources a bit.

This commit is contained in:
Christian Muehlhaeuser 2011-05-20 00:43:33 +02:00
parent bf765dfc2e
commit 0fab2a9836
9 changed files with 83 additions and 87 deletions

View File

@ -61,7 +61,7 @@ source_ptr& Collection::source() const
void
Collection::addPlaylist( const Tomahawk::playlist_ptr& p )
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
if ( m_playlists.contains( p->guid() ) )
return;
@ -81,39 +81,42 @@ Collection::addPlaylist( const Tomahawk::playlist_ptr& p )
void
Collection::addAutoPlaylist( const Tomahawk::dynplaylist_ptr& p )
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
QList<dynplaylist_ptr> toadd;
toadd << p;
qDebug() << "Inserted dynamic playlist with guid:" << p->guid();
m_autoplaylists.insert( p->guid(), p );
qDebug() << Q_FUNC_INFO << "Collection name" << name()
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.count();
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.count();
emit autoPlaylistsAdded( toadd );
}
void
Collection::addStation( const dynplaylist_ptr& s )
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
QList<dynplaylist_ptr> toadd;
toadd << s;
qDebug() << "Inserted station with guid:" << s->guid();
m_stations.insert( s->guid(), s );
qDebug() << Q_FUNC_INFO << "Collection name" << name()
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.count();
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.count();
emit stationsAdded( toadd );
}
void
Collection::deletePlaylist( const Tomahawk::playlist_ptr& p )
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
QList<playlist_ptr> todelete;
todelete << p;
m_playlists.remove( p->guid() );
@ -128,7 +131,8 @@ Collection::deletePlaylist( const Tomahawk::playlist_ptr& p )
void
Collection::deleteAutoPlaylist( const Tomahawk::dynplaylist_ptr& p )
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
QList<dynplaylist_ptr> todelete;
todelete << p;
m_autoplaylists.remove( p->guid() );
@ -139,17 +143,19 @@ Collection::deleteAutoPlaylist( const Tomahawk::dynplaylist_ptr& p )
emit autoPlaylistsDeleted( todelete );
}
void
Collection::deleteStation( const dynplaylist_ptr& s )
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
QList<dynplaylist_ptr> todelete;
todelete << s;
m_stations.remove( s->guid() );
qDebug() << Q_FUNC_INFO << "Collection name" << name()
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.count();
<< "from source id" << source()->id()
<< "numplaylists:" << m_playlists.count();
emit stationsDeleted( todelete );
}
@ -167,6 +173,7 @@ Collection::autoPlaylist( const QString& guid )
return m_autoplaylists.value( guid, dynplaylist_ptr() );
}
dynplaylist_ptr
Collection::station( const QString& guid )
{
@ -179,8 +186,9 @@ void
Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
{
qDebug() << Q_FUNC_INFO << plists.count();
foreach ( const playlist_ptr& p, plists ) {
qDebug() << "Batch inserting playlist:" << p->guid();
foreach ( const playlist_ptr& p, plists )
{
// qDebug() << "Batch inserting playlist:" << p->guid();
m_playlists.insert( p->guid(), p );
}
emit playlistsAdded( plists );
@ -192,25 +200,29 @@ Collection::setAutoPlaylists( const QList< Tomahawk::dynplaylist_ptr >& plists )
{
qDebug() << Q_FUNC_INFO << plists.count();
foreach ( const dynplaylist_ptr& p, plists ) {
qDebug() << "Batch inserting dynamic playlist:" << p->guid();
foreach ( const dynplaylist_ptr& p, plists )
{
// qDebug() << "Batch inserting dynamic playlist:" << p->guid();
m_autoplaylists.insert( p->guid(), p );
}
emit autoPlaylistsAdded( plists );
}
void
Collection::setStations( const QList< dynplaylist_ptr >& stations )
{
qDebug() << Q_FUNC_INFO << stations.count();
foreach ( const dynplaylist_ptr& s, stations ) {
qDebug() << "Batch inserting station:" << s->guid();
foreach ( const dynplaylist_ptr& s, stations )
{
// qDebug() << "Batch inserting station:" << s->guid();
m_stations.insert( s->guid(), s );
}
emit autoPlaylistsAdded( stations );
}
void
Collection::setTracks( const QList<Tomahawk::query_ptr>& tracks )
{
@ -227,7 +239,6 @@ Collection::delTracks( const QStringList& files )
qDebug() << Q_FUNC_INFO << files.count() << name();
QList<Tomahawk::query_ptr> tracks;
int i = 0;
foreach ( const query_ptr& query, m_tracks )
{
@ -237,7 +248,7 @@ Collection::delTracks( const QStringList& files )
{
if ( file == result->url() )
{
qDebug() << Q_FUNC_INFO << "Found deleted result:" << file;
// qDebug() << Q_FUNC_INFO << "Found deleted result:" << file;
tracks << query;
m_tracks.removeAt( i );
}
@ -250,14 +261,15 @@ Collection::delTracks( const QStringList& files )
emit tracksRemoved( tracks );
}
void
Collection::moveAutoToStation( const QString& guid )
{
if( m_autoplaylists.contains( guid ) )
m_stations.insert( guid, m_autoplaylists.take( guid ) );
}
void
Collection::moveStationToAuto( const QString& guid )
{

View File

@ -122,11 +122,9 @@ ControlConnection::registerSource()
Q_UNUSED( source )
Q_ASSERT( source == m_source.data() );
qDebug() << Q_FUNC_INFO << "Setting avatar ... " << name() << !SipHandler::instance()->avatar( name() ).isNull();
// qDebug() << Q_FUNC_INFO << "Setting avatar ... " << name() << !SipHandler::instance()->avatar( name() ).isNull();
source->setAvatar( SipHandler::instance()->avatar( name() ) );
// .. but we'll use the shared pointer we've already made:
m_registered = true;
m_servent->registerControlConnection( this );
setupDbSyncConnection();

View File

@ -124,7 +124,7 @@ Pipeline::resolve( const QList<query_ptr>& qlist, bool prioritized )
if ( m_queries_pending.contains( q ) )
{
qDebug() << "Already queued for resolving:" << q->toString();
// qDebug() << "Already queued for resolving:" << q->toString();
continue;
}
@ -192,15 +192,13 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
if ( q->solved() )
{
qDebug() << "FINISHED RESOLVING EARLY" << q->toString();
// qDebug() << "FINISHED RESOLVING EARLY" << q->toString();
q->onResolvingFinished();
setQIDState( q, 0 );
if ( m_qidsTimeout.contains( q->id() ) )
m_qidsTimeout.remove( q->id() );
qDebug() << "Queries running:" << m_qidsState.count();
shuntNext();
return;
}
@ -214,7 +212,6 @@ Pipeline::reportResults( QID qid, const QList< result_ptr >& results )
if ( m_qidsTimeout.contains( q->id() ) )
m_qidsTimeout.remove( q->id() );
qDebug() << "Queries running:" << m_qidsState.count();
shuntNext();
}
else
@ -271,8 +268,8 @@ Pipeline::timeoutShunt( const query_ptr& q )
m_qidsTimeout.remove( q->id() );
shunt( q );
}
else
qDebug() << Q_FUNC_INFO << q->toString() << "Ignoring timeout";
/* else
qDebug() << Q_FUNC_INFO << q->toString() << "Ignoring timeout";*/
}
@ -282,7 +279,7 @@ Pipeline::shunt( const query_ptr& q )
if ( !m_running )
return;
qDebug() << Q_FUNC_INFO << q->solved() << q->toString() << q->id();
// qDebug() << Q_FUNC_INFO << q->solved() << q->toString() << q->id();
unsigned int lastweight = 0;
unsigned int lasttimeout = 0;
int thisResolver = 0;
@ -308,7 +305,7 @@ Pipeline::shunt( const query_ptr& q )
if ( r->timeout() < lasttimeout )
lasttimeout = r->timeout();
qDebug() << "Dispatching to resolver" << r->name() << q->toString();
qDebug() << "Dispatching to resolver" << r->name() << q->toString() << q->solved() << q->id();
thisResolver = i;
r->resolve( q );
}
@ -334,7 +331,6 @@ Pipeline::shunt( const query_ptr& q )
// reached end of pipeline
qDebug() << "Reached end of pipeline for:" << q->toString();
setQIDState( q, 0 );
qDebug() << "Queries running:" << m_qidsState.count();
}
shuntNext();
@ -358,14 +354,16 @@ Pipeline::setQIDState( const Tomahawk::query_ptr& query, int state )
if ( state > 0 )
{
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 );
}
else
{
qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
m_qidsState.remove( query->id() );
}
qDebug() << "Queries running:" << m_qidsState.count();
}
@ -380,9 +378,10 @@ Pipeline::incQIDState( const Tomahawk::query_ptr& query )
state = m_qidsState.value( query->id() ) + 1;
}
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 );
qDebug() << "Queries running:" << m_qidsState.count();
return state;
}
@ -398,14 +397,15 @@ Pipeline::decQIDState( const Tomahawk::query_ptr& query )
int state = m_qidsState.value( query->id() ) - 1;
if ( state )
{
qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state;
// qDebug() << Q_FUNC_INFO << "replacing" << query->id() << state;
m_qidsState.insert( query->id(), state );
}
else
{
qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
// qDebug() << Q_FUNC_INFO << "removing" << query->id() << state;
m_qidsState.remove( query->id() );
}
qDebug() << "Queries running:" << m_qidsState.count();
return state;
}

View File

@ -69,16 +69,16 @@ SipHandler::~SipHandler()
const QPixmap
SipHandler::avatar( const QString& name ) const
{
qDebug() << Q_FUNC_INFO << "Getting avatar" << name << m_usernameAvatars.keys();
qDebug() << Q_FUNC_INFO << "Getting avatar" << name; // << m_usernameAvatars.keys();
if( m_usernameAvatars.contains( name ) )
{
qDebug() << Q_FUNC_INFO << "Getting avatar and avatar != null ";
// qDebug() << Q_FUNC_INFO << "Getting avatar and avatar != null ";
Q_ASSERT(!m_usernameAvatars.value( name ).isNull());
return m_usernameAvatars.value( name );
}
else
{
qDebug() << Q_FUNC_INFO << "Getting avatar and avatar == null, GAAAAAH ";
qDebug() << Q_FUNC_INFO << "Getting avatar and avatar == null :-(";
return QPixmap();
}
}
@ -601,10 +601,10 @@ SipHandler::onStateChanged( SipPlugin::ConnectionState state )
void
SipHandler::onAvatarReceived( const QString& from, const QPixmap& avatar )
{
qDebug() << Q_FUNC_INFO << " setting avatar on source for " << from;
// qDebug() << Q_FUNC_INFO << "setting avatar on source for" << from;
if ( avatar.isNull() )
{
qDebug() << Q_FUNC_INFO << " got null pixmap, not adding anything";
// qDebug() << Q_FUNC_INFO << "got null pixmap, not adding anything";
return;
}
@ -616,22 +616,22 @@ SipHandler::onAvatarReceived( const QString& from, const QPixmap& avatar )
ControlConnection *conn = Servent::instance()->lookupControlConnection( from );
if( conn )
{
qDebug() << Q_FUNC_INFO << from << "got control connection";
// qDebug() << Q_FUNC_INFO << from << "got control connection";
Tomahawk::source_ptr source = conn->source();
if( source )
{
qDebug() << Q_FUNC_INFO << from << "got source, setting avatar";
// qDebug() << Q_FUNC_INFO << from << "got source, setting avatar";
source->setAvatar( avatar );
}
else
{
qDebug() << Q_FUNC_INFO << from << "no source found, not setting avatar";
// qDebug() << Q_FUNC_INFO << from << "no source found, not setting avatar";
}
}
else
{
qDebug() << Q_FUNC_INFO << from << "no control connection setup yet";
// qDebug() << Q_FUNC_INFO << from << "no control connection setup yet";
}
}
@ -639,7 +639,7 @@ SipHandler::onAvatarReceived( const QString& from, const QPixmap& avatar )
void
SipHandler::onAvatarReceived( const QPixmap& avatar )
{
qDebug() << Q_FUNC_INFO << "Set own avatar on MyCollection";
// qDebug() << Q_FUNC_INFO << "Set own avatar on MyCollection";
SourceList::instance()->getLocal()->setAvatar( avatar );
}

View File

@ -84,7 +84,7 @@ SipInfo::clear()
bool
SipInfo::isValid() const
{
qDebug() << Q_FUNC_INFO << d->visible << d->host.hostName() << d->port << d->uniqname << d->key;
// qDebug() << Q_FUNC_INFO << d->visible << d->host.hostName() << d->port << d->uniqname << d->key;
if( !d->visible.isNull() )
{
if(

View File

@ -42,7 +42,7 @@ WelcomePlaylistModel::WelcomePlaylistModel( QObject* parent )
void
WelcomePlaylistModel::loadFromSettings()
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
if( !m_waitingForSome )
return;
@ -54,7 +54,7 @@ WelcomePlaylistModel::loadFromSettings()
for( int i = playlist_guids.size() - 1; i >= 0; i-- )
{
qDebug() << "loading playlist" << playlist_guids[i];
// qDebug() << "loading playlist" << playlist_guids[i];
playlist_ptr pl = m_cached.value( playlist_guids[i], playlist_ptr() );
if( pl.isNull() )

View File

@ -81,14 +81,14 @@ void AvatarManager::onNewIq(const Jreen::IQ& iq, int context)
{
iq.accept();
qDebug() << Q_FUNC_INFO << "Got vcard from " << iq.from().full();
// qDebug() << Q_FUNC_INFO << "Got vcard from " << iq.from().full();
QString id = iq.from().full();
QString avatarHash;
const Jreen::VCard::Photo &photo = vcard->photo();
if (!photo.data().isEmpty()) {
qDebug() << "vcard: got photo data" << id;
// qDebug() << "vcard: got photo data" << id;
avatarHash = QCryptographicHash::hash(photo.data(), QCryptographicHash::Sha1).toHex();
@ -110,13 +110,13 @@ void AvatarManager::onNewIq(const Jreen::IQ& iq, int context)
}
else
{
qDebug() << "vcard: got no photo data" << id;
// qDebug() << "vcard: got no photo data" << id;
}
// got own presence
if ( m_client->jid().bare() == id )
{
qDebug() << Q_FUNC_INFO << "got own vcard";
// qDebug() << Q_FUNC_INFO << "got own vcard";
Jreen::Presence presence = m_client->presence();
Jreen::VCardUpdate::Ptr update = presence.findExtension<Jreen::VCardUpdate>();
@ -167,5 +167,5 @@ bool AvatarManager::isCached(const QString &avatarHash) const
void AvatarManager::onNewAvatar(const QString& jid)
{
qDebug() << Q_FUNC_INFO << "Found new Avatar..." << jid;
// qDebug() << Q_FUNC_INFO << "Found new Avatar..." << jid;
}

View File

@ -219,10 +219,7 @@ JabberPlugin::connectPlugin( bool startup )
return true; //FIXME: should i return false here?!
}
qDebug() << "Connecting to the XMPP server...";
qDebug() << m_client->jid().full();
qDebug() << m_client->server() << m_client->port();
qDebug() << "Connecting to the XMPP server..." << m_client->jid().full();
//FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon
QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) );
@ -263,7 +260,7 @@ JabberPlugin::disconnectPlugin()
void
JabberPlugin::onConnect()
{
qDebug() << Q_FUNC_INFO;
// qDebug() << Q_FUNC_INFO;
// update jid resource, servers like gtalk use resource binding and may
// have changed our requested /resource
@ -273,7 +270,7 @@ JabberPlugin::onConnect()
emit jidChanged( m_client->jid().full() );
}
qDebug() << "Connected as:" << m_client->jid().full();
qDebug() << "Connected to jabber as:" << m_client->jid().full();
// set presence to least valid value
m_client->setPresence(Jreen::Presence::XA, "Got Tomahawk? http://gettomahawk.com", -127);
@ -439,7 +436,6 @@ JabberPlugin::sendMsg(const QString& to, const QString& msg)
sipMessage = new TomahawkSipMessage();
}
qDebug() << "Send sip messsage to " << to;
Jreen::IQ iq( Jreen::IQ::Set, to );
iq.addExtension( sipMessage );
@ -581,7 +577,7 @@ void JabberPlugin::onNewMessage(const Jreen::Message& message)
if ( m_state != Connected )
return;
qDebug() << Q_FUNC_INFO << "message type" << message.subtype();
// qDebug() << Q_FUNC_INFO << "message type" << message.subtype();
QString from = message.from().full();
QString msg = message.body();
@ -626,7 +622,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
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() )
return;
@ -648,8 +644,7 @@ void JabberPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, const
*/
if( caps )
{
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps " << caps->node()
<< "requesting disco..";
qDebug() << Q_FUNC_INFO << fulljid << "Running tomahawk: maybe" << "caps " << caps->node() << "requesting disco..";
// request disco features
QString node = caps->node() + '#' + caps->ver();
@ -670,7 +665,7 @@ void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, co
if ( m_state != Connected )
return;
qDebug() << Q_FUNC_INFO << "presence type: " << presence.subtype();
qDebug() << Q_FUNC_INFO << "presence type:" << presence.subtype();
if(item)
qDebug() << Q_FUNC_INFO << presence.from().full() << "subs" << item->subscription() << "ask" << item->ask();
else
@ -700,8 +695,6 @@ void JabberPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, co
return;
}
qDebug() << Q_FUNC_INFO << presence.from().bare() << "open subscription request box";
// preparing the confirm box for the user
QMessageBox *confirmBox = new QMessageBox(
QMessageBox::Question,
@ -734,8 +727,6 @@ JabberPlugin::onSubscriptionRequestConfirmed( int result )
}
}
qDebug() << Q_FUNC_INFO << "box confirmed for" << jid.bare();
// we got an answer, deleting the box
m_subscriptionConfirmBoxes.remove( jid );
sender()->deleteLater();
@ -762,7 +753,7 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq, int context)
if( context == RequestDisco )
{
qDebug() << Q_FUNC_INFO << "Received disco IQ...";
// qDebug() << Q_FUNC_INFO << "Received disco IQ...";
Jreen::Disco::Info *discoInfo = iq.findExtension<Jreen::Disco::Info>().data();
if(!discoInfo)
return;
@ -809,7 +800,7 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq, int context)
{
qDebug() << "Sent IQ(Set), what should be happening here?";
}
else if(context == SipMessageSent )
else if( context == SipMessageSent )
{
qDebug() << "Sent SipMessage... what now?!";
}
@ -819,18 +810,13 @@ void JabberPlugin::onNewIq(const Jreen::IQ& iq, int context)
}*/
else
{
TomahawkSipMessage *sipMessage = iq.findExtension<TomahawkSipMessage>().data();
if(sipMessage)
{
iq.accept();
qDebug() << Q_FUNC_INFO << "Got SipMessage ...";
qDebug() << Q_FUNC_INFO << "ip" << sipMessage->ip();
qDebug() << Q_FUNC_INFO << "port" << sipMessage->port();
qDebug() << Q_FUNC_INFO << "uniqname" << sipMessage->uniqname();
qDebug() << Q_FUNC_INFO << "key" << sipMessage->key();
qDebug() << Q_FUNC_INFO << "visible" << sipMessage->visible();
qDebug() << Q_FUNC_INFO << "Got SipMessage ..."
<< "ip" << sipMessage->ip() << "port" << sipMessage->port() << "uniqname" << sipMessage->uniqname() << "key" << sipMessage->key() << "visible" << sipMessage->visible();
SipInfo info;
info.setVisible( sipMessage->visible() );
@ -920,7 +906,7 @@ void JabberPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Type
void JabberPlugin::onNewAvatar(const QString& jid)
{
qDebug() << Q_FUNC_INFO << jid;
// qDebug() << Q_FUNC_INFO << jid;
if ( m_state != Connected )
return;

View File

@ -1,5 +1,5 @@
#include "tomahawksipmessagefactory.h"
//#include "util.h"
#include <QStringList>
#include <QXmlStreamWriter>
#include <QDebug>
@ -43,7 +43,7 @@ void TomahawkSipMessageFactory::handleStartElement(const QStringRef &name, const
} else if (m_depth == 2) {
if (name == QLatin1String("transport"))
{
qDebug() << "Found Transport";
// qDebug() << "Found Transport";
m_state = AtTransport;
m_uniqname = attributes.value(QLatin1String("uniqname")).toString();
@ -53,7 +53,7 @@ void TomahawkSipMessageFactory::handleStartElement(const QStringRef &name, const
if (name == QLatin1String("candidate"))
{
m_state = AtCandidate;
qDebug() << "Found candidate";
// qDebug() << "Found candidate";
m_ip = attributes.value(QLatin1String("ip")).toString();
m_port = attributes.value(QLatin1String("port")).toString().toInt();