Replace QObject, QWidget, QImage, QPair, QRgb, QColor, QChar, QString, QIODevice with TQ* version

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/13/head
Michele Calgaro 1 year ago
parent ee077affc0
commit 87c77000cf
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -400,29 +400,29 @@ This is the list of the various string types used in KVIrc.
KviStr KviStr
The basic KVIrc string class. It has been first implemented as a hack The basic KVIrc string class. It has been first implemented as a hack
around various bugs of the original QString class (the NOT unicode one around various bugs of the original TQString class (the NOT unicode one
that now has been renamed to QCString). It has the property of being that now has been renamed to QCString). It has the property of being
always non null and it has no reference counting. always non null and it has no reference counting.
Actually many occurences of this string are replaced by QString Actually many occurences of this string are replaced by TQString
(especially in GUI modules) to handle correctly the UNICODE character set. (especially in GUI modules) to handle correctly the UNICODE character set.
QString TQString
The Qt UNICODE string. See the Qt documentation for details. The Qt UNICODE string. See the Qt documentation for details.
This is the string that should be mostly used in KVIrc in the near future. This is the string that should be mostly used in KVIrc in the near future.
Take care: in general it is NOT null terminated. Take care: in general it is NOT null terminated.
There is a KviQString wrapper namespace (#include "kvi_qstring.h") that There is a KviQString wrapper namespace (#include "kvi_qstring.h") that
adds some missing functionality. For example, adds some missing functionality. For example,
KviQString::sprintf(qstring_buffer,qstring_format,...) KviQString::sprintf(qstring_buffer,qstring_format,...)
allows formatting a QString with a format string that is a QString itself allows formatting a TQString with a format string that is a TQString itself
(and thus it is UNICODE). (and thus it is UNICODE).
QString uses reference counting. An assigment of a QString to another TQString uses reference counting. An assigment of a TQString to another
QString does NOT make an immediate copy, it just increases the reference TQString does NOT make an immediate copy, it just increases the reference
count instead. The copy is made at the first modification of one of the count instead. The copy is made at the first modification of one of the
two strings (the operation is called "detaching"). While generally this two strings (the operation is called "detaching"). While generally this
is not an issue, you must take care when passing QString objects between is not an issue, you must take care when passing TQString objects between
concurrent threads. concurrent threads.
(const) QChar * (const) TQChar *
The array of Qt chars. This is usually obtained by callling The array of Qt chars. This is usually obtained by callling
KviQString::nullTerminatedArray() which itself is a hack... KviQString::nullTerminatedArray() which itself is a hack...
This array is used in some functions that were written for This array is used in some functions that were written for
@ -435,7 +435,7 @@ The Goal:
- Use KviStr only where it is strictly needed (for protocol or performance - Use KviStr only where it is strictly needed (for protocol or performance
related issues). One of such places is the IRC server parser (but there related issues). One of such places is the IRC server parser (but there
are more). are more).
- Use QString everywhere in the user interface and in any other - Use TQString everywhere in the user interface and in any other
place where KviStr is not strictly needed. Save and restore place where KviStr is not strictly needed. Save and restore
strings in the UTF8 format. strings in the UTF8 format.
- Get rid of ALL occurences of KviWStr and kvi_wchar_t * : DONE on 2004.11.02 - Get rid of ALL occurences of KviWStr and kvi_wchar_t * : DONE on 2004.11.02
@ -449,7 +449,7 @@ language. To make a string translaetable use one of the __tr* macros.
The most common one across the sources is __tr("string") that returns The most common one across the sources is __tr("string") that returns
a const char * translation of "string". a const char * translation of "string".
Actually __tr() is being phased out in favor of __tr2qs() that returns Actually __tr() is being phased out in favor of __tr2qs() that returns
a QString instead of a const char * pointer. a TQString instead of a const char * pointer.
The arguments of these macros are extracted from the sources by the The arguments of these macros are extracted from the sources by the
gettext program and are used to build the translation hashes loaded at runtime. gettext program and are used to build the translation hashes loaded at runtime.
Remember that the arguments must be string constants and not variables. Remember that the arguments must be string constants and not variables.
@ -459,7 +459,7 @@ defined in kvi_locale.h
CSTRING is an US-ASCII null terminated C string. CSTRING is an US-ASCII null terminated C string.
__tr2qs(CSTRING) : translates CSTRING to a QString & __tr2qs(CSTRING) : translates CSTRING to a TQString &
__tr(CSTRING) : translates CSTRING to another CSTRING __tr(CSTRING) : translates CSTRING to another CSTRING
This should disappear in favor of __tr2qs This should disappear in favor of __tr2qs
@ -694,11 +694,11 @@ comes from the server) you MUST use KviWindow::outputNoFmt() instead
of KviWindow::output(). of KviWindow::output().
BAD: BAD:
QString szText = pConnection->decodeText(msg.safeTrailing()); TQString szText = pConnection->decodeText(msg.safeTrailing());
pWindow->output(KVI_OUT_SOMETHING,szText); <--potential crash/security hole pWindow->output(KVI_OUT_SOMETHING,szText); <--potential crash/security hole
GOOD: GOOD:
QString szText = pConnection->decodeText(msg.safeTrailing()); TQString szText = pConnection->decodeText(msg.safeTrailing());
pWindow->outputNoFmt(KVI_OUT_SOMETHING,szText); <--faster and no crashes pWindow->outputNoFmt(KVI_OUT_SOMETHING,szText); <--faster and no crashes
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -861,11 +861,11 @@ Porting to Qt 4.x (while mantaining Qt 3.x compatibility) (Work In Progress)
For the moment, in random order: For the moment, in random order:
- Avoid using QString::null, use KviQString::empty instead. - Avoid using TQString::null, use KviQString::empty instead.
This is because Qt 4.x does NOT have a null static variable. Qt 4.x in fact This is because Qt 4.x does NOT have a null static variable. Qt 4.x in fact
does not have the distinction between null and empty strings (Note that for does not have the distinction between null and empty strings (Note that for
KviStr this choice was made since the beginning). KviStr this choice was made since the beginning).
Do NOT replace all the uses of QString::null with QString() (as the qt 4.x Do NOT replace all the uses of TQString::null with TQString() (as the qt 4.x
porting documentation suggests) since for Qt 3.x this construct is SLOW. porting documentation suggests) since for Qt 3.x this construct is SLOW.
- We're building a compatibility layer in kvilib. - We're building a compatibility layer in kvilib.

