1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-03 12:47:45 +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 )
@@ -61,4 +81,4 @@ SharedTimeLine::disconnectNotify( const char* signal )
} }
} }
} }

View File

@@ -31,30 +31,34 @@ namespace TomahawkUtils
class DLLEXPORT SharedTimeLine : public QObject class DLLEXPORT SharedTimeLine : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
SharedTimeLine(); SharedTimeLine();
virtual ~SharedTimeLine() {} virtual ~SharedTimeLine() {}
int currentFrame() { return m_timeline.currentFrame(); } int currentFrame() { return m_timeline.currentFrame(); }
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:
virtual void connectNotify( const char *signal ); #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 disconnectNotify( const char *signal );
#endif
virtual void disconnectNotify( const char *signal ); private:
int m_refcount;
private: QTimeLine m_timeline;
int m_refcount;
QTimeLine m_timeline;
}; };
} }
#endif #endif