diff options
120 files changed, 4169 insertions, 1680 deletions
@@ -944,7 +944,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" @@ -3331,7 +3331,7 @@ if [ "$OPT_HELP" = "yes" ]; then cat <<EOF Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>] - [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>] + [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>] [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-demosdir <dir>] [-buildkey <key>] [-release] [-debug] [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp index 5e44d1b..e5f1ddb 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<Tile> tiles READ tiles CONSTANT); + Q_PROPERTY(QDeclarativeListProperty<Tile> tiles READ tiles CONSTANT) QDeclarativeListProperty<Tile> tiles() { return QDeclarativeListProperty<Tile>(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: 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] 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/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 <QtCore> + +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/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 4dd81b0..c11ba55 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 @@ -66,8 +63,8 @@ QMAKE_LINK_OBJECT_MAX = QMAKE_LINK_OBJECT_SCRIPT= QMAKE_LIBS = -llibc -llibm -leuser -llibdl -QMAKE_LIBS_CORE = $$QMAKE_LIBS -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 -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/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/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)"; 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 <wtf/Platform.h> -#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/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..2282cdb 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -56,6 +56,7 @@ #include <QtCore/qbasictimer.h> #include <QtCore/qdatetime.h> #include <QtCore/qtimer.h> +#include <QtCore/qelapsedtimer.h> #include <private/qobject_p.h> #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 QElapsedTimer ElapsedTimer; class QUnifiedTimer : public QObject { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 12a992a..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 <qbytearray.h> -#include <qdatetime.h> +#include <qelapsedtimer.h> #include <qcoreapplication.h> #include <qsocketnotifier.h> #include <qtimer.h> @@ -1639,7 +1639,7 @@ bool QProcess::waitForBytesWritten(int msecs) if (d->processState == QProcess::NotRunning) return false; if (d->processState == QProcess::Starting) { - QTime 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) { - QTime 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 5119ec0..216c382 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -92,7 +92,6 @@ QT_END_NAMESPACE #include <private/qcoreapplication_p.h> #include <private/qthread_p.h> -#include <qdatetime.h> #include <qfile.h> #include <qfileinfo.h> #include <qlist.h> @@ -101,6 +100,7 @@ QT_END_NAMESPACE #include <qsemaphore.h> #include <qsocketnotifier.h> #include <qthread.h> +#include <qelapsedtimer.h> #include <errno.h> #include <stdlib.h> @@ -933,7 +933,7 @@ bool QProcessPrivate::waitForReadyRead(int msecs) qDebug("QProcessPrivate::waitForReadyRead(%d)", msecs); #endif - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); forever { @@ -1005,7 +1005,7 @@ bool QProcessPrivate::waitForBytesWritten(int msecs) qDebug("QProcessPrivate::waitForBytesWritten(%d)", msecs); #endif - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); while (!writeBuffer.isEmpty()) { @@ -1072,7 +1072,7 @@ bool QProcessPrivate::waitForFinished(int msecs) qDebug("QProcessPrivate::waitForFinished(%d)", msecs); #endif - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); forever { diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 0fd965b..e0d92c0 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 "qelapsedtimer.h" #ifndef Q_OS_VXWORKS # if !defined(Q_OS_HPUX) || defined(__ia64) @@ -56,74 +57,12 @@ #include <mach/mach_time.h> #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 (!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 297b25d..439ca5a 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 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 2da5a7d..8fc3fb8 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 <qdatastream.h> -#include <qdatetime.h> #include <qdebug.h> #include <qdir.h> #include <qfile.h> @@ -59,6 +58,7 @@ #include <qthreadpool.h> #include <qthreadstorage.h> #include <private/qthread_p.h> +#include <qelapsedtimer.h> #include <qlibraryinfo.h> #include <qvarlengtharray.h> #include <private/qfactoryloader_p.h> @@ -917,7 +917,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m QThreadData *data = QThreadData::current(); if (!data->eventDispatcher) return; - QTime 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 a141887..f7d45ac 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 "qelapsedtimer.h" #include "qeventdispatcher_unix_p.h" #include <private/qthread_p.h> @@ -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 (!QElapsedTimer::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 (QElapsedTimer::isMonotonic()) return; timeval delta; if (timeChanged(&delta)) 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<QThread *>(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 } diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index c1027ed..54a4205 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): + // ((1970 * 365) + (1970 / 4) - (1970 / 100) + (1970 / 400) - 13) * 86400 * 1000000 + static const qint64 unixEpoch = Q_INT64_C(0xdcddb30f2f8000); + + 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 6fdc855..ef5968e 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -261,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.cpp b/src/corelib/tools/qelapsedtimer.cpp new file mode 100644 index 0000000..28dfc23 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** +** +** 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 + +/*! + \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 + // 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..0d6f0be --- /dev/null +++ b/src/corelib/tools/qelapsedtimer.h @@ -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$ +** +****************************************************************************/ + +#ifndef QTIMESTAMP_H +#define QTIMESTAMP_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class Q_CORE_EXPORT QElapsedTimer +{ +public: + enum ClockType { + SystemTime, + MonotonicClock, + TickCounter, + MachAbsoluteTime + }; + static ClockType clockType(); + static bool isMonotonic(); + + void start(); + qint64 restart(); + void invalidate(); + bool isValid() const; + + qint64 elapsed() const; + bool hasExpired(qint64 timeout) const; + + qint64 msecsSinceReference() 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..9b589c1 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** 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 + +/*! + 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; + t1 = QDateTime::currentMsecsSinceEpoch(); + t2 = 0; + 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; +} + +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..8fceb49 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_mac.cpp @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** 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 <sys/time.h> +#include <unistd.h> + +#include <mach/mach_time.h> + +QT_BEGIN_NAMESPACE + +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return MachAbsoluteTime; +} + +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(); + t2 = 0; + + return absoluteToMSecs(t1 - old); +} + +qint64 QElapsedTimer::elapsed() const +{ + uint64_t cpu_time = mach_absolute_time(); + return absoluteToMSecs(cpu_time - t1); +} + +qint64 QElapsedTimer::msecsSinceReference() const +{ + return absoluteToMSecs(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..038b102 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_symbian.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** 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 <e32std.h> +#include <sys/time.h> +#include <hal.h> + +QT_BEGIN_NAMESPACE + +// return quint64 to avoid sign-extension +static quint64 getMicrosecondFromTick() +{ + static TInt nanokernel_tick_period; + if (!nanokernel_tick_period) + HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period); + + 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)); +} + +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; +} + +bool QElapsedTimer::isMonotonic() +{ + return true; +} + +void QElapsedTimer::start() +{ + t1 = getMillisecondFromTick(); + t2 = 0; +} + +qint64 QElapsedTimer::restart() +{ + qint64 oldt1 = t1; + t1 = getMillisecondFromTick(); + t2 = 0; + return t1 - oldt1; +} + +qint64 QElapsedTimer::elapsed() const +{ + return getMillisecondFromTick() - t1; +} + +qint64 QElapsedTimer::msecsSinceReference() const +{ + return t1; +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + return 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) < 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..85d7fa8 --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_unix.cpp @@ -0,0 +1,179 @@ +/**************************************************************************** +** +** 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 <sys/time.h> +#include <time.h> +#include <unistd.h> + +#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 +} + +QElapsedTimer::ClockType QElapsedTimer::clockType() +{ + return isMonotonic() ? MonotonicClock : SystemTime; +} + +static inline QPair<long, long> 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<long, long> 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<long, long> r = do_gettime(); + t1 = r.first; + t2 = r.second; +} + +qint64 QElapsedTimer::restart() +{ + QPair<long, long> r = do_gettime(); + qint64 oldt1 = t1; + qint64 oldt2 = t2; + t1 = r.first; + t2 = r.second; + + r.first -= oldt1; + r.second -= oldt2; + return r.first * Q_INT64_C(1000) + r.second / fractionAdjustment(); +} + +qint64 QElapsedTimer::elapsed() const +{ + QElapsedTimer now; + now.start(); + 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 * Q_INT64_C(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..135196a --- /dev/null +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** 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 <windows.h> + +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(); + + 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() +{ + return TickCounter; +} + +bool QElapsedTimer::isMonotonic() +{ + return true; +} + +void QElapsedTimer::start() +{ + t1 = getTickCount(); + t2 = 0; +} + +qint64 QElapsedTimer::restart() +{ + qint64 oldt1 = t1; + t1 = getTickCount(); + t2 = 0; + return t1 - oldt1; +} + +qint64 QElapsedTimer::elapsed() const +{ + return getTickCount() - t1; +} + +qint64 QElapsedTimer::msecsSinceReference() const +{ + return t1; +} + +qint64 QElapsedTimer::msecsTo(const QElapsedTimer &other) const +{ + return 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) < 0; +} + +QT_END_NAMESPACE 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/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 877a77a..f413223 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -42,9 +42,9 @@ #include "qtimeline.h" #include <private/qobject_p.h> -#include <QtCore/qdatetime.h> #include <QtCore/qcoreevent.h> #include <QtCore/qmath.h> +#include <QtCore/qelapsedtimer.h> QT_BEGIN_NAMESPACE @@ -70,7 +70,7 @@ public: int currentTime; int timerId; - QTime timer; + QElapsedTimer timer; QTimeLine::Direction direction; QEasingCurve easingCurve; diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 6d64915..4e0ebbc 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/qelapsedtimer.h \ tools/qunicodetables_p.h \ tools/qvarlengtharray.h \ tools/qvector.h \ @@ -56,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 \ @@ -81,6 +83,12 @@ SOURCES += \ symbian:SOURCES+=tools/qlocale_symbian.cpp +mac:SOURCES += tools/qelapsedtimer_mac.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 + #zlib support contains(QT_CONFIG, zlib) { wince*: DEFINES += NO_ERRNO_H diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 3b08bf6..3b279ae 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(); + QElapsedTimer base; + base.start(); QFileInfo fileInfo; bool firstTime = true; QList<QPair<QString, QFileInfo> > 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<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { +void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) { updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo)); - QTime current = QTime::currentTime(); + QElapsedTimer 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..5abcd94 100644 --- a/src/gui/dialogs/qfileinfogatherer_p.h +++ b/src/gui/dialogs/qfileinfogatherer_p.h @@ -60,9 +60,10 @@ #include <qfileiconprovider.h> #include <qfsfileengine.h> #include <qpair.h> -#include <qdatetime.h> #include <qstack.h> +#include <qdatetime.h> #include <qdir.h> +#include <qelapsedtimer.h> 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<QPair<QString, QFileInfo> > &updatedFiles, const QString &path); + void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &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..a2d7b23 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 "qelapsedtimer.h" #include <private/qdialog_p.h> #include <limits.h> @@ -103,7 +103,7 @@ public: QTimer *forceTimer; bool shown_once; bool cancellation_flag; - QTime 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 dd9a7e6..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(); } /*! @@ -2839,7 +2844,8 @@ void QAbstractItemView::keyboardSearch(const QString &search) QModelIndex start = currentIndex().isValid() ? currentIndex() : d->model->index(0, 0, d->root); - QTime now(QTime::currentTime()); + QElapsedTimer 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..fce74f3 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/qelapsedtimer.h" #ifndef QT_NO_ITEMVIEWS @@ -390,7 +390,7 @@ public: #endif QString keyboardInput; - QTime keyboardInputTime; + QElapsedTimer keyboardInputTime; bool autoScroll; QBasicTimer autoScrollTimer; @@ -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 61ad79d..b2457f3 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()); + QElapsedTimer now; + now.start(); bool skipRow = false; if (search.isEmpty() || (d->keyboardInputTime.msecsTo(now) > QApplication::keyboardInputInterval())) { @@ -2156,9 +2157,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(); @@ -2178,7 +2180,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; } } @@ -2190,6 +2195,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) { @@ -2212,7 +2218,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/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index fea8c37..003fd4c 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2309,12 +2309,15 @@ 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) +#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"), 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) { diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 047bd09..3bdc971 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 "qelapsedtimer.h" #include "qvariant.h" #include "qdnd_p.h" #include <private/qwidget_p.h> @@ -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; + QElapsedTimer started; + started.start(); + QElapsedTimer 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/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/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 4f71681..0e378f9 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<NSCursor *>(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<QRect> &rects = mask.rects(); @@ -1029,11 +1030,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; } @@ -1044,7 +1050,17 @@ 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 (qwidget && qt_widget_private(qwidget->window())->topData()->embedded + && !QApplication::focusWidget() && qwidget->focusPolicy() != Qt::NoFocus) + qwidget->setFocus(Qt::OtherFocusReason); return YES; } @@ -1118,8 +1134,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]; + } + } } } @@ -1128,8 +1151,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/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 9591b9a..0a05d8e 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 "qelapsedtimer.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; + QElapsedTimer 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..bf60f97 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 "qelapsedtimer.h" #include "private/qobject_p.h" QT_BEGIN_NAMESPACE @@ -148,7 +148,7 @@ public: QPoint lastPositions[3]; bool started; qreal speed; - QTime time; + QElapsedTimer time; }; class QTapGesturePrivate : public QGesturePrivate 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 } }; 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/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 } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 10fb009..ece4be4 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 "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; - QTime t; + QElapsedTimer t; t.start(); static const int maximumWaitTime = 2000; if (!w->testAttribute(Qt::WA_WState_Created)) @@ -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)) diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 35850db..b527e72 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -47,7 +47,7 @@ #include <qlayout.h> #include <qstyle.h> #include <qstyleoption.h> -#include <qdatetime.h> +#include <qelapsedtimer.h> #include <qpointer.h> #include <qdebug.h> #include <qx11info_x11.h> @@ -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; + QElapsedTimer t; t.start(); functorData data; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 9f69fd8..4ae9f79 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 <qabstractitemview.h> #include <qcheckbox.h> #include <qcombobox.h> -#include <qdatetime.h> #include <qdebug.h> #include <qdialogbuttonbox.h> #include <qformlayout.h> @@ -81,6 +80,7 @@ static const int blueFrameWidth = 2; // with of line edit focus frame #include <qsplitter.h> #include <qstyleoption.h> #include <qtextedit.h> +#include <qelapsedtimer.h> #include <qtoolbar.h> #include <qtoolbox.h> #include <qtoolbutton.h> @@ -980,7 +980,7 @@ public: #ifndef QT_NO_PROGRESSBAR QList<QProgressBar *> bars; int progressBarAnimateTimer; - QTime timer; + QElapsedTimer timer; #endif }; diff --git a/src/gui/styles/qwindowsstyle_p.h b/src/gui/styles/qwindowsstyle_p.h index 808abe1..2a89b84 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 <qlist.h> -#include <qdatetime.h> #include <qhash.h> +#include <qelapsedtimer.h> QT_BEGIN_NAMESPACE @@ -80,7 +80,7 @@ public: QList<QProgressBar *> bars; int animationFps; int animateTimer; - QTime startTime; + QElapsedTimer startTime; int animateStep; QColor inactiveCaptionText; QColor activeCaptionColor; 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 <qlistview.h> #include <qtableview.h> #include <qbasictimer.h> +#include <qdatetime.h> #include <qcommandlinkbutton.h> QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index bb1e60d..b1ab478 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -41,9 +41,9 @@ #include <qplatformdefs.h> -#include <qdatetime.h> #include <qdebug.h> #include <qpaintdevice.h> +#include <qelapsedtimer.h> #include <private/qt_x11_p.h> #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; + QElapsedTimer t; t.start(); #endif @@ -1301,7 +1301,7 @@ static void initializeDb() if (!db || db->count) return; - QTime t; + QElapsedTimer 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..6a01d68 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..19d1fca 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/qelapsedtimer.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; + QElapsedTimer firstRepeat; #endif diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index dd7fc48..a56d093 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 "qelapsedtimer.h" #include "qdebug.h" QT_BEGIN_NAMESPACE @@ -103,7 +103,7 @@ private: int elapsed; bool showWidget; QTimer anim; - QTime checkTime; + QElapsedTimer checkTime; double windowOpacity; }; @@ -384,7 +384,7 @@ private: int orientation; QTimer anim; - QTime checkTime; + QElapsedTimer checkTime; QPixmap pm; }; 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; diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 43722a1..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; @@ -2060,6 +2052,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 diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index c0eeb2f..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 <QtCore/qdatetime.h> +#include <QtCore/qelapsedtimer.h> #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; + 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 2a6a7da..7180c4d 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 "qelapsedtimer.h" #include "qtooltip.h" #include "qdebug.h" #include <private/qwidget_p.h> @@ -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 QElapsedTimer *t = 0; static QWorkspaceTitleBar *tc = 0; if (!t) - t = new QTime; + 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 QTime* 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 QTime; + 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 92cef83..c907019 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -61,6 +61,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qdatetime.h> #include <QtMultimedia/qaudio.h> @@ -116,8 +117,8 @@ private: void drain(); QTimer* timer; - QTime timeStamp; - QTime 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 802bc27..e6ac231 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -60,6 +60,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> +#include <QtCore/qelapsedtimer.h> #include <QtCore/qdatetime.h> #include <QtMultimedia/qaudio.h> @@ -133,8 +134,8 @@ private: QTimer* timer; QByteArray m_device; int bytesAvailable; - QTime timeStamp; - QTime clockStamp; + QElapsedTimer timeStamp; + QElapsedTimer clockStamp; qint64 elapsedTimeOffset; char* audioBuffer; snd_pcm_t* handle; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 1940dd1..197d89e 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -173,40 +173,58 @@ 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 + + \snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 4 + + Network requests can be reenabled again 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 5 - This property can be used to enable and disable network access for all clients of a single - network access manager instance. + \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. */ /*! - \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. */ /*! @@ -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,20 +905,22 @@ 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); } -#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); @@ -909,8 +941,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; @@ -1208,28 +1242,37 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co { Q_Q(QNetworkAccessManager); -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION initializeSession = false; -#endif if (networkSession) delete networkSession; if (!config.isValid()) { networkSession = 0; + online = false; + + if (networkAccessible == QNetworkAccessManager::NotAccessible) + emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); + else + emit q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility); + return; } 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(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() @@ -1249,7 +1292,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionNewConfigurationActivated() if (networkSession) { networkSession->accept(); - emit q->networkSessionOnline(); + emit q->networkSessionConnected(); } } @@ -1259,6 +1302,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 694a54f..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 @@ -126,9 +132,9 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); #endif - void networkSessionOnline(); + 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 4a2a840..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,10 +76,9 @@ public: proxyFactory(0), #endif networkSession(0), - networkAccessEnabled(true), -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION + networkAccessible(QNetworkAccessManager::Accessible), + online(false), initializeSession(true), -#endif cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -111,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; @@ -125,10 +125,9 @@ public: QNetworkSession *networkSession; QString networkConfiguration; - bool networkAccessEnabled; -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION + QNetworkAccessManager::NetworkAccessibility networkAccessible; + bool online; bool initializeSession; -#endif bool cookieJarCreated; 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, 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/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(); diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 95721ee..21cd0fd 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -365,12 +365,12 @@ #include "private/qhostinfo_p.h" #include <qabstracteventdispatcher.h> -#include <qdatetime.h> #include <qhostaddress.h> #include <qhostinfo.h> #include <qmetaobject.h> #include <qpointer.h> #include <qtimer.h> +#include <qelapsedtimer.h> #ifndef QT_NO_OPENSSL #include <QtNetwork/qsslsocket.h> @@ -1738,7 +1738,7 @@ bool QAbstractSocket::waitForConnected(int msecs) bool wasPendingClose = d->pendingClose; d->pendingClose = false; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (d->state == HostLookupState) { @@ -1819,7 +1819,7 @@ bool QAbstractSocket::waitForReadyRead(int msecs) return false; } - QTime 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; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // handle a socket in connecting state @@ -1960,7 +1960,7 @@ bool QAbstractSocket::waitForDisconnected(int msecs) return false; } - QTime 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 3293ff5..dfda257 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 "qelapsedtimer.h" #if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) #include <qdebug.h> @@ -319,7 +319,7 @@ bool QHttpSocketEngine::waitForRead(int msecs, bool *timedOut) if (!d->socket || d->socket->state() == QAbstractSocket::UnconnectedState) return false; - QTime 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; } - QTime 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 1ca11d8..f14decc 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -52,9 +52,9 @@ #include <fcntl.h> #include <errno.h> -#include <qdatetime.h> #include <qdir.h> #include <qdebug.h> +#include <qelapsedtimer.h> #ifdef Q_OS_VXWORKS # include <selectLib.h> @@ -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; + 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 9a2c349..6c800fe 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 "qelapsedtimer.h" #include "qvarlengtharray.h" -#include "qdatetime.h" #include <time.h> #include <errno.h> #include <fcntl.h> @@ -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; + QElapsedTimer timer; timer.start(); do { diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 924530e..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 "qdatetime.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; - QDateTime timeStamp; + QElapsedTimer 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<int, QSocks5BindData *> 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; + 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; - QTime 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; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); while (socks5State != wantedState) { @@ -1699,7 +1699,7 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut) d->readNotificationActivated = false; - QTime 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; - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); // are we connected yet? diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 9623570..86b11b9 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -286,8 +286,8 @@ #include <QtCore/qdebug.h> #include <QtCore/qdir.h> -#include <QtCore/qdatetime.h> #include <QtCore/qmutex.h> +#include <QtCore/qelapsedtimer.h> #include <QtNetwork/qhostaddress.h> #include <QtNetwork/qhostinfo.h> @@ -1393,7 +1393,7 @@ bool QSslSocket::waitForEncrypted(int msecs) if (d->mode == UnencryptedMode && !d->autoStartHandshake) return false; - QTime 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; - QTime 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); - QTime 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); - QTime stopWatch; + QElapsedTimer stopWatch; stopWatch.start(); if (!d->connectionEncrypted) { 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 | 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 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 <QtTest/qtestcorelist.h> #include <QtTest/qtestelementattribute.h> -#include <cstdlib> - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -95,9 +93,6 @@ void QTestCoreElement<ElementType>::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); diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h index 3c11cdd..82d69d6 100644 --- a/src/testlib/qtestsystem.h +++ b/src/testlib/qtestsystem.h @@ -44,7 +44,7 @@ #include <QtTest/qtestcase.h> #include <QtCore/qcoreapplication.h> -#include <QtCore/qdatetime.h> +#include <QtCore/qelapsedtimer.h> QT_BEGIN_HEADER @@ -63,7 +63,7 @@ namespace QTest { Q_ASSERT(QCoreApplication::instance()); - QTime timer; + QElapsedTimer timer; timer.start(); do { QCoreApplication::processEvents(QEventLoop::AllEvents, ms); diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri index 15e746a..1de7b18 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 48dc444..44dd625 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 \ 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 \ 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/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<QString>("dateTimeStr"); diff --git a/tests/auto/qelapsedtimer/qelapsedtimer.pro b/tests/auto/qelapsedtimer/qelapsedtimer.pro new file mode 100644 index 0000000..ed75228 --- /dev/null +++ b/tests/auto/qelapsedtimer/qelapsedtimer.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +QT -= gui + +SOURCES += tst_qelapsedtimer.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..9ea422c --- /dev/null +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** 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 <QtCore/QString> +#include <QtCore/QTime> +#include <QtCore/QElapsedTimer> +#include <QtTest/QtTest> + +static const int minResolution = 50; // the minimum resolution for the tests + +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"); + QElapsedTimer t; + t.start(); + qDebug() << "Current time is" << t.msecsSinceReference(); +} + +void tst_QElapsedTimer::validity() +{ + QElapsedTimer t; + + t.invalidate(); + QVERIFY(!t.isValid()); + + t.start(); + QVERIFY(t.isValid()); + + t.invalidate(); + QVERIFY(!t.isValid()); +} + +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); + +#if 0 + QElapsedTimer 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)); +#endif + + quint64 value1 = t1.msecsSinceReference(); + qint64 elapsed = t1.restart(); + 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() +{ + QElapsedTimer t1; + t1.start(); + + QTest::qSleep(4*minResolution); + QElapsedTimer 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 = t2.msecsTo(t1); + QVERIFY(diff < minResolution); +} + +QTEST_MAIN(tst_QElapsedTimer); + +#include "tst_qelapsedtimer.moc" 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<int>("keycode"); + QTest::addColumn<QString>("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" 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()); 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 <QtTest/QtTest> + +#include <QtNetwork/QNetworkAccessManager> +#include <QtNetwork/QNetworkConfigurationManager> + +#include <QtCore/QDebug> + +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>("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::NetworkAccessibility>(), + QNetworkAccessManager::NotAccessible); + QCOMPARE(manager.isNetworkAccessible(), QNetworkAccessManager::NotAccessible); + + manager.setNetworkAccessible(QNetworkAccessManager::Accessible); + + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.takeFirst().at(0).value<QNetworkAccessManager::NetworkAccessibility>(), + 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::NetworkAccessibility>(), + 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" 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); 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..c5d8e4e --- /dev/null +++ b/tests/manual/qtbug-8933/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** 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 <QtGui/QApplication> +#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..4120a8f --- /dev/null +++ b/tests/manual/qtbug-8933/widget.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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" + +#include <QTimer> +#include <QDebug> + +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..01aa141 --- /dev/null +++ b/tests/manual/qtbug-8933/widget.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** 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 + +#include <QWidget> +#include <QMenuBar> +#include <QMenu> + +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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Widget</class> + <widget class="QWidget" name="Widget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>400</height> + </rect> + </property> + <property name="windowTitle"> + <string>Widget</string> + </property> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>110</x> + <y>60</y> + <width>311</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> 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 @@ <file>images/qtlogo.png</file> <file>images/qt3logo.png</file> <file>images/resetproperty.png</file> + <file>images/cleartext.png</file> <file>images/sort.png</file> <file>images/edit.png</file> <file>images/reload.png</file> diff --git a/tools/designer/src/components/formeditor/images/cleartext.png b/tools/designer/src/components/formeditor/images/cleartext.png Binary files differnew file mode 100644 index 0000000..74133ba --- /dev/null +++ b/tools/designer/src/components/formeditor/images/cleartext.png 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)), diff --git a/tools/designer/src/lib/shared/filterwidget.cpp b/tools/designer/src/lib/shared/filterwidget.cpp index 6c73a08..f485346 100644 --- a/tools/designer/src/lib/shared/filterwidget.cpp +++ b/tools/designer/src/lib/shared/filterwidget.cpp @@ -44,13 +44,17 @@ #include <QtGui/QVBoxLayout> #include <QtGui/QHBoxLayout> -#include <QtGui/QPushButton> #include <QtGui/QLineEdit> #include <QtGui/QFocusEvent> #include <QtGui/QPalette> #include <QtGui/QCursor> +#include <QtGui/QToolButton> +#include <QtGui/QPainter> +#include <QtGui/QStyle> +#include <QtGui/QStyleOption> #include <QtCore/QDebug> +#include <QtCore/QPropertyAnimation> 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,53 @@ void HintLineEdit::focusInEvent(QFocusEvent *e) } } - hideHintText(); QLineEdit::focusInEvent(e); } -void HintLineEdit::focusOutEvent(QFocusEvent *e) -{ - if (debugFilter) - qDebug() << Q_FUNC_INFO; - // Focus out: Switch to displaying the hint text unless there is user input - showHintText(); - QLineEdit::focusOutEvent(e); -} - -QString HintLineEdit::hintText() const +// ------------------- FilterWidget +FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm) : + QWidget(parent), + m_editor(new HintLineEdit(this)), + m_button(new IconButton(m_editor)), + m_buttonwidth(0) { - return m_hintText; -} + m_editor->setPlaceholderText(tr("Filter")); -void HintLineEdit::setHintText(const QString &ht) -{ - if (ht == m_hintText) - return; - hideHintText(); - m_hintText = ht; - if (!hasFocus() && !ht.isEmpty()) - showHintText(); -} + // Let the style determine minimum height for our widget + QSize size(ICONBUTTON_SIZE + 2, ICONBUTTON_SIZE + 2); -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")) { + size = size.expandedTo(QSize(24, 0)); } -} -bool HintLineEdit::isShowingHintText() const -{ - return m_showingHintText; -} - -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("<Filter>")); 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 +201,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 <QtGui/QWidget> #include <QtGui/QLineEdit> #include <QtGui/QColor> +#include <QtGui/QToolButton> 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 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<QString,Text> 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 } } 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 @@ <source>Show All</source> <translation>Vis alle</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Indstillinger…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Slut %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>Om %1</translation> + </message> </context> <context> <name>AudioOutput</name> diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 2108774..ec7e786 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -2,9 +2,30 @@ <!DOCTYPE TS> <TS version="2.0" language="de"> <context> + <name>CloseButton</name> + <message> + <location filename="../src/gui/widgets/qtabbar.cpp" line="+2266"/> + <source>Close Tab</source> + <translation>Schließen</translation> + </message> +</context> +<context> + <name>FakeReply</name> + <message> + <location filename="../src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp" line="+2200"/> + <source>Fake error !</source> + <translation>Fake error !</translation> + </message> + <message> + <location line="+3"/> + <source>Invalid URL</source> + <translation>Ungültige URL</translation> + </message> +</context> +<context> <name>MAC_APPLICATION_MENU</name> <message> - <location filename="../src/gui/kernel/qapplication.cpp" line="+2316"/> + <location filename="../src/gui/kernel/qapplication.cpp" line="+2314"/> <source>Services</source> <translation>Dienste</translation> </message> @@ -25,32 +46,11 @@ </message> </context> <context> - <name>CloseButton</name> - <message> - <location filename="../src/gui/widgets/qtabbar.cpp" line="+2266"/> - <source>Close Tab</source> - <translation>Schließen</translation> - </message> -</context> -<context> - <name>FakeReply</name> - <message> - <location filename="../src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp" line="+2200"/> - <source>Fake error !</source> - <translation>Fake error !</translation> - </message> - <message> - <location line="+3"/> - <source>Invalid URL</source> - <translation>Ungültige URL</translation> - </message> -</context> -<context> <name>Phonon::</name> <message> <location filename="../src/3rdparty/phonon/phonon/phononnamespace.cpp" line="+55"/> <source>Notifications</source> - <translation>Benachrichtungen</translation> + <translation>Benachrichtigungen</translation> </message> <message> <location line="+2"/> @@ -176,7 +176,7 @@ Bitte überprüfen Sie Ihre GStreamer-Installation und stellen Sie sicher, dass <translation>Audio-Ausgabegerät</translation> </message> <message> - <location filename="../src/3rdparty/phonon/mmf/utils.cpp" line="+87"/> + <location filename="../src/3rdparty/phonon/mmf/utils.cpp" line="+89"/> <source>No error</source> <translation>Kein Fehler</translation> </message> @@ -1209,7 +1209,7 @@ nach <context> <name>QAbstractSocket</name> <message> - <location filename="../src/network/socket/qabstractsocket.cpp" line="+903"/> + <location filename="../src/network/socket/qabstractsocket.cpp" line="+916"/> <location filename="../src/network/socket/qhttpsocketengine.cpp" line="+629"/> <location filename="../src/network/socket/qsocks5socketengine.cpp" line="+661"/> <location line="+26"/> @@ -1231,13 +1231,13 @@ nach <message> <location line="-559"/> <location line="+809"/> - <location line="+208"/> + <location line="+220"/> <source>Operation on socket is not supported</source> <translation>Diese Socket-Operation wird nicht unterstützt</translation> </message> <message> - <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="+586"/> - <location filename="../src/network/socket/qabstractsocket.cpp" line="+200"/> + <location filename="../src/network/access/qhttpnetworkconnection.cpp" line="+598"/> + <location filename="../src/network/socket/qabstractsocket.cpp" line="+203"/> <source>Socket operation timed out</source> <translation>Das Zeitlimit für die Operation wurde überschritten</translation> </message> @@ -1255,7 +1255,7 @@ nach <context> <name>QAbstractSpinBox</name> <message> - <location filename="../src/gui/widgets/qabstractspinbox.cpp" line="+1260"/> + <location filename="../src/gui/widgets/qabstractspinbox.cpp" line="+1263"/> <source>&Step up</source> <translation>&Inkrementieren</translation> </message> @@ -1281,7 +1281,7 @@ nach <context> <name>QApplication</name> <message> - <location filename="../src/gui/kernel/qapplication.cpp" line="+2309"/> + <location filename="../src/gui/kernel/qapplication.cpp" line="-10"/> <source>QT_LAYOUT_DIRECTION</source> <comment>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.</comment> <translation>LTR</translation> @@ -1351,7 +1351,7 @@ nach <context> <name>QColorDialog</name> <message> - <location filename="../src/gui/dialogs/qcolordialog.cpp" line="+1355"/> + <location filename="../src/gui/dialogs/qcolordialog.cpp" line="+1378"/> <source>Hu&e:</source> <translation>Farb&ton:</translation> </message> @@ -1556,6 +1556,960 @@ nach </message> </context> <context> + <name>QDeclarativeAbstractAnimation</name> + <message> + <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="+164"/> + <source>Cannot animate non-existent property "%1"</source> + <translation>Die Eigenschaft '%1" existiert nicht und kann daher nicht animiert werden</translation> + </message> + <message> + <location line="+3"/> + <source>Cannot animate read-only property "%1"</source> + <translation>Die Eigenschaft '%1" ist schreibgeschützt und kann daher nicht animiert werden</translation> + </message> +</context> +<context> + <name>QDeclarativeAnchors</name> + <message> + <location filename="../src/declarative/graphicsitems/qdeclarativeanchors.cpp" line="+176"/> + <source>Possible anchor loop detected on fill.</source> + <translation>Bei der Fülloperation wurde eine potentielle Endlosschleife der Anker festgestellt.</translation> + </message> + <message> + <location line="+28"/> + <source>Possible anchor loop detected on centerIn.</source> + <translation>Bei der Operation 'centerIn' wurde eine potentielle Endlosschleife der Anker festgestellt.</translation> + </message> + <message> + <location line="+170"/> + <location line="+34"/> + <location line="+607"/> + <location line="+37"/> + <source>Cannot anchor to an item that isn't a parent or sibling.</source> + <translation>Das Ziel eines Anker muss ein Elternelement oder Element der gleichen Ebene sein.</translation> + </message> + <message> + <location line="-534"/> + <source>Possible anchor loop detected on vertical anchor.</source> + <translation>Bei einem vertikalen Anker wurde eine potentielle Endlosschleife der Anker festgestellt.</translation> + </message> + <message> + <location line="+59"/> + <source>Possible anchor loop detected on horizontal anchor.</source> + <translation>Bei einem horizontalen Anker wurde eine potentielle Endlosschleife der Anker festgestellt.</translation> + </message> + <message> + <location line="+422"/> + <source>Cannot specify left, right, and hcenter anchors.</source> + <translation>Ankerangaben für links, rechts und horizontal zentriert dürfen nicht zusammen auftreten.</translation> + </message> + <message> + <location line="+10"/> + <location line="+37"/> + <source>Cannot anchor to a null item.</source> + <translation>Es kann kein Anker zu einem Null-Element angegeben werden.</translation> + </message> + <message> + <location line="-34"/> + <source>Cannot anchor a horizontal edge to a vertical edge.</source> + <translation>Es kann kein Anker zu einer horizontalen oder vertikalen Kante angegeben werden.</translation> + </message> + <message> + <location line="+6"/> + <location line="+37"/> + <source>Cannot anchor item to self.</source> + <translation>Ein Element kann keinen Anker zu sich selbst haben.</translation> + </message> + <message> + <location line="-25"/> + <source>Cannot specify top, bottom, and vcenter anchors.</source> + <translation>Ankerangaben für oben, unten und vertikal zentriert dürfen nicht zusammen auftreten.</translation> + </message> + <message> + <location line="+6"/> + <source>Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.</source> + <translation>Ein Baseline-Anker darf nicht mit zusammen mit weiteren Ankerangaben für oben, unten und vertikal zentriert verwendet werden.</translation> + </message> + <message> + <location line="+13"/> + <source>Cannot anchor a vertical edge to a horizontal edge.</source> + <translation>Vertikale und horizontale Kanten können nicht mit Ankern verbunden werden.</translation> + </message> +</context> +<context> + <name>QDeclarativeBehavior</name> + <message> + <location filename="../src/declarative/util/qdeclarativebehavior.cpp" line="+124"/> + <source>Cannot change the animation assigned to a Behavior.</source> + <translation>Die zu einem Behavior-Element gehörende Animation kann nicht geändert werden.</translation> + </message> +</context> +<context> + <name>QDeclarativeBinding</name> + <message> + <location filename="../src/declarative/qml/qdeclarativebinding.cpp" line="+195"/> + <source>Binding loop detected for property "%1"</source> + <translation>Bei der für die Eigenschaft "%1" angegebenen Bindung wurde eine Endlosschleife festgestellt</translation> + </message> +</context> +<context> + <name>QDeclarativeCompiler</name> + <message> + <location filename="../src/declarative/qml/qdeclarativecompiler.cpp" line="+188"/> + <location line="+1807"/> + <location line="+82"/> + <location line="+75"/> + <location line="+459"/> + <source>Invalid property assignment: "%1" is a read-only property</source> + <translation>Ungültige Zuweisung bei Eigenschaft: "%1" ist schreibgeschützt</translation> + </message> + <message> + <location line="-2414"/> + <source>Invalid property assignment: unknown enumeration</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Ungültiger Aufzählungswert</translation> + </message> + <message> + <location line="+8"/> + <source>Invalid property assignment: string expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeichenkette erwartet</translation> + </message> + <message> + <location line="+3"/> + <source>Invalid property assignment: url expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine URL erwartet</translation> + </message> + <message> + <location line="+6"/> + <source>Invalid property assignment: unsigned int expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine vorzeichenloser Ganzzahlwert erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: int expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird ein Ganzzahlwert erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: float expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: double expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl (double) erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: color expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Farbspezifikation erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: date expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: time expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeitangabe erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: datetime expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet</translation> + </message> + <message> + <location line="+8"/> + <source>Invalid property assignment: point expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Koordinatenangabe für einen Punkt erwartet</translation> + </message> + <message> + <location line="+8"/> + <source>Invalid property assignment: size expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Größenangabe erwartet</translation> + </message> + <message> + <location line="+8"/> + <source>Invalid property assignment: rect expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es werden Parameter für ein Rechteck erwartet</translation> + </message> + <message> + <location line="+5"/> + <source>Invalid property assignment: boolean expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird ein Boolescher Wert erwartet</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid property assignment: 3D vector expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird ein dreidimensionaler Vektor erwartet</translation> + </message> + <message> + <location line="+9"/> + <source>Invalid property assignment: unsupported type "%1"</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Der Typ "%1" ist nicht unterstützt</translation> + </message> + <message> + <location line="+259"/> + <source>Element is not creatable.</source> + <translation>Das Element kann nicht erzeugt werden.</translation> + </message> + <message> + <location line="+548"/> + <source>Component elements may not contain properties other than id</source> + <translation>Komponenten dürfen außer id keine weiteren Eigenschaften enthalten.</translation> + </message> + <message> + <location line="+3"/> + <source>Component elements may not contain script blocks</source> + <translation>Komponenten dürfen keine Skripte enthalten</translation> + </message> + <message> + <location line="+7"/> + <source>Invalid component id specification</source> + <translation>Ungültige Komponentenspezifikation</translation> + </message> + <message> + <location line="+6"/> + <location line="+594"/> + <source>id is not unique</source> + <translation>ID-Wert nicht eindeutig</translation> + </message> + <message> + <location line="-584"/> + <source>Invalid component body specification</source> + <translation>Inhalt der Komponente ungültig</translation> + </message> + <message> + <location line="+7"/> + <source>Cannot create empty component specification</source> + <translation>Es kann keine leere Komponentenangabe erzeugt werden</translation> + </message> + <message> + <location line="+17"/> + <source>Invalid Script block. Specify either the source property or inline script</source> + <translation>Ungültiges Skript. Es muss die Eigenschaft oder ein eingebettetes Skript angegeben werden</translation> + </message> + <message> + <location line="+4"/> + <source>Invalid Script source value</source> + <translation>Ungültige Angabe für Skript</translation> + </message> + <message> + <location line="+24"/> + <source>Properties cannot be set on Script block</source> + <translation>Für ein Skript können keine Eigenschaften angegeben werden</translation> + </message> + <message> + <location line="+14"/> + <source>Invalid Script block</source> + <translation>Ungültiges Skript</translation> + </message> + <message> + <location line="+144"/> + <source>Incorrectly specified signal</source> + <translation>Ungültige Signalspezifikation</translation> + </message> + <message> + <location line="+13"/> + <source>Empty signal assignment</source> + <translation>Leere Signalzuweisung</translation> + </message> + <message> + <location line="+38"/> + <source>Empty property assignment</source> + <translation>Leere Eigenschaftszuweisung</translation> + </message> + <message> + <location line="+12"/> + <source>Attached properties cannot be used here</source> + <translation>An dieser Stelle können keine Eigenschaften des Typs 'attached' verwendet werden</translation> + </message> + <message> + <location line="+15"/> + <location line="+104"/> + <source>Non-existent attached object</source> + <translation>Es existiert kein Bezugselement für die Eigenschaft</translation> + </message> + <message> + <location line="-100"/> + <location line="+103"/> + <source>Invalid attached object assignment</source> + <translation>Ungültige Zuweisung des Bezugselements</translation> + </message> + <message> + <location line="-50"/> + <source>Cannot assign to non-existent default property</source> + <translation>Es kann keine Zuweisung erfolgen, da keine Vorgabe-Eigenschaft existiert</translation> + </message> + <message> + <location line="+2"/> + <location line="+361"/> + <source>Cannot assign to non-existent property "%1"</source> + <translation>Es kann keine Zuweisung erfolgen, da keine Eigenschaft des Namens '%1" existiert</translation> + </message> + <message> + <location line="-330"/> + <source>Invalid use of namespace</source> + <translation>Ungültige Verwendung eines Namensraums</translation> + </message> + <message> + <location line="+5"/> + <source>Not an attached property name</source> + <translation>Kein gültiger Name einer Eigenschaft des Typs 'attached'</translation> + </message> + <message> + <location line="+183"/> + <source>Invalid use of id property</source> + <translation>Ungültige Verwendung einer Eigenschaft des Typs 'Id'</translation> + </message> + <message> + <location line="+13"/> + <source>id conflicts with type name</source> + <translation>Der Wert der Id ist ungültig, da er bereits als Typnamen vergeben ist</translation> + </message> + <message> + <location line="+2"/> + <source>id conflicts with namespace prefix</source> + <translation>Der Wert der Id ist ungültig, da er bereits als Namensraum vergeben ist</translation> + </message> + <message> + <location line="+84"/> + <location line="+2"/> + <source>Property has already been assigned a value</source> + <translation>Der Eigenschaft wurde bereits ein Wert zugewiesen</translation> + </message> + <message> + <location line="+8"/> + <location line="+8"/> + <source>Invalid grouped property access</source> + <translation>Falsche Gruppierung bei Zugriff auf Eigenschaft</translation> + </message> + <message> + <location line="+3"/> + <source>Cannot assign a value directly to a grouped property</source> + <translation>Bei einer Eigenschaft, die Teil einer Gruppierung ist, ist keine direkte Wertzuweisung zulässig</translation> + </message> + <message> + <location line="+16"/> + <source>Invalid property use</source> + <translation>Ungültige Verwendung von Eigenschaften</translation> + </message> + <message> + <location line="+12"/> + <source>Property assignment expected</source> + <translation>Zuweisung an Eigenschaft erwartet</translation> + </message> + <message> + <location line="+3"/> + <source>Single property assignment expected</source> + <translation>Einzelne Zuweisung an Eigenschaft erwartet</translation> + </message> + <message> + <location line="+5"/> + <source>Unexpected object assignment</source> + <translation>Zuweisung des Objekts nicht zulässig</translation> + </message> + <message> + <location line="+57"/> + <source>Cannot assign object to list</source> + <translation>Zuweisung eines Objekts an eine Liste nicht zulässig</translation> + </message> + <message> + <location line="+6"/> + <source>Can only assign one binding to lists</source> + <translation>Listen kann nur eine einzige Bindung zugewiesen werden</translation> + </message> + <message> + <location line="+6"/> + <source>Cannot assign primitives to lists</source> + <translation>Zuweisung eines einfachen Werts (primitive) an eine Liste nicht zulässig</translation> + </message> + <message> + <location line="+13"/> + <source>Cannot assign multiple values to a script property</source> + <translation>Eine Zuweisung mehrerer Werte an eine Skript-Eigenschaft ist nicht zulässig</translation> + </message> + <message> + <location line="+3"/> + <source>Invalid property assignment: script expected</source> + <translation>Ungültige Zuweisung bei Eigenschaft: Es wird ein Skript erwartet</translation> + </message> + <message> + <location line="+106"/> + <source>Cannot assign object to property</source> + <translation>Zuweisung eines Objekts an eine Eigenschaft nicht zulässig</translation> + </message> + <message> + <location line="+50"/> + <source>"%1" cannot operate on "%2"</source> + <translation>"%1" kann nicht auf "%2" angewandt werden</translation> + </message> + <message> + <location line="+96"/> + <source>Duplicate default property</source> + <translation>Mehrfaches Auftreten der Vorgabe-Eigenschaft</translation> + </message> + <message> + <location line="+5"/> + <source>Duplicate property name</source> + <translation>Mehrfaches Auftreten eines Eigenschaftsnamens</translation> + </message> + <message> + <location line="+3"/> + <source>Property names cannot begin with an upper case letter</source> + <translation>Eigenschaftsnamen dürfen nicht mit einem Großbuchstaben beginnen</translation> + </message> + <message> + <location line="+7"/> + <source>Duplicate signal name</source> + <translation>Mehrfaches Auftreten eines Signalnamens</translation> + </message> + <message> + <location line="+2"/> + <source>Signal names cannot begin with an upper case letter</source> + <translation>Signalnamen dürfen nicht mit einem Großbuchstaben beginnen</translation> + </message> + <message> + <location line="+6"/> + <source>Duplicate method name</source> + <translation>Mehrfaches Auftreten eines Methodennamens</translation> + </message> + <message> + <location line="+2"/> + <source>Method names cannot begin with an upper case letter</source> + <translation>Methodennamen dürfen nicht mit einem Großbuchstaben beginnen</translation> + </message> + <message> + <location line="+21"/> + <source>Property value set multiple times</source> + <translation>Mehrfache Zuweisung eines Wertes an eine Eigenschaft</translation> + </message> + <message> + <location line="+4"/> + <source>Invalid property nesting</source> + <translation>Ungültige Schachtelung von Eigenschaften</translation> + </message> + <message> + <location line="+53"/> + <source>Cannot override FINAL property</source> + <translation>Eine als 'FINAL' ausgewiesene Eigenschaft kann nicht überschrieben werden</translation> + </message> + <message> + <location line="+25"/> + <source>Invalid property type</source> + <translation>Ungültiger Typ der Eigenschaft</translation> + </message> + <message> + <location line="+151"/> + <source>Invalid empty ID</source> + <translation>Ungültiger (leerer) Id-Wert</translation> + </message> + <message> + <location line="+3"/> + <source>IDs cannot start with an uppercase letter</source> + <translation>Id-Werte dürfen nicht mit einem Großbuchstaben beginnen</translation> + </message> + <message> + <location line="+6"/> + <source>IDs must start with a letter or underscore</source> + <translation>Id-Werte müssen mit einem Buchstaben oder dem Zeichen '_' beginnen</translation> + </message> + <message> + <location line="+2"/> + <source>IDs must contain only letters, numbers, and underscores</source> + <translation>Id-Werte dürfen nur Buchstaben oder Unterstriche enthalten</translation> + </message> + <message> + <location line="+6"/> + <source>ID illegally masks global JavaScript property</source> + <translation>Der Id-Wert überdeckt eine globale Eigenschaft aus JavaScript</translation> + </message> + <message> + <location line="+31"/> + <location line="+9"/> + <source>No property alias location</source> + <translation>Alias-Eigenschaft ohne Quellangabe</translation> + </message> + <message> + <location line="-4"/> + <location line="+25"/> + <source>Invalid alias location</source> + <translation>Ungültige Quellangabe bei Alias-Eigenschaft</translation> + </message> + <message> + <location line="-16"/> + <source>Invalid alias reference. An alias reference must be specified as <id> or <id>.<property></source> + <translation>Ungültige Referenzierung einer Alias-Eigenschaft. Die Referenz muss in der Form <id> oder <id>.<property> angegeben werden</translation> + </message> + <message> + <location line="+3"/> + <source>Invalid alias reference. Unable to find id "%1"</source> + <translation>Ungültige Referenzierung einer Alias-Eigenschaft. Der Id-Wert "%1" konnte nicht gefunden werden</translation> + </message> +</context> +<context> + <name>QDeclarativeComponent</name> + <message> + <location filename="../src/declarative/qml/qdeclarativecomponent.cpp" line="+442"/> + <source>Invalid empty URL</source> + <translation>Ungültige (leere) URL</translation> + </message> +</context> +<context> + <name>QDeclarativeCompositeTypeManager</name> + <message> + <location filename="../src/declarative/qml/qdeclarativecompositetypemanager.cpp" line="+415"/> + <location line="+220"/> + <source>Resource %1 unavailable</source> + <translation>Auf die Ressource %1 konnte nicht zugegriffen werden</translation> + </message> + <message> + <location line="-141"/> + <source>Import %1 unavailable</source> + <translation>Import %1 nicht verfügbar</translation> + </message> + <message> + <location line="+30"/> + <source>Namespace %1 cannot be used as a type</source> + <translation>Der Namensraum %1 kann nicht als Typangabe verwendet werden</translation> + </message> + <message> + <location line="+2"/> + <source>%1 is not a type</source> + <translation>%1 ist keine Typangabe</translation> + </message> + <message> + <location line="+42"/> + <source>Type %1 unavailable</source> + <translation>Der Typ %1 ist nicht verfügbar</translation> + </message> +</context> +<context> + <name>QDeclarativeConnections</name> + <message> + <location filename="../src/declarative/util/qdeclarativeconnections.cpp" line="+172"/> + <location line="+54"/> + <location line="+7"/> + <source>Cannot assign to non-existent property "%1"</source> + <translation>Es kann keine Zuweisung erfolgen, da keine Eigenschaft des Namens '%1" existiert</translation> + </message> + <message> + <location line="-51"/> + <source>Connections: nested objects not allowed</source> + <translation>Verbindungen: Verschachtelte Objekte sind nicht zulässig</translation> + </message> + <message> + <location line="+3"/> + <source>Connections: syntax error</source> + <translation>Verbindungen: Syntaxfehler</translation> + </message> + <message> + <location line="+8"/> + <source>Connections: script expected</source> + <translation>Verbindungen: Skript erwartet</translation> + </message> +</context> +<context> + <name>QDeclarativeEngine</name> + <message> + <location filename="../src/declarative/qml/qdeclarativesqldatabase.cpp" line="+204"/> + <source>executeSql called outside transaction()</source> + <translation>'executeSql' wurde außerhalb von 'transaction()' aufgerufen</translation> + </message> + <message> + <location line="+58"/> + <source>Read-only Transaction</source> + <translation>Schreibgeschützte Transaktion</translation> + </message> + <message> + <location line="+20"/> + <source>Version mismatch: expected %1, found %2</source> + <translation>Die Version %2 kann nicht verwendet werden; es wird %1 benötigt</translation> + </message> + <message> + <location line="+14"/> + <source>SQL transaction failed</source> + <translation>Die SQL-Transaktion schlug fehl</translation> + </message> + <message> + <location line="+21"/> + <source>transaction: missing callback</source> + <translation>callback fehlt bei Transaktion</translation> + </message> + <message> + <location line="+57"/> + <location line="+16"/> + <source>SQL: database version mismatch</source> + <translation>SQL: Die Version der Datenbank entspricht nicht der erwarteten Version</translation> + </message> +</context> +<context> + <name>QDeclarativeFlipable</name> + <message> + <location filename="../src/declarative/graphicsitems/qdeclarativeflipable.cpp" line="+124"/> + <source>front is a write-once property</source> + <translation>'front' kann nur einmal zugewiesen werden</translation> + </message> + <message> + <location line="+19"/> + <source>back is a write-once property</source> + <translation>'back' kann nur einmal zugewiesen werden</translation> + </message> +</context> +<context> + <name>QDeclarativeInfo</name> + <message> + <location filename="../src/declarative/qml/qdeclarativeinfo.cpp" line="+112"/> + <location line="+3"/> + <source>unknown location</source> + <translation>Unbekannter Ort</translation> + </message> +</context> +<context> + <name>QDeclarativeListModel</name> + <message> + <location filename="../src/declarative/util/qdeclarativelistmodel.cpp" line="+483"/> + <source>remove: index %1 out of range</source> + <translation>remove: Der Index %1 ist außerhalb des gültigen Bereichs</translation> + </message> + <message> + <location line="+30"/> + <source>insert: value is not an object</source> + <translation>insert: Der Wert ist kein Objekt</translation> + </message> + <message> + <location line="+9"/> + <source>insert: index %1 out of range</source> + <translation>insert: Der Index %1 ist außerhalb des gültigen Bereichs</translation> + </message> + <message> + <location line="+29"/> + <source>move: out of range</source> + <translation>move: Außerhalb des gültigen Bereichs</translation> + </message> + <message> + <location line="+49"/> + <source>append: value is not an object</source> + <translation>append: Der Wert ist kein Objekt</translation> + </message> + <message> + <location line="+39"/> + <source>get: index %1 out of range</source> + <translation>get: Der Index %1 ist außerhalb des gültigen Bereichs</translation> + </message> + <message> + <location line="+33"/> + <source>set: value is not an object</source> + <translation>set: Der Wert ist kein Objekt</translation> + </message> + <message> + <location line="+4"/> + <location line="+39"/> + <source>set: index %1 out of range</source> + <translation>set: Der Index %1 ist außerhalb des gültigen Bereichs</translation> + </message> + <message> + <location line="+38"/> + <source>ListElement: cannot use default property</source> + <translation>ListElement: Die Vorgabe-Eigenschaft kann nicht verwendet werden</translation> + </message> + <message> + <location line="+4"/> + <source>ListElement: cannot use reserved "id" property</source> + <translation>ListElement: Die "id"-Eigenschaft kann nicht verwendet werden</translation> + </message> + <message> + <location line="+46"/> + <source>ListElement: cannot use script for property value</source> + <translation>ListElement: Es kann kein Skript für den Wert der Eigenschaft verwendet werden</translation> + </message> + <message> + <location line="+25"/> + <source>ListModel: undefined property '%1'</source> + <translation>ListModel: Die Eigenschaft '%1' ist nicht definiert</translation> + </message> +</context> +<context> + <name>QDeclarativeParentAnimation</name> + <message> + <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="+2486"/> + <source>Unable to preserve appearance under complex transform</source> + <translation>Das Erscheinungsbild kann bei einer komplexen Transformation nicht beibehalten werden</translation> + </message> + <message> + <location line="+10"/> + <location line="+7"/> + <source>Unable to preserve appearance under non-uniform scale</source> + <translation>Das Erscheinungsbild kann bei einer nicht-uniformen Skalierung nicht beibehalten werden</translation> + </message> + <message> + <location line="+7"/> + <source>Unable to preserve appearance under scale of 0</source> + <translation>Das Erscheinungsbild kann bei einer Skalierung mit 0 nicht beibehalten werden</translation> + </message> +</context> +<context> + <name>QDeclarativeParentChange</name> + <message> + <location filename="../src/declarative/util/qdeclarativestateoperations.cpp" line="+93"/> + <source>Unable to preserve appearance under complex transform</source> + <translation>Das Erscheinungsbild kann bei einer komplexen Transformation nicht beibehalten werden</translation> + </message> + <message> + <location line="+10"/> + <location line="+7"/> + <source>Unable to preserve appearance under non-uniform scale</source> + <translation>Das Erscheinungsbild kann bei einer nicht-uniformen Skalierung nicht beibehalten werden</translation> + </message> + <message> + <location line="+7"/> + <source>Unable to preserve appearance under scale of 0</source> + <translation>Das Erscheinungsbild kann bei einer Skalierung mit 0 nicht beibehalten werden</translation> + </message> +</context> +<context> + <name>QDeclarativeParser</name> + <message> + <location filename="../src/declarative/qml/parser/qdeclarativejslexer.cpp" line="+556"/> + <source>Illegal character</source> + <translation>Ungültiges Zeichen</translation> + </message> + <message> + <location line="+14"/> + <source>Unclosed string at end of line</source> + <translation>Zeichenkette am Zeilenende nicht abgeschlossen</translation> + </message> + <message> + <location line="+26"/> + <source>Illegal escape squence</source> + <translation>Ungültiges Escape-Sequenz</translation> + </message> + <message> + <location line="+46"/> + <source>Illegal unicode escape sequence</source> + <translation>Ungültige Unicode-Escape-Sequenz</translation> + </message> + <message> + <location line="+26"/> + <source>Unclosed comment at end of file</source> + <translation>Kommentar am Dateiende nicht abgeschlossen</translation> + </message> + <message> + <location line="+87"/> + <source>Illegal syntax for exponential number</source> + <translation>Ungültige Syntax des Exponenten</translation> + </message> + <message> + <location line="+26"/> + <source>Identifier cannot start with numeric literal</source> + <translation>Ein Bezeichner darf nicht mit einem numerischen Literal beginnen</translation> + </message> + <message> + <location line="+331"/> + <source>Unterminated regular expression literal</source> + <translation>Regulärer Ausdruck nicht abgeschlossen</translation> + </message> + <message> + <location line="+24"/> + <source>Invalid regular expression flag '%0'</source> + <translation>Ungültiger Modifikator '%0' bei regulärem Ausdruck</translation> + </message> + <message> + <location filename="../src/declarative/qml/parser/qdeclarativejsparser.cpp" line="+1781"/> + <location line="+67"/> + <source>Syntax error</source> + <translation>Syntaxfehler</translation> + </message> + <message> + <location line="-65"/> + <source>Unexpected token `%1'</source> + <translation>Unerwartetes Element '%1'</translation> + </message> + <message> + <location line="+28"/> + <location line="+24"/> + <source>Expected token `%1'</source> + <translation>Es wird das Element '%1' erwartet</translation> + </message> + <message> + <location filename="../src/declarative/qml/qdeclarativescriptparser.cpp" line="+266"/> + <location line="+434"/> + <location line="+59"/> + <source>Property value set multiple times</source> + <translation>Mehrfache Zuweisung eines Wertes an eine Eigenschaft</translation> + </message> + <message> + <location line="-482"/> + <source>Expected type name</source> + <translation>Es wird ein Typname erwartet</translation> + </message> + <message> + <location line="+29"/> + <source>Invalid use of Script block</source> + <translation>Ungültige Verwendung von Skript-Blöcken</translation> + </message> + <message> + <location line="+154"/> + <source>Invalid import qualifier ID</source> + <translation>Ungültige Id-Angabe bei Import</translation> + </message> + <message> + <location line="+11"/> + <source>Library import requires a version</source> + <translation>Der Import einer Bibliothek erfordert eine Versionsangabe</translation> + </message> + <message> + <location line="+53"/> + <source>Expected parameter type</source> + <translation>Es wird eine Typangabe für den Parameter erwartet</translation> + </message> + <message> + <location line="+42"/> + <source>Invalid property type modifier</source> + <translation>Ungültiger Modifikator für den Typ der Eigenschaft</translation> + </message> + <message> + <location line="+9"/> + <source>Unexpected property type modifier</source> + <translation>Modifikator für den Typ der Eigenschaft an dieser Stelle nicht zulässig</translation> + </message> + <message> + <location line="+9"/> + <source>Expected property type</source> + <translation>Typangabe für Eigenschaft erwartet</translation> + </message> + <message> + <location line="+9"/> + <source>Readonly not yet supported</source> + <translation>'read-only' wird an dieser Stelle noch nicht unterstützt</translation> + </message> + <message> + <location line="+213"/> + <source>JavaScript declaration outside Script element</source> + <translation>Eine JavaScript-Deklaration ist außerhalb eines Skriptelementes nicht zulässig</translation> + </message> + <message> + <location line="+19"/> + <source>Variable declarations not allow in inline Script blocks</source> + <translation>Variablendeklarationen sind in eingebetteten Script-Blöcken nicht zulässig</translation> + </message> +</context> +<context> + <name>QDeclarativePauseAnimation</name> + <message> + <location filename="../src/declarative/util/qdeclarativeanimation.cpp" line="-2103"/> + <source>Cannot set a duration of < 0</source> + <translation>Es kann keine Zeitdauer <0 gesetzt werden</translation> + </message> +</context> +<context> + <name>QDeclarativePropertyAnimation</name> + <message> + <location line="+1252"/> + <source>Cannot set a duration of < 0</source> + <translation>Es kann keine Zeitdauer <0 gesetzt werden</translation> + </message> +</context> +<context> + <name>QDeclarativePropertyChanges</name> + <message> + <location filename="../src/declarative/util/qdeclarativepropertychanges.cpp" line="+380"/> + <source>Cannot assign to non-existent property "%1"</source> + <translation>Es kann keine Zuweisung erfolgen, da keine Eigenschaft des Namens '%1" existiert</translation> + </message> + <message> + <location line="+3"/> + <source>Cannot assign to read-only property "%1"</source> + <translation>Die Eigenschaft '%1" ist schreibgeschützt und kann daher nicht zugewiesen werden</translation> + </message> +</context> +<context> + <name>QDeclarativeTextInput</name> + <message> + <location filename="../src/declarative/graphicsitems/qdeclarativetextinput.cpp" line="+594"/> + <location line="+9"/> + <source>Could not load cursor delegate</source> + <translation>Cursor-Delegate konnte nicht geladen werden</translation> + </message> + <message> + <location line="+12"/> + <source>Could not instantiate cursor delegate</source> + <translation>Cursor-Delegate konnte angelegt werden</translation> + </message> +</context> +<context> + <name>QDeclarativeVME</name> + <message> + <location filename="../src/declarative/qml/qdeclarativevme.cpp" line="+195"/> + <source>Unable to create object of type %1</source> + <translation>Es konnte kein Objekt des Typs %1 erzeugt werden</translation> + </message> + <message> + <location line="+306"/> + <source>Cannot assign value %1 to property %2</source> + <translation>Der Wert '%1' kann nicht der Eigenschaft %2 zugewiesen werden</translation> + </message> + <message> + <location line="+22"/> + <source>Cannot assign object type %1 with no default method</source> + <translation>Der Objekttyp %1 kann nicht zugewiesen werden, da keine Vorgabe-Methode existiert</translation> + </message> + <message> + <location line="+3"/> + <source>Cannot connect mismatched signal/slot %1 %vs. %2</source> + <translation>Es kann keine Verbindung zwischen dem Signal %1 und dem Slot %2 hergestellt werden, da sie nicht zusammenpassen</translation> + </message> + <message> + <location line="+5"/> + <source>Cannot assign an object to signal property %1</source> + <translation>Der Signal-Eigenschaft %1 kann kein Objekt zugewiesen werden</translation> + </message> + <message> + <location line="+147"/> + <source>Cannot assign object to list</source> + <translation>Zuweisung eines Objekts an eine Liste nicht zulässig</translation> + </message> + <message> + <location line="+41"/> + <source>Cannot assign object to interface property</source> + <translation>Der Eigenschaft der Schnittstelle kann kein Objekt zugewiesen werden</translation> + </message> + <message> + <location line="+11"/> + <source>Unable to create attached object</source> + <translation>Es konnte kein 'attached'-Objekt erzeugt werden</translation> + </message> + <message> + <location line="+32"/> + <source>Cannot set properties on %1 as it is null</source> + <translation>Es können keine Eigenschaften auf %1 gesetzt werden, da es 'null' ist</translation> + </message> +</context> +<context> + <name>QDeclarativeVisualDataModel</name> + <message> + <location filename="../src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp" line="+1022"/> + <source>Delegate component must be Item type.</source> + <translation>Delegate-Komponente muss vom Typ 'Item' sein</translation> + </message> +</context> +<context> + <name>QDeclarativeXmlListModelRole</name> + <message> + <location filename="../src/declarative/util/qdeclarativexmllistmodel_p.h" line="+158"/> + <source>An XmlRole query must not start with '/'</source> + <translation>Eine XmlRole-Abfrage darf nicht mit '/' beginnen</translation> + </message> +</context> +<context> + <name>QDeclarativeXmlRoleList</name> + <message> + <location filename="../src/declarative/util/qdeclarativexmllistmodel.cpp" line="+623"/> + <source>An XmlListModel query must start with '/' or "//"</source> + <translation>Eine XmlListModel-Abfrage muss mit '/' oder "//" beginnen</translation> + </message> +</context> +<context> <name>QDial</name> <message> <location filename="../src/plugins/accessible/widgets/rangecontrols.cpp" line="+951"/> @@ -1576,7 +2530,7 @@ nach <context> <name>QDialog</name> <message> - <location filename="../src/gui/dialogs/qdialog.cpp" line="+652"/> + <location filename="../src/gui/dialogs/qdialog.cpp" line="+659"/> <source>What's This?</source> <translation>Direkthilfe</translation> </message> @@ -1589,7 +2543,7 @@ nach <context> <name>QDialogButtonBox</name> <message> - <location filename="../src/gui/dialogs/qmessagebox.cpp" line="+1876"/> + <location filename="../src/gui/dialogs/qmessagebox.cpp" line="+1906"/> <location line="+464"/> <location filename="../src/gui/widgets/qdialogbuttonbox.cpp" line="+648"/> <source>OK</source> @@ -1842,7 +2796,7 @@ nach <context> <name>QFileDialog</name> <message> - <location filename="../src/gui/dialogs/qfiledialog.cpp" line="+557"/> + <location filename="../src/gui/dialogs/qfiledialog.cpp" line="+558"/> <location line="+471"/> <source>All Files (*)</source> <translation>Alle Dateien (*)</translation> @@ -2389,7 +3343,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QFontDialog</name> <message> - <location filename="../src/gui/dialogs/qfontdialog.cpp" line="+776"/> + <location filename="../src/gui/dialogs/qfontdialog.cpp" line="+768"/> <source>&Font</source> <translation>&Schriftart</translation> </message> @@ -2424,13 +3378,12 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Beispiel</translation> </message> <message> - <location line="-608"/> - <location line="+257"/> + <location line="-595"/> <source>Select Font</source> <translation>Schriftart auswählen</translation> </message> <message> - <location line="+352"/> + <location line="+596"/> <source>Wr&iting System</source> <translation>&Schriftsystem</translation> </message> @@ -2584,7 +3537,8 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QGstreamerPlayerSession</name> <message> - <location filename="../src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp" line="+270"/> + <location filename="../src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp" line="+423"/> + <location line="+16"/> <source>Unable to play %1</source> <translation>%1 kann nicht abgespielt werden</translation> </message> @@ -2592,12 +3546,12 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QHostInfo</name> <message> - <location filename="../src/network/kernel/qhostinfo_p.h" line="+101"/> + <location filename="../src/network/kernel/qhostinfo_p.h" line="+103"/> <source>Unknown error</source> <translation>Unbekannter Fehler</translation> </message> <message> - <location filename="../src/network/kernel/qhostinfo.cpp" line="+168"/> + <location filename="../src/network/kernel/qhostinfo.cpp" line="+175"/> <source>No host name given</source> <translation>Es wurde kein Hostname angegeben</translation> </message> @@ -2921,7 +3875,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <message> <location line="+5"/> <source>Could not prepare statement</source> - <translation>Der Befehl konnte nicht initalisiert werden</translation> + <translation>Der Befehl konnte nicht initialisiert werden</translation> </message> <message> <location line="+5"/> @@ -2978,7 +3932,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Kein freier Speicherplatz auf dem Gerät vorhanden</translation> </message> <message> - <location filename="../src/corelib/io/qiodevice.cpp" line="+1565"/> + <location filename="../src/corelib/io/qiodevice.cpp" line="+1564"/> <source>Unknown error</source> <translation>Unbekannter Fehler</translation> </message> @@ -3094,7 +4048,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QLineEdit</name> <message> - <location filename="../src/gui/widgets/qlineedit.cpp" line="+2104"/> + <location filename="../src/gui/widgets/qlineedit.cpp" line="+2107"/> <source>Select All</source> <translation>Alles auswählen</translation> </message> @@ -3227,7 +4181,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QMYSQLDriver</name> <message> - <location filename="../src/sql/drivers/mysql/qsql_mysql.cpp" line="+1270"/> + <location filename="../src/sql/drivers/mysql/qsql_mysql.cpp" line="+1287"/> <source>Unable to open database '</source> <translation>Die Datenbankverbindung kann nicht geöffnet werden '</translation> </message> @@ -3417,7 +4371,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QMediaPlayer</name> <message> - <location filename="../src/multimedia/playback/qmediaplayer.cpp" line="+471"/> + <location filename="../src/multimedia/playback/qmediaplayer.cpp" line="+494"/> <source>The QMediaPlayer object does not have a valid service</source> <translation>Das QMediaPlayer-Objekt verfügt über keinen gültigen Dienst</translation> </message> @@ -3425,7 +4379,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QMediaPlaylist</name> <message> - <location filename="../src/multimedia/base/qmediaplaylist.cpp" line="+454"/> + <location filename="../src/multimedia/base/qmediaplaylist.cpp" line="+455"/> <location line="+46"/> <source>Could not add items to read only playlist.</source> <translation>Es konnten keine Einträge zur Wiedergabeliste hinzugefügt werden, da sie schreibgeschützt ist.</translation> @@ -3472,7 +4426,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QMenuBar</name> <message> - <location filename="../src/gui/widgets/qmenu_symbian.cpp" line="+436"/> + <location filename="../src/gui/widgets/qmenu_symbian.cpp" line="+452"/> <source>Actions</source> <translation>Optionen</translation> </message> @@ -3508,12 +4462,12 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Hilfe</translation> </message> <message> - <location line="-1102"/> + <location line="-1119"/> <source>Show Details...</source> <translation>Details einblenden...</translation> </message> <message> - <location line="+1"/> + <location line="+0"/> <source>Hide Details...</source> <translation>Details ausblenden...</translation> </message> @@ -3559,7 +4513,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <message> <location line="+3"/> <source>Unsupported socket operation</source> - <translation>Nichtunterstütztes Socket-Kommando</translation> + <translation> Socket-Kommando nicht unterstützt</translation> </message> <message> <location line="+3"/> @@ -3781,7 +4735,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QNetworkAccessManager</name> <message> - <location filename="../src/network/access/qnetworkreplyimpl.cpp" line="+862"/> + <location filename="../src/network/access/qnetworkreplyimpl.cpp" line="+885"/> <source>Network access is disabled.</source> <translation>Der Zugriff auf das Netzwerk ist nicht gestattet.</translation> </message> @@ -3794,12 +4748,17 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Beim Herunterladen von %1 trat ein Fehler auf - Die Antwort des Servers ist: %2</translation> </message> <message> - <location filename="../src/network/access/qnetworkreplyimpl.cpp" line="-780"/> + <location filename="../src/network/access/qnetworkreplyimpl.cpp" line="-801"/> <source>Protocol "%1" is unknown</source> <translation>Das Protokoll "%1" ist unbekannt</translation> </message> <message> - <location line="+486"/> + <location line="+177"/> + <source>Network session error.</source> + <translation>Fehler bei Netzwerkverbindung.</translation> + </message> + <message> + <location line="+323"/> <source>Temporary network failure.</source> <translation>Das Netzwerk ist zur Zeit ausgefallen.</translation> </message> @@ -3816,7 +4775,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QNetworkSession</name> <message> - <location filename="../src/network/bearer/qnetworksession.cpp" line="+437"/> + <location filename="../src/network/bearer/qnetworksession.cpp" line="+441"/> <source>Invalid configuration.</source> <translation>Ungültige Konfiguration.</translation> </message> @@ -3824,8 +4783,8 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QNetworkSessionPrivateImpl</name> <message> - <location filename="../src/plugins/bearer/qnetworksession_impl.cpp" line="+247"/> - <location filename="../src/plugins/bearer/symbian/qnetworksession_impl.cpp" line="+213"/> + <location filename="../src/plugins/bearer/qnetworksession_impl.cpp" line="+270"/> + <location filename="../src/plugins/bearer/symbian/qnetworksession_impl.cpp" line="+215"/> <source>Unknown session error.</source> <translation>Unbekannter Fehler bei Netzwerkverbindung.</translation> </message> @@ -3854,7 +4813,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Das Roaming wurde abgebrochen oder ist hier nicht möglich.</translation> </message> <message> - <location filename="../src/plugins/bearer/icd/qnetworksession_impl.cpp" line="+1083"/> + <location filename="../src/plugins/bearer/icd/qnetworksession_impl.cpp" line="+1159"/> <source>Roaming error</source> <translation>Fehler beim Roaming</translation> </message> @@ -3872,7 +4831,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QOCIDriver</name> <message> - <location filename="../src/sql/drivers/oci/qsql_oci.cpp" line="+2082"/> + <location filename="../src/sql/drivers/oci/qsql_oci.cpp" line="+2088"/> <source>Unable to logon</source> <translation>Logon-Vorgang fehlgeschlagen</translation> </message> @@ -3946,12 +4905,12 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QODBCDriver</name> <message> - <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="+1791"/> + <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="+1842"/> <source>Unable to connect</source> <translation>Es kann keine Verbindung aufgebaut werden</translation> </message> <message> - <location line="+233"/> + <location line="+234"/> <source>Unable to disable autocommit</source> <translation>'autocommit' konnte nicht deaktiviert werden</translation> </message> @@ -3971,7 +4930,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>'autocommit' konnte nicht aktiviert werden</translation> </message> <message> - <location line="-276"/> + <location line="-277"/> <source>Unable to connect - Driver doesn't support all functionality required</source> <translation>Es kann keine Verbindung aufgebaut werden weil der Treiber die benötigte Funktionalität nicht vollständig unterstützt</translation> </message> @@ -3979,19 +4938,19 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QODBCResult</name> <message> - <location line="-935"/> + <location line="-940"/> <location line="+351"/> <source>QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration</source> <translation>QODBCResult::reset: 'SQL_CURSOR_STATIC' konnte nicht als Attribut des Befehls gesetzt werden. Bitte prüfen Sie die Konfiguration Ihres ODBC-Treibers</translation> </message> <message> <location line="-334"/> - <location line="+626"/> + <location line="+627"/> <source>Unable to execute statement</source> <translation>Der Befehl konnte nicht ausgeführt werden</translation> </message> <message> - <location line="-545"/> + <location line="-546"/> <source>Unable to fetch next</source> <translation>Der nächste Datensatz konnte nicht abgeholt werden</translation> </message> @@ -4001,19 +4960,19 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Der Befehl konnte nicht initialisiert werden</translation> </message> <message> - <location line="+266"/> + <location line="+267"/> <source>Unable to bind variable</source> <translation>Die Variable konnte nicht gebunden werden</translation> </message> <message> <location filename="../src/sql/drivers/db2/qsql_db2.cpp" line="+189"/> - <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="-465"/> - <location line="+574"/> + <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="-466"/> + <location line="+578"/> <source>Unable to fetch last</source> <translation>Der letzte Datensatz konnte nicht abgeholt werden</translation> </message> <message> - <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="-668"/> + <location filename="../src/sql/drivers/odbc/qsql_odbc.cpp" line="-672"/> <source>Unable to fetch</source> <translation>Es konnten keine Daten abgeholt werden</translation> </message> @@ -4031,7 +4990,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QObject</name> <message> - <location filename="../src/declarative/util/qmlxmllistmodel.cpp" line="+370"/> + <location filename="../src/declarative/util/qdeclarativexmllistmodel.cpp" line="-193"/> <source>"%1" duplicates a previous role name and will be disabled.</source> <translation>"%1" ist bereits als Name einer Rolle vergeben und wird daher deaktiviert.</translation> </message> @@ -4039,7 +4998,7 @@ Möchten Sie die Datei trotzdem löschen?</translation> <context> <name>QPPDOptionsModel</name> <message> - <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="+1195"/> + <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="+1238"/> <source>Name</source> <translation>Name</translation> </message> @@ -4231,12 +5190,12 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>unbekannt</translation> </message> <message> - <location filename="../src/gui/dialogs/qprintdialog_win.cpp" line="+266"/> + <location filename="../src/gui/dialogs/qprintdialog_win.cpp" line="+272"/> <source>OK</source> <translation>OK</translation> </message> <message> - <location filename="../src/gui/dialogs/qprintdialog_qws.cpp" line="+375"/> + <location filename="../src/gui/dialogs/qprintdialog_qws.cpp" line="+379"/> <source>Print all</source> <translation>Alles drucken</translation> </message> @@ -4371,7 +5330,12 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>US Common #10 Envelope (105 x 241 mm)</translation> </message> <message> - <location line="-25"/> + <location line="+20"/> + <source>Print current page</source> + <translation>Diese Seite drucken</translation> + </message> + <message> + <location line="-45"/> <source>A4 (210 x 297 mm, 8.26 x 11.7 inches)</source> <translation>A4 (210 x 297 mm)</translation> </message> @@ -4401,14 +5365,14 @@ Möchten Sie die Datei trotzdem löschen?</translation> <translation>Auswahl drucken</translation> </message> <message> - <location filename="../src/gui/dialogs/qabstractprintdialog.cpp" line="+112"/> + <location filename="../src/gui/dialogs/qabstractprintdialog.cpp" line="+113"/> <location line="+13"/> <location filename="../src/gui/dialogs/qprintdialog_win.cpp" line="-2"/> <source>Print</source> <translation>Drucken</translation> </message> <message> - <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-359"/> + <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-392"/> <source>Print To File ...</source> <translation>In Datei drucken ...</translation> </message> @@ -4427,7 +5391,7 @@ Do you want to overwrite it?</source> Soll sie überschrieben werden?</translation> </message> <message> - <location filename="../src/gui/dialogs/qprintdialog_qws.cpp" line="-228"/> + <location filename="../src/gui/dialogs/qprintdialog_qws.cpp" line="-232"/> <source>File exists</source> <translation>Die Datei existiert bereits</translation> </message> @@ -4604,7 +5568,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Benutzerdefiniert</translation> </message> <message> - <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-523"/> + <location filename="../src/gui/dialogs/qprintdialog_unix.cpp" line="-530"/> <location line="+68"/> <source>&Options >></source> <translation>&Einstellungen >></translation> @@ -4615,7 +5579,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>&Einstellungen << </translation> </message> <message> - <location line="+253"/> + <location line="+260"/> <source>Print to File (PDF)</source> <translation>In PDF-Datei drucken</translation> </message> @@ -4635,7 +5599,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Schreiben der Datei %1</translation> </message> <message> - <location line="-369"/> + <location line="-376"/> <source>&Print</source> <translation>&Drucken</translation> </message> @@ -4648,7 +5612,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>%1%</translation> </message> <message> - <location line="+71"/> + <location line="+84"/> <source>Print Preview</source> <translation>Druckvorschau</translation> </message> @@ -4864,6 +5828,11 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <source>Short side</source> <translation>Kurze Seite</translation> </message> + <message> + <location/> + <source>Current Page</source> + <translation></translation> + </message> </context> <context> <name>QPrintWidget</name> @@ -6566,7 +7535,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Umdrehen</translation> </message> <message> - <location line="+602"/> + <location line="+603"/> <location line="+135"/> <source>Ctrl</source> <translation>Strg</translation> @@ -6600,7 +7569,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>F%1</translation> </message> <message> - <location line="-898"/> + <location line="-899"/> <source>Home Page</source> <translation>Startseite</translation> </message> @@ -6734,7 +7703,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Abbrechen</translation> </message> <message> - <location filename="../src/gui/kernel/qsoftkeymanager_s60.cpp" line="+312"/> + <location filename="../src/gui/kernel/qsoftkeymanager_s60.cpp" line="+331"/> <source>Exit</source> <translation>Beenden</translation> </message> @@ -6812,7 +7781,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <context> <name>QSslSocket</name> <message> - <location filename="../src/network/ssl/qsslsocket_openssl.cpp" line="+546"/> + <location filename="../src/network/ssl/qsslsocket_openssl.cpp" line="+550"/> <source>Unable to write data: %1</source> <translation>Die Daten konnten nicht geschrieben werden: %1</translation> </message> @@ -6832,7 +7801,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Im Ablauf des SSL-Protokolls ist ein Fehler aufgetreten: %1</translation> </message> <message> - <location line="-521"/> + <location line="-524"/> <source>Error creating SSL context (%1)</source> <translation>Es konnte keine SSL-Kontextstruktur erzeugt werden (%1)</translation> </message> @@ -6842,7 +7811,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Ungültige oder leere Schlüsselliste (%1)</translation> </message> <message> - <location line="+42"/> + <location line="+45"/> <source>Private key does not certify public key, %1</source> <translation>Der private Schlüssel passt nicht zum öffentlichen Schlüssel, %1</translation> </message> @@ -6857,7 +7826,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Es konnte keine SSL-Sitzung erzeugt werden: %1</translation> </message> <message> - <location line="-61"/> + <location line="-64"/> <source>Cannot provide a certificate with no key, %1</source> <translation>Ohne Schlüssel kann kein Zertifikat zur Verfügung gestellt werden, %1</translation> </message> @@ -6867,7 +7836,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Das lokale Zertifikat konnte nicht geladen werden, %1</translation> </message> <message> - <location line="+12"/> + <location line="+15"/> <source>Error loading private key, %1</source> <translation>Der private Schlüssel konnte nicht geladen werden, %1</translation> </message> @@ -7078,7 +8047,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <context> <name>QTextControl</name> <message> - <location filename="../src/gui/text/qtextcontrol.cpp" line="+2029"/> + <location filename="../src/gui/text/qtextcontrol.cpp" line="+2034"/> <source>&Undo</source> <translation>&Rückgängig</translation> </message> @@ -8127,7 +9096,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <context> <name>QWidget</name> <message> - <location filename="../src/gui/kernel/qwidget.cpp" line="+5761"/> + <location filename="../src/gui/kernel/qwidget.cpp" line="+5805"/> <source>*</source> <translation>*</translation> </message> @@ -8592,866 +9561,6 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> </message> </context> <context> - <name>QmlAbstractAnimation</name> - <message> - <location filename="../src/declarative/util/qmlanimation.cpp" line="+235"/> - <source>Cannot animate non-existent property "%1"</source> - <translation>Die Eigenschaft '%1" existiert nicht und kann daher nicht animiert werden</translation> - </message> - <message> - <location line="+3"/> - <source>Cannot animate read-only property "%1"</source> - <translation>Die Eigenschaft '%1" ist schreibgeschützt und kann daher nicht animiert werden</translation> - </message> -</context> -<context> - <name>QmlBehavior</name> - <message> - <location filename="../src/declarative/util/qmlbehavior.cpp" line="+122"/> - <source>Cannot change the animation assigned to a Behavior.</source> - <translation>Die zu einem Behavior-Element gehörende Animation kann nicht geändert werden.</translation> - </message> -</context> -<context> - <name>QmlBinding</name> - <message> - <location filename="../src/declarative/qml/qmlbinding.cpp" line="+195"/> - <source>Binding loop detected for property "%1"</source> - <translation>Bei der für die Eigenschaft "%1" angegebenen Bindung wurde eine Schleife festgestellt</translation> - </message> -</context> -<context> - <name>QmlCompiler</name> - <message> - <location filename="../src/declarative/qml/qmlcompiler.cpp" line="+214"/> - <location line="+1772"/> - <location line="+124"/> - <location line="+427"/> - <source>Invalid property assignment: "%1" is a read-only property</source> - <translation>Ungültige Zuweisung bei Eigenschaft: "%1" ist schreibgeschützt</translation> - </message> - <message> - <location line="-2314"/> - <source>Invalid property assignment: unknown enumeration</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Ungültiger Aufzählungswert</translation> - </message> - <message> - <location line="+8"/> - <source>Invalid property assignment: string expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeichenkette erwartet</translation> - </message> - <message> - <location line="+3"/> - <source>Invalid property assignment: url expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine URL erwartet</translation> - </message> - <message> - <location line="+6"/> - <source>Invalid property assignment: unsigned int expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine vorzeichenloser Ganzzahlwert erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: int expected</source> - <translation type="unfinished">Ungültige Zuweisung bei Eigenschaft: Es wird ein Ganzzahlwert erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: float expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: double expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Gleitkommazahl (double) erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: color expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Farbspezifikation erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: date expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: time expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Zeitangabe erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: datetime expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Datumsangabe erwartet</translation> - </message> - <message> - <location line="+8"/> - <source>Invalid property assignment: point expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Koordinatenangabe für einen Punkt erwartet</translation> - </message> - <message> - <location line="+8"/> - <source>Invalid property assignment: size expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird eine Größenangabe erwartet</translation> - </message> - <message> - <location line="+8"/> - <source>Invalid property assignment: rect expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es werden Parameter für ein Rechteck erwartet</translation> - </message> - <message> - <location line="+5"/> - <source>Invalid property assignment: boolean expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird ein Boolescher Wert erwartet</translation> - </message> - <message> - <location line="+7"/> - <source>Invalid property assignment: 3D vector expected</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Es wird ein dreidimensionaler Vektor erwartet</translation> - </message> - <message> - <location line="+9"/> - <source>Invalid property assignment: unsupported type "%1"</source> - <translation>Ungültige Zuweisung bei Eigenschaft: Der Typ "%1" ist nicht unterstützt</translation> - </message> - <message> - <location line="+801"/> - <location line="+3"/> - <source>Invalid component specification</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>Invalid component id specification</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <location line="+565"/> - <source>id is not unique</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-555"/> - <source>Invalid component body specification</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>Cannot create empty component specification</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+17"/> - <source>Invalid Script block. Specify either the source property or inline script</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <source>Invalid Script source value</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+24"/> - <source>Properties cannot be set on Script block</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Invalid Script block</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+130"/> - <source>Incorrectly specified signal</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+13"/> - <source>Empty signal assignment</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+36"/> - <source>Empty property assignment</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+12"/> - <source>Attached properties cannot be used here</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+15"/> - <location line="+104"/> - <source>Non-existent attached object</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-100"/> - <location line="+103"/> - <source>Invalid attached object assignment</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-50"/> - <source>Cannot assign to non-existent default property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <location line="+339"/> - <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-308"/> - <source>Invalid use of namespace</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>Not an attached property name</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+169"/> - <source>Invalid use of id property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>"%1" is not a valid object id</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>id conflicts with type name</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>id conflicts with namespace prefix</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+78"/> - <source>Invalid value in grouped property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+10"/> - <location line="+8"/> - <source>Invalid grouped property access</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+16"/> - <source>Invalid property use</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+12"/> - <source>Property assignment expected</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> - <source>Single property assignment expected</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Unexpected object assignment</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+57"/> - <source>Cannot assign object to list</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+12"/> - <source>Cannot assign primitives to lists</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-6"/> - <source>Can only assign one binding to lists</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+19"/> - <source>Cannot assign multiple values to a script property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> - <source>Invalid property assignment: script expected</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+129"/> - <source>Cannot assign object to property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+97"/> - <source>Duplicate default property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>Duplicate property name</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+8"/> - <source>Duplicate signal name</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>Duplicate method name</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+22"/> - <source>Invalid property nesting</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+55"/> - <source>Cannot override FINAL property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+25"/> - <source>Invalid property type</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+174"/> - <location line="+9"/> - <source>No property alias location</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-4"/> - <location line="+25"/> - <source>Invalid alias location</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-16"/> - <source>Invalid alias reference. An alias reference must be specified as <id> or <id>.<property></source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> - <source>Invalid alias reference. Unable to find id "%1"</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlCompositeTypeManager</name> - <message> - <location filename="../src/declarative/qml/qmlcompositetypemanager.cpp" line="+415"/> - <location line="+220"/> - <source>Resource %1 unavailable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-141"/> - <source>Import %1 unavailable</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+30"/> - <source>Namespace %1 cannot be used as a type</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+2"/> - <source>%1 is not a type</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+42"/> - <source>Type %1 unavailable</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlEngine</name> - <message> - <location filename="../src/declarative/qml/qmlsqldatabase.cpp" line="+204"/> - <source>executeSql called outside transaction()</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+52"/> - <source>Read-only Transaction</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+20"/> - <source>Version mismatch: expected %1, found %2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>SQL transaction failed</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+21"/> - <source>transaction: missing callback</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+57"/> - <location line="+16"/> - <source>SQL: database version mismatch</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlGraphicsAnchors</name> - <message> - <location filename="../src/declarative/graphicsitems/qmlgraphicsanchors.cpp" line="+177"/> - <source>Possible anchor loop detected on fill.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+28"/> - <source>Possible anchor loop detected on centerIn.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+163"/> - <location line="+34"/> - <location line="+607"/> - <location line="+37"/> - <source>Cannot anchor to an item that isn't a parent or sibling.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-534"/> - <source>Possible anchor loop detected on vertical anchor.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+59"/> - <source>Possible anchor loop detected on horizontal anchor.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+422"/> - <source>Cannot specify left, right, and hcenter anchors.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+10"/> - <location line="+37"/> - <source>Cannot anchor to a null item.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-34"/> - <source>Cannot anchor a horizontal edge to a vertical edge.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <location line="+37"/> - <source>Cannot anchor item to self.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-25"/> - <source>Cannot specify top, bottom, and vcenter anchors.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+6"/> - <source>Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+13"/> - <source>Cannot anchor a vertical edge to a horizontal edge.</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlGraphicsFlipable</name> - <message> - <location filename="../src/declarative/graphicsitems/qmlgraphicsflipable.cpp" line="+149"/> - <source>front is a write-once property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+19"/> - <source>back is a write-once property</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlGraphicsTextInput</name> - <message> - <location filename="../src/declarative/graphicsitems/qmlgraphicstextinput.cpp" line="+594"/> - <location line="+9"/> - <source>Could not load cursor delegate</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+12"/> - <source>Could not instantiate cursor delegate</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlGraphicsVisualDataModel</name> - <message> - <location filename="../src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp" line="+826"/> - <source>Delegate component must be Item type.</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlInfo</name> - <message> - <location filename="../src/declarative/qml/qmlinfo.cpp" line="+112"/> - <location line="+3"/> - <source>unknown location</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlListModel</name> - <message> - <location filename="../src/declarative/util/qmllistmodel.cpp" line="+491"/> - <source>remove: index %1 out of range</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+30"/> - <source>insert: value is not an object</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+9"/> - <source>insert: index %1 out of range</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+29"/> - <source>move: out of range</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+49"/> - <source>append: value is not an object</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+39"/> - <source>get: index %1 out of range</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+33"/> - <source>set: value is not an object</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <location line="+39"/> - <source>set: index %1 out of range</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+49"/> - <source>ListElement: cannot use default property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+4"/> - <source>ListElement: cannot use reserved "id" property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+46"/> - <source>ListElement: cannot use script for property value</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+25"/> - <source>ListModel: undefined property '%1'</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlParentChange</name> - <message> - <location filename="../src/declarative/util/qmlstateoperations.cpp" line="+85"/> - <source>Unable to preserve appearance under complex transform</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+10"/> - <location line="+7"/> - <source>Unable to preserve appearance under non-uniform scale</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+7"/> - <source>Unable to preserve appearance under scale of 0</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlParser</name> - <message> - <location filename="../src/declarative/qml/parser/qmljslexer.cpp" line="+554"/> - <source>Illegal character</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+14"/> - <source>Unclosed string at end of line</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+26"/> - <source>Illegal escape squence</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+46"/> - <source>Illegal unicode escape sequence</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+26"/> - <source>Unclosed comment at end of file</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+87"/> - <source>Illegal syntax for exponential number</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+26"/> - <source>Identifier cannot start with numeric literal</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+331"/> - <source>Unterminated regular expression literal</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+24"/> - <source>Invalid regular expression flag '%0'</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../src/declarative/qml/parser/qmljsparser.cpp" line="+1767"/> - <location line="+67"/> - <source>Syntax error</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="-65"/> - <source>Unexpected token `%1'</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+28"/> - <location line="+24"/> - <source>Expected token `%1'</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../src/declarative/qml/qmlscriptparser.cpp" line="+267"/> - <source>Expected type name</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+29"/> - <source>Invalid use of Script block</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+151"/> - <source>Invalid import qualifier ID</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Library import requires a version</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+53"/> - <source>Expected parameter type</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+42"/> - <source>Invalid property type modifier</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+9"/> - <source>Unexpected property type modifier</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+9"/> - <source>Expected property type</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+9"/> - <source>Readonly not yet supported</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+194"/> - <source>QmlJS declaration outside Script element</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+19"/> - <source>Variable declarations not allow in inline Script blocks</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlPauseAnimation</name> - <message> - <location filename="../src/declarative/util/qmlanimation.cpp" line="+410"/> - <source>Cannot set a duration of < 0</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlPropertyAnimation</name> - <message> - <location line="-568"/> - <source>Unmatched parenthesis in easing function "%1"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+9"/> - <source>Easing function "%1" must start with "ease"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+15"/> - <source>Unknown easing curve "%1"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+10"/> - <location line="+9"/> - <source>Improperly specified parameter in easing function "%1"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Unknown easing parameter "%1"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+1754"/> - <source>Cannot set a duration of < 0</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlPropertyChanges</name> - <message> - <location filename="../src/declarative/util/qmlpropertychanges.cpp" line="+361"/> - <source>Cannot assign to non-existent property "%1"</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> - <source>Cannot assign to read-only property "%1"</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlVME</name> - <message> - <location filename="../src/declarative/qml/qmlvme.cpp" line="+195"/> - <source>Unable to create object of type %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+306"/> - <source>Cannot assign value %1 to property %2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+22"/> - <source>Cannot assign object type %1 with no default method</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+3"/> - <source>Cannot connect mismatched signal/slot %1 %vs. %2</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+5"/> - <source>Cannot assign an object to signal property %1</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+147"/> - <source>Cannot assign object to list</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+41"/> - <source>Cannot assign object to interface property</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+11"/> - <source>Unable to create attached object</source> - <translation type="unfinished"></translation> - </message> - <message> - <location line="+32"/> - <source>Cannot set properties on %1 as it is null</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlXmlListModelRole</name> - <message> - <location filename="../src/declarative/util/qmlxmllistmodel.cpp" line="-255"/> - <source>An XmlRole query must not start with '/'</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> - <name>QmlXmlRoleList</name> - <message> - <location line="+430"/> - <source>An XmlListModel query must start with '/' or "//"</source> - <translation type="unfinished"></translation> - </message> -</context> -<context> <name>QtXmlPatterns</name> <message> <location filename="../src/xmlpatterns/data/qabstractduration.cpp" line="+99"/> @@ -9916,7 +10025,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <message> <location line="+130"/> <source>%1 is an invalid flag for regular expressions. Valid flags are:</source> - <translation>%1 ist kein gültiger Modifizierer für reguläre Ausdrücke. Gültige Modifizierer sind:</translation> + <translation>%1 ist kein gültiger Modifikator für reguläre Ausdrücke. Gültige Modifikatoren sind:</translation> </message> <message> <location filename="../src/xmlpatterns/functions/qqnamefns.cpp" line="+17"/> @@ -11098,7 +11207,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Das Unterelement fehlt im Bereich; mögliche Unterelemente wären: %1.</translation> </message> <message> - <location line="+127"/> + <location line="+143"/> <source>Document is not a XML schema.</source> <translation>Das Dokument ist kein XML-Schema.</translation> </message> @@ -11124,7 +11233,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>Der Zielnamensraum %1 des importierten Schemas unterscheidet sich vom dem von ihm definierten Zielnamensraum %2.</translation> </message> <message> - <location line="+237"/> + <location line="+243"/> <source>%1 element is not allowed to have the same %2 attribute value as the target namespace %3.</source> <translation>Das Element %1 kann nicht den Zielnamensraum %3 als Wert des Attributs '%2' spezifizieren.</translation> </message> @@ -11134,7 +11243,7 @@ Bitte wählen Sie einen anderen Dateinamen.</translation> <translation>In einem Schema ohne Namensraum muss das Element %1 ein Attribut %2 haben.</translation> </message> <message> - <location line="+833"/> + <location line="+851"/> <location line="+158"/> <source>%1 element is not allowed inside %2 element if %3 attribute is present.</source> <translation>Wenn das Attribut %3 vorhanden ist, darf das Element %1 nicht im Element %2 vorkommen.</translation> 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 @@ <source>Show All</source> <translation>Mostrar todo</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Preferencias…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Salir de %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>Acerca de %1</translation> + </message> </context> <context> <name>AudioOutput</name> 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 @@ <source>Show All</source> <translation>Tout afficher</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Préférences…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Quitter %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>À propos de %1</translation> + </message> </context> <context> <name>AudioOutput</name> 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 @@ <source>Show All</source> <translation>すべてを表示</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>環境設定...</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>%1 を終了</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>%1 について</translation> + </message> </context> <context> <name>CloseButton</name> 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 @@ <source>Show All</source> <translation>Pokaż wszystko</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Preferencje…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Zakończ %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>%1…</translation> + </message> </context> <context> <name>CloseButton</name> 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 @@ <source>Show All</source> <translation>Mostrar Tudo</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Preferências…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Encerrar %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>Sobre o %1</translation> + </message> </context> <context> <name>AudioOutput</name> 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 @@ <source>Show All</source> <translation>Показать все</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Настройки…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Завершить %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>О программе %1</translation> + </message> </context> <context> <name>CloseButton</name> 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 @@ <source>Show All</source> <translation>Visa alla</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>Inställningar…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>Avsluta %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>Om %1</translation> + </message> </context> <context> <name>AudioOutput</name> 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 @@ <source>Show All</source> <translation>全部显示</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>偏好设置…</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>退出 %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>关于 %1</translation> + </message> </context> <context> <name>AudioOutput</name> 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 @@ <source>Show All</source> <translation>顯示全部</translation> </message> + <message> + <location line="+1"/> + <source>Preferences...</source> + <translation>偏好設定⋯</translation> + </message> + <message> + <location line="+1"/> + <source>Quit %1</source> + <translation>結束 %1</translation> + </message> + <message> + <location line="+1"/> + <source>About %1</source> + <translation>關於 %1</translation> + </message> </context> <context> <name>AudioOutput</name> |