From: AlexeyD <da...@us...> - 2006-02-06 15:13:07
|
Update of /cvsroot/tora/tora In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22596 Modified Files: tothread.cpp tothread.h utils.cpp Log Message: Thread stuff updated to latest QT and Dandrea's fix to utils supplied Index: utils.cpp =================================================================== RCS file: /cvsroot/tora/tora/utils.cpp,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** utils.cpp 11 Jan 2006 14:28:24 -0000 1.157 --- utils.cpp 6 Feb 2006 15:12:53 -0000 1.158 *************** *** 91,94 **** --- 91,95 ---- #endif // Q_OS_MACX + #define CHUNK_SIZE 31 *************** *** 317,346 **** void toStatusMessage(const QString &str, bool save, bool log) { ! if (!toThread::mainThread()) return ; toMain *main = dynamic_cast<toMain *>(qApp->mainWidget()); if (main) { int sec = toTool::globalConfig(CONF_STATUS_MESSAGE, DEFAULT_STATUS_MESSAGE).toInt(); ! if (!str.isEmpty()) { ! if (save || sec == 0) ! main->statusBar()->message(str.simplifyWhiteSpace()); ! else ! main->statusBar()->message(str.simplifyWhiteSpace(), sec*1000); ! ! if (!save && log) ! { ! if (toTool::globalConfig(CONF_MESSAGE_STATUSBAR, "").isEmpty()) ! main->displayMessage(str); ! toPush(LastMessages, str); ! if (int(LastMessages.size()) > toTool::globalConfig(CONF_STATUS_SAVE, ! DEFAULT_STATUS_SAVE).toInt()) ! toShift(LastMessages); ! } ! QToolTip::add ! (main->statusBar(), str); } } } --- 318,347 ---- void toStatusMessage(const QString &str, bool save, bool log) { ! #ifndef WIN32 ! if (!toThread::mainThread()){ return ; + } + #endif toMain *main = dynamic_cast<toMain *>(qApp->mainWidget()); if (main) { int sec = toTool::globalConfig(CONF_STATUS_MESSAGE, DEFAULT_STATUS_MESSAGE).toInt(); ! if (save || sec == 0) ! main->statusBar()->message(str.simplifyWhiteSpace()); ! else ! main->statusBar()->message(str.simplifyWhiteSpace(), sec*1000); ! if (!save && !str.isEmpty() && log) { ! if (toTool::globalConfig(CONF_MESSAGE_STATUSBAR, "").isEmpty()) ! main->displayMessage(str); ! toPush(LastMessages, str); ! if (int(LastMessages.size()) > toTool::globalConfig(CONF_STATUS_SAVE, ! DEFAULT_STATUS_SAVE).toInt()) ! toShift(LastMessages); } + QToolTip::add + (main->statusBar(), str); } + } Index: tothread.cpp =================================================================== RCS file: /cvsroot/tora/tora/tothread.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** tothread.cpp 19 Apr 2005 10:30:40 -0000 1.42 --- tothread.cpp 6 Feb 2006 15:12:53 -0000 1.43 *************** *** 49,71 **** #ifdef QT_THREAD_SUPPORT - #ifdef WIN32 - bool toWaitCondition::wait(QMutex *mutex, unsigned long time) - { - bool status = FALSE; - - // this implementation relies on existing wait() method - if (mutex) - { - mutex->unlock(); - status = QWaitCondition::wait(time); - mutex->lock () - ; - } - else - status = QWaitCondition::wait(time); - - return status; - } - #endif void toSemaphore::up(void) --- 49,52 ---- *************** *** 305,309 **** int toThread::LastID = 0; __declspec( thread ) int toThread::ThreadID = 0; ! int toThread::MainThread = 0; bool toThread::mainThread(void) --- 286,290 ---- int toThread::LastID = 0; __declspec( thread ) int toThread::ThreadID = 0; ! int toThread::MainThread = -1; bool toThread::mainThread(void) *************** *** 361,364 **** --- 342,347 ---- toThread::LastID++; toThread::ThreadID = LastID; + if (toThread::MainThread==-1) + toThread::MainThread=LastID; Lock->unlock(); Task->run(); Index: tothread.h =================================================================== RCS file: /cvsroot/tora/tora/tothread.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tothread.h 8 May 2005 18:50:47 -0000 1.33 --- tothread.h 6 Feb 2006 15:12:53 -0000 1.34 *************** *** 78,98 **** #else - #ifdef WIN32 - /** - * Implementing missing functionality from QWaitCondition for Win32 - */ - class toWaitCondition : public QWaitCondition - { - public: - // create the wait condition - toWaitCondition(): QWaitCondition() - {} - - // this method is not implemented in QT Free port - bool wait( QMutex *mutex, unsigned long time = ULONG_MAX ); - - }; - - #endif /** Encapsulation of pthread semaphores. A semaphore can be raise to any value --- 78,81 ---- *************** *** 106,116 **** private: QMutex Mutex; ! #ifdef WIN32 ! ! toWaitCondition Condition; ! #else ! ! QWaitCondition Condition; ! #endif int Value; --- 89,93 ---- private: QMutex Mutex; ! QWaitCondition Condition; int Value; |