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

Remove boost usage from FuncTimeout

This commit is contained in:
Uwe L. Korn
2014-08-18 16:34:40 +01:00
parent 9f4cf09152
commit 07c5e9d182
3 changed files with 8 additions and 12 deletions

View File

@@ -25,7 +25,7 @@
using namespace Tomahawk; using namespace Tomahawk;
FuncTimeout::FuncTimeout( int ms, boost::function< void() > func, QObject* besafe ) FuncTimeout::FuncTimeout( int ms, function< void() > func, QObject* besafe )
: m_func( func ) : m_func( func )
, m_watch( QPointer< QObject >( besafe ) ) , m_watch( QPointer< QObject >( besafe ) )
{ {

View File

@@ -22,17 +22,15 @@
#include <QObject> #include <QObject>
#include <QPointer> #include <QPointer>
#include <boost/function.hpp> #include "utils/tr1-functional.h"
#include "DllMacro.h" #include "DllMacro.h"
/* /*
#include <boost/bind.hpp>
I want to do: I want to do:
QTimer::singleShot(1000, this, SLOT(doSomething(x))); QTimer::singleShot(1000, this, SLOT(doSomething(x)));
instead, I'm doing: instead, I'm doing:
new FuncTimeout(1000, boost::bind(&MyClass::doSomething, this, x)); new FuncTimeout(1000, bind(&MyClass::doSomething, this, x));
*/ */
namespace Tomahawk namespace Tomahawk
@@ -43,7 +41,7 @@ class DLLEXPORT FuncTimeout : public QObject
Q_OBJECT Q_OBJECT
public: public:
FuncTimeout( int ms, boost::function<void()> func, QObject* besafe ); FuncTimeout( int ms, function<void()> func, QObject* besafe );
~FuncTimeout(); ~FuncTimeout();
@@ -51,7 +49,7 @@ public slots:
void exec(); void exec();
private: private:
boost::function<void()> m_func; function<void()> m_func;
QPointer< QObject > m_watch; QPointer< QObject > m_watch;
}; };

View File

@@ -32,8 +32,6 @@
#include "Source.h" #include "Source.h"
#include "SourceList.h" #include "SourceList.h"
#include <boost/bind.hpp>
#define DEFAULT_CONCURRENT_QUERIES 4 #define DEFAULT_CONCURRENT_QUERIES 4
#define MAX_CONCURRENT_QUERIES 16 #define MAX_CONCURRENT_QUERIES 16
#define CLEANUP_TIMEOUT 5 * 60 * 1000 #define CLEANUP_TIMEOUT 5 * 60 * 1000
@@ -566,7 +564,7 @@ Pipeline::shunt( const query_ptr& q )
if ( r->timeout() > 0 ) if ( r->timeout() > 0 )
{ {
d->qidsTimeout.insert( q->id(), true ); d->qidsTimeout.insert( q->id(), true );
new FuncTimeout( r->timeout(), boost::bind( &Pipeline::timeoutShunt, this, q ), this ); new FuncTimeout( r->timeout(), bind( &Pipeline::timeoutShunt, this, q ), this );
} }
} }
else else
@@ -618,7 +616,7 @@ Pipeline::setQIDState( const Tomahawk::query_ptr& query, int state )
{ {
d->qidsState.insert( query->id(), state ); d->qidsState.insert( query->id(), state );
new FuncTimeout( 0, boost::bind( &Pipeline::shunt, this, query ), this ); new FuncTimeout( 0, bind( &Pipeline::shunt, this, query ), this );
} }
else else
{ {
@@ -628,7 +626,7 @@ Pipeline::setQIDState( const Tomahawk::query_ptr& query, int state )
if ( !d->queries_temporary.contains( query ) ) if ( !d->queries_temporary.contains( query ) )
d->qids.remove( query->id() ); d->qids.remove( query->id() );
new FuncTimeout( 0, boost::bind( &Pipeline::shuntNext, this ), this ); new FuncTimeout( 0, bind( &Pipeline::shuntNext, this ), this );
} }
} }