From bf7f88413be3831a9372d323d02fc0335b9f9188 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 26 May 2011 21:04:57 +0000 Subject: TQt4 port Gwenview This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/tsthread/tsthread.cpp | 52 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/tsthread/tsthread.cpp') diff --git a/src/tsthread/tsthread.cpp b/src/tsthread/tsthread.cpp index 16b4538..43b902c 100644 --- a/src/tsthread/tsthread.cpp +++ b/src/tsthread/tsthread.cpp @@ -24,15 +24,15 @@ DEALINGS IN THE SOFTWARE. #include "tsthread.h" -#include -#include +#include +#include #include -#include +#include #include -#ifdef TS_QTHREADSTORAGE -QThreadStorage< TSThread** >* TSThread::current_thread; +#ifdef TS_TQTHREADSTORAGE +TQThreadStorage< TSThread** >* TSThread::current_thread; #else TSCurrentThread* TSThread::current_thread; #endif @@ -45,10 +45,10 @@ class TSMainThread virtual void run() { assert( false ); } }; -TSThread::Helper::Helper( TSThread* parent ) - : thread( parent ) +TSThread::Helper::Helper( TSThread* tqparent ) + : thread( tqparent ) { - assert( parent ); + assert( tqparent ); } void TSThread::Helper::run() @@ -82,11 +82,11 @@ void TSThread::start() void TSThread::cancel() { - QMutexLocker lock( &mutex ); + TQMutexLocker lock( &mutex ); cancelling = true; if( cancel_mutex != NULL ) { - QMutexLocker lock( cancel_mutex ); + TQMutexLocker lock( cancel_mutex ); cancel_cond->wakeAll(); } } @@ -108,8 +108,8 @@ bool TSThread::running() const void TSThread::initCurrentThread() { -#ifdef TS_QTHREADSTORAGE - current_thread = new QThreadStorage< TSThread** >(); +#ifdef TS_TQTHREADSTORAGE + current_thread = new TQThreadStorage< TSThread** >(); typedef TSThread* TSThreadPtr; // set pointer for main thread (this must be main thread) current_thread->setLocalData( new TSThreadPtr( NULL )); // TODO NULL ? @@ -123,9 +123,9 @@ void TSThread::initCurrentThread() void TSThread::executeThread() { -#ifdef TS_QTHREADSTORAGE +#ifdef TS_TQTHREADSTORAGE // store dynamically allocated pointer, so that - // QThreadStorage deletes the pointer and not TSThread + // TQThreadStorage deletes the pointer and not TSThread typedef TSThread* TSThreadPtr; current_thread->setLocalData( new TSThreadPtr( this )); #else @@ -135,35 +135,35 @@ void TSThread::executeThread() postSignal( this, NULL ); // = terminated() } -void TSThread::postSignal( QObject* obj, const char* signal ) +void TSThread::postSignal( TQObject* obj, const char* signal ) { assert( currentThread() == this ); - qApp->postEvent( this, new SignalEvent( signal, obj, NULL )); + tqApp->postEvent( this, new SignalEvent( signal, obj, NULL )); } -void TSThread::emitSignalInternal( QObject* obj, const char* signal, QUObject* o ) +void TSThread::emitSignalInternal( TQObject* obj, const char* signal, TQUObject* o ) { assert( currentThread() == this ); - QMutexLocker locker( &signal_mutex ); + TQMutexLocker locker( &signal_mutex ); emit_pending = true; - qApp->postEvent( this, new SignalEvent( signal, obj, o )); + tqApp->postEvent( this, new SignalEvent( signal, obj, o )); while( emit_pending ) signal_cond.wait( &signal_mutex ); } -void TSThread::emitCancellableSignalInternal( QObject* obj, const char* signal, QUObject* o ) +void TSThread::emitCancellableSignalInternal( TQObject* obj, const char* signal, TQUObject* o ) { assert( currentThread() == this ); // can't use this->mutex, because its locking will be triggered by TSWaitCondition - QMutexLocker locker( &signal_mutex ); + TQMutexLocker locker( &signal_mutex ); emit_pending = true; - qApp->postEvent( this, new SignalEvent( signal, obj, o )); + tqApp->postEvent( this, new SignalEvent( signal, obj, o )); while( emit_pending && !testCancel()) signal_cond.cancellableWait( &signal_mutex ); emit_pending = false; // in case of cancel } -void TSThread::customEvent( QCustomEvent* ev ) +void TSThread::customEvent( TQCustomEvent* ev ) { SignalEvent* e = static_cast< SignalEvent* >( ev ); if( e->signal.isEmpty()) // = terminated() @@ -174,8 +174,8 @@ void TSThread::customEvent( QCustomEvent* ev ) return; } bool deleted = false; - deleted_flag = &deleted; // this is like QGuardedPtr for self, but faster - int signal_id = e->object->metaObject()->findSignal( normalizeSignalSlot( e->signal ).data() + 1, true ); + deleted_flag = &deleted; // this is like TQGuardedPtr for self, but faster + int signal_id = e->object->tqmetaObject()->tqfindSignal( normalizeSignalSlot( e->signal ).data() + 1, true ); if( signal_id >= 0 ) e->object->qt_emit( signal_id, e->args ); else @@ -183,7 +183,7 @@ void TSThread::customEvent( QCustomEvent* ev ) if( deleted ) // some slot deleted 'this' return; deleted_flag = NULL; - QMutexLocker locker( &signal_mutex ); + TQMutexLocker locker( &signal_mutex ); if( emit_pending ) { emit_pending = false; -- cgit v1.2.1