diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/kvilib/ext/kvi_stringconversion.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kvilib/ext/kvi_stringconversion.cpp')
-rw-r--r-- | src/kvilib/ext/kvi_stringconversion.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/kvilib/ext/kvi_stringconversion.cpp b/src/kvilib/ext/kvi_stringconversion.cpp index 3d0255cc..accba786 100644 --- a/src/kvilib/ext/kvi_stringconversion.cpp +++ b/src/kvilib/ext/kvi_stringconversion.cpp @@ -31,25 +31,25 @@ #include "kvi_qstring.h" #include <stdio.h> -QString g_szGlobalDir; -QString g_szLocalDir; +TQString g_szGlobalDir; +TQString g_szLocalDir; namespace KviStringConversion { - void init(const QString& szGlobalDir,const QString& szLocalDir) + void init(const TQString& szGlobalDir,const TQString& szLocalDir) { g_szGlobalDir=szGlobalDir; g_szLocalDir=szLocalDir; } - void encodePath(QString& buffer) + void encodePath(TQString& buffer) { if(!buffer.isEmpty()) { if(!g_szLocalDir.isEmpty()) { - if(KviQString::find(buffer,g_szLocalDir)==0) + if(KviTQString::tqfind(buffer,g_szLocalDir)==0) { buffer.remove(0,g_szLocalDir.length()); buffer.prepend("local://"); @@ -57,7 +57,7 @@ namespace KviStringConversion } if(!g_szGlobalDir.isEmpty()) { - if(KviQString::find(buffer,g_szGlobalDir)==0) + if(KviTQString::tqfind(buffer,g_szGlobalDir)==0) { buffer.remove(0,g_szGlobalDir.length()); buffer.prepend("global://"); @@ -66,13 +66,13 @@ namespace KviStringConversion } } - void decodePath(QString& buffer) + void decodePath(TQString& buffer) { if(!buffer.isEmpty()) { if(!g_szLocalDir.isEmpty()) { - if(KviQString::find(buffer,"local://")==0) + if(KviTQString::tqfind(buffer,"local://")==0) { buffer.remove(0,8); buffer.prepend(g_szLocalDir); @@ -80,7 +80,7 @@ namespace KviStringConversion } if(!g_szGlobalDir.isEmpty()) { - if(KviQString::find(buffer,"global://")==0) + if(KviTQString::tqfind(buffer,"global://")==0) { buffer.remove(0,9); buffer.prepend(g_szGlobalDir); @@ -89,66 +89,66 @@ namespace KviStringConversion } } - void encodePath(QStringList& buffer) + void encodePath(TQStringList& buffer) { - for ( QStringList::Iterator it = buffer.begin(); it != buffer.end(); ++it ) + for ( TQStringList::Iterator it = buffer.begin(); it != buffer.end(); ++it ) { encodePath(*it); } } - void decodePath(QStringList& buffer) + void decodePath(TQStringList& buffer) { - for ( QStringList::Iterator it = buffer.begin(); it != buffer.end(); ++it ) + for ( TQStringList::Iterator it = buffer.begin(); it != buffer.end(); ++it ) { decodePath(*it); } } - void toString(const bool bValue,QString &buffer) + void toString(const bool bValue,TQString &buffer) { buffer = bValue ? '1' : '0'; } - bool fromString(const QString & szValue,bool &buffer) + bool fromString(const TQString & szValue,bool &buffer) { if(szValue.isEmpty())buffer = false; - else buffer = !((KviQString::equalCS(szValue,"0")) || (KviQString::equalCI(szValue,"false"))); + else buffer = !((KviTQString::equalCS(szValue,"0")) || (KviTQString::equalCI(szValue,"false"))); return true; } - void toString(const int iValue,QString &buffer) + void toString(const int iValue,TQString &buffer) { buffer.setNum(iValue); } - bool fromString(const QString &szValue,int &buffer) + bool fromString(const TQString &szValue,int &buffer) { bool bOk; buffer = szValue.toInt(&bOk); return bOk; } - void toString(const unsigned int uValue,QString &buffer) + void toString(const unsigned int uValue,TQString &buffer) { buffer.setNum(uValue); } - bool fromString(const QString & szValue,unsigned int &buffer) + bool fromString(const TQString & szValue,unsigned int &buffer) { bool bOk; buffer= szValue.toUInt(&bOk); return bOk; } - void toString(const QRect &rValue,QString &buffer) + void toString(const TQRect &rValue,TQString &buffer) { buffer.sprintf("%d,%d,%d,%d",rValue.x(),rValue.y(),rValue.width(),rValue.height()); } - bool fromString(const QString & szValue,QRect &buffer) + bool fromString(const TQString & szValue,TQRect &buffer) { - KviQCString tmp = KviQString::toUtf8(szValue); + KviTQCString tmp = KviTQString::toUtf8(szValue); const char * c = tmp.data(); if(!c)return false; int l,t,w,h; @@ -157,26 +157,26 @@ namespace KviStringConversion return true; } - void toString(const QString &szValue,QString &buffer) + void toString(const TQString &szValue,TQString &buffer) { buffer = szValue; } - bool fromString(const QString & szValue,QString &buffer) + bool fromString(const TQString & szValue,TQString &buffer) { buffer = szValue; return true; } - void toString(const KviPixmap &pValue,QString &buffer) + void toString(const KviPixmap &pValue,TQString &buffer) { buffer=pValue.path(); encodePath(buffer); } - bool fromString(const QString & szValue,KviPixmap &buffer) + bool fromString(const TQString & szValue,KviPixmap &buffer) { - QString szPath(szValue); + TQString szPath(szValue); decodePath(szPath); if(szPath.isEmpty()) { buffer.setNull(); @@ -186,16 +186,16 @@ namespace KviStringConversion } } - void toString(const KviMsgType &mValue,QString &buffer) + void toString(const KviMsgType &mValue,TQString &buffer) { buffer.sprintf("%d,%u,%u,%d,%d",mValue.m_iPixId,mValue.m_cForeColor,mValue.m_cBackColor,mValue.m_bLogEnabled,mValue.m_iLevel); } - bool fromString(const QString & szValue,KviMsgType &buffer) + bool fromString(const TQString & szValue,KviMsgType &buffer) { int iId,iLog,iLevel; unsigned int uFore,uBack; - KviQCString tmp = KviQString::toUtf8(szValue); + KviTQCString tmp = KviTQString::toUtf8(szValue); char * cx = tmp.data(); if(!cx)return false; if(sscanf(cx,"%d,%u,%u,%d,%d",&iId,&uFore,&uBack,&iLog,&iLevel) != 5)return false; @@ -203,21 +203,21 @@ namespace KviStringConversion return true; } - void toString(const QColor &cValue,QString &buffer) + void toString(const TQColor &cValue,TQString &buffer) { buffer = cValue.name(); } - bool fromString(const QString & szValue,QColor &buffer) + bool fromString(const TQString & szValue,TQColor &buffer) { buffer.setNamedColor(szValue); return true; } - void toString(const QFont &fValue,QString &buffer) + void toString(const TQFont &fValue,TQString &buffer) { - QString family(fValue.family()); - buffer.sprintf("%s,%d,%d,%d",KviQString::toUtf8(family).data(),fValue.pointSize(),fValue.styleHint(),fValue.weight()); - QString options; + TQString family(fValue.family()); + buffer.sprintf("%s,%d,%d,%d",KviTQString::toUtf8(family).data(),fValue.pointSize(),fValue.styleHint(),fValue.weight()); + TQString options; if(fValue.bold())options.append('b'); if(fValue.italic())options.append('i'); if(fValue.underline())options.append('u'); @@ -231,45 +231,45 @@ namespace KviStringConversion } } - bool fromString(const QString & szValue,QFont &buffer) + bool fromString(const TQString & szValue,TQFont &buffer) { KviStr str = szValue; - KviStr family,pointSize,styleHint,weight,options; + KviStr family,pointSize,tqstyleHint,weight,options; str.getToken(family,','); str.getToken(pointSize,','); - str.getToken(styleHint,','); + str.getToken(tqstyleHint,','); str.getToken(weight,','); if(!family.isEmpty())buffer.setFamily(family.ptr()); int i; bool bOk; i = pointSize.toInt(&bOk); if(bOk && (i > 0))buffer.setPointSize(i); - i = styleHint.toInt(&bOk); - if(bOk && (i >= 0))buffer.setStyleHint((QFont::StyleHint)i); + i = tqstyleHint.toInt(&bOk); + if(bOk && (i >= 0))buffer.setStyleHint((TQFont::StyleHint)i); i = weight.toInt(&bOk); if(bOk && (i >= 0))buffer.setWeight(i); if(!str.isEmpty()) { - buffer.setBold(str.contains("b")); - buffer.setItalic(str.contains("i")); - buffer.setUnderline(str.contains("u")); - buffer.setStrikeOut(str.contains("s")); - buffer.setFixedPitch(str.contains("f")); + buffer.setBold(str.tqcontains("b")); + buffer.setItalic(str.tqcontains("i")); + buffer.setUnderline(str.tqcontains("u")); + buffer.setStrikeOut(str.tqcontains("s")); + buffer.setFixedPitch(str.tqcontains("f")); } return true; } - void toString(const QStringList &sValue,QString &buffer) + void toString(const TQStringList &sValue,TQString &buffer) { buffer = sValue.join(","); } - bool fromString(const QString & szValue,QStringList &buffer) + bool fromString(const TQString & szValue,TQStringList &buffer) { #ifdef COMPILE_USE_QT4 buffer = szValue.split(","); #else - buffer = QStringList::split(",",szValue); + buffer = TQStringList::split(",",szValue); #endif return true; } |