1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-02 20:28:14 +02:00

connectNotify changed its signature with Qt5

This commit is contained in:
Uwe L. Korn
2013-09-02 13:15:00 +02:00
parent ab6e1e4a84
commit e697e7e57f
2 changed files with 42 additions and 18 deletions

View File

@@ -20,6 +20,7 @@
#include "SharedTimeLine.h" #include "SharedTimeLine.h"
#include <QMetaMethod>
namespace TomahawkUtils namespace TomahawkUtils
{ {
@@ -37,20 +38,39 @@ SharedTimeLine::SharedTimeLine()
void void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
SharedTimeLine::connectNotify( const QMetaMethod& signal )
#else
SharedTimeLine::connectNotify( const char* signal ) SharedTimeLine::connectNotify( const char* signal )
#endif
{ {
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) ) { #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) )
#else
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) )
#endif
{
m_refcount++; m_refcount++;
if ( m_timeline.state() != QTimeLine::Running ) if ( m_timeline.state() != QTimeLine::Running )
{
m_timeline.start(); m_timeline.start();
} }
}
} }
void void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
SharedTimeLine::disconnectNotify( const QMetaMethod& signal )
#else
SharedTimeLine::disconnectNotify( const char* signal ) SharedTimeLine::disconnectNotify( const char* signal )
#endif
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) )
#else
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) ) if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) )
#endif
{ {
m_refcount--; m_refcount--;
if ( m_timeline.state() == QTimeLine::Running && m_refcount == 0 ) if ( m_timeline.state() == QTimeLine::Running && m_refcount == 0 )

View File

@@ -31,9 +31,9 @@ namespace TomahawkUtils
class DLLEXPORT SharedTimeLine : public QObject class DLLEXPORT SharedTimeLine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
SharedTimeLine(); SharedTimeLine();
virtual ~SharedTimeLine() {} virtual ~SharedTimeLine() {}
@@ -42,15 +42,19 @@ class DLLEXPORT SharedTimeLine : public QObject
void setUpdateInterval( int msec ) { if ( msec != m_timeline.updateInterval() ) m_timeline.setUpdateInterval( msec ); } void setUpdateInterval( int msec ) { if ( msec != m_timeline.updateInterval() ) m_timeline.setUpdateInterval( msec ); }
signals: signals:
void frameChanged( int ); void frameChanged( int );
protected slots: protected slots:
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
virtual void connectNotify( const QMetaMethod & signal );
virtual void disconnectNotify( const QMetaMethod & signal );
#else
virtual void connectNotify( const char *signal ); virtual void connectNotify( const char *signal );
virtual void disconnectNotify( const char *signal ); virtual void disconnectNotify( const char *signal );
#endif
private: private:
int m_refcount; int m_refcount;
QTimeLine m_timeline; QTimeLine m_timeline;
}; };