From ffe8a83e053396df448e9413828527613ca3bd46 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:46:43 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- win/dummy.cpp | 6 ++-- win/kdelibs_global_win.h | 8 ++--- win/qeventloopex.cpp | 76 ++++++++++++++++++++++++------------------------ win/qeventloopex.h | 14 ++++----- win/win32_utils.h | 16 +++++----- win/win32_utils2.cpp | 56 +++++++++++++++++------------------ 6 files changed, 88 insertions(+), 88 deletions(-) (limited to 'win') diff --git a/win/dummy.cpp b/win/dummy.cpp index e5e6473f6..189927567 100644 --- a/win/dummy.cpp +++ b/win/dummy.cpp @@ -17,18 +17,18 @@ Boston, MA 02110-1301, USA. */ -#include +#include /** qt_enter_modal() and qt_enter_modal() from qapplication_win.cpp are not exported by default, then we can't use it in NetAccess::enter_loop() (kio). Empty implementation created as a workaround. */ -KDEWIN32_EXPORT void qt_enter_modal( QWidget *widget ) +KDEWIN32_EXPORT void qt_enter_modal( TQWidget *widget ) { } -KDEWIN32_EXPORT void qt_leave_modal( QWidget *widget ) +KDEWIN32_EXPORT void qt_leave_modal( TQWidget *widget ) { } diff --git a/win/kdelibs_global_win.h b/win/kdelibs_global_win.h index aa095857a..dfb3432e8 100644 --- a/win/kdelibs_global_win.h +++ b/win/kdelibs_global_win.h @@ -19,7 +19,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include /*! Bootstrap */ #define kdemain \ @@ -77,13 +77,13 @@ int kde_start /* #ifdef __cplusplus -#include +#include # ifndef KDEDIR -# define KDEDIR QString(KDEWIN32_DIR) +# define KDEDIR TQString(KDEWIN32_DIR) # endif # ifndef __KDE_BINDIR -# define __KDE_BINDIR QString(KDEWIN32_DIR "/bin") +# define __KDE_BINDIR TQString(KDEWIN32_DIR "/bin") # endif #endif */ diff --git a/win/qeventloopex.cpp b/win/qeventloopex.cpp index ae53d26f9..da5eba60c 100644 --- a/win/qeventloopex.cpp +++ b/win/qeventloopex.cpp @@ -22,15 +22,15 @@ #include #include #include -#include -#include +#include +#include #include "qeventloopex.h" // Local defined structures and classes (needed only for QEventLoopEx implementation) struct QSockNotEx { - QSocketNotifier *obj; + TQSocketNotifier *obj; int fd; fd_set *queue; }; @@ -41,7 +41,7 @@ public: QSockNotTypeEx(); ~QSockNotTypeEx(); - QPtrList *list; + TQPtrList *list; fd_set select_fds; fd_set enabled_fds; fd_set pending_fds; @@ -69,7 +69,7 @@ public: SOCKET m_sockUpdate; // pending socket notifiers list - QPtrList sn_pending_list; + TQPtrList sn_pending_list; HANDLE m_evPendingListEmpty; CRITICAL_SECTION m_csPendingList; @@ -98,8 +98,8 @@ QSockNotTypeEx::~QSockNotTypeEx() list = 0; } -QEventLoopEx::QEventLoopEx( QObject *parent, const char *name) : - QEventLoop(parent,name) +QEventLoopEx::QEventLoopEx( TQObject *parent, const char *name) : + TQEventLoop(parent,name) { DWORD dwThreadId; @@ -150,42 +150,42 @@ QEventLoopEx::~QEventLoopEx() /***************************************************************************** QEventLoopEx implementations for Windows (for synchronous socket calls) *****************************************************************************/ -void QEventLoopEx::registerSocketNotifier( QSocketNotifier *notifier ) +void QEventLoopEx::registerSocketNotifier( TQSocketNotifier *notifier ) { int sockfd = notifier->socket(); int type = notifier->type(); u_long n; DWORD dw; #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::registerSocketNotifier %p", notifier ); + qDebug( "TQSocketNotifier::registerSocketNotifier %p", notifier ); #endif if(ioctlsocket(sockfd,FIONREAD,&n) == SOCKET_ERROR) { #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::registerSocketNotifier %p not a socket", notifier ); + qDebug( "TQSocketNotifier::registerSocketNotifier %p not a socket", notifier ); #endif dw = WSAGetLastError(); - QEventLoop::registerSocketNotifier(notifier); + TQEventLoop::registerSocketNotifier(notifier); return; } if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) { #if defined(QT_CHECK_RANGE) - qWarning( "QSocketNotifier: Internal error" ); + qWarning( "TQSocketNotifier: Internal error" ); #endif return; } EnterCriticalSection(&d->m_csVec); - QPtrList *list = d->sn_vec[type].list; + TQPtrList *list = d->sn_vec[type].list; fd_set *fds = &d->sn_vec[type].enabled_fds; QSockNotEx *sn; if ( ! list ) { // create new list, the QSockNotType destructor will delete it for us - list = new QPtrList; + list = new TQPtrList; Q_CHECK_PTR( list ); list->setAutoDelete( TRUE ); d->sn_vec[type].list = list; @@ -215,32 +215,32 @@ void QEventLoopEx::registerSocketNotifier( QSocketNotifier *notifier ) LeaveCriticalSection(&d->m_csVec); #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::signal update socket"); + qDebug( "TQSocketNotifier::signal update socket"); #endif closesocket(d->m_sockUpdate); } -void QEventLoopEx::unregisterSocketNotifier( QSocketNotifier *notifier ) +void QEventLoopEx::unregisterSocketNotifier( TQSocketNotifier *notifier ) { int sockfd = notifier->socket(); int type = notifier->type(); if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) { #if defined(QT_CHECK_RANGE) - qWarning( "QSocketNotifier: Internal error" ); + qWarning( "TQSocketNotifier: Internal error" ); #endif return; } #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::unregisterSocketNotifier %p", notifier ); + qDebug( "TQSocketNotifier::unregisterSocketNotifier %p", notifier ); #endif EnterCriticalSection(&d->m_csVec); - QPtrList *list = d->sn_vec[type].list; + TQPtrList *list = d->sn_vec[type].list; fd_set *fds = &d->sn_vec[type].enabled_fds; QSockNotEx *sn; if ( ! list ) { LeaveCriticalSection(&d->m_csVec); - QEventLoop::unregisterSocketNotifier(notifier); + TQEventLoop::unregisterSocketNotifier(notifier); return; } sn = list->first(); @@ -248,7 +248,7 @@ void QEventLoopEx::unregisterSocketNotifier( QSocketNotifier *notifier ) sn = list->next(); if ( !sn ) {// not found LeaveCriticalSection(&d->m_csVec); - QEventLoop::unregisterSocketNotifier(notifier); + TQEventLoop::unregisterSocketNotifier(notifier); return; } @@ -273,42 +273,42 @@ void QEventLoopEx::unregisterSocketNotifier( QSocketNotifier *notifier ) } LeaveCriticalSection(&d->m_csVec); #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::signal update socket"); + qDebug( "TQSocketNotifier::signal update socket"); #endif closesocket(d->m_sockUpdate); } bool QEventLoopEx::processEvents( ProcessEventsFlags flags ) { - if(!QEventLoop::processEvents(flags)) + if(!TQEventLoop::processEvents(flags)) return false; activateSocketNotifiers(); return true; } -void QEventLoopEx::setSocketNotifierPending( QSocketNotifier *notifier ) +void QEventLoopEx::setSocketNotifierPending( TQSocketNotifier *notifier ) { int sockfd = notifier->socket(); int type = notifier->type(); if ( sockfd < 0 || type < 0 || type > 2 || notifier == 0 ) { #if defined(QT_CHECK_RANGE) - qWarning( "QSocketNotifier: Internal error" ); + qWarning( "TQSocketNotifier: Internal error" ); #endif return; } #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::setSocketNotifierPending %p",notifier ); + qDebug( "TQSocketNotifier::setSocketNotifierPending %p",notifier ); #endif EnterCriticalSection(&d->m_csVec); - QPtrList *list = d->sn_vec[type].list; + TQPtrList *list = d->sn_vec[type].list; QSockNotEx *sn; if ( ! list ) { #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::setSocketNotifierPending %p: no list",notifier ); + qDebug( "TQSocketNotifier::setSocketNotifierPending %p: no list",notifier ); #endif LeaveCriticalSection(&d->m_csVec); return; @@ -318,7 +318,7 @@ void QEventLoopEx::setSocketNotifierPending( QSocketNotifier *notifier ) sn = list->next(); if ( ! sn ) { // not found #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::setSocketNotifierPending %p: not found",notifier ); + qDebug( "TQSocketNotifier::setSocketNotifierPending %p: not found",notifier ); #endif LeaveCriticalSection(&d->m_csVec); return; @@ -346,11 +346,11 @@ int QEventLoopEx::activateSocketNotifiers() return 0; // nothing to do int n_act = 0; - QEvent event( QEvent::SockAct ); + TQEvent event( TQEvent::SockAct ); EnterCriticalSection(&d->m_csVec); // Avoid deaklock EnterCriticalSection(&d->m_csPendingList); - QPtrListIterator it( d->sn_pending_list ); + TQPtrListIterator it( d->sn_pending_list ); QSockNotEx *sn; while ( (sn=it.current()) ) { ++it; @@ -360,7 +360,7 @@ int QEventLoopEx::activateSocketNotifiers() #ifdef _DEBUG_EVENTLOOPEX qDebug("QEventLoopEx:activateSocketNotifiers %p to object %p",sn, sn->obj); #endif - QApplication::sendEvent( sn->obj, &event ); + TQApplication::sendEvent( sn->obj, &event ); n_act++; } } @@ -369,7 +369,7 @@ int QEventLoopEx::activateSocketNotifiers() LeaveCriticalSection(&d->m_csVec); // Avoid deaklock #ifdef _DEBUG_EVENTLOOPEX - qDebug( "QSocketNotifier::activateSocketNotifiers set m_evPendingListEmpty"); + qDebug( "TQSocketNotifier::activateSocketNotifiers set m_evPendingListEmpty"); #endif SetEvent(d->m_evPendingListEmpty); @@ -455,7 +455,7 @@ void QEventLoopEx::run() for (int type = 0; type < 3; ++type) { - QPtrList *list = d->sn_vec[type].list; + TQPtrList *list = d->sn_vec[type].list; if (!list) continue; @@ -483,7 +483,7 @@ void QEventLoopEx::run() { // disable the invalid socket notifier static const char *t[] = { "Read", "Write", "Exception" }; - qWarning("QSocketNotifier: invalid socket %d and type '%s', disabling...", + qWarning("TQSocketNotifier: invalid socket %d and type '%s', disabling...", sn->fd, t[type]); sn->obj->setEnabled(FALSE); } @@ -520,12 +520,12 @@ void QEventLoopEx::run() if ( ! d->sn_vec[i].list ) continue; - QPtrList *list = d->sn_vec[i].list; + TQPtrList *list = d->sn_vec[i].list; QSockNotEx *sn = list->first(); while ( sn ) { if ( FD_ISSET( sn->fd, &d->sn_vec[i].select_fds ) ) { - QEvent event( QEvent::SockAct ); + TQEvent event( TQEvent::SockAct ); setSocketNotifierPending( sn->obj ); } sn = list->next(); @@ -535,7 +535,7 @@ void QEventLoopEx::run() } if(!d->sn_pending_list.isEmpty() ) { - QApplication::eventLoop()->wakeUp(); + TQApplication::eventLoop()->wakeUp(); #ifdef _DEBUG_EVENTLOOPEX qDebug("QEventLoopEx: wake up main event loop and wait for pending list empty"); #endif diff --git a/win/qeventloopex.h b/win/qeventloopex.h index cf9838633..26247ac82 100644 --- a/win/qeventloopex.h +++ b/win/qeventloopex.h @@ -20,9 +20,9 @@ #if !defined(__QEVENTLOOPEX_H_) #define __QEVENTLOOPEX_H_ -#include -#include -#include +#include +#include +#include #include @@ -33,15 +33,15 @@ class QEventLoopEx : public QEventLoop Q_OBJECT public: - QEventLoopEx( QObject *parent = 0, const char *name = 0 ); + QEventLoopEx( TQObject *parent = 0, const char *name = 0 ); virtual ~QEventLoopEx(); public: - virtual void registerSocketNotifier( QSocketNotifier * ); - virtual void unregisterSocketNotifier( QSocketNotifier * ); + virtual void registerSocketNotifier( TQSocketNotifier * ); + virtual void unregisterSocketNotifier( TQSocketNotifier * ); virtual bool processEvents( ProcessEventsFlags flags ); - void setSocketNotifierPending( QSocketNotifier *notifier ); + void setSocketNotifierPending( TQSocketNotifier *notifier ); int activateSocketNotifiers(); protected: diff --git a/win/win32_utils.h b/win/win32_utils.h index 341028209..ca3459427 100644 --- a/win/win32_utils.h +++ b/win/win32_utils.h @@ -25,7 +25,7 @@ #include #ifdef __cplusplus -#include +#include extern "C" { #endif @@ -59,13 +59,13 @@ KDEWIN32_EXPORT void win32_slashify(char *path, int maxlen); @param item is an item inside subKey or "" if default folder's value should be returned @param ok if not null, will be set to true on success and false on failure */ -KDEWIN32_EXPORT QString getWin32RegistryValue(HKEY key, const QString& subKey, - const QString& item, bool *ok = 0); +KDEWIN32_EXPORT TQString getWin32RegistryValue(HKEY key, const TQString& subKey, + const TQString& item, bool *ok = 0); /** \return a value from MS Windows native registry for shell folder \a folder. */ -inline QString getWin32ShellFoldersPath(const QString& folder) { +inline TQString getWin32ShellFoldersPath(const TQString& folder) { return getWin32RegistryValue(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", folder); } @@ -76,7 +76,7 @@ inline QString getWin32ShellFoldersPath(const QString& folder) { Used by KPropertiesDialog, if possible. */ KDEWIN32_EXPORT -bool showWin32FilePropertyDialog(const QString& fileName); +bool showWin32FilePropertyDialog(const TQString& fileName); /** \return two-letter locale name (like "en" or "pl") taken from MS Windows native registry. @@ -84,12 +84,12 @@ bool showWin32FilePropertyDialog(const QString& fileName); Used e.g. by kbuildsycoca application. */ KDEWIN32_EXPORT -QCString getWin32LocaleName(); +TQCString getWin32LocaleName(); /*! Temporary solutiuon - \return a KFileDialog-compatible filter string converted to QFileDialog compatible one. + \return a KFileDialog-compatible filter string converted to TQFileDialog compatible one. This is temporary solution for kdelibs/win32... */ -KDEWIN32_EXPORT QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter); +KDEWIN32_EXPORT TQString convertKFileDialogFilterToQFileDialogFilter(const TQString& filter); #endif //__cplusplus diff --git a/win/win32_utils2.cpp b/win/win32_utils2.cpp index fe693151e..2e46d2acb 100644 --- a/win/win32_utils2.cpp +++ b/win/win32_utils2.cpp @@ -17,22 +17,22 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include KDEWIN32_EXPORT -QString getWin32RegistryValue(HKEY key, const QString& subKey, const QString& item, bool *ok) +TQString getWin32RegistryValue(HKEY key, const TQString& subKey, const TQString& item, bool *ok) { #define FAILURE \ { if (ok) \ *ok = false; \ - return QString::null; } + return TQString::null; } if (!subKey) FAILURE; @@ -54,50 +54,50 @@ QString getWin32RegistryValue(HKEY key, const QString& subKey, const QString& it } RegCloseKey(hKey); - QString res = QString::fromUcs2(lszValue); + TQString res = TQString::fromUcs2(lszValue); delete [] lszValue; return res; } KDEWIN32_EXPORT -bool showWin32FilePropertyDialog(const QString& fileName) +bool showWin32FilePropertyDialog(const TQString& fileName) { - QString path_ = QDir::convertSeparators(QFileInfo(fileName).absFilePath()); + TQString path_ = TQDir::convertSeparators(TQFileInfo(fileName).absFilePath()); SHELLEXECUTEINFO execInfo; memset(&execInfo,0,sizeof(execInfo)); execInfo.cbSize = sizeof(execInfo); execInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; - const QString verb("properties"); + const TQString verb("properties"); execInfo.lpVerb = (TCHAR*)verb.ucs2(); execInfo.lpFile = (TCHAR*)path_.ucs2(); return ShellExecuteEx(&execInfo); } KDEWIN32_EXPORT -QCString getWin32LocaleName() +TQCString getWin32LocaleName() { bool ok; - QString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International", + TQString localeNumber = getWin32RegistryValue(HKEY_CURRENT_USER, "Control Panel\\International", "Locale", &ok); if (!ok) - return QCString(); - QString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes", + return TQCString(); + TQString localeName = getWin32RegistryValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout\\DosKeybCodes", localeNumber, &ok); if (!ok) - return QCString(); + return TQCString(); return localeName.latin1(); } KDEWIN32_EXPORT -QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter) +TQString convertKFileDialogFilterToQFileDialogFilter(const TQString& filter) { - QString kde_filters = filter; + TQString kde_filters = filter; int pos; // Strip the escape characters from // escaped '/' characters. - QString copy (kde_filters); + TQString copy (kde_filters); for (pos = 0; (pos = copy.find("\\/", pos)) != -1; ++pos) copy.remove(pos, 1); @@ -105,13 +105,13 @@ QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter) //we need to convert KDE filter format to Qt format //Qt format: "some text (*.first *.second)" or "All (*)" //KDE format: "*.first *.second" or "*" - QStringList filters = QStringList::split("\n",kde_filters); - QString current; - QString converted; //finally - converted filter - for (QStringList::ConstIterator it = filters.constBegin(); it!=filters.constEnd();++it) { + TQStringList filters = TQStringList::split("\n",kde_filters); + TQString current; + TQString converted; //finally - converted filter + for (TQStringList::ConstIterator it = filters.constBegin(); it!=filters.constEnd();++it) { current = *it; - QString new_f;//filter part - QString new_name;//filter name part + TQString new_f;//filter part + TQString new_name;//filter name part int p = (*it).find('|'); if (p!=-1) { new_f = current.left(p); @@ -124,7 +124,7 @@ QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter) //remove (.....) from name p=new_name.find('('); int p2 = new_name.findRev(')'); - QString new_name1, new_name2; + TQString new_name1, new_name2; if (p!=-1) new_name1 = new_name.left(p); if (p2!=-1) @@ -136,9 +136,9 @@ QString convertKFileDialogFilterToQFileDialogFilter(const QString& filter) new_name = new_name.stripWhiteSpace(); // make filters unique: remove uppercase extensions (case doesn't matter on win32, BTW) - QStringList allfiltersUnique; - QStringList origList( QStringList::split(" ", new_f) ); - for (QStringList::ConstIterator it = origList.constBegin(); + TQStringList allfiltersUnique; + TQStringList origList( TQStringList::split(" ", new_f) ); + for (TQStringList::ConstIterator it = origList.constBegin(); it!=origList.constEnd(); ++it) { if ((*it) == (*it).lower()) -- cgit v1.2.3