1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-08 10:02:29 +02:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Leo Franchi 2011-04-29 18:05:42 -04:00
commit 6be3027be5
6 changed files with 57 additions and 25 deletions

View File

@ -35,28 +35,6 @@ InfoPlugin::InfoPlugin(QObject *parent)
:QObject( parent )
{
qDebug() << Q_FUNC_INFO;
InfoSystem *system = qobject_cast< InfoSystem* >( parent );
if( system )
{
QObject::connect(
this,
SIGNAL( getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
system->getCache(),
SLOT( getCachedInfoSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) )
);
QObject::connect(
system->getCache(),
SIGNAL( notInCache( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
this,
SLOT( notInCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) )
);
QObject::connect(
this,
SIGNAL( updateCache( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) ),
system->getCache(),
SLOT( updateCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) )
);
}
}
@ -68,6 +46,7 @@ InfoSystem::instance()
return s_instance;
}
InfoSystem::InfoSystem(QObject *parent)
: QObject(parent)
{
@ -96,6 +75,25 @@ InfoSystem::InfoSystem(QObject *parent)
SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
Qt::UniqueConnection
);
connect(
plugin.data(),
SIGNAL( getCachedInfo( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
m_cache,
SLOT( getCachedInfoSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) )
);
connect(
m_cache,
SIGNAL( notInCache( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
plugin.data(),
SLOT( notInCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, QString, Tomahawk::InfoSystem::InfoType, QVariant, Tomahawk::InfoSystem::InfoCustomData ) )
);
connect(
plugin.data(),
SIGNAL( updateCache( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) ),
m_cache,
SLOT( updateCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) )
);
}
connect( m_cache, SIGNAL( info( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ),
this, SLOT( infoSlot( QString, Tomahawk::InfoSystem::InfoType, QVariant, QVariant, Tomahawk::InfoSystem::InfoCustomData ) ), Qt::UniqueConnection );
@ -154,7 +152,7 @@ void InfoSystem::getInfo(const QString &caller, const InfoType type, const QVari
QLinkedList< InfoPluginPtr > providers = determineOrderedMatches(type);
if (providers.isEmpty())
{
emit info(QString(), InfoNoInfo, QVariant(), QVariant(), customData);
emit info(caller, InfoNoInfo, QVariant(), QVariant(), customData);
emit finished(caller);
return;
}
@ -162,7 +160,7 @@ void InfoSystem::getInfo(const QString &caller, const InfoType type, const QVari
InfoPluginPtr ptr = providers.first();
if (!ptr)
{
emit info(QString(), InfoNoInfo, QVariant(), QVariant(), customData);
emit info(caller, InfoNoInfo, QVariant(), QVariant(), customData);
emit finished(caller);
return;
}

View File

@ -135,11 +135,17 @@ protected:
private:
friend class InfoSystem;
friend class InfoSystemCache;
};
typedef QWeakPointer< InfoPlugin > InfoPluginPtr;
class DLLEXPORT InfoSystemWorker : public QObject
{
Q_OBJECT
InfoSystemWorker() {};
~InfoSystemWorker() {};
};
class DLLEXPORT InfoSystem : public QObject
{
Q_OBJECT
@ -175,7 +181,9 @@ private:
QHash< QString, QHash< InfoType, int > > m_dataTracker;
InfoSystemCache* m_cache;
InfoSystemWorker* m_worker;
QThread* m_infoSystemCacheThreadController;
QThread* m_infoSystemWorkerThreadController;
static InfoSystem* s_instance;
};

View File

@ -165,6 +165,12 @@ ScriptResolver::handleMsg( const QByteArray& msg )
rp->setMimetype( TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() ) );
Q_ASSERT( !rp->mimetype().isEmpty() );
}
if ( m.contains( "year" ) )
{
QVariantMap attr;
attr[ "releaseyear" ] = m.value( "year" );
rp->setAttributes( attr );
}
results << rp;
}

View File

@ -18,6 +18,8 @@
#include "jabber_p.h"
#include <string>
#include <QDebug>
#include <QTime>
#include <QTimer>
@ -456,6 +458,11 @@ Jabber_p::handleMessage( const gloox::Message& m, gloox::MessageSession * /*sess
QVariant v = parser.parse( msg.toAscii(), &ok );
if ( !ok || v.type() != QVariant::Map )
{
if ( m.from().server().find( "googlemail." ) != string::npos
|| m.from().server().find( "gmail." ) != string::npos
|| m.from().server().find( "gtalk." ) != string::npos )
return;
sendMsg( from, QString( "I'm sorry -- I'm just an automatic presence used by Tomahawk Player (http://gettomahawk.com). If you are getting this message, the person you are trying to reach is probably not signed on, so please try again later!" ) );
return;
}

View File

@ -334,6 +334,12 @@ Jabber_p::onNewMessage( const Jreen::Message& m )
QVariant v = parser.parse( msg.toAscii(), &ok );
if ( !ok || v.type() != QVariant::Map )
{
if ( m.from().domain().contains( "googlemail." )
|| m.from().domain().contains( "gmail." )
|| m.from().domain().contains( "gtalk." )
)
return;
QString to = from;
QString response = QString( tr("I'm sorry -- I'm just an automatic presence used by Tomahawk Player"
" (http://gettomahawk.com). If you are getting this message, the person you"

View File

@ -105,6 +105,13 @@ SourceTreeView::SourceTreeView( QWidget* parent )
// connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( onSelectionChanged() ) );
hideOfflineSources();
// Light-blue sourcetree on osx
#ifdef Q_WS_MAC
setStyleSheet( "SourceTreeView:active { background: #DDE4EB; } "
"SourceTreeView { background: #EDEDED; } " );
#endif
}