1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Fix compilation with older CMake versions

This commit is contained in:
Uwe L. Korn
2013-09-02 13:37:38 +02:00
parent e697e7e57f
commit a5d47d58a2
2 changed files with 36 additions and 15 deletions

View File

@@ -38,17 +38,26 @@ SharedTimeLine::SharedTimeLine()
void void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
SharedTimeLine::connectNotify( const QMetaMethod& signal ) SharedTimeLine::connectNotify( const QMetaMethod& signal )
#else
SharedTimeLine::connectNotify( const char* signal )
#endif
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) ) if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) )
{
m_refcount++;
if ( m_timeline.state() != QTimeLine::Running )
{
m_timeline.start();
}
}
#else #else
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) ) Q_ASSERT( false );
#endif #endif
}
void
SharedTimeLine::connectNotify( const char* signal )
{
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) )
{ {
m_refcount++; m_refcount++;
if ( m_timeline.state() != QTimeLine::Running ) if ( m_timeline.state() != QTimeLine::Running )
@@ -60,17 +69,28 @@ SharedTimeLine::connectNotify( const char* signal )
void void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
SharedTimeLine::disconnectNotify( const QMetaMethod& signal ) SharedTimeLine::disconnectNotify( const QMetaMethod& signal )
#else
SharedTimeLine::disconnectNotify( const char* signal )
#endif
{ {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) ) if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) )
{
m_refcount--;
if ( m_timeline.state() == QTimeLine::Running && m_refcount == 0 )
{
m_timeline.stop();
deleteLater();
}
}
#else #else
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) ) Q_ASSERT( false );
#endif #endif
}
void
SharedTimeLine::disconnectNotify( const char* signal )
{
if ( signal == QMetaObject::normalizedSignature( SIGNAL( frameChanged( int ) ) ) )
{ {
m_refcount--; m_refcount--;
if ( m_timeline.state() == QTimeLine::Running && m_refcount == 0 ) if ( m_timeline.state() == QTimeLine::Running && m_refcount == 0 )

View File

@@ -46,13 +46,14 @@ signals:
void frameChanged( int ); void frameChanged( int );
protected slots: protected slots:
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) // Would be nice to ifdef this, but we would need CMake 2.8.11 for that as a requirement
virtual void connectNotify( const QMetaMethod & signal ); // #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
virtual void disconnectNotify( const QMetaMethod & signal ); virtual void connectNotify( const QMetaMethod& signal );
#else 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 // #endif
private: private:
int m_refcount; int m_refcount;