diff options
Diffstat (limited to 'src/kvirc/kvs/kvi_kvs_object.cpp')
-rw-r--r-- | src/kvirc/kvs/kvi_kvs_object.cpp | 378 |
1 files changed, 189 insertions, 189 deletions
diff --git a/src/kvirc/kvs/kvi_kvs_object.cpp b/src/kvirc/kvs/kvi_kvs_object.cpp index 0447cfd9..6d51de2f 100644 --- a/src/kvirc/kvs/kvi_kvs_object.cpp +++ b/src/kvirc/kvs/kvi_kvs_object.cpp @@ -43,10 +43,10 @@ #include "kvi_kvs_object_functioncall.h" #include "kvi_kvs_object_functionhandlerimpl.h" -#include <qmetaobject.h> -#include <qtimer.h> +#include <tqmetaobject.h> +#include <tqtimer.h> #include <time.h> -#include <qiconset.h> +#include <tqiconset.h> @@ -69,11 +69,11 @@ [big]Basic concepts[/big] Objects are arranged in tree structures. - Each object that you create is either toplevel object or a children - of another object. A toplevel object is a parentless one. - Obviously all objects can have children objects.[br][br] + Each object that you create is either toplevel object or a tqchildren + of another object. A toplevel object is a tqparentless one. + Obviously all objects can have tqchildren objects.[br][br] - When an object is destroyed , all its children are also destroyed. + When an object is destroyed , all its tqchildren are also destroyed. The toplevel objects are automatically destroyed when KVIrc quits. The objects are global to the entire application (this is different from previous KVIrc releases where the objects were local @@ -85,7 +85,7 @@ by the programmer; the name is just a mnemonic expedient, and you may also not need it.[br][br] - Each object is identified by an [b]OPAQUE UNIQUE ID[/b]. + Each object is identified by an [b]OPAQUE UNITQUE ID[/b]. The ID is assigned by KVIrc and can be held in any variable. You can think the object id as a "handle for the object" or the object's pointer. Any action performed on the object will require its ID.[br][br] @@ -95,7 +95,7 @@ To create an object you must use the [fnc]$new[/fnc]() function. [fnc]$new[/fnc]() requires three parameters:[br] - The object class (more about object classes later in this document)[br] - - The ID of the parent object , (that can be 0 for toplevel objects).[br] + - The ID of the tqparent object , (that can be 0 for toplevel objects).[br] - The object name (eventually empty)[br] [example] %myobject = [fnc]$new[/fnc]([class]object[/class],0,theName) @@ -113,7 +113,7 @@ [example] [cmd]if[/cmd](%myobject == %anotherobject)[cmd]echo[/cmd] "This is the same object!"; [/example] - The parent object id is optional, if not specified it is assumed to be 0. + The tqparent object id is optional, if not specified it is assumed to be 0. The object name is optional , but it may help you later in finding the object.[br][br] To destroy an object use the [cmd]delete[/cmd] command. (In previous versions @@ -121,7 +121,7 @@ [example] [cmd]delete[/cmd] %myobject [/example] - If the destroyed object has children objects , these are destroyed too.[br][br] + If the destroyed object has tqchildren objects , these are destroyed too.[br][br] [big]Fields : objects as pseudo-structures[/big] @@ -196,15 +196,15 @@ [cmd]delete[/cmd] %tmp [/example] Another cool function exported by the [class:object]object[/class] class is the - [classfnc:object]$children[/classfnc]() function. - It returns a comma separated list of children identifiers.[br] + [classfnc:object]$tqchildren[/classfnc]() function. + It returns a comma separated list of tqchildren identifiers.[br] [example] %tmp = [fnc]$new[/fnc]([class]object[/class],0,myobject) %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child1) %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child2) %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child3) - [cmd]echo[/cmd] The object's children list is : %tmp->[classfnc:object]$children[/classfnc]() - # Destroy the object and the children + [cmd]echo[/cmd] The object's tqchildren list is : %tmp->[classfnc:object]$tqchildren[/classfnc]() + # Destroy the object and the tqchildren [cmd]delete[/cmd] %tmp [/example] There are two special functions for each objects: the "constructor" and the "destructor". @@ -230,25 +230,25 @@ [cmd]privateimpl[/cmd](%tmp,destructor) { %count = 0; - [cmd]foreach[/cmd](%t,[fnc]$this[/fnc]->[classfnc:object]$children[/classfnc]()) + [cmd]foreach[/cmd](%t,[fnc]$this[/fnc]->[classfnc:object]$tqchildren[/classfnc]()) { [cmd]echo[/cmd] Children : %t->[classfnc:object]$name[/classfnc]() with class %t->[classfnc:object]$class[/classfnc]() %count++ } - [cmd]echo[/cmd] Just before destroying my %count children. + [cmd]echo[/cmd] Just before destroying my %count tqchildren. } - # Destroy the object and the children + # Destroy the object and the tqchildren [cmd]delete[/cmd] %tmp [/example] In the example above four objects have been created. - A "parent" object named "myobject" , and three children objects. + A "tqparent" object named "myobject" , and three tqchildren objects. The destructor has been reimplemented for each child object, to make it "say" its name (Please note the usage of [fnc]$this[/fnc]). - In the parent destructor the children have been counted and listed.[br] - Then the parent object is destroyed causing to:[br] - - trigger the parent destructor.[br] - - destroy all the children (and conseguently trigger all the "individual" destructors).[br][br] + In the tqparent destructor the tqchildren have been counted and listed.[br] + Then the tqparent object is destroyed causing to:[br] + - trigger the tqparent destructor.[br] + - destroy all the tqchildren (and conseguently trigger all the "individual" destructors).[br][br] Not all the object functions must return a value: If a function does not return a meaningful value , or you just want to ignore it , you can call it in the following way:[br] @@ -339,7 +339,7 @@ The above class is named "helloworld". It inherits the [class]object[/class] class. This means that it acquires all the [class]object[/class] fuunctions: [classfnc:object]$name[/classfnc]() , - [classfnc:object]$class[/class]() , [classfnc:object]$children[/classfnc]()... + [classfnc:object]$class[/class]() , [classfnc:object]$tqchildren[/classfnc]()... Additionally , it has the $sayhello() function, that "echoes Hello world" to the console. Now you can create an instance of this class: [example] @@ -486,7 +486,7 @@ @description: This is the base class for all the builtin KVirc object classes. It exports the functions to retrieve the object name, to iterate - through children objects and to lookup a child object by name or class. + through tqchildren objects and to lookup a child object by name or class. Additionally , this class provides the builtin timer functionality. The [classfnc]$constructor[/classfnc] and [classfnc]$destructor[/classfnc] functions are empty implementations that all the other classes inherit. @@ -499,8 +499,8 @@ The default implementation emits the signal "[classsignal]destroyed[/classsignal]". !fn: $name() Returns the name of this object. - !fn: $parent() - Returns the parent object of this object or 0 if this object has no parent. + !fn: $tqparent() + Returns the tqparent object of this object or 0 if this object has no tqparent. !fn: $timerEvent(<timerId>) Handler for the timer events. The default implementation does nothing. @@ -521,15 +521,15 @@ Returns the first child that matches <class> and <name>. If <class> is an empty string, any class matches, if <name> is an empty string, any name matches. - This function traverses the entire tree of children + This function traverses the entire tree of tqchildren but is NOT recursive. !fn: $childCount() - Returns the number of children objects + Returns the number of tqchildren objects !fn: $emit(<signal_name>[,parameters]) Emits the signal <signal_name> passing the optional [parameters]. See the [doc:objects]objects documentation[/doc] for an overview of signals and slots. - !fn: $children() - Returns an array of children object identifiers. + !fn: $tqchildren() + Returns an array of tqchildren object identifiers. !fn: $signalSender() Returns the current signal sender when in a slot connected to a signal. In other contexts this function returns an empty string. @@ -540,11 +540,11 @@ one of this object's slots. This means that in a slot handler it returns the name of the signal that has triggered it. - !fn: $property(<Qt property name>[,bNowarning:boolean]) + !fn: $property(<TQt property name>[,bNowarning:boolean]) This is for really advanced scripting.[br] - All KVIrc widgets are based on the Qt library ones.[br] - The Qt library allow to set and read special properties.[br] - You will have to take a look at the Qt documentation for each widget type + All KVIrc widgets are based on the TQt library ones.[br] + The TQt library allow to set and read special properties.[br] + You will have to take a look at the TQt documentation for each widget type to see the available property names.[br] The supported property types are: Rect, Size, Point, Color, String, CString, Int, UInt, Bool and enumeration types.[br] @@ -553,9 +553,9 @@ There are many properties that are available ony through the [classfnc]$property()[classfnc]" call:[br] For example, you can find out if the widget accepts drops by calling [classfnc]$property(acceptDrops)[classfnc].[br] This function will be mainly useful in the [class]wrapper[/class] class. - !fn: $setProperty(<Qt property>,<property value>) + !fn: $setProperty(<TQt property>,<property value>) Sets a qt property for this widget.[br] - This is for advanced scripting, and can control really many features of the Qt widgets.[br] + This is for advanced scripting, and can control really many features of the TQt widgets.[br] For example, the [class]multilineedit[/class] widgets can be set to the "password" echo mode only by using this function call:[br] [example] @@ -586,8 +586,8 @@ static char * g_hNextObjectHandle = (char *)0; -KviKvsObject::KviKvsObject(KviKvsObjectClass * pClass,KviKvsObject * pParent,const QString &szName) -: QObject(pParent) +KviKvsObject::KviKvsObject(KviKvsObjectClass * pClass,KviKvsObject * pParent,const TQString &szName) +: TQObject(pParent) { if(g_hNextObjectHandle == 0)g_hNextObjectHandle++; // make sure it's never 0 m_hObject = (kvs_hobject_t)g_hNextObjectHandle; @@ -639,7 +639,7 @@ KviKvsObject::~KviKvsObject() // Disconnect all the signals if(m_pSignalDict) { - KviPointerHashTableIterator<QString,KviKvsObjectConnectionList> it(*m_pSignalDict); + KviPointerHashTableIterator<TQString,KviKvsObjectConnectionList> it(*m_pSignalDict); while(it.current()) { @@ -660,7 +660,7 @@ KviKvsObject::~KviKvsObject() KviKvsObjectConnectionListIterator cit(*m_pConnectionList); while(cit.current()) { - QString szSig = cit.current()->szSignal; + TQString szSig = cit.current()->szSignal; cit.current()->pSourceObject->disconnectSignal(szSig,cit.current()); //++cit;// NO!... we point to the next now! } @@ -670,7 +670,7 @@ KviKvsObject::~KviKvsObject() for(;;) { if(!m_pSignalDict)break; - KviPointerHashTableEntry<QString,KviKvsObjectConnectionList> * pSignalList = m_pSignalDict->firstEntry(); + KviPointerHashTableEntry<TQString,KviKvsObjectConnectionList> * pSignalList = m_pSignalDict->firstEntry(); if(!pSignalList)break; KviKvsObjectConnection * pConnection = pSignalList->data()->first(); if(!pConnection)break; @@ -683,18 +683,18 @@ KviKvsObject::~KviKvsObject() if(!m_pConnectionList)break; KviKvsObjectConnection * pConnection = m_pConnectionList->first(); if(!pConnection)break; - QString szSignalCopy = pConnection->szSignal; // we need this since pConnection is deleted inside disconnectSignal() and pConnection->szSignal dies too (but is referenced after the connection delete) + TQString szSignalCopy = pConnection->szSignal; // we need this since pConnection is deleted inside disconnectSignal() and pConnection->szSignal dies too (but is referenced after the connection delete) pConnection->pSourceObject->disconnectSignal(szSignalCopy,pConnection); } #endif KviKvsKernel::instance()->objectController()->unregisterObject(this); - if(parentObject())parentObject()->unregisterChild(this); + if(tqparentObject())tqparentObject()->unregisterChild(this); if(m_pObject) { - disconnect(m_pObject,SIGNAL(destroyed()),this,SLOT(objectDestroyed())); + disconnect(m_pObject,TQT_SIGNAL(destroyed()),this,TQT_SLOT(objectDestroyed())); if(m_bObjectOwner)delete m_pObject; } @@ -707,14 +707,14 @@ bool KviKvsObject::init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pPara return true; } -QWidget * KviKvsObject::parentScriptWidget() +TQWidget * KviKvsObject::tqparentScriptWidget() { - if(parentObject()) + if(tqparentObject()) { - if(parentObject()->object()) + if(tqparentObject()->object()) { - if(parentObject()->object()->isWidgetType()) - return (QWidget *)(parentObject()->object()); + if(tqparentObject()->object()->isWidgetType()) + return (TQWidget *)(tqparentObject()->object()); } } return 0; @@ -730,19 +730,19 @@ void KviKvsObject::registerChild(KviKvsObject *pChild) m_pChildList->append(pChild); } -// SIGNAL/SLOT stuff +// SIGNAL/TQT_SLOT stuff -bool KviKvsObject::connectSignal(const QString &sigName,KviKvsObject * pTarget,const QString &slotName) +bool KviKvsObject::connectSignal(const TQString &sigName,KviKvsObject * pTarget,const TQString &slotName) { if(!pTarget->lookupFunctionHandler(slotName))return false; // no such slot if(!m_pSignalDict) { - m_pSignalDict = new KviPointerHashTable<QString,KviKvsObjectConnectionList>(7,false); + m_pSignalDict = new KviPointerHashTable<TQString,KviKvsObjectConnectionList>(7,false); m_pSignalDict->setAutoDelete(true); } - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); + KviKvsObjectConnectionList * l = m_pSignalDict->tqfind(sigName); if(!l) { l = new KviKvsObjectConnectionList; @@ -772,11 +772,11 @@ void KviKvsObject::registerConnection(KviKvsObjectConnection *pConnection) m_pConnectionList->append(pConnection); } -bool KviKvsObject::disconnectSignal(const QString &sigName,KviKvsObject * pTarget,const QString &slotName) +bool KviKvsObject::disconnectSignal(const TQString &sigName,KviKvsObject * pTarget,const TQString &slotName) { if(!m_pSignalDict)return false; //no such signal to disconnect - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); + KviKvsObjectConnectionList * l = m_pSignalDict->tqfind(sigName); if(!l)return false; KviKvsObjectConnectionListIterator it(*l); @@ -785,7 +785,7 @@ bool KviKvsObject::disconnectSignal(const QString &sigName,KviKvsObject * pTarge { if(sl->pTargetObject == pTarget) { - if(KviQString::equalCI(sl->szSlot,slotName)) + if(KviTQString::equalCI(sl->szSlot,slotName)) { pTarget->unregisterConnection(sl); l->removeRef(sl); @@ -803,14 +803,14 @@ bool KviKvsObject::disconnectSignal(const QString &sigName,KviKvsObject * pTarge return false; } -bool KviKvsObject::disconnectSignal(const QString &sigName,KviKvsObjectConnection * pConnection) +bool KviKvsObject::disconnectSignal(const TQString &sigName,KviKvsObjectConnection * pConnection) { if(!m_pSignalDict)return false; - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); + KviKvsObjectConnectionList * l = m_pSignalDict->tqfind(sigName); //__range_valid(l); if(!l)return false; pConnection->pTargetObject->unregisterConnection(pConnection); - //__range_valid(l->findRef(pConnection) > -1); + //__range_valid(l->tqfindRef(pConnection) > -1); l->removeRef(pConnection); if(l->isEmpty())m_pSignalDict->remove(sigName); if(m_pSignalDict->isEmpty()) @@ -834,11 +834,11 @@ bool KviKvsObject::unregisterConnection(KviKvsObjectConnection * pConnection) return true; } -int KviKvsObject::emitSignal(const QString &sigName,KviKvsObjectFunctionCall * pOuterCall,KviKvsVariantList * pParams) +int KviKvsObject::emitSignal(const TQString &sigName,KviKvsObjectFunctionCall * pOuterCall,KviKvsVariantList * pParams) { if(!m_pSignalDict)return 0; - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); + KviKvsObjectConnectionList * l = m_pSignalDict->tqfind(sigName); if(!l)return 0; // no slots registered KviKvsVariant retVal; @@ -863,7 +863,7 @@ int KviKvsObject::emitSignal(const QString &sigName,KviKvsObjectFunctionCall * p pTarget->setSignalSender(m_hObject); pTarget->setSignalName(sigName); - if(!pTarget->callFunction(this,s->szSlot,QString::null,pOuterCall->context(),&retVal,pParams)) + if(!pTarget->callFunction(this,s->szSlot,TQString(),pOuterCall->context(),&retVal,pParams)) { if(KviKvsKernel::instance()->objectController()->lookupObject(hTarget) && it.current()) { @@ -920,7 +920,7 @@ bool KviKvsObject::function_name(KviKvsObjectFunctionCall * c) bool KviKvsObject::function_parent(KviKvsObjectFunctionCall * c) { - KviKvsObject * o = parentObject(); + KviKvsObject * o = tqparentObject(); c->returnValue()->setHObject(o ? o->handle() : (kvs_hobject_t)0); return true; } @@ -955,7 +955,7 @@ bool KviKvsObject::function_destructor(KviKvsObjectFunctionCall * c) return true; } -bool KviKvsObject::function_children(KviKvsObjectFunctionCall * c) +bool KviKvsObject::function_tqchildren(KviKvsObjectFunctionCall * c) { KviKvsArray * a = new KviKvsArray(); int id=0; @@ -969,7 +969,7 @@ bool KviKvsObject::function_children(KviKvsObjectFunctionCall * c) } bool KviKvsObject::function_findChild(KviKvsObjectFunctionCall * c) { - QString szClass,szName; + TQString szClass,szName; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("className",KVS_PT_STRING,KVS_PF_OPTIONAL,szClass) KVSO_PARAMETER("objectName",KVS_PT_STRING,KVS_PF_OPTIONAL,szName) @@ -983,7 +983,7 @@ bool KviKvsObject::function_findChild(KviKvsObjectFunctionCall * c) bool KviKvsObject::function_emit(KviKvsObjectFunctionCall * c) { - QString szSignal; + TQString szSignal; KviKvsVariantList vList; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("signal",KVS_PT_NONEMPTYSTRING,0,szSignal) @@ -1017,7 +1017,7 @@ bool KviKvsObject::function_killTimer(KviKvsObjectFunctionCall * c) bool KviKvsObject::function_killTimers(KviKvsObjectFunctionCall * c) { - // FIXME: QT4 does not seem to have QObject::killTimers() + // FIXME: QT4 does not seem to have TQObject::killTimers() #ifndef COMPILE_USE_QT4 killTimers(); #endif @@ -1038,38 +1038,38 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c) KviWindow * w = c->context()->window(); if(!bArray) - w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Listing Qt properties for object named \"%Q\" of KVS class %Q"),&m_szName,&(m_pClass->name())); + w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Listing TQt properties for object named \"%Q\" of KVS class %Q"),&m_szName,&(m_pClass->name())); kvs_int_t cnt = 0; if(m_pObject) { - const QMetaObject *o = m_pObject->metaObject(); + const TQMetaObject *o = m_pObject->tqmetaObject(); if(!bArray) - w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Properties for Qt class %s"),o->className()); + w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("Properties for TQt class %s"),o->className()); #ifndef COMPILE_USE_QT4 while(o) { #endif kvs_int_t idx = 0; #ifdef COMPILE_USE_QT4 - QMetaProperty prop = o->property(idx); - const QMetaProperty *p = ∝ + TQMetaProperty prop = o->property(idx); + const TQMetaProperty *p = ∝ #else - const QMetaProperty *p = o->property(idx); + const TQMetaProperty *p = o->property(idx); #endif while(p) { - QString szOut; - QString szName = p->name(); + TQString szOut; + TQString szName = p->name(); #ifdef COMPILE_USE_QT4 - QString szType = p->typeName(); + TQString szType = p->typeName(); #else - QString szType = p->type(); + TQString szType = p->type(); #endif if(bArray) - KviQString::sprintf(szOut,"%Q, %Q",&szName,&szType); + KviTQString::sprintf(szOut,"%Q, %Q",&szName,&szType); else { - KviQString::sprintf(szOut,__tr2qs("Property: %c%Q%c, type %Q"),KVI_TEXT_BOLD,&szName,KVI_TEXT_BOLD,&szType); + KviTQString::sprintf(szOut,__tr2qs("Property: %c%Q%c, type %Q"),KVI_TEXT_BOLD,&szName,KVI_TEXT_BOLD,&szType); szOut.prepend(" "); } @@ -1077,8 +1077,8 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c) { szOut += ", enum("; #ifndef COMPILE_USE_QT4 - // FIXME: Qt 4.x needs QMetaEnum for this loop - QStrList le = p->enumKeys(); + // FIXME: TQt 4.x needs TQMetaEnum for this loop + TQStrList le = p->enumKeys(); int i = 0; for(char *c2 = le.first(); c2; c2 = le.next()) { @@ -1120,7 +1120,7 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c) cnt++; } #ifndef COMPILE_USE_QT4 - o = o->superClass(); + o = o->tqsuperClass(); } #endif @@ -1137,7 +1137,7 @@ bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c) // rewritten using the new KVS features :) bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) { - QString szName; + TQString szName; KviKvsVariant * v; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("propertyName",KVS_PT_NONEMPTYSTRING,0,szName) @@ -1148,26 +1148,26 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(!m_pObject) { - // there are no Qt properties at all - c->warning(__tr2qs("The object named \"%Q\" of class %Q has no Qt properties"),&m_szName,&(m_pClass->name())); + // there are no TQt properties at all + c->warning(__tr2qs("The object named \"%Q\" of class %Q has no TQt properties"),&m_szName,&(m_pClass->name())); return true; } #ifdef COMPILE_USE_QT4 - int idx = m_pObject->metaObject()->indexOfProperty(szName); + int idx = m_pObject->tqmetaObject()->indexOfProperty(szName); #else - int idx = m_pObject->metaObject()->findProperty(szName,true); + int idx = m_pObject->tqmetaObject()->tqfindProperty(szName,true); #endif if(idx < 0) { - c->warning(__tr2qs("No Qt property named \"%Q\" for object named \"%Q\" of class %Q"),&szName,&m_szName,&(m_pClass->name())); + c->warning(__tr2qs("No TQt property named \"%Q\" for object named \"%Q\" of class %Q"),&szName,&m_szName,&(m_pClass->name())); return true; } #ifdef COMPILE_USE_QT4 - QMetaProperty prop = m_pObject->metaObject()->property(idx); - const QMetaProperty * p = ∝ + TQMetaProperty prop = m_pObject->tqmetaObject()->property(idx); + const TQMetaProperty * p = ∝ #else - const QMetaProperty * p = m_pObject->metaObject()->property(idx,true); + const TQMetaProperty * p = m_pObject->tqmetaObject()->property(idx,true); #endif if(!p) { @@ -1175,7 +1175,7 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) return true; } - QVariant vv = m_pObject->property(szName); + TQVariant vv = m_pObject->property(szName); if(!vv.isValid()) { c->warning(__tr2qs("Can't find property named \"%Q\" for object named \"%Q\" of class %Q: the property is indexed and defined but the returned variant is not valid"),&szName,&m_szName,&(m_pClass->name())); @@ -1184,14 +1184,14 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(p->isEnumType()) { - QString szKey; + TQString szKey; v->asString(szKey); #ifdef COMPILE_USE_QT4 int val = p->enumerator().keyToValue(szKey); #else int val = p->keyToValue(szKey); #endif - QVariant var(val); + TQVariant var(val); m_pObject->setProperty(szName,var); return true; } @@ -1204,39 +1204,39 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) switch(vv.type()) { - case QVariant::Int: + case TQVariant::Int: { kvs_int_t i; if(!v->asInteger(i))WRONG_TYPE("integer") - m_pObject->setProperty(szName,QVariant((int)i)); + m_pObject->setProperty(szName,TQVariant((int)i)); } break; - case QVariant::UInt: + case TQVariant::UInt: { kvs_int_t i; if(!v->asInteger(i))WRONG_TYPE("unsigned integer") if(i < 0)WRONG_TYPE("unsigned integer") - m_pObject->setProperty(szName,QVariant((unsigned int)i)); + m_pObject->setProperty(szName,TQVariant((unsigned int)i)); } break; - case QVariant::Bool: - m_pObject->setProperty(szName,QVariant(v->asBoolean())); + case TQVariant::Bool: + m_pObject->setProperty(szName,TQVariant(v->asBoolean())); break; - case QVariant::String: + case TQVariant::String: { - QString s; + TQString s; v->asString(s); - m_pObject->setProperty(szName,QVariant(s)); + m_pObject->setProperty(szName,TQVariant(s)); } break; - case QVariant::CString: + case TQVariant::CString: { - QString s; + TQString s; v->asString(s); - m_pObject->setProperty(szName,QVariant(s.utf8())); + m_pObject->setProperty(szName,TQVariant(s.utf8())); } break; - case QVariant::Point: + case TQVariant::Point: { if(!v->isArray())WRONG_TYPE("array(integer,integer)") KviKvsArray * a = v->array(); @@ -1245,10 +1245,10 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(!x || !y)WRONG_TYPE("array(integer,integer)") kvs_int_t iX,iY; if(!x->asInteger(iX) || !y->asInteger(iY))WRONG_TYPE("array(integer,integer)") - m_pObject->setProperty(szName,QVariant(QPoint(iX,iY))); + m_pObject->setProperty(szName,TQVariant(TQPoint(iX,iY))); } break; - case QVariant::Size: + case TQVariant::Size: { if(!v->isArray())WRONG_TYPE("array(integer,integer)") KviKvsArray * a = v->array(); @@ -1257,10 +1257,10 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(!w || !h)WRONG_TYPE("array(integer,integer)") kvs_int_t iW,iH; if(!w->asInteger(iW) || !h->asInteger(iH))WRONG_TYPE("array(integer,integer)") - m_pObject->setProperty(szName,QVariant(QSize(iW,iH))); + m_pObject->setProperty(szName,TQVariant(TQSize(iW,iH))); } break; - case QVariant::Rect: + case TQVariant::Rect: { if(!v->isArray())WRONG_TYPE("array(integer,integer,integer,integer)") KviKvsArray * a = v->array(); @@ -1271,12 +1271,12 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(!x || !y || !w || !h)WRONG_TYPE("array(integer,integer,integer,integer)") kvs_int_t iX,iY,iW,iH; if(!x->asInteger(iX) || !y->asInteger(iY) || !w->asInteger(iW) || !h->asInteger(iH))WRONG_TYPE("array(integer,integer,integer,integer)") - m_pObject->setProperty(szName,QVariant(QRect(iX,iY,iW,iH))); + m_pObject->setProperty(szName,TQVariant(TQRect(iX,iY,iW,iH))); } break; #ifndef COMPILE_USE_QT4 // FIXME: QT4 ???? - case QVariant::Color: + case TQVariant::Color: { if(!v->isArray())WRONG_TYPE("array(integer,integer,integer)") KviKvsArray * a = v->array(); @@ -1286,10 +1286,10 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(!r || !g || !b)WRONG_TYPE("array(integer,integer,integer)") kvs_int_t iR,iG,iB; if(!r->asInteger(iR) || !g->asInteger(iG) || !b->asInteger(iB))WRONG_TYPE("array(integer,integer,integer)") - m_pObject->setProperty(szName,QVariant(QColor(iR,iG,iB))); + m_pObject->setProperty(szName,TQVariant(TQColor(iR,iG,iB))); } break; - case QVariant::Font: + case TQVariant::Font: { if(!v->isArray())WRONG_TYPE("array(string,integer,string)") KviKvsArray * a = v->array(); @@ -1299,55 +1299,55 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) if(!ff || !ps)WRONG_TYPE("array(string,integer,string)") kvs_int_t iPs; if(!ps->asInteger(iPs))WRONG_TYPE("array(string,integer,string)") - QString szFf,szFl; + TQString szFf,szFl; ff->asString(szFf); if(fl)fl->asString(szFl); - QFont fnt; + TQFont fnt; fnt.setFamily(szFf); fnt.setPointSize(iPs); - if(szFl.find('b') != -1)fnt.setBold(true); - if(szFl.find('i') != -1)fnt.setItalic(true); - if(szFl.find('u') != -1)fnt.setUnderline(true); - if(szFl.find('o') != -1)fnt.setOverline(true); - if(szFl.find('f') != -1)fnt.setFixedPitch(true); - if(szFl.find('s') != -1)fnt.setStrikeOut(true); - m_pObject->setProperty(szName,QVariant(fnt)); + if(szFl.tqfind('b') != -1)fnt.setBold(true); + if(szFl.tqfind('i') != -1)fnt.setItalic(true); + if(szFl.tqfind('u') != -1)fnt.setUnderline(true); + if(szFl.tqfind('o') != -1)fnt.setOverline(true); + if(szFl.tqfind('f') != -1)fnt.setFixedPitch(true); + if(szFl.tqfind('s') != -1)fnt.setStrikeOut(true); + m_pObject->setProperty(szName,TQVariant(fnt)); } break; - case QVariant::Pixmap: - case QVariant::IconSet: + case TQVariant::Pixmap: + case TQVariant::IconSet: { if(v->isHObject()) { if(v->hobject() == (kvs_hobject_t)0) { // null pixmap - if(vv.type() == QVariant::Pixmap) - m_pObject->setProperty(szName,QVariant(QPixmap())); + if(vv.type() == TQVariant::Pixmap) + m_pObject->setProperty(szName,TQVariant(TQPixmap())); else - m_pObject->setProperty(szName,QVariant(QIconSet())); + m_pObject->setProperty(szName,TQVariant(TQIconSet())); } else { KviKvsObject * pix = KviKvsKernel::instance()->objectController()->lookupObject(v->hobject()); if(!pix->inherits("KviScriptPixmapObject")) c->warning(__tr2qs("A pixmap object, an image_id or an image file path is required for this property")); else { - QVariant pixv = pix->property("pixmap"); - if(vv.type() == QVariant::Pixmap) + TQVariant pixv = pix->property("pixmap"); + if(vv.type() == TQVariant::Pixmap) m_pObject->setProperty(szName,pixv); else - m_pObject->setProperty(szName,QVariant(QIconSet(pixv.toPixmap()))); + m_pObject->setProperty(szName,TQVariant(TQIconSet(pixv.toPixmap()))); } } } else { - QString szStr; + TQString szStr; v->asString(szStr); - QPixmap * pPix = g_pIconManager->getImage(szStr); + TQPixmap * pPix = g_pIconManager->getImage(szStr); if(pPix) { - if(vv.type() == QVariant::Pixmap) - m_pObject->setProperty(szName,QVariant(*pPix)); + if(vv.type() == TQVariant::Pixmap) + m_pObject->setProperty(szName,TQVariant(*pPix)); else - m_pObject->setProperty(szName,QVariant(QIconSet(*pPix))); + m_pObject->setProperty(szName,TQVariant(TQIconSet(*pPix))); } else c->warning(__tr2qs("Can't find the requested image")); @@ -1365,7 +1365,7 @@ bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) { - QString szName; + TQString szName; bool bNoerror; KVSO_PARAMETERS_BEGIN(c) KVSO_PARAMETER("propertyName",KVS_PT_NONEMPTYSTRING,0,szName) @@ -1374,36 +1374,36 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) if(!m_pObject) { - // there are no Qt properties at all - if (bNoerror) c->returnValue()->setString("No Qt properties"); + // there are no TQt properties at all + if (bNoerror) c->returnValue()->setString("No TQt properties"); else { - c->warning(__tr2qs("The object named \"%Q\" of class %Q has no Qt properties"),&m_szName,&(m_pClass->name())); + c->warning(__tr2qs("The object named \"%Q\" of class %Q has no TQt properties"),&m_szName,&(m_pClass->name())); c->returnValue()->setNothing(); } return true; } #ifdef COMPILE_USE_QT4 - int idx = m_pObject->metaObject()->indexOfProperty(szName); + int idx = m_pObject->tqmetaObject()->indexOfProperty(szName); #else - int idx = m_pObject->metaObject()->findProperty(szName,true); + int idx = m_pObject->tqmetaObject()->tqfindProperty(szName,true); #endif if(idx < 0) { - if (bNoerror) c->returnValue()->setString("No Qt properties"); + if (bNoerror) c->returnValue()->setString("No TQt properties"); else { - c->warning(__tr2qs("No Qt property named \"%Q\" for object named \"%Q\" of class %Q"),&szName,&m_szName,&(m_pClass->name())); + c->warning(__tr2qs("No TQt property named \"%Q\" for object named \"%Q\" of class %Q"),&szName,&m_szName,&(m_pClass->name())); c->returnValue()->setNothing(); } return true; } #ifdef COMPILE_USE_QT4 - QMetaProperty prop = m_pObject->metaObject()->property(idx); - const QMetaProperty * p = ∝ + TQMetaProperty prop = m_pObject->tqmetaObject()->property(idx); + const TQMetaProperty * p = ∝ #else - const QMetaProperty * p = m_pObject->metaObject()->property(idx,true); + const TQMetaProperty * p = m_pObject->tqmetaObject()->property(idx,true); #endif if(!p) { @@ -1412,7 +1412,7 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) return true; } - QVariant v = m_pObject->property(szName); + TQVariant v = m_pObject->property(szName); if(!v.isValid()) { c->warning(__tr2qs("Can't find property named \"%Q\" for object named \"%Q\" of class %Q: the property is indexed and defined but the returned variant is not valid"),&szName,&m_szName,&(m_pClass->name())); @@ -1432,42 +1432,42 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) switch(v.type()) { - case QVariant::Int: + case TQVariant::Int: c->returnValue()->setInteger((kvs_int_t)v.toInt()); break; - case QVariant::UInt: + case TQVariant::UInt: c->returnValue()->setInteger((kvs_int_t)v.toUInt()); break; - case QVariant::Bool: + case TQVariant::Bool: c->returnValue()->setBoolean(v.toBool()); break; - case QVariant::String: + case TQVariant::String: c->returnValue()->setString(v.toString()); break; - case QVariant::CString: - c->returnValue()->setString(QString::fromUtf8(v.toCString().data())); + case TQVariant::CString: + c->returnValue()->setString(TQString::fromUtf8(v.toCString().data())); break; - case QVariant::Point: + case TQVariant::Point: { - QPoint p = v.toPoint(); + TQPoint p = v.toPoint(); KviKvsArray * a = new KviKvsArray(); a->set(0,new KviKvsVariant((kvs_int_t)p.x())); a->set(1,new KviKvsVariant((kvs_int_t)p.y())); c->returnValue()->setArray(a); } break; - case QVariant::Size: + case TQVariant::Size: { - QSize p = v.toSize(); + TQSize p = v.toSize(); KviKvsArray * a = new KviKvsArray(); a->set(0,new KviKvsVariant((kvs_int_t)p.width())); a->set(1,new KviKvsVariant((kvs_int_t)p.height())); c->returnValue()->setArray(a); } break; - case QVariant::Rect: + case TQVariant::Rect: { - QRect p = v.toRect(); + TQRect p = v.toRect(); KviKvsArray * a = new KviKvsArray(); a->set(0,new KviKvsVariant((kvs_int_t)p.x())); a->set(1,new KviKvsVariant((kvs_int_t)p.y())); @@ -1478,9 +1478,9 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) break; #ifndef COMPILE_USE_QT4 // FIXME: QT4 ? - case QVariant::Color: + case TQVariant::Color: { - QColor clr = v.toColor(); + TQColor clr = v.toColor(); KviKvsArray * a = new KviKvsArray(); a->set(0,new KviKvsVariant((kvs_int_t)clr.red())); a->set(1,new KviKvsVariant((kvs_int_t)clr.green())); @@ -1488,13 +1488,13 @@ bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) c->returnValue()->setArray(a); } break; - case QVariant::Font: + case TQVariant::Font: { - QFont f = v.toFont(); + TQFont f = v.toFont(); KviKvsArray * a = new KviKvsArray(); a->set(0,new KviKvsVariant(f.family())); a->set(1,new KviKvsVariant((kvs_int_t)f.pointSize())); - QString szFlags; + TQString szFlags; if(f.bold())szFlags += "b"; if(f.underline())szFlags += "u"; if(f.overline())szFlags += "o"; @@ -1543,7 +1543,7 @@ bool KviKvsObject::inheritsClass(KviKvsObjectClass * pClass) return false; } -KviKvsObjectClass * KviKvsObject::getClass(const QString & classOverride) +KviKvsObjectClass * KviKvsObject::getClass(const TQString & classOverride) { if(classOverride.isEmpty())return m_pClass; KviKvsObjectClass * cl = m_pClass; // class override can be also THIS class @@ -1551,20 +1551,20 @@ KviKvsObjectClass * KviKvsObject::getClass(const QString & classOverride) // is the class member function (not the local override) while(cl) { - if(KviQString::equalCI(cl->name(),classOverride))break; + if(KviTQString::equalCI(cl->name(),classOverride))break; else cl = cl->m_pParentClass; } return cl; } -KviKvsObjectFunctionHandler * KviKvsObject::lookupFunctionHandler(const QString & funcName,const QString & classOverride) +KviKvsObjectFunctionHandler * KviKvsObject::lookupFunctionHandler(const TQString & funcName,const TQString & classOverride) { KviKvsObjectFunctionHandler * h = 0; if(classOverride.isEmpty() && m_pFunctionHandlers) { // lookup the local overrides - h = m_pFunctionHandlers->find(funcName); + h = m_pFunctionHandlers->tqfind(funcName); } if(!h) @@ -1582,7 +1582,7 @@ bool KviKvsObject::die() { if(m_bInDelayedDeath)return false; m_bInDelayedDeath = true; - QTimer::singleShot(0,this,SLOT(delayedDie())); + TQTimer::singleShot(0,this,TQT_SLOT(delayedDie())); return true; } @@ -1599,13 +1599,13 @@ void KviKvsObject::delayedDie() delete this; // byez! } -void KviKvsObject::setObject(QObject * o,bool bIsOwned) +void KviKvsObject::setObject(TQObject * o,bool bIsOwned) { //__range_invalid(m_pObject); m_bObjectOwner = bIsOwned; m_pObject = o; o->installEventFilter(this); - connect(m_pObject,SIGNAL(destroyed()),this,SLOT(objectDestroyed())); + connect(m_pObject,TQT_SIGNAL(destroyed()),this,TQT_SLOT(objectDestroyed())); } void KviKvsObject::objectDestroyed() @@ -1614,12 +1614,12 @@ void KviKvsObject::objectDestroyed() die(); } -bool KviKvsObject::eventFilter(QObject *o,QEvent *e) +bool KviKvsObject::eventFilter(TQObject *o,TQEvent *e) { return false; // do not stop } -void KviKvsObject::timerEvent(QTimerEvent *e) +void KviKvsObject::timerEvent(TQTimerEvent *e) { KviKvsVariant * v = new KviKvsVariant(); v->setInteger(e->timerId()); @@ -1628,17 +1628,17 @@ void KviKvsObject::timerEvent(QTimerEvent *e) callFunction(this,"timerEvent",&parms); } -bool KviKvsObject::callFunction(KviKvsObject * pCaller,const QString &fncName,KviKvsVariant * pRetVal,KviKvsVariantList * pParams) +bool KviKvsObject::callFunction(KviKvsObject * pCaller,const TQString &fncName,KviKvsVariant * pRetVal,KviKvsVariantList * pParams) { KviKvsVariant rv; if(!pRetVal)pRetVal = &rv; KviKvsRunTimeContext ctx(0,g_pApp->activeConsole(),KviKvsKernel::instance()->emptyParameterList(),pRetVal,0); if(!pParams)pParams = KviKvsKernel::instance()->emptyParameterList(); - return callFunction(pCaller,fncName,QString::null,&ctx,pRetVal,pParams); + return callFunction(pCaller,fncName,TQString(),&ctx,pRetVal,pParams); } -bool KviKvsObject::callFunction(KviKvsObject * pCaller,const QString &fncName,KviKvsVariantList * pParams) +bool KviKvsObject::callFunction(KviKvsObject * pCaller,const TQString &fncName,KviKvsVariantList * pParams) { KviKvsVariant fakeRetVal; return callFunction(pCaller,fncName,&fakeRetVal,pParams); @@ -1646,8 +1646,8 @@ bool KviKvsObject::callFunction(KviKvsObject * pCaller,const QString &fncName,Kv bool KviKvsObject::callFunction( KviKvsObject * pCaller, - const QString & fncName, - const QString & classOverride, + const TQString & fncName, + const TQString & classOverride, KviKvsRunTimeContext * pContext, KviKvsVariant * pRetVal, KviKvsVariantList * pParams) @@ -1687,7 +1687,7 @@ bool KviKvsObject::callFunction( -void KviKvsObject::registerPrivateImplementation(const QString &szFunctionName,const QString &szCode) +void KviKvsObject::registerPrivateImplementation(const TQString &szFunctionName,const TQString &szCode) { if(szCode.isEmpty()) { @@ -1703,20 +1703,20 @@ void KviKvsObject::registerPrivateImplementation(const QString &szFunctionName,c } else { if(!m_pFunctionHandlers) { - m_pFunctionHandlers = new KviPointerHashTable<QString,KviKvsObjectFunctionHandler>(7,false); + m_pFunctionHandlers = new KviPointerHashTable<TQString,KviKvsObjectFunctionHandler>(7,false); m_pFunctionHandlers->setAutoDelete(true); } - QString szContext = m_pClass->name(); + TQString szContext = m_pClass->name(); szContext += "[privateimpl]::"; szContext += szFunctionName; - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectScriptFunctionHandler(szContext,szCode)); + m_pFunctionHandlers->tqreplace(szFunctionName,new KviKvsObjectScriptFunctionHandler(szContext,szCode)); } } -KviKvsObject * KviKvsObject::findChild(const QString &szClass,const QString &szName) +KviKvsObject * KviKvsObject::findChild(const TQString &szClass,const TQString &szName) { for(KviKvsObject * o = m_pChildList->first();o;o= m_pChildList->next()) { @@ -1725,13 +1725,13 @@ KviKvsObject * KviKvsObject::findChild(const QString &szClass,const QString &szN // any class matches if(szName.isEmpty())return o; // any name matches // name must match - if(KviQString::equalCI(szName,o->name()))return o; + if(KviTQString::equalCI(szName,o->name()))return o; } else { - if(KviQString::equalCI(szClass,o->getClass()->name())) + if(KviTQString::equalCI(szClass,o->getClass()->name())) { if(szName.isEmpty())return o; // any name matches // name must match - if(KviQString::equalCI(szName,o->name()))return o; + if(KviTQString::equalCI(szName,o->name()))return o; } } KviKvsObject * c = o->findChild(szClass,szName); |