summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-26 23:42:28 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-26 23:42:28 (GMT)
commit59c58576efd3ceff7add46a359fd99e56a2fb279 (patch)
treea23982655f3f7959c9c340b429aebc51435e6676
parentd8f757bdb881c3a3d723642734d7d76fae14dce7 (diff)
parent1a72f98a15ef78004894dc6636b8a5d969d66fde (diff)
downloadQt-59c58576efd3ceff7add46a359fd99e56a2fb279.zip
Qt-59c58576efd3ceff7add46a359fd99e56a2fb279.tar.gz
Qt-59c58576efd3ceff7add46a359fd99e56a2fb279.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fixed copy-paste error in htmlgenerator.cpp Corrected filename case for wincrypt.h Add qDebug() operator for QGLFormat Fix conversion between JavaScript Date and QDateTime Avoid memory allocation when converting from Gbk to unicode. Warn if surface creation fails Doc: fixing search bug doc: Added more DITA output to the XML generator QSemaphore::tryAquire(timeout) -- never times out on an active semaphore Fix warnings in QSslSocketPrivate::systemCaCertificates() doc: Added more DITA output to the XML generator
-rw-r--r--src/corelib/thread/qsemaphore.cpp7
-rw-r--r--src/gui/egl/qegl_x11.cpp5
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp16
-rw-r--r--src/network/ssl/qsslsocket_p.h2
-rw-r--r--src/opengl/qgl.cpp26
-rw-r--r--src/opengl/qgl.h7
-rw-r--r--src/plugins/codecs/cn/qgb18030codec.cpp21
-rw-r--r--src/script/api/qscriptengine.cpp47
-rw-r--r--src/script/api/qscriptengine_p.h10
-rw-r--r--src/script/script.pri1
-rw-r--r--src/script/utils/qscriptdate.cpp365
-rw-r--r--src/script/utils/qscriptdate_p.h52
-rw-r--r--src/script/utils/utils.pri5
-rw-r--r--tests/auto/qsemaphore/tst_qsemaphore.cpp49
-rw-r--r--tools/qdoc3/codechunk.h2
-rw-r--r--tools/qdoc3/cppcodeparser.cpp32
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp128
-rw-r--r--tools/qdoc3/ditaxmlgenerator.h1
-rw-r--r--tools/qdoc3/htmlgenerator.cpp10
-rw-r--r--tools/qdoc3/node.cpp39
-rw-r--r--tools/qdoc3/node.h155
-rw-r--r--tools/qdoc3/test/qt-html-templates.qdocconf6
22 files changed, 454 insertions, 532 deletions
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index 9dc828d..8e8a88a 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -44,6 +44,8 @@
#ifndef QT_NO_THREAD
#include "qmutex.h"
#include "qwaitcondition.h"
+#include "qelapsedtimer.h"
+#include "qdatetime.h"
QT_BEGIN_NAMESPACE
@@ -218,8 +220,11 @@ bool QSemaphore::tryAcquire(int n, int timeout)
while (n > d->avail)
d->cond.wait(locker.mutex());
} else {
+ QElapsedTimer timer;
+ timer.start();
while (n > d->avail) {
- if (!d->cond.wait(locker.mutex(), timeout))
+ if (timer.hasExpired(timeout)
+ || !d->cond.wait(locker.mutex(), timeout - timer.elapsed()))
return false;
}
}
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 969acc4..fea6e8d 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -415,7 +415,10 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg
// At this point, the widget's window should be created and have the correct visual. Now we
// just need to create the EGL surface for it:
- return eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ if (surf == EGL_NO_SURFACE)
+ qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
+ return surf;
}
if (x11PixmapData) {
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 36a0cc7..9bd93a2 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -574,17 +574,17 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
}
}
#elif defined(Q_OS_AIX)
- systemCerts.append(QSslCertificate::fromPath("/var/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard));
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/var/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard));
#elif defined(Q_OS_SOLARIS)
- systemCerts.append(QSslCertificate::fromPath("/usr/local/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard));
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard));
#elif defined(Q_OS_HPUX)
- systemCerts.append(QSslCertificate::fromPath("/opt/openssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard));
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/opt/openssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard));
#elif defined(Q_OS_LINUX)
- systemCerts.append(QSslCertificate::fromPath("/etc/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard)); // (K)ubuntu, OpenSUSE, Mandriva, ...
- systemCerts.append(QSslCertificate::fromPath("/etc/pki/tls/certs/ca-bundle.crt", QSsl::Pem)); // Fedora
- systemCerts.append(QSslCertificate::fromPath("/usr/lib/ssl/certs/*.pem", QSsl::Pem, QRegExp::Wildcard)); // Gentoo, Mandrake
- systemCerts.append(QSslCertificate::fromPath("/usr/share/ssl/*.pem", QSsl::Pem, QRegExp::Wildcard)); // Centos, Redhat, SuSE
- systemCerts.append(QSslCertificate::fromPath("/usr/local/ssl/*.pem", QSsl::Pem, QRegExp::Wildcard)); // Normal OpenSSL Tarball
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // (K)ubuntu, OpenSUSE, Mandriva, ...
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/etc/pki/tls/certs/ca-bundle.crt"), QSsl::Pem)); // Fedora
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/lib/ssl/certs/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Gentoo, Mandrake
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/share/ssl/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Centos, Redhat, SuSE
+ systemCerts.append(QSslCertificate::fromPath(QLatin1String("/usr/local/ssl/*.pem"), QSsl::Pem, QRegExp::Wildcard)); // Normal OpenSSL Tarball
#endif
return systemCerts;
}
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index 42ae98f..d3c3858 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*);
typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*);
#elif defined(Q_OS_WIN)
-#include <Wincrypt.h>
+#include <wincrypt.h>
#ifndef HCRYPTPROV_LEGACY
#define HCRYPTPROV_LEGACY HCRYPTPROV
#endif
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b4c85ac..9effb34 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1521,6 +1521,32 @@ bool operator==(const QGLFormat& a, const QGLFormat& b)
&& a.d->profile == b.d->profile);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QGLFormat &f)
+{
+ const QGLFormatPrivate * const d = f.d;
+
+ dbg.nospace() << "QGLFormat("
+ << "options " << d->opts
+ << ", plane " << d->pln
+ << ", depthBufferSize " << d->depthSize
+ << ", accumBufferSize " << d->accumSize
+ << ", stencilBufferSize " << d->stencilSize
+ << ", redBufferSize " << d->redSize
+ << ", greenBufferSize " << d->greenSize
+ << ", blueBufferSize " << d->blueSize
+ << ", alphaBufferSize " << d->alphaSize
+ << ", samples " << d->numSamples
+ << ", swapInterval " << d->swapInterval
+ << ", majorVersion " << d->majorVersion
+ << ", minorVersion " << d->minorVersion
+ << ", profile " << d->profile
+ << ')';
+
+ return dbg.space();
+}
+#endif
+
/*!
Returns false if all the options of the two QGLFormat objects
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index f0b36f7..f85cad5 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -281,6 +281,9 @@ private:
friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
+#ifndef QT_NO_DEBUG_STREAM
+ friend Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
+#endif
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags)
@@ -288,6 +291,10 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags)
Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
+#ifndef QT_NO_DEBUG_STREAM
+Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
+#endif
+
class Q_OPENGL_EXPORT QGLContext
{
Q_DECLARE_PRIVATE(QGLContext)
diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp
index 3f2eec7..e10c8b1 100644
--- a/src/plugins/codecs/cn/qgb18030codec.cpp
+++ b/src/plugins/codecs/cn/qgb18030codec.cpp
@@ -319,7 +319,7 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
{
uchar buf[2];
int nbuf = 0;
- QChar replacement = QChar::ReplacementCharacter;
+ ushort replacement = QChar::ReplacementCharacter;
if (state) {
if (state->flags & ConvertInvalidToNull)
replacement = QChar::Null;
@@ -330,6 +330,9 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
int invalid = 0;
QString result;
+ result.resize(len);
+ int unicodeLen = 0;
+ ushort *const resultData = reinterpret_cast<ushort*>(result.data());
//qDebug("QGbkDecoder::toUnicode(const char* chars = \"%s\", int len = %d)", chars, len);
for (int i=0; i<len; i++) {
@@ -338,14 +341,16 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
case 0:
if (ch < 0x80) {
// ASCII
- result += QLatin1Char(ch);
+ resultData[unicodeLen] = ch;
+ ++unicodeLen;
} else if (Is1stByte(ch)) {
// GBK 1st byte?
buf[0] = ch;
nbuf = 1;
} else {
// Invalid
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
break;
@@ -356,21 +361,25 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
int clen = 2;
uint u = qt_Gb18030ToUnicode(buf, clen);
if (clen == 2) {
- result += qValidChar(u);
+ resultData[unicodeLen] = qValidChar(static_cast<ushort>(u));
+ ++unicodeLen;
} else {
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
}
nbuf = 0;
} else {
// Error
- result += replacement;
+ resultData[unicodeLen] = replacement;
+ ++unicodeLen;
++invalid;
nbuf = 0;
}
break;
}
}
+ result.resize(unicodeLen);
if (state) {
state->remainingChars = nbuf;
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 655026c..7bccffe 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -438,6 +438,53 @@ qsreal ToNumber(const QString &value)
#endif
+static const qsreal MsPerSecond = 1000.0;
+
+static inline int MsFromTime(qsreal t)
+{
+ int r = int(::fmod(t, MsPerSecond));
+ return (r >= 0) ? r : r + int(MsPerSecond);
+}
+
+/*!
+ \internal
+ Converts a JS date value (milliseconds) to a QDateTime (local time).
+*/
+QDateTime MsToDateTime(JSC::ExecState *exec, qsreal t)
+{
+ if (qIsNaN(t))
+ return QDateTime();
+ JSC::GregorianDateTime tm;
+ JSC::msToGregorianDateTime(exec, t, /*output UTC=*/true, tm);
+ int ms = MsFromTime(t);
+ QDateTime convertedUTC = QDateTime(QDate(tm.year + 1900, tm.month + 1, tm.monthDay),
+ QTime(tm.hour, tm.minute, tm.second, ms), Qt::UTC);
+ return convertedUTC.toLocalTime();
+}
+
+/*!
+ \internal
+ Converts a QDateTime to a JS date value (milliseconds).
+*/
+qsreal DateTimeToMs(JSC::ExecState *exec, const QDateTime &dt)
+{
+ if (!dt.isValid())
+ return qSNaN();
+ QDateTime utc = dt.toUTC();
+ QDate date = utc.date();
+ QTime time = utc.time();
+ JSC::GregorianDateTime tm;
+ tm.year = date.year() - 1900;
+ tm.month = date.month() - 1;
+ tm.monthDay = date.day();
+ tm.weekDay = date.dayOfWeek();
+ tm.yearDay = date.dayOfYear();
+ tm.hour = time.hour();
+ tm.minute = time.minute();
+ tm.second = time.second();
+ return JSC::gregorianDateTimeToMS(exec, tm, time.msec(), /*inputIsUTC=*/true);
+}
+
void GlobalClientData::mark(JSC::MarkStack& markStack)
{
engine->mark(markStack);
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 1b35704..c71465d 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -50,7 +50,6 @@
#include "bridge/qscriptobject_p.h"
#include "bridge/qscriptqobject_p.h"
#include "bridge/qscriptvariant_p.h"
-#include "utils/qscriptdate_p.h"
#include "DateConstructor.h"
#include "DateInstance.h"
@@ -119,6 +118,9 @@ namespace QScript
inline QString ToString(qsreal);
#endif
+ QDateTime MsToDateTime(JSC::ExecState *, qsreal);
+ qsreal DateTimeToMs(JSC::ExecState *, const QDateTime &);
+
//some conversion helper functions
inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec);
bool isFunction(JSC::JSValue value);
@@ -861,7 +863,7 @@ inline JSC::JSValue QScriptEnginePrivate::newDate(JSC::ExecState *exec, qsreal v
inline JSC::JSValue QScriptEnginePrivate::newDate(JSC::ExecState *exec, const QDateTime &value)
{
- return newDate(exec, QScript::FromDateTime(value));
+ return newDate(exec, QScript::DateTimeToMs(exec, value));
}
inline JSC::JSValue QScriptEnginePrivate::newObject()
@@ -994,12 +996,12 @@ inline JSC::UString QScriptEnginePrivate::toString(JSC::ExecState *exec, JSC::JS
return str;
}
-inline QDateTime QScriptEnginePrivate::toDateTime(JSC::ExecState *, JSC::JSValue value)
+inline QDateTime QScriptEnginePrivate::toDateTime(JSC::ExecState *exec, JSC::JSValue value)
{
if (!isDate(value))
return QDateTime();
qsreal t = static_cast<JSC::DateInstance*>(JSC::asObject(value))->internalNumber();
- return QScript::ToDateTime(t, Qt::LocalTime);
+ return QScript::MsToDateTime(exec, t);
}
inline QObject *QScriptEnginePrivate::toQObject(JSC::ExecState *exec, JSC::JSValue value)
diff --git a/src/script/script.pri b/src/script/script.pri
index 2ee1a82..9cd71d3 100644
--- a/src/script/script.pri
+++ b/src/script/script.pri
@@ -1,4 +1,3 @@
include($$PWD/api/api.pri)
include($$PWD/bridge/bridge.pri)
include($$PWD/parser/parser.pri)
-include($$PWD/utils/utils.pri)
diff --git a/src/script/utils/qscriptdate.cpp b/src/script/utils/qscriptdate.cpp
deleted file mode 100644
index 5980256..0000000
--- a/src/script/utils/qscriptdate.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtScript module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL-ONLY$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscriptdate_p.h"
-
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstringlist.h>
-
-#include <math.h>
-
-#ifndef Q_WS_WIN
-# include <time.h>
-# include <sys/time.h>
-#else
-# include <windows.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-namespace QScript {
-
-qsreal ToInteger(qsreal n);
-
-static const qsreal HoursPerDay = 24.0;
-static const qsreal MinutesPerHour = 60.0;
-static const qsreal SecondsPerMinute = 60.0;
-static const qsreal msPerSecond = 1000.0;
-static const qsreal msPerMinute = 60000.0;
-static const qsreal msPerHour = 3600000.0;
-static const qsreal msPerDay = 86400000.0;
-
-static qsreal LocalTZA = 0.0; // initialized at startup
-
-static inline qsreal TimeWithinDay(qsreal t)
-{
- qsreal r = ::fmod(t, msPerDay);
- return (r >= 0) ? r : r + msPerDay;
-}
-
-static inline int HourFromTime(qsreal t)
-{
- int r = int(::fmod(::floor(t / msPerHour), HoursPerDay));
- return (r >= 0) ? r : r + int(HoursPerDay);
-}
-
-static inline int MinFromTime(qsreal t)
-{
- int r = int(::fmod(::floor(t / msPerMinute), MinutesPerHour));
- return (r >= 0) ? r : r + int(MinutesPerHour);
-}
-
-static inline int SecFromTime(qsreal t)
-{
- int r = int(::fmod(::floor(t / msPerSecond), SecondsPerMinute));
- return (r >= 0) ? r : r + int(SecondsPerMinute);
-}
-
-static inline int msFromTime(qsreal t)
-{
- int r = int(::fmod(t, msPerSecond));
- return (r >= 0) ? r : r + int(msPerSecond);
-}
-
-static inline qsreal Day(qsreal t)
-{
- return ::floor(t / msPerDay);
-}
-
-static inline qsreal DaysInYear(qsreal y)
-{
- if (::fmod(y, 4))
- return 365;
-
- else if (::fmod(y, 100))
- return 366;
-
- else if (::fmod(y, 400))
- return 365;
-
- return 366;
-}
-
-static inline qsreal DayFromYear(qsreal y)
-{
- return 365 * (y - 1970)
- + ::floor((y - 1969) / 4)
- - ::floor((y - 1901) / 100)
- + ::floor((y - 1601) / 400);
-}
-
-static inline qsreal TimeFromYear(qsreal y)
-{
- return msPerDay * DayFromYear(y);
-}
-
-static inline qsreal YearFromTime(qsreal t)
-{
- int y = 1970;
- y += (int) ::floor(t / (msPerDay * 365.2425));
-
- qsreal t2 = TimeFromYear(y);
- return (t2 > t) ? y - 1 : ((t2 + msPerDay * DaysInYear(y)) <= t) ? y + 1 : y;
-}
-
-static inline bool InLeapYear(qsreal t)
-{
- qsreal x = DaysInYear(YearFromTime(t));
- if (x == 365)
- return 0;
-
- Q_ASSERT (x == 366);
- return 1;
-}
-
-static inline qsreal DayWithinYear(qsreal t)
-{
- return Day(t) - DayFromYear(YearFromTime(t));
-}
-
-static inline qsreal MonthFromTime(qsreal t)
-{
- qsreal d = DayWithinYear(t);
- qsreal l = InLeapYear(t);
-
- if (d < 31.0)
- return 0;
-
- else if (d < 59.0 + l)
- return 1;
-
- else if (d < 90.0 + l)
- return 2;
-
- else if (d < 120.0 + l)
- return 3;
-
- else if (d < 151.0 + l)
- return 4;
-
- else if (d < 181.0 + l)
- return 5;
-
- else if (d < 212.0 + l)
- return 6;
-
- else if (d < 243.0 + l)
- return 7;
-
- else if (d < 273.0 + l)
- return 8;
-
- else if (d < 304.0 + l)
- return 9;
-
- else if (d < 334.0 + l)
- return 10;
-
- else if (d < 365.0 + l)
- return 11;
-
- return qSNaN(); // ### assert?
-}
-
-static inline qsreal DateFromTime(qsreal t)
-{
- int m = (int) ToInteger(MonthFromTime(t));
- qsreal d = DayWithinYear(t);
- qsreal l = InLeapYear(t);
-
- switch (m) {
- case 0: return d + 1.0;
- case 1: return d - 30.0;
- case 2: return d - 58.0 - l;
- case 3: return d - 89.0 - l;
- case 4: return d - 119.0 - l;
- case 5: return d - 150.0 - l;
- case 6: return d - 180.0 - l;
- case 7: return d - 211.0 - l;
- case 8: return d - 242.0 - l;
- case 9: return d - 272.0 - l;
- case 10: return d - 303.0 - l;
- case 11: return d - 333.0 - l;
- }
-
- return qSNaN(); // ### assert
-}
-
-static inline qsreal WeekDay(qsreal t)
-{
- qsreal r = ::fmod (Day(t) + 4.0, 7.0);
- return (r >= 0) ? r : r + 7.0;
-}
-
-
-static inline qsreal MakeTime(qsreal hour, qsreal min, qsreal sec, qsreal ms)
-{
- return ((hour * MinutesPerHour + min) * SecondsPerMinute + sec) * msPerSecond + ms;
-}
-
-static inline qsreal DayFromMonth(qsreal month, qsreal leap)
-{
- switch ((int) month) {
- case 0: return 0;
- case 1: return 31.0;
- case 2: return 59.0 + leap;
- case 3: return 90.0 + leap;
- case 4: return 120.0 + leap;
- case 5: return 151.0 + leap;
- case 6: return 181.0 + leap;
- case 7: return 212.0 + leap;
- case 8: return 243.0 + leap;
- case 9: return 273.0 + leap;
- case 10: return 304.0 + leap;
- case 11: return 334.0 + leap;
- }
-
- return qSNaN(); // ### assert?
-}
-
-static qsreal MakeDay(qsreal year, qsreal month, qsreal day)
-{
- year += ::floor(month / 12.0);
-
- month = ::fmod(month, 12.0);
- if (month < 0)
- month += 12.0;
-
- qsreal t = TimeFromYear(year);
- qsreal leap = InLeapYear(t);
-
- day += ::floor(t / msPerDay);
- day += DayFromMonth(month, leap);
-
- return day - 1;
-}
-
-static inline qsreal MakeDate(qsreal day, qsreal time)
-{
- return day * msPerDay + time;
-}
-
-static inline qsreal DaylightSavingTA(double t)
-{
-#ifndef Q_WS_WIN
- long int tt = (long int)(t / msPerSecond);
- struct tm *tmtm = localtime((const time_t*)&tt);
- if (! tmtm)
- return 0;
- return (tmtm->tm_isdst > 0) ? msPerHour : 0;
-#else
- Q_UNUSED(t);
- /// ### implement me
- return 0;
-#endif
-}
-
-static inline qsreal LocalTime(qsreal t)
-{
- return t + LocalTZA + DaylightSavingTA(t);
-}
-
-static inline qsreal UTC(qsreal t)
-{
- return t - LocalTZA - DaylightSavingTA(t - LocalTZA);
-}
-
-static inline qsreal TimeClip(qsreal t)
-{
- if (! qIsFinite(t) || fabs(t) > 8.64e15)
- return qSNaN();
- return ToInteger(t);
-}
-
-static qsreal getLocalTZA()
-{
-#ifndef Q_WS_WIN
- struct tm* t;
- time_t curr;
- time(&curr);
- t = localtime(&curr);
- time_t locl = mktime(t);
- t = gmtime(&curr);
- time_t globl = mktime(t);
- return double(locl - globl) * 1000.0;
-#else
- TIME_ZONE_INFORMATION tzInfo;
- GetTimeZoneInformation(&tzInfo);
- return -tzInfo.Bias * 60.0 * 1000.0;
-#endif
-}
-
-/*!
- \internal
-
- Converts the QDateTime \a dt to an ECMA Date value (in UTC form).
-*/
-qsreal FromDateTime(const QDateTime &dt)
-{
- if (!dt.isValid())
- return qSNaN();
- if (!LocalTZA) // ### move
- LocalTZA = getLocalTZA();
- QDate date = dt.date();
- QTime taim = dt.time();
- int year = date.year();
- int month = date.month() - 1;
- int day = date.day();
- int hours = taim.hour();
- int mins = taim.minute();
- int secs = taim.second();
- int ms = taim.msec();
- double t = MakeDate(MakeDay(year, month, day),
- MakeTime(hours, mins, secs, ms));
- if (dt.timeSpec() == Qt::LocalTime)
- t = UTC(t);
- return TimeClip(t);
-}
-
-/*!
- \internal
-
- Converts the ECMA Date value \tt (in UTC form) to QDateTime
- according to \a spec.
-*/
-QDateTime ToDateTime(qsreal t, Qt::TimeSpec spec)
-{
- if (qIsNaN(t))
- return QDateTime();
- if (!LocalTZA) // ### move
- LocalTZA = getLocalTZA();
- if (spec == Qt::LocalTime)
- t = LocalTime(t);
- int year = int(YearFromTime(t));
- int month = int(MonthFromTime(t) + 1);
- int day = int(DateFromTime(t));
- int hours = HourFromTime(t);
- int mins = MinFromTime(t);
- int secs = SecFromTime(t);
- int ms = msFromTime(t);
- return QDateTime(QDate(year, month, day), QTime(hours, mins, secs, ms), spec);
-}
-
-} // namespace QScript
-
-QT_END_NAMESPACE
diff --git a/src/script/utils/qscriptdate_p.h b/src/script/utils/qscriptdate_p.h
deleted file mode 100644
index b9c9fd4..0000000
--- a/src/script/utils/qscriptdate_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtScript module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL-ONLY$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCRIPTDATE_P_H
-#define QSCRIPTDATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qdatetime.h>
-
-QT_BEGIN_NAMESPACE
-
-typedef double qsreal;
-
-namespace QScript
-{
- qsreal FromDateTime(const QDateTime &dt);
- QDateTime ToDateTime(qsreal t, Qt::TimeSpec spec);
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/script/utils/utils.pri b/src/script/utils/utils.pri
deleted file mode 100644
index d8302d5..0000000
--- a/src/script/utils/utils.pri
+++ /dev/null
@@ -1,5 +0,0 @@
-SOURCES += \
- $$PWD/qscriptdate.cpp
-
-HEADERS += \
- $$PWD/qscriptdate_p.h
diff --git a/tests/auto/qsemaphore/tst_qsemaphore.cpp b/tests/auto/qsemaphore/tst_qsemaphore.cpp
index ace33dc..7cede30 100644
--- a/tests/auto/qsemaphore/tst_qsemaphore.cpp
+++ b/tests/auto/qsemaphore/tst_qsemaphore.cpp
@@ -63,6 +63,7 @@ private slots:
void tryAcquire();
void tryAcquireWithTimeout_data();
void tryAcquireWithTimeout();
+ void tryAcquireWithTimeoutStarvation();
void release();
void available();
void producerConsumer();
@@ -232,8 +233,8 @@ void tst_QSemaphore::tryAcquireWithTimeout_data()
{
QTest::addColumn<int>("timeout");
- QTest::newRow("") << 1000;
- QTest::newRow("") << 10000;
+ QTest::newRow("1s") << 1000;
+ QTest::newRow("10s") << 10000;
}
void tst_QSemaphore::tryAcquireWithTimeout()
@@ -316,6 +317,50 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QCOMPARE(semaphore.available(), 0);
}
+void tst_QSemaphore::tryAcquireWithTimeoutStarvation()
+{
+ class Thread : public QThread
+ {
+ public:
+ QSemaphore startup;
+ QSemaphore *semaphore;
+ int amountToConsume, timeout;
+
+ void run()
+ {
+ startup.release();
+ forever {
+ if (!semaphore->tryAcquire(amountToConsume, timeout))
+ break;
+ semaphore->release(amountToConsume);
+ }
+ }
+ };
+
+ QSemaphore semaphore;
+ semaphore.release(1);
+
+ Thread consumer;
+ consumer.semaphore = &semaphore;
+ consumer.amountToConsume = 1;
+ consumer.timeout = 1000;
+
+ // start the thread and wait for it to start consuming
+ consumer.start();
+ consumer.startup.acquire();
+
+ // try to consume more than the thread we started is, and provide a longer
+ // timeout... we should timeout, not wait indefinitely
+ QVERIFY(!semaphore.tryAcquire(consumer.amountToConsume * 2, consumer.timeout * 2));
+
+ // the consumer should still be running
+ QVERIFY(consumer.isRunning() && !consumer.isFinished());
+
+ // acquire, and wait for smallConsumer to timeout
+ semaphore.acquire();
+ QVERIFY(consumer.wait());
+}
+
void tst_QSemaphore::release()
{ DEPENDS_ON("acquire"); }
diff --git a/tools/qdoc3/codechunk.h b/tools/qdoc3/codechunk.h
index e78873c..a0c554e 100644
--- a/tools/qdoc3/codechunk.h
+++ b/tools/qdoc3/codechunk.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
/*
The CodeChunk class represents a tiny piece of C++ code.
- The class provides convertion between a list of lexemes and a string. It adds
+ The class provides conversion between a list of lexemes and a string. It adds
spaces at the right place for consistent style. The tiny pieces of code it
represents are data types, enum values, and default parameter values.
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 13678af..ce7eba3 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -1850,16 +1850,40 @@ bool CppCodeParser::matchProperty(InnerNode *parent)
else if (key == "WRITE") {
tre->addPropertyFunction(property, value, PropertyNode::Setter);
property->setWritable(true);
- } else if (key == "STORED")
+ }
+ else if (key == "STORED")
property->setStored(value.toLower() == "true");
- else if (key == "DESIGNABLE")
- property->setDesignable(value.toLower() == "true");
+ else if (key == "DESIGNABLE") {
+ QString v = value.toLower();
+ if (v == "true")
+ property->setDesignable(true);
+ else if (v == "false")
+ property->setDesignable(false);
+ else {
+ property->setDesignable(false);
+ property->setRuntimeDesFunc(value);
+ }
+ }
else if (key == "RESET")
tre->addPropertyFunction(property, value, PropertyNode::Resetter);
else if (key == "NOTIFY") {
tre->addPropertyFunction(property, value, PropertyNode::Notifier);
}
-
+ else if (key == "SCRIPTABLE") {
+ QString v = value.toLower();
+ if (v == "true")
+ property->setScriptable(true);
+ else if (v == "false")
+ property->setScriptable(false);
+ else {
+ property->setScriptable(false);
+ property->setRuntimeScrFunc(value);
+ }
+ }
+ else if (key == "COSTANT")
+ property->setConstant();
+ else if (key == "FINAL")
+ property->setFinal();
}
match(Tok_RightParen);
return true;
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index be734ac..0135983 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -4573,7 +4573,8 @@ void DitaXmlGenerator::writeLocation(const Node* n)
s2 = CXXTYPEDEFDECLARATIONFILE;
s3 = CXXTYPEDEFDECLARATIONFILELINE;
}
- else if (n->type() == Node::Property) {
+ else if ((n->type() == Node::Property) ||
+ (n->type() == Node::Variable)) {
s1 = CXXVARIABLEAPIITEMLOCATION;
s2 = CXXVARIABLEDECLARATIONFILE;
s3 = CXXVARIABLEDECLARATIONFILELINE;
@@ -4716,6 +4717,8 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke
writer.writeStartElement(CXXFUNCTIONPARAMETER);
writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE);
writer.writeCharacters((*p).leftType());
+ if (!(*p).rightType().isEmpty())
+ writer.writeCharacters((*p).rightType());
writer.writeEndElement(); // <cxxFunctionParameterDeclaredType>
writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME);
writer.writeCharacters((*p).name());
@@ -4888,12 +4891,6 @@ void DitaXmlGenerator::writeTypedefs(const Section& s,
}
}
-void DitaXmlGenerator::writeDataMembers(const Section& s,
- const ClassNode* cn,
- CodeMarker* marker)
-{
-}
-
void DitaXmlGenerator::writeProperties(const Section& s,
const ClassNode* cn,
CodeMarker* marker)
@@ -4914,9 +4911,9 @@ void DitaXmlGenerator::writeProperties(const Section& s,
writer.writeAttribute("value",pn->accessString());
writer.writeEndElement(); // <cxxVariableAccessSpecifier>
- if (!pn->dataType().isEmpty()) {
+ if (!pn->qualifiedDataType().isEmpty()) {
writer.writeStartElement(CXXVARIABLEDECLAREDTYPE);
- writer.writeCharacters(pn->dataType());
+ writer.writeCharacters(pn->qualifiedDataType());
writer.writeEndElement(); // <cxxVariableDeclaredType>
}
QString fq = fullQualification(pn);
@@ -4925,11 +4922,49 @@ void DitaXmlGenerator::writeProperties(const Section& s,
writer.writeCharacters(fq);
writer.writeEndElement(); // <cxxVariableScopedName>
}
+
+ writer.writeStartElement(CXXVARIABLEPROTOTYPE);
+ writer.writeCharacters("Q_PROPERTY(");
+ writer.writeCharacters(pn->qualifiedDataType());
+ writer.writeCharacters(" ");
+ writer.writeCharacters(pn->name());
+ writerFunctions("READ",pn->getters());
+ writerFunctions("WRITE",pn->setters());
+ writerFunctions("RESET",pn->resetters());
+ writerFunctions("NOTIFY",pn->notifiers());
+ if (pn->isDesignable() != pn->designableDefault()) {
+ writer.writeCharacters(" DESIGNABLE ");
+ if (!pn->runtimeDesignabilityFunction().isEmpty())
+ writer.writeCharacters(pn->runtimeDesignabilityFunction());
+ else
+ writer.writeCharacters(pn->isDesignable() ? "true" : "false");
+ }
+ if (pn->isScriptable() != pn->scriptableDefault()) {
+ writer.writeCharacters(" SCRIPTABLE ");
+ if (!pn->runtimeScriptabilityFunction().isEmpty())
+ writer.writeCharacters(pn->runtimeScriptabilityFunction());
+ else
+ writer.writeCharacters(pn->isScriptable() ? "true" : "false");
+ }
+ if (pn->isWritable() != pn->writableDefault()) {
+ writer.writeCharacters(" STORED ");
+ writer.writeCharacters(pn->isStored() ? "true" : "false");
+ }
+ if (pn->isUser() != pn->userDefault()) {
+ writer.writeCharacters(" USER ");
+ writer.writeCharacters(pn->isUser() ? "true" : "false");
+ }
+ if (pn->isConstant())
+ writer.writeCharacters(" CONSTANT");
+ if (pn->isFinal())
+ writer.writeCharacters(" FINAL");
+ writer.writeCharacters(")");
+ writer.writeEndElement(); // <cxxVariablePrototype>
+
writer.writeStartElement(CXXVARIABLENAMELOOKUP);
writer.writeCharacters(pn->parent()->name() + "::" + pn->name());
writer.writeEndElement(); // <cxxVariableNameLookup>
-
if (pn->overriddenFrom() != 0) {
PropertyNode* opn = (PropertyNode*)pn->overriddenFrom();
writer.writeStartElement(CXXVARIABLEREIMPLEMENTED);
@@ -4954,4 +4989,77 @@ void DitaXmlGenerator::writeProperties(const Section& s,
}
}
+void DitaXmlGenerator::writeDataMembers(const Section& s,
+ const ClassNode* cn,
+ CodeMarker* marker)
+{
+ NodeList::ConstIterator m = s.members.begin();
+ while (m != s.members.end()) {
+ if ((*m)->type() == Node::Variable) {
+ const VariableNode* vn = static_cast<const VariableNode*>(*m);
+ writer.writeStartElement(CXXVARIABLE);
+ writer.writeAttribute("id",vn->guid());
+ writer.writeStartElement(APINAME);
+ writer.writeCharacters(vn->name());
+ writer.writeEndElement(); // </apiName>
+ generateBrief(vn,marker);
+ writer.writeStartElement(CXXVARIABLEDETAIL);
+ writer.writeStartElement(CXXVARIABLEDEFINITION);
+ writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER);
+ writer.writeAttribute("value",vn->accessString());
+ writer.writeEndElement(); // <cxxVariableAccessSpecifier>
+
+ writer.writeStartElement(CXXVARIABLEDECLAREDTYPE);
+ writer.writeCharacters(vn->leftType());
+ if (!vn->rightType().isEmpty())
+ writer.writeCharacters(vn->rightType());
+ writer.writeEndElement(); // <cxxVariableDeclaredType>
+
+ QString fq = fullQualification(vn);
+ if (!fq.isEmpty()) {
+ writer.writeStartElement(CXXVARIABLESCOPEDNAME);
+ writer.writeCharacters(fq);
+ writer.writeEndElement(); // <cxxVariableScopedName>
+ }
+
+ writer.writeStartElement(CXXVARIABLEPROTOTYPE);
+ writer.writeCharacters(vn->leftType() + " ");
+ //writer.writeCharacters(vn->parent()->name() + "::" + vn->name());
+ writer.writeCharacters(vn->name());
+ if (!vn->rightType().isEmpty())
+ writer.writeCharacters(vn->rightType());
+ writer.writeEndElement(); // <cxxVariablePrototype>
+
+ writer.writeStartElement(CXXVARIABLENAMELOOKUP);
+ writer.writeCharacters(vn->parent()->name() + "::" + vn->name());
+ writer.writeEndElement(); // <cxxVariableNameLookup>
+
+ writeLocation(vn);
+ writer.writeEndElement(); // <cxxVariableDefinition>
+ writer.writeStartElement(APIDESC);
+
+ if (!vn->doc().isEmpty()) {
+ generateBody(vn, marker);
+ }
+
+ writer.writeEndElement(); // </apiDesc>
+ writer.writeEndElement(); // </cxxVariableDetail>
+ writer.writeEndElement(); // </cxxVariable>
+ }
+ ++m;
+ }
+}
+
+void DitaXmlGenerator::writerFunctions(const QString& tag, const NodeList& nlist)
+{
+ NodeList::const_iterator n = nlist.begin();
+ while (n != nlist.end()) {
+ writer.writeCharacters(" ");
+ writer.writeCharacters(tag);
+ writer.writeCharacters(" ");
+ writer.writeCharacters((*n)->name());
+ ++n;
+ }
+}
+
QT_END_NAMESPACE
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 8c7e439..26788d7 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -133,6 +133,7 @@ class DitaXmlGenerator : public PageGenerator
void writeProperties(const Section& s,
const ClassNode* cn,
CodeMarker* marker);
+ void writerFunctions(const QString& tag, const NodeList& nlist);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 339c390..b93db4f 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1891,6 +1891,16 @@ void HtmlGenerator::generateFooter(const Node *node)
else
{
out() << " <script src=\"scripts/functions.js\" type=\"text/javascript\"></script>\n";
+ out() << " <!-- <script type=\"text/javascript\">\n";
+ out() << " var _gaq = _gaq || [];\n";
+ out() << " _gaq.push(['_setAccount', 'UA-4457116-5']);\n";
+ out() << " _gaq.push(['_trackPageview']);\n";
+ out() << " (function() {\n";
+ out() << " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n";
+ out() << " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n";
+ out() << " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n";
+ out() << " })();\n";
+ out() << " </script> -->\n";
out() << "</body>\n";
}
out() << "</html>\n";
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 26957ac..7596825 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1287,21 +1287,39 @@ void FunctionNode::debug() const
/*!
\class PropertyNode
+
+ This class describes one instance of using the Q_PROPERTY macro.
*/
/*!
+ The constructor sets the \a parent and the \a name, but
+ everything else is set to default values.
*/
PropertyNode::PropertyNode(InnerNode *parent, const QString& name)
: LeafNode(Property, parent, name),
sto(Trool_Default),
des(Trool_Default),
+ scr(Trool_Default),
+ wri(Trool_Default),
+ usr(Trool_Default),
+ cst(false),
+ fnl(false),
overrides(0)
{
+ // nothing.
}
/*!
+ Sets this property's \e {overridden from} property to
+ \a baseProperty, which indicates that this property
+ overrides \a baseProperty. To begin with, all the values
+ in this property are set to the corresponding values in
+ \a baseProperty.
+
+ We probably should ensure that the constant and final
+ attributes are not being overridden improperly.
*/
-void PropertyNode::setOverriddenFrom(const PropertyNode *baseProperty)
+void PropertyNode::setOverriddenFrom(const PropertyNode* baseProperty)
{
for (int i = 0; i < NumFunctionRoles; ++i) {
if (funcs[i].isEmpty())
@@ -1311,6 +1329,12 @@ void PropertyNode::setOverriddenFrom(const PropertyNode *baseProperty)
sto = baseProperty->sto;
if (des == Trool_Default)
des = baseProperty->des;
+ if (scr == Trool_Default)
+ scr = baseProperty->scr;
+ if (wri == Trool_Default)
+ wri = baseProperty->wri;
+ if (usr == Trool_Default)
+ usr = baseProperty->usr;
overrides = baseProperty;
}
@@ -1336,7 +1360,9 @@ QString PropertyNode::qualifiedDataType() const
}
}
-/*!
+/*! Converts the \a boolean value to an enum representation
+ of the boolean type, which includes an enum value for the
+ \e {default value} of the item, i.e. true, false, or default.
*/
PropertyNode::Trool PropertyNode::toTrool(bool boolean)
{
@@ -1344,6 +1370,15 @@ PropertyNode::Trool PropertyNode::toTrool(bool boolean)
}
/*!
+ Converts the enum \a troolean back to a boolean value.
+ If \a troolean is neither the true enum value nor the
+ false enum value, the boolean value returned is
+ \a defaultValue.
+
+ Note that runtimeDesignabilityFunction() should be called
+ first. If that function returns the name of a function, it
+ means the function must be called at runtime to determine
+ whether the property is Designable.
*/
bool PropertyNode::fromTrool(Trool troolean, bool defaultValue)
{
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 37f2f26..b13e113 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -153,7 +153,7 @@ class Node
void setStatus(Status status) { sta = status; }
void setThreadSafeness(ThreadSafeness safeness) { saf = safeness; }
void setSince(const QString &since) { sinc = since; }
- void setRelates(InnerNode *pseudoParent);
+ void setRelates(InnerNode* pseudoParent);
void setModuleName(const QString &module) { mod = module; }
void setLink(LinkType linkType, const QString &link, const QString &desc);
void setUrl(const QString &url);
@@ -167,8 +167,8 @@ class Node
virtual bool isQmlNode() const { return false; }
Type type() const { return typ; }
virtual SubType subType() const { return NoSubType; }
- InnerNode *parent() const { return par; }
- InnerNode *relates() const { return rel; }
+ InnerNode* parent() const { return par; }
+ InnerNode* relates() const { return rel; }
const QString& name() const { return nam; }
QMap<LinkType, QPair<QString,QString> > links() const { return linkMap; }
QString moduleName() const;
@@ -195,7 +195,7 @@ class Node
QString ditaXmlHref();
protected:
- Node(Type type, InnerNode *parent, const QString& name);
+ Node(Type type, InnerNode* parent, const QString& name);
private:
@@ -212,8 +212,8 @@ class Node
PageType pageTyp : 4;
Status sta : 3;
#endif
- InnerNode *par;
- InnerNode *rel;
+ InnerNode* par;
+ InnerNode* rel;
QString nam;
Location loc;
Doc d;
@@ -228,35 +228,35 @@ class Node
class FunctionNode;
class EnumNode;
-typedef QList<Node *> NodeList;
+typedef QList<Node*> NodeList;
class InnerNode : public Node
{
public:
virtual ~InnerNode();
- Node *findNode(const QString& name);
- Node *findNode(const QString& name, Type type);
- FunctionNode *findFunctionNode(const QString& name);
- FunctionNode *findFunctionNode(const FunctionNode *clone);
+ Node* findNode(const QString& name);
+ Node* findNode(const QString& name, Type type);
+ FunctionNode* findFunctionNode(const QString& name);
+ FunctionNode* findFunctionNode(const FunctionNode* clone);
void addInclude(const QString &include);
void setIncludes(const QStringList &includes);
- void setOverload(const FunctionNode *func, bool overlode);
+ void setOverload(const FunctionNode* func, bool overlode);
void normalizeOverloads();
void makeUndocumentedChildrenInternal();
void deleteChildren();
void removeFromRelated();
virtual bool isInnerNode() const;
- const Node *findNode(const QString& name) const;
- const Node *findNode(const QString& name, Type type) const;
- const FunctionNode *findFunctionNode(const QString& name) const;
- const FunctionNode *findFunctionNode(const FunctionNode *clone) const;
- const EnumNode *findEnumNodeForValue(const QString &enumValue) const;
+ const Node* findNode(const QString& name) const;
+ const Node* findNode(const QString& name, Type type) const;
+ const FunctionNode* findFunctionNode(const QString& name) const;
+ const FunctionNode* findFunctionNode(const FunctionNode* clone) const;
+ const EnumNode* findEnumNodeForValue(const QString &enumValue) const;
const NodeList & childNodes() const { return children; }
const NodeList & relatedNodes() const { return related; }
int count() const { return children.size(); }
- int overloadNumber(const FunctionNode *func) const;
+ int overloadNumber(const FunctionNode* func) const;
int numOverloads(const QString& funcName) const;
NodeList overloads(const QString &funcName) const;
const QStringList& includes() const { return inc; }
@@ -269,23 +269,23 @@ class InnerNode : public Node
virtual void setAbstract(bool ) { }
protected:
- InnerNode(Type type, InnerNode *parent, const QString& name);
+ InnerNode(Type type, InnerNode* parent, const QString& name);
private:
friend class Node;
- static bool isSameSignature(const FunctionNode *f1, const FunctionNode *f2);
- void addChild(Node *child);
- void removeChild(Node *child);
- void removeRelated(Node *pseudoChild);
+ static bool isSameSignature(const FunctionNode* f1, const FunctionNode* f2);
+ void addChild(Node* child);
+ void removeChild(Node* child);
+ void removeRelated(Node* pseudoChild);
QStringList pageKeywds;
QStringList inc;
NodeList children;
NodeList enumChildren;
NodeList related;
- QMap<QString, Node *> childMap;
- QMap<QString, Node *> primaryFunctionMap;
+ QMap<QString, Node*> childMap;
+ QMap<QString, Node*> primaryFunctionMap;
QMap<QString, NodeList> secondaryFunctionMap;
};
@@ -304,7 +304,7 @@ class LeafNode : public Node
class NamespaceNode : public InnerNode
{
public:
- NamespaceNode(InnerNode *parent, const QString& name);
+ NamespaceNode(InnerNode* parent, const QString& name);
virtual ~NamespaceNode() { }
};
@@ -329,11 +329,11 @@ struct RelatedClass
class ClassNode : public InnerNode
{
public:
- ClassNode(InnerNode *parent, const QString& name);
+ ClassNode(InnerNode* parent, const QString& name);
virtual ~ClassNode() { }
void addBaseClass(Access access,
- ClassNode *node,
+ ClassNode* node,
const QString &dataTypeWithTemplateArgs = "");
void fixBaseClasses();
@@ -363,12 +363,12 @@ class FakeNode : public InnerNode
{
public:
- FakeNode(InnerNode *parent, const QString& name, SubType subType);
+ FakeNode(InnerNode* parent, const QString& name, SubType subType);
virtual ~FakeNode() { }
void setTitle(const QString &title) { tle = title; }
void setSubTitle(const QString &subTitle) { stle = subTitle; }
- void addGroupMember(Node *node) { gr.append(node); }
+ void addGroupMember(Node* node) { gr.append(node); }
SubType subType() const { return sub; }
QString title() const { return tle; }
@@ -388,7 +388,7 @@ class FakeNode : public InnerNode
class QmlClassNode : public FakeNode
{
public:
- QmlClassNode(InnerNode *parent,
+ QmlClassNode(InnerNode* parent,
const QString& name,
const ClassNode* cn);
virtual ~QmlClassNode();
@@ -411,7 +411,7 @@ class QmlClassNode : public FakeNode
class QmlBasicTypeNode : public FakeNode
{
public:
- QmlBasicTypeNode(InnerNode *parent,
+ QmlBasicTypeNode(InnerNode* parent,
const QString& name);
virtual ~QmlBasicTypeNode() { }
virtual bool isQmlNode() const { return true; }
@@ -498,41 +498,41 @@ class TypedefNode;
class EnumNode : public LeafNode
{
public:
- EnumNode(InnerNode *parent, const QString& name);
+ EnumNode(InnerNode* parent, const QString& name);
virtual ~EnumNode() { }
void addItem(const EnumItem& item);
- void setFlagsType(TypedefNode *typedeff);
+ void setFlagsType(TypedefNode* typedeff);
bool hasItem(const QString &name) const { return names.contains(name); }
const QList<EnumItem>& items() const { return itms; }
Access itemAccess(const QString& name) const;
- const TypedefNode *flagsType() const { return ft; }
+ const TypedefNode* flagsType() const { return ft; }
QString itemValue(const QString &name) const;
private:
QList<EnumItem> itms;
QSet<QString> names;
- const TypedefNode *ft;
+ const TypedefNode* ft;
};
class TypedefNode : public LeafNode
{
public:
- TypedefNode(InnerNode *parent, const QString& name);
+ TypedefNode(InnerNode* parent, const QString& name);
virtual ~TypedefNode() { }
- const EnumNode *associatedEnum() const { return ae; }
+ const EnumNode* associatedEnum() const { return ae; }
private:
- void setAssociatedEnum(const EnumNode *enume);
+ void setAssociatedEnum(const EnumNode* enume);
friend class EnumNode;
- const EnumNode *ae;
+ const EnumNode* ae;
};
-inline void EnumNode::setFlagsType(TypedefNode *typedeff)
+inline void EnumNode::setFlagsType(TypedefNode* typedeff)
{
ft = typedeff;
typedeff->setAssociatedEnum(this);
@@ -584,8 +584,8 @@ class FunctionNode : public LeafNode
Native };
enum Virtualness { NonVirtual, ImpureVirtual, PureVirtual };
- FunctionNode(InnerNode *parent, const QString &name);
- FunctionNode(Type type, InnerNode *parent, const QString &name, bool attached);
+ FunctionNode(InnerNode* parent, const QString &name);
+ FunctionNode(Type type, InnerNode* parent, const QString &name, bool attached);
virtual ~FunctionNode() { }
void setReturnType(const QString& returnType) { rt = returnType; }
@@ -598,8 +598,8 @@ class FunctionNode : public LeafNode
void setReimp(bool r);
void addParameter(const Parameter& parameter);
inline void setParameters(const QList<Parameter>& parameters);
- void borrowParameterNames(const FunctionNode *source);
- void setReimplementedFrom(FunctionNode *from);
+ void borrowParameterNames(const FunctionNode* source);
+ void setReimplementedFrom(FunctionNode* from);
const QString& returnType() const { return rt; }
Metaness metaness() const { return met; }
@@ -616,9 +616,9 @@ class FunctionNode : public LeafNode
int numOverloads() const;
const QList<Parameter>& parameters() const { return params; }
QStringList parameterNames() const;
- const FunctionNode *reimplementedFrom() const { return rf; }
- const QList<FunctionNode *> &reimplementedBy() const { return rb; }
- const PropertyNode *associatedProperty() const { return ap; }
+ const FunctionNode* reimplementedFrom() const { return rf; }
+ const QList<FunctionNode*> &reimplementedBy() const { return rb; }
+ const PropertyNode* associatedProperty() const { return ap; }
const QStringList& parentPath() const { return pp; }
QStringList reconstructParams(bool values = false) const;
@@ -632,7 +632,7 @@ class FunctionNode : public LeafNode
void debug() const;
private:
- void setAssociatedProperty(PropertyNode *property);
+ void setAssociatedProperty(PropertyNode* property);
friend class InnerNode;
friend class PropertyNode;
@@ -652,9 +652,9 @@ class FunctionNode : public LeafNode
bool reimp: 1;
bool att: 1;
QList<Parameter> params;
- const FunctionNode *rf;
- const PropertyNode *ap;
- QList<FunctionNode *> rb;
+ const FunctionNode* rf;
+ const PropertyNode* ap;
+ QList<FunctionNode*> rb;
};
class PropertyNode : public LeafNode
@@ -663,16 +663,22 @@ class PropertyNode : public LeafNode
enum FunctionRole { Getter, Setter, Resetter, Notifier };
enum { NumFunctionRoles = Notifier + 1 };
- PropertyNode(InnerNode *parent, const QString& name);
+ PropertyNode(InnerNode* parent, const QString& name);
virtual ~PropertyNode() { }
void setDataType(const QString& dataType) { dt = dataType; }
- void addFunction(FunctionNode *function, FunctionRole role);
- void addSignal(FunctionNode *function, FunctionRole role);
+ void addFunction(FunctionNode* function, FunctionRole role);
+ void addSignal(FunctionNode* function, FunctionRole role);
void setStored(bool stored) { sto = toTrool(stored); }
void setDesignable(bool designable) { des = toTrool(designable); }
+ void setScriptable(bool scriptable) { scr = toTrool(scriptable); }
void setWritable(bool writable) { wri = toTrool(writable); }
- void setOverriddenFrom(const PropertyNode *baseProperty);
+ void setUser(bool user) { usr = toTrool(user); }
+ void setOverriddenFrom(const PropertyNode* baseProperty);
+ void setRuntimeDesFunc(const QString& rdf) { runtimeDesFunc = rdf; }
+ void setRuntimeScrFunc(const QString& scrf) { runtimeScrFunc = scrf; }
+ void setConstant() { cst = true; }
+ void setFinal() { fnl = true; }
const QString &dataType() const { return dt; }
QString qualifiedDataType() const;
@@ -684,8 +690,20 @@ class PropertyNode : public LeafNode
NodeList notifiers() const { return functions(Notifier); }
bool isStored() const { return fromTrool(sto, storedDefault()); }
bool isDesignable() const { return fromTrool(des, designableDefault()); }
+ bool isScriptable() const { return fromTrool(scr, scriptableDefault()); }
+ const QString& runtimeDesignabilityFunction() const { return runtimeDesFunc; }
+ const QString& runtimeScriptabilityFunction() const { return runtimeScrFunc; }
bool isWritable() const { return fromTrool(wri, writableDefault()); }
- const PropertyNode *overriddenFrom() const { return overrides; }
+ bool isUser() const { return fromTrool(usr, userDefault()); }
+ bool isConstant() const { return cst; }
+ bool isFinal() const { return fnl; }
+ const PropertyNode* overriddenFrom() const { return overrides; }
+
+ bool storedDefault() const { return true; }
+ bool userDefault() const { return false; }
+ bool designableDefault() const { return !setters().isEmpty(); }
+ bool scriptableDefault() const { return true; }
+ bool writableDefault() const { return !setters().isEmpty(); }
private:
enum Trool { Trool_True, Trool_False, Trool_Default };
@@ -693,16 +711,18 @@ class PropertyNode : public LeafNode
static Trool toTrool(bool boolean);
static bool fromTrool(Trool troolean, bool defaultValue);
- bool storedDefault() const { return true; }
- bool designableDefault() const { return !setters().isEmpty(); }
- bool writableDefault() const { return !setters().isEmpty(); }
-
QString dt;
+ QString runtimeDesFunc;
+ QString runtimeScrFunc;
NodeList funcs[NumFunctionRoles];
Trool sto;
Trool des;
+ Trool scr;
Trool wri;
- const PropertyNode *overrides;
+ Trool usr;
+ bool cst;
+ bool fnl;
+ const PropertyNode* overrides;
};
inline void FunctionNode::setParameters(const QList<Parameter> &parameters)
@@ -710,13 +730,13 @@ inline void FunctionNode::setParameters(const QList<Parameter> &parameters)
params = parameters;
}
-inline void PropertyNode::addFunction(FunctionNode *function, FunctionRole role)
+inline void PropertyNode::addFunction(FunctionNode* function, FunctionRole role)
{
funcs[(int)role].append(function);
function->setAssociatedProperty(this);
}
-inline void PropertyNode::addSignal(FunctionNode *function, FunctionRole role)
+inline void PropertyNode::addSignal(FunctionNode* function, FunctionRole role)
{
funcs[(int)role].append(function);
}
@@ -732,7 +752,7 @@ inline NodeList PropertyNode::functions() const
class VariableNode : public LeafNode
{
public:
- VariableNode(InnerNode *parent, const QString &name);
+ VariableNode(InnerNode* parent, const QString &name);
virtual ~VariableNode() { }
void setLeftType(const QString &leftType) { lt = leftType; }
@@ -750,15 +770,16 @@ class VariableNode : public LeafNode
bool sta;
};
-inline VariableNode::VariableNode(InnerNode *parent, const QString &name)
+inline VariableNode::VariableNode(InnerNode* parent, const QString &name)
: LeafNode(Variable, parent, name), sta(false)
{
+ // nothing.
}
class TargetNode : public LeafNode
{
public:
- TargetNode(InnerNode *parent, const QString& name);
+ TargetNode(InnerNode* parent, const QString& name);
virtual ~TargetNode() { }
virtual bool isInnerNode() const;
diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf
index 1fb000b..b82e337 100644
--- a/tools/qdoc3/test/qt-html-templates.qdocconf
+++ b/tools/qdoc3/test/qt-html-templates.qdocconf
@@ -11,7 +11,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \
" <a href=\"index.html\" class=\"qtref\"><span>Qt Reference Documentation</span></a>\n" \
" <div id=\"narrowsearch\"><form onsubmit=\"return false;\" action=\"\" id=\"qtdocsearch\">\n" \
" <fieldset>\n" \
- " <input type=\"text\" value=\"\" id=\"pageType\" name=\"searchstring\">\n" \
+ " <input type=\"text\" value=\"\" id=\"pageType2\" name=\"searchstring\">\n" \
" </fieldset>\n" \
" </form></div>\n" \
" <div id=\"nav-topright\">\n" \
@@ -160,7 +160,9 @@ HTML.footer = " <!-- /div -->\n" \
" <div id=\"feedbackBox\">\n" \
" <div id=\"feedcloseX\" class=\"feedclose t_button\">X</div>\n" \
" <form id=\"feedform\" action=\"http://doc.qt.nokia.com/docFeedbck/feedback.php\" method=\"get\">\n" \
- " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\">Please submit you feedback...</textarea></p>\n" \
+ " <p>Thank you for giving your feedback. <div class=\"note\">Make sure it is related the page. For more general bugs and \n" \
+ " requests, please use the <a href=\"http://bugreports.qt.nokia.com/secure/Dashboard.jspa\">Qt Bug Tracker</a></div></p>\n" \
+ " <p><textarea id=\"feedbox\" name=\"feedText\" rows=\"5\" cols=\"40\"></textarea></p>\n" \
" <p><input id=\"feedsubmit\" class=\"feedclose\" type=\"submit\" name=\"feedback\" /></p>\n" \
" </form>\n" \
" </div>\n" \