From a12b989c6d469a5a4512b7cbb70f716d98eae8e3 Mon Sep 17 00:00:00 2001 From: jasplin Date: Wed, 17 Mar 2010 08:48:36 +0100 Subject: Cleanup: Removed include file and comment. --- src/testlib/qtestcoreelement.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h index 4738f7d..e1ad44a 100644 --- a/src/testlib/qtestcoreelement.h +++ b/src/testlib/qtestcoreelement.h @@ -45,8 +45,6 @@ #include #include -#include - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -95,9 +93,6 @@ void QTestCoreElement::addAttribute(const QTest::AttributeIndex att if (attribute(attributeIndex)) return; - // if (attributeIndex == QTest::AI_Metric) - // abort(); - QTestElementAttribute *testAttribute = new QTestElementAttribute; testAttribute->setPair(attributeIndex, value); testAttribute->addToList(&listOfAttributes); -- cgit v0.12 From c3a8819a68cff387178a0f37de62611b98e0a665 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 17 Mar 2010 11:24:37 +0100 Subject: Use a toolbar for the designer property editor This makes the designer plugin a little bit more consistent. It also helps cosmeticaly in creator as we get a better separation between the tool bar and the treeview. Reviewed-by: thorbjorn --- tools/designer/src/components/widgetbox/widgetbox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/designer/src/components/widgetbox/widgetbox.cpp b/tools/designer/src/components/widgetbox/widgetbox.cpp index 512d6ba..091135a 100644 --- a/tools/designer/src/components/widgetbox/widgetbox.cpp +++ b/tools/designer/src/components/widgetbox/widgetbox.cpp @@ -74,7 +74,10 @@ WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::Wi FilterWidget *filterWidget = new FilterWidget(0, FilterWidget::LayoutAlignNone); filterWidget->setRefuseFocus(true); connect(filterWidget, SIGNAL(filterChanged(QString)), m_view, SLOT(filter(QString))); - l->addWidget(filterWidget); + + QToolBar *toolBar = new QToolBar(this); + toolBar->addWidget(filterWidget); + l->addWidget(toolBar); // View connect(m_view, SIGNAL(pressed(QString,QString,QPoint)), -- cgit v0.12 From 782a5c8537831143d52df99c434bb1e5420d7113 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 11:31:05 +0100 Subject: Initial version of QTimestamp class. Only the generic, non-monotonic QTime-based version available right now Task-number: QT-2965 --- src/corelib/tools/qdatetime.h | 1 + src/corelib/tools/qtimestamp.h | 106 +++++++++++++++++++++++++++++++ src/corelib/tools/qtimestamp_generic.cpp | 93 +++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 3 + tests/auto/qtimestamp/qtimestamp.pro | 13 ++++ tests/auto/qtimestamp/tst_qtimestamp.cpp | 68 ++++++++++++++++++++ 6 files changed, 284 insertions(+) create mode 100644 src/corelib/tools/qtimestamp.h create mode 100644 src/corelib/tools/qtimestamp_generic.cpp create mode 100644 tests/auto/qtimestamp/qtimestamp.pro create mode 100644 tests/auto/qtimestamp/tst_qtimestamp.cpp diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 6fdc855..75b5985 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -204,6 +204,7 @@ private: friend class QDateTime; friend class QDateTimePrivate; + friend class QTimestamp; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h new file mode 100644 index 0000000..f923cd4 --- /dev/null +++ b/src/corelib/tools/qtimestamp.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTIMESTAMP_H +#define QTIMESTAMP_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QTimestamp +{ +public: + static bool isMonotonic(); + + void start(); + qint64 restart() + { + qint64 r = elapsed(); + start(); + return r; + } + + qint64 elapsed() const; + bool hasExpired(qint64 timeout) const + { + // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be + // considered as never expired + return quint64(elapsed()) > quint64(timeout); + } + + qint64 msecsTo(const QTimestamp &other) const; + void addMSecs(int ms); + qint64 secsTo(const QTimestamp &other) const; + void addSecs(int secs); + + bool operator==(const QTimestamp &other) const + { return t1 == other.t1 && t2 == other.t2; } + bool operator!=(const QTimestamp &other) const + { return !(*this == other); } + + friend bool Q_CORE_EXPORT operator<(const QTimestamp &v1, const QTimestamp &v2); + friend qint64 operator-(const QTimestamp &v1, const QTimestamp &v2) + { return v2.msecsTo(v1); } + + friend QTimestamp &operator+=(QTimestamp &ts, qint64 ms) + { ts.addMSecs(ms); return ts; } + friend QTimestamp operator+(const QTimestamp &ts, qint64 ms) + { QTimestamp copy(ts); return copy += ms; } + friend QTimestamp &operator-=(QTimestamp &ts, qint64 ms) + { ts.addMSecs(-ms); return ts; } + friend QTimestamp operator-(const QTimestamp &ts, qint64 ms) + { QTimestamp copy(ts); return copy -= ms; } + +private: + qint64 t1; + qint64 t2; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTIMESTAMP_H diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp new file mode 100644 index 0000000..18c5026 --- /dev/null +++ b/src/corelib/tools/qtimestamp_generic.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtimestamp.h" +#include "qdatetime.h" + +QT_BEGIN_NAMESPACE + +bool QTimestamp::isMonotonic() +{ + return false; +} + +void QTimestamp::start() +{ + QTime t = QTime::currentTime(); + t1 = t.mds; + t2 = 0; +} + +qint64 QTimestamp::elapsed() const +{ + QTime t = QTime::currentTime(); + return t.mds - t1; +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + qint64 diff = other.t1 - t1; + if (diff < 0) // passed midnight + diff += 86400 * 1000; + return diff; +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += ms; +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs * 1000; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 6d64915..49f2f16 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -42,6 +42,7 @@ HEADERS += \ tools/qstringmatcher.h \ tools/qtextboundaryfinder.h \ tools/qtimeline.h \ + tools/qtimestamp.h \ tools/qunicodetables_p.h \ tools/qvarlengtharray.h \ tools/qvector.h \ @@ -81,6 +82,8 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp +unix:SOURCES += tools/qtimestamp_generic.cpp + #zlib support contains(QT_CONFIG, zlib) { wince*: DEFINES += NO_ERRNO_H diff --git a/tests/auto/qtimestamp/qtimestamp.pro b/tests/auto/qtimestamp/qtimestamp.pro new file mode 100644 index 0000000..3a06390 --- /dev/null +++ b/tests/auto/qtimestamp/qtimestamp.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +QT -= gui + +SOURCES += tst_qtimestamp.cpp +wince* { + DEFINES += SRCDIR=\\\"\\\" +} else:symbian { + # do not define SRCDIR at all + TARGET.EPOCHEAPSIZE = 0x100000 0x3000000 +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + diff --git a/tests/auto/qtimestamp/tst_qtimestamp.cpp b/tests/auto/qtimestamp/tst_qtimestamp.cpp new file mode 100644 index 0000000..5a0b230 --- /dev/null +++ b/tests/auto/qtimestamp/tst_qtimestamp.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +class tst_QTimestamp : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void basics(); + void elapsed(); +}; + +void tst_QTimestamp::basics() +{ + QTimestamp t1; + t1.start(); + + QCOMPARE(t1, t1); + QVERIFY(!(t1 != t1)); + QVERIFY(!(t1 < t1)); + QCOMPARE(t1.msecsTo(t1), qint64(0)); + QCOMPARE(t1.secsTo(t1), qint64(0)); + QCOMPARE(t1 + 0, t1); + QCOMPARE(t1 - 0, t1); + + QTimestamp t2 = t1; + t2 += 1000; // so we can use secsTo + + QVERIFY(t1 != t2); + QVERIFY(!(t1 == t2)); + QVERIFY(t1 < t2); + QVERIFY(!(t2 < t1)); + QCOMPARE(t1.msecsTo(t2), qint64(1000)); + QCOMPARE(t1.secsTo(t2), qint64(1)); + QCOMPARE(t2 - t1, qint64(1000)); + QCOMPARE(t1 - t2, qint64(-1000)); +} + +void tst_QTimestamp::elapsed() +{ + QTimestamp t1; + t1.start(); + + QTest::qWait(100); + QTimestamp t2; + t2.start(); + + QVERIFY(t1 != t2); + QVERIFY(!(t1 == t2)); + QVERIFY(t1 < t2); + QVERIFY(t1.msecsTo(t2) > 0); + // don't check: t1.secsTo(t2) + QVERIFY(t1 - t2 < 0); + + QVERIFY(t1.elapsed() > 0); + QVERIFY(t1.hasExpired(50)); + QVERIFY(!t1.hasExpired(500)); + QVERIFY(!t2.hasExpired(0)); + + QVERIFY(!t1.hasExpired(-1)); + QVERIFY(!t2.hasExpired(-1)); +} + +QTEST_MAIN(tst_QTimestamp); + +#include "tst_qtimestamp.moc" -- cgit v0.12 From e33a545fc76ad99db39680433b151815175f8b76 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 12:21:53 +0100 Subject: Add the Mac implementation of QTimestamp. Task-number: QT-2965 --- src/corelib/tools/qtimestamp_mac.cpp | 109 +++++++++++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 3 +- 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 src/corelib/tools/qtimestamp_mac.cpp diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp new file mode 100644 index 0000000..bdc91d1 --- /dev/null +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtimestamp.h" +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +bool QTimestamp::isMonotonic() +{ + return true; +} + +static mach_timebase_info_data_t info = {0,0}; +static qint64 absoluteToMSecs(qint64 cpuTime) +{ + if (info.denom == 0) + mach_timebase_info(&info); + qint64 nsecs = cpuTime * info.numer / info.denom; + return nsecs / (1000*1000ull); +} + +static qint64 msecsToAbsolute(qint64 ms) +{ + if (info.denom == 0) + mach_timebase_info(&info); + qint64 nsecs = ms * 1000000ull; + return nsecs * info.denom / info.numer; +} + +void QTimestamp::start() +{ + t1 = mach_absolute_time(); + t2 = 0; +} + +qint64 QTimestamp::elapsed() const +{ + uint64_t cpu_time = mach_absolute_time(); + return absoluteToMSecs(cpu_time - t1); +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + return absoluteToMSecs(other.t1 - t1); +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += msecsToAbsolute(ms); +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs * 1000; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 49f2f16..3599cc7 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -82,7 +82,8 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp -unix:SOURCES += tools/qtimestamp_generic.cpp +mac:SOURCES += tools/qtimestamp_mac.cpp +else:SOURCES += tools/qtimestamp_generic.cpp #zlib support contains(QT_CONFIG, zlib) { -- cgit v0.12 From 495581a1278f534e855d6122cdcb719c1df6d40b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 12:50:52 +0100 Subject: Add the non-Mac Unix implementation of QTimestamp. Task-number: QT-2965 --- src/corelib/tools/qtimestamp_unix.cpp | 149 ++++++++++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 1 + 2 files changed, 150 insertions(+) create mode 100644 src/corelib/tools/qtimestamp_unix.cpp diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp new file mode 100644 index 0000000..b82259f --- /dev/null +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtimestamp.h" +#include +#include +#include + +#if !defined(QT_NO_CLOCK_MONOTONIC) +# if defined(QT_BOOTSTRAPPED) +# define QT_NO_CLOCK_MONOTONIC +# endif +#endif + +QT_BEGIN_NAMESPACE + +bool QTimestamp::isMonotonic() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 > 0) + return true; +#else + static int returnValue = 0; + + if (returnValue == 0) { +# if (_POSIX_MONOTONIC_CLOCK-0 < 0) + returnValue = -1; +# elif (_POSIX_MONOTONIC_CLOCK == 0) + // detect if the system support monotonic timers + long x = sysconf(_SC_MONOTONIC_CLOCK); + returnValue = (x >= 200112L) ? 1 : -1; +# endif + } + + return returnValue != -1; +#endif +} + +static qint64 fractionAdjustment() +{ + if (QTimestamp::isMonotonic()) { + // the monotonic timer is measured in nanoseconds + // 1 ms = 1000000 ns + return 1000*1000ull; + } else { + // gettimeofday is measured in microseconds + // 1 ms = 1000 us + return 1000; + } +} + +void QTimestamp::start() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 > 0) + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + t1 = ts.tv_sec; + t2 = ts.tv_nsec; +#else +# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) + if (isMonotonic()) { + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + t1 = ts.tv_sec; + t2 = ts.tv_nsec; + return; + } +# endif + // use gettimeofday + timeval tv; + ::gettimeofday(&tv, 0); + t1 = tv.tv_sec; + t2 = tv.tv_usec; +#endif +} + +qint64 QTimestamp::elapsed() const +{ + QTimestamp now; + now.start(); + return msecsTo(now); +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + qint64 secs = other.t1 - t1; + qint64 fraction = other.t2 - t2; + return secs * 1000 + fraction / fractionAdjustment(); +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += ms / 1000; + t2 += ms % 1000 * fractionAdjustment(); +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return other.t1 - t1; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 3599cc7..b8a0ae1 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -83,6 +83,7 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp mac:SOURCES += tools/qtimestamp_mac.cpp +else:unix:SOURCES += tools/qtimestamp_unix.cpp else:SOURCES += tools/qtimestamp_generic.cpp #zlib support -- cgit v0.12 From 3e20aa117f4867aa40e03103fcb4e1a54b42dd1c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 13:05:47 +0100 Subject: Add the Windows implementation of QTimestamp Task-number: QT-2965 --- src/corelib/tools/qtimestamp_win.cpp | 120 +++++++++++++++++++++++++++++++++++ src/corelib/tools/tools.pri | 1 + 2 files changed, 121 insertions(+) create mode 100644 src/corelib/tools/qtimestamp_win.cpp diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp new file mode 100644 index 0000000..99faebd --- /dev/null +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtimestamp.h" +#include + +typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); +static PtrGetTickCount64 ptrGetTickCount64 = 0; + +QT_BEGIN_NAMESPACE + +static void resolveLibs() +{ + static bool done = false; + if (done) + return; + + // try to get GetTickCount64 from the system + HMODULE kernel32 = GetModuleHandleW(L"kernel32"); + if (!kernel32) + return; + +#if defined(Q_OS_WINCE) + // does this function exist on WinCE, or will ever exist? + ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, L"GetTickCount64"); +#else + ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); +#endif + + done = true; +} + +static quint64 getTickCount() +{ + resolveLibs(); + if (ptrGetTickCount64) + return ptrGetTickCount64(); + return GetTickCount(); +} + +bool QTimestamp::isMonotonic() +{ + return true; +} + +void QTimestamp::start() +{ + t1 = getTickCount(); + t2 = 0; +} + +qint64 QTimestamp::elapsed() const +{ + return getTickCount() - t1; +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + return other.t1 - t1; +} + +void QTimestamp::addMSecs(int ms) +{ + t1 += ms; +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + t1 += secs * 1000; +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index b8a0ae1..863f86e 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -84,6 +84,7 @@ symbian:SOURCES+=tools/qlocale_symbian.cpp mac:SOURCES += tools/qtimestamp_mac.cpp else:unix:SOURCES += tools/qtimestamp_unix.cpp +else:win32:SOURCES += tools/qtimestamp_win.cpp else:SOURCES += tools/qtimestamp_generic.cpp #zlib support -- cgit v0.12 From ca0def08d1ec2575546f7bfa3759f24288ba8e2a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Feb 2010 14:10:05 +0100 Subject: Add the Symbian version of QTimestamp. This code is disabled --- src/corelib/tools/qtimestamp_symbian.cpp | 117 +++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/corelib/tools/qtimestamp_symbian.cpp diff --git a/src/corelib/tools/qtimestamp_symbian.cpp b/src/corelib/tools/qtimestamp_symbian.cpp new file mode 100644 index 0000000..e78597c --- /dev/null +++ b/src/corelib/tools/qtimestamp_symbian.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtimestamp.h" +#include + +QT_BEGIN_NAMESPACE + +// return quint64 to avoid sign-extension +static quint64 getMillisecondFromTick() +{ + static TInt nanokernel_tick_period; + if (!nanokernel_tick_period) + HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period); + return nanokernel_tick_period * User::NTickCount(); +} + +static qint64 difference(qint64 a, qint64 b) +{ + qint64 retval = a - b; + // there can be 32-bit rollover + // assume there were rollovers if the difference is negative by more than + // 75% of the 32-bit range + + if (retval < Q_INT64_C(-0xc0000000)) + retval += Q_UINT64_C(0x100000000); + return retval; +} + +bool QTimestamp::isMonotonic() +{ + return true; +} + +void QTimestamp::start() +{ + t1 = getMillisecondFromTick(); + t2 = 0; +} + +qint64 QTimestamp::restart() +{ + qint64 oldt1 = t1; + t1 = getMillisecondFromTick(); + return difference(t1, oldt1); +} + +qint64 QTimestamp::elapsed() const +{ + return difference(getMillisecondFromTick(), t1); +} + +qint64 QTimestamp::msecsTo(const QTimestamp &other) const +{ + return difference(other.t1, t1); +} + +void QTimestamp::addMSecs(int ms) +{ + // simulate a 32-bit rollover + t1 = quint32(t1 + ms); +} + +qint64 QTimestamp::secsTo(const QTimestamp &other) const +{ + return msecsTo(other) / 1000; +} + +void QTimestamp::addSecs(int secs) +{ + addMSecs(secs * 1000); +} + +bool operator<(const QTimestamp &v1, const QTimestamp &v2) +{ + return difference(v1.t1, v2.t1) < 0; +} + +QT_END_NAMESPACE -- cgit v0.12 From 49d949b644b94fbd6c1946ffddcc1b8675ffa9ef Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 13:56:46 +0100 Subject: Make qcore_unix.cpp share code with QTimestamp --- src/corelib/kernel/qcore_unix.cpp | 65 +--------------------------- src/corelib/kernel/qcore_unix_p.h | 4 +- src/corelib/kernel/qeventdispatcher_unix.cpp | 9 ++-- src/corelib/tools/qtimestamp_mac.cpp | 25 ++++++++--- src/corelib/tools/qtimestamp_unix.cpp | 62 ++++++++++++++++---------- 5 files changed, 68 insertions(+), 97 deletions(-) diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 0fd965b..9146923 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qcore_unix_p.h" +#include "qtimestamp.h" #ifndef Q_OS_VXWORKS # if !defined(Q_OS_HPUX) || defined(__ia64) @@ -56,74 +57,12 @@ #include #endif -#if !defined(QT_NO_CLOCK_MONOTONIC) -# if defined(QT_BOOTSTRAPPED) -# define QT_NO_CLOCK_MONOTONIC -# endif -#endif - QT_BEGIN_NAMESPACE -bool qt_gettime_is_monotonic() -{ -#if (_POSIX_MONOTONIC_CLOCK-0 > 0) || defined(Q_OS_MAC) - return true; -#else - static int returnValue = 0; - - if (returnValue == 0) { -# if (_POSIX_MONOTONIC_CLOCK-0 < 0) - returnValue = -1; -# elif (_POSIX_MONOTONIC_CLOCK == 0) - // detect if the system support monotonic timers - long x = sysconf(_SC_MONOTONIC_CLOCK); - returnValue = (x >= 200112L) ? 1 : -1; -# endif - } - - return returnValue != -1; -#endif -} - -timeval qt_gettime() -{ - timeval tv; -#if defined(Q_OS_MAC) - static mach_timebase_info_data_t info = {0,0}; - if (info.denom == 0) - mach_timebase_info(&info); - - uint64_t cpu_time = mach_absolute_time(); - uint64_t nsecs = cpu_time * (info.numer / info.denom); - tv.tv_sec = nsecs / 1000000000ull; - tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); - return tv; -#elif (_POSIX_MONOTONIC_CLOCK-0 > 0) - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; - return tv; -#else -# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (qt_gettime_is_monotonic()) { - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - tv.tv_sec = ts.tv_sec; - tv.tv_usec = ts.tv_nsec / 1000; - return tv; - } -# endif - // use gettimeofday - ::gettimeofday(&tv, 0); - return tv; -#endif -} - static inline bool time_update(struct timeval *tv, const struct timeval &start, const struct timeval &timeout) { - if (!qt_gettime_is_monotonic()) { + if (!QTimestamp::isMonotonic()) { // we cannot recalculate the timeout without a monotonic clock as the time may have changed return false; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 297b25d..59d66f7 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -314,8 +314,8 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) # define _POSIX_MONOTONIC_CLOCK -1 #endif -bool qt_gettime_is_monotonic(); -timeval qt_gettime(); +timeval qt_gettime(); // in qtimestamp_mac.cpp or qtimestamp_unix.cpp + Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timeval *tv); diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index a141887..7a671d1 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -45,6 +45,7 @@ #include "qpair.h" #include "qsocketnotifier.h" #include "qthread.h" +#include "qtimestamp.h" #include "qeventdispatcher_unix_p.h" #include @@ -311,12 +312,10 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, QTimerInfoList::QTimerInfoList() { - currentTime = qt_gettime(); - #if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) - if (!qt_gettime_is_monotonic()) { + if (!QTimestamp::isMonotonic()) { // not using monotonic timers, initialize the timeChanged() machinery - previousTime = currentTime; + previousTime = qt_gettime(); tms unused; previousTicks = times(&unused); @@ -393,7 +392,7 @@ bool QTimerInfoList::timeChanged(timeval *delta) void QTimerInfoList::repairTimersIfNeeded() { - if (qt_gettime_is_monotonic()) + if (QTimestamp::isMonotonic()) return; timeval delta; if (timeChanged(&delta)) diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp index bdc91d1..e1a7d79 100644 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -53,20 +53,35 @@ bool QTimestamp::isMonotonic() } static mach_timebase_info_data_t info = {0,0}; -static qint64 absoluteToMSecs(qint64 cpuTime) +static qint64 absoluteToNSecs(qint64 cpuTime) { if (info.denom == 0) mach_timebase_info(&info); qint64 nsecs = cpuTime * info.numer / info.denom; - return nsecs / (1000*1000ull); + return nsecs; +} + +static qint64 absoluteToMSecs(qint64 cpuTime) +{ + return absoluteToNSecs(cpuTime) / 1000000; } static qint64 msecsToAbsolute(qint64 ms) { if (info.denom == 0) mach_timebase_info(&info); - qint64 nsecs = ms * 1000000ull; - return nsecs * info.denom / info.numer; + return ms * 1000000 * info.denom / info.numer; +} + +timeval qt_gettime() +{ + timeval tv; + + uint64_t cpu_time = mach_absolute_time(); + uint64_t nsecs = absoluteToNSecs(cpu_time); + tv.tv_sec = nsecs / 1000000000ull; + tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); + return tv; } void QTimestamp::start() @@ -98,7 +113,7 @@ qint64 QTimestamp::secsTo(const QTimestamp &other) const void QTimestamp::addSecs(int secs) { - t1 += secs * 1000; + t1 += msecsToAbsolute(secs * 1000); } bool operator<(const QTimestamp &v1, const QTimestamp &v2) diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp index b82259f..dbf49c1 100644 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qtimestamp.h" +#include "qpair.h" #include #include #include @@ -52,6 +53,19 @@ QT_BEGIN_NAMESPACE +static qint64 fractionAdjustment() +{ + if (QTimestamp::isMonotonic()) { + // the monotonic timer is measured in nanoseconds + // 1 ms = 1000000 ns + return 1000*1000ull; + } else { + // gettimeofday is measured in microseconds + // 1 ms = 1000 us + return 1000; + } +} + bool QTimestamp::isMonotonic() { #if (_POSIX_MONOTONIC_CLOCK-0 > 0) @@ -73,44 +87,48 @@ bool QTimestamp::isMonotonic() #endif } -static qint64 fractionAdjustment() -{ - if (QTimestamp::isMonotonic()) { - // the monotonic timer is measured in nanoseconds - // 1 ms = 1000000 ns - return 1000*1000ull; - } else { - // gettimeofday is measured in microseconds - // 1 ms = 1000 us - return 1000; - } -} - -void QTimestamp::start() +static inline QPair do_gettime() { #if (_POSIX_MONOTONIC_CLOCK-0 > 0) timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - t1 = ts.tv_sec; - t2 = ts.tv_nsec; + return qMakePair(ts.tv_sec, ts.tv_nsec); #else # if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (isMonotonic()) { + if (QTimestamp::isMonotonic()) { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - t1 = ts.tv_sec; - t2 = ts.tv_nsec; - return; + return qMakePair(ts.tv_sec, ts.tv_nsec); } # endif // use gettimeofday timeval tv; ::gettimeofday(&tv, 0); - t1 = tv.tv_sec; - t2 = tv.tv_usec; + return qMakePair(tv.tv_sec, tv.tv_usec); #endif } +// used in qcore_unix.cpp and qeventdispatcher_unix.cpp +timeval qt_gettime() +{ + QPair r = do_gettime(); + + timeval tv; + tv.tv_sec = r.first; + tv.tv_usec = r.second; + if (QTimestamp::isMonotonic()) + tv.tv_usec /= 1000; + + return tv; +} + +void QTimestamp::start() +{ + QPair r = do_gettime(); + t1 = r.first; + t2 = r.second; +} + qint64 QTimestamp::elapsed() const { QTimestamp now; -- cgit v0.12 From 8c9446cd2058fde086df92f6b7d97e4770cf8dc6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 19:47:10 +0100 Subject: Add a qtimestamp.cpp with some common functions. Had to add invalidate() and isValid() functions because that's what QUnifiedTimer expects (QAbstractAnimation). Also move restart() to each implementation for efficiency. Task-number: QT-2965 --- src/corelib/tools/qtimestamp.cpp | 65 ++++++++++++++++++++++++++++++++ src/corelib/tools/qtimestamp.h | 16 ++------ src/corelib/tools/qtimestamp_generic.cpp | 8 ++++ src/corelib/tools/qtimestamp_mac.cpp | 8 ++++ src/corelib/tools/qtimestamp_unix.cpp | 13 +++++++ src/corelib/tools/qtimestamp_win.cpp | 7 ++++ src/corelib/tools/tools.pri | 1 + tests/auto/qtimestamp/tst_qtimestamp.cpp | 34 +++++++++++++++-- 8 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 src/corelib/tools/qtimestamp.cpp diff --git a/src/corelib/tools/qtimestamp.cpp b/src/corelib/tools/qtimestamp.cpp new file mode 100644 index 0000000..b861099 --- /dev/null +++ b/src/corelib/tools/qtimestamp.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtimestamp.h" + +QT_BEGIN_NAMESPACE + +static const qint64 invalidData = Q_INT64_C(0x8000000000000000); + +void QTimestamp::invalidate() +{ + t1 = t2 = invalidData; +} + +bool QTimestamp::isValid() const +{ + return t1 != invalidData && t2 != invalidData; +} + +bool QTimestamp::hasExpired(qint64 timeout) const +{ + // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be + // considered as never expired + return quint64(elapsed()) > quint64(timeout); +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h index f923cd4..1e913f0 100644 --- a/src/corelib/tools/qtimestamp.h +++ b/src/corelib/tools/qtimestamp.h @@ -56,20 +56,12 @@ public: static bool isMonotonic(); void start(); - qint64 restart() - { - qint64 r = elapsed(); - start(); - return r; - } + qint64 restart(); + void invalidate(); + bool isValid() const; qint64 elapsed() const; - bool hasExpired(qint64 timeout) const - { - // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be - // considered as never expired - return quint64(elapsed()) > quint64(timeout); - } + bool hasExpired(qint64 timeout) const; qint64 msecsTo(const QTimestamp &other) const; void addMSecs(int ms); diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp index 18c5026..9930932 100644 --- a/src/corelib/tools/qtimestamp_generic.cpp +++ b/src/corelib/tools/qtimestamp_generic.cpp @@ -56,6 +56,14 @@ void QTimestamp::start() t2 = 0; } +qint64 QTimestamp::restart() +{ + QTime t = QTime::currentTime(); + qint64 old = t1; + t1 = t.mds; + return t1 - old; +} + qint64 QTimestamp::elapsed() const { QTime t = QTime::currentTime(); diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp index e1a7d79..a80e7ee 100644 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -90,6 +90,14 @@ void QTimestamp::start() t2 = 0; } +qint64 QTimestamp::restart() +{ + qint64 old = t1; + t1 = mach_absolute_time(); + + return absoluteToMSecs(t1 - old); +} + qint64 QTimestamp::elapsed() const { uint64_t cpu_time = mach_absolute_time(); diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp index dbf49c1..75371e7 100644 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -129,6 +129,19 @@ void QTimestamp::start() t2 = r.second; } +qint64 QTimestamp::restart() +{ + QPair r = do_gettime(); + qint64 oldt1 = t1; + qint64 oldt2 = t2; + t1 = r.first; + t2 = r.second; + + r.first -= oldt1; + r.second -= oldt2; + return r.first * 1000 + r.second / fractionAdjustment(); +} + qint64 QTimestamp::elapsed() const { QTimestamp now; diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp index 99faebd..72d38d0 100644 --- a/src/corelib/tools/qtimestamp_win.cpp +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -87,6 +87,13 @@ void QTimestamp::start() t2 = 0; } +qint64 QTimestamp::restart() +{ + qint64 oldt1 = t1; + t1 = getTickCount(); + return t1 - oldt1; +} + qint64 QTimestamp::elapsed() const { return getTickCount() - t1; diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 863f86e..e1097c4 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -77,6 +77,7 @@ SOURCES += \ tools/qstringlist.cpp \ tools/qtextboundaryfinder.cpp \ tools/qtimeline.cpp \ + tools/qtimestamp.cpp \ tools/qvector.cpp \ tools/qvsnprintf.cpp diff --git a/tests/auto/qtimestamp/tst_qtimestamp.cpp b/tests/auto/qtimestamp/tst_qtimestamp.cpp index 5a0b230..ab1e959 100644 --- a/tests/auto/qtimestamp/tst_qtimestamp.cpp +++ b/tests/auto/qtimestamp/tst_qtimestamp.cpp @@ -3,15 +3,32 @@ #include #include +static const int minResolution = 50; // the minimum resolution for the tests + class tst_QTimestamp : public QObject { Q_OBJECT private Q_SLOTS: + void validity(); void basics(); void elapsed(); }; +void tst_QTimestamp::validity() +{ + QTimestamp t; + + t.invalidate(); + QVERIFY(!t.isValid()); + + t.start(); + QVERIFY(t.isValid()); + + t.invalidate(); + QVERIFY(!t.isValid()); +} + void tst_QTimestamp::basics() { QTimestamp t1; @@ -36,6 +53,9 @@ void tst_QTimestamp::basics() QCOMPARE(t1.secsTo(t2), qint64(1)); QCOMPARE(t2 - t1, qint64(1000)); QCOMPARE(t1 - t2, qint64(-1000)); + + qint64 elapsed = t1.restart(); + QVERIFY(elapsed < minResolution); } void tst_QTimestamp::elapsed() @@ -43,7 +63,7 @@ void tst_QTimestamp::elapsed() QTimestamp t1; t1.start(); - QTest::qWait(100); + QTest::qWait(4*minResolution); QTimestamp t2; t2.start(); @@ -55,12 +75,18 @@ void tst_QTimestamp::elapsed() QVERIFY(t1 - t2 < 0); QVERIFY(t1.elapsed() > 0); - QVERIFY(t1.hasExpired(50)); - QVERIFY(!t1.hasExpired(500)); - QVERIFY(!t2.hasExpired(0)); + QVERIFY(t1.hasExpired(minResolution)); + QVERIFY(!t1.hasExpired(8*minResolution)); + QVERIFY(!t2.hasExpired(minResolution)); QVERIFY(!t1.hasExpired(-1)); QVERIFY(!t2.hasExpired(-1)); + + qint64 elapsed = t1.restart(); + QVERIFY(elapsed > 3*minResolution); + QVERIFY(elapsed < 5*minResolution); + qint64 diff = t1 - t2; + QVERIFY(diff < minResolution); } QTEST_MAIN(tst_QTimestamp); -- cgit v0.12 From cd33d38ce0067719b0215264a22685a91b2e08dc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 18:27:45 +0100 Subject: Port QtCore uses of QTime as a stopwatch to QTimestamp. tst_qtimeline improvement: from 56187446 to 53915928 (callgrind) --- src/corelib/animation/qabstractanimation.cpp | 1 + src/corelib/animation/qabstractanimation_p.h | 57 +--------------------------- src/corelib/io/qprocess.cpp | 6 +-- src/corelib/io/qprocess_unix.cpp | 8 ++-- src/corelib/kernel/qcoreapplication.cpp | 4 +- src/corelib/tools/qtimeline.cpp | 4 +- 6 files changed, 14 insertions(+), 66 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index f834a80..82b3003 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -170,6 +170,7 @@ QUnifiedTimer::QUnifiedTimer() : currentAnimationIdx(0), consistentTiming(false), slowMode(false), isPauseTimerActive(false), runningLeafAnimations(0) { + time.invalidate(); } QUnifiedTimer *QUnifiedTimer::instance() diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 8bc3224..3eb4948 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -56,6 +56,7 @@ #include #include #include +#include #include #ifdef Q_OS_WIN @@ -113,61 +114,7 @@ private: Q_DECLARE_PUBLIC(QAbstractAnimation) }; -class ElapsedTimer -{ -public: - ElapsedTimer() { - invalidate(); - } - - void invalidate() { - m_started = -1; - } - - bool isValid() const { - return m_started >= 0; - } - - void start() { - m_started = getTickCount_sys(); - } - - qint64 elapsed() const { - qint64 current = getTickCount_sys(); - qint64 delta = current - m_started; - if (delta < 0) - delta += getPeriod_sys(); //we wrapped around - return delta; - } - -private: - enum { - MSECS_PER_HOUR = 3600000, - MSECS_PER_MIN = 60000 - }; - - qint64 m_started; - - quint64 getPeriod_sys() const { -#ifdef Q_OS_WIN - return Q_UINT64_C(0x100000000); -#else - // fallback - return 86400 * 1000; -#endif - } - - qint64 getTickCount_sys() const { -#ifdef Q_OS_WIN - return ::GetTickCount(); -#else - // fallback - const QTime t = QTime::currentTime(); - return MSECS_PER_HOUR * t.hour() + MSECS_PER_MIN * t.minute() + 1000 * t.second() + t.msec(); -#endif - } -}; - +typedef QTimestamp ElapsedTimer; class QUnifiedTimer : public QObject { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 12a992a..6250094 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -88,7 +88,7 @@ QT_END_NAMESPACE #include "qprocess_p.h" #include -#include +#include #include #include #include @@ -1639,7 +1639,7 @@ bool QProcess::waitForBytesWritten(int msecs) if (d->processState == QProcess::NotRunning) return false; if (d->processState == QProcess::Starting) { - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); bool started = waitForStarted(msecs); if (!started) @@ -1676,7 +1676,7 @@ bool QProcess::waitForFinished(int msecs) if (d->processState == QProcess::NotRunning) return false; if (d->processState == QProcess::Starting) { - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); bool started = waitForStarted(msecs); if (!started) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 5119ec0..511154a 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -92,7 +92,6 @@ QT_END_NAMESPACE #include #include -#include #include #include #include @@ -101,6 +100,7 @@ QT_END_NAMESPACE #include #include #include +#include #include #include @@ -933,7 +933,7 @@ bool QProcessPrivate::waitForReadyRead(int msecs) qDebug("QProcessPrivate::waitForReadyRead(%d)", msecs); #endif - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); forever { @@ -1005,7 +1005,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) qDebug("QProcessPrivate::waitForBytesWritten(%d)", msecs); #endif - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); while (!writeBuffer.isEmpty()) { @@ -1072,7 +1072,7 @@ bool QProcessPrivate::waitForFinished(int msecs) qDebug("QProcessPrivate::waitForFinished(%d)", msecs); #endif - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); forever { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 2da5a7d..3d6364b 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -47,7 +47,6 @@ #include "qeventloop.h" #include "qcorecmdlineargs_p.h" #include -#include #include #include #include @@ -59,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -917,7 +917,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m QThreadData *data = QThreadData::current(); if (!data->eventDispatcher) return; - QTime start; + QTimestamp start; start.start(); if (flags & QEventLoop::DeferredDeletion) QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 877a77a..57977bc 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -42,9 +42,9 @@ #include "qtimeline.h" #include -#include #include #include +#include QT_BEGIN_NAMESPACE @@ -70,7 +70,7 @@ public: int currentTime; int timerId; - QTime timer; + QTimestamp timer; QTimeLine::Direction direction; QEasingCurve easingCurve; -- cgit v0.12 From ec5b7ea367389234697a98d7243243ec689be724 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 19:48:41 +0100 Subject: Port QtNetwork uses of QTime as a stopwatch to QTimestamp. --- src/network/socket/qabstractsocket.cpp | 10 +++++----- src/network/socket/qhttpsocketengine.cpp | 6 +++--- src/network/socket/qlocalsocket_unix.cpp | 4 ++-- src/network/socket/qnativesocketengine_unix.cpp | 4 ++-- src/network/socket/qsocks5socketengine.cpp | 18 +++++++++--------- src/network/ssl/qsslsocket.cpp | 10 +++++----- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 95721ee..fc50ee5 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -365,12 +365,12 @@ #include "private/qhostinfo_p.h" #include -#include #include #include #include #include #include +#include #ifndef QT_NO_OPENSSL #include @@ -1738,7 +1738,7 @@ bool QAbstractSocket::waitForConnected(int msecs) bool wasPendingClose = d->pendingClose; d->pendingClose = false; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); if (d->state == HostLookupState) { @@ -1819,7 +1819,7 @@ bool QAbstractSocket::waitForReadyRead(int msecs) return false; } - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // handle a socket in connecting state @@ -1878,7 +1878,7 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) if (d->writeBuffer.isEmpty()) return false; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // handle a socket in connecting state @@ -1960,7 +1960,7 @@ bool QAbstractSocket::waitForDisconnected(int msecs) return false; } - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // handle a socket in connecting state diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 3293ff5..9d412ac 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -42,9 +42,9 @@ #include "qhttpsocketengine_p.h" #include "qtcpsocket.h" #include "qhostaddress.h" -#include "qdatetime.h" #include "qurl.h" #include "qhttp.h" +#include "qtimestamp.h" #if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) #include @@ -319,7 +319,7 @@ bool QHttpSocketEngine::waitForRead(int msecs, bool *timedOut) if (!d->socket || d->socket->state() == QAbstractSocket::UnconnectedState) return false; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // Wait for more data if nothing is available. @@ -366,7 +366,7 @@ bool QHttpSocketEngine::waitForWrite(int msecs, bool *timedOut) return true; } - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // If we're not connected yet, wait until we are, and until bytes have diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 1ca11d8..20301ba 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -52,9 +52,9 @@ #include #include -#include #include #include +#include #ifdef Q_OS_VXWORKS # include @@ -534,7 +534,7 @@ bool QLocalSocket::waitForConnected(int msec) int result = -1; // on Linux timeout will be updated by select, but _not_ on other systems. - QTime timer; + QTimestamp timer; timer.start(); while (state() == ConnectingState && (-1 == msec || timer.elapsed() < msec)) { diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 9a2c349..7c1fc17 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -44,8 +44,8 @@ #include "private/qnet_unix_p.h" #include "qiodevice.h" #include "qhostaddress.h" +#include "qtimestamp.h" #include "qvarlengtharray.h" -#include "qdatetime.h" #include #include #include @@ -1003,7 +1003,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c #ifndef Q_OS_SYMBIAN ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); #else - QTime timer; + QTimestamp timer; timer.start(); do { diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 924530e..0c6a01a 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -49,7 +49,7 @@ #include "qdebug.h" #include "qhash.h" #include "qqueue.h" -#include "qdatetime.h" +#include "qtimestamp.h" #include "qmutex.h" #include "qthread.h" #include "qcoreapplication.h" @@ -308,7 +308,7 @@ struct QSocks5BindData : public QSocks5Data quint16 localPort; QHostAddress peerAddress; quint16 peerPort; - QDateTime timeStamp; + QTimestamp timeStamp; }; struct QSocks5RevivedDatagram @@ -369,7 +369,7 @@ void QSocks5BindStore::add(int socketDescriptor, QSocks5BindData *bindData) if (store.contains(socketDescriptor)) { // qDebug() << "delete it"; } - bindData->timeStamp = QDateTime::currentDateTime(); + bindData->timeStamp.start(); store.insert(socketDescriptor, bindData); // start sweep timer if not started if (sweepTimerId == -1) @@ -412,7 +412,7 @@ void QSocks5BindStore::timerEvent(QTimerEvent * event) QMutableHashIterator it(store); while (it.hasNext()) { it.next(); - if (it.value()->timeStamp.secsTo(QDateTime::currentDateTime()) > 350) { + if (it.value()->timeStamp.hasExpired(350000)) { QSOCKS5_DEBUG << "QSocks5BindStore removing JJJJ"; it.remove(); } @@ -1355,7 +1355,7 @@ bool QSocks5SocketEngine::bind(const QHostAddress &address, quint16 port) } int msecs = SOCKS5_BLOCKING_BIND_TIMEOUT; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port()); if (!d->waitForConnected(msecs, 0) || @@ -1455,7 +1455,7 @@ void QSocks5SocketEngine::close() if (d->data && d->data->controlSocket) { if (d->data->controlSocket->state() == QAbstractSocket::ConnectedState) { int msecs = 100; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); while (!d->data->controlSocket->bytesToWrite()) { if (!d->data->controlSocket->waitForBytesWritten(qt_timeout_value(msecs, stopWatch.elapsed()))) @@ -1674,7 +1674,7 @@ bool QSocks5SocketEnginePrivate::waitForConnected(int msecs, bool *timedOut) mode == BindMode ? BindSuccess : UdpAssociateSuccess; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); while (socks5State != wantedState) { @@ -1699,7 +1699,7 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut) d->readNotificationActivated = false; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // are we connected yet? @@ -1749,7 +1749,7 @@ bool QSocks5SocketEngine::waitForWrite(int msecs, bool *timedOut) Q_D(QSocks5SocketEngine); QSOCKS5_DEBUG << "waitForWrite" << msecs; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); // are we connected yet? diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 9623570..895e32c 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -286,8 +286,8 @@ #include #include -#include #include +#include #include #include @@ -1393,7 +1393,7 @@ bool QSslSocket::waitForEncrypted(int msecs) if (d->mode == UnencryptedMode && !d->autoStartHandshake) return false; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); if (d->plainSocket->state() != QAbstractSocket::ConnectedState) { @@ -1433,7 +1433,7 @@ bool QSslSocket::waitForReadyRead(int msecs) bool *previousReadyReadEmittedPointer = d->readyReadEmittedPointer; d->readyReadEmittedPointer = &readyReadEmitted; - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { @@ -1470,7 +1470,7 @@ bool QSslSocket::waitForBytesWritten(int msecs) if (d->mode == UnencryptedMode) return d->plainSocket->waitForBytesWritten(msecs); - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { @@ -1508,7 +1508,7 @@ bool QSslSocket::waitForDisconnected(int msecs) if (d->mode == UnencryptedMode) return d->plainSocket->waitForDisconnected(msecs); - QTime stopWatch; + QTimestamp stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { -- cgit v0.12 From 0f771c62f5253a969f5a8a81bfd9254b9bd58b8f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2010 20:00:36 +0100 Subject: Port QtGui uses of QTime as a stopwatch to QTimestamp --- src/gui/dialogs/qfileinfogatherer.cpp | 8 +++++--- src/gui/dialogs/qfileinfogatherer_p.h | 5 +++-- src/gui/dialogs/qprogressdialog.cpp | 4 ++-- src/gui/itemviews/qabstractitemview.cpp | 3 ++- src/gui/itemviews/qabstractitemview_p.h | 4 ++-- src/gui/itemviews/qtreeview.cpp | 3 ++- src/gui/kernel/qclipboard_x11.cpp | 15 ++++++--------- src/gui/kernel/qdnd_x11.cpp | 12 ++++-------- src/gui/kernel/qgesture_p.h | 4 ++-- src/gui/kernel/qstandardgestures.cpp | 7 +++---- src/gui/kernel/qwidget_x11.cpp | 4 ++-- src/gui/kernel/qx11embed_x11.cpp | 4 ++-- src/gui/styles/qplastiquestyle.cpp | 4 ++-- src/gui/styles/qwindowsstyle_p.h | 4 ++-- src/gui/text/qfontdatabase_x11.cpp | 8 ++++---- src/gui/widgets/qabstractslider.cpp | 10 +++++----- src/gui/widgets/qabstractslider_p.h | 3 ++- src/gui/widgets/qeffects.cpp | 6 +++--- src/gui/widgets/qscrollbar.cpp | 4 ++-- src/gui/widgets/qworkspace.cpp | 10 +++++----- 20 files changed, 60 insertions(+), 62 deletions(-) diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 3b08bf6..a565c45 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -297,7 +297,8 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil return; } - QTime base = QTime::currentTime(); + QTimestamp base; + base.start(); QFileInfo fileInfo; bool firstTime = true; QList > updatedFiles; @@ -326,9 +327,10 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil emit directoryLoaded(path); } -void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QTime &base, bool &firstTime, QList > &updatedFiles, const QString &path) { +void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QTimestamp &base, bool &firstTime, QList > &updatedFiles, const QString &path) { updatedFiles.append(QPair(fileInfo.fileName(), fileInfo)); - QTime current = QTime::currentTime(); + QTimestamp current; + current.start(); if ((firstTime && updatedFiles.count() > 100) || base.msecsTo(current) > 1000) { emit updates(path, updatedFiles); updatedFiles.clear(); diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index eff6b3c..a2b9acd 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -60,9 +60,10 @@ #include #include #include -#include #include +#include #include +#include QT_BEGIN_NAMESPACE @@ -174,7 +175,7 @@ protected: void getFileInfos(const QString &path, const QStringList &files); private: - void fetch(const QFileInfo &info, QTime &base, bool &firstTime, QList > &updatedFiles, const QString &path); + void fetch(const QFileInfo &info, QTimestamp &base, bool &firstTime, QList > &updatedFiles, const QString &path); QString translateDriveName(const QFileInfo &drive) const; QMutex mutex; diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 4fffdba..602f47c 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -46,7 +46,6 @@ #include "qshortcut.h" #include "qpainter.h" #include "qdrawutil.h" -#include "qdatetime.h" #include "qlabel.h" #include "qprogressbar.h" #include "qapplication.h" @@ -54,6 +53,7 @@ #include "qpushbutton.h" #include "qcursor.h" #include "qtimer.h" +#include "qtimestamp.h" #include #include @@ -103,7 +103,7 @@ public: QTimer *forceTimer; bool shown_once; bool cancellation_flag; - QTime starttime; + QTimestamp starttime; #ifndef QT_NO_CURSOR QCursor parentCursor; #endif diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index dd9a7e6..34b5e13 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2839,7 +2839,8 @@ void QAbstractItemView::keyboardSearch(const QString &search) QModelIndex start = currentIndex().isValid() ? currentIndex() : d->model->index(0, 0, d->root); - QTime now(QTime::currentTime()); + QTimestamp now; + now.start(); bool skipRow = false; if (search.isEmpty() || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 82fd1a6..4af98b4 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -56,7 +56,6 @@ #include "private/qabstractscrollarea_p.h" #include "private/qabstractitemmodel_p.h" #include "QtGui/qapplication.h" -#include "QtCore/qdatetime.h" #include "QtGui/qevent.h" #include "QtGui/qmime.h" #include "QtGui/qpainter.h" @@ -65,6 +64,7 @@ #include "QtCore/qdebug.h" #include "QtGui/qpainter.h" #include "QtCore/qbasictimer.h" +#include "QtCore/qtimestamp.h" #ifndef QT_NO_ITEMVIEWS @@ -390,7 +390,7 @@ public: #endif QString keyboardInput; - QTime keyboardInputTime; + QTimestamp keyboardInputTime; bool autoScroll; QBasicTimer autoScrollTimer; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 4135ba0..9f8c322 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -958,7 +958,8 @@ void QTreeView::keyboardSearch(const QString &search) else start = d->model->index(0, 0, d->root); - QTime now(QTime::currentTime()); + QTimestamp now; + now.start(); bool skipRow = false; if (search.isEmpty() || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 047bd09..2a9706b 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -65,7 +65,6 @@ #include "qapplication.h" #include "qdesktopwidget.h" #include "qbitmap.h" -#include "qdatetime.h" #include "qiodevice.h" #include "qbuffer.h" #include "qtextcodec.h" @@ -76,6 +75,7 @@ #include "qt_x11_p.h" #include "qx11info_x11.h" #include "qimagewriter.h" +#include "qtimestamp.h" #include "qvariant.h" #include "qdnd_p.h" #include @@ -516,8 +516,9 @@ static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout) { - QTime started = QTime::currentTime(); - QTime now = started; + QTimestamp started; + started.start(); + QTimestamp now = started; if (QAbstractEventDispatcher::instance()->inherits("QtMotif") || QApplication::clipboard()->property("useEventLoopWhenWaiting").toBool()) { @@ -545,9 +546,7 @@ bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int ti XSync(X11->display, false); usleep(50000); - now = QTime::currentTime(); - if (started > now) // crossed midnight - started = now; + now.start(); QEventLoop::ProcessEventsFlags flags(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers @@ -576,9 +575,7 @@ bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int ti if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0)) qApp->x11ProcessEvent(&e); - now = QTime::currentTime(); - if ( started > now ) // crossed midnight - started = now; + now.start(); XFlush(X11->display); diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 9591b9a..0d24ed7 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -51,10 +51,10 @@ #include "qbitmap.h" #include "qdesktopwidget.h" #include "qevent.h" -#include "qdatetime.h" #include "qiodevice.h" #include "qpointer.h" #include "qcursor.h" +#include "qtimestamp.h" #include "qvariant.h" #include "qvector.h" #include "qurl.h" @@ -1911,23 +1911,19 @@ Qt::DropAction QDragManager::drag(QDrag * o) // then we could still have problems, but this is highly unlikely QApplication::flush(); - QTime started = QTime::currentTime(); - QTime now = started; + QTimestamp timer; + timer.start(); do { XEvent event; if (XCheckTypedEvent(X11->display, ClientMessage, &event)) qApp->x11ProcessEvent(&event); - now = QTime::currentTime(); - if (started > now) // crossed midnight - started = now; - // sleep 50 ms, so we don't use up CPU cycles all the time. struct timeval usleep_tv; usleep_tv.tv_sec = 0; usleep_tv.tv_usec = 50000; select(0, 0, 0, 0, &usleep_tv); - } while (object && started.msecsTo(now) < 1000); + } while (object && timer.hasExpired(1000)); } object = o; diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 649a310..84d8b7c 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -55,8 +55,8 @@ #include "qrect.h" #include "qpoint.h" -#include "qdatetime.h" #include "qgesture.h" +#include "qtimestamp.h" #include "private/qobject_p.h" QT_BEGIN_NAMESPACE @@ -148,7 +148,7 @@ public: QPoint lastPositions[3]; bool started; qreal speed; - QTime time; + QTimestamp time; }; class QTapGesturePrivate : public QGesturePrivate diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 86bf1b2e..a575717 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -301,7 +301,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, switch (event->type()) { case QEvent::TouchBegin: { d->speed = 1; - d->time = QTime::currentTime(); + d->time.start(); d->started = true; result = QGestureRecognizer::MayBeGesture; break; @@ -338,11 +338,10 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, p3.screenPos().y() - d->lastPositions[2].y()) / 3; const int distance = xDistance >= yDistance ? xDistance : yDistance; - int elapsedTime = d->time.msecsTo(QTime::currentTime()); + int elapsedTime = d->time.restart(); if (!elapsedTime) elapsedTime = 1; d->speed = 0.9 * d->speed + distance / elapsedTime; - d->time = QTime::currentTime(); d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle(); static const int MoveThreshold = 50; @@ -405,7 +404,7 @@ void QSwipeGestureRecognizer::reset(QGesture *state) d->lastPositions[0] = d->lastPositions[1] = d->lastPositions[2] = QPoint(); d->started = false; d->speed = 0; - d->time = QTime(); + d->time.invalidate(); QGestureRecognizer::reset(state); } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 10fb009..3fbb9ce 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -49,7 +49,7 @@ #include "qbitmap.h" #include "qlayout.h" #include "qtextcodec.h" -#include "qdatetime.h" +#include "qtimestamp.h" #include "qcursor.h" #include "qstack.h" #include "qcolormap.h" @@ -352,7 +352,7 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) return; QApplication::flush(); XEvent ev; - QTime t; + QTimestamp t; t.start(); static const int maximumWaitTime = 2000; if (!w->testAttribute(Qt::WA_WState_Created)) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 35850db..b92a5b1 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include @@ -1231,7 +1231,7 @@ void QX11EmbedContainer::embedClient(WId id) For safety, we will not wait more than 500 ms, so that we can preemptively workaround buggy window managers. */ - QTime t; + QTimestamp t; t.start(); functorData data; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 9f69fd8..9f4d48e 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -56,7 +56,6 @@ static const int blueFrameWidth = 2; // with of line edit focus frame #include #include #include -#include #include #include #include @@ -81,6 +80,7 @@ static const int blueFrameWidth = 2; // with of line edit focus frame #include #include #include +#include #include #include #include @@ -980,7 +980,7 @@ public: #ifndef QT_NO_PROGRESSBAR QList bars; int progressBarAnimateTimer; - QTime timer; + QTimestamp timer; #endif }; diff --git a/src/gui/styles/qwindowsstyle_p.h b/src/gui/styles/qwindowsstyle_p.h index 808abe1..92060d8 100644 --- a/src/gui/styles/qwindowsstyle_p.h +++ b/src/gui/styles/qwindowsstyle_p.h @@ -58,8 +58,8 @@ #ifndef QT_NO_STYLE_WINDOWS #include -#include #include +#include QT_BEGIN_NAMESPACE @@ -80,7 +80,7 @@ public: QList bars; int animationFps; int animateTimer; - QTime startTime; + QTimestamp startTime; int animateStep; QColor inactiveCaptionText; QColor activeCaptionColor; diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index bb1e60d..fd3cba8 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -41,9 +41,9 @@ #include -#include #include #include +#include #include #include "qx11info_x11.h" @@ -1218,7 +1218,7 @@ static void load(const QString &family = QString(), int script = -1, bool forceX } #ifdef QFONTDATABASE_DEBUG - QTime t; + QTimestamp t; t.start(); #endif @@ -1301,7 +1301,7 @@ static void initializeDb() if (!db || db->count) return; - QTime t; + QTimestamp t; t.start(); #ifndef QT_NO_FONTCONFIG @@ -1314,7 +1314,7 @@ static void initializeDb() } loadFontConfig(); - FD_DEBUG("QFontDatabase: loaded FontConfig: %d ms", t.elapsed()); + FD_DEBUG("QFontDatabase: loaded FontConfig: %d ms", int(t.elapsed())); #endif t.start(); diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 522d472..8f53116 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -764,12 +764,12 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) SliderAction action = SliderNoAction; #ifdef QT_KEYPAD_NAVIGATION if (ev->isAutoRepeat()) { - if (d->firstRepeat.isNull()) - d->firstRepeat = QTime::currentTime(); + if (!d->firstRepeat.isValid()) + d->firstRepeat.start(); else if (1 == d->repeatMultiplier) { // This is the interval in milli seconds which one key repetition // takes. - const int repeatMSecs = d->firstRepeat.msecsTo(QTime::currentTime()); + const int repeatMSecs = d->firstRepeat.elapsed(); /** * The time it takes to currently navigate the whole slider. @@ -787,8 +787,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) } } - else if (!d->firstRepeat.isNull()) { - d->firstRepeat = QTime(); + else if (!d->firstRepeat.isValid()) { + d->firstRepeat.invalidate() d->repeatMultiplier = 1; } diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h index 6e6ff6e..c8c29b5 100644 --- a/src/gui/widgets/qabstractslider_p.h +++ b/src/gui/widgets/qabstractslider_p.h @@ -54,6 +54,7 @@ // #include "QtCore/qbasictimer.h" +#include "QtCore/qtimestamp.h" #include "private/qwidget_p.h" #include "qstyle.h" @@ -103,7 +104,7 @@ public: /** * The time of when the first auto repeating key press event occurs. */ - QTime firstRepeat; + QTimestamp firstRepeat; #endif diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index dd7fc48..9dd853f 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -41,7 +41,6 @@ #include "qapplication.h" #ifndef QT_NO_EFFECTS -#include "qdatetime.h" #include "qdesktopwidget.h" #include "qeffects_p.h" #include "qevent.h" @@ -50,6 +49,7 @@ #include "qpixmap.h" #include "qpointer.h" #include "qtimer.h" +#include "qtimestamp.h" #include "qdebug.h" QT_BEGIN_NAMESPACE @@ -103,7 +103,7 @@ private: int elapsed; bool showWidget; QTimer anim; - QTime checkTime; + QTimestamp checkTime; double windowOpacity; }; @@ -384,7 +384,7 @@ private: int orientation; QTimer anim; - QTime checkTime; + QTimestamp checkTime; QPixmap pm; }; diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index c0eeb2f..894300d 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -47,7 +47,7 @@ #include "qstyle.h" #include "qstyleoption.h" #include "qmenu.h" -#include +#include #ifndef QT_NO_SCROLLBAR @@ -613,7 +613,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e) } const int initialDelay = 500; // default threshold d->activateControl(d->pressedControl, initialDelay); - QTime time; + QTimestamp time; time.start(); repaint(style()->subControlRect(QStyle::CC_ScrollBar, &opt, d->pressedControl, this)); if (time.elapsed() >= initialDelay && d->repeatActionTimer.isActive()) { diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index 2a6a7da..b4e4cc4 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -44,7 +44,6 @@ #include "qapplication.h" #include "qbitmap.h" #include "qcursor.h" -#include "qdatetime.h" #include "qdesktopwidget.h" #include "qevent.h" #include "qhash.h" @@ -59,6 +58,7 @@ #include "qscrollbar.h" #include "qstyle.h" #include "qstyleoption.h" +#include "qtimestamp.h" #include "qtooltip.h" #include "qdebug.h" #include @@ -450,10 +450,10 @@ void QWorkspaceTitleBar::mousePressEvent(QMouseEvent *e) case QStyle::SC_TitleBarSysMenu: if (d->flags & Qt::WindowSystemMenuHint) { d->buttonDown = QStyle::SC_None; - static QTime *t = 0; + static QTimestamp *t = 0; static QWorkspaceTitleBar *tc = 0; if (!t) - t = new QTime; + t = new QTimestamp; if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) { emit showOperationMenu(); t->start(); @@ -1839,7 +1839,7 @@ bool QWorkspace::event(QEvent *e) bool QWorkspace::eventFilter(QObject *o, QEvent * e) { Q_D(QWorkspace); - static QTime* t = 0; + static QTimestamp* t = 0; static QWorkspace* tc = 0; if (o == d->maxtools) { switch (e->type()) { @@ -1847,7 +1847,7 @@ bool QWorkspace::eventFilter(QObject *o, QEvent * e) { QMenuBar* b = (QMenuBar*)o->parent(); if (!t) - t = new QTime; + t = new QTimestamp; if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) { if (isRightToLeft()) { QPoint p = b->mapToGlobal(QPoint(b->x() + b->width(), b->y() + b->height())); -- cgit v0.12 From 0e0ac26bc58626df780e0fc3bc0483d5b310db8b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Feb 2010 10:08:19 +0100 Subject: Port QtMultimedia uses of QTime as a stopwatch to QTimestamp (unix code only) --- src/multimedia/audio/qaudioinput_alsa_p.h | 5 +++-- src/multimedia/audio/qaudiooutput_alsa_p.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 92cef83..9a87691 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -116,8 +117,8 @@ private: void drain(); QTimer* timer; - QTime timeStamp; - QTime clockStamp; + QTimestamp timeStamp; + QTimestamp clockStamp; qint64 elapsedTimeOffset; int intervalTime; char* audioBuffer; diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 802bc27..c655701 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -60,6 +60,7 @@ #include #include #include +#include #include #include @@ -133,8 +134,8 @@ private: QTimer* timer; QByteArray m_device; int bytesAvailable; - QTime timeStamp; - QTime clockStamp; + QTimestamp timeStamp; + QTimestamp clockStamp; qint64 elapsedTimeOffset; char* audioBuffer; snd_pcm_t* handle; -- cgit v0.12 From e0f654ceb4a46ed60351743090dbc13ea8b92106 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Feb 2010 10:15:44 +0100 Subject: Port QTest::qWait also to use QTimestamp. To avoid using QTimestamp to test QTimestamp, use QTest::qSleep in QTimestamp's own testcase. --- src/testlib/qtestsystem.h | 4 ++-- tests/auto/qtimestamp/tst_qtimestamp.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 3c11cdd..54da114 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -44,7 +44,7 @@ #include #include -#include +#include QT_BEGIN_HEADER @@ -63,7 +63,7 @@ namespace QTest { Q_ASSERT(QCoreApplication::instance()); - QTime timer; + QTimestamp timer; timer.start(); do { QCoreApplication::processEvents(QEventLoop::AllEvents, ms); diff --git a/tests/auto/qtimestamp/tst_qtimestamp.cpp b/tests/auto/qtimestamp/tst_qtimestamp.cpp index ab1e959..79138ce 100644 --- a/tests/auto/qtimestamp/tst_qtimestamp.cpp +++ b/tests/auto/qtimestamp/tst_qtimestamp.cpp @@ -63,7 +63,7 @@ void tst_QTimestamp::elapsed() QTimestamp t1; t1.start(); - QTest::qWait(4*minResolution); + QTest::qSleep(4*minResolution); QTimestamp t2; t2.start(); -- cgit v0.12 From 500b55813c591c35a63d76cb0f6809578c9ec053 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Feb 2010 14:08:17 +0100 Subject: Add support for 32-bit rollovers on Windows --- src/corelib/tools/qtimestamp_win.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp index 72d38d0..34bf7a7 100644 --- a/src/corelib/tools/qtimestamp_win.cpp +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -76,6 +76,18 @@ static quint64 getTickCount() return GetTickCount(); } +static qint64 difference(qint64 a, qint64 b) +{ + qint64 retval = a - b; + // if we're not using GetTickCount64, then there can be 32-bit rollover + // assume there were rollovers if the difference is negative by more than + // 75% of the 32-bit range + + if (!ptrGetTickCount64 && retval < Q_INT64_C(-0xc0000000)) + retval += Q_UINT64_C(0x100000000); + return retval; +} + bool QTimestamp::isMonotonic() { return true; @@ -91,22 +103,26 @@ qint64 QTimestamp::restart() { qint64 oldt1 = t1; t1 = getTickCount(); - return t1 - oldt1; + return difference(t1, oldt1); } qint64 QTimestamp::elapsed() const { - return getTickCount() - t1; + return difference(getTickCount(), t1); } qint64 QTimestamp::msecsTo(const QTimestamp &other) const { - return other.t1 - t1; + return difference(other.t1, t1); } void QTimestamp::addMSecs(int ms) { t1 += ms; + + // do we need to simulate rolling over? + if (!ptrGetTickCount64) + t1 = quint32(t1); } qint64 QTimestamp::secsTo(const QTimestamp &other) const @@ -116,12 +132,12 @@ qint64 QTimestamp::secsTo(const QTimestamp &other) const void QTimestamp::addSecs(int secs) { - t1 += secs * 1000; + addMSecs(secs * 1000); } bool operator<(const QTimestamp &v1, const QTimestamp &v2) { - return v1.t1 < v2.t1; + return difference(v1.t1, v2.t1) < 0; } QT_END_NAMESPACE -- cgit v0.12 From e0c97f943e80488c7e674075d40a27822b7e8c78 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Feb 2010 17:04:55 +0100 Subject: Remove unnecessary functions from the QTimestamp API. If necesary, we can add them back later. But let's not add functions we don't need right now. --- src/corelib/tools/qtimestamp.h | 13 ------------- src/corelib/tools/qtimestamp_generic.cpp | 10 ---------- src/corelib/tools/qtimestamp_mac.cpp | 17 ----------------- src/corelib/tools/qtimestamp_symbian.cpp | 11 ----------- src/corelib/tools/qtimestamp_unix.cpp | 11 ----------- src/corelib/tools/qtimestamp_win.cpp | 14 -------------- 6 files changed, 76 deletions(-) diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h index 1e913f0..de87ad8 100644 --- a/src/corelib/tools/qtimestamp.h +++ b/src/corelib/tools/qtimestamp.h @@ -64,9 +64,7 @@ public: bool hasExpired(qint64 timeout) const; qint64 msecsTo(const QTimestamp &other) const; - void addMSecs(int ms); qint64 secsTo(const QTimestamp &other) const; - void addSecs(int secs); bool operator==(const QTimestamp &other) const { return t1 == other.t1 && t2 == other.t2; } @@ -74,17 +72,6 @@ public: { return !(*this == other); } friend bool Q_CORE_EXPORT operator<(const QTimestamp &v1, const QTimestamp &v2); - friend qint64 operator-(const QTimestamp &v1, const QTimestamp &v2) - { return v2.msecsTo(v1); } - - friend QTimestamp &operator+=(QTimestamp &ts, qint64 ms) - { ts.addMSecs(ms); return ts; } - friend QTimestamp operator+(const QTimestamp &ts, qint64 ms) - { QTimestamp copy(ts); return copy += ms; } - friend QTimestamp &operator-=(QTimestamp &ts, qint64 ms) - { ts.addMSecs(-ms); return ts; } - friend QTimestamp operator-(const QTimestamp &ts, qint64 ms) - { QTimestamp copy(ts); return copy -= ms; } private: qint64 t1; diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp index 9930932..c80ac34 100644 --- a/src/corelib/tools/qtimestamp_generic.cpp +++ b/src/corelib/tools/qtimestamp_generic.cpp @@ -78,21 +78,11 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const return diff; } -void QTimestamp::addMSecs(int ms) -{ - t1 += ms; -} - qint64 QTimestamp::secsTo(const QTimestamp &other) const { return msecsTo(other) / 1000; } -void QTimestamp::addSecs(int secs) -{ - t1 += secs * 1000; -} - bool operator<(const QTimestamp &v1, const QTimestamp &v2) { return v1.t1 < v2.t1; diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp index a80e7ee..02f0fa7 100644 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -66,13 +66,6 @@ static qint64 absoluteToMSecs(qint64 cpuTime) return absoluteToNSecs(cpuTime) / 1000000; } -static qint64 msecsToAbsolute(qint64 ms) -{ - if (info.denom == 0) - mach_timebase_info(&info); - return ms * 1000000 * info.denom / info.numer; -} - timeval qt_gettime() { timeval tv; @@ -109,21 +102,11 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const return absoluteToMSecs(other.t1 - t1); } -void QTimestamp::addMSecs(int ms) -{ - t1 += msecsToAbsolute(ms); -} - qint64 QTimestamp::secsTo(const QTimestamp &other) const { return msecsTo(other) / 1000; } -void QTimestamp::addSecs(int secs) -{ - t1 += msecsToAbsolute(secs * 1000); -} - bool operator<(const QTimestamp &v1, const QTimestamp &v2) { return v1.t1 < v2.t1; diff --git a/src/corelib/tools/qtimestamp_symbian.cpp b/src/corelib/tools/qtimestamp_symbian.cpp index e78597c..1d7b6ff 100644 --- a/src/corelib/tools/qtimestamp_symbian.cpp +++ b/src/corelib/tools/qtimestamp_symbian.cpp @@ -93,22 +93,11 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const return difference(other.t1, t1); } -void QTimestamp::addMSecs(int ms) -{ - // simulate a 32-bit rollover - t1 = quint32(t1 + ms); -} - qint64 QTimestamp::secsTo(const QTimestamp &other) const { return msecsTo(other) / 1000; } -void QTimestamp::addSecs(int secs) -{ - addMSecs(secs * 1000); -} - bool operator<(const QTimestamp &v1, const QTimestamp &v2) { return difference(v1.t1, v2.t1) < 0; diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp index 75371e7..507c861 100644 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -156,22 +156,11 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const return secs * 1000 + fraction / fractionAdjustment(); } -void QTimestamp::addMSecs(int ms) -{ - t1 += ms / 1000; - t2 += ms % 1000 * fractionAdjustment(); -} - qint64 QTimestamp::secsTo(const QTimestamp &other) const { return other.t1 - t1; } -void QTimestamp::addSecs(int secs) -{ - t1 += secs; -} - bool operator<(const QTimestamp &v1, const QTimestamp &v2) { return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp index 34bf7a7..1aea5cf 100644 --- a/src/corelib/tools/qtimestamp_win.cpp +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -116,25 +116,11 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const return difference(other.t1, t1); } -void QTimestamp::addMSecs(int ms) -{ - t1 += ms; - - // do we need to simulate rolling over? - if (!ptrGetTickCount64) - t1 = quint32(t1); -} - qint64 QTimestamp::secsTo(const QTimestamp &other) const { return msecsTo(other) / 1000; } -void QTimestamp::addSecs(int secs) -{ - addMSecs(secs * 1000); -} - bool operator<(const QTimestamp &v1, const QTimestamp &v2) { return difference(v1.t1, v2.t1) < 0; -- cgit v0.12 From 21983be486af0d252b8d393ed36b15becb3c8824 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Feb 2010 15:02:26 +0100 Subject: Rename QTimestamp to QElapsedTimer --- src/corelib/animation/qabstractanimation_p.h | 4 ++-- src/corelib/io/qprocess.cpp | 6 +++--- src/corelib/io/qprocess_unix.cpp | 8 ++++---- src/corelib/kernel/qcore_unix.cpp | 4 ++-- src/corelib/kernel/qcore_unix_p.h | 2 +- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- src/corelib/kernel/qeventdispatcher_unix.cpp | 6 +++--- src/corelib/tools/qdatetime.h | 2 +- src/corelib/tools/qtimeline.cpp | 4 ++-- src/corelib/tools/qtimestamp.cpp | 8 ++++---- src/corelib/tools/qtimestamp.h | 12 ++++++------ src/corelib/tools/qtimestamp_generic.cpp | 16 ++++++++-------- src/corelib/tools/qtimestamp_mac.cpp | 16 ++++++++-------- src/corelib/tools/qtimestamp_symbian.cpp | 16 ++++++++-------- src/corelib/tools/qtimestamp_unix.cpp | 24 ++++++++++++------------ src/corelib/tools/qtimestamp_win.cpp | 16 ++++++++-------- src/corelib/tools/tools.pri | 12 ++++++------ src/gui/dialogs/qfileinfogatherer.cpp | 6 +++--- src/gui/dialogs/qfileinfogatherer_p.h | 4 ++-- src/gui/dialogs/qprogressdialog.cpp | 4 ++-- src/gui/itemviews/qabstractitemview.cpp | 2 +- src/gui/itemviews/qabstractitemview_p.h | 4 ++-- src/gui/itemviews/qtreeview.cpp | 2 +- src/gui/kernel/qclipboard_x11.cpp | 6 +++--- src/gui/kernel/qdnd_x11.cpp | 4 ++-- src/gui/kernel/qgesture_p.h | 4 ++-- src/gui/kernel/qwidget_x11.cpp | 4 ++-- src/gui/kernel/qx11embed_x11.cpp | 4 ++-- src/gui/styles/qplastiquestyle.cpp | 4 ++-- src/gui/styles/qwindowsstyle_p.h | 4 ++-- src/gui/text/qfontdatabase_x11.cpp | 6 +++--- src/gui/widgets/qabstractslider_p.h | 4 ++-- src/gui/widgets/qeffects.cpp | 6 +++--- src/gui/widgets/qscrollbar.cpp | 4 ++-- src/gui/widgets/qworkspace.cpp | 10 +++++----- src/multimedia/audio/qaudioinput_alsa_p.h | 6 +++--- src/multimedia/audio/qaudiooutput_alsa_p.h | 6 +++--- src/network/socket/qabstractsocket.cpp | 10 +++++----- src/network/socket/qhttpsocketengine.cpp | 6 +++--- src/network/socket/qlocalsocket_unix.cpp | 4 ++-- src/network/socket/qnativesocketengine_unix.cpp | 4 ++-- src/network/socket/qsocks5socketengine.cpp | 14 +++++++------- src/network/ssl/qsslsocket.cpp | 10 +++++----- src/testlib/qtestsystem.h | 4 ++-- 44 files changed, 153 insertions(+), 153 deletions(-) diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 3eb4948..2282cdb 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #ifdef Q_OS_WIN @@ -114,7 +114,7 @@ private: Q_DECLARE_PUBLIC(QAbstractAnimation) }; -typedef QTimestamp ElapsedTimer; +typedef QElapsedTimer ElapsedTimer; class QUnifiedTimer : public QObject { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 6250094..63c2ab8 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -88,7 +88,7 @@ QT_END_NAMESPACE #include "qprocess_p.h" #include -#include +#include #include #include #include @@ -1639,7 +1639,7 @@ bool QProcess::waitForBytesWritten(int msecs) if (d->processState == QProcess::NotRunning) return false; if (d->processState == QProcess::Starting) { - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); bool started = waitForStarted(msecs); if (!started) @@ -1676,7 +1676,7 @@ bool QProcess::waitForFinished(int msecs) if (d->processState == QProcess::NotRunning) return false; if (d->processState == QProcess::Starting) { - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); bool started = waitForStarted(msecs); if (!started) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 511154a..216c382 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -100,7 +100,7 @@ QT_END_NAMESPACE #include #include #include -#include +#include #include #include @@ -933,7 +933,7 @@ bool QProcessPrivate::waitForReadyRead(int msecs) qDebug("QProcessPrivate::waitForReadyRead(%d)", msecs); #endif - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); forever { @@ -1005,7 +1005,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) qDebug("QProcessPrivate::waitForBytesWritten(%d)", msecs); #endif - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); while (!writeBuffer.isEmpty()) { @@ -1072,7 +1072,7 @@ bool QProcessPrivate::waitForFinished(int msecs) qDebug("QProcessPrivate::waitForFinished(%d)", msecs); #endif - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); forever { diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 9146923..e0d92c0 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qcore_unix_p.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #ifndef Q_OS_VXWORKS # if !defined(Q_OS_HPUX) || defined(__ia64) @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE static inline bool time_update(struct timeval *tv, const struct timeval &start, const struct timeval &timeout) { - if (!QTimestamp::isMonotonic()) { + if (!QElapsedTimer::isMonotonic()) { // we cannot recalculate the timeout without a monotonic clock as the time may have changed return false; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index 59d66f7..439ca5a 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -314,7 +314,7 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) # define _POSIX_MONOTONIC_CLOCK -1 #endif -timeval qt_gettime(); // in qtimestamp_mac.cpp or qtimestamp_unix.cpp +timeval qt_gettime(); // in qelapsedtimer_mac.cpp or qtimestamp_unix.cpp Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timeval *tv); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 3d6364b..8fc3fb8 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include @@ -917,7 +917,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m QThreadData *data = QThreadData::current(); if (!data->eventDispatcher) return; - QTimestamp start; + QElapsedTimer start; start.start(); if (flags & QEventLoop::DeferredDeletion) QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 7a671d1..f7d45ac 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -45,7 +45,7 @@ #include "qpair.h" #include "qsocketnotifier.h" #include "qthread.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qeventdispatcher_unix_p.h" #include @@ -313,7 +313,7 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, QTimerInfoList::QTimerInfoList() { #if (_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) - if (!QTimestamp::isMonotonic()) { + if (!QElapsedTimer::isMonotonic()) { // not using monotonic timers, initialize the timeChanged() machinery previousTime = qt_gettime(); @@ -392,7 +392,7 @@ bool QTimerInfoList::timeChanged(timeval *delta) void QTimerInfoList::repairTimersIfNeeded() { - if (QTimestamp::isMonotonic()) + if (QElapsedTimer::isMonotonic()) return; timeval delta; if (timeChanged(&delta)) diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 75b5985..cb7f5bd 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -204,7 +204,7 @@ private: friend class QDateTime; friend class QDateTimePrivate; - friend class QTimestamp; + friend class QElapsedTimer; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 57977bc..f413223 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -70,7 +70,7 @@ public: int currentTime; int timerId; - QTimestamp timer; + QElapsedTimer timer; QTimeLine::Direction direction; QEasingCurve easingCurve; diff --git a/src/corelib/tools/qtimestamp.cpp b/src/corelib/tools/qtimestamp.cpp index b861099..220b108 100644 --- a/src/corelib/tools/qtimestamp.cpp +++ b/src/corelib/tools/qtimestamp.cpp @@ -39,23 +39,23 @@ ** ****************************************************************************/ -#include "qtimestamp.h" +#include "qelapsedtimer.h" QT_BEGIN_NAMESPACE static const qint64 invalidData = Q_INT64_C(0x8000000000000000); -void QTimestamp::invalidate() +void QElapsedTimer::invalidate() { t1 = t2 = invalidData; } -bool QTimestamp::isValid() const +bool QElapsedTimer::isValid() const { return t1 != invalidData && t2 != invalidData; } -bool QTimestamp::hasExpired(qint64 timeout) const +bool QElapsedTimer::hasExpired(qint64 timeout) const { // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be // considered as never expired diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h index de87ad8..4fa0ca5 100644 --- a/src/corelib/tools/qtimestamp.h +++ b/src/corelib/tools/qtimestamp.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Core) -class Q_CORE_EXPORT QTimestamp +class Q_CORE_EXPORT QElapsedTimer { public: static bool isMonotonic(); @@ -63,15 +63,15 @@ public: qint64 elapsed() const; bool hasExpired(qint64 timeout) const; - qint64 msecsTo(const QTimestamp &other) const; - qint64 secsTo(const QTimestamp &other) const; + qint64 msecsTo(const QElapsedTimer &other) const; + qint64 secsTo(const QElapsedTimer &other) const; - bool operator==(const QTimestamp &other) const + bool operator==(const QElapsedTimer &other) const { return t1 == other.t1 && t2 == other.t2; } - bool operator!=(const QTimestamp &other) const + bool operator!=(const QElapsedTimer &other) const { return !(*this == other); } - friend bool Q_CORE_EXPORT operator<(const QTimestamp &v1, const QTimestamp &v2); + friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2); private: qint64 t1; diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp index c80ac34..a9c2233 100644 --- a/src/corelib/tools/qtimestamp_generic.cpp +++ b/src/corelib/tools/qtimestamp_generic.cpp @@ -39,24 +39,24 @@ ** ****************************************************************************/ -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qdatetime.h" QT_BEGIN_NAMESPACE -bool QTimestamp::isMonotonic() +bool QElapsedTimer::isMonotonic() { return false; } -void QTimestamp::start() +void QElapsedTimer::start() { QTime t = QTime::currentTime(); t1 = t.mds; t2 = 0; } -qint64 QTimestamp::restart() +qint64 QElapsedTimer::restart() { QTime t = QTime::currentTime(); qint64 old = t1; @@ -64,13 +64,13 @@ qint64 QTimestamp::restart() return t1 - old; } -qint64 QTimestamp::elapsed() const +qint64 QElapsedTimer::elapsed() const { QTime t = QTime::currentTime(); return t.mds - t1; } -qint64 QTimestamp::msecsTo(const QTimestamp &other) const +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { qint64 diff = other.t1 - t1; if (diff < 0) // passed midnight @@ -78,12 +78,12 @@ qint64 QTimestamp::msecsTo(const QTimestamp &other) const return diff; } -qint64 QTimestamp::secsTo(const QTimestamp &other) const +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const { return msecsTo(other) / 1000; } -bool operator<(const QTimestamp &v1, const QTimestamp &v2) +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { return v1.t1 < v2.t1; } diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp index 02f0fa7..21a6d1b 100644 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ b/src/corelib/tools/qtimestamp_mac.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include #include @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE -bool QTimestamp::isMonotonic() +bool QElapsedTimer::isMonotonic() { return true; } @@ -77,13 +77,13 @@ timeval qt_gettime() return tv; } -void QTimestamp::start() +void QElapsedTimer::start() { t1 = mach_absolute_time(); t2 = 0; } -qint64 QTimestamp::restart() +qint64 QElapsedTimer::restart() { qint64 old = t1; t1 = mach_absolute_time(); @@ -91,23 +91,23 @@ qint64 QTimestamp::restart() return absoluteToMSecs(t1 - old); } -qint64 QTimestamp::elapsed() const +qint64 QElapsedTimer::elapsed() const { uint64_t cpu_time = mach_absolute_time(); return absoluteToMSecs(cpu_time - t1); } -qint64 QTimestamp::msecsTo(const QTimestamp &other) const +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { return absoluteToMSecs(other.t1 - t1); } -qint64 QTimestamp::secsTo(const QTimestamp &other) const +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const { return msecsTo(other) / 1000; } -bool operator<(const QTimestamp &v1, const QTimestamp &v2) +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { return v1.t1 < v2.t1; } diff --git a/src/corelib/tools/qtimestamp_symbian.cpp b/src/corelib/tools/qtimestamp_symbian.cpp index 1d7b6ff..1fbba65 100644 --- a/src/corelib/tools/qtimestamp_symbian.cpp +++ b/src/corelib/tools/qtimestamp_symbian.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include QT_BEGIN_NAMESPACE @@ -65,40 +65,40 @@ static qint64 difference(qint64 a, qint64 b) return retval; } -bool QTimestamp::isMonotonic() +bool QElapsedTimer::isMonotonic() { return true; } -void QTimestamp::start() +void QElapsedTimer::start() { t1 = getMillisecondFromTick(); t2 = 0; } -qint64 QTimestamp::restart() +qint64 QElapsedTimer::restart() { qint64 oldt1 = t1; t1 = getMillisecondFromTick(); return difference(t1, oldt1); } -qint64 QTimestamp::elapsed() const +qint64 QElapsedTimer::elapsed() const { return difference(getMillisecondFromTick(), t1); } -qint64 QTimestamp::msecsTo(const QTimestamp &other) const +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { return difference(other.t1, t1); } -qint64 QTimestamp::secsTo(const QTimestamp &other) const +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const { return msecsTo(other) / 1000; } -bool operator<(const QTimestamp &v1, const QTimestamp &v2) +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { return difference(v1.t1, v2.t1) < 0; } diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp index 507c861..b8215f4 100644 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ b/src/corelib/tools/qtimestamp_unix.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qpair.h" #include #include @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE static qint64 fractionAdjustment() { - if (QTimestamp::isMonotonic()) { + if (QElapsedTimer::isMonotonic()) { // the monotonic timer is measured in nanoseconds // 1 ms = 1000000 ns return 1000*1000ull; @@ -66,7 +66,7 @@ static qint64 fractionAdjustment() } } -bool QTimestamp::isMonotonic() +bool QElapsedTimer::isMonotonic() { #if (_POSIX_MONOTONIC_CLOCK-0 > 0) return true; @@ -95,7 +95,7 @@ static inline QPair do_gettime() return qMakePair(ts.tv_sec, ts.tv_nsec); #else # if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (QTimestamp::isMonotonic()) { + if (QElapsedTimer::isMonotonic()) { timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return qMakePair(ts.tv_sec, ts.tv_nsec); @@ -116,20 +116,20 @@ timeval qt_gettime() timeval tv; tv.tv_sec = r.first; tv.tv_usec = r.second; - if (QTimestamp::isMonotonic()) + if (QElapsedTimer::isMonotonic()) tv.tv_usec /= 1000; return tv; } -void QTimestamp::start() +void QElapsedTimer::start() { QPair r = do_gettime(); t1 = r.first; t2 = r.second; } -qint64 QTimestamp::restart() +qint64 QElapsedTimer::restart() { QPair r = do_gettime(); qint64 oldt1 = t1; @@ -142,26 +142,26 @@ qint64 QTimestamp::restart() return r.first * 1000 + r.second / fractionAdjustment(); } -qint64 QTimestamp::elapsed() const +qint64 QElapsedTimer::elapsed() const { - QTimestamp now; + QElapsedTimer now; now.start(); return msecsTo(now); } -qint64 QTimestamp::msecsTo(const QTimestamp &other) const +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { qint64 secs = other.t1 - t1; qint64 fraction = other.t2 - t2; return secs * 1000 + fraction / fractionAdjustment(); } -qint64 QTimestamp::secsTo(const QTimestamp &other) const +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const { return other.t1 - t1; } -bool operator<(const QTimestamp &v1, const QTimestamp &v2) +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); } diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp index 1aea5cf..e384dd8 100644 --- a/src/corelib/tools/qtimestamp_win.cpp +++ b/src/corelib/tools/qtimestamp_win.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); @@ -88,40 +88,40 @@ static qint64 difference(qint64 a, qint64 b) return retval; } -bool QTimestamp::isMonotonic() +bool QElapsedTimer::isMonotonic() { return true; } -void QTimestamp::start() +void QElapsedTimer::start() { t1 = getTickCount(); t2 = 0; } -qint64 QTimestamp::restart() +qint64 QElapsedTimer::restart() { qint64 oldt1 = t1; t1 = getTickCount(); return difference(t1, oldt1); } -qint64 QTimestamp::elapsed() const +qint64 QElapsedTimer::elapsed() const { return difference(getTickCount(), t1); } -qint64 QTimestamp::msecsTo(const QTimestamp &other) const +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { return difference(other.t1, t1); } -qint64 QTimestamp::secsTo(const QTimestamp &other) const +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const { return msecsTo(other) / 1000; } -bool operator<(const QTimestamp &v1, const QTimestamp &v2) +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { return difference(v1.t1, v2.t1) < 0; } diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index e1097c4..692fae9 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -42,7 +42,7 @@ HEADERS += \ tools/qstringmatcher.h \ tools/qtextboundaryfinder.h \ tools/qtimeline.h \ - tools/qtimestamp.h \ + tools/qelapsedtimer.h \ tools/qunicodetables_p.h \ tools/qvarlengtharray.h \ tools/qvector.h \ @@ -77,16 +77,16 @@ SOURCES += \ tools/qstringlist.cpp \ tools/qtextboundaryfinder.cpp \ tools/qtimeline.cpp \ - tools/qtimestamp.cpp \ + tools/qelapsedtimer.cpp \ tools/qvector.cpp \ tools/qvsnprintf.cpp symbian:SOURCES+=tools/qlocale_symbian.cpp -mac:SOURCES += tools/qtimestamp_mac.cpp -else:unix:SOURCES += tools/qtimestamp_unix.cpp -else:win32:SOURCES += tools/qtimestamp_win.cpp -else:SOURCES += tools/qtimestamp_generic.cpp +mac:SOURCES += tools/qelapsedtimer_mac.cpp +else:unix:SOURCES += tools/qelapsedtimer_unix.cpp +else:win32:SOURCES += tools/qelapsedtimer_win.cpp +else:SOURCES += tools/qelapsedtimer_generic.cpp #zlib support contains(QT_CONFIG, zlib) { diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index a565c45..3b279ae 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -297,7 +297,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil return; } - QTimestamp base; + QElapsedTimer base; base.start(); QFileInfo fileInfo; bool firstTime = true; @@ -327,9 +327,9 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil emit directoryLoaded(path); } -void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QTimestamp &base, bool &firstTime, QList > &updatedFiles, const QString &path) { +void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList > &updatedFiles, const QString &path) { updatedFiles.append(QPair(fileInfo.fileName(), fileInfo)); - QTimestamp current; + QElapsedTimer current; current.start(); if ((firstTime && updatedFiles.count() > 100) || base.msecsTo(current) > 1000) { emit updates(path, updatedFiles); diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h index a2b9acd..5abcd94 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -63,7 +63,7 @@ #include #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -175,7 +175,7 @@ protected: void getFileInfos(const QString &path, const QStringList &files); private: - void fetch(const QFileInfo &info, QTimestamp &base, bool &firstTime, QList > &updatedFiles, const QString &path); + void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList > &updatedFiles, const QString &path); QString translateDriveName(const QFileInfo &drive) const; QMutex mutex; diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 602f47c..a2d7b23 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -53,7 +53,7 @@ #include "qpushbutton.h" #include "qcursor.h" #include "qtimer.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include #include @@ -103,7 +103,7 @@ public: QTimer *forceTimer; bool shown_once; bool cancellation_flag; - QTimestamp starttime; + QElapsedTimer starttime; #ifndef QT_NO_CURSOR QCursor parentCursor; #endif diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 34b5e13..3738816 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2839,7 +2839,7 @@ void QAbstractItemView::keyboardSearch(const QString &search) QModelIndex start = currentIndex().isValid() ? currentIndex() : d->model->index(0, 0, d->root); - QTimestamp now; + QElapsedTimer now; now.start(); bool skipRow = false; if (search.isEmpty() diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 4af98b4..509459c 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -64,7 +64,7 @@ #include "QtCore/qdebug.h" #include "QtGui/qpainter.h" #include "QtCore/qbasictimer.h" -#include "QtCore/qtimestamp.h" +#include "QtCore/qelapsedtimer.h" #ifndef QT_NO_ITEMVIEWS @@ -390,7 +390,7 @@ public: #endif QString keyboardInput; - QTimestamp keyboardInputTime; + QElapsedTimer keyboardInputTime; bool autoScroll; QBasicTimer autoScrollTimer; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 9f8c322..fcdc429 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -958,7 +958,7 @@ void QTreeView::keyboardSearch(const QString &search) else start = d->model->index(0, 0, d->root); - QTimestamp now; + QElapsedTimer now; now.start(); bool skipRow = false; if (search.isEmpty() diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 2a9706b..3bdc971 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -75,7 +75,7 @@ #include "qt_x11_p.h" #include "qx11info_x11.h" #include "qimagewriter.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qvariant.h" #include "qdnd_p.h" #include @@ -516,9 +516,9 @@ static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout) { - QTimestamp started; + QElapsedTimer started; started.start(); - QTimestamp now = started; + QElapsedTimer now = started; if (QAbstractEventDispatcher::instance()->inherits("QtMotif") || QApplication::clipboard()->property("useEventLoopWhenWaiting").toBool()) { diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 0d24ed7..0a05d8e 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -54,7 +54,7 @@ #include "qiodevice.h" #include "qpointer.h" #include "qcursor.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qvariant.h" #include "qvector.h" #include "qurl.h" @@ -1911,7 +1911,7 @@ Qt::DropAction QDragManager::drag(QDrag * o) // then we could still have problems, but this is highly unlikely QApplication::flush(); - QTimestamp timer; + QElapsedTimer timer; timer.start(); do { XEvent event; diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 84d8b7c..bf60f97 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -56,7 +56,7 @@ #include "qrect.h" #include "qpoint.h" #include "qgesture.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "private/qobject_p.h" QT_BEGIN_NAMESPACE @@ -148,7 +148,7 @@ public: QPoint lastPositions[3]; bool started; qreal speed; - QTimestamp time; + QElapsedTimer time; }; class QTapGesturePrivate : public QGesturePrivate diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 3fbb9ce..b4febc6 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -49,7 +49,7 @@ #include "qbitmap.h" #include "qlayout.h" #include "qtextcodec.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qcursor.h" #include "qstack.h" #include "qcolormap.h" @@ -352,7 +352,7 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) return; QApplication::flush(); XEvent ev; - QTimestamp t; + QElapsedTimer t; t.start(); static const int maximumWaitTime = 2000; if (!w->testAttribute(Qt::WA_WState_Created)) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index b92a5b1..b527e72 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include @@ -1231,7 +1231,7 @@ void QX11EmbedContainer::embedClient(WId id) For safety, we will not wait more than 500 ms, so that we can preemptively workaround buggy window managers. */ - QTimestamp t; + QElapsedTimer t; t.start(); functorData data; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 9f4d48e..4ae9f79 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -80,7 +80,7 @@ static const int blueFrameWidth = 2; // with of line edit focus frame #include #include #include -#include +#include #include #include #include @@ -980,7 +980,7 @@ public: #ifndef QT_NO_PROGRESSBAR QList bars; int progressBarAnimateTimer; - QTimestamp timer; + QElapsedTimer timer; #endif }; diff --git a/src/gui/styles/qwindowsstyle_p.h b/src/gui/styles/qwindowsstyle_p.h index 92060d8..2a89b84 100644 --- a/src/gui/styles/qwindowsstyle_p.h +++ b/src/gui/styles/qwindowsstyle_p.h @@ -59,7 +59,7 @@ #ifndef QT_NO_STYLE_WINDOWS #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -80,7 +80,7 @@ public: QList bars; int animationFps; int animateTimer; - QTimestamp startTime; + QElapsedTimer startTime; int animateStep; QColor inactiveCaptionText; QColor activeCaptionColor; diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index fd3cba8..b1ab478 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include "qx11info_x11.h" @@ -1218,7 +1218,7 @@ static void load(const QString &family = QString(), int script = -1, bool forceX } #ifdef QFONTDATABASE_DEBUG - QTimestamp t; + QElapsedTimer t; t.start(); #endif @@ -1301,7 +1301,7 @@ static void initializeDb() if (!db || db->count) return; - QTimestamp t; + QElapsedTimer t; t.start(); #ifndef QT_NO_FONTCONFIG diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h index c8c29b5..19d1fca 100644 --- a/src/gui/widgets/qabstractslider_p.h +++ b/src/gui/widgets/qabstractslider_p.h @@ -54,7 +54,7 @@ // #include "QtCore/qbasictimer.h" -#include "QtCore/qtimestamp.h" +#include "QtCore/qelapsedtimer.h" #include "private/qwidget_p.h" #include "qstyle.h" @@ -104,7 +104,7 @@ public: /** * The time of when the first auto repeating key press event occurs. */ - QTimestamp firstRepeat; + QElapsedTimer firstRepeat; #endif diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index 9dd853f..a56d093 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -49,7 +49,7 @@ #include "qpixmap.h" #include "qpointer.h" #include "qtimer.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qdebug.h" QT_BEGIN_NAMESPACE @@ -103,7 +103,7 @@ private: int elapsed; bool showWidget; QTimer anim; - QTimestamp checkTime; + QElapsedTimer checkTime; double windowOpacity; }; @@ -384,7 +384,7 @@ private: int orientation; QTimer anim; - QTimestamp checkTime; + QElapsedTimer checkTime; QPixmap pm; }; diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 894300d..4ee9f27 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -47,7 +47,7 @@ #include "qstyle.h" #include "qstyleoption.h" #include "qmenu.h" -#include +#include #ifndef QT_NO_SCROLLBAR @@ -613,7 +613,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e) } const int initialDelay = 500; // default threshold d->activateControl(d->pressedControl, initialDelay); - QTimestamp time; + QElapsedTimer time; time.start(); repaint(style()->subControlRect(QStyle::CC_ScrollBar, &opt, d->pressedControl, this)); if (time.elapsed() >= initialDelay && d->repeatActionTimer.isActive()) { diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index b4e4cc4..7180c4d 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -58,7 +58,7 @@ #include "qscrollbar.h" #include "qstyle.h" #include "qstyleoption.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qtooltip.h" #include "qdebug.h" #include @@ -450,10 +450,10 @@ void QWorkspaceTitleBar::mousePressEvent(QMouseEvent *e) case QStyle::SC_TitleBarSysMenu: if (d->flags & Qt::WindowSystemMenuHint) { d->buttonDown = QStyle::SC_None; - static QTimestamp *t = 0; + static QElapsedTimer *t = 0; static QWorkspaceTitleBar *tc = 0; if (!t) - t = new QTimestamp; + t = new QElapsedTimer; if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) { emit showOperationMenu(); t->start(); @@ -1839,7 +1839,7 @@ bool QWorkspace::event(QEvent *e) bool QWorkspace::eventFilter(QObject *o, QEvent * e) { Q_D(QWorkspace); - static QTimestamp* t = 0; + static QElapsedTimer* t = 0; static QWorkspace* tc = 0; if (o == d->maxtools) { switch (e->type()) { @@ -1847,7 +1847,7 @@ bool QWorkspace::eventFilter(QObject *o, QEvent * e) { QMenuBar* b = (QMenuBar*)o->parent(); if (!t) - t = new QTimestamp; + t = new QElapsedTimer; if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) { if (isRightToLeft()) { QPoint p = b->mapToGlobal(QPoint(b->x() + b->width(), b->y() + b->height())); diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 9a87691..c907019 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include @@ -117,8 +117,8 @@ private: void drain(); QTimer* timer; - QTimestamp timeStamp; - QTimestamp clockStamp; + QElapsedTimer timeStamp; + QElapsedTimer clockStamp; qint64 elapsedTimeOffset; int intervalTime; char* audioBuffer; diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index c655701..e6ac231 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include #include @@ -134,8 +134,8 @@ private: QTimer* timer; QByteArray m_device; int bytesAvailable; - QTimestamp timeStamp; - QTimestamp clockStamp; + QElapsedTimer timeStamp; + QElapsedTimer clockStamp; qint64 elapsedTimeOffset; char* audioBuffer; snd_pcm_t* handle; diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index fc50ee5..21cd0fd 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -370,7 +370,7 @@ #include #include #include -#include +#include #ifndef QT_NO_OPENSSL #include @@ -1738,7 +1738,7 @@ bool QAbstractSocket::waitForConnected(int msecs) bool wasPendingClose = d->pendingClose; d->pendingClose = false; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (d->state == HostLookupState) { @@ -1819,7 +1819,7 @@ bool QAbstractSocket::waitForReadyRead(int msecs) return false; } - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // handle a socket in connecting state @@ -1878,7 +1878,7 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) if (d->writeBuffer.isEmpty()) return false; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // handle a socket in connecting state @@ -1960,7 +1960,7 @@ bool QAbstractSocket::waitForDisconnected(int msecs) return false; } - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // handle a socket in connecting state diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 9d412ac..dfda257 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -44,7 +44,7 @@ #include "qhostaddress.h" #include "qurl.h" #include "qhttp.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) #include @@ -319,7 +319,7 @@ bool QHttpSocketEngine::waitForRead(int msecs, bool *timedOut) if (!d->socket || d->socket->state() == QAbstractSocket::UnconnectedState) return false; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // Wait for more data if nothing is available. @@ -366,7 +366,7 @@ bool QHttpSocketEngine::waitForWrite(int msecs, bool *timedOut) return true; } - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // If we're not connected yet, wait until we are, and until bytes have diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 20301ba..f14decc 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -54,7 +54,7 @@ #include #include -#include +#include #ifdef Q_OS_VXWORKS # include @@ -534,7 +534,7 @@ bool QLocalSocket::waitForConnected(int msec) int result = -1; // on Linux timeout will be updated by select, but _not_ on other systems. - QTimestamp timer; + QElapsedTimer timer; timer.start(); while (state() == ConnectingState && (-1 == msec || timer.elapsed() < msec)) { diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 7c1fc17..6c800fe 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -44,7 +44,7 @@ #include "private/qnet_unix_p.h" #include "qiodevice.h" #include "qhostaddress.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qvarlengtharray.h" #include #include @@ -1003,7 +1003,7 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c #ifndef Q_OS_SYMBIAN ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv); #else - QTimestamp timer; + QElapsedTimer timer; timer.start(); do { diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 0c6a01a..f68edfe 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -49,7 +49,7 @@ #include "qdebug.h" #include "qhash.h" #include "qqueue.h" -#include "qtimestamp.h" +#include "qelapsedtimer.h" #include "qmutex.h" #include "qthread.h" #include "qcoreapplication.h" @@ -308,7 +308,7 @@ struct QSocks5BindData : public QSocks5Data quint16 localPort; QHostAddress peerAddress; quint16 peerPort; - QTimestamp timeStamp; + QElapsedTimer timeStamp; }; struct QSocks5RevivedDatagram @@ -1355,7 +1355,7 @@ bool QSocks5SocketEngine::bind(const QHostAddress &address, quint16 port) } int msecs = SOCKS5_BLOCKING_BIND_TIMEOUT; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); d->data->controlSocket->connectToHost(d->proxyInfo.hostName(), d->proxyInfo.port()); if (!d->waitForConnected(msecs, 0) || @@ -1455,7 +1455,7 @@ void QSocks5SocketEngine::close() if (d->data && d->data->controlSocket) { if (d->data->controlSocket->state() == QAbstractSocket::ConnectedState) { int msecs = 100; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); while (!d->data->controlSocket->bytesToWrite()) { if (!d->data->controlSocket->waitForBytesWritten(qt_timeout_value(msecs, stopWatch.elapsed()))) @@ -1674,7 +1674,7 @@ bool QSocks5SocketEnginePrivate::waitForConnected(int msecs, bool *timedOut) mode == BindMode ? BindSuccess : UdpAssociateSuccess; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); while (socks5State != wantedState) { @@ -1699,7 +1699,7 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut) d->readNotificationActivated = false; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // are we connected yet? @@ -1749,7 +1749,7 @@ bool QSocks5SocketEngine::waitForWrite(int msecs, bool *timedOut) Q_D(QSocks5SocketEngine); QSOCKS5_DEBUG << "waitForWrite" << msecs; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // are we connected yet? diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 895e32c..86b11b9 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -287,7 +287,7 @@ #include #include #include -#include +#include #include #include @@ -1393,7 +1393,7 @@ bool QSslSocket::waitForEncrypted(int msecs) if (d->mode == UnencryptedMode && !d->autoStartHandshake) return false; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (d->plainSocket->state() != QAbstractSocket::ConnectedState) { @@ -1433,7 +1433,7 @@ bool QSslSocket::waitForReadyRead(int msecs) bool *previousReadyReadEmittedPointer = d->readyReadEmittedPointer; d->readyReadEmittedPointer = &readyReadEmitted; - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { @@ -1470,7 +1470,7 @@ bool QSslSocket::waitForBytesWritten(int msecs) if (d->mode == UnencryptedMode) return d->plainSocket->waitForBytesWritten(msecs); - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { @@ -1508,7 +1508,7 @@ bool QSslSocket::waitForDisconnected(int msecs) if (d->mode == UnencryptedMode) return d->plainSocket->waitForDisconnected(msecs); - QTimestamp stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 54da114..82d69d6 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -44,7 +44,7 @@ #include #include -#include +#include QT_BEGIN_HEADER @@ -63,7 +63,7 @@ namespace QTest { Q_ASSERT(QCoreApplication::instance()); - QTimestamp timer; + QElapsedTimer timer; timer.start(); do { QCoreApplication::processEvents(QEventLoop::AllEvents, ms); -- cgit v0.12 From 7f3c9feaaf67ce7e89cd2f9df2155c61a58acaed Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Feb 2010 15:02:56 +0100 Subject: Rename the files too --- src/corelib/tools/qelapsedtimer.cpp | 65 ++++++++++ src/corelib/tools/qelapsedtimer.h | 85 +++++++++++++ src/corelib/tools/qelapsedtimer_generic.cpp | 91 +++++++++++++ src/corelib/tools/qelapsedtimer_mac.cpp | 115 +++++++++++++++++ src/corelib/tools/qelapsedtimer_symbian.cpp | 106 ++++++++++++++++ src/corelib/tools/qelapsedtimer_unix.cpp | 169 +++++++++++++++++++++++++ src/corelib/tools/qelapsedtimer_win.cpp | 129 +++++++++++++++++++ src/corelib/tools/qtimestamp.cpp | 65 ---------- src/corelib/tools/qtimestamp.h | 85 ------------- src/corelib/tools/qtimestamp_generic.cpp | 91 ------------- src/corelib/tools/qtimestamp_mac.cpp | 115 ----------------- src/corelib/tools/qtimestamp_symbian.cpp | 106 ---------------- src/corelib/tools/qtimestamp_unix.cpp | 169 ------------------------- src/corelib/tools/qtimestamp_win.cpp | 129 ------------------- tests/auto/qelapsedtimer/qelapsedtimer.pro | 13 ++ tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 94 ++++++++++++++ tests/auto/qtimestamp/qtimestamp.pro | 13 -- tests/auto/qtimestamp/tst_qtimestamp.cpp | 94 -------------- 18 files changed, 867 insertions(+), 867 deletions(-) create mode 100644 src/corelib/tools/qelapsedtimer.cpp create mode 100644 src/corelib/tools/qelapsedtimer.h create mode 100644 src/corelib/tools/qelapsedtimer_generic.cpp create mode 100644 src/corelib/tools/qelapsedtimer_mac.cpp create mode 100644 src/corelib/tools/qelapsedtimer_symbian.cpp create mode 100644 src/corelib/tools/qelapsedtimer_unix.cpp create mode 100644 src/corelib/tools/qelapsedtimer_win.cpp delete mode 100644 src/corelib/tools/qtimestamp.cpp delete mode 100644 src/corelib/tools/qtimestamp.h delete mode 100644 src/corelib/tools/qtimestamp_generic.cpp delete mode 100644 src/corelib/tools/qtimestamp_mac.cpp delete mode 100644 src/corelib/tools/qtimestamp_symbian.cpp delete mode 100644 src/corelib/tools/qtimestamp_unix.cpp delete mode 100644 src/corelib/tools/qtimestamp_win.cpp create mode 100644 tests/auto/qelapsedtimer/qelapsedtimer.pro create mode 100644 tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp delete mode 100644 tests/auto/qtimestamp/qtimestamp.pro delete mode 100644 tests/auto/qtimestamp/tst_qtimestamp.cpp diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp new file mode 100644 index 0000000..220b108 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qelapsedtimer.h" + +QT_BEGIN_NAMESPACE + +static const qint64 invalidData = Q_INT64_C(0x8000000000000000); + +void QElapsedTimer::invalidate() +{ + t1 = t2 = invalidData; +} + +bool QElapsedTimer::isValid() const +{ + return t1 != invalidData && t2 != invalidData; +} + +bool QElapsedTimer::hasExpired(qint64 timeout) const +{ + // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be + // considered as never expired + return quint64(elapsed()) > quint64(timeout); +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/tools/qelapsedtimer.h new file mode 100644 index 0000000..4fa0ca5 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTIMESTAMP_H +#define QTIMESTAMP_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QElapsedTimer +{ +public: + static bool isMonotonic(); + + void start(); + qint64 restart(); + void invalidate(); + bool isValid() const; + + qint64 elapsed() const; + bool hasExpired(qint64 timeout) const; + + qint64 msecsTo(const QElapsedTimer &other) const; + qint64 secsTo(const QElapsedTimer &other) const; + + bool operator==(const QElapsedTimer &other) const + { return t1 == other.t1 && t2 == other.t2; } + bool operator!=(const QElapsedTimer &other) const + { return !(*this == other); } + + friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2); + +private: + qint64 t1; + qint64 t2; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QTIMESTAMP_H diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp new file mode 100644 index 0000000..a9c2233 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qelapsedtimer.h" +#include "qdatetime.h" + +QT_BEGIN_NAMESPACE + +bool QElapsedTimer::isMonotonic() +{ + return false; +} + +void QElapsedTimer::start() +{ + QTime t = QTime::currentTime(); + t1 = t.mds; + t2 = 0; +} + +qint64 QElapsedTimer::restart() +{ + QTime t = QTime::currentTime(); + qint64 old = t1; + t1 = t.mds; + return t1 - old; +} + +qint64 QElapsedTimer::elapsed() const +{ + QTime t = QTime::currentTime(); + return t.mds - t1; +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + qint64 diff = other.t1 - t1; + if (diff < 0) // passed midnight + diff += 86400 * 1000; + return diff; +} + +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const +{ + return msecsTo(other) / 1000; +} + +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qelapsedtimer_mac.cpp b/src/corelib/tools/qelapsedtimer_mac.cpp new file mode 100644 index 0000000..21a6d1b --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_mac.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qelapsedtimer.h" +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +bool QElapsedTimer::isMonotonic() +{ + return true; +} + +static mach_timebase_info_data_t info = {0,0}; +static qint64 absoluteToNSecs(qint64 cpuTime) +{ + if (info.denom == 0) + mach_timebase_info(&info); + qint64 nsecs = cpuTime * info.numer / info.denom; + return nsecs; +} + +static qint64 absoluteToMSecs(qint64 cpuTime) +{ + return absoluteToNSecs(cpuTime) / 1000000; +} + +timeval qt_gettime() +{ + timeval tv; + + uint64_t cpu_time = mach_absolute_time(); + uint64_t nsecs = absoluteToNSecs(cpu_time); + tv.tv_sec = nsecs / 1000000000ull; + tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); + return tv; +} + +void QElapsedTimer::start() +{ + t1 = mach_absolute_time(); + t2 = 0; +} + +qint64 QElapsedTimer::restart() +{ + qint64 old = t1; + t1 = mach_absolute_time(); + + return absoluteToMSecs(t1 - old); +} + +qint64 QElapsedTimer::elapsed() const +{ + uint64_t cpu_time = mach_absolute_time(); + return absoluteToMSecs(cpu_time - t1); +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + return absoluteToMSecs(other.t1 - t1); +} + +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const +{ + return msecsTo(other) / 1000; +} + +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) +{ + return v1.t1 < v2.t1; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp new file mode 100644 index 0000000..1fbba65 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_symbian.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qelapsedtimer.h" +#include + +QT_BEGIN_NAMESPACE + +// return quint64 to avoid sign-extension +static quint64 getMillisecondFromTick() +{ + static TInt nanokernel_tick_period; + if (!nanokernel_tick_period) + HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period); + return nanokernel_tick_period * User::NTickCount(); +} + +static qint64 difference(qint64 a, qint64 b) +{ + qint64 retval = a - b; + // there can be 32-bit rollover + // assume there were rollovers if the difference is negative by more than + // 75% of the 32-bit range + + if (retval < Q_INT64_C(-0xc0000000)) + retval += Q_UINT64_C(0x100000000); + return retval; +} + +bool QElapsedTimer::isMonotonic() +{ + return true; +} + +void QElapsedTimer::start() +{ + t1 = getMillisecondFromTick(); + t2 = 0; +} + +qint64 QElapsedTimer::restart() +{ + qint64 oldt1 = t1; + t1 = getMillisecondFromTick(); + return difference(t1, oldt1); +} + +qint64 QElapsedTimer::elapsed() const +{ + return difference(getMillisecondFromTick(), t1); +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + return difference(other.t1, t1); +} + +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const +{ + return msecsTo(other) / 1000; +} + +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) +{ + return difference(v1.t1, v2.t1) < 0; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp new file mode 100644 index 0000000..b8215f4 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qelapsedtimer.h" +#include "qpair.h" +#include +#include +#include + +#if !defined(QT_NO_CLOCK_MONOTONIC) +# if defined(QT_BOOTSTRAPPED) +# define QT_NO_CLOCK_MONOTONIC +# endif +#endif + +QT_BEGIN_NAMESPACE + +static qint64 fractionAdjustment() +{ + if (QElapsedTimer::isMonotonic()) { + // the monotonic timer is measured in nanoseconds + // 1 ms = 1000000 ns + return 1000*1000ull; + } else { + // gettimeofday is measured in microseconds + // 1 ms = 1000 us + return 1000; + } +} + +bool QElapsedTimer::isMonotonic() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 > 0) + return true; +#else + static int returnValue = 0; + + if (returnValue == 0) { +# if (_POSIX_MONOTONIC_CLOCK-0 < 0) + returnValue = -1; +# elif (_POSIX_MONOTONIC_CLOCK == 0) + // detect if the system support monotonic timers + long x = sysconf(_SC_MONOTONIC_CLOCK); + returnValue = (x >= 200112L) ? 1 : -1; +# endif + } + + return returnValue != -1; +#endif +} + +static inline QPair do_gettime() +{ +#if (_POSIX_MONOTONIC_CLOCK-0 > 0) + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return qMakePair(ts.tv_sec, ts.tv_nsec); +#else +# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) + if (QElapsedTimer::isMonotonic()) { + timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return qMakePair(ts.tv_sec, ts.tv_nsec); + } +# endif + // use gettimeofday + timeval tv; + ::gettimeofday(&tv, 0); + return qMakePair(tv.tv_sec, tv.tv_usec); +#endif +} + +// used in qcore_unix.cpp and qeventdispatcher_unix.cpp +timeval qt_gettime() +{ + QPair r = do_gettime(); + + timeval tv; + tv.tv_sec = r.first; + tv.tv_usec = r.second; + if (QElapsedTimer::isMonotonic()) + tv.tv_usec /= 1000; + + return tv; +} + +void QElapsedTimer::start() +{ + QPair r = do_gettime(); + t1 = r.first; + t2 = r.second; +} + +qint64 QElapsedTimer::restart() +{ + QPair r = do_gettime(); + qint64 oldt1 = t1; + qint64 oldt2 = t2; + t1 = r.first; + t2 = r.second; + + r.first -= oldt1; + r.second -= oldt2; + return r.first * 1000 + r.second / fractionAdjustment(); +} + +qint64 QElapsedTimer::elapsed() const +{ + QElapsedTimer now; + now.start(); + return msecsTo(now); +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + qint64 secs = other.t1 - t1; + qint64 fraction = other.t2 - t2; + return secs * 1000 + fraction / fractionAdjustment(); +} + +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const +{ + return other.t1 - t1; +} + +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) +{ + return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp new file mode 100644 index 0000000..e384dd8 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** 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 QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qelapsedtimer.h" +#include + +typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); +static PtrGetTickCount64 ptrGetTickCount64 = 0; + +QT_BEGIN_NAMESPACE + +static void resolveLibs() +{ + static bool done = false; + if (done) + return; + + // try to get GetTickCount64 from the system + HMODULE kernel32 = GetModuleHandleW(L"kernel32"); + if (!kernel32) + return; + +#if defined(Q_OS_WINCE) + // does this function exist on WinCE, or will ever exist? + ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, L"GetTickCount64"); +#else + ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); +#endif + + done = true; +} + +static quint64 getTickCount() +{ + resolveLibs(); + if (ptrGetTickCount64) + return ptrGetTickCount64(); + return GetTickCount(); +} + +static qint64 difference(qint64 a, qint64 b) +{ + qint64 retval = a - b; + // if we're not using GetTickCount64, then there can be 32-bit rollover + // assume there were rollovers if the difference is negative by more than + // 75% of the 32-bit range + + if (!ptrGetTickCount64 && retval < Q_INT64_C(-0xc0000000)) + retval += Q_UINT64_C(0x100000000); + return retval; +} + +bool QElapsedTimer::isMonotonic() +{ + return true; +} + +void QElapsedTimer::start() +{ + t1 = getTickCount(); + t2 = 0; +} + +qint64 QElapsedTimer::restart() +{ + qint64 oldt1 = t1; + t1 = getTickCount(); + return difference(t1, oldt1); +} + +qint64 QElapsedTimer::elapsed() const +{ + return difference(getTickCount(), t1); +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + return difference(other.t1, t1); +} + +qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const +{ + return msecsTo(other) / 1000; +} + +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) +{ + return difference(v1.t1, v2.t1) < 0; +} + +QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp.cpp b/src/corelib/tools/qtimestamp.cpp deleted file mode 100644 index 220b108..0000000 --- a/src/corelib/tools/qtimestamp.cpp +++ /dev/null @@ -1,65 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qelapsedtimer.h" - -QT_BEGIN_NAMESPACE - -static const qint64 invalidData = Q_INT64_C(0x8000000000000000); - -void QElapsedTimer::invalidate() -{ - t1 = t2 = invalidData; -} - -bool QElapsedTimer::isValid() const -{ - return t1 != invalidData && t2 != invalidData; -} - -bool QElapsedTimer::hasExpired(qint64 timeout) const -{ - // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be - // considered as never expired - return quint64(elapsed()) > quint64(timeout); -} - -QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp.h b/src/corelib/tools/qtimestamp.h deleted file mode 100644 index 4fa0ca5..0000000 --- a/src/corelib/tools/qtimestamp.h +++ /dev/null @@ -1,85 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTIMESTAMP_H -#define QTIMESTAMP_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class Q_CORE_EXPORT QElapsedTimer -{ -public: - static bool isMonotonic(); - - void start(); - qint64 restart(); - void invalidate(); - bool isValid() const; - - qint64 elapsed() const; - bool hasExpired(qint64 timeout) const; - - qint64 msecsTo(const QElapsedTimer &other) const; - qint64 secsTo(const QElapsedTimer &other) const; - - bool operator==(const QElapsedTimer &other) const - { return t1 == other.t1 && t2 == other.t2; } - bool operator!=(const QElapsedTimer &other) const - { return !(*this == other); } - - friend bool Q_CORE_EXPORT operator<(const QElapsedTimer &v1, const QElapsedTimer &v2); - -private: - qint64 t1; - qint64 t2; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QTIMESTAMP_H diff --git a/src/corelib/tools/qtimestamp_generic.cpp b/src/corelib/tools/qtimestamp_generic.cpp deleted file mode 100644 index a9c2233..0000000 --- a/src/corelib/tools/qtimestamp_generic.cpp +++ /dev/null @@ -1,91 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qelapsedtimer.h" -#include "qdatetime.h" - -QT_BEGIN_NAMESPACE - -bool QElapsedTimer::isMonotonic() -{ - return false; -} - -void QElapsedTimer::start() -{ - QTime t = QTime::currentTime(); - t1 = t.mds; - t2 = 0; -} - -qint64 QElapsedTimer::restart() -{ - QTime t = QTime::currentTime(); - qint64 old = t1; - t1 = t.mds; - return t1 - old; -} - -qint64 QElapsedTimer::elapsed() const -{ - QTime t = QTime::currentTime(); - return t.mds - t1; -} - -qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const -{ - qint64 diff = other.t1 - t1; - if (diff < 0) // passed midnight - diff += 86400 * 1000; - return diff; -} - -qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const -{ - return msecsTo(other) / 1000; -} - -bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) -{ - return v1.t1 < v2.t1; -} - -QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp_mac.cpp b/src/corelib/tools/qtimestamp_mac.cpp deleted file mode 100644 index 21a6d1b..0000000 --- a/src/corelib/tools/qtimestamp_mac.cpp +++ /dev/null @@ -1,115 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qelapsedtimer.h" -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -bool QElapsedTimer::isMonotonic() -{ - return true; -} - -static mach_timebase_info_data_t info = {0,0}; -static qint64 absoluteToNSecs(qint64 cpuTime) -{ - if (info.denom == 0) - mach_timebase_info(&info); - qint64 nsecs = cpuTime * info.numer / info.denom; - return nsecs; -} - -static qint64 absoluteToMSecs(qint64 cpuTime) -{ - return absoluteToNSecs(cpuTime) / 1000000; -} - -timeval qt_gettime() -{ - timeval tv; - - uint64_t cpu_time = mach_absolute_time(); - uint64_t nsecs = absoluteToNSecs(cpu_time); - tv.tv_sec = nsecs / 1000000000ull; - tv.tv_usec = (nsecs / 1000) - (tv.tv_sec * 1000000); - return tv; -} - -void QElapsedTimer::start() -{ - t1 = mach_absolute_time(); - t2 = 0; -} - -qint64 QElapsedTimer::restart() -{ - qint64 old = t1; - t1 = mach_absolute_time(); - - return absoluteToMSecs(t1 - old); -} - -qint64 QElapsedTimer::elapsed() const -{ - uint64_t cpu_time = mach_absolute_time(); - return absoluteToMSecs(cpu_time - t1); -} - -qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const -{ - return absoluteToMSecs(other.t1 - t1); -} - -qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const -{ - return msecsTo(other) / 1000; -} - -bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) -{ - return v1.t1 < v2.t1; -} - -QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp_symbian.cpp b/src/corelib/tools/qtimestamp_symbian.cpp deleted file mode 100644 index 1fbba65..0000000 --- a/src/corelib/tools/qtimestamp_symbian.cpp +++ /dev/null @@ -1,106 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qelapsedtimer.h" -#include - -QT_BEGIN_NAMESPACE - -// return quint64 to avoid sign-extension -static quint64 getMillisecondFromTick() -{ - static TInt nanokernel_tick_period; - if (!nanokernel_tick_period) - HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period); - return nanokernel_tick_period * User::NTickCount(); -} - -static qint64 difference(qint64 a, qint64 b) -{ - qint64 retval = a - b; - // there can be 32-bit rollover - // assume there were rollovers if the difference is negative by more than - // 75% of the 32-bit range - - if (retval < Q_INT64_C(-0xc0000000)) - retval += Q_UINT64_C(0x100000000); - return retval; -} - -bool QElapsedTimer::isMonotonic() -{ - return true; -} - -void QElapsedTimer::start() -{ - t1 = getMillisecondFromTick(); - t2 = 0; -} - -qint64 QElapsedTimer::restart() -{ - qint64 oldt1 = t1; - t1 = getMillisecondFromTick(); - return difference(t1, oldt1); -} - -qint64 QElapsedTimer::elapsed() const -{ - return difference(getMillisecondFromTick(), t1); -} - -qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const -{ - return difference(other.t1, t1); -} - -qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const -{ - return msecsTo(other) / 1000; -} - -bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) -{ - return difference(v1.t1, v2.t1) < 0; -} - -QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp_unix.cpp b/src/corelib/tools/qtimestamp_unix.cpp deleted file mode 100644 index b8215f4..0000000 --- a/src/corelib/tools/qtimestamp_unix.cpp +++ /dev/null @@ -1,169 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qelapsedtimer.h" -#include "qpair.h" -#include -#include -#include - -#if !defined(QT_NO_CLOCK_MONOTONIC) -# if defined(QT_BOOTSTRAPPED) -# define QT_NO_CLOCK_MONOTONIC -# endif -#endif - -QT_BEGIN_NAMESPACE - -static qint64 fractionAdjustment() -{ - if (QElapsedTimer::isMonotonic()) { - // the monotonic timer is measured in nanoseconds - // 1 ms = 1000000 ns - return 1000*1000ull; - } else { - // gettimeofday is measured in microseconds - // 1 ms = 1000 us - return 1000; - } -} - -bool QElapsedTimer::isMonotonic() -{ -#if (_POSIX_MONOTONIC_CLOCK-0 > 0) - return true; -#else - static int returnValue = 0; - - if (returnValue == 0) { -# if (_POSIX_MONOTONIC_CLOCK-0 < 0) - returnValue = -1; -# elif (_POSIX_MONOTONIC_CLOCK == 0) - // detect if the system support monotonic timers - long x = sysconf(_SC_MONOTONIC_CLOCK); - returnValue = (x >= 200112L) ? 1 : -1; -# endif - } - - return returnValue != -1; -#endif -} - -static inline QPair do_gettime() -{ -#if (_POSIX_MONOTONIC_CLOCK-0 > 0) - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return qMakePair(ts.tv_sec, ts.tv_nsec); -#else -# if !defined(QT_NO_CLOCK_MONOTONIC) && !defined(QT_BOOTSTRAPPED) - if (QElapsedTimer::isMonotonic()) { - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return qMakePair(ts.tv_sec, ts.tv_nsec); - } -# endif - // use gettimeofday - timeval tv; - ::gettimeofday(&tv, 0); - return qMakePair(tv.tv_sec, tv.tv_usec); -#endif -} - -// used in qcore_unix.cpp and qeventdispatcher_unix.cpp -timeval qt_gettime() -{ - QPair r = do_gettime(); - - timeval tv; - tv.tv_sec = r.first; - tv.tv_usec = r.second; - if (QElapsedTimer::isMonotonic()) - tv.tv_usec /= 1000; - - return tv; -} - -void QElapsedTimer::start() -{ - QPair r = do_gettime(); - t1 = r.first; - t2 = r.second; -} - -qint64 QElapsedTimer::restart() -{ - QPair r = do_gettime(); - qint64 oldt1 = t1; - qint64 oldt2 = t2; - t1 = r.first; - t2 = r.second; - - r.first -= oldt1; - r.second -= oldt2; - return r.first * 1000 + r.second / fractionAdjustment(); -} - -qint64 QElapsedTimer::elapsed() const -{ - QElapsedTimer now; - now.start(); - return msecsTo(now); -} - -qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const -{ - qint64 secs = other.t1 - t1; - qint64 fraction = other.t2 - t2; - return secs * 1000 + fraction / fractionAdjustment(); -} - -qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const -{ - return other.t1 - t1; -} - -bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) -{ - return v1.t1 < v2.t1 || (v1.t1 == v2.t1 && v1.t2 < v2.t2); -} - -QT_END_NAMESPACE diff --git a/src/corelib/tools/qtimestamp_win.cpp b/src/corelib/tools/qtimestamp_win.cpp deleted file mode 100644 index e384dd8..0000000 --- a/src/corelib/tools/qtimestamp_win.cpp +++ /dev/null @@ -1,129 +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 QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qelapsedtimer.h" -#include - -typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); -static PtrGetTickCount64 ptrGetTickCount64 = 0; - -QT_BEGIN_NAMESPACE - -static void resolveLibs() -{ - static bool done = false; - if (done) - return; - - // try to get GetTickCount64 from the system - HMODULE kernel32 = GetModuleHandleW(L"kernel32"); - if (!kernel32) - return; - -#if defined(Q_OS_WINCE) - // does this function exist on WinCE, or will ever exist? - ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, L"GetTickCount64"); -#else - ptrGetTickCount64 = (PtrGetTickCount64)GetProcAddress(kernel32, "GetTickCount64"); -#endif - - done = true; -} - -static quint64 getTickCount() -{ - resolveLibs(); - if (ptrGetTickCount64) - return ptrGetTickCount64(); - return GetTickCount(); -} - -static qint64 difference(qint64 a, qint64 b) -{ - qint64 retval = a - b; - // if we're not using GetTickCount64, then there can be 32-bit rollover - // assume there were rollovers if the difference is negative by more than - // 75% of the 32-bit range - - if (!ptrGetTickCount64 && retval < Q_INT64_C(-0xc0000000)) - retval += Q_UINT64_C(0x100000000); - return retval; -} - -bool QElapsedTimer::isMonotonic() -{ - return true; -} - -void QElapsedTimer::start() -{ - t1 = getTickCount(); - t2 = 0; -} - -qint64 QElapsedTimer::restart() -{ - qint64 oldt1 = t1; - t1 = getTickCount(); - return difference(t1, oldt1); -} - -qint64 QElapsedTimer::elapsed() const -{ - return difference(getTickCount(), t1); -} - -qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const -{ - return difference(other.t1, t1); -} - -qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const -{ - return msecsTo(other) / 1000; -} - -bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) -{ - return difference(v1.t1, v2.t1) < 0; -} - -QT_END_NAMESPACE diff --git a/tests/auto/qelapsedtimer/qelapsedtimer.pro b/tests/auto/qelapsedtimer/qelapsedtimer.pro new file mode 100644 index 0000000..3a06390 --- /dev/null +++ b/tests/auto/qelapsedtimer/qelapsedtimer.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +QT -= gui + +SOURCES += tst_qtimestamp.cpp +wince* { + DEFINES += SRCDIR=\\\"\\\" +} else:symbian { + # do not define SRCDIR at all + TARGET.EPOCHEAPSIZE = 0x100000 0x3000000 +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp new file mode 100644 index 0000000..79138ce --- /dev/null +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -0,0 +1,94 @@ +#include +#include +#include +#include + +static const int minResolution = 50; // the minimum resolution for the tests + +class tst_QTimestamp : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void validity(); + void basics(); + void elapsed(); +}; + +void tst_QTimestamp::validity() +{ + QTimestamp t; + + t.invalidate(); + QVERIFY(!t.isValid()); + + t.start(); + QVERIFY(t.isValid()); + + t.invalidate(); + QVERIFY(!t.isValid()); +} + +void tst_QTimestamp::basics() +{ + QTimestamp t1; + t1.start(); + + QCOMPARE(t1, t1); + QVERIFY(!(t1 != t1)); + QVERIFY(!(t1 < t1)); + QCOMPARE(t1.msecsTo(t1), qint64(0)); + QCOMPARE(t1.secsTo(t1), qint64(0)); + QCOMPARE(t1 + 0, t1); + QCOMPARE(t1 - 0, t1); + + QTimestamp t2 = t1; + t2 += 1000; // so we can use secsTo + + QVERIFY(t1 != t2); + QVERIFY(!(t1 == t2)); + QVERIFY(t1 < t2); + QVERIFY(!(t2 < t1)); + QCOMPARE(t1.msecsTo(t2), qint64(1000)); + QCOMPARE(t1.secsTo(t2), qint64(1)); + QCOMPARE(t2 - t1, qint64(1000)); + QCOMPARE(t1 - t2, qint64(-1000)); + + qint64 elapsed = t1.restart(); + QVERIFY(elapsed < minResolution); +} + +void tst_QTimestamp::elapsed() +{ + QTimestamp t1; + t1.start(); + + QTest::qSleep(4*minResolution); + QTimestamp t2; + t2.start(); + + QVERIFY(t1 != t2); + QVERIFY(!(t1 == t2)); + QVERIFY(t1 < t2); + QVERIFY(t1.msecsTo(t2) > 0); + // don't check: t1.secsTo(t2) + QVERIFY(t1 - t2 < 0); + + QVERIFY(t1.elapsed() > 0); + QVERIFY(t1.hasExpired(minResolution)); + QVERIFY(!t1.hasExpired(8*minResolution)); + QVERIFY(!t2.hasExpired(minResolution)); + + QVERIFY(!t1.hasExpired(-1)); + QVERIFY(!t2.hasExpired(-1)); + + qint64 elapsed = t1.restart(); + QVERIFY(elapsed > 3*minResolution); + QVERIFY(elapsed < 5*minResolution); + qint64 diff = t1 - t2; + QVERIFY(diff < minResolution); +} + +QTEST_MAIN(tst_QTimestamp); + +#include "tst_qtimestamp.moc" diff --git a/tests/auto/qtimestamp/qtimestamp.pro b/tests/auto/qtimestamp/qtimestamp.pro deleted file mode 100644 index 3a06390..0000000 --- a/tests/auto/qtimestamp/qtimestamp.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -QT -= gui - -SOURCES += tst_qtimestamp.cpp -wince* { - DEFINES += SRCDIR=\\\"\\\" -} else:symbian { - # do not define SRCDIR at all - TARGET.EPOCHEAPSIZE = 0x100000 0x3000000 -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - diff --git a/tests/auto/qtimestamp/tst_qtimestamp.cpp b/tests/auto/qtimestamp/tst_qtimestamp.cpp deleted file mode 100644 index 79138ce..0000000 --- a/tests/auto/qtimestamp/tst_qtimestamp.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include -#include -#include -#include - -static const int minResolution = 50; // the minimum resolution for the tests - -class tst_QTimestamp : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void validity(); - void basics(); - void elapsed(); -}; - -void tst_QTimestamp::validity() -{ - QTimestamp t; - - t.invalidate(); - QVERIFY(!t.isValid()); - - t.start(); - QVERIFY(t.isValid()); - - t.invalidate(); - QVERIFY(!t.isValid()); -} - -void tst_QTimestamp::basics() -{ - QTimestamp t1; - t1.start(); - - QCOMPARE(t1, t1); - QVERIFY(!(t1 != t1)); - QVERIFY(!(t1 < t1)); - QCOMPARE(t1.msecsTo(t1), qint64(0)); - QCOMPARE(t1.secsTo(t1), qint64(0)); - QCOMPARE(t1 + 0, t1); - QCOMPARE(t1 - 0, t1); - - QTimestamp t2 = t1; - t2 += 1000; // so we can use secsTo - - QVERIFY(t1 != t2); - QVERIFY(!(t1 == t2)); - QVERIFY(t1 < t2); - QVERIFY(!(t2 < t1)); - QCOMPARE(t1.msecsTo(t2), qint64(1000)); - QCOMPARE(t1.secsTo(t2), qint64(1)); - QCOMPARE(t2 - t1, qint64(1000)); - QCOMPARE(t1 - t2, qint64(-1000)); - - qint64 elapsed = t1.restart(); - QVERIFY(elapsed < minResolution); -} - -void tst_QTimestamp::elapsed() -{ - QTimestamp t1; - t1.start(); - - QTest::qSleep(4*minResolution); - QTimestamp t2; - t2.start(); - - QVERIFY(t1 != t2); - QVERIFY(!(t1 == t2)); - QVERIFY(t1 < t2); - QVERIFY(t1.msecsTo(t2) > 0); - // don't check: t1.secsTo(t2) - QVERIFY(t1 - t2 < 0); - - QVERIFY(t1.elapsed() > 0); - QVERIFY(t1.hasExpired(minResolution)); - QVERIFY(!t1.hasExpired(8*minResolution)); - QVERIFY(!t2.hasExpired(minResolution)); - - QVERIFY(!t1.hasExpired(-1)); - QVERIFY(!t2.hasExpired(-1)); - - qint64 elapsed = t1.restart(); - QVERIFY(elapsed > 3*minResolution); - QVERIFY(elapsed < 5*minResolution); - qint64 diff = t1 - t2; - QVERIFY(diff < minResolution); -} - -QTEST_MAIN(tst_QTimestamp); - -#include "tst_qtimestamp.moc" -- cgit v0.12 From bc88d38905a80b2a025acf5b52858264c0ef0d39 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Feb 2010 15:10:19 +0100 Subject: Autotest: Rename the test to match the new class name --- tests/auto/qelapsedtimer/qelapsedtimer.pro | 2 +- tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/auto/qelapsedtimer/qelapsedtimer.pro b/tests/auto/qelapsedtimer/qelapsedtimer.pro index 3a06390..ed75228 100644 --- a/tests/auto/qelapsedtimer/qelapsedtimer.pro +++ b/tests/auto/qelapsedtimer/qelapsedtimer.pro @@ -1,7 +1,7 @@ load(qttest_p4) QT -= gui -SOURCES += tst_qtimestamp.cpp +SOURCES += tst_qelapsedtimer.cpp wince* { DEFINES += SRCDIR=\\\"\\\" } else:symbian { diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp index 79138ce..d671d1b 100644 --- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -1,11 +1,11 @@ #include #include -#include +#include #include static const int minResolution = 50; // the minimum resolution for the tests -class tst_QTimestamp : public QObject +class tst_QElapsedTimer : public QObject { Q_OBJECT @@ -15,9 +15,9 @@ private Q_SLOTS: void elapsed(); }; -void tst_QTimestamp::validity() +void tst_QElapsedTimer::validity() { - QTimestamp t; + QElapsedTimer t; t.invalidate(); QVERIFY(!t.isValid()); @@ -29,9 +29,9 @@ void tst_QTimestamp::validity() QVERIFY(!t.isValid()); } -void tst_QTimestamp::basics() +void tst_QElapsedTimer::basics() { - QTimestamp t1; + QElapsedTimer t1; t1.start(); QCOMPARE(t1, t1); @@ -42,7 +42,7 @@ void tst_QTimestamp::basics() QCOMPARE(t1 + 0, t1); QCOMPARE(t1 - 0, t1); - QTimestamp t2 = t1; + QElapsedTimer t2 = t1; t2 += 1000; // so we can use secsTo QVERIFY(t1 != t2); @@ -58,13 +58,13 @@ void tst_QTimestamp::basics() QVERIFY(elapsed < minResolution); } -void tst_QTimestamp::elapsed() +void tst_QElapsedTimer::elapsed() { - QTimestamp t1; + QElapsedTimer t1; t1.start(); QTest::qSleep(4*minResolution); - QTimestamp t2; + QElapsedTimer t2; t2.start(); QVERIFY(t1 != t2); @@ -89,6 +89,6 @@ void tst_QTimestamp::elapsed() QVERIFY(diff < minResolution); } -QTEST_MAIN(tst_QTimestamp); +QTEST_MAIN(tst_QElapsedTimer); -#include "tst_qtimestamp.moc" +#include "tst_qelapsedtimer.moc" -- cgit v0.12 From 047090b2b7af7e5a3b88615dafed9d4d957fbe6e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Feb 2010 16:29:47 +0100 Subject: Add a couple of extra functions to QElapsedTimer --- src/corelib/tools/qelapsedtimer.h | 13 ++++++++++ src/corelib/tools/qelapsedtimer_generic.cpp | 29 +++++++++++++++------- src/corelib/tools/qelapsedtimer_mac.cpp | 11 +++++++++ src/corelib/tools/qelapsedtimer_symbian.cpp | 10 ++++++++ src/corelib/tools/qelapsedtimer_unix.cpp | 14 +++++++++-- src/corelib/tools/qelapsedtimer_win.cpp | 10 ++++++++ tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 33 +++++++++++++++++++++----- 7 files changed, 103 insertions(+), 17 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/tools/qelapsedtimer.h index 4fa0ca5..827359b 100644 --- a/src/corelib/tools/qelapsedtimer.h +++ b/src/corelib/tools/qelapsedtimer.h @@ -53,8 +53,20 @@ QT_MODULE(Core) class Q_CORE_EXPORT QElapsedTimer { public: + enum ClockType { + SystemTime, + MonotonicClock, + TickCounter, + MachAbsoluteTime + }; + static ClockType clockType(); static bool isMonotonic(); + static inline QElapsedTimer started() + { QElapsedTimer t; t.start(); return t; } + static inline QElapsedTimer invalid() + { QElapsedTimer t; t.invalidate(); return t; } + void start(); qint64 restart(); void invalidate(); @@ -63,6 +75,7 @@ public: qint64 elapsed() const; bool hasExpired(qint64 timeout) const; + qint64 msecsSinceReference() const; qint64 msecsTo(const QElapsedTimer &other) const; qint64 secsTo(const QElapsedTimer &other) const; diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index a9c2233..db6da46 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -44,6 +44,17 @@ QT_BEGIN_NAMESPACE +static qint64 currentDateTimeMsec() +{ + QDateTime t = QDateTime::currentDateTime(); + return t.toTime_t() * Q_INT64_C(1000) + t.time().msec(); +} + +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return SystemTime; +} + bool QElapsedTimer::isMonotonic() { return false; @@ -51,30 +62,30 @@ bool QElapsedTimer::isMonotonic() void QElapsedTimer::start() { - QTime t = QTime::currentTime(); - t1 = t.mds; - t2 = 0; + restart(); } qint64 QElapsedTimer::restart() { - QTime t = QTime::currentTime(); qint64 old = t1; - t1 = t.mds; + t1 = currentDateTimeMsec(); + t2 = 0; return t1 - old; } qint64 QElapsedTimer::elapsed() const { - QTime t = QTime::currentTime(); - return t.mds - t1; + return currentDateTimeMsec() - t1; +} + +qint64 QElapsedTimer::msecsSinceReference() const +{ + return t1; } qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { qint64 diff = other.t1 - t1; - if (diff < 0) // passed midnight - diff += 86400 * 1000; return diff; } diff --git a/src/corelib/tools/qelapsedtimer_mac.cpp b/src/corelib/tools/qelapsedtimer_mac.cpp index 21a6d1b..4a62761 100644 --- a/src/corelib/tools/qelapsedtimer_mac.cpp +++ b/src/corelib/tools/qelapsedtimer_mac.cpp @@ -47,6 +47,11 @@ QT_BEGIN_NAMESPACE +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return MachAbsoluteTime; +} + bool QElapsedTimer::isMonotonic() { return true; @@ -87,6 +92,7 @@ qint64 QElapsedTimer::restart() { qint64 old = t1; t1 = mach_absolute_time(); + t2 = 0; return absoluteToMSecs(t1 - old); } @@ -97,6 +103,11 @@ qint64 QElapsedTimer::elapsed() const return absoluteToMSecs(cpu_time - t1); } +qint64 QElapsedTimer::msecsSinceReference() +{ + return absoluteToMSecs(t1); +} + qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { return absoluteToMSecs(other.t1 - t1); diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp index 1fbba65..06e6f99 100644 --- a/src/corelib/tools/qelapsedtimer_symbian.cpp +++ b/src/corelib/tools/qelapsedtimer_symbian.cpp @@ -53,6 +53,11 @@ static quint64 getMillisecondFromTick() return nanokernel_tick_period * User::NTickCount(); } +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return TickCounter; +} + static qint64 difference(qint64 a, qint64 b) { qint64 retval = a - b; @@ -88,6 +93,11 @@ qint64 QElapsedTimer::elapsed() const return difference(getMillisecondFromTick(), t1); } +qint64 QElapsedTimer::msecsSinceReference() const +{ + return t1; +} + qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { return difference(other.t1, t1); diff --git a/src/corelib/tools/qelapsedtimer_unix.cpp b/src/corelib/tools/qelapsedtimer_unix.cpp index b8215f4..85d7fa8 100644 --- a/src/corelib/tools/qelapsedtimer_unix.cpp +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -87,6 +87,11 @@ bool QElapsedTimer::isMonotonic() #endif } +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return isMonotonic() ? MonotonicClock : SystemTime; +} + static inline QPair do_gettime() { #if (_POSIX_MONOTONIC_CLOCK-0 > 0) @@ -139,7 +144,7 @@ qint64 QElapsedTimer::restart() r.first -= oldt1; r.second -= oldt2; - return r.first * 1000 + r.second / fractionAdjustment(); + return r.first * Q_INT64_C(1000) + r.second / fractionAdjustment(); } qint64 QElapsedTimer::elapsed() const @@ -149,11 +154,16 @@ qint64 QElapsedTimer::elapsed() const return msecsTo(now); } +qint64 QElapsedTimer::msecsSinceReference() const +{ + return t1 * Q_INT64_C(1000) + t2 / fractionAdjustment(); +} + qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { qint64 secs = other.t1 - t1; qint64 fraction = other.t2 - t2; - return secs * 1000 + fraction / fractionAdjustment(); + return secs * Q_INT64_C(1000) + fraction / fractionAdjustment(); } qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index e384dd8..ce37fa2 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -76,6 +76,11 @@ static quint64 getTickCount() return GetTickCount(); } +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return TickCounter; +} + static qint64 difference(qint64 a, qint64 b) { qint64 retval = a - b; @@ -111,6 +116,11 @@ qint64 QElapsedTimer::elapsed() const return difference(getTickCount(), t1); } +qint64 QElapsedTimer::msecsSinceReference() const +{ + return t1; +} + qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { return difference(other.t1, t1); diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp index d671d1b..5f797a3 100644 --- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -10,11 +10,19 @@ class tst_QElapsedTimer : public QObject Q_OBJECT private Q_SLOTS: + void statics(); void validity(); void basics(); void elapsed(); }; +void tst_QElapsedTimer::statics() +{ + qDebug() << "Clock type is" << QElapsedTimer::clockType(); + qDebug() << "Said clock is" << (QElapsedTimer::isMonotonic() ? "monotonic" : "not monotonic"); + qDebug() << "Current time is" << QElapsedTimer::started().msecsSinceReference(); +} + void tst_QElapsedTimer::validity() { QElapsedTimer t; @@ -27,6 +35,12 @@ void tst_QElapsedTimer::validity() t.invalidate(); QVERIFY(!t.isValid()); + + t = QElapsedTimer::started(); + QVERIFY(t.isValid()); + + t = QElapsedTimer::invalid(); + QVERIFY(!t.isValid()); } void tst_QElapsedTimer::basics() @@ -34,14 +48,17 @@ void tst_QElapsedTimer::basics() QElapsedTimer t1; t1.start(); + QVERIFY(t1.msecsSinceReference() != 0); + QCOMPARE(t1, t1); QVERIFY(!(t1 != t1)); QVERIFY(!(t1 < t1)); QCOMPARE(t1.msecsTo(t1), qint64(0)); QCOMPARE(t1.secsTo(t1), qint64(0)); - QCOMPARE(t1 + 0, t1); - QCOMPARE(t1 - 0, t1); +// QCOMPARE(t1 + 0, t1); +// QCOMPARE(t1 - 0, t1); +#if 0 QElapsedTimer t2 = t1; t2 += 1000; // so we can use secsTo @@ -51,10 +68,14 @@ void tst_QElapsedTimer::basics() QVERIFY(!(t2 < t1)); QCOMPARE(t1.msecsTo(t2), qint64(1000)); QCOMPARE(t1.secsTo(t2), qint64(1)); - QCOMPARE(t2 - t1, qint64(1000)); - QCOMPARE(t1 - t2, qint64(-1000)); +// QCOMPARE(t2 - t1, qint64(1000)); +// QCOMPARE(t1 - t2, qint64(-1000)); +#endif + quint64 value1 = t1.msecsSinceReference(); qint64 elapsed = t1.restart(); + quint64 value2 = t1.msecsSinceReference(); + QCOMPARE(elapsed, qint64(value2 - value1)); QVERIFY(elapsed < minResolution); } @@ -72,7 +93,7 @@ void tst_QElapsedTimer::elapsed() QVERIFY(t1 < t2); QVERIFY(t1.msecsTo(t2) > 0); // don't check: t1.secsTo(t2) - QVERIFY(t1 - t2 < 0); +// QVERIFY(t1 - t2 < 0); QVERIFY(t1.elapsed() > 0); QVERIFY(t1.hasExpired(minResolution)); @@ -85,7 +106,7 @@ void tst_QElapsedTimer::elapsed() qint64 elapsed = t1.restart(); QVERIFY(elapsed > 3*minResolution); QVERIFY(elapsed < 5*minResolution); - qint64 diff = t1 - t2; + qint64 diff = t2.msecsTo(t1); QVERIFY(diff < minResolution); } -- cgit v0.12 From 873305b9d85de44fc9e2150697822c8d3ccdef65 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 26 Feb 2010 16:30:43 +0100 Subject: Change the 32-bit rollover on Windows and Symbian to be more efficient. If it rolls over, then the newer value will be lower than the older one. So just add 2^32 to the value and we'll have proper calculations. --- src/corelib/tools/qelapsedtimer_symbian.cpp | 31 +++++++++++++---------------- src/corelib/tools/qelapsedtimer_win.cpp | 30 ++++++++++++---------------- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp index 06e6f99..6360dbf 100644 --- a/src/corelib/tools/qelapsedtimer_symbian.cpp +++ b/src/corelib/tools/qelapsedtimer_symbian.cpp @@ -50,7 +50,15 @@ static quint64 getMillisecondFromTick() static TInt nanokernel_tick_period; if (!nanokernel_tick_period) HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period); - return nanokernel_tick_period * User::NTickCount(); + + static quint32 highdword = 0; + static quint32 lastval = 0; + quint32 val = User::NTickCount(); + if (val < lastval) + ++highdword; + lastval = val; + + return nanokernel_tick_period * (val | (quint64(highdword) << 32)); } QElapsedTimer::ClockType QElapsedTimer::clockType() @@ -58,18 +66,6 @@ QElapsedTimer::ClockType QElapsedTimer::clockType() return TickCounter; } -static qint64 difference(qint64 a, qint64 b) -{ - qint64 retval = a - b; - // there can be 32-bit rollover - // assume there were rollovers if the difference is negative by more than - // 75% of the 32-bit range - - if (retval < Q_INT64_C(-0xc0000000)) - retval += Q_UINT64_C(0x100000000); - return retval; -} - bool QElapsedTimer::isMonotonic() { return true; @@ -85,12 +81,13 @@ qint64 QElapsedTimer::restart() { qint64 oldt1 = t1; t1 = getMillisecondFromTick(); - return difference(t1, oldt1); + t2 = 0; + return t1 - oldt1; } qint64 QElapsedTimer::elapsed() const { - return difference(getMillisecondFromTick(), t1); + return getMillisecondFromTick() - t1; } qint64 QElapsedTimer::msecsSinceReference() const @@ -100,7 +97,7 @@ qint64 QElapsedTimer::msecsSinceReference() const qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { - return difference(other.t1, t1); + return other.t1 - t1; } qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const @@ -110,7 +107,7 @@ qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { - return difference(v1.t1, v2.t1) < 0; + return (v1.t1 - v2.t1) < 0; } QT_END_NAMESPACE diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index ce37fa2..135196a 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -73,7 +73,14 @@ static quint64 getTickCount() resolveLibs(); if (ptrGetTickCount64) return ptrGetTickCount64(); - return GetTickCount(); + + static quint32 highdword = 0; + static quint32 lastval = 0; + quint32 val = GetTickCount(); + if (val < lastval) + ++highdword; + lastval = val; + return val | (quint64(highdword) << 32); } QElapsedTimer::ClockType QElapsedTimer::clockType() @@ -81,18 +88,6 @@ QElapsedTimer::ClockType QElapsedTimer::clockType() return TickCounter; } -static qint64 difference(qint64 a, qint64 b) -{ - qint64 retval = a - b; - // if we're not using GetTickCount64, then there can be 32-bit rollover - // assume there were rollovers if the difference is negative by more than - // 75% of the 32-bit range - - if (!ptrGetTickCount64 && retval < Q_INT64_C(-0xc0000000)) - retval += Q_UINT64_C(0x100000000); - return retval; -} - bool QElapsedTimer::isMonotonic() { return true; @@ -108,12 +103,13 @@ qint64 QElapsedTimer::restart() { qint64 oldt1 = t1; t1 = getTickCount(); - return difference(t1, oldt1); + t2 = 0; + return t1 - oldt1; } qint64 QElapsedTimer::elapsed() const { - return difference(getTickCount(), t1); + return getTickCount() - t1; } qint64 QElapsedTimer::msecsSinceReference() const @@ -123,7 +119,7 @@ qint64 QElapsedTimer::msecsSinceReference() const qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { - return difference(other.t1, t1); + return other.t1 - t1; } qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const @@ -133,7 +129,7 @@ qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { - return difference(v1.t1, v2.t1) < 0; + return (v1.t1 - v2.t1) < 0; } QT_END_NAMESPACE -- cgit v0.12 From 06ffa232f1920fa5aa857e644df08ef52b62a0b3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 1 Mar 2010 16:51:09 +0100 Subject: remove, fixup --- src/corelib/tools/qelapsedtimer.h | 5 ----- tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 10 +++------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer.h b/src/corelib/tools/qelapsedtimer.h index 827359b..0d6f0be 100644 --- a/src/corelib/tools/qelapsedtimer.h +++ b/src/corelib/tools/qelapsedtimer.h @@ -62,11 +62,6 @@ public: static ClockType clockType(); static bool isMonotonic(); - static inline QElapsedTimer started() - { QElapsedTimer t; t.start(); return t; } - static inline QElapsedTimer invalid() - { QElapsedTimer t; t.invalidate(); return t; } - void start(); qint64 restart(); void invalidate(); diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp index 5f797a3..5c3d4f8 100644 --- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -20,7 +20,9 @@ void tst_QElapsedTimer::statics() { qDebug() << "Clock type is" << QElapsedTimer::clockType(); qDebug() << "Said clock is" << (QElapsedTimer::isMonotonic() ? "monotonic" : "not monotonic"); - qDebug() << "Current time is" << QElapsedTimer::started().msecsSinceReference(); + QElapsedTimer t; + t.start(); + qDebug() << "Current time is" << t.msecsSinceReference(); } void tst_QElapsedTimer::validity() @@ -35,12 +37,6 @@ void tst_QElapsedTimer::validity() t.invalidate(); QVERIFY(!t.isValid()); - - t = QElapsedTimer::started(); - QVERIFY(t.isValid()); - - t = QElapsedTimer::invalid(); - QVERIFY(!t.isValid()); } void tst_QElapsedTimer::basics() -- cgit v0.12 From 73d10fd0813b19ad71e76419d78bf6e2dfd312d7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 1 Mar 2010 16:52:36 +0100 Subject: Add QDateTime::currentDateTimeUtc and QDateTime::currentMsecsSinceEpoch --- src/corelib/tools/qdatetime.cpp | 353 +++++++++++++++++++--------- src/corelib/tools/qdatetime.h | 3 +- src/corelib/tools/qelapsedtimer_generic.cpp | 10 +- src/corelib/tools/tools.pri | 3 +- tests/auto/qdatetime/tst_qdatetime.cpp | 75 ++++++ 5 files changed, 328 insertions(+), 116 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c1027ed..7e03777 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -98,18 +98,23 @@ static inline QDate fixedDate(int y, int m, int d) return result; } +static inline uint julianDayFromGregorianDate(int year, int month, int day) +{ + // Gregorian calendar starting from October 15, 1582 + // Algorithm from Henry F. Fliegel and Thomas C. Van Flandern + return (1461 * (year + 4800 + (month - 14) / 12)) / 4 + + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12 + - (3 * ((year + 4900 + (month - 14) / 12) / 100)) / 4 + + day - 32075; +} + static uint julianDayFromDate(int year, int month, int day) { if (year < 0) ++year; if (year > 1582 || (year == 1582 && (month > 10 || (month == 10 && day >= 15)))) { - // Gregorian calendar starting from October 15, 1582 - // Algorithm from Henry F. Fliegel and Thomas C. Van Flandern - return (1461 * (year + 4800 + (month - 14) / 12)) / 4 - + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12 - - (3 * ((year + 4900 + (month - 14) / 12) / 100)) / 4 - + day - 32075; + return julianDayFromGregorianDate(year, month, day); } else if (year < 1582 || (year == 1582 && (month < 10 || (month == 10 && day <= 4)))) { // Julian calendar until October 4, 1582 // Algorithm from Frequently Asked Questions about Calendars by Claus Toendering @@ -1118,46 +1123,12 @@ int QDate::daysTo(const QDate &d) const */ /*! - \overload + \fn QDate::currentDate() Returns the current date, as reported by the system clock. \sa QTime::currentTime(), QDateTime::currentDateTime() */ -QDate QDate::currentDate() -{ - QDate d; -#if defined(Q_OS_WIN) - SYSTEMTIME st; - memset(&st, 0, sizeof(SYSTEMTIME)); - GetLocalTime(&st); - d.jd = julianDayFromDate(st.wYear, st.wMonth, st.wDay); -#elif defined(Q_OS_SYMBIAN) - TTime localTime; - localTime.HomeTime(); - TDateTime localDateTime = localTime.DateTime(); - // months and days are zero indexed - d.jd = julianDayFromDate(localDateTime.Year(), localDateTime.Month() + 1, localDateTime.Day() + 1 ); -#else - // posix compliant system - time_t ltime; - time(<ime); - tm *t = 0; - -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) - // use the reentrant version of localtime() where available - tzset(); - tm res; - t = localtime_r(<ime, &res); -#else - t = localtime(<ime); -#endif // !QT_NO_THREAD && _POSIX_THREAD_SAFE_FUNCTIONS - - d.jd = julianDayFromDate(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); -#endif - return d; -} - #ifndef QT_NO_DATESTRING /*! \fn QDate QDate::fromString(const QString &string, Qt::DateFormat format) @@ -1812,7 +1783,7 @@ int QTime::msecsTo(const QTime &t) const */ /*! - \overload + \fn QTime::currentTime() Returns the current time as reported by the system clock. @@ -1820,53 +1791,6 @@ int QTime::msecsTo(const QTime &t) const operating system; not all systems provide 1-millisecond accuracy. */ -QTime QTime::currentTime() -{ - QTime ct; - -#if defined(Q_OS_WIN) - SYSTEMTIME st; - memset(&st, 0, sizeof(SYSTEMTIME)); - GetLocalTime(&st); - ct.mds = MSECS_PER_HOUR * st.wHour + MSECS_PER_MIN * st.wMinute + 1000 * st.wSecond - + st.wMilliseconds; -#if defined(Q_OS_WINCE) - ct.startTick = GetTickCount() % MSECS_PER_DAY; -#endif -#elif defined(Q_OS_SYMBIAN) - TTime localTime; - localTime.HomeTime(); - TDateTime localDateTime = localTime.DateTime(); - ct.mds = MSECS_PER_HOUR * localDateTime.Hour() + MSECS_PER_MIN * localDateTime.Minute() - + 1000 * localDateTime.Second() + (localDateTime.MicroSecond() / 1000); -#elif defined(Q_OS_UNIX) - // posix compliant system - struct timeval tv; - gettimeofday(&tv, 0); - time_t ltime = tv.tv_sec; - tm *t = 0; - -#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) - // use the reentrant version of localtime() where available - tzset(); - tm res; - t = localtime_r(<ime, &res); -#else - t = localtime(<ime); -#endif - Q_CHECK_PTR(t); - - ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec - + tv.tv_usec / 1000; -#else - time_t ltime; // no millisecond resolution - ::time(<ime); - const tm *const t = localtime(<ime); - ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec; -#endif - return ct; -} - #ifndef QT_NO_DATESTRING /*! \fn QTime QTime::fromString(const QString &string, Qt::DateFormat format) @@ -2872,63 +2796,280 @@ bool QDateTime::operator<(const QDateTime &other) const */ /*! + \fn QDateTime QDateTime::currentDateTime() Returns the current datetime, as reported by the system clock, in the local time zone. - \sa QDate::currentDate(), QTime::currentTime(), toTimeSpec() + \sa currentDateTimeUtc(), QDate::currentDate(), QTime::currentTime(), toTimeSpec() */ -QDateTime QDateTime::currentDateTime() +/*! + \fn QDateTime QDateTime::currentDateTimeUtc() + \since 4.7 + Returns the current datetime, as reported by the system clock, in + UTC. + + \sa currentDateTime(), QDate::currentDate(), QTime::currentTime(), toTimeSpec() +*/ + +/*! + \fn qint64 QDateTime::currentMsecsSinceEpoch() + \since 4.7 + + Returns the number of milliseconds since 1970-01-01T00:00:00 Universal + Coordinated Time. This number is like the POSIX time_t variable, but + expressed in milliseconds instead. + + \sa currentDateTime(), currentDateTimeUtc(), toTime_t(), toTimeSpec() +*/ + +static inline uint msecsFromDecomposed(int hour, int minute, int sec, int msec = 0) { + return MSECS_PER_HOUR * hour + MSECS_PER_MIN * minute + 1000 * sec + msec; +} + #if defined(Q_OS_WIN) +QDate QDate::currentDate() +{ + QDate d; + SYSTEMTIME st; + memset(&st, 0, sizeof(SYSTEMTIME)); + GetLocalTime(&st); + d.jd = julianDayFromDate(st.wYear, st.wMonth, st.wDay); + return d; +} + +QTime QTime::currentTime() +{ + QTime ct; + SYSTEMTIME st; + memset(&st, 0, sizeof(SYSTEMTIME)); + GetLocalTime(&st); + ct.mds = msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); +#if defined(Q_OS_WINCE) + ct.startTick = GetTickCount() % MSECS_PER_DAY; +#endif + return ct; +} + +QDateTime QDateTime::currentDateTime() +{ QDate d; QTime t; SYSTEMTIME st; memset(&st, 0, sizeof(SYSTEMTIME)); GetLocalTime(&st); d.jd = julianDayFromDate(st.wYear, st.wMonth, st.wDay); - t.mds = MSECS_PER_HOUR * st.wHour + MSECS_PER_MIN * st.wMinute + 1000 * st.wSecond - + st.wMilliseconds; + t.mds = msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); return QDateTime(d, t); +} + +QDateTime QDateTime::currentDateTimeUtc() +{ + QDate d; + QTime t; + SYSTEMTIME st; + memset(&st, 0, sizeof(SYSTEMTIME)); + GetSystemTime(&st); + d.jd = julianDayFromDate(st.wYear, st.wMonth, st.wDay); + t.mds = msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); + return QDateTime(d, t, Qt::UTC); +} + +qint64 QDateTime::currentMsecsSinceEpoch() +{ + QDate d; + QTime t; + SYSTEMTIME st; + memset(&st, 0, sizeof(SYSTEMTIME)); + GetSystemTime(&st); + + return msecsFromDecomposed(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds) + + qint64(julianDayFromGregorianDate(st.wYear, st.wMonth, st.wDay) + - julianDayFromGregorianDate(1970, 1, 1)) * Q_INT64_C(86400000); +} + #elif defined(Q_OS_SYMBIAN) - return QDateTime(QDate::currentDate(), QTime::currentTime()); +QDate QDate::currentDate() +{ + QDate d; + TTime localTime; + localTime.HomeTime(); + TDateTime localDateTime = localTime.DateTime(); + // months and days are zero indexed + d.jd = julianDayFromDate(localDateTime.Year(), localDateTime.Month() + 1, localDateTime.Day() + 1 ); + return d; +} + +QTime QTime::currentTime() +{ + QTime ct; + TTime localTime; + localTime.HomeTime(); + TDateTime localDateTime = localTime.DateTime(); + ct.mds = msecsFromDecomposed(localDateTime.Hour(), localDateTime.Minute(), + localDateTime.Second(), localDateTime.MicroSecond() / 1000); + return ct; +} + +QDateTime QDateTime::currentDateTime() +{ + QDate d; + QTime ct; + TTime localTime; + localTime.HomeTime(); + TDateTime localDateTime = localTime.DateTime(); + // months and days are zero indexed + d.jd = julianDayFromDate(localDateTime.Year(), localDateTime.Month() + 1, localDateTime.Day() + 1); + ct.mds = msecsFromDecomposed(localDateTime.Hour(), localDateTime.Minute(), + localDateTime.Second(), localDateTime.MicroSecond() / 1000); + return QDateTime(d, ct); +} + +QDateTime QDateTime::currentDateTimeUtc() +{ + QDate d; + QTime ct; + TTime gmTime; + gmTime.UniversalTime(); + TDateTime gmtDateTime = gmTime.DateTime(); + // months and days are zero indexed + d.jd = julianDayFromDate(gmtDateTime.Year(), gmtDateTime.Month() + 1, gmtDateTime.Day() + 1); + ct.mds = msecsFromDecomposed(gmtDateTime.Hour(), gmtDateTime.Minute(), + gmtDateTime.Second(), gmtDateTime.MicroSecond() / 1000); + return QDateTime(d, ct, Qt::UTC); +} + +qint64 QDateTime::currentMsecsSinceEpoch() +{ + QDate d; + QTime ct; + TTime gmTime; + gmTime.UniversalTime(); + TDateTime gmtDateTime = gmTime.DateTime(); + + // according to the documentation, the value is: + // "a date and time as a number of microseconds since midnight, January 1st, 0 AD nominal Gregorian" + qint64 value = gmTime.Int64(); + + // whereas 1970-01-01T00:00:00 is (in the same representation): + static const qint64 unixEpoch = qint64(1970 * 365 + 1970 / 4 - 1970 / 100 + 1970 / 400) * Q_INT64_C(86400) + * Q_INT64_C(1000000); + + return (value - unixEpoch) / 1000; +} + +#elif defined(Q_OS_UNIX) +QDate QDate::currentDate() +{ + QDate d; + // posix compliant system + time_t ltime; + time(<ime); + struct tm *t = 0; + +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) + // use the reentrant version of localtime() where available + tzset(); + struct tm res; + t = localtime_r(<ime, &res); #else -#if defined(Q_OS_UNIX) + t = localtime(<ime); +#endif // !QT_NO_THREAD && _POSIX_THREAD_SAFE_FUNCTIONS + + d.jd = julianDayFromDate(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); + return d; +} + +QTime QTime::currentTime() +{ + QTime ct; + // posix compliant system + struct timeval tv; + gettimeofday(&tv, 0); + time_t ltime = tv.tv_sec; + struct tm *t = 0; + +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) + // use the reentrant version of localtime() where available + tzset(); + struct tm res; + t = localtime_r(<ime, &res); +#else + t = localtime(<ime); +#endif + Q_CHECK_PTR(t); + + ct.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000); + return ct; +} + +QDateTime QDateTime::currentDateTime() +{ // posix compliant system // we have milliseconds struct timeval tv; gettimeofday(&tv, 0); time_t ltime = tv.tv_sec; - tm *t = 0; + struct tm *t = 0; #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of localtime() where available tzset(); - tm res; + struct tm res; t = localtime_r(<ime, &res); #else t = localtime(<ime); #endif QDateTime dt; - dt.d->time.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec - + tv.tv_usec / 1000; -#else - time_t ltime; // no millisecond resolution - ::time(<ime); - tm *t = 0; - localtime(<ime); - dt.d->time.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec; -#endif // Q_OS_UNIX + dt.d->time.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000); dt.d->date.jd = julianDayFromDate(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); dt.d->spec = t->tm_isdst > 0 ? QDateTimePrivate::LocalDST : t->tm_isdst == 0 ? QDateTimePrivate::LocalStandard : QDateTimePrivate::LocalUnknown; return dt; +} + +QDateTime QDateTime::currentDateTimeUtc() +{ + // posix compliant system + // we have milliseconds + struct timeval tv; + gettimeofday(&tv, 0); + time_t ltime = tv.tv_sec; + struct tm *t = 0; + +#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) + // use the reentrant version of localtime() where available + struct tm res; + t = gmtime_r(<ime, &res); +#else + t = gmtime(<ime); #endif + + QDateTime dt; + dt.d->time.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000); + + dt.d->date.jd = julianDayFromDate(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); + dt.d->spec = QDateTimePrivate::UTC; + return dt; } +qint64 QDateTime::currentMsecsSinceEpoch() +{ + // posix compliant system + // we have milliseconds + struct timeval tv; + gettimeofday(&tv, 0); + return qint64(tv.tv_sec) * Q_INT64_C(1000) + tv.tv_usec / 1000; +} + +#else +#error "What system is this?" +#endif + /*! \since 4.2 diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index cb7f5bd..ef5968e 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -204,7 +204,6 @@ private: friend class QDateTime; friend class QDateTimePrivate; - friend class QElapsedTimer; #ifndef QT_NO_DATASTREAM friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QTime &); friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QTime &); @@ -262,11 +261,13 @@ public: int utcOffset() const; static QDateTime currentDateTime(); + static QDateTime currentDateTimeUtc(); #ifndef QT_NO_DATESTRING static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); static QDateTime fromString(const QString &s, const QString &format); #endif static QDateTime fromTime_t(uint secsSince1Jan1970UTC); + static qint64 currentMsecsSinceEpoch(); #ifdef QT3_SUPPORT inline QT3_SUPPORT void setTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec) { diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index db6da46..3feecd6 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -44,12 +44,6 @@ QT_BEGIN_NAMESPACE -static qint64 currentDateTimeMsec() -{ - QDateTime t = QDateTime::currentDateTime(); - return t.toTime_t() * Q_INT64_C(1000) + t.time().msec(); -} - QElapsedTimer::ClockType QElapsedTimer::clockType() { return SystemTime; @@ -68,14 +62,14 @@ void QElapsedTimer::start() qint64 QElapsedTimer::restart() { qint64 old = t1; - t1 = currentDateTimeMsec(); + t1 = QDateTime::currentMsecsSinceEpoch(); t2 = 0; return t1 - old; } qint64 QElapsedTimer::elapsed() const { - return currentDateTimeMsec() - t1; + return QDateTime::currentMsecsSinceEpoch() - t1; } qint64 QElapsedTimer::msecsSinceReference() const diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 692fae9..73dae7a 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -57,6 +57,7 @@ SOURCES += \ tools/qcryptographichash.cpp \ tools/qdatetime.cpp \ tools/qeasingcurve.cpp \ + tools/qelapsedtimer.cpp \ tools/qhash.cpp \ tools/qline.cpp \ tools/qlinkedlist.cpp \ @@ -77,13 +78,13 @@ SOURCES += \ tools/qstringlist.cpp \ tools/qtextboundaryfinder.cpp \ tools/qtimeline.cpp \ - tools/qelapsedtimer.cpp \ tools/qvector.cpp \ tools/qvsnprintf.cpp symbian:SOURCES+=tools/qlocale_symbian.cpp mac:SOURCES += tools/qelapsedtimer_mac.cpp +else:symbian:SOURCES += tools/qelapsedtimer_generic.cpp else:unix:SOURCES += tools/qelapsedtimer_unix.cpp else:win32:SOURCES += tools/qelapsedtimer_win.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 86a4c80..a6b9a5f 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -106,6 +106,8 @@ private slots: void secsTo(); void operator_eqeq(); void currentDateTime(); + void currentDateTimeUtc(); + void currentDateTimeUtc2(); void fromStringTextDate_data(); void fromStringTextDate(); @@ -880,6 +882,79 @@ void tst_QDateTime::currentDateTime() QVERIFY(dt3.timeSpec() == Qt::UTC); } +void tst_QDateTime::currentDateTimeUtc() +{ +#if defined(Q_OS_WINCE) + __time64_t buf1, buf2; + ::_time64(&buf1); +#else + time_t buf1, buf2; + ::time(&buf1); +#endif + QDateTime lowerBound; + lowerBound.setTime_t(buf1); + + QDateTime dt1 = QDateTime::currentDateTimeUtc(); + QDateTime dt2 = QDateTime::currentDateTimeUtc().toLocalTime(); + QDateTime dt3 = QDateTime::currentDateTimeUtc().toUTC(); + +#if defined(Q_OS_WINCE) + ::_time64(&buf2); +#else + ::time(&buf2); +#endif + QDateTime upperBound; + upperBound.setTime_t(buf2); + upperBound = upperBound.addSecs(1); + + QVERIFY(lowerBound < upperBound); + + QVERIFY(lowerBound <= dt1); + QVERIFY(dt1 < upperBound); + QVERIFY(lowerBound <= dt2); + QVERIFY(dt2 < upperBound); + QVERIFY(lowerBound <= dt3); + QVERIFY(dt3 < upperBound); + + QVERIFY(dt1.timeSpec() == Qt::UTC); + QVERIFY(dt2.timeSpec() == Qt::LocalTime); + QVERIFY(dt3.timeSpec() == Qt::UTC); +} + +void tst_QDateTime::currentDateTimeUtc2() +{ + QDateTime local, utc; + qint64 msec; + + // check that we got all down to the same milliseconds + int i = 2; + bool ok = false; + do { + local = QDateTime::currentDateTime(); + utc = QDateTime::currentDateTimeUtc(); + msec = QDateTime::currentMsecsSinceEpoch(); + ok = local.time().msec() == utc.time().msec() + && utc.time().msec() == (msec % 1000); + } while (--i && !ok); + + if (!i) + QSKIP("Failed to get the dates within 1 ms of each other", SkipAll); + + // seconds and milliseconds should be the same: + QCOMPARE(utc.time().second(), local.time().second()); + QCOMPARE(utc.time().msec(), local.time().msec()); + QCOMPARE(msec % 1000, qint64(local.time().msec())); + QCOMPARE(msec / 1000 % 60, qint64(local.time().second())); + + // the two dates should be equal, actually + QCOMPARE(local.toUTC(), utc); + QCOMPARE(utc.toLocalTime(), local); + + // and finally, the time_t should equal our number + QCOMPARE(qint64(utc.toTime_t()), msec / 1000); + QCOMPARE(qint64(local.toTime_t()), msec / 1000); +} + void tst_QDateTime::toTime_t_data() { QTest::addColumn("dateTimeStr"); -- cgit v0.12 From e62a99d588eaf2b7443250f36c42762a0631c02a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 5 Mar 2010 19:03:51 +0100 Subject: Bugfix the Symbian implementation --- mkspecs/common/symbian/symbian.conf | 4 ++-- src/corelib/tools/qdatetime.cpp | 4 ++-- src/corelib/tools/qelapsedtimer_symbian.cpp | 20 +++++++++++++++++++- src/corelib/tools/tools.pri | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 16b9a28..239b998 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -74,8 +74,8 @@ QMAKE_LINK_OBJECT_MAX = QMAKE_LINK_OBJECT_SCRIPT= QMAKE_LIBS = -llibc -llibm -leuser -llibdl -QMAKE_LIBS_CORE = $$QMAKE_LIBS -llibpthread -lefsrv -QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lhal -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lcentralrepository +QMAKE_LIBS_CORE = $$QMAKE_LIBS -llibpthread -lefsrv -lhal +QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lcentralrepository QMAKE_LIBS_NETWORK = QMAKE_LIBS_EGL = -llibEGL QMAKE_LIBS_OPENGL = diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 7e03777..54a4205 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2953,8 +2953,8 @@ qint64 QDateTime::currentMsecsSinceEpoch() qint64 value = gmTime.Int64(); // whereas 1970-01-01T00:00:00 is (in the same representation): - static const qint64 unixEpoch = qint64(1970 * 365 + 1970 / 4 - 1970 / 100 + 1970 / 400) * Q_INT64_C(86400) - * Q_INT64_C(1000000); + // ((1970 * 365) + (1970 / 4) - (1970 / 100) + (1970 / 400) - 13) * 86400 * 1000000 + static const qint64 unixEpoch = Q_INT64_C(0xdcddb30f2f8000); return (value - unixEpoch) / 1000; } diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp index 6360dbf..038b102 100644 --- a/src/corelib/tools/qelapsedtimer_symbian.cpp +++ b/src/corelib/tools/qelapsedtimer_symbian.cpp @@ -40,12 +40,15 @@ ****************************************************************************/ #include "qelapsedtimer.h" +#include "qpair.h" #include +#include +#include QT_BEGIN_NAMESPACE // return quint64 to avoid sign-extension -static quint64 getMillisecondFromTick() +static quint64 getMicrosecondFromTick() { static TInt nanokernel_tick_period; if (!nanokernel_tick_period) @@ -61,6 +64,21 @@ static quint64 getMillisecondFromTick() return nanokernel_tick_period * (val | (quint64(highdword) << 32)); } +static quint64 getMillisecondFromTick() +{ + return getMicrosecondFromTick() / 1000; +} + +timeval qt_gettime() +{ + timeval tv; + quint64 now = getMicrosecondFromTick(); + tv.tv_sec = now / 1000000; + tv.tv_usec = now % 1000000; + + return tv; +} + QElapsedTimer::ClockType QElapsedTimer::clockType() { return TickCounter; diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 73dae7a..4e0ebbc 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -84,7 +84,7 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp mac:SOURCES += tools/qelapsedtimer_mac.cpp -else:symbian:SOURCES += tools/qelapsedtimer_generic.cpp +else:symbian:SOURCES += tools/qelapsedtimer_symbian.cpp else:unix:SOURCES += tools/qelapsedtimer_unix.cpp else:win32:SOURCES += tools/qelapsedtimer_win.cpp else:SOURCES += tools/qelapsedtimer_generic.cpp -- cgit v0.12 From c8b999d9d1eaf3379233169ccd4e9ea8c86a1702 Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Wed, 17 Mar 2010 12:03:50 +0100 Subject: "Strictly" Fullscreen Application in Mac OS Full screen in OSX is achieved by using the Kiosk Mode. Therefore it is not a real full screen but an emulation since we basically disable the dock and the menubar. Previous to this patch we were autoshowing the menubar all the time even when we didn't have a menubar. The problem with that is the fact that in OSX there is always a system menubar, so the menubar appeared the moment somebody hovered over the menubar region. With this patch we check if we have created a menubar and if so we autoshow the menubar, otherwise the menubar will remain hidden in full screen mode. Task-number: QTBUG-8933 Reviewed-by: Richard Moe Gustavsen --- src/gui/widgets/qmenu_mac.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 43722a1..627043d 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -2060,6 +2060,22 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly() QWidget *w = findWindowThatShouldDisplayMenubar(); QMenuBar *mb = findMenubarForWindow(w); + // We need to see if we are in full screen mode, if so we need to + // switch the full screen mode to be able to show or hide the menubar. + if(w && mb) { + // This case means we are creating a menubar, check if full screen + if(w->isFullScreen()) { + // Ok, switch to showing the menubar when hovering over it. + SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); + } + } else if(w) { + // Removing a menubar + if(w->isFullScreen()) { + // Ok, switch to not showing the menubar when hovering on it + SetSystemUIMode(kUIModeAllHidden, 0); + } + } + if (mb && mb->isNativeMenuBar()) { bool modal = QApplicationPrivate::modalState(); #ifdef QT_MAC_USE_COCOA -- cgit v0.12 From f8d5f2594a9b268b9eeecf95b24b23fc940c71ce Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Wed, 17 Mar 2010 12:09:03 +0100 Subject: Cocoa: minisplitter has only 1px wide grab area The problem was that in Cocoa we were ignoring the WA_MouseNoMask attribute, therefore the mask was being applied to the mouse movements. This in turn caused the cursor not to change accordingly. Task-number: QTCREATORBUG-361 Reviewed-by: Prasanth --- src/gui/kernel/qcocoaview_mac.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 4f71681..a627616 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -241,7 +241,8 @@ static int qCocoaViewCount = 0; QRegion mask = qt_widget_private(cursorWidget)->extra->mask; NSCursor *nscursor = static_cast(qt_mac_nsCursorForQCursor(cursorWidget->cursor())); - if (mask.isEmpty()) { + // The mask could have the WA_MouseNoMask attribute set and that means that we have to ignore the mask. + if (mask.isEmpty() || cursorWidget->testAttribute(Qt::WA_MouseNoMask)) { [self addCursorRect:[qt_mac_nativeview_for(cursorWidget) visibleRect] cursor:nscursor]; } else { const QVector &rects = mask.rects(); @@ -490,7 +491,9 @@ static int qCocoaViewCount = 0; CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; qwidgetprivate->hd = cg; CGContextSaveGState(cg); - + CGFloat components[] = {1,0,0,1}; + CGContextSetFillColor(cg, components); + CGContextFillRect(cg, aRect); if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event. if (qwidget->testAttribute(Qt::WA_WState_InPaintEvent)) qWarning("QWidget::repaint: Recursive repaint detected"); -- cgit v0.12 From 7e9052cc1f16b3eeabb73ada9492d91620df796d Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Wed, 17 Mar 2010 12:15:59 +0100 Subject: Manual test for QTBUG-8933. See the readme file. Reviewed-by: TrustMe --- tests/manual/qtbug-8933/README | 7 ++++ tests/manual/qtbug-8933/main.cpp | 10 ++++++ tests/manual/qtbug-8933/qtbug-8933.pro | 16 ++++++++++ tests/manual/qtbug-8933/widget.cpp | 58 ++++++++++++++++++++++++++++++++++ tests/manual/qtbug-8933/widget.h | 32 +++++++++++++++++++ tests/manual/qtbug-8933/widget.ui | 33 +++++++++++++++++++ 6 files changed, 156 insertions(+) create mode 100644 tests/manual/qtbug-8933/README create mode 100644 tests/manual/qtbug-8933/main.cpp create mode 100644 tests/manual/qtbug-8933/qtbug-8933.pro create mode 100644 tests/manual/qtbug-8933/widget.cpp create mode 100644 tests/manual/qtbug-8933/widget.h create mode 100644 tests/manual/qtbug-8933/widget.ui diff --git a/tests/manual/qtbug-8933/README b/tests/manual/qtbug-8933/README new file mode 100644 index 0000000..b3ce407 --- /dev/null +++ b/tests/manual/qtbug-8933/README @@ -0,0 +1,7 @@ +The purpose of this test is to check if the full screen mode in OSX is working properly or not. +This test creates a widget and 5 seconds later enters full screen mode. If you hover over the area +where the menubar should be you will get no menubar. After 5 more seconds (i.e. 10 seconds since +start) a menubar is created. At that point, if you hover over the menubar area you will get the +menubar. 5 seconds later the menubar is destroyed and if you hover over there will be no menubar. +After 5 more seconds the widget goes back to normal mode and the test is finished. + diff --git a/tests/manual/qtbug-8933/main.cpp b/tests/manual/qtbug-8933/main.cpp new file mode 100644 index 0000000..841b7c3 --- /dev/null +++ b/tests/manual/qtbug-8933/main.cpp @@ -0,0 +1,10 @@ +#include +#include "widget.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Widget w; + w.show(); + return a.exec(); +} diff --git a/tests/manual/qtbug-8933/qtbug-8933.pro b/tests/manual/qtbug-8933/qtbug-8933.pro new file mode 100644 index 0000000..8b87c83 --- /dev/null +++ b/tests/manual/qtbug-8933/qtbug-8933.pro @@ -0,0 +1,16 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-03-16T14:40:16 +# +#------------------------------------------------- + +TARGET = qtbug-8933 +TEMPLATE = app + + +SOURCES += main.cpp\ + widget.cpp + +HEADERS += widget.h + +FORMS += widget.ui diff --git a/tests/manual/qtbug-8933/widget.cpp b/tests/manual/qtbug-8933/widget.cpp new file mode 100644 index 0000000..47a440b --- /dev/null +++ b/tests/manual/qtbug-8933/widget.cpp @@ -0,0 +1,58 @@ +#include "widget.h" +#include "ui_widget.h" + +#include +#include + +Widget::Widget(QWidget *parent) : + QWidget(parent), + ui(new Ui::Widget) +{ + ui->setupUi(this); + QTimer::singleShot(5000, this, SLOT(switchToFullScreen())); + QTimer::singleShot(10000, this, SLOT(addMenuBar())); + QTimer::singleShot(15000, this, SLOT(removeMenuBar())); + QTimer::singleShot(20000, this, SLOT(switchToNormalScreen())); +} + +Widget::~Widget() +{ + delete ui; +} + +void Widget::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void Widget::switchToFullScreen() +{ + ui->label->setText("entering full screen"); + showFullScreen(); +} + +void Widget::switchToNormalScreen() +{ + ui->label->setText("leaving full screen"); + showNormal(); +} + +void Widget::addMenuBar() +{ + ui->label->setText("adding menu bar"); + menuBar = new QMenuBar(this); + menuBar->setVisible(true); +} + +void Widget::removeMenuBar() +{ + ui->label->setText("removing menu bar"); + delete menuBar; +} diff --git a/tests/manual/qtbug-8933/widget.h b/tests/manual/qtbug-8933/widget.h new file mode 100644 index 0000000..f6afa8f --- /dev/null +++ b/tests/manual/qtbug-8933/widget.h @@ -0,0 +1,32 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include +#include +#include + +namespace Ui { + class Widget; +} + +class Widget : public QWidget { + Q_OBJECT +public: + Widget(QWidget *parent = 0); + ~Widget(); + +public slots: + void switchToFullScreen(); + void switchToNormalScreen(); + void addMenuBar(); + void removeMenuBar(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::Widget *ui; + QMenuBar *menuBar; +}; + +#endif // WIDGET_H diff --git a/tests/manual/qtbug-8933/widget.ui b/tests/manual/qtbug-8933/widget.ui new file mode 100644 index 0000000..e0ded3f --- /dev/null +++ b/tests/manual/qtbug-8933/widget.ui @@ -0,0 +1,33 @@ + + + Widget + + + + 0 + 0 + 600 + 400 + + + + Widget + + + + + 110 + 60 + 311 + 16 + + + + TextLabel + + + + + + + -- cgit v0.12 From d28a81d51734afd1f3a052f4c4e9fc90aef393e8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 17 Mar 2010 12:44:01 +0100 Subject: qdoc3: Fixed some ifdef typos and removed some whitespace. --- tools/qdoc3/generator.cpp | 8 ++++---- tools/qdoc3/node.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 0c6497b..62f191b 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1194,14 +1194,14 @@ void Generator::appendSortedQmlNames(Text& text, QMap classMap; int index = 0; -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "Generator::appendSortedQmlNames():" << base->name() << "is inherited by..."; -#endif +#endif for (int i = 0; i < subs.size(); ++i) { Text t; -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << " " << subs[i]->name(); -#endif +#endif appendFullName(t, subs[i], base, marker); classMap[t.toString().toLower()] = t; } diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index d60ff73..bd37443 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1297,9 +1297,9 @@ QmlClassNode::QmlClassNode(InnerNode *parent, */ QmlClassNode::~QmlClassNode() { -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "Deleting QmlClassNode:" << name(); -#endif +#endif } /*! @@ -1334,9 +1334,9 @@ QString QmlClassNode::fileBase() const void QmlClassNode::addInheritedBy(const QString& base, Node* sub) { inheritedBy.insert(base,sub); -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE-QDOCCONF_FILES qDebug() << "QmlClassNode::addInheritedBy(): insert" << base << sub->name() << inheritedBy.size(); -#endif +#endif } /*! @@ -1347,10 +1347,10 @@ void QmlClassNode::subclasses(const QString& base, NodeList& subs) subs.clear(); if (inheritedBy.count(base) > 0) { subs = inheritedBy.values(base); -#ifdef DEBUG_MULTIPLE QDOCCONF_FILES +#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES qDebug() << "QmlClassNode::subclasses():" << inheritedBy.count(base) << base << "subs:" << subs.size() << "total size:" << inheritedBy.size(); -#endif +#endif } } -- cgit v0.12 From 99f3df7982fc6f5c3016c828e01cea3fe5a596b7 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 17 Mar 2010 13:14:28 +0100 Subject: Added missing "const" for mac. --- src/corelib/tools/qelapsedtimer_mac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qelapsedtimer_mac.cpp b/src/corelib/tools/qelapsedtimer_mac.cpp index 4a62761..8fceb49 100644 --- a/src/corelib/tools/qelapsedtimer_mac.cpp +++ b/src/corelib/tools/qelapsedtimer_mac.cpp @@ -103,7 +103,7 @@ qint64 QElapsedTimer::elapsed() const return absoluteToMSecs(cpu_time - t1); } -qint64 QElapsedTimer::msecsSinceReference() +qint64 QElapsedTimer::msecsSinceReference() const { return absoluteToMSecs(t1); } -- cgit v0.12 From 0ca8f2b116a01323b40c139a014f955e30b2acd3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Mar 2010 13:34:43 +0100 Subject: Doc: document QElapsedTimer Task-Number: QT-2965 --- doc/src/snippets/qelapsedtimer/main.cpp | 112 ++++++++++++++ doc/src/snippets/qelapsedtimer/qelapsedtimer.pro | 2 + src/corelib/tools/qelapsedtimer.cpp | 186 +++++++++++++++++++++++ src/corelib/tools/qelapsedtimer_generic.cpp | 82 ++++++++++ 4 files changed, 382 insertions(+) create mode 100644 doc/src/snippets/qelapsedtimer/main.cpp create mode 100644 doc/src/snippets/qelapsedtimer/qelapsedtimer.pro diff --git a/doc/src/snippets/qelapsedtimer/main.cpp b/doc/src/snippets/qelapsedtimer/main.cpp new file mode 100644 index 0000000..9d0421f --- /dev/null +++ b/doc/src/snippets/qelapsedtimer/main.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +void slowOperation1() +{ + static char buf[256]; + for (int i = 0; i < (1<<20); ++i) + buf[i % sizeof buf] = i; +} + +void slowOperation2(int) { slowOperation1(); } + +void startExample() +{ +//![0] + QElapsedTimer timer; + timer.start(); + + slowOperation1(); + + qDebug() << "The slow operation took" << timer.elapsed() << "milliseconds"; +//![0] +} + +//![1] +void executeSlowOperations(int timeout) +{ + QElapsedTimer timer; + timer.start(); + slowOperation1(); + + int remainingTime = timeout - timer.elapsed(); + if (remainingTime > 0) + slowOperation2(remainingTime); +} +//![1] + +//![2] +void executeOperationsForTime(int ms) +{ + QElapsedTimer timer; + timer.start(); + + while (!timer.hasExpired(ms)) + slowOperation1(); +} +//![2] + +int restartExample() +{ +//![3] + QElapsedTimer timer; + + int count = 1; + timer.start(); + do { + count *= 2; + slowOperation2(count); + } while (timer.restart() < 250); + + return count; +//![3] +} + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + + startExample(); + restartExample(); + executeSlowOperations(5); + executeOperationsForTime(5); +} diff --git a/doc/src/snippets/qelapsedtimer/qelapsedtimer.pro b/doc/src/snippets/qelapsedtimer/qelapsedtimer.pro new file mode 100644 index 0000000..b0a8f66 --- /dev/null +++ b/doc/src/snippets/qelapsedtimer/qelapsedtimer.pro @@ -0,0 +1,2 @@ +SOURCES = main.cpp +QT -= gui diff --git a/src/corelib/tools/qelapsedtimer.cpp b/src/corelib/tools/qelapsedtimer.cpp index 220b108..28dfc23 100644 --- a/src/corelib/tools/qelapsedtimer.cpp +++ b/src/corelib/tools/qelapsedtimer.cpp @@ -43,18 +43,204 @@ QT_BEGIN_NAMESPACE +/*! + \class QElapsedTimer + \brief The QElapsedTimer class provides a fast way to calculate elapsed times. + \since 4.7 + + \reentrant + \ingroup tools + \inmodule QtCore + + The QElapsedTimer class is usually used to quickly calculate how much + time has elapsed between two events. Its API is similar to that of QTime, + so code that was using that can be ported quickly to the new class. + + However, unlike QTime, QElapsedTimer tries to use monotonic clocks if + possible. This means it's not possible to convert QElapsedTimer objects + to a human-readable time. + + The typical use-case for the class is to determine how much time was + spent in a slow operation. The simplest example of such a case is for + debugging purposes, as in the following example: + + \snippet doc/src/snippets/qelapsedtimer/main.cpp 0 + + In this example, the timer is started by a call to start() and the + elapsed timer is calculated by the elapsed() function. + + The time elapsed can also be used to recalculate the time available for + another operation, after the first one is complete. This is useful when + the execution must complete within a certain time period, but several + steps are needed. The \tt{waitFor}-type functions in QIODevice and its + subclasses are good examples of such need. In that case, the code could + be as follows: + + \snippet doc/src/snippets/qelapsedtimer/main.cpp 1 + + Another use-case is to execute a certain operation for a specific + timeslice. For this, QElapsedTimer provides the hasExpired() convenience + function, which can be used to determine if a certain number of + milliseconds has already elapsed: + + \snippet doc/src/snippets/qelapsedtimer/main.cpp 1 + + \section1 Reference clocks + + QElapsedTimer will use the platform's monotonic reference clock in all + platforms that support it (see QElapsedTimer::isMonotonic()). This has + the added benefit that QElapsedTimer is immune to time adjustments, such + as the user correcting the time. Also unlike QTime, QElapsedTimer is + immune to changes in the timezone settings, such as daylight savings + periods. + + On the other hand, this means QElapsedTimer values can only be compared + with other values that use the same reference. This is especially true if + the time since the reference is extracted from the QElapsedTimer object + (QElapsedTimer::msecsSinceReference()) and serialised. These values + should never be exchanged across the network or saved to disk, since + there's no telling whether the computer node receiving the data is the + same as the one originating it or if it has rebooted since. + + It is, however, possible to exchange the value with other processes + running on the same machine, provided that they also use the same + reference clock. QElapsedTimer will always use the same clock, so it's + safe to compare with the value coming from another process in the same + machine. If comparing to values produced by other APIs, you should check + that the clock used is the same as QElapsedTimer (see + QElapsedTimer::clockType()). + + \section2 32-bit overflows + + Some of the clocks that QElapsedTimer have a limited range and may + overflow after hitting the upper limit (usually 32-bit). QElapsedTimer + deals with this overflow issue and presents a consistent timing. However, + when extracting the time since reference from QElapsedTimer, two + different processes in the same machine may have different understanding + of how much time has actually elapsed. + + The information on which clocks types may overflow and how to remedy that + issue is documented along with the clock types. + + \sa QTime, QTimer +*/ + +/*! + \enum QElapsedTimer::ClockType + + This enum contains the different clock types that QElapsedTimer may use. + + QElapsedTimer will always use the same clock type in a particular + machine, so this value will not change during the lifetime of a program. + It is provided so that QElapsedTimer can be used with other non-Qt + implementations, to guarantee that the same reference clock is being + used. + + \value SystemTime The human-readable system time. This clock is not monotonic. + \value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is not monotonic and does not overflow. + \value TickCounter The system's tick counter, used on Windows and Symbian systems. This clock may overflow. + \value MachAbsoluteTime The Mach kernel's absolute time (Mac OS X). This clock is monotonic and does not overflow. + + \section2 SystemTime + + The system time clock is purely the real time, expressed in milliseconds + since Jan 1, 1970 at 0:00 UTC. It's equivalent to the value returned by + the C and POSIX \tt{time} function, with the milliseconds added. This + clock type is currently only used on Unix systems that do not support + monotonic clocks (see below). + + This is the only non-monotonic clock that QElapsedTimer may use. + + \section2 MonotonicClock + + This is the system's monotonic clock, expressed in milliseconds since an + arbitrary point in the past. This clock type is used on Unix systems + which support POSIX monotonic clocks (\tt{_POSIX_MONOTONIC_CLOCK}). + + This clock does not overflow. + + \section2 TickCounter + + The tick counter clock type is based on the system's or the processor's + tick counter, multiplied by the duration of a tick. This clock type is + used on Windows and Symbian platforms. + + The TickCounter clock type is the only clock type that may overflow. + Windows Vista and Windows Server 2008 support the extended 64-bit tick + counter, which allows avoiding the overflow. + + On Windows systems, the clock overflows after 2^32 milliseconds, which + corresponds to roughly 49.7 days. This means two processes's reckoning of + the time since the reference may be different by multiples of 2^32 + milliseconds. When comparing such values, it's recommended that the high + 32 bits of the millisecond count be masked off. + + On Symbian systems, the overflow happens after 2^32 ticks, the duration + of which can be obtained from the platform HAL using the constant + HAL::ENanoTickPeriod. When comparing values between processes, it's + necessary to divide the value by the tick duration and mask off the high + 32 bits. + + \section2 MachAbsoluteTime + + This clock type is based on the absolute time presented by Mach kernels, + such as that found on Mac OS X. This clock type is presented separately + from MonotonicClock since Mac OS X is also a Unix system and may support + a POSIX monotonic clock with values differing from the Mach absolute + time. + + This clock is monotonic and does not overflow. + + \sa clockType(), isMonotonic() +*/ + +/*! + \fn bool QElapsedTimer::operator ==(const QElapsedTimer &other) const + + Returns true if this object and \a other contain the same time. +*/ + +/*! + \fn bool QElapsedTimer::operator !=(const QElapsedTimer &other) const + + Returns true if this object and \a other contain different times. +*/ + static const qint64 invalidData = Q_INT64_C(0x8000000000000000); +/*! + Marks this QElapsedTimer object as invalid. + + An invalid object can be checked with isValid(). Calculations of timer + elapsed since invalid data are undefined and will likely produce bizarre + results. + + \sa isValid(), start(), restart() +*/ void QElapsedTimer::invalidate() { t1 = t2 = invalidData; } +/*! + Returns true if this object was invalidated by a call to invalidate() and + has not been restarted since. + + \sa invalidate(), start(), restart() +*/ bool QElapsedTimer::isValid() const { return t1 != invalidData && t2 != invalidData; } +/*! + Returns true if this QElapsedTimer has already expired by \a timeout + milliseconds (that is, more than \a timeout milliseconds have elapsed). + The value of \a timeout can be -1 to indicate that this timer does not + expire, in which case this function will always return false. + + \sa elapsed() +*/ bool QElapsedTimer::hasExpired(qint64 timeout) const { // if timeout is -1, quint64(timeout) is LLINT_MAX, so this will be diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index 3feecd6..9b589c1 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -44,21 +44,57 @@ QT_BEGIN_NAMESPACE +/*! + Returns the clock type that this QElapsedTimer implementation uses. + + \sa isMonotonic() +*/ QElapsedTimer::ClockType QElapsedTimer::clockType() { return SystemTime; } +/*! + Returns true if this is a monotonic clock, false otherwise. See the + information on the different clock types to understand which ones are + monotonic. + + \sa clockType(), QElapsedTimer::ClockType +*/ bool QElapsedTimer::isMonotonic() { return false; } +/*! + Starts this timer. Once started, a timer value can be checked with elapsed() or msecsSinceReference(). + + Normally, a timer is started just before a lengthy operation, such as: + \snippet doc/src/snippets/qelapsedtimer/main.cpp 0 + + Also, starting a timer makes it valid again. + + \sa restart(), invalidate(), elapsed() +*/ void QElapsedTimer::start() { restart(); } +/*! + Restarts the timer and returns the time elapsed since the previous start. + This function is equivalent to obtaining the elapsed time with elapsed() + and then starting the timer again with restart(), but it does so in one + single operation, avoiding the need to obtain the clock value twice. + + The following example illustrates how to use this function to calibrate a + parameter to a slow operation (for example, an iteration count) so that + this operation takes at least 250 milliseconds: + + \snippet doc/src/snippets/qelapsedtimer/main.cpp 3 + + \sa start(), invalidate(), elapsed() +*/ qint64 QElapsedTimer::restart() { qint64 old = t1; @@ -67,27 +103,73 @@ qint64 QElapsedTimer::restart() return t1 - old; } +/*! + Returns the number of milliseconds since this QElapsedTimer was last + started. Calling this function in a QElapsedTimer that was invalidated + will result in undefined results. + + \sa start(), restart(), hasExpired(), invalidate() +*/ qint64 QElapsedTimer::elapsed() const { return QDateTime::currentMsecsSinceEpoch() - t1; } +/*! + Returns the number of milliseconds between last time this QElapsedTimer + object was started and its reference clock's start. + + This number is usually arbitrary for all clocks except the + QElapsedTimer::SystemTime clock. For that clock type, this number is the + number of milliseconds since January 1st, 1970 at 0:00 UTC (that is, it + is the Unix time expressed in milliseconds). + + \sa clockType(), elapsed() +*/ qint64 QElapsedTimer::msecsSinceReference() const { return t1; } +/*! + Returns the number of milliseconds between this QElapsedTimer and \a + other. If \a other was started before this object, the returned value + will be positive. If it was started later, the returned value will be + negative. + + The return value is undefined if this object or \a other were invalidated. + + \sa secsTo(), elapsed() +*/ qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const { qint64 diff = other.t1 - t1; return diff; } +/*! + Returns the number of seconds between this QElapsedTimer and \a other. If + \a other was started before this object, the returned value will be + positive. If it was started later, the returned value will be negative. + + The return value is undefined if this object or \a other were invalidated. + + \sa msecsTo(), elapsed() +*/ qint64 QElapsedTimer::secsTo(const QElapsedTimer &other) const { return msecsTo(other) / 1000; } +/*! + \relates QElapsedTimer + + Returns true if \a v1 was started before \a v2, false otherwise. + + The returned value is undefined if one of the two parameters is invalid + and the other isn't. However, two invalid timers are equal and thus this + function will return false. +*/ bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2) { return v1.t1 < v2.t1; -- cgit v0.12 From fb6cfbe48bc4f2148062d50d4df95616e06f9324 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 16 Mar 2010 15:22:31 +0100 Subject: Improved qt_x11_wait_for_window_manager We shouldn't really care about ReparentNotify when waiting for a window to be "managed" by the window manager. We only need to wait until the window is Mapped and Exposed for the first time, then we (most likely) can safely assume that the window manager has finished managing the window. Task-number: QTBUG-9097 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qwidget_x11.cpp | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index b4febc6..ece4be4 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -369,7 +369,7 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) // ConfigureNotify ... MapNotify ... Expose enum State { - Initial, Reparented, Mapped + Initial, Mapped } state = Initial; do { @@ -377,33 +377,15 @@ Q_GUI_EXPORT void qt_x11_wait_for_window_manager(QWidget* w) XNextEvent(X11->display, &ev); qApp->x11ProcessEvent(&ev); - if (w->windowFlags() & Qt::X11BypassWindowManagerHint) { - switch (state) { - case Initial: - case Reparented: - if (ev.type == MapNotify && ev.xany.window == winid) - state = Mapped; - break; - case Mapped: - if (ev.type == Expose && ev.xany.window == winid) - return; - break; - } - } else { - switch (state) { - case Initial: - if (ev.type == ReparentNotify && ev.xany.window == winid) - state = Reparented; - break; - case Reparented: - if (ev.type == MapNotify && ev.xany.window == winid) - state = Mapped; - break; - case Mapped: - if (ev.type == Expose && ev.xany.window == winid) - return; - break; - } + switch (state) { + case Initial: + if (ev.type == MapNotify && ev.xany.window == winid) + state = Mapped; + break; + case Mapped: + if (ev.type == Expose && ev.xany.window == winid) + return; + break; } } else { if (!XEventsQueued(X11->display, QueuedAfterFlush)) -- cgit v0.12 From f3405a516ac30fc7dee1021cc6f34ca03dd08d97 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Mar 2010 15:16:55 +0100 Subject: Implement Idle-priority threads for Linux. I don't know of any other systems that define SCHED_IDLE, but if any do, they'll use this code too Task-number: related to QTBUG-9032 Reviewed-by: Bradley T. Hughes --- src/corelib/thread/qthread.cpp | 4 +- src/corelib/thread/qthread_unix.cpp | 107 +++++++++++++++++++++--------------- 2 files changed, 65 insertions(+), 46 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index dd0c257..cb84538 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -617,7 +617,9 @@ QThread::Priority QThread::priority() const { Q_D(const QThread); QMutexLocker locker(&d->mutex); - return d->priority; + + // mask off the high bits that are used for flags + return Priority(d->priority & 0xffff); } /*! diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index cda35a4..5a50646 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -92,10 +92,17 @@ # endif #endif +#if defined(Q_OS_LINUX) && !defined(SCHED_IDLE) +// from linux/sched.h +# define SCHED_IDLE 5 +#endif + QT_BEGIN_NAMESPACE #ifndef QT_NO_THREAD +enum { ThreadPriorityResetFlag = 0x80000000 }; + static pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT; static pthread_key_t current_thread_data_key; @@ -221,6 +228,11 @@ void *QThreadPrivate::start(void *arg) QThread *thr = reinterpret_cast(arg); QThreadData *data = QThreadData::get2(thr); + // do we need to reset the thread priority? + if (int(thr->d_func()->priority) & ThreadPriorityResetFlag) { + thr->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag)); + } + #ifdef Q_OS_SYMBIAN // Because Symbian Open C does not provide a way to convert between // RThread and pthread_t, we must delay initialization of the RThread @@ -436,6 +448,37 @@ void QThread::usleep(unsigned long usecs) thread_sleep(&ti); } +// Does some magic and calculate the Unix scheduler priorities +// sched_policy is IN/OUT: it must be set to a valid policy before calling this function +// sched_priority is OUT only +static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority) +{ +#ifdef SCHED_IDLE + if (priority == QThread::IdlePriority) { + *sched_policy = SCHED_IDLE; + *sched_priority = 0; + return true; + } + const int lowestPriority = QThread::LowestPriority; +#else + const int lowestPriority = QThread::IdlePriority; +#endif + const int highestPriority = QThread::TimeCriticalPriority; + + int prio_min = sched_get_priority_min(*sched_policy); + int prio_max = sched_get_priority_max(*sched_policy); + if (prio_min == -1 || prio_max == -1) + return false; + + int prio; + // crudely scale our priority enum values to the prio_min/prio_max + prio = ((priority - lowestPriority) * (prio_max - prio_min) / highestPriority) + prio_min; + prio = qMax(prio_min, qMin(prio_max, prio)); + + *sched_priority = prio; + return true; +} + void QThread::start(Priority priority) { Q_D(QThread); @@ -472,32 +515,14 @@ void QThread::start(Priority priority) break; } - int prio_min = sched_get_priority_min(sched_policy); - int prio_max = sched_get_priority_max(sched_policy); - if (prio_min == -1 || prio_max == -1) { + int prio; + if (!calculateUnixPriority(priority, &sched_policy, &prio)) { // failed to get the scheduling parameters, don't // bother setting the priority qWarning("QThread::start: Cannot determine scheduler priority range"); break; } - int prio; - switch (priority) { - case IdlePriority: - prio = prio_min; - break; - - case TimeCriticalPriority: - prio = prio_max; - break; - - default: - // crudely scale our priority enum values to the prio_min/prio_max - prio = (priority * (prio_max - prio_min) / TimeCriticalPriority) + prio_min; - prio = qMax(prio_min, qMin(prio_max, prio)); - break; - } - sched_param sp; sp.sched_priority = prio; @@ -505,7 +530,9 @@ void QThread::start(Priority priority) || pthread_attr_setschedpolicy(&attr, sched_policy) != 0 || pthread_attr_setschedparam(&attr, &sp) != 0) { // could not set scheduling hints, fallback to inheriting them + // we'll try again from inside the thread pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED); + d->priority = Priority(priority | ThreadPriorityResetFlag); } break; } @@ -672,38 +699,28 @@ void QThread::setPriority(Priority priority) return; } - int prio_min = sched_get_priority_min(sched_policy); - int prio_max = sched_get_priority_max(sched_policy); - if (prio_min == -1 || prio_max == -1) { + int prio; + if (!calculateUnixPriority(priority, &sched_policy, &prio)) { // failed to get the scheduling parameters, don't // bother setting the priority qWarning("QThread::setPriority: Cannot determine scheduler priority range"); return; } - int prio; - switch (priority) { - case InheritPriority: - qWarning("QThread::setPriority: Argument cannot be InheritPriority"); - return; - - case IdlePriority: - prio = prio_min; - break; - - case TimeCriticalPriority: - prio = prio_max; - break; - - default: - // crudely scale our priority enum values to the prio_min/prio_max - prio = (priority * (prio_max - prio_min) / TimeCriticalPriority) + prio_min; - prio = qMax(prio_min, qMin(prio_max, prio)); - break; - } - param.sched_priority = prio; - pthread_setschedparam(d->thread_id, sched_policy, ¶m); + int status = pthread_setschedparam(d->thread_id, sched_policy, ¶m); + +# ifdef SCHED_IDLE + // were we trying to set to idle priority and failed? + if (status == -1 && sched_policy == SCHED_IDLE && errno == EINVAL) { + // reset to lowest priority possible + pthread_getschedparam(d->thread_id, &sched_policy, ¶m); + param.sched_priority = sched_get_priority_min(sched_policy); + pthread_setschedparam(d->thread_id, sched_policy, ¶m); + } +# else + Q_UNUSED(status); +# endif // SCHED_IDLE #endif } -- cgit v0.12 From 90dfb5e5d8fc8cb841b0762cd88aa4b996c38312 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 9 Mar 2010 13:48:38 +0100 Subject: Do not deliver the same key event multiple times in Cocoa. When QCocoaView receives a keyDown or keyUp event, we translate it to QKeyEvent and deliver it to qt widgets, propagating if necessary. However if none of Qt widgets accepted the event we should propagate it back to cocoa - to get a beep from it, or for example if Qt widget is embedded into a native widget. Task-number: related to QTBUG-6444 Task-number: QTCREATORBUG-698 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 20 -------------------- src/gui/kernel/qcocoaview_mac.mm | 20 ++++++++++++++++---- src/gui/kernel/qt_cocoa_helpers_mac.mm | 7 +++---- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index 9fe5ae0..129e0a5 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -132,26 +132,6 @@ QT_END_NAMESPACE [super toggleToolbarShown:sender]; } -/* - The methods keyDown, keyUp, and flagsChanged... These really shouldn't ever - get hit. We automatically say we can be first responder if we are a window. - So, the handling should get handled by the view. This is here more as a - last resort (i.e., this is code that can potentially be removed). - */ -- (void)keyDown:(NSEvent *)theEvent -{ - bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); - if (!keyOK) - [super keyDown:theEvent]; -} - -- (void)keyUp:(NSEvent *)theEvent -{ - bool keyOK = qt_dispatchKeyEvent(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); - if (!keyOK) - [super keyUp:theEvent]; -} - - (void)flagsChanged:(NSEvent *)theEvent { qt_dispatchModifiersChanged(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]); diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index a627616..99c0bb1 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1121,8 +1121,15 @@ static int qCocoaViewCount = 0; } if (sendKeyEvents && !composing) { bool keyOK = qt_dispatchKeyEvent(theEvent, widgetToGetKey); - if (!keyOK && !sendToPopup) - [super keyDown:theEvent]; + if (!keyOK && !sendToPopup) { + // find the first responder that is not created by Qt and forward + // the event to it (for example if Qt widget is embedded into native). + QWidget *toplevel = qwidget->window(); + if (toplevel && qt_widget_private(toplevel)->topData()->embedded) { + if (NSResponder *w = [qt_mac_nativeview_for(toplevel) superview]) + [w keyDown:theEvent]; + } + } } } @@ -1131,8 +1138,13 @@ static int qCocoaViewCount = 0; { if (sendKeyEvents) { bool keyOK = qt_dispatchKeyEvent(theEvent, qwidget); - if (!keyOK) - [super keyUp:theEvent]; + if (!keyOK) { + QWidget *toplevel = qwidget->window(); + if (toplevel && qt_widget_private(toplevel)->topData()->embedded) { + if (NSResponder *w = [qt_mac_nativeview_for(toplevel) superview]) + [w keyUp:theEvent]; + } + } } } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 24fe5f7..b1e4c94 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -652,8 +652,7 @@ bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widge UInt32 macScanCode = 1; QKeyEventEx ke(cocoaEvent2QtEvent([event type]), qtKey, keyMods, text, [event isARepeat], qMax(1, keyLength), macScanCode, [event keyCode], [event modifierFlags]); - qt_sendSpontaneousEvent(widgetToGetEvent, &ke); - return ke.isAccepted(); + return qt_sendSpontaneousEvent(widgetToGetEvent, &ke) && ke.isAccepted(); } #endif @@ -703,8 +702,8 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve if (mustUseCocoaKeyEvent()) return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent); bool isAccepted; - qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true); - return isAccepted; + bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true); + return consumed && isAccepted; #endif } -- cgit v0.12 From 77230f7ec9e78ec2d57629ea934ceb1d59eb391e Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 9 Mar 2010 18:14:52 +0100 Subject: Do not beep on Mac when pressing some keys. When a key event is delivered to widgets, we should accept the event if the widget reacted to it in any way - if either the current item has changed or if the widget scrolled. Task-number: QTBUG-6444 Reviewed-by: Prasanth --- src/gui/itemviews/qabstractitemview.cpp | 7 ++++++- src/gui/itemviews/qabstractitemview_p.h | 1 + src/gui/itemviews/qtreeview.cpp | 12 ++++++++++-- src/gui/widgets/qlinecontrol.cpp | 1 - 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 3738816..fc53ea3 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -104,7 +104,8 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() horizontalScrollMode(QAbstractItemView::ScrollPerItem), currentIndexSet(false), wrapItemText(false), - delayedPendingLayout(false) + delayedPendingLayout(false), + moveCursorUpdatedView(false) { } @@ -2210,6 +2211,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) #endif QPersistentModelIndex newCurrent; + d->moveCursorUpdatedView = false; switch (event->key()) { case Qt::Key_Down: newCurrent = moveCursor(MoveDown, event->modifiers()); @@ -2266,6 +2268,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); setSelection(rect, command); } + event->accept(); return; } } @@ -2363,6 +2366,8 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } break; } } + if (d->moveCursorUpdatedView) + event->accept(); } /*! diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h index 509459c..fce74f3 100644 --- a/src/gui/itemviews/qabstractitemview_p.h +++ b/src/gui/itemviews/qabstractitemview_p.h @@ -419,6 +419,7 @@ public: bool wrapItemText; mutable bool delayedPendingLayout; + bool moveCursorUpdatedView; private: mutable QBasicTimer delayedLayout; diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index fcdc429..95ba67c 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2139,9 +2139,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie return d->modelIndex(d->above(vi), current.column()); case MoveLeft: { QScrollBar *sb = horizontalScrollBar(); - if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum()) + if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum()) { d->collapse(vi, true); - else { + d->moveCursorUpdatedView = true; + } else { bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); if (descend) { QModelIndex par = current.parent(); @@ -2161,7 +2162,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie return next; } + int oldValue = sb->value(); sb->setValue(sb->value() - sb->singleStep()); + if (oldValue != sb->value()) + d->moveCursorUpdatedView = true; } } @@ -2173,6 +2177,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie if (vi < d->viewItems.count() && !d->viewItems.at(vi).expanded && d->itemsExpandable && d->hasVisibleChildren(d->viewItems.at(vi).index)) { d->expand(vi, true); + d->moveCursorUpdatedView = true; } else { bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); if (descend) { @@ -2195,7 +2200,10 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie //last restort: we change the scrollbar value QScrollBar *sb = horizontalScrollBar(); + int oldValue = sb->value(); sb->setValue(sb->value() + sb->singleStep()); + if (oldValue != sb->value()) + d->moveCursorUpdatedView = true; } } updateGeometries(); diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 8e715a9..42df800 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1767,7 +1767,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } break; #endif - default: if (!handled) unknown = true; -- cgit v0.12 From 4256bd2141fef53f9e69a51b966bd85f67a6cf54 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 11 Mar 2010 13:37:22 +0100 Subject: Fixed focus handling when Qt is embedded into Cocoa app. When a Qt widget gets focus we should call setFocus() on it to make sure the focus chain is properly set. Reviewed-by: Prasanth --- src/gui/kernel/qcocoaview_mac.mm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 99c0bb1..e745074 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1032,11 +1032,16 @@ static int qCocoaViewCount = 0; { if (!qwidget) return NO; + // disabled widget shouldn't get focus even if it's a window. + // hence disabled windows will not get any key or mouse events. + if (!qwidget->isEnabled()) + return NO; // Before accepting the focus for a window, we check that // the focusWidget (if any) is not contained in the same window. - if (qwidget->isWindow() && (!qApp->focusWidget() - || qApp->focusWidget()->window() != qwidget)) + if (qwidget->isWindow() && !qt_widget_private(qwidget)->topData()->embedded + && (!qApp->focusWidget() || qApp->focusWidget()->window() != qwidget)) { return YES; // Always do it, so that windows can accept key press events. + } return qwidget->focusPolicy() != Qt::NoFocus; } @@ -1047,7 +1052,16 @@ static int qCocoaViewCount = 0; // Seems like the following test only triggers if this // view is inside a QMacNativeWidget: if (qwidget == QApplication::focusWidget()) - QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); + qwidget->clearFocus(); + return YES; +} + +- (BOOL)becomeFirstResponder +{ + // see the comment in the acceptsFirstResponder - if the window "stole" focus + // let it become the responder, but don't tell Qt + if (!QApplication::focusWidget() && qwidget->focusPolicy() != Qt::NoFocus) + qwidget->setFocus(Qt::OtherFocusReason); return YES; } -- cgit v0.12 From ed1a76e95a54bb86ce12c5e804550bfbfd58fa7e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 17 Mar 2010 16:57:10 +0100 Subject: compile fix for Windows Reviewed-by: Kai Koehne --- src/gui/styles/qwindowsvistastyle_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/gui/styles/qwindowsvistastyle_p.h index 673568d..ab941a1 100644 --- a/src/gui/styles/qwindowsvistastyle_p.h +++ b/src/gui/styles/qwindowsvistastyle_p.h @@ -86,6 +86,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE -- cgit v0.12 From 3d6f1ebf1dbdefc443aa4f8e7d18755383794156 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Wed, 10 Mar 2010 16:35:59 +0100 Subject: qmake: fix to create proper install target in Makefile at first run Previously when qmake was executed the first time, or when no previously compiled binary target was available for some reason, qmake just created an empty install target in the Makefile. So in fact for a target to be installed properly you needed to run something like "qmake && make && qmake && make install". This should now be fixed with this patch. Reviewed-by: Marius Storm-Olsen Task-number:QTBUG-5558 --- qmake/generators/makefile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index b9d2445..29a2422 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1245,7 +1245,8 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n } if(!dirstr.endsWith(Option::dir_sep)) dirstr += Option::dir_sep; - if(exists(wild)) { //real file + bool is_target = (wild == fileFixify(var("TARGET"), FileFixifyAbsolute)); + if(is_target || exists(wild)) { //real file or target QString file = wild; QFileInfo fi(fileInfo(wild)); if(!target.isEmpty()) @@ -1259,7 +1260,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n QString cmd; if (fi.isDir()) cmd = "-$(INSTALL_DIR)"; - else if (fi.isExecutable()) + else if (is_target || fi.isExecutable()) cmd = "-$(INSTALL_PROGRAM)"; else cmd = "-$(INSTALL_FILE)"; -- cgit v0.12 From d6ab68fbd22b2d057b0e32e1bfc73a5e7dc9327d Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Mon, 15 Mar 2010 12:00:02 +0100 Subject: Force qt-zlib to be used for host system when cross compiling. There is no possibility to define which zlib should be used for the bootstrapped tools when cross compiling. Therefor we will force qt-zlib to be used for bootstrapped tools. Reviewed-by: Marius Storm-Olsen Task-number: QTBUG-8678 --- src/tools/bootstrap/bootstrap.pri | 2 +- src/tools/bootstrap/bootstrap.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri index b3ee948..6442526 100644 --- a/src/tools/bootstrap/bootstrap.pri +++ b/src/tools/bootstrap/bootstrap.pri @@ -51,7 +51,7 @@ hpux-acc*|hpuxi-acc* { } LIBS += -lbootstrap } -!contains(QT_CONFIG, zlib):!contains(QT_CONFIG, no-zlib) { +!contains(QT_CONFIG, zlib):!contains(QT_CONFIG, no-zlib):!cross_compile { unix:LIBS += -lz # win32:LIBS += libz.lib } diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 0dbb90f..7e91333 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -95,7 +95,7 @@ macx: { LIBS += -framework CoreServices } -contains(QT_CONFIG, zlib) { +contains(QT_CONFIG, zlib)|cross_compile { INCLUDEPATH += ../../3rdparty/zlib SOURCES+= \ ../3rdparty/zlib/adler32.c \ -- cgit v0.12 From ba39db7b374eb3e4ded5150c1ad58ca38f3b7394 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 17 Mar 2010 19:14:43 +0100 Subject: Compile fix on keypad-navigation systems --- src/gui/widgets/qabstractslider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 8f53116..6a01d68 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -788,7 +788,7 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) } else if (!d->firstRepeat.isValid()) { - d->firstRepeat.invalidate() + d->firstRepeat.invalidate(); d->repeatMultiplier = 1; } -- cgit v0.12 From 41ab4760d0cac439d9dbe26f95cd6327039fbb8e Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 17 Mar 2010 21:45:02 +0100 Subject: Remove unwanted code in f8d5f2594a9b268b9eeecf95b24b23fc940c71ce Reviewed-by: Trust Me --- src/gui/kernel/qcocoaview_mac.mm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index e745074..0bc57e0 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -491,9 +491,7 @@ static int qCocoaViewCount = 0; CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; qwidgetprivate->hd = cg; CGContextSaveGState(cg); - CGFloat components[] = {1,0,0,1}; - CGContextSetFillColor(cg, components); - CGContextFillRect(cg, aRect); + if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event. if (qwidget->testAttribute(Qt::WA_WState_InPaintEvent)) qWarning("QWidget::repaint: Recursive repaint detected"); -- cgit v0.12 From 0d3c62150f2fa2c06f7676336076be4622059cc3 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 20 Jan 2010 14:56:37 +0100 Subject: Optimized QLocale to access system locale on demand. Changed the initialization of the system locale to make construction of the QLocale object as lightweight as possible. So now the default contructor just creates a QLocale and QSystemLocale objects, but doesn't try to fill the cache in the latter with data from the system and postpones it until it is actually requested (most applications create QLocale objects on the stack and might not even use the data from the system locale, so we don't need to initialize system locale right away). This is an improved version of an already reverted change 8911ed8bfe7f918b93c758f9b5d93274b37739e6, 8911ed8bfe7f918b93c758f9b5d93274b37739e6 and 8911ed8bfe7f918b93c758f9b5d93274b37739e6. Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale.cpp | 214 +++++++++++++++++++++++++++++-------- src/corelib/tools/qlocale.h | 1 + src/corelib/tools/qlocale_p.h | 18 ++-- tests/auto/qlocale/tst_qlocale.cpp | 6 ++ 4 files changed, 185 insertions(+), 54 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 1966a79..e36497c 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1274,11 +1274,25 @@ QLocale QSystemLocale::fallbackLocale() const */ QVariant QSystemLocale::query(QueryType type, QVariant /* in */) const { - if (type == MeasurementSystem) { + switch (type) { + case MeasurementSystem: return QVariant(unixGetSystemMeasurementSystem()); - } else { - return QVariant(); + case LanguageId: + case CountryId: { + QString locale = QLatin1String(envVarLocale()); + QLocale::Language lang; + QLocale::Country cntry; + getLangAndCountry(locale, lang, cntry); + if (type == LanguageId) + return lang; + if (cntry == QLocale::AnyCountry) + return fallbackLocale().country(); + return cntry; + } + default: + break; } + return QVariant(); } #elif !defined(Q_OS_SYMBIAN) @@ -1310,12 +1324,10 @@ QVariant QSystemLocale::query(QueryType /* type */, QVariant /* in */) const #endif -#ifndef QT_NO_SYSTEMLOCALE static QSystemLocale *_systemLocale = 0; Q_GLOBAL_STATIC_WITH_ARGS(QSystemLocale, QSystemLocale_globalSystemLocale, (true)) static QLocalePrivate *system_lp = 0; Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate) -#endif /****************************************************************************** ** Default system locale behavior @@ -1388,7 +1400,8 @@ QSystemLocale::QSystemLocale() /*! \internal */ QSystemLocale::QSystemLocale(bool) -{ } +{ +} /*! Deletes the object. @@ -1410,16 +1423,42 @@ static const QSystemLocale *systemLocale() return QSystemLocale_globalSystemLocale(); } +static const QLocalePrivate *maybeSystemPrivate(); +bool QLocalePrivate::isUninitializedSystemLocale() const +{ + return this == maybeSystemPrivate() && m_language_id == 0; +} + +QVariant QLocalePrivate::querySystemLocale(int type, const QVariant &in) const +{ + QVariant res = systemLocale()->query(QSystemLocale::QueryType(type), in); + if (res.isNull() && isUninitializedSystemLocale()) { + // if we were not able to get data from the system, initialize the + // system locale private data (which is essentially equals to this) + // with a fallback locale. + QLocalePrivate *system_private = globalLocalePrivate(); + *system_private = *systemLocale()->fallbackLocale().d(); + // internal cache is not initialized with values from the system, mark + // it as not fully initialized system locale. + system_private->m_language_id = 0; + } + return res; +} + +// retrieves data from the system locale and caches them locally. void QLocalePrivate::updateSystemPrivate() { const QSystemLocale *sys_locale = systemLocale(); if (!system_lp) - system_lp = globalLocalePrivate(); + return; + + // copy over the information from the fallback locale and modify *system_lp = *sys_locale->fallbackLocale().d(); QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant()); if (!res.isNull()) system_lp->m_language_id = res.toInt(); + res = sys_locale->query(QSystemLocale::CountryId, QVariant()); if (!res.isNull()) system_lp->m_country_id = res.toInt(); @@ -1446,19 +1485,29 @@ void QLocalePrivate::updateSystemPrivate() } #endif +// returns the private data for the system locale. Cached data will not be +// initialized until the updateSystemPrivate is called. static const QLocalePrivate *systemPrivate() { #ifndef QT_NO_SYSTEMLOCALE - // copy over the information from the fallback locale and modify - if (!system_lp || system_lp->m_language_id == 0) - QLocalePrivate::updateSystemPrivate(); - + if (!system_lp) { + system_lp = globalLocalePrivate(); + // mark the locale as uninitialized system locale + system_lp->m_language_id = 0; + } return system_lp; #else return locale_data; #endif } +#ifndef QT_NO_SYSTEMLOCALE +static const QLocalePrivate *maybeSystemPrivate() +{ + return system_lp; +} +#endif + static const QLocalePrivate *defaultPrivate() { if (!default_lp) @@ -2283,7 +2332,12 @@ void QLocale::setDefault(const QLocale &locale) */ QLocale::Language QLocale::language() const { - return Language(d()->languageId()); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return Language(dd->languageId()); } /*! @@ -2293,7 +2347,12 @@ QLocale::Language QLocale::language() const */ QLocale::Country QLocale::country() const { - return Country(d()->countryId()); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return Country(dd->countryId()); } /*! @@ -2631,8 +2690,8 @@ QString QLocale::toString(const QDate &date, FormatType format) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(format == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(format == LongFormat ? QSystemLocale::DateToStringLong : QSystemLocale::DateToStringShort, date); if (!res.isNull()) @@ -2726,8 +2785,8 @@ QString QLocale::toString(const QDateTime &dateTime, FormatType format) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(format == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(format == LongFormat ? QSystemLocale::DateTimeToStringLong : QSystemLocale::DateTimeToStringShort, dateTime); @@ -2752,8 +2811,8 @@ QString QLocale::toString(const QTime &time, FormatType format) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(format == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(format == LongFormat ? QSystemLocale::TimeToStringLong : QSystemLocale::TimeToStringShort, time); if (!res.isNull()) @@ -2779,8 +2838,8 @@ QString QLocale::toString(const QTime &time, FormatType format) const QString QLocale::dateFormat(FormatType format) const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(format == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(format == LongFormat ? QSystemLocale::DateFormatLong : QSystemLocale::DateFormatShort, QVariant()); if (!res.isNull()) @@ -2816,8 +2875,8 @@ QString QLocale::dateFormat(FormatType format) const QString QLocale::timeFormat(FormatType format) const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(format == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(format == LongFormat ? QSystemLocale::TimeFormatLong : QSystemLocale::TimeFormatShort, QVariant()); if (!res.isNull()) @@ -2853,8 +2912,8 @@ QString QLocale::timeFormat(FormatType format) const QString QLocale::dateTimeFormat(FormatType format) const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(format == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(format == LongFormat ? QSystemLocale::DateTimeFormatLong : QSystemLocale::DateTimeFormatShort, QVariant()); @@ -3021,7 +3080,12 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons */ QChar QLocale::decimalPoint() const { - return d()->decimal(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->decimal(); } /*! @@ -3031,7 +3095,12 @@ QChar QLocale::decimalPoint() const */ QChar QLocale::groupSeparator() const { - return d()->group(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->group(); } /*! @@ -3041,7 +3110,12 @@ QChar QLocale::groupSeparator() const */ QChar QLocale::percent() const { - return d()->percent(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->percent(); } /*! @@ -3051,7 +3125,12 @@ QChar QLocale::percent() const */ QChar QLocale::zeroDigit() const { - return d()->zero(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->zero(); } /*! @@ -3061,7 +3140,12 @@ QChar QLocale::zeroDigit() const */ QChar QLocale::negativeSign() const { - return d()->minus(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->minus(); } /*! @@ -3071,7 +3155,12 @@ QChar QLocale::negativeSign() const */ QChar QLocale::positiveSign() const { - return d()->plus(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->plus(); } /*! @@ -3081,7 +3170,12 @@ QChar QLocale::positiveSign() const */ QChar QLocale::exponential() const { - return d()->exponential(); + const QLocalePrivate *dd = d(); +#ifndef QT_NO_SYSTEMLOCALE + if (dd->isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif + return dd->exponential(); } static bool qIsUpper(char c) @@ -3200,8 +3294,8 @@ QString QLocale::monthName(int month, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(type == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(type == LongFormat ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, month); if (!res.isNull()) @@ -3246,8 +3340,8 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(type == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(type == LongFormat ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort, month); if (!res.isNull()) @@ -3293,8 +3387,8 @@ QString QLocale::dayName(int day, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(type == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(type == LongFormat ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort, day); if (!res.isNull()) @@ -3342,8 +3436,8 @@ QString QLocale::standaloneDayName(int day, FormatType type) const return QString(); #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(type == LongFormat + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(type == LongFormat ? QSystemLocale::DayNameLong : QSystemLocale::DayNameShort, day); if (!res.isNull()) @@ -3387,8 +3481,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const bool found = false; #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(QSystemLocale::MeasurementSystem, QVariant()); + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(QSystemLocale::MeasurementSystem, QVariant()); if (!res.isNull()) { meas = MeasurementSystem(res.toInt()); found = true; @@ -3415,8 +3509,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const QString QLocale::amText() const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(QSystemLocale::AMText, QVariant()); + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(QSystemLocale::AMText, QVariant()); if (!res.isNull()) return res.toString(); } @@ -3435,8 +3529,8 @@ QString QLocale::amText() const QString QLocale::pmText() const { #ifndef QT_NO_SYSTEMLOCALE - if (d() == systemPrivate()) { - QVariant res = systemLocale()->query(QSystemLocale::PMText, QVariant()); + if (d() == maybeSystemPrivate()) { + QVariant res = d()->querySystemLocale(QSystemLocale::PMText, QVariant()); if (!res.isNull()) return res.toString(); } @@ -3851,6 +3945,10 @@ QString QLocalePrivate::doubleToString(double d, int width, unsigned flags) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif if (precision == -1) precision = 6; if (width == -1) @@ -4001,6 +4099,10 @@ QString QLocalePrivate::longLongToString(qlonglong l, int precision, int base, int width, unsigned flags) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif bool precision_not_specified = false; if (precision == -1) { precision_not_specified = true; @@ -4086,6 +4188,10 @@ QString QLocalePrivate::unsLongLongToString(qulonglong l, int precision, int base, int width, unsigned flags) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif bool precision_not_specified = false; if (precision == -1) { precision_not_specified = true; @@ -4288,6 +4394,10 @@ bool QLocalePrivate::numberToCLocale(const QString &num, bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByteArray *buff, int decDigits) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif buff->clear(); buff->reserve(str.length()); @@ -4381,6 +4491,10 @@ bool QLocalePrivate::validateChars(const QString &str, NumberMode numMode, QByte double QLocalePrivate::stringToDouble(const QString &number, bool *ok, GroupSeparatorMode group_sep_mode) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif CharBuff buff; if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)) { @@ -4394,6 +4508,10 @@ double QLocalePrivate::stringToDouble(const QString &number, bool *ok, qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif CharBuff buff; if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)) { @@ -4408,6 +4526,10 @@ qlonglong QLocalePrivate::stringToLongLong(const QString &number, int base, qulonglong QLocalePrivate::stringToUnsLongLong(const QString &number, int base, bool *ok, GroupSeparatorMode group_sep_mode) const { +#ifndef QT_NO_SYSTEMLOCALE + if (isUninitializedSystemLocale()) + QLocalePrivate::updateSystemPrivate(); +#endif CharBuff buff; if (!numberToCLocale(group().unicode() == 0xa0 ? number.trimmed() : number, group_sep_mode, &buff)) { diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index e854c84..9b7b214 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -638,6 +638,7 @@ public: ; private: friend struct QLocalePrivate; + // ### We now use this field to pack an index into locale_data and NumberOptions. // ### Qt 5: change to a QLocaleData *d; uint numberOptions. union { diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index ecf79e9..003ae8c 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -63,14 +63,14 @@ QT_BEGIN_NAMESPACE struct Q_CORE_EXPORT QLocalePrivate { public: - QChar decimal() const { return QChar(m_decimal); } - QChar group() const { return QChar(m_group); } - QChar list() const { return QChar(m_list); } - QChar percent() const { return QChar(m_percent); } - QChar zero() const { return QChar(m_zero); } - QChar plus() const { return QChar(m_plus); } - QChar minus() const { return QChar(m_minus); } - QChar exponential() const { return QChar(m_exponential); } + QChar decimal() const { Q_ASSERT(m_decimal); return QChar(m_decimal); } + QChar group() const { Q_ASSERT(m_group); return QChar(m_group); } + QChar list() const { Q_ASSERT(m_list); return QChar(m_list); } + QChar percent() const { Q_ASSERT(m_percent); return QChar(m_percent); } + QChar zero() const { Q_ASSERT(m_zero); return QChar(m_zero); } + QChar plus() const { Q_ASSERT(m_plus); return QChar(m_plus); } + QChar minus() const { Q_ASSERT(m_minus); return QChar(m_minus); } + QChar exponential() const { Q_ASSERT(m_exponential); return QChar(m_exponential); } quint32 languageId() const { return m_language_id; } quint32 countryId() const { return m_country_id; } @@ -132,6 +132,8 @@ public: CharBuff *result) const; inline char digitToCLocale(const QChar &c) const; + inline bool isUninitializedSystemLocale() const; + QVariant querySystemLocale(int type, const QVariant &in) const; static void updateSystemPrivate(); enum NumberMode { IntegerMode, DoubleStandardMode, DoubleScientificMode }; diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 5a87154..9363e4e 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -158,9 +158,15 @@ void tst_QLocale::ctor() QCoreApplication app(argc, (char**)&argv); #endif QLocale default_locale = QLocale::system(); + + QVERIFY(!default_locale.monthName(1, QLocale::LongFormat).isEmpty()); + QVERIFY(!default_locale.monthName(1, QLocale::ShortFormat).isEmpty()); + QVERIFY(default_locale.language() != 0); + QLocale::Language default_lang = default_locale.language(); QLocale::Country default_country = default_locale.country(); + qDebug("Default: %s/%s", QLocale::languageToString(default_lang).toLatin1().constData(), QLocale::countryToString(default_country).toLatin1().constData()); -- cgit v0.12 From ffcd64e38529c6d93c632282a75a31731feeb0d2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 18 Mar 2010 10:31:48 +1000 Subject: Make destructor virtual. --- src/network/bearer/qnetworkconfiguration_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 6908277..07b472e 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -72,7 +72,7 @@ public: { } - ~QNetworkConfigurationPrivate() + virtual ~QNetworkConfigurationPrivate() { //release pointers to member configurations serviceNetworkMembers.clear(); -- cgit v0.12 From 729bbd99736dd88847018a3378fc89e3be348d87 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 17 Mar 2010 10:48:11 +1000 Subject: Don't fail unit test when there is no default network configuration. --- tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp index 3052330..b11868a 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -285,14 +285,12 @@ void tst_QNetworkConfigurationManager::defaultConfiguration() QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); bool confirm = configs.contains(defaultConfig); - bool isUserChoice = (defaultConfig.type() == QNetworkConfiguration::UserChoice); - //user choice config is not part of allConfigurations() - QVERIFY(isUserChoice != confirm); - if (!isUserChoice) { + if (defaultConfig.type() != QNetworkConfiguration::UserChoice) { QVERIFY(confirm || !defaultConfig.isValid()); QVERIFY(!(confirm && !defaultConfig.isValid())); } else { + QVERIFY(!confirm); // user choice config is not part of allConfigurations() QVERIFY(defaultConfig.isValid()); QCOMPARE(defaultConfig.name(), QString("UserChoice")); QCOMPARE(defaultConfig.children().count(), 0); -- cgit v0.12 From cb7e008ee713729dd27666df7282888325c0963a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 17 Mar 2010 10:49:27 +1000 Subject: Add flag to indicate that network sessions are expected on a platform. --- mkspecs/common/symbian/symbian.conf | 3 --- mkspecs/linux-g++-maemo/qmake.conf | 3 --- src/network/access/qnetworkaccessmanager.cpp | 14 +++++++------- src/network/access/qnetworkaccessmanager_p.h | 4 ---- src/network/bearer/qnetworkconfigmanager.cpp | 2 ++ src/network/bearer/qnetworkconfigmanager.h | 3 ++- src/plugins/bearer/icd/qicdengine.cpp | 3 ++- src/plugins/bearer/symbian/symbianengine.cpp | 3 ++- 8 files changed, 15 insertions(+), 20 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 239b998..1053ab3 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -9,9 +9,6 @@ QMAKE_INCREMENTAL_STYLE = sublib DEFINES += UNICODE QT_KEYPAD_NAVIGATION QT_SOFTKEYS_ENABLED QT_USE_MATH_H_FLOATS -# QNetworkAccessManager to create a network session by default -DEFINES += QT_QNAM_DEFAULT_NETWORK_SESSION - QMAKE_COMPILER_DEFINES += SYMBIAN QMAKE_EXT_OBJ = .o diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index e272e72..ca201bc 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -33,7 +33,4 @@ DEFINES += QT_GL_NO_SCISSOR_TEST # Work round SGX 1.4 driver bug (text corrupted), modify glyph cache width: DEFINES += QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -# QNetworkAccessManager to create a network session by default -DEFINES += QT_QNAM_DEFAULT_NETWORK_SESSION - load(qt_config) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 1940dd1..4518d4c 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -880,15 +880,17 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QDisabledNetworkReply(this, req, op); } -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION if (!d->networkSession && (d->initializeSession || !d->networkConfiguration.isEmpty())) { QNetworkConfigurationManager manager; - if (d->networkConfiguration.isEmpty()) - d->createSession(manager.defaultConfiguration()); - else + if (!d->networkConfiguration.isEmpty()) { d->createSession(manager.configurationFromIdentifier(d->networkConfiguration)); + } else { + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) + d->createSession(manager.defaultConfiguration()); + else + d->initializeSession = false; + } } -#endif if (d->networkSession) d->networkSession->setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), -1); @@ -1208,9 +1210,7 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co { Q_Q(QNetworkAccessManager); -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION initializeSession = false; -#endif if (networkSession) delete networkSession; diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 4a2a840..0140268 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -77,9 +77,7 @@ public: #endif networkSession(0), networkAccessEnabled(true), -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION initializeSession(true), -#endif cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -126,9 +124,7 @@ public: QNetworkSession *networkSession; QString networkConfiguration; bool networkAccessEnabled; -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION bool initializeSession; -#endif bool cookieJarCreated; diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index e7595a4..0cd5efb 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -166,6 +166,8 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() sockets. \value DataStatistics If this flag is set QNetworkSession can provide statistics about transmitted and received data. + \value NetworkSessionRequired If this flag is set the platform requires that a network + session is created before network operations can be performed. */ /*! diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 73041fe..bb4d8a0 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -64,7 +64,8 @@ public: SystemSessionSupport = 0x00000004, ApplicationLevelRoaming = 0x00000008, ForcedRoaming = 0x00000010, - DataStatistics = 0x00000020 + DataStatistics = 0x00000020, + NetworkSessionRequired = 0x00000040 }; Q_DECLARE_FLAGS(Capabilities, Capability) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 5e9dc0a..f70a209 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -417,7 +417,8 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const { return QNetworkConfigurationManager::CanStartAndStopInterfaces | QNetworkConfigurationManager::DataStatistics | - QNetworkConfigurationManager::ForcedRoaming; + QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::NetworkSessionRequired; } QNetworkSessionPrivate *QIcdEngine::createSessionBackend() diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 980892a..4d65b80 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -184,7 +184,8 @@ QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const capFlags = QNetworkConfigurationManager::CanStartAndStopInterfaces | QNetworkConfigurationManager::DirectConnectionRouting | QNetworkConfigurationManager::SystemSessionSupport | - QNetworkConfigurationManager::DataStatistics; + QNetworkConfigurationManager::DataStatistics | + QNetworkConfigurationManager::NetworkSessionRequired; #ifdef SNAP_FUNCTIONALITY_AVAILABLE capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming | -- cgit v0.12 From 015ea6d3e6caeaac16b42dfe0e396d7f4e5f1f03 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 18 Mar 2010 15:00:59 +1000 Subject: Fix license headers. --- tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 41 ++++++++++++++++++++++++++ tests/manual/qtbug-8933/main.cpp | 41 ++++++++++++++++++++++++++ tests/manual/qtbug-8933/widget.cpp | 41 ++++++++++++++++++++++++++ tests/manual/qtbug-8933/widget.h | 41 ++++++++++++++++++++++++++ 4 files changed, 164 insertions(+) diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp index 5c3d4f8..912226d 100644 --- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include #include diff --git a/tests/manual/qtbug-8933/main.cpp b/tests/manual/qtbug-8933/main.cpp index 841b7c3..c5d8e4e 100644 --- a/tests/manual/qtbug-8933/main.cpp +++ b/tests/manual/qtbug-8933/main.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include #include "widget.h" diff --git a/tests/manual/qtbug-8933/widget.cpp b/tests/manual/qtbug-8933/widget.cpp index 47a440b..4120a8f 100644 --- a/tests/manual/qtbug-8933/widget.cpp +++ b/tests/manual/qtbug-8933/widget.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "widget.h" #include "ui_widget.h" diff --git a/tests/manual/qtbug-8933/widget.h b/tests/manual/qtbug-8933/widget.h index f6afa8f..01aa141 100644 --- a/tests/manual/qtbug-8933/widget.h +++ b/tests/manual/qtbug-8933/widget.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef WIDGET_H #define WIDGET_H -- cgit v0.12 From e5c386c39065c640b938b33994af28a6589e4523 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 18 Mar 2010 16:24:58 +1000 Subject: Build and run QElapsedTimer test. --- tests/auto/corelib.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/corelib.pro b/tests/auto/corelib.pro index c08e372..259be4c 100644 --- a/tests/auto/corelib.pro +++ b/tests/auto/corelib.pro @@ -24,6 +24,7 @@ SUBDIRS=\ qdebug \ qdiriterator \ qeasingcurve \ + qelapsedtimer \ qevent \ qexplicitlyshareddatapointer \ qfileinfo \ -- cgit v0.12 From f3ea09192a6f17d2f2b607272eb5ad2ba47536e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Thu, 18 Mar 2010 11:39:08 +0100 Subject: doc: Fixed use of Qt 3 support function in QIcon doc snippet isOn() is an Qt 3 support member of QAbstractButton, isChecked() should be used instead. --- doc/src/snippets/code/src_gui_image_qicon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/snippets/code/src_gui_image_qicon.cpp b/doc/src/snippets/code/src_gui_image_qicon.cpp index df1fa82..e0dcfa6 100644 --- a/doc/src/snippets/code/src_gui_image_qicon.cpp +++ b/doc/src/snippets/code/src_gui_image_qicon.cpp @@ -56,8 +56,8 @@ void MyWidget::drawIcon(QPainter *painter, QPoint pos) QPixmap pixmap = icon.pixmap(QSize(22, 22), isEnabled() ? QIcon::Normal : QIcon::Disabled, - isOn() ? QIcon::On - : QIcon::Off); + isChecked() ? QIcon::On + : QIcon::Off); painter->drawPixmap(pos, pixmap); } //! [2] -- cgit v0.12 From f3f979cbd37f47892cd0c0a9fc23b802ed6f7890 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 18 Mar 2010 10:25:38 +0100 Subject: Incorrect translation for Application menu items in Mac. A behavior change was introduced by the commit 97b8727635a73197fac4f5edb8a1122733933db4. The menu items with menuRoles will now be translated like Native Mac applications. Translations/merging of menu items are done as follows: 1) AboutRole ==> "About " 2) PreferencesRole ==> "Preferences..." 3) QuitRole ==> "Quit " Task-number: QTBUG-4463 Reviewed-by: mortens --- src/gui/kernel/qapplication.cpp | 7 ++++--- src/gui/kernel/qcocoamenuloader_mac.mm | 3 +++ src/gui/widgets/qmenu_mac.mm | 22 +++++++--------------- translations/qt_da.ts | 15 +++++++++++++++ translations/qt_de.ts | 15 +++++++++++++++ translations/qt_es.ts | 15 +++++++++++++++ translations/qt_fr.ts | 15 +++++++++++++++ translations/qt_ja_JP.ts | 15 +++++++++++++++ translations/qt_pl.ts | 15 +++++++++++++++ translations/qt_pt.ts | 15 +++++++++++++++ translations/qt_ru.ts | 15 +++++++++++++++ translations/qt_sv.ts | 15 +++++++++++++++ translations/qt_zh_CN.ts | 15 +++++++++++++++ translations/qt_zh_TW.ts | 15 +++++++++++++++ 14 files changed, 179 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index fea8c37..a2666f7 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2309,12 +2309,14 @@ static bool qt_detectRTLLanguage() " languages or to 'RTL' in right-to-left languages (such as Hebrew" " and Arabic) to get proper widget layout.") == QLatin1String("RTL")); } -#if defined(QT_MAC_USE_COCOA) static const char *application_menu_strings[] = { QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"), QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"), QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide Others"), - QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All") + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Show All"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Preferences..."), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Quit %1"), + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","About %1") }; QString qt_mac_applicationmenu_string(int type) { @@ -2322,7 +2324,6 @@ QString qt_mac_applicationmenu_string(int type) application_menu_strings[type]); } #endif -#endif /*!\reimp diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 35d156a..b58fd7c 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -231,6 +231,9 @@ QT_USE_NAMESPACE [hideItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(1).arg(qAppName()))]; [hideAllOthersItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(2))]; [showAllItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(3))]; + [preferencesItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(4))]; + [quitItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(5).arg(qAppName()))]; + [aboutItem setTitle: qt_mac_QStringToNSString(qt_mac_applicationmenu_string(6).arg(qAppName()))]; #endif } diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 627043d..9a14ce6 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -909,6 +909,7 @@ static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QMacMenuAction *act static QString qt_mac_menu_merge_text(QMacMenuAction *action) { QString ret; + extern QString qt_mac_applicationmenu_string(int type); #ifdef QT_MAC_USE_COCOA QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); #endif @@ -916,34 +917,25 @@ static QString qt_mac_menu_merge_text(QMacMenuAction *action) ret = action->action->text(); #ifndef QT_MAC_USE_COCOA else if (action->command == kHICommandAbout) - ret = QMenuBar::tr("About %1").arg(qAppName()); + ret = qt_mac_applicationmenu_string(6).arg(qAppName()); else if (action->command == kHICommandAboutQt) ret = QMenuBar::tr("About Qt"); else if (action->command == kHICommandPreferences) - ret = QMenuBar::tr("Preferences"); + ret = qt_mac_applicationmenu_string(4); else if (action->command == kHICommandQuit) - ret = QMenuBar::tr("Quit %1").arg(qAppName()); + ret = qt_mac_applicationmenu_string(5).arg(qAppName()); #else else if (action->menuItem == [loader aboutMenuItem]) { - if (action->action->text() == QString("About %1").arg(qAppName())) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(6).arg(qAppName()); } else if (action->menuItem == [loader aboutQtMenuItem]) { if (action->action->text() == QString("About Qt")) ret = QMenuBar::tr("About Qt"); else ret = action->action->text(); } else if (action->menuItem == [loader preferencesMenuItem]) { - if (action->action->text() == QString("Preferences")) - ret = QMenuBar::tr("Preferences"); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(4); } else if (action->menuItem == [loader quitMenuItem]) { - if (action->action->text() == QString("Quit %1").arg(qAppName())) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(5).arg(qAppName()); } #endif return ret; diff --git a/translations/qt_da.ts b/translations/qt_da.ts index 515ed50..6d52fc2 100644 --- a/translations/qt_da.ts +++ b/translations/qt_da.ts @@ -23,6 +23,21 @@ Show All Vis alle + + + Preferences... + Indstillinger… + + + + Quit %1 + Slut %1 + + + + About %1 + Om %1 + AudioOutput diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 2108774..6289834 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -23,6 +23,21 @@ Show All Alle anzeigen + + + Preferences... + Einstellungen … + + + + Quit %1 + %1 beenden + + + + About %1 + Über %1 + CloseButton diff --git a/translations/qt_es.ts b/translations/qt_es.ts index 596864a..4fa4762 100644 --- a/translations/qt_es.ts +++ b/translations/qt_es.ts @@ -23,6 +23,21 @@ Show All Mostrar todo + + + Preferences... + Preferencias… + + + + Quit %1 + Salir de %1 + + + + About %1 + Acerca de %1 + AudioOutput diff --git a/translations/qt_fr.ts b/translations/qt_fr.ts index 322fb65..7a69cbe 100644 --- a/translations/qt_fr.ts +++ b/translations/qt_fr.ts @@ -23,6 +23,21 @@ Show All Tout afficher + + + Preferences... + Préférences… + + + + Quit %1 + Quitter %1 + + + + About %1 + À propos de %1 + AudioOutput diff --git a/translations/qt_ja_JP.ts b/translations/qt_ja_JP.ts index f0dae3a..e6f92b7 100644 --- a/translations/qt_ja_JP.ts +++ b/translations/qt_ja_JP.ts @@ -23,6 +23,21 @@ Show All すべてを表示 + + + Preferences... + 環境設定... + + + + Quit %1 + %1 を終了 + + + + About %1 + %1 について + CloseButton diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts index bf6e1fe..db7d2c5 100644 --- a/translations/qt_pl.ts +++ b/translations/qt_pl.ts @@ -23,6 +23,21 @@ Show All Pokaż wszystko + + + Preferences... + Preferencje… + + + + Quit %1 + Zakończ %1 + + + + About %1 + %1… + CloseButton diff --git a/translations/qt_pt.ts b/translations/qt_pt.ts index 7ca7fe7..97afd4f 100644 --- a/translations/qt_pt.ts +++ b/translations/qt_pt.ts @@ -23,6 +23,21 @@ Show All Mostrar Tudo + + + Preferences... + Preferências… + + + + Quit %1 + Encerrar %1 + + + + About %1 + Sobre o %1 + AudioOutput diff --git a/translations/qt_ru.ts b/translations/qt_ru.ts index 641d7aa..e9cdfd4 100644 --- a/translations/qt_ru.ts +++ b/translations/qt_ru.ts @@ -23,6 +23,21 @@ Show All Показать все + + + Preferences... + Настройки… + + + + Quit %1 + Завершить %1 + + + + About %1 + О программе %1 + CloseButton diff --git a/translations/qt_sv.ts b/translations/qt_sv.ts index 391af4a..d4c8977 100644 --- a/translations/qt_sv.ts +++ b/translations/qt_sv.ts @@ -23,6 +23,21 @@ Show All Visa alla + + + Preferences... + Inställningar… + + + + Quit %1 + Avsluta %1 + + + + About %1 + Om %1 + AudioOutput diff --git a/translations/qt_zh_CN.ts b/translations/qt_zh_CN.ts index d6a995d..df23f43 100644 --- a/translations/qt_zh_CN.ts +++ b/translations/qt_zh_CN.ts @@ -23,6 +23,21 @@ Show All 全部显示 + + + Preferences... + 偏好设置… + + + + Quit %1 + 退出 %1 + + + + About %1 + 关于 %1 + AudioOutput diff --git a/translations/qt_zh_TW.ts b/translations/qt_zh_TW.ts index 50c0048..b29c879 100644 --- a/translations/qt_zh_TW.ts +++ b/translations/qt_zh_TW.ts @@ -23,6 +23,21 @@ Show All 顯示全部 + + + Preferences... + 偏好設定⋯ + + + + Quit %1 + 結束 %1 + + + + About %1 + 關於 %1 + AudioOutput -- cgit v0.12 From a6b28b13331117c6beec96ddcdcd727550d77343 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 18 Mar 2010 12:41:09 +0100 Subject: Minor update for f3f979cbd37f47892cd0c0a9fc23b802ed6f7890 The function is needed only on Mac. Task-number: QTBUG-4463 Reviewed-by: TrustMe --- src/gui/kernel/qapplication.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index a2666f7..003fd4c 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2309,6 +2309,7 @@ static bool qt_detectRTLLanguage() " languages or to 'RTL' in right-to-left languages (such as Hebrew" " and Arabic) to get proper widget layout.") == QLatin1String("RTL")); } +#if defined(Q_WS_MAC) static const char *application_menu_strings[] = { QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Services"), QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU","Hide %1"), @@ -2324,6 +2325,7 @@ QString qt_mac_applicationmenu_string(int type) application_menu_strings[type]); } #endif +#endif /*!\reimp -- cgit v0.12 From 109efebab1420270d824fd419bf0b2f2cb9d01b9 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Thu, 18 Mar 2010 11:25:05 +0100 Subject: Fix JSC export macros If we're building QtScript, we want the JS_EXPORTDATA and JS_EXPORTCLASS to expand to nothing. This avoids the macros being redefined (incorrectly) on MSVC. --- src/3rdparty/javascriptcore/JavaScriptCore/config.h | 2 +- src/script/script.pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/config.h b/src/3rdparty/javascriptcore/JavaScriptCore/config.h index d5fdfe9..2af2e71 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/config.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/config.h @@ -25,7 +25,7 @@ #include -#if OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) +#if !defined(QT_BUILD_SCRIPT_LIB) && OS(WINDOWS) && !defined(BUILDING_WX__) && !COMPILER(GCC) #if defined(BUILDING_JavaScriptCore) || defined(BUILDING_WTF) #define JS_EXPORTDATA __declspec(dllexport) #else diff --git a/src/script/script.pro b/src/script/script.pro index df5dbf3..2a74a66 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -73,7 +73,7 @@ solaris-g++:isEqual(QT_ARCH,sparc) { } # Avoid JSC C API functions being exported. -DEFINES += JS_NO_EXPORT JS_EXPORTDATA="" +DEFINES += JS_NO_EXPORT INCLUDEPATH += $$PWD -- cgit v0.12 From 371cab1c2da691c654b2f86a4cabfd4f74f6b170 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Thu, 18 Mar 2010 14:40:43 +0100 Subject: Fixed qmdiarea autotest regression on Cocoa This is an addition to 4256bd2141fef53f9e69a51b966bd85f67a6cf54 - when Cocoa asks as to become first responder we should only tell Qt about it if we are embedded into Cocoa app and there is no Qt widget being focused. Reviewed-by: Prasanth --- src/gui/kernel/qcocoaview_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 0bc57e0..0e378f9 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1058,7 +1058,8 @@ static int qCocoaViewCount = 0; { // see the comment in the acceptsFirstResponder - if the window "stole" focus // let it become the responder, but don't tell Qt - if (!QApplication::focusWidget() && qwidget->focusPolicy() != Qt::NoFocus) + if (qwidget && qt_widget_private(qwidget->window())->topData()->embedded + && !QApplication::focusWidget() && qwidget->focusPolicy() != Qt::NoFocus) qwidget->setFocus(Qt::OtherFocusReason); return YES; } -- cgit v0.12 From b19899f81cb7ac3b35e5fad3af777e89f1627474 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 18 Mar 2010 14:52:47 +0100 Subject: Add Japanese/Korean keyboard specific keys to QKeySequence QKeySequence didn't handle keys like Qt::Key_Zenkaku_Hankaku. Such keys didn't work as shortcut in Qt Creator. Merge-request: 496 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qkeysequence.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 7f92a2c..9efcc4e 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -580,6 +580,41 @@ static const struct { { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, + // -------------------------------------------------------------- + // Japanese keyboard support + { Qt::Key_Kanji, QT_TRANSLATE_NOOP("QShortcut", "Kanji") }, + { Qt::Key_Muhenkan, QT_TRANSLATE_NOOP("QShortcut", "Muhenkan") }, + { Qt::Key_Henkan, QT_TRANSLATE_NOOP("QShortcut", "Henkan") }, + { Qt::Key_Romaji, QT_TRANSLATE_NOOP("QShortcut", "Romaji") }, + { Qt::Key_Hiragana, QT_TRANSLATE_NOOP("QShortcut", "Hiragana") }, + { Qt::Key_Katakana, QT_TRANSLATE_NOOP("QShortcut", "Katakana") }, + { Qt::Key_Hiragana_Katakana,QT_TRANSLATE_NOOP("QShortcut", "Hiragana Katakana") }, + { Qt::Key_Zenkaku, QT_TRANSLATE_NOOP("QShortcut", "Zenkaku") }, + { Qt::Key_Hankaku, QT_TRANSLATE_NOOP("QShortcut", "Hankaku") }, + { Qt::Key_Zenkaku_Hankaku, QT_TRANSLATE_NOOP("QShortcut", "Zenkaku Hankaku") }, + { Qt::Key_Touroku, QT_TRANSLATE_NOOP("QShortcut", "Touroku") }, + { Qt::Key_Massyo, QT_TRANSLATE_NOOP("QShortcut", "Massyo") }, + { Qt::Key_Kana_Lock, QT_TRANSLATE_NOOP("QShortcut", "Kana Lock") }, + { Qt::Key_Kana_Shift, QT_TRANSLATE_NOOP("QShortcut", "Kana Shift") }, + { Qt::Key_Eisu_Shift, QT_TRANSLATE_NOOP("QShortcut", "Eisu Shift") }, + { Qt::Key_Eisu_toggle, QT_TRANSLATE_NOOP("QShortcut", "Eisu toggle") }, + { Qt::Key_Codeinput, QT_TRANSLATE_NOOP("QShortcut", "Code input") }, + { Qt::Key_MultipleCandidate,QT_TRANSLATE_NOOP("QShortcut", "Multiple Candidate") }, + { Qt::Key_PreviousCandidate,QT_TRANSLATE_NOOP("QShortcut", "Previous Candidate") }, + + // -------------------------------------------------------------- + // Korean keyboard support + { Qt::Key_Hangul, QT_TRANSLATE_NOOP("QShortcut", "Hangul") }, + { Qt::Key_Hangul_Start, QT_TRANSLATE_NOOP("QShortcut", "Hangul Start") }, + { Qt::Key_Hangul_End, QT_TRANSLATE_NOOP("QShortcut", "Hangul End") }, + { Qt::Key_Hangul_Hanja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Hanja") }, + { Qt::Key_Hangul_Jamo, QT_TRANSLATE_NOOP("QShortcut", "Hangul Jamo") }, + { Qt::Key_Hangul_Romaja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Romaja") }, + { Qt::Key_Hangul_Jeonja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Jeonja") }, + { Qt::Key_Hangul_Banja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Banja") }, + { Qt::Key_Hangul_PreHanja, QT_TRANSLATE_NOOP("QShortcut", "Hangul PreHanja") }, + { Qt::Key_Hangul_PostHanja,QT_TRANSLATE_NOOP("QShortcut", "Hangul PostHanja") }, + { Qt::Key_Hangul_Special, QT_TRANSLATE_NOOP("QShortcut", "Hangul Special") }, { 0, 0 } }; -- cgit v0.12 From b0eeea8a2ff13e1449dd98ef5c43c1c89e2e357b Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 18 Mar 2010 14:52:49 +0100 Subject: Add a test case for commit 76d767080a6be7b025f36d6778dfaedbd31a9f07 Merge-request: 496 Reviewed-by: Denis Dzyubenko --- tests/auto/qkeysequence/tst_qkeysequence.cpp | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index b1ef223..1faae6a 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -134,6 +134,8 @@ private slots: void keyBindings(); void translated_data(); void translated(); + void i18nKeys_data(); + void i18nKeys(); void initTestCase(); @@ -570,5 +572,55 @@ void tst_QKeySequence::translated() } +void tst_QKeySequence::i18nKeys_data() +{ + QTest::addColumn("keycode"); + QTest::addColumn("keystring"); + + // Japanese keyboard support + QTest::newRow("Kanji") << (int)Qt::Key_Kanji << QString("Kanji"); + QTest::newRow("Muhenkan") << (int)Qt::Key_Muhenkan << QString("Muhenkan"); + QTest::newRow("Henkan") << (int)Qt::Key_Henkan << QString("Henkan"); + QTest::newRow("Romaji") << (int)Qt::Key_Romaji << QString("Romaji"); + QTest::newRow("Hiragana") << (int)Qt::Key_Hiragana << QString("Hiragana"); + QTest::newRow("Katakana") << (int)Qt::Key_Katakana << QString("Katakana"); + QTest::newRow("Hiragana Katakana") << (int)Qt::Key_Hiragana_Katakana << QString("Hiragana Katakana"); + QTest::newRow("Zenkaku") << (int)Qt::Key_Zenkaku << QString("Zenkaku"); + QTest::newRow("Hankaku") << (int)Qt::Key_Hankaku << QString("Hankaku"); + QTest::newRow("Zenkaku Hankaku") << (int)Qt::Key_Zenkaku_Hankaku << QString("Zenkaku Hankaku"); + QTest::newRow("Touroku") << (int)Qt::Key_Touroku << QString("Touroku"); + QTest::newRow("Massyo") << (int)Qt::Key_Massyo << QString("Massyo"); + QTest::newRow("Kana Lock") << (int)Qt::Key_Kana_Lock << QString("Kana Lock"); + QTest::newRow("Kana Shift") << (int)Qt::Key_Kana_Shift << QString("Kana Shift"); + QTest::newRow("Eisu Shift") << (int)Qt::Key_Eisu_Shift << QString("Eisu Shift"); + QTest::newRow("Eisu_toggle") << (int)Qt::Key_Eisu_toggle << QString("Eisu toggle"); + QTest::newRow("Code input") << (int)Qt::Key_Codeinput << QString("Code input"); + QTest::newRow("Multiple Candidate") << (int)Qt::Key_MultipleCandidate << QString("Multiple Candidate"); + QTest::newRow("Previous Candidate") << (int)Qt::Key_PreviousCandidate << QString("Previous Candidate"); + + // Korean keyboard support + QTest::newRow("Hangul") << (int)Qt::Key_Hangul << QString("Hangul"); + QTest::newRow("Hangul Start") << (int)Qt::Key_Hangul_Start << QString("Hangul Start"); + QTest::newRow("Hangul End") << (int)Qt::Key_Hangul_End << QString("Hangul End"); + QTest::newRow("Hangul Hanja") << (int)Qt::Key_Hangul_Hanja << QString("Hangul Hanja"); + QTest::newRow("Hangul Jamo") << (int)Qt::Key_Hangul_Jamo << QString("Hangul Jamo"); + QTest::newRow("Hangul Romaja") << (int)Qt::Key_Hangul_Romaja << QString("Hangul Romaja"); + QTest::newRow("Hangul Jeonja") << (int)Qt::Key_Hangul_Jeonja << QString("Hangul Jeonja"); + QTest::newRow("Hangul Banja") << (int)Qt::Key_Hangul_Banja << QString("Hangul Banja"); + QTest::newRow("Hangul PreHanja") << (int)Qt::Key_Hangul_PreHanja << QString("Hangul PreHanja"); + QTest::newRow("Hangul PostHanja") << (int)Qt::Key_Hangul_PostHanja << QString("Hangul PostHanja"); + QTest::newRow("Hangul Special") << (int)Qt::Key_Hangul_Special << QString("Hangul Special"); +} + +void tst_QKeySequence::i18nKeys() +{ + QFETCH(int, keycode); + QFETCH(QString, keystring); + QKeySequence seq(keycode); + + QCOMPARE(seq, QKeySequence(keystring)); + QCOMPARE(seq.toString(), keystring); +} + QTEST_MAIN(tst_QKeySequence) #include "tst_qkeysequence.moc" -- cgit v0.12 From 49542b562cd5ed0f64fcd1705595f05700e16400 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 18 Mar 2010 15:58:46 +0100 Subject: Redesigned filter widgets I redesigned the filter widget so that the reset button is contained within the line edit and only shown when edited. This is typically what KDE and GNOME does. The base icon also changed to use platform dependant icons on X11 and a new clear icon for other platforms. Since hinttext is now a feature of QLineEdit, I could safely remove this code as well. Unfortunately Oxygen is reporting incorrect contents margins for line edits. In essence it incorrectly offsets the frame so I had to add some magic to support that in particular. Reviewed-by: ogoffart --- .../src/components/formeditor/formeditor.qrc | 1 + .../src/components/formeditor/images/cleartext.png | Bin 0 -> 760 bytes tools/designer/src/lib/shared/filterwidget.cpp | 163 ++++++++++++--------- tools/designer/src/lib/shared/filterwidget_p.h | 52 ++++--- 4 files changed, 116 insertions(+), 100 deletions(-) create mode 100644 tools/designer/src/components/formeditor/images/cleartext.png diff --git a/tools/designer/src/components/formeditor/formeditor.qrc b/tools/designer/src/components/formeditor/formeditor.qrc index 83cc9c7..6510814 100644 --- a/tools/designer/src/components/formeditor/formeditor.qrc +++ b/tools/designer/src/components/formeditor/formeditor.qrc @@ -63,6 +63,7 @@ images/qtlogo.png images/qt3logo.png images/resetproperty.png + images/cleartext.png images/sort.png images/edit.png images/reload.png diff --git a/tools/designer/src/components/formeditor/images/cleartext.png b/tools/designer/src/components/formeditor/images/cleartext.png new file mode 100644 index 0000000..74133ba Binary files /dev/null and b/tools/designer/src/components/formeditor/images/cleartext.png differ diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index 6c73a08..84810cb 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -44,13 +44,17 @@ #include #include -#include #include #include #include #include +#include +#include +#include +#include #include +#include enum { debugFilter = 0 }; @@ -61,12 +65,44 @@ namespace qdesigner_internal { HintLineEdit::HintLineEdit(QWidget *parent) : QLineEdit(parent), m_defaultFocusPolicy(focusPolicy()), - m_hintColor(QColor(0xbbbbbb)), - m_refuseFocus(false), - m_showingHintText(false) + m_refuseFocus(false) { } +IconButton::IconButton(QWidget *parent) + : QToolButton(parent) +{ + setCursor(Qt::ArrowCursor); +} + +void IconButton::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + // Note isDown should really use the active state but in most styles + // this has no proper feedback + QPixmap iconpixmap = icon().pixmap(ICONBUTTON_SIZE, ICONBUTTON_SIZE, isDown() ? + QIcon::Selected : QIcon::Normal); + QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height()); + pixmapRect.moveCenter(rect().center()); + painter.setOpacity(m_fader); + painter.drawPixmap(pixmapRect, iconpixmap); +} + +void IconButton::animateShow(bool visible) +{ + if (visible) { + QPropertyAnimation *animation = new QPropertyAnimation(this, "fader"); + animation->setDuration(160); + animation->setEndValue(1.0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } else { + QPropertyAnimation *animation = new QPropertyAnimation(this, "fader"); + animation->setDuration(160); + animation->setEndValue(0.0); + animation->start(QAbstractAnimation::DeleteWhenStopped); + } +} + bool HintLineEdit::refuseFocus() const { return m_refuseFocus; @@ -111,92 +147,60 @@ void HintLineEdit::focusInEvent(QFocusEvent *e) } } - hideHintText(); QLineEdit::focusInEvent(e); } -void HintLineEdit::focusOutEvent(QFocusEvent *e) +// ------------------- FilterWidget +FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : + QWidget(parent), + m_editor(new HintLineEdit(this)), + m_button(new IconButton(m_editor)), + m_buttonwidth(0) { - if (debugFilter) - qDebug() << Q_FUNC_INFO; - // Focus out: Switch to displaying the hint text unless there is user input - showHintText(); - QLineEdit::focusOutEvent(e); -} + m_editor->setPlaceholderText(tr("Filter")); -QString HintLineEdit::hintText() const -{ - return m_hintText; -} + // Let the style determine minimum height for our widget + QSize size(ICONBUTTON_SIZE + 2, ICONBUTTON_SIZE + 2); -void HintLineEdit::setHintText(const QString &ht) -{ - if (ht == m_hintText) - return; - hideHintText(); - m_hintText = ht; - if (!hasFocus() && !ht.isEmpty()) - showHintText(); -} + QStyleOptionFrame frameOpt; + frameOpt.initFrom(m_editor); + QSize adjustedSize = style()->sizeFromContents(QStyle::CT_LineEdit, &frameOpt, size, m_editor); -void HintLineEdit::showHintText(bool force) -{ - if (m_showingHintText || m_hintText.isEmpty()) - return; - if (force || text().isEmpty()) { - m_showingHintText = true; - setText(m_hintText); - setTextColor(m_hintColor, &m_textColor); - } -} -void HintLineEdit::hideHintText() -{ - if (m_showingHintText && !m_hintText.isEmpty()) { - m_showingHintText = false; - setText(QString()); - setTextColor(m_textColor); + // Note KDE does not reserve space for the highlight color + if (style()->inherits("OxygenStyle")) { + adjustedSize = adjustedSize.expandedTo(QSize(0, 32)); + size = size.expandedTo(QSize(24, 0)); } -} -bool HintLineEdit::isShowingHintText() const -{ - return m_showingHintText; -} + m_editor->setMinimumHeight(adjustedSize.height()); -QString HintLineEdit::typedText() const -{ - return m_showingHintText ? QString() : text(); -} + // Make room for clear icon + QMargins margins = m_editor->textMargins(); + if (layoutDirection() == Qt::LeftToRight) + margins.setRight(size.width()); + else + margins.setLeft(size.width()); -void HintLineEdit::setTextColor(const QColor &newColor, QColor *oldColor) -{ - QPalette pal = palette(); - if (oldColor) - *oldColor = pal.color(QPalette::Text); - pal.setColor(QPalette::Text, newColor); - setPalette(pal);} + m_editor->setTextMargins(margins); -// ------------------- FilterWidget -FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : - QWidget(parent), - m_button(new QPushButton), - m_editor(new HintLineEdit) -{ - m_editor->setHintText(tr("")); QHBoxLayout *l = new QHBoxLayout(this); l->setMargin(0); l->setSpacing(0); - if (lm == LayoutAlignRight) l->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum)); l->addWidget(m_editor); - m_button->setIcon(createIconSet(QLatin1String("resetproperty.png"))); - m_button->setIconSize(QSize(8, 8)); - m_button->setFlat(true); - l->addWidget(m_button); + // KDE has custom icons for this. Notice that icon namings are counter intuitive + // If these icons are not avaiable we use the freedesktop standard name before + // falling back to a bundled resource + QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ? + QLatin1String("edit-clear-locationbar-rtl") : + QLatin1String("edit-clear-locationbar-ltr"), + QIcon::fromTheme("edit-clear", createIconSet(QLatin1String("cleartext.png")))); + m_button->setIcon(icon); + m_button->setToolTip(tr("Clear text")); connect(m_button, SIGNAL(clicked()), this, SLOT(reset())); connect(m_editor, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString))); connect(m_editor, SIGNAL(textEdited(QString)), this, SIGNAL(filterChanged(QString))); @@ -204,25 +208,38 @@ FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : QString FilterWidget::text() const { - return m_editor->typedText(); + return m_editor->text(); } void FilterWidget::checkButton(const QString &) { - m_button->setEnabled(!text().isEmpty()); + m_button->animateShow(!m_editor->text().isEmpty()); } void FilterWidget::reset() { if (debugFilter) qDebug() << Q_FUNC_INFO; - if (!text().isEmpty()) { + + if (!m_editor->text().isEmpty()) { // Editor has lost focus once this is pressed - m_editor->showHintText(true); + m_editor->clear(); emit filterChanged(QString()); } } +void FilterWidget::resizeEvent(QResizeEvent *) +{ + QRect contentRect = m_editor->rect(); + if (layoutDirection() == Qt::LeftToRight) { + const int iconoffset = m_editor->textMargins().right() + 4; + m_button->setGeometry(contentRect.adjusted(m_editor->width() - iconoffset, 0, 0, 0)); + } else { + const int iconoffset = m_editor->textMargins().left() + 4; + m_button->setGeometry(contentRect.adjusted(0, 0, -m_editor->width() + iconoffset, 0)); + } +} + bool FilterWidget::refuseFocus() const { return m_editor->refuseFocus(); diff --git a/tools/designer/src/lib/shared/filterwidget_p.h b/tools/designer/src/lib/shared/filterwidget_p.h index 025d708..423b30e 100644 --- a/tools/designer/src/lib/shared/filterwidget_p.h +++ b/tools/designer/src/lib/shared/filterwidget_p.h @@ -58,58 +58,55 @@ #include #include #include +#include QT_BEGIN_NAMESPACE -class QPushButton; +class QToolButton; namespace qdesigner_internal { -/* A line edit that displays a grayed hintText (like "Type Here to Filter") - * when not focused and empty. When connecting to the changed signals and - * querying text, one has to be aware that the text is set to that hint - * text if isShowingHintText() returns true (that is, does not contain - * valid user input). This widget should never have initial focus +/* This widget should never have initial focus * (ie, be the first widget of a dialog, else, the hint cannot be displayed. * For situations, where it is the only focusable control (widget box), * there is a special "refuseFocus()" mode, in which it clears the focus * policy and focusses explicitly on click (note that setting Qt::ClickFocus * is not sufficient for that as an ActivationFocus will occur). */ +#define ICONBUTTON_SIZE 16 + class QDESIGNER_SHARED_EXPORT HintLineEdit : public QLineEdit { Q_OBJECT public: explicit HintLineEdit(QWidget *parent = 0); - QString hintText() const; - - bool isShowingHintText() const; - - // Convenience for accessing the text that returns "" in case of isShowingHintText(). - QString typedText() const; - bool refuseFocus() const; void setRefuseFocus(bool v); -public slots: - void setHintText(const QString &ht); - void showHintText(bool force = false); - void hideHintText(); - protected: virtual void mousePressEvent(QMouseEvent *event); virtual void focusInEvent(QFocusEvent *e); - virtual void focusOutEvent(QFocusEvent *e); private: - void setTextColor(const QColor &newColor, QColor *oldColor = 0); - const Qt::FocusPolicy m_defaultFocusPolicy; - const QColor m_hintColor; - QColor m_textColor; bool m_refuseFocus; - QString m_hintText; - bool m_showingHintText; +}; + +// IconButton: This is a simple helper class that represents clickable icons + +class IconButton: public QToolButton +{ + Q_OBJECT + Q_PROPERTY(float fader READ fader WRITE setFader) +public: + IconButton(QWidget *parent); + void paintEvent(QPaintEvent *event); + float fader() { return m_fader; } + void setFader(float value) { m_fader = value; update(); } + void animateShow(bool visible); + +private: + float m_fader; }; // FilterWidget: For filtering item views, with reset button Uses HintLineEdit. @@ -128,7 +125,7 @@ public: explicit FilterWidget(QWidget *parent = 0, LayoutMode lm = LayoutAlignRight); QString text() const; - + void resizeEvent(QResizeEvent *); bool refuseFocus() const; // see HintLineEdit void setRefuseFocus(bool v); @@ -142,8 +139,9 @@ private slots: void checkButton(const QString &text); private: - QPushButton *m_button; HintLineEdit *m_editor; + IconButton *m_button; + int m_buttonwidth; }; } // namespace qdesigner_internal -- cgit v0.12 From 39fa20a6d9b91ae5c266d1232f9f051ecd37b39d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 Mar 2010 16:46:59 +0100 Subject: 10n: Update German translation for 4.7.0 Complete QML, spell-check and purge. --- translations/qt_de.ts | 10070 ++++++++++++++++++++++++------------------------ 1 file changed, 5082 insertions(+), 4988 deletions(-) diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 6289834..ec7e786 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -2,9 +2,30 @@ + CloseButton + + + Close Tab + Schließen + + + + FakeReply + + + Fake error ! + Fake error ! + + + + Invalid URL + Ungültige URL + + + MAC_APPLICATION_MENU - + Services Dienste @@ -23,49 +44,13 @@ Show All Alle anzeigen - - - Preferences... - Einstellungen … - - - - Quit %1 - %1 beenden - - - - About %1 - Über %1 - - - - CloseButton - - - Close Tab - Schließen - - - - FakeReply - - - Fake error ! - Fake error ! - - - - Invalid URL - Ungültige URL - Phonon:: Notifications - Benachrichtungen + Benachrichtigungen @@ -191,7 +176,7 @@ Bitte überprüfen Sie Ihre GStreamer-Installation und stellen Sie sicher, dass Audio-Ausgabegerät - + No error Kein Fehler @@ -1224,7 +1209,7 @@ nach QAbstractSocket - + @@ -1246,13 +1231,13 @@ nach - + Operation on socket is not supported Diese Socket-Operation wird nicht unterstützt - - + + Socket operation timed out Das Zeitlimit für die Operation wurde überschritten @@ -1270,7 +1255,7 @@ nach QAbstractSpinBox - + &Step up &Inkrementieren @@ -1296,7 +1281,7 @@ nach QApplication - + QT_LAYOUT_DIRECTION Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout. LTR @@ -1366,7 +1351,7 @@ nach QColorDialog - + Hu&e: Farb&ton: @@ -1571,2335 +1556,2310 @@ nach - QDial - - - QDial - QDial - + QDeclarativeAbstractAnimation - - SpeedoMeter - Tachometer + + Cannot animate non-existent property "%1" + Die Eigenschaft '%1" existiert nicht und kann daher nicht animiert werden - - SliderHandle - Schieberegler + + Cannot animate read-only property "%1" + Die Eigenschaft '%1" ist schreibgeschützt und kann daher nicht animiert werden - QDialog + QDeclarativeAnchors - - What's This? - Direkthilfe + + Possible anchor loop detected on fill. + Bei der Fülloperation wurde eine potentielle Endlosschleife der Anker festgestellt. - - Done - Fertig + + Possible anchor loop detected on centerIn. + Bei der Operation 'centerIn' wurde eine potentielle Endlosschleife der Anker festgestellt. - - - QDialogButtonBox - - - - OK - OK + + + + + Cannot anchor to an item that isn't a parent or sibling. + Das Ziel eines Anker muss ein Elternelement oder Element der gleichen Ebene sein. - - Save - Speichern + + Possible anchor loop detected on vertical anchor. + Bei einem vertikalen Anker wurde eine potentielle Endlosschleife der Anker festgestellt. - - &Save - S&peichern + + Possible anchor loop detected on horizontal anchor. + Bei einem horizontalen Anker wurde eine potentielle Endlosschleife der Anker festgestellt. - - Open - Öffnen + + Cannot specify left, right, and hcenter anchors. + Ankerangaben für links, rechts und horizontal zentriert dürfen nicht zusammen auftreten. - - Cancel - Abbrechen + + + Cannot anchor to a null item. + Es kann kein Anker zu einem Null-Element angegeben werden. - - &Cancel - &Abbrechen + + Cannot anchor a horizontal edge to a vertical edge. + Es kann kein Anker zu einer horizontalen oder vertikalen Kante angegeben werden. - - Close - Schließen + + + Cannot anchor item to self. + Ein Element kann keinen Anker zu sich selbst haben. - - &Close - Schl&ießen + + Cannot specify top, bottom, and vcenter anchors. + Ankerangaben für oben, unten und vertikal zentriert dürfen nicht zusammen auftreten. - - Apply - Anwenden + + Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors. + Ein Baseline-Anker darf nicht mit zusammen mit weiteren Ankerangaben für oben, unten und vertikal zentriert verwendet werden. - - Reset - Zurücksetzen + + Cannot anchor a vertical edge to a horizontal edge. + Vertikale und horizontale Kanten können nicht mit Ankern verbunden werden. + + + QDeclarativeBehavior - - Help - Hilfe + + Cannot change the animation assigned to a Behavior. + Die zu einem Behavior-Element gehörende Animation kann nicht geändert werden. + + + QDeclarativeBinding - - Don't Save - Nicht speichern + + Binding loop detected for property "%1" + Bei der für die Eigenschaft "%1" angegebenen Bindung wurde eine Endlosschleife festgestellt + + + QDeclarativeCompiler - - Discard - Verwerfen + + + + + + Invalid property assignment: "%1" is a read-only property + Ungültige Zuweisung bei Eigenschaft: "%1" ist schreibgeschützt - - &Yes - &Ja + + Invalid property assignment: unknown enumeration + Ungültige Zuweisung bei Eigenschaft: Ungültiger Aufzählungswert - - Yes to &All - Ja, &alle + + Invalid property assignment: string expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeichenkette erwartet - &No - &Nein + Invalid property assignment: url expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine URL erwartet - - N&o to All - N&ein, keine + + Invalid property assignment: unsigned int expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine vorzeichenloser Ganzzahlwert erwartet - - Save All - Alles speichern + + Invalid property assignment: int expected + Ungültige Zuweisung bei Eigenschaft: Es wird ein Ganzzahlwert erwartet - - Abort - Abbrechen + + Invalid property assignment: float expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl erwartet - - Retry - Wiederholen + + Invalid property assignment: double expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl (double) erwartet - - Ignore - Ignorieren + + Invalid property assignment: color expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Farbspezifikation erwartet - - Restore Defaults - Voreinstellungen + + Invalid property assignment: date expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet - - Close without Saving - Schließen ohne Speichern + + Invalid property assignment: time expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeitangabe erwartet - - &OK - &OK + + Invalid property assignment: datetime expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet - - - QDirModel - - Name - Name + + Invalid property assignment: point expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Koordinatenangabe für einen Punkt erwartet - - Size - Größe + + Invalid property assignment: size expected + Ungültige Zuweisung bei Eigenschaft: Es wird eine Größenangabe erwartet - - Kind - Match OS X Finder - Art + + Invalid property assignment: rect expected + Ungültige Zuweisung bei Eigenschaft: Es werden Parameter für ein Rechteck erwartet - - Type - All other platforms - Typ + + Invalid property assignment: boolean expected + Ungültige Zuweisung bei Eigenschaft: Es wird ein Boolescher Wert erwartet - - Date Modified - Änderungsdatum + + Invalid property assignment: 3D vector expected + Ungültige Zuweisung bei Eigenschaft: Es wird ein dreidimensionaler Vektor erwartet - - - QDockWidget - - Close - Schließen + + Invalid property assignment: unsupported type "%1" + Ungültige Zuweisung bei Eigenschaft: Der Typ "%1" ist nicht unterstützt - - Dock - Andocken + + Element is not creatable. + Das Element kann nicht erzeugt werden. - - Float - Herauslösen + + Component elements may not contain properties other than id + Komponenten dürfen außer id keine weiteren Eigenschaften enthalten. - - - QDoubleSpinBox - - More - Mehr + + Component elements may not contain script blocks + Komponenten dürfen keine Skripte enthalten - - Less - Weniger + + Invalid component id specification + Ungültige Komponentenspezifikation - - - QErrorMessage - - &Show this message again - Diese Meldung wieder an&zeigen + + + id is not unique + ID-Wert nicht eindeutig - - &OK - &OK + + Invalid component body specification + Inhalt der Komponente ungültig - - Debug Message: - Debug-Ausgabe: + + Cannot create empty component specification + Es kann keine leere Komponentenangabe erzeugt werden - - Warning: - Achtung: + + Invalid Script block. Specify either the source property or inline script + Ungültiges Skript. Es muss die Eigenschaft oder ein eingebettetes Skript angegeben werden - - Fatal Error: - Fehler: + + Invalid Script source value + Ungültige Angabe für Skript - - - QFile - - - Destination file exists - Die Zieldatei existiert bereits + + Properties cannot be set on Script block + Für ein Skript können keine Eigenschaften angegeben werden - - Will not rename sequential file using block copy - Eine sequentielle Datei kann nicht durch blockweises Kopieren umbenannt werden + + Invalid Script block + Ungültiges Skript - - Cannot remove source file - Die Quelldatei kann nicht entfernt werden + + Incorrectly specified signal + Ungültige Signalspezifikation - - Cannot open %1 for input - %1 kann nicht zum Lesen geöffnet werden + + Empty signal assignment + Leere Signalzuweisung - - Cannot open for output - Das Öffnen zum Schreiben ist fehlgeschlagen + + Empty property assignment + Leere Eigenschaftszuweisung - - Failure to write block - Der Datenblock konnte nicht geschrieben werden + + Attached properties cannot be used here + An dieser Stelle können keine Eigenschaften des Typs 'attached' verwendet werden - - Cannot create %1 for output - %1 kann nicht erstellt werden + + + Non-existent attached object + Es existiert kein Bezugselement für die Eigenschaft - - - QFileDialog - - - All Files (*) - Alle Dateien (*) + + + Invalid attached object assignment + Ungültige Zuweisung des Bezugselements - - - Back - Zurück + + Cannot assign to non-existent default property + Es kann keine Zuweisung erfolgen, da keine Vorgabe-Eigenschaft existiert - - - List View - Liste + + + Cannot assign to non-existent property "%1" + Es kann keine Zuweisung erfolgen, da keine Eigenschaft des Namens '%1" existiert - - - Detail View - Details + + Invalid use of namespace + Ungültige Verwendung eines Namensraums - - - File - Datei + + Not an attached property name + Kein gültiger Name einer Eigenschaft des Typs 'attached' - - Open - Öffnen + + Invalid use of id property + Ungültige Verwendung einer Eigenschaft des Typs 'Id' + + + + id conflicts with type name + Der Wert der Id ist ungültig, da er bereits als Typnamen vergeben ist - Save As - Speichern unter + id conflicts with namespace prefix + Der Wert der Id ist ungültig, da er bereits als Namensraum vergeben ist - - - - &Open - &Öffnen + + + Property has already been assigned a value + Der Eigenschaft wurde bereits ein Wert zugewiesen - - - &Save - S&peichern + + + Invalid grouped property access + Falsche Gruppierung bei Zugriff auf Eigenschaft - - Recent Places - Zuletzt besucht + + Cannot assign a value directly to a grouped property + Bei einer Eigenschaft, die Teil einer Gruppierung ist, ist keine direkte Wertzuweisung zulässig - - &Rename - &Umbenennen + + Invalid property use + Ungültige Verwendung von Eigenschaften - - &Delete - &Löschen + + Property assignment expected + Zuweisung an Eigenschaft erwartet - - Show &hidden files - &Versteckte Dateien anzeigen + + Single property assignment expected + Einzelne Zuweisung an Eigenschaft erwartet - - New Folder - Neues Verzeichnis + + Unexpected object assignment + Zuweisung des Objekts nicht zulässig - - Find Directory - Verzeichnis suchen + + Cannot assign object to list + Zuweisung eines Objekts an eine Liste nicht zulässig - - Directories - Verzeichnisse + + Can only assign one binding to lists + Listen kann nur eine einzige Bindung zugewiesen werden - - All Files (*.*) - Alle Dateien (*.*) + + Cannot assign primitives to lists + Zuweisung eines einfachen Werts (primitive) an eine Liste nicht zulässig - - - Directory: - Verzeichnis: + + Cannot assign multiple values to a script property + Eine Zuweisung mehrerer Werte an eine Skript-Eigenschaft ist nicht zulässig - - %1 already exists. -Do you want to replace it? - Die Datei %1 existiert bereits. -Soll sie überschrieben werden? + + Invalid property assignment: script expected + Ungültige Zuweisung bei Eigenschaft: Es wird ein Skript erwartet - - %1 -File not found. -Please verify the correct file name was given. - %1 -Die Datei konnte nicht gefunden werden. -Stellen Sie sicher, dass der Dateiname richtig ist. + + Cannot assign object to property + Zuweisung eines Objekts an eine Eigenschaft nicht zulässig - - My Computer - Mein Computer + + "%1" cannot operate on "%2" + "%1" kann nicht auf "%2" angewandt werden - - - Parent Directory - Übergeordnetes Verzeichnis + + Duplicate default property + Mehrfaches Auftreten der Vorgabe-Eigenschaft - - - Files of type: - Dateien des Typs: + + Duplicate property name + Mehrfaches Auftreten eines Eigenschaftsnamens - - - %1 -Directory not found. -Please verify the correct directory name was given. - %1 -Das Verzeichnis konnte nicht gefunden werden. -Stellen Sie sicher, dass der Verzeichnisname richtig ist. + + Property names cannot begin with an upper case letter + Eigenschaftsnamen dürfen nicht mit einem Großbuchstaben beginnen - - '%1' is write protected. -Do you want to delete it anyway? - '%1' ist schreibgeschützt. -Möchten Sie die Datei trotzdem löschen? + + Duplicate signal name + Mehrfaches Auftreten eines Signalnamens - - Are sure you want to delete '%1'? - Sind Sie sicher, dass Sie '%1' löschen möchten? + + Signal names cannot begin with an upper case letter + Signalnamen dürfen nicht mit einem Großbuchstaben beginnen - - Could not delete directory. - Konnte Verzeichnis nicht löschen. + + Duplicate method name + Mehrfaches Auftreten eines Methodennamens - - Drive - Laufwerk + + Method names cannot begin with an upper case letter + Methodennamen dürfen nicht mit einem Großbuchstaben beginnen - - File Folder - Match Windows Explorer - Ordner + + Property value set multiple times + Mehrfache Zuweisung eines Wertes an eine Eigenschaft - - Folder - All other platforms - Order + + Invalid property nesting + Ungültige Schachtelung von Eigenschaften - - Alias - Mac OS X Finder - Alias + + Cannot override FINAL property + Eine als 'FINAL' ausgewiesene Eigenschaft kann nicht überschrieben werden - - Shortcut - All other platforms - Symbolischer Link + + Invalid property type + Ungültiger Typ der Eigenschaft - - Unknown - Unbekannt + + Invalid empty ID + Ungültiger (leerer) Id-Wert - - Show - Anzeigen + + IDs cannot start with an uppercase letter + Id-Werte dürfen nicht mit einem Großbuchstaben beginnen - - - Forward - Vorwärts + + IDs must start with a letter or underscore + Id-Werte müssen mit einem Buchstaben oder dem Zeichen '_' beginnen - - &New Folder - &Neues Verzeichnis + + IDs must contain only letters, numbers, and underscores + Id-Werte dürfen nur Buchstaben oder Unterstriche enthalten - - - &Choose - &Auswählen + + ID illegally masks global JavaScript property + Der Id-Wert überdeckt eine globale Eigenschaft aus JavaScript - - Remove - Löschen + + + No property alias location + Alias-Eigenschaft ohne Quellangabe - - - File &name: - Datei&name: + + + Invalid alias location + Ungültige Quellangabe bei Alias-Eigenschaft - - - Look in: - Suchen in: + + Invalid alias reference. An alias reference must be specified as <id> or <id>.<property> + Ungültige Referenzierung einer Alias-Eigenschaft. Die Referenz muss in der Form <id> oder <id>.<property> angegeben werden - - - Create New Folder - Neuen Ordner erstellen + + Invalid alias reference. Unable to find id "%1" + Ungültige Referenzierung einer Alias-Eigenschaft. Der Id-Wert "%1" konnte nicht gefunden werden - QFileSystemModel + QDeclarativeComponent - - - %1 TB - %1 TB + + Invalid empty URL + Ungültige (leere) URL + + + QDeclarativeCompositeTypeManager - - - %1 GB - %1 GB + + + Resource %1 unavailable + Auf die Ressource %1 konnte nicht zugegriffen werden - - - %1 MB - %1 MB + + Import %1 unavailable + Import %1 nicht verfügbar + + + + Namespace %1 cannot be used as a type + Der Namensraum %1 kann nicht als Typangabe verwendet werden - - %1 KB - %1 KB + %1 is not a type + %1 ist keine Typangabe - - %1 bytes - %1 Byte + + Type %1 unavailable + Der Typ %1 ist nicht verfügbar + + + QDeclarativeConnections - - Invalid filename - Ungültiger Dateiname + + + + Cannot assign to non-existent property "%1" + Es kann keine Zuweisung erfolgen, da keine Eigenschaft des Namens '%1" existiert - - <b>The name "%1" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks. - <b>Der Name "%1" kann nicht verwendet werden.</b><p>Versuchen Sie, die Sonderzeichen zu entfernen oder einen kürzeren Namen zu verwenden. + + Connections: nested objects not allowed + Verbindungen: Verschachtelte Objekte sind nicht zulässig - - Name - Name + + Connections: syntax error + Verbindungen: Syntaxfehler - - Size - Größe + + Connections: script expected + Verbindungen: Skript erwartet + + + QDeclarativeEngine - - Kind - Match OS X Finder - Art + + executeSql called outside transaction() + 'executeSql' wurde außerhalb von 'transaction()' aufgerufen - - Type - All other platforms - Typ + + Read-only Transaction + Schreibgeschützte Transaktion - - Date Modified - Änderungsdatum + + Version mismatch: expected %1, found %2 + Die Version %2 kann nicht verwendet werden; es wird %1 benötigt - - My Computer - Mein Computer + + SQL transaction failed + Die SQL-Transaktion schlug fehl - - Computer - Computer + + transaction: missing callback + callback fehlt bei Transaktion - - %1 byte(s) - %1 byte + + + SQL: database version mismatch + SQL: Die Version der Datenbank entspricht nicht der erwarteten Version - QFontDatabase + QDeclarativeFlipable - - - Normal - Normal + + front is a write-once property + 'front' kann nur einmal zugewiesen werden - - - - Bold - Fett + + back is a write-once property + 'back' kann nur einmal zugewiesen werden + + + QDeclarativeInfo - - - Demi Bold - Halbfett + + + unknown location + Unbekannter Ort + + + QDeclarativeListModel - - - - Black - Schwarz + + remove: index %1 out of range + remove: Der Index %1 ist außerhalb des gültigen Bereichs - - Demi - Semi + + insert: value is not an object + insert: Der Wert ist kein Objekt - - - Light - Leicht + + insert: index %1 out of range + insert: Der Index %1 ist außerhalb des gültigen Bereichs - - - Italic - Kursiv + + move: out of range + move: Außerhalb des gültigen Bereichs - - - Oblique - Schräggestellt + + append: value is not an object + append: Der Wert ist kein Objekt - - Any - Alle + + get: index %1 out of range + get: Der Index %1 ist außerhalb des gültigen Bereichs - - Latin - Lateinisch + + set: value is not an object + set: Der Wert ist kein Objekt - - Greek - Griechisch + + + set: index %1 out of range + set: Der Index %1 ist außerhalb des gültigen Bereichs - - Cyrillic - Kyrillisch + + ListElement: cannot use default property + ListElement: Die Vorgabe-Eigenschaft kann nicht verwendet werden - - Armenian - Armenisch + + ListElement: cannot use reserved "id" property + ListElement: Die "id"-Eigenschaft kann nicht verwendet werden - - Hebrew - Hebräisch + + ListElement: cannot use script for property value + ListElement: Es kann kein Skript für den Wert der Eigenschaft verwendet werden - - Arabic - Arabisch + + ListModel: undefined property '%1' + ListModel: Die Eigenschaft '%1' ist nicht definiert + + + QDeclarativeParentAnimation - - Syriac - Syrisch + + Unable to preserve appearance under complex transform + Das Erscheinungsbild kann bei einer komplexen Transformation nicht beibehalten werden - - Thaana - Thaana - + + + Unable to preserve appearance under non-uniform scale + Das Erscheinungsbild kann bei einer nicht-uniformen Skalierung nicht beibehalten werden + - - Devanagari - Devanagari + + Unable to preserve appearance under scale of 0 + Das Erscheinungsbild kann bei einer Skalierung mit 0 nicht beibehalten werden + + + QDeclarativeParentChange - - Bengali - Bengalisch + + Unable to preserve appearance under complex transform + Das Erscheinungsbild kann bei einer komplexen Transformation nicht beibehalten werden - - Gurmukhi - Gurmukhi + + + Unable to preserve appearance under non-uniform scale + Das Erscheinungsbild kann bei einer nicht-uniformen Skalierung nicht beibehalten werden - - Gujarati - Gujarati + + Unable to preserve appearance under scale of 0 + Das Erscheinungsbild kann bei einer Skalierung mit 0 nicht beibehalten werden + + + QDeclarativeParser - - Oriya - Oriya + + Illegal character + Ungültiges Zeichen - - Tamil - Tamilisch + + Unclosed string at end of line + Zeichenkette am Zeilenende nicht abgeschlossen - - Telugu - Telugu + + Illegal escape squence + Ungültiges Escape-Sequenz - - Kannada - Kannada + + Illegal unicode escape sequence + Ungültige Unicode-Escape-Sequenz - - Malayalam - Malayalam + + Unclosed comment at end of file + Kommentar am Dateiende nicht abgeschlossen - - Sinhala - Sinhala + + Illegal syntax for exponential number + Ungültige Syntax des Exponenten - - Thai - Thailändisch + + Identifier cannot start with numeric literal + Ein Bezeichner darf nicht mit einem numerischen Literal beginnen - - Lao - Laotisch + + Unterminated regular expression literal + Regulärer Ausdruck nicht abgeschlossen - - Tibetan - Tibetisch + + Invalid regular expression flag '%0' + Ungültiger Modifikator '%0' bei regulärem Ausdruck - - Myanmar - Myanmar + + + Syntax error + Syntaxfehler - - Georgian - Georgisch + + Unexpected token `%1' + Unerwartetes Element '%1' - - Khmer - Khmer + + + Expected token `%1' + Es wird das Element '%1' erwartet - - Simplified Chinese - Chinesisch (Kurzzeichen) + + + + Property value set multiple times + Mehrfache Zuweisung eines Wertes an eine Eigenschaft - - Traditional Chinese - Chinesisch (Langzeichen) + + Expected type name + Es wird ein Typname erwartet - - Japanese - Japanisch + + Invalid use of Script block + Ungültige Verwendung von Skript-Blöcken - - Korean - Koreanisch + + Invalid import qualifier ID + Ungültige Id-Angabe bei Import - - Vietnamese - Vietnamesisch + + Library import requires a version + Der Import einer Bibliothek erfordert eine Versionsangabe - - Symbol - Symbol + + Expected parameter type + Es wird eine Typangabe für den Parameter erwartet - - Ogham - Ogham + + Invalid property type modifier + Ungültiger Modifikator für den Typ der Eigenschaft - - Runic - Runen + + Unexpected property type modifier + Modifikator für den Typ der Eigenschaft an dieser Stelle nicht zulässig - - N'Ko - N'Ko + + Expected property type + Typangabe für Eigenschaft erwartet - - - QFontDialog - - &Font - &Schriftart + + Readonly not yet supported + 'read-only' wird an dieser Stelle noch nicht unterstützt - - Font st&yle - Schrifts&til + + JavaScript declaration outside Script element + Eine JavaScript-Deklaration ist außerhalb eines Skriptelementes nicht zulässig - - &Size - &Größe + + Variable declarations not allow in inline Script blocks + Variablendeklarationen sind in eingebetteten Script-Blöcken nicht zulässig + + + QDeclarativePauseAnimation - - Effects - Effekte + + Cannot set a duration of < 0 + Es kann keine Zeitdauer <0 gesetzt werden + + + QDeclarativePropertyAnimation - - Stri&keout - Durch&gestrichen + + Cannot set a duration of < 0 + Es kann keine Zeitdauer <0 gesetzt werden + + + QDeclarativePropertyChanges - - &Underline - &Unterstrichen + + Cannot assign to non-existent property "%1" + Es kann keine Zuweisung erfolgen, da keine Eigenschaft des Namens '%1" existiert - - Sample - Beispiel + + Cannot assign to read-only property "%1" + Die Eigenschaft '%1" ist schreibgeschützt und kann daher nicht zugewiesen werden + + + QDeclarativeTextInput - - - Select Font - Schriftart auswählen + + + Could not load cursor delegate + Cursor-Delegate konnte nicht geladen werden - - Wr&iting System - &Schriftsystem + + Could not instantiate cursor delegate + Cursor-Delegate konnte angelegt werden - QFtp + QDeclarativeVME - - Host %1 found - Rechner %1 gefunden + + Unable to create object of type %1 + Es konnte kein Objekt des Typs %1 erzeugt werden - - Host found - Rechner gefunden + + Cannot assign value %1 to property %2 + Der Wert '%1' kann nicht der Eigenschaft %2 zugewiesen werden - - - - Connected to host %1 - Verbunden mit Rechner %1 + + Cannot assign object type %1 with no default method + Der Objekttyp %1 kann nicht zugewiesen werden, da keine Vorgabe-Methode existiert - - Connected to host - Verbindung mit Rechner besteht + + Cannot connect mismatched signal/slot %1 %vs. %2 + Es kann keine Verbindung zwischen dem Signal %1 und dem Slot %2 hergestellt werden, da sie nicht zusammenpassen - - Connection to %1 closed - Verbindung mit %1 beendet + + Cannot assign an object to signal property %1 + Der Signal-Eigenschaft %1 kann kein Objekt zugewiesen werden - - - - Connection closed - Verbindung beendet + + Cannot assign object to list + Zuweisung eines Objekts an eine Liste nicht zulässig - - - Host %1 not found - Rechner %1 konnte nicht gefunden werden + + Cannot assign object to interface property + Der Eigenschaft der Schnittstelle kann kein Objekt zugewiesen werden - - - Connection refused to host %1 - Verbindung mit %1 verweigert + + Unable to create attached object + Es konnte kein 'attached'-Objekt erzeugt werden - - Connection timed out to host %1 - Das Zeitlimit für die Verbindung zu '%1' wurde überschritten + + Cannot set properties on %1 as it is null + Es können keine Eigenschaften auf %1 gesetzt werden, da es 'null' ist + + + QDeclarativeVisualDataModel - - - - - Unknown error - Unbekannter Fehler + + Delegate component must be Item type. + Delegate-Komponente muss vom Typ 'Item' sein + + + QDeclarativeXmlListModelRole - - - Connecting to host failed: -%1 - Verbindung mit Rechner schlug fehl: -%1 + + An XmlRole query must not start with '/' + Eine XmlRole-Abfrage darf nicht mit '/' beginnen + + + QDeclarativeXmlRoleList - - - Login failed: -%1 - Anmeldung schlug fehl: -%1 + + An XmlListModel query must start with '/' or "//" + Eine XmlListModel-Abfrage muss mit '/' oder "//" beginnen + + + QDial - - - Listing directory failed: -%1 - Der Inhalt des Verzeichnisses kann nicht angezeigt werden: -%1 + + QDial + QDial - - - Changing directory failed: -%1 - Ändern des Verzeichnisses schlug fehl: -%1 + + SpeedoMeter + Tachometer - - - Downloading file failed: -%1 - Herunterladen der Datei schlug fehl: -%1 + + SliderHandle + Schieberegler + + + QDialog - - - Uploading file failed: -%1 - Hochladen der Datei schlug fehl: -%1 + + What's This? + Direkthilfe - - - Removing file failed: -%1 - Löschen der Datei schlug fehl: -%1 + + Done + Fertig + + + QDialogButtonBox - - - Creating directory failed: -%1 - Erstellen des Verzeichnisses schlug fehl: -%1 + + + + OK + OK - - - Removing directory failed: -%1 - Löschen des Verzeichnisses schlug fehl: -%1 + + Save + Speichern - - - Not connected - Keine Verbindung + + &Save + S&peichern - - - Connection refused for data connection - Verbindung für die Daten Verbindung verweigert + + Open + Öffnen - - - QGstreamerPlayerSession - - Unable to play %1 - %1 kann nicht abgespielt werden + + Cancel + Abbrechen - - - QHostInfo - - Unknown error - Unbekannter Fehler + + &Cancel + &Abbrechen - - No host name given - Es wurde kein Hostname angegeben + + Close + Schließen - - - QHostInfoAgent - - - - - Host not found - Rechner konnte nicht gefunden werden + + &Close + Schl&ießen - - - - - Unknown address type - Unbekannter Adresstyp + + Apply + Anwenden - - - - Unknown error - Unbekannter Fehler + + Reset + Zurücksetzen - - - No host name given - Es wurde kein Hostname angegeben + + Help + Hilfe - - - Invalid hostname - Ungültiger Rechnername + + Don't Save + Nicht speichern - - - QHttp - - - Connection refused - Verbindung verweigert + + Discard + Verwerfen - - - - Host %1 not found - Rechner %1 konnte nicht gefunden werden + + &Yes + &Ja - - - Wrong content length - Ungültige Längenangabe + + Yes to &All + Ja, &alle - - - HTTP request failed - HTTP-Anfrage fehlgeschlagen + + &No + &Nein - - Host %1 found - Rechner %1 gefunden + + N&o to All + N&ein, keine - - Host found - Rechner gefunden + + Save All + Alles speichern - - Connected to host %1 - Verbunden mit Rechner %1 + + Abort + Abbrechen - - Connected to host - Verbindung mit Rechner besteht + + Retry + Wiederholen - - Connection to %1 closed - Verbindung mit %1 beendet + + Ignore + Ignorieren - - - Connection closed - Verbindung beendet + + Restore Defaults + Voreinstellungen - - - - - Unknown error - Unbekannter Fehler + + Close without Saving + Schließen ohne Speichern - - - Request aborted - Anfrage wurde abgebrochen + + &OK + &OK + + + QDirModel - - - No server set to connect to - Für die Verbindung wurde kein Server-Rechner angegeben + + Name + Name - - - Server closed connection unexpectedly - Der Server hat die Verbindung unerwartet geschlossen + + Size + Größe - - - Invalid HTTP response header - Der Kopfteil der HTTP-Antwort ist ungültig + + Kind + Match OS X Finder + Art - - Unknown authentication method - Unbekannte Authentifizierungsmethode + + Type + All other platforms + Typ - - - - - Invalid HTTP chunked body - Der Inhalt (chunked body) der HTTP-Antwort ist ungültig + + Date Modified + Änderungsdatum + + + QDockWidget - - Error writing response to device - Beim Schreiben der Antwort auf das Ausgabegerät ist ein Fehler aufgetreten + + Close + Schließen - - Proxy authentication required - Proxy-Authentifizierung erforderlich + + Dock + Andocken - - Authentication required - Authentifizierung erforderlich + + Float + Herauslösen + + + QDoubleSpinBox - - Proxy requires authentication - Der Proxy-Server verlangt eine Authentifizierung + + More + Mehr - - Host requires authentication - Der Hostrechner verlangt eine Authentifizierung + + Less + Weniger + + + QErrorMessage - - Data corrupted - Die Daten sind verfälscht + + &Show this message again + Diese Meldung wieder an&zeigen - - SSL handshake failed - Im Ablauf des SSL-Protokolls ist ein Fehler aufgetreten. + + &OK + &OK - - Unknown protocol specified - Es wurde ein unbekanntes Protokoll angegeben + + Debug Message: + Debug-Ausgabe: - - Connection refused (or timed out) - Verbindung verweigert oder Zeitlimit überschritten + + Warning: + Achtung: - - HTTPS connection requested but SSL support not compiled in - Die angeforderte HTTPS-Verbindung kann nicht aufgebaut werden, da keine SSL-Unterstützung vorhanden ist + + Fatal Error: + Fehler: - QHttpSocketEngine - - - Did not receive HTTP response from proxy - Keine HTTP-Antwort vom Proxy-Server - - - - Error parsing authentication request from proxy - Fehler beim Auswerten der Authentifizierungsanforderung des Proxy-Servers - + QFile - - Authentication required - Authentifizierung erforderlich + + + Destination file exists + Die Zieldatei existiert bereits - - Proxy denied connection - Der Proxy-Server hat den Aufbau einer Verbindung verweigert + + Will not rename sequential file using block copy + Eine sequentielle Datei kann nicht durch blockweises Kopieren umbenannt werden - - Error communicating with HTTP proxy - Fehler bei der Kommunikation mit dem Proxy-Server + + Cannot remove source file + Die Quelldatei kann nicht entfernt werden - - Proxy server not found - Es konnte kein Proxy-Server gefunden werden + + Cannot open %1 for input + %1 kann nicht zum Lesen geöffnet werden - - Proxy connection refused - Der Proxy-Server hat den Aufbau einer Verbindung verweigert + + Cannot open for output + Das Öffnen zum Schreiben ist fehlgeschlagen - - Proxy server connection timed out - Bei der Verbindung mit dem Proxy-Server wurde ein Zeitlimit überschritten + + Failure to write block + Der Datenblock konnte nicht geschrieben werden - - Proxy connection closed prematurely - Der Proxy-Server hat die Verbindung vorzeitig beendet + + Cannot create %1 for output + %1 kann nicht erstellt werden - QIBaseDriver + QFileDialog - - Error opening database - Die Datenbankverbindung konnte nicht geöffnet werden + + + All Files (*) + Alle Dateien (*) - - Could not start transaction - Es konnte keine Transaktion gestartet werden + + + Back + Zurück - - Unable to commit transaction - Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + + List View + Liste - - Unable to rollback transaction - Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + + Detail View + Details - - - QIBaseResult - - Unable to create BLOB - Es konnte kein BLOB erzeugt werden + + + File + Datei - - Unable to write BLOB - Der BLOB konnte nicht geschrieben werden + + Open + Öffnen - - Unable to open BLOB - Der BLOB konnte nicht geöffnet werden + + Save As + Speichern unter - - Unable to read BLOB - Der BLOB konnte nicht gelesen werden + + + + &Open + &Öffnen - - - Could not find array - Das Feld konnte nicht gefunden werden + + + &Save + S&peichern - - Could not get array data - Die Daten des Feldes konnten nicht gelesen werden + + Recent Places + Zuletzt besucht - - Could not get query info - Die erforderlichen Informationen zur Abfrage sind nicht verfügbar + + &Rename + &Umbenennen - - Could not start transaction - Es konnte keine Transaktion gestartet werden + + &Delete + &Löschen - - Unable to commit transaction - Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + Show &hidden files + &Versteckte Dateien anzeigen - - Could not allocate statement - Die Allokation des Befehls schlug fehl + + New Folder + Neues Verzeichnis - - Could not prepare statement - Der Befehl konnte nicht initalisiert werden + + Find Directory + Verzeichnis suchen - - - Could not describe input statement - Es konnte keine Beschreibung des Eingabebefehls erhalten werden + + Directories + Verzeichnisse - - Could not describe statement - Es konnte keine Beschreibung des Befehls erhalten werden + + All Files (*.*) + Alle Dateien (*.*) - - Unable to close statement - Der Befehl konnte nicht geschlossen werden + + + Directory: + Verzeichnis: - - Unable to execute query - Der Befehl konnte nicht ausgeführt werden + + %1 already exists. +Do you want to replace it? + Die Datei %1 existiert bereits. +Soll sie überschrieben werden? - - Could not fetch next item - Das nächste Element konnte nicht abgeholt werden + + %1 +File not found. +Please verify the correct file name was given. + %1 +Die Datei konnte nicht gefunden werden. +Stellen Sie sicher, dass der Dateiname richtig ist. - - Could not get statement info - Es ist keine Information zum Befehl verfügbar + + My Computer + Mein Computer - - - QIODevice - - Permission denied - Zugriff verweigert + + + Parent Directory + Übergeordnetes Verzeichnis - - Too many open files - Zu viele Dateien geöffnet + + + Files of type: + Dateien des Typs: - - No such file or directory - Die Datei oder das Verzeichnis konnte nicht gefunden werden + + + %1 +Directory not found. +Please verify the correct directory name was given. + %1 +Das Verzeichnis konnte nicht gefunden werden. +Stellen Sie sicher, dass der Verzeichnisname richtig ist. - - No space left on device - Kein freier Speicherplatz auf dem Gerät vorhanden + + '%1' is write protected. +Do you want to delete it anyway? + '%1' ist schreibgeschützt. +Möchten Sie die Datei trotzdem löschen? - - Unknown error - Unbekannter Fehler + + Are sure you want to delete '%1'? + Sind Sie sicher, dass Sie '%1' löschen möchten? - - - QInputContext - - XIM - XIM + + Could not delete directory. + Konnte Verzeichnis nicht löschen. - - FEP - FEP + + Drive + Laufwerk - - XIM input method - XIM-Eingabemethode + + File Folder + Match Windows Explorer + Ordner - - Windows input method - Windows-Eingabemethode + + Folder + All other platforms + Order - - Mac OS X input method - Mac OS X-Eingabemethode + + Alias + Mac OS X Finder + Alias - - S60 FEP input method - S60-FEP-Eingabemethode + + Shortcut + All other platforms + Symbolischer Link - - - QInputDialog - - Enter a value: - Geben Sie einen Wert ein: + + Unknown + Unbekannt - - - QLibrary - - Could not mmap '%1': %2 - Operation mmap fehlgeschlagen für '%1': %2 + + Show + Anzeigen - - Plugin verification data mismatch in '%1' - Die Prüfdaten des Plugins '%1' stimmen nicht überein + + + Forward + Vorwärts - - Could not unmap '%1': %2 - Operation unmap fehlgeschlagen für '%1': %2 + + &New Folder + &Neues Verzeichnis - - The plugin '%1' uses incompatible Qt library. (%2.%3.%4) [%5] - Das Plugin '%1' verwendet eine inkompatible Qt-Bibliothek. (%2.%3.%4) [%5] + + + &Choose + &Auswählen - - The plugin '%1' uses incompatible Qt library. Expected build key "%2", got "%3" - Das Plugin '%1' verwendet eine inkompatible Qt-Bibliothek. Erforderlicher build-spezifischer Schlüssel "%2", erhalten "%3" + + Remove + Löschen - - Unknown error - Unbekannter Fehler + + + File &name: + Datei&name: - - - The shared library was not found. - Die dynamische Bibliothek konnte nicht gefunden werden. + + + Look in: + Suchen in: - - The file '%1' is not a valid Qt plugin. - Die Datei '%1' ist kein gültiges Qt-Plugin. + + + Create New Folder + Neuen Ordner erstellen + + + QFileSystemModel - - The plugin '%1' uses incompatible Qt library. (Cannot mix debug and release libraries.) - Das Plugin '%1' verwendet eine inkompatible Qt-Bibliothek. (Im Debug- bzw. Release-Modus erstellte Bibliotheken können nicht zusammen verwendet werden.) + + + %1 TB + %1 TB - - - Cannot load library %1: %2 - Die Bibliothek %1 kann nicht geladen werden: %2 + + + %1 GB + %1 GB - - - Cannot unload library %1: %2 - Die Bibliothek %1 kann nicht entladen werden: %2 + + + %1 MB + %1 MB - - - Cannot resolve symbol "%1" in %2: %3 - Das Symbol "%1" kann in %2 nicht aufgelöst werden: %3 + + + %1 KB + %1 KB - - - QLineEdit - - Select All - Alles auswählen + + %1 bytes + %1 Byte - - &Undo - &Rückgängig + + Invalid filename + Ungültiger Dateiname - - &Redo - Wieder&herstellen + + <b>The name "%1" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks. + <b>Der Name "%1" kann nicht verwendet werden.</b><p>Versuchen Sie, die Sonderzeichen zu entfernen oder einen kürzeren Namen zu verwenden. - - Cu&t - &Ausschneiden + + Name + Name - - &Copy - &Kopieren + + Size + Größe - - &Paste - Einf&ügen - + + Kind + Match OS X Finder + Art + + + + Type + All other platforms + Typ + - Delete - Löschen + Date Modified + Änderungsdatum + + + + My Computer + Mein Computer + + + + Computer + Computer + + + + %1 byte(s) + %1 byte - QLocalServer + QFontDatabase - - - %1: Name error - %1: Fehlerhafter Name + + + Normal + Normal - - %1: Permission denied - %1: Zugriff verweigert + + + + Bold + Fett - - %1: Address in use - %1: Die Adresse wird bereits verwendet + + + Demi Bold + Halbfett - - %1: Unknown error %2 - %1: Unbekannter Fehler %2 + + + + Black + Schwarz - - - QLocalSocket - - - %1: Connection refused - %1: Der Verbindungsaufbau wurde verweigert + + Demi + Semi - - - %1: Remote closed - %1: Die Verbindung wurde von der Gegenseite geschlossen + + + Light + Leicht + + + + + Italic + Kursiv + + + + + Oblique + Schräggestellt + + + + Any + Alle - - - - %1: Invalid name - %1: Ungültiger Name + Latin + Lateinisch - - %1: Socket access error - %1: Fehler beim Zugriff auf den Socket + Greek + Griechisch - - %1: Socket resource error - %1: Socket-Fehler (Ressourcenproblem) + Cyrillic + Kyrillisch - - %1: Socket operation timed out - %1: Zeitüberschreitung bei Socket-Operation + Armenian + Armenisch - - %1: Datagram too large - %1: Das Datagramm ist zu groß + Hebrew + Hebräisch - - - %1: Connection error - %1: Verbindungsfehler + Arabic + Arabisch - - %1: The socket operation is not supported - %1: Diese Socket-Operation wird nicht unterstützt + Syriac + Syrisch - - %1: Unknown error - %1: Unbekannter Fehler + + Thaana + Thaana - - - %1: Unknown error %2 - %1: Unbekannter Fehler %2 + + Devanagari + Devanagari - - - QMYSQLDriver - - Unable to open database ' - Die Datenbankverbindung kann nicht geöffnet werden ' + + Bengali + Bengalisch - - Unable to connect - Es kann keine Verbindung aufgebaut werden + + Gurmukhi + Gurmukhi - - Unable to begin transaction - Es kann keine Transaktion gestartet werden + + Gujarati + Gujarati - - Unable to commit transaction - Die Transaktion kann nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + Oriya + Oriya - - Unable to rollback transaction - Die Transaktion kann nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + Tamil + Tamilisch - - - QMYSQLResult - - - Unable to fetch data - Es konnten keine Daten abgeholt werden + + Telugu + Telugu - - Unable to execute query - Die Abfrage konnte nicht ausgeführt werden + + Kannada + Kannada - - Unable to store result - Das Ergebnis konnte nicht gespeichert werden + + Malayalam + Malayalam - - - Unable to prepare statement - Der Befehl konnte nicht initialisiert werden + + Sinhala + Sinhala - - Unable to reset statement - Der Befehl konnte nicht zurückgesetzt werden + + Thai + Thailändisch - - Unable to bind value - Der Wert konnte nicht gebunden werden + + Lao + Laotisch - - Unable to execute statement - Der Befehl konnte nicht ausgeführt werden + + Tibetan + Tibetisch - - - Unable to bind outvalues - Die Ausgabewerte konnten nicht gebunden werden + + Myanmar + Myanmar - - Unable to store statement results - Die Ergebnisse des Befehls konnten nicht gespeichert werden + + Georgian + Georgisch - - Unable to execute next query - Die folgende Abfrage kann nicht ausgeführt werden + + Khmer + Khmer - - Unable to store next result - Das folgende Ergebnis kann nicht gespeichert werden + + Simplified Chinese + Chinesisch (Kurzzeichen) - - - QMdiArea - - (Untitled) - (Unbenannt) + + Traditional Chinese + Chinesisch (Langzeichen) - - - QMdiSubWindow - - %1 - [%2] - %1 - [%2] + + Japanese + Japanisch - - Close - Schließen + + Korean + Koreanisch - - Minimize - Minimieren + + Vietnamese + Vietnamesisch - - Restore Down - Wiederherstellen + + Symbol + Symbol - - &Restore - Wieder&herstellen + + Ogham + Ogham - &Move - Ver&schieben + Runic + Runen + + + + N'Ko + N'Ko + + + + QFontDialog + + + &Font + &Schriftart - &Size - Größe ä&ndern + Font st&yle + Schrifts&til - Mi&nimize - M&inimieren + &Size + &Größe - - Ma&ximize - Ma&ximieren + + Effects + Effekte - Stay on &Top - Im &Vordergrund bleiben + Stri&keout + Durch&gestrichen - - &Close - Schl&ießen + + &Underline + &Unterstrichen - - Maximize - Maximieren + + Sample + Beispiel - - Unshade - Herabrollen + + Select Font + Schriftart auswählen - - Shade - Aufrollen + + Wr&iting System + &Schriftsystem + + + QFtp - - Restore - Wiederherstellen + + Host %1 found + Rechner %1 gefunden - - Help - Hilfe + + Host found + Rechner gefunden - - Menu - Menü + + + + Connected to host %1 + Verbunden mit Rechner %1 - - - [%1] - - [%1] + + Connected to host + Verbindung mit Rechner besteht - - - QMediaPlayer - - The QMediaPlayer object does not have a valid service - Das QMediaPlayer-Objekt verfügt über keinen gültigen Dienst + + Connection to %1 closed + Verbindung mit %1 beendet - - - QMediaPlaylist - - - Could not add items to read only playlist. - Es konnten keine Einträge zur Wiedergabeliste hinzugefügt werden, da sie schreibgeschützt ist. + + + + Connection closed + Verbindung beendet - - - Playlist format is not supported - Das Format der Wiedergabeliste ist nicht unterstützt + + + Host %1 not found + Rechner %1 konnte nicht gefunden werden - - The file could not be accessed. - Auf die Datei konnte nicht zugegriffen werden. + + + Connection refused to host %1 + Verbindung mit %1 verweigert - - Playlist format is not supported. - Das Format der Wiedergabeliste ist nicht unterstützt. + + Connection timed out to host %1 + Das Zeitlimit für die Verbindung zu '%1' wurde überschritten - - - QMenu - - - Close - Schließen + + + + + Unknown error + Unbekannter Fehler - - - Open - Öffnen + + + Connecting to host failed: +%1 + Verbindung mit Rechner schlug fehl: +%1 - - - - Execute - Ausführen + + + Login failed: +%1 + Anmeldung schlug fehl: +%1 - - - QMenuBar - - Actions - Optionen + + + Listing directory failed: +%1 + Der Inhalt des Verzeichnisses kann nicht angezeigt werden: +%1 - - - QMessageBox - - - - - OK - OK + + + Changing directory failed: +%1 + Ändern des Verzeichnisses schlug fehl: +%1 - - <h3>About Qt</h3><p>This program uses Qt version %1.</p> - + + + Downloading file failed: +%1 + Herunterladen der Datei schlug fehl: +%1 - - <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> - + + + Uploading file failed: +%1 + Hochladen der Datei schlug fehl: +%1 - - About Qt - Über Qt + + + Removing file failed: +%1 + Löschen der Datei schlug fehl: +%1 - - Help - Hilfe + + + Creating directory failed: +%1 + Erstellen des Verzeichnisses schlug fehl: +%1 - - Show Details... - Details einblenden... + + + Removing directory failed: +%1 + Löschen des Verzeichnisses schlug fehl: +%1 - - Hide Details... - Details ausblenden... + + + Not connected + Keine Verbindung - - - QMultiInputContext - - Select IM - Eingabemethode auswählen + + + Connection refused for data connection + Verbindung für die Daten Verbindung verweigert - QMultiInputContextPlugin - - - Multiple input method switcher - Umschalter für Eingabemethoden - + QGstreamerPlayerSession - - Multiple input method switcher that uses the context menu of the text widgets - Mehrfachumschalter für Eingabemethoden, der das Kontextmenü des Text-Widgets verwendet + + + Unable to play %1 + %1 kann nicht abgespielt werden - QNativeSocketEngine - - - The remote host closed the connection - Der entfernte Rechner hat die Verbindung geschlossen - - - - Network operation timed out - Das Zeitlimit für die Operation wurde überschritten - + QHostInfo - - Out of resources - Keine Ressourcen verfügbar + + Unknown error + Unbekannter Fehler - - Unsupported socket operation - Nichtunterstütztes Socket-Kommando + + No host name given + Es wurde kein Hostname angegeben + + + QHostInfoAgent - - Protocol type not supported - Das Protokoll wird nicht unterstützt + + + + + Host not found + Rechner konnte nicht gefunden werden - - Invalid socket descriptor - Ungültiger Socket-Deskriptor + + + + + Unknown address type + Unbekannter Adresstyp - - Network unreachable - Das Netzwerk ist nicht erreichbar + + + + Unknown error + Unbekannter Fehler - - Permission denied - Zugriff verweigert + + + No host name given + Es wurde kein Hostname angegeben - - Connection timed out - Das Zeitlimit für die Verbindung wurde überschritten + + + Invalid hostname + Ungültiger Rechnername + + + QHttp - + + Connection refused Verbindung verweigert - - The bound address is already in use - Die angegebene Adresse ist bereits in Gebrauch - - - - The address is not available - Die Adresse ist nicht verfügbar - - - - The address is protected - Die Adresse ist geschützt - - - - Unable to send a message - Die Nachricht konnte nicht gesendet werden - - - - Unable to receive a message - Die Nachricht konnte nicht empfangen werden - - - - Unable to write - Der Schreibvorgang konnte nicht ausgeführt werden + + + + Host %1 not found + Rechner %1 konnte nicht gefunden werden - - Network error - Netzwerkfehler + + + Wrong content length + Ungültige Längenangabe - - Another socket is already listening on the same port - Auf diesem Port hört bereits ein anderer Socket + + + HTTP request failed + HTTP-Anfrage fehlgeschlagen - - Unable to initialize non-blocking socket - Der nichtblockierende Socket konnte nicht initialisiert werden + + Host %1 found + Rechner %1 gefunden - - Unable to initialize broadcast socket - Der Broadcast-Socket konnte nicht initialisiert werden + + Host found + Rechner gefunden - - Attempt to use IPv6 socket on a platform with no IPv6 support - Es wurde versucht, einen IPv6-Socket auf einem System ohne IPv6-Unterstützung zu verwenden + + Connected to host %1 + Verbunden mit Rechner %1 - - Host unreachable - Der Zielrechner kann nicht erreicht werden + + Connected to host + Verbindung mit Rechner besteht - - Datagram was too large to send - Das Datagram konnte nicht gesendet werden, weil es zu groß ist + + Connection to %1 closed + Verbindung mit %1 beendet - - Operation on non-socket - Operation kann nur auf einen Socket angewandt werden + + + Connection closed + Verbindung beendet - + + + + Unknown error Unbekannter Fehler - - The proxy type is invalid for this operation - Die Operation kann mit dem Proxy-Typ nicht durchgeführt werden - - - - QNetworkAccessCacheBackend - - - Error opening %1 - %1 konnte nicht geöffnet werden + + + Request aborted + Anfrage wurde abgebrochen - - - QNetworkAccessDataBackend - - Operation not supported on %1 - Diese Operation wird von %1 nicht unterstützt + + + No server set to connect to + Für die Verbindung wurde kein Server-Rechner angegeben - - Invalid URI: %1 - Ungültiger URI: %1 + + + Server closed connection unexpectedly + Der Server hat die Verbindung unerwartet geschlossen - - - QNetworkAccessDebugPipeBackend - - Write error writing to %1: %2 - Fehler beim Schreiben zu %1: %2 + + + Invalid HTTP response header + Der Kopfteil der HTTP-Antwort ist ungültig - - Socket error on %1: %2 - Socket-Fehler bei %1: %2 + + Unknown authentication method + Unbekannte Authentifizierungsmethode - - Remote host closed the connection prematurely on %1 - Der entfernte Rechner hat die Verbindung zu %1 vorzeitig beendet + + + + + Invalid HTTP chunked body + Der Inhalt (chunked body) der HTTP-Antwort ist ungültig - - - QNetworkAccessFileBackend - - - Request for opening non-local file %1 - Anforderung zum Öffnen einer Datei über Netzwerk %1 + + Error writing response to device + Beim Schreiben der Antwort auf das Ausgabegerät ist ein Fehler aufgetreten - - - Error opening %1: %2 - %1 konnte nicht geöffnet werden: %2 + + Proxy authentication required + Proxy-Authentifizierung erforderlich - - Write error writing to %1: %2 - Fehler beim Schreiben zur Datei %1: %2 + + Authentication required + Authentifizierung erforderlich - - - Cannot open %1: Path is a directory - %1 kann nicht geöffnet werden: Der Pfad spezifiziert ein Verzeichnis + + Proxy requires authentication + Der Proxy-Server verlangt eine Authentifizierung - - Read error reading from %1: %2 - Beim Lesen von der Datei %1 trat ein Fehler auf: %2 + + Host requires authentication + Der Hostrechner verlangt eine Authentifizierung - - - QNetworkAccessFtpBackend - - No suitable proxy found - Es konnte kein geeigneter Proxy-Server gefunden werden + + Data corrupted + Die Daten sind verfälscht - - Cannot open %1: is a directory - %1 kann nicht geöffnet werden: Es handelt sich um ein Verzeichnis + + SSL handshake failed + Im Ablauf des SSL-Protokolls ist ein Fehler aufgetreten. - - Logging in to %1 failed: authentication required - Die Anmeldung bei %1 schlug fehl: Es ist eine Authentifizierung erforderlich + + Unknown protocol specified + Es wurde ein unbekanntes Protokoll angegeben - - Error while downloading %1: %2 - Beim Herunterladen von %1 trat ein Fehler auf: %2 + + Connection refused (or timed out) + Verbindung verweigert oder Zeitlimit überschritten - - Error while uploading %1: %2 - Beim Hochladen von %1 trat ein Fehler auf: %2 + + HTTPS connection requested but SSL support not compiled in + Die angeforderte HTTPS-Verbindung kann nicht aufgebaut werden, da keine SSL-Unterstützung vorhanden ist - QNetworkAccessHttpBackend + QHttpSocketEngine - - No suitable proxy found - Es konnte kein geeigneter Proxy-Server gefunden werden + + Did not receive HTTP response from proxy + Keine HTTP-Antwort vom Proxy-Server - - - QNetworkAccessManager - - Network access is disabled. - Der Zugriff auf das Netzwerk ist nicht gestattet. + + Error parsing authentication request from proxy + Fehler beim Auswerten der Authentifizierungsanforderung des Proxy-Servers - - - QNetworkReply - - Error downloading %1 - server replied: %2 - Beim Herunterladen von %1 trat ein Fehler auf - Die Antwort des Servers ist: %2 + + Authentication required + Authentifizierung erforderlich - - Protocol "%1" is unknown - Das Protokoll "%1" ist unbekannt + + Proxy denied connection + Der Proxy-Server hat den Aufbau einer Verbindung verweigert - - Temporary network failure. - Das Netzwerk ist zur Zeit ausgefallen. + + Error communicating with HTTP proxy + Fehler bei der Kommunikation mit dem Proxy-Server - - - QNetworkReplyImpl - - - Operation canceled - Operation abgebrochen + + Proxy server not found + Es konnte kein Proxy-Server gefunden werden - - - QNetworkSession - - Invalid configuration. - Ungültige Konfiguration. + + Proxy connection refused + Der Proxy-Server hat den Aufbau einer Verbindung verweigert + + + + Proxy server connection timed out + Bei der Verbindung mit dem Proxy-Server wurde ein Zeitlimit überschritten + + + + Proxy connection closed prematurely + Der Proxy-Server hat die Verbindung vorzeitig beendet - QNetworkSessionPrivateImpl + QIBaseDriver - - - Unknown session error. - Unbekannter Fehler bei Netzwerkverbindung. + + Error opening database + Die Datenbankverbindung konnte nicht geöffnet werden - - - The session was aborted by the user or system. - Die Verbindung wurde vom Nutzer oder vom Betriebssystem unterbrochen. + + Could not start transaction + Es konnte keine Transaktion gestartet werden - - - The requested operation is not supported by the system. - Die angeforderte Operation wird vom System nicht unterstützt. + + Unable to commit transaction + Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + + + Unable to rollback transaction + Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + + QIBaseResult - - - The specified configuration cannot be used. - Die angegebene Konfiguration kann nicht verwendet werden. + + Unable to create BLOB + Es konnte kein BLOB erzeugt werden - - - Roaming was aborted or is not possible. - Das Roaming wurde abgebrochen oder ist hier nicht möglich. + + Unable to write BLOB + Der BLOB konnte nicht geschrieben werden - - Roaming error - Fehler beim Roaming + + Unable to open BLOB + Der BLOB konnte nicht geöffnet werden - - Session aborted by user or system - Die Verbindung wurde vom Nutzer oder vom Betriebssystem unterbrochen + + Unable to read BLOB + Der BLOB konnte nicht gelesen werden - - Unidentified Error - Unbekannter Fehler + + + Could not find array + Das Feld konnte nicht gefunden werden - - - QOCIDriver - - Unable to logon - Logon-Vorgang fehlgeschlagen + + Could not get array data + Die Daten des Feldes konnten nicht gelesen werden - - Unable to initialize - QOCIDriver - Initialisierung fehlgeschlagen + + Could not get query info + Die erforderlichen Informationen zur Abfrage sind nicht verfügbar - - Unable to begin transaction + + Could not start transaction Es konnte keine Transaktion gestartet werden @@ -3908,5562 +3868,5696 @@ Möchten Sie die Datei trotzdem löschen? Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - Unable to rollback transaction - Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + Could not allocate statement + Die Allokation des Befehls schlug fehl - - - QOCIResult - - - - Unable to bind column for batch execute - Die Spalte konnte nicht für den Stapelverarbeitungs-Befehl gebunden werden + + Could not prepare statement + Der Befehl konnte nicht initialisiert werden - - Unable to execute batch statement - Der Stapelverarbeitungs-Befehl konnte nicht ausgeführt werden + + + Could not describe input statement + Es konnte keine Beschreibung des Eingabebefehls erhalten werden - - Unable to goto next - Kann nicht zum nächsten Element gehen + + Could not describe statement + Es konnte keine Beschreibung des Befehls erhalten werden - - Unable to alloc statement - Die Allokation des Befehls schlug fehl + + Unable to close statement + Der Befehl konnte nicht geschlossen werden - - Unable to prepare statement - Der Befehl konnte nicht initialisiert werden + + Unable to execute query + Der Befehl konnte nicht ausgeführt werden - - Unable to get statement type - Der Anweisungstyp kann nicht bestimmt werden + + Could not fetch next item + Das nächste Element konnte nicht abgeholt werden - - Unable to bind value - Der Wert konnte nicht gebunden werden + + Could not get statement info + Es ist keine Information zum Befehl verfügbar + + + + QIODevice + + + Permission denied + Zugriff verweigert - - Unable to execute statement - Der Befehl konnte nicht ausgeführt werden + + Too many open files + Zu viele Dateien geöffnet + + + + No such file or directory + Die Datei oder das Verzeichnis konnte nicht gefunden werden + + + + No space left on device + Kein freier Speicherplatz auf dem Gerät vorhanden + + + + Unknown error + Unbekannter Fehler - QODBCDriver + QInputContext - - Unable to connect - Es kann keine Verbindung aufgebaut werden + + XIM + XIM - - Unable to disable autocommit - 'autocommit' konnte nicht deaktiviert werden + + FEP + FEP - - Unable to commit transaction - Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + XIM input method + XIM-Eingabemethode - - Unable to rollback transaction - Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + Windows input method + Windows-Eingabemethode - - Unable to enable autocommit - 'autocommit' konnte nicht aktiviert werden + + Mac OS X input method + Mac OS X-Eingabemethode - - Unable to connect - Driver doesn't support all functionality required - Es kann keine Verbindung aufgebaut werden weil der Treiber die benötigte Funktionalität nicht vollständig unterstützt + + S60 FEP input method + S60-FEP-Eingabemethode - QODBCResult + QInputDialog - - - QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration - QODBCResult::reset: 'SQL_CURSOR_STATIC' konnte nicht als Attribut des Befehls gesetzt werden. Bitte prüfen Sie die Konfiguration Ihres ODBC-Treibers + + Enter a value: + Geben Sie einen Wert ein: + + + QLibrary - - - Unable to execute statement - Der Befehl konnte nicht ausgeführt werden + + Could not mmap '%1': %2 + Operation mmap fehlgeschlagen für '%1': %2 - - Unable to fetch next - Der nächste Datensatz konnte nicht abgeholt werden + + Plugin verification data mismatch in '%1' + Die Prüfdaten des Plugins '%1' stimmen nicht überein - - Unable to prepare statement - Der Befehl konnte nicht initialisiert werden + + Could not unmap '%1': %2 + Operation unmap fehlgeschlagen für '%1': %2 - - Unable to bind variable - Die Variable konnte nicht gebunden werden + + The plugin '%1' uses incompatible Qt library. (%2.%3.%4) [%5] + Das Plugin '%1' verwendet eine inkompatible Qt-Bibliothek. (%2.%3.%4) [%5] - - - - Unable to fetch last - Der letzte Datensatz konnte nicht abgeholt werden + + The plugin '%1' uses incompatible Qt library. Expected build key "%2", got "%3" + Das Plugin '%1' verwendet eine inkompatible Qt-Bibliothek. Erforderlicher build-spezifischer Schlüssel "%2", erhalten "%3" - - Unable to fetch - Es konnten keine Daten abgeholt werden + + Unknown error + Unbekannter Fehler - - Unable to fetch first - Der erste Datensatz konnte nicht abgeholt werden + + + The shared library was not found. + Die dynamische Bibliothek konnte nicht gefunden werden. - - Unable to fetch previous - Der vorangegangene Datensatz kann nicht abgeholt werden + + The file '%1' is not a valid Qt plugin. + Die Datei '%1' ist kein gültiges Qt-Plugin. - - - QObject - - "%1" duplicates a previous role name and will be disabled. - "%1" ist bereits als Name einer Rolle vergeben und wird daher deaktiviert. + + The plugin '%1' uses incompatible Qt library. (Cannot mix debug and release libraries.) + Das Plugin '%1' verwendet eine inkompatible Qt-Bibliothek. (Im Debug- bzw. Release-Modus erstellte Bibliotheken können nicht zusammen verwendet werden.) - - - QPPDOptionsModel - - Name - Name + + + Cannot load library %1: %2 + Die Bibliothek %1 kann nicht geladen werden: %2 - - Value - Wert + + + Cannot unload library %1: %2 + Die Bibliothek %1 kann nicht entladen werden: %2 + + + + + Cannot resolve symbol "%1" in %2: %3 + Das Symbol "%1" kann in %2 nicht aufgelöst werden: %3 - QPSQLDriver + QLineEdit - - Unable to connect - Es kann keine Verbindung aufgebaut werden + + Select All + Alles auswählen - - Could not begin transaction - Es konnte keine Transaktion gestartet werden + + &Undo + &Rückgängig - - Could not commit transaction - Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + &Redo + Wieder&herstellen - - Could not rollback transaction - Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + Cu&t + &Ausschneiden - - Unable to subscribe - Die Registrierung schlug fehl + + &Copy + &Kopieren - - Unable to unsubscribe - Die Registrierung konnte nicht aufgehoben werden + + &Paste + Einf&ügen + + + + Delete + Löschen - QPSQLResult + QLocalServer - - Unable to create query - Es konnte keine Abfrage erzeugt werden + + + %1: Name error + %1: Fehlerhafter Name - - Unable to prepare statement - Der Befehl konnte nicht initialisiert werden + + %1: Permission denied + %1: Zugriff verweigert + + + + %1: Address in use + %1: Die Adresse wird bereits verwendet + + + + %1: Unknown error %2 + %1: Unbekannter Fehler %2 - QPageSetupWidget + QLocalSocket - - Centimeters (cm) - Zentimeter (cm) + + + %1: Connection refused + %1: Der Verbindungsaufbau wurde verweigert - - Millimeters (mm) - Millimeter (mm) + + + %1: Remote closed + %1: Die Verbindung wurde von der Gegenseite geschlossen - - Inches (in) - Zoll (in) + + + + + %1: Invalid name + %1: Ungültiger Name - - Points (pt) - Punkte (pt) + + + %1: Socket access error + %1: Fehler beim Zugriff auf den Socket - - Form - Formular + + + %1: Socket resource error + %1: Socket-Fehler (Ressourcenproblem) - - Paper - Papier + + + %1: Socket operation timed out + %1: Zeitüberschreitung bei Socket-Operation - - Page size: - Seitengröße: + + + %1: Datagram too large + %1: Das Datagramm ist zu groß - - Width: - Breite: + + + + %1: Connection error + %1: Verbindungsfehler - - Height: - Höhe: + + + %1: The socket operation is not supported + %1: Diese Socket-Operation wird nicht unterstützt - - Paper source: - Papierquelle: + + %1: Unknown error + %1: Unbekannter Fehler - - Orientation - Ausrichtung + + + %1: Unknown error %2 + %1: Unbekannter Fehler %2 + + + QMYSQLDriver - - Portrait - Hochformat + + Unable to open database ' + Die Datenbankverbindung kann nicht geöffnet werden ' - - Landscape - Querformat + + Unable to connect + Es kann keine Verbindung aufgebaut werden - - Reverse landscape - Umgekehrtes Querformat + + Unable to begin transaction + Es kann keine Transaktion gestartet werden - - Reverse portrait - Umgekehrtes Hochformat + + Unable to commit transaction + Die Transaktion kann nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - Margins - Ränder + + Unable to rollback transaction + Die Transaktion kann nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + + QMYSQLResult - - top margin - Oberer Rand + + + Unable to fetch data + Es konnten keine Daten abgeholt werden - - left margin - Linker Rand + + Unable to execute query + Die Abfrage konnte nicht ausgeführt werden - - right margin - Rechter Rand + + Unable to store result + Das Ergebnis konnte nicht gespeichert werden - - bottom margin - Unterer Rand + + + Unable to prepare statement + Der Befehl konnte nicht initialisiert werden - - - QPluginLoader - - Unknown error - Unbekannter Fehler + + Unable to reset statement + Der Befehl konnte nicht zurückgesetzt werden - - The plugin was not loaded. - Das Plugin wurde nicht geladen. + + Unable to bind value + Der Wert konnte nicht gebunden werden - - - QPrintDialog - - locally connected - direkt verbunden + + Unable to execute statement + Der Befehl konnte nicht ausgeführt werden - - - Aliases: %1 - Alias: %1 + + + Unable to bind outvalues + Die Ausgabewerte konnten nicht gebunden werden - - - unknown - unbekannt + + Unable to store statement results + Die Ergebnisse des Befehls konnten nicht gespeichert werden + + + + Unable to execute next query + Die folgende Abfrage kann nicht ausgeführt werden - - OK - OK + + Unable to store next result + Das folgende Ergebnis kann nicht gespeichert werden + + + QMdiArea - - Print all - Alles drucken + + (Untitled) + (Unbenannt) + + + QMdiSubWindow - - Print range - Bereich drucken + + %1 - [%2] + %1 - [%2] - - A0 (841 x 1189 mm) - A0 (841 x 1189 mm) + + Close + Schließen - - A1 (594 x 841 mm) - A1 (594 x 841 mm) + + Minimize + Minimieren - - A2 (420 x 594 mm) - A2 (420 x 594 mm) + + Restore Down + Wiederherstellen - - A3 (297 x 420 mm) - A3 (297 x 420 mm) + + &Restore + Wieder&herstellen - - A5 (148 x 210 mm) - A5 (148 x 210 mm) + + &Move + Ver&schieben - A6 (105 x 148 mm) - A6 (105 x 148 mm) + &Size + Größe ä&ndern - A7 (74 x 105 mm) - A7 (74 x 105 mm) + Mi&nimize + M&inimieren - - A8 (52 x 74 mm) - A8 (52 x 74 mm) + + Ma&ximize + Ma&ximieren - - A9 (37 x 52 mm) - A9 (37 x 52 mm) + + Stay on &Top + Im &Vordergrund bleiben - - B0 (1000 x 1414 mm) - B0 (1000 x 1414 mm) + + &Close + Schl&ießen - - B1 (707 x 1000 mm) - B1 (707 x 1000 mm) + + Maximize + Maximieren - - B2 (500 x 707 mm) - B2 (500 x 707 mm) + + Unshade + Herabrollen - - B3 (353 x 500 mm) - B3 (353 x 500 mm) + + Shade + Aufrollen - - B4 (250 x 353 mm) - B4 (250 x 353 mm) + + Restore + Wiederherstellen - - B6 (125 x 176 mm) - B6 (125 x 176 mm) + + Help + Hilfe - - B7 (88 x 125 mm) - B7 (88 x 125 mm) + + Menu + Menü - - B8 (62 x 88 mm) - B8 (62 x 88 mm) + + - [%1] + - [%1] + + + QMediaPlayer - - B9 (44 x 62 mm) - B9 (44 x 62 mm) + + The QMediaPlayer object does not have a valid service + Das QMediaPlayer-Objekt verfügt über keinen gültigen Dienst + + + QMediaPlaylist - - B10 (31 x 44 mm) - B10 (31 x 44 mm) + + + Could not add items to read only playlist. + Es konnten keine Einträge zur Wiedergabeliste hinzugefügt werden, da sie schreibgeschützt ist. - - C5E (163 x 229 mm) - C5E (163 x 229 mm) + + + Playlist format is not supported + Das Format der Wiedergabeliste ist nicht unterstützt - - DLE (110 x 220 mm) - DLE (110 x 220 mm) + + The file could not be accessed. + Auf die Datei konnte nicht zugegriffen werden. - - Folio (210 x 330 mm) - Folio (210 x 330 mm) + + Playlist format is not supported. + Das Format der Wiedergabeliste ist nicht unterstützt. + + + QMenu - - Ledger (432 x 279 mm) - Ledger (432 x 279 mm) + + + Close + Schließen - - Tabloid (279 x 432 mm) - Tabloid (279 x 432 mm) + + + Open + Öffnen - - US Common #10 Envelope (105 x 241 mm) - US Common #10 Envelope (105 x 241 mm) + + + + Execute + Ausführen + + + QMenuBar - - A4 (210 x 297 mm, 8.26 x 11.7 inches) - A4 (210 x 297 mm) + + Actions + Optionen + + + + QMessageBox + + + + + + OK + OK - - B5 (176 x 250 mm, 6.93 x 9.84 inches) - B5 (176 x 250 mm) + + <h3>About Qt</h3><p>This program uses Qt version %1.</p> + - - Executive (7.5 x 10 inches, 191 x 254 mm) - Executive (7,5 x 10 Zoll, 191 x 254 mm) + + <p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is available under three different licensing options designed to accommodate the needs of our various users.</p><p>Qt licensed under our commercial license agreement is appropriate for development of proprietary/commercial software where you do not want to share any source code with third parties or otherwise cannot comply with the terms of the GNU LGPL version 2.1 or GNU GPL version 3.0.</p><p>Qt licensed under the GNU LGPL version 2.1 is appropriate for the development of Qt applications (proprietary or open source) provided you can comply with the terms and conditions of the GNU LGPL version 2.1.</p><p>Qt licensed under the GNU General Public License version 3.0 is appropriate for the development of Qt applications where you wish to use such applications in combination with software subject to the terms of the GNU GPL version 3.0 or where you are otherwise willing to comply with the terms of the GNU GPL version 3.0.</p><p>Please see <a href="http://qt.nokia.com/products/licensing">qt.nokia.com/products/licensing</a> for an overview of Qt licensing.</p><p>Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).</p><p>Qt is a Nokia product. See <a href="http://qt.nokia.com/">qt.nokia.com</a> for more information.</p> + - - Legal (8.5 x 14 inches, 216 x 356 mm) - Legal (8,5 x 14 Zoll, 216 x 356 mm) + + About Qt + Über Qt - - Letter (8.5 x 11 inches, 216 x 279 mm) - Letter (8,5 x 11 Zoll, 216 x 279 mm) + + Help + Hilfe - - Print selection - Auswahl drucken + + Show Details... + Details einblenden... - - - - Print - Drucken + + Hide Details... + Details ausblenden... + + + QMultiInputContext - - Print To File ... - In Datei drucken ... + + Select IM + Eingabemethode auswählen + + + QMultiInputContextPlugin - - File %1 is not writable. -Please choose a different file name. - Die Datei %1 ist schreibgeschützt. -Bitte wählen Sie einen anderen Dateinamen. + + Multiple input method switcher + Umschalter für Eingabemethoden - - %1 already exists. -Do you want to overwrite it? - Die Datei %1 existiert bereits. -Soll sie überschrieben werden? + + Multiple input method switcher that uses the context menu of the text widgets + Mehrfachumschalter für Eingabemethoden, der das Kontextmenü des Text-Widgets verwendet + + + QNativeSocketEngine - - File exists - Die Datei existiert bereits + + The remote host closed the connection + Der entfernte Rechner hat die Verbindung geschlossen - - <qt>Do you want to overwrite it?</qt> - <qt>Soll sie überschrieben werden?</qt> + + Network operation timed out + Das Zeitlimit für die Operation wurde überschritten - - %1 is a directory. -Please choose a different file name. - %1 ist ein Verzeichnis. -Bitte wählen Sie einen anderen Dateinamen. + + Out of resources + Keine Ressourcen verfügbar - - The 'From' value cannot be greater than the 'To' value. - Die Angabe für die erste Seite darf nicht größer sein als die für die letzte Seite. + + Unsupported socket operation + Socket-Kommando nicht unterstützt - - A0 - A0 + + Protocol type not supported + Das Protokoll wird nicht unterstützt - - A1 - A1 + + Invalid socket descriptor + Ungültiger Socket-Deskriptor - - A2 - A2 + + Network unreachable + Das Netzwerk ist nicht erreichbar - - A3 - A3 + + Permission denied + Zugriff verweigert - - A4 - A4 + + Connection timed out + Das Zeitlimit für die Verbindung wurde überschritten - - A5 - A5 + + Connection refused + Verbindung verweigert - - A6 - A6 + + The bound address is already in use + Die angegebene Adresse ist bereits in Gebrauch - - A7 - A7 + + The address is not available + Die Adresse ist nicht verfügbar - - A8 - A8 + + The address is protected + Die Adresse ist geschützt - - A9 - A9 + + Unable to send a message + Die Nachricht konnte nicht gesendet werden - - B0 - B0 + + Unable to receive a message + Die Nachricht konnte nicht empfangen werden - - B1 - B1 + + Unable to write + Der Schreibvorgang konnte nicht ausgeführt werden - - B2 - B2 + + Network error + Netzwerkfehler - - B3 - B3 + + Another socket is already listening on the same port + Auf diesem Port hört bereits ein anderer Socket - - B4 - B4 + + Unable to initialize non-blocking socket + Der nichtblockierende Socket konnte nicht initialisiert werden - - B5 - B5 + + Unable to initialize broadcast socket + Der Broadcast-Socket konnte nicht initialisiert werden - - B6 - B6 + + Attempt to use IPv6 socket on a platform with no IPv6 support + Es wurde versucht, einen IPv6-Socket auf einem System ohne IPv6-Unterstützung zu verwenden - - B7 - B7 + + Host unreachable + Der Zielrechner kann nicht erreicht werden - - B8 - B8 + + Datagram was too large to send + Das Datagram konnte nicht gesendet werden, weil es zu groß ist - - B9 - B9 + + Operation on non-socket + Operation kann nur auf einen Socket angewandt werden - - B10 - B10 + + Unknown error + Unbekannter Fehler - - C5E - C5E + + The proxy type is invalid for this operation + Die Operation kann mit dem Proxy-Typ nicht durchgeführt werden + + + QNetworkAccessCacheBackend - - DLE - DLE + + Error opening %1 + %1 konnte nicht geöffnet werden + + + QNetworkAccessDataBackend - - Executive - Executive + + Operation not supported on %1 + Diese Operation wird von %1 nicht unterstützt - - Folio - Folio + + Invalid URI: %1 + Ungültiger URI: %1 + + + QNetworkAccessDebugPipeBackend - - Ledger - Ledger + + Write error writing to %1: %2 + Fehler beim Schreiben zu %1: %2 - - Legal - Legal + + Socket error on %1: %2 + Socket-Fehler bei %1: %2 - - Letter - Letter + + Remote host closed the connection prematurely on %1 + Der entfernte Rechner hat die Verbindung zu %1 vorzeitig beendet + + + QNetworkAccessFileBackend - - Tabloid - Tabloid + + + Request for opening non-local file %1 + Anforderung zum Öffnen einer Datei über Netzwerk %1 - - US Common #10 Envelope - US Common #10 Envelope + + + Error opening %1: %2 + %1 konnte nicht geöffnet werden: %2 - - Custom - Benutzerdefiniert + + Write error writing to %1: %2 + Fehler beim Schreiben zur Datei %1: %2 - - - &Options >> - &Einstellungen >> + + + Cannot open %1: Path is a directory + %1 kann nicht geöffnet werden: Der Pfad spezifiziert ein Verzeichnis - - &Options << - &Einstellungen << + + Read error reading from %1: %2 + Beim Lesen von der Datei %1 trat ein Fehler auf: %2 + + + QNetworkAccessFtpBackend - - Print to File (PDF) - In PDF-Datei drucken + + No suitable proxy found + Es konnte kein geeigneter Proxy-Server gefunden werden - - Print to File (Postscript) - In Postscript-Datei drucken + + Cannot open %1: is a directory + %1 kann nicht geöffnet werden: Es handelt sich um ein Verzeichnis - - Local file - Lokale Datei + + Logging in to %1 failed: authentication required + Die Anmeldung bei %1 schlug fehl: Es ist eine Authentifizierung erforderlich - - Write %1 file - Schreiben der Datei %1 + + Error while downloading %1: %2 + Beim Herunterladen von %1 trat ein Fehler auf: %2 - - &Print - &Drucken + + Error while uploading %1: %2 + Beim Hochladen von %1 trat ein Fehler auf: %2 - QPrintPreviewDialog + QNetworkAccessHttpBackend - - %1% - %1% + + No suitable proxy found + Es konnte kein geeigneter Proxy-Server gefunden werden + + + QNetworkAccessManager - - Print Preview - Druckvorschau + + Network access is disabled. + Der Zugriff auf das Netzwerk ist nicht gestattet. + + + QNetworkReply - - Next page - Nächste Seite + + Error downloading %1 - server replied: %2 + Beim Herunterladen von %1 trat ein Fehler auf - Die Antwort des Servers ist: %2 - - Previous page - Vorige Seite + + Protocol "%1" is unknown + Das Protokoll "%1" ist unbekannt - - First page - Erste Seite + + Network session error. + Fehler bei Netzwerkverbindung. - - Last page - Letzte Seite + + Temporary network failure. + Das Netzwerk ist zur Zeit ausgefallen. + + + QNetworkReplyImpl - - Fit width - Breite anpassen + + + Operation canceled + Operation abgebrochen + + + QNetworkSession - - Fit page - Seite anpassen + + Invalid configuration. + Ungültige Konfiguration. + + + QNetworkSessionPrivateImpl - - Zoom in - Vergrößern + + + Unknown session error. + Unbekannter Fehler bei Netzwerkverbindung. - - Zoom out - Verkleinern + + + The session was aborted by the user or system. + Die Verbindung wurde vom Nutzer oder vom Betriebssystem unterbrochen. - - Portrait - Hochformat + + + The requested operation is not supported by the system. + Die angeforderte Operation wird vom System nicht unterstützt. - - Landscape - Querformat + + + The specified configuration cannot be used. + Die angegebene Konfiguration kann nicht verwendet werden. - - Show single page - Einzelne Seite anzeigen + + + Roaming was aborted or is not possible. + Das Roaming wurde abgebrochen oder ist hier nicht möglich. - - Show facing pages - Gegenüberliegende Seiten anzeigen + + Roaming error + Fehler beim Roaming - - Show overview of all pages - Übersicht aller Seiten + + Session aborted by user or system + Die Verbindung wurde vom Nutzer oder vom Betriebssystem unterbrochen - - Print - Drucken + + Unidentified Error + Unbekannter Fehler + + + QOCIDriver - - Page setup - Seite einrichten + + Unable to logon + Logon-Vorgang fehlgeschlagen - - Close - Schließen + + Unable to initialize + QOCIDriver + Initialisierung fehlgeschlagen - - Export to PDF - PDF exportieren + + Unable to begin transaction + Es konnte keine Transaktion gestartet werden - - Export to PostScript - PostScript exportieren + + Unable to commit transaction + Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - - Page Setup - Seite einrichten + + Unable to rollback transaction + Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) - QPrintPropertiesWidget + QOCIResult - - Form - Formular + + + + Unable to bind column for batch execute + Die Spalte konnte nicht für den Stapelverarbeitungs-Befehl gebunden werden - - Page - Seite + + Unable to execute batch statement + Der Stapelverarbeitungs-Befehl konnte nicht ausgeführt werden - - Advanced - Erweitert + + Unable to goto next + Kann nicht zum nächsten Element gehen - - - QPrintSettingsOutput - - Form - Formular + + Unable to alloc statement + Die Allokation des Befehls schlug fehl - - Copies - Anzahl Exemplare + + Unable to prepare statement + Der Befehl konnte nicht initialisiert werden - - Print range - Bereich drucken + + Unable to get statement type + Der Anweisungstyp kann nicht bestimmt werden - - Print all - Alles drucken + + Unable to bind value + Der Wert konnte nicht gebunden werden - - Pages from - Seiten von + + Unable to execute statement + Der Befehl konnte nicht ausgeführt werden + + + + QODBCDriver + + + Unable to connect + Es kann keine Verbindung aufgebaut werden - - to - bis + + Unable to disable autocommit + 'autocommit' konnte nicht deaktiviert werden - - Selection - Auswahl + + Unable to commit transaction + Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - Output Settings - Ausgabeeinstellungen + + Unable to rollback transaction + Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) - - Copies: - Anzahl Exemplare: + + Unable to enable autocommit + 'autocommit' konnte nicht aktiviert werden - - Collate - Sortieren + + Unable to connect - Driver doesn't support all functionality required + Es kann keine Verbindung aufgebaut werden weil der Treiber die benötigte Funktionalität nicht vollständig unterstützt + + + QODBCResult - - Reverse - Umgekehrt + + + QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration + QODBCResult::reset: 'SQL_CURSOR_STATIC' konnte nicht als Attribut des Befehls gesetzt werden. Bitte prüfen Sie die Konfiguration Ihres ODBC-Treibers - - Options - Optionen + + + Unable to execute statement + Der Befehl konnte nicht ausgeführt werden - - Color Mode - Farbmodus + + Unable to fetch next + Der nächste Datensatz konnte nicht abgeholt werden - - Color - Farbe + + Unable to prepare statement + Der Befehl konnte nicht initialisiert werden - - Grayscale - Graustufen + + Unable to bind variable + Die Variable konnte nicht gebunden werden - - Duplex Printing - Duplexdruck + + + + Unable to fetch last + Der letzte Datensatz konnte nicht abgeholt werden - - None - Kein + + Unable to fetch + Es konnten keine Daten abgeholt werden - - Long side - Lange Seite + + Unable to fetch first + Der erste Datensatz konnte nicht abgeholt werden - - Short side - Kurze Seite + + Unable to fetch previous + Der vorangegangene Datensatz kann nicht abgeholt werden - QPrintWidget + QObject - - Form - Formular + + "%1" duplicates a previous role name and will be disabled. + "%1" ist bereits als Name einer Rolle vergeben und wird daher deaktiviert. + + + QPPDOptionsModel - - Printer - Drucker + + Name + Name - - &Name: - &Name: + + Value + Wert + + + QPSQLDriver - - P&roperties - &Eigenschaften + + Unable to connect + Es kann keine Verbindung aufgebaut werden - - Location: - Standort: + + Could not begin transaction + Es konnte keine Transaktion gestartet werden - - Preview - Vorschau + + Could not commit transaction + Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - Type: - Typ: + + Could not rollback transaction + Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) - - Output &file: - Ausgabe&datei: + + Unable to subscribe + Die Registrierung schlug fehl - - ... - ... + + Unable to unsubscribe + Die Registrierung konnte nicht aufgehoben werden - QProcess - - - - Could not open input redirection for reading - Die Eingabeumleitung konnte nicht zum Lesen geöffnet werden - + QPSQLResult - - - Could not open output redirection for writing - Die Ausgabeumleitung konnte nicht zum Lesen geöffnet werden + + Unable to create query + Es konnte keine Abfrage erzeugt werden - - Resource error (fork failure): %1 - Ressourcenproblem ("fork failure"): %1 + + Unable to prepare statement + Der Befehl konnte nicht initialisiert werden + + + QPageSetupWidget - - - - - - - - - - Process operation timed out - Zeitüberschreitung + + Centimeters (cm) + Zentimeter (cm) - - - - - Error reading from process - Das Lesen vom Prozess schlug fehl + + Millimeters (mm) + Millimeter (mm) - - - - Error writing to process - Das Schreiben zum Prozess schlug fehl + + Inches (in) + Zoll (in) - - Process crashed - Der Prozess ist abgestürzt + + Points (pt) + Punkte (pt) - - No program defined - Es wurde kein Programm angegeben + + Form + Formular - - Process failed to start: %1 - Das Starten des Prozesses schlug fehl: %1 + + Paper + Papier - - - QProgressDialog - - Cancel - Abbrechen + + Page size: + Seitengröße: - - - QPushButton - - Open - Öffnen + + Width: + Breite: - - - QRadioButton - - Check - Ankreuzen + + Height: + Höhe: - - - QRegExp - - no error occurred - kein Fehler + + Paper source: + Papierquelle: - - disabled feature used - deaktivierte Eigenschaft wurde benutzt + + Orientation + Ausrichtung - - bad char class syntax - falsche Syntax für Zeichenklasse + + Portrait + Hochformat - - bad lookahead syntax - falsche Syntax für Lookahead + + Landscape + Querformat - - bad repetition syntax - falsche Syntax für Wiederholungen + + Reverse landscape + Umgekehrtes Querformat - - invalid octal value - ungültiger Oktal-Wert + + Reverse portrait + Umgekehrtes Hochformat - - missing left delim - fehlende linke Begrenzung + + Margins + Ränder - - unexpected end - unerwartetes Ende + + top margin + Oberer Rand - - met internal limit - internes Limit erreicht + + left margin + Linker Rand - - invalid interval - ungültiges Intervall + + right margin + Rechter Rand - - invalid category - ungültige Kategorie + + bottom margin + Unterer Rand - QSQLite2Driver + QPluginLoader - - Error opening database - Die Datenbankverbindung konnte nicht geöffnet werden + + Unknown error + Unbekannter Fehler - - Unable to begin transaction - Es konnte keine Transaktion gestartet werden + + The plugin was not loaded. + Das Plugin wurde nicht geladen. + + + QPrintDialog - - Unable to commit transaction - Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + locally connected + direkt verbunden - - Unable to rollback transaction - Die Transaktion kann nicht rückgängig gemacht werden + + + Aliases: %1 + Alias: %1 - - - QSQLite2Result - - Unable to fetch results - Das Ergebnis konnte nicht abgeholt werden + + + unknown + unbekannt - - Unable to execute statement - Der Befehl konnte nicht ausgeführt werden + + OK + OK - - - QSQLiteDriver - - Error opening database - Die Datenbankverbindung konnte nicht geöffnet werden + + Print all + Alles drucken - - Error closing database - Die Datenbankverbindung konnte nicht geschlossen werden + + Print range + Bereich drucken - - Unable to begin transaction - Es konnte keine Transaktion gestartet werden + + A0 (841 x 1189 mm) + A0 (841 x 1189 mm) - - Unable to commit transaction - Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) + + A1 (594 x 841 mm) + A1 (594 x 841 mm) - - Unable to rollback transaction - Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + A2 (420 x 594 mm) + A2 (420 x 594 mm) - - - QSQLiteResult - - - - Unable to fetch row - Der Datensatz konnte nicht abgeholt werden + + A3 (297 x 420 mm) + A3 (297 x 420 mm) - - Unable to execute statement - Der Befehl konnte nicht ausgeführt werden + + A5 (148 x 210 mm) + A5 (148 x 210 mm) - - Unable to reset statement - Der Befehl konnte nicht zurückgesetzt werden + + A6 (105 x 148 mm) + A6 (105 x 148 mm) - - Unable to bind parameters - Die Parameter konnte nicht gebunden werden + + A7 (74 x 105 mm) + A7 (74 x 105 mm) - - Parameter count mismatch - Die Anzahl der Parameter ist falsch + + A8 (52 x 74 mm) + A8 (52 x 74 mm) - - No query - Kein Abfrage + + A9 (37 x 52 mm) + A9 (37 x 52 mm) - - - QScriptBreakpointsModel - - ID - ID + + B0 (1000 x 1414 mm) + B0 (1000 x 1414 mm) - - Location - Stelle + + B1 (707 x 1000 mm) + B1 (707 x 1000 mm) - - Condition - Bedingung + + B2 (500 x 707 mm) + B2 (500 x 707 mm) - - Ignore-count - Auslösen nach + + B3 (353 x 500 mm) + B3 (353 x 500 mm) - - Single-shot - Einmal auslösen + + B4 (250 x 353 mm) + B4 (250 x 353 mm) - Hit-count - Ausgelöst + B6 (125 x 176 mm) + B6 (125 x 176 mm) - - - QScriptBreakpointsWidget - - New - Neu + + B7 (88 x 125 mm) + B7 (88 x 125 mm) - - Delete - Löschen + + B8 (62 x 88 mm) + B8 (62 x 88 mm) - - - QScriptDebugger - - - Go to Line - Gehe zu Zeile + + B9 (44 x 62 mm) + B9 (44 x 62 mm) - - Line: - Zeile: + + B10 (31 x 44 mm) + B10 (31 x 44 mm) - - Interrupt - Unterbrechen + + C5E (163 x 229 mm) + C5E (163 x 229 mm) + + + + DLE (110 x 220 mm) + DLE (110 x 220 mm) - Shift+F5 - Shift+F5 + Folio (210 x 330 mm) + Folio (210 x 330 mm) - - Continue - Weiter + + Ledger (432 x 279 mm) + Ledger (432 x 279 mm) - - F5 - F5 + + Tabloid (279 x 432 mm) + Tabloid (279 x 432 mm) - - Step Into - Einzelschritt herein + + US Common #10 Envelope (105 x 241 mm) + US Common #10 Envelope (105 x 241 mm) - - F11 - F11 + + Print current page + Diese Seite drucken - - Step Over - Einzelschritt über + + A4 (210 x 297 mm, 8.26 x 11.7 inches) + A4 (210 x 297 mm) - - F10 - F10 + + B5 (176 x 250 mm, 6.93 x 9.84 inches) + B5 (176 x 250 mm) - - Step Out - Einzelschritt heraus + + Executive (7.5 x 10 inches, 191 x 254 mm) + Executive (7,5 x 10 Zoll, 191 x 254 mm) - - Shift+F11 - Shift+F11 + + Legal (8.5 x 14 inches, 216 x 356 mm) + Legal (8,5 x 14 Zoll, 216 x 356 mm) - - Run to Cursor - Bis Cursor ausführen + + Letter (8.5 x 11 inches, 216 x 279 mm) + Letter (8,5 x 11 Zoll, 216 x 279 mm) - - Ctrl+F10 - Ctrl+F10 + + Print selection + Auswahl drucken - - Run to New Script - Bis zu neuem Skript ausführen + + + + Print + Drucken - - Toggle Breakpoint - Haltepunkt umschalten + + Print To File ... + In Datei drucken ... - - F9 - F9 + + File %1 is not writable. +Please choose a different file name. + Die Datei %1 ist schreibgeschützt. +Bitte wählen Sie einen anderen Dateinamen. - - Clear Debug Output - Debug-Ausgabe löschen + + %1 already exists. +Do you want to overwrite it? + Die Datei %1 existiert bereits. +Soll sie überschrieben werden? - - Clear Error Log - Fehlerausgabe löschen + + File exists + Die Datei existiert bereits - - Clear Console - Konsole löschen + + <qt>Do you want to overwrite it?</qt> + <qt>Soll sie überschrieben werden?</qt> - - &Find in Script... - &Suche im Skript... + + %1 is a directory. +Please choose a different file name. + %1 ist ein Verzeichnis. +Bitte wählen Sie einen anderen Dateinamen. - - Ctrl+F - Ctrl+F + + The 'From' value cannot be greater than the 'To' value. + Die Angabe für die erste Seite darf nicht größer sein als die für die letzte Seite. - - Find &Next - &Nächste Fundstelle + + A0 + A0 - - F3 - F3 + + A1 + A1 - - Find &Previous - Vorhergehende Fundstelle + + A2 + A2 - - Shift+F3 - Shift+F3 + + A3 + A3 - - Ctrl+G - Ctrl+G + + A4 + A4 - - Debug - Debuggen + + A5 + A5 - - - QScriptDebuggerCodeFinderWidget - - Close - Schließen + + A6 + A6 - - Previous - Vorige + + A7 + A7 - - Next - Nächste + + A8 + A8 - - Case Sensitive - Groß/Kleinschreibung beachten + + A9 + A9 - - Whole words - Ganze Worte + + B0 + B0 - - <img src=":/qt/scripttools/debugging/images/wrap.png">&nbsp;Search wrapped - <img src=":/qt/scripttools/debugging/images/wrap.png">&nbsp;Die Suche hat das Ende erreicht + + B1 + B1 - - - QScriptDebuggerLocalsModel - - Name - Name + + B2 + B2 - - Value - Wert + + B3 + B3 - - - QScriptDebuggerStackModel - - Level - Ebene + + B4 + B4 - - Name - Name + + B5 + B5 - - Location - Stelle + + B6 + B6 - - - QScriptEdit - - Toggle Breakpoint - Haltepunkt umschalten + + B7 + B7 - - Disable Breakpoint - Haltepunkt deaktivieren + + B8 + B8 - Enable Breakpoint - Haltepunkt aktivieren + B9 + B9 - - Breakpoint Condition: - Bedingung: + + B10 + B10 - - - QScriptEngineDebugger - - Loaded Scripts - Geladene Skripte + + C5E + C5E - - Breakpoints - Haltepunkte + + DLE + DLE - - Stack - Stapel + + Executive + Executive - - Locals - Lokale Variablen + + Folio + Folio - - Console - Konsole + + Ledger + Ledger - - Debug Output - Debug-Ausgabe + + Legal + Legal - - Error Log - Fehlerausgabe + + Letter + Letter - - Search - Suche + + Tabloid + Tabloid - - View - Ansicht + + US Common #10 Envelope + US Common #10 Envelope - - Qt Script Debugger - Qt Script Debugger + + Custom + Benutzerdefiniert - - - QScriptNewBreakpointWidget - - Close - Schließen + + + &Options >> + &Einstellungen >> - - - QScrollBar - - Scroll here - Hierher scrollen + + &Options << + &Einstellungen << - - Left edge - Linker Rand + + Print to File (PDF) + In PDF-Datei drucken - - Top - Anfang + + Print to File (Postscript) + In Postscript-Datei drucken - - Right edge - Rechter Rand + + Local file + Lokale Datei - - Bottom - Ende + + Write %1 file + Schreiben der Datei %1 - - Page left - Eine Seite nach links + + &Print + &Drucken + + + QPrintPreviewDialog - - - Page up - Eine Seite nach oben + + %1% + %1% - - Page right - Eine Seite nach rechts + + Print Preview + Druckvorschau - - - Page down - Eine Seite nach unten + + Next page + Nächste Seite - - Scroll left - Nach links scrollen + + Previous page + Vorige Seite - - Scroll up - Nach oben scrollen + + First page + Erste Seite - Scroll right - Nach rechts scrollen + Last page + Letzte Seite - - Scroll down - Nach unten scrollen + + Fit width + Breite anpassen - - Line up - Ausrichten + + Fit page + Seite anpassen - - Position - Position + + Zoom in + Vergrößern - - Line down - Eine Zeile nach unten + + Zoom out + Verkleinern - - - QSharedMemory - - %1: create size is less then 0 - %1: Die Größenangabe für die Erzeugung ist kleiner als Null + + Portrait + Hochformat - - - %1: unable to lock - %1: Sperrung fehlgeschlagen + + Landscape + Querformat - - %1: unable to unlock - %1: Die Sperrung konnte nicht aufgehoben werden + + Show single page + Einzelne Seite anzeigen - - - - %1: permission denied - %1: Zugriff verweigert + + Show facing pages + Gegenüberliegende Seiten anzeigen - - - - %1: already exists - %1: existiert bereits + + Show overview of all pages + Übersicht aller Seiten - - %1: doesn't exists - %1: existiert nicht + + Print + Drucken - - - - %1: out of resources - %1: Keine Ressourcen mehr verfügbar + + Page setup + Seite einrichten - - - - %1: unknown error %2 - %1: Unbekannter Fehler %2 + + Close + Schließen - - %1: key is empty - %1: Ungültige Schlüsselangabe (leer) + + Export to PDF + PDF exportieren - - %1: ftok failed - %1: ftok-Aufruf schlug fehl + + Export to PostScript + PostScript exportieren - - - - %1: unable to make key - %1: Es kann kein Schlüssel erzeugt werden + + + Page Setup + Seite einrichten + + + QPrintPropertiesWidget - - - %1: doesn't exist - %1: existiert nicht + + Form + Formular - - %1: UNIX key file doesn't exist - %1: Die Unix-Schlüsseldatei existiert nicht + + Page + Seite - - %1: system-imposed size restrictions - %1: Ein systembedingtes Limit der Größe wurde erreicht + + Advanced + Erweitert + + + QPrintSettingsOutput - - %1: not attached - %1: nicht verbunden + + Form + Formular - - - %1: invalid size - %1: Ungültige Größe + + Copies + Anzahl Exemplare + + + + Print range + Bereich drucken - - - %1: key error - %1: Fehlerhafter Schlüssel + + Print all + Alles drucken - - %1: size query failed - %1: Die Abfrage der Größe schlug fehl + + Pages from + Seiten von - - %1: unable to set key on lock - %1: Es kann kein Schlüssel für die Sperrung gesetzt werden + + to + bis - - - QShortcut - - Space - Leertaste + + Selection + Auswahl - - Esc - Esc + + Output Settings + Ausgabeeinstellungen - - Tab - Tab + + Copies: + Anzahl Exemplare: - - Backtab - Rück-Tab + + Collate + Sortieren - - Backspace - Rücktaste + + Reverse + Umgekehrt - - Return - Return + + Options + Optionen - - Enter - Enter + + Color Mode + Farbmodus - - Ins - Einfg + + Color + Farbe - - Del - Entf + + Grayscale + Graustufen - - Pause - Pause + + Duplex Printing + Duplexdruck - - Print - Druck + + None + Kein - - SysReq - SysReq + + Long side + Lange Seite - - Home - Pos1 + + Short side + Kurze Seite - - End - Ende + + Current Page + + + + QPrintWidget - - Left - Links + + Form + Formular - - Up - Hoch + + Printer + Drucker - - Right - Rechts + + &Name: + &Name: - - Down - Runter + + P&roperties + &Eigenschaften - - PgUp - Bild aufwärts + + Location: + Standort: - - PgDown - Bild abwärts + + Preview + Vorschau - - CapsLock - Feststelltaste + + Type: + Typ: - - NumLock - Zahlen-Feststelltaste + + Output &file: + Ausgabe&datei: - - ScrollLock - Rollen-Feststelltaste + + ... + ... + + + QProcess - - Menu - Menü + + + Could not open input redirection for reading + Die Eingabeumleitung konnte nicht zum Lesen geöffnet werden - - Help - Hilfe + + + Could not open output redirection for writing + Die Ausgabeumleitung konnte nicht zum Lesen geöffnet werden - - Back - Zurück + + Resource error (fork failure): %1 + Ressourcenproblem ("fork failure"): %1 - - Forward - Vorwärts + + + + + + + + + + Process operation timed out + Zeitüberschreitung - - Stop - Abbrechen + + + + + Error reading from process + Das Lesen vom Prozess schlug fehl - - Refresh - Aktualisieren + + + + Error writing to process + Das Schreiben zum Prozess schlug fehl - - Volume Down - Lautstärke - + + Process crashed + Der Prozess ist abgestürzt - - Volume Mute - Ton aus + + No program defined + Es wurde kein Programm angegeben - - Volume Up - Lautstärke + + + Process failed to start: %1 + Das Starten des Prozesses schlug fehl: %1 + + + QProgressDialog - - Bass Boost - Bass-Boost + + Cancel + Abbrechen + + + QPushButton - - Bass Up - Bass + + + Open + Öffnen + + + QRadioButton - - Bass Down - Bass - + + Check + Ankreuzen + + + QRegExp - - Treble Up - Höhen + + + no error occurred + kein Fehler - Treble Down - Höhen - + disabled feature used + deaktivierte Eigenschaft wurde benutzt - Media Play - Wiedergabe + bad char class syntax + falsche Syntax für Zeichenklasse - Media Stop - Stopp + bad lookahead syntax + falsche Syntax für Lookahead - Media Previous - Vorheriger + bad repetition syntax + falsche Syntax für Wiederholungen - Media Next - Nächster + invalid octal value + ungültiger Oktal-Wert - Media Record - Aufzeichnen + missing left delim + fehlende linke Begrenzung - - Favorites - Favoriten + + unexpected end + unerwartetes Ende - Search - Suchen + met internal limit + internes Limit erreicht - Standby - Standby + invalid interval + ungültiges Intervall - Open URL - URL öffnen + invalid category + ungültige Kategorie + + + QSQLite2Driver - - Launch Mail - Mail starten + + Error opening database + Die Datenbankverbindung konnte nicht geöffnet werden - - Launch Media - Medienspieler starten + + Unable to begin transaction + Es konnte keine Transaktion gestartet werden - - Launch (0) - (0) starten + + Unable to commit transaction + Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - Launch (1) - (1) starten + + Unable to rollback transaction + Die Transaktion kann nicht rückgängig gemacht werden + + + QSQLite2Result - - Launch (2) - (2) starten + + Unable to fetch results + Das Ergebnis konnte nicht abgeholt werden - - Launch (3) - (3) starten + + Unable to execute statement + Der Befehl konnte nicht ausgeführt werden + + + QSQLiteDriver - - Launch (4) - (4) starten + + Error opening database + Die Datenbankverbindung konnte nicht geöffnet werden - - Launch (5) - (5) starten + + Error closing database + Die Datenbankverbindung konnte nicht geschlossen werden - - Launch (6) - (6) starten + + Unable to begin transaction + Es konnte keine Transaktion gestartet werden - - Launch (7) - (7) starten + + Unable to commit transaction + Die Transaktion konnte nicht durchgeführt werden (Operation 'commit' fehlgeschlagen) - - Launch (8) - (8) starten + + Unable to rollback transaction + Die Transaktion konnte nicht rückgängig gemacht werden (Operation 'rollback' fehlgeschlagen) + + + QSQLiteResult - - Launch (9) - (9) starten + + + + Unable to fetch row + Der Datensatz konnte nicht abgeholt werden - - Launch (A) - (A) starten + + Unable to execute statement + Der Befehl konnte nicht ausgeführt werden - - Launch (B) - (B) starten + + Unable to reset statement + Der Befehl konnte nicht zurückgesetzt werden - - Launch (C) - (C) starten + + Unable to bind parameters + Die Parameter konnte nicht gebunden werden - - Launch (D) - (D) starten + + Parameter count mismatch + Die Anzahl der Parameter ist falsch - - Launch (E) - (E) starten + + No query + Kein Abfrage + + + QScriptBreakpointsModel - - Launch (F) - (F) starten + + ID + ID - - Monitor Brightness Up - Monitor heller + + Location + Stelle - - Monitor Brightness Down - Monitor dunkler + + Condition + Bedingung - - Keyboard Light On/Off - Tastaturbeleuchtung Ein/Aus + + Ignore-count + Auslösen nach - - Keyboard Brightness Up - Tastaturbeleuchtung heller + + Single-shot + Einmal auslösen - - Keyboard Brightness Down - Tastaturbeleuchtung dunkler + + Hit-count + Ausgelöst + + + QScriptBreakpointsWidget - - Power Off - Ausschalten + + New + Neu - - Wake Up - Aufwecken + + Delete + Löschen + + + QScriptDebugger - - Eject - Auswerfen + + + Go to Line + Gehe zu Zeile - - Screensaver - Bildschirmschoner + + Line: + Zeile: - - WWW - Internet + + Interrupt + Unterbrechen - - Sleep - Schlafmodus + + Shift+F5 + Shift+F5 - - LightBulb - Beleuchtung + + Continue + Weiter - - Shop - Shop + + F5 + F5 - - History - Verlauf + + Step Into + Einzelschritt herein - - Add Favorite - Lesezeichen hinzufügen + + F11 + F11 - - Hot Links - Empfohlene Verweise + + Step Over + Einzelschritt über - - Adjust Brightness - Helligkeit einstellen + + F10 + F10 - - Finance - Finanzen + + Step Out + Einzelschritt heraus - - Community - Community + + Shift+F11 + Shift+F11 - - Audio Rewind - Audio rückspulen + + Run to Cursor + Bis Cursor ausführen - - Back Forward - Hinterstes nach vorn + + Ctrl+F10 + Ctrl+F10 - - Application Left - Anwendung links + + Run to New Script + Bis zu neuem Skript ausführen - - Application Right - Anwendung rechts + + Toggle Breakpoint + Haltepunkt umschalten - Book - Buch + F9 + F9 - - CD - CD + + Clear Debug Output + Debug-Ausgabe löschen - - Calculator - Rechner + + Clear Error Log + Fehlerausgabe löschen - - Clear - Löschen + + Clear Console + Konsole löschen - - Clear Grab - Zugriff löschen + + &Find in Script... + &Suche im Skript... - Close - Schließen + Ctrl+F + Ctrl+F - - Copy - Kopieren + + Find &Next + &Nächste Fundstelle - - Cut - Ausschneiden + + F3 + F3 - - Display - Anzeigen + + Find &Previous + Vorhergehende Fundstelle - - DOS - DOS + + Shift+F3 + Shift+F3 - - Documents - Dokumente + + Ctrl+G + Ctrl+G - - Spreadsheet - Spreadsheet + + Debug + Debuggen + + + QScriptDebuggerCodeFinderWidget - - Browser - Browser + + Close + Schließen - - Game - Spiel + + Previous + Vorige - - Go - Los + + Next + Nächste - - iTouch - iTouch + + Case Sensitive + Groß/Kleinschreibung beachten - - Logoff - Logoff + + Whole words + Ganze Worte - - Market - Markt + + <img src=":/qt/scripttools/debugging/images/wrap.png">&nbsp;Search wrapped + <img src=":/qt/scripttools/debugging/images/wrap.png">&nbsp;Die Suche hat das Ende erreicht + + + QScriptDebuggerLocalsModel - - Meeting - Versammlung + + Name + Name - - Keyboard Menu - Tastaturmenü + + Value + Wert + + + QScriptDebuggerStackModel - - Menu PB - Menü PB + + Level + Ebene - - My Sites - Meine Orte + + Name + Name - - News - Nachrichten + + Location + Stelle + + + QScriptEdit - - Home Office - Home Office + + Toggle Breakpoint + Haltepunkt umschalten - - Option - Option + + Disable Breakpoint + Haltepunkt deaktivieren - Paste - Einfügen + Enable Breakpoint + Haltepunkt aktivieren - - Phone - Telefon + + Breakpoint Condition: + Bedingung: + + + QScriptEngineDebugger - - Reply - Antworten + + Loaded Scripts + Geladene Skripte - - Reload - Neu laden + + Breakpoints + Haltepunkte - - Rotate Windows - Fenster rotieren + + Stack + Stapel - - Rotation PB - Rotation PB + + Locals + Lokale Variablen - - Rotation KB - Rotation KB + + Console + Konsole - - Save - Speichern + + Debug Output + Debug-Ausgabe - - Send - Senden + + Error Log + Fehlerausgabe - - Spellchecker - Rechtschreibprüfung + + Search + Suche - - Split Screen - Bildschirm teilen + + View + Ansicht - - Support - Hilfe + + Qt Script Debugger + Qt Script Debugger + + + QScriptNewBreakpointWidget - - Task Panel - Task-Leiste + + Close + Schließen + + + QScrollBar - - Terminal - Terminal + + Scroll here + Hierher scrollen - - Tools - Werkzeuge + + Left edge + Linker Rand - - Travel - Reise + + Top + Anfang - Video - Video + Right edge + Rechter Rand - - Word Processor - Textverarbeitung + + Bottom + Ende - - XFer - XFer + + Page left + Eine Seite nach links - - Zoom In - Vergrößern + + + Page up + Eine Seite nach oben - Zoom Out - Verkleinern + Page right + Eine Seite nach rechts - - Away - Abwesend + + + Page down + Eine Seite nach unten - - Messenger - Messenger + + Scroll left + Nach links scrollen - - WebCam - WebCam + + Scroll up + Nach oben scrollen - Mail Forward - Weiterleitung + Scroll right + Nach rechts scrollen - - Pictures - Bilder + + Scroll down + Nach unten scrollen - - Music - Musik + + Line up + Ausrichten - - Battery - Batterie + + Position + Position - - Bluetooth - Bluetooth + + Line down + Eine Zeile nach unten + + + QSharedMemory - - Wireless - Drahtlos + + %1: create size is less then 0 + %1: Die Größenangabe für die Erzeugung ist kleiner als Null - - Ultra Wide Band - Ultra Wide Band + + + %1: unable to lock + %1: Sperrung fehlgeschlagen - - Audio Forward - Audio vorspulen + + %1: unable to unlock + %1: Die Sperrung konnte nicht aufgehoben werden - - Audio Repeat - Audio wiederholen + + + + %1: permission denied + %1: Zugriff verweigert - - Audio Random Play - Audio zufällige Auswahl spielen + + + + %1: already exists + %1: existiert bereits - - Subtitle - Untertitel + + %1: doesn't exists + %1: existiert nicht - - Audio Cycle Track - Audiospur wechseln + + + + %1: out of resources + %1: Keine Ressourcen mehr verfügbar - - Time - Zeit + + + + %1: unknown error %2 + %1: Unbekannter Fehler %2 - - View - Ansicht + + %1: key is empty + %1: Ungültige Schlüsselangabe (leer) - - Top Menu - Hauptmenü + + %1: ftok failed + %1: ftok-Aufruf schlug fehl - - Suspend - Pause + + + + %1: unable to make key + %1: Es kann kein Schlüssel erzeugt werden - - Hibernate - Hibernate + + + %1: doesn't exist + %1: existiert nicht - - Print Screen - Bildschirm drucken + + %1: UNIX key file doesn't exist + %1: Die Unix-Schlüsseldatei existiert nicht - - Page Up - Bild aufwärts + + %1: system-imposed size restrictions + %1: Ein systembedingtes Limit der Größe wurde erreicht + + + + %1: not attached + %1: nicht verbunden - - Page Down - Bild abwärts + + + %1: invalid size + %1: Ungültige Größe - - Caps Lock - Feststelltaste + + + %1: key error + %1: Fehlerhafter Schlüssel - - Num Lock - Zahlen-Feststelltaste + + %1: size query failed + %1: Die Abfrage der Größe schlug fehl - - Number Lock - Zahlen-Feststelltaste + + %1: unable to set key on lock + %1: Es kann kein Schlüssel für die Sperrung gesetzt werden + + + QShortcut - - Scroll Lock - Rollen-Feststelltaste + + Space + Leertaste - Insert - Einfügen + Esc + Esc - Delete - Löschen + Tab + Tab - Escape - Escape + Backtab + Rück-Tab - System Request - System Request + Backspace + Rücktaste - - - Select - Auswählen + + Return + Return - Yes - Ja + Enter + Enter - No - Nein + Ins + Einfg - - Context1 - Kontext1 + + Del + Entf - Context2 - Kontext2 + Pause + Pause - Context3 - Kontext3 + Print + Druck - Context4 - Kontext4 + SysReq + SysReq - Call - Anruf + Home + Pos1 - Hangup - Auflegen + End + Ende - Flip - Umdrehen + Left + Links - - - Ctrl - Strg + + Up + Hoch - - - Shift - Umschalt + + Right + Rechts - - - Alt - Alt + + Down + Runter - - - Meta - Meta + + PgUp + Bild aufwärts - - + - + + + PgDown + Bild abwärts - - F%1 - F%1 + + CapsLock + Feststelltaste - - Home Page - Startseite + + NumLock + Zahlen-Feststelltaste - - - QSlider - - Page left - Eine Seite nach links + + ScrollLock + Rollen-Feststelltaste - - Page up - Eine Seite nach oben + + Menu + Menü - - Position - Position + + Help + Hilfe - - Page right - Eine Seite nach rechts + + Back + Zurück - - Page down - Eine Seite nach unten + + Forward + Vorwärts - - - QSocks5SocketEngine - - Connection to proxy refused - Der Proxy-Server hat den Aufbau einer Verbindung verweigert + + Stop + Abbrechen - - Connection to proxy closed prematurely - Der Proxy-Server hat die Verbindung vorzeitig beendet + + Refresh + Aktualisieren - - Proxy host not found - Der Proxy-Server konnte nicht gefunden werden + + Volume Down + Lautstärke - - - Connection to proxy timed out - Bei der Verbindung mit dem Proxy-Server wurde ein Zeitlimit überschritten + + Volume Mute + Ton aus - - Proxy authentication failed - Die Authentifizierung beim Proxy-Server schlug fehl + + Volume Up + Lautstärke + - Proxy authentication failed: %1 - Die Authentifizierung beim Proxy-Server schlug fehl: %1 + Bass Boost + Bass-Boost - - SOCKS version 5 protocol error - Protokoll-Fehler (SOCKS version 5) + + Bass Up + Bass + - - General SOCKSv5 server failure - Allgemeiner Fehler bei der Kommunikation mit dem SOCKSv5-Server + + Bass Down + Bass - - - Connection not allowed by SOCKSv5 server - Der SOCKSv5-Server hat die Verbindung verweigert + + Treble Up + Höhen + - - TTL expired - TTL verstrichen + + Treble Down + Höhen - - - SOCKSv5 command not supported - Dieses SOCKSv5-Kommando wird nicht unterstützt + + Media Play + Wiedergabe - - Address type not supported - Dieser Adresstyp wird nicht unterstützt + + Media Stop + Stopp - - Unknown SOCKSv5 proxy error code 0x%1 - Unbekannten Fehlercode vom SOCKSv5-Proxy-Server erhalten: 0x%1 + + Media Previous + Vorheriger - - - Network operation timed out - Das Zeitlimit für die Operation wurde überschritten + + + Media Next + Nächster - - - QSoftKeyManager - - Ok - Ok + + Media Record + Aufzeichnen - - Select - Auswählen + + Favorites + Favoriten - - Done - Fertig + + Search + Suchen - - Options - Optionen + + Standby + Standby - - Cancel - Abbrechen + + Open URL + URL öffnen - - Exit - Beenden + + Launch Mail + Mail starten - - - QSpinBox - - More - Mehr + + Launch Media + Medienspieler starten - - Less - Weniger + + Launch (0) + (0) starten - - - QSql - - Delete - Löschen + + Launch (1) + (1) starten - Delete this record? - Diesen Datensatz löschen? + Launch (2) + (2) starten - - - Yes - Ja + Launch (3) + (3) starten - - - - No - Nein + + Launch (4) + (4) starten - - Insert - Einfügen + + Launch (5) + (5) starten - - Update - Aktualisieren + + Launch (6) + (6) starten - - Save edits? - Änderungen speichern? + + Launch (7) + (7) starten - - Cancel - Abbrechen + + Launch (8) + (8) starten - - Confirm - Bestätigen + + Launch (9) + (9) starten - Cancel your edits? - Änderungen verwerfen? + Launch (A) + (A) starten - - - QSslSocket - - Unable to write data: %1 - Die Daten konnten nicht geschrieben werden: %1 + + Launch (B) + (B) starten - - Unable to decrypt data: %1 - Die Daten konnten nicht entschlüsselt werden: %1 + + Launch (C) + (C) starten - - Error while reading: %1 - Beim Lesen ist ein Fehler aufgetreten: %1 + + Launch (D) + (D) starten - - Error during SSL handshake: %1 - Im Ablauf des SSL-Protokolls ist ein Fehler aufgetreten: %1 + + Launch (E) + (E) starten - - Error creating SSL context (%1) - Es konnte keine SSL-Kontextstruktur erzeugt werden (%1) + + Launch (F) + (F) starten - - Invalid or empty cipher list (%1) - Ungültige oder leere Schlüsselliste (%1) + + Monitor Brightness Up + Monitor heller - - Private key does not certify public key, %1 - Der private Schlüssel passt nicht zum öffentlichen Schlüssel, %1 + + Monitor Brightness Down + Monitor dunkler - - Error creating SSL session, %1 - Es konnte keine SSL-Sitzung erzeugt werden, %1 + + Keyboard Light On/Off + Tastaturbeleuchtung Ein/Aus - - Error creating SSL session: %1 - Es konnte keine SSL-Sitzung erzeugt werden: %1 + + Keyboard Brightness Up + Tastaturbeleuchtung heller - - Cannot provide a certificate with no key, %1 - Ohne Schlüssel kann kein Zertifikat zur Verfügung gestellt werden, %1 + + Keyboard Brightness Down + Tastaturbeleuchtung dunkler - - Error loading local certificate, %1 - Das lokale Zertifikat konnte nicht geladen werden, %1 + + Power Off + Ausschalten - - Error loading private key, %1 - Der private Schlüssel konnte nicht geladen werden, %1 + + Wake Up + Aufwecken - - No error - Kein Fehler + + Eject + Auswerfen - - The issuer certificate could not be found - Das Zertifikat des Ausstellers konnte nicht gefunden werden + + Screensaver + Bildschirmschoner - - The certificate signature could not be decrypted - Die Signatur des Zertifikats konnte nicht entschlüsselt werden + + WWW + Internet - - The public key in the certificate could not be read - Der öffentliche Schlüssel konnte nicht gelesen werden + + Sleep + Schlafmodus - - The signature of the certificate is invalid - Die Signatur des Zertifikats ist ungültig + + LightBulb + Beleuchtung - - The certificate is not yet valid - Das Zertifikat ist noch nicht gültig + + Shop + Shop - - The certificate has expired - Die Gültigkeit des Zertifikats ist abgelaufen + + History + Verlauf - - The certificate's notBefore field contains an invalid time - Das Feld 'notBefore' des Zertifikats enthält eine ungültige Zeit + + Add Favorite + Lesezeichen hinzufügen - - The certificate's notAfter field contains an invalid time - Das Feld 'notAfter' des Zertifikats enthält eine ungültige Zeit + + Hot Links + Empfohlene Verweise - - The certificate is self-signed, and untrusted - Das Zertifikat ist selbstsigniert und daher nicht vertrauenswürdig + + Adjust Brightness + Helligkeit einstellen - - The root certificate of the certificate chain is self-signed, and untrusted - Das oberste Zertifikat der Kette ist selbstsigniert und daher nicht vertrauenswürdig + + Finance + Finanzen - - The issuer certificate of a locally looked up certificate could not be found - Das Zertifikat des Ausstellers eines lokal gefundenen Zertifikats konnte nicht gefunden werden + + Community + Community - - No certificates could be verified - Keines der Zertifikate konnte verifiziert werden + + Audio Rewind + Audio rückspulen - - One of the CA certificates is invalid - Eines der Zertifikate der Zertifizierungsstelle ist ungültig + + Back Forward + Hinterstes nach vorn - - The basicConstraints path length parameter has been exceeded - Die Länge des basicConstraints-Pfades wurde überschritten + + Application Left + Anwendung links - - The supplied certificate is unsuitable for this purpose - Das angegebene Zertifikat kann in diesem Fall nicht verwendet werden + + Application Right + Anwendung rechts - - The root CA certificate is not trusted for this purpose - Das oberste Zertifikat der Zertifizierungsstelle ist für diesen Fall nicht vertrauenswürdig + + Book + Buch - - The root CA certificate is marked to reject the specified purpose - Das oberste Zertifikat der Zertifizierungsstelle weist diesen Fall auf Grund einer speziellen Kennzeichnung zurück + + CD + CD - - The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate - Das Zertifikat des betrachteten Ausstellers wurde zurückgewiesen da sein Subjektname nicht dem Namen des Austellers des aktuellen Zertifikats entspricht + + Calculator + Rechner - - The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate - Das Zertifikat des betrachteten Ausstellers wurde zurückgewiesen da Ausstellername und Seriennummer vorhanden sind und nicht dem Bezeichner der Zertifizierungsstelle des aktuellen Zertifikats entsprechen + + Clear + Löschen - - The peer did not present any certificate - Die Gegenstelle hat kein Zertifikat angegeben + + Clear Grab + Zugriff löschen - - The host name did not match any of the valid hosts for this certificate - Der Name des Hosts ist keiner aus der Liste der für dieses Zertifikat gültigen Hosts + + Close + Schließen - - Unknown error - Unbekannter Fehler + + Copy + Kopieren - - - QStateMachine - - Missing initial state in compound state '%1' - Der Anfangszustand des zusammengesetzten Zustands '%1' fehlt + + Cut + Ausschneiden - - Missing default state in history state '%1' - Der Anfangszustand im Verlauf bei Zustand '%1' fehlt + + Display + Anzeigen - - No common ancestor for targets and source of transition from state '%1' - Die Ziele und die Quelle des Übergangs vom Zustand '%1' haben keinen gemeinsamen Ursprung + + DOS + DOS - - Unknown error - Unbekannter Fehler + + Documents + Dokumente - - - QSystemSemaphore - - %1: does not exist - %1: Nicht existent + + Spreadsheet + Spreadsheet - - - %1: out of resources - %1: Keine Ressourcen mehr verfügbar + + Browser + Browser - - - %1: permission denied - %1: Zugriff verweigert + + Game + Spiel - - %1: already exists - %1: Existiert bereits + + Go + Los - - - %1: unknown error %2 - %1: Unbekannter Fehler %2 + + iTouch + iTouch - - - QTDSDriver - - Unable to open connection - Die Datenbankverbindung kann nicht geöffnet werden + + Logoff + Logoff - - Unable to use database - Die Datenbank kann nicht verwendet werden + + Market + Markt - - - QTabBar - - Scroll Left - Nach links scrollen + + Meeting + Versammlung - - Scroll Right - Nach rechts scrollen + + Keyboard Menu + Tastaturmenü - - - QTcpServer - - Operation on socket is not supported - Diese Socket-Operation wird nicht unterstützt + + Menu PB + Menü PB - - - QTextControl - - &Undo - &Rückgängig + + My Sites + Meine Orte - - &Redo - Wieder&herstellen + + News + Nachrichten - - Cu&t - &Ausschneiden + + Home Office + Home Office - - &Copy - &Kopieren + + Option + Option - - Copy &Link Location - &Link-Adresse kopieren + + Paste + Einfügen - - &Paste - Einf&ügen + + Phone + Telefon - - Delete - Löschen + + Reply + Antworten - - Select All - Alles auswählen + + Reload + Neu laden - - - QToolButton - - - Press - Drücken + + Rotate Windows + Fenster rotieren - - - Open - Öffnen + + Rotation PB + Rotation PB - - - QUdpSocket - - This platform does not support IPv6 - Diese Plattform unterstützt kein IPv6 + + Rotation KB + Rotation KB + + + + Save + Speichern - - - QUndoGroup - - Undo - Rückgängig + + Send + Senden - - Redo - Wiederherstellen + + Spellchecker + Rechtschreibprüfung - - - QUndoModel - - <empty> - <leer> + + Split Screen + Bildschirm teilen - - - QUndoStack - - Undo - Rückgängig + + Support + Hilfe - - Redo - Wiederherstellen + + Task Panel + Task-Leiste - - - QUnicodeControlCharacterMenu - - LRM Left-to-right mark - LRM Left-to-right mark + + Terminal + Terminal - RLM Right-to-left mark - RLM Right-to-left mark + Tools + Werkzeuge - ZWJ Zero width joiner - ZWJ Zero width joiner + Travel + Reise - ZWNJ Zero width non-joiner - ZWNJ Zero width non-joiner + Video + Video - ZWSP Zero width space - ZWSP Zero width space + Word Processor + Textverarbeitung - LRE Start of left-to-right embedding - LRE Start of left-to-right embedding + XFer + XFer - RLE Start of right-to-left embedding - RLE Start of right-to-left embedding + Zoom In + Vergrößern - LRO Start of left-to-right override - LRO Start of left-to-right override + Zoom Out + Verkleinern - RLO Start of right-to-left override - RLO Start of right-to-left override + Away + Abwesend - PDF Pop directional formatting - PDF Pop directional formatting + Messenger + Messenger - - Insert Unicode control character - Unicode-Kontrollzeichen einfügen + + WebCam + WebCam - - - QWebFrame - - Request cancelled - Anfrage wurde abgebrochen + + Mail Forward + Weiterleitung - - Request blocked - Anfrage wurde abgewiesen + + Pictures + Bilder - - Cannot show URL - Der URL kann nicht angezeigt werden + + Music + Musik - - Frame load interrupted by policy change - Das Laden des Rahmens wurde durch eine Änderung der Richtlinien unterbrochen + + Battery + Batterie - - Cannot show mimetype - Dieser Mime-Typ kann nicht angezeigt werden + + Bluetooth + Bluetooth - - File does not exist - Die Datei existiert nicht + + Wireless + Drahtlos - - - QWebPage - - Submit - default label for Submit buttons in forms on web pages - Senden + + Ultra Wide Band + Ultra Wide Band - - Submit - Submit (input element) alt text for <input> elements with no alt, title, or value - Senden + + Audio Forward + Audio vorspulen - - Reset - default label for Reset buttons in forms on web pages - Rücksetzen + + Audio Repeat + Audio wiederholen - - Choose File - title for file button used in HTML forms - Durchsuchen + + Audio Random Play + Audio zufällige Auswahl spielen - - No file selected - text to display in file button used in HTML forms when no file is selected - Es ist keine Datei ausgewählt + + Subtitle + Untertitel - - Open in New Window - Open in New Window context menu item - In neuem Fenster öffnen + + Audio Cycle Track + Audiospur wechseln - - Save Link... - Download Linked File context menu item - Ziel speichern unter... + + Time + Zeit - - Copy Link - Copy Link context menu item - Link-Adresse kopieren + + View + Ansicht - - Open Image - Open Image in New Window context menu item - Grafik in neuem Fenster öffnen + + Top Menu + Hauptmenü - - Save Image - Download Image context menu item - Grafik speichern unter + + Suspend + Pause - - Copy Image - Copy Link context menu item - Grafik kopieren + + Hibernate + Hibernate - - Open Frame - Open Frame in New Window context menu item - Frame öffnen + + Print Screen + Bildschirm drucken - - Copy - Copy context menu item - Kopieren + + Page Up + Bild aufwärts - - Go Back - Back context menu item - Zurück + + Page Down + Bild abwärts - - Go Forward - Forward context menu item - Vor + + Caps Lock + Feststelltaste - - Stop - Stop context menu item - Abbrechen + + Num Lock + Zahlen-Feststelltaste - - Reload - Reload context menu item - Neu laden + + Number Lock + Zahlen-Feststelltaste - - Cut - Cut context menu item - Ausschneiden + + Scroll Lock + Rollen-Feststelltaste - - Paste - Paste context menu item + + Insert Einfügen - - No Guesses Found - No Guesses Found context menu item - Keine Vorschläge gefunden - - - - Ignore - Ignore Spelling context menu item - Ignorieren + + Delete + Löschen - - Add To Dictionary - Learn Spelling context menu item - In Wörterbuch aufnehmen + + Escape + Escape - - Search The Web - Search The Web context menu item - Im Web suchen + + System Request + System Request - - Look Up In Dictionary - Look Up in Dictionary context menu item - Im Wörterbuch nachschauen + + + Select + Auswählen - - Open Link - Open Link context menu item - Adresse öffnen + + Yes + Ja - - Ignore - Ignore Grammar context menu item - Ignorieren + + No + Nein - - Spelling - Spelling and Grammar context sub-menu item - Rechtschreibung + + Context1 + Kontext1 - - Show Spelling and Grammar - menu item title - Rechtschreibung und Grammatik anzeigen + + Context2 + Kontext2 - Hide Spelling and Grammar - menu item title - Rechtschreibung und Grammatik nicht anzeigen + Context3 + Kontext3 - - Check Spelling - Check spelling context menu item - Rechtschreibung prüfen + + Context4 + Kontext4 - - Check Spelling While Typing - Check spelling while typing context menu item - Rechtschreibung während des Schreibens überprüfen + + Call + Anruf - - Check Grammar With Spelling - Check grammar with spelling context menu item - Grammatik mit Rechtschreibung zusammen überprüfen + + Hangup + Auflegen - - Fonts - Font context sub-menu item - Fonts + + Flip + Umdrehen - - Bold - Bold context menu item - Fett + + + Ctrl + Strg - - Italic - Italic context menu item - Kursiv + + + Shift + Umschalt - - Underline - Underline context menu item - Unterstrichen + + + Alt + Alt - - Outline - Outline context menu item - Umriss + + + Meta + Meta - - Direction - Writing direction context sub-menu item - Schreibrichtung + + + + + - - Text Direction - Text direction context sub-menu item - Schreibrichtung + + F%1 + F%1 - - Default - Default writing direction context menu item - Vorgabe + + Home Page + Startseite + + + QSlider - - Left to Right - Left to Right context menu item - Von links nach rechts + + Page left + Eine Seite nach links - - Right to Left - Right to Left context menu item - Von rechts nach links + + Page up + Eine Seite nach oben - - Loading... - Media controller status message when the media is loading - Lädt... + + Position + Position - - Live Broadcast - Media controller status message when watching a live broadcast - Live-Übertragung + + Page right + Eine Seite nach rechts - - Audio Element - Media controller element - Audio-Element + + Page down + Eine Seite nach unten + + + QSocks5SocketEngine - - Video Element - Media controller element - Video-Element + + Connection to proxy refused + Der Proxy-Server hat den Aufbau einer Verbindung verweigert - - Mute Button - Media controller element - Stummschalttaste + + Connection to proxy closed prematurely + Der Proxy-Server hat die Verbindung vorzeitig beendet - - Unmute Button - Media controller element - Abstelltaste für Stummschaltung + + Proxy host not found + Der Proxy-Server konnte nicht gefunden werden - - Play Button - Media controller element - Abspielknopf + + Connection to proxy timed out + Bei der Verbindung mit dem Proxy-Server wurde ein Zeitlimit überschritten - - Pause Button - Media controller element - Pause-Knopf + + Proxy authentication failed + Die Authentifizierung beim Proxy-Server schlug fehl - - Slider - Media controller element - Schieberegler + + Proxy authentication failed: %1 + Die Authentifizierung beim Proxy-Server schlug fehl: %1 - - Slider Thumb - Media controller element - Schieberegler-Griff + + SOCKS version 5 protocol error + Protokoll-Fehler (SOCKS version 5) - - Rewind Button - Media controller element - Rückspultaste + + General SOCKSv5 server failure + Allgemeiner Fehler bei der Kommunikation mit dem SOCKSv5-Server - - Return to Real-time Button - Media controller element - Kehre zu Echtzeit zurück + + Connection not allowed by SOCKSv5 server + Der SOCKSv5-Server hat die Verbindung verweigert - - Elapsed Time - Media controller element - Spielzeit + + TTL expired + TTL verstrichen - - Remaining Time - Media controller element - Verbleibende Zeit + + SOCKSv5 command not supported + Dieses SOCKSv5-Kommando wird nicht unterstützt - - Status Display - Media controller element - Statusanzeige + + Address type not supported + Dieser Adresstyp wird nicht unterstützt - - Fullscreen Button - Media controller element - Vollbild-Taste + + Unknown SOCKSv5 proxy error code 0x%1 + Unbekannten Fehlercode vom SOCKSv5-Proxy-Server erhalten: 0x%1 - - Seek Forward Button - Media controller element - Vorlauftaste + + Network operation timed out + Das Zeitlimit für die Operation wurde überschritten + + + QSoftKeyManager - - Seek Back Button - Media controller element - Rücklauftaste + + Ok + Ok - - Audio element playback controls and status display - Media controller element - Audio-Steuerung und Statusanzeige + + Select + Auswählen - - Video element playback controls and status display - Media controller element - Video-Steuerung und Statusanzeige + + Done + Fertig - - Mute audio tracks - Media controller element - Schalte Tonspuren stumm + + Options + Optionen - - Unmute audio tracks - Media controller element - Stummschaltung der Tonspuren aufheben + + Cancel + Abbrechen - - Begin playback - Media controller element - Abspielen + + Exit + Beenden + + + QSpinBox - - Pause playback - Media controller element - Pause + + More + Mehr - Movie time scrubber - Media controller element - Abspielzeit + Less + Weniger + + + QSql - - Movie time scrubber thumb - Media controller element - Griff zur Einstellung der Abspielzeit + + Delete + Löschen - - Rewind movie - Media controller element - Film zurückspulen + + Delete this record? + Diesen Datensatz löschen? - - Return streaming movie to real-time - Media controller element - Setze Film auf Echtzeit zurück + + + + Yes + Ja - - Current movie time - Media controller element - Abspielzeit des Films + + + + No + Nein - - Remaining movie time - Media controller element - Verbleibende Zeit des Films + + Insert + Einfügen - Current movie status - Media controller element - Status des Films + Update + Aktualisieren - - Play movie in full-screen mode - Media controller element - Film im Vollbildmodus abspielen + + Save edits? + Änderungen speichern? - - Seek quickly back - Media controller element - Schnelles Rückwärtssuchen + + Cancel + Abbrechen - - Seek quickly forward - Media controller element - Schnelles Vorwärtssuchen + + Confirm + Bestätigen - - Indefinite time - Media time description - Unbegrenzte Zeit + + Cancel your edits? + Änderungen verwerfen? + + + QSslSocket - - %1 days %2 hours %3 minutes %4 seconds - Media time description - %1 Tage %2 Stunden %3 Minuten %4 Sekunden + + Unable to write data: %1 + Die Daten konnten nicht geschrieben werden: %1 - - %1 hours %2 minutes %3 seconds - Media time description - %1 Stunden %2 Minuten %3 Sekunden + + Unable to decrypt data: %1 + Die Daten konnten nicht entschlüsselt werden: %1 - - %1 minutes %2 seconds - Media time description - %1 Minuten %2 Sekunden + + Error while reading: %1 + Beim Lesen ist ein Fehler aufgetreten: %1 - - %1 seconds - Media time description - %1 Sekunden + + Error during SSL handshake: %1 + Im Ablauf des SSL-Protokolls ist ein Fehler aufgetreten: %1 - - Inspect - Inspect Element context menu item - Prüfen + + Error creating SSL context (%1) + Es konnte keine SSL-Kontextstruktur erzeugt werden (%1) - - No recent searches - Label for only item in menu that appears when clicking on the search field image, when no searches have been performed - Es existieren noch keine Suchanfragen + + Invalid or empty cipher list (%1) + Ungültige oder leere Schlüsselliste (%1) - - Recent searches - label for first item in the menu that appears when clicking on the search field image, used as embedded menu title - Bisherige Suchanfragen + + Private key does not certify public key, %1 + Der private Schlüssel passt nicht zum öffentlichen Schlüssel, %1 - - Clear recent searches - menu item in Recent Searches menu that empties menu's contents - Gespeicherte Suchanfragen löschen + + Error creating SSL session, %1 + Es konnte keine SSL-Sitzung erzeugt werden, %1 - - Unknown - Unknown filesize FTP directory listing item - Unbekannt + + Error creating SSL session: %1 + Es konnte keine SSL-Sitzung erzeugt werden: %1 - - Web Inspector - %2 - Web Inspector - %2 + + Cannot provide a certificate with no key, %1 + Ohne Schlüssel kann kein Zertifikat zur Verfügung gestellt werden, %1 - - %1 (%2x%3 pixels) - Title string for images - %1 (%2x%3 Pixel) + + Error loading local certificate, %1 + Das lokale Zertifikat konnte nicht geladen werden, %1 - - Bad HTTP request - Ungültige HTTP-Anforderung + + Error loading private key, %1 + Der private Schlüssel konnte nicht geladen werden, %1 + + + + No error + Kein Fehler - - This is a searchable index. Enter search keywords: - text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index' - Dieser Index verfügt über eine Suchfunktion. Geben Sie einen Suchbegriff ein: + + The issuer certificate could not be found + Das Zertifikat des Ausstellers konnte nicht gefunden werden - - Scroll here - Hierher scrollen + + The certificate signature could not be decrypted + Die Signatur des Zertifikats konnte nicht entschlüsselt werden - Left edge - Linker Rand + The public key in the certificate could not be read + Der öffentliche Schlüssel konnte nicht gelesen werden - - Top - Anfang + + The signature of the certificate is invalid + Die Signatur des Zertifikats ist ungültig - - Right edge - Rechter Rand + + The certificate is not yet valid + Das Zertifikat ist noch nicht gültig - - Bottom - Ende + + The certificate has expired + Die Gültigkeit des Zertifikats ist abgelaufen - Page left - Eine Seite nach links + The certificate's notBefore field contains an invalid time + Das Feld 'notBefore' des Zertifikats enthält eine ungültige Zeit - - Page up - Eine Seite nach oben + + The certificate's notAfter field contains an invalid time + Das Feld 'notAfter' des Zertifikats enthält eine ungültige Zeit - - Page right - Eine Seite nach rechts + + The certificate is self-signed, and untrusted + Das Zertifikat ist selbstsigniert und daher nicht vertrauenswürdig - - Page down - Eine Seite nach unten + + The root certificate of the certificate chain is self-signed, and untrusted + Das oberste Zertifikat der Kette ist selbstsigniert und daher nicht vertrauenswürdig - Scroll left - Nach links scrollen + The issuer certificate of a locally looked up certificate could not be found + Das Zertifikat des Ausstellers eines lokal gefundenen Zertifikats konnte nicht gefunden werden - - Scroll up - Nach oben scrollen + + No certificates could be verified + Keines der Zertifikate konnte verifiziert werden - - Scroll right - Nach rechts scrollen + + One of the CA certificates is invalid + Eines der Zertifikate der Zertifizierungsstelle ist ungültig - - Scroll down - Nach unten scrollen - - - - %n file(s) - number of chosen file - - Eine Datei - %n Dateien - + + The basicConstraints path length parameter has been exceeded + Die Länge des basicConstraints-Pfades wurde überschritten - - JavaScript Alert - %1 - JavaScript-Hinweis - %1 + + The supplied certificate is unsuitable for this purpose + Das angegebene Zertifikat kann in diesem Fall nicht verwendet werden - - JavaScript Confirm - %1 - JavaScript-Bestätigung - %1 + + The root CA certificate is not trusted for this purpose + Das oberste Zertifikat der Zertifizierungsstelle ist für diesen Fall nicht vertrauenswürdig - - JavaScript Prompt - %1 - JavaScript-Eingabeaufforderung - %1 + + The root CA certificate is marked to reject the specified purpose + Das oberste Zertifikat der Zertifizierungsstelle weist diesen Fall auf Grund einer speziellen Kennzeichnung zurück - - JavaScript Problem - %1 - JavaScript-Problem - %1 + + The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate + Das Zertifikat des betrachteten Ausstellers wurde zurückgewiesen da sein Subjektname nicht dem Namen des Austellers des aktuellen Zertifikats entspricht - - The script on this page appears to have a problem. Do you want to stop the script? - Das Skript dieser Webseite ist fehlerhaft. Möchten Sie es anhalten? + + The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate + Das Zertifikat des betrachteten Ausstellers wurde zurückgewiesen da Ausstellername und Seriennummer vorhanden sind und nicht dem Bezeichner der Zertifizierungsstelle des aktuellen Zertifikats entsprechen - - Move the cursor to the next character - Positionsmarke auf folgendes Zeichen setzen + + The peer did not present any certificate + Die Gegenstelle hat kein Zertifikat angegeben - Move the cursor to the previous character - Positionsmarke auf vorangehendes Zeichen setzen + The host name did not match any of the valid hosts for this certificate + Der Name des Hosts ist keiner aus der Liste der für dieses Zertifikat gültigen Hosts - - Move the cursor to the next word - Positionsmarke auf folgendes Wort setzen + + Unknown error + Unbekannter Fehler + + + QStateMachine - - Move the cursor to the previous word - Positionsmarke auf vorangehendes Wort setzen + + Missing initial state in compound state '%1' + Der Anfangszustand des zusammengesetzten Zustands '%1' fehlt - - Move the cursor to the next line - Positionsmarke auf folgende Zeile setzen + + Missing default state in history state '%1' + Der Anfangszustand im Verlauf bei Zustand '%1' fehlt - - Move the cursor to the previous line - Positionsmarke auf vorangehende Zeile setzen + + No common ancestor for targets and source of transition from state '%1' + Die Ziele und die Quelle des Übergangs vom Zustand '%1' haben keinen gemeinsamen Ursprung - - Move the cursor to the start of the line - Positionsmarke auf Zeilenanfang setzen + + Unknown error + Unbekannter Fehler + + + QSystemSemaphore - - Move the cursor to the end of the line - Positionsmarke auf Zeilenende setzen + + %1: does not exist + %1: Nicht existent - - Move the cursor to the start of the block - Positionsmarke auf Anfang des Blocks setzen + + + %1: out of resources + %1: Keine Ressourcen mehr verfügbar - - Move the cursor to the end of the block - Positionsmarke auf Ende des Blocks setzen + + + %1: permission denied + %1: Zugriff verweigert - - Move the cursor to the start of the document - Positionsmarke auf Anfang des Dokumentes setzen + + %1: already exists + %1: Existiert bereits - - Move the cursor to the end of the document - Positionsmarke auf Ende des Dokumentes setzen + + + %1: unknown error %2 + %1: Unbekannter Fehler %2 + + + QTDSDriver - - Select all - Alles auswählen + + Unable to open connection + Die Datenbankverbindung kann nicht geöffnet werden - - Select to the next character - Bis zum nächsten Zeichen markieren + + Unable to use database + Die Datenbank kann nicht verwendet werden + + + QTabBar - - Select to the previous character - Bis zum vorherigen Zeichen markieren + + Scroll Left + Nach links scrollen - - Select to the next word - Bis zum nächsten Wort markieren + + Scroll Right + Nach rechts scrollen + + + QTcpServer - - Select to the previous word - Bis zum vorherigen Wort markieren + + Operation on socket is not supported + Diese Socket-Operation wird nicht unterstützt + + + + QTextControl + + + &Undo + &Rückgängig - - Select to the next line - Bis zur nächsten Zeile markieren + + &Redo + Wieder&herstellen - - Select to the previous line - Bis zur vorherigen Zeile markieren + + Cu&t + &Ausschneiden - - Select to the start of the line - Bis zum Zeilenanfang markieren + + &Copy + &Kopieren - - Select to the end of the line - Bis zum Zeilenende markieren + + Copy &Link Location + &Link-Adresse kopieren - - Select to the start of the block - Bis zum Anfang des Blocks markieren + + &Paste + Einf&ügen - Select to the end of the block - Bis zum Ende des Blocks markieren + Delete + Löschen - - Select to the start of the document - Bis zum Anfang des Dokuments markieren + + Select All + Alles auswählen + + + QToolButton - - Select to the end of the document - Bis zum Ende des Dokuments markieren + + + Press + Drücken - - Delete to the start of the word - Bis zum Anfang des Wortes löschen + + + Open + Öffnen + + + QUdpSocket - - Delete to the end of the word - Bis zum Ende des Wortes löschen + + This platform does not support IPv6 + Diese Plattform unterstützt kein IPv6 + + + QUndoGroup - - Insert a new paragraph - Neuen Abschnitt einfügen + + Undo + Rückgängig - - Insert a new line - Neue Zeile einfügen + + Redo + Wiederherstellen + + + QUndoModel - - Paste and Match Style - Einfügen und dem Stil anpassen + + <empty> + <leer> + + + QUndoStack - - Remove formatting - Formatierung entfernen + + Undo + Rückgängig - - Strikethrough - Durchgestrichen + + Redo + Wiederherstellen + + + QUnicodeControlCharacterMenu - - Subscript - Tiefstellung + + LRM Left-to-right mark + LRM Left-to-right mark - - Superscript - Hochstellung + + RLM Right-to-left mark + RLM Right-to-left mark - - Insert Bulleted List - Liste mit Punkten einfügen + + ZWJ Zero width joiner + ZWJ Zero width joiner - - Insert Numbered List - Nummerierte Liste einfügen + + ZWNJ Zero width non-joiner + ZWNJ Zero width non-joiner - - Indent - Einrücken + + ZWSP Zero width space + ZWSP Zero width space - - Outdent - Einrückung aufheben + + LRE Start of left-to-right embedding + LRE Start of left-to-right embedding - - Center - Zentrieren + + RLE Start of right-to-left embedding + RLE Start of right-to-left embedding - - Justify - Ausrichten + + LRO Start of left-to-right override + LRO Start of left-to-right override - - Align Left - Linksbündig ausrichten + + RLO Start of right-to-left override + RLO Start of right-to-left override - - Align Right - Rechtsbündig ausrichten + + PDF Pop directional formatting + PDF Pop directional formatting - - - QWhatsThisAction - - What's This? - Direkthilfe + + Insert Unicode control character + Unicode-Kontrollzeichen einfügen - QWidget + QWebFrame - - * - * + + Request cancelled + Anfrage wurde abgebrochen - - - QWizard - - Cancel - Abbrechen + + Request blocked + Anfrage wurde abgewiesen - - Help - Hilfe + + Cannot show URL + Der URL kann nicht angezeigt werden - - < &Back - < &Zurück + + Frame load interrupted by policy change + Das Laden des Rahmens wurde durch eine Änderung der Richtlinien unterbrochen - - &Finish - Ab&schließen + + Cannot show mimetype + Dieser Mime-Typ kann nicht angezeigt werden - - &Help - &Hilfe + + File does not exist + Die Datei existiert nicht + + + QWebPage - - Go Back - Zurück + + Submit + default label for Submit buttons in forms on web pages + Senden - - Continue - Weiter + + Submit + Submit (input element) alt text for <input> elements with no alt, title, or value + Senden - Commit - Anwenden + Reset + default label for Reset buttons in forms on web pages + Rücksetzen - - Done - Fertig + + Choose File + title for file button used in HTML forms + Durchsuchen - - &Next - &Weiter + + No file selected + text to display in file button used in HTML forms when no file is selected + Es ist keine Datei ausgewählt - - &Next > - &Weiter > + + Open in New Window + Open in New Window context menu item + In neuem Fenster öffnen + + + + Save Link... + Download Linked File context menu item + Ziel speichern unter... + + + + Copy Link + Copy Link context menu item + Link-Adresse kopieren - - - QWorkspace - - &Restore - Wieder&herstellen + + Open Image + Open Image in New Window context menu item + Grafik in neuem Fenster öffnen - - &Move - Ver&schieben + + Save Image + Download Image context menu item + Grafik speichern unter - - &Size - &Größe ändern + + Copy Image + Copy Link context menu item + Grafik kopieren - - Mi&nimize - M&inimieren + + Open Frame + Open Frame in New Window context menu item + Frame öffnen - - Ma&ximize - Ma&ximieren + + Copy + Copy context menu item + Kopieren - - &Close - Schl&ießen + + Go Back + Back context menu item + Zurück - - Stay on &Top - Im &Vordergrund bleiben + + Go Forward + Forward context menu item + Vor - - Minimize - Minimieren + + Stop + Stop context menu item + Abbrechen - - Restore Down - Wiederherstellen + + Reload + Reload context menu item + Neu laden - - Close - Schließen + + Cut + Cut context menu item + Ausschneiden - - - Sh&ade - &Aufrollen + + Paste + Paste context menu item + Einfügen - - - %1 - [%2] - %1 - [%2] + + No Guesses Found + No Guesses Found context menu item + Keine Vorschläge gefunden - - &Unshade - &Herabrollen + + Ignore + Ignore Spelling context menu item + Ignorieren - - - QXml - - no error occurred - kein Fehler + + Add To Dictionary + Learn Spelling context menu item + In Wörterbuch aufnehmen - - error triggered by consumer - Konsument löste Fehler aus + + Search The Web + Search The Web context menu item + Im Web suchen - - unexpected end of file - unerwartetes Ende der Datei + + Look Up In Dictionary + Look Up in Dictionary context menu item + Im Wörterbuch nachschauen - - more than one document type definition - mehrere Dokumenttypdefinitionen + + Open Link + Open Link context menu item + Adresse öffnen - - error occurred while parsing element - Fehler beim Parsen eines Elements + + Ignore + Ignore Grammar context menu item + Ignorieren - - tag mismatch - Element-Tags sind nicht richtig geschachtelt + + Spelling + Spelling and Grammar context sub-menu item + Rechtschreibung - - error occurred while parsing content - Fehler beim Parsen des Inhalts eines Elements + + Show Spelling and Grammar + menu item title + Rechtschreibung und Grammatik anzeigen - unexpected character - unerwartetes Zeichen + Hide Spelling and Grammar + menu item title + Rechtschreibung und Grammatik nicht anzeigen - - invalid name for processing instruction - kein gültiger Name für eine Processing-Instruktion + + Check Spelling + Check spelling context menu item + Rechtschreibung prüfen - - version expected while reading the XML declaration - fehlende Version beim Parsen der XML-Deklaration + + Check Spelling While Typing + Check spelling while typing context menu item + Rechtschreibung während des Schreibens überprüfen - - wrong value for standalone declaration - falscher Wert für die Standalone-Deklaration + + Check Grammar With Spelling + Check grammar with spelling context menu item + Grammatik mit Rechtschreibung zusammen überprüfen - - error occurred while parsing document type definition - Fehler beim Parsen der Dokumenttypdefinition + + Fonts + Font context sub-menu item + Fonts - - letter is expected - ein Buchstabe ist an dieser Stelle erforderlich + + Bold + Bold context menu item + Fett - - error occurred while parsing comment - Fehler beim Parsen eines Kommentars + + Italic + Italic context menu item + Kursiv - - error occurred while parsing reference - Fehler beim Parsen einer Referenz + + Underline + Underline context menu item + Unterstrichen - - internal general entity reference not allowed in DTD - in einer DTD ist keine interne allgemeine Entity-Referenz erlaubt + + Outline + Outline context menu item + Umriss - - external parsed general entity reference not allowed in attribute value - in einem Attribut-Wert sind keine externen Entity-Referenzen erlaubt + + Direction + Writing direction context sub-menu item + Schreibrichtung - - external parsed general entity reference not allowed in DTD - in der DTD sind keine externen Entity-Referenzen erlaubt + + Text Direction + Text direction context sub-menu item + Schreibrichtung - - unparsed entity reference in wrong context - nicht-analysierte Entity-Referenz im falschen Kontext verwendet + + Default + Default writing direction context menu item + Vorgabe - - recursive entities - rekursive Entity + + Left to Right + Left to Right context menu item + Von links nach rechts - - error in the text declaration of an external entity - Fehler in der Text-Deklaration einer externen Entity + + Right to Left + Right to Left context menu item + Von rechts nach links - - encoding declaration or standalone declaration expected while reading the XML declaration - fehlende Encoding-Deklaration oder Standalone-Deklaration beim Parsen der XML-Deklaration + + Loading... + Media controller status message when the media is loading + Lädt... - - standalone declaration expected while reading the XML declaration - fehlende Standalone-Deklaration beim Parsen der XML Deklaration + + Live Broadcast + Media controller status message when watching a live broadcast + Live-Übertragung - - - QXmlPatternistCLI - - Warning in %1, at line %2, column %3: %4 - Warnung in %1, bei Zeile %2, Spalte %3: %4 + + Audio Element + Media controller element + Audio-Element - - Warning in %1: %2 - Warnung in %1: %2 + + Video Element + Media controller element + Video-Element - - Unknown location - unbekannt + + Mute Button + Media controller element + Stummschalttaste - - Error %1 in %2, at line %3, column %4: %5 - Fehler %1 in %2, bei Zeile %3, Spalte %4: %5 + + Unmute Button + Media controller element + Abstelltaste für Stummschaltung - - Error %1 in %2: %3 - Fehler %1 in %2: %3 + + Play Button + Media controller element + Abspielknopf - - - QXmlStream - - - Extra content at end of document. - Überzähliger Inhalt nach Ende des Dokumentes. + + Pause Button + Media controller element + Pause-Knopf - - Invalid entity value. - Ungültiger Entity-Wert. + + Slider + Media controller element + Schieberegler - - Invalid XML character. - Ungültiges XML-Zeichen. + + Slider Thumb + Media controller element + Schieberegler-Griff - - Sequence ']]>' not allowed in content. - Im Inhalt ist die Zeichenfolge ']]>' nicht erlaubt. + + Rewind Button + Media controller element + Rückspultaste - - Namespace prefix '%1' not declared - Der Namensraum-Präfix '%1' wurde nicht deklariert + + Return to Real-time Button + Media controller element + Kehre zu Echtzeit zurück - - Attribute redefined. - Redefinition eines Attributes. + + Elapsed Time + Media controller element + Spielzeit - - Unexpected character '%1' in public id literal. - '%1' ist kein gültiges Zeichen in einer public-id-Angabe. + + Remaining Time + Media controller element + Verbleibende Zeit - - Invalid XML version string. - Ungültige XML-Versionsangabe. + + Status Display + Media controller element + Statusanzeige - Unsupported XML version. - Diese XML-Version wird nicht unterstützt. + Fullscreen Button + Media controller element + Vollbild-Taste - - %1 is an invalid encoding name. - %1 ist kein gültiger Name für das Encoding. + + Seek Forward Button + Media controller element + Vorlauftaste - - Encoding %1 is unsupported - Das Encoding %1 wird nicht unterstützt + + Seek Back Button + Media controller element + Rücklauftaste - - Standalone accepts only yes or no. - Der Wert für das 'Standalone'-Attribut kann nur 'yes' oder 'no' sein. + + Audio element playback controls and status display + Media controller element + Audio-Steuerung und Statusanzeige - Invalid attribute in XML declaration. - Die XML-Deklaration enthält ein ungültiges Attribut. - - - - Premature end of document. - Vorzeitiges Ende des Dokuments. + Video element playback controls and status display + Media controller element + Video-Steuerung und Statusanzeige - Invalid document. - Ungültiges Dokument. + Mute audio tracks + Media controller element + Schalte Tonspuren stumm - - Expected - Es wurde + + Unmute audio tracks + Media controller element + Stummschaltung der Tonspuren aufheben - - , but got ' - erwartet, stattdessen erhalten ' + + Begin playback + Media controller element + Abspielen - - Unexpected ' - Ungültig an dieser Stelle ' + + Pause playback + Media controller element + Pause - - Expected character data. - Es wurden Zeichendaten erwartet. + + Movie time scrubber + Media controller element + Abspielzeit - - Recursive entity detected. - Es wurde eine rekursive Entity festgestellt. + + Movie time scrubber thumb + Media controller element + Griff zur Einstellung der Abspielzeit - - Start tag expected. - Öffnendes Element erwartet. + + Rewind movie + Media controller element + Film zurückspulen - - XML declaration not at start of document. - Die XML-Deklaration befindet sich nicht am Anfang des Dokuments. + + Return streaming movie to real-time + Media controller element + Setze Film auf Echtzeit zurück - - NDATA in parameter entity declaration. - Eine Parameter-Entity-Deklaration darf kein NDATA enthalten. + + Current movie time + Media controller element + Abspielzeit des Films - - %1 is an invalid processing instruction name. - %1 ist kein gültiger Name für eine Prozessing-Instruktion. + + Remaining movie time + Media controller element + Verbleibende Zeit des Films - - Invalid processing instruction name. - Der Name der Prozessing-Instruktion ist ungültig. + + Current movie status + Media controller element + Status des Films - - - - - Illegal namespace declaration. - Ungültige Namensraum-Deklaration. + + Play movie in full-screen mode + Media controller element + Film im Vollbildmodus abspielen - - Invalid XML name. - Ungültiger XML-Name. + + Seek quickly back + Media controller element + Schnelles Rückwärtssuchen - - Opening and ending tag mismatch. - Die Anzahl der öffnenden Elemente stimmt nicht mit der Anzahl der schließenden Elemente überein. + + Seek quickly forward + Media controller element + Schnelles Vorwärtssuchen - - Reference to unparsed entity '%1'. - Es wurde die ungeparste Entity '%1' referenziert. + + Indefinite time + Media time description + Unbegrenzte Zeit - - - - Entity '%1' not declared. - Die Entity '%1' ist nicht deklariert. + + %1 days %2 hours %3 minutes %4 seconds + Media time description + %1 Tage %2 Stunden %3 Minuten %4 Sekunden - - Reference to external entity '%1' in attribute value. - Im Attributwert wurde die externe Entity '%1' referenziert. + + %1 hours %2 minutes %3 seconds + Media time description + %1 Stunden %2 Minuten %3 Sekunden - - Invalid character reference. - Ungültige Zeichenreferenz. + + %1 minutes %2 seconds + Media time description + %1 Minuten %2 Sekunden - - - Encountered incorrectly encoded content. - Es wurde Inhalt mit einer ungültigen Kodierung gefunden. + + %1 seconds + Media time description + %1 Sekunden - - The standalone pseudo attribute must appear after the encoding. - Das Standalone-Pseudoattribut muss dem Encoding unmittelbar folgen. + + Inspect + Inspect Element context menu item + Prüfen - - %1 is an invalid PUBLIC identifier. - %1 ist keine gültige Angabe für eine PUBLIC-Id. + + No recent searches + Label for only item in menu that appears when clicking on the search field image, when no searches have been performed + Es existieren noch keine Suchanfragen - - - QmlAbstractAnimation - - Cannot animate non-existent property "%1" - Die Eigenschaft '%1" existiert nicht und kann daher nicht animiert werden + + Recent searches + label for first item in the menu that appears when clicking on the search field image, used as embedded menu title + Bisherige Suchanfragen - - Cannot animate read-only property "%1" - Die Eigenschaft '%1" ist schreibgeschützt und kann daher nicht animiert werden + + Clear recent searches + menu item in Recent Searches menu that empties menu's contents + Gespeicherte Suchanfragen löschen - - - QmlBehavior - - Cannot change the animation assigned to a Behavior. - Die zu einem Behavior-Element gehörende Animation kann nicht geändert werden. + + Unknown + Unknown filesize FTP directory listing item + Unbekannt - - - QmlBinding - - Binding loop detected for property "%1" - Bei der für die Eigenschaft "%1" angegebenen Bindung wurde eine Schleife festgestellt + + Web Inspector - %2 + Web Inspector - %2 - - - QmlCompiler - - - - - Invalid property assignment: "%1" is a read-only property - Ungültige Zuweisung bei Eigenschaft: "%1" ist schreibgeschützt + + %1 (%2x%3 pixels) + Title string for images + %1 (%2x%3 Pixel) - - Invalid property assignment: unknown enumeration - Ungültige Zuweisung bei Eigenschaft: Ungültiger Aufzählungswert + + Bad HTTP request + Ungültige HTTP-Anforderung - - Invalid property assignment: string expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeichenkette erwartet + + This is a searchable index. Enter search keywords: + text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index' + Dieser Index verfügt über eine Suchfunktion. Geben Sie einen Suchbegriff ein: - - Invalid property assignment: url expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine URL erwartet + + Scroll here + Hierher scrollen - - Invalid property assignment: unsigned int expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine vorzeichenloser Ganzzahlwert erwartet + + Left edge + Linker Rand - - Invalid property assignment: int expected - Ungültige Zuweisung bei Eigenschaft: Es wird ein Ganzzahlwert erwartet + + Top + Anfang - - Invalid property assignment: float expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl erwartet + + Right edge + Rechter Rand - - Invalid property assignment: double expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl (double) erwartet + + Bottom + Ende - - Invalid property assignment: color expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Farbspezifikation erwartet + + Page left + Eine Seite nach links - - Invalid property assignment: date expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet + + Page up + Eine Seite nach oben - - Invalid property assignment: time expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeitangabe erwartet + + Page right + Eine Seite nach rechts - - Invalid property assignment: datetime expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet + + Page down + Eine Seite nach unten - - Invalid property assignment: point expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Koordinatenangabe für einen Punkt erwartet + + Scroll left + Nach links scrollen - - Invalid property assignment: size expected - Ungültige Zuweisung bei Eigenschaft: Es wird eine Größenangabe erwartet + + Scroll up + Nach oben scrollen - - Invalid property assignment: rect expected - Ungültige Zuweisung bei Eigenschaft: Es werden Parameter für ein Rechteck erwartet + + Scroll right + Nach rechts scrollen - - Invalid property assignment: boolean expected - Ungültige Zuweisung bei Eigenschaft: Es wird ein Boolescher Wert erwartet + + Scroll down + Nach unten scrollen - - - Invalid property assignment: 3D vector expected - Ungültige Zuweisung bei Eigenschaft: Es wird ein dreidimensionaler Vektor erwartet + + + %n file(s) + number of chosen file + + Eine Datei + %n Dateien + - - Invalid property assignment: unsupported type "%1" - Ungültige Zuweisung bei Eigenschaft: Der Typ "%1" ist nicht unterstützt + + JavaScript Alert - %1 + JavaScript-Hinweis - %1 - - - Invalid component specification - + + JavaScript Confirm - %1 + JavaScript-Bestätigung - %1 - - Invalid component id specification - + + JavaScript Prompt - %1 + JavaScript-Eingabeaufforderung - %1 - - - id is not unique - + + JavaScript Problem - %1 + JavaScript-Problem - %1 - - Invalid component body specification - + + The script on this page appears to have a problem. Do you want to stop the script? + Das Skript dieser Webseite ist fehlerhaft. Möchten Sie es anhalten? - - Cannot create empty component specification - + + Move the cursor to the next character + Positionsmarke auf folgendes Zeichen setzen - - Invalid Script block. Specify either the source property or inline script - + + Move the cursor to the previous character + Positionsmarke auf vorangehendes Zeichen setzen - - Invalid Script source value - + + Move the cursor to the next word + Positionsmarke auf folgendes Wort setzen - - Properties cannot be set on Script block - + + Move the cursor to the previous word + Positionsmarke auf vorangehendes Wort setzen - - Invalid Script block - + + Move the cursor to the next line + Positionsmarke auf folgende Zeile setzen - - Incorrectly specified signal - + + Move the cursor to the previous line + Positionsmarke auf vorangehende Zeile setzen - - Empty signal assignment - + + Move the cursor to the start of the line + Positionsmarke auf Zeilenanfang setzen - - Empty property assignment - + + Move the cursor to the end of the line + Positionsmarke auf Zeilenende setzen - - Attached properties cannot be used here - + + Move the cursor to the start of the block + Positionsmarke auf Anfang des Blocks setzen - - - Non-existent attached object - + + Move the cursor to the end of the block + Positionsmarke auf Ende des Blocks setzen - - - Invalid attached object assignment - + + Move the cursor to the start of the document + Positionsmarke auf Anfang des Dokumentes setzen - - Cannot assign to non-existent default property - + + Move the cursor to the end of the document + Positionsmarke auf Ende des Dokumentes setzen - - - Cannot assign to non-existent property "%1" - + + Select all + Alles auswählen - - Invalid use of namespace - + + Select to the next character + Bis zum nächsten Zeichen markieren - - Not an attached property name - + + Select to the previous character + Bis zum vorherigen Zeichen markieren - - Invalid use of id property - + + Select to the next word + Bis zum nächsten Wort markieren - - "%1" is not a valid object id - + + Select to the previous word + Bis zum vorherigen Wort markieren - - id conflicts with type name - + + Select to the next line + Bis zur nächsten Zeile markieren - - id conflicts with namespace prefix - + + Select to the previous line + Bis zur vorherigen Zeile markieren - - Invalid value in grouped property - + + Select to the start of the line + Bis zum Zeilenanfang markieren - - - Invalid grouped property access - + + Select to the end of the line + Bis zum Zeilenende markieren - - Invalid property use - + + Select to the start of the block + Bis zum Anfang des Blocks markieren - - Property assignment expected - + + Select to the end of the block + Bis zum Ende des Blocks markieren - Single property assignment expected - + Select to the start of the document + Bis zum Anfang des Dokuments markieren - - Unexpected object assignment - + + Select to the end of the document + Bis zum Ende des Dokuments markieren - - Cannot assign object to list - + + Delete to the start of the word + Bis zum Anfang des Wortes löschen - - Cannot assign primitives to lists - + + Delete to the end of the word + Bis zum Ende des Wortes löschen - - Can only assign one binding to lists - + + Insert a new paragraph + Neuen Abschnitt einfügen - - Cannot assign multiple values to a script property - + + Insert a new line + Neue Zeile einfügen - - Invalid property assignment: script expected - + + Paste and Match Style + Einfügen und dem Stil anpassen - - Cannot assign object to property - + + Remove formatting + Formatierung entfernen - - Duplicate default property - + + Strikethrough + Durchgestrichen - - Duplicate property name - + + Subscript + Tiefstellung - - Duplicate signal name - + + Superscript + Hochstellung - - Duplicate method name - + + Insert Bulleted List + Liste mit Punkten einfügen - - Invalid property nesting - + + Insert Numbered List + Nummerierte Liste einfügen - - Cannot override FINAL property - + + Indent + Einrücken - - Invalid property type - + + Outdent + Einrückung aufheben - - - No property alias location - + + Center + Zentrieren - - - Invalid alias location - + + Justify + Ausrichten - - Invalid alias reference. An alias reference must be specified as <id> or <id>.<property> - + + Align Left + Linksbündig ausrichten - Invalid alias reference. Unable to find id "%1" - + Align Right + Rechtsbündig ausrichten - QmlCompositeTypeManager + QWhatsThisAction - - - Resource %1 unavailable - + + What's This? + Direkthilfe + + + QWidget - - Import %1 unavailable - + + * + * + + + QWizard - - Namespace %1 cannot be used as a type - + + Cancel + Abbrechen - %1 is not a type - + Help + Hilfe - - Type %1 unavailable - + + < &Back + < &Zurück - - - QmlEngine - - executeSql called outside transaction() - + + &Finish + Ab&schließen - - Read-only Transaction - + + &Help + &Hilfe - - Version mismatch: expected %1, found %2 - + + Go Back + Zurück + + + + Continue + Weiter + + + + Commit + Anwenden - - SQL transaction failed - + + Done + Fertig - - transaction: missing callback - + + &Next + &Weiter - - - SQL: database version mismatch - + + &Next > + &Weiter > - QmlGraphicsAnchors - - - Possible anchor loop detected on fill. - - + QWorkspace - - Possible anchor loop detected on centerIn. - + + &Restore + Wieder&herstellen - - - - - Cannot anchor to an item that isn't a parent or sibling. - + + &Move + Ver&schieben - - Possible anchor loop detected on vertical anchor. - + + &Size + &Größe ändern - - Possible anchor loop detected on horizontal anchor. - + + Mi&nimize + M&inimieren - - Cannot specify left, right, and hcenter anchors. - + + Ma&ximize + Ma&ximieren - - - Cannot anchor to a null item. - + + &Close + Schl&ießen - - Cannot anchor a horizontal edge to a vertical edge. - + + Stay on &Top + Im &Vordergrund bleiben - - - Cannot anchor item to self. - + + Minimize + Minimieren - - Cannot specify top, bottom, and vcenter anchors. - + + Restore Down + Wiederherstellen - - Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors. - + + Close + Schließen - - Cannot anchor a vertical edge to a horizontal edge. - + + + Sh&ade + &Aufrollen - - - QmlGraphicsFlipable - - front is a write-once property - + + + %1 - [%2] + %1 - [%2] - - back is a write-once property - + + &Unshade + &Herabrollen - QmlGraphicsTextInput + QXml - - - Could not load cursor delegate - + + no error occurred + kein Fehler - - Could not instantiate cursor delegate - + + error triggered by consumer + Konsument löste Fehler aus - - - QmlGraphicsVisualDataModel - - Delegate component must be Item type. - + + unexpected end of file + unerwartetes Ende der Datei - - - QmlInfo - - - unknown location - + + more than one document type definition + mehrere Dokumenttypdefinitionen - - - QmlListModel - - remove: index %1 out of range - + + error occurred while parsing element + Fehler beim Parsen eines Elements - - insert: value is not an object - + + tag mismatch + Element-Tags sind nicht richtig geschachtelt - - insert: index %1 out of range - + + error occurred while parsing content + Fehler beim Parsen des Inhalts eines Elements - - move: out of range - + + unexpected character + unerwartetes Zeichen - - append: value is not an object - + + invalid name for processing instruction + kein gültiger Name für eine Processing-Instruktion - - get: index %1 out of range - + + version expected while reading the XML declaration + fehlende Version beim Parsen der XML-Deklaration - - set: value is not an object - + + wrong value for standalone declaration + falscher Wert für die Standalone-Deklaration - - - set: index %1 out of range - + + error occurred while parsing document type definition + Fehler beim Parsen der Dokumenttypdefinition - - ListElement: cannot use default property - + + letter is expected + ein Buchstabe ist an dieser Stelle erforderlich - - ListElement: cannot use reserved "id" property - + + error occurred while parsing comment + Fehler beim Parsen eines Kommentars - - ListElement: cannot use script for property value - + + error occurred while parsing reference + Fehler beim Parsen einer Referenz - - ListModel: undefined property '%1' - + + internal general entity reference not allowed in DTD + in einer DTD ist keine interne allgemeine Entity-Referenz erlaubt - - - QmlParentChange - - Unable to preserve appearance under complex transform - + + external parsed general entity reference not allowed in attribute value + in einem Attribut-Wert sind keine externen Entity-Referenzen erlaubt - - - Unable to preserve appearance under non-uniform scale - + + external parsed general entity reference not allowed in DTD + in der DTD sind keine externen Entity-Referenzen erlaubt - - Unable to preserve appearance under scale of 0 - + + unparsed entity reference in wrong context + nicht-analysierte Entity-Referenz im falschen Kontext verwendet - - - QmlParser - - Illegal character - + + recursive entities + rekursive Entity - - Unclosed string at end of line - + + error in the text declaration of an external entity + Fehler in der Text-Deklaration einer externen Entity - - Illegal escape squence - + + encoding declaration or standalone declaration expected while reading the XML declaration + fehlende Encoding-Deklaration oder Standalone-Deklaration beim Parsen der XML-Deklaration + + + + standalone declaration expected while reading the XML declaration + fehlende Standalone-Deklaration beim Parsen der XML Deklaration + + + QXmlPatternistCLI - - Illegal unicode escape sequence - + + Warning in %1, at line %2, column %3: %4 + Warnung in %1, bei Zeile %2, Spalte %3: %4 - - Unclosed comment at end of file - + + Warning in %1: %2 + Warnung in %1: %2 - - Illegal syntax for exponential number - + + Unknown location + unbekannt - - Identifier cannot start with numeric literal - + + Error %1 in %2, at line %3, column %4: %5 + Fehler %1 in %2, bei Zeile %3, Spalte %4: %5 - - Unterminated regular expression literal - + + Error %1 in %2: %3 + Fehler %1 in %2: %3 + + + QXmlStream - - Invalid regular expression flag '%0' - + + + Extra content at end of document. + Überzähliger Inhalt nach Ende des Dokumentes. - - - Syntax error - + + Invalid entity value. + Ungültiger Entity-Wert. - - Unexpected token `%1' - + + Invalid XML character. + Ungültiges XML-Zeichen. - - - Expected token `%1' - + + Sequence ']]>' not allowed in content. + Im Inhalt ist die Zeichenfolge ']]>' nicht erlaubt. - - Expected type name - + + Namespace prefix '%1' not declared + Der Namensraum-Präfix '%1' wurde nicht deklariert - - Invalid use of Script block - + + Attribute redefined. + Redefinition eines Attributes. - - Invalid import qualifier ID - + + Unexpected character '%1' in public id literal. + '%1' ist kein gültiges Zeichen in einer public-id-Angabe. - - Library import requires a version - + + Invalid XML version string. + Ungültige XML-Versionsangabe. - - Expected parameter type - + + Unsupported XML version. + Diese XML-Version wird nicht unterstützt. - - Invalid property type modifier - + + %1 is an invalid encoding name. + %1 ist kein gültiger Name für das Encoding. - - Unexpected property type modifier - + + Encoding %1 is unsupported + Das Encoding %1 wird nicht unterstützt - - Expected property type - + + Standalone accepts only yes or no. + Der Wert für das 'Standalone'-Attribut kann nur 'yes' oder 'no' sein. - - Readonly not yet supported - + + Invalid attribute in XML declaration. + Die XML-Deklaration enthält ein ungültiges Attribut. - - QmlJS declaration outside Script element - + + Premature end of document. + Vorzeitiges Ende des Dokuments. - - Variable declarations not allow in inline Script blocks - + + Invalid document. + Ungültiges Dokument. - - - QmlPauseAnimation - - Cannot set a duration of < 0 - + + Expected + Es wurde - - - QmlPropertyAnimation - - Unmatched parenthesis in easing function "%1" - + + , but got ' + erwartet, stattdessen erhalten ' - - Easing function "%1" must start with "ease" - + + Unexpected ' + Ungültig an dieser Stelle ' - - Unknown easing curve "%1" - + + Expected character data. + Es wurden Zeichendaten erwartet. - - - Improperly specified parameter in easing function "%1" - + + Recursive entity detected. + Es wurde eine rekursive Entity festgestellt. - - Unknown easing parameter "%1" - + + Start tag expected. + Öffnendes Element erwartet. - - Cannot set a duration of < 0 - + + XML declaration not at start of document. + Die XML-Deklaration befindet sich nicht am Anfang des Dokuments. - - - QmlPropertyChanges - - Cannot assign to non-existent property "%1" - + + NDATA in parameter entity declaration. + Eine Parameter-Entity-Deklaration darf kein NDATA enthalten. - - Cannot assign to read-only property "%1" - + + %1 is an invalid processing instruction name. + %1 ist kein gültiger Name für eine Prozessing-Instruktion. - - - QmlVME - - Unable to create object of type %1 - + + Invalid processing instruction name. + Der Name der Prozessing-Instruktion ist ungültig. - - Cannot assign value %1 to property %2 - + + + + + Illegal namespace declaration. + Ungültige Namensraum-Deklaration. - - Cannot assign object type %1 with no default method - + + Invalid XML name. + Ungültiger XML-Name. - - Cannot connect mismatched signal/slot %1 %vs. %2 - + + Opening and ending tag mismatch. + Die Anzahl der öffnenden Elemente stimmt nicht mit der Anzahl der schließenden Elemente überein. - - Cannot assign an object to signal property %1 - + + Reference to unparsed entity '%1'. + Es wurde die ungeparste Entity '%1' referenziert. - - Cannot assign object to list - + + + + Entity '%1' not declared. + Die Entity '%1' ist nicht deklariert. - - Cannot assign object to interface property - + + Reference to external entity '%1' in attribute value. + Im Attributwert wurde die externe Entity '%1' referenziert. - - Unable to create attached object - + + Invalid character reference. + Ungültige Zeichenreferenz. - - Cannot set properties on %1 as it is null - + + + Encountered incorrectly encoded content. + Es wurde Inhalt mit einer ungültigen Kodierung gefunden. - - - QmlXmlListModelRole - - An XmlRole query must not start with '/' - + + The standalone pseudo attribute must appear after the encoding. + Das Standalone-Pseudoattribut muss dem Encoding unmittelbar folgen. - - - QmlXmlRoleList - - An XmlListModel query must start with '/' or "//" - + + %1 is an invalid PUBLIC identifier. + %1 ist keine gültige Angabe für eine PUBLIC-Id. @@ -9931,7 +10025,7 @@ Bitte wählen Sie einen anderen Dateinamen. %1 is an invalid flag for regular expressions. Valid flags are: - %1 ist kein gültiger Modifizierer für reguläre Ausdrücke. Gültige Modifizierer sind: + %1 ist kein gültiger Modifikator für reguläre Ausdrücke. Gültige Modifikatoren sind: @@ -11113,7 +11207,7 @@ Bitte wählen Sie einen anderen Dateinamen. Das Unterelement fehlt im Bereich; mögliche Unterelemente wären: %1. - + Document is not a XML schema. Das Dokument ist kein XML-Schema. @@ -11139,7 +11233,7 @@ Bitte wählen Sie einen anderen Dateinamen. Der Zielnamensraum %1 des importierten Schemas unterscheidet sich vom dem von ihm definierten Zielnamensraum %2. - + %1 element is not allowed to have the same %2 attribute value as the target namespace %3. Das Element %1 kann nicht den Zielnamensraum %3 als Wert des Attributs '%2' spezifizieren. @@ -11149,7 +11243,7 @@ Bitte wählen Sie einen anderen Dateinamen. In einem Schema ohne Namensraum muss das Element %1 ein Attribut %2 haben. - + %1 element is not allowed inside %2 element if %3 attribute is present. Wenn das Attribut %3 vorhanden ist, darf das Element %1 nicht im Element %2 vorkommen. -- cgit v0.12 From 728fbb7e078cf4fbd173fbcdab91bfaf8b591cfe Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Mar 2010 16:37:28 +0100 Subject: Remove incorrect semi-colons after Q_PROPERTY --- demos/declarative/minehunt/minehunt.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp index 89845ef..c56590d 100644 --- a/demos/declarative/minehunt/minehunt.cpp +++ b/demos/declarative/minehunt/minehunt.cpp @@ -54,16 +54,16 @@ class Tile : public QObject public: Tile() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} - Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged); + Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged) bool hasFlag() const { return _hasFlag; } - Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged); + Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged) bool hasMine() const { return _hasMine; } - Q_PROPERTY(int hint READ hint NOTIFY hintChanged); + Q_PROPERTY(int hint READ hint NOTIFY hintChanged) int hint() const { return _hint; } - Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged()); + Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged()) bool flipped() const { return _flipped; } void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();} @@ -91,19 +91,19 @@ class MinehuntGame : public QObject public: MinehuntGame(); - Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT); + Q_PROPERTY(QDeclarativeListProperty tiles READ tiles CONSTANT) QDeclarativeListProperty tiles() { return QDeclarativeListProperty(this, _tiles); } - Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged); + Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged) bool isPlaying() {return playing;} - Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged); + Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged) bool hasWon() {return won;} - Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged); + Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged) int numMines() const{return nMines;} - Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged); + Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged) int numFlags() const{return nFlags;} public slots: -- cgit v0.12 From 0f500da44e87ba80dbe09c4f8b392451bf000e78 Mon Sep 17 00:00:00 2001 From: Helio Chissini de Castro Date: Thu, 18 Mar 2010 12:40:49 -0300 Subject: - Fix importdir option on unix/linux configure --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 37382ae..567261f 100755 --- a/configure +++ b/configure @@ -943,7 +943,7 @@ while [ "$#" -gt 0 ]; do shift VAL=$1 ;; - -prefix|-docdir|-headerdir|-plugindir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config) + -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-demosdir|-depths|-make|-nomake|-platform|-xplatform|-buildkey|-sdk|-arch|-host-arch|-mysql_config) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` shift VAL="$1" @@ -3319,7 +3319,7 @@ if [ "$OPT_HELP" = "yes" ]; then cat <] [-prefix-install] [-bindir ] [-libdir ] - [-docdir ] [-headerdir ] [-plugindir ] [-datadir ] + [-docdir ] [-headerdir ] [-plugindir ] [-importdir ] [-datadir ] [-translationdir ] [-sysconfdir ] [-examplesdir ] [-demosdir ] [-buildkey ] [-release] [-debug] [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] -- cgit v0.12 From b6dcc8faf73d63a281f5cd9c0ef80ef5db367532 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 18 Mar 2010 18:36:50 +0100 Subject: Dont force height for filter widget This had some negative side effects when used in Qt Creator and since the kde icon now fits nicely without this workaround I will remove it for now. --- tools/designer/src/lib/shared/filterwidget.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index 84810cb..f485346 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -162,18 +162,11 @@ FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : // Let the style determine minimum height for our widget QSize size(ICONBUTTON_SIZE + 2, ICONBUTTON_SIZE + 2); - QStyleOptionFrame frameOpt; - frameOpt.initFrom(m_editor); - QSize adjustedSize = style()->sizeFromContents(QStyle::CT_LineEdit, &frameOpt, size, m_editor); - // Note KDE does not reserve space for the highlight color if (style()->inherits("OxygenStyle")) { - adjustedSize = adjustedSize.expandedTo(QSize(0, 32)); size = size.expandedTo(QSize(24, 0)); } - m_editor->setMinimumHeight(adjustedSize.height()); - // Make room for clear icon QMargins margins = m_editor->textMargins(); if (layoutDirection() == Qt::LeftToRight) -- cgit v0.12 From 109a8a7a06831288ba1110f8caaaf6e5dee8bfbd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Mar 2010 00:25:15 +0100 Subject: Autotest: fix instability by accepting rounding errors --- tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp index 912226d..9ea422c 100644 --- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -111,9 +111,14 @@ void tst_QElapsedTimer::basics() quint64 value1 = t1.msecsSinceReference(); qint64 elapsed = t1.restart(); - quint64 value2 = t1.msecsSinceReference(); - QCOMPARE(elapsed, qint64(value2 - value1)); QVERIFY(elapsed < minResolution); + + quint64 value2 = t1.msecsSinceReference(); + // in theory, elapsed == value2 - value1 + + // However, since QElapsedTimer keeps internally the full resolution, + // we have here a rounding error due to integer division + QVERIFY(qAbs(elapsed - qint64(value2 - value1)) < 1); } void tst_QElapsedTimer::elapsed() -- cgit v0.12 From 777843c18c9b62af90436ba03036027c9222eadf Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 17 Mar 2010 14:04:03 +1000 Subject: Rename private signal. --- src/network/access/qnetworkaccessmanager.cpp | 18 ++++++++++-------- src/network/access/qnetworkaccessmanager.h | 2 +- src/network/access/qnetworkreplyimpl.cpp | 12 +++++++++++- src/network/access/qnetworkreplyimpl_p.h | 4 ++-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 4518d4c..51c5731 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -198,15 +198,15 @@ static void ensureInitialized() */ /*! - \fn void QNetworkAccessManager::networkSessionOnline() + \fn void QNetworkAccessManager::networkSessionConnected() \since 4.7 \internal - This signal is emitted when the status of the network session changes into a usable state. - It is used to signal QNetworkReply's to start or migrate their network operation once the - network session has been opened / roamed. + This signal is emitted when the status of the network session changes into a usable (Connected) + state. It is used to signal to QNetworkReplys to start or migrate their network operation once + the network session has been opened or finished roaming. */ /*! @@ -911,8 +911,10 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // first step: create the reply QUrl url = request.url(); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); - if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) - connect(this, SIGNAL(networkSessionOnline()), reply, SLOT(_q_networkSessionOnline())); + if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) { + connect(this, SIGNAL(networkSessionConnected()), + reply, SLOT(_q_networkSessionConnected())); + } QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; @@ -1222,7 +1224,7 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co networkSession = new QNetworkSession(config, q); - QObject::connect(networkSession, SIGNAL(opened()), q, SIGNAL(networkSessionOnline())); + QObject::connect(networkSession, SIGNAL(opened()), q, SIGNAL(networkSessionConnected())); QObject::connect(networkSession, SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); QObject::connect(networkSession, SIGNAL(newConfigurationActivated()), q, SLOT(_q_networkSessionNewConfigurationActivated())); @@ -1249,7 +1251,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionNewConfigurationActivated() if (networkSession) { networkSession->accept(); - emit q->networkSessionOnline(); + emit q->networkSessionConnected(); } } diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 694a54f..e3dbb40 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -126,7 +126,7 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif - void networkSessionOnline(); + void networkSessionConnected(); void networkAccessChanged(bool enabled); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 8505a41..7fc0097 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -232,10 +232,20 @@ void QNetworkReplyImplPrivate::_q_bufferOutgoingData() } } -void QNetworkReplyImplPrivate::_q_networkSessionOnline() +void QNetworkReplyImplPrivate::_q_networkSessionConnected() { Q_Q(QNetworkReplyImpl); + if (manager.isNull()) + return; + + QNetworkSession *session = manager->d_func()->networkSession; + if (!session) + return; + + if (session->state() != QNetworkSession::Connected) + return; + switch (state) { case QNetworkReplyImplPrivate::Buffering: case QNetworkReplyImplPrivate::Working: diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 6045ef4..fcb3397 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -99,7 +99,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) - Q_PRIVATE_SLOT(d_func(), void _q_networkSessionOnline()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) }; @@ -133,7 +133,7 @@ public: void _q_copyReadChannelFinished(); void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); - void _q_networkSessionOnline(); + void _q_networkSessionConnected(); void _q_networkSessionFailed(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, -- cgit v0.12 From 39818f933b958d504b9cc18487658209d1df22da Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 17 Feb 2010 16:16:55 +1000 Subject: Don't emit open signal on session close/error. --- src/network/access/qnetworkaccessmanager.cpp | 2 ++ src/network/access/qnetworkreplyimpl.cpp | 10 ++++++++++ src/network/access/qnetworkreplyimpl_p.h | 2 ++ src/network/bearer/qnetworksession.cpp | 9 ++++----- src/network/bearer/qnetworksession_p.h | 4 +--- src/plugins/bearer/qnetworksession_impl.cpp | 19 ++++++++++--------- src/plugins/bearer/qnetworksession_impl.h | 2 +- .../auto/qnetworksession/test/tst_qnetworksession.cpp | 3 +++ 8 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 51c5731..f52eec5 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -914,6 +914,8 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) { connect(this, SIGNAL(networkSessionConnected()), reply, SLOT(_q_networkSessionConnected())); + if (d->networkSession) + connect(d->networkSession, SIGNAL(closed()), reply, SLOT(_q_networkSessionClosed())); } QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7fc0097..9ef2ed8 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -262,6 +262,16 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected() } } +void QNetworkReplyImplPrivate::_q_networkSessionClosed() +{ + if (state != Finished) { + state = Working; + error(QNetworkReply::UnknownNetworkError, + QCoreApplication::translate("QNetworkReply", "Network session closed.")); + finished(); + } +} + void QNetworkReplyImplPrivate::_q_networkSessionFailed() { // Abort waiting replies. diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index fcb3397..8e498d5 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -100,6 +100,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) }; @@ -134,6 +135,7 @@ public: void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); void _q_networkSessionConnected(); + void _q_networkSessionClosed(); void _q_networkSessionFailed(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index cf9f4b2..d05f20e 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -231,7 +231,7 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, d->q = this; d->publicConfig = connectionConfig; d->syncStateWithInterface(); - connect(d, SIGNAL(quitPendingWaitsForOpened()), this, SIGNAL(opened())); + connect(d, SIGNAL(opened()), this, SIGNAL(opened())); connect(d, SIGNAL(error(QNetworkSession::SessionError)), this, SIGNAL(error(QNetworkSession::SessionError))); connect(d, SIGNAL(stateChanged(QNetworkSession::State)), @@ -308,10 +308,9 @@ bool QNetworkSession::waitForOpened(int msecs) return false; QEventLoop* loop = new QEventLoop(this); - QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), - loop, SLOT(quit())); - QObject::connect(this, SIGNAL(error(QNetworkSession::SessionError)), - loop, SLOT(quit())); + connect(d, SIGNAL(opened()), loop, SLOT(quit())); + connect(d, SIGNAL(closed()), loop, SLOT(quit())); + connect(d, SIGNAL(error(QNetworkSession::SessionError)), loop, SLOT(quit())); //final call if (msecs>=0) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 76691b3..5eef8e3 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -116,9 +116,7 @@ protected: } Q_SIGNALS: - //releases any pending waitForOpened() calls - void quitPendingWaitsForOpened(); - + void opened(); void error(QNetworkSession::SessionError error); void stateChanged(QNetworkSession::State state); void closed(); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index db1759c..ddda04f 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -103,7 +103,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), this, SLOT(forcedSessionClose(QNetworkConfiguration))); - opened = false; + sessionOpened = false; isOpen = false; state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; @@ -153,7 +153,7 @@ void QNetworkSessionPrivateImpl::open() emit QNetworkSessionPrivate::error(lastError); return; } - opened = true; + sessionOpened = true; if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { @@ -165,7 +165,7 @@ void QNetworkSessionPrivateImpl::open() isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; if (isOpen) - emit quitPendingWaitsForOpened(); + emit opened(); } } @@ -175,7 +175,7 @@ void QNetworkSessionPrivateImpl::close() lastError = QNetworkSession::OperationNotSupportedError; emit QNetworkSessionPrivate::error(lastError); } else if (isOpen) { - opened = false; + sessionOpened = false; isOpen = false; emit closed(); } @@ -196,7 +196,7 @@ void QNetworkSessionPrivateImpl::stop() sessionManager()->forceSessionClose(activeConfig); } - opened = false; + sessionOpened = false; isOpen = false; emit closed(); } @@ -364,10 +364,10 @@ void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() state = engine->sessionStateForId(activeConfig.identifier()); bool oldActive = isOpen; - isOpen = (state == QNetworkSession::Connected) ? opened : false; + isOpen = (state == QNetworkSession::Connected) ? sessionOpened : false; if (!oldActive && isOpen) - emit quitPendingWaitsForOpened(); + emit opened(); if (oldActive && !isOpen) emit closed(); @@ -398,7 +398,7 @@ void QNetworkSessionPrivateImpl::configurationChanged(QNetworkConfigurationPriva void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration &config) { if (activeConfig == config) { - opened = false; + sessionOpened = false; isOpen = false; emit closed(); @@ -416,7 +416,7 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id, switch (error) { case QBearerEngineImpl::OperationNotSupported: lastError = QNetworkSession::OperationNotSupportedError; - opened = false; + sessionOpened = false; break; case QBearerEngineImpl::InterfaceLookupError: case QBearerEngineImpl::ConnectError: @@ -426,6 +426,7 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id, } emit QNetworkSessionPrivate::error(lastError); + emit closed(); } } diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index c644174..c31e540 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -114,7 +114,7 @@ private Q_SLOTS: void decrementTimeout(); private: - bool opened; + bool sessionOpened; QBearerEngineImpl *engine; diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 4b56f77..35f7ba7 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -628,6 +628,9 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session.state() == previousState); + QVERIFY(sessionOpenedSpy.isEmpty()); + QCOMPARE(sessionClosedSpy.count(), 1); + if (error == QNetworkSession::OperationNotSupportedError) { // The session needed to bring up the interface, // but the operation is not supported. -- cgit v0.12 From 331ad8eb0aedb4baefcaf6f08a8e0ce440a32b06 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 16 Feb 2010 09:30:38 +1000 Subject: Rename networkAccess property to networkAccessible. Add unit test and update docs. --- .../src_network_access_qnetworkaccessmanager.cpp | 9 ++ src/network/access/qnetworkaccessmanager.cpp | 106 +++++++++++++++----- src/network/access/qnetworkaccessmanager.h | 15 ++- src/network/access/qnetworkaccessmanager_p.h | 9 +- tests/auto/network.pro | 1 + .../qnetworkaccessmanager.pro | 5 + .../tst_qnetworkaccessmanager.cpp | 111 +++++++++++++++++++++ 7 files changed, 225 insertions(+), 31 deletions(-) create mode 100644 tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro create mode 100644 tests/auto/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp diff --git a/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp b/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp index 5db6676..1853650 100644 --- a/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp +++ b/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp @@ -69,3 +69,12 @@ networkAccessManager->setConfiguration(manager.defaultConfiguration()); //! [3] networkAccessManager->setConfiguration(QNetworkConfiguration()); //! [3] + +//! [4] +networkAccessManager->setNetworkAccessible(QNetworkAccessManager::NotAccessible); +//! [4] + +//! [5] +networkAccessManager->setNetworkAccessible(QNetworkAccessManager::Accessible); +//! [5] + diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index f52eec5..8fe1857 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -173,28 +173,46 @@ static void ensureInitialized() */ /*! - \property QNetworkAccessManager::networkAccess - \brief states whether network access is enabled or disabled through this network access - manager. + \enum QNetworkAccessManager::NetworkAccessibility + + Indicates whether the network is accessible via this network access manager. + + \value UnknownAccessibility The network accessibility cannot be determined. + \value NotAccessible The network is not currently accessible, either because there + is currently no network coverage or network access has been + explicitly disabled by a call to setNetworkAccessible(). + \value Accessible The network is accessible. + + \sa networkAccessible +*/ + +/*! + \property QNetworkAccessManager::networkAccessible + \brief whether the network is currently accessible via this network access manager. \since 4.7 - Network access is enabled by default. + If the network is \l {NotAccessible}{not accessible} the network access manager will not + process any new network requests, all such requests will fail with an error. Requests with + URLs with the file:// scheme will still be processed. + + By default the value of this property reflects the physical state of the device. Applications + may override it to disable all network requests via this network access manager by calling - When network access is disabled the network access manager will not process any new network - requests, all such requests will fail with an error. Requests with URLs with the file:// scheme - will still be processed. + \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 4 - This property can be used to enable and disable network access for all clients of a single - network access manager instance. + Network requests can be reenabled again by calling + + \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 5 + + \note Calling setNetworkAccessible() does not change the network state. */ /*! - \fn void QNetworkAccessManager::networkAccessChanged(bool enabled) + \fn void QNetworkAccessManager::networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible) - This signal is emitted when the value of the \l networkAccess property changes. If \a enabled - is true new requests that access the network will be processed; otherwise new network requests - that require network access will fail with an error. + This signal is emitted when the value of the \l networkAccessible property changes. + \a accessible is the new network accessibility. */ /*! @@ -792,30 +810,42 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const /*! \since 4.7 - Enables network access via this QNetworkAccessManager if \a enabled is true; otherwise disables - access. + Overrides the reported network accessibility. If \a accessible is NotAccessible the reported + network accessiblity will always be NotAccessible. Otherwise the reported network + accessibility will reflect the actual device state. */ -void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) +void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkAccessibility accessible) { Q_D(QNetworkAccessManager); - if (d->networkAccessEnabled != enabled) { - d->networkAccessEnabled = enabled; - emit networkAccessChanged(enabled); + if (d->networkAccessible != accessible) { + NetworkAccessibility previous = networkAccessible(); + d->networkAccessible = accessible; + NetworkAccessibility current = networkAccessible(); + if (previous != current) + emit networkAccessibleChanged(current); } } /*! \since 4.7 - Returns true if network access via this QNetworkAccessManager is enabled; otherwise returns - false. + Returns the current network accessibility. */ -bool QNetworkAccessManager::networkAccessEnabled() const +QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccessible() const { Q_D(const QNetworkAccessManager); - return d->networkAccessEnabled; + if (d->networkSession) { + // d->online holds online/offline state of this network session. + if (d->online) + return d->networkAccessible; + else + return NotAccessible; + } else { + // Network accessibility is either disabled or unknown. + return (d->networkAccessible == NotAccessible) ? NotAccessible : UnknownAccessibility; + } } /*! @@ -875,7 +905,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. - if (!d->networkAccessEnabled && !(req.url().scheme() == QLatin1String("file") || + if (!d->networkAccessible && !(req.url().scheme() == QLatin1String("file") || req.url().scheme().isEmpty())) { return new QDisabledNetworkReply(this, req, op); } @@ -1221,6 +1251,13 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co if (!config.isValid()) { networkSession = 0; + online = false; + + if (networkAccessible == QNetworkAccessManager::NotAccessible) + emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); + else + emit q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility); + return; } @@ -1228,12 +1265,16 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co QObject::connect(networkSession, SIGNAL(opened()), q, SIGNAL(networkSessionConnected())); QObject::connect(networkSession, SIGNAL(closed()), q, SLOT(_q_networkSessionClosed())); + QObject::connect(networkSession, SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State))); QObject::connect(networkSession, SIGNAL(newConfigurationActivated()), q, SLOT(_q_networkSessionNewConfigurationActivated())); QObject::connect(networkSession, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), q, SLOT(_q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); + + _q_networkSessionStateChanged(networkSession->state()); } void QNetworkAccessManagerPrivate::_q_networkSessionClosed() @@ -1263,6 +1304,23 @@ void QNetworkAccessManagerPrivate::_q_networkSessionPreferredConfigurationChange networkSession->migrate(); } +void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession::State state) +{ + Q_Q(QNetworkAccessManager); + + if (online) { + if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) { + online = false; + emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); + } + } else { + if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) { + online = true; + emit q->networkAccessibleChanged(networkAccessible); + } + } +} + QT_END_NAMESPACE #include "moc_qnetworkaccessmanager.cpp" diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index e3dbb40..1d794a2 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -70,7 +70,7 @@ class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject { Q_OBJECT - Q_PROPERTY(bool networkAccess READ networkAccessEnabled WRITE setNetworkAccessEnabled NOTIFY networkAccessChanged) + Q_PROPERTY(NetworkAccessibility networkAccessible READ networkAccessible WRITE setNetworkAccessible NOTIFY networkAccessibleChanged) public: enum Operation { @@ -84,6 +84,12 @@ public: UnknownOperation = 0 }; + enum NetworkAccessibility { + UnknownAccessibility = -1, + NotAccessible = 0, + Accessible = 1 + }; + explicit QNetworkAccessManager(QObject *parent = 0); ~QNetworkAccessManager(); @@ -113,8 +119,8 @@ public: QNetworkConfiguration configuration() const; QNetworkConfiguration activeConfiguration() const; - void setNetworkAccessEnabled(bool enabled); - bool networkAccessEnabled() const; + void setNetworkAccessible(NetworkAccessibility accessible); + NetworkAccessibility networkAccessible() const; Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY @@ -128,7 +134,7 @@ Q_SIGNALS: void networkSessionConnected(); - void networkAccessChanged(bool enabled); + void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible); protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, @@ -142,6 +148,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)); }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 0140268..1785685 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -58,6 +58,7 @@ #include "qnetworkaccessbackend_p.h" #include "private/qobject_p.h" #include "QtNetwork/qnetworkproxy.h" +#include "QtNetwork/qnetworksession.h" QT_BEGIN_NAMESPACE @@ -65,7 +66,6 @@ class QAuthenticator; class QAbstractNetworkCache; class QNetworkAuthenticationCredential; class QNetworkCookieJar; -class QNetworkSession; class QNetworkAccessManagerPrivate: public QObjectPrivate { @@ -76,7 +76,8 @@ public: proxyFactory(0), #endif networkSession(0), - networkAccessEnabled(true), + networkAccessible(QNetworkAccessManager::Accessible), + online(false), initializeSession(true), cookieJarCreated(false) { } @@ -109,6 +110,7 @@ public: void _q_networkSessionNewConfigurationActivated(); void _q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + void _q_networkSessionStateChanged(QNetworkSession::State state); // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -123,7 +125,8 @@ public: QNetworkSession *networkSession; QString networkConfiguration; - bool networkAccessEnabled; + QNetworkAccessManager::NetworkAccessibility networkAccessible; + bool online; bool initializeSession; bool cookieJarCreated; diff --git a/tests/auto/network.pro b/tests/auto/network.pro index 6b24850..2a7c178 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -16,6 +16,7 @@ SUBDIRS=\ qhttpnetworkreply \ qhttpsocketengine \ qnativesocketengine \ + qnetworkaccessmanager \ qnetworkaddressentry \ qnetworkconfigmanager \ qnetworkconfiguration \ diff --git a/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro b/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro new file mode 100644 index 0000000..e2889c1 --- /dev/null +++ b/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +SOURCES += tst_qnetworkaccessmanager.cpp +QT = core network + + diff --git a/tests/auto/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp b/tests/auto/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp new file mode 100644 index 0000000..9267389 --- /dev/null +++ b/tests/auto/qnetworkaccessmanager/tst_qnetworkaccessmanager.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** 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 test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +#include + +Q_DECLARE_METATYPE(QNetworkAccessManager::NetworkAccessibility); + +class tst_QNetworkAccessManager : public QObject +{ + Q_OBJECT + +public: + tst_QNetworkAccessManager(); + +private slots: + void networkAccessible(); +}; + +tst_QNetworkAccessManager::tst_QNetworkAccessManager() +{ +} + +void tst_QNetworkAccessManager::networkAccessible() +{ + QNetworkAccessManager manager; + + qRegisterMetaType("QNetworkAccessManager::NetworkAccessibility"); + + QSignalSpy spy(&manager, + SIGNAL(networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility))); + + QCOMPARE(manager.isNetworkAccessible(), QNetworkAccessManager::UnknownAccessibility); + + manager.setNetworkAccessible(QNetworkAccessManager::NotAccessible); + + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.takeFirst().at(0).value(), + QNetworkAccessManager::NotAccessible); + QCOMPARE(manager.isNetworkAccessible(), QNetworkAccessManager::NotAccessible); + + manager.setNetworkAccessible(QNetworkAccessManager::Accessible); + + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.takeFirst().at(0).value(), + QNetworkAccessManager::UnknownAccessibility); + QCOMPARE(manager.isNetworkAccessible(), QNetworkAccessManager::UnknownAccessibility); + + QNetworkConfigurationManager configManager; + QNetworkConfiguration defaultConfig = configManager.defaultConfiguration(); + if (defaultConfig.isValid()) { + manager.setConfiguration(defaultConfig); + + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.takeFirst().at(0).value(), + QNetworkAccessManager::Accessible); + QCOMPARE(manager.isNetworkAccessible(), QNetworkAccessManager::Accessible); + + manager.setNetworkAccessible(QNetworkAccessManager::NotAccessible); + + QCOMPARE(spy.count(), 1); + QCOMPARE(QNetworkAccessManager::NetworkAccessibility(spy.takeFirst().at(0).toInt()), + QNetworkAccessManager::NotAccessible); + QCOMPARE(manager.isNetworkAccessible(), QNetworkAccessManager::NotAccessible); + } +} + +QTEST_MAIN(tst_QNetworkAccessManager) +#include "tst_qnetworkaccessmanager.moc" -- cgit v0.12 From 02bdd61245da529ff99cdebc939b33fefe398f48 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 19 Mar 2010 14:27:26 +1000 Subject: Revert "Don't emit open signal on session close/error." This reverts commit 39818f933b958d504b9cc18487658209d1df22da. --- src/network/access/qnetworkaccessmanager.cpp | 2 -- src/network/access/qnetworkreplyimpl.cpp | 10 ---------- src/network/access/qnetworkreplyimpl_p.h | 2 -- src/network/bearer/qnetworksession.cpp | 9 +++++---- src/network/bearer/qnetworksession_p.h | 4 +++- src/plugins/bearer/qnetworksession_impl.cpp | 19 +++++++++---------- src/plugins/bearer/qnetworksession_impl.h | 2 +- .../auto/qnetworksession/test/tst_qnetworksession.cpp | 3 --- 8 files changed, 18 insertions(+), 33 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 8fe1857..197d89e 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -944,8 +944,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) { connect(this, SIGNAL(networkSessionConnected()), reply, SLOT(_q_networkSessionConnected())); - if (d->networkSession) - connect(d->networkSession, SIGNAL(closed()), reply, SLOT(_q_networkSessionClosed())); } QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 9ef2ed8..7fc0097 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -262,16 +262,6 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected() } } -void QNetworkReplyImplPrivate::_q_networkSessionClosed() -{ - if (state != Finished) { - state = Working; - error(QNetworkReply::UnknownNetworkError, - QCoreApplication::translate("QNetworkReply", "Network session closed.")); - finished(); - } -} - void QNetworkReplyImplPrivate::_q_networkSessionFailed() { // Abort waiting replies. diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 8e498d5..fcb3397 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -100,7 +100,6 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) - Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) }; @@ -135,7 +134,6 @@ public: void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); void _q_networkSessionConnected(); - void _q_networkSessionClosed(); void _q_networkSessionFailed(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index d05f20e..cf9f4b2 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -231,7 +231,7 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, d->q = this; d->publicConfig = connectionConfig; d->syncStateWithInterface(); - connect(d, SIGNAL(opened()), this, SIGNAL(opened())); + connect(d, SIGNAL(quitPendingWaitsForOpened()), this, SIGNAL(opened())); connect(d, SIGNAL(error(QNetworkSession::SessionError)), this, SIGNAL(error(QNetworkSession::SessionError))); connect(d, SIGNAL(stateChanged(QNetworkSession::State)), @@ -308,9 +308,10 @@ bool QNetworkSession::waitForOpened(int msecs) return false; QEventLoop* loop = new QEventLoop(this); - connect(d, SIGNAL(opened()), loop, SLOT(quit())); - connect(d, SIGNAL(closed()), loop, SLOT(quit())); - connect(d, SIGNAL(error(QNetworkSession::SessionError)), loop, SLOT(quit())); + QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), + loop, SLOT(quit())); + QObject::connect(this, SIGNAL(error(QNetworkSession::SessionError)), + loop, SLOT(quit())); //final call if (msecs>=0) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 5eef8e3..76691b3 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -116,7 +116,9 @@ protected: } Q_SIGNALS: - void opened(); + //releases any pending waitForOpened() calls + void quitPendingWaitsForOpened(); + void error(QNetworkSession::SessionError error); void stateChanged(QNetworkSession::State state); void closed(); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index ddda04f..db1759c 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -103,7 +103,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), this, SLOT(forcedSessionClose(QNetworkConfiguration))); - sessionOpened = false; + opened = false; isOpen = false; state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; @@ -153,7 +153,7 @@ void QNetworkSessionPrivateImpl::open() emit QNetworkSessionPrivate::error(lastError); return; } - sessionOpened = true; + opened = true; if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { @@ -165,7 +165,7 @@ void QNetworkSessionPrivateImpl::open() isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; if (isOpen) - emit opened(); + emit quitPendingWaitsForOpened(); } } @@ -175,7 +175,7 @@ void QNetworkSessionPrivateImpl::close() lastError = QNetworkSession::OperationNotSupportedError; emit QNetworkSessionPrivate::error(lastError); } else if (isOpen) { - sessionOpened = false; + opened = false; isOpen = false; emit closed(); } @@ -196,7 +196,7 @@ void QNetworkSessionPrivateImpl::stop() sessionManager()->forceSessionClose(activeConfig); } - sessionOpened = false; + opened = false; isOpen = false; emit closed(); } @@ -364,10 +364,10 @@ void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() state = engine->sessionStateForId(activeConfig.identifier()); bool oldActive = isOpen; - isOpen = (state == QNetworkSession::Connected) ? sessionOpened : false; + isOpen = (state == QNetworkSession::Connected) ? opened : false; if (!oldActive && isOpen) - emit opened(); + emit quitPendingWaitsForOpened(); if (oldActive && !isOpen) emit closed(); @@ -398,7 +398,7 @@ void QNetworkSessionPrivateImpl::configurationChanged(QNetworkConfigurationPriva void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration &config) { if (activeConfig == config) { - sessionOpened = false; + opened = false; isOpen = false; emit closed(); @@ -416,7 +416,7 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id, switch (error) { case QBearerEngineImpl::OperationNotSupported: lastError = QNetworkSession::OperationNotSupportedError; - sessionOpened = false; + opened = false; break; case QBearerEngineImpl::InterfaceLookupError: case QBearerEngineImpl::ConnectError: @@ -426,7 +426,6 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id, } emit QNetworkSessionPrivate::error(lastError); - emit closed(); } } diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index c31e540..c644174 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -114,7 +114,7 @@ private Q_SLOTS: void decrementTimeout(); private: - bool sessionOpened; + bool opened; QBearerEngineImpl *engine; diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 35f7ba7..4b56f77 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -628,9 +628,6 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session.state() == previousState); - QVERIFY(sessionOpenedSpy.isEmpty()); - QCOMPARE(sessionClosedSpy.count(), 1); - if (error == QNetworkSession::OperationNotSupportedError) { // The session needed to bring up the interface, // but the operation is not supported. -- cgit v0.12 From 8c56170a03bb7ce21d875a1f12561ead799ff209 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Fri, 19 Mar 2010 16:18:32 +0100 Subject: Tab color fix for document mode on Snow Leopard. The window frame/toolbar color is different (a bit lighter) for snow leopard, so we need to adjust the tab color in document mode . Reviewed-by: Richard Moe Gustavsen --- src/gui/styles/qmacstyle_mac.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 116b03e..7097291 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -237,12 +237,14 @@ void drawTabShape(QPainter *p, const QStyleOptionTabV3 *tabOpt) // fill body if (active) { - p->fillRect(rect, QColor(151, 151, 151)); + int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 16 : 0; + p->fillRect(rect, QColor(151 + d, 151 + d, 151 + d)); } else { + int d = (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) ? 9 : 0; QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); - gradient.setColorAt(0, QColor(207, 207, 207)); - gradient.setColorAt(0.5, QColor(206, 206, 206)); - gradient.setColorAt(1, QColor(201, 201, 201)); + gradient.setColorAt(0, QColor(207 + d, 207 + d, 207 + d)); + gradient.setColorAt(0.5, QColor(206 + d, 206 + d, 206 + d)); + gradient.setColorAt(1, QColor(201 + d, 201 + d, 201 + d)); p->fillRect(rect, gradient); } -- cgit v0.12 From 1d506981bcc3d2b8aad67989fd7946a0ad826856 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 19 Mar 2010 17:22:27 +0100 Subject: Do not create native window handle just because a parent has one. On X11 when creating a widget that has a parent, there is no reason to create a native window handle right away since we don't know yet if the window is going to be ever shown. Task-number: QTBUG-9215 Reviewed-by: Bradley T. Hughes --- src/gui/kernel/qwidget_x11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index ece4be4..47f91f8 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -1166,7 +1166,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) adjustFlags(data.window_flags, q); // keep compatibility with previous versions, we need to preserve the created state // (but we recreate the winId for the widget being reparented, again for compatibility) - if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created))) + if (wasCreated) createWinId(); if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden) q->setAttribute(Qt::WA_WState_Hidden); -- cgit v0.12 From 935240ce8a06a67cab4ed15311f4c89ca8d17b77 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 19 Mar 2010 17:32:58 +0100 Subject: Add 2 signals, introduce side widget, make it possible to reset startId Add pageAdded() and pageRemoved() signals. QWizard is now able to show the side widget (on the left). In Creator it will be used to implement steps pane (progress list). Passing -1 to setStartId resets id if it was set explicitly. --- src/gui/dialogs/qwizard.cpp | 205 ++++++++++++++++++++++++++++++++----- src/gui/dialogs/qwizard.h | 5 + tests/auto/qwizard/tst_qwizard.cpp | 97 +++++++++++++++++- 3 files changed, 279 insertions(+), 28 deletions(-) diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp index a58057d..8607529 100644 --- a/src/gui/dialogs/qwizard.cpp +++ b/src/gui/dialogs/qwizard.cpp @@ -218,8 +218,8 @@ public: : topLevelMarginLeft(-1), topLevelMarginRight(-1), topLevelMarginTop(-1), topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1), childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1), - wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false), - subTitle(false), extension(false) {} + wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false), + subTitle(false), extension(false), sideWidget(false) {} int topLevelMarginLeft; int topLevelMarginRight; @@ -238,6 +238,7 @@ public: bool title; bool subTitle; bool extension; + bool sideWidget; bool operator==(const QWizardLayoutInfo &other); inline bool operator!=(const QWizardLayoutInfo &other) { return !operator==(other); } @@ -261,7 +262,8 @@ bool QWizardLayoutInfo::operator==(const QWizardLayoutInfo &other) && watermark == other.watermark && title == other.title && subTitle == other.subTitle - && extension == other.extension; + && extension == other.extension + && sideWidget == other.sideWidget; } class QWizardHeader : public QWidget @@ -425,6 +427,40 @@ public: : QWizardHeader(Ruler, parent) {} }; +class QWatermarkLabel : public QLabel +{ +public: + QWatermarkLabel(QWidget *parent, QWidget *sideWidget) : QLabel(parent), m_sideWidget(sideWidget) { + m_layout = new QVBoxLayout(this); + if (m_sideWidget) + m_layout->addWidget(m_sideWidget); + } + + QSize minimumSizeHint() const { + if (!pixmap() && !pixmap()->isNull()) + return pixmap()->size(); + return QFrame::minimumSizeHint(); + } + + void setSideWidget(QWidget *widget) { + if (m_sideWidget == widget) + return; + if (m_sideWidget) { + m_layout->removeWidget(m_sideWidget); + m_sideWidget->hide(); + } + m_sideWidget = widget; + if (m_sideWidget) + m_layout->addWidget(m_sideWidget); + } + QWidget *sideWidget() const { + return m_sideWidget; + } +private: + QVBoxLayout *m_layout; + QWidget *m_sideWidget; +}; + class QWizardPagePrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QWizardPage) @@ -501,6 +537,7 @@ public: inline QWizardPrivate() : start(-1) + , startSetByUser(false) , current(-1) , canContinue(false) , canFinish(false) @@ -513,6 +550,7 @@ public: , placeholderWidget2(0) , headerWidget(0) , watermarkLabel(0) + , sideWidget(0) , titleLabel(0) , subTitleLabel(0) , bottomRuler(0) @@ -581,6 +619,7 @@ public: QList history; QSet initialized; // ### remove and move bit to QWizardPage? int start; + bool startSetByUser; int current; bool canContinue; bool canFinish; @@ -612,7 +651,8 @@ public: QWidget *placeholderWidget1; QWidget *placeholderWidget2; QWizardHeader *headerWidget; - QLabel *watermarkLabel; + QWatermarkLabel *watermarkLabel; + QWidget *sideWidget; QFrame *pageFrame; QLabel *titleLabel; QLabel *subTitleLabel; @@ -907,11 +947,12 @@ QWizardLayoutInfo QWizardPrivate::layoutInfoForCurrentPage() info.header = (info.wizStyle == QWizard::ClassicStyle || info.wizStyle == QWizard::ModernStyle) && !(opts & QWizard::IgnoreSubTitles) && !subTitleText.isEmpty(); + info.sideWidget = sideWidget; info.watermark = (info.wizStyle != QWizard::MacStyle) && (info.wizStyle != QWizard::AeroStyle) && !watermarkPixmap.isNull(); info.title = !info.header && !titleText.isEmpty(); info.subTitle = !(opts & QWizard::IgnoreSubTitles) && !info.header && !subTitleText.isEmpty(); - info.extension = info.watermark && (opts & QWizard::ExtendedWatermarkPixmap); + info.extension = (info.watermark || info.sideWidget) && (opts & QWizard::ExtendedWatermarkPixmap); return info; } @@ -954,7 +995,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info) int numColumns; if (mac) { numColumns = 3; - } else if (info.watermark) { + } else if (info.watermark || info.sideWidget) { numColumns = 2; } else { numColumns = 1; @@ -1096,8 +1137,8 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info) pageFrame->setContentsMargins(hMargin, vMargin, hMargin, vMargin); } - if (info.watermark && !watermarkLabel) { - watermarkLabel = new QLabel(antiFlickerWidget); + if ((info.watermark || info.sideWidget) && !watermarkLabel) { + watermarkLabel = new QWatermarkLabel(antiFlickerWidget, sideWidget); watermarkLabel->setBackgroundRole(QPalette::Base); watermarkLabel->setMinimumHeight(1); watermarkLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); @@ -1173,7 +1214,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info) mainLayout->addLayout(buttonLayout, row++, buttonStartColumn, 1, buttonNumColumns); - if (info.watermark) { + if (info.watermark || info.sideWidget) { if (info.extension) watermarkEndRow = row; mainLayout->addWidget(watermarkLabel, watermarkStartRow, 0, @@ -1193,7 +1234,7 @@ void QWizardPrivate::recreateLayout(const QWizardLayoutInfo &info) if (bottomRuler) bottomRuler->setVisible(classic || modern); if (watermarkLabel) - watermarkLabel->setVisible(info.watermark); + watermarkLabel->setVisible(info.watermark || info.sideWidget); layoutInfo = info; } @@ -1233,10 +1274,17 @@ void QWizardPrivate::updateLayout() titleFmt, subTitleFmt); } - if (info.watermark) { - Q_ASSERT(page); - watermarkLabel->setPixmap(page->pixmap(QWizard::WatermarkPixmap)); + if (info.watermark || info.sideWidget) { + QPixmap pix; + if (info.watermark) { + if (page) + pix = page->pixmap(QWizard::WatermarkPixmap); + else + pix = q->pixmap(QWizard::WatermarkPixmap); + } + watermarkLabel->setPixmap(pix); // in case there is no watermark and we show the side widget we need to clear the watermark } + if (info.title) { Q_ASSERT(page); titleLabel->setTextFormat(titleFmt); @@ -1267,7 +1315,7 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) minimumSize.setWidth(headerWidget->maximumWidth()); maximumSize.setWidth(headerWidget->maximumWidth()); } - if (info.watermark) { + if (info.watermark && !info.sideWidget) { minimumSize.setHeight(mainLayout->totalSizeHint().height()); maximumSize.setHeight(mainLayout->totalSizeHint().height()); } @@ -2149,7 +2197,7 @@ QWizard::~QWizard() The ID is guaranteed to be larger than any other ID in the QWizard so far. - \sa setPage(), page() + \sa setPage(), page(), pageAdded() */ int QWizard::addPage(QWizardPage *page) { @@ -2166,7 +2214,10 @@ int QWizard::addPage(QWizardPage *page) Adds the given \a page to the wizard with the given \a id. - \sa addPage(), page() + \note Adding a page may influence the value of the startId property + in case it was not set explicitly. + + \sa addPage(), page(), pageAdded() */ void QWizard::setPage(int theid, QWizardPage *page) { @@ -2210,12 +2261,19 @@ void QWizard::setPage(int theid, QWizardPage *page) // hide new page and reset layout to old status page->hide(); d->pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled); + + if (!d->startSetByUser && d->pageMap.constBegin().key() == theid) + d->start = theid; + emit pageAdded(theid); } /*! Removes the page with the given \a id. cleanupPage() will be called if necessary. + + \note Removing a page may influence the value of the startId property. + \since 4.5 - \sa addPage(), setPage() + \sa addPage(), setPage(), pageRemoved(), startId() */ void QWizard::removePage(int id) { @@ -2223,8 +2281,24 @@ void QWizard::removePage(int id) QWizardPage *removedPage = 0; - if (d->start == id) - d->start = -1; + // update startItem accordingly + if (d->pageMap.count() > 0) { // only if we have any pages + if (d->start == id) { + const int firstId = d->pageMap.constBegin().key(); + if (firstId == id) { + if (d->pageMap.count() > 1) + d->start = (++d->pageMap.constBegin()).key(); // secondId + else + d->start = -1; // removing the last page + } else { // startSetByUser has to be "true" here + d->start = firstId; + } + d->startSetByUser = false; + } + } + + if (d->pageMap.contains(id)) + emit pageRemoved(id); if (!d->history.contains(id)) { // Case 1: removing a page not in the history @@ -2334,21 +2408,27 @@ QList QWizard::pageIds() const void QWizard::setStartId(int theid) { Q_D(QWizard); - if (!d->pageMap.contains(theid)) { - qWarning("QWizard::setStartId: Invalid page ID %d", theid); + int newStart = theid; + if (theid == -1) + newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1; + + if (d->start == newStart) { + d->startSetByUser = theid != -1; return; } - d->start = theid; + + if (!d->pageMap.contains(newStart)) { + qWarning("QWizard::setStartId: Invalid page ID %d", newStart); + return; + } + d->start = newStart; + d->startSetByUser = theid != -1; } int QWizard::startId() const { Q_D(const QWizard); - if (d->start != -1) - return d->start; - if (!d->pageMap.isEmpty()) - return d->pageMap.constBegin().key(); - return -1; + return d->start; } /*! @@ -2825,6 +2905,55 @@ void QWizard::setDefaultProperty(const char *className, const char *property, } /*! + \since 4.7 + + Sets the given \a widget to be shown on the left side of the wizard. + For styles which use the WatermarkPixmap (ClassicStyle and ModernStyle) + the side widget is displayed on top of the watermark, for other styles + or when the watermark is not provided the side widget is displayed + on the left side of the wizard. + + Passing 0 shows no side widget. + + When the \a widget is not 0 the wizard reparents it. + + Any previous side widget is hidden. + + You may call setSideWidget() with the same widget at different + times. + + All widgets set here will be deleted by the wizard when it is + destroyed unless you separately reparent the widget after setting + some other side widget (or 0). + + By default, no side widget is present. +*/ +void QWizard::setSideWidget(QWidget *widget) +{ + Q_D(QWizard); + + d->sideWidget = widget; + if (d->watermarkLabel) { + d->watermarkLabel->setSideWidget(widget); + d->updateLayout(); + } +} + +/*! + \since 4.7 + + Returns the widget on the left side of the wizard or 0. + + By default, no side widget is present. +*/ +QWidget *QWizard::sideWidget() const +{ + Q_D(const QWizard); + + return d->sideWidget; +} + +/*! \reimp */ void QWizard::setVisible(bool visible) @@ -2878,6 +3007,28 @@ QSize QWizard::sizeHint() const */ /*! + \fn void QWizard::pageAdded(int id) + + \since 4.7 + + This signal is emitted whenever a page is added to the + wizard. The page's \a id is passed as parameter. + + \sa addPage(), setPage(), startId() +*/ + +/*! + \fn void QWizard::pageRemoved(int id) + + \since 4.7 + + This signal is emitted whenever a page is removed from the + wizard. The page's \a id is passed as parameter. + + \sa removePage(), startId() +*/ + +/*! \fn void QWizard::helpRequested() This signal is emitted when the user clicks the \gui Help button. diff --git a/src/gui/dialogs/qwizard.h b/src/gui/dialogs/qwizard.h index 58b13fe..b146147 100644 --- a/src/gui/dialogs/qwizard.h +++ b/src/gui/dialogs/qwizard.h @@ -165,6 +165,9 @@ public: void setPixmap(WizardPixmap which, const QPixmap &pixmap); QPixmap pixmap(WizardPixmap which) const; + void setSideWidget(QWidget *widget); + QWidget *sideWidget() const; + void setDefaultProperty(const char *className, const char *property, const char *changedSignal); @@ -175,6 +178,8 @@ Q_SIGNALS: void currentIdChanged(int id); void helpRequested(); void customButtonClicked(int which); + void pageAdded(int id); + void pageRemoved(int id); public Q_SLOTS: void back(); diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index 764cd3e..f797227 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -104,6 +104,7 @@ private slots: void setCommitPage(); void setWizardStyle(); void removePage(); + void sideWidget(); // task-specific tests below me: void task161660_buttonSpacing(); @@ -569,12 +570,16 @@ void tst_QWizard::addPage() QWizard wizard; const int N = 100; QWizardPage *pages[N]; + QSignalSpy spy(&wizard, SIGNAL(pageAdded(int))); for (int i = 0; i < N; ++i) { pages[i] = new QWizardPage(parent); QCOMPARE(wizard.addPage(pages[i]), i); QCOMPARE(pages[i]->window(), (QWidget *)&wizard); QCOMPARE(wizard.startId(), 0); + QCOMPARE(spy.count(), 1); + QList arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), i); } for (int i = 0; i < N; ++i) { @@ -585,16 +590,29 @@ void tst_QWizard::addPage() QVERIFY(!wizard.page(N + 1)); wizard.setPage(N + 50, new QWizardPage); + QCOMPARE(spy.count(), 1); + QList arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), N + 50); wizard.setPage(-3000, new QWizardPage); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), -3000); QWizardPage *pageX = new QWizardPage; QCOMPARE(wizard.addPage(pageX), N + 51); QCOMPARE(wizard.page(N + 51), pageX); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), N + 51); QCOMPARE(wizard.addPage(new QWizardPage), N + 52); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), N + 52); QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page"); wizard.addPage(0); // generates a warning + QCOMPARE(spy.count(), 0); delete parent; } @@ -611,6 +629,7 @@ void tst_QWizard::setPage() QWidget *parent = new QWidget; QWizard wizard; QWizardPage *page; + QSignalSpy spy(&wizard, SIGNAL(pageAdded(int))); QCOMPARE(wizard.startId(), -1); QCOMPARE(wizard.currentId(), -1); @@ -620,6 +639,7 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1"); wizard.setPage(-1, page); // gives a warning and does nothing + QCOMPARE(spy.count(), 0); QVERIFY(!wizard.page(-2)); QVERIFY(!wizard.page(-1)); QVERIFY(!wizard.page(0)); @@ -631,6 +651,9 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(0, page); + QCOMPARE(spy.count(), 1); + QList arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 0); QCOMPARE(page->window(), (QWidget *)&wizard); QCOMPARE(wizard.page(0), page); QCOMPARE(wizard.startId(), 0); @@ -641,6 +664,9 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(-2, page); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), -2); QCOMPARE(page->window(), (QWidget *)&wizard); QCOMPARE(wizard.page(-2), page); QCOMPARE(wizard.startId(), -2); @@ -659,6 +685,9 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(2, page); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.page(2), page); QCOMPARE(wizard.startId(), -2); QCOMPARE(wizard.currentId(), -2); @@ -675,6 +704,9 @@ void tst_QWizard::setPage() page = new QWizardPage(parent); wizard.setPage(-3, page); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), -3); QCOMPARE(wizard.page(-3), page); QCOMPARE(wizard.startId(), -3); QCOMPARE(wizard.currentId(), -2); @@ -743,6 +775,7 @@ void tst_QWizard::setPage() QCOMPARE(wizard.nextId(), -2); CHECK_VISITED(wizard, QList() << -3); } + QCOMPARE(spy.count(), 0); delete parent; } @@ -766,7 +799,17 @@ void tst_QWizard::setStartId() wizard.setPage(INT_MAX, new QWizardPage); QCOMPARE(wizard.startId(), INT_MIN); - QTest::ignoreMessage(QtWarningMsg,"QWizard::setStartId: Invalid page ID -1"); + QTest::ignoreMessage(QtWarningMsg,"QWizard::setStartId: Invalid page ID 123"); + wizard.setStartId(123); + QCOMPARE(wizard.startId(), INT_MIN); + + wizard.setStartId(-1); + QCOMPARE(wizard.startId(), INT_MIN); + + wizard.setStartId(-2); + QCOMPARE(wizard.startId(), -2); + QCOMPARE(wizard.nextId(), -1); + wizard.setStartId(-1); QCOMPARE(wizard.startId(), INT_MIN); @@ -2209,6 +2252,7 @@ void tst_QWizard::removePage() QWizardPage *page1 = new QWizardPage; QWizardPage *page2 = new QWizardPage; QWizardPage *page3 = new QWizardPage; + QSignalSpy spy(&wizard, SIGNAL(pageRemoved(int))); wizard.setPage(0, page0); wizard.setPage(1, page1); @@ -2218,26 +2262,36 @@ void tst_QWizard::removePage() wizard.restart(); QCOMPARE(wizard.pageIds().size(), 4); QCOMPARE(wizard.visitedPages().size(), 1); + QCOMPARE(spy.count(), 0); // Removing a non-existent page wizard.removePage(4); QCOMPARE(wizard.pageIds().size(), 4); + QCOMPARE(spy.count(), 0); // Removing and then reinserting a page QCOMPARE(wizard.pageIds().size(), 4); QVERIFY(wizard.pageIds().contains(2)); wizard.removePage(2); + QCOMPARE(spy.count(), 1); + QList arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.pageIds().size(), 3); QVERIFY(!wizard.pageIds().contains(2)); wizard.setPage(2, page2); + QCOMPARE(spy.count(), 0); QCOMPARE(wizard.pageIds().size(), 4); QVERIFY(wizard.pageIds().contains(2)); // Removing the same page twice wizard.removePage(2); // restore + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.pageIds().size(), 3); QVERIFY(!wizard.pageIds().contains(2)); wizard.removePage(2); + QCOMPARE(spy.count(), 0); QCOMPARE(wizard.pageIds().size(), 3); QVERIFY(!wizard.pageIds().contains(2)); @@ -2247,7 +2301,11 @@ void tst_QWizard::removePage() wizard.next(); QCOMPARE(wizard.visitedPages().size(), 2); QCOMPARE(wizard.currentPage(), page1); + QCOMPARE(spy.count(), 0); wizard.removePage(2); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.visitedPages().size(), 2); QVERIFY(!wizard.pageIds().contains(2)); QCOMPARE(wizard.currentPage(), page1); @@ -2256,9 +2314,13 @@ void tst_QWizard::removePage() wizard.setPage(2, page2); // restore wizard.restart(); wizard.next(); + QCOMPARE(spy.count(), 0); QCOMPARE(wizard.visitedPages().size(), 2); QCOMPARE(wizard.currentPage(), page1); wizard.removePage(0); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 0); QCOMPARE(wizard.visitedPages().size(), 1); QVERIFY(!wizard.visitedPages().contains(0)); QVERIFY(!wizard.pageIds().contains(0)); @@ -2268,9 +2330,13 @@ void tst_QWizard::removePage() wizard.setPage(0, page0); // restore wizard.restart(); wizard.next(); + QCOMPARE(spy.count(), 0); QCOMPARE(wizard.visitedPages().size(), 2); QCOMPARE(wizard.currentPage(), page1); wizard.removePage(1); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 1); QCOMPARE(wizard.visitedPages().size(), 1); QVERIFY(!wizard.visitedPages().contains(1)); QVERIFY(!wizard.pageIds().contains(1)); @@ -2278,6 +2344,9 @@ void tst_QWizard::removePage() // Remove the current page which is the first (and only) one in the history wizard.removePage(0); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 0); QCOMPARE(wizard.visitedPages().size(), 1); QVERIFY(!wizard.visitedPages().contains(0)); QCOMPARE(wizard.pageIds().size(), 2); @@ -2285,6 +2354,9 @@ void tst_QWizard::removePage() QCOMPARE(wizard.currentPage(), page2); // wizard.removePage(2); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 2); QCOMPARE(wizard.visitedPages().size(), 1); QVERIFY(!wizard.visitedPages().contains(2)); QCOMPARE(wizard.pageIds().size(), 1); @@ -2292,11 +2364,34 @@ void tst_QWizard::removePage() QCOMPARE(wizard.currentPage(), page3); // wizard.removePage(3); + QCOMPARE(spy.count(), 1); + arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toInt(), 3); QVERIFY(wizard.visitedPages().empty()); QVERIFY(wizard.pageIds().empty()); QCOMPARE(wizard.currentPage(), static_cast(0)); } +void tst_QWizard::sideWidget() +{ + QWizard wizard; + + wizard.setSideWidget(0); + QVERIFY(wizard.sideWidget() == 0); + QWidget *w1 = new QWidget(&wizard); + wizard.setSideWidget(w1); + QVERIFY(wizard.sideWidget() == w1); + QWidget *w2 = new QWidget(&wizard); + wizard.setSideWidget(w2); + QVERIFY(wizard.sideWidget() == w2); + QVERIFY(w1->parent() != 0); + QCOMPARE(w1->window(), static_cast(&wizard)); + QCOMPARE(w2->window(), static_cast(&wizard)); + w1->setParent(0); + wizard.setSideWidget(0); + QVERIFY(wizard.sideWidget() == 0); +} + void tst_QWizard::task161660_buttonSpacing() { #ifndef QT_NO_STYLE_PLASTIQUE -- cgit v0.12 From de5e292f706ab05d2a8a213bbd73db06a61eb9d2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Mar 2010 16:15:22 +0100 Subject: Rename m_volume to m_vol HP-UX has a #define somewhere for m_volume --- src/imports/multimedia/qdeclarativemediabase.cpp | 10 +++++----- src/imports/multimedia/qdeclarativemediabase_p.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/imports/multimedia/qdeclarativemediabase.cpp b/src/imports/multimedia/qdeclarativemediabase.cpp index 5bad969..bbd5901 100644 --- a/src/imports/multimedia/qdeclarativemediabase.cpp +++ b/src/imports/multimedia/qdeclarativemediabase.cpp @@ -232,7 +232,7 @@ QDeclarativeMediaBase::QDeclarativeMediaBase() , m_loaded(false) , m_muted(false) , m_position(0) - , m_volume(1.0) + , m_vol(1.0) , m_playbackRate(1.0) , m_mediaService(0) , m_playerControl(0) @@ -313,7 +313,7 @@ void QDeclarativeMediaBase::setObject(QObject *object) } // Init - m_playerControl->setVolume(m_volume * 100); + m_playerControl->setVolume(m_vol * 100); m_playerControl->setMuted(m_muted); m_playerControl->setPlaybackRate(m_playbackRate); @@ -457,15 +457,15 @@ void QDeclarativeMediaBase::setPosition(int position) qreal QDeclarativeMediaBase::volume() const { - return m_playerControl == 0 ? m_volume : qreal(m_playerControl->volume()) / 100; + return m_playerControl == 0 ? m_vol : qreal(m_playerControl->volume()) / 100; } void QDeclarativeMediaBase::setVolume(qreal volume) { - if (m_volume == volume) + if (m_vol == volume) return; - m_volume = volume; + m_vol = volume; if (m_playerControl != 0) m_playerControl->setVolume(qRound(volume * 100)); diff --git a/src/imports/multimedia/qdeclarativemediabase_p.h b/src/imports/multimedia/qdeclarativemediabase_p.h index 43df54d..7d262e0 100644 --- a/src/imports/multimedia/qdeclarativemediabase_p.h +++ b/src/imports/multimedia/qdeclarativemediabase_p.h @@ -154,7 +154,7 @@ protected: bool m_loaded; bool m_muted; int m_position; - qreal m_volume; + qreal m_vol; qreal m_playbackRate; QMediaService *m_mediaService; QMediaPlayerControl *m_playerControl; -- cgit v0.12 From b2cfb30175f2d08ecfbe9fa7b8b502aeed4c1fca Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Mar 2010 16:26:05 +0100 Subject: Fix compilation with WINSCW: #include doesn't find files in the same dir --- src/declarative/graphicsitems/qdeclarativeitem_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 55df063..cb068da 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -55,9 +55,9 @@ #include "qdeclarativeitem.h" -#include "qdeclarativeanchors_p.h" -#include "qdeclarativeanchors_p_p.h" -#include "qdeclarativeitemchangelistener_p.h" +#include "private/qdeclarativeanchors_p.h" +#include "private/qdeclarativeanchors_p_p.h" +#include "private/qdeclarativeitemchangelistener_p.h" #include #include -- cgit v0.12 From 06b9776836a8e16792eb647c33310eb773780f0a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Mar 2010 16:26:53 +0100 Subject: Fix compilation on Linux Error was: narrowing conversion of 'point.QPointF::x()' from 'qreal' to 'float' inside { } --- src/declarative/qml/qdeclarativecompiler.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 42d2950..7eb469a 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -438,7 +438,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, bool ok; QPointF point = QDeclarativeStringConverters::pointFFromString(string, &ok); - float data[] = { point.x(), point.y() }; + float data[] = { float(point.x()), float(point.y()) }; int index = output->indexForFloat(data, 2); if (type == QVariant::PointF) instr.type = QDeclarativeInstruction::StorePointF; @@ -453,7 +453,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, { bool ok; QSizeF size = QDeclarativeStringConverters::sizeFFromString(string, &ok); - float data[] = { size.width(), size.height() }; + float data[] = { float(size.width()), float(size.height()) }; int index = output->indexForFloat(data, 2); if (type == QVariant::SizeF) instr.type = QDeclarativeInstruction::StoreSizeF; @@ -468,8 +468,8 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, { bool ok; QRectF rect = QDeclarativeStringConverters::rectFFromString(string, &ok); - float data[] = { rect.x(), rect.y(), - rect.width(), rect.height() }; + float data[] = { float(rect.x()), float(rect.y()), + float(rect.width()), float(rect.height()) }; int index = output->indexForFloat(data, 4); if (type == QVariant::RectF) instr.type = QDeclarativeInstruction::StoreRectF; @@ -492,7 +492,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, bool ok; QVector3D vector = QDeclarativeStringConverters::vector3DFromString(string, &ok); - float data[] = { vector.x(), vector.y(), vector.z() }; + float data[] = { float(vector.x()), float(vector.y()), float(vector.z()) }; int index = output->indexForFloat(data, 3); instr.type = QDeclarativeInstruction::StoreVector3D; instr.storeRealPair.propertyIndex = prop.propertyIndex(); -- cgit v0.12 From 29f94f0d25711bd30fd5ed7d6a6717ce4f2244d5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Mar 2010 16:27:05 +0100 Subject: Fix cast-from-ascii warning --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 7eb469a..64d46d5 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2094,7 +2094,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Propert buildDynamicMeta(baseObj, ForceCreation); v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; } else { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(v->object->typeName.constData()).arg(prop->name.constData())); + COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(QLatin1String(v->object->typeName.constData())).arg(QLatin1String(prop->name.constData()))); } return true; -- cgit v0.12 From 69e873e2bfae3fc028c21d93112a75008c3bb58b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Mar 2010 23:15:23 +0100 Subject: Avoid a data relocation by not trying to store a pointer in the .data section of plugins. Reviewed-By: Rohan McGovern --- src/corelib/plugin/qplugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index b798437..7f541f1 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -110,7 +110,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio # define QPLUGIN_DEBUG_STR "true" # endif # define Q_PLUGIN_VERIFICATION_DATA \ - static const char *qt_plugin_verification_data = \ + static const char qt_plugin_verification_data[] = \ "pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \ "version="QT_VERSION_STR"\n" \ "debug="QPLUGIN_DEBUG_STR"\n" \ -- cgit v0.12 From 7c594907d521bb29ecca1b953a4ceea49ec32dd4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 20 Mar 2010 23:57:59 +0100 Subject: Compile Qt in C++0x mode. This is not valid in C++0x: char str[] = { 128, 0 }; Because 128 cannot be represented in a char. The same applies to conversion from int to qreal: it's a narrowing conversion, with possible data loss. More info: http://www2.research.att.com/~bs/C++0xFAQ.html#narrowing Reviewed-by: Trust Me --- src/dbus/qdbusmarshaller.cpp | 2 +- src/gui/itemviews/qitemdelegate.cpp | 2 +- src/gui/kernel/qcursor_x11.cpp | 68 +++++++++++----------- src/gui/painting/qpaintengineex.cpp | 19 +++--- src/gui/styles/qstylesheetstyle.cpp | 2 +- src/gui/text/qtextdocument_p.cpp | 2 +- src/multimedia/base/qpaintervideosurface.cpp | 34 +++++------ .../gl2paintengineex/qpaintengineex_opengl2.cpp | 8 +-- src/opengl/qglshaderprogram.cpp | 20 ++++--- src/opengl/qpaintengine_opengl.cpp | 8 +-- 10 files changed, 84 insertions(+), 81 deletions(-) diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp index 8ec328e..60b3c09 100644 --- a/src/dbus/qdbusmarshaller.cpp +++ b/src/dbus/qdbusmarshaller.cpp @@ -514,7 +514,7 @@ bool QDBusMarshaller::appendCrossMarshalling(QDBusDemarshaller *demarshaller) void* data; q_dbus_message_iter_get_fixed_array(&sub,&data,&len); - char signature[2] = { element, 0 }; + char signature[2] = { char(element), 0 }; q_dbus_message_iter_open_container(&iterator, DBUS_TYPE_ARRAY, signature, &sub); q_dbus_message_iter_append_fixed_array(&sub, element, &data, len); q_dbus_message_iter_close_container(&iterator, &sub); diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 7d8e103..cba213b 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1023,7 +1023,7 @@ QPixmap QItemDelegate::decoration(const QStyleOptionViewItem &option, const QVar // hacky but faster version of "QString::sprintf("%d-%d", i, enabled)" static QString qPixmapSerial(quint64 i, bool enabled) { - ushort arr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', '0' + enabled }; + ushort arr[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', ushort('0' + enabled) }; ushort *ptr = &arr[16]; while (i > 0) { diff --git a/src/gui/kernel/qcursor_x11.cpp b/src/gui/kernel/qcursor_x11.cpp index 4e871a6..8e48628 100644 --- a/src/gui/kernel/qcursor_x11.cpp +++ b/src/gui/kernel/qcursor_x11.cpp @@ -294,7 +294,7 @@ void QCursorData::update() return; #endif // QT_NO_XCURSOR - static const char cur_blank_bits[] = { + static const uchar cur_blank_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -302,44 +302,44 @@ void QCursorData::update() // Non-standard X11 cursors are created from bitmaps #ifndef QT_USE_APPROXIMATE_CURSORS - static const char cur_ver_bits[] = { + static const uchar cur_ver_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 }; - static const char mcur_ver_bits[] = { + static const uchar mcur_ver_bits[] = { 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 }; - static const char cur_hor_bits[] = { + static const uchar cur_hor_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18, 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const char mcur_hor_bits[] = { + static const uchar mcur_hor_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c, 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c, 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 }; - static const char cur_bdiag_bits[] = { + static const uchar cur_bdiag_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const char mcur_bdiag_bits[] = { + static const uchar mcur_bdiag_bits[] = { 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f, 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01, 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 }; - static const char cur_fdiag_bits[] = { + static const uchar cur_fdiag_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 }; - static const char mcur_fdiag_bits[] = { + static const uchar mcur_fdiag_bits[] = { 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00, 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e, 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 }; - static const char *cursor_bits16[] = { + static const uchar *cursor_bits16[] = { cur_ver_bits, mcur_ver_bits, cur_hor_bits, mcur_hor_bits, cur_bdiag_bits, mcur_bdiag_bits, cur_fdiag_bits, mcur_fdiag_bits, 0, 0, cur_blank_bits, cur_blank_bits }; - static const char vsplit_bits[] = { + static const uchar vsplit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, @@ -351,7 +351,7 @@ void QCursorData::update() 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const char vsplitm_bits[] = { + static const uchar vsplitm_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00, @@ -363,7 +363,7 @@ void QCursorData::update() 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const char hsplit_bits[] = { + static const uchar hsplit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, @@ -375,7 +375,7 @@ void QCursorData::update() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const char hsplitm_bits[] = { + static const uchar hsplitm_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, @@ -387,7 +387,7 @@ void QCursorData::update() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static const char whatsthis_bits[] = { + static const uchar whatsthis_bits[] = { 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00, 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00, 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00, @@ -399,7 +399,7 @@ void QCursorData::update() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - static const char whatsthism_bits[] = { + static const uchar whatsthism_bits[] = { 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00, 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00, 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00, @@ -411,7 +411,7 @@ void QCursorData::update() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - static const char busy_bits[] = { + static const uchar busy_bits[] = { 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00, @@ -423,7 +423,7 @@ void QCursorData::update() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - static const char busym_bits[] = { + static const uchar busym_bits[] = { 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00, @@ -436,41 +436,41 @@ void QCursorData::update() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - static const char * const cursor_bits32[] = { + static const uchar * const cursor_bits32[] = { vsplit_bits, vsplitm_bits, hsplit_bits, hsplitm_bits, 0, 0, 0, 0, whatsthis_bits, whatsthism_bits, busy_bits, busym_bits }; - static const char forbidden_bits[] = { + static const uchar forbidden_bits[] = { 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01, 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06, 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03, 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 }; - static const char forbiddenm_bits[] = { + static const uchar forbiddenm_bits[] = { 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03, 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f, 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07, 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00}; - static const char openhand_bits[] = { + static const uchar openhand_bits[] = { 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92, 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20, 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00}; - static const char openhandm_bits[] = { + static const uchar openhandm_bits[] = { 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff, 0xf6,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f, 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00}; - static const char closedhand_bits[] = { + static const uchar closedhand_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50, 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10, 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00}; - static const char closedhandm_bits[] = { + static const uchar closedhandm_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f, 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; - static const char * const cursor_bits20[] = { + static const uchar * const cursor_bits20[] = { forbidden_bits, forbiddenm_bits }; @@ -484,8 +484,8 @@ void QCursorData::update() fg.green = 0; fg.blue = 0; int i = (cshape - Qt::SizeVerCursor) * 2; - pm = XCreateBitmapFromData(dpy, rootwin, cursor_bits16[i], 16, 16); - pmm = XCreateBitmapFromData(dpy, rootwin, cursor_bits16[i + 1], 16, 16); + pm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(cursor_bits16[i]), 16, 16); + pmm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(cursor_bits16[i + 1]), 16, 16); hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); } else if ((cshape >= Qt::SplitVCursor && cshape <= Qt::SplitHCursor) || cshape == Qt::WhatsThisCursor || cshape == Qt::BusyCursor) { @@ -497,8 +497,8 @@ void QCursorData::update() fg.green = 0; fg.blue = 0; int i = (cshape - Qt::SplitVCursor) * 2; - pm = XCreateBitmapFromData(dpy, rootwin, cursor_bits32[i], 32, 32); - pmm = XCreateBitmapFromData(dpy, rootwin, cursor_bits32[i + 1], 32, 32); + pm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(cursor_bits32[i]), 32, 32); + pmm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(cursor_bits32[i + 1]), 32, 32); int hs = (cshape == Qt::PointingHandCursor || cshape == Qt::WhatsThisCursor || cshape == Qt::BusyCursor) ? 0 : 16; hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, hs, hs); @@ -511,8 +511,8 @@ void QCursorData::update() fg.green = 0; fg.blue = 0; int i = (cshape - Qt::ForbiddenCursor) * 2; - pm = XCreateBitmapFromData(dpy, rootwin, cursor_bits20[i], 20, 20); - pmm = XCreateBitmapFromData(dpy, rootwin, cursor_bits20[i + 1], 20, 20); + pm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(cursor_bits20[i]), 20, 20); + pmm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(cursor_bits20[i + 1]), 20, 20); hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 10, 10); } else if (cshape == Qt::OpenHandCursor || cshape == Qt::ClosedHandCursor) { XColor bg, fg; @@ -523,8 +523,8 @@ void QCursorData::update() fg.green = 0; fg.blue = 0; bool open = cshape == Qt::OpenHandCursor; - pm = XCreateBitmapFromData(dpy, rootwin, open ? openhand_bits : closedhand_bits, 16, 16); - pmm = XCreateBitmapFromData(dpy, rootwin, open ? openhandm_bits : closedhandm_bits, 16, 16); + pm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(open ? openhand_bits : closedhand_bits), 16, 16); + pmm = XCreateBitmapFromData(dpy, rootwin, reinterpret_cast(open ? openhandm_bits : closedhandm_bits), 16, 16); hcurs = XCreatePixmapCursor(dpy, pm, pmm, &fg, &bg, 8, 8); } else if (cshape == Qt::DragCopyCursor || cshape == Qt::DragMoveCursor || cshape == Qt::DragLinkCursor) { diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 1fd622d..990e3c4 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -607,11 +607,11 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op) { qreal right = r.x() + r.width(); qreal bottom = r.y() + r.height(); - qreal pts[] = { r.x(), r.y(), - right, r.y(), + qreal pts[] = { qreal(r.x()), qreal(r.y()), + right, qreal(r.y()), right, bottom, - r.x(), bottom, - r.x(), r.y() }; + qreal(r.x()), bottom, + qreal(r.x()), qreal(r.y()) }; QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); clip(vp, op); } @@ -711,11 +711,11 @@ void QPaintEngineEx::drawRects(const QRect *rects, int rectCount) // ### Is there a one off here? qreal right = r.x() + r.width(); qreal bottom = r.y() + r.height(); - qreal pts[] = { r.x(), r.y(), - right, r.y(), + qreal pts[] = { qreal(r.x()), qreal(r.y()), + right, qreal(r.y()), right, bottom, - r.x(), bottom, - r.x(), r.y() }; + qreal(r.x()), bottom, + qreal(r.x()), qreal(r.y()) }; QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); draw(vp); } @@ -903,7 +903,8 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) } } else { for (int i=0; idevice->size(); diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 739983e..55fd922 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -1290,7 +1290,8 @@ void QGLShaderProgram::setAttributeValue(int location, const QColor& value) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {value.redF(), value.greenF(), value.blueF(), value.alphaF()}; + GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()), + GLfloat(value.blueF()), GLfloat(value.alphaF())}; glVertexAttrib4fv(location, values); } } @@ -2025,7 +2026,8 @@ void QGLShaderProgram::setUniformValue(int location, const QColor& color) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {color.redF(), color.greenF(), color.blueF(), color.alphaF()}; + GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()), + GLfloat(color.blueF()), GLfloat(color.alphaF())}; glUniform4fv(location, 1, values); } } @@ -2054,7 +2056,7 @@ void QGLShaderProgram::setUniformValue(int location, const QPoint& point) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {point.x(), point.y()}; + GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())}; glUniform2fv(location, 1, values); } } @@ -2083,7 +2085,7 @@ void QGLShaderProgram::setUniformValue(int location, const QPointF& point) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {point.x(), point.y()}; + GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())}; glUniform2fv(location, 1, values); } } @@ -2112,7 +2114,7 @@ void QGLShaderProgram::setUniformValue(int location, const QSize& size) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {size.width(), size.width()}; + GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.width())}; glUniform2fv(location, 1, values); } } @@ -2141,7 +2143,7 @@ void QGLShaderProgram::setUniformValue(int location, const QSizeF& size) Q_D(QGLShaderProgram); Q_UNUSED(d); if (location != -1) { - GLfloat values[4] = {size.width(), size.height()}; + GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())}; glUniform2fv(location, 1, values); } } @@ -2562,9 +2564,9 @@ void QGLShaderProgram::setUniformValue(int location, const QTransform& value) Q_UNUSED(d); if (location != -1) { GLfloat mat[3][3] = { - {value.m11(), value.m12(), value.m13()}, - {value.m21(), value.m22(), value.m23()}, - {value.m31(), value.m32(), value.m33()} + {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())}, + {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())}, + {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())} }; glUniformMatrix3fv(location, 1, GL_FALSE, mat[0]); } diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index c8307a0..306fd8b 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -3342,15 +3342,15 @@ void QGLEllipseMaskGenerator::drawMask(const QRect &rect) QTransform gl_to_qt(1, 0, 0, -1, 0, offscreen->drawableSize().height()); QTransform inv_matrix = gl_to_qt * matrix().inverted() * translate; - float m[3][4] = { { inv_matrix.m11(), inv_matrix.m12(), inv_matrix.m13() }, - { inv_matrix.m21(), inv_matrix.m22(), inv_matrix.m23() }, - { inv_matrix.m31(), inv_matrix.m32(), inv_matrix.m33() } }; + float m[3][4] = { { float(inv_matrix.m11()), float(inv_matrix.m12()), float(inv_matrix.m13()) }, + { float(inv_matrix.m21()), float(inv_matrix.m22()), float(inv_matrix.m23()) }, + { float(inv_matrix.m31()), float(inv_matrix.m32()), float(inv_matrix.m33()) } }; QPoint offs(screen_rect.left() - rect.left(), (offscreen->drawableSize().height() - screen_rect.top()) - (offscreen->offscreenSize().height() - rect.top())); // last component needs to be 1.0f to avoid Nvidia bug on linux - float ellipse_offset[4] = { offs.x(), offs.y(), 0.0f, 1.0f }; + float ellipse_offset[4] = { float(offs.x()), float(offs.y()), 0.0f, 1.0f }; GLfloat vertexArray[4 * 2]; qt_add_rect_to_array(rect, vertexArray); -- cgit v0.12 From 1aca37afd10fbb4c440f7a66fb7ad3f23e47a312 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 21 Mar 2010 00:30:53 +0100 Subject: Compile Phonon in C++0x mode. Will upstream the patch --- src/3rdparty/phonon/gstreamer/glrenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/gstreamer/glrenderer.cpp b/src/3rdparty/phonon/gstreamer/glrenderer.cpp index 6cf3459..0203028 100644 --- a/src/3rdparty/phonon/gstreamer/glrenderer.cpp +++ b/src/3rdparty/phonon/gstreamer/glrenderer.cpp @@ -304,7 +304,7 @@ void GLRenderWidgetImplementation::paintEvent(QPaintEvent *) const float tx_array[] = { 0, 0, 1, 0, 1, 1, 0, 1}; const QRectF r = drawFrameRect(); - const float v_array[] = { r.left(), r.top(), r.right(), r.top(), r.right(), r.bottom(), r.left(), r.bottom() }; + const float v_array[] = { float(r.left()), float(r.top()), float(r.right()), float(r.top()), float(r.right()), float(r.bottom()), float(r.left()), float(r.bottom()) }; glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, m_texture[0]); -- cgit v0.12 From 59f1e6b6ac569ae50ec657795454e4910aa0075f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 21 Mar 2010 00:31:17 +0100 Subject: Disable C++0x mode for QtWebKit and QtScript since WebKit will not compile any time soon with C++0x --- src/3rdparty/webkit/WebCore/WebCore.pro | 3 +++ src/script/script.pro | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index a80eed4..2f85100 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -3424,3 +3424,6 @@ symbian { } } } + +# WebKit doesn't compile in C++0x mode +*-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x diff --git a/src/script/script.pro b/src/script/script.pro index 2a74a66..55217e0 100644 --- a/src/script/script.pro +++ b/src/script/script.pro @@ -80,3 +80,6 @@ INCLUDEPATH += $$PWD include(script.pri) symbian:TARGET.UID3=0x2001B2E1 + +# WebKit doesn't compile in C++0x mode +*-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x -- cgit v0.12 From 05500482c4b7f810bd4c073739bdedf0b8783738 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 21 Mar 2010 09:29:07 +0100 Subject: Autotests: if you use X11 libs, you must link to X11 libs explicitly. Solaris linker complains if you don't. Plus it's the right thing to do --- tests/auto/guiapplauncher/guiapplauncher.pro | 3 +++ tests/auto/qgl_threads/qgl_threads.pro | 3 +++ tests/auto/qwidget/qwidget.pro | 4 ++++ tests/auto/qwidget_window/qwidget_window.pro | 3 +++ 4 files changed, 13 insertions(+) diff --git a/tests/auto/guiapplauncher/guiapplauncher.pro b/tests/auto/guiapplauncher/guiapplauncher.pro index 2f81061..30f5cf4 100644 --- a/tests/auto/guiapplauncher/guiapplauncher.pro +++ b/tests/auto/guiapplauncher/guiapplauncher.pro @@ -16,3 +16,6 @@ HEADERS += windowmanager.h # process enumeration,etc. win32:LIBS+=-luser32 +x11 { + LIBS += $$QMAKE_LIBS_X11 +} diff --git a/tests/auto/qgl_threads/qgl_threads.pro b/tests/auto/qgl_threads/qgl_threads.pro index 9312c05..83d5d82 100644 --- a/tests/auto/qgl_threads/qgl_threads.pro +++ b/tests/auto/qgl_threads/qgl_threads.pro @@ -9,3 +9,6 @@ QT += opengl HEADERS += tst_openglthreading.h SOURCES += tst_openglthreading.cpp +x11 { + LIBS += $$QMAKE_LIBS_X11 +} diff --git a/tests/auto/qwidget/qwidget.pro b/tests/auto/qwidget/qwidget.pro index 61db2ee..e39431b 100644 --- a/tests/auto/qwidget/qwidget.pro +++ b/tests/auto/qwidget/qwidget.pro @@ -14,6 +14,10 @@ mac { OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm } +x11 { + LIBS += $$QMAKE_LIBS_X11 +} + symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE LIBS += -leikcore -lcone -leikcoctl diff --git a/tests/auto/qwidget_window/qwidget_window.pro b/tests/auto/qwidget_window/qwidget_window.pro index e375fab..df7d687 100644 --- a/tests/auto/qwidget_window/qwidget_window.pro +++ b/tests/auto/qwidget_window/qwidget_window.pro @@ -1,4 +1,7 @@ load(qttest_p4) SOURCES += tst_qwidget_window.cpp +x11 { + LIBS += $$QMAKE_LIBS_X11 +} -- cgit v0.12 From 2cc9a9a51d6742708b1ea41c7338755e2a0ee9e9 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 22 Mar 2010 13:48:36 +1000 Subject: Fix build failure on WinCE. --- src/network/bearer/qnetworksession.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 18437f6..e65c177 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -48,6 +48,10 @@ #include #include +#if defined(Q_OS_WIN) && defined(interface) +#undef interface +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -- cgit v0.12 From 74f5e34979b8a08a91aa3c2fa6d252e68eca7817 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 22 Mar 2010 10:46:00 +0100 Subject: Add support for polyphonic greek Merge patch c0006e05f32ecd6f16825b799d2bce345c166433 from harfbuzz and add autotests to QTextScriptEngine. Support for polyphonic greek is implemented by mapping decomposed greek character sequences to their composed characters in the greek extended unicode range (U+1f00 - U+1fff). Task-number: QTBUG-391 Reviewed-By: Simon Hausmann --- src/3rdparty/harfbuzz/src/Makefile.am | 3 +- src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp | 1 + .../harfbuzz/src/harfbuzz-shaper-private.h | 1 + src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 2 +- src/3rdparty/harfbuzz/tests/shaping/main.cpp | 127 +++++++++++++++++---- .../qtextscriptengine/tst_qtextscriptengine.cpp | 75 ++++++++++++ 6 files changed, 185 insertions(+), 24 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/Makefile.am b/src/3rdparty/harfbuzz/src/Makefile.am index 2b0fb1d..51d0652 100644 --- a/src/3rdparty/harfbuzz/src/Makefile.am +++ b/src/3rdparty/harfbuzz/src/Makefile.am @@ -12,7 +12,8 @@ MAINSOURCES = \ harfbuzz-impl.c \ harfbuzz-open.c \ harfbuzz-shaper.cpp \ - harfbuzz-tibetan.c \ + harfbuzz-greek.c \ + harfbuzz-tibetan.c \ harfbuzz-khmer.c \ harfbuzz-indic.cpp \ harfbuzz-hebrew.c \ diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp index d2f902f..2dae501 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-all.cpp @@ -25,6 +25,7 @@ #include "harfbuzz-shaper.cpp" #include "harfbuzz-indic.cpp" extern "C" { +#include "harfbuzz-greek.c" #include "harfbuzz-tibetan.c" #include "harfbuzz-khmer.c" #include "harfbuzz-hebrew.c" diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h index 80bccf8..11ed753 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h @@ -100,6 +100,7 @@ typedef struct { extern const HB_ScriptEngine hb_scriptEngines[]; extern HB_Bool HB_BasicShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_GreekShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_TibetanShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_ArabicShape(HB_ShaperItem *shaper_item); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index bfc7bd4..4bc53c8 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -587,7 +587,7 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Common { HB_BasicShape, 0}, // Greek - { HB_BasicShape, 0}, + { HB_GreekShape, 0}, // Cyrillic { HB_BasicShape, 0}, // Armenian diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp index 827ac30..b48b0a9 100644 --- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp +++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp @@ -136,13 +136,13 @@ HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 return HB_Err_Ok; } -void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics) +void hb_getGlyphMetrics(HB_Font, HB_Glyph, HB_GlyphMetrics *metrics) { // ### metrics->x = metrics->y = metrics->width = metrics->height = metrics->xOffset = metrics->yOffset = 0; } -HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric) +HB_Fixed hb_getFontMetric(HB_Font, HB_FontMetric ) { return 0; // #### } @@ -169,6 +169,8 @@ public slots: void initTestCase(); void cleanupTestCase(); private slots: + void greek(); + void devanagari(); void bengali(); void gurmukhi(); @@ -203,18 +205,25 @@ void tst_QScriptEngine::cleanupTestCase() FT_Done_FreeType(freetype); } -struct ShapeTable { - unsigned short unicode[16]; - unsigned short glyphs[16]; +class Shaper +{ +public: + Shaper(FT_Face face, HB_Script script, const QString &str); + + HB_FontRec hbFont; + HB_ShaperItem shaper_item; + QVarLengthArray hb_glyphs; + QVarLengthArray hb_attributes; + QVarLengthArray hb_advances; + QVarLengthArray hb_offsets; + QVarLengthArray hb_logClusters; + }; -static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +Shaper::Shaper(FT_Face face, HB_Script script, const QString &str) { - QString str = QString::fromUtf16( s->unicode ); - HB_Face hbFace = HB_NewFace(face, hb_getSFntTable); - HB_FontRec hbFont; hbFont.klass = &hb_fontClass; hbFont.userData = face; hbFont.x_ppem = face->size->metrics.x_ppem; @@ -222,7 +231,6 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) hbFont.x_scale = face->size->metrics.x_scale; hbFont.y_scale = face->size->metrics.y_scale; - HB_ShaperItem shaper_item; shaper_item.kerning_applied = false; shaper_item.string = reinterpret_cast(str.constData()); shaper_item.stringLength = str.length(); @@ -237,11 +245,6 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) shaper_item.glyphIndicesPresent = false; shaper_item.initialGlyphCount = 0; - QVarLengthArray hb_glyphs(shaper_item.num_glyphs); - QVarLengthArray hb_attributes(shaper_item.num_glyphs); - QVarLengthArray hb_advances(shaper_item.num_glyphs); - QVarLengthArray hb_offsets(shaper_item.num_glyphs); - QVarLengthArray hb_logClusters(shaper_item.num_glyphs); while (1) { hb_glyphs.resize(shaper_item.num_glyphs); @@ -263,10 +266,68 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) if (HB_ShapeItem(&shaper_item)) break; - } HB_FreeFace(hbFace); +} + + +#if defined(Q_WS_X11) +static bool decomposedShaping(FT_Face face, HB_Script script, const QChar &ch) +{ + QString uc = QString().append(ch); + Shaper shaper(face, script, uc); + + uc = uc.normalized(QString::NormalizationForm_D); + Shaper decomposed(face, script, uc); + + if( shaper.shaper_item.num_glyphs != decomposed.shaper_item.num_glyphs ) + goto error; + + for (unsigned int i = 0; i < shaper.shaper_item.num_glyphs; ++i) { + if ((shaper.shaper_item.glyphs[i]&0xffffff) != (decomposed.shaper_item.glyphs[i]&0xffffff)) + goto error; + } + return true; + error: + QString str = ""; + int i = 0; + while (i < uc.length()) { + str += QString("%1 ").arg(uc[i].unicode(), 4, 16); + ++i; + } + qDebug("%s: decomposedShaping of char %4x failed\n decomposedString: %s\n nglyphs=%d, decomposed nglyphs %d", + face->family_name, + ch.unicode(), str.toLatin1().data(), + shaper.shaper_item.num_glyphs, + decomposed.shaper_item.num_glyphs); + + str = ""; + i = 0; + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" composed glyph result = %s", str.toLatin1().constData()); + str = ""; + i = 0; + while (i < decomposed.shaper_item.num_glyphs) { + str += QString("%1 ").arg(decomposed.shaper_item.glyphs[i], 4, 16); + ++i; + } + qDebug(" decomposed glyph result = %s", str.toLatin1().constData()); + return false; +} +#endif + +struct ShapeTable { + unsigned short unicode[16]; + unsigned short glyphs[16]; +}; + +static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) +{ + Shaper shaper(face, script, QString::fromUtf16( s->unicode )); hb_uint32 nglyphs = 0; const unsigned short *g = s->glyphs; @@ -275,16 +336,16 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) g++; } - if( nglyphs != shaper_item.num_glyphs ) + if( nglyphs != shaper.shaper_item.num_glyphs ) goto error; for (hb_uint32 i = 0; i < nglyphs; ++i) { - if ((shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) + if ((shaper.shaper_item.glyphs[i]&0xffffff) != s->glyphs[i]) goto error; } return true; error: - str = ""; + QString str = ""; const unsigned short *uc = s->unicode; while (*uc) { str += QString("%1 ").arg(*uc, 4, 16); @@ -293,18 +354,40 @@ static bool shaping(FT_Face face, const ShapeTable *s, HB_Script script) qDebug("%s: shaping of string %s failed, nglyphs=%d, expected %d", face->family_name, str.toLatin1().constData(), - shaper_item.num_glyphs, nglyphs); + shaper.shaper_item.num_glyphs, nglyphs); str = ""; hb_uint32 i = 0; - while (i < shaper_item.num_glyphs) { - str += QString("%1 ").arg(shaper_item.glyphs[i], 4, 16); + while (i < shaper.shaper_item.num_glyphs) { + str += QString("%1 ").arg(shaper.shaper_item.glyphs[i], 4, 16); ++i; } qDebug(" glyph result = %s", str.toLatin1().constData()); return false; } + +void tst_QScriptEngine::greek() +{ + FT_Face face = loadFace("DejaVuSans.ttf"); + if (face) { + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(face, HB_Script_Greek, QChar(uc)) ); + } + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } +} + + void tst_QScriptEngine::devanagari() { { diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 6de3f59..841f5b9 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -99,6 +99,7 @@ private slots: void kannada(); void malayalam(); void sinhala(); + void greek(); void khmer(); void linearB(); @@ -998,6 +999,80 @@ void tst_QTextScriptEngine::linearB() #endif } +#if defined(Q_WS_X11) +static bool decomposedShaping( const QFont &f, const QChar &ch) +{ + QString str = QString().append(ch); + QTextLayout layout(str, f); + QTextEngine *e = layout.d; + e->itemize(); + e->shape(0); + + QTextLayout decomposed(str.normalized(QString::NormalizationForm_D), f); + QTextEngine *de = decomposed.d; + de->itemize(); + de->shape(0); + + if( e->layoutData->items[0].num_glyphs != de->layoutData->items[0].num_glyphs ) + goto error; + + for (int i = 0; i < e->layoutData->items[0].num_glyphs; ++i) { + if ((e->layoutData->glyphLayout.glyphs[i] & 0xffffff) != (de->layoutData->glyphLayout.glyphs[i] & 0xffffff)) + goto error; + } + return true; + error: + qDebug("%s: decomposedShaping of char %4x failed, nglyphs=%d, decomposed nglyphs %d", + f.family().toLatin1().constData(), + ch.unicode(), + e->layoutData->items[0].num_glyphs, + de->layoutData->items[0].num_glyphs); + + str = ""; + int i = 0; + while (i < e->layoutData->items[0].num_glyphs) { + str += QString("%1 ").arg(e->layoutData->glyphLayout.glyphs[i], 4, 16); + ++i; + } + qDebug(" composed glyph result = %s", str.toLatin1().constData()); + str = ""; + i = 0; + while (i < de->layoutData->items[0].num_glyphs) { + str += QString("%1 ").arg(de->layoutData->glyphLayout.glyphs[i], 4, 16); + ++i; + } + qDebug(" decomposed glyph result = %s", str.toLatin1().constData()); + return false; +} +#endif + + +void tst_QTextScriptEngine::greek() +{ +#if defined(Q_WS_X11) + { + if (QFontDatabase().families(QFontDatabase::Any).contains("DejaVu Sans")) { + QFont f("DejaVu Sans"); + for (int uc = 0x1f00; uc <= 0x1fff; ++uc) { + QString str; + str.append(uc); + if (str.normalized(QString::NormalizationForm_D).normalized(QString::NormalizationForm_C) != str) { + //qDebug() << "skipping" << hex << uc; + continue; + } + if (uc == 0x1fc1 || uc == 0x1fed) + continue; + QVERIFY( decomposedShaping(f, QChar(uc)) ); + } + } else { + QSKIP("couln't find DejaVu Sans", SkipAll); + } + } +#else + QSKIP("X11 specific test", SkipAll); +#endif +} + QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" -- cgit v0.12 From f725e2b9cae1866ff6510cb339cc4ada363f9e4f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 19 Mar 2010 22:48:12 +0100 Subject: Moc: Add support for rvalue references in signals and slots. Reviewed-By: Simon Hausmann --- src/tools/moc/moc.cpp | 4 +++- src/tools/moc/moc.h | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 94ad56f..c84233e 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -230,11 +230,13 @@ Type Moc::parseType() } } while (test(CONST) || test(VOLATILE) || test(SIGNED) || test(UNSIGNED) - || test(STAR) || test(AND)) { + || test(STAR) || test(AND) || test(ANDAND)) { type.name += ' '; type.name += lexem(); if (lookup(0) == AND) type.referenceType = Type::Reference; + else if (lookup(0) == ANDAND) + type.referenceType = Type::RValueReference; else if (lookup(0) == STAR) type.referenceType = Type::Pointer; } diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 10abfc6..6fb0d49 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -55,7 +55,7 @@ struct QMetaObject; struct Type { - enum ReferenceType { NoReference, Reference, Pointer }; + enum ReferenceType { NoReference, Reference, RValueReference, Pointer }; inline Type() : isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {} inline explicit Type(const QByteArray &_name) : name(_name), isVolatile(false), isScoped(false), firstToken(NOTOKEN), referenceType(NoReference) {} @@ -240,8 +240,11 @@ public: inline QByteArray noRef(const QByteArray &type) { - if (type.endsWith('&')) + if (type.endsWith('&')) { + if (type.endsWith("&&")) + return type.left(type.length()-2); return type.left(type.length()-1); + } return type; } -- cgit v0.12