@ -59,13 +59,13 @@ typedef struct _KviOptionsWidgetInstanceEntry
KviOptionsWidget * (*createProc)(TQWidget *); KviOptionsWidget * (*createProc)(TQWidget *);
KviOptionsWidget * pWidget; // singleton KviOptionsWidget * pWidget; // singleton
int iIcon; int iIcon;
QString szName; TQString szName;
QString szNameNoLocale; TQString szNameNoLocale;
const char * szClassName; const char * szClassName;
int iPriority; int iPriority;
QString szKeywords; TQString szKeywords;
QString szKeywordsNoLocale; TQString szKeywordsNoLocale;
QString szGroup; TQString szGroup;
bool bIsContainer; bool bIsContainer;
bool bIsNotContained; bool bIsNotContained;
KviPointerList<KviOptionsWidgetInstanceEntry> * pChildList; KviPointerList<KviOptionsWidgetInstanceEntry> * pChildList;
@ -160,7 +160,7 @@ EOF
for aclass in $CLASS_LIST; do for aclass in $CLASS_LIST; do
echo -n "KviOptionsWidget * class$aclass" >> $TARGET echo -n "KviOptionsWidget * class$aclass" >> $TARGET
echo "_createInstanceProc(QWidget * parent)" >> $TARGET echo "_createInstanceProc(TQWidget * parent)" >> $TARGET
echo "{" >> $TARGET echo "{" >> $TARGET
echo " return new $aclass(parent);" >> $TARGET echo " return new $aclass(parent);" >> $TARGET
echo "}" >> $TARGET echo "}" >> $TARGET
@ -183,7 +183,7 @@ done
cat >> instances.cpp <<EOF cat >> instances.cpp <<EOF
KviOptionsInstanceManager::KviOptionsInstanceManager() KviOptionsInstanceManager::KviOptionsInstanceManager()
: QObject(0) : TQObject(0)
{ {
//tqDebug("Instantiating"); //tqDebug("Instantiating");
@ -343,7 +343,7 @@ void KviOptionsInstanceManager::widgetDestroyed()
} }
KviOptionsWidget * KviOptionsInstanceManager::getInstance(KviOptionsWidgetInstanceEntry * e,QWidget * par) KviOptionsWidget * KviOptionsInstanceManager::getInstance(KviOptionsWidgetInstanceEntry * e,TQWidget * par)
{ {
if(!e)return 0; if(!e)return 0;
if(!(e->pWidget)) if(!(e->pWidget))
@ -354,7 +354,7 @@ KviOptionsWidget * KviOptionsInstanceManager::getInstance(KviOptionsWidgetInstan
} }
if(e->pWidget->parent() != par) if(e->pWidget->parent() != par)
{ {
QWidget * oldPar = (QWidget *)e->pWidget->parent(); TQWidget * oldPar = (TQWidget *)e->pWidget->parent();
e->pWidget->reparent(par,TQPoint(0,0)); e->pWidget->reparent(par,TQPoint(0,0));
delete oldPar; delete oldPar;
} }
@ -394,7 +394,7 @@ KviOptionsWidget * KviOptionsInstanceManager::getInstance(KviOptionsWidgetInstan
return e->pWidget; return e->pWidget;
} }
KviOptionsWidgetInstanceEntry * KviOptionsInstanceManager::findInstanceEntry(const QObject * ptr,KviPointerList<KviOptionsWidgetInstanceEntry> * l) KviOptionsWidgetInstanceEntry * KviOptionsInstanceManager::findInstanceEntry(const TQObject * ptr,KviPointerList<KviOptionsWidgetInstanceEntry> * l)
{ {
if(l) if(l)
{ {

Loading…
Cancel
Save