summaryrefslogtreecommitdiffstats
path: root/src/tsthread/tsthread.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
commitbf7f88413be3831a9372d323d02fc0335b9f9188 (patch)
tree516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/tsthread/tsthread.cpp
parente238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff)
downloadgwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz
gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip
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
Diffstat (limited to 'src/tsthread/tsthread.cpp')
-rw-r--r--src/tsthread/tsthread.cpp52
1 files changed, 26 insertions, 26 deletions
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 <qapplication.h>
-#include <qmetaobject.h>
+#include <tqapplication.h>
+#include <tqmetaobject.h>
#include <kdebug.h>
-#include <qguardedptr.h>
+#include <tqguardedptr.h>
#include <assert.h>
-#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;