diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-01 02:17:47 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-01 02:17:47 (GMT) |
commit | 3733ee3ca9fdc964f2453089ca18c9179839846e (patch) | |
tree | 95cb7a51eb51f612611f48b44a51c23bcd0f8727 | |
parent | a16a6e6fb3cf9d9c70515d2361bc06c598c27f3f (diff) | |
parent | 8a2f4988afa8af09e4e8ed39d76c8eac0ba30390 (diff) | |
download | Qt-3733ee3ca9fdc964f2453089ca18c9179839846e.zip Qt-3733ee3ca9fdc964f2453089ca18c9179839846e.tar.gz Qt-3733ee3ca9fdc964f2453089ca18c9179839846e.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
47 files changed, 670 insertions, 574 deletions
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index d7aa0db..3d5c792 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1977,7 +1977,7 @@ distinction between shared and \section1 QMAKE_CFLAGS_WARN_OFF This variable is not empty if the warn_off - \l{#TEMPLATE}{TEMPLATE} option is specified. The value of this + \l{#CONFIG}{CONFIG} option is specified. The value of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. @@ -1985,7 +1985,7 @@ distinction between shared and \section1 QMAKE_CFLAGS_WARN_ON This variable is not empty if the warn_on - \l{#TEMPLATE}{TEMPLATE} option is specified. + \l{#CONFIG}{CONFIG} option is specified. The value of this variable is typically handled by \c qmake or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified. diff --git a/examples/dbus/dbus-chat/chat_adaptor.cpp b/examples/dbus/dbus-chat/chat_adaptor.cpp index dc07e1c..77e7ab0 100644 --- a/examples/dbus/dbus-chat/chat_adaptor.cpp +++ b/examples/dbus/dbus-chat/chat_adaptor.cpp @@ -38,10 +38,10 @@ ** $QT_END_LICENSE$ ** ** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -i chat_adaptor.h -a :chat_adaptor.cpp com.trolltech.chat.xml +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -i chat_adaptor.h -a :chat_adaptor.cpp com.trolltech.chat.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** This is an auto-generated file. ** Do not edit! All changes made to it will be lost. diff --git a/examples/dbus/dbus-chat/chat_adaptor.h b/examples/dbus/dbus-chat/chat_adaptor.h index b1e66ad..831c4f5 100644 --- a/examples/dbus/dbus-chat/chat_adaptor.h +++ b/examples/dbus/dbus-chat/chat_adaptor.h @@ -38,10 +38,10 @@ ** $QT_END_LICENSE$ ** ** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -a chat_adaptor.h: com.trolltech.chat.xml +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -a chat_adaptor.h: com.trolltech.chat.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** This is an auto-generated file. ** This file may have been hand-edited. Look for HAND-EDIT comments @@ -49,20 +49,17 @@ ** ****************************************************************************/ -#ifndef CHAT_ADAPTOR_H_142741156243605 -#define CHAT_ADAPTOR_H_142741156243605 +#ifndef CHAT_ADAPTOR_H_1257535021 +#define CHAT_ADAPTOR_H_1257535021 #include <QtCore/QObject> #include <QtDBus/QtDBus> - -QT_BEGIN_NAMESPACE class QByteArray; template<class T> class QList; template<class Key, class Value> class QMap; class QString; class QStringList; class QVariant; -QT_END_NAMESPACE /* * Adaptor class for interface com.trolltech.chat @@ -72,14 +69,14 @@ class ChatAdaptor: public QDBusAbstractAdaptor Q_OBJECT Q_CLASSINFO("D-Bus Interface", "com.trolltech.chat") Q_CLASSINFO("D-Bus Introspection", "" -" <interface name=\"com.trolltech.chat\" >\n" -" <signal name=\"message\" >\n" -" <arg direction=\"out\" type=\"s\" name=\"nickname\" />\n" -" <arg direction=\"out\" type=\"s\" name=\"text\" />\n" +" <interface name=\"com.trolltech.chat\">\n" +" <signal name=\"message\">\n" +" <arg direction=\"out\" type=\"s\" name=\"nickname\"/>\n" +" <arg direction=\"out\" type=\"s\" name=\"text\"/>\n" " </signal>\n" -" <signal name=\"action\" >\n" -" <arg direction=\"out\" type=\"s\" name=\"nickname\" />\n" -" <arg direction=\"out\" type=\"s\" name=\"text\" />\n" +" <signal name=\"action\">\n" +" <arg direction=\"out\" type=\"s\" name=\"nickname\"/>\n" +" <arg direction=\"out\" type=\"s\" name=\"text\"/>\n" " </signal>\n" " </interface>\n" "") diff --git a/examples/dbus/dbus-chat/chat_interface.cpp b/examples/dbus/dbus-chat/chat_interface.cpp index f187ee0..3aba098 100644 --- a/examples/dbus/dbus-chat/chat_interface.cpp +++ b/examples/dbus/dbus-chat/chat_interface.cpp @@ -38,10 +38,10 @@ ** $QT_END_LICENSE$ ** ** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -i chat_interface.h -p :chat_interface.cpp chat/com.trolltech.chat.xml +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -i chat_interface.h -p :chat_interface.cpp com.trolltech.chat.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** This is an auto-generated file. ** This file may have been hand-edited. Look for HAND-EDIT comments diff --git a/examples/dbus/dbus-chat/chat_interface.h b/examples/dbus/dbus-chat/chat_interface.h index 3bf427b..a6aa2df 100644 --- a/examples/dbus/dbus-chat/chat_interface.h +++ b/examples/dbus/dbus-chat/chat_interface.h @@ -38,18 +38,18 @@ ** $QT_END_LICENSE$ ** ** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -p chat_interface.h: com.trolltech.chat.xml +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -p chat_interface.h: com.trolltech.chat.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** This is an auto-generated file. ** Do not edit! All changes made to it will be lost. ** ****************************************************************************/ -#ifndef CHAT_INTERFACE_H_143021156243606 -#define CHAT_INTERFACE_H_143021156243606 +#ifndef CHAT_INTERFACE_H_1257535021 +#define CHAT_INTERFACE_H_1257535021 #include <QtCore/QObject> #include <QtCore/QByteArray> diff --git a/examples/dbus/remotecontrolledcar/car/car.pro b/examples/dbus/remotecontrolledcar/car/car.pro index 9b426d3..d362dc9 100644 --- a/examples/dbus/remotecontrolledcar/car/car.pro +++ b/examples/dbus/remotecontrolledcar/car/car.pro @@ -10,7 +10,7 @@ CONFIG += qdbus # Input # DBUS_ADAPTORS += car.xml -HEADERS += car.h car_adaptor_p.h +HEADERS += car.h car_adaptor.h SOURCES += car.cpp main.cpp car_adaptor.cpp # install diff --git a/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp b/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp index bd4832e..da7505b 100644 --- a/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp +++ b/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp @@ -38,17 +38,17 @@ ** $QT_END_LICENSE$ ** ** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -c CarAdaptor -a car_adaptor_p.h:car_adaptor.cpp car.xml +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -i car_adaptor.h -a :car_adaptor.cpp car.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** This is an auto-generated file. ** Do not edit! All changes made to it will be lost. ** ****************************************************************************/ -#include "car_adaptor_p.h" +#include "car_adaptor.h" #include <QtCore/QMetaObject> #include <QtCore/QByteArray> #include <QtCore/QList> @@ -58,40 +58,40 @@ #include <QtCore/QVariant> /* - * Implementation of adaptor class CarAdaptor + * Implementation of adaptor class CarInterfaceAdaptor */ -CarAdaptor::CarAdaptor(QObject *parent) +CarInterfaceAdaptor::CarInterfaceAdaptor(QObject *parent) : QDBusAbstractAdaptor(parent) { // constructor setAutoRelaySignals(true); } -CarAdaptor::~CarAdaptor() +CarInterfaceAdaptor::~CarInterfaceAdaptor() { // destructor } -void CarAdaptor::accelerate() +void CarInterfaceAdaptor::accelerate() { // handle method call com.trolltech.Examples.CarInterface.accelerate QMetaObject::invokeMethod(parent(), "accelerate"); } -void CarAdaptor::decelerate() +void CarInterfaceAdaptor::decelerate() { // handle method call com.trolltech.Examples.CarInterface.decelerate QMetaObject::invokeMethod(parent(), "decelerate"); } -void CarAdaptor::turnLeft() +void CarInterfaceAdaptor::turnLeft() { // handle method call com.trolltech.Examples.CarInterface.turnLeft QMetaObject::invokeMethod(parent(), "turnLeft"); } -void CarAdaptor::turnRight() +void CarInterfaceAdaptor::turnRight() { // handle method call com.trolltech.Examples.CarInterface.turnRight QMetaObject::invokeMethod(parent(), "turnRight"); diff --git a/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h b/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h deleted file mode 100644 index 5f769cd..0000000 --- a/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -c CarAdaptor -a car_adaptor_p.h:car_adaptor.cpp car.xml -** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** -** This is an auto-generated file. -** This file may have been hand-edited. Look for HAND-EDIT comments -** before re-generating it. -** -****************************************************************************/ - -#ifndef CAR_ADAPTOR_P_H_1157030132 -#define CAR_ADAPTOR_P_H_1157030132 - -#include <QtCore/QObject> -#include <QtDBus/QtDBus> - -QT_BEGIN_NAMESPACE -class QByteArray; -template<class T> class QList; -template<class Key, class Value> class QMap; -class QString; -class QStringList; -class QVariant; -QT_END_NAMESPACE - -/* - * Adaptor class for interface com.trolltech.Examples.CarInterface - */ -class CarAdaptor: public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "com.trolltech.Examples.CarInterface") - Q_CLASSINFO("D-Bus Introspection", "" -" <interface name=\"com.trolltech.Examples.CarInterface\" >\n" -" <method name=\"accelerate\" />\n" -" <method name=\"decelerate\" />\n" -" <method name=\"turnLeft\" />\n" -" <method name=\"turnRight\" />\n" -" <signal name=\"crashed\" />\n" -" </interface>\n" - "") -public: - CarAdaptor(QObject *parent); - virtual ~CarAdaptor(); - -public: // PROPERTIES -public Q_SLOTS: // METHODS - void accelerate(); - void decelerate(); - void turnLeft(); - void turnRight(); -Q_SIGNALS: // SIGNALS - void crashed(); -}; - -#endif diff --git a/examples/dbus/remotecontrolledcar/car/main.cpp b/examples/dbus/remotecontrolledcar/car/main.cpp index 85b206c..eab82a7 100644 --- a/examples/dbus/remotecontrolledcar/car/main.cpp +++ b/examples/dbus/remotecontrolledcar/car/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "car.h" -#include "car_adaptor_p.h" +#include "car_adaptor.h" #include <QtGui/QApplication> #include <QtGui/QGraphicsView> #include <QtGui/QGraphicsScene> @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) view.resize(400, 300); view.show(); - new CarAdaptor(car); + new CarInterfaceAdaptor(car); QDBusConnection connection = QDBusConnection::sessionBus(); connection.registerObject("/Car", car); connection.registerService("com.trolltech.CarExample"); diff --git a/examples/dbus/remotecontrolledcar/controller/car_interface.cpp b/examples/dbus/remotecontrolledcar/controller/car_interface.cpp index 01be1bf..5bc60e0 100644 --- a/examples/dbus/remotecontrolledcar/controller/car_interface.cpp +++ b/examples/dbus/remotecontrolledcar/controller/car_interface.cpp @@ -38,10 +38,10 @@ ** $QT_END_LICENSE$ ** ** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -c CarInterface -p car_interface_p.h:car_interface.cpp car.xml +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -i car_interface.h -p :car_interface.cpp car.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** ** This is an auto-generated file. ** This file may have been hand-edited. Look for HAND-EDIT comments @@ -49,18 +49,17 @@ ** ****************************************************************************/ -#include "car_interface_p.h" - +#include "car_interface.h" /* - * Implementation of interface class CarInterface + * Implementation of interface class ComTrolltechExamplesCarInterfaceInterface */ -CarInterface::CarInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) +ComTrolltechExamplesCarInterfaceInterface::ComTrolltechExamplesCarInterfaceInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) { } -CarInterface::~CarInterface() +ComTrolltechExamplesCarInterfaceInterface::~ComTrolltechExamplesCarInterfaceInterface() { } diff --git a/examples/dbus/remotecontrolledcar/controller/car_interface_p.h b/examples/dbus/remotecontrolledcar/controller/car_interface_p.h deleted file mode 100644 index 8a5a907..0000000 --- a/examples/dbus/remotecontrolledcar/controller/car_interface_p.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples 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$ -** -** -** This file was generated by dbusxml2cpp version 0.6 -** Command line was: dbusxml2cpp -c CarInterface -p car_interface_p.h:car_interface.cpp car.xml -** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -** -****************************************************************************/ - -#ifndef CAR_INTERFACE_P_H_1156853585 -#define CAR_INTERFACE_P_H_1156853585 - -#include <QtCore/QObject> -#include <QtCore/QByteArray> -#include <QtCore/QList> -#include <QtCore/QMap> -#include <QtCore/QString> -#include <QtCore/QStringList> -#include <QtCore/QVariant> -#include <QtDBus/QtDBus> - -/* - * Proxy class for interface com.trolltech.Examples.CarInterface - */ -class CarInterface: public QDBusAbstractInterface -{ - Q_OBJECT -public: - static inline const char *staticInterfaceName() - { return "com.trolltech.Examples.CarInterface"; } - -public: - CarInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); - - ~CarInterface(); - -public Q_SLOTS: // METHODS - inline QDBusReply<void> accelerate() - { - QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("accelerate"), argumentList); - } - - inline QDBusReply<void> decelerate() - { - QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("decelerate"), argumentList); - } - - inline QDBusReply<void> turnLeft() - { - QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("turnLeft"), argumentList); - } - - inline QDBusReply<void> turnRight() - { - QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("turnRight"), argumentList); - } - -Q_SIGNALS: // SIGNALS - void crashed(); -}; - -namespace com { - namespace trolltech { - namespace Examples { - typedef ::CarInterface CarInterface; - } - } -} -#endif diff --git a/examples/dbus/remotecontrolledcar/controller/controller.cpp b/examples/dbus/remotecontrolledcar/controller/controller.cpp index 00a8875..5fca9e3 100644 --- a/examples/dbus/remotecontrolledcar/controller/controller.cpp +++ b/examples/dbus/remotecontrolledcar/controller/controller.cpp @@ -42,13 +42,13 @@ #include <QtGui> #include "controller.h" -#include "car_interface_p.h" +#include "car_interface.h" Controller::Controller(QWidget *parent) : QWidget(parent) { ui.setupUi(this); - car = new CarInterface("com.trolltech.CarExample", "/Car", + car = new com::trolltech::Examples::CarInterface("com.trolltech.CarExample", "/Car", QDBusConnection::sessionBus(), this); startTimer(1000); } diff --git a/examples/dbus/remotecontrolledcar/controller/controller.h b/examples/dbus/remotecontrolledcar/controller/controller.h index 07a1355..caadff9 100644 --- a/examples/dbus/remotecontrolledcar/controller/controller.h +++ b/examples/dbus/remotecontrolledcar/controller/controller.h @@ -43,8 +43,7 @@ #define CONTROLLER_H #include "ui_controller.h" - -class CarInterface; +#include "car_interface.h" class Controller : public QWidget { @@ -64,7 +63,7 @@ private slots: private: Ui::Controller ui; - CarInterface *car; + com::trolltech::Examples::CarInterface *car; }; #endif diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro index 159e3b1..375b9d7 100644 --- a/examples/dbus/remotecontrolledcar/controller/controller.pro +++ b/examples/dbus/remotecontrolledcar/controller/controller.pro @@ -11,7 +11,7 @@ CONFIG += qdbus # Input # DBUS_INTERFACES += car.xml FORMS += controller.ui -HEADERS += car_interface_p.h controller.h +HEADERS += car_interface.h controller.h SOURCES += main.cpp car_interface.cpp controller.cpp # install diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp index e90529e..625098e 100644 --- a/src/corelib/io/qfileinfo.cpp +++ b/src/corelib/io/qfileinfo.cpp @@ -41,12 +41,8 @@ #include "qplatformdefs.h" #include "qfileinfo.h" -#include "qdatetime.h" -#include "qabstractfileengine.h" #include "qfsfileengine_p.h" #include "qglobal.h" -#include "qatomic.h" -#include "qhash.h" #include "qdir.h" #include "qfileinfo_p.h" @@ -54,7 +50,7 @@ QT_BEGIN_NAMESPACE QFileInfoPrivate::QFileInfoPrivate(const QFileInfo *copy) { - if(copy) { + if (copy) { copy->d_func()->data->ref.ref(); data = copy->d_func()->data; } else { @@ -81,7 +77,8 @@ void QFileInfoPrivate::initFileEngine(const QString &file) bool QFileInfoPrivate::hasAccess(Access access) const { - if (!(getFileFlags(QAbstractFileEngine::FileInfoAll) & QAbstractFileEngine::LocalDiskFlag)) { + if (!(getFileFlags(QAbstractFileEngine::PermsMask + | QAbstractFileEngine::LocalDiskFlag) & QAbstractFileEngine::LocalDiskFlag)) { switch (access) { case ReadAccess: return getFileFlags(QAbstractFileEngine::ReadUserPerm); @@ -129,86 +126,104 @@ void QFileInfoPrivate::detach() QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const { - if(data->cache_enabled && !data->fileNames[(int)name].isNull()) + if (data->cache_enabled && !data->fileNames[(int)name].isNull()) return data->fileNames[(int)name]; QString ret = data->fileEngine->fileName(name); - if(data->cache_enabled) + if (ret.isNull()) + ret = QLatin1String(""); + if (data->cache_enabled) data->fileNames[(int)name] = ret; return ret; } +QString QFileInfoPrivate::getFileOwner(QAbstractFileEngine::FileOwner own) const +{ + if (data->cache_enabled && !data->fileOwners[(int)own].isNull()) + return data->fileOwners[(int)own]; + QString ret = data->fileEngine->owner(own); + if (ret.isNull()) + ret = QLatin1String(""); + if (data->cache_enabled) + data->fileOwners[(int)own] = ret; + return ret; +} + uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) const { - // We split the testing into tests for for LinkType, BundleType and the rest. + // We split the testing into tests for for LinkType, BundleType, PermsMask + // and the rest. + // Tests for file permissions on Windows can be slow, expecially on network + // paths and NTFS drives. // In order to determine if a file is a symlink or not, we have to lstat(). // If we're not interested in that information, we might as well avoid one // extra syscall. Bundle detecton on Mac can be slow, expecially on network // paths, so we separate out that as well. - QAbstractFileEngine::FileFlags flags; - if (!data->getCachedFlag(CachedFileFlags)) { - QAbstractFileEngine::FileFlags req = QAbstractFileEngine::FileInfoAll; - req &= (~QAbstractFileEngine::LinkType); - req &= (~QAbstractFileEngine::BundleType); + QAbstractFileEngine::FileFlags req = 0; + uint cachedFlags = 0; - flags = data->fileEngine->fileFlags(req); - data->setCachedFlag(CachedFileFlags); - data->fileFlags |= uint(flags); - } else { - flags = QAbstractFileEngine::FileFlags(data->fileFlags & request); - } + if (request & (QAbstractFileEngine::FlagsMask | QAbstractFileEngine::TypesMask)) { + if (!data->getCachedFlag(CachedFileFlags)) { + req |= QAbstractFileEngine::FlagsMask; + req |= QAbstractFileEngine::TypesMask; + req &= (~QAbstractFileEngine::LinkType); + req &= (~QAbstractFileEngine::BundleType); - if (request & QAbstractFileEngine::LinkType) { - if (!data->getCachedFlag(CachedLinkTypeFlag)) { - QAbstractFileEngine::FileFlags linkflag; - linkflag = data->fileEngine->fileFlags(QAbstractFileEngine::LinkType); + cachedFlags |= CachedFileFlags; + } - data->setCachedFlag(CachedLinkTypeFlag); - data->fileFlags |= uint(linkflag); - flags |= linkflag; + if (request & QAbstractFileEngine::LinkType) { + if (!data->getCachedFlag(CachedLinkTypeFlag)) { + req |= QAbstractFileEngine::LinkType; + cachedFlags |= CachedLinkTypeFlag; + } } - } - if (request & QAbstractFileEngine::BundleType) { - if (!data->getCachedFlag(CachedBundleTypeFlag)) { - QAbstractFileEngine::FileFlags bundleflag; - bundleflag = data->fileEngine->fileFlags(QAbstractFileEngine::BundleType); + if (request & QAbstractFileEngine::BundleType) { + if (!data->getCachedFlag(CachedBundleTypeFlag)) { + req |= QAbstractFileEngine::BundleType; + cachedFlags |= CachedBundleTypeFlag; + } + } + } - data->setCachedFlag(CachedBundleTypeFlag); - data->fileFlags |= uint(bundleflag); - flags |= bundleflag; + if (request & QAbstractFileEngine::PermsMask) { + if (!data->getCachedFlag(CachedPerms)) { + req |= QAbstractFileEngine::PermsMask; + cachedFlags |= CachedPerms; } } - // no else branch - // if we had it cached, it was caught in the previous else branch + if (req) { + if (data->cache_enabled) + req &= (~QAbstractFileEngine::Refresh); + else + req |= QAbstractFileEngine::Refresh; - return flags & request; + QAbstractFileEngine::FileFlags flags = data->fileEngine->fileFlags(req); + data->fileFlags |= uint(flags); + data->setCachedFlag(cachedFlags); + } + + return data->fileFlags & request; } QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) const { if (!data->cache_enabled) data->clearFlags(); - if(request == QAbstractFileEngine::CreationTime) { - if(data->getCachedFlag(CachedCTime)) - return data->fileTimes[request]; - data->setCachedFlag(CachedCTime); - return (data->fileTimes[request] = data->fileEngine->fileTime(request)); + uint cf; + if (request == QAbstractFileEngine::CreationTime) + cf = CachedCTime; + else if (request == QAbstractFileEngine::ModificationTime) + cf = CachedMTime; + else + cf = CachedATime; + if (!data->getCachedFlag(cf)) { + data->fileTimes[request] = data->fileEngine->fileTime(request); + data->setCachedFlag(cf); } - if(request == QAbstractFileEngine::ModificationTime) { - if(data->getCachedFlag(CachedMTime)) - return data->fileTimes[request]; - data->setCachedFlag(CachedMTime); - return (data->fileTimes[request] = data->fileEngine->fileTime(request)); - } - if(request == QAbstractFileEngine::AccessTime) { - if(data->getCachedFlag(CachedATime)) - return data->fileTimes[request]; - data->setCachedFlag(CachedATime); - return (data->fileTimes[request] = data->fileEngine->fileTime(request)); - } - return data->fileTimes[0]; //cannot really happen + return data->fileTimes[request]; } //************* QFileInfo @@ -305,7 +320,6 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) \sa setFile() */ - QFileInfo::QFileInfo() : d_ptr(new QFileInfoPrivate()) { } @@ -316,7 +330,6 @@ QFileInfo::QFileInfo() : d_ptr(new QFileInfoPrivate()) \sa setFile(), isRelative(), QDir::setCurrent(), QDir::isRelativePath() */ - QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate()) { d_ptr->initFileEngine(file); @@ -331,7 +344,6 @@ QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate()) \sa isRelative() */ - QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate()) { d_ptr->initFileEngine(file.fileName()); @@ -349,7 +361,6 @@ QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate()) \sa isRelative() */ - QFileInfo::QFileInfo(const QDir &dir, const QString &file) : d_ptr(new QFileInfoPrivate()) { d_ptr->initFileEngine(dir.filePath(file)); @@ -358,7 +369,6 @@ QFileInfo::QFileInfo(const QDir &dir, const QString &file) : d_ptr(new QFileInfo /*! Constructs a new QFileInfo that is a copy of the given \a fileinfo. */ - QFileInfo::QFileInfo(const QFileInfo &fileinfo) : d_ptr(new QFileInfoPrivate(&fileinfo)) { @@ -368,7 +378,6 @@ QFileInfo::QFileInfo(const QFileInfo &fileinfo) : d_ptr(new QFileInfoPrivate(&fi Destroys the QFileInfo and frees its resources. */ - QFileInfo::~QFileInfo() { } @@ -395,19 +404,19 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) const Q_D(const QFileInfo); // ### Qt 5: understand long and short file names on Windows // ### (GetFullPathName()). - if(fileinfo.d_func()->data == d->data) + if (fileinfo.d_func()->data == d->data) return true; - if(!d->data->fileEngine || !fileinfo.d_func()->data->fileEngine) + if (!d->data->fileEngine || !fileinfo.d_func()->data->fileEngine) return false; - if(d->data->fileEngine->caseSensitive() != fileinfo.d_func()->data->fileEngine->caseSensitive()) + if (d->data->fileEngine->caseSensitive() != fileinfo.d_func()->data->fileEngine->caseSensitive()) return false; - if(fileinfo.size() == size()) { //if the size isn't the same... + if (fileinfo.size() == size()) { //if the size isn't the same... QString file1 = canonicalFilePath(), file2 = fileinfo.canonicalFilePath(); - if(file1.length() == file2.length()) { - if(!fileinfo.d_func()->data->fileEngine->caseSensitive()) { - for(int i = 0; i < file1.length(); i++) { - if(file1.at(i).toLower() != file2.at(i).toLower()) + if (file1.length() == file2.length()) { + if (!fileinfo.d_func()->data->fileEngine->caseSensitive()) { + for (int i = 0; i < file1.length(); i++) { + if (file1.at(i).toLower() != file2.at(i).toLower()) return false; } return true; @@ -441,7 +450,6 @@ bool QFileInfo::operator==(const QFileInfo &fileinfo) /*! Makes a copy of the given \a fileinfo and assigns it to this QFileInfo. */ - QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) { Q_D(QFileInfo); @@ -464,7 +472,6 @@ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) \sa isRelative(), QDir::setCurrent(), QDir::isRelativePath() */ - void QFileInfo::setFile(const QString &file) { *this = QFileInfo(file); @@ -481,7 +488,6 @@ void QFileInfo::setFile(const QString &file) \sa isRelative() */ - void QFileInfo::setFile(const QFile &file) { *this = QFileInfo(file.fileName()); @@ -498,7 +504,6 @@ void QFileInfo::setFile(const QFile &file) \sa isRelative() */ - void QFileInfo::setFile(const QDir &dir, const QString &file) { *this = QFileInfo(dir.filePath(file)); @@ -528,25 +533,24 @@ void QFileInfo::setFile(const QDir &dir, const QString &file) QString QFileInfo::absoluteFilePath() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::AbsoluteName); } /*! - Returns the canonical path including the file name, i.e. an absolute - path without symbolic links or redundant "." or ".." elements. + Returns the canonical path including the file name, i.e. an absolute + path without symbolic links or redundant "." or ".." elements. - If the file does not exist, canonicalFilePath() returns an empty - string. + If the file does not exist, canonicalFilePath() returns an empty + string. - \sa filePath(), absoluteFilePath(), dir() + \sa filePath(), absoluteFilePath(), dir() */ - QString QFileInfo::canonicalFilePath() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::CanonicalName); } @@ -569,7 +573,6 @@ QString QFileInfo::canonicalFilePath() const \sa absoluteFilePath(), path(), canonicalPath(), fileName(), isRelative() */ - QString QFileInfo::absolutePath() const { Q_D(const QFileInfo); @@ -591,16 +594,14 @@ QString QFileInfo::absolutePath() const \sa path(), absolutePath() */ - QString QFileInfo::canonicalPath() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::CanonicalPathName); } - /*! Returns the file's path. This doesn't include the file name. @@ -610,11 +611,10 @@ QString QFileInfo::canonicalPath() const \sa filePath(), absolutePath(), canonicalPath(), dir(), fileName(), isRelative() */ - QString QFileInfo::path() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::PathName); } @@ -635,16 +635,14 @@ QString QFileInfo::path() const \sa isAbsolute() */ - bool QFileInfo::isRelative() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return true; return d->data->fileEngine->isRelativePath(); } - /*! Converts the file's path to an absolute path if it is not already in that form. Returns true to indicate that the path was converted; otherwise returns false @@ -652,11 +650,10 @@ bool QFileInfo::isRelative() const \sa filePath(), isRelative() */ - bool QFileInfo::makeAbsolute() { Q_D(QFileInfo); - if(!d->data->fileEngine || !d->data->fileEngine->isRelativePath()) + if (!d->data->fileEngine || !d->data->fileEngine->isRelativePath()) return false; QString absFileName = d->getFileName(QAbstractFileEngine::AbsoluteName); d->initFileEngine(absFileName); @@ -669,11 +666,10 @@ bool QFileInfo::makeAbsolute() \note If the file is a symlink that points to a non existing file, false is returned. */ - bool QFileInfo::exists() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::ExistsFlag); } @@ -685,7 +681,6 @@ bool QFileInfo::exists() const \note On Windows CE, there might be a delay for the file system driver to detect changes on the file. */ - void QFileInfo::refresh() { Q_D(QFileInfo); @@ -698,11 +693,10 @@ void QFileInfo::refresh() \sa absoluteFilePath(), canonicalFilePath(), isRelative() */ - QString QFileInfo::filePath() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::DefaultName); } @@ -718,11 +712,10 @@ QString QFileInfo::filePath() const \sa isRelative(), filePath(), baseName(), extension() */ - QString QFileInfo::fileName() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::BaseName); } @@ -739,11 +732,10 @@ QString QFileInfo::fileName() const \sa isBundle(), filePath(), baseName(), extension() */ - QString QFileInfo::bundleName() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::BundleName); } @@ -764,11 +756,10 @@ QString QFileInfo::bundleName() const \sa fileName(), suffix(), completeSuffix(), completeBaseName() */ - QString QFileInfo::baseName() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::BaseName).section(QLatin1Char('.'), 0, 0); } @@ -784,11 +775,10 @@ QString QFileInfo::baseName() const \sa fileName(), suffix(), completeSuffix(), baseName() */ - QString QFileInfo::completeBaseName() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); QString name = d->getFileName(QAbstractFileEngine::BaseName); int index = name.lastIndexOf(QLatin1Char('.')); @@ -806,11 +796,10 @@ QString QFileInfo::completeBaseName() const \sa fileName(), suffix(), baseName(), completeBaseName() */ - QString QFileInfo::completeSuffix() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); QString fileName = d->getFileName(QAbstractFileEngine::BaseName); int firstDot = fileName.indexOf(QLatin1Char('.')); @@ -834,11 +823,10 @@ QString QFileInfo::completeSuffix() const \sa fileName(), completeSuffix(), baseName(), completeBaseName() */ - QString QFileInfo::suffix() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); QString fileName = d->getFileName(QAbstractFileEngine::BaseName); int lastDot = fileName.lastIndexOf(QLatin1Char('.')); @@ -849,24 +837,23 @@ QString QFileInfo::suffix() const /*! - Returns the path of the object's parent directory as a QDir object. + Returns the path of the object's parent directory as a QDir object. - \bold{Note:} The QDir returned always corresponds to the object's - parent directory, even if the QFileInfo represents a directory. + \bold{Note:} The QDir returned always corresponds to the object's + parent directory, even if the QFileInfo represents a directory. - For each of the follwing, dir() returns a QDir for - \c{"~/examples/191697"}. + For each of the follwing, dir() returns a QDir for + \c{"~/examples/191697"}. - \snippet doc/src/snippets/fileinfo/main.cpp 0 + \snippet doc/src/snippets/fileinfo/main.cpp 0 - For each of the follwing, dir() returns a QDir for - \c{"."}. + For each of the follwing, dir() returns a QDir for + \c{"."}. - \snippet doc/src/snippets/fileinfo/main.cpp 1 + \snippet doc/src/snippets/fileinfo/main.cpp 1 - \sa absolutePath(), filePath(), fileName(), isRelative(), absoluteDir() + \sa absolutePath(), filePath(), fileName(), isRelative(), absoluteDir() */ - QDir QFileInfo::dir() const { // ### Qt5: Maybe rename this to parentDirectory(), considering what it actually do? @@ -878,7 +865,6 @@ QDir QFileInfo::dir() const \sa dir(), filePath(), fileName(), isRelative() */ - QDir QFileInfo::absoluteDir() const { return QDir(absolutePath()); @@ -891,7 +877,7 @@ QDir QFileInfo::absoluteDir() const */ QDir QFileInfo::dir(bool absPath) const { - if(absPath) + if (absPath) return absoluteDir(); return dir(); } @@ -902,11 +888,10 @@ QDir QFileInfo::dir(bool absPath) const \sa isWritable(), isExecutable(), permission() */ - bool QFileInfo::isReadable() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->hasAccess(QFileInfoPrivate::ReadAccess); } @@ -916,11 +901,10 @@ bool QFileInfo::isReadable() const \sa isReadable(), isExecutable(), permission() */ - bool QFileInfo::isWritable() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->hasAccess(QFileInfoPrivate::WriteAccess); } @@ -930,11 +914,10 @@ bool QFileInfo::isWritable() const \sa isReadable(), isWritable(), permission() */ - bool QFileInfo::isExecutable() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->hasAccess(QFileInfoPrivate::ExecuteAccess); } @@ -948,7 +931,7 @@ bool QFileInfo::isExecutable() const bool QFileInfo::isHidden() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::HiddenFlag); } @@ -960,11 +943,10 @@ bool QFileInfo::isHidden() const \sa isDir(), isSymLink(), isBundle() */ - bool QFileInfo::isFile() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::FileType); } @@ -975,11 +957,10 @@ bool QFileInfo::isFile() const \sa isFile(), isSymLink(), isBundle() */ - bool QFileInfo::isDir() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::DirectoryType); } @@ -992,11 +973,10 @@ bool QFileInfo::isDir() const \sa isDir(), isSymLink(), isFile() */ - bool QFileInfo::isBundle() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::BundleType); } @@ -1018,21 +998,19 @@ bool QFileInfo::isBundle() const \sa isFile(), isDir(), symLinkTarget() */ - bool QFileInfo::isSymLink() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::LinkType); } /*! - Returns true if the object points to a directory or to a symbolic - link to a directory, and that directory is the root directory; otherwise - returns false. + Returns true if the object points to a directory or to a symbolic + link to a directory, and that directory is the root directory; otherwise + returns false. */ - bool QFileInfo::isRoot() const { Q_D(const QFileInfo); @@ -1064,7 +1042,7 @@ bool QFileInfo::isRoot() const QString QFileInfo::readLink() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); return d->getFileName(QAbstractFileEngine::LinkName); } @@ -1079,13 +1057,12 @@ QString QFileInfo::readLink() const \sa ownerId(), group(), groupId() */ - QString QFileInfo::owner() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); - return d->data->fileEngine->owner(QAbstractFileEngine::OwnerUser); + return d->getFileOwner(QAbstractFileEngine::OwnerUser); } /*! @@ -1096,11 +1073,10 @@ QString QFileInfo::owner() const \sa owner(), group(), groupId() */ - uint QFileInfo::ownerId() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return 0; return d->data->fileEngine->ownerId(QAbstractFileEngine::OwnerUser); } @@ -1115,13 +1091,12 @@ uint QFileInfo::ownerId() const \sa groupId(), owner(), ownerId() */ - QString QFileInfo::group() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QLatin1String(""); - return d->data->fileEngine->owner(QAbstractFileEngine::OwnerGroup); + return d->getFileOwner(QAbstractFileEngine::OwnerGroup); } /*! @@ -1132,11 +1107,10 @@ QString QFileInfo::group() const \sa group(), owner(), ownerId() */ - uint QFileInfo::groupId() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return 0; return d->data->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup); } @@ -1154,11 +1128,10 @@ uint QFileInfo::groupId() const \sa isReadable(), isWritable(), isExecutable() */ - bool QFileInfo::permission(QFile::Permissions permissions) const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return false; return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; } @@ -1167,11 +1140,10 @@ bool QFileInfo::permission(QFile::Permissions permissions) const Returns the complete OR-ed together combination of QFile::Permissions for the file. */ - QFile::Permissions QFileInfo::permissions() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return 0; return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); } @@ -1183,13 +1155,12 @@ QFile::Permissions QFileInfo::permissions() const \sa exists() */ - qint64 QFileInfo::size() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return 0; - if(!d->data->getCachedFlag(QFileInfoPrivate::CachedSize)) { + if (!d->data->getCachedFlag(QFileInfoPrivate::CachedSize)) { d->data->setCachedFlag(QFileInfoPrivate::CachedSize); d->data->fileSize = d->data->fileEngine->size(); } @@ -1209,11 +1180,10 @@ qint64 QFileInfo::size() const \sa lastModified() lastRead() */ - QDateTime QFileInfo::created() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QDateTime(); return d->getFileTime(QAbstractFileEngine::CreationTime); } @@ -1223,11 +1193,10 @@ QDateTime QFileInfo::created() const \sa created() lastRead() */ - QDateTime QFileInfo::lastModified() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QDateTime(); return d->getFileTime(QAbstractFileEngine::ModificationTime); } @@ -1240,11 +1209,10 @@ QDateTime QFileInfo::lastModified() const \sa created() lastModified() */ - QDateTime QFileInfo::lastRead() const { Q_D(const QFileInfo); - if(!d->data->fileEngine) + if (!d->data->fileEngine) return QDateTime(); return d->getFileTime(QAbstractFileEngine::AccessTime); } @@ -1252,7 +1220,6 @@ QDateTime QFileInfo::lastRead() const /*! \internal Detaches all internal data. */ - void QFileInfo::detach() { Q_D(QFileInfo); @@ -1264,7 +1231,6 @@ void QFileInfo::detach() \sa setCaching(), refresh() */ - bool QFileInfo::caching() const { Q_D(const QFileInfo); @@ -1283,7 +1249,6 @@ bool QFileInfo::caching() const \sa refresh(), caching() */ - void QFileInfo::setCaching(bool enable) { Q_D(QFileInfo); diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index 065f860..d97a0cf 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -54,6 +54,9 @@ // #include "qfileinfo.h" +#include "qabstractfileengine.h" +#include "qdatetime.h" +#include "qatomic.h" QT_BEGIN_NAMESPACE @@ -75,35 +78,41 @@ public: uint getFileFlags(QAbstractFileEngine::FileFlags) const; QDateTime &getFileTime(QAbstractFileEngine::FileTime) const; QString getFileName(QAbstractFileEngine::FileName) const; + QString getFileOwner(QAbstractFileEngine::FileOwner own) const; enum { CachedFileFlags=0x01, CachedLinkTypeFlag=0x02, CachedBundleTypeFlag=0x04, CachedMTime=0x10, CachedCTime=0x20, CachedATime=0x40, - CachedSize =0x08 }; + CachedSize =0x08, CachedPerms=0x80 }; struct Data { inline Data() - : ref(1), fileEngine(0), cache_enabled(1), fileSize(0) - { clear(); } + : ref(1), fileEngine(0), + cachedFlags(0), cache_enabled(1), fileFlags(0), fileSize(0) + {} inline Data(const Data ©) : ref(1), fileEngine(QAbstractFileEngine::create(copy.fileName)), - fileName(copy.fileName), cache_enabled(copy.cache_enabled), fileSize(copy.fileSize) - { clear(); } + fileName(copy.fileName), + cachedFlags(0), cache_enabled(copy.cache_enabled), fileFlags(0), fileSize(0) + {} inline ~Data() { delete fileEngine; } inline void clearFlags() { fileFlags = 0; cachedFlags = 0; if (fileEngine) - (void)fileEngine->fileFlags(QFSFileEngine::Refresh); + (void)fileEngine->fileFlags(QAbstractFileEngine::Refresh); } inline void clear() { clearFlags(); for (int i = QAbstractFileEngine::NFileNames - 1 ; i >= 0 ; --i) fileNames[i].clear(); + fileOwners[1].clear(); + fileOwners[0].clear(); } mutable QAtomicInt ref; QAbstractFileEngine *fileEngine; mutable QString fileName; mutable QString fileNames[QAbstractFileEngine::NFileNames]; + mutable QString fileOwners[2]; mutable uint cachedFlags : 31; mutable uint cache_enabled : 1; diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 3f69b4f..d177b26 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -331,7 +331,7 @@ QEvent::~QEvent() equivalent of calling setAccepted(false). Clearing the accept parameter indicates that the event receiver - does not want the event. Unwanted events might be propgated to the + does not want the event. Unwanted events might be propagated to the parent widget. \sa accept() diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index d391893..be1b2ae 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -492,10 +492,14 @@ static inline int indexOfMethodRelative(const QMetaObject **baseObject, const char *method, bool normalizeStringData) { - while (*baseObject) { + const QMetaObject *m; + for (m = *baseObject; m; m = *baseObject = m->d.superdata) { const QMetaObject *const m = *baseObject; int i = (MethodType == MethodSignal && priv(m->d.data)->revision >= 4) ? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1); + if (i < 0) + continue; + const int end = (MethodType == MethodSlot && priv(m->d.data)->revision >= 4) ? (priv(m->d.data)->signalCount) : 0; if (!normalizeStringData) { @@ -513,7 +517,6 @@ static inline int indexOfMethodRelative(const QMetaObject **baseObject, return i; } } - *baseObject = m->d.superdata; } return -1; } diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index 4b0f488..e9bdf57 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -404,7 +404,17 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r */ QString QtPrivate::QStringList_join(const QStringList *that, const QString &sep) { + int totalLength = 0; + const int size = that->size(); + + for (int i = 0; i < size; ++i) + totalLength += that->at(i).size(); + + if(size > 0) + totalLength += sep.size() * (size - 1); + QString res; + res.reserve(totalLength); for (int i = 0; i < that->size(); ++i) { if (i) res += sep; diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index e72194e..961a3f6 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1337,12 +1337,39 @@ void QApplication::setMainWidget(QWidget *mainWidget) /***************************************************************************** QApplication cursor stack *****************************************************************************/ +#ifdef QT_MAC_USE_COCOA +void QApplicationPrivate::disableUsageOfCursorRects(bool disable) +{ + // In Cocoa there are two competing ways of setting the cursor; either + // by using cursor rects (see qcocoaview_mac.mm), or by pushing/popping + // the cursor manually. When we use override cursors, it makes most sense + // to use the latter. But then we need to tell cocoa to stop using the + // first approach so it doesn't change the cursor back when hovering over + // a cursor rect: + QWidgetList topLevels = qApp->topLevelWidgets(); + for (int i=0; i<topLevels.size(); ++i) { + if (NSWindow *window = qt_mac_window_for(topLevels.at(i))) + disable ? [window disableCursorRects] : [window enableCursorRects]; + } +} + +void QApplicationPrivate::updateOverrideCursor() +{ + // Sometimes Cocoa forgets that we have set a Cursor + // manually. In those cases, remind it again: + if (QCursor *override = qApp->overrideCursor()) + [static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(*override)) set]; +} +#endif + void QApplication::setOverrideCursor(const QCursor &cursor) { qApp->d_func()->cursor_list.prepend(cursor); #ifdef QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; + if (qApp->d_func()->cursor_list.size() == 1) + qApp->d_func()->disableUsageOfCursorRects(true); [static_cast<NSCursor *>(qt_mac_nsCursorForQCursor(cursor)) push]; #else if (qApp && qApp->activeWindow()) @@ -1359,6 +1386,8 @@ void QApplication::restoreOverrideCursor() #ifdef QT_MAC_USE_COCOA QMacCocoaAutoReleasePool pool; [NSCursor pop]; + if (qApp->d_func()->cursor_list.isEmpty()) + qApp->d_func()->disableUsageOfCursorRects(false); #else if (qApp && qApp->activeWindow()) { const QCursor def(Qt::ArrowCursor); @@ -2432,6 +2461,12 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event } #ifdef QT_MAC_USE_COCOA +void QApplicationPrivate::qt_initAfterNSAppStarted() +{ + setupAppleEvents(); + updateOverrideCursor(); +} + void QApplicationPrivate::setupAppleEvents() { // This function is called from the event dispatcher when NSApplication has @@ -2444,7 +2479,6 @@ void QApplicationPrivate::setupAppleEvents() forEventClass:kCoreEventClass andEventID:kAEQuitApplication]; [eventManager setEventHandler:newDelegate andSelector:@selector(getUrl:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; - } #endif @@ -2995,7 +3029,7 @@ void onApplicationWindowChangedActivation(QWidget *widget, bool activated) } QMenuBar::macUpdateMenuBar(); - + QApplicationPrivate::updateOverrideCursor(); #else Q_UNUSED(widget); Q_UNUSED(activated); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index a796048..59565d4 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -458,7 +458,10 @@ public: static OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long); static OSStatus tabletProximityCallback(EventHandlerCallRef, EventRef, void *); #ifdef QT_MAC_USE_COCOA + static void qt_initAfterNSAppStarted(); static void setupAppleEvents(); + static void updateOverrideCursor(); + static void disableUsageOfCursorRects(bool disable); #endif static bool qt_mac_apply_settings(); #endif diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index b4bb8bf..8c5d166 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -602,6 +602,8 @@ extern "C" { - (void)mouseEntered:(NSEvent *)event { + if (qwidgetprivate->data.in_destructor) + return; QEvent enterEvent(QEvent::Enter); NSPoint windowPoint = [event locationInWindow]; NSPoint globalPoint = [[event window] convertBaseToScreen:windowPoint]; diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 84d37ae..2a1da41 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -1049,7 +1049,7 @@ void QEventDispatcherMacPrivate::firstLoopEntry(CFRunLoopObserverRef ref, Q_UNUSED(ref); Q_UNUSED(activity); #ifdef QT_MAC_USE_COCOA - QApplicationPrivate::setupAppleEvents(); + QApplicationPrivate::qt_initAfterNSAppStarted(); #endif processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents); } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index e0dcaef..13c25fd 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -143,6 +143,9 @@ extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds) { +#ifdef QT_MAC_USE_COCOA + QMacCocoaAutoReleasePool pool; +#endif OSWindowRef wnd = static_cast<OSWindowRef>(window); if (wnd) { QWidget *widget; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 20c0cde..3ff46f5 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2311,6 +2311,9 @@ void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWin q->setAttribute(Qt::WA_WState_WindowOpacitySet, false); } + if (qApp->overrideCursor()) + [windowRef disableCursorRects]; + setWindowLevel(); macUpdateHideOnSuspend(); macUpdateOpaqueSizeGrip(); @@ -3576,6 +3579,8 @@ void QWidgetPrivate::hide_sys() if (!QWidget::mouseGrabber()){ QWidget *enterWidget = QApplication::widgetAt(QCursor::pos()); + if (enterWidget && enterWidget->data->in_destructor) + enterWidget = 0; QApplicationPrivate::dispatchEnterLeave(enterWidget, qt_mouseover); qt_mouseover = enterWidget; } diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 083f730..2313ac5 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -4320,8 +4320,6 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, rect.setY(0); rect.setHeight(widget->height()); } - if (opt->direction == Qt::RightToLeft) - rect.adjust(15, 0, -20, 0); } break; case SE_ProgressBarGroove: diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index 092efc5..19b4669 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -105,8 +105,8 @@ public: The values supported by the the device for each of these parameters can be fetched with - supportedByteOrders(), supportedChannels(), supportedCodecs(), - supportedFrequencies(), supportedSampleSizes(), and + supportedByteOrders(), supportedChannelCounts(), supportedCodecs(), + supportedSampleRates(), supportedSampleSizes(), and supportedSampleTypes(). The combinations supported are dependent on the platform, audio plugins installed and the audio device capabilities. If you need a specific format, you can check if the device supports it with isFormatSupported(), or fetch a @@ -259,7 +259,18 @@ QStringList QAudioDeviceInfo::supportedCodecs() const } /*! - Returns a list of supported frequencies. + Returns a list of supported sample rates. +*/ + +QList<int> QAudioDeviceInfo::supportedSampleRates() const +{ + return supportedFrequencies(); +} + +/*! + \obsolete + + Use supportedSampleRates() instead. */ QList<int> QAudioDeviceInfo::supportedFrequencies() const @@ -268,7 +279,18 @@ QList<int> QAudioDeviceInfo::supportedFrequencies() const } /*! - Returns a list of supported channels. + Returns a list of supported channel counts. +*/ + +QList<int> QAudioDeviceInfo::supportedChannelCounts() const +{ + return supportedChannels(); +} + +/*! + \obsolete + + Use supportedChannelCount() instead. */ QList<int> QAudioDeviceInfo::supportedChannels() const diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index 62dc8a2..1cc0731 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -84,7 +84,9 @@ public: QStringList supportedCodecs() const; QList<int> supportedFrequencies() const; + QList<int> supportedSampleRates() const; QList<int> supportedChannels() const; + QList<int> supportedChannelCounts() const; QList<int> supportedSampleSizes() const; QList<QAudioFormat::Endian> supportedByteOrders() const; QList<QAudioFormat::SampleType> supportedSampleTypes() const; diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index f6b8154..955a880 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -95,14 +95,14 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const QAudioFormat nearest; if(mode == QAudio::AudioOutput) { nearest.setFrequency(44100); - nearest.setChannels(2); + nearest.setChannelCount(2); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(16); nearest.setCodec(QLatin1String("audio/pcm")); } else { nearest.setFrequency(11025); - nearest.setChannels(1); + nearest.setChannelCount(1); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(8); diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index 89ae0ff..e349b9e 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -111,7 +111,7 @@ public: \o Parameter \o Description \row - \o Frequency + \o Sample Rate \o Samples per second of audio data in Hertz. \row \o Number of channels @@ -143,8 +143,8 @@ public: Values are initialized as follows: \list - \o frequency() = -1 - \o channels() = -1 + \o sampleRate() = -1 + \o channelCount() = -1 \o sampleSize() = -1 \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder) \o sampleType() = QAudioFormat::Unknown @@ -224,7 +224,18 @@ bool QAudioFormat::isValid() const } /*! - Sets the frequency to \a frequency. + Sets the sample rate to \a samplerate Hertz. +*/ + +void QAudioFormat::setSampleRate(int samplerate) +{ + d->frequency = samplerate; +} + +/*! + \obsolete + + Use setSampleRate() instead. */ void QAudioFormat::setFrequency(int frequency) @@ -233,7 +244,18 @@ void QAudioFormat::setFrequency(int frequency) } /*! - Returns the current frequency value. + Returns the current sample rate in Hertz. +*/ + +int QAudioFormat::sampleRate() const +{ + return d->frequency; +} + +/*! + \obsolete + + Use sampleRate() instead. */ int QAudioFormat::frequency() const @@ -242,7 +264,18 @@ int QAudioFormat::frequency() const } /*! - Sets the channels to \a channels. + Sets the channel count to \a channels. +*/ + +void QAudioFormat::setChannelCount(int channels) +{ + d->channels = channels; +} + +/*! + \obsolete + + Use setChannelCount() instead. */ void QAudioFormat::setChannels(int channels) @@ -251,7 +284,18 @@ void QAudioFormat::setChannels(int channels) } /*! - Returns the current channel value. + Returns the current channel count value. +*/ + +int QAudioFormat::channelCount() const +{ + return d->channels; +} + +/*! + \obsolete + + Use channelCount() instead. */ int QAudioFormat::channels() const diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index cb58d1c..6c835b7 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -75,9 +75,13 @@ public: void setFrequency(int frequency); int frequency() const; + void setSampleRate(int sampleRate); + int sampleRate() const; void setChannels(int channels); int channels() const; + void setChannelCount(int channelCount); + int channelCount() const; void setSampleSize(int sampleSize); int sampleSize() const; diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 17e8bfb..84fd2a5 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -230,6 +230,11 @@ bool QAudioInputPrivate::open() } else { period_size = buffer_size/5; } +#ifdef Q_OS_WINCE + // For wince reduce size to 40ms for buffer size and 20ms period + buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.04; + period_size = buffer_size/2; +#endif timeStamp.restart(); elapsedTimeOffset = 0; wfx.nSamplesPerSec = settings.frequency(); diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index 614357c..75297c4 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -1,43 +1,43 @@ /**************************************************************************** - ** - ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the QtTest 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$ - ** - ****************************************************************************/ +** +** 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 QtTest 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 <QtTest/private/qbenchmarkmetric_p.h> diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index e244690..46431a8 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -362,9 +362,10 @@ namespace QTest { char buf3[1024]; Q_ASSERT(result.iterations > 0); + formatResult(resultBuffer, 100, result.value, countSignificantDigits(result.value)); QTest::qt_snprintf( buf3, sizeof(buf3), " (total: %s, iterations: %d)", - QByteArray::number(result.value).constData(), // no 64-bit qt_snprintf support + resultBuffer, result.iterations); char buf[1024]; diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 98e9787..40daecb 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1671,8 +1671,9 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) #endif { #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) + QScopedPointer<FatalSignalHandler> handler; if (!noCrashHandler) - FatalSignalHandler handler; + handler.reset(new FatalSignalHandler); #endif qInvokeTestMethods(testObject); } diff --git a/tests/auto/networkdata/README b/tests/auto/networkdata/README deleted file mode 100644 index e8748cc..0000000 --- a/tests/auto/networkdata/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains network test data diff --git a/tests/auto/qdiriterator/foo/bar/readme.txt b/tests/auto/qdiriterator/foo/bar/readme.txt deleted file mode 100644 index e69de29..0000000 --- a/tests/auto/qdiriterator/foo/bar/readme.txt +++ /dev/null diff --git a/tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html b/tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html deleted file mode 100644 index 51a2261..0000000 --- a/tests/auto/qdiriterator/recursiveDirs/dir1/aPage.html +++ /dev/null @@ -1,8 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml/"> - <head> - <title>A title</title> - </head> - <body> - <p>Some text</p> - </body> -</html> diff --git a/tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt b/tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt deleted file mode 100644 index 5b1dd02..0000000 --- a/tests/auto/qdiriterator/recursiveDirs/dir1/textFileB.txt +++ /dev/null @@ -1 +0,0 @@ -Some Text diff --git a/tests/auto/qdiriterator/recursiveDirs/textFileA.txt b/tests/auto/qdiriterator/recursiveDirs/textFileA.txt deleted file mode 100644 index 5b1dd02..0000000 --- a/tests/auto/qdiriterator/recursiveDirs/textFileA.txt +++ /dev/null @@ -1 +0,0 @@ -Some Text diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp index 6cdd1f7..f6fce32 100644 --- a/tests/auto/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp @@ -71,6 +71,39 @@ public: tst_QDirIterator(); virtual ~tst_QDirIterator(); +private: // convenience functions + QStringList createdDirectories; + QStringList createdFiles; + + QDir currentDir; + bool createDirectory(const QString &dirName) + { + if (currentDir.mkdir(dirName)) { + createdDirectories.prepend(dirName); + return true; + } + return false; + } + + bool createFile(const QString &fileName) + { + QFile file(fileName); + if (file.open(QIODevice::WriteOnly)) { + createdFiles << fileName; + return true; + } + return false; + } + + bool createLink(const QString &destination, const QString &linkName) + { + if (QFile::link(destination, linkName)) { + createdFiles << linkName; + return true; + } + return false; + } + private slots: void iterateRelativeDirectory_data(); void iterateRelativeDirectory(); @@ -96,41 +129,47 @@ tst_QDirIterator::tst_QDirIterator() QFile::remove("entrylist/directory/entrylist3.lnk"); QFile::remove("entrylist/directory/entrylist4.lnk"); + createDirectory("entrylist"); + createDirectory("entrylist/directory"); + createFile("entrylist/file"); + createFile("entrylist/writable"); + createFile("entrylist/directory/dummy"); + + createDirectory("recursiveDirs"); + createDirectory("recursiveDirs/dir1"); + createFile("recursiveDirs/textFileA.txt"); + createFile("recursiveDirs/dir1/aPage.html"); + createFile("recursiveDirs/dir1/textFileB.txt"); + + createDirectory("foo"); + createDirectory("foo/bar"); + createFile("foo/bar/readme.txt"); + #ifndef Q_NO_SYMLINKS # if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) // ### Sadly, this is a platform difference right now. - QFile::link("entrylist/file", "entrylist/linktofile.lnk"); + createLink("entrylist/file", "entrylist/linktofile.lnk"); # ifndef Q_NO_SYMLINKS_TO_DIRS - QFile::link("entrylist/directory", "entrylist/linktodirectory.lnk"); + createLink("entrylist/directory", "entrylist/linktodirectory.lnk"); # endif - QFile::link("entrylist/nothing", "entrylist/brokenlink.lnk"); + createLink("entrylist/nothing", "entrylist/brokenlink.lnk"); # else - QFile::link("file", "entrylist/linktofile.lnk"); + createLink("file", "entrylist/linktofile.lnk"); # ifndef Q_NO_SYMLINKS_TO_DIRS - QFile::link("directory", "entrylist/linktodirectory.lnk"); + createLink("directory", "entrylist/linktodirectory.lnk"); # endif - QFile::link("nothing", "entrylist/brokenlink.lnk"); + createLink("nothing", "entrylist/brokenlink.lnk"); # endif #endif - QFile("entrylist/writable").open(QIODevice::ReadWrite); } tst_QDirIterator::~tst_QDirIterator() { - QFile::remove("entrylist/directory"); - QFile::remove("entrylist/linktofile.lnk"); - QFile::remove("entrylist/linktodirectory.lnk"); - QFile::remove("entrylist/brokenlink.lnk"); - QFile::remove("entrylist/brokenlink"); - QFile::remove("entrylist/writable"); - QFile::remove("entrylist/entrylist1.lnk"); - QFile::remove("entrylist/entrylist2.lnk"); - QFile::remove("entrylist/entrylist3.lnk"); - QFile::remove("entrylist/entrylist4.lnk"); - QFile::remove("entrylist/directory/entrylist1.lnk"); - QFile::remove("entrylist/directory/entrylist2.lnk"); - QFile::remove("entrylist/directory/entrylist3.lnk"); - QFile::remove("entrylist/directory/entrylist4.lnk"); + Q_FOREACH(QString fileName, createdFiles) + QFile::remove(fileName); + + Q_FOREACH(QString dirName, createdDirectories) + currentDir.rmdir(dirName); } void tst_QDirIterator::iterateRelativeDirectory_data() @@ -298,23 +337,23 @@ void tst_QDirIterator::stopLinkLoop() { #ifdef Q_OS_WIN // ### Sadly, this is a platform difference right now. - QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk"); - QFile::link("entrylist/.", "entrylist/entrylist2.lnk"); - QFile::link("entrylist/../entrylist/.", "entrylist/entrylist3.lnk"); - QFile::link("entrylist/..", "entrylist/entrylist4.lnk"); - QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk"); - QFile::link("entrylist/.", "entrylist/directory/entrylist2.lnk"); - QFile::link("entrylist/../directory/.", "entrylist/directory/entrylist3.lnk"); - QFile::link("entrylist/..", "entrylist/directory/entrylist4.lnk"); + createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk"); + createLink("entrylist/.", "entrylist/entrylist2.lnk"); + createLink("entrylist/../entrylist/.", "entrylist/entrylist3.lnk"); + createLink("entrylist/..", "entrylist/entrylist4.lnk"); + createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk"); + createLink("entrylist/.", "entrylist/directory/entrylist2.lnk"); + createLink("entrylist/../directory/.", "entrylist/directory/entrylist3.lnk"); + createLink("entrylist/..", "entrylist/directory/entrylist4.lnk"); #else - QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk"); - QFile::link(".", "entrylist/entrylist2.lnk"); - QFile::link("../entrylist/.", "entrylist/entrylist3.lnk"); - QFile::link("..", "entrylist/entrylist4.lnk"); - QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk"); - QFile::link(".", "entrylist/directory/entrylist2.lnk"); - QFile::link("../directory/.", "entrylist/directory/entrylist3.lnk"); - QFile::link("..", "entrylist/directory/entrylist4.lnk"); + createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk"); + createLink(".", "entrylist/entrylist2.lnk"); + createLink("../entrylist/.", "entrylist/entrylist3.lnk"); + createLink("..", "entrylist/entrylist4.lnk"); + createLink(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/directory/entrylist1.lnk"); + createLink(".", "entrylist/directory/entrylist2.lnk"); + createLink("../directory/.", "entrylist/directory/entrylist3.lnk"); + createLink("..", "entrylist/directory/entrylist4.lnk"); #endif QDirIterator it(QLatin1String("entrylist"), QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); @@ -325,22 +364,6 @@ void tst_QDirIterator::stopLinkLoop() QVERIFY(max); // The goal of this test is only to ensure that the test above don't malfunction - -#ifdef Q_OS_WIN - // ### Sadly, this is a platform difference right now. - QFile::link(QDir::currentPath() + QLatin1String("/entrylist"), "entrylist/entrylist1.lnk"); - QFile::link("../../entrylist/.", "entrylist/entrylist2.lnk"); - QFile::link("entrylist/..", "entrylist/entrylist3.lnk"); -#else - QFile::remove("entrylist/entrylist1.lnk"); - QFile::remove("entrylist/entrylist2.lnk"); - QFile::remove("entrylist/entrylist3.lnk"); - QFile::remove("entrylist/entrylist4.lnk"); - QFile::remove("entrylist/directory/entrylist1.lnk"); - QFile::remove("entrylist/directory/entrylist2.lnk"); - QFile::remove("entrylist/directory/entrylist3.lnk"); - QFile::remove("entrylist/directory/entrylist4.lnk"); -#endif } class EngineWithNoIterator : public QFSFileEngine diff --git a/tests/auto/qobject/oldnormalizeobject.h b/tests/auto/qobject/oldnormalizeobject.h index 8420a3a..3adf04d 100644 --- a/tests/auto/qobject/oldnormalizeobject.h +++ b/tests/auto/qobject/oldnormalizeobject.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest 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 OLDNORMALIZEOBJECT_H #define OLDNORMALIZEOBJECT_H diff --git a/tests/auto/selftests/expected_benchlibcallgrind.txt b/tests/auto/selftests/expected_benchlibcallgrind.txt index caf2424..f172711 100644 --- a/tests/auto/selftests/expected_benchlibcallgrind.txt +++ b/tests/auto/selftests/expected_benchlibcallgrind.txt @@ -2,7 +2,7 @@ Config: Using QTest library 4.5.0, Qt 4.5.0 PASS : tst_BenchlibCallgrind::initTestCase() RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions(): - 200,000,000 instr. loads per iteration (total: 200000000, iterations: 1) + 200,000,000 instruction reads per iteration (total: 200000000, iterations: 1) PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions() PASS : tst_BenchlibCallgrind::cleanupTestCase() Totals: 3 passed, 0 failed, 0 skipped diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 89ece0f..6608439 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -97,7 +97,7 @@ inline bool qCompare if (r1.unit == "msec") { variance = 0.1; } - else if (r1.unit == "instr. loads") { + else if (r1.unit == "instruction reads") { variance = 0.001; } else if (r1.unit == "ticks") { @@ -434,7 +434,7 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error) /* This code avoids using a QRegExp because QRegExp might be broken. */ - /* Sample format: 4,000 msec per iteration (total: 4000, iterations: 1) */ + /* Sample format: 4,000 msec per iteration (total: 4,000, iterations: 1) */ QString sFirstNumber; while (!remaining.isEmpty() && !remaining.at(0).isSpace()) { @@ -468,7 +468,7 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error) remaining = remaining.mid(sizeof(periterbit)-1); - /* Remaining: 4000, iterations: 1) */ + /* Remaining: 4,000, iterations: 1) */ static const char itersbit[] = ", iterations: "; QString sTotal; while (!remaining.startsWith(itersbit) && !remaining.isEmpty()) { @@ -482,9 +482,12 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error) remaining = remaining.mid(sizeof(itersbit)-1); - qint64 total = sTotal.toLongLong(&ok); + /* 4,000 -> 4000 */ + sTotal.remove(','); + + double total = sTotal.toDouble(&ok); if (!ok) { - if (error) *error = sTotal + " (total) is not a valid integer"; + if (error) *error = sTotal + " (total) is not a valid number"; return out; } diff --git a/tests/auto/selftests/xunit/tst_xunit b/tests/auto/selftests/xunit/tst_xunit Binary files differdeleted file mode 100755 index 31d03a8..0000000 --- a/tests/auto/selftests/xunit/tst_xunit +++ /dev/null diff --git a/tests/benchmarks/qmetaobject/main.cpp b/tests/benchmarks/qmetaobject/main.cpp index c375a16..eef6020 100644 --- a/tests/benchmarks/qmetaobject/main.cpp +++ b/tests/benchmarks/qmetaobject/main.cpp @@ -42,6 +42,84 @@ #include <QtGui> #include <qtest.h> +class LotsOfSignals : public QObject +{ + Q_OBJECT +public: + LotsOfSignals() {} + +signals: + void extraSignal1(); + void extraSignal2(); + void extraSignal3(); + void extraSignal4(); + void extraSignal5(); + void extraSignal6(); + void extraSignal7(); + void extraSignal8(); + void extraSignal9(); + void extraSignal10(); + void extraSignal12(); + void extraSignal13(); + void extraSignal14(); + void extraSignal15(); + void extraSignal16(); + void extraSignal17(); + void extraSignal18(); + void extraSignal19(); + void extraSignal20(); + void extraSignal21(); + void extraSignal22(); + void extraSignal23(); + void extraSignal24(); + void extraSignal25(); + void extraSignal26(); + void extraSignal27(); + void extraSignal28(); + void extraSignal29(); + void extraSignal30(); + void extraSignal31(); + void extraSignal32(); + void extraSignal33(); + void extraSignal34(); + void extraSignal35(); + void extraSignal36(); + void extraSignal37(); + void extraSignal38(); + void extraSignal39(); + void extraSignal40(); + void extraSignal41(); + void extraSignal42(); + void extraSignal43(); + void extraSignal44(); + void extraSignal45(); + void extraSignal46(); + void extraSignal47(); + void extraSignal48(); + void extraSignal49(); + void extraSignal50(); + void extraSignal51(); + void extraSignal52(); + void extraSignal53(); + void extraSignal54(); + void extraSignal55(); + void extraSignal56(); + void extraSignal57(); + void extraSignal58(); + void extraSignal59(); + void extraSignal60(); + void extraSignal61(); + void extraSignal62(); + void extraSignal63(); + void extraSignal64(); + void extraSignal65(); + void extraSignal66(); + void extraSignal67(); + void extraSignal68(); + void extraSignal69(); + void extraSignal70(); +}; + class tst_qmetaobject: public QObject { Q_OBJECT @@ -57,6 +135,9 @@ private slots: void indexOfSignal(); void indexOfSlot_data(); void indexOfSlot(); + + void unconnected_data(); + void unconnected(); }; void tst_qmetaobject::initTestCase() @@ -154,6 +235,30 @@ void tst_qmetaobject::indexOfSlot() } } +void tst_qmetaobject::unconnected_data() +{ + QTest::addColumn<int>("signal_index"); + QTest::newRow("signal--9") << 9; + QTest::newRow("signal--32") << 32; + QTest::newRow("signal--33") << 33; + QTest::newRow("signal--64") << 64; + QTest::newRow("signal--65") << 65; + QTest::newRow("signal--70") << 70; +} + +void tst_qmetaobject::unconnected() +{ + LotsOfSignals *obj = new LotsOfSignals; + QFETCH(int, signal_index); + QVERIFY(obj->metaObject()->methodCount() == 73); + void *v; + QBENCHMARK { + //+1 because QObject has one slot + QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, signal_index+1, &v); + } + delete obj; +} + QTEST_MAIN(tst_qmetaobject) #include "main.moc" diff --git a/tests/benchmarks/qvector/outofline.cpp b/tests/benchmarks/qvector/outofline.cpp index d1d72b0..e8d036e 100644 --- a/tests/benchmarks/qvector/outofline.cpp +++ b/tests/benchmarks/qvector/outofline.cpp @@ -1,3 +1,43 @@ +/**************************************************************************** +** +** 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 QtTest 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 <QVector> #include <vector> |