diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2010-02-05 05:24:23 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2010-02-05 05:24:23 (GMT) |
commit | 9f43d4aafeb16c81bc1a161c99dee2df19772e42 (patch) | |
tree | 081f5c2323f6fadf49f2d1fada8a7c0cb4bc953c /examples | |
parent | f14e3b86e6b7b496017ddd462821325bdb40c779 (diff) | |
parent | 7474ad656269aec1352d166bb5a4435086d48482 (diff) | |
download | Qt-9f43d4aafeb16c81bc1a161c99dee2df19772e42.zip Qt-9f43d4aafeb16c81bc1a161c99dee2df19772e42.tar.gz Qt-9f43d4aafeb16c81bc1a161c99dee2df19772e42.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'examples')
34 files changed, 471 insertions, 344 deletions
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.h index 5f769cd..d109883 100644 --- a/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h +++ b/examples/dbus/remotecontrolledcar/car/car_adaptor.h @@ -1,17 +1,17 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** 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 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. +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -25,23 +25,23 @@ ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** 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 +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -a car_adaptor.h: car.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2009 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,40 +49,37 @@ ** ****************************************************************************/ -#ifndef CAR_ADAPTOR_P_H_1157030132 -#define CAR_ADAPTOR_P_H_1157030132 +#ifndef CAR_ADAPTOR_H_1264773009 +#define CAR_ADAPTOR_H_1264773009 #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 +class CarInterfaceAdaptor: 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 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(); + CarInterfaceAdaptor(QObject *parent); + virtual ~CarInterfaceAdaptor(); public: // PROPERTIES public Q_SLOTS: // METHODS 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..21662b4 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). +** qqdbusxml2cpp 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.h index 8a5a907..c2d281a 100644 --- a/examples/dbus/remotecontrolledcar/controller/car_interface_p.h +++ b/examples/dbus/remotecontrolledcar/controller/car_interface.h @@ -1,17 +1,17 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** 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 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. +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -25,31 +25,31 @@ ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** ** 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 +** This file was generated by qdbusxml2cpp version 0.7 +** Command line was: qdbusxml2cpp -p car_interface.h: car.xml ** -** dbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** qdbusxml2cpp is Copyright (C) 2009 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 +#ifndef CAR_INTERFACE_H_1264772826 +#define CAR_INTERFACE_H_1264772826 #include <QtCore/QObject> #include <QtCore/QByteArray> @@ -63,7 +63,7 @@ /* * Proxy class for interface com.trolltech.Examples.CarInterface */ -class CarInterface: public QDBusAbstractInterface +class ComTrolltechExamplesCarInterfaceInterface: public QDBusAbstractInterface { Q_OBJECT public: @@ -71,33 +71,33 @@ public: { return "com.trolltech.Examples.CarInterface"; } public: - CarInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + ComTrolltechExamplesCarInterfaceInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); - ~CarInterface(); + ~ComTrolltechExamplesCarInterfaceInterface(); public Q_SLOTS: // METHODS - inline QDBusReply<void> accelerate() + inline QDBusPendingReply<> accelerate() { QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("accelerate"), argumentList); + return asyncCallWithArgumentList(QLatin1String("accelerate"), argumentList); } - inline QDBusReply<void> decelerate() + inline QDBusPendingReply<> decelerate() { QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("decelerate"), argumentList); + return asyncCallWithArgumentList(QLatin1String("decelerate"), argumentList); } - inline QDBusReply<void> turnLeft() + inline QDBusPendingReply<> turnLeft() { QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("turnLeft"), argumentList); + return asyncCallWithArgumentList(QLatin1String("turnLeft"), argumentList); } - inline QDBusReply<void> turnRight() + inline QDBusPendingReply<> turnRight() { QList<QVariant> argumentList; - return callWithArgumentList(QDBus::Block, QLatin1String("turnRight"), argumentList); + return asyncCallWithArgumentList(QLatin1String("turnRight"), argumentList); } Q_SIGNALS: // SIGNALS @@ -107,7 +107,7 @@ Q_SIGNALS: // SIGNALS namespace com { namespace trolltech { namespace Examples { - typedef ::CarInterface CarInterface; + typedef ::ComTrolltechExamplesCarInterfaceInterface CarInterface; } } } 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/examples/designer/taskmenuextension/tictactoedialog.h b/examples/designer/taskmenuextension/tictactoedialog.h index aeaaaf4..3d810dd 100644 --- a/examples/designer/taskmenuextension/tictactoedialog.h +++ b/examples/designer/taskmenuextension/tictactoedialog.h @@ -55,7 +55,7 @@ class TicTacToeDialog : public QDialog Q_OBJECT public: - TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0); + explicit TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0); QSize sizeHint() const; diff --git a/examples/network/googlesuggest/googlesuggest.cpp b/examples/network/googlesuggest/googlesuggest.cpp index 79bc448..0c85773 100644 --- a/examples/network/googlesuggest/googlesuggest.cpp +++ b/examples/network/googlesuggest/googlesuggest.cpp @@ -231,4 +231,5 @@ void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply) networkReply->deleteLater(); } -//! [9]
\ No newline at end of file +//! [9] + diff --git a/examples/network/googlesuggest/searchbox.cpp b/examples/network/googlesuggest/searchbox.cpp index 69dc20e..8ef6f00 100644 --- a/examples/network/googlesuggest/searchbox.cpp +++ b/examples/network/googlesuggest/searchbox.cpp @@ -69,4 +69,5 @@ void SearchBox::doSearch() QString url = QString(GSEARCH_URL).arg(text()); QDesktopServices::openUrl(QUrl(url)); } -//! [2]
\ No newline at end of file +//! [2] + diff --git a/examples/network/network-chat/chatdialog.cpp b/examples/network/network-chat/chatdialog.cpp index d8bcb30..da65270 100644 --- a/examples/network/network-chat/chatdialog.cpp +++ b/examples/network/network-chat/chatdialog.cpp @@ -79,7 +79,7 @@ void ChatDialog::appendMessage(const QString &from, const QString &message) QTextCursor cursor(textEdit->textCursor()); cursor.movePosition(QTextCursor::End); QTextTable *table = cursor.insertTable(1, 2, tableFormat); - table->cellAt(0, 0).firstCursorPosition().insertText("<" + from + "> "); + table->cellAt(0, 0).firstCursorPosition().insertText('<' + from + "> "); table->cellAt(0, 1).firstCursorPosition().insertText(message); QScrollBar *bar = textEdit->verticalScrollBar(); bar->setValue(bar->maximum()); diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp index 2b8725c..f516783 100644 --- a/examples/network/network-chat/client.cpp +++ b/examples/network/network-chat/client.cpp @@ -69,8 +69,8 @@ void Client::sendMessage(const QString &message) QString Client::nickName() const { - return QString(peerManager->userName()) + "@" + QHostInfo::localHostName() - + ":" + QString::number(server.serverPort()); + return QString(peerManager->userName()) + '@' + QHostInfo::localHostName() + + ':' + QString::number(server.serverPort()); } bool Client::hasConnection(const QHostAddress &senderIp, int senderPort) const diff --git a/examples/network/network-chat/connection.cpp b/examples/network/network-chat/connection.cpp index 1df8a2d..5c636b9 100644 --- a/examples/network/network-chat/connection.cpp +++ b/examples/network/network-chat/connection.cpp @@ -83,7 +83,7 @@ bool Connection::sendMessage(const QString &message) return false; QByteArray msg = message.toUtf8(); - QByteArray data = "MESSAGE " + QByteArray::number(msg.size()) + " " + msg; + QByteArray data = "MESSAGE " + QByteArray::number(msg.size()) + ' ' + msg; return write(data) == data.size(); } @@ -118,7 +118,7 @@ void Connection::processReadyRead() return; } - username = QString(buffer) + "@" + peerAddress().toString() + ":" + username = QString(buffer) + '@' + peerAddress().toString() + ':' + QString::number(peerPort()); currentDataType = Undefined; numBytesForCurrentDataType = 0; @@ -162,7 +162,7 @@ void Connection::sendPing() void Connection::sendGreetingMessage() { QByteArray greeting = greetingMessage.toUtf8(); - QByteArray data = "GREETING " + QByteArray::number(greeting.size()) + " " + greeting; + QByteArray data = "GREETING " + QByteArray::number(greeting.size()) + ' ' + greeting; if (write(data) == data.size()) isGreetingMessageSent = true; } diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp index 5ad2dc7..430031b 100644 --- a/examples/network/network-chat/peermanager.cpp +++ b/examples/network/network-chat/peermanager.cpp @@ -61,7 +61,7 @@ PeerManager::PeerManager(Client *client) foreach (QString string, envVariables) { int index = environment.indexOf(QRegExp(string)); if (index != -1) { - QStringList stringList = environment.at(index).split("="); + QStringList stringList = environment.at(index).split('='); if (stringList.size() == 2) { username = stringList.at(1).toUtf8(); break; diff --git a/examples/network/qftp/ftpwindow.cpp b/examples/network/qftp/ftpwindow.cpp index ae3a2b6..3fd62f8 100644 --- a/examples/network/qftp/ftpwindow.cpp +++ b/examples/network/qftp/ftpwindow.cpp @@ -324,7 +324,8 @@ void FtpWindow::processItem(QTreeWidgetItem *item, int /*column*/) if (isDirectory.value(name)) { fileList->clear(); isDirectory.clear(); - currentPath += "/" + name; + currentPath += '/'; + currentPath += name; ftp->cd(name); ftp->list(); cdToParentButton->setEnabled(true); diff --git a/examples/network/qftp/sym_iap_util.h b/examples/network/qftp/sym_iap_util.h index 8079d2c..41e43a9 100644 --- a/examples/network/qftp/sym_iap_util.h +++ b/examples/network/qftp/sym_iap_util.h @@ -298,7 +298,7 @@ QString qt_TDesC2QStringL(const TDesC& aDescriptor) #ifdef QT_NO_UNICODE return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length()); #else - return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length()); + return QString((const QChar *)aDescriptor.Ptr(), aDescriptor.Length()); #endif } diff --git a/examples/network/securesocketclient/sslclient.cpp b/examples/network/securesocketclient/sslclient.cpp index 1422f1c..0d6a581 100644 --- a/examples/network/securesocketclient/sslclient.cpp +++ b/examples/network/securesocketclient/sslclient.cpp @@ -177,7 +177,7 @@ void SslClient::socketReadyRead() void SslClient::sendData() { QString input = form->sessionInput->text(); - appendString(input + "\n"); + appendString(input + '\n'); socket->write(input.toUtf8() + "\r\n"); form->sessionInput->clear(); } diff --git a/examples/network/torrent/trackerclient.cpp b/examples/network/torrent/trackerclient.cpp index 4f23d54..2397737 100644 --- a/examples/network/torrent/trackerclient.cpp +++ b/examples/network/torrent/trackerclient.cpp @@ -105,7 +105,7 @@ void TrackerClient::fetchPeerList() QString passkey = "?"; if (fullUrl.contains("?passkey")) { passkey = metaInfo.announceUrl().mid(fullUrl.indexOf("?passkey"), -1); - passkey += "&"; + passkey += '&'; } // Percent encode the hash diff --git a/examples/opengl/hellogl_es/cl_helper.h b/examples/opengl/hellogl_es/cl_helper.h deleted file mode 100644 index 4f4c2bd..0000000 --- a/examples/opengl/hellogl_es/cl_helper.h +++ /dev/null @@ -1,133 +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$ -** -****************************************************************************/ - -#ifdef QT_OPENGL_ES_1_CL - -//! [0] -#define FLOAT2X(f) ((int) ( (f) * (65536))) -#define X2FLOAT(x) ((float)(x) / 65536.0f) - -#define f2vt(f) FLOAT2X(f) -#define vt2f(x) X2FLOAT(x) - -#define q_vertexType GLfixed -#define q_vertexTypeEnum GL_FIXED - -#define q_glFog glFogx -#define q_glFogv glFogxv -//! [0] - -#define q_glLight glLightx -#define q_glLightv glLightxv -#define q_glLightModel glLightModelx -#define q_glLightModelv glLightModelxv - -#define q_glAlphaFunc glAlphaFuncx - -#define q_glMaterial glMaterialx -#define q_glMaterialv glMaterialxv -#define q_glColor4 glColor4x - -#define q_glTexParameter glTexParameterx -#define q_glTexEnv glTexEnvx - -#define q_glOrtho glOrthox -#define q_glFrustum glFrustumx - -#define q_glTranslate glTranslatex -#define q_glScale glScalex -#define q_glRotate glRotatex -#define q_glLoadMatrix glLoadMatrixx - -#define q_glClearColor glClearColorx - -#define q_glMultMatrix glMultMatrixx - -#define q_glNormal3 glNormal3x - -#define q_glPolygonOffset glPolygonOffsetx -#define q_glPointSize glPointSizex - -//! [1] -#else - -#define f2vt(f) (f) -#define vt2f(x) (x) - -#define q_vertexType GLfloat -#define q_vertexTypeEnum GL_FLOAT - -#define q_glFog glFogf -#define q_glFogv glFogfv -//! [1] - -#define q_glLight glLightf -#define q_glLightv glLightfv -#define q_glLightModel glLightModelf -#define q_glLightModelv glLightModelfv - -#define q_glAlphaFunc glAlphaFuncf - -#define q_glMaterial glMaterialf -#define q_glMaterialv glMaterialfv -#define q_glColor4 glColor4f - -#define q_glTexParameter glTexParameterf -#define q_glTexEnv glTexEnvf - -#define q_glOrtho glOrthof -#define q_glFrustum glFrustumf - -#define q_glTranslate glTranslatef -#define q_glScale glScalef -#define q_glRotate glRotatef -#define q_glLoadMatrix glLoadMatrixf - -#define q_glClearColor glClearColor - -#define q_glMultMatrix glMultMatrixf - -#define q_glNormal3 glNormal3f - -#define q_glPolygonOffset glPolygonOffsetf -#define q_glPointSize glPointSizef - -#endif diff --git a/examples/opengl/hellogl_es/glwidget.cpp b/examples/opengl/hellogl_es/glwidget.cpp index 9a45a11..8a6543d 100644 --- a/examples/opengl/hellogl_es/glwidget.cpp +++ b/examples/opengl/hellogl_es/glwidget.cpp @@ -44,7 +44,6 @@ #include <math.h> #include "bubble.h" -#include "cl_helper.h" const int bubbleNum = 8; @@ -114,9 +113,9 @@ void GLWidget::paintQtLogo() { glDisable(GL_TEXTURE_2D); glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3,q_vertexTypeEnum,0, createdVertices); + glVertexPointer(3,GL_FLOAT,0, createdVertices); glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(q_vertexTypeEnum,0,createdNormals); + glNormalPointer(GL_FLOAT,0,createdNormals); glDrawArrays(GL_TRIANGLES, 0, m_vertexNumber / 3); } //! [2] @@ -125,83 +124,83 @@ void GLWidget::paintTexturedCube() { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_uiTexture); - q_vertexType afVertices[] = { - f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(0.5), - f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(-0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5), - f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5), - f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5), - - f2vt(0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(0.5),f2vt(0.5),f2vt(-0.5), - f2vt(0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5),f2vt(0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(0.5), - f2vt(-0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5),f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(-0.5), - f2vt(-0.5), f2vt(-0.5), f2vt(0.5), f2vt(-0.5),f2vt(0.5),f2vt(-0.5),f2vt(-0.5),f2vt(0.5),f2vt(0.5), - - f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(-0.5), - f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(0.5), - f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5), - f2vt(0.5), f2vt(-0.5), f2vt(0.5), f2vt(0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(-0.5), f2vt(0.5) + GLfloat afVertices[] = { + -0.5, 0.5, 0.5, 0.5,-0.5,0.5,-0.5,-0.5,0.5, + 0.5, -0.5, 0.5, -0.5,0.5,0.5,0.5,0.5,0.5, + -0.5, -0.5, -0.5, 0.5,-0.5,-0.5,-0.5,0.5,-0.5, + 0.5, 0.5, -0.5, -0.5,0.5,-0.5,0.5,-0.5,-0.5, + + 0.5, -0.5, -0.5, 0.5,-0.5,0.5,0.5,0.5,-0.5, + 0.5, 0.5, 0.5, 0.5,0.5,-0.5,0.5,-0.5,0.5, + -0.5, 0.5, -0.5, -0.5,-0.5,0.5,-0.5,-0.5,-0.5, + -0.5, -0.5, 0.5, -0.5,0.5,-0.5,-0.5,0.5,0.5, + + 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, + -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, + -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, + 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5 }; glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3,q_vertexTypeEnum,0,afVertices); - - q_vertexType afTexCoord[] = { - f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - - f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), - f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), - - f2vt(0.0f),f2vt(1.0f), f2vt(1.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), - f2vt(1.0f),f2vt(0.0f), f2vt(0.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), - f2vt(1.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), - f2vt(0.0f),f2vt(1.0f), f2vt(0.0f),f2vt(0.0f), f2vt(1.0f),f2vt(1.0f) + glVertexPointer(3,GL_FLOAT,0,afVertices); + + GLfloat afTexCoord[] = { + 0.0f,0.0f, 1.0f,1.0f, 1.0f,0.0f, + 1.0f,1.0f, 0.0f,0.0f, 0.0f,1.0f, + 1.0f,1.0f, 1.0f,0.0f, 0.0f,1.0f, + 0.0f,0.0f, 0.0f,1.0f, 1.0f,0.0f, + + 1.0f,1.0f, 1.0f,0.0f, 0.0f,1.0f, + 0.0f,0.0f, 0.0f,1.0f, 1.0f,0.0f, + 0.0f,0.0f, 1.0f,1.0f, 1.0f,0.0f, + 1.0f,1.0f, 0.0f,0.0f, 0.0f,1.0f, + + 0.0f,1.0f, 1.0f,0.0f, 1.0f,1.0f, + 1.0f,0.0f, 0.0f,1.0f, 0.0f,0.0f, + 1.0f,0.0f, 1.0f,1.0f, 0.0f,0.0f, + 0.0f,1.0f, 0.0f,0.0f, 1.0f,1.0f }; glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2,q_vertexTypeEnum,0,afTexCoord); + glTexCoordPointer(2,GL_FLOAT,0,afTexCoord); - q_vertexType afNormals[] = { + GLfloat afNormals[] = { - f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), - f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), f2vt(0),f2vt(0),f2vt(-1), - f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), - f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), f2vt(0),f2vt(0),f2vt(1), + 0,0,-1, 0,0,-1, 0,0,-1, + 0,0,-1, 0,0,-1, 0,0,-1, + 0,0,1, 0,0,1, 0,0,1, + 0,0,1, 0,0,1, 0,0,1, - f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), - f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), f2vt(-1),f2vt(0),f2vt(0), - f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), - f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), f2vt(1),f2vt(0),f2vt(0), + -1,0,0, -1,0,0, -1,0,0, + -1,0,0, -1,0,0, -1,0,0, + 1,0,0, 1,0,0, 1,0,0, + 1,0,0, 1,0,0, 1,0,0, - f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), - f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), f2vt(0),f2vt(-1),f2vt(0), - f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), - f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0), f2vt(0),f2vt(1),f2vt(0) + 0,-1,0, 0,-1,0, 0,-1,0, + 0,-1,0, 0,-1,0, 0,-1,0, + 0,1,0, 0,1,0, 0,1,0, + 0,1,0, 0,1,0, 0,1,0 }; glEnableClientState(GL_NORMAL_ARRAY); - glNormalPointer(q_vertexTypeEnum,0,afNormals); + glNormalPointer(GL_FLOAT,0,afNormals); glDrawArrays(GL_TRIANGLES, 0, 36); } void GLWidget::initializeGL () { - q_glClearColor(f2vt(0.1f), f2vt(0.1f), f2vt(0.2f), f2vt(1.0f)); + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glEnable(GL_TEXTURE_2D); glGenTextures(1, &m_uiTexture); m_uiTexture = bindTexture(QImage(":/qt.png")); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); - q_vertexType aLightPosition[] = {f2vt(0.0f),f2vt(0.3f),f2vt(1.0f),f2vt(0.0f)}; + GLfloat aLightPosition[] = {0.0f,0.3f,1.0f,0.0f}; - q_glLightv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition); + glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition); m_fAngle = 0; m_fScale = 1; createGeometry(); @@ -230,12 +229,12 @@ void GLWidget::paintGL() //Since OpenGL ES does not support glPush/PopAttrib(GL_ALL_ATTRIB_BITS) //we have to take care of the states ourselves - q_glClearColor(f2vt(0.1f), f2vt(0.1f), f2vt(0.2f), f2vt(1.0f)); + glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - q_glTexParameter(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); @@ -248,14 +247,14 @@ void GLWidget::paintGL() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - q_glRotate(f2vt(m_fAngle), f2vt(0.0), f2vt(1.0), f2vt(0.0)); - q_glRotate(f2vt(m_fAngle), f2vt(1.0), f2vt(0.0), f2vt(0.0)); - q_glRotate(f2vt(m_fAngle), f2vt(0.0), f2vt(0.0), f2vt(1.0)); - q_glScale(f2vt(m_fScale), f2vt(m_fScale),f2vt(m_fScale)); - q_glTranslate(f2vt(0),f2vt(-0.2),f2vt(0)); + glRotatef(m_fAngle, 0.0f, 1.0f, 0.0f); + glRotatef(m_fAngle, 1.0f, 0.0f, 0.0f); + glRotatef(m_fAngle, 0.0f, 0.0f, 1.0f); + glScalef(m_fScale, m_fScale,m_fScale); + glTranslatef(0.0f,-0.2f,0.0f); - q_vertexType matDiff[] = {f2vt(0.40), f2vt(1.0), f2vt(0.0), f2vt(1.0)}; - q_glMaterialv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); + GLfloat matDiff[] = {0.40f, 1.0f, 0.0f, 1.0f}; + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matDiff); if (qtLogo) paintQtLogo(); @@ -376,11 +375,11 @@ void GLWidget::createGeometry() //! [1] m_vertexNumber = vertices.size(); - createdVertices = new q_vertexType[m_vertexNumber]; - createdNormals = new q_vertexType[m_vertexNumber]; + createdVertices = new GLfloat[m_vertexNumber]; + createdNormals = new GLfloat[m_vertexNumber]; for (int i = 0;i < m_vertexNumber;i++) { - createdVertices[i] = f2vt(vertices.at(i) * 2); - createdNormals[i] = f2vt(normals.at(i)); + createdVertices[i] = vertices.at(i) * 2; + createdNormals[i] = normals.at(i); } vertices.clear(); normals.clear(); diff --git a/examples/opengl/hellogl_es/glwidget.h b/examples/opengl/hellogl_es/glwidget.h index 7a8df53..3b2b5d4 100644 --- a/examples/opengl/hellogl_es/glwidget.h +++ b/examples/opengl/hellogl_es/glwidget.h @@ -45,7 +45,6 @@ #include <QGLWidget> #include <QTime> -#include "cl_helper.h" class Bubble; @@ -76,8 +75,8 @@ private: void extrude(qreal x1, qreal y1, qreal x2, qreal y2); QList<qreal> vertices; QList<qreal> normals; - q_vertexType *createdVertices; - q_vertexType *createdNormals; + GLfloat *createdVertices; + GLfloat *createdNormals; int m_vertexNumber; bool qtLogo; QList<Bubble*> bubbles; diff --git a/examples/opengl/opengl.pro b/examples/opengl/opengl.pro index eaac9b8..c3fbc77 100644 --- a/examples/opengl/opengl.pro +++ b/examples/opengl/opengl.pro @@ -1,14 +1,12 @@ TEMPLATE = subdirs -contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles1cl)|contains(QT_CONFIG, opengles2){ +contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2){ contains(QT_CONFIG, opengles2) { SUBDIRS = hellogl_es2 } else { SUBDIRS = hellogl_es } - !contains(QT_CONFIG, opengles1cl) { - SUBDIRS += textures - } + SUBDIRS += textures contains(QT_CONFIG, opengles1) { SUBDIRS += hellogl } diff --git a/examples/qtestlib/tutorial5/containers.cpp b/examples/qtestlib/tutorial5/containers.cpp new file mode 100644 index 0000000..fe68c85 --- /dev/null +++ b/examples/qtestlib/tutorial5/containers.cpp @@ -0,0 +1,269 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +// This file contains benchmarks for comparing QVector against std::vector + +#include <QtCore> +#include <QVector> +#include <vector> + +#include <qtest.h> + +template <typename T> // T is the item type +class UseCases { +public: + virtual ~UseCases() {} + + // Use case: Insert \a size items into the vector. + virtual void insert(int size) = 0; + + // Use case: Lookup \a size items from the vector. + virtual void lookup(int size) = 0; +}; + +template <typename T> +T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler +{ + return ts; +} + +// This subclass implements the use cases using QVector as efficiently as possible. +template <typename T> +class UseCases_QVector : public UseCases<T> +{ + void insert(int size) + { + QVector<T> v; + T t; + QBENCHMARK { + for (int i = 0; i < size; ++i) + v.append(t); + } + } + + void lookup(int size) + { + QVector<T> v; + + T t; + for (int i = 0; i < size; ++i) + v.append(t); + + T *ts = new T[size]; + QBENCHMARK { + for (int i = 0; i < size; ++i) + ts[i] = v.value(i); + } + f<T>(ts); + delete[] ts; + } +}; + +// This subclass implements the use cases using std::vector as efficiently as possible. +template <typename T> +class UseCases_stdvector : public UseCases<T> +{ + void insert(int size) + { + std::vector<T> v; + T t; + QBENCHMARK { + for (int i = 0; i < size; ++i) + v.push_back(t); + } + } + + void lookup(int size) + { + std::vector<T> v; + + T t; + for (int i = 0; i < size; ++i) + v.push_back(t); + + T *ts = new T[size]; + QBENCHMARK { + for (int i = 0; i < size; ++i) + ts[i] = v[i]; + } + f<T>(ts); + delete[] ts; + } +}; + +struct Large { // A "large" item type + int x[1000]; +}; + +// Symbian devices typically have limited memory +#ifdef Q_OS_SYMBIAN +# define LARGE_MAX_SIZE 2000 +#else +# define LARGE_MAX_SIZE 20000 +#endif + +class tst_vector_vs_std : public QObject +{ + Q_OBJECT +public: + tst_vector_vs_std() + { + useCases_QVector_int = new UseCases_QVector<int>; + useCases_stdvector_int = new UseCases_stdvector<int>; + + useCases_QVector_Large = new UseCases_QVector<Large>; + useCases_stdvector_Large = new UseCases_stdvector<Large>; + } + +private: + UseCases<int> *useCases_QVector_int; + UseCases<int> *useCases_stdvector_int; + UseCases<Large> *useCases_QVector_Large; + UseCases<Large> *useCases_stdvector_Large; + +private slots: + void insert_int_data(); + void insert_int(); + void insert_Large_data(); + void insert_Large(); + void lookup_int_data(); + void lookup_int(); + void lookup_Large_data(); + void lookup_Large(); +}; + +void tst_vector_vs_std::insert_int_data() +{ + QTest::addColumn<bool>("useStd"); + QTest::addColumn<int>("size"); + + for (int size = 10; size < 20000; size += 100) { + const QByteArray sizeString = QByteArray::number(size); + QTest::newRow(("std::vector-int--" + sizeString).constData()) << true << size; + QTest::newRow(("QVector-int--" + sizeString).constData()) << false << size; + } +} + +void tst_vector_vs_std::insert_int() +{ + QFETCH(bool, useStd); + QFETCH(int, size); + + if (useStd) + useCases_stdvector_int->insert(size); + else + useCases_QVector_int->insert(size); +} + +void tst_vector_vs_std::insert_Large_data() +{ + QTest::addColumn<bool>("useStd"); + QTest::addColumn<int>("size"); + + for (int size = 10; size < LARGE_MAX_SIZE; size += 100) { + const QByteArray sizeString = QByteArray::number(size); + QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size; + QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size; + } +} + +void tst_vector_vs_std::insert_Large() +{ + QFETCH(bool, useStd); + QFETCH(int, size); + + if (useStd) + useCases_stdvector_Large->insert(size); + else + useCases_QVector_Large->insert(size); +} + +//! [1] +void tst_vector_vs_std::lookup_int_data() +{ + QTest::addColumn<bool>("useStd"); + QTest::addColumn<int>("size"); + + for (int size = 10; size < 20000; size += 100) { + const QByteArray sizeString = QByteArray::number(size); + QTest::newRow(("std::vector-int--" + sizeString).constData()) << true << size; + QTest::newRow(("QVector-int--" + sizeString).constData()) << false << size; + } +} +//! [1] + +//! [2] +void tst_vector_vs_std::lookup_int() +{ + QFETCH(bool, useStd); + QFETCH(int, size); + + if (useStd) + useCases_stdvector_int->lookup(size); // Create a std::vector and run the benchmark. + else + useCases_QVector_int->lookup(size); // Create a QVector and run the benchmark. +} +//! [2] + +void tst_vector_vs_std::lookup_Large_data() +{ + QTest::addColumn<bool>("useStd"); + QTest::addColumn<int>("size"); + + for (int size = 10; size < LARGE_MAX_SIZE; size += 100) { + const QByteArray sizeString = QByteArray::number(size); + QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size; + QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size; + } +} + +void tst_vector_vs_std::lookup_Large() +{ + QFETCH(bool, useStd); + QFETCH(int, size); + + if (useStd) + useCases_stdvector_Large->lookup(size); + else + useCases_QVector_Large->lookup(size); +} + +QTEST_MAIN(tst_vector_vs_std) +#include "main.moc" diff --git a/examples/tools/customtype/message.cpp b/examples/tools/customtype/message.cpp index 4ef041a..d27159e 100644 --- a/examples/tools/customtype/message.cpp +++ b/examples/tools/customtype/message.cpp @@ -64,7 +64,7 @@ Message::Message(const QString &body, const QStringList &headers) } //! [custom type streaming operator] -QDebug &operator<<(QDebug &dbg, const Message &message) +QDebug operator<<(QDebug dbg, const Message &message) { QStringList pieces = message.body().split("\r\n", QString::SkipEmptyParts); if (pieces.isEmpty()) diff --git a/examples/tools/customtype/message.h b/examples/tools/customtype/message.h index 361f803..4ef48d4 100644 --- a/examples/tools/customtype/message.h +++ b/examples/tools/customtype/message.h @@ -70,7 +70,7 @@ Q_DECLARE_METATYPE(Message); //! [custom type meta-type declaration] //! [custom type streaming operator] -QDebug &operator<<(QDebug &dbg, const Message &message); +QDebug operator<<(QDebug dbg, const Message &message); //! [custom type streaming operator] #endif diff --git a/examples/uitools/textfinder/textfinder.cpp b/examples/uitools/textfinder/textfinder.cpp index 855f11f..1b7c14b 100644 --- a/examples/uitools/textfinder/textfinder.cpp +++ b/examples/uitools/textfinder/textfinder.cpp @@ -116,7 +116,7 @@ void TextFinder::on_findButton_clicked() if (isFirstTime == false) document->undo(); - if (searchString == "") { + if (searchString.isEmpty()) { QMessageBox::information(this, tr("Empty Search Field"), "The search field is empty. Please enter a word and click Find."); } else { diff --git a/examples/webkit/framecapture/framecapture.pro b/examples/webkit/framecapture/framecapture.pro index 6f2f093..11960b9 100644 --- a/examples/webkit/framecapture/framecapture.pro +++ b/examples/webkit/framecapture/framecapture.pro @@ -1,4 +1,4 @@ -QT += webkit +QT += webkit network HEADERS = framecapture.h SOURCES = main.cpp \ diff --git a/examples/webkit/simpleselector/simpleselector.pro b/examples/webkit/simpleselector/simpleselector.pro index acd0ae7..3ddd6db 100644 --- a/examples/webkit/simpleselector/simpleselector.pro +++ b/examples/webkit/simpleselector/simpleselector.pro @@ -1,4 +1,4 @@ -QT += webkit +QT += webkit network FORMS = window.ui HEADERS = window.h SOURCES = main.cpp \ |