From 05c35356abc31549c5db6eba31fb608c0365c2a0 Mon Sep 17 00:00:00 2001 From: con Date: Tue, 2 Dec 2008 12:01:29 +0100 Subject: Initial import --- bin/designer/templates.xml | 13 + .../templates/Dialog_with_Buttons_Bottom.ui | 71 + .../templates/Dialog_with_Buttons_Right.ui | 71 + bin/designer/templates/Dialog_without_Buttons.ui | 18 + bin/designer/templates/Main_Window.ui | 27 + bin/designer/templates/Widget.ui | 24 + bin/gdbmacros/GPL_EXCEPTION.TXT | 87 + bin/gdbmacros/gdbmacros.cpp | 2446 ++++++++++++++++++++ bin/gdbmacros/gdbmacros.pro | 3 + bin/license.txt | 615 +++++ bin/runInTerminal.command | 7 + bin/schemes/MS_Visual_C++.kms | 495 ++++ bin/schemes/Xcode.kms | 585 +++++ bin/snippets/class_generic.snp | 26 + bin/snippets/class_qobject.snp | 29 + bin/snippets/class_qwidget.snp | 29 + bin/snippets/comment.snp | 23 + bin/snippets/for.snp | 48 + bin/snippets/foreach.snp | 25 + bin/snippets/if.snp | 25 + bin/snippets/ifelse.snp | 27 + bin/templates/qt4project/main.cpp | 10 + bin/templates/qt4project/mywidget.cpp | 11 + bin/templates/qt4project/mywidget.h | 15 + bin/templates/qt4project/mywidget_form.cpp | 13 + bin/templates/qt4project/mywidget_form.h | 23 + bin/templates/qt4project/widget.ui | 23 + 27 files changed, 4789 insertions(+) create mode 100644 bin/designer/templates.xml create mode 100644 bin/designer/templates/Dialog_with_Buttons_Bottom.ui create mode 100644 bin/designer/templates/Dialog_with_Buttons_Right.ui create mode 100644 bin/designer/templates/Dialog_without_Buttons.ui create mode 100644 bin/designer/templates/Main_Window.ui create mode 100644 bin/designer/templates/Widget.ui create mode 100644 bin/gdbmacros/GPL_EXCEPTION.TXT create mode 100644 bin/gdbmacros/gdbmacros.cpp create mode 100644 bin/gdbmacros/gdbmacros.pro create mode 100644 bin/license.txt create mode 100755 bin/runInTerminal.command create mode 100644 bin/schemes/MS_Visual_C++.kms create mode 100644 bin/schemes/Xcode.kms create mode 100644 bin/snippets/class_generic.snp create mode 100644 bin/snippets/class_qobject.snp create mode 100644 bin/snippets/class_qwidget.snp create mode 100644 bin/snippets/comment.snp create mode 100644 bin/snippets/for.snp create mode 100644 bin/snippets/foreach.snp create mode 100644 bin/snippets/if.snp create mode 100644 bin/snippets/ifelse.snp create mode 100644 bin/templates/qt4project/main.cpp create mode 100644 bin/templates/qt4project/mywidget.cpp create mode 100644 bin/templates/qt4project/mywidget.h create mode 100644 bin/templates/qt4project/mywidget_form.cpp create mode 100644 bin/templates/qt4project/mywidget_form.h create mode 100644 bin/templates/qt4project/widget.ui (limited to 'bin') diff --git a/bin/designer/templates.xml b/bin/designer/templates.xml new file mode 100644 index 0000000000..738e31cf47 --- /dev/null +++ b/bin/designer/templates.xml @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/bin/designer/templates/Dialog_with_Buttons_Bottom.ui b/bin/designer/templates/Dialog_with_Buttons_Bottom.ui new file mode 100644 index 0000000000..18d31ab915 --- /dev/null +++ b/bin/designer/templates/Dialog_with_Buttons_Bottom.ui @@ -0,0 +1,71 @@ + + + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/bin/designer/templates/Dialog_with_Buttons_Right.ui b/bin/designer/templates/Dialog_with_Buttons_Right.ui new file mode 100644 index 0000000000..703d594f4f --- /dev/null +++ b/bin/designer/templates/Dialog_with_Buttons_Right.ui @@ -0,0 +1,71 @@ + + + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 290 + 20 + 81 + 241 + + + + Qt::Vertical + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/bin/designer/templates/Dialog_without_Buttons.ui b/bin/designer/templates/Dialog_without_Buttons.ui new file mode 100644 index 0000000000..1be629818c --- /dev/null +++ b/bin/designer/templates/Dialog_without_Buttons.ui @@ -0,0 +1,18 @@ + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + diff --git a/bin/designer/templates/Main_Window.ui b/bin/designer/templates/Main_Window.ui new file mode 100644 index 0000000000..e324db8292 --- /dev/null +++ b/bin/designer/templates/Main_Window.ui @@ -0,0 +1,27 @@ + + + + + MainWindow + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + diff --git a/bin/designer/templates/Widget.ui b/bin/designer/templates/Widget.ui new file mode 100644 index 0000000000..d03fae3871 --- /dev/null +++ b/bin/designer/templates/Widget.ui @@ -0,0 +1,24 @@ + + + + + Form + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/bin/gdbmacros/GPL_EXCEPTION.TXT b/bin/gdbmacros/GPL_EXCEPTION.TXT new file mode 100644 index 0000000000..8fa94329fe --- /dev/null +++ b/bin/gdbmacros/GPL_EXCEPTION.TXT @@ -0,0 +1,87 @@ +Nokia Corporation Qt GPL Exception version 1.3 +============================================== + +Additional rights granted beyond the GPL (the "Exception"). + +As a special exception to the terms and conditions of GPL version 2.0 or GPL +version 3.0, Nokia Corporation hereby grants you the rights described below, +provided you agree to the terms and conditions in this Exception, including its +obligations and restrictions on use. + +Nothing in this Exception gives you or anyone else the right to change the +licensing terms of the Qt Open Source Edition. + +Below, "Licensed Software" shall refer to the software licensed under the GPL +version 2.0 or GPL version 3.0 and this exception. + +1) The right to use open source licenses not compatible with the GNU +General Public License version 2.0 or GNU General Public License version +3.0: You may link software (hereafter referred to as "Your Software") +against the Licensed Software and/or distribute binaries of Your Software +linked against the Licensed Software, provided that: + +A) Your Software is licensed under one of the following licenses: + + +License name Version(s)/Copyright Date +Academic Free License 2.0, 2.1, 3.0 +Apache Software License 1.0 or 1.1 +Apache License 2.0 +Apple Public Source License 2.0 +Artistic license (as set forth in the addendum file) +BSD license "July 22 1999" +Common Development and Distribution + License (CDDL) 1.0 +Common Public License 1.0 +Eclipse Public License 1.0 +GNU Library or "Lesser" +General Public License (LGPL) 2.0, 2.1, 3.0 +Jabber Open Source License 1.0 +MIT License (as set forth in the addendum file) +Mozilla Public License (MPL) 1.0 or 1.1 +Open Software License 2.0, 3.0 +OpenSSL license (with original +SSLeay license) "2003" ("1998") +PHP License 3.0 +Python license (CNRI Python License) (as set forth in the addendum file) +Python Software Foundation License 2.1.1 +Q Public License 1.0 +Sleepycat License "1999" +W3C License "2001" +X11 License X11R6.6 +Zlib/libpng License (as set forth in the addendum file) +Zope Public License 2.0, 2.1 + + +(Licenses without a specific version number or date are reproduced +in the file GPL_Exception_Addendum.txt in your source package). + +and + +B) You must, on request, make a complete package including the complete +source code of Your Software (as defined in the GNU General Public License +version 2, section 3, but excluding anything excluded by the special +exception in the same section) available to Nokia Corporation under the +same license as that granted to other recipients of the source code of Your +Software. + +and + +C) Your or any other contributor's rights to: + + i) distribute the source code of Your Software to anyone for any purpose; + + and + + ii) publicly discuss the development project for Your Software and its + goals in any form and in any forum are not prohibited by any legal + instrument, including but not limited to contracts, non-disclosure + agreements, and employee contracts. + + +2) The right to link non-open source applications with pre-installed versions of +the Licensed Software: You may link applications with binary pre-installed +versions of the Licensed Software, provided that such applications have been +developed and are deployed in accordance with the terms and conditions of the Qt +Commercial License Agreement. + diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp new file mode 100644 index 0000000000..0d6575db5b --- /dev/null +++ b/bin/gdbmacros/gdbmacros.cpp @@ -0,0 +1,2446 @@ +/**************************************************************************** +** This file is part of Qt Creator +** +** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).* +** +** Contact: Qt Software Information (qt-info@nokia.com)** +** +** No Commercial Usage +** This file contains pre-release code and may only be used for evaluation +** and testing purposes. It may not be used for commercial development. You +** may use this file in accordance with the terms and conditions contained in +** the either Technology Preview License Agreement or the Beta Release +** License Agreement. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. In addition, as a special +** exception, Nokia gives you certain additional rights. These rights are +** described in the Nokia Qt GPL Exception version 1.2, included in the file +** GPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact Nokia +** at qt-info@nokia.com +****************************************************************************/ + +// {[( + +#include + +// this relies on contents copied from qobject_p.h +#define PRIVATE_OBJECT_ALLOWED 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/*! + \class QDumper + \brief Helper class for producing "nice" output in Qt Creator's debugger. + + \internal + + The whole "custom dumper" implementation is currently far less modular + than it could be. But as the code is still in a flux, making it nicer + from a pure archtectural point of view seems still be a waste of resources. + + Some hints: + + New dumpers for non-templated classes should be mentioned in + \c{qDumpObjectData440()} in the \c{protocolVersion == 1} branch. + + Templated classes need extra support on the IDE level + (see plugins/debugger/gdbengine.cpp) and should not be mentiond in + \c{qDumpObjectData440()}. + + In any case, dumper processesing should end up in + \c{handleProtocolVersion2and3()} and needs an entry in the bis switch there. + + Next step is to create a suitable \c{static void qDumpFoo(QDumper &d)} + function. At the bare minimum it should contain something like: + + + \c{ + const Foo &foo = *reinterpret_cast(d.data); + + P(d, "value", ...); + P(d, "type", "Foo"); + P(d, "numchild", "0"); + } + + + 'P(d, name, value)' roughly expands to: + d << (name) << "=\"" << value << "\""; + + Useful (i.e. understood by the IDE) names include: + + \list + \o "name" shows up in the first column in the Locals&Watchers view. + \o "value" shows up in the second column. + \o "valueencoded" should be set to "1" if the value is base64 encoded. + Always base64-encode values that might use unprintable or otherwise + "confuse" the protocol (like spaces and quotes). [A-Za-z0-9] is "safe". + A value of "3" is used for base64-encoded UCS4, "2" denotes + base64-encoded UTF16. + \o "numchild" return the number of children in the view. Effectively, only + 0 and != 0 will be used, so don't try too hard to get the number right. + \endlist + + If the current item has children, it might be queried to produce information + about thes children. In this case the dumper should use something like + + \c{ + if (d.dumpChildren) { + d << ",children=["; + } + + */ + +int qtGhVersion = QT_VERSION; + +#ifdef QT_GUI_LIB +# include +# include +#endif + +#include +#include + +#include +#include + +//#include + +#ifdef Q_OS_WIN +# include +#endif + +#undef NS +#ifdef QT_NAMESPACE +# define STRINGIFY0(s) #s +# define STRINGIFY1(s) STRINGIFY0(s) +# define NS STRINGIFY1(QT_NAMESPACE) "::" +# define NSX "'" STRINGIFY1(QT_NAMESPACE) "::" +# define NSY "'" +#else +# define NS "" +# define NSX "" +# define NSY "" +#endif + + +#if PRIVATE_OBJECT_ALLOWED + +#if defined(QT_BEGIN_NAMESPACE) +QT_BEGIN_NAMESPACE +#endif + +class QVariant; +class QThreadData; +class QObjectConnectionListVector; + +class QObjectPrivate : public QObjectData +{ + Q_DECLARE_PUBLIC(QObject) + +public: + QObjectPrivate() {} + virtual ~QObjectPrivate() {} + + // preserve binary compatibility with code compiled without Qt 3 support + QList pendingChildInsertedEvents; // unused + + // id of the thread that owns the object + QThreadData *threadData; + void moveToThread_helper(); + void setThreadData_helper(QThreadData *currentData, QThreadData *targetData); + void _q_reregisterTimers(void *pointer); + + struct Sender + { + QObject *sender; + int signal; + int ref; + }; + + Sender *currentSender; // object currently activating the object + QObject *currentChildBeingDeleted; + + QList > eventFilters; + + struct ExtraData + { +#ifndef QT_NO_USERDATA + QVector userData; +#endif + QList propertyNames; + QList propertyValues; + }; + ExtraData *extraData; + mutable quint32 connectedSignals; + + QString objectName; + + // Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions + struct Connection + { + QObject *receiver; + int method; + uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking + QBasicAtomicPointer argumentTypes; + }; + typedef QList ConnectionList; + + QObjectConnectionListVector *connectionLists; + QList senders; + int *deleteWatch; + + static QObjectPrivate *get(QObject *o) { return o->d_func(); } +}; + +#if defined(QT_BEGIN_NAMESPACE) +QT_END_NAMESPACE +#endif + +#endif // PRIVATE_OBJECT_ALLOWED + + +// this can be mangled typenames of nested templates, each char-by-char +// comma-separated integer list +static char qDumpInBuffer[10000]; +static char qDumpBuffer[1000]; + +namespace { + +static bool isPointerType(const QByteArray &type) +{ + return type.endsWith("*") || type.endsWith("* const"); +} + +static QByteArray stripPointerType(QByteArray type) +{ + if (type.endsWith("*")) + type.chop(1); + if (type.endsWith("* const")) + type.chop(7); + if (type.endsWith(' ')) + type.chop(1); + return type; +} + +// This is used to abort evaluation of custom data dumpers in a "coordinated" +// way. Abortion will happen anyway when we try to access a non-initialized +// non-trivial object, so there is no way to prevent this from occuring at all +// conceptionally. Gdb will catch SIGSEGV and return to the calling frame. +// This is just fine provided we only _read_ memory in the custom handlers +// below. + +volatile int qProvokeSegFaultHelper; + +static const void *addOffset(const void *p, int offset) +{ + return offset + reinterpret_cast(p); +} + +static const void *skipvtable(const void *p) +{ + return sizeof(void*) + reinterpret_cast(p); +} + +static const void *deref(const void *p) +{ + return *reinterpret_cast(p); +} + +static const void *dfunc(const void *p) +{ + return deref(skipvtable(p)); +} + +static bool isEqual(const char *s, const char *t) +{ + return qstrcmp(s, t) == 0; +} + +static bool startsWith(const char *s, const char *t) +{ + return qstrncmp(s, t, strlen(t)) == 0; +} + +// provoke segfault when address is not readable +#define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0) +#define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0) +// provoke segfault unconditionally +#define qCheck(b) do { if (!b) qProvokeSegFaultHelper = *(char*)0; } while (0) + +const char *stripNamespace(const char *type) +{ + static const size_t nslen = strlen(NS); + return startsWith(type, NS) ? type + nslen : type; +} + +static bool isSimpleType(const char *type) +{ + switch (type[0]) { + case 'c': + return isEqual(type, "char"); + case 'd': + return isEqual(type, "double"); + case 'f': + return isEqual(type, "float"); + case 'i': + return isEqual(type, "int"); + case 'l': + return isEqual(type, "long") || startsWith(type, "long "); + case 's': + return isEqual(type, "short") || isEqual(type, "signed") + || startsWith(type, "signed "); + case 'u': + return isEqual(type, "unsigned") || startsWith(type, "unsigned "); + } + return false; +} + +static bool isShortKey(const char *type) +{ + return isSimpleType(type) || isEqual(type, "QString"); +} + +static bool isMovableType(const char *type) +{ + if (isPointerType(type)) + return true; + + if (isSimpleType(type)) + return true; + + type = stripNamespace(type); + + switch (type[1]) { + case 'B': + return isEqual(type, "QBrush") + || isEqual(type, "QBitArray") + || isEqual(type, "QByteArray") ; + case 'C': + return isEqual(type, "QCustomTypeInfo"); + case 'D': + return isEqual(type, "QDate") + || isEqual(type, "QDateTime"); + case 'F': + return isEqual(type, "QFileInfo") + || isEqual(type, "QFixed") + || isEqual(type, "QFixedPoint") + || isEqual(type, "QFixedSize"); + case 'H': + return isEqual(type, "QHashDummyValue"); + case 'I': + return isEqual(type, "QIcon") + || isEqual(type, "QImage"); + case 'L': + return isEqual(type, "QLine") + || isEqual(type, "QLineF") + || isEqual(type, "QLocal"); + case 'M': + return isEqual(type, "QMatrix") + || isEqual(type, "QModelIndex"); + case 'P': + return isEqual(type, "QPoint") + || isEqual(type, "QPointF") + || isEqual(type, "QPen") + || isEqual(type, "QPersistentModelIndex"); + case 'R': + return isEqual(type, "QResourceRoot") + || isEqual(type, "QRect") + || isEqual(type, "QRectF") + || isEqual(type, "QRegExp"); + case 'S': + return isEqual(type, "QSize") + || isEqual(type, "QSizeF") + || isEqual(type, "QString"); + case 'T': + return isEqual(type, "QTime") + || isEqual(type, "QTextBlock"); + case 'U': + return isEqual(type, "QUrl"); + case 'V': + return isEqual(type, "QVariant"); + case 'X': + return isEqual(type, "QXmlStreamAttribute") + || isEqual(type, "QXmlStreamNamespaceDeclaration") + || isEqual(type, "QXmlStreamNotationDeclaration") + || isEqual(type, "QXmlStreamEntityDeclaration"); + } + return false; +} + +struct QDumper +{ + explicit QDumper(); + ~QDumper(); + void flush(); + void checkFill(); + QDumper &operator<<(long c); + QDumper &operator<<(int i); + QDumper &operator<<(double d); + QDumper &operator<<(float d); + QDumper &operator<<(unsigned long c); + QDumper &operator<<(unsigned int i); + QDumper &operator<<(const void *p); + QDumper &operator<<(qulonglong c); + void put(char c); + void addCommaIfNeeded(); + void putBase64Encoded(const char *buf, int n); + QDumper &operator<<(const char *str); + QDumper &operator<<(const QByteArray &ba); + QDumper &operator<<(const QString &str); + void disarm(); + + void beginHash(); // start of data hash output + void endHash(); // start of data hash output + + void write(const void *buf, int len); // raw write to stdout + + // the dumper arguments + int protocolVersion; // dumper protocol version + int token; // some token to show on success + const char *outertype; // object type + const char *iname; // object name used for display + const char *exp; // object expression + const char *innertype; // 'inner type' for class templates + const void *data; // pointer to raw data + bool dumpChildren; // do we want to see children? + + // handling of nested templates + void setupTemplateParameters(); + enum { maxTemplateParameters = 10 }; + const char *templateParameters[maxTemplateParameters + 1]; + int templateParametersCount; + + // internal state + bool success; // are we finished? + int pos; + + int extraInt[4]; +}; + + +QDumper::QDumper() +{ + success = false; + pos = 0; +} + +QDumper::~QDumper() +{ + flush(); + + char buf[30]; + int len = qsnprintf(buf, sizeof(buf) - 1, "%d^done\n", token); + write(buf, len); +} + +void QDumper::write(const void *buf, int len) +{ + ::fwrite(buf, len, 1, stdout); + ::fflush(stdout); +} + +void QDumper::flush() +{ + if (pos != 0) { + char buf[30]; + int len = qsnprintf(buf, sizeof(buf) - 1, "%d#%d,", token, pos); + write(buf, len); + write(qDumpBuffer, pos); + write("\n", 1); + pos = 0; + } +} + +void QDumper::setupTemplateParameters() +{ + char *s = const_cast(innertype); + + templateParametersCount = 1; + templateParameters[0] = s; + for (int i = 1; i != maxTemplateParameters + 1; ++i) + templateParameters[i] = 0; + + while (*s) { + while (*s && *s != '@') + ++s; + if (*s) { + *s = '\0'; + ++s; + templateParameters[templateParametersCount++] = s; + } + } +} + +QDumper &QDumper::operator<<(unsigned long long c) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%llu", c); + return *this; +} + +QDumper &QDumper::operator<<(unsigned long c) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%lu", c); + return *this; +} + +QDumper &QDumper::operator<<(float d) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%f", d); + return *this; +} + +QDumper &QDumper::operator<<(double d) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%f", d); + return *this; +} + +QDumper &QDumper::operator<<(unsigned int i) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%u", i); + return *this; +} + +QDumper &QDumper::operator<<(long c) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%ld", c); + return *this; +} + +QDumper &QDumper::operator<<(int i) +{ + checkFill(); + pos += sprintf(qDumpBuffer + pos, "%d", i); + return *this; +} + +QDumper &QDumper::operator<<(const void *p) +{ + static char buf[100]; + if (p) { + sprintf(buf, "%p", p); + // we get a '0x' prefix only on some implementations. + // if it isn't there, write it out manually. + if (buf[1] != 'x') { + put('0'); + put('x'); + } + *this << buf; + } else { + *this << ""; + } + return *this; +} + +void QDumper::checkFill() +{ + if (pos >= int(sizeof(qDumpBuffer)) - 100) + flush(); +} + +void QDumper::put(char c) +{ + checkFill(); + qDumpBuffer[pos++] = c; +} + +void QDumper::addCommaIfNeeded() +{ + if (pos == 0) + return; + char c = qDumpBuffer[pos - 1]; + if (c == '}' || c == '"' || c == ']') + put(','); +} + +void QDumper::putBase64Encoded(const char *buf, int n) +{ + const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef" + "ghijklmn" "opqrstuv" "wxyz0123" "456789+/"; + const char padchar = '='; + int padlen = 0; + + //int tmpsize = ((n * 4) / 3) + 3; + + int i = 0; + while (i < n) { + int chunk = 0; + chunk |= int(uchar(buf[i++])) << 16; + if (i == n) { + padlen = 2; + } else { + chunk |= int(uchar(buf[i++])) << 8; + if (i == n) + padlen = 1; + else + chunk |= int(uchar(buf[i++])); + } + + int j = (chunk & 0x00fc0000) >> 18; + int k = (chunk & 0x0003f000) >> 12; + int l = (chunk & 0x00000fc0) >> 6; + int m = (chunk & 0x0000003f); + put(alphabet[j]); + put(alphabet[k]); + put(padlen > 1 ? padchar : alphabet[l]); + put(padlen > 0 ? padchar : alphabet[m]); + } +} + +QDumper &QDumper::operator<<(const char *str) +{ + if (!str) + return *this << ""; + while (*str) + put(*(str++)); + return *this; +} + +QDumper &QDumper::operator<<(const QByteArray &ba) +{ + putBase64Encoded(ba.constData(), ba.size()); + return *this; +} + +QDumper &QDumper::operator<<(const QString &str) +{ + QByteArray ba = str.toUtf8(); + putBase64Encoded(ba.constData(), ba.size()); + return *this; +} + +void QDumper::disarm() +{ + flush(); + success = true; +} + +void QDumper::beginHash() +{ + addCommaIfNeeded(); + put('{'); +} + +void QDumper::endHash() +{ + put('}'); +} + + +// +// Some helpers to keep the dumper code short +// + +// dump property=value pair +#undef P +#define P(dumper,name,value) \ + do { \ + dumper.addCommaIfNeeded(); \ + dumper << (name) << "=\"" << value << "\""; \ + } while (0) + +// simple string property +#undef S +#define S(dumper, name, value) \ + dumper.beginHash(); \ + P(dumper, "name", name); \ + P(dumper, "value", value); \ + P(dumper, "type", NS"QString"); \ + P(dumper, "numchild", "0"); \ + P(dumper, "valueencoded", "1"); \ + dumper.endHash(); + +// simple integer property +#undef I +#define I(dumper, name, value) \ + dumper.beginHash(); \ + P(dumper, "name", name); \ + P(dumper, "value", value); \ + P(dumper, "type", "int"); \ + P(dumper, "numchild", "0"); \ + dumper.endHash(); + +// simple boolean property +#undef BL +#define BL(dumper, name, value) \ + dumper.beginHash(); \ + P(dumper, "name", name); \ + P(dumper, "value", (value ? "true" : "false")); \ + P(dumper, "type", "bool"); \ + P(dumper, "numchild", "0"); \ + dumper.endHash(); + + +// a single QChar +#undef QC +#define QC(dumper, name, value) \ + dumper.beginHash(); \ + P(dumper, "name", name); \ + P(dumper, "value", QString(QLatin1String("'%1' (%2, 0x%3)")) \ + .arg(value).arg(value.unicode()).arg(value.unicode(), 0, 16)); \ + P(dumper, "valueencoded", "1"); \ + P(dumper, "type", NS"QChar"); \ + P(dumper, "numchild", "0"); \ + dumper.endHash(); + +#undef TT +#define TT(type, value) \ + "" << type << " : " << value << "" + +static void qDumpUnknown(QDumper &d) +{ + P(d, "iname", d.iname); + P(d, "addr", d.data); + P(d, "value", ""); + P(d, "type", d.outertype); + P(d, "numchild", "0"); + d.disarm(); +} + +static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr, + const char *key = "value") +{ + type = stripNamespace(type); + switch (type[1]) { + case 'l': + if (isEqual(type, "float")) + P(d, key, *(float*)addr); + return; + case 'n': + if (isEqual(type, "int")) + P(d, key, *(int*)addr); + else if (isEqual(type, "unsigned")) + P(d, key, *(unsigned int*)addr); + else if (isEqual(type, "unsigned int")) + P(d, key, *(unsigned int*)addr); + else if (isEqual(type, "unsigned long")) + P(d, key, *(unsigned long*)addr); + else if (isEqual(type, "unsigned long long")) + P(d, key, *(qulonglong*)addr); + return; + case 'o': + if (isEqual(type, "bool")) + switch (*(bool*)addr) { + case 0: P(d, key, "false"); break; + case 1: P(d, key, "true"); break; + default: P(d, key, *(bool*)addr); break; + } + else if (isEqual(type, "double")) + P(d, key, *(double*)addr); + else if (isEqual(type, "long")) + P(d, key, *(long*)addr); + else if (isEqual(type, "long long")) + P(d, key, *(qulonglong*)addr); + return; + case 'B': + if (isEqual(type, "QByteArray")) { + d << key << "encoded=\"1\","; + P(d, key, *(QByteArray*)addr); + } + return; + case 'L': + if (startsWith(type, "QList<")) { + const QListData *ldata = reinterpret_cast(addr); + P(d, "value", "<" << ldata->size() << " items>"); + P(d, "valuedisabled", "true"); + P(d, "numchild", ldata->size()); + } + return; + case 'O': + if (isEqual(type, "QObject *")) { + if (addr) { + const QObject *ob = reinterpret_cast(addr); + P(d, "addr", ob); + P(d, "value", ob->objectName()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QObject"); + P(d, "displayedtype", ob->metaObject()->className()); + } else { + P(d, "value", "0x0"); + P(d, "type", NS"QObject *"); + } + } + return; + case 'S': + if (isEqual(type, "QString")) { + d << key << "encoded=\"1\","; + P(d, key, *(QString*)addr); + } + return; + default: + return; + } +} + +static void qDumpInnerValue(QDumper &d, const char *type, const void *addr) +{ + P(d, "addr", addr); + P(d, "type", type); + + if (!type[0]) + return; + + qDumpInnerValueHelper(d, type, addr); +} + + +////////////////////////////////////////////////////////////////////////////// + +static void qDumpQByteArray(QDumper &d) +{ + const QByteArray &ba = *reinterpret_cast(d.data); + + if (!ba.isEmpty()) { + qCheckAccess(ba.constData()); + qCheckAccess(ba.constData() + ba.size()); + } + + if (ba.size() <= 100) + P(d, "value", ba); + else + P(d, "value", ba.left(100) << " "); + P(d, "valueencoded", "1"); + P(d, "type", NS"QByteArray"); + P(d, "numchild", ba.size()); + P(d, "childtype", "char"); + P(d, "childnumchild", "0"); + if (d.dumpChildren) { + d << ",children=["; + char buf[20]; + for (int i = 0; i != ba.size(); ++i) { + unsigned char c = ba.at(i); + unsigned char u = isprint(c) && c != '"' ? c : '?'; + sprintf(buf, "%02x (%u '%c')", c, c, u); + d.beginHash(); + P(d, "name", "[" << i << "]"); + P(d, "value", buf); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpQDateTime(QDumper &d) +{ +#ifdef QT_NO_DATESTRING + qDumpUnknown(d); +#else + const QDateTime &date = *reinterpret_cast(d.data); + if (date.isNull()) { + P(d, "value", "(null)"); + } else { + P(d, "value", date.toString()); + P(d, "valueencoded", "1"); + } + P(d, "type", NS"QDateTime"); + P(d, "numchild", "3"); + if (d.dumpChildren) { + d << ",children=["; + BL(d, "isNull", date.isNull()); + I(d, "toTime_t", (long)date.toTime_t()); + S(d, "toString", date.toString()); + S(d, "toString_(ISO)", date.toString(Qt::ISODate)); + S(d, "toString_(SystemLocale)", date.toString(Qt::SystemLocaleDate)); + S(d, "toString_(Locale)", date.toString(Qt::LocaleDate)); + S(d, "toString", date.toString()); + + #if 0 + d.beginHash(); + P(d, "name", "toUTC"); + P(d, "exp", "(("NSX"QDateTime"NSY"*)" << d.data << ")" + "->toTimeSpec('"NS"Qt::UTC')"); + P(d, "type", NS"QDateTime"); + P(d, "numchild", "1"); + d.endHash(); + #endif + + #if 0 + d.beginHash(); + P(d, "name", "toLocalTime"); + P(d, "exp", "(("NSX"QDateTime"NSY"*)" << d.data << ")" + "->toTimeSpec('"NS"Qt::LocalTime')"); + P(d, "type", NS"QDateTime"); + P(d, "numchild", "1"); + d.endHash(); + #endif + + d << "]"; + } + d.disarm(); +#endif // ifdef QT_NO_DATESTRING +} + +static void qDumpQDir(QDumper &d) +{ + const QDir &dir = *reinterpret_cast(d.data); + P(d, "value", dir.path()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QDir"); + P(d, "numchild", "3"); + if (d.dumpChildren) { + d << ",children=["; + S(d, "absolutePath", dir.absolutePath()); + S(d, "canonicalPath", dir.canonicalPath()); + d << "]"; + } + d.disarm(); +} + +static void qDumpQFile(QDumper &d) +{ + const QFile &file = *reinterpret_cast(d.data); + P(d, "value", file.fileName()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QFile"); + P(d, "numchild", "2"); + if (d.dumpChildren) { + d << ",children=["; + S(d, "fileName", file.fileName()); + BL(d, "exists", file.exists()); + d << "]"; + } + d.disarm(); +} + +static void qDumpQFileInfo(QDumper &d) +{ + const QFileInfo &info = *reinterpret_cast(d.data); + P(d, "value", info.filePath()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QFileInfo"); + P(d, "numchild", "3"); + if (d.dumpChildren) { + d << ",children=["; + S(d, "absolutePath", info.absolutePath()); + S(d, "absoluteFilePath", info.absoluteFilePath()); + S(d, "canonicalPath", info.canonicalPath()); + S(d, "canonicalFilePath", info.canonicalFilePath()); + S(d, "completeBaseName", info.completeBaseName()); + S(d, "completeSuffix", info.completeSuffix()); + S(d, "baseName", info.baseName()); +#ifdef Q_OS_MACX + BL(d, "isBundle", info.isBundle()); + S(d, "bundleName", info.bundleName()); +#endif + S(d, "completeSuffix", info.completeSuffix()); + S(d, "fileName", info.fileName()); + S(d, "filePath", info.filePath()); + S(d, "group", info.group()); + S(d, "owner", info.owner()); + S(d, "path", info.path()); + + I(d, "groupid", (long)info.groupId()); + I(d, "ownerid", (long)info.ownerId()); + //QFile::Permissions permissions () const + I(d, "permissions", info.permissions()); + + //QDir absoluteDir () const + //QDir dir () const + + BL(d, "caching", info.caching()); + BL(d, "exists", info.exists()); + BL(d, "isAbsolute", info.isAbsolute()); + BL(d, "isDir", info.isDir()); + BL(d, "isExecutable", info.isExecutable()); + BL(d, "isFile", info.isFile()); + BL(d, "isHidden", info.isHidden()); + BL(d, "isReadable", info.isReadable()); + BL(d, "isRelative", info.isRelative()); + BL(d, "isRoot", info.isRoot()); + BL(d, "isSymLink", info.isSymLink()); + BL(d, "isWritable", info.isWritable()); + + d.beginHash(); + P(d, "name", "created"); + P(d, "value", info.created().toString()); + P(d, "valueencoded", "1"); + P(d, "exp", "(("NSX"QFileInfo"NSY"*)" << d.data << ")->created()"); + P(d, "type", NS"QDateTime"); + P(d, "numchild", "1"); + d.endHash(); + + d.beginHash(); + P(d, "name", "lastModified"); + P(d, "value", info.lastModified().toString()); + P(d, "valueencoded", "1"); + P(d, "exp", "(("NSX"QFileInfo"NSY"*)" << d.data << ")->lastModified()"); + P(d, "type", NS"QDateTime"); + P(d, "numchild", "1"); + d.endHash(); + + d.beginHash(); + P(d, "name", "lastRead"); + P(d, "value", info.lastRead().toString()); + P(d, "valueencoded", "1"); + P(d, "exp", "(("NSX"QFileInfo"NSY"*)" << d.data << ")->lastRead()"); + P(d, "type", NS"QDateTime"); + P(d, "numchild", "1"); + d.endHash(); + + d << "]"; + } + d.disarm(); +} + +bool isOptimizedIntKey(const char *keyType) +{ + return isEqual(keyType, "int") +#if defined(Q_BYTE_ORDER) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN + || isEqual(keyType, "short") + || isEqual(keyType, "ushort") +#endif + || isEqual(keyType, "uint"); +} + +int hashOffset(bool optimizedIntKey, bool forKey, unsigned keySize, unsigned valueSize) +{ + // int-key optimization, small value + struct NodeOS { void *next; uint k; uint v; } nodeOS; + // int-key optimiatzion, large value + struct NodeOL { void *next; uint k; void *v; } nodeOL; + // no optimization, small value + struct NodeNS { void *next; uint h; uint k; uint v; } nodeNS; + // no optimization, large value + struct NodeNL { void *next; uint h; uint k; void *v; } nodeNL; + // complex key + struct NodeL { void *next; uint h; void *k; void *v; } nodeL; + + if (forKey) { + // offsetof(...,...) not yet in Standard C++ + const ulong nodeOSk ( (char *)&nodeOS.k - (char *)&nodeOS ); + const ulong nodeOLk ( (char *)&nodeOL.k - (char *)&nodeOL ); + const ulong nodeNSk ( (char *)&nodeNS.k - (char *)&nodeNS ); + const ulong nodeNLk ( (char *)&nodeNL.k - (char *)&nodeNL ); + const ulong nodeLk ( (char *)&nodeL.k - (char *)&nodeL ); + if (optimizedIntKey) + return valueSize > sizeof(int) ? nodeOLk : nodeOSk; + if (keySize > sizeof(int)) + return nodeLk; + return valueSize > sizeof(int) ? nodeNLk : nodeNSk; + } else { + const ulong nodeOSv ( (char *)&nodeOS.v - (char *)&nodeOS ); + const ulong nodeOLv ( (char *)&nodeOL.v - (char *)&nodeOL ); + const ulong nodeNSv ( (char *)&nodeNS.v - (char *)&nodeNS ); + const ulong nodeNLv ( (char *)&nodeNL.v - (char *)&nodeNL ); + const ulong nodeLv ( (char *)&nodeL.v - (char *)&nodeL ); + if (optimizedIntKey) + return valueSize > sizeof(int) ? nodeOLv : nodeOSv; + if (keySize > sizeof(int)) + return nodeLv; + return valueSize > sizeof(int) ? nodeNLv : nodeNSv; + } +} + + +static void qDumpQHash(QDumper &d) +{ + QHashData *h = *reinterpret_cast(d.data); + const char *keyType = d.templateParameters[0]; + const char *valueType = d.templateParameters[1]; + + qCheckPointer(h->fakeNext); + qCheckPointer(h->buckets); + + unsigned keySize = d.extraInt[0]; + unsigned valueSize = d.extraInt[1]; + + int n = h->size; + + if (n < 0) + qCheck(false); + if (n > 0) { + qCheckPointer(h->fakeNext); + qCheckPointer(*h->buckets); + } + + P(d, "value", "<" << n << " items>"); + P(d, "numchild", n); + if (d.dumpChildren) { + if (n > 1000) + n = 1000; + bool simpleKey = isShortKey(keyType); + bool simpleValue = isShortKey(valueType); + bool opt = isOptimizedIntKey(keyType); + int keyOffset = hashOffset(opt, true, keySize, valueSize); + int valueOffset = hashOffset(opt, false, keySize, valueSize); + + P(d, "extra", "simplekey: " << simpleKey << " simpleValue: " << simpleValue + << " keySize: " << keyOffset << " valueOffset: " << valueOffset + << " opt: " << opt); + + QHashData::Node *node = h->firstNode(); + QHashData::Node *end = reinterpret_cast(h); + int i = 0; + + d << ",children=["; + while (node != end) { + d.beginHash(); + if (simpleKey) { + qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "name"); + P(d, "nameisindex", "1"); + if (simpleValue) + qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset)); + P(d, "type", valueType); + P(d, "addr", addOffset(node, valueOffset)); + } else { + P(d, "name", "[" << i << "]"); + //P(d, "exp", "*(char*)" << node); + P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node); + P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'"); + } + d.endHash(); + ++i; + node = QHashData::nextNode(node); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpQHashNode(QDumper &d) +{ + const QHashData *h = reinterpret_cast(d.data); + const char *keyType = d.templateParameters[0]; + const char *valueType = d.templateParameters[1]; + + P(d, "value", ""); + P(d, "numchild", 2); + if (d.dumpChildren) { + unsigned keySize = d.extraInt[0]; + unsigned valueSize = d.extraInt[1]; + bool opt = isOptimizedIntKey(keyType); + int keyOffset = hashOffset(opt, true, keySize, valueSize); + int valueOffset = hashOffset(opt, false, keySize, valueSize); + + // there is a hash specialization in cast the key are integers or shorts + d << ",children=["; + d.beginHash(); + P(d, "name", "key"); + P(d, "type", keyType); + P(d, "addr", addOffset(h, keyOffset)); + d.endHash(); + d.beginHash(); + P(d, "name", "value"); + P(d, "type", valueType); + P(d, "addr", addOffset(h, valueOffset)); + d.endHash(); + d << "]"; + } + d.disarm(); +} + +static void qDumpQImage(QDumper &d) +{ +#ifdef QT_GUI_LIB + const QImage &im = *reinterpret_cast(d.data); + P(d, "value", "(" << im.width() << "x" << im.height() << ")"); + P(d, "type", NS"QImage"); + P(d, "numchild", "0"); + d.disarm(); +#else + Q_UNUSED(d); +#endif +} + +static void qDumpQList(QDumper &d) +{ + // This uses the knowledge that QList has only a single member + // of type union { QListData p; QListData::Data *d; }; + const QListData &ldata = *reinterpret_cast(d.data); + const QListData::Data *pdata = + *reinterpret_cast(d.data); + int nn = ldata.size(); + if (nn < 0) + qCheck(false); + if (nn > 0) { + qCheckAccess(ldata.d->array); + //qCheckAccess(ldata.d->array[0]); + //qCheckAccess(ldata.d->array[nn - 1]); +#if QT_VERSION >= 0x040400 + if (ldata.d->ref._q_value <= 0) + qCheck(false); +#endif + } + + int n = nn; + P(d, "value", "<" << n << " items>"); + P(d, "valuedisabled", "true"); + P(d, "numchild", n); + P(d, "childtype", d.innertype); + if (d.dumpChildren) { + unsigned innerSize = d.extraInt[0]; + bool innerTypeIsPointer = isPointerType(d.innertype); + QByteArray strippedInnerType = stripPointerType(d.innertype); + + // The exact condition here is: + // QTypeInfo::isLarge || QTypeInfo::isStatic + // but this data is available neither in the compiled binary nor + // in the frontend. + // So as first approximation only do the 'isLarge' check: + bool isInternal = innerSize <= int(sizeof(void*)) + && isMovableType(d.innertype); + + P(d, "internal", (int)isInternal); + + P(d, "childtype", d.innertype); + if (n > 1000) + n = 1000; + d << ",children=["; + for (int i = 0; i != n; ++i) { + d.beginHash(); + P(d, "name", "[" << i << "]"); + if (innerTypeIsPointer) { + void *p = ldata.d->array + i + pdata->begin; + if (p) { + //P(d, "value","@" << p); + qDumpInnerValue(d, strippedInnerType.data(), deref(p)); + } else { + P(d, "value", ""); + P(d, "numchild", "0"); + } + } else { + void *p = ldata.d->array + i + pdata->begin; + if (isInternal) { + //qDumpInnerValue(d, d.innertype, p); + P(d, "addr", p); + qDumpInnerValueHelper(d, d.innertype, p); + } else { + //qDumpInnerValue(d, d.innertype, deref(p)); + P(d, "addr", deref(p)); + qDumpInnerValueHelper(d, d.innertype, deref(p)); + } + } + d.endHash(); + } + if (n < nn) { + d.beginHash(); + P(d, "value", ""); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpQLocale(QDumper &d) +{ + const QLocale &locale = *reinterpret_cast(d.data); + P(d, "value", locale.name()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QLocale"); + P(d, "numchild", "8"); + if (d.dumpChildren) { + d << ",children=["; + + d.beginHash(); + P(d, "name", "country"); + P(d, "exp", "(("NSX"QLocale"NSY"*)" << d.data << ")->country()"); + d.endHash(); + + d.beginHash(); + P(d, "name", "language"); + P(d, "exp", "(("NSX"QLocale"NSY"*)" << d.data << ")->language()"); + d.endHash(); + + d.beginHash(); + P(d, "name", "measurementSystem"); + P(d, "exp", "(("NSX"QLocale"NSY"*)" << d.data << ")->measurementSystem()"); + d.endHash(); + + d.beginHash(); + P(d, "name", "numberOptions"); + P(d, "exp", "(("NSX"QLocale"NSY"*)" << d.data << ")->numberOptions()"); + d.endHash(); + + S(d, "timeFormat_(short)", locale.timeFormat(QLocale::ShortFormat)); + S(d, "timeFormat_(long)", locale.timeFormat(QLocale::LongFormat)); + + QC(d, "decimalPoint", locale.decimalPoint()); + QC(d, "exponential", locale.exponential()); + QC(d, "percent", locale.percent()); + QC(d, "zeroDigit", locale.zeroDigit()); + QC(d, "groupSeparator", locale.groupSeparator()); + QC(d, "negativeSign", locale.negativeSign()); + + d << "]"; + } + d.disarm(); +} + +static void qDumpQMap(QDumper &d) +{ + QMapData *h = *reinterpret_cast(d.data); + const char *keyType = d.templateParameters[0]; + const char *valueType = d.templateParameters[1]; + + int n = h->size; + + if (n < 0) + qCheck(false); + if (n > 0) { + qCheckAccess(h->backward); + qCheckAccess(h->forward[0]); + qCheckPointer(h->backward->backward); + qCheckPointer(h->forward[0]->backward); + } + + P(d, "value", "<" << n << " items>"); + P(d, "numchild", n); + if (d.dumpChildren) { + if (n > 1000) + n = 1000; + + //unsigned keySize = d.extraInt[0]; + //unsigned valueSize = d.extraInt[1]; + unsigned mapnodesize = d.extraInt[2]; + unsigned valueOff = d.extraInt[3]; + + bool simpleKey = isShortKey(keyType); + bool simpleValue = isShortKey(valueType); + // both negative: + int keyOffset = 2 * sizeof(void*) - int(mapnodesize); + int valueOffset = 2 * sizeof(void*) - int(mapnodesize) + valueOff; + + P(d, "extra", "simplekey: " << simpleKey << " simpleValue: " << simpleValue + << " keyOffset: " << keyOffset << " valueOffset: " << valueOffset + << " mapnodesize: " << mapnodesize); + d << ",children=["; + + QMapData::Node *node = reinterpret_cast(h->forward[0]); + QMapData::Node *end = reinterpret_cast(h); + int i = 0; + + while (node != end) { + d.beginHash(); + if (simpleKey) { + P(d, "type", valueType); + qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "name"); + + P(d, "nameisindex", "1"); + if (simpleValue) + qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset)); + + P(d, "type", valueType); + P(d, "addr", addOffset(node, valueOffset)); + } else { + P(d, "name", "[" << i << "]"); + P(d, "type", NS"QMapNode<" << keyType << "," << valueType << " >"); + // actually, any type (even 'char') will do... + P(d, "exp", "*('"NS"QMapNode<" << keyType << "," << valueType << " >'*)" << node); + //P(d, "exp", "*('"NS"QMapData'*)" << (void*)node); + //P(d, "exp", "*(char*)" << (void*)node); + + // P(d, "addr", node); does not work as gdb fails to parse + // e.g. &((*('"NS"QMapNode'*)0x616658)) + } + d.endHash(); + + ++i; + node = node->forward[0]; + } + d << "]"; + } + + d.disarm(); +} + +static void qDumpQModelIndex(QDumper &d) +{ + const QModelIndex *mi = reinterpret_cast(d.data); + + P(d, "type", NS"QModelIndex"); + if (mi->isValid()) { + P(d, "value", "(" << mi->row() << ", " << mi->column() << ")"); + P(d, "numchild", 5); + if (d.dumpChildren) { + d << ",children=["; + I(d, "row", mi->row()); + I(d, "column", mi->column()); + + d.beginHash(); + P(d, "name", "parent"); + const QModelIndex parent = mi->parent(); + if (parent.isValid()) + P(d, "value", "(" << mi->row() << ", " << mi->column() << ")"); + else + P(d, "value", ""); + P(d, "exp", "(("NSX"QModelIndex"NSY"*)" << d.data << ")->parent()"); + P(d, "type", NS"QModelIndex"); + P(d, "numchild", "1"); + d.endHash(); + + S(d, "internalId", QString::number(mi->internalId(), 10)); + + d.beginHash(); + P(d, "name", "model"); + P(d, "value", static_cast(mi->model())); + P(d, "type", NS"QAbstractItemModel*"); + P(d, "numchild", "1"); + d.endHash(); + + d << "]"; + } + } else { + P(d, "value", ""); + P(d, "numchild", 0); + } + + d.disarm(); +} + +static void qDumpQMapNode(QDumper &d) +{ + const QMapData *h = reinterpret_cast(d.data); + const char *keyType = d.templateParameters[0]; + const char *valueType = d.templateParameters[1]; + + qCheckAccess(h->backward); + qCheckAccess(h->forward[0]); + + P(d, "value", ""); + P(d, "numchild", 2); + if (d.dumpChildren) { + //unsigned keySize = d.extraInt[0]; + //unsigned valueSize = d.extraInt[1]; + unsigned mapnodesize = d.extraInt[2]; + unsigned valueOff = d.extraInt[3]; + + unsigned keyOffset = 2 * sizeof(void*) - mapnodesize; + unsigned valueOffset = 2 * sizeof(void*) - mapnodesize + valueOff; + + d << ",children=["; + d.beginHash(); + P(d, "name", "key"); + qDumpInnerValue(d, keyType, addOffset(h, keyOffset)); + + d.endHash(); + d.beginHash(); + P(d, "name", "value"); + qDumpInnerValue(d, valueType, addOffset(h, valueOffset)); + d.endHash(); + d << "]"; + } + + d.disarm(); +} + +static void qDumpQObject(QDumper &d) +{ + const QObject *ob = reinterpret_cast(d.data); + const QMetaObject *mo = ob->metaObject(); + unsigned childrenOffset = d.extraInt[0]; + P(d, "value", ob->objectName()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QObject"); + P(d, "displayedtype", mo->className()); + P(d, "numchild", 4); + if (d.dumpChildren) { + const QObjectList &children = ob->children(); + int slotCount = 0; + int signalCount = 0; + for (int i = mo->methodCount(); --i >= 0; ) { + QMetaMethod::MethodType mt = mo->method(i).methodType(); + signalCount += (mt == QMetaMethod::Signal); + slotCount += (mt == QMetaMethod::Slot); + } + d << ",children=["; + d.beginHash(); + P(d, "name", "properties"); + // FIXME: Note that when simply using '(QObject*)' + // in the cast below, Gdb/MI _sometimes_ misparses + // expressions further down in the tree. + P(d, "exp", "*(class '"NS"QObject'*)" << d.data); + P(d, "type", NS"QObjectPropertyList"); + P(d, "value", "<" << mo->propertyCount() << " items>"); + P(d, "numchild", mo->propertyCount()); + d.endHash(); +#if 0 + d.beginHash(); + P(d, "name", "methods"); + P(d, "exp", "*(class '"NS"QObject'*)" << d.data); + P(d, "type", NS"QObjectMethodList"); + P(d, "value", "<" << mo->methodCount() << " items>"); + P(d, "numchild", mo->methodCount()); + d.endHash(); +#endif +#if 0 + d.beginHash(); + P(d, "name", "senders"); + P(d, "exp", "(*(class '"NS"QObjectPrivate'*)" << dfunc(ob) << ")->senders"); + P(d, "type", NS"QList<"NS"QObjectPrivateSender>"); + d.endHash(); +#endif +#if PRIVATE_OBJECT_ALLOWED + d.beginHash(); + P(d, "name", "signals"); + P(d, "exp", "*(class '"NS"QObject'*)" << d.data); + P(d, "type", NS"QObjectSignalList"); + P(d, "value", "<" << signalCount << " items>"); + P(d, "numchild", signalCount); + d.endHash(); + d.beginHash(); + P(d, "name", "slots"); + P(d, "exp", "*(class '"NS"QObject'*)" << d.data); + P(d, "type", NS"QObjectSlotList"); + P(d, "value", "<" << slotCount << " items>"); + P(d, "numchild", slotCount); + d.endHash(); +#endif + d.beginHash(); + P(d, "name", "children"); + // works always, but causes additional traffic on the list + //P(d, "exp", "((class '"NS"QObject'*)" << d.data << ")->children()"); + // + //P(d, "addr", addOffset(dfunc(ob), childrenOffset)); + //P(d, "type", NS"QList"); + //P(d, "value", "<" << children.size() << " items>"); + qDumpInnerValue(d, NS"QList<"NS"QObject *>", + addOffset(dfunc(ob), childrenOffset)); + P(d, "numchild", children.size()); + d.endHash(); +#if 0 + // Unneeded (and not working): Connections are listes as childen + // of the signal or slot they are connected to. + // d.beginHash(); + // P(d, "name", "connections"); + // P(d, "exp", "*(*(class "NS"QObjectPrivate*)" << dfunc(ob) << ")->connectionLists"); + // P(d, "type", NS"QVector<"NS"QList<"NS"QObjectPrivate::Connection> >"); + // d.endHash(); +#endif +#if 0 + d.beginHash(); + P(d, "name", "objectprivate"); + P(d, "type", NS"QObjectPrivate"); + P(d, "addr", dfunc(ob)); + P(d, "value", ""); + P(d, "numchild", "1"); + d.endHash(); +#endif + d.beginHash(); + P(d, "name", "parent"); + qDumpInnerValueHelper(d, NS"QObject *", ob->parent()); + d.endHash(); +#if 1 + d.beginHash(); + P(d, "name", "className"); + P(d, "value",ob->metaObject()->className()); + P(d, "type", ""); + P(d, "numchild", "0"); + d.endHash(); +#endif + d << "]"; + } + d.disarm(); +} + +static void qDumpQObjectPropertyList(QDumper &d) +{ + const QObject *ob = (const QObject *)d.data; + const QMetaObject *mo = ob->metaObject(); + P(d, "addr", ""); + P(d, "type", NS"QObjectPropertyList"); + P(d, "numchild", mo->propertyCount()); + if (d.dumpChildren) { + d << ",children=["; + for (int i = mo->propertyCount(); --i >= 0; ) { + const QMetaProperty & prop = mo->property(i); + d.beginHash(); + P(d, "name", prop.name()); + P(d, "exp", "((" << mo->className() << "*)" << ob + << ")->" << prop.name() << "()"); + if (isEqual(prop.typeName(), "QString")) { + P(d, "value", prop.read(ob).toString()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QString"); + P(d, "numchild", "0"); + } else if (isEqual(prop.typeName(), "bool")) { + P(d, "value", (prop.read(ob).toBool() ? "true" : "false")); + P(d, "numchild", "0"); + } else if (isEqual(prop.typeName(), "int")) { + P(d, "value", prop.read(ob).toInt()); + P(d, "numchild", "0"); + } + P(d, "type", prop.typeName()); + P(d, "numchild", "1"); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpQObjectMethodList(QDumper &d) +{ + const QObject *ob = (const QObject *)d.data; + const QMetaObject *mo = ob->metaObject(); + P(d, "addr", ""); + P(d, "type", NS"QObjectMethodList"); + P(d, "numchild", mo->methodCount()); + P(d, "childtype", "QMetaMethod::Method"); + P(d, "childnumchild", "0"); + if (d.dumpChildren) { + d << ",children=["; + for (int i = 0; i != mo->methodCount(); ++i) { + const QMetaMethod & method = mo->method(i); + int mt = method.methodType(); + d.beginHash(); + P(d, "name", "[" << i << "] " << mo->indexOfMethod(method.signature()) + << " " << method.signature()); + P(d, "value", (mt == QMetaMethod::Signal ? "" : "") << " (" << mt << ")"); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +#if PRIVATE_OBJECT_ALLOWED +const char * qConnectionTypes[] ={ + "auto", + "direct", + "queued", + "autocompat", + "blockingqueued" +}; + +#if QT_VERSION >= 0x040400 +static const QObjectPrivate::ConnectionList &qConnectionList(const QObject *ob, int signalNumber) +{ + static const QObjectPrivate::ConnectionList emptyList; + const QObjectPrivate *p = reinterpret_cast(dfunc(ob)); + if (!p->connectionLists) + return emptyList; + typedef QVector ConnLists; + const ConnLists *lists = reinterpret_cast(p->connectionLists); + // there's an optimization making the lists only large enough to hold the + // last non-empty item + if (signalNumber >= lists->size()) + return emptyList; + return lists->at(signalNumber); +} +#endif + +static void qDumpQObjectSignal(QDumper &d) +{ + unsigned signalNumber = d.extraInt[0]; + + P(d, "addr", ""); + P(d, "numchild", "1"); + P(d, "type", NS"QObjectSignal"); + +#if QT_VERSION >= 0x040400 + if (d.dumpChildren) { + const QObject *ob = reinterpret_cast(d.data); + d << ",children=["; + const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, signalNumber); + for (int i = 0; i != connList.size(); ++i) { + const QObjectPrivate::Connection &conn = connList.at(i); + d.beginHash(); + P(d, "name", "[" << i << "] receiver"); + qDumpInnerValueHelper(d, NS"QObject *", conn.receiver); + d.endHash(); + d.beginHash(); + P(d, "name", "[" << i << "] slot"); + P(d, "type", ""); + P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); + P(d, "numchild", "0"); + d.endHash(); + d.beginHash(); + P(d, "name", "[" << i << "] type"); + P(d, "type", ""); + P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>"); + P(d, "numchild", "0"); + d.endHash(); + } + d << "]"; + P(d, "numchild", connList.size()); + } +#endif + d.disarm(); +} + +static void qDumpQObjectSignalList(QDumper &d) +{ + const QObject *ob = reinterpret_cast(d.data); + const QMetaObject *mo = ob->metaObject(); + int count = 0; + for (int i = mo->methodCount(); --i >= 0; ) + count += (mo->method(i).methodType() == QMetaMethod::Signal); + P(d, "addr", d.data); + P(d, "numchild", count); +#if QT_VERSION >= 0x040400 + if (d.dumpChildren) { + d << ",children=["; + for (int i = 0; i != mo->methodCount(); ++i) { + const QMetaMethod & method = mo->method(i); + if (method.methodType() == QMetaMethod::Signal) { + int k = mo->indexOfSignal(method.signature()); + const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k); + d.beginHash(); + P(d, "name", "[" << k << "]"); + P(d, "value", method.signature()); + P(d, "numchild", connList.size()); + //P(d, "numchild", "1"); + P(d, "exp", "*(class '"NS"QObject'*)" << d.data); + P(d, "type", NS"QObjectSignal"); + d.endHash(); + } + } + d << "]"; + } +#endif + d.disarm(); +} + +static void qDumpQObjectSlot(QDumper &d) +{ + int slotNumber = d.extraInt[0]; + + P(d, "addr", d.data); + P(d, "numchild", "1"); + P(d, "type", NS"QObjectSlot"); + +#if QT_VERSION >= 0x040400 + if (d.dumpChildren) { + d << ",children=["; + int numchild = 0; + const QObject *ob = reinterpret_cast(d.data); + const QObjectPrivate *p = reinterpret_cast(dfunc(ob)); + for (int s = 0; s != p->senders.size(); ++s) { + const QObjectPrivate::Sender &sender = p->senders.at(s); + const QObjectPrivate::ConnectionList &connList + = qConnectionList(sender.sender, sender.signal); + for (int i = 0; i != connList.size(); ++i) { + const QObjectPrivate::Connection &conn = connList.at(i); + if (conn.receiver == ob && conn.method == slotNumber) { + ++numchild; + const QMetaMethod & method = + sender.sender->metaObject()->method(sender.signal); + d.beginHash(); + P(d, "name", "[" << s << "] sender"); + qDumpInnerValueHelper(d, NS"QObject *", sender.sender); + d.endHash(); + d.beginHash(); + P(d, "name", "[" << s << "] signal"); + P(d, "type", ""); + P(d, "value", method.signature()); + P(d, "numchild", "0"); + d.endHash(); + d.beginHash(); + P(d, "name", "[" << s << "] type"); + P(d, "type", ""); + P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>"); + P(d, "numchild", "0"); + d.endHash(); + } + } + } + d << "]"; + P(d, "numchild", numchild); + } +#endif + d.disarm(); +} + +static void qDumpQObjectSlotList(QDumper &d) +{ + const QObject *ob = reinterpret_cast(d.data); +#if QT_VERSION >= 0x040400 + const QObjectPrivate *p = reinterpret_cast(dfunc(ob)); +#endif + const QMetaObject *mo = ob->metaObject(); + + int count = 0; + for (int i = mo->methodCount(); --i >= 0; ) + count += (mo->method(i).methodType() == QMetaMethod::Slot); + + P(d, "addr", d.data); + P(d, "numchild", count); +#if QT_VERSION >= 0x040400 + if (d.dumpChildren) { + d << ",children=["; + for (int i = 0; i != mo->methodCount(); ++i) { + const QMetaMethod & method = mo->method(i); + if (method.methodType() == QMetaMethod::Slot) { + d.beginHash(); + int k = mo->indexOfSlot(method.signature()); + P(d, "name", "[" << k << "]"); + P(d, "value", method.signature()); + + // count senders. expensive... + int numchild = 0; + for (int s = 0; s != p->senders.size(); ++s) { + const QObjectPrivate::Sender & sender = p->senders.at(s); + const QObjectPrivate::ConnectionList &connList + = qConnectionList(sender.sender, sender.signal); + for (int c = 0; c != connList.size(); ++c) { + const QObjectPrivate::Connection &conn = connList.at(c); + if (conn.receiver == ob && conn.method == k) + ++numchild; + } + } + P(d, "numchild", numchild); + P(d, "exp", "*(class '"NS"QObject'*)" << d.data); + P(d, "type", NS"QObjectSlot"); + d.endHash(); + } + } + d << "]"; + } +#endif + d.disarm(); +} +#endif // PRIVATE_OBJECT_ALLOWED + + +static void qDumpQPixmap(QDumper &d) +{ +#ifdef QT_GUI_LIB + const QPixmap &im = *reinterpret_cast(d.data); + P(d, "value", "(" << im.width() << "x" << im.height() << ")"); + P(d, "type", NS"QPixmap"); + P(d, "numchild", "0"); + d.disarm(); +#else + Q_UNUSED(d); +#endif +} + +static void qDumpQSet(QDumper &d) +{ + // This uses the knowledge that QHash has only a single member + // of union { QHashData *d; QHashNode *e; }; + QHashData *hd = *(QHashData**)d.data; + QHashData::Node *node = hd->firstNode(); + + int n = hd->size; + if (n < 0) + qCheck(false); + if (n > 0) { + qCheckAccess(node); + qCheckPointer(node->next); + } + + P(d, "value", "<" << n << " items>"); + P(d, "valuedisabled", "true"); + P(d, "numchild", 2 * n); + if (d.dumpChildren) { + if (n > 100) + n = 100; + d << ",children=["; + int i = 0; + for (int bucket = 0; bucket != hd->numBuckets; ++bucket) { + for (node = hd->buckets[bucket]; node->next; node = node->next) { + d.beginHash(); + P(d, "name", "[" << i << "]"); + P(d, "type", d.innertype); + P(d, "exp", "(('QHashNode<" << d.innertype + << ",QHashDummyValue>'*)" + << static_cast(node) << ")->key" + ); + d.endHash(); + ++i; + } + } + d << "]"; + } + d.disarm(); +} + +static void qDumpQString(QDumper &d) +{ + const QString &str = *reinterpret_cast(d.data); + + if (!str.isEmpty()) { + qCheckAccess(str.unicode()); + qCheckAccess(str.unicode() + str.size()); + } + + P(d, "value", str); + P(d, "valueencoded", "1"); + P(d, "type", NS"QString"); + //P(d, "editvalue", str); // handled generically below + P(d, "numchild", "0"); + + d.disarm(); +} + +static void qDumpQStringList(QDumper &d) +{ + const QStringList &list = *reinterpret_cast(d.data); + int n = list.size(); + if (n < 0) + qCheck(false); + if (n > 0) { + qCheckAccess(&list.front()); + qCheckAccess(&list.back()); + } + + P(d, "value", "<" << n << " items>"); + P(d, "valuedisabled", "true"); + P(d, "numchild", n); + P(d, "childtype", NS"QString"); + P(d, "childnumchild", "0"); + if (d.dumpChildren) { + if (n > 1000) + n = 1000; + d << ",children=["; + for (int i = 0; i != n; ++i) { + d.beginHash(); + P(d, "name", "[" << i << "]"); + P(d, "value", list[i]); + P(d, "valueencoded", "1"); + d.endHash(); + } + if (n < list.size()) { + d.beginHash(); + P(d, "name", "Warning:"); + P(d, "value", ""); + P(d, "type", ""); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpQTextCodec(QDumper &d) +{ + const QTextCodec &codec = *reinterpret_cast(d.data); + P(d, "value", codec.name()); + P(d, "valueencoded", "1"); + P(d, "type", NS"QTextCodec"); + P(d, "numchild", "2"); + if (d.dumpChildren) { + d << ",children=["; + S(d, "name", codec.name()); + I(d, "mibEnum", codec.mibEnum()); + d << "]"; + } + d.disarm(); +} + +static void qDumpQVariantHelper(const void *data, QString *value, + QString *exp, int *numchild) +{ + const QVariant &v = *reinterpret_cast(data); + switch (v.type()) { + case QVariant::Invalid: + *value = QLatin1String(""); + *numchild = 0; + break; + case QVariant::String: + *value = QLatin1Char('"') + v.toString() + QLatin1Char('"'); + *numchild = 0; + break; + case QVariant::StringList: + *exp = QString(QLatin1String("((QVariant*)%1)->d.data.c")) + .arg((quintptr)data); + *numchild = v.toStringList().size(); + break; + case QVariant::Int: + *value = QString::number(v.toInt()); + *numchild= 0; + break; + case QVariant::Double: + *value = QString::number(v.toDouble()); + *numchild = 0; + break; + default: { + char buf[1000]; + const char *format = (v.typeName()[0] == 'Q') + ? "'"NS"%s "NS"qVariantValue<"NS"%s >'(*('"NS"QVariant'*)%p)" + : "'%s "NS"qVariantValue<%s >'(*('"NS"QVariant'*)%p)"; + qsnprintf(buf, sizeof(buf) - 1, format, v.typeName(), v.typeName(), data); + *exp = QLatin1String(buf); + *numchild = 1; + break; + } + } +} + +static void qDumpQVariant(QDumper &d) +{ + const QVariant &v = *reinterpret_cast(d.data); + QString value; + QString exp; + int numchild = 0; + qDumpQVariantHelper(d.data, &value, &exp, &numchild); + bool isInvalid = (v.typeName() == 0); + if (isInvalid) { + P(d, "value", "(invalid)"); + } else if (value.isEmpty()) { + P(d, "value", "(" << v.typeName() << ") " << qPrintable(value)); + } else { + QByteArray ba; + ba += '('; + ba += v.typeName(); + ba += ") "; + ba += qPrintable(value); + P(d, "value", ba); + P(d, "valueencoded", "1"); + } + P(d, "type", NS"QVariant"); + P(d, "numchild", (isInvalid ? "0" : "1")); + if (d.dumpChildren) { + d << ",children=["; + d.beginHash(); + P(d, "name", "value"); + if (!exp.isEmpty()) + P(d, "exp", qPrintable(exp)); + if (!value.isEmpty()) { + P(d, "value", value); + P(d, "valueencoded", "1"); + } + P(d, "type", v.typeName()); + P(d, "numchild", numchild); + d.endHash(); + d << "]"; + } + d.disarm(); +} + +static void qDumpQVector(QDumper &d) +{ + QVectorData *v = *reinterpret_cast(d.data); + + // Try to provoke segfaults early to prevent the frontend + // from asking for unavailable child details + int nn = v->size; + if (nn < 0) + qCheck(false); + if (nn > 0) { + //qCheckAccess(&vec.front()); + //qCheckAccess(&vec.back()); + } + + unsigned innersize = d.extraInt[0]; + unsigned typeddatasize = d.extraInt[1]; + + int n = nn; + P(d, "value", "<" << n << " items>"); + P(d, "valuedisabled", "true"); + P(d, "numchild", n); + if (d.dumpChildren) { + bool innerTypeIsPointer = isPointerType(d.innertype); + QByteArray strippedInnerType = stripPointerType(d.innertype); + + if (n > 1000) + n = 1000; + d << ",children=["; + for (int i = 0; i != n; ++i) { + d.beginHash(); + P(d, "name", "[" << i << "]"); + const void *p = addOffset(v, i * innersize + typeddatasize); + if (innerTypeIsPointer) { + if (deref(p)) { + //P(d, "value","@" << p); + qDumpInnerValue(d, strippedInnerType.data(), deref(p)); + } else { + P(d, "type", d.innertype); + P(d, "value", ""); + P(d, "numchild", "0"); + } + } else { + qDumpInnerValue(d, d.innertype, p); + } + d.endHash(); + } + if (n < nn) { + d.beginHash(); + P(d, "name", "[...]"); + P(d, "value", ""); + P(d, "type", d.innertype); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpStdString(QDumper &d) +{ + const std::string &str = *reinterpret_cast(d.data); + + if (!str.empty()) { + qCheckAccess(str.c_str()); + qCheckAccess(str.c_str() + str.size() - 1); + } + + d << ",value=\""; + d.putBase64Encoded(str.c_str(), str.size()); + d << "\""; + P(d, "valueencoded", "1"); + P(d, "type", "std::string"); + P(d, "numchild", "0"); + + d.disarm(); +} + +static void qDumpStdWString(QDumper &d) +{ + const std::wstring &str = *reinterpret_cast(d.data); + + if (!str.empty()) { + qCheckAccess(str.c_str()); + qCheckAccess(str.c_str() + str.size() - 1); + } + + d << "value=\""; + d.putBase64Encoded((const char *)str.c_str(), str.size() * sizeof(wchar_t)); + d << "\""; + P(d, "valueencoded", (sizeof(wchar_t) == 2 ? "2" : "3")); + P(d, "type", "std::wstring"); + P(d, "numchild", "0"); + + d.disarm(); +} + +static void qDumpStdVector(QDumper &d) +{ + // Correct type would be something like: + // std::_Vector_base >>::_Vector_impl + struct VectorImpl { + char *start; + char *finish; + char *end_of_storage; + }; + const VectorImpl *v = static_cast(d.data); + + // Try to provoke segfaults early to prevent the frontend + // from asking for unavailable child details + int nn = (v->finish - v->start) / d.extraInt[0]; + if (nn < 0) + qCheck(false); + if (nn > 0) { + qCheckAccess(v->start); + qCheckAccess(v->finish); + qCheckAccess(v->end_of_storage); + } + + int n = nn; + P(d, "value", "<" << n << " items>"); + P(d, "valuedisabled", "true"); + P(d, "numchild", n); + if (d.dumpChildren) { + unsigned innersize = d.extraInt[0]; + bool innerTypeIsPointer = isPointerType(d.innertype); + QByteArray strippedInnerType = stripPointerType(d.innertype); + + if (n > 1000) + n = 1000; + d << ",children=["; + for (int i = 0; i != n; ++i) { + d.beginHash(); + P(d, "name", "[" << i << "]"); + const void *p = addOffset(v->start, i * innersize); + if (innerTypeIsPointer) { + if (deref(p)) { + //P(d, "value","@" << p); + qDumpInnerValue(d, strippedInnerType.data(), deref(p)); + } else { + P(d, "type", d.innertype); + P(d, "value", ""); + P(d, "numchild", "0"); + } + } else { + qDumpInnerValue(d, d.innertype, p); + } + d.endHash(); + } + if (n < nn) { + d.beginHash(); + P(d, "name", "[...]"); + P(d, "value", ""); + P(d, "type", d.innertype); + d.endHash(); + } + d << "]"; + } + d.disarm(); +} + +static void qDumpStdVectorBool(QDumper &d) +{ + // FIXME + return qDumpStdVector(d); +} + +static void handleProtocolVersion2and3(QDumper & d) +{ + if (!d.outertype[0]) { + qDumpUnknown(d); + return; + } + + d.setupTemplateParameters(); + P(d, "iname", d.iname); + P(d, "addr", d.data); + +#ifdef QT_NO_QDATASTREAM + if (d.protocolVersion == 3) { + QVariant::Type type = QVariant::nameToType(d.outertype); + if (type != QVariant::Invalid) { + QVariant v(type, d.data); + QByteArray ba; + QDataStream ds(&ba, QIODevice::WriteOnly); + ds << v; + P(d, "editvalue", ba); + } + } +#endif + + const char *type = stripNamespace(d.outertype); + // type[0] is usally 'Q', so don't use it + switch (type[1]) { + case 'B': + if (isEqual(type, "QByteArray")) + qDumpQByteArray(d); + break; + case 'D': + if (isEqual(type, "QDateTime")) + qDumpQDateTime(d); + else if (isEqual(type, "QDir")) + qDumpQDir(d); + break; + case 'F': + if (isEqual(type, "QFile")) + qDumpQFile(d); + else if (isEqual(type, "QFileInfo")) + qDumpQFileInfo(d); + break; + case 'H': + if (isEqual(type, "QHash")) + qDumpQHash(d); + else if (isEqual(type, "QHashNode")) + qDumpQHashNode(d); + break; + case 'I': + if (isEqual(type, "QImage")) + qDumpQImage(d); + break; + case 'L': + if (isEqual(type, "QList")) + qDumpQList(d); + else if (isEqual(type, "QLocale")) + qDumpQLocale(d); + break; + case 'M': + if (isEqual(type, "QMap")) + qDumpQMap(d); + else if (isEqual(type, "QMapNode")) + qDumpQMapNode(d); + else if (isEqual(type, "QModelIndex")) + qDumpQModelIndex(d); + break; + case 'O': + if (isEqual(type, "QObject")) + qDumpQObject(d); + else if (isEqual(type, "QObjectPropertyList")) + qDumpQObjectPropertyList(d); + else if (isEqual(type, "QObjectMethodList")) + qDumpQObjectMethodList(d); + #if PRIVATE_OBJECT_ALLOWED + else if (isEqual(type, "QObjectSignal")) + qDumpQObjectSignal(d); + else if (isEqual(type, "QObjectSignalList")) + qDumpQObjectSignalList(d); + else if (isEqual(type, "QObjectSlot")) + qDumpQObjectSlot(d); + else if (isEqual(type, "QObjectSlotList")) + qDumpQObjectSlotList(d); + #endif + break; + case 'P': + if (isEqual(type, "QPixmap")) + qDumpQPixmap(d); + break; + case 'S': + if (isEqual(type, "QSet")) + qDumpQSet(d); + else if (isEqual(type, "QString")) + qDumpQString(d); + else if (isEqual(type, "QStringList")) + qDumpQStringList(d); + break; + case 'T': + if (isEqual(type, "QTextCodec")) + qDumpQTextCodec(d); + break; + case 'V': + if (isEqual(type, "QVariant")) + qDumpQVariant(d); + else if (isEqual(type, "QVector")) + qDumpQVector(d); + break; + case 's': + if (isEqual(type, "wstring")) + qDumpStdWString(d); + break; + case 't': + if (isEqual(type, "std::vector")) + qDumpStdVector(d); + else if (isEqual(type, "std::vector::bool")) + qDumpStdVectorBool(d); + else if (isEqual(type, "string")) + qDumpStdString(d); + else if (isEqual(type, "std::string")) + qDumpStdString(d); + else if (isEqual(type, "std::wstring")) + qDumpStdWString(d); + break; + } + + if (!d.success) + qDumpUnknown(d); +} + +} // anonymous namespace + + +extern "C" Q_DECL_EXPORT +void qDumpObjectData440( + int protocolVersion, + int token, + void *data, + bool dumpChildren, + int extraInt0, + int extraInt1, + int extraInt2, + int extraInt3) +{ + if (protocolVersion == -2) { + // close socket + QDumper d; + d.protocolVersion = protocolVersion; + d.token = token; + d.flush(); + d.disarm(); + } + + else if (protocolVersion == -1) { + // finalize Startup + QDumper d; + d.protocolVersion = protocolVersion; + d.token = token; + d.disarm(); + } + + else if (protocolVersion == 0) { + QDumper d; + d.protocolVersion = protocolVersion; + d.token = token; + // used to test whether error output gets through + //fprintf(stderr, "using stderr, qDebug follows: %d\n", token); + //qDebug() << "using qDebug, stderr already used: " << token; + d.disarm(); + } + + else if (protocolVersion == 1) { + QDumper d; + d.protocolVersion = protocolVersion; + d.token = token; + + //qDebug() << "SOCKET: after connect: state: " << qDumperSocket.state(); + // simpledumpers is a list of all available dumpers that are + // _not_ templates. templates currently require special + // hardcoded handling in the debugger plugin. + // don't mention them here in this list + d << "simpledumpers=[" + "\""NS"QByteArray\"," + "\""NS"QDir\"," + "\""NS"QImage\"," + "\""NS"QFile\"," + "\""NS"QFileInfo\"," + "\""NS"QLocale\"," + "\""NS"QModelIndex\"," + //"\""NS"QHash\"," // handled on GH side + //"\""NS"QHashNode\"," + //"\""NS"QMap\"," // handled on GH side + //"\""NS"QMapNode\"," + "\""NS"QObject\"," + "\""NS"QObjectMethodList\"," // hack to get nested properties display + "\""NS"QObjectPropertyList\"," + #if PRIVATE_OBJECT_ALLOWED + "\""NS"QObjectSignal\"," + "\""NS"QObjectSignalList\"," + "\""NS"QObjectSlot\"," + "\""NS"QObjectSlotList\"," + #endif // PRIVATE_OBJECT_ALLOWED + "\""NS"QString\"," + "\""NS"QStringList\"," + "\""NS"QTextCodec\"," + "\""NS"QVariant\"," + "\""NS"QWidget\"," + "\""NS"QDateTime\"," + "\"string\"," + "\"wstring\"," + "\"std::string\"," + "\"std::wstring\"," + // << "\""NS"QRegion\"," + "]"; + d << ",namespace=\""NS"\""; + d.disarm(); + } + + else if (protocolVersion == 2 || protocolVersion == 3) { + QDumper d; + + d.protocolVersion = protocolVersion; + d.token = token; + d.data = data; + d.dumpChildren = dumpChildren; + d.extraInt[0] = extraInt0; + d.extraInt[1] = extraInt1; + d.extraInt[2] = extraInt2; + d.extraInt[3] = extraInt3; + + const char *inbuffer = qDumpInBuffer; + d.outertype = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer; + d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer; + d.exp = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer; + d.innertype = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer; + d.iname = inbuffer; while (*inbuffer) ++inbuffer; ++inbuffer; + + handleProtocolVersion2and3(d); + } + + else { + qDebug() << "Unsupported protocol version" << protocolVersion; + } +} + + +// ]}) diff --git a/bin/gdbmacros/gdbmacros.pro b/bin/gdbmacros/gdbmacros.pro new file mode 100644 index 0000000000..bd1c07b968 --- /dev/null +++ b/bin/gdbmacros/gdbmacros.pro @@ -0,0 +1,3 @@ +TEMPLATE = lib +CONFIG += shared +SOURCES=gdbmacros.cpp diff --git a/bin/license.txt b/bin/license.txt new file mode 100644 index 0000000000..8e4678abe4 --- /dev/null +++ b/bin/license.txt @@ -0,0 +1,615 @@ +For individuals and/or legal entities resident in the Americas (North +America, Central America and South America), the applicable licensing +terms are specified under the heading "Technology Preview License +Agreement: The Americas". + +For individuals and/or legal entities not resident in The Americas, the +applicable licensing terms are specified under the heading "Technology +Preview License Agreement: Rest of the World". + + +TECHNOLOGY PREVIEW LICENSE AGREEMENT: The Americas +Agreement version 2.3 + +This Technology Preview License Agreement ("Agreement") is a legal +agreement between Nokia Inc. ("Nokia"), with its registered office at +6021 Connection Drive, Irving, TX 75039, U.S.A. and you (either an +individual or a legal entity) ("Licensee") for the Licensed Software (as +defined below). + +1. DEFINITIONS + +"Affiliate" of a Party shall mean an entity (i) which is directly or +indirectly controlling such Party; (ii) which is under the same direct +or indirect ownership or control as such Party; or (iii) which is +directly or indirectly owned or controlled by such Party. For these +purposes, an entity shall be treated as being controlled by another if +that other entity has fifty percent (50 %) or more of the votes in such +entity, is able to direct its affairs and/or to control the composition +of its board of directors or equivalent body. + +"Term" shall mean the period of time six (6) months from the later of +(a) the Effective Date; or (b) the date the Licensed Software was +initially delivered to Licensee by Nokia. If no specific Effective Date +is set forth in the Agreement, the Effective Date shall be deemed to be +the date the Licensed Software was initially delivered to Licensee. + +"Licensed Software" shall mean the computer software, "online" or +electronic documentation, associated media and printed materials, +including the source code, example programs and the documentation +delivered by Nokia to Licensee in conjunction with this Agreement. + +"Party" or "Parties" shall mean Licensee and/or Nokia. + + +2. OWNERSHIP + +The Licensed Software is protected by copyright laws and international +copyright treaties, as well as other intellectual property laws and +treaties. The Licensed Software is licensed, not sold. + +If Licensee provides any findings, proposals, suggestions or other +feedback ("Feedback") to Nokia regarding the Licensed Software, Nokia +shall own all right, title and interest including the intellectual +property rights in and to such Feedback, excluding however any existing +patent rights of Licensee. To the extent Licensee owns or controls any +patents for such Feedback Licensee hereby grants to Nokia and its +Affiliates, a worldwide, perpetual, non-transferable, sublicensable, +royalty-free license to (i) use, copy and modify Feedback and to create +derivative works thereof, (ii) to make (and have made), use, import, +sell, offer for sale, lease, dispose, offer for disposal or otherwise +exploit any products or services of Nokia containing Feedback,, and +(iii) sublicense all the foregoing rights to third party licensees and +customers of Nokia and/or its Affiliates. + + +3. VALIDITY OF THE AGREEMENT + +By installing, copying, or otherwise using the Licensed Software, +Licensee agrees to be bound by the terms of this Agreement. If Licensee +does not agree to the terms of this Agreement, Licensee may not install, +copy, or otherwise use the Licensed Software. Upon Licensee's acceptance +of the terms and conditions of this Agreement, Nokia grants Licensee the +right to use the Licensed Software in the manner provided below. + + +4. LICENSES + +4.1. Using and Copying + +Nokia grants to Licensee a non-exclusive, non-transferable, time-limited +license to use and copy the Licensed Software for sole purpose of +evaluating and testing the Licensed Software during the Term. + +Licensee may install copies of the Licensed Software on an unlimited +number of computers provided that (a) if an individual, only such +individual; or (b) if a legal entity only its employees; use the +Licensed Software for the authorized purposes. + +4.2 No Distribution or Modifications + +Licensee may not disclose, modify, sell, market, commercialise, +distribute, loan, rent, lease, or license the Licensed Software or any +copy of it or use the Licensed Software for any purpose that is not +expressly granted in this Section 4. Licensee may not alter or remove +any details of ownership, copyright, trademark or other property right +connected with the Licensed Software. Licensee may not distribute any +software statically or dynamically linked with the Licensed Software. + +4.3 No Technical Support + +Nokia has no obligation to furnish Licensee with any technical support +whatsoever. Any such support is subject to separate agreement between +the Parties. + + +5. PRE-RELEASE CODE +The Licensed Software contains pre-release code that is not at the level +of performance and compatibility of a final, generally available, +product offering. The Licensed Software may not operate correctly and +may be substantially modified prior to the first commercial product +release, if any. Nokia is not obligated to make this or any later +version of the Licensed Software commercially available. The License +Software is "Not for Commercial Use" and may only be used for the +purposes described in Section 4. The Licensed Software may not be used +in a live operating environment where it may be relied upon to perform +in the same manner as a commercially released product or with data that +has not been sufficiently backed up. + +6. THIRD PARTY SOFTWARE + +The Licensed Software may provide links to third party libraries or code +(collectively "Third Party Software") to implement various functions. +Third Party Software does not comprise part of the Licensed Software. In +some cases, access to Third Party Software may be included along with +the Licensed Software delivery as a convenience for development and +testing only. Such source code and libraries may be listed in the +".../src/3rdparty" source tree delivered with the Licensed Software or +documented in the Licensed Software where the Third Party Software is +used, as may be amended from time to time, do not comprise the Licensed +Software. Licensee acknowledges (1) that some part of Third Party +Software may require additional licensing of copyright and patents from +the owners of such, and (2) that distribution of any of the Licensed +Software referencing any portion of a Third Party Software may require +appropriate licensing from such third parties. + + +7. LIMITED WARRANTY AND WARRANTY DISCLAIMER + +The Licensed Software is licensed to Licensee "as is". To the maximum +extent permitted by applicable law, Nokia on behalf of itself and its +suppliers, disclaims all warranties and conditions, either express or +implied, including, but not limited to, implied warranties of +merchantability, fitness for a particular purpose, title and +non-infringement with regard to the Licensed Software. + + +8. LIMITATION OF LIABILITY + +If, Nokia's warranty disclaimer notwithstanding, Nokia is held liable to +Licensee, whether in contract, tort or any other legal theory, based on +the Licensed Software, Nokia's entire liability to Licensee and +Licensee's exclusive remedy shall be, at Nokia's option, either (A) +return of the price Licensee paid for the Licensed Software, or (B) +repair or replacement of the Licensed Software, provided Licensee +returns to Nokia all copies of the Licensed Software as originally +delivered to Licensee. Nokia shall not under any circumstances be liable +to Licensee based on failure of the Licensed Software if the failure +resulted from accident, abuse or misapplication, nor shall Nokia under +any circumstances be liable for special damages, punitive or exemplary +damages, damages for loss of profits or interruption of business or for +loss or corruption of data. Any award of damages from Nokia to Licensee +shall not exceed the total amount Licensee has paid to Nokia in +connection with this Agreement. + + +9. CONFIDENTIALITY + +Each party acknowledges that during the Term of this Agreement it shall +have access to information about the other party's business, business +methods, business plans, customers, business relations, technology, and +other information, including the terms of this Agreement, that is +confidential and of great value to the other party, and the value of +which would be significantly reduced if disclosed to third parties (the +"Confidential Information"). Accordingly, when a party (the "Receiving +Party") receives Confidential Information from another party (the +"Disclosing Party"), the Receiving Party shall, and shall obligate its +employees and agents and employees and agents of its Affiliates to: (i) +maintain the Confidential Information in strict confidence; (ii) not +disclose the Confidential Information to a third party without the +Disclosing Party's prior written approval; and (iii) not, directly or +indirectly, use the Confidential Information for any purpose other than +for exercising its rights and fulfilling its responsibilities pursuant +to this Agreement. Each party shall take reasonable measures to protect +the Confidential Information of the other party, which measures shall +not be less than the measures taken by such party to protect its own +confidential and proprietary information. + +"Confidential Information" shall not include information that (a) is or +becomes generally known to the public through no act or omission of the +Receiving Party; (b) was in the Receiving Party's lawful possession +prior to the disclosure hereunder and was not subject to limitations on +disclosure or use; (c) is developed by the Receiving Party without +access to the Confidential Information of the Disclosing Party or by +persons who have not had access to the Confidential Information of the +Disclosing Party as proven by the written records of the Receiving +Party; (d) is lawfully disclosed to the Receiving Party without +restrictions, by a third party not under an obligation of +confidentiality; or (e) the Receiving Party is legally compelled to +disclose the information, in which case the Receiving Party shall assert +the privileged and confidential nature of the information and cooperate +fully with the Disclosing Party to protect against and prevent +disclosure of any Confidential Information and to limit the scope of +disclosure and the dissemination of disclosed Confidential Information +by all legally available means. + +The obligations of the Receiving Party under this Section shall continue +during the Initial Term and for a period of five (5) years after +expiration or termination of this Agreement. To the extent that the +terms of the Non-Disclosure Agreement between Nokia and Licensee +conflict with the terms of this Section 8, this Section 8 shall be +controlling over the terms of the Non-Disclosure Agreement. + + +10. GENERAL PROVISIONS + +10.1 No Assignment + +Licensee shall not be entitled to assign or transfer all or any of its +rights, benefits and obligations under this Agreement without the prior +written consent of Nokia, which shall not be unreasonably withheld. + +10.2 Termination + +Nokia may terminate the Agreement at any time immediately upon written +notice by Nokia to Licensee if Licensee breaches this Agreement. + +Upon termination of this Agreement, Licensee shall return to Nokia all +copies of Licensed Software that were supplied by Nokia. All other +copies of Licensed Software in the possession or control of Licensee +must be erased or destroyed. An officer of Licensee must promptly +deliver to Nokia a written confirmation that this has occurred. + +10.3 Surviving Sections + +Any terms and conditions that by their nature or otherwise reasonably +should survive a cancellation or termination of this Agreement shall +also be deemed to survive. Such terms and conditions include, but are +not limited to the following Sections: 2, 5, 6, 7, 8, 9, 10.2, 10.3, 10.4, +10.5, 10.6, 10.7, and 10.8 of this Agreement. + +10.4 Entire Agreement + +This Agreement constitutes the complete agreement between the parties +and supersedes all prior or contemporaneous discussions, +representations, and proposals, written or oral, with respect to the +subject matters discussed herein, with the exception of the +non-disclosure agreement executed by the parties in connection with this +Agreement ("Non-Disclosure Agreement"), if any, shall be subject to +Section 8. No modification of this Agreement shall be effective unless +contained in a writing executed by an authorized representative of each +party. No term or condition contained in Licensee's purchase order shall +apply unless expressly accepted by Nokia in writing. If any provision of +the Agreement is found void or unenforceable, the remainder shall remain +valid and enforceable according to its terms. If any remedy provided is +determined to have failed for its essential purpose, all limitations of +liability and exclusions of damages set forth in this Agreement shall +remain in effect. + +10.5 Export Control + +Licensee acknowledges that the Licensed Software may be subject to +export control restrictions of various countries. Licensee shall fully +comply with all applicable export license restrictions and requirements +as well as with all laws and regulations relating to the importation of +the Licensed Software and shall procure all necessary governmental +authorizations, including without limitation, all necessary licenses, +approvals, permissions or consents, where necessary for the +re-exportation of the Licensed Software., + +10.6 Governing Law and Legal Venue + +This Agreement shall be governed by and construed in accordance with the +federal laws of the United States of America and the internal laws of +the State of New York without given effect to any choice of law rule +that would result in the application of the laws of any other +jurisdiction. The United Nations Convention on Contracts for the +International Sale of Goods (CISG) shall not apply. Each Party (a) +hereby irrevocably submits itself to and consents to the jurisdiction of +the United States District Court for the Southern District of New York +(or if such court lacks jurisdiction, the state courts of the State of +New York) for the purposes of any action, claim, suit or proceeding +between the Parties in connection with any controversy, claim, or +dispute arising out of or relating to this Agreement; and (b) hereby +waives, and agrees not to assert by way of motion, as a defense or +otherwise, in any such action, claim, suit or proceeding, any claim that +is not personally subject to the jurisdiction of such court(s), that the +action, claim, suit or proceeding is brought in an inconvenient forum or +that the venue of the action, claim, suit or proceeding is improper. +Notwithstanding the foregoing, nothing in this Section 9.6 is intended +to, or shall be deemed to, constitute a submission or consent to, or +selection of, jurisdiction, forum or venue for any action for patent +infringement, whether or not such action relates to this Agreement. + +10.7 No Implied License + +There are no implied licenses or other implied rights granted under this +Agreement, and all rights, save for those expressly granted hereunder, +shall remain with Nokia and its licensors. In addition, no licenses or +immunities are granted to the combination of the Licensed Software with +any other software or hardware not delivered by Nokia under this +Agreement. + +10.8 Government End Users + +A "U.S. Government End User" shall mean any agency or entity of the +government of the United States. The following shall apply if Licensee +is a U.S. Government End User. The Licensed Software is a "commercial +item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), +consisting of "commercial computer software" and "commercial computer +software documentation," as such terms are used in 48 C.F.R. 12.212 +(Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 +through 227.7202-4 (June 1995), all U.S. Government End Users acquire +the Licensed Software with only those rights set forth herein. The +Licensed Software (including related documentation) is provided to U.S. +Government End Users: (a) only as a commercial end item; and (b) only +pursuant to this Agreement. + + + + + +TECHNOLOGY PREVIEW LICENSE AGREEMENT: Rest of the World +Agreement version 2.3 + +This Technology Preview License Agreement ("Agreement") is a legal +agreement between Nokia Corporation ("Nokia"), with its registered +office at Keilalahdentie 4, 02150 Espoo, Finland and you (either an +individual or a legal entity) ("Licensee") for the Licensed Software (as +defined below). + +1. DEFINITIONS + +"Affiliate" of a Party shall mean an entity (i) which is directly or +indirectly controlling such Party; (ii) which is under the same direct +or indirect ownership or control as such Party; or (iii) which is +directly or indirectly owned or controlled by such Party. For these +purposes, an entity shall be treated as being controlled by another if +that other entity has fifty percent (50 %) or more of the votes in such +entity, is able to direct its affairs and/or to control the composition +of its board of directors or equivalent body. + +"Term" shall mean the period of time six (6) months from the later of +(a) the Effective Date; or (b) the date the Licensed Software was +initially delivered to Licensee by Nokia. If no specific Effective Date +is set forth in the Agreement, the Effective Date shall be deemed to be +the date the Licensed Software was initially delivered to Licensee. + +"Licensed Software" shall mean the computer software, "online" or +electronic documentation, associated media and printed materials, +including the source code, example programs and the documentation +delivered by Nokia to Licensee in conjunction with this Agreement. + +"Party" or "Parties" shall mean Licensee and/or Nokia. + + +2. OWNERSHIP + +The Licensed Software is protected by copyright laws and international +copyright treaties, as well as other intellectual property laws and +treaties. The Licensed Software is licensed, not sold. + +If Licensee provides any findings, proposals, suggestions or other +feedback ("Feedback") to Nokia regarding the Licensed Software, Nokia +shall own all right, title and interest including the intellectual +property rights in and to such Feedback, excluding however any existing +patent rights of Licensee. To the extent Licensee owns or controls any +patents for such Feedback Licensee hereby grants to Nokia and its +Affiliates, a worldwide, perpetual, non-transferable, sublicensable, +royalty-free license to (i) use, copy and modify Feedback and to create +derivative works thereof, (ii) to make (and have made), use, import, +sell, offer for sale, lease, dispose, offer for disposal or otherwise +exploit any products or services of Nokia containing Feedback,, and +(iii) sublicense all the foregoing rights to third party licensees and +customers of Nokia and/or its Affiliates. + +3. VALIDITY OF THE AGREEMENT + +By installing, copying, or otherwise using the Licensed Software, +Licensee agrees to be bound by the terms of this Agreement. If Licensee +does not agree to the terms of this Agreement, Licensee may not install, +copy, or otherwise use the Licensed Software. Upon Licensee's acceptance +of the terms and conditions of this Agreement, Nokia grants Licensee the +right to use the Licensed Software in the manner provided below. + + +4. LICENSES + +4.1. Using and Copying + +Nokia grants to Licensee a non-exclusive, non-transferable, time-limited +license to use and copy the Licensed Software for sole purpose of +evaluating and testing the Licensed Software during the Term. + +Licensee may install copies of the Licensed Software on an unlimited +number of computers provided that (a) if an individual, only such +individual; or (b) if a legal entity only its employees; use the +Licensed Software for the authorized purposes. + +4.2 No Distribution or Modifications + +Licensee may not disclose, modify, sell, market, commercialise, +distribute, loan, rent, lease, or license the Licensed Software or any +copy of it or use the Licensed Software for any purpose that is not +expressly granted in this Section 4. Licensee may not alter or remove +any details of ownership, copyright, trademark or other property right +connected with the Licensed Software. Licensee may not distribute any +software statically or dynamically linked with the Licensed Software. + +4.3 No Technical Support + +Nokia has no obligation to furnish Licensee with any technical support +whatsoever. Any such support is subject to separate agreement between +the Parties. + + +5. PRE-RELEASE CODE + +The Licensed Software contains pre-release code that is not at the level +of performance and compatibility of a final, generally available, +product offering. The Licensed Software may not operate correctly and +may be substantially modified prior to the first commercial product +release, if any. Nokia is not obligated to make this or any later +version of the Licensed Software commercially available. The License +Software is "Not for Commercial Use" and may only be used for the +purposes described in Section 4. The Licensed Software may not be used +in a live operating environment where it may be relied upon to perform +in the same manner as a commercially released product or with data that +has not been sufficiently backed up. + +6. THIRD PARTY SOFTWARE + +The Licensed Software may provide links to third party libraries or code +(collectively "Third Party Software") to implement various functions. +Third Party Software does not comprise part of the Licensed Software. In +some cases, access to Third Party Software may be included along with +the Licensed Software delivery as a convenience for development and +testing only. Such source code and libraries may be listed in the +".../src/3rdparty" source tree delivered with the Licensed Software or +documented in the Licensed Software where the Third Party Software is +used, as may be amended from time to time, do not comprise the Licensed +Software. Licensee acknowledges (1) that some part of Third Party +Software may require additional licensing of copyright and patents from +the owners of such, and (2) that distribution of any of the Licensed +Software referencing any portion of a Third Party Software may require +appropriate licensing from such third parties. + + +7. LIMITED WARRANTY AND WARRANTY DISCLAIMER + +The Licensed Software is licensed to Licensee "as is". To the maximum +extent permitted by applicable law, Nokia on behalf of itself and its +suppliers, disclaims all warranties and conditions, either express or +implied, including, but not limited to, implied warranties of +merchantability, fitness for a particular purpose, title and +non-infringement with regard to the Licensed Software. + + +8. LIMITATION OF LIABILITY + +If, Nokia's warranty disclaimer notwithstanding, Nokia is held liable to +Licensee, whether in contract, tort or any other legal theory, based on +the Licensed Software, Nokia's entire liability to Licensee and +Licensee's exclusive remedy shall be, at Nokia's option, either (A) +return of the price Licensee paid for the Licensed Software, or (B) +repair or replacement of the Licensed Software, provided Licensee +returns to Nokia all copies of the Licensed Software as originally +delivered to Licensee. Nokia shall not under any circumstances be liable +to Licensee based on failure of the Licensed Software if the failure +resulted from accident, abuse or misapplication, nor shall Nokia under +any circumstances be liable for special damages, punitive or exemplary +damages, damages for loss of profits or interruption of business or for +loss or corruption of data. Any award of damages from Nokia to Licensee +shall not exceed the total amount Licensee has paid to Nokia in +connection with this Agreement. + + +9. CONFIDENTIALITY + +Each party acknowledges that during the Term of this Agreement it shall +have access to information about the other party's business, business +methods, business plans, customers, business relations, technology, and +other information, including the terms of this Agreement, that is +confidential and of great value to the other party, and the value of +which would be significantly reduced if disclosed to third parties (the +"Confidential Information"). Accordingly, when a party (the "Receiving +Party") receives Confidential Information from another party (the +"Disclosing Party"), the Receiving Party shall, and shall obligate its +employees and agents and employees and agents of its Affiliates to: (i) +maintain the Confidential Information in strict confidence; (ii) not +disclose the Confidential Information to a third party without the +Disclosing Party's prior written approval; and (iii) not, directly or +indirectly, use the Confidential Information for any purpose other than +for exercising its rights and fulfilling its responsibilities pursuant +to this Agreement. Each party shall take reasonable measures to protect +the Confidential Information of the other party, which measures shall +not be less than the measures taken by such party to protect its own +confidential and proprietary information. + +"Confidential Information" shall not include information that (a) is or +becomes generally known to the public through no act or omission of the +Receiving Party; (b) was in the Receiving Party's lawful possession +prior to the disclosure hereunder and was not subject to limitations on +disclosure or use; (c) is developed by the Receiving Party without +access to the Confidential Information of the Disclosing Party or by +persons who have not had access to the Confidential Information of the +Disclosing Party as proven by the written records of the Receiving +Party; (d) is lawfully disclosed to the Receiving Party without +restrictions, by a third party not under an obligation of +confidentiality; or (e) the Receiving Party is legally compelled to +disclose the information, in which case the Receiving Party shall assert +the privileged and confidential nature of the information and cooperate +fully with the Disclosing Party to protect against and prevent +disclosure of any Confidential Information and to limit the scope of +disclosure and the dissemination of disclosed Confidential Information +by all legally available means. + +The obligations of the Receiving Party under this Section shall continue +during the Initial Term and for a period of five (5) years after +expiration or termination of this Agreement. To the extent that the +terms of the Non-Disclosure Agreement between Nokia and Licensee +conflict with the terms of this Section 8, this Section 8 shall be +controlling over the terms of the Non-Disclosure Agreement. + + +10. GENERAL PROVISIONS + +10.1 No Assignment + +Licensee shall not be entitled to assign or transfer all or any of its +rights, benefits and obligations under this Agreement without the prior +written consent of Nokia, which shall not be unreasonably withheld. + +10.2 Termination + +Nokia may terminate the Agreement at any time immediately upon written +notice by Nokia to Licensee if Licensee breaches this Agreement. + +Upon termination of this Agreement, Licensee shall return to Nokia all +copies of Licensed Software that were supplied by Nokia. All other +copies of Licensed Software in the possession or control of Licensee +must be erased or destroyed. An officer of Licensee must promptly +deliver to Nokia a written confirmation that this has occurred. + +10.3 Surviving Sections + +Any terms and conditions that by their nature or otherwise reasonably +should survive a cancellation or termination of this Agreement shall +also be deemed to survive. Such terms and conditions include, but are +not limited to the following Sections: 2, 5, 6, 7, 8, 9, 10.2, 10.3, 10.4, +10.5, 10.6, 10.7, and 10.8 of this Agreement. + +10.4 Entire Agreement + +This Agreement constitutes the complete agreement between the parties +and supersedes all prior or contemporaneous discussions, +representations, and proposals, written or oral, with respect to the +subject matters discussed herein, with the exception of the +non-disclosure agreement executed by the parties in connection with this +Agreement ("Non-Disclosure Agreement"), if any, shall be subject to +Section 8. No modification of this Agreement shall be effective unless +contained in a writing executed by an authorized representative of each +party. No term or condition contained in Licensee's purchase order shall +apply unless expressly accepted by Nokia in writing. If any provision of +the Agreement is found void or unenforceable, the remainder shall remain +valid and enforceable according to its terms. If any remedy provided is +determined to have failed for its essential purpose, all limitations of +liability and exclusions of damages set forth in this Agreement shall +remain in effect. + +10.5 Export Control + +Licensee acknowledges that the Licensed Software may be subject to +export control restrictions of various countries. Licensee shall fully +comply with all applicable export license restrictions and requirements +as well as with all laws and regulations relating to the importation of +the Licensed Software and shall procure all necessary governmental +authorizations, including without limitation, all necessary licenses, +approvals, permissions or consents, where necessary for the +re-exportation of the Licensed Software., + +10.6 Governing Law and Legal Venue + +This Agreement shall be construed and interpreted in accordance with the +laws of Finland, excluding its choice of law provisions. Any disputes +arising out of or relating to this Agreement shall be resolved in +arbitration under the Rules of Arbitration of the Chamber of Commerce of +Helsinki, Finland. The arbitration tribunal shall consist of one (1), or +if either Party so requires, of three (3), arbitrators. The award shall +be final and binding and enforceable in any court of competent +jurisdiction. The arbitration shall be held in Helsinki, Finland and the +process shall be conducted in the English language. + +10.7 No Implied License + +There are no implied licenses or other implied rights granted under this +Agreement, and all rights, save for those expressly granted hereunder, +shall remain with Nokia and its licensors. In addition, no licenses or +immunities are granted to the combination of the Licensed Software with +any other software or hardware not delivered by Nokia under this +Agreement. + +10.8 Government End Users + +A "U.S. Government End User" shall mean any agency or entity of the +government of the United States. The following shall apply if Licensee +is a U.S. Government End User. The Licensed Software is a "commercial +item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), +consisting of "commercial computer software" and "commercial computer +software documentation," as such terms are used in 48 C.F.R. 12.212 +(Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 +through 227.7202-4 (June 1995), all U.S. Government End Users acquire +the Licensed Software with only those rights set forth herein. The +Licensed Software (including related documentation) is provided to U.S. +Government End Users: (a) only as a commercial end item; and (b) only +pursuant to this Agreement. diff --git a/bin/runInTerminal.command b/bin/runInTerminal.command new file mode 100755 index 0000000000..89195e3d10 --- /dev/null +++ b/bin/runInTerminal.command @@ -0,0 +1,7 @@ +#!/bin/bash +osascript >/dev/null 2>&1 < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/schemes/Xcode.kms b/bin/schemes/Xcode.kms new file mode 100644 index 0000000000..30653822df --- /dev/null +++ b/bin/schemes/Xcode.kms @@ -0,0 +1,585 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/snippets/class_generic.snp b/bin/snippets/class_generic.snp new file mode 100644 index 0000000000..1f196c3dac --- /dev/null +++ b/bin/snippets/class_generic.snp @@ -0,0 +1,26 @@ + + + + Name + Class - Generic + + + Description + This creates a new generic class + + + Category + Classes + + + Shortcut + cl + + + Contents + + + \ No newline at end of file diff --git a/bin/snippets/class_qobject.snp b/bin/snippets/class_qobject.snp new file mode 100644 index 0000000000..784233e546 --- /dev/null +++ b/bin/snippets/class_qobject.snp @@ -0,0 +1,29 @@ + + + + Name + Class - QObject + + + Description + This creates a new class deriving from QObject + + + Category + Classes + + + Shortcut + cl + + + Contents + + + diff --git a/bin/snippets/class_qwidget.snp b/bin/snippets/class_qwidget.snp new file mode 100644 index 0000000000..1edb2d2cc7 --- /dev/null +++ b/bin/snippets/class_qwidget.snp @@ -0,0 +1,29 @@ + + + + Name + Class - QWidget + + + Description + This creates a new class deriving from QWidget + + + Category + Classes + + + Shortcut + cl + + + Contents + + + \ No newline at end of file diff --git a/bin/snippets/comment.snp b/bin/snippets/comment.snp new file mode 100644 index 0000000000..bd909a7e7a --- /dev/null +++ b/bin/snippets/comment.snp @@ -0,0 +1,23 @@ + + + + Name + /* ... */ Comment + + + Description + This creates comment + + + Category + Other + + + Shortcut + /* + + + Contents + + + diff --git a/bin/snippets/for.snp b/bin/snippets/for.snp new file mode 100644 index 0000000000..16aa633faf --- /dev/null +++ b/bin/snippets/for.snp @@ -0,0 +1,48 @@ + + + + + Name + for loop + + + + Description + This inserts an incrementing for loop + + + + Category + Common Statements + + + + Shortcut + fo + + + + Contents + + + + + Arguments + + for (TYPE VAR = 0; VAR < CONDITION; ++VAR)...]]> + for (%1 VAR = 0; VAR < 10; ++VAR)...]]> + for (%1 %2 = 0; %2 < CONDITION; ++%2)...]]> + + + + + ArgumentDefaults + + int + i + + + + \ No newline at end of file diff --git a/bin/snippets/foreach.snp b/bin/snippets/foreach.snp new file mode 100644 index 0000000000..c00beb99e5 --- /dev/null +++ b/bin/snippets/foreach.snp @@ -0,0 +1,25 @@ + + + + Name + foreach statement + + + Description + This creates a foreach statement + + + Category + Common Statements + + + Shortcut + fo + + + Contents + + + diff --git a/bin/snippets/if.snp b/bin/snippets/if.snp new file mode 100644 index 0000000000..2888590efa --- /dev/null +++ b/bin/snippets/if.snp @@ -0,0 +1,25 @@ + + + + Name + if Statement + + + Description + This creates a if statement + + + Category + Common Statements + + + Shortcut + if + + + Contents + + + diff --git a/bin/snippets/ifelse.snp b/bin/snippets/ifelse.snp new file mode 100644 index 0000000000..39428555ca --- /dev/null +++ b/bin/snippets/ifelse.snp @@ -0,0 +1,27 @@ + + + + Name + if - else Statement + + + Description + This creates a if...else statement + + + Category + Common Statements + + + Shortcut + if + + + Contents + + + diff --git a/bin/templates/qt4project/main.cpp b/bin/templates/qt4project/main.cpp new file mode 100644 index 0000000000..e1e39f6f26 --- /dev/null +++ b/bin/templates/qt4project/main.cpp @@ -0,0 +1,10 @@ +#include <%QAPP_INCLUDE%> +#include "%INCLUDE%" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + %CLASS% w; + w.show(); + return a.exec(); +} diff --git a/bin/templates/qt4project/mywidget.cpp b/bin/templates/qt4project/mywidget.cpp new file mode 100644 index 0000000000..ae355e98dd --- /dev/null +++ b/bin/templates/qt4project/mywidget.cpp @@ -0,0 +1,11 @@ +#include "%INCLUDE%" + +%CLASS%::%CLASS%(QWidget *parent) + : %BASECLASS%(parent) +{ +} + +%CLASS%::~%CLASS%() +{ + +} diff --git a/bin/templates/qt4project/mywidget.h b/bin/templates/qt4project/mywidget.h new file mode 100644 index 0000000000..88ee4d9506 --- /dev/null +++ b/bin/templates/qt4project/mywidget.h @@ -0,0 +1,15 @@ +#ifndef %PRE_DEF% +#define %PRE_DEF% + +#include + +class %CLASS% : public %BASECLASS% +{ + Q_OBJECT + +public: + %CLASS%(QWidget *parent = 0); + ~%CLASS%(); +}; + +#endif // %PRE_DEF% diff --git a/bin/templates/qt4project/mywidget_form.cpp b/bin/templates/qt4project/mywidget_form.cpp new file mode 100644 index 0000000000..33b14afab8 --- /dev/null +++ b/bin/templates/qt4project/mywidget_form.cpp @@ -0,0 +1,13 @@ +#include "%INCLUDE%" +#include "%UI_HDR%" + +%CLASS%::%CLASS%(QWidget *parent) + : %BASECLASS%(parent), ui(new Ui::%CLASS%Class) +{ + ui->setupUi(this); +} + +%CLASS%::~%CLASS%() +{ + delete ui; +} diff --git a/bin/templates/qt4project/mywidget_form.h b/bin/templates/qt4project/mywidget_form.h new file mode 100644 index 0000000000..fd4d373277 --- /dev/null +++ b/bin/templates/qt4project/mywidget_form.h @@ -0,0 +1,23 @@ +#ifndef %PRE_DEF% +#define %PRE_DEF% + +#include + +namespace Ui +{ + class %CLASS%Class; +} + +class %CLASS% : public %BASECLASS% +{ + Q_OBJECT + +public: + %CLASS%(QWidget *parent = 0); + ~%CLASS%(); + +private: + Ui::%CLASS%Class *ui; +}; + +#endif // %PRE_DEF% diff --git a/bin/templates/qt4project/widget.ui b/bin/templates/qt4project/widget.ui new file mode 100644 index 0000000000..6c78aeebc4 --- /dev/null +++ b/bin/templates/qt4project/widget.ui @@ -0,0 +1,23 @@ + + %CLASS%Class + + + %CLASS%Class + + + + 0 + 0 + 600 + 400 + + + + %CLASS% + %CENTRAL_WIDGET% + + + + + + -- cgit v1.2.1