From e69e8b1d09fb579316595b4e6a850e717358a8b1 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 19 Jun 2011 19:03:33 +0000 Subject: TQt4 port kdegraphics This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1237557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksvg/ecma/ksvg_ecma.cpp | 18 +++++++++--------- ksvg/ecma/ksvg_helper.cpp | 4 ++-- ksvg/ecma/ksvg_lookup.h | 22 +++++++++++----------- ksvg/ecma/ksvg_window.cpp | 40 ++++++++++++++++++++-------------------- ksvg/ecma/ksvg_window.h | 17 +++++++++-------- 5 files changed, 51 insertions(+), 50 deletions(-) (limited to 'ksvg/ecma') diff --git a/ksvg/ecma/ksvg_ecma.cpp b/ksvg/ecma/ksvg_ecma.cpp index a42d69ad..2cb17dcd 100644 --- a/ksvg/ecma/ksvg_ecma.cpp +++ b/ksvg/ecma/ksvg_ecma.cpp @@ -38,18 +38,18 @@ using namespace KSVG; using namespace KJS; -class AsyncStatus : public ObjectImp +class AsynctqStatus : public ObjectImp { public: - AsyncStatus() : ObjectImp() { } + AsynctqStatus() : ObjectImp() { } virtual bool implementsCall() const { return true; } virtual Value call(ExecState *exec, Object &thisObj, const List &args); }; -Value AsyncStatus::call(ExecState *exec, Object &, const List &args) +Value AsynctqStatus::call(ExecState *exec, Object &, const List &args) { - kdDebug(26004) << "[AsyncStatus] " << args[0].toString(exec).ascii() << endl; + kdDebug(26004) << "[AsynctqStatus] " << args[0].toString(exec).ascii() << endl; if(args[0].toString(exec) == "success") return Number(1); @@ -163,7 +163,7 @@ TQString KSVGEcma::valueOfEventListener(SVGEventListener *listener) const { KSVGEcmaEventListener *event = static_cast(listener); if(!event) - return TQString::null; + return TQString(); return event->type(); } @@ -175,7 +175,7 @@ void KSVGEcma::addEventListener(KSVGEcmaEventListener *listener) void KSVGEcma::removeEventListener(KSVGEcmaEventListener *listener) { - m_ecmaEventListeners.take(m_ecmaEventListeners.find(listener)); + m_ecmaEventListeners.take(m_ecmaEventListeners.tqfind(listener)); if(m_ecmaEventListeners.count() == 0) m_hasListeners = false; @@ -194,7 +194,7 @@ void KSVGEcma::finishedWithEvent(SVGEventImpl *event) Value KSVGEcma::getUrl(ExecState *exec, ::KURL url) { - Object *status = new Object(new AsyncStatus()); + Object *status = new Object(new AsynctqStatus()); // FIXME: Security issue, allows local testing of getURL(), REMOVE BEFORE RELEASE! (Niko) TQString svgDocument = KSVGLoader::getUrl(url, true); @@ -214,7 +214,7 @@ Value KSVGEcma::getUrl(ExecState *exec, ::KURL url) void KSVGEcma::postUrl(ExecState *exec, ::KURL url, const TQString &data, const TQString &mimeType, const TQString &contentEncoding, Object &callBackFunction) { - Object *status = new Object(new AsyncStatus()); + Object *status = new Object(new AsynctqStatus()); status->put(exec, Identifier("content"), String("")); status->put(exec, Identifier("success"), Boolean(false)); @@ -224,7 +224,7 @@ void KSVGEcma::postUrl(ExecState *exec, ::KURL url, const TQString &data, const // Support gzip compression if(contentEncoding == "gzip" || contentEncoding == "deflate") - byteArray = qCompress(byteArray); + byteArray = tqCompress(byteArray); KSVGLoader *loader = new KSVGLoader(); loader->postUrl(url, byteArray, mimeType, exec, callBackFunction, *status); diff --git a/ksvg/ecma/ksvg_helper.cpp b/ksvg/ecma/ksvg_helper.cpp index 24f05101..1d41733e 100644 --- a/ksvg/ecma/ksvg_helper.cpp +++ b/ksvg/ecma/ksvg_helper.cpp @@ -33,7 +33,7 @@ KJS::UString::UString(const DOM::DOMString &d) unsigned int len = d.length(); KJS::UChar *dat = new UChar[len]; - memcpy(dat, d.unicode(), len * sizeof(UChar)); + memcpy(dat, d.tqunicode(), len * sizeof(UChar)); rep = KJS::UString::Rep::create(dat, len); } @@ -41,7 +41,7 @@ KJS::UString::UString(const TQString &d) { unsigned int len = d.length(); KJS::UChar *dat = new UChar[len]; - memcpy(dat, d.unicode(), len * sizeof(UChar)); + memcpy(dat, d.tqunicode(), len * sizeof(UChar)); rep = KJS::UString::Rep::create(dat, len); } diff --git a/ksvg/ecma/ksvg_lookup.h b/ksvg/ecma/ksvg_lookup.h index 11c41462..659ce8c7 100644 --- a/ksvg/ecma/ksvg_lookup.h +++ b/ksvg/ecma/ksvg_lookup.h @@ -31,13 +31,13 @@ #define KSVG_GET_COMMON \ public: \ \ - /* The standard hasProperty call, auto-generated. Looks in hashtable, forwards to parents. */ \ + /* The standard hasProperty call, auto-generated. Looks in hashtable, forwards to tqparents. */ \ bool hasProperty(KJS::ExecState *exec, const KJS::Identifier &propertyName) const; \ \ /* get() method, called by KSVGBridge::get */ \ KJS::Value get(KJS::ExecState *exec, const KJS::Identifier &propertyName, const KJS::ObjectImp* bridge) const; \ \ - /* Called by lookupGet(). Auto-generated. Forwards to the parent which has the given property. */ \ + /* Called by lookupGet(). Auto-generated. Forwards to the tqparent which has the given property. */ \ KJS::Value getInParents(KJS::ExecState *exec, const KJS::Identifier &propertyName, const KJS::ObjectImp* bridge) const; \ \ KJS::Object prototype(KJS::ExecState *exec) const;\ @@ -59,7 +59,7 @@ public: \ KSVG_GET_COMMON \ virtual KJS::Value cache(KJS::ExecState *exec) const; -// For classes without properties, but with a parent class to forward to +// For classes without properties, but with a tqparent class to forward to #define KSVG_FORWARDGET \ public: \ \ @@ -80,7 +80,7 @@ public: \ /* put() method, called by KSVGBridge::put */ \ bool put(KJS::ExecState *exec, const KJS::Identifier &propertyName, const KJS::Value &value, int attr); \ \ - /* Called by lookupPut. Auto-generated. Looks in hashtable, forwards to parents. */ \ + /* Called by lookupPut. Auto-generated. Looks in hashtable, forwards to tqparents. */ \ bool putInParents(KJS::ExecState *exec, const KJS::Identifier &propertyName, const KJS::Value &value, int attr); // For classes which inherit a read-write class, but have no readwrite property themselves @@ -127,7 +127,7 @@ namespace KSVG * * This method does it all (looking in the hashtable, checking for function * overrides, creating the function or retrieving from cache, calling - * getValueProperty in case of a non-function property, forwarding to parent[s] if + * getValueProperty in case of a non-function property, forwarding to tqparent[s] if * unknown property). * * Template arguments: @@ -150,7 +150,7 @@ namespace KSVG { const KJS::HashEntry *entry = KJS::Lookup::findEntry(table, propertyName); - if(!entry) // not found, forward to parents + if(!entry) // not found, forward to tqparents return thisObj->getInParents(exec, propertyName, bridge); if(entry->attr & KJS::Function) @@ -174,7 +174,7 @@ namespace KSVG { const KJS::HashEntry *entry = KJS::Lookup::findEntry(table, propertyName); - if(!entry) // not found, forward to parents + if(!entry) // not found, forward to tqparents return thisObj->getInParents(exec, propertyName, bridge); if(entry->attr & KJS::Function) @@ -199,7 +199,7 @@ namespace KSVG { const KJS::HashEntry *entry = KJS::Lookup::findEntry(table, propertyName); - if(!entry) // not found, forward to parents + if(!entry) // not found, forward to tqparents return thisObj->putInParents(exec, propertyName, value, attr); else if(entry->attr & KJS::Function) // Function: put as override property return false; @@ -256,14 +256,14 @@ namespace KSVG } \ const KJS::ClassInfo ClassProto::info = { ClassName, 0, &s_hashTable, 0 }; \ -// same as KSVG_IMPLEMENT_PROTOTYPE but with a parent class to forward calls to +// same as KSVG_IMPLEMENT_PROTOTYPE but with a tqparent class to forward calls to // Not used within KSVG up to now - each class does a self proto lookup in generateddata.cpp #define KSVG_IMPLEMENT_PROTOTYPE_WITH_PARENT(ClassName,ClassProto,ClassFunc,ParentProto) \ KJS::Value KSVG::ClassProto::get(KJS::ExecState *exec, const KJS::Identifier &propertyName) const \ { \ KJS::Value val = lookupGetFunction(exec, propertyName, &s_hashTable, this ); \ if ( val.type() != UndefinedType ) return val; \ - /* Not found -> forward request to "parent" prototype */ \ + /* Not found -> forward request to "tqparent" prototype */ \ return ParentProto::self(exec).get( exec, propertyName ); \ } \ bool KSVG::ClassProto::hasProperty(KJS::ExecState *exec, const KJS::Identifier &propertyName) const \ @@ -310,7 +310,7 @@ namespace KSVG // To be used in all call() implementations! // Can't use if (!thisObj.inherits(&ClassName::s_classInfo) since we don't -// use the (single-parent) inheritance of ClassInfo... +// use the (single-tqparent) inheritance of ClassInfo... #define KSVG_CHECK_THIS(ClassName) KSVG_CHECK(ClassName, thisObj) #endif diff --git a/ksvg/ecma/ksvg_window.cpp b/ksvg/ecma/ksvg_window.cpp index 80a4ee14..7137bfbd 100644 --- a/ksvg/ecma/ksvg_window.cpp +++ b/ksvg/ecma/ksvg_window.cpp @@ -108,7 +108,7 @@ const ClassInfo KSVG::Window::s_classInfo = { "Window", 0, &s_hashTable, 0 }; KSVG::Window::Window(KSVG::SVGDocumentImpl *p) : ObjectImp(), m_doc(p) { - winq = new WindowQObject(this); + winq = new WindowTQObject(this); } KSVG::Window::~Window() @@ -278,7 +278,7 @@ void KSVG::Window::clear(ExecState *exec) { kdDebug(26004) << "KSVG::Window::clear " << this << endl; delete winq; - winq = new WindowQObject(this);; + winq = new WindowTQObject(this);; // Get rid of everything, those user vars could hold references to DOM nodes deleteAllProperties(exec); @@ -330,11 +330,11 @@ Value WindowFunc::call(ExecState *exec, Object &thisObj, const List &args) case KSVG::Window::_GetURL: { KURL url((const_cast(window))->doc()->baseUrl(), args[0].toString(exec).qstring()); - Value asyncStatus = (const_cast(window))->doc()->ecmaEngine()->getUrl(exec, url); + Value asynctqStatus = (const_cast(window))->doc()->ecmaEngine()->getUrl(exec, url); Object callBackFunction = Object::dynamicCast(args[1]); List callBackArgs; - callBackArgs.append(asyncStatus); + callBackArgs.append(asynctqStatus); callBackFunction.call(exec, callBackFunction, callBackArgs); return Undefined(); @@ -392,7 +392,7 @@ Value WindowFunc::call(ExecState *exec, Object &thisObj, const List &args) else str2 = KInputDialog::getText(i18n("Prompt"), TQStyleSheet::convertFromPlainText(str), - TQString::null, &ok); + TQString(), &ok); if ( ok ) return String(str2); else @@ -488,18 +488,18 @@ void ScheduledAction::execute(Window *window) } } -////////////////////// WindowQObject //////////////////////// +////////////////////// WindowTQObject //////////////////////// -WindowQObject::WindowQObject(Window *w) : parent(w) +WindowTQObject::WindowTQObject(Window *w) : tqparent(w) { } -WindowQObject::~WindowQObject() +WindowTQObject::~WindowTQObject() { - parentDestroyed(); // reuse same code + tqparentDestroyed(); // reuse same code } -void WindowQObject::parentDestroyed() +void WindowTQObject::tqparentDestroyed() { killTimers(); @@ -513,7 +513,7 @@ void WindowQObject::parentDestroyed() scheduledActions.clear(); } -int WindowQObject::installTimeout(const UString &handler, int t, bool singleShot) +int WindowTQObject::installTimeout(const UString &handler, int t, bool singleShot) { int id = startTimer(t); ScheduledAction *action = new ScheduledAction(handler.qstring(), singleShot); @@ -521,7 +521,7 @@ int WindowQObject::installTimeout(const UString &handler, int t, bool singleShot return id; } -int WindowQObject::installTimeout(const Value &func, List args, int t, bool singleShot) +int WindowTQObject::installTimeout(const Value &func, List args, int t, bool singleShot) { Object objFunc = Object::dynamicCast(func); int id = startTimer(t); @@ -529,13 +529,13 @@ int WindowQObject::installTimeout(const Value &func, List args, int t, bool sing return id; } -void WindowQObject::clearTimeout(int timerId, bool delAction) +void WindowTQObject::clearTimeout(int timerId, bool delAction) { killTimer(timerId); if(delAction) { - TQMapIterator it = scheduledActions.find(timerId); + TQMapIterator it = scheduledActions.tqfind(timerId); if(it != scheduledActions.end()) { ScheduledAction *action = *it; @@ -545,9 +545,9 @@ void WindowQObject::clearTimeout(int timerId, bool delAction) } } -void WindowQObject::timerEvent(TQTimerEvent *e) +void WindowTQObject::timerEvent(TQTimerEvent *e) { - TQMapIterator it = scheduledActions.find(e->timerId()); + TQMapIterator it = scheduledActions.tqfind(e->timerId()); if(it != scheduledActions.end()) { ScheduledAction *action = *it; @@ -560,8 +560,8 @@ void WindowQObject::timerEvent(TQTimerEvent *e) scheduledActions.remove(it); } - if(parent->doc()) - action->execute(parent); + if(tqparent->doc()) + action->execute(tqparent); // It is important to test singleShot and not action->singleShot here - the // action could have been deleted already if not single shot and if the @@ -570,9 +570,9 @@ void WindowQObject::timerEvent(TQTimerEvent *e) delete action; } else - kdWarning(6070) << "WindowQObject::timerEvent this=" << this << " timer " << e->timerId() << " not found (" << scheduledActions.count() << " actions in map)" << endl; + kdWarning(6070) << "WindowTQObject::timerEvent this=" << this << " timer " << e->timerId() << " not found (" << scheduledActions.count() << " actions in map)" << endl; } -void WindowQObject::timeoutClose() +void WindowTQObject::timeoutClose() { } diff --git a/ksvg/ecma/ksvg_window.h b/ksvg/ecma/ksvg_window.h index db6ac9a3..6f1e511a 100644 --- a/ksvg/ecma/ksvg_window.h +++ b/ksvg/ecma/ksvg_window.h @@ -25,14 +25,14 @@ namespace KSVG { class SVGDocumentImpl; -class WindowQObject; +class WindowTQObject; // This is currently a fork of khtml's Window object, simplified. // However in the long run it could become a base class for it. // Author: David Faure class Window : public KJS::ObjectImp { friend class WindowFunc; - friend class WindowQObject; + friend class WindowTQObject; friend class ScheduledAction; public: Window(KSVG::SVGDocumentImpl *p); @@ -81,7 +81,7 @@ public: static const struct KJS::HashTable s_hashTable; private: - WindowQObject *winq; + WindowTQObject *winq; TQGuardedPtr m_doc; }; @@ -98,22 +98,23 @@ public: bool singleShot; }; -class WindowQObject : public TQObject { +class WindowTQObject : public TQObject { Q_OBJECT + TQ_OBJECT public: - WindowQObject(Window *w); - ~WindowQObject(); + WindowTQObject(Window *w); + ~WindowTQObject(); int installTimeout(const KJS::UString &handler, int t, bool singleShot); int installTimeout(const KJS::Value &func, KJS::List args, int t, bool singleShot); void clearTimeout(int timerId, bool delAction = true); public slots: void timeoutClose(); protected slots: - void parentDestroyed(); + void tqparentDestroyed(); protected: void timerEvent(TQTimerEvent *e); private: - Window *parent; + Window *tqparent; //KHTMLPart *part; // not guarded, may be dangling TQMap scheduledActions; }; -- cgit v1.2.3