1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-02-25 20:33:20 +01: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 <QMetaMethod>
namespace TomahawkUtils
{
@ -37,20 +38,39 @@ SharedTimeLine::SharedTimeLine()
void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
SharedTimeLine::connectNotify( const QMetaMethod& signal )
#else
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++;
if ( m_timeline.state() != QTimeLine::Running )
{
m_timeline.start();
}
}
}
void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
SharedTimeLine::disconnectNotify( const QMetaMethod& signal )
#else
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 ) ) ) )
#endif
{
m_refcount--;
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
{
Q_OBJECT
Q_OBJECT
public:
SharedTimeLine();
public:
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:
void frameChanged( int );
signals:
void frameChanged( int );
protected slots:
virtual void connectNotify( const char *signal );
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 disconnectNotify( const char *signal );
#endif
virtual void disconnectNotify( const char *signal );
private:
int m_refcount;
QTimeLine m_timeline;
private:
int m_refcount;
QTimeLine m_timeline;
};
}
#endif
#endif