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/modules/objects/libkviobjects.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/modules/objects/libkviobjects.cpp')
-rw-r--r-- | src/modules/objects/libkviobjects.cpp | 161 |
1 files changed, 80 insertions, 81 deletions
diff --git a/src/modules/objects/libkviobjects.cpp b/src/modules/objects/libkviobjects.cpp index 73eacace..81d3bef1 100644 --- a/src/modules/objects/libkviobjects.cpp +++ b/src/modules/objects/libkviobjects.cpp @@ -23,7 +23,7 @@ //============================================================================= #include "kvi_tal_listview.h" -#include <qimage.h> +#include <tqimage.h> #include "kvi_iconmanager.h" #include "kvi_window.h" #include "kvi_out.h" @@ -40,11 +40,11 @@ #include "kvi_app.h" #include "kvi_fileutils.h" #ifndef COMPILE_USE_QT4 - #include <qwidgetlist.h> - #include <qobjectlist.h> + #include <tqwidgetlist.h> + #include <tqobjectlist.h> #endif -#include <qdir.h> +#include <tqdir.h> #include "class_button.h" #include "class_checkbox.h" @@ -86,7 +86,7 @@ #include "class_dockwindow.h" #include "class_vbox.h" #include "class_hbox.h" -static void dumpChildObjects(KviWindow *pWnd, QObject *parent, const char *spacing, bool bWidgetsOnly, KviKvsArray *n, int &idx); +static void dumpChildObjects(KviWindow *pWnd, TQObject *tqparent, const char *spacing, bool bWidgetsOnly, KviKvsArray *n, int &idx); static bool objects_module_cleanup(KviModule *m) { @@ -153,7 +153,7 @@ static bool objects_kvs_cmd_killClass(KviKvsModuleCommandCall * c) Suppresses any warning message @description: Removes the definition of the class <class_name>.[br] - All the instances of the class are killed (thus children objects are killed too).[br] + All the instances of the class are killed (thus tqchildren objects are killed too).[br] All the derived class definitions are removed as well.[br] Builtin class definitions cannot be removed and this commands kills only all the instances of that class (derived class definitions @@ -164,7 +164,7 @@ static bool objects_kvs_cmd_killClass(KviKvsModuleCommandCall * c) */ - QString szClass; + TQString szClass; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("class",KVS_PT_NONEMPTYSTRING,0,szClass) KVSM_PARAMETERS_END(c) @@ -209,7 +209,7 @@ static bool objects_kvs_cmd_clearObjects(KviKvsModuleCommandCall * c) */ KviKvsKernel::instance()->objectController()->clearInstances(); - if(!c->switches()->find('i',"ii")) KviKvsKernel::instance()->objectController()->clearUserClasses(); + if(!c->switches()->tqfind('i',"ii")) KviKvsKernel::instance()->objectController()->clearUserClasses(); return true; } @@ -242,7 +242,7 @@ static bool objects_kvs_cmd_connect(KviKvsModuleCommandCall * c) KviKvsObject *obSrc; KviKvsObject *obTrg; - QString szSignal,szSlot; + TQString szSignal,szSlot; kvs_hobject_t hSrc,hTrg; KVSM_PARAMETERS_BEGIN(c) KVSO_PARAMETER("object source",KVS_PT_HOBJECT,0,hSrc) @@ -332,8 +332,8 @@ static bool objects_kvs_fnc_instances(KviKvsModuleFunctionCall * c) [doc:objects]objects documentation[/doc] */ - QString szClassName; - QString szFlags; + TQString szClassName; + TQString szFlags; KVSM_PARAMETERS_BEGIN(c) KVSO_PARAMETER("class name",KVS_PT_NONEMPTYSTRING,0,szClassName) KVSO_PARAMETER("flags",KVS_PT_STRING,KVS_PF_OPTIONAL,szFlags) @@ -345,7 +345,7 @@ static bool objects_kvs_fnc_instances(KviKvsModuleFunctionCall * c) KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(szClassName); if(!pClass) { - if(!szFlags.contains(QChar('q'))) + if(!szFlags.tqcontains(TQChar('q'))) c->warning(__tr2qs("The class '%Q' does not exist"),&szClassName); return true; } @@ -353,7 +353,7 @@ static bool objects_kvs_fnc_instances(KviKvsModuleFunctionCall * c) KviPointerHashTableIterator<void *,KviKvsObject> it(*od); kvs_uint_t uIdx = 0; - if(szFlags.contains(QChar('s'))) + if(szFlags.tqcontains(TQChar('s'))) { while(KviKvsObject * ob = it.current()) { @@ -404,7 +404,7 @@ static bool objects_kvs_fnc_variables(KviKvsModuleFunctionCall * c) c->warning(__tr2qs("Object does not exists")); return true; } - KviPointerHashTableIterator<QString,KviKvsVariant> it(* ob->dataContainer()->dict()); + KviPointerHashTableIterator<TQString,KviKvsVariant> it(* ob->dataContainer()->dict()); KviKvsHash* pHash = new KviKvsHash(); c->returnValue()->setHash(pHash); while(KviKvsVariant * t = it.current()) @@ -434,7 +434,7 @@ static bool objects_kvs_fnc_variables(KviKvsModuleFunctionCall * c) */ static bool objects_kvs_fnc_classAllHandlers(KviKvsModuleFunctionCall * c) { - QString szClassName; + TQString szClassName; KVSM_PARAMETERS_BEGIN(c) KVSO_PARAMETER("class name",KVS_PT_NONEMPTYSTRING,0,szClassName) KVSM_PARAMETERS_END(c) @@ -445,12 +445,12 @@ static bool objects_kvs_fnc_classAllHandlers(KviKvsModuleFunctionCall * c) return true; } - KviPointerHashTableIterator<QString,KviKvsObjectFunctionHandler> it(* pClass->getHandlers()); + KviPointerHashTableIterator<TQString,KviKvsObjectFunctionHandler> it(* pClass->getHandlers()); KviKvsHash* pHash = new KviKvsHash(); c->returnValue()->setHash(pHash); while(KviKvsObjectFunctionHandler * t = it.current()) { - QString szCode; + TQString szCode; KviKvsObjectFunctionHandler *handler=pClass->lookupFunctionHandler(it.currentKey()); pClass->getFunctionCode(szCode,*handler); pHash->set(it.currentKey(),new KviKvsVariant(szCode)); @@ -481,8 +481,8 @@ static bool objects_kvs_fnc_classes(KviKvsModuleFunctionCall * c) KviKvsArray * pArry = new KviKvsArray(); c->returnValue()->setArray(pArry); int uIdx=0; - KviPointerHashTableIterator<QString,KviKvsObjectClass> it(*KviKvsKernel::instance()->objectController()->classDict()); - KviPointerHashTable<QString,bool> *classdict=new KviPointerHashTable<QString,bool>; + KviPointerHashTableIterator<TQString,KviKvsObjectClass> it(*KviKvsKernel::instance()->objectController()->classDict()); + KviPointerHashTable<TQString,bool> *classdict=new KviPointerHashTable<TQString,bool>; classdict->setAutoDelete(false); bool bFake=true; while(KviKvsObjectClass * pClass=it.current()) @@ -490,21 +490,21 @@ static bool objects_kvs_fnc_classes(KviKvsModuleFunctionCall * c) if (!pClass->isBuiltin())classdict->insert(it.currentKey(),&bFake); ++it; } - QString szPath; + TQString szPath; g_pApp->getLocalKvircDirectory(szPath,KviApp::Classes); - QDir d(szPath); - QStringList sl; - sl = d.entryList(QDir::Files); - for(QStringList::Iterator it2 = sl.begin();it2 != sl.end();++it2) + TQDir d(szPath); + TQStringList sl; + sl = d.entryList(TQDir::Files); + for(TQStringList::Iterator it2 = sl.begin();it2 != sl.end();++it2) { - QString szName=*it2; - szName.replace("--","::"); + TQString szName=*it2; + szName.tqreplace("--","::"); if (szName!=".." && szName!=".") classdict->insert(szName.left(szName.length()-4),&bFake); } KviKvsArray* pArray = new KviKvsArray(); c->returnValue()->setArray(pArray); int idx=0; - KviPointerHashTableIterator<QString,bool> strIt(*classdict); + KviPointerHashTableIterator<TQString,bool> strIt(*classdict); while(strIt.current()) { pArray->set(idx,new KviKvsVariant(strIt.currentKey())); @@ -542,7 +542,7 @@ static bool objects_kvs_cmd_disconnect(KviKvsModuleCommandCall * c) KviKvsObject *obSrc; KviKvsObject *obTrg; - QString szSignal,szSlot; + TQString szSignal,szSlot; kvs_hobject_t hSrc,hTrg; KVSM_PARAMETERS_BEGIN(c) KVSO_PARAMETER("object source",KVS_PT_HOBJECT,0,hSrc) @@ -615,21 +615,21 @@ static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) return true; } - QImage * imgSource=0; - QPaintDevice * pdSource = 0; + TQImage * imgSource=0; + TQPaintDevice * pdSource = 0; - if(obSrc->inherits("KviKvsObject_pixmap")) pdSource =((KviKvsObject_pixmap *)obSrc)->getPixmap(); - else if (obSrc->inherits("KviKvsObject_widget")) pdSource=((KviKvsObject_widget *)obSrc)->widget(); + if(obSrc->inherits("KviKvsObject_pixmap")) pdSource =TQT_TQPAINTDEVICE(((KviKvsObject_pixmap *)obSrc)->getPixmap()); + else if (obSrc->inherits("KviKvsObject_widget")) pdSource=TQT_TQPAINTDEVICE(((KviKvsObject_widget *)obSrc)->widget()); if (!pdSource) { c->warning(__tr2qs("Widget, Image or Pixmap required ")); return true; } - QPaintDevice * pdDest = 0; + TQPaintDevice * pdDest = 0; if(obDst->inherits("KviKvsObject_pixmap")){ - pdDest= ((KviKvsObject_pixmap *)obDst)->getPixmap(); + pdDest= TQT_TQPAINTDEVICE(((KviKvsObject_pixmap *)obDst)->getPixmap()); } - else if (obDst->inherits("KviKvsObject_widget")) pdDest=((KviKvsObject_widget *)obDst)->widget(); + else if (obDst->inherits("KviKvsObject_widget")) pdDest=TQT_TQPAINTDEVICE(((KviKvsObject_widget *)obDst)->widget()); if (!pdDest) { c->warning(__tr2qs("Widget or Pixmap required")); @@ -639,9 +639,9 @@ static bool objects_kvs_cmd_bitBlt(KviKvsModuleCommandCall * c) ((KviKvsObject_pixmap *)obDst)->pixmapChanged(); } #ifdef COMPILE_USE_QT4 - /*QPainter p(pdDest); - QRect rectdest(iXdst,iYdst,uW,uH); - QRect rectsrc(iXsrc,iYsrc,uW,uH); + /*TQPainter p(pdDest); + TQRect rectdest(iXdst,iYdst,uW,uH); + TQRect rectsrc(iXsrc,iYsrc,uW,uH); p.drawPixmap(rectdest,pdSource,rectsrc); */ @@ -721,9 +721,9 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) return true; } - QPaintDevice * pdDest = 0; - if(obDest->inherits("KviKvsObject_pixmap")) pdDest = ((KviKvsObject_pixmap *)obDest)->getPixmap(); - else if (obDest->inherits("KviKvsObject_widget")) pdDest=((KviKvsObject_widget *)obDest)->widget(); + TQPaintDevice * pdDest = 0; + if(obDest->inherits("KviKvsObject_pixmap")) pdDest = TQT_TQPAINTDEVICE(((KviKvsObject_pixmap *)obDest)->getPixmap()); + else if (obDest->inherits("KviKvsObject_widget")) pdDest=TQT_TQPAINTDEVICE(((KviKvsObject_widget *)obDest)->widget()); if (!pdDest) { @@ -734,8 +734,8 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) if(obDest->inherits("KviKvsObject_pixmap")) ((KviKvsObject_pixmap *)obDest)->pixmapChanged(); - QImage *img_back=((KviKvsObject_pixmap *)obBck)->getImage(); - QImage *img_fore=((KviKvsObject_pixmap *)obFor)->getImage(); + TQImage *img_back=((KviKvsObject_pixmap *)obBck)->getImage(); + TQImage *img_fore=((KviKvsObject_pixmap *)obFor)->getImage(); // check size if ((iBkX+uW>img_back->width())||(iBkY+uH>img_back->height())) @@ -748,16 +748,16 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) c->warning(__tr2qs("Values for foreground are out of image size ")); return true; } - QImage buffer; + TQImage buffer; buffer.create(uW,uH,32); buffer.setAlphaBuffer(true); for(int y = 0;y < buffer.height();y++) { - QRgb * dst = (QRgb *)buffer.scanLine(y); - QRgb * end = dst + buffer.width(); - QRgb * bkg = (QRgb *)img_back->scanLine(y+iBkY); + TQRgb * dst = (TQRgb *)buffer.scanLine(y); + TQRgb * end = dst + buffer.width(); + TQRgb * bkg = (TQRgb *)img_back->scanLine(y+iBkY); bkg += iBkX; - QRgb * fgn = (QRgb *)img_fore->scanLine(y+iFoY); + TQRgb * fgn = (TQRgb *)img_fore->scanLine(y+iFoY); fgn += iFoX; double dRemaining = 1.0 - dBlend; int a=0; @@ -765,11 +765,11 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) { - *dst = qRgba( - (int)((qRed(*bkg) * dRemaining) + (qRed(*fgn) * dBlend)), - (int)((qGreen(*bkg) * dRemaining) + (qGreen(*fgn) * dBlend)), - (int)((qBlue(*bkg) * dRemaining) + (qBlue(*fgn) * dBlend)), - (int)((qAlpha(*bkg) * dRemaining) + (qAlpha(*fgn) * dBlend)) + *dst = tqRgba( + (int)((tqRed(*bkg) * dRemaining) + (tqRed(*fgn) * dBlend)), + (int)((tqGreen(*bkg) * dRemaining) + (tqGreen(*fgn) * dBlend)), + (int)((tqBlue(*bkg) * dRemaining) + (tqBlue(*fgn) * dBlend)), + (int)((tqAlpha(*bkg) * dRemaining) + (tqAlpha(*fgn) * dBlend)) ); dst++; @@ -780,8 +780,8 @@ static bool objects_kvs_cmd_blend(KviKvsModuleCommandCall * c) } #ifdef COMPILE_USE_QT4 - QPainter p(pdDest); - QRect rect(iDesX,iDesY,buffer.width(),buffer.height()); + TQPainter p(pdDest); + TQRect rect(iDesX,iDesY,buffer.width(),buffer.height()); p.drawImage(rect,buffer); #else bitBlt(pdDest,iDesX,iDesY,&buffer,0,0,buffer.width(),buffer.height()); @@ -827,10 +827,10 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) KVSO_PARAMETERS_END(cmd) if (bFlag) cmd->window()->output(80, "Objects dump:"); #ifdef COMPILE_USE_QT4 - QWidgetList list = g_pApp->topLevelWidgets(); + TQWidgetList list = g_pApp->tqtopLevelWidgets(); KviStr spacing = ">"; - QString szTemp; + TQString szTemp; KviKvsArray * n = new KviKvsArray(); int idx=0; for(int i=0;i<list.count();i++) @@ -846,9 +846,9 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) list.at(i)->isVisible() ? "visible" : "hidden", list.at(i)->x(), list.at(i)->y(), list.at(i)->width(), list.at(i)->height()); } - QString szClass=list.at(i)->className(); - QString szObj=list.at(i)->name(); - QString szTemp; + TQString szClass=list.at(i)->className(); + TQString szObj=list.at(i)->name(); + TQString szTemp; szTemp = szClass + "::" + szObj; KviKvsVariant v; v.setString(szTemp); @@ -865,11 +865,11 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) } #else - QWidgetList *l = g_pApp->topLevelWidgets(); + TQWidgetList *l = g_pApp->tqtopLevelWidgets(); l->setAutoDelete(false); - QWidgetListIt it(*l); + TQWidgetListIt it(*l); KviStr spacing = ">"; - QString szTemp; + TQString szTemp; KviKvsArray * n = new KviKvsArray(); int idx=0; while( it.current() ) @@ -885,9 +885,9 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) it.current()->isVisible() ? "visible" : "hidden", it.current()->x(), it.current()->y(), it.current()->width(), it.current()->height()); } - QString szClass=it.current()->className(); - QString szObj=it.current()->name(); - QString szTemp; + TQString szClass=it.current()->className(); + TQString szObj=it.current()->name(); + TQString szTemp; szTemp = szClass + "::" + szObj; KviKvsVariant v; v.setString(szTemp); @@ -898,7 +898,7 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) idx++; - dumpChildObjects(cmd->window(), it.current(), spacing.ptr(), bFlag,n,idx); + dumpChildObjects(cmd->window(), TQT_TQOBJECT(it.current()), spacing.ptr(), bFlag,n,idx); } @@ -910,12 +910,12 @@ static bool objects_kvs_fnc_listObjects(KviKvsModuleFunctionCall * cmd) return true; } -static void dumpChildObjects(KviWindow *pWnd, QObject *parent, const char *spacing, bool bFlag, KviKvsArray *n, int &idx) +static void dumpChildObjects(KviWindow *pWnd, TQObject *tqparent, const char *spacing, bool bFlag, KviKvsArray *n, int &idx) { #ifdef COMPILE_USE_QT4 - const QObjectList list = parent->children(); + const TQObjectList list = tqparent->tqchildren(); if( !list.count() ) return; - QString sp(spacing); + TQString sp(spacing); sp.append(">"); for(int i=0;i<list.count();i++) { @@ -928,9 +928,9 @@ static void dumpChildObjects(KviWindow *pWnd, QObject *parent, const char *spaci list.at(i)->name(), KVI_TEXT_BOLD, list.at(i)->className() ); } - QString szClass=list.at(i)->className(); - QString szObj=list.at(i)->name(); - QString szTemp; + TQString szClass=list.at(i)->className(); + TQString szObj=list.at(i)->name(); + TQString szTemp; szTemp=spacing+szClass+"::"+szObj; KviKvsVariant v; v.setString(szTemp); @@ -942,11 +942,10 @@ static void dumpChildObjects(KviWindow *pWnd, QObject *parent, const char *spaci } #else - const QObjectList *l = parent->children(); - if( !l ) return; - if( l->isEmpty() ) return; - QObjectListIt it(*l); - QString sp(spacing); + const TQObjectList l = tqparent->childrenListObject(); + if( l.isEmpty() ) return; + TQObjectListIt it(l); + TQString sp(spacing); sp.append(">"); while( it.current() ) { @@ -959,9 +958,9 @@ static void dumpChildObjects(KviWindow *pWnd, QObject *parent, const char *spaci it.current()->name(), KVI_TEXT_BOLD, it.current()->className() ); } - QString szClass=it.current()->className(); - QString szObj=it.current()->name(); - QString szTemp; + TQString szClass=it.current()->className(); + TQString szObj=it.current()->name(); + TQString szTemp; szTemp=spacing+szClass+"::"+szObj; KviKvsVariant v; v.setString(szTemp); |