mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 01:54:07 +02:00
Merge remote-tracking branch 'origin' into phonon
This commit is contained in:
@@ -75,7 +75,7 @@ FIND_PATH(CLUCENE_LIBRARY_DIR
|
|||||||
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
|
PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
|
||||||
IF (CLUCENE_LIBRARY_DIR)
|
IF (CLUCENE_LIBRARY_DIR)
|
||||||
MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
|
MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
|
||||||
#INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
|
INCLUDE(${CLUCENE_LIBRARY_DIR}/CLuceneConfig.cmake/CLuceneConfig.cmake)
|
||||||
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
|
IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
|
||||||
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
|
MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
|
||||||
SET(CLUCENE_GOOD_VERSION FALSE)
|
SET(CLUCENE_GOOD_VERSION FALSE)
|
||||||
|
@@ -18,7 +18,7 @@ public:
|
|||||||
virtual QString name() const;
|
virtual QString name() const;
|
||||||
virtual unsigned int weight() const { return m_weight; }
|
virtual unsigned int weight() const { return m_weight; }
|
||||||
virtual unsigned int preference() const { return 100; }
|
virtual unsigned int preference() const { return 100; }
|
||||||
virtual unsigned int timeout() const { return 1000; }
|
virtual unsigned int timeout() const { return 2500; }
|
||||||
|
|
||||||
virtual void resolve( const Tomahawk::query_ptr& query );
|
virtual void resolve( const Tomahawk::query_ptr& query );
|
||||||
|
|
||||||
|
@@ -38,6 +38,9 @@ signals:
|
|||||||
void peerOnline( const QString& );
|
void peerOnline( const QString& );
|
||||||
void peerOffline( const QString& );
|
void peerOffline( const QString& );
|
||||||
void msgReceived( const QString& from, const QString& msg );
|
void msgReceived( const QString& from, const QString& msg );
|
||||||
|
|
||||||
|
void addMenu( QMenu* menu );
|
||||||
|
void removeMenu( QMenu* menu );
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE( SipPlugin, "tomahawk.Sip/1.0" )
|
Q_DECLARE_INTERFACE( SipPlugin, "tomahawk.Sip/1.0" )
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include "album.h"
|
#include "album.h"
|
||||||
#include "pipeline.h"
|
#include "pipeline.h"
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
|
#include "functimeout.h"
|
||||||
|
|
||||||
|
|
||||||
ScriptResolver::ScriptResolver( const QString& exe )
|
ScriptResolver::ScriptResolver( const QString& exe )
|
||||||
@@ -104,10 +105,19 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
|
|
||||||
if( msgtype == "results" )
|
if( msgtype == "results" )
|
||||||
{
|
{
|
||||||
QList< Tomahawk::result_ptr > 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;
|
||||||
const QVariantList reslist = m.value( "results" ).toList();
|
const QVariantList reslist = m.value( "results" ).toList();
|
||||||
Tomahawk::collection_ptr coll = SourceList::instance()->getLocal()->collection();
|
Tomahawk::collection_ptr coll = SourceList::instance()->getLocal()->collection();
|
||||||
|
|
||||||
foreach( const QVariant& rv, reslist )
|
foreach( const QVariant& rv, reslist )
|
||||||
{
|
{
|
||||||
QVariantMap m = rv.toMap();
|
QVariantMap m = rv.toMap();
|
||||||
@@ -127,6 +137,7 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
|||||||
rp->setCollection( coll );
|
rp->setCollection( coll );
|
||||||
results << rp;
|
results << rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::Pipeline::instance()->reportResults( qid, results );
|
Tomahawk::Pipeline::instance()->reportResults( qid, results );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,6 +183,9 @@ 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 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -201,3 +215,16 @@ ScriptResolver::stop()
|
|||||||
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 );
|
||||||
|
}
|
||||||
|
@@ -40,6 +40,8 @@ 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 );
|
||||||
@@ -54,6 +56,8 @@ 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;
|
||||||
};
|
};
|
||||||
|
@@ -286,6 +286,6 @@ SipHandler::onError( int code, const QString& msg )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SipPlugin* sip = qobject_cast<SipPlugin*>(sender());
|
SipPlugin* sip = qobject_cast<SipPlugin*>(sender());
|
||||||
QTimer::singleShot( 10000, sip, SLOT( connect() ) );
|
QTimer::singleShot( 10000, sip, SLOT( connectPlugin() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,15 +9,9 @@
|
|||||||
|
|
||||||
JabberPlugin::JabberPlugin()
|
JabberPlugin::JabberPlugin()
|
||||||
: p( 0 ),
|
: p( 0 ),
|
||||||
m_menu ( 0 )
|
m_menu ( 0 ),
|
||||||
|
m_addFriendAction( 0 )
|
||||||
{
|
{
|
||||||
if( !accountName().isEmpty() )
|
|
||||||
m_menu = new QMenu(QString("Jabber (").append(accountName()).append(")"));
|
|
||||||
|
|
||||||
m_addFriendAction = m_menu->addAction("Add Friend...");
|
|
||||||
|
|
||||||
connect(m_addFriendAction, SIGNAL(triggered()),
|
|
||||||
this, SLOT(showAddFriendDialog()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -86,8 +80,8 @@ JabberPlugin::connectPlugin( bool startup )
|
|||||||
QObject::connect( p, SIGNAL( peerOffline( QString ) ), SIGNAL( peerOffline( QString ) ) );
|
QObject::connect( p, SIGNAL( peerOffline( QString ) ), SIGNAL( peerOffline( QString ) ) );
|
||||||
QObject::connect( p, SIGNAL( msgReceived( QString, QString ) ), SIGNAL( msgReceived( QString, QString ) ) );
|
QObject::connect( p, SIGNAL( msgReceived( QString, QString ) ), SIGNAL( msgReceived( QString, QString ) ) );
|
||||||
|
|
||||||
QObject::connect( p, SIGNAL( connected() ), SIGNAL( connected() ) );
|
QObject::connect( p, SIGNAL( connected() ), SLOT( onConnected() ) );
|
||||||
QObject::connect( p, SIGNAL( disconnected() ), SIGNAL( disconnected() ) );
|
QObject::connect( p, SIGNAL( disconnected() ), SIGNAL( onDisconnected() ) );
|
||||||
QObject::connect( p, SIGNAL( authError( int, QString ) ), SLOT( onAuthError( int, QString ) ) );
|
QObject::connect( p, SIGNAL( authError( int, QString ) ), SLOT( onAuthError( int, QString ) ) );
|
||||||
|
|
||||||
p->resolveHostSRV();
|
p->resolveHostSRV();
|
||||||
@@ -95,6 +89,38 @@ JabberPlugin::connectPlugin( bool startup )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JabberPlugin::onConnected()
|
||||||
|
{
|
||||||
|
if( !m_menu ) {
|
||||||
|
m_menu = new QMenu( QString( "Jabber (").append( accountName() ).append( ")" ) );
|
||||||
|
|
||||||
|
m_addFriendAction = m_menu->addAction( "Add Friend..." );
|
||||||
|
|
||||||
|
connect( m_addFriendAction, SIGNAL( triggered() ),
|
||||||
|
this, SLOT( showAddFriendDialog() ) ) ;
|
||||||
|
|
||||||
|
emit addMenu( m_menu );
|
||||||
|
}
|
||||||
|
|
||||||
|
emit connected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JabberPlugin::onDisconnected()
|
||||||
|
{
|
||||||
|
if( m_menu && m_addFriendAction ) {
|
||||||
|
emit removeMenu( m_menu );
|
||||||
|
|
||||||
|
delete m_menu;
|
||||||
|
m_menu = 0;
|
||||||
|
m_addFriendAction = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit disconnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::onAuthError( int code, const QString& message )
|
JabberPlugin::onAuthError( int code, const QString& message )
|
||||||
|
@@ -32,6 +32,8 @@ public slots:
|
|||||||
|
|
||||||
void disconnectPlugin()
|
void disconnectPlugin()
|
||||||
{
|
{
|
||||||
|
onDisconnected();
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
p->disconnect();
|
p->disconnect();
|
||||||
|
|
||||||
@@ -60,7 +62,9 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
void onAuthError( int, const QString& );
|
void onAuthError( int, const QString& );
|
||||||
void showAddFriendDialog();
|
void showAddFriendDialog();
|
||||||
|
void onConnected();
|
||||||
|
void onDisconnected();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Jabber_p* p;
|
Jabber_p* p;
|
||||||
QMenu* m_menu;
|
QMenu* m_menu;
|
||||||
|
@@ -10,14 +10,9 @@
|
|||||||
|
|
||||||
JabberPlugin::JabberPlugin()
|
JabberPlugin::JabberPlugin()
|
||||||
: p( 0 )
|
: p( 0 )
|
||||||
|
, m_menu( 0 )
|
||||||
|
, m_addFriendAction( 0 )
|
||||||
{
|
{
|
||||||
m_menu = new QMenu(QString("JREEN (").append(accountName()).append(")"));
|
|
||||||
m_addFriendAction = m_menu->addAction("Add Friend...");
|
|
||||||
QAction *connectAction = m_menu->addAction("Connect");
|
|
||||||
|
|
||||||
connect(m_addFriendAction, SIGNAL(triggered()),
|
|
||||||
this, SLOT(showAddFriendDialog()));
|
|
||||||
connect(connectAction, SIGNAL(triggered()), SLOT(connectPlugin()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JabberPlugin::~JabberPlugin()
|
JabberPlugin::~JabberPlugin()
|
||||||
@@ -92,8 +87,8 @@ JabberPlugin::connectPlugin( bool startup )
|
|||||||
QObject::connect( p, SIGNAL( peerOffline( QString ) ), SIGNAL( peerOffline( QString ) ) );
|
QObject::connect( p, SIGNAL( peerOffline( QString ) ), SIGNAL( peerOffline( QString ) ) );
|
||||||
QObject::connect( p, SIGNAL( msgReceived( QString, QString ) ), SIGNAL( msgReceived( QString, QString ) ) );
|
QObject::connect( p, SIGNAL( msgReceived( QString, QString ) ), SIGNAL( msgReceived( QString, QString ) ) );
|
||||||
|
|
||||||
QObject::connect( p, SIGNAL( connected() ), SIGNAL( connected() ) );
|
QObject::connect( p, SIGNAL( connected() ), SIGNAL( onConnected() ) );
|
||||||
QObject::connect( p, SIGNAL( disconnected() ), SIGNAL( disconnected() ) );
|
QObject::connect( p, SIGNAL( disconnected() ), SIGNAL( onDisconnected() ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -101,6 +96,8 @@ JabberPlugin::connectPlugin( bool startup )
|
|||||||
void
|
void
|
||||||
JabberPlugin::disconnectPlugin()
|
JabberPlugin::disconnectPlugin()
|
||||||
{
|
{
|
||||||
|
onDisconnected();
|
||||||
|
|
||||||
if ( p )
|
if ( p )
|
||||||
p->disconnect();
|
p->disconnect();
|
||||||
|
|
||||||
@@ -108,6 +105,38 @@ JabberPlugin::disconnectPlugin()
|
|||||||
p = 0;
|
p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JabberPlugin::onConnected()
|
||||||
|
{
|
||||||
|
if( !m_menu ) {
|
||||||
|
m_menu = new QMenu( QString( "JREEN (" ).append( accountName() ).append(")" ) );
|
||||||
|
m_addFriendAction = m_menu->addAction( "Add Friend..." );
|
||||||
|
QAction *connectAction = m_menu->addAction( "Connect" );
|
||||||
|
|
||||||
|
connect( m_addFriendAction, SIGNAL(triggered() ),
|
||||||
|
this, SLOT( showAddFriendDialog() ) );
|
||||||
|
connect( connectAction, SIGNAL( triggered() ), SLOT( connectPlugin() ) );
|
||||||
|
|
||||||
|
emit addMenu( m_menu );
|
||||||
|
}
|
||||||
|
|
||||||
|
emit connected();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JabberPlugin::onDisconnected()
|
||||||
|
{
|
||||||
|
if( m_menu && m_addFriendAction ) {
|
||||||
|
emit removeMenu( m_menu );
|
||||||
|
|
||||||
|
delete m_menu;
|
||||||
|
m_menu = 0;
|
||||||
|
m_addFriendAction = 0; // deleted by menu
|
||||||
|
}
|
||||||
|
|
||||||
|
emit disconnected();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
JabberPlugin::sendMsg(const QString& to, const QString& msg)
|
JabberPlugin::sendMsg(const QString& to, const QString& msg)
|
||||||
{
|
{
|
||||||
|
@@ -35,6 +35,8 @@ public slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showAddFriendDialog();
|
void showAddFriendDialog();
|
||||||
|
void onConnected();
|
||||||
|
void onDisconnected();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Jabber_p* p;
|
Jabber_p* p;
|
||||||
|
@@ -157,10 +157,8 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
// propagate sip menu
|
// propagate sip menu
|
||||||
foreach( SipPlugin *plugin, APP->sipHandler()->plugins() )
|
foreach( SipPlugin *plugin, APP->sipHandler()->plugins() )
|
||||||
{
|
{
|
||||||
if ( plugin->menu() )
|
connect( plugin, SIGNAL( addMenu( QMenu* ) ), this, SLOT( pluginMenuAdded( QMenu* ) ) );
|
||||||
{
|
connect( plugin, SIGNAL( removeMenu( QMenu* ) ), this, SLOT( pluginMenuRemoved( QMenu* ) ) );
|
||||||
ui->menuNetwork->addMenu( plugin->menu() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
@@ -337,6 +335,25 @@ TomahawkWindow::addPeerManually()
|
|||||||
Servent::instance()->connectToPeer( addr, port, key );
|
Servent::instance()->connectToPeer( addr, port, key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::pluginMenuAdded( QMenu* menu )
|
||||||
|
{
|
||||||
|
ui->menuNetwork->addMenu( menu );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::pluginMenuRemoved( QMenu* menu )
|
||||||
|
{
|
||||||
|
foreach( QAction* action, ui->menuNetwork->actions() )
|
||||||
|
{
|
||||||
|
if( action->menu() == menu )
|
||||||
|
{
|
||||||
|
ui->menuNetwork->removeAction( action );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::loadSpiff()
|
TomahawkWindow::loadSpiff()
|
||||||
|
@@ -45,6 +45,8 @@ public slots:
|
|||||||
void loadSpiff();
|
void loadSpiff();
|
||||||
void showSettingsDialog();
|
void showSettingsDialog();
|
||||||
void updateCollectionManually();
|
void updateCollectionManually();
|
||||||
|
void pluginMenuAdded(QMenu*);
|
||||||
|
void pluginMenuRemoved(QMenu*);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSipConnected();
|
void onSipConnected();
|
||||||
|
Reference in New Issue
Block a user