From 0f31f63e11d4fcb2b399979de28368a89275b911 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 12:17:58 +1000 Subject: Bearer Management Integration 1. --- config.tests/mac/corelwan/corewlan.pro | 4 + config.tests/mac/corelwan/corewlantest.mm | 49 + config.tests/unix/networkmanager/main.cpp | 47 + .../unix/networkmanager/networkmanager.pro | 11 + examples/network/bearercloud/bearercloud.cpp | 197 ++++ examples/network/bearercloud/bearercloud.h | 81 ++ examples/network/bearercloud/bearercloud.pro | 30 + examples/network/bearercloud/cloud.cpp | 361 ++++++ examples/network/bearercloud/cloud.h | 97 ++ examples/network/bearercloud/icons.qrc | 7 + examples/network/bearercloud/lan.svg | 76 ++ examples/network/bearercloud/main.cpp | 89 ++ examples/network/bearercloud/unknown.svg | 76 ++ examples/network/bearercloud/wlan.svg | 151 +++ examples/network/bearermonitor/bearermonitor.cpp | 395 +++++++ examples/network/bearermonitor/bearermonitor.h | 92 ++ examples/network/bearermonitor/bearermonitor.pro | 32 + .../network/bearermonitor/bearermonitor_240_320.ui | 420 +++++++ .../network/bearermonitor/bearermonitor_640_480.ui | 386 +++++++ examples/network/bearermonitor/main.cpp | 55 + examples/network/bearermonitor/sessionwidget.cpp | 156 +++ examples/network/bearermonitor/sessionwidget.h | 75 ++ examples/network/bearermonitor/sessionwidget.ui | 251 +++++ src/network/bearer/bearer.pro | 163 +++ src/network/bearer/qcorewlanengine_mac.mm | 461 ++++++++ src/network/bearer/qcorewlanengine_mac_p.h | 100 ++ src/network/bearer/qgenericengine.cpp | 234 ++++ src/network/bearer/qgenericengine_p.h | 94 ++ src/network/bearer/qnativewifiengine_win.cpp | 726 ++++++++++++ src/network/bearer/qnativewifiengine_win_p.h | 95 ++ src/network/bearer/qnetworkconfigmanager.cpp | 333 ++++++ src/network/bearer/qnetworkconfigmanager.h | 101 ++ src/network/bearer/qnetworkconfigmanager_maemo.cpp | 760 +++++++++++++ src/network/bearer/qnetworkconfigmanager_maemo_p.h | 141 +++ src/network/bearer/qnetworkconfigmanager_p.cpp | 450 ++++++++ src/network/bearer/qnetworkconfigmanager_p.h | 178 +++ src/network/bearer/qnetworkconfigmanager_s60_p.cpp | 974 ++++++++++++++++ src/network/bearer/qnetworkconfigmanager_s60_p.h | 182 +++ src/network/bearer/qnetworkconfiguration.cpp | 349 ++++++ src/network/bearer/qnetworkconfiguration.h | 113 ++ src/network/bearer/qnetworkconfiguration_maemo_p.h | 109 ++ src/network/bearer/qnetworkconfiguration_p.h | 104 ++ src/network/bearer/qnetworkconfiguration_s60_p.cpp | 60 + src/network/bearer/qnetworkconfiguration_s60_p.h | 108 ++ src/network/bearer/qnetworkmanagerservice_p.cpp | 1011 +++++++++++++++++ src/network/bearer/qnetworkmanagerservice_p.h | 400 +++++++ src/network/bearer/qnetworksession.cpp | 689 ++++++++++++ src/network/bearer/qnetworksession.h | 135 +++ src/network/bearer/qnetworksession_maemo.cpp | 1181 ++++++++++++++++++++ src/network/bearer/qnetworksession_maemo_p.h | 167 +++ src/network/bearer/qnetworksession_p.cpp | 542 +++++++++ src/network/bearer/qnetworksession_p.h | 167 +++ src/network/bearer/qnetworksession_s60_p.cpp | 1168 +++++++++++++++++++ src/network/bearer/qnetworksession_s60_p.h | 213 ++++ src/network/bearer/qnetworksessionengine.cpp | 57 + src/network/bearer/qnetworksessionengine_p.h | 98 ++ src/network/bearer/qnetworksessionengine_win_p.h | 145 +++ src/network/bearer/qnlaengine_win.cpp | 592 ++++++++++ src/network/bearer/qnlaengine_win_p.h | 104 ++ src/network/bearer/qnmdbushelper.cpp | 117 ++ src/network/bearer/qnmdbushelper_p.h | 90 ++ src/network/bearer/qnmwifiengine_unix.cpp | 1133 +++++++++++++++++++ src/network/bearer/qnmwifiengine_unix_p.h | 164 +++ tests/auto/qbearertestcommon.h | 74 ++ .../qnetworkconfigmanager.pro | 15 + .../tst_qnetworkconfigmanager.cpp | 335 ++++++ .../qnetworkconfiguration.pro | 15 + .../tst_qnetworkconfiguration.cpp | 303 +++++ tests/auto/qnetworksession/lackey/lackey.pro | 12 + tests/auto/qnetworksession/lackey/main.cpp | 138 +++ tests/auto/qnetworksession/qnetworksession.pro | 2 + .../tst_qnetworksession/tst_qnetworksession.cpp | 873 +++++++++++++++ .../tst_qnetworksession/tst_qnetworksession.pro | 21 + tests/manual/bearerex/bearerex.cpp | 565 ++++++++++ tests/manual/bearerex/bearerex.h | 138 +++ tests/manual/bearerex/bearerex.pro | 34 + tests/manual/bearerex/bearerex.ui | 95 ++ tests/manual/bearerex/detailedinfodialog.ui | 54 + tests/manual/bearerex/main.cpp | 58 + tests/manual/bearerex/sessiondialog.ui | 139 +++ tests/manual/bearerex/xqlistwidget.cpp | 66 ++ tests/manual/bearerex/xqlistwidget.h | 58 + tests/manual/networkmanager/README | 2 + tests/manual/networkmanager/dialog.ui | 213 ++++ tests/manual/networkmanager/networkmanager.pro | 19 + tests/manual/networkmanager/networkmanagertest.cpp | 287 +++++ tests/manual/networkmanager/nmview.cpp | 1030 +++++++++++++++++ tests/manual/networkmanager/nmview.h | 107 ++ tests/manual/networkmanager/startdlg.cpp | 95 ++ tests/manual/networkmanager/startdlg.h | 58 + 90 files changed, 21952 insertions(+) create mode 100644 config.tests/mac/corelwan/corewlan.pro create mode 100644 config.tests/mac/corelwan/corewlantest.mm create mode 100644 config.tests/unix/networkmanager/main.cpp create mode 100644 config.tests/unix/networkmanager/networkmanager.pro create mode 100644 examples/network/bearercloud/bearercloud.cpp create mode 100644 examples/network/bearercloud/bearercloud.h create mode 100644 examples/network/bearercloud/bearercloud.pro create mode 100644 examples/network/bearercloud/cloud.cpp create mode 100644 examples/network/bearercloud/cloud.h create mode 100644 examples/network/bearercloud/icons.qrc create mode 100644 examples/network/bearercloud/lan.svg create mode 100644 examples/network/bearercloud/main.cpp create mode 100644 examples/network/bearercloud/unknown.svg create mode 100644 examples/network/bearercloud/wlan.svg create mode 100644 examples/network/bearermonitor/bearermonitor.cpp create mode 100644 examples/network/bearermonitor/bearermonitor.h create mode 100644 examples/network/bearermonitor/bearermonitor.pro create mode 100644 examples/network/bearermonitor/bearermonitor_240_320.ui create mode 100644 examples/network/bearermonitor/bearermonitor_640_480.ui create mode 100644 examples/network/bearermonitor/main.cpp create mode 100644 examples/network/bearermonitor/sessionwidget.cpp create mode 100644 examples/network/bearermonitor/sessionwidget.h create mode 100644 examples/network/bearermonitor/sessionwidget.ui create mode 100644 src/network/bearer/bearer.pro create mode 100644 src/network/bearer/qcorewlanengine_mac.mm create mode 100644 src/network/bearer/qcorewlanengine_mac_p.h create mode 100644 src/network/bearer/qgenericengine.cpp create mode 100644 src/network/bearer/qgenericengine_p.h create mode 100644 src/network/bearer/qnativewifiengine_win.cpp create mode 100644 src/network/bearer/qnativewifiengine_win_p.h create mode 100644 src/network/bearer/qnetworkconfigmanager.cpp create mode 100644 src/network/bearer/qnetworkconfigmanager.h create mode 100644 src/network/bearer/qnetworkconfigmanager_maemo.cpp create mode 100644 src/network/bearer/qnetworkconfigmanager_maemo_p.h create mode 100644 src/network/bearer/qnetworkconfigmanager_p.cpp create mode 100644 src/network/bearer/qnetworkconfigmanager_p.h create mode 100644 src/network/bearer/qnetworkconfigmanager_s60_p.cpp create mode 100644 src/network/bearer/qnetworkconfigmanager_s60_p.h create mode 100644 src/network/bearer/qnetworkconfiguration.cpp create mode 100644 src/network/bearer/qnetworkconfiguration.h create mode 100644 src/network/bearer/qnetworkconfiguration_maemo_p.h create mode 100644 src/network/bearer/qnetworkconfiguration_p.h create mode 100644 src/network/bearer/qnetworkconfiguration_s60_p.cpp create mode 100644 src/network/bearer/qnetworkconfiguration_s60_p.h create mode 100644 src/network/bearer/qnetworkmanagerservice_p.cpp create mode 100644 src/network/bearer/qnetworkmanagerservice_p.h create mode 100644 src/network/bearer/qnetworksession.cpp create mode 100644 src/network/bearer/qnetworksession.h create mode 100644 src/network/bearer/qnetworksession_maemo.cpp create mode 100644 src/network/bearer/qnetworksession_maemo_p.h create mode 100644 src/network/bearer/qnetworksession_p.cpp create mode 100644 src/network/bearer/qnetworksession_p.h create mode 100644 src/network/bearer/qnetworksession_s60_p.cpp create mode 100644 src/network/bearer/qnetworksession_s60_p.h create mode 100644 src/network/bearer/qnetworksessionengine.cpp create mode 100644 src/network/bearer/qnetworksessionengine_p.h create mode 100644 src/network/bearer/qnetworksessionengine_win_p.h create mode 100644 src/network/bearer/qnlaengine_win.cpp create mode 100644 src/network/bearer/qnlaengine_win_p.h create mode 100644 src/network/bearer/qnmdbushelper.cpp create mode 100644 src/network/bearer/qnmdbushelper_p.h create mode 100644 src/network/bearer/qnmwifiengine_unix.cpp create mode 100644 src/network/bearer/qnmwifiengine_unix_p.h create mode 100644 tests/auto/qbearertestcommon.h create mode 100644 tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro create mode 100644 tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp create mode 100644 tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro create mode 100644 tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp create mode 100644 tests/auto/qnetworksession/lackey/lackey.pro create mode 100644 tests/auto/qnetworksession/lackey/main.cpp create mode 100644 tests/auto/qnetworksession/qnetworksession.pro create mode 100644 tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp create mode 100644 tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro create mode 100644 tests/manual/bearerex/bearerex.cpp create mode 100644 tests/manual/bearerex/bearerex.h create mode 100644 tests/manual/bearerex/bearerex.pro create mode 100644 tests/manual/bearerex/bearerex.ui create mode 100644 tests/manual/bearerex/detailedinfodialog.ui create mode 100644 tests/manual/bearerex/main.cpp create mode 100644 tests/manual/bearerex/sessiondialog.ui create mode 100644 tests/manual/bearerex/xqlistwidget.cpp create mode 100644 tests/manual/bearerex/xqlistwidget.h create mode 100644 tests/manual/networkmanager/README create mode 100644 tests/manual/networkmanager/dialog.ui create mode 100644 tests/manual/networkmanager/networkmanager.pro create mode 100644 tests/manual/networkmanager/networkmanagertest.cpp create mode 100644 tests/manual/networkmanager/nmview.cpp create mode 100644 tests/manual/networkmanager/nmview.h create mode 100644 tests/manual/networkmanager/startdlg.cpp create mode 100644 tests/manual/networkmanager/startdlg.h diff --git a/config.tests/mac/corelwan/corewlan.pro b/config.tests/mac/corelwan/corewlan.pro new file mode 100644 index 0000000..54a6c36 --- /dev/null +++ b/config.tests/mac/corelwan/corewlan.pro @@ -0,0 +1,4 @@ +SOURCES=corewlantest.mm +TARGET=corewlan +LIBS += -framework CoreWLAN -framework Foundation +CONFIG-=app_bundle diff --git a/config.tests/mac/corelwan/corewlantest.mm b/config.tests/mac/corelwan/corewlantest.mm new file mode 100644 index 0000000..bcddf44 --- /dev/null +++ b/config.tests/mac/corelwan/corewlantest.mm @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +int main() +{ + [CWInterface interfaceWithName:@"en2"]; + return 0; +} diff --git a/config.tests/unix/networkmanager/main.cpp b/config.tests/unix/networkmanager/main.cpp new file mode 100644 index 0000000..6f2bae6 --- /dev/null +++ b/config.tests/unix/networkmanager/main.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/config.tests/unix/networkmanager/networkmanager.pro b/config.tests/unix/networkmanager/networkmanager.pro new file mode 100644 index 0000000..554f513 --- /dev/null +++ b/config.tests/unix/networkmanager/networkmanager.pro @@ -0,0 +1,11 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Mon Oct 19 12:58:26 2009 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp diff --git a/examples/network/bearercloud/bearercloud.cpp b/examples/network/bearercloud/bearercloud.cpp new file mode 100644 index 0000000..182d4ec --- /dev/null +++ b/examples/network/bearercloud/bearercloud.cpp @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "bearercloud.h" +#include "cloud.h" + +#include +#include +#include +#include + +#include + +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +//! [0] +BearerCloud::BearerCloud(QObject *parent) +: QGraphicsScene(parent), timerId(0) +{ + setSceneRect(-300, -300, 600, 600); + + qsrand(QDateTime::currentDateTime().toTime_t()); + + offset[QNetworkConfiguration::Active] = 2 * M_PI * qrand() / RAND_MAX; + offset[QNetworkConfiguration::Discovered] = offset[QNetworkConfiguration::Active] + M_PI / 6; + offset[QNetworkConfiguration::Defined] = offset[QNetworkConfiguration::Discovered] - M_PI / 6; + offset[QNetworkConfiguration::Undefined] = offset[QNetworkConfiguration::Undefined] + M_PI / 6; + + thisDevice = new QGraphicsTextItem(QHostInfo::localHostName()); + thisDevice->setData(0, QLatin1String("This Device")); + thisDevice->setPos(thisDevice->boundingRect().width() / -2, + thisDevice->boundingRect().height() / -2); + addItem(thisDevice); + + qreal radius = Cloud::getRadiusForState(QNetworkConfiguration::Active); + QGraphicsEllipseItem *orbit = new QGraphicsEllipseItem(-radius, -radius, 2*radius, 2*radius); + orbit->setPen(QColor(Qt::green)); + addItem(orbit); + radius = Cloud::getRadiusForState(QNetworkConfiguration::Discovered); + orbit = new QGraphicsEllipseItem(-radius, -radius, 2*radius, 2*radius); + orbit->setPen(QColor(Qt::blue)); + addItem(orbit); + radius = Cloud::getRadiusForState(QNetworkConfiguration::Defined); + orbit = new QGraphicsEllipseItem(-radius, -radius, 2*radius, 2*radius); + orbit->setPen(QColor(Qt::darkGray)); + addItem(orbit); + radius = Cloud::getRadiusForState(QNetworkConfiguration::Undefined); + orbit = new QGraphicsEllipseItem(-radius, -radius, 2*radius, 2*radius); + orbit->setPen(QColor(Qt::lightGray)); + addItem(orbit); + + connect(&manager, SIGNAL(configurationAdded(QNetworkConfiguration)), + this, SLOT(configurationAdded(QNetworkConfiguration))); + connect(&manager, SIGNAL(configurationRemoved(QNetworkConfiguration)), + this, SLOT(configurationRemoved(QNetworkConfiguration))); + connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + + QTimer::singleShot(0, this, SLOT(updateConfigurations())); +} +//! [0] + +BearerCloud::~BearerCloud() +{ +} + +void BearerCloud::cloudMoved() +{ + if (!timerId) + timerId = startTimer(1000 / 25); +} + +void BearerCloud::timerEvent(QTimerEvent *) +{ + QList clouds; + foreach (QGraphicsItem *item, items()) { + if (Cloud *cloud = qgraphicsitem_cast(item)) + clouds << cloud; + } + + foreach (Cloud *cloud, clouds) + cloud->calculateForces(); + + bool cloudsMoved = false; + foreach (Cloud *cloud, clouds) + cloudsMoved |= cloud->advance(); + + if (!cloudsMoved) { + killTimer(timerId); + timerId = 0; + } +} + +//! [2] +void BearerCloud::configurationAdded(const QNetworkConfiguration &config) +{ + const QNetworkConfiguration::StateFlags state = config.state(); + + configStates.insert(state, config.identifier()); + + const qreal radius = Cloud::getRadiusForState(state); + const int count = configStates.count(state); + const qreal angle = 2 * M_PI / count; + + Cloud *item = new Cloud(config); + configurations.insert(config.identifier(), item); + + item->setPos(radius * cos((count-1) * angle + offset[state]), + radius * sin((count-1) * angle + offset[state])); + + addItem(item); + + cloudMoved(); +} +//! [2] + +//! [3] +void BearerCloud::configurationRemoved(const QNetworkConfiguration &config) +{ + foreach (const QNetworkConfiguration::StateFlags &state, configStates.uniqueKeys()) + configStates.remove(state, config.identifier()); + + Cloud *item = configurations.take(config.identifier()); + + item->setFinalScale(0.0); + item->setDeleteAfterAnimation(true); + + cloudMoved(); +} +//! [3] + +//! [4] +void BearerCloud::configurationChanged(const QNetworkConfiguration &config) +{ + foreach (const QNetworkConfiguration::StateFlags &state, configStates.uniqueKeys()) + configStates.remove(state, config.identifier()); + + configStates.insert(config.state(), config.identifier()); + + cloudMoved(); +} +//! [4] + +//! [1] +void BearerCloud::updateConfigurations() +{ + QList allConfigurations = manager.allConfigurations(); + + while (!allConfigurations.isEmpty()) + configurationAdded(allConfigurations.takeFirst()); + + cloudMoved(); +} +//! [1] + diff --git a/examples/network/bearercloud/bearercloud.h b/examples/network/bearercloud/bearercloud.h new file mode 100644 index 0000000..c18ffd3 --- /dev/null +++ b/examples/network/bearercloud/bearercloud.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include +#include + +QTM_USE_NAMESPACE + +class Cloud; + +class BearerCloud : public QGraphicsScene +{ + Q_OBJECT + +public: + BearerCloud(QObject *parent = 0); + ~BearerCloud(); + + void cloudMoved(); + + void timerEvent(QTimerEvent *event); + +private Q_SLOTS: + void configurationAdded(const QNetworkConfiguration &config); + void configurationRemoved(const QNetworkConfiguration &config); + void configurationChanged(const QNetworkConfiguration &config); + void updateConfigurations(); + +private: + QNetworkConfigurationManager manager; + + QGraphicsTextItem *thisDevice; + QHash configurations; + + QMap offset; + QMultiMap configStates; + + int timerId; +}; + diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro new file mode 100644 index 0000000..308ddda --- /dev/null +++ b/examples/network/bearercloud/bearercloud.pro @@ -0,0 +1,30 @@ +HEADERS = bearercloud.h \ + cloud.h + +SOURCES = main.cpp \ + bearercloud.cpp \ + cloud.cpp + +RESOURCES = icons.qrc + +TARGET = bearercloud + +QT = core gui network svg + +INCLUDEPATH += ../../src/bearer + +include(../examples.pri) + +qtAddLibrary(QtBearer) + +CONFIG += console + +include(../examples.pri) + + +macx: { + contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer + INCLUDEPATH += ../../ + contains(CONFIG, debug) { + } +} diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp new file mode 100644 index 0000000..4a1bde7 --- /dev/null +++ b/examples/network/bearercloud/cloud.cpp @@ -0,0 +1,361 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "cloud.h" +#include "bearercloud.h" + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +static QMap svgCache; + +//! [0] +Cloud::Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent) +: QGraphicsItem(parent), configuration(config), deleteAfterAnimation(false) +{ + session = new QNetworkSession(configuration, this); + connect(session, SIGNAL(newConfigurationActivated()), + this, SLOT(newConfigurationActivated())); + connect(session, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(stateChanged(QNetworkSession::State))); + + setFlag(ItemIsMovable); +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)) + setFlag(ItemSendsGeometryChanges); +#endif + setZValue(1); + + icon = new QGraphicsSvgItem(this); + text = new QGraphicsTextItem(this); + + currentScale = 0; + finalScale = 1; + setTransform(QTransform::fromScale(currentScale, currentScale), false); + setOpacity(0); + + newConfigurationActivated(); +} +//! [0] + +Cloud::~Cloud() +{ +} + +void Cloud::setFinalScale(qreal factor) +{ + finalScale = factor; +} + +void Cloud::setDeleteAfterAnimation(bool deleteAfter) +{ + deleteAfterAnimation = deleteAfter; +} + +void Cloud::calculateForces() +{ + if (!scene() || scene()->mouseGrabberItem() == this) { + newPos = pos(); + return; + } + + // sum up all the forces push this item away + qreal xvel = 0; + qreal yvel = 0; + QLineF orbitForce; + foreach (QGraphicsItem *item, scene()->items()) { + // other clouds + Cloud *cloud = qgraphicsitem_cast(item); + if (!cloud && item->data(0) != QLatin1String("This Device")) + continue; + + qreal factor = 1.0; + + QLineF line(cloud ? item->mapToScene(0, 0) : QPointF(0, 0), mapToScene(0, 0)); + if (item->data(0) == QLatin1String("This Device")) + orbitForce = line; + + if (cloud) + factor = cloud->currentScale; + + qreal dx = line.dx(); + qreal dy = line.dy(); + double l = 2.0 * (dx * dx + dy * dy); + if (l > 0) { + xvel += factor * dx * 200.0 / l; + yvel += factor * dy * 200.0 / l; + } + } + + // tendency to stay at a fixed orbit + qreal orbit = getRadiusForState(configuration.state()); + qreal distance = orbitForce.length(); + + QLineF unit = orbitForce.unitVector(); + + orbitForce.setLength(xvel * unit.dx() + yvel * unit.dy()); + + qreal w = 2 - exp(-pow(distance-orbit, 2)/(2 * 50)); + + if (distance < orbit) { + xvel += orbitForce.dx() * w; + yvel += orbitForce.dy() * w; + } else { + xvel -= orbitForce.dx() * w; + yvel -= orbitForce.dy() * w; + } + + if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1) + xvel = yvel = 0; + + QRectF sceneRect = scene()->sceneRect(); + newPos = pos() + QPointF(xvel, yvel); + newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10)); + newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10)); +} + +bool Cloud::advance() +{ + static const qreal scaleDelta = 0.01; + + bool animated = false; + + if (currentScale < finalScale) { + animated = true; + currentScale = qMin(currentScale + scaleDelta, finalScale); + setTransform(QTransform::fromScale(currentScale, currentScale), false); + } else if (currentScale > finalScale) { + animated = true; + currentScale = qMax(currentScale - scaleDelta, finalScale); + setTransform(QTransform::fromScale(currentScale, currentScale), false); + } + + if (newPos != pos()) { + setPos(newPos); + animated = true; + } + + if (opacity() != finalOpacity) { + animated = true; + if (qAbs(finalScale - currentScale) > 0.0) { + // use scale as reference + setOpacity(opacity() + scaleDelta * (finalOpacity - opacity()) / + qAbs(finalScale - currentScale)); + } else { + setOpacity(finalOpacity); + } + } + + if (!animated && deleteAfterAnimation) + deleteLater(); + + return animated; +} + +QRectF Cloud::boundingRect() const +{ + return childrenBoundingRect(); +} + +void Cloud::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) +{ +} + +//! [4] +QVariant Cloud::itemChange(GraphicsItemChange change, const QVariant &value) +{ + switch (change) { + case ItemPositionHasChanged: + if (BearerCloud *bearercloud = qobject_cast(scene())) + bearercloud->cloudMoved(); + default: + ; + }; + + return QGraphicsItem::itemChange(change, value); +} +//! [4] + +//! [3] +void Cloud::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + if (session->isActive()) + session->close(); + else + session->open(); + + event->accept(); + } +} +//! [3] + +//! [2] +void Cloud::stateChanged(QNetworkSession::State state) +{ + if (configuration.name().isEmpty()) + finalOpacity = qreal(0.1); + else if (session->state() == QNetworkSession::NotAvailable) + finalOpacity = 0.5; + else + finalOpacity = 1.0; + + QString tooltip; + + if (configuration.name().isEmpty()) + tooltip += tr("HIDDEN NETWORK
"); + else + tooltip += tr("%1
").arg(configuration.name()); + + const QNetworkInterface interface = session->interface(); + if (interface.isValid()) + tooltip += tr("
Interface: %1").arg(interface.humanReadableName()); + tooltip += tr("
Id: %1").arg(configuration.identifier()); + + const QString bearerName = session->bearerName(); + if (!bearerName.isEmpty()) + tooltip += tr("
Bearer: %1").arg(bearerName); + + QString s = tr("
State: %1 (%2)"); + switch (state) { + case QNetworkSession::Invalid: + s = s.arg(tr("Invalid")); + break; + case QNetworkSession::NotAvailable: + s = s.arg(tr("Not Available")); + break; + case QNetworkSession::Connecting: + s = s.arg(tr("Connecting")); + break; + case QNetworkSession::Connected: + s = s.arg(tr("Connected")); + break; + case QNetworkSession::Closing: + s = s.arg(tr("Closing")); + break; + case QNetworkSession::Disconnected: + s = s.arg(tr("Disconnected")); + break; + case QNetworkSession::Roaming: + s = s.arg(tr("Roaming")); + break; + default: + s = s.arg(tr("Unknown")); + } + + if (session->isActive()) + s = s.arg(tr("Active")); + else + s = s.arg(tr("Inactive")); + + tooltip += s; + + tooltip += tr("

Active time: %1 seconds").arg(session->activeTime()); + tooltip += tr("
Received data: %1 bytes").arg(session->bytesReceived()); + tooltip += tr("
Sent data: %1 bytes").arg(session->bytesWritten()); + + setToolTip(tooltip); +} +//! [2] + +//! [1] +void Cloud::newConfigurationActivated() +{ + const QString bearerName = session->bearerName(); + if (!svgCache.contains(bearerName)) { + if (bearerName == QLatin1String("WLAN")) + svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg"))); + else if (bearerName == QLatin1String("Ethernet")) + svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":lan.svg"))); + else + svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":unknown.svg"))); + } + + icon->setSharedRenderer(svgCache[bearerName]); + + if (configuration.name().isEmpty()) { + text->setPlainText(tr("HIDDEN NETWORK")); + } else { + if (configuration.type() == QNetworkConfiguration::ServiceNetwork) + text->setHtml("" + configuration.name() + ""); + else + text->setPlainText(configuration.name()); + } + + const qreal height = icon->boundingRect().height() + text->boundingRect().height(); + + icon->setPos(icon->boundingRect().width() / -2, height / -2); + + text->setPos(text->boundingRect().width() / -2, + height / 2 - text->boundingRect().height()); + + stateChanged(session->state()); +} +//! [1] + +qreal Cloud::getRadiusForState(QNetworkConfiguration::StateFlags state) +{ + switch (state) { + case QNetworkConfiguration::Active: + return 100; + break; + case QNetworkConfiguration::Discovered: + return 150; + break; + case QNetworkConfiguration::Defined: + return 200; + break; + case QNetworkConfiguration::Undefined: + return 250; + break; + default: + return 300; + } +} + diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h new file mode 100644 index 0000000..4ce43df --- /dev/null +++ b/examples/network/bearercloud/cloud.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +QTM_USE_NAMESPACE + +class QGraphicsTextItem; +class QGraphicsSvgItem; + +class Cloud : public QObject, public QGraphicsItem +{ + Q_OBJECT + Q_INTERFACES(QGraphicsItem) + +public: + Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent = 0); + ~Cloud(); + + enum { Type = UserType + 1 }; + int type() const { return Type; } + + void setFinalScale(qreal factor); + void setDeleteAfterAnimation(bool deleteAfter); + + void calculateForces(); + + bool advance(); + QRectF boundingRect() const; + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + + static qreal getRadiusForState(QNetworkConfiguration::StateFlags state); + +protected: + QVariant itemChange(GraphicsItemChange change, const QVariant &value); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + +private Q_SLOTS: + void stateChanged(QNetworkSession::State state); + void newConfigurationActivated(); + +private: + QNetworkConfiguration configuration; + QNetworkSession *session; + + QGraphicsTextItem *text; + QGraphicsSvgItem *icon; + + qreal finalOpacity; + qreal finalScale; + qreal currentScale; + + QPointF newPos; + + bool deleteAfterAnimation; +}; + diff --git a/examples/network/bearercloud/icons.qrc b/examples/network/bearercloud/icons.qrc new file mode 100644 index 0000000..84a8939 --- /dev/null +++ b/examples/network/bearercloud/icons.qrc @@ -0,0 +1,7 @@ + + + wlan.svg + lan.svg + unknown.svg + + diff --git a/examples/network/bearercloud/lan.svg b/examples/network/bearercloud/lan.svg new file mode 100644 index 0000000..3cce805 --- /dev/null +++ b/examples/network/bearercloud/lan.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + image/svg+xml + + + + + + LAN + + diff --git a/examples/network/bearercloud/main.cpp b/examples/network/bearercloud/main.cpp new file mode 100644 index 0000000..33c55e9 --- /dev/null +++ b/examples/network/bearercloud/main.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "bearercloud.h" + +#include +#include + +class CloudView : public QGraphicsView +{ + Q_OBJECT + +public: + CloudView(QGraphicsScene *scene); + ~CloudView() { } + +protected: + void resizeEvent(QResizeEvent *) { + fitInView(sceneRect(), Qt::KeepAspectRatio); + } +#ifdef Q_OS_WINCE + void hideEvent(QHideEvent *) { + qApp->quit(); + } +#endif +}; + +CloudView::CloudView(QGraphicsScene *scene) +: QGraphicsView(scene) +{ + setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing | + QPainter::SmoothPixmapTransform); +#if defined (Q_OS_SYMBIAN) || defined (Q_OS_WINCE) + setWindowState(Qt::WindowMaximized); +#endif +} + +#include "main.moc" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + BearerCloud bearerCloud; + + CloudView view(&bearerCloud); + view.show(); + + return app.exec(); +} + diff --git a/examples/network/bearercloud/unknown.svg b/examples/network/bearercloud/unknown.svg new file mode 100644 index 0000000..fd10298 --- /dev/null +++ b/examples/network/bearercloud/unknown.svg @@ -0,0 +1,76 @@ + + + + + + + + + + + image/svg+xml + + + + + + NET + + diff --git a/examples/network/bearercloud/wlan.svg b/examples/network/bearercloud/wlan.svg new file mode 100644 index 0000000..8b86089 --- /dev/null +++ b/examples/network/bearercloud/wlan.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp new file mode 100644 index 0000000..70c8269 --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -0,0 +1,395 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "bearermonitor.h" +#include "sessionwidget.h" + +#include + +#ifdef Q_OS_WIN +#include +#undef interface + +#ifndef NS_NLA +#define NS_NLA 15 +#endif +#endif + +BearerMonitor::BearerMonitor(QWidget *parent) +: QWidget(parent) +{ + setupUi(this); + delete tabWidget->currentWidget(); + sessionGroup->hide(); +#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) + setWindowState(Qt::WindowMaximized); +#endif + updateConfigurations(); + + onlineStateChanged(!manager.allConfigurations(QNetworkConfiguration::Active).isEmpty()); + + QNetworkConfiguration defaultConfiguration = manager.defaultConfiguration(); + for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) { + QTreeWidgetItem *item = treeWidget->topLevelItem(i); + + if (item->data(0, Qt::UserRole).toString() == defaultConfiguration.identifier()) { + treeWidget->setCurrentItem(item); + showConfigurationFor(item); + break; + } + } + + connect(&manager, SIGNAL(configurationAdded(const QNetworkConfiguration&)), + this, SLOT(configurationAdded(const QNetworkConfiguration&))); + connect(&manager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)), + this, SLOT(configurationRemoved(const QNetworkConfiguration&))); + connect(&manager, SIGNAL(configurationChanged(const QNetworkConfiguration&)), + this, SLOT(configurationChanged(const QNetworkConfiguration))); + connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations())); + connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool))); + +#ifdef Q_OS_WIN + connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork())); + connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork())); +#else + nlaGroup->hide(); +#endif + + connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), + this, SLOT(createSessionFor(QTreeWidgetItem*))); + + connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), + this, SLOT(showConfigurationFor(QTreeWidgetItem*))); + + connect(newSessionButton, SIGNAL(clicked()), + this, SLOT(createNewSession())); + connect(deleteSessionButton, SIGNAL(clicked()), + this, SLOT(deleteSession())); + + connect(scanButton, SIGNAL(clicked()), + this, SLOT(performScan())); +} + +BearerMonitor::~BearerMonitor() +{ +} + +static void updateItem(QTreeWidgetItem *item, const QNetworkConfiguration &config) +{ + item->setText(0, config.name()); + item->setData(0, Qt::UserRole, config.identifier()); + + QFont font = item->font(1); + font.setBold((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active); + item->setFont(0, font); +} + +void BearerMonitor::configurationAdded(const QNetworkConfiguration &config, QTreeWidgetItem *parent) +{ + QTreeWidgetItem *item = new QTreeWidgetItem; + updateItem(item, config); + + if (parent) + parent->addChild(item); + else + treeWidget->addTopLevelItem(item); + + if (config.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &child, config.children()) + configurationAdded(child, item); + } +} + +void BearerMonitor::configurationRemoved(const QNetworkConfiguration &config) +{ + for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) { + QTreeWidgetItem *item = treeWidget->topLevelItem(i); + + if (item->data(0, Qt::UserRole).toString() == config.identifier()) { + delete item; + break; + } + } +} + +void BearerMonitor::configurationChanged(const QNetworkConfiguration &config) +{ + for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) { + QTreeWidgetItem *item = treeWidget->topLevelItem(i); + + if (item->data(0, Qt::UserRole).toString() == config.identifier()) { + updateItem(item, config); + + if (config.type() == QNetworkConfiguration::ServiceNetwork) + updateSnapConfiguration(item, config); + + if (item == treeWidget->currentItem()) + showConfigurationFor(item); + + break; + } + } +} + +void BearerMonitor::updateSnapConfiguration(QTreeWidgetItem *parent, const QNetworkConfiguration &snap) +{ + QMap itemMap; + for (int i = 0; i < parent->childCount(); ++i) { + QTreeWidgetItem *item = parent->child(i); + itemMap.insert(item->data(0, Qt::UserRole).toString(), item); + } + + QList allConfigurations = snap.children(); + + while (!allConfigurations.isEmpty()) { + QNetworkConfiguration config = allConfigurations.takeFirst(); + + QTreeWidgetItem *item = itemMap.take(config.identifier()); + if (item) { + updateItem(item, config); + + if (config.type() == QNetworkConfiguration::ServiceNetwork) + updateSnapConfiguration(item, config); + } else { + configurationAdded(config, parent); + } + } + + foreach (const QString &id, itemMap.keys()) + delete itemMap.value(id); + + itemMap.clear(); +} + +void BearerMonitor::updateConfigurations() +{ + progressBar->hide(); + scanButton->show(); + + QList items = treeWidget->findItems(QLatin1String("*"), Qt::MatchWildcard); + QMap itemMap; + while (!items.isEmpty()) { + QTreeWidgetItem *item = items.takeFirst(); + itemMap.insert(item->data(0, Qt::UserRole).toString(), item); + } + + QList allConfigurations = manager.allConfigurations(); + + while (!allConfigurations.isEmpty()) { + QNetworkConfiguration config = allConfigurations.takeFirst(); + + QTreeWidgetItem *item = itemMap.take(config.identifier()); + if (item) { + updateItem(item, config); + + if (config.type() == QNetworkConfiguration::ServiceNetwork) + updateSnapConfiguration(item, config); + } else { + configurationAdded(config); + } + } + + foreach (const QString &id, itemMap.keys()) + delete itemMap.value(id); +} + +void BearerMonitor::onlineStateChanged(bool isOnline) +{ + if (isOnline) + onlineState->setText(tr("Online")); + else + onlineState->setText(tr("Offline")); +} + +#ifdef Q_OS_WIN +void BearerMonitor::registerNetwork() +{ + QTreeWidgetItem *item = treeWidget->currentItem(); + + QNetworkConfiguration configuration = + manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); + + const QString name = configuration.name(); + + qDebug() << "Registering" << name << "with system"; + + WSAQUERYSET networkInfo; + memset(&networkInfo, 0, sizeof(networkInfo)); + networkInfo.dwSize = sizeof(networkInfo); + networkInfo.lpszServiceInstanceName = (LPWSTR)name.utf16(); + networkInfo.dwNameSpace = NS_NLA; + + if (WSASetService(&networkInfo, RNRSERVICE_REGISTER, 0) == SOCKET_ERROR) + qDebug() << "WSASetService(RNRSERVICE_REGISTER) returned" << WSAGetLastError(); +} + +void BearerMonitor::unregisterNetwork() +{ + QTreeWidgetItem *item = treeWidget->currentItem(); + + QNetworkConfiguration configuration = + manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); + + const QString name = configuration.name(); + + qDebug() << "Unregistering" << name << "with system"; + + WSAQUERYSET networkInfo; + memset(&networkInfo, 0, sizeof(networkInfo)); + networkInfo.dwSize = sizeof(networkInfo); + networkInfo.lpszServiceInstanceName = (LPWSTR)name.utf16(); + networkInfo.dwNameSpace = NS_NLA; + + if (WSASetService(&networkInfo, RNRSERVICE_DELETE, 0) == SOCKET_ERROR) + qDebug() << "WSASetService(RNRSERVICE_DELETE) returned" << WSAGetLastError(); +} +#endif + +void BearerMonitor::showConfigurationFor(QTreeWidgetItem *item) +{ + QString identifier; + + if (item) + identifier = item->data(0, Qt::UserRole).toString(); + + QNetworkConfiguration conf = manager.configurationFromIdentifier(identifier); + + switch (conf.state()) { + case QNetworkConfiguration::Active: + configurationState->setText(tr("Active")); + break; + case QNetworkConfiguration::Discovered: + configurationState->setText(tr("Discovered")); + break; + case QNetworkConfiguration::Defined: + configurationState->setText(tr("Defined")); + break; + case QNetworkConfiguration::Undefined: + configurationState->setText(tr("Undefined")); + break; + default: + configurationState->setText(QString()); + } + + switch (conf.type()) { + case QNetworkConfiguration::InternetAccessPoint: + configurationType->setText(tr("Internet Access Point")); + break; + case QNetworkConfiguration::ServiceNetwork: + configurationType->setText(tr("Service Network")); + break; + case QNetworkConfiguration::UserChoice: + configurationType->setText(tr("User Choice")); + break; + case QNetworkConfiguration::Invalid: + configurationType->setText(tr("Invalid")); + break; + default: + configurationType->setText(QString()); + } + + switch (conf.purpose()) { + case QNetworkConfiguration::UnknownPurpose: + configurationPurpose->setText(tr("Unknown")); + break; + case QNetworkConfiguration::PublicPurpose: + configurationPurpose->setText(tr("Public")); + break; + case QNetworkConfiguration::PrivatePurpose: + configurationPurpose->setText(tr("Private")); + break; + case QNetworkConfiguration::ServiceSpecificPurpose: + configurationPurpose->setText(tr("Service Specific")); + break; + default: + configurationPurpose->setText(QString()); + } + + configurationIdentifier->setText(conf.identifier()); + + configurationRoaming->setText(conf.isRoamingAvailable() ? tr("Available") : tr("Not available")); + + configurationChildren->setText(QString::number(conf.children().count())); + + configurationName->setText(conf.name()); +} + +void BearerMonitor::createSessionFor(QTreeWidgetItem *item) +{ + const QString identifier = item->data(0, Qt::UserRole).toString(); + + QNetworkConfiguration conf = manager.configurationFromIdentifier(identifier); + + SessionWidget *session = new SessionWidget(conf); + + tabWidget->addTab(session, conf.name()); + + sessionGroup->show(); + + sessionWidgets.append(session); +} + +void BearerMonitor::createNewSession() +{ + QTreeWidgetItem *item = treeWidget->currentItem(); + + createSessionFor(item); +} + +void BearerMonitor::deleteSession() +{ + SessionWidget *session = qobject_cast(tabWidget->currentWidget()); + if (session) { + sessionWidgets.removeAll(session); + + delete session; + + if (tabWidget->count() == 0) + sessionGroup->hide(); + } +} + +void BearerMonitor::performScan() +{ + scanButton->hide(); + progressBar->show(); + manager.updateConfigurations(); +} diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h new file mode 100644 index 0000000..d1f4601 --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 BEARERMONITOR_H +#define BEARERMONITOR_H + +#include +#include +#if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) +#include "ui_bearermonitor_240_320.h" +#else +#include "ui_bearermonitor_640_480.h" +#endif + +QTM_USE_NAMESPACE + +class SessionWidget; + +class BearerMonitor : public QWidget, public Ui_BearerMonitor +{ + Q_OBJECT + +public: + BearerMonitor(QWidget *parent = 0); + ~BearerMonitor(); + +private slots: + void configurationAdded(const QNetworkConfiguration &config, QTreeWidgetItem *parent = 0); + void configurationRemoved(const QNetworkConfiguration &config); + void configurationChanged(const QNetworkConfiguration &config); + void updateSnapConfiguration(QTreeWidgetItem *parent, const QNetworkConfiguration &snap); + void updateConfigurations(); + + void onlineStateChanged(bool isOnline); + +#ifdef Q_OS_WIN + void registerNetwork(); + void unregisterNetwork(); +#endif + + void showConfigurationFor(QTreeWidgetItem *item); + + void createSessionFor(QTreeWidgetItem *item); + void createNewSession(); + void deleteSession(); + + void performScan(); + +private: + QNetworkConfigurationManager manager; + QList sessionWidgets; +}; + +#endif //BEARERMONITOR_H diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro new file mode 100644 index 0000000..c8fb3c2 --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -0,0 +1,32 @@ +HEADERS = sessionwidget.h \ + bearermonitor.h + +SOURCES = main.cpp \ + bearermonitor.cpp \ + sessionwidget.cpp + +FORMS = bearermonitor_240_320.ui \ + bearermonitor_640_480.ui \ + sessionwidget.ui + +TARGET = bearermonitor + +QT = core gui network + +INCLUDEPATH += ../../src/bearer + +include(../examples.pri) + +qtAddLibrary(QtBearer) +win32:!wince*:LIBS += -lWs2_32 +wince*:LIBS += -lWs2 + +CONFIG += console + +include(../examples.pri) + +macx: { + contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer + contains(CONFIG, debug) { + } +} diff --git a/examples/network/bearermonitor/bearermonitor_240_320.ui b/examples/network/bearermonitor/bearermonitor_240_320.ui new file mode 100644 index 0000000..ce9c2d1 --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor_240_320.ui @@ -0,0 +1,420 @@ + + + BearerMonitor + + + + 0 + 0 + 240 + 320 + + + + Form + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + true + + + + + 0 + -274 + 206 + 576 + + + + + + + System State + + + true + + + + 0 + + + 0 + + + 0 + + + + + + + Online State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + Configurations + + + true + + + + 0 + + + 0 + + + 0 + + + + + + + + + Name: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Type: + + + + + + + + 0 + 0 + + + + Invalid + + + + + + + + + + + Purpose: + + + + + + + + 0 + 0 + + + + Unknown + + + + + + + + + + + Identifier: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Roaming: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Children: + + + + + + + + 0 + 0 + + + + + + + + + + + + + Network Location Awareness + + + + + + Register + + + + + + + Unregister + + + + + + + + + + New Session + + + + + + + Delete Session + + + + + + + Scan + + + + + + + 0 + + + -1 + + + false + + + false + + + %p% + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + false + + + + 1 + + + + + + + + + + + + + Sessions + + + true + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 0 + + + + Session 1 + + + + + + + + + + + + + + + + diff --git a/examples/network/bearermonitor/bearermonitor_640_480.ui b/examples/network/bearermonitor/bearermonitor_640_480.ui new file mode 100644 index 0000000..941eaa0 --- /dev/null +++ b/examples/network/bearermonitor/bearermonitor_640_480.ui @@ -0,0 +1,386 @@ + + + BearerMonitor + + + + 0 + 0 + 640 + 515 + + + + Form + + + + + + System State + + + true + + + + 0 + + + 0 + + + 0 + + + + + + + Online State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + Configurations + + + true + + + + 0 + + + 0 + + + 0 + + + + + false + + + + 1 + + + + + + + + + + + + Name: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + State: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Type: + + + + + + + + 0 + 0 + + + + Invalid + + + + + + + + + + + Purpose: + + + + + + + + 0 + 0 + + + + Unknown + + + + + + + + + + + Identifier: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Roaming: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Children: + + + + + + + + 0 + 0 + + + + + + + + + + + + + Network Location Awareness + + + + + + Register + + + + + + + Unregister + + + + + + + + + + New Session + + + + + + + Delete Session + + + + + + + Scan + + + + + + + 0 + + + -1 + + + false + + + false + + + %p% + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Sessions + + + true + + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 0 + + + + Session 1 + + + + + + + + + + + + diff --git a/examples/network/bearermonitor/main.cpp b/examples/network/bearermonitor/main.cpp new file mode 100644 index 0000000..9685181 --- /dev/null +++ b/examples/network/bearermonitor/main.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "bearermonitor.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + BearerMonitor monitor; + monitor.show(); + + return app.exec(); +} + diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp new file mode 100644 index 0000000..7633dd7 --- /dev/null +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "sessionwidget.h" + +SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent) +: QWidget(parent) +{ + setupUi(this); + + session = new QNetworkSession(config, this); + + connect(session, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(updateSession())); + connect(session, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(updateSession())); + + updateSession(); + + sessionId->setText(QString("0x%1").arg(qulonglong(session), 8, 16, QChar('0'))); + + configuration->setText(session->configuration().name()); + + connect(openSessionButton, SIGNAL(clicked()), + this, SLOT(openSession())); + connect(openSyncSessionButton, SIGNAL(clicked()), + this, SLOT(openSyncSession())); + connect(closeSessionButton, SIGNAL(clicked()), + this, SLOT(closeSession())); + connect(stopSessionButton, SIGNAL(clicked()), + this, SLOT(stopSession())); +} + +SessionWidget::~SessionWidget() +{ + delete session; +} + +void SessionWidget::updateSession() +{ + updateSessionState(session->state()); + updateSessionError(session->error()); + + bearer->setText(session->bearerName()); + + interfaceName->setText(session->interface().humanReadableName()); + interfaceGuid->setText(session->interface().name()); +} + +void SessionWidget::openSession() +{ + session->open(); + updateSession(); +} + +void SessionWidget::openSyncSession() +{ + session->open(); + session->waitForOpened(); + updateSession(); +} + +void SessionWidget::closeSession() +{ + session->close(); + updateSession(); +} + +void SessionWidget::stopSession() +{ + session->stop(); + updateSession(); +} + +void SessionWidget::updateSessionState(QNetworkSession::State state) +{ + QString s = tr("%1 (%2)"); + + switch (state) { + case QNetworkSession::Invalid: + s = s.arg(tr("Invalid")); + break; + case QNetworkSession::NotAvailable: + s = s.arg(tr("Not Available")); + break; + case QNetworkSession::Connecting: + s = s.arg(tr("Connecting")); + break; + case QNetworkSession::Connected: + s = s.arg(tr("Connected")); + break; + case QNetworkSession::Closing: + s = s.arg(tr("Closing")); + break; + case QNetworkSession::Disconnected: + s = s.arg(tr("Disconnected")); + break; + case QNetworkSession::Roaming: + s = s.arg(tr("Roaming")); + break; + default: + s = s.arg(tr("Unknown")); + } + + if (session->isActive()) + s = s.arg(tr("Active")); + else + s = s.arg(tr("Inactive")); + + sessionState->setText(s); +} + +void SessionWidget::updateSessionError(QNetworkSession::SessionError error) +{ + lastError->setText(QString::number(error)); + errorString->setText(session->errorString()); +} + diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h new file mode 100644 index 0000000..cb6591e --- /dev/null +++ b/examples/network/bearermonitor/sessionwidget.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 SESSIONWIDGET_H +#define SESSIONWIDGET_H + +#include "ui_sessionwidget.h" + +#include + +QTM_USE_NAMESPACE + +class SessionWidget : public QWidget, public Ui_SessionWidget +{ + Q_OBJECT + +public: + SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0); + ~SessionWidget(); + +private: + void updateSessionState(QNetworkSession::State state); + void updateSessionError(QNetworkSession::SessionError error); + +private Q_SLOTS: + void openSession(); + void openSyncSession(); + void closeSession(); + void stopSession(); + void updateSession(); + +private: + QNetworkSession *session; +}; + +#endif + diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui new file mode 100644 index 0000000..f02f306 --- /dev/null +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -0,0 +1,251 @@ + + + SessionWidget + + + + 0 + 0 + 340 + 220 + + + + Form + + + + + + + + Session ID: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + 0 + 0 + + + + Session State: + + + + + + + + 0 + 0 + + + + Invalid + + + + + + + + + + + Configuration: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Bearer: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Interface Name: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Interface GUID: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Last Error: + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Error String + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + Open + + + + + + + Blocking Open + + + + + + + Close + + + + + + + Stop + + + + + + + + + + diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro new file mode 100644 index 0000000..2255b7c --- /dev/null +++ b/src/network/bearer/bearer.pro @@ -0,0 +1,163 @@ +# Qt bearer management library +TEMPLATE = lib +TARGET = QtBearer + +QT += network +include (../../common.pri) + +DEFINES += QT_BUILD_BEARER_LIB QT_MAKEDLL + +#DEFINES += BEARER_MANAGEMENT_DEBUG + +PUBLIC_HEADERS += qnetworkconfiguration.h \ + qnetworksession.h \ + qnetworkconfigmanager.h + +HEADERS += $$PUBLIC_HEADERS +SOURCES += qnetworksession.cpp \ + qnetworkconfigmanager.cpp \ + qnetworkconfiguration.cpp + +symbian: { + exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ + exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { + message("Building with SNAP support") + DEFINES += SNAP_FUNCTIONALITY_AVAILABLE=1 + LIBS += -lcmmanager + } else { + message("Building without SNAP support") + LIBS += -lapengine + } + + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + + HEADERS += qnetworkconfigmanager_s60_p.h \ + qnetworkconfiguration_s60_p.h \ + qnetworksession_s60_p.h + SOURCES += qnetworkconfigmanager_s60_p.cpp \ + qnetworkconfiguration_s60_p.cpp \ + qnetworksession_s60_p.cpp + + LIBS += -lcommdb \ + -lapsettingshandlerui \ + -lconnmon \ + -lcentralrepository \ + -lesock \ + -linsock \ + -lecom \ + -lefsrv \ + -lnetmeta + + deploy.path = $${EPOCROOT} + exportheaders.sources = $$PUBLIC_HEADERS + exportheaders.path = epoc32/include + + for(header, exportheaders.sources) { + BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" + } + + bearer_deployment.sources = QtBearer.dll + bearer_deployment.path = /sys/bin + DEPLOYMENT += bearer_deployment + + TARGET.CAPABILITY = All -TCB +} else { + maemo { + QT += dbus + CONFIG += link_pkgconfig + + exists(../debug) { + message("Enabling debug messages.") + DEFINES += BEARER_MANAGEMENT_DEBUG + } + + HEADERS += qnetworksession_maemo_p.h \ + qnetworkconfigmanager_maemo_p.h \ + qnetworkconfiguration_maemo_p.h + + SOURCES += qnetworkconfigmanager_maemo.cpp \ + qnetworksession_maemo.cpp + + documentation.path = $$QT_MOBILITY_PREFIX/doc + documentation.files = doc/html + + PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet + + CONFIG += create_pc create_prl + QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet + pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig + pkgconfig.files = QtBearer.pc + + INSTALLS += pkgconfig documentation + + } else { + + DEFINES += BEARER_ENGINE + + HEADERS += qnetworkconfigmanager_p.h \ + qnetworkconfiguration_p.h \ + qnetworksession_p.h \ + qnetworksessionengine_p.h \ + qgenericengine_p.h + + SOURCES += qnetworkconfigmanager_p.cpp \ + qnetworksession_p.cpp \ + qnetworksessionengine.cpp \ + qgenericengine.cpp + + unix:!mac:contains(networkmanager_enabled, yes) { + contains(QT_CONFIG,dbus) { + DEFINES += BACKEND_NM + QT += dbus + + HEADERS += qnmdbushelper_p.h \ + qnetworkmanagerservice_p.h \ + qnmwifiengine_unix_p.h + + SOURCES += qnmdbushelper.cpp \ + qnetworkmanagerservice_p.cpp \ + qnmwifiengine_unix.cpp + } else { + message("NetworkManager backend requires Qt DBus support") + } + } + + win32: { + HEADERS += qnlaengine_win_p.h \ + qnetworksessionengine_win_p.h + + !wince*:HEADERS += qnativewifiengine_win_p.h + + SOURCES += qnlaengine_win.cpp + + !wince*:SOURCES += qnativewifiengine_win.cpp + + !wince*:LIBS += -lWs2_32 + wince*:LIBS += -lWs2 + } + } + macx: { + HEADERS += qcorewlanengine_mac_p.h + SOURCES+= qcorewlanengine_mac.mm + LIBS += -framework Foundation -framework SystemConfiguration + + contains(corewlan_enabled, yes) { + isEmpty(QMAKE_MAC_SDK) { + SDK6="yes" + } else { + contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { + SDK6="yes" + } + } + + !isEmpty(SDK6) { + LIBS += -framework CoreWLAN + DEFINES += MAC_SDK_10_6 + } + } + + + } +} + +include(../../features/deploy.pri) diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm new file mode 100644 index 0000000..5451615 --- /dev/null +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -0,0 +1,461 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qcorewlanengine_mac_p.h" +#include "qnetworkconfiguration_p.h" + +#include +#include +#include +#include + +#include + +#if defined(MAC_SDK_10_6) //not much functionality without this +#include +#include +#include +#include +#endif + +#include +#include +#include + +#include +QMap networkInterfaces; + +QTM_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) + +inline QString cfstringRefToQstring(CFStringRef cfStringRef) { +// return QString([cfStringRef UTF8String]); + QString retVal; + CFIndex maxLength = 2 * CFStringGetLength(cfStringRef) + 1/*zero term*/; // max UTF8 + char *cstring = new char[maxLength]; + if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) { + retVal = QString::fromUtf8(cstring); + } + delete cstring; + return retVal; +} + +inline CFStringRef qstringToCFStringRef(const QString &string) +{ + return CFStringCreateWithCharacters(0, reinterpret_cast(string.unicode()), + string.length()); +} + +inline NSString *qstringToNSString(const QString &qstr) +{ return [reinterpret_cast(qstringToCFStringRef(qstr)) autorelease]; } + +inline QString nsstringToQString(const NSString *nsstr) +{ return cfstringRefToQstring(reinterpret_cast(nsstr)); } + +inline QStringList nsarrayToQStringList(void *nsarray) +{ + QStringList result; + NSArray *array = static_cast(nsarray); + for (NSUInteger i=0; i<[array count]; ++i) + result << nsstringToQString([array objectAtIndex:i]); + return result; +} + +static QString qGetInterfaceType(const QString &interfaceString) +{ + return networkInterfaces.value(interfaceString); +} + +QCoreWlanEngine::QCoreWlanEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + getAllScInterfaces(); + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QCoreWlanEngine::~QCoreWlanEngine() +{ +} + +QList QCoreWlanEngine::getWifiConfigurations() +{ + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + QString interfaceName = i.key(); + if (i.value() == "WLAN") { + if(!isWifiReady(interfaceName)) { + qWarning() << "wifi not powered on"; + return QList(); + } else { + // QList profs = getWlanProfiles(interfaceName); + scanForSsids(interfaceName); + } + } else { + + } + } + return QList (); +} + +QList QCoreWlanEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + QList foundConfigurations; + QList wificonfigs = getWifiConfigurations(); + + uint identifier; + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + if (i.value() == "WLAN") { + QList fetchedConfigurations = scanForSsids(i.key()); + for (int i = 0; i < fetchedConfigurations.count(); ++i) { + + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; + config->name = fetchedConfigurations.at(i)->name; + config->isValid = fetchedConfigurations.at(i)->isValid; + config->id = fetchedConfigurations.at(i)->id; + + config->state = fetchedConfigurations.at(i)->state; + config->type = fetchedConfigurations.at(i)->type; + config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; + config->purpose = fetchedConfigurations.at(i)->purpose; + config->internet = fetchedConfigurations.at(i)->internet; + config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; + + identifier = config->name.toUInt(); + configurationInterface[identifier] = config->serviceInterface.name(); + foundConfigurations.append(config); + } + } + + QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString humanReadableName = interface.humanReadableName(); + cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; + cpPriv->isValid = true; + + if (interface.index()) + identifier = interface.index(); + else + identifier = qHash(interface.hardwareAddress()); + + cpPriv->id = QString::number(identifier); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Undefined; + + if (interface.flags() & QNetworkInterface::IsRunning) { + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->internet = true; + } + if ( !interface.addressEntries().isEmpty()) { + cpPriv->state |= QNetworkConfiguration::Active; + cpPriv->internet = true; + } + configurationInterface[identifier] = interface.name(); + foundConfigurations.append(cpPriv); + } + [autoreleasepool release]; + pollTimer.start(); + return foundConfigurations; +} + +QString QCoreWlanEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QCoreWlanEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QCoreWlanEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QCoreWlanEngine::connectToId(const QString &id) +{ + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + QString interfaceString = getInterfaceFromId(id); + + if(networkInterfaces.value(interfaceString) == "WLAN") { +#if defined(MAC_SDK_10_6) + CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; + CWConfiguration *userConfig = [ wifiInterface configuration]; + + NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile + + NSEnumerator *enumerator = [remNets objectEnumerator]; + CWWirelessProfile *wProfile; + NSUInteger index=0; + while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile + + if(id == nsstringToQString([wProfile ssid])) { + CW8021XProfile *user8021XProfile = nil; + user8021XProfile = [ wProfile user8021XProfile]; + + NSError *err = nil; + NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; + + if(user8021XProfile) { + [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; + } else { + [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; + } + + NSDictionary *parametersDict = nil; + NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { + CWNetwork *apNetwork = [apArray objectAtIndex:row]; + if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { + bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; + if(!result) { + qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); + emit connectionError(id, ConnectError); + } else { + [autoreleasepool release]; + return; + } + } + } + } + } + index++; + } + emit connectionError(id, InterfaceLookupError); +#endif + } else { + // not wifi + } + emit connectionError(id, OperationNotSupported); + [autoreleasepool release]; +} + +void QCoreWlanEngine::disconnectFromId(const QString &id) +{ + QString interfaceString = getInterfaceFromId(id); + if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now +#if defined(MAC_SDK_10_6) + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; + [wifiInterface disassociate]; + if([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) { + emit connectionError(id, DisconnectionError); + } + [autoreleasepool release]; + return; +#endif + } else { + + } + emit connectionError(id, OperationNotSupported); +} + +void QCoreWlanEngine::requestUpdate() +{ + getAllScInterfaces(); + emit configurationsChanged(); +} + +QCoreWlanEngine *QCoreWlanEngine::instance() +{ + return coreWlanEngine(); +} + +QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) +{ + QList foundConfigs; +#if defined(MAC_SDK_10_6) + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; + NSError *err = nil; + NSDictionary *parametersDict = nil; + NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { + CWNetwork *apNetwork = [apArray objectAtIndex:row]; + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QString networkSsid = nsstringToQString([apNetwork ssid]); + cpPriv->name = networkSsid; + cpPriv->isValid = true; + cpPriv->id = networkSsid; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); + + CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; + CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; + if(!userNetworkProfile) { + } else { + qWarning() <<"Has profile!" ; + } + + if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { + QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); + if( cpPriv->name == interfaceSsidString) { + cpPriv->state |= QNetworkConfiguration::Active; + } + } else { + if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { + cpPriv->state = QNetworkConfiguration::Discovered; + } else { + cpPriv->state = QNetworkConfiguration::Defined; + } + } + if(!cpPriv->state) { + cpPriv->state = QNetworkConfiguration::Undefined; + } + if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + else + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + foundConfigs.append(cpPriv); + } + } else { + qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) + < QCoreWlanEngine::getWlanProfiles(const QString &interfaceName) +{ + Q_UNUSED(interfaceName) +#if defined(MAC_SDK_10_6) +// for( CW8021XProfile *each8021XProfile in [CW8021XProfile allUser8021XProfiles] ) { +// qWarning() << "Profile name" << nsstringToQString([each8021XProfile ssid]); +// } + +#endif + return QList (); +} + +bool QCoreWlanEngine::getAllScInterfaces() +{ + networkInterfaces.clear(); + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + CFArrayRef interfaces = SCNetworkInterfaceCopyAll(); + if (interfaces != NULL) { + CFIndex interfaceCount; + CFIndex interfaceIndex; + interfaceCount = CFArrayGetCount(interfaces); + for (interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++) { + + CFStringRef bsdName; + CFTypeRef thisInterface = CFArrayGetValueAtIndex(interfaces, interfaceIndex); + bsdName = SCNetworkInterfaceGetBSDName((SCNetworkInterfaceRef)thisInterface); + QString interfaceName = cfstringRefToQstring(bsdName); + QString typeStr; + CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface); + if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) { + typeStr = "WLAN"; +// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) { +// typeStr = "Bluetooth"; + } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) { + typeStr = "Ethernet"; + } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) { + typeStr = "Ethernet"; //ok a bit fudged + } + if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) { + networkInterfaces.insert(interfaceName,typeStr); + } + } + } + CFRelease(interfaces); + + [autoreleasepool release]; + return true; +} + +#include "moc_qcorewlanengine_mac_p.cpp" + +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qcorewlanengine_mac_p.h b/src/network/bearer/qcorewlanengine_mac_p.h new file mode 100644 index 0000000..fc8e4b5 --- /dev/null +++ b/src/network/bearer/qcorewlanengine_mac_p.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QCOREWLANENGINE_P_H +#define QCOREWLANENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworksessionengine_p.h" +#include +#include +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QCoreWlanEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QCoreWlanEngine(QObject *parent = 0); + ~QCoreWlanEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QCoreWlanEngine *instance(); + static bool getAllScInterfaces(); + +private: + bool isWifiReady(const QString &dev); + QMap configurationInterface; + QTimer pollTimer; + QList scanForSsids(const QString &interfaceName); + + QList getWlanProfiles(const QString &interfaceName); + + QList getWifiConfigurations(); + bool isKnownSsid(const QString &interfaceName, const QString &ssid); +}; + +QTM_END_NAMESPACE + +#endif + diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp new file mode 100644 index 0000000..184a69c --- /dev/null +++ b/src/network/bearer/qgenericengine.cpp @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qgenericengine_p.h" +#include "qnetworkconfiguration_p.h" + +#include +#include +#include +#include + +#include + +#ifdef Q_OS_WIN +#include "qnetworksessionengine_win_p.h" +#endif + +QTM_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QGenericEngine, genericEngine) + +static QString qGetInterfaceType(const QString &interface) +{ +#ifdef Q_OS_WIN32 + unsigned long oid; + DWORD bytesWritten; + + NDIS_MEDIUM medium; + NDIS_PHYSICAL_MEDIUM physicalMedium; + + HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, + FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + if (handle == INVALID_HANDLE_VALUE) + return QString(); + + oid = OID_GEN_MEDIA_SUPPORTED; + bytesWritten = 0; + bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &medium, sizeof(medium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + return QString(); + } + + oid = OID_GEN_PHYSICAL_MEDIUM; + bytesWritten = 0; + result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + + if (medium == NdisMedium802_3) + return QLatin1String("Ethernet"); + else + return QString(); + } + + CloseHandle(handle); + + if (medium == NdisMedium802_3) { + switch (physicalMedium) { + case NdisPhysicalMediumWirelessLan: + return QLatin1String("WLAN"); + case NdisPhysicalMediumBluetooth: + return QLatin1String("Bluetooth"); + case NdisPhysicalMediumWiMax: + return QLatin1String("WiMAX"); + default: +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Physical Medium" << physicalMedium; +#endif + return QLatin1String("Ethernet"); + } + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << medium << physicalMedium; +#endif +#else + Q_UNUSED(interface); +#endif + + return QString(); +} + +QGenericEngine::QGenericEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QGenericEngine::~QGenericEngine() +{ +} + +QList QGenericEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + + QList foundConfigurations; + + // Immediately after connecting with a wireless access point + // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a + // second time results in a non-empty list. If we loose interfaces we will end up removing + // network configurations which will break current sessions. + QList interfaces = QNetworkInterface::allInterfaces(); + if (interfaces.isEmpty()) + interfaces = QNetworkInterface::allInterfaces(); + + // create configuration for each interface + while (!interfaces.isEmpty()) { + QNetworkInterface interface = interfaces.takeFirst(); + + if (!interface.isValid()) + continue; + + // ignore loopback interface + if (interface.flags() & QNetworkInterface::IsLoopBack) + continue; + + // ignore WLAN interface handled in seperate engine + if (qGetInterfaceType(interface.name()) == "WLAN") + continue; + + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString humanReadableName = interface.humanReadableName(); + cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; + cpPriv->isValid = true; + + uint identifier; + if (interface.index()) + identifier = qHash(QLatin1String("NLA:") + QString::number(interface.index())); + else + identifier = qHash(QLatin1String("NLA:") + interface.hardwareAddress()); + + cpPriv->id = QString::number(identifier); + cpPriv->state = QNetworkConfiguration::Discovered; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + if (interface.flags() & QNetworkInterface::IsUp) + cpPriv->state |= QNetworkConfiguration::Active; + + configurationInterface[identifier] = interface.name(); + + foundConfigurations.append(cpPriv); + } + + pollTimer.start(); + + return foundConfigurations; +} + +QString QGenericEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QGenericEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QGenericEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QGenericEngine::connectToId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::disconnectFromId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::requestUpdate() +{ + emit configurationsChanged(); +} + +QGenericEngine *QGenericEngine::instance() +{ + return genericEngine(); +} + +#include "moc_qgenericengine_p.cpp" +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qgenericengine_p.h b/src/network/bearer/qgenericengine_p.h new file mode 100644 index 0000000..976776e --- /dev/null +++ b/src/network/bearer/qgenericengine_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QGENERICENGINE_P_H +#define QGENERICENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworksessionengine_p.h" + +#include +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QGenericEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QGenericEngine(QObject *parent = 0); + ~QGenericEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QGenericEngine *instance(); + +private: + QMap configurationInterface; + QTimer pollTimer; +}; + +QTM_END_NAMESPACE + +#endif + diff --git a/src/network/bearer/qnativewifiengine_win.cpp b/src/network/bearer/qnativewifiengine_win.cpp new file mode 100644 index 0000000..d8fe5fb --- /dev/null +++ b/src/network/bearer/qnativewifiengine_win.cpp @@ -0,0 +1,726 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnativewifiengine_win_p.h" +#include "qnetworkconfiguration_p.h" + +#include +#include +#include +#include + +#include + +#include +#undef interface + +QTM_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QNativeWifiEngine, nativeWifiEngine) + +#define WLAN_MAX_NAME_LENGTH 256 +#define WLAN_MAX_PHY_TYPE_NUMBER 8 +#define WLAN_NOTIFICATION_SOURCE_ALL 0x0000ffff +#define WLAN_AVAILABLE_NETWORK_CONNECTED 1 +#define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2 +#define DOT11_SSID_MAX_LENGTH 32 + +struct WLAN_NOTIFICATION_DATA { + DWORD NotificationSource; + DWORD NotificationCode; + GUID InterfaceGuid; + DWORD dwDataSize; + PVOID pData; +}; + +enum WLAN_INTERFACE_STATE { + wlan_interface_state_not_ready = 0, + wlan_interface_state_connected, + wlan_interface_state_ad_hoc_network_formed, + wlan_interface_state_disconnecting, + wlan_interface_state_disconnected, + wlan_interface_state_associating, + wlan_interface_state_discovering, + wlan_interface_state_authenticating +}; + +struct WLAN_INTERFACE_INFO { + GUID InterfaceGuid; + WCHAR strInterfaceDescription[WLAN_MAX_NAME_LENGTH]; + WLAN_INTERFACE_STATE isState; +}; + +struct WLAN_INTERFACE_INFO_LIST { + DWORD dwNumberOfItems; + DWORD dwIndex; + WLAN_INTERFACE_INFO InterfaceInfo[1]; +}; + +struct DOT11_SSID { + ULONG uSSIDLength; + UCHAR ucSSID[DOT11_SSID_MAX_LENGTH]; +}; + +struct NDIS_OBJECT_HEADER { + UCHAR Type; + UCHAR Revision; + USHORT Size; +}; + +typedef UCHAR DOT11_MAC_ADDRESS[6]; +struct DOT11_BSSID_LIST { + NDIS_OBJECT_HEADER Header; + ULONG uNumberOfEntries; + ULONG uTotalNumOfEntries; + DOT11_MAC_ADDRESS BSSIDs[1]; +}; + +enum DOT11_BSS_TYPE { + dot11_BSS_type_infrastructure = 1, + dot11_BSS_type_independent = 2, + dot11_BSS_type_any = 3 +}; + +enum DOT11_PHY_TYPE { + dot11_phy_type_unknown = 0, + dot11_phy_type_any = dot11_phy_type_unknown, + dot11_phy_type_fhss = 1, + dot11_phy_type_dsss = 2, + dot11_phy_type_irbaseband = 3, + dot11_phy_type_ofdm = 4, + dot11_phy_type_hrdsss = 5, + dot11_phy_type_erp = 6, + dot11_phy_type_ht = 7, + dot11_phy_type_IHV_start = 0x80000000, + dot11_phy_type_IHV_end = 0xffffffff +}; + +enum DOT11_AUTH_ALGORITHM { + DOT11_AUTH_ALGO_80211_OPEN = 1, + DOT11_AUTH_ALGO_80211_SHARED_KEY = 2, + DOT11_AUTH_ALGO_WPA = 3, + DOT11_AUTH_ALGO_WPA_PSK = 4, + DOT11_AUTH_ALGO_WPA_NONE = 5, + DOT11_AUTH_ALGO_RSNA = 6, + DOT11_AUTH_ALGO_RSNA_PSK = 7, + DOT11_AUTH_ALGO_IHV_START = 0x80000000, + DOT11_AUTH_ALGO_IHV_END = 0xffffffff +}; + +enum DOT11_CIPHER_ALGORITHM { + DOT11_CIPHER_ALGO_NONE = 0x00, + DOT11_CIPHER_ALGO_WEP40 = 0x01, + DOT11_CIPHER_ALGO_TKIP = 0x02, + DOT11_CIPHER_ALGO_CCMP = 0x04, + DOT11_CIPHER_ALGO_WEP104 = 0x05, + DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100, + DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100, + DOT11_CIPHER_ALGO_WEP = 0x101, + DOT11_CIPHER_ALGO_IHV_START = 0x80000000, + DOT11_CIPHER_ALGO_IHV_END = 0xffffffff +}; + +struct WLAN_AVAILABLE_NETWORK { + WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; + DOT11_SSID dot11Ssid; + DOT11_BSS_TYPE dot11BssType; + ULONG uNumberOfBssids; + BOOL bNetworkConnectable; + DWORD wlanNotConnectableReason; + ULONG uNumberOfPhyTypes; + DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER]; + BOOL bMorePhyTypes; + ULONG wlanSignalQuality; + BOOL bSecurityEnabled; + DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; + DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; + DWORD dwFlags; + DWORD dwReserved; +}; + +struct WLAN_AVAILABLE_NETWORK_LIST { + DWORD dwNumberOfItems; + DWORD dwIndex; + WLAN_AVAILABLE_NETWORK Network[1]; +}; + +enum WLAN_INTF_OPCODE { + wlan_intf_opcode_autoconf_start = 0x000000000, + wlan_intf_opcode_autoconf_enabled, + wlan_intf_opcode_background_scan_enabled, + wlan_intf_opcode_media_streaming_mode, + wlan_intf_opcode_radio_state, + wlan_intf_opcode_bss_type, + wlan_intf_opcode_interface_state, + wlan_intf_opcode_current_connection, + wlan_intf_opcode_channel_number, + wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs, + wlan_intf_opcode_supported_adhoc_auth_cipher_pairs, + wlan_intf_opcode_supported_country_or_region_string_list, + wlan_intf_opcode_current_operation_mode, + wlan_intf_opcode_supported_safe_mode, + wlan_intf_opcode_certified_safe_mode, + wlan_intf_opcode_autoconf_end = 0x0fffffff, + wlan_intf_opcode_msm_start = 0x10000100, + wlan_intf_opcode_statistics, + wlan_intf_opcode_rssi, + wlan_intf_opcode_msm_end = 0x1fffffff, + wlan_intf_opcode_security_start = 0x20010000, + wlan_intf_opcode_security_end = 0x2fffffff, + wlan_intf_opcode_ihv_start = 0x30000000, + wlan_intf_opcode_ihv_end = 0x3fffffff +}; + +enum WLAN_OPCODE_VALUE_TYPE { + wlan_opcode_value_type_query_only = 0, + wlan_opcode_value_type_set_by_group_policy, + wlan_opcode_value_type_set_by_user, + wlan_opcode_value_type_invalid +}; + +enum WLAN_CONNECTION_MODE { + wlan_connection_mode_profile = 0, + wlan_connection_mode_temporary_profile, + wlan_connection_mode_discovery_secure, + wlan_connection_mode_discovery_unsecure, + wlan_connection_mode_auto, + wlan_connection_mode_invalid +}; + +struct WLAN_CONNECTION_PARAMETERS { + WLAN_CONNECTION_MODE wlanConnectionMode; + LPCWSTR strProfile; + DOT11_SSID *pDot11Ssid; + DOT11_BSSID_LIST *pDesiredBssidList; + DOT11_BSS_TYPE dot11BssType; + DWORD dwFlags; +}; + +struct WLAN_RAW_DATA { + DWORD dwDataSize; + BYTE DataBlob[1]; +}; + +enum WLAN_NOTIFICATION_ACM { + wlan_notification_acm_start = 0, + wlan_notification_acm_autoconf_enabled, + wlan_notification_acm_autoconf_disabled, + wlan_notification_acm_background_scan_enabled, + wlan_notification_acm_background_scan_disabled, + wlan_notification_acm_bss_type_change, + wlan_notification_acm_power_setting_change, + wlan_notification_acm_scan_complete, + wlan_notification_acm_scan_fail, + wlan_notification_acm_connection_start, + wlan_notification_acm_connection_complete, + wlan_notification_acm_connection_attempt_fail, + wlan_notification_acm_filter_list_change, + wlan_notification_acm_interface_arrival, + wlan_notification_acm_interface_removal, + wlan_notification_acm_profile_change, + wlan_notification_acm_profile_name_change, + wlan_notification_acm_profiles_exhausted, + wlan_notification_acm_network_not_available, + wlan_notification_acm_network_available, + wlan_notification_acm_disconnecting, + wlan_notification_acm_disconnected, + wlan_notification_acm_adhoc_network_state_change, + wlan_notification_acm_end +}; + +struct WLAN_ASSOCIATION_ATTRIBUTES { + DOT11_SSID dot11Ssid; + DOT11_BSS_TYPE dot11BssType; + DOT11_MAC_ADDRESS dot11Bssid; + DOT11_PHY_TYPE dot11PhyType; + ULONG uDot11PhyIndex; + ULONG wlanSignalQuality; + ULONG ulRxRate; + ULONG ulTxRate; +}; + +struct WLAN_SECURITY_ATTRIBUTES { + BOOL bSecurityEnabled; + BOOL bOneXEnabled; + DOT11_AUTH_ALGORITHM dot11AuthAlgorithm; + DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm; +}; + +struct WLAN_CONNECTION_ATTRIBUTES { + WLAN_INTERFACE_STATE isState; + WLAN_CONNECTION_MODE wlanConnectionMode; + WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; + WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; + WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes; +}; + +typedef void (WINAPI *WLAN_NOTIFICATION_CALLBACK)(WLAN_NOTIFICATION_DATA *, PVOID); + +typedef DWORD (WINAPI *WlanOpenHandleProto) + (DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle); +typedef DWORD (WINAPI *WlanRegisterNotificationProto) + (HANDLE hClientHandle, DWORD dwNotifSource, BOOL bIgnoreDuplicate, + WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext, + PVOID pReserved, PDWORD pdwPrevNotifSource); +typedef DWORD (WINAPI *WlanEnumInterfacesProto) + (HANDLE hClientHandle, PVOID pReserved, WLAN_INTERFACE_INFO_LIST **ppInterfaceList); +typedef DWORD (WINAPI *WlanGetAvailableNetworkListProto) + (HANDLE hClientHandle, const GUID* pInterfaceGuid, DWORD dwFlags, PVOID pReserved, + WLAN_AVAILABLE_NETWORK_LIST **ppAvailableNetworkList); +typedef DWORD (WINAPI *WlanQueryInterfaceProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, WLAN_INTF_OPCODE OpCode, PVOID pReserved, + PDWORD pdwDataSize, PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType); +typedef DWORD (WINAPI *WlanConnectProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, + const WLAN_CONNECTION_PARAMETERS *pConnectionParameters, PVOID pReserved); +typedef DWORD (WINAPI *WlanDisconnectProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, PVOID pReserved); +typedef DWORD (WINAPI *WlanScanProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, const DOT11_SSID *pDot11Ssid, + const WLAN_RAW_DATA *pIeData, PVOID pReserved); +typedef VOID (WINAPI *WlanFreeMemoryProto)(PVOID pMemory); +typedef DWORD (WINAPI *WlanCloseHandleProto)(HANDLE hClientHandle, PVOID pReserved); + +static WlanOpenHandleProto local_WlanOpenHandle = 0; +static WlanRegisterNotificationProto local_WlanRegisterNotification = 0; +static WlanEnumInterfacesProto local_WlanEnumInterfaces = 0; +static WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList = 0; +static WlanQueryInterfaceProto local_WlanQueryInterface = 0; +static WlanConnectProto local_WlanConnect = 0; +static WlanDisconnectProto local_WlanDisconnect = 0; +static WlanScanProto local_WlanScan = 0; +static WlanFreeMemoryProto local_WlanFreeMemory = 0; +static WlanCloseHandleProto local_WlanCloseHandle = 0; + +static void resolveLibrary() +{ + static volatile bool triedResolve = false; + + if (!triedResolve) { +#ifndef QT_NO_THREAD + QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle)); +#endif + + if (!triedResolve) { + local_WlanOpenHandle = (WlanOpenHandleProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanOpenHandle"); + local_WlanRegisterNotification = (WlanRegisterNotificationProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanRegisterNotification"); + local_WlanEnumInterfaces = (WlanEnumInterfacesProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanEnumInterfaces"); + local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanGetAvailableNetworkList"); + local_WlanQueryInterface = (WlanQueryInterfaceProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanQueryInterface"); + local_WlanConnect = (WlanConnectProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanConnect"); + local_WlanDisconnect = (WlanDisconnectProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanDisconnect"); + local_WlanScan = (WlanScanProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanScan"); + local_WlanFreeMemory = (WlanFreeMemoryProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanFreeMemory"); + local_WlanCloseHandle = (WlanCloseHandleProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanCloseHandle"); + + triedResolve = true; + } + } +} + +void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) +{ + Q_UNUSED(d); + + switch (data->NotificationCode) { + case wlan_notification_acm_connection_complete: + case wlan_notification_acm_disconnected: + d->emitConfigurationsChanged(); + break; + default: + qDebug() << "wlan unknown notification"; + } +} + +QNativeWifiEngine::QNativeWifiEngine(QObject *parent) +: QNetworkSessionEngine(parent), handle(0) +{ + DWORD clientVersion; + + DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle); + if (result != ERROR_SUCCESS) { + if (result != ERROR_SERVICE_NOT_ACTIVE) + qWarning("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); + + return; + } + + result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true, + WLAN_NOTIFICATION_CALLBACK(qNotificationCallback), + this, 0, 0); + if (result != ERROR_SUCCESS) + qWarning("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); + + // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. + // We need to poll for changes in available wireless networks. + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QNativeWifiEngine::~QNativeWifiEngine() +{ + local_WlanCloseHandle(handle, 0); +} + +QList QNativeWifiEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = false; + + QList foundConfigurations; + + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return foundConfigurations; + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + WLAN_AVAILABLE_NETWORK_LIST *networkList; + result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, + 3, 0, &networkList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); + continue; + } + + QStringList seenNetworks; + + for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { + WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; + + QString networkName; + + if (network.strProfileName[0] != 0) { + networkName = QString::fromWCharArray(network.strProfileName); + } else { + networkName = QByteArray(reinterpret_cast(network.dot11Ssid.ucSSID), + network.dot11Ssid.uSSIDLength); + } + + // don't add duplicate networks + if (seenNetworks.contains(networkName)) + continue; + else + seenNetworks.append(networkName); + + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + + cpPriv->isValid = true; + + cpPriv->name = networkName; + cpPriv->id = QString::number(qHash(QLatin1String("WLAN:") + cpPriv->name)); + + if (!(network.dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE)) + cpPriv->state = QNetworkConfiguration::Undefined; + + if (network.strProfileName[0] != 0) { + if (network.bNetworkConnectable) { + if (network.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) + cpPriv->state = QNetworkConfiguration::Active; + else + cpPriv->state = QNetworkConfiguration::Discovered; + } else { + cpPriv->state = QNetworkConfiguration::Defined; + } + } + + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + + foundConfigurations.append(cpPriv); + } + + local_WlanFreeMemory(networkList); + } + + local_WlanFreeMemory(interfaceList); + + if (ok) + *ok = true; + + pollTimer.start(); + + return foundConfigurations; +} + +QString QNativeWifiEngine::getInterfaceFromId(const QString &id) +{ + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return QString(); + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + DWORD dataSize; + WLAN_CONNECTION_ATTRIBUTES *connectionAttributes; + result = local_WlanQueryInterface(handle, &interface.InterfaceGuid, + wlan_intf_opcode_current_connection, 0, &dataSize, + reinterpret_cast(&connectionAttributes), 0); + if (result != ERROR_SUCCESS) { + if (result != ERROR_INVALID_STATE) + qWarning("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result); + + continue; + } + + if (qHash(QLatin1String("WLAN:") + + QString::fromWCharArray(connectionAttributes->strProfileName)) == id.toUInt()) { + QString guid("{%1-%2-%3-%4%5-%6%7%8%9%10%11}"); + + guid = guid.arg(interface.InterfaceGuid.Data1, 8, 16, QChar('0')); + guid = guid.arg(interface.InterfaceGuid.Data2, 4, 16, QChar('0')); + guid = guid.arg(interface.InterfaceGuid.Data3, 4, 16, QChar('0')); + for (int i = 0; i < 8; ++i) + guid = guid.arg(interface.InterfaceGuid.Data4[i], 2, 16, QChar('0')); + + local_WlanFreeMemory(connectionAttributes); + + return guid.toUpper(); + } + + local_WlanFreeMemory(connectionAttributes); + } + + return QString(); +} + +bool QNativeWifiEngine::hasIdentifier(const QString &id) +{ + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return false; + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + WLAN_AVAILABLE_NETWORK_LIST *networkList; + result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, + 3, 0, &networkList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); + continue; + } + + for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { + WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; + + QString networkName; + + if (network.strProfileName[0] != 0) { + networkName = QString::fromWCharArray(network.strProfileName); + } else { + networkName = QByteArray(reinterpret_cast(network.dot11Ssid.ucSSID), + network.dot11Ssid.uSSIDLength); + } + + if (qHash(QLatin1String("WLAN:") + networkName) == id.toUInt()) { + local_WlanFreeMemory(networkList); + local_WlanFreeMemory(interfaceList); + return true; + } + } + + local_WlanFreeMemory(networkList); + } + + local_WlanFreeMemory(interfaceList); + + return false; +} + +QString QNativeWifiEngine::bearerName(const QString &) +{ + return QLatin1String("WLAN"); +} + +void QNativeWifiEngine::connectToId(const QString &id) +{ + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + emit connectionError(id, InterfaceLookupError); + return; + } + + QString profile; + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + WLAN_AVAILABLE_NETWORK_LIST *networkList; + result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, + 3, 0, &networkList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); + continue; + } + + for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { + WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; + + profile = QString::fromWCharArray(network.strProfileName); + + if (qHash(QLatin1String("WLAN:") + profile) == id.toUInt()) + break; + else + profile.clear(); + } + + local_WlanFreeMemory(networkList); + + if (!profile.isEmpty()) { + WLAN_CONNECTION_PARAMETERS parameters; + parameters.wlanConnectionMode = wlan_connection_mode_profile; + parameters.strProfile = reinterpret_cast(profile.utf16()); + parameters.pDot11Ssid = 0; + parameters.pDesiredBssidList = 0; + parameters.dot11BssType = dot11_BSS_type_any; + parameters.dwFlags = 0; + + DWORD result = local_WlanConnect(handle, &interface.InterfaceGuid, ¶meters, 0); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result); + emit connectionError(id, ConnectError); + break; + } + + break; + } + } + + local_WlanFreeMemory(interfaceList); + + if (profile.isEmpty()) + emit connectionError(id, InterfaceLookupError); +} + +void QNativeWifiEngine::disconnectFromId(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) { + emit connectionError(id, InterfaceLookupError); + return; + } + + QStringList split = interface.mid(1, interface.length() - 2).split('-'); + + GUID guid; + guid.Data1 = split.at(0).toUInt(0, 16); + guid.Data2 = split.at(1).toUShort(0, 16); + guid.Data3 = split.at(2).toUShort(0, 16); + guid.Data4[0] = split.at(3).left(2).toUShort(0, 16); + guid.Data4[1] = split.at(3).right(2).toUShort(0, 16); + for (int i = 0; i < 6; ++i) + guid.Data4[i + 2] = split.at(4).mid(i*2, 2).toUShort(0, 16); + + DWORD result = local_WlanDisconnect(handle, &guid, 0); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result); + emit connectionError(id, DisconnectionError); + return; + } +} + +void QNativeWifiEngine::requestUpdate() +{ + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return; + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0); + if (result != ERROR_SUCCESS) + qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); + } +} + +QNativeWifiEngine *QNativeWifiEngine::instance() +{ + resolveLibrary(); + + // native wifi dll not available + if (!local_WlanOpenHandle) + return 0; + + QNativeWifiEngine *engine = nativeWifiEngine(); + + // could not initialise subsystem + if (engine && engine->handle == 0) + return 0; + + return engine; +} + +#include "moc_qnativewifiengine_win_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnativewifiengine_win_p.h b/src/network/bearer/qnativewifiengine_win_p.h new file mode 100644 index 0000000..0d5bcb0 --- /dev/null +++ b/src/network/bearer/qnativewifiengine_win_p.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNATIVEWIFIENGINE_P_H +#define QNATIVEWIFIENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworksessionengine_p.h" + +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QNativeWifiEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QNativeWifiEngine(QObject *parent = 0); + ~QNativeWifiEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + inline void emitConfigurationsChanged() { emit configurationsChanged(); } + + static QNativeWifiEngine *instance(); + +private: + QTimer pollTimer; + + Qt::HANDLE handle; +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp new file mode 100644 index 0000000..264f0df --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -0,0 +1,333 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworkconfigmanager.h" + +#ifdef Q_OS_SYMBIAN +#include "qnetworkconfigmanager_s60_p.h" +#else +#include "qnetworkconfigmanager_p.h" +#endif + +QTM_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); + +/*! + \class QNetworkConfigurationManager + + \brief The QNetworkConfigurationManager class manages the network configurations provided + by the system. + + \inmodule QtNetwork + \ingroup bearer + + QNetworkConfigurationManager provides access to the network configurations known to the system and + enables applications to detect the system capabilities (with regards to network sessions) at runtime. + + A QNetworkConfiguration abstracts a set of configuration options describing how a + network interface has to be configured to connect to a particular target network. + QNetworkConfigurationManager maintains and updates the global list of + QNetworkConfigurations. Applications can access and filter this list via + allConfigurations(). If a new configuration is added or an existing one is removed or changed + the configurationAdded(), configurationRemoved() and configurationChanged() signals are emitted + respectively. + + The defaultConfiguration() can be used when intending to immediately create a new + network session without caring about the particular configuration. It returns + a \l QNetworkConfiguration::Discovered configuration. If there are not any + discovered ones an invalid configuration is returned. + + Some configuration updates may require some time to perform updates. A WLAN scan is + such an example. Unless the platform performs internal updates it may be required to + manually trigger configuration updates via QNetworkConfigurationManager::updateConfigurations(). + The completion of the update process is indicted by emitting the updateCompleted() + signal. The update process ensures that every existing QNetworkConfiguration instance + is updated. There is no need to ask for a renewed configuration list via allConfigurations(). + + \sa QNetworkConfiguration +*/ + +/*! + \fn void QNetworkConfigurationManager::configurationAdded(const QNetworkConfiguration& config) + + This signal is emitted whenever a new network configuration is added to the system. The new + configuration is specified by \a config. +*/ + +/*! + \fn void QNetworkConfigurationManager::configurationRemoved(const QNetworkConfiguration& configuration) + + This signal is emitted when a configuration is about to be removed from the system. The removed + \a configuration is invalid but retains name and identifier. +*/ + +/*! + \fn void QNetworkConfigurationManager::updateCompleted() + + This signal is emitted when the configuration update has been completed. Such an update can + be initiated via \l updateConfigurations(). +*/ + +/*! \fn void QNetworkConfigurationManager::configurationChanged(const QNetworkConfiguration& config) + + This signal is emitted when the \l {QNetworkConfiguration::state()}{state} of \a config changes. +*/ + +/*! + \fn void QNetworkConfigurationManager::onlineStateChanged(bool isOnline) + + This signal is emitted when the device changes from online to offline mode or vice versa. + \a isOnline represents the new state of the device. + + The state is considered to be online for as long as + \l{allConfigurations()}{allConfigurations}(QNetworkConfiguration::Active) returns a list with + at least one entry. +*/ + +/*! + \enum QNetworkConfigurationManager::Capability + + Specifies the system capabilities of the bearer API. The possible values are: + + \value CanStartAndStopInterfaces Network sessions and their underlying access points can be + started and stopped. If this flag is not set QNetworkSession + can only monitor but not influence the state of access points. + On some platforms this feature may require elevated user + permissions. This option is platform specific and may not + always be available. + \value DirectConnectionRouting Network sessions and their sockets can be bound to a + particular network interface. Any packet that passes through + the socket goes to the specified network interface and thus + disregards standard routing table entries. This may be useful + when two interfaces can reach overlapping IP ranges or an + application has specific needs in regards to target networks. + This option is platform specific and may not always be + available. + \value SystemSessionSupport If this flag is set the underlying platform ensures that a + network interface is not shut down until the last network + session has been \l{QNetworkSession::close()}{closed()}. This + works across multiple processes. If the platform session + support is missing this API can only ensure the above behavior + for network sessions within the same process. + In general mobile platforms (such as Symbian/S60) have such + support whereas most desktop platform lack this capability. + \value ApplicationLevelRoaming The system gives applications control over the systems roaming + behavior. Applications can initiate roaming (in case the + current link is not suitable) and are consulted if the system + has identified a more suitable access point. + \value ForcedRoaming The system disconnects an existing access point and reconnects + via a more suitable one. The application does not have any + control over this process and has to reconnect its active + sockets. + \value DataStatistics If this flag is set QNetworkSession can provide statistics + about transmitted and received data. +*/ + +/*! + Constructs a QNetworkConfigurationManager with the given \a parent. +*/ +QNetworkConfigurationManager::QNetworkConfigurationManager( QObject* parent ) + : QObject(parent) +{ + QNetworkConfigurationManagerPrivate* priv = connManager(); + connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)), + this, SIGNAL(configurationAdded(QNetworkConfiguration))); + connect(priv, SIGNAL(configurationRemoved(QNetworkConfiguration)), + this, SIGNAL(configurationRemoved(QNetworkConfiguration))); + connect(priv, SIGNAL(configurationUpdateComplete()), + this, SIGNAL(updateCompleted())); + connect(priv, SIGNAL(onlineStateChanged(bool)), + this, SIGNAL(onlineStateChanged(bool))); + connect(priv, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SIGNAL(configurationChanged(QNetworkConfiguration))); +} + +/*! + Frees the resources associated with the QNetworkConfigurationManager object. +*/ +QNetworkConfigurationManager::~QNetworkConfigurationManager() +{ +} + + +/*! + Returns the default configuration to be used. This function always returns a discovered + configuration; otherwise an invalid configuration. + + In some cases it may be required to call updateConfigurations() and wait for the + updateCompleted() signal before calling this function. + + \sa allConfigurations() +*/ +QNetworkConfiguration QNetworkConfigurationManager::defaultConfiguration() const +{ + return connManager()->defaultConfiguration(); +} + +/*! + Returns the list of configurations which comply with the given \a filter. + + By default this function returns all (defined and undefined) configurations. + + A wireless network with a particular SSID may only be accessible in a + certain area despite the fact that the system has a valid configuration + for it. Therefore the filter flag may be used to limit the list to + discovered and possibly connected configurations only. + + If \a filter is set to zero this function returns all possible configurations. + + Note that this function returns the states for all configurations as they are known at + the time of this function call. If for instance a configuration of type WLAN is defined + the system may have to perform a WLAN scan in order to determine whether it is + actually available. To obtain the most accurate state updateConfigurations() should + be used to update each configuration's state. Note that such an update may require + some time. It's completion is signalled by updateCompleted(). In the absence of a + configuration update this function returns the best estimate at the time of the call. +*/ +QList QNetworkConfigurationManager::allConfigurations(QNetworkConfiguration::StateFlags filter) const +{ + QList result; + QNetworkConfigurationManagerPrivate* conPriv = connManager(); + QList cpsIdents = conPriv->accessPointConfigurations.keys(); + + //find all InternetAccessPoints + foreach( QString ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->accessPointConfigurations.value(ii); + if ( (p->state & filter) == filter ) { + QNetworkConfiguration pt; + pt.d = conPriv->accessPointConfigurations.value(ii); + result << pt; + } + } + + //find all service networks + cpsIdents = conPriv->snapConfigurations.keys(); + foreach( QString ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->snapConfigurations.value(ii); + if ( (p->state & filter) == filter ) { + QNetworkConfiguration pt; + pt.d = conPriv->snapConfigurations.value(ii); + result << pt; + } + } + + return result; +} + +/*! + Returns the QNetworkConfiguration for \a identifier; otherwise returns an + invalid QNetworkConfiguration. + + \sa QNetworkConfiguration::identifier() +*/ +QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier(const QString& identifier) const +{ + QNetworkConfigurationManagerPrivate* conPriv = connManager(); + QNetworkConfiguration item; + if (conPriv->accessPointConfigurations.contains(identifier)) + item.d = conPriv->accessPointConfigurations.value(identifier); + else if (conPriv->snapConfigurations.contains(identifier)) + item.d = conPriv->snapConfigurations.value(identifier); + else if (conPriv->userChoiceConfigurations.contains(identifier)) + item.d = conPriv->userChoiceConfigurations.value(identifier); + return item; + +} + +/*! + Returns true if the system is considered to be connected to another device via an active + network interface; otherwise returns false. + + This is equivalent to the following code snippet: + + \code + QNetworkConfigurationManager mgr; + QList activeConfigs = mgr.allConfigurations(QNetworkConfiguration::Active) + if (activeConfigs.count() > 0) + Q_ASSERT(mgr.isOnline()) + else + Q_ASSERT(!mgr.isOnline()) + \endcode + + \sa onlineStateChanged() +*/ +bool QNetworkConfigurationManager::isOnline() const +{ + QNetworkConfigurationManagerPrivate* conPriv = connManager(); + Q_UNUSED(conPriv); + QList activeConfigs = allConfigurations(QNetworkConfiguration::Active); + return activeConfigs.count() > 0; +} + +/*! + Returns the capabilities supported by the current platform. +*/ +QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabilities() const +{ + return connManager()->capFlags; +} + +/*! + Initiates an update of all configurations. This may be used to initiate WLAN scans or other + time consuming updates which may be required to obtain the correct state for configurations. + + This call is asynchronous. On completion of this update the updateCompleted() signal is + emitted. If new configurations are discovered or old ones were removed or changed the update + process may trigger the emission of one or multiple configurationAdded(), + configurationRemoved() and configurationChanged() signals. + + If a configuration state changes as a result of this update all existing QNetworkConfiguration + instances are updated automatically. + + \sa allConfigurations() +*/ +void QNetworkConfigurationManager::updateConfigurations() +{ + connManager()->performAsyncConfigurationUpdate(); +} + +#include "moc_qnetworkconfigmanager.cpp" + +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h new file mode 100644 index 0000000..98641f6 --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONMANAGER_H +#define QNETWORKCONFIGURATIONMANAGER_H + +#include "qmobilityglobal.h" + +#include +#include "qnetworkconfiguration.h" + +QT_BEGIN_HEADER + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationManagerPrivate; +class Q_BEARER_EXPORT QNetworkConfigurationManager : public QObject +{ + Q_OBJECT + +public: + + enum Capability { + CanStartAndStopInterfaces = 0x00000001, + DirectConnectionRouting = 0x00000002, + SystemSessionSupport = 0x00000004, + ApplicationLevelRoaming = 0x00000008, + ForcedRoaming = 0x00000010, + DataStatistics = 0x00000020 + }; + + Q_DECLARE_FLAGS(Capabilities, Capability) + + QNetworkConfigurationManager( QObject* parent = 0 ); + virtual ~QNetworkConfigurationManager(); + + + QNetworkConfigurationManager::Capabilities capabilities() const; + + QNetworkConfiguration defaultConfiguration() const; + QList allConfigurations(QNetworkConfiguration::StateFlags flags = 0) const; + QNetworkConfiguration configurationFromIdentifier(const QString& identifier) const; + void updateConfigurations(); + + bool isOnline() const; + +Q_SIGNALS: + void configurationAdded(const QNetworkConfiguration& config); + void configurationRemoved(const QNetworkConfiguration& config); + void configurationChanged(const QNetworkConfiguration& config); + void onlineStateChanged(bool isOnline); + void updateCompleted(); + +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkConfigurationManager::Capabilities) + +QTM_END_NAMESPACE + +QT_END_HEADER + +#endif //QNETWORKCONFIGURATIONMANAGER_H + diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp new file mode 100644 index 0000000..795b054 --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager_maemo.cpp @@ -0,0 +1,760 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qnetworkconfigmanager_maemo_p.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +QTM_BEGIN_NAMESPACE + +#define IAP "/system/osso/connectivity/IAP" +static int iap_prefix_len; +static void notify_iap(GConfClient *client, guint id, + GConfEntry *entry, gpointer user_data); + + +/* The IapAddTimer is a helper class that makes sure we update + * the configuration only after all gconf additions to certain + * iap are finished (after a certain timeout) + */ +class _IapAddTimer : public QObject +{ + Q_OBJECT + +public: + _IapAddTimer() {} + ~_IapAddTimer() + { + if (timer.isActive()) { + QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + timer.stop(); + } + } + + void add(QString& iap_id, QNetworkConfigurationManagerPrivate *d); + + QString iap_id; + QTimer timer; + QNetworkConfigurationManagerPrivate *d; + +public Q_SLOTS: + void timeout(); +}; + + +void _IapAddTimer::add(QString& id, QNetworkConfigurationManagerPrivate *d_ptr) +{ + iap_id = id; + d = d_ptr; + + if (timer.isActive()) { + QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + timer.stop(); + } + timer.setSingleShot(true); + QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + timer.start(1500); +} + + +void _IapAddTimer::timeout() +{ + d->addConfiguration(iap_id); +} + + +class IapAddTimer { + QHash timers; + +public: + IapAddTimer() {} + ~IapAddTimer() {} + + void add(QString& iap_id, QNetworkConfigurationManagerPrivate *d); + void del(QString& iap_id); + void removeAll(); +}; + + +void IapAddTimer::removeAll() +{ + QHashIterator i(timers); + while (i.hasNext()) { + i.next(); + _IapAddTimer *t = i.value(); + delete t; + } + timers.clear(); +} + + +void IapAddTimer::add(QString& iap_id, QNetworkConfigurationManagerPrivate *d) +{ + if (timers.contains(iap_id)) { + _IapAddTimer *iap = timers.value(iap_id); + iap->add(iap_id, d); + } else { + _IapAddTimer *iap = new _IapAddTimer; + iap->add(iap_id, d); + timers.insert(iap_id, iap); + } +} + +void IapAddTimer::del(QString& iap_id) +{ + if (timers.contains(iap_id)) { + _IapAddTimer *iap = timers.take(iap_id); + delete iap; + } +} + + +class IapMonitor +{ +public: + IapMonitor() : first_call(true) { } + friend void notify_iap(GConfClient *, guint, + GConfEntry *entry, gpointer user_data); + + void setup(QNetworkConfigurationManagerPrivate *d); + void cleanup(); + +private: + bool first_call; + + void iapAdded(const char *key, GConfEntry *entry); + void iapDeleted(const char *key, GConfEntry *entry); + + Maemo::IAPMonitor *iap; + QNetworkConfigurationManagerPrivate *d; + IapAddTimer timers; +}; + +Q_GLOBAL_STATIC(IapMonitor, iapMonitor); + + +/* Notify func that is called when IAP is added or deleted */ +static void notify_iap(GConfClient *, guint, + GConfEntry *entry, gpointer user_data) +{ + const char *key = gconf_entry_get_key(entry); + if (key && g_str_has_prefix(key, IAP)) { + IapMonitor *ptr = (IapMonitor *)user_data; + if (gconf_entry_get_value(entry)) { + ptr->iapAdded(key, entry); + } else { + ptr->iapDeleted(key, entry); + } + } +} + + +void IapMonitor::setup(QNetworkConfigurationManagerPrivate *d_ptr) +{ + if (first_call) { + d = d_ptr; + iap_prefix_len = strlen(IAP); + iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this); + first_call = false; + } +} + + +void IapMonitor::cleanup() +{ + if (!first_call) { + delete iap; + timers.removeAll(); + first_call = true; + } +} + + +void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/) +{ + //qDebug("Notify called for added element: %s=%s", gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry))); + + /* We cannot know when the IAP is fully added to gconf, so a timer is + * installed instead. When the timer expires we hope that IAP is added ok. + */ + QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0); + timers.add(iap_id, d); +} + + +void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/) +{ + //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry)); + + /* We are only interested in IAP deletions so we skip the config entries + */ + if (strstr(key + iap_prefix_len + 1, "/")) { + //qDebug("Deleting IAP config %s", key+iap_prefix_len); + return; + } + + QString iap_id = key + iap_prefix_len + 1; + d->deleteConfiguration(iap_id); +} + + + +void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() +{ + capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; + capFlags |= QNetworkConfigurationManager::DataStatistics; + capFlags |= QNetworkConfigurationManager::ForcedRoaming; +} + + +static inline QString network_attrs_to_security(uint network_attrs) +{ + uint cap = 0; + nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */ + if (cap & WLANCOND_OPEN) + return "NONE"; + else if (cap & WLANCOND_WEP) + return "WEP"; + else if (cap & WLANCOND_WPA_PSK) + return "WPA_PSK"; + else if (cap & WLANCOND_WPA_EAP) + return "WPA_EAP"; + return ""; +} + + +struct SSIDInfo { + QString iap_id; + QString wlan_security; +}; + + +void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivate *ptr) +{ + QNetworkConfiguration item; + item.d = ptr; + emit configurationChanged(item); +} + +void QNetworkConfigurationManagerPrivate::deleteConfiguration(QString& iap_id) +{ + /* Called when IAPs are deleted in gconf, in this case we do not scan + * or read all the IAPs from gconf because it might take too much power + * (multiple applications would need to scan and read all IAPs from gconf) + */ + if (accessPointConfigurations.contains(iap_id)) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.take(iap_id); + if (priv.data()) { + priv->isValid = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "was removed from storage."; +#endif + + QNetworkConfiguration item; + item.d = priv; + emit configurationRemoved(item); + configChanged(priv.data(), false); + } else + qWarning("Configuration not found for IAP %s", iap_id.toAscii().data()); + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data()); +#endif + } +} + + +uint32_t QNetworkConfigurationManagerPrivate::getNetworkAttrs(bool is_iap_id, + QString& iap_id, + QString& iap_type, + QString security_method) +{ + guint network_attr = 0; + dbus_uint32_t cap = 0; + + if (iap_type == "WLAN_INFRA") + cap |= WLANCOND_INFRA; + else if (iap_type == "WLAN_ADHOC") + cap |= WLANCOND_ADHOC; + + if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) { + Maemo::IAPConf saved_ap(iap_id); + security_method = saved_ap.value("wlan_security").toString(); + } + + if (!security_method.isEmpty()) { + if (security_method == "WEP") + cap |= WLANCOND_WEP; + else if (security_method == "WPA_PSK") + cap |= WLANCOND_WPA_PSK; + else if (security_method == "WPA_EAP") + cap |= WLANCOND_WPA_EAP; + else if (security_method == "NONE") + cap |= WLANCOND_OPEN; + + if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) { + Maemo::IAPConf saved_iap(iap_id); + bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool(); + if (wpa2_only) { + cap |= WLANCOND_WPA2; + } + } + } + + cap2nwattr(cap, &network_attr); + if (is_iap_id) + network_attr |= ICD_NW_ATTR_IAPNAME; + + return (uint32_t)network_attr; +} + + +void QNetworkConfigurationManagerPrivate::addConfiguration(QString& iap_id) +{ + if (!accessPointConfigurations.contains(iap_id)) { + Maemo::IAPConf saved_iap(iap_id); + QString iap_type = saved_iap.value("type").toString(); + if (!iap_type.isEmpty()) { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv->name = saved_iap.value("name").toString(); + if (cpPriv->name.isEmpty()) + cpPriv->name = iap_id; + cpPriv->isValid = true; + cpPriv->id = iap_id; + cpPriv->iap_type = iap_type; + cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); + cpPriv->service_id = saved_iap.value("service_id").toString(); + cpPriv->service_type = saved_iap.value("service_type").toString(); + if (iap_type.startsWith("WLAN")) { + QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray(); + if (ssid.isEmpty()) { + qWarning() << "Cannot get ssid for" << iap_id; + } + } + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Defined; + + QExplicitlySharedDataPointer ptr(cpPriv); + accessPointConfigurations.insert(iap_id, ptr); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, name: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data()); +#endif + + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + configChanged(ptr.data(), true); + } else { + qWarning("IAP %s does not have \"type\" field defined, skipping this IAP.", iap_id.toAscii().data()); + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "already in gconf."; +#endif + + /* Check if the data in gconf changed and update configuration + * accordingly + */ + QExplicitlySharedDataPointer ptr = accessPointConfigurations.take(iap_id); + if (ptr.data()) { + Maemo::IAPConf changed_iap(iap_id); + QString iap_type = changed_iap.value("type").toString(); + bool update_needed = false; /* if IAP type or ssid changed, we need to change the state */ + + ptr->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); + ptr->service_id = changed_iap.value("service_id").toString(); + ptr->service_type = changed_iap.value("service_type").toString(); + + if (!iap_type.isEmpty()) { + ptr->name = changed_iap.value("name").toString(); + if (ptr->name.isEmpty()) + ptr->name = iap_id; + ptr->isValid = true; + if (ptr->iap_type != iap_type) { + ptr->iap_type = iap_type; + update_needed = true; + } + if (iap_type.startsWith("WLAN")) { + QByteArray ssid = changed_iap.value("wlan_ssid").toByteArray(); + if (ssid.isEmpty()) { + qWarning() << "Cannot get ssid for" << iap_id; + } + if (ptr->network_id != ssid) { + ptr->network_id = ssid; + update_needed = true; + } + } + } + accessPointConfigurations.insert(iap_id, ptr); + if (update_needed) { + ptr->type = QNetworkConfiguration::InternetAccessPoint; + if (ptr->state != QNetworkConfiguration::Defined) { + ptr->state = QNetworkConfiguration::Defined; + configurationChanged(ptr.data()); + } + } + } else { + qWarning("Cannot find IAP %s from current configuration although it should be there.", iap_id.toAscii().data()); + } + } +} + + +void QNetworkConfigurationManagerPrivate::updateConfigurations() +{ + /* Contains known network id (like ssid) from storage */ + QMultiHash knownConfigs; + + /* All the scanned access points */ + QList scanned; + + /* Turn on IAP monitoring */ + iapMonitor()->setup(this); + + if (firstUpdate) { + /* We create a default configuration which is a pseudo config */ + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv->name = "UserChoice"; + cpPriv->state = QNetworkConfiguration::Discovered; + cpPriv->isValid = true; + cpPriv->id = OSSO_IAP_ANY; + cpPriv->type = QNetworkConfiguration::UserChoice; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + QExplicitlySharedDataPointer ptr(cpPriv); + userChoiceConfigurations.insert(cpPriv->id, ptr); + } + + /* We return currently configured IAPs in the first run and do the WLAN + * scan in subsequent runs. + */ + QList all_iaps; + Maemo::IAPConf::getAll(all_iaps); + + foreach (QString escaped_iap_id, all_iaps) { + QByteArray ssid; + + /* The key that is returned by getAll() needs to be unescaped */ + gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1); + QString iap_id = QString((char *)unescaped_id); + g_free(unescaped_id); + + Maemo::IAPConf saved_ap(iap_id); + bool is_temporary = saved_ap.value("temporary").toBool(); + if (is_temporary) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "is temporary, skipping it."; +#endif + continue; + } + + QString iap_type = saved_ap.value("type").toString(); + if (iap_type.startsWith("WLAN")) { + ssid = saved_ap.value("wlan_ssid").toByteArray(); + if (ssid.isEmpty()) { + qWarning() << "Cannot get ssid for" << iap_id; + continue; + } + + QString security_method = saved_ap.value("wlan_security").toString(); + SSIDInfo *info = new SSIDInfo; + info->iap_id = iap_id; + info->wlan_security = security_method; + knownConfigs.insert(ssid, info); + } else if (iap_type.isEmpty()) { + qWarning() << "IAP" << iap_id << "network type is not set! Skipping it"; + continue; + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "network type is" << iap_type; +#endif + ssid.clear(); + } + + if (!accessPointConfigurations.contains(iap_id)) { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + //cpPriv->name = iap_info.value().toString(); + cpPriv->name = saved_ap.value("name").toString(); + if (cpPriv->name.isEmpty()) + if (!ssid.isEmpty() && ssid.size() > 0) + cpPriv->name = ssid.data(); + else + cpPriv->name = iap_id; + cpPriv->isValid = true; + cpPriv->id = iap_id; + cpPriv->network_id = ssid; + cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); + cpPriv->iap_type = iap_type; + cpPriv->service_id = saved_ap.value("service_id").toString(); + cpPriv->service_type = saved_ap.value("service_type").toString(); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->manager = this; + + QExplicitlySharedDataPointer ptr(cpPriv); + accessPointConfigurations.insert(iap_id, ptr); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, name: %s, ssid: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); +#endif + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, ssid: %s, already exists in the known list", iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); +#endif + } + } + + if (!firstUpdate) { + QStringList scannedNetworkTypes; + QStringList networkTypesToScan; + QString error; + Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT); + + scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE, + networkTypesToScan, + scanned, + error); + if (!error.isEmpty()) { + qWarning() << "Network scanning failed" << error; + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + if (!scanned.isEmpty()) + qDebug() << "Scan returned" << scanned.size() << "networks"; + else + qDebug() << "Scan returned nothing."; +#endif + } + } + + + /* This is skipped in the first update as scanned size is zero */ + if (!scanned.isEmpty()) + for (int i=0; i priv = accessPointConfigurations.take(iapid); + if (priv.data()) { + priv->state = QNetworkConfiguration::Discovered; /* Defined is set automagically */ + priv->network_attrs = ap.scan.network_attrs; + priv->service_id = ap.scan.service_id; + priv->service_type = ap.scan.service_type; + priv->service_attrs = ap.scan.service_attrs; + + configurationChanged(priv.data()); + accessPointConfigurations.insert(iapid, priv); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, ssid: %s, discovered", iapid.toAscii().data(), priv->network_id.data()); +#endif + + if (!ap.scan.network_type.startsWith("WLAN")) + continue; // not a wlan AP + + /* Remove scanned AP from known configurations so that we can + * emit configurationRemoved signal later + */ + QList known_iaps = knownConfigs.values(priv->network_id); + rescan_list: + if (!known_iaps.isEmpty()) { + for (int k=0; kiap_id << "security" << iap->wlan_security << "scan" << network_attrs_to_security(ap.scan.network_attrs); +#endif + + if (iap->wlan_security == + network_attrs_to_security(ap.scan.network_attrs)) { + /* Remove IAP from the list */ + knownConfigs.remove(priv->network_id, iap); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Removed IAP" << iap->iap_id << "from unknown config"; +#endif + known_iaps.removeAt(k); + delete iap; + goto rescan_list; + } + } + } + } else { + qWarning() << "IAP" << iapid << "is missing in configuration."; + } + + } else { + /* Non saved access point data */ + QByteArray scanned_ssid = ap.scan.network_id; + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QString hrs = scanned_ssid.data(); + + cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name; + cpPriv->isValid = true; + cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved + cpPriv->network_id = scanned_ssid; + cpPriv->iap_type = ap.scan.network_type; + cpPriv->network_attrs = ap.scan.network_attrs; + cpPriv->service_id = ap.scan.service_id; + cpPriv->service_type = ap.scan.service_type; + cpPriv->service_attrs = ap.scan.service_attrs; + cpPriv->manager = this; + + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Undefined; + + QExplicitlySharedDataPointer ptr(cpPriv); + accessPointConfigurations.insert(cpPriv->id, ptr); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan."; +#endif + + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + } + + + /* Remove non existing iaps since last update */ + if (!firstUpdate) { + QHashIterator i(knownConfigs); + while (i.hasNext()) { + i.next(); + SSIDInfo *iap = i.value(); + QString iap_id = iap->iap_id; + //qDebug() << i.key() << ": " << iap_id; + + QExplicitlySharedDataPointer priv = accessPointConfigurations.take(iap_id); + if (priv.data()) { + priv->isValid = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "was removed as it was not found in scan."; +#endif + + QNetworkConfiguration item; + item.d = priv; + emit configurationRemoved(item); + configChanged(priv.data(), false); + + //if we would have SNAP support we would have to remove the references + //from existing ServiceNetworks to the removed access point configuration + } + } + } + + + QMutableHashIterator i(knownConfigs); + while (i.hasNext()) { + i.next(); + SSIDInfo *iap = i.value(); + delete iap; + i.remove(); + } + + if (!firstUpdate) + emit configurationUpdateComplete(); + + if (firstUpdate) + firstUpdate = false; +} + + +QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() +{ + /* Here we just return [ANY] request to icd and let the icd decide which + * IAP to connect. + */ + QNetworkConfiguration item; + if (userChoiceConfigurations.contains(OSSO_IAP_ANY)) + item.d = userChoiceConfigurations.value(OSSO_IAP_ANY); + return item; +} + + +void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() +{ + QTimer::singleShot(0, this, SLOT(updateConfigurations())); +} + + +void QNetworkConfigurationManagerPrivate::cleanup() +{ + iapMonitor()->cleanup(); +} + + +void QNetworkConfigurationManagerPrivate::configChanged(QNetworkConfigurationPrivate *ptr, bool added) +{ + if (added) { + if (ptr && ptr->state == QNetworkConfiguration::Active) { + onlineConfigurations++; + if (!firstUpdate && onlineConfigurations == 1) + emit onlineStateChanged(true); + } + } else { + if (ptr && ptr->state == QNetworkConfiguration::Active) { + onlineConfigurations--; + if (!firstUpdate && onlineConfigurations == 0) + emit onlineStateChanged(false); + if (onlineConfigurations < 0) + onlineConfigurations = 0; + } + } +} + + +#include "qnetworkconfigmanager_maemo.moc" +#include "moc_qnetworkconfigmanager_maemo_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_maemo_p.h b/src/network/bearer/qnetworkconfigmanager_maemo_p.h new file mode 100644 index 0000000..e182495 --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager_maemo_p.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONMANAGERPRIVATE_H +#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +#include +#include + +QTM_BEGIN_NAMESPACE + + +class QNetworkConfigurationManagerPrivate : public QObject +{ + Q_OBJECT +public: + QNetworkConfigurationManagerPrivate() + : QObject(0), capFlags(0), firstUpdate(true), onlineConfigurations(0) + { + registerPlatformCapabilities(); + updateConfigurations(); + } + + virtual ~QNetworkConfigurationManagerPrivate() + { + QList configIdents = snapConfigurations.keys(); + foreach(const QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + configIdents = accessPointConfigurations.keys(); + foreach(const QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + configIdents = userChoiceConfigurations.keys(); + foreach(const QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = userChoiceConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + cleanup(); + } + + QNetworkConfiguration defaultConfiguration(); + + QNetworkConfigurationManager::Capabilities capFlags; + void registerPlatformCapabilities(); + + void performAsyncConfigurationUpdate(); + + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash > accessPointConfigurations; + QHash > snapConfigurations; + QHash > userChoiceConfigurations; + bool firstUpdate; + int onlineConfigurations; + friend class IapMonitor; + void cleanup(); + void deleteConfiguration(QString &iap_id); + void addConfiguration(QString &iap_id); + void configurationChanged(QNetworkConfigurationPrivate *ptr); + uint32_t getNetworkAttrs(bool is_iap_id, QString& iap_id, + QString& iap_type, QString security_method); + void configChanged(QNetworkConfigurationPrivate *ptr, bool added); + friend class QNetworkSessionPrivate; + +public slots: + void updateConfigurations(); + +Q_SIGNALS: + void configurationAdded(const QNetworkConfiguration& config); + void configurationRemoved(const QNetworkConfiguration& config); + void configurationUpdateComplete(); + void configurationChanged(const QNetworkConfiguration& config); + void onlineStateChanged(bool isOnline); +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp new file mode 100644 index 0000000..8b15f41 --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -0,0 +1,450 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworkconfigmanager_p.h" +#include "qgenericengine_p.h" + +#ifdef Q_OS_WIN +#include "qnlaengine_win_p.h" +#endif +#ifdef Q_OS_WIN32 +#include "qnativewifiengine_win_p.h" +#endif +#if defined(BACKEND_NM) +#include "qnmwifiengine_unix_p.h" +#endif +#ifdef Q_OS_DARWIN +#include "qcorewlanengine_mac_p.h" +#endif + +#include +#include +#include + +QTM_BEGIN_NAMESPACE + +void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() +{ + capFlags = QNetworkConfigurationManager::ForcedRoaming; +} + +void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivate *cpPriv, QNetworkSessionEngine *engine) +{ + QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); + + ptr.data()->isValid = cpPriv->isValid; + ptr.data()->name = cpPriv->name; + ptr.data()->id = cpPriv->id; + ptr.data()->state = cpPriv->state; + ptr.data()->type = cpPriv->type; + ptr.data()->roamingSupported = cpPriv->roamingSupported; + ptr.data()->purpose = cpPriv->purpose; + ptr.data()->internet = cpPriv->internet; + + accessPointConfigurations.insert(cpPriv->id, ptr); + configurationEngine.insert(cpPriv->id, engine); + + if (!firstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + + if (ptr.data()->state == QNetworkConfiguration::Active) { + ++onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 1) + emit onlineStateChanged(true); + } +} + +void QNetworkConfigurationManagerPrivate::configurationRemoved(const QString &id) +{ + if (!accessPointConfigurations.contains(id)) + return; + + QExplicitlySharedDataPointer ptr = + accessPointConfigurations.take(id); + + configurationEngine.remove(id); + + ptr.data()->isValid = false; + + if (!firstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationRemoved(item); + } + + if (ptr.data()->state == QNetworkConfiguration::Active) { + --onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 0) + emit onlineStateChanged(false); + } +} + +void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivate *cpPriv) +{ + if (!accessPointConfigurations.contains(cpPriv->id)) + return; + + QExplicitlySharedDataPointer ptr = + accessPointConfigurations.value(cpPriv->id); + + if (ptr.data()->isValid != cpPriv->isValid || + ptr.data()->name != cpPriv->name || + ptr.data()->id != cpPriv->id || + ptr.data()->state != cpPriv->state || + ptr.data()->type != cpPriv->type || + ptr.data()->roamingSupported != cpPriv->roamingSupported || + ptr.data()->purpose != cpPriv->purpose || + ptr.data()->internet != cpPriv->internet) { + + const QNetworkConfiguration::StateFlags oldState = ptr.data()->state; + + ptr.data()->isValid = cpPriv->isValid; + ptr.data()->name = cpPriv->name; + ptr.data()->id = cpPriv->id; + ptr.data()->state = cpPriv->state; + ptr.data()->type = cpPriv->type; + ptr.data()->roamingSupported = cpPriv->roamingSupported; + ptr.data()->purpose = cpPriv->purpose; + ptr.data()->internet = cpPriv->internet; + + if (!firstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationChanged(item); + } + + if (ptr.data()->state == QNetworkConfiguration::Active && oldState != ptr.data()->state) { + // configuration went online + ++onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 1) + emit onlineStateChanged(true); + } else if (ptr.data()->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { + // configuration went offline + --onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 0) + emit onlineStateChanged(false); + } + } +} + +void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() +{ + if (!snapConfigurations.contains(QLatin1String("Internet Service Network"))) { + QNetworkConfigurationPrivate *serviceNetwork = new QNetworkConfigurationPrivate; + serviceNetwork->name = tr("Internet"); + serviceNetwork->isValid = true; + serviceNetwork->id = QLatin1String("Internet Service Network"); + serviceNetwork->state = QNetworkConfiguration::Defined; + serviceNetwork->type = QNetworkConfiguration::ServiceNetwork; + + QExplicitlySharedDataPointer ptr(serviceNetwork); + + snapConfigurations.insert(serviceNetwork->id, ptr); + + if (!firstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + } + + QExplicitlySharedDataPointer ptr = + snapConfigurations.value(QLatin1String("Internet Service Network")); + + QList > serviceNetworkMembers; + + QHash >::const_iterator i = + accessPointConfigurations.constBegin(); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined; + while (i != accessPointConfigurations.constEnd()) { + QExplicitlySharedDataPointer child = i.value(); + + if (child.data()->internet && ((child.data()->state & QNetworkConfiguration::Defined) + == QNetworkConfiguration::Defined)) { + serviceNetworkMembers.append(child); + + state |= child.data()->state; + } + + ++i; + } + + + if (ptr.data()->state != state || ptr.data()->serviceNetworkMembers != serviceNetworkMembers) { + ptr.data()->state = state; + ptr.data()->serviceNetworkMembers = serviceNetworkMembers; + + QNetworkConfiguration item; + item.d = ptr; + emit configurationChanged(item); + } +} + +void QNetworkConfigurationManagerPrivate::updateConfigurations() +{ + if (firstUpdate) { + updateState = NotUpdating; + onlineConfigurations = 0; + +#if defined (Q_OS_DARWIN) + coreWifi = QCoreWlanEngine::instance(); + if (coreWifi) { + connect(coreWifi, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } +#else +#if defined(BACKEND_NM) + nmWifi = QNmWifiEngine::instance(); + if (nmWifi) { + connect(nmWifi, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } else { +#endif + generic = QGenericEngine::instance(); + if (generic) { + connect(generic, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } +#if defined(BACKEND_NM) + } +#endif +#endif + +#ifdef Q_OS_WIN + nla = QNlaEngine::instance(); + if (nla) { + connect(nla, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } +#endif + +#ifdef Q_OS_WIN32 + nativeWifi = QNativeWifiEngine::instance(); + if (nativeWifi) { + connect(nativeWifi, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + + capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; + } +#endif + } + + QNetworkSessionEngine *engine = qobject_cast(sender()); + if (updateState & Updating && engine) { +#if defined (Q_OS_DARWIN) + if (engine == coreWifi) + updateState &= ~CoreWifiUpdating; +#else +#if defined(BACKEND_NM) + if (engine == nmWifi) + updateState &= ~NmUpdating; + else if (engine == generic) + updateState &= ~GenericUpdating; +#else + if (engine == generic) + updateState &= ~GenericUpdating; +#endif +#endif + +#ifdef Q_OS_WIN + else if (engine == nla) + updateState &= ~NlaUpdating; +#ifdef Q_OS_WIN32 + else if (engine == nativeWifi) + updateState &= ~NativeWifiUpdating; +#endif +#endif + } + QList engines; + if (firstUpdate) { +#if defined (Q_OS_DARWIN) + if (coreWifi) + engines << coreWifi; +#else +#if defined(BACKEND_NM) + if (nmWifi) + engines << nmWifi; + else if (generic) + engines << generic; +#else + if (generic) + engines << generic; +#endif +#endif + +#ifdef Q_OS_WIN + if (nla) + engines << nla; +#ifdef Q_OS_WIN32 + if (nativeWifi) + engines << nativeWifi; +#endif +#endif + } else if (engine) { + engines << engine; + } + + while (!engines.isEmpty()) { + engine = engines.takeFirst(); + + bool ok; + QList foundConfigurations = engine->getConfigurations(&ok); + + // Find removed configurations. + QList removedIdentifiers = configurationEngine.keys(); + for (int i = 0; i < foundConfigurations.count(); ++i) + removedIdentifiers.removeOne(foundConfigurations.at(i)->id); + + // Update or add configurations. + while (!foundConfigurations.isEmpty()) { + QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst(); + + if (accessPointConfigurations.contains(cpPriv->id)) + configurationChanged(cpPriv); + else + configurationAdded(cpPriv, engine); + + delete cpPriv; + } + + // Remove configurations. + while (!removedIdentifiers.isEmpty()) { + const QString id = removedIdentifiers.takeFirst(); + + if (configurationEngine.value(id) == engine) + configurationRemoved(id); + } + } + + updateInternetServiceConfiguration(); + + if (updateState == Updating) { + updateState = NotUpdating; + emit configurationUpdateComplete(); + } + + if (firstUpdate) + firstUpdate = false; +} + +/*! + Returns the first active configuration found, if one exists; otherwise returns the first + discovered configuration found, if one exists; otherwise returns an empty configuration. + + \internal +*/ +QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() +{ + QExplicitlySharedDataPointer firstActive; + QExplicitlySharedDataPointer firstDiscovered; + + QHash >::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivate *priv = i.value().data(); + + if (!firstActive && priv->isValid && + (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) + firstActive = i.value(); + if (!firstDiscovered && priv->isValid && + (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) + firstDiscovered = i.value(); + + ++i; + } + + QNetworkConfiguration item; + + if (firstActive) + item.d = firstActive; + else if (firstDiscovered) + item.d = firstDiscovered; + + return item; +} + +void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() +{ + updateState = Updating; +#if defined (Q_OS_DARWIN) + if (coreWifi) { + updateState |= CoreWifiUpdating; + coreWifi->requestUpdate(); + } +#else +#if defined(BACKEND_NM) + if (nmWifi) { + updateState |= NmUpdating; + nmWifi->requestUpdate(); + } else if (generic) { + updateState |= GenericUpdating; + generic->requestUpdate(); + } +#else + if (generic) { + updateState |= GenericUpdating; + generic->requestUpdate(); + } +#endif +#endif +#ifdef Q_OS_WIN + if (nla) { + updateState |= NlaUpdating; + nla->requestUpdate(); + } +#endif + +#ifdef Q_OS_WIN32 + if (nativeWifi) { + updateState |= NativeWifiUpdating; + nativeWifi->requestUpdate(); + } +#endif +} + +#include "moc_qnetworkconfigmanager_p.cpp" + +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h new file mode 100644 index 0000000..0c42f9b --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONMANAGERPRIVATE_H +#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkconfigmanager.h" +#include "qnetworkconfiguration_p.h" + +#include +#include + +QTM_BEGIN_NAMESPACE + +#ifdef BEARER_ENGINE +class QNetworkSessionEngine; +class QGenericEngine; +class QNlaEngine; +class QNativeWifiEngine; +class QNmWifiEngine; +class QCoreWlanEngine; +#endif + + +class QNetworkConfigurationManagerPrivate : public QObject +{ + Q_OBJECT +public: + QNetworkConfigurationManagerPrivate() + : QObject(0), capFlags(0), firstUpdate(true) + { + registerPlatformCapabilities(); + updateConfigurations(); + } + + virtual ~QNetworkConfigurationManagerPrivate() + { + QList configIdents = snapConfigurations.keys(); + foreach(const QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + configIdents = accessPointConfigurations.keys(); + foreach(const QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + } + + QNetworkConfiguration defaultConfiguration(); + + QNetworkConfigurationManager::Capabilities capFlags; + void registerPlatformCapabilities(); + + void performAsyncConfigurationUpdate(); + + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash > accessPointConfigurations; + QHash > snapConfigurations; + QHash > userChoiceConfigurations; +#ifdef BEARER_ENGINE + QHash configurationEngine; +#endif + bool firstUpdate; + +public slots: + void updateConfigurations(); + +Q_SIGNALS: + void configurationAdded(const QNetworkConfiguration& config); + void configurationRemoved(const QNetworkConfiguration& config); + void configurationUpdateComplete(); + void configurationChanged(const QNetworkConfiguration& config); + void onlineStateChanged(bool isOnline); + +private: +#ifdef BEARER_ENGINE + void updateInternetServiceConfiguration(); + + void abort(); +#endif + +#ifdef BEARER_ENGINE + QGenericEngine *generic; +#ifdef Q_OS_WIN + QNlaEngine *nla; +#ifndef Q_OS_WINCE + QNativeWifiEngine *nativeWifi; +#endif +#endif +#ifdef BACKEND_NM + QNmWifiEngine *nmWifi; +#endif +#ifdef Q_OS_DARWIN + QCoreWlanEngine *coreWifi; +#endif + + uint onlineConfigurations; + + enum EngineUpdate { + NotUpdating = 0x00, + Updating = 0x01, + GenericUpdating = 0x02, + NlaUpdating = 0x04, + NativeWifiUpdating = 0x08, + NmUpdating = 0x20, + CoreWifiUpdating = 0x40, + }; + Q_DECLARE_FLAGS(EngineUpdateState, EngineUpdate) + + EngineUpdateState updateState; +#endif + +private Q_SLOTS: +#ifdef BEARER_ENGINE + void configurationAdded(QNetworkConfigurationPrivate *cpPriv, QNetworkSessionEngine *engine); + void configurationRemoved(const QString &id); + void configurationChanged(QNetworkConfigurationPrivate *cpPriv); +#endif +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp new file mode 100644 index 0000000..760a194 --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp @@ -0,0 +1,974 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworkconfigmanager_s60_p.h" + +#include +#include +#include + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include +#endif + +QTM_BEGIN_NAMESPACE + +static const int KValueThatWillBeAddedToSNAPId = 1000; +static const int KUserChoiceIAPId = 0; + +QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() + : QObject(0), CActive(CActive::EPriorityIdle), capFlags(0), iFirstUpdate(true), iInitOk(true) +{ + CActiveScheduler::Add(this); + + registerPlatformCapabilities(); + TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); + if (error != KErrNone) { + iInitOk = false; + return; + } + + TRAP_IGNORE(iConnectionMonitor.ConnectL()); + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + TRAP(error, iCmManager.OpenL()); + if (error != KErrNone) { + iInitOk = false; + return; + } +#endif + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv->name = "UserChoice"; + cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; + cpPriv->state = QNetworkConfiguration::Discovered; + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); + cpPriv->numericId = KUserChoiceIAPId; + cpPriv->connectionId = 0; + cpPriv->type = QNetworkConfiguration::UserChoice; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + QExplicitlySharedDataPointer ptr(cpPriv); + userChoiceConfigurations.insert(cpPriv->id, ptr); + + updateConfigurations(); + updateStatesToSnaps(); + + // Start monitoring IAP and/or SNAP changes in Symbian CommsDB + startCommsDatabaseNotifications(); +} + +QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() +{ + Cancel(); + + QList configIdents = snapConfigurations.keys(); + foreach(QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + configIdents = accessPointConfigurations.keys(); + foreach(QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + configIdents = userChoiceConfigurations.keys(); + foreach(QString oldIface, configIdents) { + QExplicitlySharedDataPointer priv = userChoiceConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + priv->manager = 0; + } + + iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iCmManager.Close(); +#endif + + delete ipAccessPointsAvailabilityScanner; + delete ipCommsDB; +} + + +void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() +{ + capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; + capFlags |= QNetworkConfigurationManager::DirectConnectionRouting; + capFlags |= QNetworkConfigurationManager::SystemSessionSupport; +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming; + capFlags |= QNetworkConfigurationManager::ForcedRoaming; +#endif + capFlags |= QNetworkConfigurationManager::DataStatistics; +} + +void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() +{ + if (!iInitOk || iUpdateGoingOn) { + return; + } + iUpdateGoingOn = true; + + stopCommsDatabaseNotifications(); + updateConfigurations(); // Synchronous call + updateAvailableAccessPoints(); // Asynchronous call +} + +void QNetworkConfigurationManagerPrivate::updateConfigurations() +{ + if (!iInitOk) { + return; + } + + TRAP_IGNORE(updateConfigurationsL()); +} + +void QNetworkConfigurationManagerPrivate::updateConfigurationsL() +{ + QList knownConfigs = accessPointConfigurations.keys(); + QList knownSnapConfigs = snapConfigurations.keys(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + // S60 version is >= Series60 3rd Edition Feature Pack 2 + TInt error = KErrNone; + + // Loop through all IAPs + RArray connectionMethods; // IAPs + CleanupClosePushL(connectionMethods); + iCmManager.ConnectionMethodL(connectionMethods); + for(int i = 0; i < connectionMethods.Count(); i++) { + RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]); + CleanupClosePushL(connectionMethod); + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString ident = QString::number(qHash(iapId)); + if (accessPointConfigurations.contains(ident)) { + knownConfigs.removeOne(ident); + } else { + QNetworkConfigurationPrivate* cpPriv = NULL; + TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); + if (error == KErrNone) { + QExplicitlySharedDataPointer ptr(cpPriv); + accessPointConfigurations.insert(cpPriv->id, ptr); + if (!iFirstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + } + } + CleanupStack::PopAndDestroy(&connectionMethod); + } + CleanupStack::PopAndDestroy(&connectionMethods); + + // Loop through all SNAPs + RArray destinations; + CleanupClosePushL(destinations); + iCmManager.AllDestinationsL(destinations); + for(int i = 0; i < destinations.Count(); i++) { + RCmDestination destination; + destination = iCmManager.DestinationL(destinations[i]); + CleanupClosePushL(destination); + QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids + if (snapConfigurations.contains(ident)) { + knownSnapConfigs.removeOne(ident); + } else { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + CleanupStack::PushL(cpPriv); + + HBufC *pName = destination.NameLC(); + cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->numericId = destination.Id(); + cpPriv->connectionId = 0; + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->type = QNetworkConfiguration::ServiceNetwork; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + QExplicitlySharedDataPointer ptr(cpPriv); + snapConfigurations.insert(ident, ptr); + if (!iFirstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + + CleanupStack::Pop(cpPriv); + } + QExplicitlySharedDataPointer privSNAP = snapConfigurations.value(ident); + + for (int j=0; j < destination.ConnectionMethodCount(); j++) { + RCmConnectionMethod connectionMethod = destination.ConnectionMethodL(j); + CleanupClosePushL(connectionMethod); + + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString iface = QString::number(qHash(iapId)); + // Check that IAP can be found from accessPointConfigurations list + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); + if (priv.data() == 0) { + QNetworkConfigurationPrivate* cpPriv = NULL; + TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); + if (error == KErrNone) { + QExplicitlySharedDataPointer ptr(cpPriv); + ptr.data()->serviceNetworkPtr = privSNAP; + accessPointConfigurations.insert(cpPriv->id, ptr); + if (!iFirstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + privSNAP->serviceNetworkMembers.append(ptr); + } + } else { + knownConfigs.removeOne(iface); + // Check that IAP can be found from related SNAP's configuration list + bool iapFound = false; + for (int i=0; iserviceNetworkMembers.count(); i++) { + if (privSNAP->serviceNetworkMembers[i]->numericId == iapId) { + iapFound = true; + break; + } + } + if (!iapFound) { + priv.data()->serviceNetworkPtr = privSNAP; + privSNAP->serviceNetworkMembers.append(priv); + } + } + + CleanupStack::PopAndDestroy(&connectionMethod); + } + + if (privSNAP->serviceNetworkMembers.count() > 1) { + // Roaming is supported only if SNAP contains more than one IAP + privSNAP->roamingSupported = true; + } + + CleanupStack::PopAndDestroy(&destination); + } + CleanupStack::PopAndDestroy(&destinations); + +#else + // S60 version is < Series60 3rd Edition Feature Pack 2 + CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP)); + + // Loop through all IAPs + TUint32 apId = 0; + TInt retVal = pDbTView->GotoFirstRecord(); + while (retVal == KErrNone) { + pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); + QString ident = QString::number(qHash(apId)); + if (accessPointConfigurations.contains(ident)) { + knownConfigs.removeOne(ident); + } else { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + if (readNetworkConfigurationValuesFromCommsDb(apId, cpPriv)) { + QExplicitlySharedDataPointer ptr(cpPriv); + accessPointConfigurations.insert(ident, ptr); + if (!iFirstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationAdded(item); + } + } else { + delete cpPriv; + } + } + retVal = pDbTView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy(pDbTView); +#endif + updateActiveAccessPoints(); + + foreach (QString oldIface, knownConfigs) { + //remove non existing IAP + QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + if (!iFirstUpdate) { + QNetworkConfiguration item; + item.d = priv; + emit configurationRemoved(item); + } + // Remove non existing IAP from SNAPs + QList snapConfigIdents = snapConfigurations.keys(); + foreach (QString iface, snapConfigIdents) { + QExplicitlySharedDataPointer priv2 = snapConfigurations.value(iface); + // => Check if one of the IAPs of the SNAP is active + for (int i=0; iserviceNetworkMembers.count(); i++) { + if (priv2->serviceNetworkMembers[i]->numericId == priv->numericId) { + priv2->serviceNetworkMembers.removeAt(i); + break; + } + } + } + } + foreach (QString oldIface, knownSnapConfigs) { + //remove non existing SNAPs + QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + if (!iFirstUpdate) { + QNetworkConfiguration item; + item.d = priv; + emit configurationRemoved(item); + } + } + + iFirstUpdate = false; +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +QNetworkConfigurationPrivate* QNetworkConfigurationManagerPrivate::configFromConnectionMethodL( + RCmConnectionMethod& connectionMethod) +{ + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + CleanupStack::PushL(cpPriv); + + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString ident = QString::number(qHash(iapId)); + + HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName); + CleanupStack::PushL(pName); + cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + + TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); + switch (bearerId) { + case KCommDbBearerCSD: + cpPriv->bearer = QNetworkConfigurationPrivate::Bearer2G; + break; + case KCommDbBearerWcdma: + cpPriv->bearer = QNetworkConfigurationPrivate::BearerWCDMA; + break; + case KCommDbBearerLAN: + cpPriv->bearer = QNetworkConfigurationPrivate::BearerEthernet; + break; + case KCommDbBearerVirtual: + cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; + break; + case KCommDbBearerPAN: + cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; + break; + case KCommDbBearerWLAN: + cpPriv->bearer = QNetworkConfigurationPrivate::BearerWLAN; + break; + default: + cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; + break; + } + + TInt error = KErrNone; + TUint32 bearerType = connectionMethod.GetIntAttributeL(CMManager::ECmBearerType); + switch (bearerType) { + case KUidPacketDataBearerType: + // "Packet data" Bearer => Mapping is done using "Access point name" + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EPacketDataAPName)); + break; + case KUidWlanBearerType: + // "Wireless LAN" Bearer => Mapping is done using "WLAN network name" = SSID + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EWlanSSID)); + break; + } + if (!pName) { + // "Data call" Bearer or "High Speed (GSM)" Bearer => Mapping is done using "Dial-up number" + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EDialDefaultTelNum)); + } + + if (error == KErrNone && pName) { + CleanupStack::PushL(pName); + cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + } + + cpPriv->state = QNetworkConfiguration::Defined; + TBool isConnected = connectionMethod.GetBoolAttributeL(CMManager::ECmConnected); + if (isConnected) { + cpPriv->state = QNetworkConfiguration::Active; + } + + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->numericId = iapId; + cpPriv->connectionId = 0; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + CleanupStack::Pop(cpPriv); + return cpPriv; +} +#else +bool QNetworkConfigurationManagerPrivate::readNetworkConfigurationValuesFromCommsDb( + TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration) +{ + TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration)); + if (error != KErrNone) { + return false; + } + return true; +} + +void QNetworkConfigurationManagerPrivate::readNetworkConfigurationValuesFromCommsDbL( + TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration) +{ + CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB); + CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC(); + TBuf name; + + CApUtils* pApUtils = CApUtils::NewLC(*ipCommsDB); + TUint32 apId = pApUtils->WapIdFromIapIdL(aApId); + + pDataHandler->AccessPointDataL(apId,*pAPItem); + pAPItem->ReadTextL(EApIapName, name); + if (name.Compare(_L("Easy WLAN")) == 0) { + // "Easy WLAN" won't be accepted to the Configurations list + User::Leave(KErrNotFound); + } + + QString ident = QString::number(qHash(aApId)); + + apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()); + apNetworkConfiguration->isValid = true; + apNetworkConfiguration->id = ident; + apNetworkConfiguration->numericId = aApId; + apNetworkConfiguration->connectionId = 0; + apNetworkConfiguration->state = (QNetworkConfiguration::Defined); + apNetworkConfiguration->type = QNetworkConfiguration::InternetAccessPoint; + apNetworkConfiguration->purpose = QNetworkConfiguration::UnknownPurpose; + apNetworkConfiguration->roamingSupported = false; + switch (pAPItem->BearerTypeL()) { + case EApBearerTypeCSD: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::Bearer2G; + break; + case EApBearerTypeGPRS: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::Bearer2G; + break; + case EApBearerTypeHSCSD: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerHSPA; + break; + case EApBearerTypeCDMA: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerCDMA2000; + break; + case EApBearerTypeWLAN: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerWLAN; + break; + case EApBearerTypeLAN: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerEthernet; + break; + case EApBearerTypeLANModem: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerEthernet; + break; + default: + apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerUnknown; + break; + } + apNetworkConfiguration->manager = this; + + CleanupStack::PopAndDestroy(pApUtils); + CleanupStack::PopAndDestroy(pAPItem); + CleanupStack::PopAndDestroy(pDataHandler); +} +#endif + +QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() +{ + QNetworkConfiguration config; + + if (iInitOk) { + stopCommsDatabaseNotifications(); + TRAP_IGNORE(config = defaultConfigurationL()); + startCommsDatabaseNotifications(); + } + + return config; +} + +QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfigurationL() +{ + QNetworkConfiguration item; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + // Check Default Connection (SNAP or IAP) + TCmDefConnValue defaultConnectionValue; + iCmManager.ReadDefConnL(defaultConnectionValue); + if (defaultConnectionValue.iType == ECmDefConnDestination) { + QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId)); + QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); + if (priv.data() != 0) { + item.d = priv; + } + } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { + QString iface = QString::number(qHash(defaultConnectionValue.iId)); + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); + if (priv.data() != 0) { + item.d = priv; + } + } +#endif + + if (!item.isValid()) { + QString iface = QString::number(qHash(KUserChoiceIAPId)); + QExplicitlySharedDataPointer priv = userChoiceConfigurations.value(iface); + if (priv.data() != 0) { + item.d = priv; + } + } + + return item; +} + +void QNetworkConfigurationManagerPrivate::updateActiveAccessPoints() +{ + bool online = false; + QList inactiveConfigs = accessPointConfigurations.keys(); + + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + + // Go through all connections and set state of related IAPs to Active + TUint connectionId; + TUint subConnectionCount; + TUint apId; + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); + if (priv.data()) { + online = true; + inactiveConfigs.removeOne(ident); + priv.data()->connectionId = connectionId; + // Configuration is Active + changeConfigurationStateTo(priv, QNetworkConfiguration::Active); + } + } + } + + // Make sure that state of rest of the IAPs won't be Active + foreach (QString iface, inactiveConfigs) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); + if (priv.data()) { + // Configuration is either Defined or Discovered + changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Discovered); + } + } + + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } +} + +void QNetworkConfigurationManagerPrivate::updateAvailableAccessPoints() +{ + if (!ipAccessPointsAvailabilityScanner) { + ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor); + } + if (ipAccessPointsAvailabilityScanner) { + // Scanning may take a while because WLAN scanning will be done (if device supports WLAN). + ipAccessPointsAvailabilityScanner->StartScanning(); + } +} + +void QNetworkConfigurationManagerPrivate::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo) +{ + iUpdateGoingOn = false; + if (scanSuccessful) { + QList unavailableConfigs = accessPointConfigurations.keys(); + + // Set state of returned IAPs to Discovered + // if state is not already Active + for(TUint i=0; i priv = accessPointConfigurations.value(ident); + if (priv.data()) { + unavailableConfigs.removeOne(ident); + if (priv.data()->state < QNetworkConfiguration::Active) { + // Configuration is either Discovered or Active + changeConfigurationStateAtMinTo(priv, QNetworkConfiguration::Discovered); + } + } + } + + // Make sure that state of rest of the IAPs won't be Discovered or Active + foreach (QString iface, unavailableConfigs) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); + if (priv.data()) { + // Configuration is Defined + changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Defined); + } + } + } + + updateStatesToSnaps(); + + startCommsDatabaseNotifications(); + + emit this->configurationUpdateComplete(); +} + +void QNetworkConfigurationManagerPrivate::updateStatesToSnaps() +{ + // Go through SNAPs and set correct state to SNAPs + QList snapConfigIdents = snapConfigurations.keys(); + foreach (QString iface, snapConfigIdents) { + bool discovered = false; + bool active = false; + QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); + // => Check if one of the IAPs of the SNAP is discovered or active + // => If one of IAPs is active, also SNAP is active + // => If one of IAPs is discovered but none of the IAPs is active, SNAP is discovered + for (int i=0; iserviceNetworkMembers.count(); i++) { + QExplicitlySharedDataPointer priv2 = priv->serviceNetworkMembers[i]; + if ((priv->serviceNetworkMembers[i]->state & QNetworkConfiguration::Active) + == QNetworkConfiguration::Active) { + active = true; + break; + } else if ((priv->serviceNetworkMembers[i]->state & QNetworkConfiguration::Discovered) + == QNetworkConfiguration::Discovered) { + discovered = true; + } + } + if (active) { + changeConfigurationStateTo(priv, QNetworkConfiguration::Active); + } else if (discovered) { + changeConfigurationStateTo(priv, QNetworkConfiguration::Discovered); + } else { + changeConfigurationStateTo(priv, QNetworkConfiguration::Defined); + } + } +} + +bool QNetworkConfigurationManagerPrivate::changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, + QNetworkConfiguration::StateFlags newState) +{ + if (newState != sharedData.data()->state) { + sharedData.data()->state = newState; + QNetworkConfiguration item; + item.d = sharedData; + if (!iFirstUpdate) { + emit configurationChanged(item); + } + return true; + } + return false; +} + +/* changeConfigurationStateAtMinTo function does not overwrite possible better + * state (e.g. Discovered state does not overwrite Active state) but + * makes sure that state is at minimum given state. +*/ +bool QNetworkConfigurationManagerPrivate::changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer& sharedData, + QNetworkConfiguration::StateFlags newState) +{ + if ((newState | sharedData.data()->state) != sharedData.data()->state) { + sharedData.data()->state = (sharedData.data()->state | newState); + QNetworkConfiguration item; + item.d = sharedData; + if (!iFirstUpdate) { + emit configurationChanged(item); + } + return true; + } + return false; +} + +/* changeConfigurationStateAtMaxTo function overwrites possible better + * state (e.g. Discovered state overwrites Active state) and + * makes sure that state is at maximum given state (e.g. Discovered state + * does not overwrite Defined state). +*/ +bool QNetworkConfigurationManagerPrivate::changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, + QNetworkConfiguration::StateFlags newState) +{ + if ((newState & sharedData.data()->state) != sharedData.data()->state) { + sharedData.data()->state = (newState & sharedData.data()->state); + QNetworkConfiguration item; + item.d = sharedData; + if (!iFirstUpdate) { + emit configurationChanged(item); + } + return true; + } + return false; +} + +void QNetworkConfigurationManagerPrivate::startCommsDatabaseNotifications() +{ + if (!iWaitingCommsDatabaseNotifications) { + iWaitingCommsDatabaseNotifications = ETrue; + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + +void QNetworkConfigurationManagerPrivate::stopCommsDatabaseNotifications() +{ + if (iWaitingCommsDatabaseNotifications) { + iWaitingCommsDatabaseNotifications = EFalse; + if (!IsActive()) { + SetActive(); + // Make sure that notifier recorded events will not be returned + // as soon as the client issues the next RequestNotification() request. + ipCommsDB->RequestNotification(iStatus); + ipCommsDB->CancelRequestNotification(); + } else { + ipCommsDB->CancelRequestNotification(); + } + } +} + +void QNetworkConfigurationManagerPrivate::RunL() +{ + if (iStatus != KErrCancel) { + RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); + switch (event) { + case RDbNotifier::EUnlock: /** All read locks have been removed. */ + case RDbNotifier::ECommit: /** A transaction has been committed. */ + case RDbNotifier::ERollback: /** A transaction has been rolled back */ + case RDbNotifier::ERecover: /** The database has been recovered */ + // Note that if further database events occur while a client is handling + // a request completion, the notifier records the most significant database + // event and this is signalled as soon as the client issues the next + // RequestNotification() request. + // => Stop recording notifications + stopCommsDatabaseNotifications(); + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } + iWaitingCommsDatabaseNotifications = true; + break; + default: + // Do nothing + break; + } + } + + if (iWaitingCommsDatabaseNotifications) { + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + +void QNetworkConfigurationManagerPrivate::DoCancel() +{ + ipCommsDB->CancelRequestNotification(); +} + + +void QNetworkConfigurationManagerPrivate::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) { + case EConnMonCreateConnection: + { + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint subConnectionCount = 0; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); + if (priv.data()) { + priv.data()->connectionId = connectionId; + // Configuration is Active + if (changeConfigurationStateTo(priv, QNetworkConfiguration::Active)) { + updateStatesToSnaps(); + } + if (!iOnline) { + iOnline = true; + emit this->onlineStateChanged(iOnline); + } + } + } + break; + + case EConnMonDeleteConnection: + { + CConnMonDeleteConnection* realEvent; + realEvent = (CConnMonDeleteConnection*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + QExplicitlySharedDataPointer priv = dataByConnectionId(connectionId); + if (priv.data()) { + priv.data()->connectionId = 0; + // Configuration is either Defined or Discovered + if (changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Discovered)) { + updateStatesToSnaps(); + } + } + + bool online = false; + QList iapConfigs = accessPointConfigurations.keys(); + foreach (QString iface, iapConfigs) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); + if (priv.data()->state == QNetworkConfiguration::Active) { + online = true; + break; + } + } + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } + } + break; + + case EConnMonIapAvailabilityChange: + { + CConnMonIapAvailabilityChange* realEvent; + realEvent = (CConnMonIapAvailabilityChange*) &aEvent; + TConnMonIapInfo iaps = realEvent->IapAvailability(); + QList unDiscoveredConfigs = accessPointConfigurations.keys(); + for ( TUint i = 0; i < iaps.Count(); i++ ) { + QString ident = QString::number(qHash(iaps.iIap[i].iIapId)); + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); + if (priv.data()) { + // Configuration is either Discovered or Active + changeConfigurationStateAtMinTo(priv, QNetworkConfiguration::Discovered); + unDiscoveredConfigs.removeOne(ident); + } + } + foreach (QString iface, unDiscoveredConfigs) { + QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); + if (priv.data()) { + // Configuration is Defined + changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Defined); + } + } + } + break; + + default: + // For unrecognized events + break; + } +} + +QExplicitlySharedDataPointer QNetworkConfigurationManagerPrivate::dataByConnectionId(TUint aConnectionId) +{ + QNetworkConfiguration item; + + QHash >::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QExplicitlySharedDataPointer priv = i.value(); + if (priv.data()->connectionId == aConnectionId) { + return priv; + } + ++i; + } + + return QExplicitlySharedDataPointer(); +} + +AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, + RConnectionMonitor& connectionMonitor) + : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor) +{ + CActiveScheduler::Add(this); +} + +AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner() +{ + Cancel(); +} + +void AccessPointsAvailabilityScanner::DoCancel() +{ + iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute); +} + +void AccessPointsAvailabilityScanner::StartScanning() +{ + iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); + if (!IsActive()) { + SetActive(); + } +} + +void AccessPointsAvailabilityScanner::RunL() +{ + if (iStatus.Int() != KErrNone) { + iIapBuf().iCount = 0; + iOwner.accessPointScanningReady(false,iIapBuf()); + } else { + iOwner.accessPointScanningReady(true,iIapBuf()); + } +} +#include "moc_qnetworkconfigmanager_s60_p.cpp" +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h new file mode 100644 index 0000000..296d67f --- /dev/null +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -0,0 +1,182 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONMANAGERPRIVATE_H +#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include +#include +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include +#endif + +class CCommsDatabase; +class QTimer; + +QTM_BEGIN_NAMESPACE + +class QNetworkSessionPrivate; +class AccessPointsAvailabilityScanner; + +class QNetworkConfigurationManagerPrivate : public QObject, public CActive, public MConnectionMonitorObserver +{ + Q_OBJECT + +public: + QNetworkConfigurationManagerPrivate(); + virtual ~QNetworkConfigurationManagerPrivate(); + + QNetworkConfiguration defaultConfiguration(); + void performAsyncConfigurationUpdate(); + +Q_SIGNALS: + void configurationAdded(const QNetworkConfiguration& config); + void configurationRemoved(const QNetworkConfiguration& config); + void configurationUpdateComplete(); + void configurationChanged(const QNetworkConfiguration& config); + void onlineStateChanged(bool isOnline); + +public Q_SLOTS: + void updateConfigurations(); + +private: + void registerPlatformCapabilities(); + void updateStatesToSnaps(); + bool changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, + QNetworkConfiguration::StateFlags newState); + bool changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer& sharedData, + QNetworkConfiguration::StateFlags newState); + bool changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, + QNetworkConfiguration::StateFlags newState); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + QNetworkConfigurationPrivate* configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); +#else + bool readNetworkConfigurationValuesFromCommsDb( + TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); + void readNetworkConfigurationValuesFromCommsDbL( + TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); +#endif + + void updateConfigurationsL(); + void updateActiveAccessPoints(); + void updateAvailableAccessPoints(); + void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); + void startCommsDatabaseNotifications(); + void stopCommsDatabaseNotifications(); + + QNetworkConfiguration defaultConfigurationL(); + TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; + void startMonitoringIAPData(TUint32 aIapId); + QExplicitlySharedDataPointer dataByConnectionId(TUint aConnectionId); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +public: // Data + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash > accessPointConfigurations; + QHash > snapConfigurations; + QHash > userChoiceConfigurations; + QNetworkConfigurationManager::Capabilities capFlags; + +private: // Data + bool iFirstUpdate; + CCommsDatabase* ipCommsDB; + RConnectionMonitor iConnectionMonitor; + + TBool iWaitingCommsDatabaseNotifications; + TBool iOnline; + TBool iInitOk; + TBool iUpdateGoingOn; + + + AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; + + friend class QNetworkSessionPrivate; + friend class AccessPointsAvailabilityScanner; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + RCmManager iCmManager; +#endif +}; + +class AccessPointsAvailabilityScanner : public CActive +{ +public: + AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, + RConnectionMonitor& connectionMonitor); + ~AccessPointsAvailabilityScanner(); + + void StartScanning(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // Data + QNetworkConfigurationManagerPrivate& iOwner; + RConnectionMonitor& iConnectionMonitor; + TConnMonIapInfoBuf iIapBuf; +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp new file mode 100644 index 0000000..c92b356 --- /dev/null +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -0,0 +1,349 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworkconfiguration.h" + +#ifdef Q_OS_SYMBIAN +#include "qnetworkconfiguration_s60_p.h" +#else +#include "qnetworkconfiguration_p.h" +#endif + +QTM_BEGIN_NAMESPACE + +/*! + \class QNetworkConfiguration + + \brief The QNetworkConfiguration class provides an abstraction of one or more access point configurations. + + \inmodule QtNetwork + \ingroup bearer + + QNetworkConfiguration encapsulates a single access point or service network. + In most cases a single access point configuration can be mapped to one network + interface. However a single network interface may not always map to only one + access point configuration. Multiple configurations for the same + network device may enable multiple access points. An example + device that could exhibit such a configuration might be a + Smartphone which allows the user to manage multiple WLAN + configurations while the device itself has only one WLAN network device. + + The QNetworkConfiguration also supports the concept of service networks. + This concept allows the grouping of multiple access point configurations + into one entity. Such a group is called service network and can be + beneficial in cases whereby a network session to a + particular destination network is required (e.g. a company network). + When using a service network the user doesn't usually care which one of the + connectivity options is chosen (e.g. corporate WLAN or VPN via GPRS) + as long as he can reach the company's target server. Depending + on the current position and time some of the access points that make + up the service network may not even be available. Furthermore + automated access point roaming can be enabled which enables the device + to change the network interface configuration dynamically while maintaining + the applications connection to the target network. It allows adaption + to the changing environment and may enable optimization with regards to + cost, speed or other network parameters. + + Special configurations of type UserChoice provide a placeholder configuration which is + resolved to an actual network configuration by the platform when a + \l {QNetworkSession}{session} is \l {QNetworkSession::open()}{opened}. Not all platforms + support the concept of a user choice configuration. + + \section1 Configuration states + + The list of available configurations can be obtained via + QNetworkConfigurationManager::allConfigurations(). A configuration can have + multiple states. The \l Defined configuration state indicates that the configuration + is stored on the device. However the configuration is not yet ready to be activated + as e.g. a WLAN may not be available at the current time. + + The \l Discovered state implies that the configuration is \l Defined and + the outside conditions are such that the configuration can be used immediately + to open a new network session. An example of such an outside condition may be + that the Ethernet cable is actually connected to the device or that the WLAN + with the specified SSID is in range. + + The \l Active state implies that the configuration is \l Discovered. A configuration + in this state is currently being used by an application. The underlying network + interface has a valid IP configuration and can transfer IP packets between the + device and the target network. + + The \l Undefined state indicates that the system has knowledge of possible target + networks but cannot actually use that knowledge to connect to it. An example + for such a state could be an encrypted WLAN that has been discovered + but the user hasn't actually saved a configuration including the required password + which would allow the device to connect to it. + + Depending on the type of configuration some states are transient in nature. A GPRS/UMTS + connection may almost always be \l Discovered if the GSM/UMTS network is available. + However if the GSM/UMTS network looses the connection the associated configuration may change its state + from \l Discovered to \l Defined as well. A similar use case might be triggered by + WLAN availability. QNetworkConfigurationManager::updateConfigurations() can be used to + manually trigger updates of states. Note that some platforms do not require such updates + as they implicitly change the state once it has been discovered. If the state of a + configuration changes all related QNetworkConfiguration instances change their state automatically. + + \sa QNetworkSession, QNetworkConfigurationManager +*/ + +/*! + \enum QNetworkConfiguration::Type + + This enum describes the type of configuration. + + \value InternetAccessPoint The configuration specifies the details for a single access point. + Note that configurations of type InternetAccessPoint may be part + of other QNetworkConfigurations of type ServiceNetwork. + \value ServiceNetwork The configuration is based on a group of QNetworkConfigurations of + type InternetAccessPoint. All group members can reach the same + target network. This type of configuration is a mandatory + requirement for roaming enabled network sessions. On some + platforms this form of configuration may also be called Service + Network Access Point (SNAP). + \value UserChoice The configuration is a placeholder which will be resolved to an + actual configuration by the platform when a session is opened. Depending + on the platform the selection may generate a popup dialog asking the user + for his preferred choice. + \value Invalid The configuration is invalid. +*/ + +/*! + \enum QNetworkConfiguration::StateFlag + + Specifies the configuration states. + + \value Undefined This state is used for transient configurations such as newly discovered + WLANs for which the user has not actually created a configuration yet. + \value Defined Defined configurations are known to the system but are not immediately + usable (e.g. a configured WLAN is not within range or the Ethernet cable + is currently not plugged into the machine). + \value Discovered A discovered configuration can be immediately used to create a new + QNetworkSession. An example of a discovered configuration could be a WLAN + which is within in range. If the device moves out of range the discovered + flag is dropped. A second example is a GPRS configuration which generally + remains discovered for as long as the phone has network coverage. A + configuration that has this state is also in state + QNetworkConfiguration::Defined. If the configuration is a service network + this flag is set if at least one of the underlying access points + configurations has the Discovered state. + \value Active The configuration is currently used by an open/active network session + (see \l QNetworkSession::isActive()). However this does not mean that the + current process is the entity that created the active session. It merely + indicates that if a new QNetworkSession were to be constructed based on + this configuration \l QNetworkSession::state() would return + \l QNetworkSession::Connected. This state implies the + QNetworkConfiguration::Discovered state. +*/ + +/*! + \enum QNetworkConfiguration::Purpose + + Specifies the purpose of the configuration. + + \value UnknownPurpose The configuration doesn't specify any purpose. This is the default value. + \value PublicPurpose The configuration can be used for general purpose internet access. + \value PrivatePurpose The configuration is suitable to access a private network such as an office Intranet. + \value ServiceSpecificPurpose The configuration can be used for operator specific services (e.g. + receiving MMS messages or content streaming). +*/ + +/*! + Constructs an invalid configuration object. + + \sa isValid() +*/ +QNetworkConfiguration::QNetworkConfiguration() + : d(0) +{ +} + +/*! + Creates a copy of the QNetworkConfiguration object contained in \a other. +*/ +QNetworkConfiguration::QNetworkConfiguration(const QNetworkConfiguration& other) + : d(other.d) +{ +} + +/*! + Copies the content of the QNetworkConfiguration object contained in \a other into this one. +*/ +QNetworkConfiguration& QNetworkConfiguration::operator=(const QNetworkConfiguration& other) +{ + d = other.d; + return *this; +} + +/*! + Frees the resources associated with the QNetworkConfiguration object. +*/ +QNetworkConfiguration::~QNetworkConfiguration() +{ +} + +/*! + Returns true, if this configuration is the same as the \a other + configuration given; otherwise returns false. +*/ +bool QNetworkConfiguration::operator==(const QNetworkConfiguration& other) const +{ + if (!d) + return !other.d; + + if (!other.d) + return false; + + return (d == other.d); +} + +/*! + \fn bool QNetworkConfiguration::operator!=(const QNetworkConfiguration& other) const + + Returns true if this configuration is not the same as the \a other + configuration given; otherwise returns false. +*/ + +/*! + Returns the user visible name of this configuration. + + The name may either be the name of the underlying access point or the + name for service network that this configuration represents. +*/ +QString QNetworkConfiguration::name() const +{ + return d ? d->name : QString(); +} + +/*! + Returns the unique and platform specific identifier for this network configuration; + otherwise an empty string. +*/ +QString QNetworkConfiguration::identifier() const +{ + return d ? d->id : QString(); +} + +/*! + Returns the type of the configuration. + + A configuration can represent a single access point configuration or + a set of access point configurations. Such a set is called service network. + A configuration that is based on a service network can potentially support + roaming of network sessions. +*/ +QNetworkConfiguration::Type QNetworkConfiguration::type() const +{ + return d ? d->type : QNetworkConfiguration::Invalid; +} + +/*! + Returns true if this QNetworkConfiguration object is valid. + A configuration may become invalid if the user deletes the configuration or + the configuration was default-constructed. + + The addition and removal of configurations can be monitored via the + QNetworkConfigurationManager. + + \sa QNetworkConfigurationManager +*/ +bool QNetworkConfiguration::isValid() const +{ + return d ? d->isValid : false; +} + +/*! + Returns the current state of the configuration. +*/ +QNetworkConfiguration::StateFlags QNetworkConfiguration::state() const +{ + return d ? d->state : QNetworkConfiguration::Undefined; +} + +/*! + Returns the purpose of this configuration. + + The purpose field may be used to programmatically determine the + purpose of a configuration. Such information is usually part of the + access point or service network meta data. +*/ +QNetworkConfiguration::Purpose QNetworkConfiguration::purpose() const +{ + return d ? d->purpose : QNetworkConfiguration::UnknownPurpose; +} + +/*! + Returns true if this configuration supports roaming; otherwise false. +*/ +bool QNetworkConfiguration::isRoamingAvailable() const +{ + return d ? d->roamingSupported : false; +} + +/*! + Returns all sub configurations of this network configuration. + Only network configurations of type \l ServiceNetwork can have children. Otherwise + this function returns an empty list. +*/ +QList QNetworkConfiguration::children() const +{ + QList results; + if (type() != QNetworkConfiguration::ServiceNetwork || !isValid() ) + return results; + + QMutableListIterator > iter(d->serviceNetworkMembers); + QExplicitlySharedDataPointer p(0); + while(iter.hasNext()) { + p = iter.next(); + //if we have an invalid member get rid of it -> was deleted earlier on + if (!p->isValid) + iter.remove(); + + QNetworkConfiguration item; + item.d = p; + results << item; + } + + return results; +} + + +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h new file mode 100644 index 0000000..f8c17d5 --- /dev/null +++ b/src/network/bearer/qnetworkconfiguration.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATION_H +#define QNETWORKCONFIGURATION_H + +#include "qmobilityglobal.h" + +#include +#include +#include + +QT_BEGIN_HEADER + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; +class Q_BEARER_EXPORT QNetworkConfiguration +{ +public: + QNetworkConfiguration(); + QNetworkConfiguration(const QNetworkConfiguration& other); + QNetworkConfiguration &operator=(const QNetworkConfiguration& other); + ~QNetworkConfiguration(); + + bool operator==(const QNetworkConfiguration& cp) const; + inline bool operator!=(const QNetworkConfiguration& cp) const + { return !operator==(cp); } + + enum Type { + InternetAccessPoint = 0, + ServiceNetwork, + UserChoice, + Invalid + }; + + enum Purpose { + UnknownPurpose = 0, + PublicPurpose, + PrivatePurpose, + ServiceSpecificPurpose + }; + + enum StateFlag { + Undefined = 0x0000001, + Defined = 0x0000002, + Discovered = 0x0000006, + Active = 0x000000e + }; + + Q_DECLARE_FLAGS(StateFlags, StateFlag) + + StateFlags state() const; + Type type() const; + Purpose purpose() const; + QString identifier() const; + bool isRoamingAvailable() const; + QList children() const; + + QString name() const; + bool isValid() const; + +private: + friend class QNetworkConfigurationPrivate; + friend class QNetworkConfigurationManager; + friend class QNetworkConfigurationManagerPrivate; + friend class QNetworkSessionPrivate; + QExplicitlySharedDataPointer d; +}; + +QTM_END_NAMESPACE + +QT_END_HEADER + +#endif //QNETWORKCONFIGURATION_H diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h new file mode 100644 index 0000000..8d786aa --- /dev/null +++ b/src/network/bearer/qnetworkconfiguration_maemo_p.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONPRIVATE_H +#define QNETWORKCONFIGURATIONPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate : public QSharedData +{ +public: + QNetworkConfigurationPrivate () + : isValid(false), type(QNetworkConfiguration::Invalid), + roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), + network_attrs(0), service_attrs(0), manager(0) + { + } + + ~QNetworkConfigurationPrivate() + { + //release pointers to member configurations + serviceNetworkMembers.clear(); + } + + QString name; + bool isValid; + QString id; + QNetworkConfiguration::StateFlags state; + QNetworkConfiguration::Type type; + bool roamingSupported; + QNetworkConfiguration::Purpose purpose; + + QList > serviceNetworkMembers; + QNetworkInterface serviceInterface; + + /* In Maemo the id field (defined above) is the IAP id (which typically is UUID) */ + QByteArray network_id; /* typically WLAN ssid or similar */ + QString iap_type; /* is this one WLAN or GPRS */ + uint32_t network_attrs; /* network attributes for this IAP, this is the value returned by icd and passed to it when connecting */ + + QString service_type; + QString service_id; + uint32_t service_attrs; + + QNetworkConfigurationManagerPrivate *manager; + +private: + + // disallow detaching + QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); + QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h new file mode 100644 index 0000000..a3bcd9a --- /dev/null +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONPRIVATE_H +#define QNETWORKCONFIGURATIONPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkconfiguration.h" +#include +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate : public QSharedData +{ +public: + QNetworkConfigurationPrivate () + : isValid(false), type(QNetworkConfiguration::Invalid), + roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose) + { +#ifdef BEARER_ENGINE + internet = false; +#endif + } + + ~QNetworkConfigurationPrivate() + { + //release pointers to member configurations + serviceNetworkMembers.clear(); + } + + QString name; + bool isValid; + QString id; + QNetworkConfiguration::StateFlags state; + QNetworkConfiguration::Type type; + bool roamingSupported; + QNetworkConfiguration::Purpose purpose; + +#ifdef BEARER_ENGINE + bool internet; +#endif + + QList > serviceNetworkMembers; + QNetworkInterface serviceInterface; + +private: + + // disallow detaching + QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); + QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp new file mode 100644 index 0000000..61548ba --- /dev/null +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworkconfiguration_s60_p.h" + +QTM_BEGIN_NAMESPACE + +QNetworkConfigurationPrivate::QNetworkConfigurationPrivate() + : isValid(false), type(QNetworkConfiguration::Invalid), + roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), + bearer(QNetworkConfigurationPrivate::BearerUnknown), numericId(0), + connectionId(0), manager(0) +{ +} + +QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate() +{ + //release pointers to member configurations + serviceNetworkMembers.clear(); +} + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h new file mode 100644 index 0000000..44f8f56 --- /dev/null +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKCONFIGURATIONPRIVATE_H +#define QNETWORKCONFIGURATIONPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate : public QSharedData +{ +public: + enum Bearer { + BearerEthernet, + BearerWLAN, + Bearer2G, + BearerCDMA2000, + BearerWCDMA, + BearerHSPA, + BearerBluetooth, + BearerWiMAX, + BearerUnknown = -1 + }; + + QNetworkConfigurationPrivate(); + ~QNetworkConfigurationPrivate(); + + QString name; + bool isValid; + QString id; + QNetworkConfiguration::StateFlags state; + QNetworkConfiguration::Type type; + bool roamingSupported; + QNetworkConfiguration::Purpose purpose; + + QList > serviceNetworkMembers; + + QNetworkConfigurationPrivate::Bearer bearer; + TUint32 numericId; + TUint connectionId; + + TAny* manager; + + QString mappingName; + + QExplicitlySharedDataPointer serviceNetworkPtr; + +private: + // disallow detaching + QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); + QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKCONFIGURATIONPRIVATE_H + diff --git a/src/network/bearer/qnetworkmanagerservice_p.cpp b/src/network/bearer/qnetworkmanagerservice_p.cpp new file mode 100644 index 0000000..2f91af0 --- /dev/null +++ b/src/network/bearer/qnetworkmanagerservice_p.cpp @@ -0,0 +1,1011 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include "qnetworkmanagerservice_p.h" + +//Q_DECLARE_METATYPE(QList) +QTM_BEGIN_NAMESPACE + +static QDBusConnection dbusConnection = QDBusConnection::systemBus(); +//static QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbusConnection); + +class QNetworkManagerInterfacePrivate +{ +public: + QDBusInterface *connectionInterface; + bool valid; +}; + +QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) + : QObject(parent) +{ + d = new QNetworkManagerInterfacePrivate(); + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + dbusConnection); + if (!d->connectionInterface->isValid()) { + qWarning() << "Could not find NetworkManager"; + d->valid = false; + return; + } + d->valid = true; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), + this, SIGNAL(stateChanged(const QString&, quint32))); + +} + +QNetworkManagerInterface::~QNetworkManagerInterface() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterface::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterface::setConnections() +{ + if(!isValid() ) + return false; + bool allOk = false; + if (!dbusConnection.connect(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap)))) { + allOk = true; + } + if (!dbusConnection.connect(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + "DeviceAdded", + this,SIGNAL(deviceAdded(QDBusObjectPath)))) { + allOk = true; + } + if (!dbusConnection.connect(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + "DeviceRemoved", + this,SIGNAL(deviceRemoved(QDBusObjectPath)))) { + allOk = true; + } + + return allOk; +} + +QDBusInterface *QNetworkManagerInterface::connectionInterface() const +{ + return d->connectionInterface; +} + +QList QNetworkManagerInterface::getDevices() const +{ + QDBusReply > reply = d->connectionInterface->call("GetDevices"); + return reply.value(); +} + +void QNetworkManagerInterface::activateConnection( const QString &serviceName, + QDBusObjectPath connectionPath, + QDBusObjectPath devicePath, + QDBusObjectPath specificObject) +{ + QDBusPendingCall pendingCall = d->connectionInterface->asyncCall("ActivateConnection", + QVariant(serviceName), + QVariant::fromValue(connectionPath), + QVariant::fromValue(devicePath), + QVariant::fromValue(specificObject)); + + QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingCall, this); + connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), + this, SIGNAL(activationFinished(QDBusPendingCallWatcher*))); +} + +void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const +{ + d->connectionInterface->call("DeactivateConnection", QVariant::fromValue(connectionPath)); +} + +bool QNetworkManagerInterface::wirelessEnabled() const +{ + return d->connectionInterface->property("WirelessEnabled").toBool(); +} + +bool QNetworkManagerInterface::wirelessHardwareEnabled() const +{ + return d->connectionInterface->property("WirelessHardwareEnabled").toBool(); +} + +QList QNetworkManagerInterface::activeConnections() const +{ + QVariant prop = d->connectionInterface->property("ActiveConnections"); + return prop.value >(); +} + +quint32 QNetworkManagerInterface::state() +{ + return d->connectionInterface->property("State").toUInt(); +} + +///////////// +class QNetworkManagerInterfaceAccessPointPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent) + : QObject(parent) +{ + d = new QNetworkManagerInterfaceAccessPointPrivate(); + d->path = dbusPathName; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACCESS_POINT, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find InterfaceAccessPoint"; + return; + } + d->valid = true; + +} + +QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceAccessPoint::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterfaceAccessPoint::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACCESS_POINT, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { + allOk = true; + + } + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const +{ + return d->connectionInterface; +} + +quint32 QNetworkManagerInterfaceAccessPoint::flags() const +{ + return d->connectionInterface->property("Flags").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::wpaFlags() const +{ + return d->connectionInterface->property("WpaFlags").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::rsnFlags() const +{ + return d->connectionInterface->property("RsnFlags").toUInt(); +} + +QString QNetworkManagerInterfaceAccessPoint::ssid() const +{ + return d->connectionInterface->property("Ssid").toString(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::frequency() const +{ + return d->connectionInterface->property("Frequency").toUInt(); +} + +QString QNetworkManagerInterfaceAccessPoint::hwAddress() const +{ + return d->connectionInterface->property("HwAddress").toString(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::mode() const +{ + return d->connectionInterface->property("Mode").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::maxBitrate() const +{ + return d->connectionInterface->property("MaxBitrate").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::strength() const +{ + return d->connectionInterface->property("Strength").toUInt(); +} + +///////////// +class QNetworkManagerInterfaceDevicePrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) + : QObject(parent) +{ + d = new QNetworkManagerInterfaceDevicePrivate(); + d->path = deviceObjectPath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManager"; + return; + } + d->valid = true; +} + +QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceDevice::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterfaceDevice::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), + this, SIGNAL(stateChanged(const QString&, quint32))); + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE, + "StateChanged", + nmDBusHelper,SLOT(deviceStateChanged(quint32)))) { + allOk = true; + } + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const +{ + return d->connectionInterface; +} + +QString QNetworkManagerInterfaceDevice::udi() const +{ + return d->connectionInterface->property("Udi").toString(); +} + +QNetworkInterface QNetworkManagerInterfaceDevice::interface() const +{ + return QNetworkInterface::interfaceFromName(d->connectionInterface->property("Interface").toString()); +} + +quint32 QNetworkManagerInterfaceDevice::ip4Address() const +{ + return d->connectionInterface->property("Ip4Address").toUInt(); +} + +quint32 QNetworkManagerInterfaceDevice::state() const +{ + return d->connectionInterface->property("State").toUInt(); +} + +quint32 QNetworkManagerInterfaceDevice::deviceType() const +{ + return d->connectionInterface->property("DeviceType").toUInt(); +} + +QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const +{ + QVariant prop = d->connectionInterface->property("Ip4Config"); + return prop.value(); +} + +///////////// +class QNetworkManagerInterfaceDeviceWiredPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent) +{ + d = new QNetworkManagerInterfaceDeviceWiredPrivate(); + d->path = ifaceDevicePath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRED, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find InterfaceDeviceWired"; + return; + } + d->valid = true; +} + +QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceDeviceWired::isValid() +{ + + return d->valid; +} + +bool QNetworkManagerInterfaceDeviceWired::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRED, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { + allOk = true; + } + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const +{ + return d->connectionInterface; +} + +QString QNetworkManagerInterfaceDeviceWired::hwAddress() const +{ + return d->connectionInterface->property("HwAddress").toString(); +} + +quint32 QNetworkManagerInterfaceDeviceWired::speed() const +{ + return d->connectionInterface->property("Speed").toUInt(); +} + +bool QNetworkManagerInterfaceDeviceWired::carrier() const +{ + return d->connectionInterface->property("Carrier").toBool(); +} + +///////////// +class QNetworkManagerInterfaceDeviceWirelessPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent) +{ + d = new QNetworkManagerInterfaceDeviceWirelessPrivate(); + d->path = ifaceDevicePath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find InterfaceDeviceWireless"; + return; + } + d->valid = true; +} + +QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceDeviceWireless::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterfaceDeviceWireless::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + + connect(nmDBusHelper, SIGNAL(pathForAccessPointAdded(const QString &,QDBusObjectPath)), + this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); + + connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(const QString &,QDBusObjectPath)), + this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); + + if(!dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + "AccessPointAdded", + nmDBusHelper, SLOT(slotAccessPointAdded( QDBusObjectPath )))) { + allOk = true; + } + + + if(!dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + "AccessPointRemoved", + nmDBusHelper, SLOT(slotAccessPointRemoved( QDBusObjectPath )))) { + allOk = true; + } + + + if(!dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap)))) { + allOk = true; + } + + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const +{ + return d->connectionInterface; +} + +QList QNetworkManagerInterfaceDeviceWireless::getAccessPoints() +{ + QDBusReply > reply = d->connectionInterface->call("GetAccessPoints"); + return reply.value(); +} + +QString QNetworkManagerInterfaceDeviceWireless::hwAddress() const +{ + return d->connectionInterface->property("HwAddress").toString(); +} + +quint32 QNetworkManagerInterfaceDeviceWireless::mode() const +{ + return d->connectionInterface->property("Mode").toUInt(); +} + +quint32 QNetworkManagerInterfaceDeviceWireless::bitrate() const +{ + return d->connectionInterface->property("Bitrate").toUInt(); +} + +QDBusObjectPath QNetworkManagerInterfaceDeviceWireless::activeAccessPoint() const +{ + return d->connectionInterface->property("ActiveAccessPoint").value(); +} + +quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const +{ + return d->connectionInterface->property("WirelelessCapabilities").toUInt(); +} + +///////////// +class QNetworkManagerSettingsPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent) + : QObject(parent) +{ +// qWarning() << __PRETTY_FUNCTION__; + d = new QNetworkManagerSettingsPrivate(); + d->path = settingsService; + d->connectionInterface = new QDBusInterface(settingsService, + NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManagerSettings"; + return; + } + d->valid = true; +} + +QNetworkManagerSettings::~QNetworkManagerSettings() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerSettings::isValid() +{ + return d->valid; +} + +bool QNetworkManagerSettings::setConnections() +{ + bool allOk = false; + + if (!dbusConnection.connect(d->path, NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, "NewConnection", + this, SIGNAL(newConnection(QDBusObjectPath)))) { + allOk = true; + } + + return allOk; +} + +QList QNetworkManagerSettings::listConnections() +{ + QDBusReply > reply = d->connectionInterface->call("ListConnections"); + return reply.value(); +} + +QDBusInterface *QNetworkManagerSettings::connectionInterface() const +{ + return d->connectionInterface; +} + + +///////////// +class QNetworkManagerSettingsConnectionPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + QString service; + QNmSettingsMap settingsMap; + bool valid; +}; + +QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent) +{ + qDBusRegisterMetaType(); + d = new QNetworkManagerSettingsConnectionPrivate(); + d->path = connectionObjectPath; + d->service = settingsService; + d->connectionInterface = new QDBusInterface(settingsService, + d->path, + NM_DBUS_IFACE_SETTINGS_CONNECTION, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + qWarning() << "Could not find NetworkManagerSettingsConnection"; + d->valid = false; + return; + } + d->valid = true; + QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings"); + d->settingsMap = rep.value(); +} + +QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerSettingsConnection::isValid() +{ + return d->valid; +} + +bool QNetworkManagerSettingsConnection::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + if(!dbusConnection.connect(d->service, d->path, + NM_DBUS_IFACE_SETTINGS_CONNECTION, "NewConnection", + this, SIGNAL(updated(QNmSettingsMap)))) { + allOk = true; + } + + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)), + this,SIGNAL(removed( const QString &))); + + if (!dbusConnection.connect(d->service, d->path, + NM_DBUS_IFACE_SETTINGS_CONNECTION, "Removed", + nmDBusHelper, SIGNAL(slotSettingsRemoved()))) { + allOk = true; + } + + return allOk; +} +//QNetworkManagerSettingsConnection::update(QNmSettingsMap map) +//{ +// d->connectionInterface->call("Update", QVariant::fromValue(map)); +//} + +QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const +{ + return d->connectionInterface; +} + +QNmSettingsMap QNetworkManagerSettingsConnection::getSettings() +{ + QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings"); + d->settingsMap = rep.value(); + return d->settingsMap; +} + +NMDeviceType QNetworkManagerSettingsConnection::getType() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("type"); + while (ii != innerMap.end() && ii.key() == "type") { + QString devType = ii.value().toString(); + if (devType == "802-3-ethernet") { + return DEVICE_TYPE_802_3_ETHERNET; + } + if (devType == "802-11-wireless") { + return DEVICE_TYPE_802_11_WIRELESS; + } + ii++; + } + i++; + } + return DEVICE_TYPE_UNKNOWN; +} + +bool QNetworkManagerSettingsConnection::isAutoConnect() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("autoconnect"); + while (ii != innerMap.end() && ii.key() == "autoconnect") { + return ii.value().toBool(); + ii++; + } + i++; + } + return true; //default networkmanager is autoconnect +} + +quint64 QNetworkManagerSettingsConnection::getTimestamp() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("timestamp"); + while (ii != innerMap.end() && ii.key() == "timestamp") { + return ii.value().toUInt(); + ii++; + } + i++; + } + return 0; +} + +QString QNetworkManagerSettingsConnection::getId() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("id"); + while (ii != innerMap.end() && ii.key() == "id") { + return ii.value().toString(); + ii++; + } + i++; + } + return QString(); +} + +QString QNetworkManagerSettingsConnection::getUuid() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("uuid"); + while (ii != innerMap.end() && ii.key() == "uuid") { + return ii.value().toString(); + ii++; + } + i++; + } + // is no uuid, return the connection path + return d->connectionInterface->path(); +} + +QString QNetworkManagerSettingsConnection::getSsid() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); + while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("ssid"); + while (ii != innerMap.end() && ii.key() == "ssid") { + return ii.value().toString(); + ii++; + } + i++; + } + return QString(); +} + +QString QNetworkManagerSettingsConnection::getMacAddress() +{ + if(getType() == DEVICE_TYPE_802_3_ETHERNET) { + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-3-ethernet"); + while (i != d->settingsMap.end() && i.key() == "802-3-ethernet") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("mac-address"); + while (ii != innerMap.end() && ii.key() == "mac-address") { + return ii.value().toString(); + ii++; + } + i++; + } + } + + else if(getType() == DEVICE_TYPE_802_11_WIRELESS) { + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); + while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("mac-address"); + while (ii != innerMap.end() && ii.key() == "mac-address") { + return ii.value().toString(); + ii++; + } + i++; + } + } + return QString(); +} + +QStringList QNetworkManagerSettingsConnection::getSeenBssids() +{ + if(getType() == DEVICE_TYPE_802_11_WIRELESS) { + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); + while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("seen-bssids"); + while (ii != innerMap.end() && ii.key() == "seen-bssids") { + return ii.value().toStringList(); + ii++; + } + i++; + } + } + return QStringList(); +} + +///////////// +class QNetworkManagerConnectionActivePrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent) +{ + d = new QNetworkManagerConnectionActivePrivate(); + d->path = activeConnectionObjectPath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManagerSettingsConnection"; + return; + } + d->valid = true; +} + +QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerConnectionActive::isValid() +{ + return d->valid; +} + +bool QNetworkManagerConnectionActive::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { + allOk = true; + } + + return allOk; +} + +QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const +{ + return d->connectionInterface; +} + +QString QNetworkManagerConnectionActive::serviceName() const +{ + return d->connectionInterface->property("ServiceName").toString(); +} + +QDBusObjectPath QNetworkManagerConnectionActive::connection() const +{ + QVariant prop = d->connectionInterface->property("Connection"); + return prop.value(); +} + +QDBusObjectPath QNetworkManagerConnectionActive::specificObject() const +{ + QVariant prop = d->connectionInterface->property("SpecificObject"); + return prop.value(); +} + +QList QNetworkManagerConnectionActive::devices() const +{ + QVariant prop = d->connectionInterface->property("Devices"); + return prop.value >(); +} + +quint32 QNetworkManagerConnectionActive::state() const +{ + return d->connectionInterface->property("State").toUInt(); +} + +bool QNetworkManagerConnectionActive::defaultRoute() const +{ + return d->connectionInterface->property("Default").toBool(); +} + + +//// +class QNetworkManagerIp4ConfigPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent) +{ + d = new QNetworkManagerIp4ConfigPrivate(); + d->path = deviceObjectPath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_IP4_CONFIG, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManagerIp4Config"; + return; + } + d->valid = true; +} + +QNetworkManagerIp4Config::~QNetworkManagerIp4Config() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerIp4Config::isValid() +{ + return d->valid; +} + +QStringList QNetworkManagerIp4Config::domains() const +{ + return d->connectionInterface->property("Domains").toStringList(); +} + +#include "moc_qnetworkmanagerservice_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkmanagerservice_p.h b/src/network/bearer/qnetworkmanagerservice_p.h new file mode 100644 index 0000000..8569e71 --- /dev/null +++ b/src/network/bearer/qnetworkmanagerservice_p.h @@ -0,0 +1,400 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKMANAGERSERVICE_H +#define QNETWORKMANAGERSERVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include + + +QTM_BEGIN_NAMESPACE +typedef QMap< QString, QMap > QNmSettingsMap; +typedef QList ServerThing; +QTM_END_NAMESPACE + +Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QNmSettingsMap)) +Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(ServerThing)) + + +QTM_BEGIN_NAMESPACE +class QNetworkManagerInterfacePrivate; +class QNetworkManagerInterface : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerInterface(QObject *parent = 0); + ~QNetworkManagerInterface(); + + QList getDevices() const; + void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject); + void deactivateConnection(QDBusObjectPath connectionPath) const; + + QDBusObjectPath path() const; + QDBusInterface *connectionInterface() const; + + bool wirelessEnabled() const; + bool wirelessHardwareEnabled() const; + QList activeConnections() const; + quint32 state(); + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void deviceAdded(QDBusObjectPath); + void deviceRemoved(QDBusObjectPath); + void propertiesChanged( const QString &, QMap); + void stateChanged(const QString&, quint32); + void activationFinished(QDBusPendingCallWatcher*); + +private Q_SLOTS: +private: +// Q_DISABLE_COPY(QNetworkManagerInterface); ?? + QNetworkManagerInterfacePrivate *d; + QNmDBusHelper *nmDBusHelper; +}; //end QNetworkManagerInterface + +//////// +class QNetworkManagerInterfaceAccessPointPrivate; +class QNetworkManagerInterfaceAccessPoint : public QObject +{ + Q_OBJECT + +public: + + // NM_DEVICE_STATE + enum DeviceState { + Unknown = 0, + Unmanaged, + Unavailable, + Disconnected, + Prepare, + Config, + NeedAuthentication, + IpConfig, + Activated, + Failed + }; + + enum ApFlag { + ApNone = 0x0, + Privacy = 0x1 + }; + + Q_DECLARE_FLAGS(ApFlags, ApFlag); + + enum ApSecurityFlag { + ApSecurityNone = 0x0, + PairWep40 = 0x1, + PairWep104 = 0x2, + PairTkip = 0x4, + PairCcmp = 0x8, + GroupWep40 = 0x10, + GroupWep104 = 0x20, + GroupTkip = 0x40, + GroupCcmp = 0x80, + KeyPsk = 0x100, + Key8021x = 0x200 + }; + + Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag); + + QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0); + ~QNetworkManagerInterfaceAccessPoint(); + + QDBusInterface *connectionInterface() const; + + quint32 flags() const; + quint32 wpaFlags() const; + quint32 rsnFlags() const; + QString ssid() const; + quint32 frequency() const; + QString hwAddress() const; + quint32 mode() const; + quint32 maxBitrate() const; + quint32 strength() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void propertiesChanged(QMap ); + void propertiesChanged( const QString &, QMap); +private: + QNetworkManagerInterfaceAccessPointPrivate *d; + QNmDBusHelper *nmDBusHelper; + +}; //end QNetworkManagerInterfaceAccessPoint + +//////// +class QNetworkManagerInterfaceDevicePrivate; +class QNetworkManagerInterfaceDevice : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0); + ~QNetworkManagerInterfaceDevice(); + + QString udi() const; + QNetworkInterface interface() const; + QDBusInterface *connectionInterface() const; + quint32 ip4Address() const; + quint32 state() const; + quint32 deviceType() const; + + QDBusObjectPath ip4config() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void stateChanged(const QString &, quint32); + +private: + QNetworkManagerInterfaceDevicePrivate *d; + QNmDBusHelper *nmDBusHelper; +}; //end QNetworkManagerInterfaceDevice + +//////// +class QNetworkManagerInterfaceDeviceWiredPrivate; +class QNetworkManagerInterfaceDeviceWired : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent = 0); + ~QNetworkManagerInterfaceDeviceWired(); + + QDBusInterface *connectionInterface() const; + QString hwAddress() const; + quint32 speed() const; + bool carrier() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void propertiesChanged( const QString &, QMap); +private: + QNetworkManagerInterfaceDeviceWiredPrivate *d; + QNmDBusHelper *nmDBusHelper; +}; // end QNetworkManagerInterfaceDeviceWired + +//// +class QNetworkManagerInterfaceDeviceWirelessPrivate; +class QNetworkManagerInterfaceDeviceWireless : public QObject +{ + Q_OBJECT + +public: + + enum DeviceCapability { + None = 0x0, + Wep40 = 0x1, + Wep104 = 0x2, + Tkip = 0x4, + Ccmp = 0x8, + Wpa = 0x10, + Rsn = 0x20 + }; + + QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent = 0); + ~QNetworkManagerInterfaceDeviceWireless(); + + QDBusObjectPath path() const; + QList getAccessPoints(); + QDBusInterface *connectionInterface() const; + + QString hwAddress() const; + quint32 mode() const; + quint32 bitrate() const; + QDBusObjectPath activeAccessPoint() const; + quint32 wirelessCapabilities() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void propertiesChanged( const QString &, QMap); + void accessPointAdded(const QString &,QDBusObjectPath); + void accessPointRemoved(const QString &,QDBusObjectPath); +private: + QNetworkManagerInterfaceDeviceWirelessPrivate *d; + QNmDBusHelper *nmDBusHelper; +}; // end QNetworkManagerInterfaceDeviceWireless + +//// +class QNetworkManagerSettingsPrivate; +class QNetworkManagerSettings : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0); + ~QNetworkManagerSettings(); + + QDBusInterface *connectionInterface() const; + QList listConnections(); + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void newConnection(QDBusObjectPath); +private: + QNetworkManagerSettingsPrivate *d; +}; //end QNetworkManagerSettings + +//// +class QNetworkManagerSettingsConnectionPrivate; +class QNetworkManagerSettingsConnection : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0); + ~QNetworkManagerSettingsConnection(); + + QDBusInterface *connectionInterface() const; + QNmSettingsMap getSettings(); + // void update(QNmSettingsMap map); + bool setConnections(); + NMDeviceType getType(); + bool isAutoConnect(); + quint64 getTimestamp(); + QString getId(); + QString getUuid(); + QString getSsid(); + QString getMacAddress(); + QStringList getSeenBssids(); + bool isValid(); + +Q_SIGNALS: + + void updated(QMap< QString, QMap > s); + void removed(const QString &); + +private: + QNmDBusHelper *nmDBusHelper; + QNetworkManagerSettingsConnectionPrivate *d; +}; //end QNetworkManagerSettingsConnection + +//// +class QNetworkManagerConnectionActivePrivate; +class QNetworkManagerConnectionActive : public QObject +{ + Q_OBJECT + +public: + + enum ActiveConnectionState { + Unknown = 0, + Activating = 1, + Activated = 2 + }; + + QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0); + ~ QNetworkManagerConnectionActive(); + + QDBusInterface *connectionInterface() const; + QString serviceName() const; + QDBusObjectPath connection() const; + QDBusObjectPath specificObject() const; + QList devices() const; + quint32 state() const; + bool defaultRoute() const; + bool setConnections(); + bool isValid(); + + +Q_SIGNALS: + void propertiesChanged(QList); + void propertiesChanged( const QString &, QMap); +private: + QNetworkManagerConnectionActivePrivate *d; + QNmDBusHelper *nmDBusHelper; +}; //QNetworkManagerConnectionActive + +//// +class QNetworkManagerIp4ConfigPrivate; +class QNetworkManagerIp4Config : public QObject +{ + Q_OBJECT + +public: + QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0); + ~QNetworkManagerIp4Config(); + + // QList nameservers(); + QStringList domains() const; + bool isValid(); + + private: + QNetworkManagerIp4ConfigPrivate *d; +}; +//// + +QTM_END_NAMESPACE + +#endif //QNETWORKMANAGERSERVICE_H diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp new file mode 100644 index 0000000..d3a323a --- /dev/null +++ b/src/network/bearer/qnetworksession.cpp @@ -0,0 +1,689 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "qnetworksession.h" + +#ifdef Q_OS_SYMBIAN +#include "qnetworksession_s60_p.h" +#elif MAEMO +#include "qnetworksession_maemo_p.h" +#else +#include "qnetworksession_p.h" +#endif + +QTM_BEGIN_NAMESPACE + +/*! + \class QNetworkSession + + \brief The QNetworkSession class provides control over the system's access points + and enables session management for cases when multiple clients access the same access point. + + \inmodule QtNetwork + \ingroup bearer + + A QNetworkSession enables control over the system's network interfaces. The session's configuration + parameter are determined via the QNetworkConfiguration object to which it is bound. Depending on the + type of the session (single access point or service network) a session may be linked to one or more + network interfaces. By means of \l{open()}{opening} and \l{close()}{closing} of network sessions + a developer can start and stop the systems network interfaces. If the configuration represents + multiple access points (see \l QNetworkConfiguration::ServiceNetwork) more advanced features such as roaming may be supported. + + QNetworkSession supports session management within the same process and depending on the platform's + capabilities may support out-of-process sessions. If the same + network configuration is used by multiple active sessions the underlying network interface is only terminated once + the last session has been closed. + + \section1 Roaming + + Applications may connect to the preferredConfigurationChanged() signal in order to + receive notifications when a more suitable access point becomes available. + In response to this signal the application may initiate the roaming via migrate() + or may ignore() the new access point. Once the session has roamed the + newConfigurationActivated() signal is emitted. The application may now test the + carrier and can accept() or reject() it. The session will return to the previous + access point if the roaming was rejected. + + Some platforms may support the notion of forced roaming and application level roaming (ALR). + ALR implies that the application controls (via migrate(), ignore(), accept() and reject()) + whether a network session can roam from one network configuration to the next. Such control is useful + if the application maintains stateful socket connections and wants to control the transition from + one interface to the next. + + Forced roaming implies that the system automatically roams to the next network without + consulting the application. This has the advantage that the application can make use of roaming features + without actually being aware of it. It is expected that the application detects that the underlying + socket is broken and automatically reconnects via the new network link. + + If the platform supports both modes of roaming an application indicates its preference + by connecting to the preferredConfigurationChanged() signal. Connecting to this signal means that + the application wants to take control over the roaming behavior and therefore implies application + level roaming. + + \sa QNetworkConfiguration, QNetworkConfigurationManager +*/ + +/*! + \enum QNetworkSession::State + + This enum describes the connectivity state of the session. If the session is based on a + single access point configuration the state of the session is the same as the state of the + associated network interface. + + \value Invalid The session is invalid due to an invalid configuration. This may + happen due to a removed access point or a configuration that was + invalid to begin with. + \value NotAvailable The session is based on a defined but not yet discovered QNetworkConfiguration + (see \l QNetworkConfiguration::StateFlag). + \value Connecting The network session is being established. + \value Connected The network session is connected. If the current process wishes to use this session + it has to register its interest by calling open(). A network session + is considered to be ready for socket operations if it isActive() and connected. + \value Closing The network session is in the process of being shut down. + \value Disconnected The network session is not connected. The associated QNetworkConfiguration + has the state QNetworkConfiguration::Discovered. + \value Roaming The network session is roaming from one access point to another + access point. +*/ + +/*! + \enum QNetworkSession::SessionError + + This enum describes the session errors that can occur. + + \value UnknownSessionError An unidentified error occurred. + \value SessionAbortedError The session was aborted by the user or system. + \value RoamingError The session cannot roam to the new configuration. + \value OperationNotSupportedError The operation is not supported for current configuration. + \value InvalidConfigurationError The operation cannot currently be performed for the + current configuration. +*/ + +/*! + \fn void QNetworkSession::stateChanged(QNetworkSession::State state) + + This signal is emitted whenever the state of the network session changes. + The \a state parameter is the new state. + + \sa state() +*/ + +/*! + \fn void QNetworkSession::error(QNetworkSession::SessionError error) + + This signal is emitted after an error occurred. The \a error parameter + describes the error that occurred. + + \sa error(), errorString() +*/ + +/*! + \fn void QNetworkSession::preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless) + + This signal is emitted when the preferred configuration/access point for the + session changes. Only sessions which are based on service network configurations + may emit this signal. \a config can be used to determine access point specific + details such as proxy settings and \a isSeamless indicates whether roaming will + break the sessions IP address. + + As a consequence to this signal the application may start the roaming process + by calling migrate() or may chose to ignore() the new access point. If the application + doesn't call either of the two functions the session ignores the migration opportunity. + + If the roaming process is non-seamless the IP address will change which means that + a socket becomes invalid. However seamless mobility can ensure that the local IP address + does not change. This is achieved by using a virtual IP address which is bound to the actual + link address. During the roaming process the virtual address is attached to the new link + address. + + Some platforms may support the concept of Forced Roaming and Application Level Roaming (ALR). + Forced roaming implies that the platform may simply roam to a new configuration without + consulting applications. It is up to the application to detect the link layer loss and reestablish + its sockets. In contrast ALR provides the opportunity to prevent the system from roaming. + If this session is based on a configuration that supports roaming the application can choose + whether it wants to be consulted (ALR use case) by connecting to this signal. For as long as this signal + connection remains the session remains registered as a roaming stakeholder; otherwise roaming will + be enforced by the platform. + + \sa migrate(), ignore(), QNetworkConfiguration::isRoamingAvailable() +*/ + +/*! + \fn void QNetworkSession::newConfigurationActivated() + + This signal is emitted once the session has roamed to the new access point. + The application may reopen its socket and test the suitability of the new network link. + Subsequently it may accept() or reject() the new access point. + + \sa accept(), reject() +*/ + +/*! + \fn void QNetworkSession::opened() + + This signal is emitted when the network session has been opened. + + The underlying network interface will not be shut down as long as the session remains open. + Note that this feature is dependent on \l{QNetworkConfigurationManager::SystemSessionSupport}{system wide session support}. +*/ + +/*! + \fn void QNetworkSession::closed() + + This signal is emitted when the network session has been closed. +*/ + +/*! + Constructs a session based on \a connectionConfig with the given \a parent. + + \sa QNetworkConfiguration +*/ +QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) + : QObject(parent) +{ + d = new QNetworkSessionPrivate; + d->q = this; + d->publicConfig = connectionConfig; + d->syncStateWithInterface(); + QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), + this, SIGNAL(opened())); +} + +/*! + Frees the resources associated with the QNetworkSession object. +*/ +QNetworkSession::~QNetworkSession() +{ + delete d; +} + +/*! + Creates an active/open session which increases the session counter on the underlying network interface. + The system will not terminate a network interface until the session reference counter reaches zero. + Therefore an active session allows an application to register its use of the interface. + + The interface is started if it is not active yet. Some platforms may not provide support + for out-of-process sessions. On such platforms the session counter ignores any sessions + held by another process. The platform capabilities can be + detected via QNetworkConfigurationManager::capabilities(). + + Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired + by connecting to the stateChanged(), opened() or error() signals. + + It is not a requirement to open a session in order to monitor the underlying network interface. + + \sa close(), stop(), isActive() +*/ +void QNetworkSession::open() +{ + d->open(); +} + +/*! + Waits until the session has been opened, up to \a msecs milliseconds. If the session has been opened, this + function returns true; otherwise it returns false. In the case where it returns false, you can call error() + to determine the cause of the error. + + The following example waits up to one second for the session to be opened: + + \code + session->open(); + if (session->waitForOpened(1000)) + qDebug("Open!"); + \endcode + + If \a msecs is -1, this function will not time out. + + \sa open(), error() +*/ +bool QNetworkSession::waitForOpened(int msecs) +{ + if (d->isActive) + return true; + + if (d->state != Connecting) + return false; + + QEventLoop* loop = new QEventLoop(this); + QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), + loop, SLOT(quit())); + + //final call + if (msecs>=0) + QTimer::singleShot(msecs, loop, SLOT(quit())); + + loop->exec(); + loop->disconnect(); + loop->deleteLater(); + + return d->isActive; +} + +/*! + Decreases the session counter on the associated network configuration. If the session counter reaches zero + the active network interface is shut down. This also means that state() will only change from \l Connected to + \l Disconnected if this was the last active session. + + If the platform does not support out-of-process sessions calling this function does not stop the + interface. In this case \l{stop()} has to be used to force a shut down. + The platform capabilities can be detected via QNetworkConfigurationManager::capabilities(). + + Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired + by connecting to the stateChanged(), opened() or error() signals. + + \sa open(), stop(), isActive() +*/ +void QNetworkSession::close() +{ + d->close(); +} + +/*! + Invalidates all active sessions against the network interface and therefore stops the + underlying network interface. This function always changes the session's state() flag to + \l Disconnected. + + \sa open(), close() +*/ +void QNetworkSession::stop() +{ + d->stop(); +} + +/*! + Returns the QNetworkConfiguration that this network session object is based on. + + \sa QNetworkConfiguration +*/ +QNetworkConfiguration QNetworkSession::configuration() const +{ + return d->publicConfig; +} + +/*! + Returns the type of bearer currently used by this session. The string is not translated and therefore can + not be shown to the user. The subsequent table presents the currently known bearer types: + + \table + \header + \o Value + \o Description + \row + \o Ethernet + \o The session is based on Ethernet. + \row + \o WLAN + \o The session is based on Wireless LAN. + \row + \o 2G + \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. + \row + \o CDMA2000 + \o The session uses CDMA. + \row + \o WCDMA + \o The session uses W-CDMA/UMTS. + \row + \o HSPA + \o The session uses High Speed Packet Access. + \row + \o Bluetooth + \o The session uses Bluetooth. + \row + \o WiMAX + \o The session uses WiMAX. + \endtable + + If the session is based on a network configuration of type + \l QNetworkConfiguration::ServiceNetwork the type of the preferred or currently + active configuration is returned. Therefore the bearer type may change + over time. + + This function returns an empty string if this session is based on an invalid configuration. +*/ +QString QNetworkSession::bearerName() const +{ + return d->bearerName(); +} + +/*! + Returns the network interface that is used by this session. + + This function only returns a valid QNetworkInterface when this session is \l Connected. + + The returned interface may change as a result of a roaming process. + + \sa state() +*/ +QNetworkInterface QNetworkSession::interface() const +{ + return d->currentInterface(); +} + +/*! + Returns true if this object holds an active session on the underlying network interface. + The session can be controlled via open() and close(). +*/ +bool QNetworkSession::isActive() const +{ + return d->isActive; +} + +/*! + Returns the state of the session. If the session is based on a + single access point configuration the state of the session is the same as the state of the + associated network interface. Therefore a network session object can be used to monitor + network interfaces. + + A \l QNetworkConfiguration::ServiceNetwork based session summarizes the state of all its children + and therefore returns the \l Connected state if at least one of its sub configurations is connected. + + Note that it is not required to hold an active session in order to obtain the network interface state. + A connected but inactive session may be used to monitor network interfaces whereas an active and connected + session object may prevent the network interface from being shut down. + + \sa error(), stateChanged() +*/ +QNetworkSession::State QNetworkSession::state() const +{ + return d->state; +} + +/*! + Returns the type of error that last occurred. + + \sa state(), errorString() +*/ +QNetworkSession::SessionError QNetworkSession::error() const +{ + return d->error(); +} + +/*! + Returns a human-readable description of the last device error that + occurred. + + \sa error() +*/ +QString QNetworkSession::errorString() const +{ + return d->errorString(); +} + +/*! + Returns the value for property \a key. + + A network session can have properties attached which may describe the session in more details. + This function can be used to gain access to those properties. + + The following property keys are guaranteed to be specified on all platforms: + + \table + \header + \o Key \o Description + \row + \o ActiveConfigurationIdentifier + \o If the session \l isActive() this property returns the identifier of the + QNetworkConfiguration that is used by this session; otherwise an empty string. + + The main purpose of this key is to determine which Internet access point is used + if the session is based on a \l{QNetworkConfiguration::ServiceNetwork}{ServiceNetwork}. + The following code snippet highlights the difference: + \code + QNetworkConfigurationManager mgr; + QNetworkConfiguration ap = mgr.defaultConfiguration(); + QNetworkSession* session = new QNetworkSession(ap); + ... //code activates session + + QString ident = session->sessionProperty("ActiveConfigurationIdentifier").toString(); + if ( ap.type() == QNetworkConfiguration::ServiceNetwork ) { + Q_ASSERT( ap.identifier() != ident ); + Q_ASSERT( ap.children().contains( mgr.configurationFromIdentifier(ident) ) ); + } else if ( ap.type() == QNetworkConfiguration::InternetAccessPoint ) { + Q_ASSERT( ap.identifier() == ident ); + } + \endcode + \row + \o UserChoiceConfigurationIdentifier + \o If the session \l isActive() and is bound to a QNetworkConfiguration of type + UserChoice, this property returns the identifier of the QNetworkConfiguration that the + configuration resolved to when \l open() was called; otherwise an empty string. + + The purpose of this key is to determine the real QNetworkConfiguration that the + session is using. This key is different to \i ActiveConfigurationIdentifier in that + this key may return an identifier for either a + \l {QNetworkConfiguration::ServiceNetwork}{service network} or a + \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations + whereas \i ActiveConfigurationIdentifier always returns identifiers for + \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations. + \row + \o ConnectInBackground + \o Setting this property to \i true before calling \l open() implies that the connection attempt + is made but if no connection can be established, the user is not connsulted and asked to select + a suitable connection. This property is not set by default and support for it depends on the platform. + \endtable +*/ +QVariant QNetworkSession::sessionProperty(const QString& key) const +{ + if (!d->publicConfig.isValid()) + return QVariant(); + + if (key == "ActiveConfigurationIdentifier") { + if (!d->isActive) + return QString(); + else + return d->activeConfig.identifier(); + } + + if (key == "UserChoiceConfigurationIdentifier") { + if (!d->isActive || d->publicConfig.type() != QNetworkConfiguration::UserChoice) + return QString(); + + if (d->serviceConfig.isValid()) + return d->serviceConfig.identifier(); + else + return d->activeConfig.identifier(); + } + + return d->sessionProperty(key); +} + +/*! + Sets the property \a value on the session. The property is identified using + \a key. Removing an already set property can be achieved by passing an + invalid QVariant. + + Note that the \i UserChoiceConfigurationIdentifier and \i ActiveConfigurationIdentifier + properties are read only and cannot be changed using this method. +*/ +void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) +{ + if (key == "ActiveConfigurationIdentifier" + || key == "UserChoiceConfigurationIdentifier") + return; + + d->setSessionProperty(key, value); +} + +/*! + Instructs the session to roam to the new access point. The old access point remains active + until the application calls accept(). + + The newConfigurationActivated() signal is emitted once roaming has been completed. + + \sa accept() +*/ +void QNetworkSession::migrate() +{ + d->migrate(); +} + +/*! + This function indicates that the application does not wish to roam the session. This + is the default behavior if an application doesn't call migrate() in response to a + preferredConfigurationChanged() signal. + + \sa migrate() +*/ +void QNetworkSession::ignore() +{ + //TODO Do we really need this function if we consider that this is + // the default behavior if nobody calls migrate()? + d->ignore(); +} + +/*! + Instructs the session to permanently accept the new access point. Once this function + has been called the session may not return to the old access point. + + The old access point may be closed in the process if there are no other network sessions for it. + Therefore any open socket that still uses the old access point + may become unusable and should be closed before completing the migration. +*/ +void QNetworkSession::accept() +{ + d->accept(); +} + +/*! + The new access point is not suitable for the application. By calling this function the + session returns to the previous access point/configuration. This action may invalidate + any socket that has been created via the not desired access point. + + \sa accept() +*/ +void QNetworkSession::reject() +{ + d->reject(); +} + + +/*! + Returns the amount of data sent in bytes; otherwise 0. + + This field value includes the usage across all active network + sessions which use the same network interface. + + If the session is based on a service network configuration the number of + sent bytes across all active member configurations are returned. + + This function may not always be supported on all platforms and returns + 0. The platform capability can be detected via QNetworkConfigurationManager::DataStatistics. +*/ +quint64 QNetworkSession::bytesWritten() const +{ + return d->bytesWritten(); +} + +/*! + Returns the amount of data received in bytes; otherwise 0. + + This field value includes the usage across all active network + sessions which use the same network interface. + + If the session is based on a service network configuration the number of + sent bytes across all active member configurations are returned. + + This function may not always be supported on all platforms and returns + 0. The platform capability can be detected via QNetworkConfigurationManager::DataStatistics. +*/ +quint64 QNetworkSession::bytesReceived() const +{ + return d->bytesReceived(); +} + +/*! + Returns the number of seconds that the session has been active. +*/ +quint64 QNetworkSession::activeTime() const +{ + return d->activeTime(); +} + +/*! + \internal + + This function is required to detect whether the client wants to control + the roaming process. If he connects to preferredConfigurationChanged() signal + he intends to influence it. Otherwise QNetworkSession always roams + without registering this session as a stakeholder in the roaming process. + + For more details check the Forced vs ALR roaming section in the QNetworkSession + class description. +*/ +void QNetworkSession::connectNotify(const char *signal) +{ + QObject::connectNotify(signal); + //check for preferredConfigurationChanged() signal connect notification + //This is not required on all platforms +#ifdef Q_OS_SYMBIAN + if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { + d->setALREnabled(true); + } +#endif +} + +/*! + \internal + + This function is called when the client disconnects from the preferredConfigurationChanged() + signal. + + \sa connectNotify() +*/ +void QNetworkSession::disconnectNotify(const char *signal) +{ + QObject::disconnectNotify(signal); + //check for preferredConfigurationChanged() signal disconnect notification + //This is not required on all platforms +#ifdef Q_OS_SYMBIAN + if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { + d->setALREnabled(false); + } +#endif +} + +#include "moc_qnetworksession.cpp" + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h new file mode 100644 index 0000000..47377c4 --- /dev/null +++ b/src/network/bearer/qnetworksession.h @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKSESSION_H +#define QNETWORKSESSION_H + +#include "qmobilityglobal.h" + +#include +#include +#include +#include +#include +#include "qnetworkconfiguration.h" + + +QT_BEGIN_HEADER + +QTM_BEGIN_NAMESPACE + +class QNetworkSessionPrivate; +class Q_BEARER_EXPORT QNetworkSession : public QObject +{ + Q_OBJECT +public: + enum State { + Invalid = 0, + NotAvailable, + Connecting, + Connected, + Closing, + Disconnected, + Roaming + }; + + enum SessionError { + UnknownSessionError = 0, + SessionAbortedError, + RoamingError, + OperationNotSupportedError, + InvalidConfigurationError + }; + + QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); + virtual ~QNetworkSession(); + + bool isActive() const; + QNetworkConfiguration configuration() const; + QString bearerName() const; + QNetworkInterface interface() const; + + State state() const; + SessionError error() const; + QString errorString() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + + bool waitForOpened(int msecs = 30000); + +public Q_SLOTS: + void open(); + void close(); + void stop(); + + //roaming related slots + void migrate(); + void ignore(); + void accept(); + void reject(); + + +Q_SIGNALS: + void stateChanged(QNetworkSession::State); + void opened(); + void closed(); + void error(QNetworkSession::SessionError); + void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless); + void newConfigurationActivated(); + +protected: + virtual void connectNotify(const char *signal); + virtual void disconnectNotify(const char *signal); + +private: + QNetworkSessionPrivate* d; + friend class QNetworkSessionPrivate; + }; + +QTM_END_NAMESPACE + +QT_END_HEADER + +#endif //QNETWORKSESSION_H diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp new file mode 100644 index 0000000..c7c7a31 --- /dev/null +++ b/src/network/bearer/qnetworksession_maemo.cpp @@ -0,0 +1,1181 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "qnetworksession_maemo_p.h" +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +QTM_BEGIN_NAMESPACE + +static QHash properties; + +static QString get_network_interface(); +static DBusConnection *dbus_connection; +static DBusHandlerResult signal_handler(DBusConnection *connection, + DBusMessage *message, + void *user_data); + +#define ICD_DBUS_MATCH "type='signal'," \ + "interface='" ICD_DBUS_INTERFACE "'," \ + "path='" ICD_DBUS_PATH "'" + + +static inline DBusConnection *get_dbus_conn(DBusError *error) +{ + DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, error); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Listening to bus" << dbus_bus_get_unique_name(conn); +#endif + + return conn; +} + + +/* Helper class that monitors the Icd status messages and + * can change the IAP status accordingly. This is a singleton. + */ +class IcdListener : public QObject +{ + Q_OBJECT + +public: + IcdListener() : first_call(true) { } + friend DBusHandlerResult signal_handler(DBusConnection *connection, + DBusMessage *message, + void *user_data); + void setup(QNetworkSessionPrivate *d); + void cleanup(); + void cleanupSession(QNetworkSessionPrivate *ptr); + + enum IapConnectionStatus { + /* The IAP was connected */ + CONNECTED = 0, + /* The IAP was disconnected */ + DISCONNECTED, + /* The IAP is disconnecting */ + DISCONNECTING, + /* The IAP has a network address, but is not yet fully connected */ + NETWORK_UP + }; + +private: + void icdSignalReceived(QString&, QString&, QString&); + bool first_call; + QHash sessions; +}; + +Q_GLOBAL_STATIC(IcdListener, icdListener); + + +static DBusHandlerResult signal_handler(DBusConnection *, + DBusMessage *message, + void *user_data) +{ + if (dbus_message_is_signal(message, + ICD_DBUS_INTERFACE, + ICD_STATUS_CHANGED_SIG)) { + + IcdListener *icd = (IcdListener *)user_data; + DBusError error; + dbus_error_init(&error); + + char *iap_id = 0; + char *network_type = 0; + char *state = 0; + + if (dbus_message_get_args(message, &error, + DBUS_TYPE_STRING, &iap_id, + DBUS_TYPE_STRING, &network_type, + DBUS_TYPE_STRING, &state, + DBUS_TYPE_INVALID) == FALSE) { + qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message); + } else { + QString _iap_id(iap_id); + QString _network_type(network_type); + QString _state(state); + + icd->icdSignalReceived(_iap_id, _network_type, _state); + } + + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + + +void IcdListener::setup(QNetworkSessionPrivate *d) +{ + if (first_call) { + // We use the old Icd dbus interface like in ConIC + DBusError error; + dbus_error_init(&error); + + dbus_connection = get_dbus_conn(&error); + if (dbus_error_is_set(&error)) { + qWarning() << "Cannot get dbus connection."; + dbus_error_free(&error); + return; + } + + static struct DBusObjectPathVTable icd_vtable; + icd_vtable.message_function = signal_handler; + + dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error); + if (dbus_error_is_set(&error)) { + qWarning() << "Cannot add match" << ICD_DBUS_MATCH; + dbus_error_free(&error); + return; + } + + if (dbus_connection_register_object_path(dbus_connection, + ICD_DBUS_PATH, + &icd_vtable, + (void*)this) == FALSE) { + qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH; + dbus_error_free(&error); + return; + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Listening" << ICD_STATUS_CHANGED_SIG << "signal from" << ICD_DBUS_SERVICE; +#endif + first_call = false; + dbus_error_free(&error); + } + + QString id = d->activeConfig.identifier(); + if (!sessions.contains(id)) { + QNetworkSessionPrivate *ptr = d; + sessions.insert(id, ptr); + } +} + + +void IcdListener::icdSignalReceived(QString& iap_id, +#ifdef BEARER_MANAGEMENT_DEBUG + QString& network_type, +#else + QString&, +#endif + QString& state) +{ + if (iap_id == OSSO_IAP_SCAN) // icd sends scan status signals which we will ignore + return; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Status received:" << iap_id << "type" << network_type << "state" << state; +#endif + + if (!sessions.contains(iap_id)) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "No session for IAP" << iap_id; +#endif + return; + } + + QNetworkSessionPrivate *session = sessions.value(iap_id); + QNetworkConfiguration ap_conf = session->manager.configurationFromIdentifier(iap_id); + if (!ap_conf.isValid()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Unknown IAP" << iap_id; +#endif + return; + } + + IapConnectionStatus status; + + if (state == "IDLE") { + status = DISCONNECTED; + } else if (state == "CONNECTED") { + status = CONNECTED; + } else if (state == "NETWORKUP") { + status = NETWORK_UP; + } else { + //qDebug() << "Unknown state" << state; + return; + } + + if (status == DISCONNECTED) { + if (ap_conf.state() == QNetworkConfiguration::Active) { + /* The IAP was just disconnected by Icd */ + session->updateState(QNetworkSession::Disconnected); + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Got a network disconnect when in state" << ap_conf.state(); +#endif + } + } else if (status == CONNECTED) { + /* The IAP was just connected by Icd */ + session->updateState(QNetworkSession::Connected); + session->updateIdentifier(iap_id); + + if (session->publicConfig.identifier() == OSSO_IAP_ANY) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "connected when connecting to" << OSSO_IAP_ANY; +#endif + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "connected"; +#endif + } + } + + return; +} + + +void IcdListener::cleanup() +{ + if (!first_call) { + dbus_bus_remove_match(dbus_connection, ICD_DBUS_MATCH, NULL); + dbus_connection_unref(dbus_connection); + } +} + + +void IcdListener::cleanupSession(QNetworkSessionPrivate *ptr) +{ + if (ptr->publicConfig.type() == QNetworkConfiguration::UserChoice) + (void)sessions.take(ptr->activeConfig.identifier()); + else + (void)sessions.take(ptr->publicConfig.identifier()); +} + + +void QNetworkSessionPrivate::cleanupSession(void) +{ + icdListener()->cleanupSession(this); +} + + +void QNetworkSessionPrivate::updateState(QNetworkSession::State newState) +{ + if( newState != state) { + state = newState; + + if (state == QNetworkSession::Disconnected) { + isActive = false; + currentNetworkInterface.clear(); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + activeConfig.d->state = QNetworkConfiguration::Defined; + publicConfig.d->state = QNetworkConfiguration::Defined; + + } else if (state == QNetworkSession::Connected) { + isActive = true; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + activeConfig.d->state = QNetworkConfiguration::Active; + activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; + } + publicConfig.d->state = QNetworkConfiguration::Active; + } + + emit q->stateChanged(newState); + } +} + + +void QNetworkSessionPrivate::updateIdentifier(QString &newId) +{ + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + activeConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME; + activeConfig.d->id = newId; + } else { + publicConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME; + if (publicConfig.d->id != newId) { + qWarning() << "Your config id changed from" << publicConfig.d->id << "to" << newId; + publicConfig.d->id = newId; + } + } +} + + +quint64 QNetworkSessionPrivate::getStatistics(bool sent) const +{ + /* This could be also implemented by using the Maemo::Icd::statistics() + * that gets the statistics data for a specific IAP. Change if + * necessary. + */ + Maemo::Icd icd; + QList stats_results; + quint64 counter_rx = 0, counter_tx = 0; + + if (!icd.statistics(stats_results)) { + return 0; + } + + foreach (Maemo::IcdStatisticsResult res, stats_results) { + if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) { + /* network_id is the IAP UUID */ + if (QString(res.params.network_id.data()) == activeConfig.identifier()) { + counter_tx = res.bytes_sent; + counter_rx = res.bytes_received; + } + } else { + /* We probably will never get to this branch */ + QNetworkConfigurationPrivate *d = activeConfig.d.data(); + if (res.params.network_id == d->network_id) { + counter_tx = res.bytes_sent; + counter_rx = res.bytes_received; + } + } + } + + if (sent) + return counter_tx; + else + return counter_rx; +} + + +quint64 QNetworkSessionPrivate::bytesWritten() const +{ + return getStatistics(true); +} + +quint64 QNetworkSessionPrivate::bytesReceived() const +{ + return getStatistics(false); +} + +quint64 QNetworkSessionPrivate::activeTime() const +{ + if (startTime.isNull()) { + return 0; + } + return startTime.secsTo(QDateTime::currentDateTime()); +} + + +QNetworkConfiguration& QNetworkSessionPrivate::copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy) +{ + if (deepCopy) { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QExplicitlySharedDataPointer ptr(cpPriv); + toConfig.d = ptr; + } + + toConfig.d->name = fromConfig.d->name; + toConfig.d->isValid = fromConfig.d->isValid; + // Note that we do not copy id field here as the publicConfig does + // not contain a valid IAP id. + toConfig.d->state = fromConfig.d->state; + toConfig.d->type = fromConfig.d->type; + toConfig.d->roamingSupported = fromConfig.d->roamingSupported; + toConfig.d->purpose = fromConfig.d->purpose; + toConfig.d->network_id = fromConfig.d->network_id; + toConfig.d->iap_type = fromConfig.d->iap_type; + toConfig.d->network_attrs = fromConfig.d->network_attrs; + toConfig.d->service_type = fromConfig.d->service_type; + toConfig.d->service_id = fromConfig.d->service_id; + toConfig.d->service_attrs = fromConfig.d->service_attrs; + toConfig.d->manager = fromConfig.d->manager; + + return toConfig; +} + + +/* This is called by QNetworkSession constructor and it updates the current + * state of the configuration. + */ +void QNetworkSessionPrivate::syncStateWithInterface() +{ + /* Start to listen Icd status messages. */ + icdListener()->setup(this); + + /* Initially we are not active although the configuration might be in + * connected state. + */ + isActive = false; + opened = false; + + QObject::connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); + + if (publicConfig.d.data()) { + QNetworkConfigurationManagerPrivate* mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager; + if (mgr) { + QObject::connect(mgr, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + } else { + qWarning()<<"Manager object not set when trying to connect configurationChanged signal. Your configuration object is not correctly setup, did you remember to call manager.updateConfigurations() before creating session object?"; + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + return; + } + } + + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + + switch (publicConfig.type()) { + case QNetworkConfiguration::InternetAccessPoint: + activeConfig = publicConfig; + break; + case QNetworkConfiguration::ServiceNetwork: + serviceConfig = publicConfig; + break; + case QNetworkConfiguration::UserChoice: + // active config will contain correct data after open() has succeeded + copyConfig(publicConfig, activeConfig); + + /* We create new configuration that holds the actual configuration + * returned by icd. This way publicConfig still contains the + * original user specified configuration. + * + * Note that the new activeConfig configuration is not inserted + * to configurationManager as manager class will get the newly + * connected configuration from gconf when the IAP is saved. + * This configuration manager update is done by IapMonitor class. + * If the ANY connection fails in open(), then the configuration + * data is not saved to gconf and will not be added to + * configuration manager IAP list. + */ +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug()<<"New configuration created for" << publicConfig.identifier(); +#endif + break; + default: + /* Invalid configuration, no point continuing */ + return; + } + + if (!activeConfig.isValid()) + return; + + /* Get the initial state from icd */ + Maemo::Icd icd; + QList state_results; + + /* Update the active config from first connection, this is ok as icd + * supports only one connection anyway. + */ + if (icd.state(state_results) && !state_results.isEmpty()) { + + /* If we did not get full state back, then we are not + * connected and can skip the next part. + */ + if (!(state_results.first().params.network_attrs == 0 && + state_results.first().params.network_id.isEmpty())) { + + /* If we try to connect to specific IAP and we get results back + * that tell the icd is actually connected to another IAP, + * then do not update current state etc. + */ + if (publicConfig.type() == QNetworkConfiguration::UserChoice || + publicConfig.d->id == state_results.first().params.network_id) { + + switch (state_results.first().state) { + case ICD_STATE_DISCONNECTED: + state = QNetworkSession::Disconnected; + if (activeConfig.d.data()) + activeConfig.d->isValid = true; + break; + case ICD_STATE_CONNECTING: + state = QNetworkSession::Connecting; + if (activeConfig.d.data()) + activeConfig.d->isValid = true; + break; + case ICD_STATE_CONNECTED: + { + if (!state_results.first().error.isEmpty()) + break; + + const QString id = state_results.first().params.network_id; + + QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; + if (mgr->accessPointConfigurations.contains(id)) { + //we don't want the copied data if the config is already known by the manager + //just reuse it so that existing references to the old data get the same update + QExplicitlySharedDataPointer priv = mgr->accessPointConfigurations.value(activeConfig.d->id); + activeConfig.d = priv; + } + + + state = QNetworkSession::Connected; + activeConfig.d->network_id = state_results.first().params.network_id; + activeConfig.d->id = activeConfig.d->network_id; + activeConfig.d->network_attrs = state_results.first().params.network_attrs; + activeConfig.d->iap_type = state_results.first().params.network_type; + activeConfig.d->service_type = state_results.first().params.service_type; + activeConfig.d->service_id = state_results.first().params.service_id; + activeConfig.d->service_attrs = state_results.first().params.service_attrs; + activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; + activeConfig.d->state = QNetworkConfiguration::Active; + activeConfig.d->isValid = true; + currentNetworkInterface = get_network_interface(); + + Maemo::IAPConf iap_name(activeConfig.d->id); + QString name_value = iap_name.value("name").toString(); + if (!name_value.isEmpty()) + activeConfig.d->name = name_value; + else + activeConfig.d->name = activeConfig.d->id; + + + // Add the new active configuration to manager or update the old config + mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; + if (!(mgr->accessPointConfigurations.contains(activeConfig.d->id))) { + QExplicitlySharedDataPointer ptr = activeConfig.d; + mgr->accessPointConfigurations.insert(activeConfig.d->id, ptr); + + QNetworkConfiguration item; + item.d = ptr; + emit mgr->configurationAdded(item); + +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"New configuration"<id<<"added to manager in sync"; +#endif + + } else { + mgr->configurationChanged((QNetworkConfigurationPrivate*)(activeConfig.d.data())); +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"Existing configuration"<id<<"updated in manager in sync"; +#endif + } + + } + break; + + case ICD_STATE_DISCONNECTING: + state = QNetworkSession::Closing; + if (activeConfig.d.data()) + activeConfig.d->isValid = true; + break; + default: + break; + } + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "status_req tells icd is not connected"; +#endif + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "status_req did not return any results from icd"; +#endif + } + + networkConfigurationsChanged(); +} + + +void QNetworkSessionPrivate::networkConfigurationsChanged() +{ + if (serviceConfig.isValid()) + updateStateFromServiceNetwork(); + else + updateStateFromActiveConfig(); +} + + +void QNetworkSessionPrivate::updateStateFromServiceNetwork() +{ + QNetworkSession::State oldState = state; + + foreach (const QNetworkConfiguration &config, serviceConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) + continue; + + if (activeConfig != config) { + activeConfig = config; + emit q->newConfigurationActivated(); + } + + state = QNetworkSession::Connected; + if (state != oldState) + emit q->stateChanged(state); + + return; + } + + if (serviceConfig.children().isEmpty()) + state = QNetworkSession::NotAvailable; + else + state = QNetworkSession::Disconnected; + + if (state != oldState) + emit q->stateChanged(state); +} + + +void QNetworkSessionPrivate::clearConfiguration(QNetworkConfiguration &config) +{ + config.d->network_id.clear(); + config.d->iap_type.clear(); + config.d->network_attrs = 0; + config.d->service_type.clear(); + config.d->service_id.clear(); + config.d->service_attrs = 0; +} + + +void QNetworkSessionPrivate::updateStateFromActiveConfig() +{ + QNetworkSession::State oldState = state; + + bool newActive = false; + + if (!activeConfig.d.data()) + return; + + if (!activeConfig.isValid()) { + state = QNetworkSession::Invalid; + clearConfiguration(activeConfig); + } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Connected; + newActive = opened; + } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Disconnected; + } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + state = QNetworkSession::NotAvailable; + } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { + state = QNetworkSession::NotAvailable; + clearConfiguration(activeConfig); + } + + bool oldActive = isActive; + isActive = newActive; + + if (!oldActive && isActive) + emit quitPendingWaitsForOpened(); + + if (oldActive && !isActive) + emit q->closed(); + + if (oldState != state) { + emit q->stateChanged(state); + + if (state == QNetworkSession::Disconnected) { +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"session aborted error emitted for"<error(lastError); + } + } + +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"oldState ="<ifa_next) { + family = ifa->ifa_addr->sa_family; + if (family != AF_INET) { + continue; /* Currently only IPv4 is supported by icd dbus interface */ + } + if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) { + iface = QString(ifa->ifa_name); + break; + } + } + + freeifaddrs(ifaddr); + return iface; +} + + +void QNetworkSessionPrivate::open() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit q->error(lastError); + } else if (!isActive) { + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + /* Caller is trying to connect to default IAP. + * At this time we will not know the IAP details so we just + * connect and update the active config when the IAP is + * connected. + */ + opened = true; + state = QNetworkSession::Connecting; + emit q->stateChanged(state); + QTimer::singleShot(0, this, SLOT(do_open())); + return; + } + + /* User is connecting to one specific IAP. If that IAP is not + * in discovered state we cannot continue. + */ + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + lastError =QNetworkSession::InvalidConfigurationError; + emit q->error(lastError); + return; + } + opened = true; + + if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) { + state = QNetworkSession::Connecting; + emit q->stateChanged(state); + + QTimer::singleShot(0, this, SLOT(do_open())); + return; + } + + isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isActive) + emit quitPendingWaitsForOpened(); + } else { + /* We seem to be active so inform caller */ + emit quitPendingWaitsForOpened(); + } +} + + +void QNetworkSessionPrivate::do_open() +{ + icd_connection_flags flags = connectFlags; + bool st; + QString result; + QString iap = publicConfig.identifier(); + QString bearer_name; + + if (state == QNetworkSession::Connected) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Already connected to" << activeConfig.identifier(); +#endif + emit q->stateChanged(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + return; + } + + Maemo::IcdConnectResult connect_result; + Maemo::Icd icd(ICD_LONG_CONNECT_TIMEOUT); + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + config = activeConfig; + else + config = publicConfig; + + if (iap == OSSO_IAP_ANY) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connecting to default IAP" << iap; +#endif + st = icd.connect(flags, connect_result); + + } else { + + QList params; + Maemo::ConnectParams param; + param.connect.service_type = config.d->service_type; + param.connect.service_attrs = config.d->service_attrs; + param.connect.service_id = config.d->service_id; + param.connect.network_type = config.d->iap_type; + param.connect.network_attrs = config.d->network_attrs; + if (config.d->network_attrs & ICD_NW_ATTR_IAPNAME) + param.connect.network_id = QByteArray(iap.toLatin1()); + else + param.connect.network_id = config.d->network_id; + params.append(param); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", + param.connect.network_id.data(), + param.connect.network_type.toAscii().constData(), + param.connect.network_attrs, + param.connect.service_type.toAscii().constData(), + param.connect.service_attrs, + param.connect.service_id.toAscii().constData()); +#endif + st = icd.connect(flags, params, connect_result); + } + + if (st) { + result = connect_result.connect.network_id.data(); + QString connected_iap = result; + + if (connected_iap.isEmpty()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connect to"<< iap << "failed, result is empty"; +#endif + updateState(QNetworkSession::Disconnected); + emit quitPendingWaitsForOpened(); + emit q->error(QNetworkSession::InvalidConfigurationError); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + cleanupAnyConfiguration(); + return; + } + + /* If the user tried to connect to some specific connection (foo) + * and we were already connected to some other connection (bar), + * then we cannot activate this session although icd has a valid + * connection to somewhere. + */ + if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && + (connected_iap != config.identifier())) { + updateState(QNetworkSession::Disconnected); + emit quitPendingWaitsForOpened(); + emit q->error(QNetworkSession::InvalidConfigurationError); + return; + } + + + /* Did we connect to non saved IAP? */ + if (!(config.d->network_attrs & ICD_NW_ATTR_IAPNAME)) { + /* Because the connection succeeded, the IAP is now known. + */ + config.d->network_attrs |= ICD_NW_ATTR_IAPNAME; + config.d->id = connected_iap; + } + + /* User might have changed the IAP name when a new IAP was saved */ + Maemo::IAPConf iap_name(config.d->id); + QString name = iap_name.value("name").toString(); + if (!name.isEmpty()) + config.d->name = name; + + bearer_name = connect_result.connect.network_type; + if (bearer_name == "WLAN_INFRA" || + bearer_name == "WLAN_ADHOC") + currentBearerName = "WLAN"; + else if (bearer_name == "GPRS") + currentBearerName = "HSPA"; + else + currentBearerName = bearer_name; + + config.d->isValid = true; + config.d->state = QNetworkConfiguration::Active; + config.d->type = QNetworkConfiguration::InternetAccessPoint; + + startTime = QDateTime::currentDateTime(); + updateState(QNetworkSession::Connected); + + currentNetworkInterface = get_network_interface(); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connected to" << result << config.d->name << "at" << currentNetworkInterface; +#endif + + /* We first check if the configuration already exists in the manager + * and if it is not found there, we then insert it. Note that this + * is only done for user choice config only because it can be missing + * from config manager list. + */ + + if (publicConfig.d->type == QNetworkConfiguration::UserChoice) { + +#ifdef BEARER_MANAGEMENT_DEBUG +#if 0 + QList configs; + QNetworkConfigurationManagerPrivate *conPriv = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; + QList cpsIdents = conPriv->accessPointConfigurations.keys(); + foreach( QString ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->accessPointConfigurations.value(ii); + QNetworkConfiguration pt; + pt.d = conPriv->accessPointConfigurations.value(ii); + configs << pt; + } + + int all = configs.count(); + qDebug() << "All configurations:" << all; + foreach(QNetworkConfiguration p, configs) { + qDebug() << p.name() <<": isvalid->" <"<< p.type() << + " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << + " purpose->" << p.purpose() << " state->" << p.state(); + } +#endif +#endif + + QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; + if (!mgr->accessPointConfigurations.contains(result)) { + QExplicitlySharedDataPointer ptr = config.d; + mgr->accessPointConfigurations.insert(result, ptr); + + QNetworkConfiguration item; + item.d = ptr; + emit mgr->configurationAdded(item); + +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"New configuration"< priv = mgr->accessPointConfigurations.value(result); + QNetworkConfiguration reference; + reference.d = priv; + copyConfig(config, reference, false); + config = reference; + activeConfig = reference; + mgr->configurationChanged((QNetworkConfigurationPrivate*)(config.d.data())); + +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"Existing configuration"<error(QNetworkSession::UnknownSessionError); + } +} + + +void QNetworkSessionPrivate::cleanupAnyConfiguration() +{ +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug()<<"Removing configuration created for" << activeConfig.d->id; +#endif + activeConfig = publicConfig; +} + + +void QNetworkSessionPrivate::close() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit q->error(lastError); + } else if (isActive) { + opened = false; + isActive = false; + emit q->closed(); + } +} + + +void QNetworkSessionPrivate::stop() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit q->error(lastError); + } else { + if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Closing; + emit q->stateChanged(state); + + Maemo::Icd icd; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "stopping session" << publicConfig.identifier(); +#endif + icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); + startTime = QDateTime(); + + /* Note that the state will go disconnected in + * updateStateFromActiveConfig() which gets called after + * configurationChanged is emitted (below). + */ + + activeConfig.d->state = QNetworkConfiguration::Discovered; + QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; + mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data()); + + opened = false; + isActive = false; + + } else { + opened = false; + isActive = false; + emit q->closed(); + } + } +} + + +void QNetworkSessionPrivate::migrate() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivate::accept() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivate::ignore() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivate::reject() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +QNetworkInterface QNetworkSessionPrivate::currentInterface() const +{ + if (!publicConfig.isValid() || state != QNetworkSession::Connected) + return QNetworkInterface(); + + if (currentNetworkInterface.isEmpty()) + return QNetworkInterface(); + + return QNetworkInterface::interfaceFromName(currentNetworkInterface); +} + + +void QNetworkSessionPrivate::setSessionProperty(const QString& key, const QVariant& value) +{ + if (value.isValid()) { + properties.insert(key, value); + + if (key == "ConnectInBackground") { + bool v = value.toBool(); + if (v) + connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT; + else + connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; + } + } else { + properties.remove(key); + + /* Set default value when property is removed */ + if (key == "ConnectInBackground") + connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; + } +} + + +QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const +{ + return properties.value(key); +} + + +QString QNetworkSessionPrivate::bearerName() const +{ + if (!publicConfig.isValid()) + return QString(); + + return currentBearerName; +} + + +QString QNetworkSessionPrivate::errorString() const +{ + QString errorStr; + switch(q->error()) { + case QNetworkSession::RoamingError: + errorStr = QObject::tr("Roaming error"); + break; + case QNetworkSession::SessionAbortedError: + errorStr = QObject::tr("Session aborted by user or system"); + break; + default: + case QNetworkSession::UnknownSessionError: + errorStr = QObject::tr("Unidentified Error"); + break; + } + return errorStr; +} + + +QNetworkSession::SessionError QNetworkSessionPrivate::error() const +{ + return QNetworkSession::UnknownSessionError; +} + +#include "qnetworksession_maemo.moc" +#include "moc_qnetworksession_maemo_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h new file mode 100644 index 0000000..e233087 --- /dev/null +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKSESSIONPRIVATE_H +#define QNETWORKSESSIONPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkconfigmanager_maemo_p.h" +#include "qnetworksession.h" + +#include +#include +#include + +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkSessionPrivate : public QObject +{ + Q_OBJECT +public: + QNetworkSessionPrivate() : + tx_data(0), rx_data(0), m_activeTime(0), isActive(false), + connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) + { + } + + ~QNetworkSessionPrivate() + { + cleanupSession(); + } + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + QString bearerName() const; + + void open(); + void close(); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +Q_SIGNALS: + //releases any pending waitForOpened() calls + void quitPendingWaitsForOpened(); + +private Q_SLOTS: + void do_open(); + void networkConfigurationsChanged(); + void configurationChanged(const QNetworkConfiguration &config); + +private: + QNetworkConfigurationManager manager; + + quint64 tx_data; + quint64 rx_data; + quint64 m_activeTime; + + // The config set on QNetworkSession. + QNetworkConfiguration publicConfig; + + // If publicConfig is a ServiceNetwork this is a copy of publicConfig. + // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual + // ServiceNetwork configuration. + QNetworkConfiguration serviceConfig; + + // This is the actual active configuration currently in use by the session. + // Either a copy of publicConfig or one of serviceConfig.children(). + QNetworkConfiguration activeConfig; + + QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); + void clearConfiguration(QNetworkConfiguration &config); + void cleanupAnyConfiguration(); + + QNetworkSession::State state; + bool isActive; + bool opened; + icd_connection_flags connectFlags; + + QNetworkSession::SessionError lastError; + + QNetworkSession* q; + friend class QNetworkSession; + + QDateTime startTime; + QString currentBearerName; + QString currentNetworkInterface; + friend class IcdListener; + void updateState(QNetworkSession::State); + void updateIdentifier(QString &newId); + quint64 getStatistics(bool sent) const; + void cleanupSession(void); +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKSESSIONPRIVATE_H + diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp new file mode 100644 index 0000000..c6f9833 --- /dev/null +++ b/src/network/bearer/qnetworksession_p.cpp @@ -0,0 +1,542 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworksession_p.h" +#include "qnetworksession.h" +#include "qnetworksessionengine_p.h" +#include "qgenericengine_p.h" + +#ifdef Q_OS_WIN +#include "qnlaengine_win_p.h" +#endif +#ifdef Q_OS_WIN32 +#include "qnativewifiengine_win_p.h" +#endif +#ifdef Q_OS_DARWIN +#include "qcorewlanengine_mac_p.h" +#endif +#include +#include +#include + +#include + +#if defined(BACKEND_NM) +#include "qnmwifiengine_unix_p.h" +#endif + +QTM_BEGIN_NAMESPACE + +#if defined(BACKEND_NM) +static bool NetworkManagerAvailable() +{ + QDBusConnection dbusConnection = QDBusConnection::systemBus(); + if (dbusConnection.isConnected()) { + QDBusConnectionInterface *dbiface = dbusConnection.interface(); + QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); + if (reply.isValid()) + return reply.value(); + } + return false; +} +#endif + +static QNetworkSessionEngine *getEngineFromId(const QString &id) +{ +#ifdef Q_OS_WIN + QNlaEngine *nla = QNlaEngine::instance(); + if (nla && nla->hasIdentifier(id)) + return nla; +#endif + +#ifdef Q_OS_WIN32 + QNativeWifiEngine *nativeWifi = QNativeWifiEngine::instance(); + if (nativeWifi && nativeWifi->hasIdentifier(id)) + return nativeWifi; +#endif + +#if defined(BACKEND_NM) + if(NetworkManagerAvailable()) { + QNmWifiEngine *nmwiifi = QNmWifiEngine::instance(); + if (nmwiifi && nmwiifi->hasIdentifier(id)) + return nmwiifi; + } +#endif +#ifdef Q_OS_DARWIN + QCoreWlanEngine *coreWifi = QCoreWlanEngine::instance(); + if (coreWifi && coreWifi->hasIdentifier(id)) + return coreWifi; + +#endif + QGenericEngine *generic = QGenericEngine::instance(); + if (generic && generic->hasIdentifier(id)) + return generic; + + return 0; +} + +class QNetworkSessionManagerPrivate : public QObject +{ + Q_OBJECT + +public: + QNetworkSessionManagerPrivate(QObject *parent = 0); + ~QNetworkSessionManagerPrivate(); + + void forceSessionClose(const QNetworkConfiguration &config); + +Q_SIGNALS: + void forcedSessionClose(const QNetworkConfiguration &config); +}; + +#include "qnetworksession_p.moc" + +Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); + +QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) +: QObject(parent) +{ +} + +QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() +{ +} + +void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) +{ + emit forcedSessionClose(config); +} + +void QNetworkSessionPrivate::syncStateWithInterface() +{ + connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); + connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), + this, SLOT(forcedSessionClose(QNetworkConfiguration))); + + opened = false; + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + + qRegisterMetaType + ("QNetworkSessionEngine::ConnectionError"); + + switch (publicConfig.type()) { + case QNetworkConfiguration::InternetAccessPoint: + activeConfig = publicConfig; + engine = getEngineFromId(activeConfig.identifier()); + if (engine) { + connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + Qt::QueuedConnection); + } + break; + case QNetworkConfiguration::ServiceNetwork: + serviceConfig = publicConfig; + // Defer setting engine and signals until open(). + // fall through + case QNetworkConfiguration::UserChoice: + // Defer setting serviceConfig and activeConfig until open(). + // fall through + default: + engine = 0; + } + + networkConfigurationsChanged(); +} + +void QNetworkSessionPrivate::open() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit q->error(lastError); + } else if (!isActive) { + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + lastError =QNetworkSession::InvalidConfigurationError; + emit q->error(lastError); + return; + } + opened = true; + + if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && + (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Connecting; + emit q->stateChanged(state); + + engine->connectToId(activeConfig.identifier()); + } + + isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isActive) + emit quitPendingWaitsForOpened(); + } +} + +void QNetworkSessionPrivate::close() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit q->error(lastError); + } else if (isActive) { + opened = false; + isActive = false; + emit q->closed(); + } +} + +void QNetworkSessionPrivate::stop() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit q->error(lastError); + } else { + if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Closing; + emit q->stateChanged(state); + + engine->disconnectFromId(activeConfig.identifier()); + + sessionManager()->forceSessionClose(activeConfig); + } + + opened = false; + isActive = false; + emit q->closed(); + } +} + +void QNetworkSessionPrivate::migrate() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivate::accept() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivate::ignore() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivate::reject() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +QNetworkInterface QNetworkSessionPrivate::currentInterface() const +{ + if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) + return QNetworkInterface(); + + QString interface = engine->getInterfaceFromId(activeConfig.identifier()); + + if (interface.isEmpty()) + return QNetworkInterface(); + return QNetworkInterface::interfaceFromName(interface); +} + +QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const +{ + return QVariant(); +} + +void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) +{ +} + +QString QNetworkSessionPrivate::bearerName() const +{ + if (!publicConfig.isValid() || !engine) + return QString(); + + return engine->bearerName(activeConfig.identifier()); +} + +QString QNetworkSessionPrivate::errorString() const +{ + switch (lastError) { + case QNetworkSession::UnknownSessionError: + return tr("Unknown session error."); + case QNetworkSession::SessionAbortedError: + return tr("The session was aborted by the user or system."); + case QNetworkSession::OperationNotSupportedError: + return tr("The requested operation is not supported by the system."); + case QNetworkSession::InvalidConfigurationError: + return tr("The specified configuration cannot be used."); + case QNetworkSession::RoamingError: + return tr("Roaming was aborted or is not possible."); + + } + + return QString(); +} + +QNetworkSession::SessionError QNetworkSessionPrivate::error() const +{ + return lastError; +} + +quint64 QNetworkSessionPrivate::bytesWritten() const +{ +#if defined(BACKEND_NM) + if( state == QNetworkSession::Connected ) { + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &config, publicConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); + } + } + } else { + return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); + } + } +#endif + return tx_data; +} + +quint64 QNetworkSessionPrivate::bytesReceived() const +{ +#if defined(BACKEND_NM) + if( state == QNetworkSession::Connected ) { + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &config, publicConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); + } + } + } else { + return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); + } + } +#endif + return rx_data; +} + +quint64 QNetworkSessionPrivate::activeTime() const +{ +#if defined(BACKEND_NM) + if (startTime.isNull()) { + return 0; + } + if(state == QNetworkSession::Connected ) + return startTime.secsTo(QDateTime::currentDateTime()); +#endif + return m_activeTime; +} + +void QNetworkSessionPrivate::updateStateFromServiceNetwork() +{ + QNetworkSession::State oldState = state; + + foreach (const QNetworkConfiguration &config, serviceConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) + continue; + + if (activeConfig != config) { + if (engine) { + disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); + } + + activeConfig = config; + engine = getEngineFromId(activeConfig.identifier()); + if (engine) { + connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + Qt::QueuedConnection); + } + emit q->newConfigurationActivated(); + } + + state = QNetworkSession::Connected; + if (state != oldState) + emit q->stateChanged(state); + + return; + } + + if (serviceConfig.children().isEmpty()) + state = QNetworkSession::NotAvailable; + else + state = QNetworkSession::Disconnected; + + if (state != oldState) + emit q->stateChanged(state); +} + +void QNetworkSessionPrivate::updateStateFromActiveConfig() +{ + QNetworkSession::State oldState = state; + + bool newActive = false; + + if (!activeConfig.isValid()) { + state = QNetworkSession::Invalid; + } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Connected; + newActive = opened; + } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Disconnected; + } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + state = QNetworkSession::NotAvailable; + } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { + state = QNetworkSession::NotAvailable; + } + + bool oldActive = isActive; + isActive = newActive; + + if (!oldActive && isActive) + emit quitPendingWaitsForOpened(); + if (oldActive && !isActive) + emit q->closed(); + + if (oldState != state) + emit q->stateChanged(state); +} + +void QNetworkSessionPrivate::networkConfigurationsChanged() +{ + if (serviceConfig.isValid()) + updateStateFromServiceNetwork(); + else + updateStateFromActiveConfig(); +#if defined(BACKEND_NM) + setActiveTimeStamp(); +#endif +} + +void QNetworkSessionPrivate::configurationChanged(const QNetworkConfiguration &config) +{ + if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig)) + updateStateFromServiceNetwork(); + else if (config == activeConfig) + updateStateFromActiveConfig(); +} + +void QNetworkSessionPrivate::forcedSessionClose(const QNetworkConfiguration &config) +{ + if (activeConfig == config) { + opened = false; + isActive = false; + + emit q->closed(); + + lastError = QNetworkSession::SessionAbortedError; + emit q->error(lastError); + } +} + +void QNetworkSessionPrivate::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) +{ + if (activeConfig.identifier() == id) { + networkConfigurationsChanged(); + switch (error) { + case QNetworkSessionEngine::OperationNotSupported: + lastError = QNetworkSession::OperationNotSupportedError; + opened = false; + break; + case QNetworkSessionEngine::InterfaceLookupError: + case QNetworkSessionEngine::ConnectError: + case QNetworkSessionEngine::DisconnectionError: + default: + lastError = QNetworkSession::UnknownSessionError; + } + + emit quitPendingWaitsForOpened(); + emit q->error(lastError); + } +} + +#if defined(BACKEND_NM) +void QNetworkSessionPrivate::setActiveTimeStamp() +{ + if(NetworkManagerAvailable()) { + startTime = QDateTime(); + return; + } + QString connectionIdent = q->configuration().identifier(); + QString interface = currentInterface().hardwareAddress().toLower(); + QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); + + QString path; + QString serviceName; + QNetworkManagerInterface * ifaceD; + ifaceD = new QNetworkManagerInterface(); + + QList connections = ifaceD->activeConnections(); + foreach(QDBusObjectPath conpath, connections) { + QNetworkManagerConnectionActive *conDetails; + conDetails = new QNetworkManagerConnectionActive(conpath.path()); + QDBusObjectPath connection = conDetails->connection(); + serviceName = conDetails->serviceName(); + QList so = conDetails->devices(); + foreach(QDBusObjectPath device, so) { + + if(device.path() == devicePath) { + path = connection.path(); + } + break; + } + } +if(serviceName.isEmpty()) + return; + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(serviceName); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); + startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); + // isActive = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + } + if(startTime.isNull()) + startTime = QDateTime::currentDateTime(); +} +#endif + +#include "moc_qnetworksession_p.cpp" +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h new file mode 100644 index 0000000..a2aaa6a --- /dev/null +++ b/src/network/bearer/qnetworksession_p.h @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKSESSIONPRIVATE_H +#define QNETWORKSESSIONPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkconfigmanager_p.h" +#include "qnetworksession.h" +#ifdef BEARER_ENGINE +#include "qnetworksessionengine_p.h" +#endif + +#include "qnetworksession.h" +#include +#include + +QTM_BEGIN_NAMESPACE +#ifdef BEARER_ENGINE +class QNetworkSessionEngine; +#endif + +class QNetworkSessionPrivate : public QObject +{ + Q_OBJECT +public: + QNetworkSessionPrivate() : + tx_data(0), rx_data(0), m_activeTime(0), isActive(false) + { + } + + ~QNetworkSessionPrivate() + { + } + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + QString bearerName() const; + + void open(); + void close(); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +Q_SIGNALS: + //releases any pending waitForOpened() calls + void quitPendingWaitsForOpened(); + +private Q_SLOTS: +#ifdef BEARER_ENGINE + void networkConfigurationsChanged(); + void configurationChanged(const QNetworkConfiguration &config); + void forcedSessionClose(const QNetworkConfiguration &config); + void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); +#endif + +private: + QNetworkConfigurationManager manager; + + quint64 tx_data; + quint64 rx_data; + quint64 m_activeTime; + + // The config set on QNetworkSession. + QNetworkConfiguration publicConfig; + + // If publicConfig is a ServiceNetwork this is a copy of publicConfig. + // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual + // ServiceNetwork configuration. + QNetworkConfiguration serviceConfig; + + // This is the actual active configuration currently in use by the session. + // Either a copy of publicConfig or one of serviceConfig.children(). + QNetworkConfiguration activeConfig; + + QNetworkSession::State state; + bool isActive; + +#ifdef BEARER_ENGINE + bool opened; + + QNetworkSessionEngine *engine; +#endif + QNetworkSession::SessionError lastError; + + QNetworkSession* q; + friend class QNetworkSession; + +#if defined(BEARER_ENGINE) && defined(BACKEND_NM) + QDateTime startTime; + void setActiveTimeStamp(); +#endif +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKSESSIONPRIVATE_H + diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp new file mode 100644 index 0000000..764c1c4 --- /dev/null +++ b/src/network/bearer/qnetworksession_s60_p.cpp @@ -0,0 +1,1168 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qnetworksession_s60_p.h" +#include "qnetworkconfiguration_s60_p.h" +#include "qnetworkconfigmanager_s60_p.h" +#include +#include +#include +#include +#include + +QTM_BEGIN_NAMESPACE + +QNetworkSessionPrivate::QNetworkSessionPrivate() + : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid), + isActive(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), + iALREnabled(0) +{ + CActiveScheduler::Add(this); + + // Try to load "Open C" dll dynamically and + // try to attach to setdefaultif function dynamically. + if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { + iDynamicSetdefaultif = (TOpenCSetdefaultifFunction)iOpenCLibrary.Lookup(564); + } + + TRAP_IGNORE(iConnectionMonitor.ConnectL()); +} + +QNetworkSessionPrivate::~QNetworkSessionPrivate() +{ + isActive = false; + + // Cancel Connection Progress Notifications first. + // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() + // => deleting ipConnectionNotifier results RConnection::CancelProgressNotification() + delete ipConnectionNotifier; + ipConnectionNotifier = NULL; + + // Cancel possible RConnection::Start() + Cancel(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iMobility) { + delete iMobility; + iMobility = NULL; + } +#endif + + iConnection.Close(); + iSocketServ.Close(); + if (iDynamicSetdefaultif) { + iDynamicSetdefaultif(0); + } + + iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); + + iOpenCLibrary.Close(); +} + +void QNetworkSessionPrivate::syncStateWithInterface() +{ + if (!publicConfig.d) { + return; + } + + // Start monitoring changes in IAP states + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + + // Check open connections to see if there is already + // an open connection to selected IAP or SNAP + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return; + } + + TUint numSubConnections; + TUint connectionId; + for (TUint i = 1; i <= count; i++) { + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + TInt connectionStatus; + iConnectionMonitor.GetIntAttribute(connectionId, 0, KConnectionStatus, connectionStatus, status); + User::WaitForRequest(status); + if (connectionStatus == KLinkLayerOpen) { + if (state != QNetworkSession::Closing) { + if (newState(QNetworkSession::Connected, apId)) { + return; + } + } + } + } + } + } + + if (state != QNetworkSession::Connected) { + // There were no open connections to used IAP or SNAP + if ((publicConfig.d.data()->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::NotAvailable); + } + } +} + +QNetworkInterface QNetworkSessionPrivate::interface(TUint iapId) const +{ + QString interfaceName; + + TSoInetInterfaceInfo ifinfo; + TPckg ifinfopkg(ifinfo); + TSoInetIfQuery ifquery; + TPckg ifquerypkg(ifquery); + + // Open dummy socket for interface queries + RSocket socket; + TInt retVal = socket.Open(iSocketServ, _L("udp")); + if (retVal != KErrNone) { + return QNetworkInterface(); + } + + // Start enumerating interfaces + socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); + while(socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifinfopkg) == KErrNone) { + ifquery.iName = ifinfo.iName; + TInt err = socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifquerypkg); + if(err == KErrNone && ifquery.iZone[1] == iapId) { // IAP ID is index 1 of iZone + if(ifinfo.iAddress.Address() > 0) { + interfaceName = QString::fromUtf16(ifinfo.iName.Ptr(),ifinfo.iName.Length()); + break; + } + } + } + + socket.Close(); + + if (interfaceName.isEmpty()) { + return QNetworkInterface(); + } + + return QNetworkInterface::interfaceFromName(interfaceName); +} + +QNetworkInterface QNetworkSessionPrivate::currentInterface() const +{ + if (!publicConfig.isValid() || state != QNetworkSession::Connected) { + return QNetworkInterface(); + } + + return activeInterface; +} + +QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const +{ + return QVariant(); +} + +void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) +{ +} + +QString QNetworkSessionPrivate::errorString() const +{ + switch (iError) { + case QNetworkSession::UnknownSessionError: + return tr("Unknown session error."); + case QNetworkSession::SessionAbortedError: + return tr("The session was aborted by the user or system."); + case QNetworkSession::OperationNotSupportedError: + return tr("The requested operation is not supported by the system."); + case QNetworkSession::InvalidConfigurationError: + return tr("The specified configuration cannot be used."); + case QNetworkSession::RoamingError: + return tr("Roaming was aborted or is not possible."); + } + + return QString(); +} + +QNetworkSession::SessionError QNetworkSessionPrivate::error() const +{ + return iError; +} + +void QNetworkSessionPrivate::open() +{ + if (isActive || !publicConfig.d || (state == QNetworkSession::Connecting)) { + return; + } + + // Cancel notifications from RConnectionMonitor + // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring + iConnectionMonitor.CancelNotifications(); + + TInt error = iSocketServ.Connect(); + if (error != KErrNone) { + // Could not open RSocketServ + newState(QNetworkSession::Invalid); + iError = QNetworkSession::UnknownSessionError; + emit q->error(iError); + syncStateWithInterface(); + return; + } + + error = iConnection.Open(iSocketServ); + if (error != KErrNone) { + // Could not open RConnection + iSocketServ.Close(); + newState(QNetworkSession::Invalid); + iError = QNetworkSession::UnknownSessionError; + emit q->error(iError); + syncStateWithInterface(); + return; + } + + // Use RConnection::ProgressNotification for IAP/SNAP monitoring + // (<=> ConnectionProgressNotifier uses RConnection::ProgressNotification) + if (!ipConnectionNotifier) { + ipConnectionNotifier = new ConnectionProgressNotifier(*this,iConnection); + } + if (ipConnectionNotifier) { + ipConnectionNotifier->StartNotifications(); + } + + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + // Search through existing connections. + // If there is already connection which matches to given IAP + // try to attach to existing connection. + TBool connected(EFalse); + TConnectionInfoBuf connInfo; + TUint count; + if (iConnection.EnumerateConnections(count) == KErrNone) { + for (TUint i=1; i<=count; i++) { + // Note: GetConnectionInfo expects 1-based index. + if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) { + if (connInfo().iIapId == publicConfig.d.data()->numericId) { + if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { + activeConfig = publicConfig; + activeInterface = interface(activeConfig.d.data()->numericId); + connected = ETrue; + startTime = QDateTime::currentDateTime(); + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = publicConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + error = iDynamicSetdefaultif(&ifr); + } + isActive = true; + // Make sure that state will be Connected + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + break; + } + } + } + } + } + if (!connected) { + TCommDbConnPref pref; + pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); + pref.SetIapId(publicConfig.d.data()->numericId); + iConnection.Start(pref, iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + TConnSnapPref snapPref(publicConfig.d.data()->numericId); + iConnection.Start(snapPref, iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + iKnownConfigsBeforeConnectionStart = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); + iConnection.Start(iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } + + if (error != KErrNone) { + isActive = false; + iError = QNetworkSession::UnknownSessionError; + emit q->error(iError); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + } +} + +TUint QNetworkSessionPrivate::iapClientCount(TUint aIAPId) const +{ + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + TUint connectionId; + TUint subConnectionCount; + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + if (apId == aIAPId) { + TConnMonClientEnumBuf buf; + iConnectionMonitor.GetPckgAttribute(connectionId, 0, KClientInfo, buf, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + return buf().iCount; + } + } + } + } + return 0; +} + +void QNetworkSessionPrivate::close(bool allowSignals) +{ + if (!isActive) { + return; + } + + TUint activeIap = activeConfig.d.data()->numericId; + isActive = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + + Cancel(); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iMobility) { + delete iMobility; + iMobility = NULL; + } +#endif + + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + + iConnection.Close(); + iSocketServ.Close(); + if (iDynamicSetdefaultif) { + iDynamicSetdefaultif(0); + } + +#ifdef Q_CC_NOKIAX86 + if ((allowSignals && iapClientCount(activeIap) <= 0) || +#else + if ((allowSignals && iapClientCount(activeIap) <= 1) || +#endif + (publicConfig.type() == QNetworkConfiguration::UserChoice)) { + newState(QNetworkSession::Closing); + } + + syncStateWithInterface(); + if (allowSignals) { + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + newState(QNetworkSession::Disconnected); + } + emit q->closed(); + } +} + +void QNetworkSessionPrivate::stop() +{ + if (!isActive) { + return; + } + isActive = false; + newState(QNetworkSession::Closing); + iConnection.Stop(RConnection::EStopAuthoritative); + isActive = true; + close(false); + emit q->closed(); +} + +void QNetworkSessionPrivate::migrate() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->MigrateToPreferredCarrier(); +#endif +} + +void QNetworkSessionPrivate::ignore() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->IgnorePreferredCarrier(); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected,iOldRoamingIap); + } +#endif +} + +void QNetworkSessionPrivate::accept() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->NewCarrierAccepted(); + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = activeConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + iDynamicSetdefaultif(&ifr); + } + newState(QNetworkSession::Connected, iNewRoamingIap); +#endif +} + +void QNetworkSessionPrivate::reject() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->NewCarrierRejected(); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected, iOldRoamingIap); + } +#endif +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +void QNetworkSessionPrivate::PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless) +{ + iOldRoamingIap = aOldAPInfo.AccessPoint(); + iNewRoamingIap = aNewAPInfo.AccessPoint(); + newState(QNetworkSession::Roaming); + if (iALREnabled > 0) { + iALRUpgradingConnection = aIsUpgrade; + QList configs = publicConfig.children(); + for (int i=0; i < configs.count(); i++) { + if (configs[i].d.data()->numericId == aNewAPInfo.AccessPoint()) { + emit q->preferredConfigurationChanged(configs[i],aIsSeamless); + } + } + } else { + migrate(); + } +} + +void QNetworkSessionPrivate::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/) +{ + if (iALREnabled > 0) { + emit q->newConfigurationActivated(); + } else { + accept(); + } +} + +void QNetworkSessionPrivate::Error(TInt /*aError*/) +{ + if (isActive) { + isActive = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::RoamingError; + emit q->error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + // In some cases IAP is still in Connected state when + // syncStateWithInterface(); is called + // => Following call makes sure that Session state + // changes immediately to Disconnected. + newState(QNetworkSession::Disconnected); + emit q->closed(); + } +} +#endif + +void QNetworkSessionPrivate::setALREnabled(bool enabled) +{ + if (enabled) { + iALREnabled++; + } else { + iALREnabled--; + } +} + +QNetworkConfiguration QNetworkSessionPrivate::bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const +{ + QNetworkConfiguration config; + QList subConfigurations = snapConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (subConfigurations[i].state() == QNetworkConfiguration::Active) { + config = subConfigurations[i]; + break; + } else if (!config.isValid() && subConfigurations[i].state() == QNetworkConfiguration::Discovered) { + config = subConfigurations[i]; + } + } + if (!config.isValid() && subConfigurations.count() > 0) { + config = subConfigurations[0]; + } + return config; +} + +QString QNetworkSessionPrivate::bearerName() const +{ + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + config = publicConfig; + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + if (activeConfig.isValid()) { + config = activeConfig; + } else { + config = bestConfigFromSNAP(publicConfig); + } + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (activeConfig.isValid()) { + config = activeConfig; + } + } + + if (!config.isValid()) { + return QString(); + } + + switch (config.d.data()->bearer) { + case QNetworkConfigurationPrivate::BearerEthernet: return QString("Ethernet"); + case QNetworkConfigurationPrivate::BearerWLAN: return QString("WLAN"); + case QNetworkConfigurationPrivate::Bearer2G: return QString("2G"); + case QNetworkConfigurationPrivate::BearerCDMA2000: return QString("CDMA2000"); + case QNetworkConfigurationPrivate::BearerWCDMA: return QString("WCDMA"); + case QNetworkConfigurationPrivate::BearerHSPA: return QString("HSPA"); + case QNetworkConfigurationPrivate::BearerBluetooth: return QString("Bluetooth"); + case QNetworkConfigurationPrivate::BearerWiMAX: return QString("WiMAX"); + default: return QString(); + } +} + +quint64 QNetworkSessionPrivate::bytesWritten() const +{ + return transferredData(KUplinkData); +} + +quint64 QNetworkSessionPrivate::bytesReceived() const +{ + return transferredData(KDownlinkData); +} + +quint64 QNetworkSessionPrivate::transferredData(TUint dataType) const +{ + if (!publicConfig.isValid()) { + return 0; + } + + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (serviceConfig.isValid()) { + config = serviceConfig; + } else { + if (activeConfig.isValid()) { + config = activeConfig; + } + } + } else { + config = publicConfig; + } + + if (!config.isValid()) { + return 0; + } + + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return 0; + } + + TUint transferredData = 0; + TUint numSubConnections; + TUint connectionId; + bool configFound; + for (TUint i = 1; i <= count; i++) { + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + configFound = false; + if (config.type() == QNetworkConfiguration::ServiceNetwork) { + QList configs = config.children(); + for (int i=0; i < configs.count(); i++) { + if (configs[i].d.data()->numericId == apId) { + configFound = true; + break; + } + } + } else if (config.d.data()->numericId == apId) { + configFound = true; + } + if (configFound) { + TUint tData; + iConnectionMonitor.GetUintAttribute(connectionId, 0, dataType, tData, status ); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + transferredData += tData; + } + } + } + } + } + + return transferredData; +} + +quint64 QNetworkSessionPrivate::activeTime() const +{ + if (!isActive || startTime.isNull()) { + return 0; + } + return startTime.secsTo(QDateTime::currentDateTime()); +} + +QNetworkConfiguration QNetworkSessionPrivate::activeConfiguration(TUint32 iapId) const +{ + if (iapId == 0) { + _LIT(KSetting, "IAP\\Id"); + iConnection.GetIntSetting(KSetting, iapId); + } + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + // Try to search IAP from the used SNAP using IAP Id + QList children = publicConfig.children(); + for (int i=0; i < children.count(); i++) { + if (children[i].d.data()->numericId == iapId) { + return children[i]; + } + } + + // Given IAP Id was not found from the used SNAP + // => Try to search matching IAP using mappingName + // mappingName contains: + // 1. "Access point name" for "Packet data" Bearer + // 2. "WLAN network name" (= SSID) for "Wireless LAN" Bearer + // 3. "Dial-up number" for "Data call Bearer" or "High Speed (GSM)" Bearer + // <=> Note: It's possible that in this case reported IAP is + // clone of the one of the IAPs of the used SNAP + // => If mappingName matches, clone has been found + QNetworkConfiguration pt; + pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); + if (pt.d) { + for (int i=0; i < children.count(); i++) { + if (children[i].d.data()->mappingName == pt.d.data()->mappingName) { + return children[i]; + } + } + } else { + // Given IAP Id was not found from known IAPs array + return QNetworkConfiguration(); + } + + // Matching IAP was not found from used SNAP + // => IAP from another SNAP is returned + // (Note: Returned IAP matches to given IAP Id) + return pt; + } +#endif + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (publicConfig.d.data()->manager) { + QNetworkConfiguration pt; + // Try to found User Selected IAP from known IAPs (accessPointConfigurations) + pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); + if (pt.d) { + return pt; + } else { + // Check if new (WLAN) IAP was created in IAP/SNAP dialog + // 1. Sync internal configurations array to commsdb first + ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->updateConfigurations(); + // 2. Check if new configuration was created during connection creation + QList knownConfigs = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); + if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { + // Configuration count increased => new configuration was created + // => Search new, created configuration + QString newIapId; + for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) { + if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) { + newIapId = knownConfigs[i]; + break; + } + } + if (newIapId.isEmpty()) { + newIapId = knownConfigs[knownConfigs.count()-1]; + } + pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(newIapId); + if (pt.d) { + return pt; + } + } + } + } + return QNetworkConfiguration(); + } + + return publicConfig; +} + +void QNetworkSessionPrivate::RunL() +{ + TInt statusCode = iStatus.Int(); + + switch (statusCode) { + case KErrNone: // Connection created succesfully + { + TInt error = KErrNone; + QNetworkConfiguration newActiveConfig = activeConfiguration(); + if (!newActiveConfig.isValid()) { + error = KErrGeneral; + } else if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + error = iDynamicSetdefaultif(&ifr); + } + + if (error != KErrNone) { + isActive = false; + iError = QNetworkSession::UnknownSessionError; + emit q->error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + return; + } + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + // Activate ALR monitoring + iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); + } +#endif + isActive = true; + activeConfig = newActiveConfig; + activeInterface = interface(activeConfig.d.data()->numericId); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + QNetworkConfiguration pt; + pt.d = activeConfig.d.data()->serviceNetworkPtr; + serviceConfig = pt; + } + + startTime = QDateTime::currentDateTime(); + + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + } + break; + case KErrNotFound: // Connection failed + isActive = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::InvalidConfigurationError; + emit q->error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + break; + case KErrCancel: // Connection attempt cancelled + case KErrAlreadyExists: // Connection already exists + default: + isActive = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::UnknownSessionError; + emit q->error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + break; + } +} + +void QNetworkSessionPrivate::DoCancel() +{ + iConnection.Close(); +} + +bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint accessPointId) +{ + // Make sure that activeConfig is always updated when SNAP is signaled to be + // connected. + if (isActive && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && + newState == QNetworkSession::Connected) { + activeConfig = activeConfiguration(accessPointId); + activeInterface = interface(activeConfig.d.data()->numericId); + } + + // Make sure that same state is not signaled twice in a row. + if (state == newState) { + return true; + } + + // Make sure that Connecting state does not overwrite Roaming state + if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) { + return false; + } + + bool emitSessionClosed = false; + if (isActive && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { + // Active & Connected state should change directly to Disconnected state + // only when something forces connection to close (eg. when another + // application or session stops connection or when network drops + // unexpectedly). + isActive = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::SessionAbortedError; + emit q->error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + // Start monitoring changes in IAP states + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + emitSessionClosed = true; // Emit SessionClosed after state change has been reported + } + + bool retVal = false; + if (accessPointId == 0) { + state = newState; + emit q->stateChanged(state); + retVal = true; + } else { + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (publicConfig.d.data()->numericId == accessPointId) { + state = newState; + emit q->stateChanged(state); + retVal = true; + } + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isActive) { + if (activeConfig.d.data()->numericId == accessPointId) { + state = newState; + emit q->stateChanged(state); + retVal = true; + } + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++) { + if (subConfigurations[i].d.data()->numericId == accessPointId) { + if (newState == QNetworkSession::Connected) { + // Make sure that when AccessPoint is reported to be Connected + // also state of the related configuration changes to Active. + subConfigurations[i].d.data()->state = QNetworkConfiguration::Active; + + state = newState; + emit q->stateChanged(state); + retVal = true; + } else { + if (newState == QNetworkSession::Disconnected) { + // Make sure that when AccessPoint is reported to be disconnected + // also state of the related configuration changes from Active to Defined. + subConfigurations[i].d.data()->state = QNetworkConfiguration::Defined; + } + QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); + if ((config.state() == QNetworkConfiguration::Defined) || + (config.state() == QNetworkConfiguration::Discovered)) { + state = newState; + emit q->stateChanged(state); + retVal = true; + } + } + } + } + } + } + + if (emitSessionClosed) { + emit q->closed(); + } + + return retVal; +} + +void QNetworkSessionPrivate::handleSymbianConnectionStatusChange(TInt aConnectionStatus, + TInt aError, + TUint accessPointId) +{ + switch (aConnectionStatus) + { + // Connection unitialised + case KConnectionUninitialised: + break; + + // Starting connetion selection + case KStartingSelection: + break; + + // Selection finished + case KFinishedSelection: + if (aError == KErrNone) + { + // The user successfully selected an IAP to be used + break; + } + else + { + // The user pressed e.g. "Cancel" and did not select an IAP + newState(QNetworkSession::Disconnected,accessPointId); + } + break; + + // Connection failure + case KConnectionFailure: + newState(QNetworkSession::NotAvailable); + break; + + // Prepearing connection (e.g. dialing) + case KPsdStartingConfiguration: + case KPsdFinishedConfiguration: + case KCsdFinishedDialling: + case KCsdScanningScript: + case KCsdGettingLoginInfo: + case KCsdGotLoginInfo: + break; + + // Creating connection (e.g. GPRS activation) + case KCsdStartingConnect: + case KCsdFinishedConnect: + newState(QNetworkSession::Connecting,accessPointId); + break; + + // Starting log in + case KCsdStartingLogIn: + break; + + // Finished login + case KCsdFinishedLogIn: + break; + + // Connection open + case KConnectionOpen: + break; + + case KLinkLayerOpen: + newState(QNetworkSession::Connected,accessPointId); + break; + + // Connection blocked or suspended + case KDataTransferTemporarilyBlocked: + break; + + // Hangup or GRPS deactivation + case KConnectionStartingClose: + newState(QNetworkSession::Closing,accessPointId); + break; + + // Connection closed + case KConnectionClosed: + break; + + case KLinkLayerClosed: + newState(QNetworkSession::Disconnected,accessPointId); + break; + + // Unhandled state + default: + break; + } +} + +void QNetworkSessionPrivate::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) + { + case EConnMonConnectionStatusChange: + { + CConnMonConnectionStatusChange* realEvent; + realEvent = (CConnMonConnectionStatusChange*) &aEvent; + + TUint connectionId = realEvent->ConnectionId(); + TInt connectionStatus = realEvent->ConnectionStatus(); + + // Try to Find IAP Id using connection Id + TUint apId = 0; + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (subConfigurations[i].d.data()->connectionId == connectionId) { + apId = subConfigurations[i].d.data()->numericId; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (publicConfig.d.data()->connectionId == connectionId) { + apId = publicConfig.d.data()->numericId; + } + } + + if (apId > 0) { + handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId); + } + } + break; + + case EConnMonCreateConnection: + { + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + // Store connection id to related AccessPoint Configuration + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (subConfigurations[i].d.data()->numericId == apId) { + subConfigurations[i].d.data()->connectionId = connectionId; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (publicConfig.d.data()->numericId == apId) { + publicConfig.d.data()->connectionId = connectionId; + } + } + } + } + break; + + case EConnMonDeleteConnection: + { + CConnMonDeleteConnection* realEvent; + realEvent = (CConnMonDeleteConnection*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + // Remove connection id from related AccessPoint Configuration + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (subConfigurations[i].d.data()->connectionId == connectionId) { + subConfigurations[i].d.data()->connectionId = 0; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (publicConfig.d.data()->connectionId == connectionId) { + publicConfig.d.data()->connectionId = 0; + } + } + } + break; + + default: + // For unrecognized events + break; + } +} + +ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivate& owner, RConnection& connection) + : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) +{ + CActiveScheduler::Add(this); +} + +ConnectionProgressNotifier::~ConnectionProgressNotifier() +{ + Cancel(); +} + +void ConnectionProgressNotifier::StartNotifications() +{ + if (!IsActive()) { + SetActive(); + } + iConnection.ProgressNotification(iProgress, iStatus); +} + +void ConnectionProgressNotifier::StopNotifications() +{ + Cancel(); +} + +void ConnectionProgressNotifier::DoCancel() +{ + iConnection.CancelProgressNotification(); +} + +void ConnectionProgressNotifier::RunL() +{ + if (iStatus == KErrNone) { + iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError); + + SetActive(); + iConnection.ProgressNotification(iProgress, iStatus); + } +} + +#include "moc_qnetworksession_s60_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h new file mode 100644 index 0000000..cfb99c9 --- /dev/null +++ b/src/network/bearer/qnetworksession_s60_p.h @@ -0,0 +1,213 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKSESSIONPRIVATE_H +#define QNETWORKSESSIONPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworksession.h" + +#include + +#include +#include +#include +#include +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include +#endif + +typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*); + +QTM_BEGIN_NAMESPACE + +class ConnectionProgressNotifier; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +class QNetworkSessionPrivate : public QObject, public CActive, public MMobilityProtocolResp, + public MConnectionMonitorObserver +#else +class QNetworkSessionPrivate : public QObject, public CActive, public MConnectionMonitorObserver +#endif +{ + Q_OBJECT +public: + QNetworkSessionPrivate(); + ~QNetworkSessionPrivate(); + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + QString bearerName() const; + + void setALREnabled(bool enabled); + + void open(); + void close(bool allowSignals = true); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +public: // From MMobilityProtocolResp + void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless); + + void NewCarrierActive(TAccessPointInfo aNewAPInfo, TBool aIsSeamless); + + void Error(TInt aError); +#endif + +Q_SIGNALS: + //releases any pending waitForOpened() calls + void quitPendingWaitsForOpened(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +private: + TUint iapClientCount(TUint aIAPId) const; + quint64 transferredData(TUint dataType) const; + bool newState(QNetworkSession::State newState, TUint accessPointId = 0); + void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); + QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; + QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; + QNetworkInterface interface(TUint iapId) const; + +private: // data + // The config set on QNetworkSession + mutable QNetworkConfiguration publicConfig; + + // If publicConfig is a ServiceNetwork this is a copy of publicConfig. + // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual + // ServiceNetwork configuration. + mutable QNetworkConfiguration serviceConfig; + + // This is the actual active configuration currently in use by the session. + // Either a copy of publicConfig or one of serviceConfig.children(). + mutable QNetworkConfiguration activeConfig; + + mutable QNetworkInterface activeInterface; + + QNetworkSession::State state; + bool isActive; + + QNetworkSession* q; + QDateTime startTime; + + RLibrary iOpenCLibrary; + TOpenCSetdefaultifFunction iDynamicSetdefaultif; + + mutable RSocketServ iSocketServ; + mutable RConnection iConnection; + mutable RConnectionMonitor iConnectionMonitor; + ConnectionProgressNotifier* ipConnectionNotifier; +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + CActiveCommsMobilityApiExt* iMobility; +#endif + + QNetworkSession::SessionError iError; + TInt iALREnabled; + TBool iALRUpgradingConnection; + + QList iKnownConfigsBeforeConnectionStart; + + TUint32 iOldRoamingIap; + TUint32 iNewRoamingIap; + + friend class QNetworkSession; + friend class ConnectionProgressNotifier; +}; + +class ConnectionProgressNotifier : public CActive +{ +public: + ConnectionProgressNotifier(QNetworkSessionPrivate& owner, RConnection& connection); + ~ConnectionProgressNotifier(); + + void StartNotifications(); + void StopNotifications(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // Data + QNetworkSessionPrivate& iOwner; + RConnection& iConnection; + TNifProgressBuf iProgress; + +}; + +QTM_END_NAMESPACE + +#endif //QNETWORKSESSIONPRIVATE_H + diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp new file mode 100644 index 0000000..55fc4f3 --- /dev/null +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnetworksessionengine_p.h" + +QTM_BEGIN_NAMESPACE + +QNetworkSessionEngine::QNetworkSessionEngine(QObject *parent) +: QObject(parent) +{ +} + +QNetworkSessionEngine::~QNetworkSessionEngine() +{ +} + +#include "moc_qnetworksessionengine_p.cpp" +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h new file mode 100644 index 0000000..795a209 --- /dev/null +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKSESSIONENGINE_P_H +#define QNETWORKSESSIONENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; +class QNetworkSessionEngine : public QObject +{ + Q_OBJECT + +public: + enum ConnectionError { + InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, + }; + + QNetworkSessionEngine(QObject *parent = 0); + virtual ~QNetworkSessionEngine(); + + virtual QList getConfigurations(bool *ok = 0) = 0; + virtual QString getInterfaceFromId(const QString &id) = 0; + virtual bool hasIdentifier(const QString &id) = 0; + + virtual QString bearerName(const QString &id) = 0; + + virtual void connectToId(const QString &id) = 0; + virtual void disconnectFromId(const QString &id) = 0; + + virtual void requestUpdate() = 0; + +Q_SIGNALS: + void configurationsChanged(); + void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/network/bearer/qnetworksessionengine_win_p.h b/src/network/bearer/qnetworksessionengine_win_p.h new file mode 100644 index 0000000..cf01719 --- /dev/null +++ b/src/network/bearer/qnetworksessionengine_win_p.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNETWORKSESSIONENGINE_WIN_P_H +#define QNETWORKSESSIONENGINE_WIN_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#undef interface +#include + +#ifndef NS_NLA + +#define NS_NLA 15 + +enum NLA_BLOB_DATA_TYPE { + NLA_RAW_DATA = 0, + NLA_INTERFACE = 1, + NLA_802_1X_LOCATION = 2, + NLA_CONNECTIVITY = 3, + NLA_ICS = 4 +}; + +enum NLA_CONNECTIVITY_TYPE { + NLA_NETWORK_AD_HOC = 0, + NLA_NETWORK_MANAGED = 1, + NLA_NETWORK_UNMANAGED = 2, + NLA_NETWORK_UNKNOWN = 3 +}; + +enum NLA_INTERNET { + NLA_INTERNET_UNKNOWN = 0, + NLA_INTERNET_NO = 1, + NLA_INTERNET_YES = 2 +}; + +struct NLA_BLOB { + struct { + NLA_BLOB_DATA_TYPE type; + DWORD dwSize; + DWORD nextOffset; + } header; + + union { + // NLA_RAW_DATA + CHAR rawData[1]; + + // NLA_INTERFACE + struct { + DWORD dwType; + DWORD dwSpeed; + CHAR adapterName[1]; + } interfaceData; + + // NLA_802_1X_LOCATION + struct { + CHAR information[1]; + } locationData; + + // NLA_CONNECTIVITY + struct { + NLA_CONNECTIVITY_TYPE type; + NLA_INTERNET internet; + } connectivity; + + // NLA_ICS + struct { + struct { + DWORD speed; + DWORD type; + DWORD state; + WCHAR machineName[256]; + WCHAR sharedAdapterName[256]; + } remote; + } ICS; + } data; +}; +#endif + +enum NDIS_MEDIUM { + NdisMedium802_3 = 0, +}; + +enum NDIS_PHYSICAL_MEDIUM { + NdisPhysicalMediumWirelessLan = 1, + NdisPhysicalMediumBluetooth = 10, + NdisPhysicalMediumWiMax = 12, +}; + +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 + +#define IOCTL_NDIS_QUERY_GLOBAL_STATS \ + CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) + +#endif // QNETWORKSESSIONENGINE_WIN_P_H diff --git a/src/network/bearer/qnlaengine_win.cpp b/src/network/bearer/qnlaengine_win.cpp new file mode 100644 index 0000000..b606ef4 --- /dev/null +++ b/src/network/bearer/qnlaengine_win.cpp @@ -0,0 +1,592 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnlaengine_win_p.h" +#include "qnetworkconfiguration_p.h" + +#include +#include +#include +#include + +#include + +#include "qnetworksessionengine_win_p.h" + +QTM_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QNlaEngine, nlaEngine) + +QWindowsSockInit::QWindowsSockInit() +: version(0) +{ + //### should we try for 2.2 on all platforms ?? + WSAData wsadata; + + // IPv6 requires Winsock v2.0 or better. + if (WSAStartup(MAKEWORD(2,0), &wsadata) != 0) { + qWarning("QBearerManagementAPI: WinSock v2.0 initialization failed."); + } else { + version = 0x20; + } +} + +QWindowsSockInit::~QWindowsSockInit() +{ + WSACleanup(); +} + +#ifdef BEARER_MANAGEMENT_DEBUG +static void printBlob(NLA_BLOB *blob) +{ + qDebug() << "==== BEGIN NLA_BLOB ===="; + + qDebug() << "type:" << blob->header.type; + qDebug() << "size:" << blob->header.dwSize; + qDebug() << "next offset:" << blob->header.nextOffset; + + switch (blob->header.type) { + case NLA_RAW_DATA: + qDebug() << "Raw Data"; + qDebug() << '\t' << blob->data.rawData; + break; + case NLA_INTERFACE: + qDebug() << "Interface"; + qDebug() << "\ttype:" << blob->data.interfaceData.dwType; + qDebug() << "\tspeed:" << blob->data.interfaceData.dwSpeed; + qDebug() << "\tadapter:" << blob->data.interfaceData.adapterName; + break; + case NLA_802_1X_LOCATION: + qDebug() << "802.1x Location"; + qDebug() << '\t' << blob->data.locationData.information; + break; + case NLA_CONNECTIVITY: + qDebug() << "Connectivity"; + qDebug() << "\ttype:" << blob->data.connectivity.type; + qDebug() << "\tinternet:" << blob->data.connectivity.internet; + break; + case NLA_ICS: + qDebug() << "ICS"; + qDebug() << "\tspeed:" << blob->data.ICS.remote.speed; + qDebug() << "\ttype:" << blob->data.ICS.remote.type; + qDebug() << "\tstate:" << blob->data.ICS.remote.state; + qDebug() << "\tmachine name:" << blob->data.ICS.remote.machineName; + qDebug() << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; + break; + default: + qDebug() << "UNKNOWN BLOB TYPE"; + } + + qDebug() << "===== END NLA_BLOB ====="; +} +#endif + +static QString qGetInterfaceType(const QString &interface) +{ +#ifdef Q_OS_WINCE + Q_UNUSED(interface) +#else + unsigned long oid; + DWORD bytesWritten; + + NDIS_MEDIUM medium; + NDIS_PHYSICAL_MEDIUM physicalMedium; + + HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, + FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + if (handle == INVALID_HANDLE_VALUE) + return QString(); + + oid = OID_GEN_MEDIA_SUPPORTED; + bytesWritten = 0; + bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &medium, sizeof(medium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + return QString(); + } + + oid = OID_GEN_PHYSICAL_MEDIUM; + bytesWritten = 0; + result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + + if (medium == NdisMedium802_3) + return QLatin1String("Ethernet"); + else + return QString(); + } + + CloseHandle(handle); + + if (medium == NdisMedium802_3) { + switch (physicalMedium) { + case NdisPhysicalMediumWirelessLan: + return QLatin1String("WLAN"); + case NdisPhysicalMediumBluetooth: + return QLatin1String("Bluetooth"); + case NdisPhysicalMediumWiMax: + return QLatin1String("WiMAX"); + default: +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Physical Medium" << physicalMedium; +#endif + return QLatin1String("Ethernet"); + } + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << medium << physicalMedium; +#endif + +#endif + + return QString(); +} + +class QNlaThread : public QThread +{ + Q_OBJECT + +public: + QNlaThread(QNlaEngine *parent = 0); + ~QNlaThread(); + + QList getConfigurations(); + + void forceUpdate(); + +protected: + virtual void run(); + +private: + void updateConfigurations(QList &configs); + DWORD parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const; + QNetworkConfigurationPrivate *parseQuerySet(const WSAQUERYSET *querySet) const; + void fetchConfigurations(); + +signals: + void networksChanged(); + +private: + QMutex mutex; + HANDLE handle; + bool done; + QList fetchedConfigurations; +}; + +QNlaThread::QNlaThread(QNlaEngine *parent) +: QThread(parent), handle(0), done(false) +{ +} + +QNlaThread::~QNlaThread() +{ + mutex.lock(); + + done = true; + + if (handle) { + /* cancel completion event */ + if (WSALookupServiceEnd(handle) == SOCKET_ERROR) + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + } + mutex.unlock(); + + wait(); +} + +QList QNlaThread::getConfigurations() +{ + QMutexLocker locker(&mutex); + + QList foundConfigurations; + + for (int i = 0; i < fetchedConfigurations.count(); ++i) { + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; + config->name = fetchedConfigurations.at(i)->name; + config->isValid = fetchedConfigurations.at(i)->isValid; + config->id = fetchedConfigurations.at(i)->id; + config->state = fetchedConfigurations.at(i)->state; + config->type = fetchedConfigurations.at(i)->type; + config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; + config->purpose = fetchedConfigurations.at(i)->purpose; + config->internet = fetchedConfigurations.at(i)->internet; + + foundConfigurations.append(config); + } + + return foundConfigurations; +} + +void QNlaThread::forceUpdate() +{ + mutex.lock(); + + if (handle) { + /* cancel completion event */ + if (WSALookupServiceEnd(handle) == SOCKET_ERROR) + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + handle = 0; + } + mutex.unlock(); +} + +void QNlaThread::run() +{ + WSAEVENT changeEvent = WSACreateEvent(); + if (changeEvent == WSA_INVALID_EVENT) { + qWarning("WSACreateEvent error %d", WSAGetLastError()); + return; + } + + while (true) { + fetchConfigurations(); + + WSAQUERYSET qsRestrictions; + + memset(&qsRestrictions, 0, sizeof(qsRestrictions)); + qsRestrictions.dwSize = sizeof(qsRestrictions); + qsRestrictions.dwNameSpace = NS_NLA; + + mutex.lock(); + if (done) { + mutex.unlock(); + break; + } + int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL, &handle); + mutex.unlock(); + + if (result == SOCKET_ERROR) { + qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); + break; + } + + WSACOMPLETION completion; + WSAOVERLAPPED overlapped; + + memset(&overlapped, 0, sizeof(overlapped)); + overlapped.hEvent = changeEvent; + + memset(&completion, 0, sizeof(completion)); + completion.Type = NSP_NOTIFY_EVENT; + completion.Parameters.Event.lpOverlapped = &overlapped; + + DWORD bytesReturned = 0; + result = WSANSPIoctl(handle, SIO_NSP_NOTIFY_CHANGE, 0, 0, 0, 0, + &bytesReturned, &completion); + if (result == SOCKET_ERROR) { + int error = WSAGetLastError(); + if (error != WSA_IO_PENDING) { + qWarning("WSANSPIoctl error %d", error); + break; + } + } + +#ifndef Q_OS_WINCE + // Not interested in unrelated IO completion events + // although we also don't want to block them + while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION) {} +#else + WaitForSingleObject(changeEvent, WSA_INFINITE); +#endif + + mutex.lock(); + if (handle) { + result = WSALookupServiceEnd(handle); + if (result == SOCKET_ERROR) { + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + mutex.unlock(); + break; + } + handle = 0; + } + mutex.unlock(); + } + + WSACloseEvent(changeEvent); +} + +void QNlaThread::updateConfigurations(QList &configs) +{ + mutex.lock(); + + while (!fetchedConfigurations.isEmpty()) + delete fetchedConfigurations.takeFirst(); + + fetchedConfigurations = configs; + + mutex.unlock(); + + emit networksChanged(); +} + +DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const +{ +#ifdef BEARER_MANAGEMENT_DEBUG + printBlob(blob); +#endif + + switch (blob->header.type) { + case NLA_RAW_DATA: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__); +#endif + break; + case NLA_INTERFACE: + cpPriv->state = QNetworkConfiguration::Active; + if (QNlaEngine *engine = qobject_cast(parent())) { + engine->configurationInterface[cpPriv->id.toUInt()] = + QString(blob->data.interfaceData.adapterName); + } + break; + case NLA_802_1X_LOCATION: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__); +#endif + break; + case NLA_CONNECTIVITY: + if (blob->data.connectivity.internet == NLA_INTERNET_YES) + cpPriv->internet = true; + else + cpPriv->internet = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__); +#endif + break; + case NLA_ICS: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_ICS", __FUNCTION__); +#endif + break; + default: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type %d", __FUNCTION__, blob->header.type); +#endif + ; + } + + return blob->header.nextOffset; +} + +QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *querySet) const +{ + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + + cpPriv->name = QString::fromWCharArray(querySet->lpszServiceInstanceName); + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name)); + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "size:" << querySet->dwSize; + qDebug() << "service instance name:" << QString::fromUtf16(querySet->lpszServiceInstanceName); + qDebug() << "service class id:" << querySet->lpServiceClassId; + qDebug() << "version:" << querySet->lpVersion; + qDebug() << "comment:" << QString::fromUtf16(querySet->lpszComment); + qDebug() << "namespace:" << querySet->dwNameSpace; + qDebug() << "namespace provider id:" << querySet->lpNSProviderId; + qDebug() << "context:" << QString::fromUtf16(querySet->lpszContext); + qDebug() << "number of protocols:" << querySet->dwNumberOfProtocols; + qDebug() << "protocols:" << querySet->lpafpProtocols; + qDebug() << "query string:" << QString::fromUtf16(querySet->lpszQueryString); + qDebug() << "number of cs addresses:" << querySet->dwNumberOfCsAddrs; + qDebug() << "cs addresses:" << querySet->lpcsaBuffer; + qDebug() << "output flags:" << querySet->dwOutputFlags; +#endif + + if (querySet->lpBlob) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "blob size:" << querySet->lpBlob->cbSize; + qDebug() << "blob data:" << querySet->lpBlob->pBlobData; +#endif + + DWORD offset = 0; + do { + NLA_BLOB *blob = reinterpret_cast(querySet->lpBlob->pBlobData + offset); + DWORD nextOffset = parseBlob(blob, cpPriv); + if (nextOffset == offset) + break; + else + offset = nextOffset; + } while (offset != 0 && offset < querySet->lpBlob->cbSize); + } + + return cpPriv; +} + +void QNlaThread::fetchConfigurations() +{ + QList foundConfigurations; + + WSAQUERYSET qsRestrictions; + HANDLE hLookup = 0; + + memset(&qsRestrictions, 0, sizeof(qsRestrictions)); + qsRestrictions.dwSize = sizeof(qsRestrictions); + qsRestrictions.dwNameSpace = NS_NLA; + + int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL | LUP_DEEP, &hLookup); + if (result == SOCKET_ERROR) { + qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); + mutex.lock(); + fetchedConfigurations.clear(); + mutex.unlock(); + } + + char buffer[0x10000]; + while (result == 0) { + DWORD bufferLength = sizeof(buffer); + result = WSALookupServiceNext(hLookup, LUP_RETURN_ALL, + &bufferLength, reinterpret_cast(buffer)); + + if (result == SOCKET_ERROR) { + int error = WSAGetLastError(); + + if (error == WSA_E_NO_MORE) + break; + + if (error == WSAEFAULT) { + qDebug() << "buffer not big enough" << bufferLength; + break; + } + + qWarning("WSALookupServiceNext error %d", WSAGetLastError()); + break; + } + + QNetworkConfigurationPrivate *cpPriv = + parseQuerySet(reinterpret_cast(buffer)); + + foundConfigurations.append(cpPriv); + } + + if (hLookup) { + result = WSALookupServiceEnd(hLookup); + if (result == SOCKET_ERROR) { + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + } + } + + updateConfigurations(foundConfigurations); +} + +QNlaEngine::QNlaEngine(QObject *parent) +: QNetworkSessionEngine(parent), nlaThread(0) +{ + nlaThread = new QNlaThread(this); + connect(nlaThread, SIGNAL(networksChanged()), + this, SIGNAL(configurationsChanged())); + nlaThread->start(); + + qApp->processEvents(QEventLoop::ExcludeUserInputEvents); +} + +QNlaEngine::~QNlaEngine() +{ + delete nlaThread; +} + +QList QNlaEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + + return nlaThread->getConfigurations(); +} + +QString QNlaEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QNlaEngine::hasIdentifier(const QString &id) +{ + if (configurationInterface.contains(id.toUInt())) + return true; + + foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { + if (cpPriv->id == id) + return true; + } + + return false; +} + +QString QNlaEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QNlaEngine::connectToId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QNlaEngine::disconnectFromId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QNlaEngine::requestUpdate() +{ + nlaThread->forceUpdate(); +} + +QNlaEngine *QNlaEngine::instance() +{ + return nlaEngine(); +} + +#include "qnlaengine_win.moc" +#include "moc_qnlaengine_win_p.cpp" +QTM_END_NAMESPACE + + + diff --git a/src/network/bearer/qnlaengine_win_p.h b/src/network/bearer/qnlaengine_win_p.h new file mode 100644 index 0000000..394b8cf --- /dev/null +++ b/src/network/bearer/qnlaengine_win_p.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNLAENGINE_P_H +#define QNLAENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworksessionengine_p.h" + +#include + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; +class QNlaThread; + +class QWindowsSockInit +{ +public: + QWindowsSockInit(); + ~QWindowsSockInit(); + int version; +}; + +class QNlaEngine : public QNetworkSessionEngine +{ + Q_OBJECT + + friend class QNlaThread; + +public: + QNlaEngine(QObject *parent = 0); + ~QNlaEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QNlaEngine *instance(); + +private: + QWindowsSockInit winSock; + QNlaThread *nlaThread; + QMap configurationInterface; +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/network/bearer/qnmdbushelper.cpp b/src/network/bearer/qnmdbushelper.cpp new file mode 100644 index 0000000..3b780f6 --- /dev/null +++ b/src/network/bearer/qnmdbushelper.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 class is for helping qdbus get stuff + +#include "qnmdbushelper_p.h" + +#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) +#include + +#include +#include +#include +#include +#endif + +#include + +QTM_BEGIN_NAMESPACE + +void QNmDBusHelper::deviceStateChanged(quint32 state) + { + QDBusMessage msg = this->message(); + if(state == NM_DEVICE_STATE_ACTIVATED + || state == NM_DEVICE_STATE_DISCONNECTED + || state == NM_DEVICE_STATE_UNAVAILABLE + || state == NM_DEVICE_STATE_FAILED) { + emit pathForStateChanged(msg.path(), state); + } + } + +void QNmDBusHelper::slotAccessPointAdded(QDBusObjectPath path) +{ + if(path.path().length() > 2) { + QDBusMessage msg = this->message(); + emit pathForAccessPointAdded(msg.path(), path); + } +} + +void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path) +{ + if(path.path().length() > 2) { + QDBusMessage msg = this->message(); + emit pathForAccessPointRemoved(msg.path(), path); + } +} + +void QNmDBusHelper::slotPropertiesChanged(QMap map) +{ + QDBusMessage msg = this->message(); + QMapIterator i(map); + while (i.hasNext()) { + i.next(); + if( i.key() == "State") { //state only applies to device interfaces + quint32 state = i.value().toUInt(); + if( state == NM_DEVICE_STATE_ACTIVATED + || state == NM_DEVICE_STATE_DISCONNECTED + || state == NM_DEVICE_STATE_UNAVAILABLE + || state == NM_DEVICE_STATE_FAILED) { + emit pathForPropertiesChanged( msg.path(), map); + } + } else if( i.key() == "ActiveAccessPoint") { + // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value().path(); + // } else if( i.key() == "Strength") + // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt(); + // else + // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value(); + } + } +} + +void QNmDBusHelper::slotSettingsRemoved() +{ + QDBusMessage msg = this->message(); + emit pathForSettingsRemoved(msg.path()); +} + +#include "moc_qnmdbushelper_p.cpp" +QTM_END_NAMESPACE diff --git a/src/network/bearer/qnmdbushelper_p.h b/src/network/bearer/qnmdbushelper_p.h new file mode 100644 index 0000000..f0248dc --- /dev/null +++ b/src/network/bearer/qnmdbushelper_p.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNMDBUSHELPERPRIVATE_H +#define QNMDBUSHELPERPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) +#include +#include +#include +#endif + +QTM_BEGIN_NAMESPACE + +#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) + +class QNmDBusHelper: public QObject, protected QDBusContext + { + Q_OBJECT + public: + + public slots: + void deviceStateChanged(quint32); + void slotAccessPointAdded( QDBusObjectPath ); + void slotAccessPointRemoved( QDBusObjectPath ); + void slotPropertiesChanged( QMap); + void slotSettingsRemoved(); + +Q_SIGNALS: + void pathForStateChanged(const QString &, quint32); + void pathForAccessPointAdded(const QString &, QDBusObjectPath ); + void pathForAccessPointRemoved(const QString &, QDBusObjectPath ); + void pathForPropertiesChanged(const QString &, QMap); + void pathForSettingsRemoved(const QString &); +}; +#endif + +QTM_END_NAMESPACE + +#endif// QNMDBUSHELPERPRIVATE_H diff --git a/src/network/bearer/qnmwifiengine_unix.cpp b/src/network/bearer/qnmwifiengine_unix.cpp new file mode 100644 index 0000000..f558fa8 --- /dev/null +++ b/src/network/bearer/qnmwifiengine_unix.cpp @@ -0,0 +1,1133 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "qnmwifiengine_unix_p.h" +#include "qnetworkconfiguration_p.h" +#include + +#include + +#include +#include +#include + +#include + + + +QTM_BEGIN_NAMESPACE +Q_GLOBAL_STATIC(QNmWifiEngine, nmWifiEngine) +typedef QList > QNmSettingsAddressMap; +QTM_END_NAMESPACE + +Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QNmSettingsAddressMap)) + +QTM_BEGIN_NAMESPACE + +QNmWifiEngine::QNmWifiEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + iface = new QNetworkManagerInterface(); + if(!iface->isValid()) { + return; + } + iface->setConnections(); + connect(iface,SIGNAL(deviceAdded(QDBusObjectPath)), + this,SLOT(addDevice(QDBusObjectPath))); + connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), + this,SLOT(removeDevice(QDBusObjectPath))); + + QList list = iface->getDevices(); + + foreach(QDBusObjectPath path, list) { + addDevice(path); + } + + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + foreach (QString service, connectionServices) { + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + settingsiface->setConnections(); + connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), + this,(SLOT(newConnection(QDBusObjectPath)))); + } + + updated = false; +} + +QNmWifiEngine::~QNmWifiEngine() +{ +} + +QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface) +{ + QString newname; + if (devIface->state() == NM_DEVICE_STATE_ACTIVATED) { + QString path = devIface->ip4config().path(); + QNetworkManagerIp4Config * ipIface; + ipIface = new QNetworkManagerIp4Config(path); + newname = ipIface->domains().join(" "); + } + //fallback to interface name + if(newname.isEmpty()) + newname = devIface->interface().name(); + return newname; +} + + +QList QNmWifiEngine::getConfigurations(bool *ok) +{ +// qWarning() << Q_FUNC_INFO << updated; + if (ok) + *ok = false; + + if(!updated) { + foundConfigurations.clear(); + if(knownSsids.isEmpty()) + getKnownSsids(); // list of ssids that have user configurations. + + scanForAccessPoints(); + getActiveConnectionsPaths(); + knownConnections(); + + accessPointConnections(); + +// findConnections(); + //add access points + updated = true; + } + return foundConfigurations; +} + +void QNmWifiEngine::findConnections() +{ + QList list = iface->getDevices(); + + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + + //// eth + switch (devIface->deviceType()) { +// qWarning() << devIface->connectionInterface()->path(); + + case DEVICE_TYPE_802_3_ETHERNET: + { + QString ident; + QNetworkManagerInterfaceDeviceWired *devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + + ident = devWiredIface->hwAddress(); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv->name = getNameForConfiguration(devIface); + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->internet = devWiredIface->carrier(); + + cpPriv->serviceInterface = devIface->interface(); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + switch (devIface->state()) { + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_UNMANAGED: + case NM_DEVICE_STATE_FAILED: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); + break; + case NM_DEVICE_STATE_UNAVAILABLE: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); + break; + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + case NM_DEVICE_STATE_DISCONNECTED: + { + cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered + | QNetworkConfiguration::Defined); + } + break; + case NM_DEVICE_STATE_ACTIVATED: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); + break; + default: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); + break; + }; + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + foundConfigurations.append(cpPriv); + configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + } + break; + case DEVICE_TYPE_802_11_WIRELESS: + { +// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; +// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); +// +// //// connections +// QStringList connectionServices; +// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; +// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; +// +// QString connPath; +// +// foreach (QString service, connectionServices) { +// QString ident; +// QNetworkManagerSettings *settingsiface; +// settingsiface = new QNetworkManagerSettings(service); +// QList list = settingsiface->listConnections(); +// +// foreach(QDBusObjectPath path, list) { //for each connection path +//qWarning() << path.path(); +// ident = path.path(); +// bool addIt = false; +// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); +// cpPriv->isValid = true; +// cpPriv->id = ident; +// cpPriv->internet = true; +// +// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; +// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered +// | QNetworkConfiguration::Defined); +// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; +// +// QNetworkManagerSettingsConnection *sysIface; +// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); +// cpPriv->name = sysIface->getId();//ii.value().toString(); +//qWarning() << cpPriv->name; +// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ +// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { +// cpPriv->serviceInterface = devIface->interface(); +// addIt = true; +// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ +// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { +// cpPriv->serviceInterface = devIface->interface(); +// addIt = true; +// // get the wifi interface state first.. do we need this? +// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); +// } +// +// //#if 0 +// foreach(QString conpath, activeConnectionPaths) { +// QNetworkManagerConnectionActive *aConn; +// aConn = new QNetworkManagerConnectionActive(conpath); +// // in case of accesspoint, specificObject will hold the accessPOintObjectPath +// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); +// if( aConn->connection().path() == ident) { +// +// QList devs = aConn->devices(); +// foreach(QDBusObjectPath device, devs) { +// QNetworkManagerInterfaceDevice *ifaceDevice; +// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); +// cpPriv->serviceInterface = ifaceDevice->interface(); +// cpPriv->state = getStateFlag(ifaceDevice->state()); +// //cpPriv->accessPoint = aConn->specificObject().path(); +// +// break; +// } +// } +// } +// //#endif +// // } //end while connection +// if(addIt) { +// foundConfigurations.append(cpPriv); +// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); +// } +// } +// } //end each connection service +// +// // ////////////// AccessPoints +//// QList apList = devWirelessIface->getAccessPoints(); +////// qWarning() << apList.count(); +//// foreach(QDBusObjectPath path, apList) { +//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); +//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); +//// if(cpPriv->isValid) { +//// foundConfigurations.append(cpPriv); +//// } +//// } + } // end DEVICE_TYPE_802_11_WIRELESS + break; + }; + } //end foreach device +} + +void QNmWifiEngine::knownConnections() +{ +// qWarning() << Q_FUNC_INFO; + //// connections + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + + QString connPath; + + foreach (QString service, connectionServices) { + QString ident; + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + QList list = settingsiface->listConnections(); + +// qWarning() <setConnections(); + connect(sysIface, SIGNAL(removed(QString)), + this,SLOT(settingsConnectionRemoved(QString))); + + cpPriv->name = sysIface->getId(); + cpPriv->isValid = true; + cpPriv->id = sysIface->getUuid(); +// cpPriv->id = ident; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; +//qWarning() << cpPriv->name; + cpPriv->state = getStateForId(cpPriv->id); + + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + + if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { + QString mac = sysIface->getMacAddress(); + if(!mac.length() > 2) { + qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; + QString devPath; + devPath = deviceConnectionPath(mac); + + // qWarning() << Q_FUNC_INFO << devPath; + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(devPath); + cpPriv->serviceInterface = devIface->interface(); + QNetworkManagerInterfaceDeviceWired *devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + cpPriv->internet = devWiredIface->carrier(); + + // use this mac addy + } else { + cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_3_ETHERNET, cpPriv->id); + } + + cpPriv->internet = true;//sysIface->isAutoConnect(); + + addIt = true; + } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { + QString mac = sysIface->getMacAddress();; + if(!mac.length() > 2) { + qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; + QString devPath; + devPath = deviceConnectionPath(mac); +// qWarning() << Q_FUNC_INFO << devPath; + + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(devPath); + cpPriv->serviceInterface = devIface->interface(); + // use this mac addy + } else { + cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); + } + // cpPriv->serviceInterface = devIface->interface(); + addIt = true; + // get the wifi interface state first.. do we need this? + // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); + } + if(addIt) { + foundConfigurations.append(cpPriv); + configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + } + } //end each connection service + } +} + +void QNmWifiEngine::accessPointConnections() +{ + //qWarning() << Q_FUNC_INFO; + QList list = iface->getDevices(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(path.path()); + if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + QList apList = availableAccessPoints.uniqueKeys(); + + QList::const_iterator i; + for (i = apList.constBegin(); i != apList.constEnd(); ++i) { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); + if(cpPriv->isValid) { + foundConfigurations.append(cpPriv); + // qWarning() << "adding" << cpPriv->name << "to things"; + configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + } + } + } + } +} + +QString QNmWifiEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id); +} + +bool QNmWifiEngine::hasIdentifier(const QString &id) +{ + if (configurationInterface.contains(id)) + return true; + foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { + if (cpPriv->id == id) + return true; + } + return false; +} + +QString QNmWifiEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + QList list = iface->getDevices(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(path.path()); + if(interface == devIface->interface().name()) { + switch(devIface->deviceType()) { + case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: + return QLatin1String("Ethernet"); + break; + case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: + return QLatin1String("WLAN"); + break; + case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: + return QLatin1String("2G"); + break; + case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: + return QLatin1String("CDMA2000"); + break; + default: + break; + }; + } + } + return QString(); +} + +void QNmWifiEngine::connectToId(const QString &id) +{ +// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; + activatingConnectionPath = id; + QStringList connectionSettings = getConnectionPathForId(id); + if(connectionSettings.isEmpty()) { + emit connectionError(id, OperationNotSupported); + return; + } + + QDBusObjectPath connectionPath(connectionSettings.at(1)); + QString interface = getInterfaceFromId(id); + + interface = QNetworkInterface::interfaceFromName(interface).hardwareAddress().toLower(); + QString devPath; + devPath = deviceConnectionPath(interface); + QDBusObjectPath devicePath(devPath); + + iface = new QNetworkManagerInterface(); + iface->activateConnection( + connectionSettings.at(0), + connectionPath, + devicePath, + connectionPath); + + connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), + this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); +} + +void QNmWifiEngine::disconnectFromId(const QString &id) +{ + QString activeConnectionPath = getActiveConnectionPath(id); + //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; + + if (!activeConnectionPath.isEmpty()) { + QNetworkManagerConnectionActive *activeCon; + activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); + QNetworkManagerSettingsConnection *settingsCon; + settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); + + if(settingsCon->isAutoConnect()) { +// qWarning() << id << "is autoconnect"; + emit connectionError(id, OperationNotSupported); + //unsupported + } else { +// qWarning() <deactivateConnection(dbpath); + activatingConnectionPath = ""; + } + } +} + +void QNmWifiEngine::requestUpdate() +{ + updated = false; + knownSsids.clear(); + availableAccessPoints.clear(); + emitConfigurationsChanged(); +} + +QNmWifiEngine *QNmWifiEngine::instance() +{ + QDBusConnection dbusConnection = QDBusConnection::systemBus(); + if (dbusConnection.isConnected()) { + QDBusConnectionInterface *dbiface = dbusConnection.interface(); + QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); + if (reply.isValid() && reply.value()) + return nmWifiEngine(); + } + + return 0; +} + +void QNmWifiEngine::getKnownSsids() +{ + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; +//qWarning() << Q_FUNC_INFO; + foreach (QString service, connectionServices) { + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(service, path.path()); +// qWarning() << sysIface->getSsid(); + knownSsids << sysIface->getSsid(); + } + } +} + +void QNmWifiEngine::getActiveConnectionsPaths() +{ +// qWarning() << Q_FUNC_INFO; + QNetworkManagerInterface *dbIface; + activeConnectionPaths.clear(); + dbIface = new QNetworkManagerInterface; + QList connections = dbIface->activeConnections(); + + foreach(QDBusObjectPath conpath, connections) { + activeConnectionPaths << conpath.path(); +// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); + + QNetworkManagerConnectionActive *activeConn; + activeConn = new QNetworkManagerConnectionActive(conpath.path()); + +// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); + + } +} + +QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) +{ //foreach accessPoint + //qWarning() << Q_FUNC_INFO << iPath << path.path(); + + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(iPath); + QNetworkManagerInterfaceDeviceWireless *devWirelessIface; + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); + + QString activeAPPath = devWirelessIface->activeAccessPoint().path(); + + QNetworkManagerInterfaceAccessPoint *accessPointIface; + accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + + QString ident = accessPointIface->connectionInterface()->path(); + quint32 nmState = devIface->state(); + + QString ssid = accessPointIface->ssid(); + QString hwAddy = accessPointIface->hwAddress(); + QString sInterface = devIface->interface().name(); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + bool addIt = true; + //qWarning() << availableAccessPoints.count() << ssid; + +// if(availableAccessPoints.contains(ssid)) { +// addIt = false; +// +// } +// foreach (QNetworkConfigurationPrivate *cpPriv, foundConfigurations) { +// if (cpPriv->name == ssid) { //weed out duplicate ssid's ?? +// addIt = false; +// break; +// } +// } + + if(addIt) { + + cpPriv->name = ssid; + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->serviceInterface = devIface->interface(); + + //qWarning() <<__FUNCTION__ << ssid; + + cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); + + if(activeAPPath == accessPointIface->connectionInterface()->path()) { + cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Active); + } + if(accessPointIface->flags() == NM_802_11_AP_FLAGS_PRIVACY) + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + else + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + return cpPriv; + } else { + cpPriv->isValid = false; + } + return cpPriv; +} + + + QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) +{ + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; +//qWarning() << nmState << knownSsids; + // this is the state of the wifi device interface + if(isKnown) + state = ( QNetworkConfiguration::Defined); + + switch(nmState) { //device interface state, not AP state + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_UNMANAGED: + case NM_DEVICE_STATE_UNAVAILABLE: + state = (QNetworkConfiguration::Undefined); + break; + case NM_DEVICE_STATE_DISCONNECTED: + { + if(isKnown) + state = ( state | QNetworkConfiguration::Discovered); + } + break; + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + if(isKnown) + state = ( state | QNetworkConfiguration::Discovered); + break; + case NM_DEVICE_STATE_ACTIVATED: + { + if(isKnown) + state = ( state | QNetworkConfiguration::Discovered); + } + break; + }; + return state; +} + +QString QNmWifiEngine::getActiveConnectionPath(const QString &id) +{ + //qWarning() << Q_FUNC_INFO << id; + QStringList connectionSettings = getConnectionPathForId(id); + //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); + QNetworkManagerInterface * ifaceD; + ifaceD = new QNetworkManagerInterface(); + QList connections = ifaceD->activeConnections(); + foreach(QDBusObjectPath path, connections) { + QNetworkManagerConnectionActive *conDetailsD; + conDetailsD = new QNetworkManagerConnectionActive( path.path()); + if(conDetailsD->connection().path() == connectionSettings.at(1) + && conDetailsD->serviceName() == connectionSettings.at(0)) + return path.path(); + } + return QString(); +} + + QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) + { +// qWarning() << Q_FUNC_INFO << nmstate; + QNetworkConfiguration::StateFlags flag; + switch (nmstate) { + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_FAILED: + case NM_DEVICE_STATE_UNMANAGED: + flag = (QNetworkConfiguration::Undefined); + break; + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + case NM_DEVICE_STATE_UNAVAILABLE: + flag = (QNetworkConfiguration::Defined); + break; + case NM_DEVICE_STATE_DISCONNECTED: + flag = ( flag | QNetworkConfiguration::Discovered ); + break; + case NM_DEVICE_STATE_ACTIVATED: + { + flag = ( flag | QNetworkConfiguration::Discovered + | QNetworkConfiguration::Active ); + } + break; + default: + flag = ( QNetworkConfiguration::Defined); + break; + }; + return flag; + } + +void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) +{ +// qWarning() << Q_FUNC_INFO << path << nmState; + + if(nmState == NM_DEVICE_STATE_ACTIVATED + || nmState == NM_DEVICE_STATE_DISCONNECTED + || nmState == NM_DEVICE_STATE_UNAVAILABLE + || nmState == NM_DEVICE_STATE_FAILED) { + +/* InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, +*/ +// qWarning() << Q_FUNC_INFO << ident; + QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); + switch (nmState) { + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_FAILED: + state = (QNetworkConfiguration::Undefined); + emit connectionError(activatingConnectionPath, ConnectError); + requestUpdate(); +// qWarning() << Q_FUNC_INFO; + break; + case NM_DEVICE_STATE_UNAVAILABLE: + state = (QNetworkConfiguration::Defined); +// emit connectionError(activatingConnectionPath, ConnectError); + requestUpdate(); + break; + case NM_DEVICE_STATE_DISCONNECTED: + state = ( state | QNetworkConfiguration::Discovered ); + requestUpdate(); + break; + case NM_DEVICE_STATE_ACTIVATED: + { + state = ( state | QNetworkConfiguration::Discovered + | QNetworkConfiguration::Active ); + requestUpdate(); + } + break; + default: + state = ( QNetworkConfiguration::Defined); + break; + }; + } +} + +void QNmWifiEngine::addDevice(QDBusObjectPath path) +{ + //qWarning() << Q_FUNC_INFO << path.path(); + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface->setConnections(); + connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), + this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); + + if(!devicePaths.contains(path.path())) + devicePaths << path.path(); + + switch(devIface->deviceType()) { + case DEVICE_TYPE_802_3_ETHERNET: + { + QNetworkManagerInterfaceDeviceWired * devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + devWiredIface->setConnections(); + connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), + this,SLOT(cmpPropertiesChanged( const QString &, QMap))); + requestUpdate(); + } + break; + case DEVICE_TYPE_802_11_WIRELESS: + { + QNetworkManagerInterfaceDeviceWireless *devWirelessIface; + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + devWirelessIface->setConnections(); + + connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), + this,SLOT(cmpPropertiesChanged( const QString &, QMap))); + + connect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), + this,SLOT(accessPointAdded(const QString &,QDBusObjectPath))); + + connect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), + this,SLOT(accessPointRemoved(const QString &,QDBusObjectPath))); + requestUpdate(); + + } + break; + default: + break; + }; +} + +void QNmWifiEngine::removeDevice(QDBusObjectPath /*path*/) +{ +// qWarning() << Q_FUNC_INFO << path.path(); +// disconnect(devIface,SIGNAL(stateChanged(const QString &, quint32)), +// this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); +// +// if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { +// // devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); +// // devWirelessIface->setConnections(); +// +// disconnect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), +// this,SIGNAL(cmpPropertiesChanged( const QString &, QMap))); +// +// disconnect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), +// this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); +// +// disconnect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), +// this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); +// +// } +} +void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap map) +{ + QMapIterator i(map); + while (i.hasNext()) { + i.next(); +// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); + if( i.key() == "State") { //only applies to device interfaces + updateDeviceInterfaceState(path, i.value().toUInt()); + } + if( i.key() == "ActiveAccessPoint") { + } + if( i.key() == "Carrier") { //someone got plugged in + // requestUpdate(); + } + } +} + +void QNmWifiEngine::accessPointRemoved( const QString &aPath, QDBusObjectPath /*oPath*/) +{ + //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); + + if(aPath.contains("devices")) { + requestUpdate(); + } +} + +void QNmWifiEngine::accessPointAdded( const QString &aPath, QDBusObjectPath oPath) +{ + //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv = addAccessPoint( aPath, oPath); + requestUpdate(); +} + +QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id) +{ + //qWarning() << Q_FUNC_INFO << id; + bool isAvailable = false; + QStringList conPath = getConnectionPathForId(id); + QString aconpath = getActiveConnectionPath(id); + + //qWarning() << Q_FUNC_INFO << id << aconpath; + + if(!aconpath.isEmpty()) { + //active connection + QNetworkManagerConnectionActive *aConn; + aConn = new QNetworkManagerConnectionActive(aconpath); + + QList devs = aConn->devices(); + + foreach(QDBusObjectPath dev, devs) { + //qWarning() << "foreach" << dev.path(); + QNetworkManagerInterfaceDevice *ifaceDevice; + ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); + + if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { + + if(isAddressOfConnection(id, ifaceDevice->ip4Address())) { + // this is it! + return getStateFlag(ifaceDevice->state()); + } else { + continue; + } + + if(ifaceDevice->state() == NM_DEVICE_STATE_UNAVAILABLE || + ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { + isAvailable = true; + + QNetworkManagerInterfaceDeviceWired *devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); + if(!devWiredIface->carrier()) + return QNetworkConfiguration::Defined; + } //end eth + } else if(ifaceDevice->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + qWarning() << "FIXME!!!!!!!!!!!!!!!!!"; + } + + return getStateFlag(ifaceDevice->state()); + } + } else { + // not active + //qWarning() << Q_FUNC_INFO << "Not active"; + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); + if(sysIface->isValid()) { + if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { + QString ssid = sysIface->getSsid(); + bool ok = false; + + if(knownSsids.contains(ssid, Qt::CaseSensitive)) { + foreach(QString onessid, knownSsids) { + // qWarning() << ssid << onessid; + if(onessid == ssid && availableAccessPoints.contains(ssid)) { + // qWarning() < devices = aConn->devices(); + foreach(QDBusObjectPath device, devices) { + QNetworkManagerInterfaceDevice *ifaceDevice; + ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); + if(ifaceDevice->ip4Address() == ipaddress) { + return true; + } + } + return false; +} + +QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) +{ + // check active connections first. + QStringList conIdPath = getConnectionPathForId(id); +// qWarning() << Q_FUNC_INFO << id << conIdPath; + + QNetworkInterface interface; + foreach(QString conpath, activeConnectionPaths) { + QNetworkManagerConnectionActive *aConn; + aConn = new QNetworkManagerConnectionActive(conpath); + + if(aConn->connection().path() == conIdPath.at(1) + && aConn->serviceName() == conIdPath.at(0)) { + + QList devs = aConn->devices(); + QNetworkManagerInterfaceDevice *ifaceDevice; + ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one + interface = ifaceDevice->interface(); + return interface; + } + } + +//try guessing + QList list = iface->getDevices(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + if(devIface->deviceType() == type /*&& devIface->managed()*/) { + interface = devIface->interface(); + if(devIface->state() == NM_STATE_DISCONNECTED) { + return interface; + } + } + } + return interface; +} + +quint64 QNmWifiEngine::receivedDataForId(const QString &id) const +{ + if(configurationInterface.count() > 1) + return 0; + quint64 result = 0; + + QString devFile; + devFile = configurationInterface.value(id); + QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); + if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&rx); + in >> result; + rx.close(); + } + return result; +} + +quint64 QNmWifiEngine::sentDataForId(const QString &id) const +{ + if(configurationInterface.count() > 1) + return 0; + quint64 result = 0; + QString devFile; + devFile = configurationInterface.value(id); + + QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); + if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + return result; +} + +void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) +{ + //qWarning() << Q_FUNC_INFO; + requestUpdate(); +} + +void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) +{ + //qWarning() << Q_FUNC_INFO; + requestUpdate(); +} + +void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) +{ + QDBusPendingReply reply = *openCall; + if (reply.isError()) { + qWarning() <<"Error" << reply.error().name() << reply.error().message() + < list = iface->getDevices(); + + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(path.path()); + + if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + +// qWarning() << devIface->connectionInterface()->path(); + + QNetworkManagerInterfaceDeviceWireless *devWirelessIface; + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + ////////////// AccessPoints + QList apList = devWirelessIface->getAccessPoints(); + + foreach(QDBusObjectPath path, apList) { + QNetworkManagerInterfaceAccessPoint *accessPointIface; + accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + QString ssid = accessPointIface->ssid(); + availableAccessPoints.insert(ssid, path); + } + } + } +} + +QString QNmWifiEngine::deviceConnectionPath(const QString &mac) +{ +// qWarning() << __FUNCTION__ << mac; + QString newMac = mac; + newMac = newMac.replace(":","_").toLower(); + //device object path might not contain just mac address + //might contain extra numbers on the end. thanks HAL + foreach(QString device, devicePaths) { + if(device.contains(newMac)) { + newMac = device; + break; + } + } + return newMac; +} + +QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) +{ + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; +//qWarning() << Q_FUNC_INFO; + foreach (QString service, connectionServices) { + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(service, path.path()); +// qWarning() << uuid << sysIface->getUuid(); + if(sysIface->getUuid() == uuid) { +// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); + return QStringList() << service << sysIface->connectionInterface()->path(); + } + } + } + return QStringList(); +} + +#include "moc_qnmwifiengine_unix_p.cpp" + +QTM_END_NAMESPACE + diff --git a/src/network/bearer/qnmwifiengine_unix_p.h b/src/network/bearer/qnmwifiengine_unix_p.h new file mode 100644 index 0000000..1287800 --- /dev/null +++ b/src/network/bearer/qnmwifiengine_unix_p.h @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QNMWIFIENGINE_P_H +#define QNMWIFIENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +//#include + +#include +#include +#include +#include + +#include "qnetworksessionengine_p.h" +#include +#include +#include + + + +QTM_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QNmWifiEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QNmWifiEngine(QObject *parent = 0); + ~QNmWifiEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QNmWifiEngine *instance(); + + QStringList knownSsids; + inline void emitConfigurationsChanged() { emit configurationsChanged(); } + QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); + + QStringList getConnectionPathForId(const QString &uuid); + //QString getConnectionPathForId(const QString &name = QString()); + quint64 sentDataForId(const QString &id) const; + quint64 receivedDataForId(const QString &id) const; + +private: + bool updated; + QString activatingConnectionPath; + QStringList activeConnectionPaths; + + + QMap availableAccessPoints; + void scanForAccessPoints(); + + QStringList devicePaths; + + void getActiveConnectionsPaths(); + void getKnownSsids(); + void accessPointConnections(); + void knownConnections(); + void findConnections(); + QString deviceConnectionPath(const QString &mac); + + QList foundConfigurations; + // QHash > allConfigurations; + + QNetworkManagerInterface *iface; + + QNetworkConfiguration::StateFlags getAPState(qint32 vState, bool isKnown); + QNetworkConfiguration::StateFlags getStateFlag(quint32 nmstate); + + QString getActiveConnectionPath(const QString &identifier); + QString getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface); + + QNetworkConfiguration::StateFlags getStateForId(const QString &id); + + QNetworkInterface getBestInterface(quint32 type, const QString &conPath); + + QMap configurationInterface; + + bool isAddressOfConnection(const QString &conPath, quint32 ipaddress); + +private slots: + void updateDeviceInterfaceState(const QString &, quint32); + void addDevice(QDBusObjectPath path); + void removeDevice(QDBusObjectPath path); + +Q_SIGNALS: + void configurationChanged(const QNetworkConfiguration& config); + void updateAccessPointState(const QString &, quint32); +// void slotActivationFinished(QDBusPendingCallWatcher*); + +private slots: + void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); + void accessPointRemoved( const QString &aPath, QDBusObjectPath oPath); + void cmpPropertiesChanged(const QString &, QMap map); + void newConnection(QDBusObjectPath); + void settingsConnectionRemoved(const QString &); + void slotActivationFinished(QDBusPendingCallWatcher*); +}; + +QTM_END_NAMESPACE + +#endif + + diff --git a/tests/auto/qbearertestcommon.h b/tests/auto/qbearertestcommon.h new file mode 100644 index 0000000..3356bd6 --- /dev/null +++ b/tests/auto/qbearertestcommon.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 QBEARERTESTCOMMON_H +#define QBEARERTESTCOMMON_H + +// Will try to wait for the condition while allowing event processing +#define QTRY_VERIFY(__expr) \ + do { \ + const int __step = 50; \ + const int __timeout = 90000; \ + if (!(__expr)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QVERIFY(__expr); \ + } while(0) + +// Will try to wait for the condition while allowing event processing +#define QTRY_COMPARE(__expr, __expected) \ + do { \ + const int __step = 50; \ + const int __timeout = 90000; \ + if ((__expr) != (__expected)) { \ + QTest::qWait(0); \ + } \ + for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \ + QTest::qWait(__step); \ + } \ + QCOMPARE(__expr, __expected); \ + } while(0) + +#endif + diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro new file mode 100644 index 0000000..0b2ed1a --- /dev/null +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -0,0 +1,15 @@ +SOURCES += tst_qnetworkconfigmanager.cpp +HEADERS += ../qbearertestcommon.h +TARGET = tst_qnetworkconfigurationmanager +CONFIG += testcase + +QT = core network + +INCLUDEPATH += ../../../src/bearer + +include(../../../common.pri) +qtAddLibrary(QtBearer) + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp new file mode 100644 index 0000000..796677d --- /dev/null +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -0,0 +1,335 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../qbearertestcommon.h" +#include "qnetworkconfiguration.h" +#include "qnetworkconfigmanager.h" + +#ifdef MAEMO +#include +#include +#endif + +QTM_USE_NAMESPACE +class tst_QNetworkConfigurationManager : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void allConfigurations(); + void defaultConfiguration(); + void configurationFromIdentifier(); + +private: +#ifdef MAEMO + Maemo::IAPConf *iapconf; + Maemo::IAPConf *iapconf2; + Maemo::IAPConf *gprsiap; +#define MAX_IAPS 50 + Maemo::IAPConf *iaps[MAX_IAPS]; + QProcess *icd_stub; +#endif +}; + +void tst_QNetworkConfigurationManager::initTestCase() +{ +#ifdef MAEMO + iapconf = new Maemo::IAPConf("007"); + iapconf->setValue("ipv4_type", "AUTO"); + iapconf->setValue("wlan_wepkey1", "connt"); + iapconf->setValue("wlan_wepdefkey", 1); + iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); + iapconf->setValue("name", "James Bond"); + iapconf->setValue("type", "WLAN_INFRA"); + + gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); + gprsiap->setValue("ask_password", false); + gprsiap->setValue("gprs_accesspointname", "internet"); + gprsiap->setValue("gprs_password", ""); + gprsiap->setValue("gprs_username", ""); + gprsiap->setValue("ipv4_autodns", true); + gprsiap->setValue("ipv4_type", "AUTO"); + gprsiap->setValue("sim_imsi", "244070123456789"); + gprsiap->setValue("name", "MI6"); + gprsiap->setValue("type", "GPRS"); + + iapconf2 = new Maemo::IAPConf("osso.net"); + iapconf2->setValue("ipv4_type", "AUTO"); + iapconf2->setValue("wlan_wepkey1", "osso.net"); + iapconf2->setValue("wlan_wepdefkey", 1); + iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); + iapconf2->setValue("name", "osso.net"); + iapconf2->setValue("type", "WLAN_INFRA"); + iapconf2->setValue("wlan_security", "WEP"); + + /* Create large number of IAPs in the gconf and see what happens */ + fflush(stdout); + printf("Creating %d IAPS: ", MAX_IAPS); + for (int i=0; isetValue("name", QString("test-iap-")+num); + iaps[i]->setValue("type", "WLAN_INFRA"); + iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); + iaps[i]->setValue("wlan_security", "WPA_PSK"); + iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); + printf("."); + fflush(stdout); + } + printf("\n"); + fflush(stdout); + + icd_stub = new QProcess(this); + icd_stub->start("/usr/bin/icd2_stub.py"); + QTest::qWait(1000); + + // Add a known network to scan list that icd2 stub returns + QProcess dbus_send; + // 007 network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); + dbus_send.waitForFinished(); + + // osso.net network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); + dbus_send.waitForFinished(); +#endif +} + + +void tst_QNetworkConfigurationManager::cleanupTestCase() +{ +#ifdef MAEMO + iapconf->clear(); + delete iapconf; + iapconf2->clear(); + delete iapconf2; + gprsiap->clear(); + delete gprsiap; + + printf("Deleting %d IAPS : ", MAX_IAPS); + for (int i=0; iclear(); + delete iaps[i]; + printf("."); + fflush(stdout); + } + printf("\n"); + qDebug() << "Deleted" << MAX_IAPS << "IAPs"; + + icd_stub->terminate(); + icd_stub->waitForFinished(); +#endif +} + +void tst_QNetworkConfigurationManager::init() +{ +} + +void tst_QNetworkConfigurationManager::cleanup() +{ +} + +void printConfigurationDetails(const QNetworkConfiguration& p) +{ + qDebug() << p.name() <<": isvalid->" <"<< p.type() << + " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << + " purpose->" << p.purpose() << " state->" << p.state(); +} + +void tst_QNetworkConfigurationManager::allConfigurations() +{ + QNetworkConfigurationManager manager; + QList preScanConfigs = manager.allConfigurations(); + + foreach(QNetworkConfiguration c, preScanConfigs) + { + QVERIFY2(c.type()!=QNetworkConfiguration::UserChoice, "allConfiguration must not return UserChoice configs"); + } + + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(); + + int all = configs.count(); + qDebug() << "All configurations:" << all; + QVERIFY(all); + foreach(QNetworkConfiguration p, configs) { + QVERIFY(p.isValid()); + printConfigurationDetails(p); + QVERIFY(p.type() != QNetworkConfiguration::Invalid); + QVERIFY(p.type() != QNetworkConfiguration::UserChoice); + } + + configs = manager.allConfigurations(QNetworkConfiguration::Undefined); + int undefined = configs.count(); + QVERIFY(undefined <= all); + qDebug() << "Undefined configurations:" << undefined; + foreach( const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.state() & QNetworkConfiguration::Undefined); + QVERIFY(!(p.state() & QNetworkConfiguration::Defined)); + } + + //get defined configs only (same as all) + configs = manager.allConfigurations(QNetworkConfiguration::Defined); + int defined = configs.count(); + qDebug() << "Defined configurations:" << defined; + QVERIFY(defined <= all); + foreach( const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.state() & QNetworkConfiguration::Defined); + QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); + } + + //get discovered configurations only + configs = manager.allConfigurations(QNetworkConfiguration::Discovered); + int discovered = configs.count(); + //QVERIFY(discovered); + qDebug() << "Discovered configurations:" << discovered; + foreach(const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.isValid()); + QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); + QVERIFY(p.state() & QNetworkConfiguration::Defined); + QVERIFY(p.state() & QNetworkConfiguration::Discovered); + } + + //getactive configurations only + configs = manager.allConfigurations(QNetworkConfiguration::Active); + int active = configs.count(); + if (active) + QVERIFY(manager.isOnline()); + else + QVERIFY(!manager.isOnline()); + + //QVERIFY(active); + qDebug() << "Active configurations:" << active; + foreach(const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.isValid()); + QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); + QVERIFY(p.state() & QNetworkConfiguration::Active); + QVERIFY(p.state() & QNetworkConfiguration::Discovered); + QVERIFY(p.state() & QNetworkConfiguration::Defined); + } + + QVERIFY(all >= discovered); + QVERIFY(discovered >= active); +} + + +void tst_QNetworkConfigurationManager::defaultConfiguration() +{ + QNetworkConfigurationManager manager; + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(); + QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); + + bool confirm = configs.contains(defaultConfig); + bool isUserChoice = (defaultConfig.type() == QNetworkConfiguration::UserChoice); + + //user choice config is not part of allConfigurations() + QVERIFY(isUserChoice != confirm); + if (!isUserChoice) { + QVERIFY(confirm || !defaultConfig.isValid()); + QVERIFY(!(confirm && !defaultConfig.isValid())); + } else { + QVERIFY(defaultConfig.isValid()); + QCOMPARE(defaultConfig.name(), QString("UserChoice")); + QCOMPARE(defaultConfig.children().count(), 0); + QVERIFY(!defaultConfig.isRoamingAvailable()); + QCOMPARE(defaultConfig.state(), QNetworkConfiguration::Discovered); + QNetworkConfiguration copy = manager.configurationFromIdentifier(defaultConfig.identifier()); + QVERIFY(copy == defaultConfig); + } +} + +void tst_QNetworkConfigurationManager::configurationFromIdentifier() +{ + QNetworkConfigurationManager manager; + QSet allIdentifier; + + //force an update to get maximum number of configs + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(); + + foreach(QNetworkConfiguration c, configs) { + QVERIFY(!allIdentifier.contains(c.identifier())); + allIdentifier.insert(c.identifier()); + + QNetworkConfiguration direct = manager.configurationFromIdentifier(c.identifier()); + QVERIFY(direct.isValid()); + QVERIFY(direct == c); + } + + //assume that there is no item with identifier 'FooBar' + QVERIFY(!allIdentifier.contains("FooBar")); + QNetworkConfiguration invalid = manager.configurationFromIdentifier("FooBar"); + QVERIFY(!invalid.isValid()); +} + + +QTEST_MAIN(tst_QNetworkConfigurationManager) +#include "tst_qnetworkconfigmanager.moc" diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro new file mode 100644 index 0000000..61e4097 --- /dev/null +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -0,0 +1,15 @@ +SOURCES += tst_qnetworkconfiguration.cpp +HEADERS += ../qbearertestcommon.h +TARGET = tst_qnetworkconfiguration +CONFIG += testcase + +QT = core network + +INCLUDEPATH += ../../../src/bearer + +include(../../../common.pri) +qtAddLibrary(QtBearer) + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp new file mode 100644 index 0000000..cbb13f3 --- /dev/null +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -0,0 +1,303 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../qbearertestcommon.h" +#include "qnetworkconfiguration.h" +#include "qnetworkconfigmanager.h" + +#ifdef MAEMO +#include +#include +#endif + +QTM_USE_NAMESPACE +class tst_QNetworkConfiguration : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + +private slots: + void invalidPoint(); + void comparison(); + void children(); + void isRoamingAvailable(); + +private: +#ifdef MAEMO + Maemo::IAPConf *iapconf; + Maemo::IAPConf *iapconf2; + Maemo::IAPConf *gprsiap; +#define MAX_IAPS 50 + Maemo::IAPConf *iaps[MAX_IAPS]; + QProcess *icd_stub; +#endif +}; + +void tst_QNetworkConfiguration::initTestCase() +{ +#ifdef MAEMO + iapconf = new Maemo::IAPConf("007"); + iapconf->setValue("ipv4_type", "AUTO"); + iapconf->setValue("wlan_wepkey1", "connt"); + iapconf->setValue("wlan_wepdefkey", 1); + iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); + iapconf->setValue("name", "James Bond"); + iapconf->setValue("type", "WLAN_INFRA"); + + iapconf2 = new Maemo::IAPConf("osso.net"); + iapconf2->setValue("ipv4_type", "AUTO"); + iapconf2->setValue("wlan_wepkey1", "osso.net"); + iapconf2->setValue("wlan_wepdefkey", 1); + iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); + iapconf2->setValue("name", "osso.net"); + iapconf2->setValue("type", "WLAN_INFRA"); + iapconf2->setValue("wlan_security", "WEP"); + + gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); + gprsiap->setValue("ask_password", false); + gprsiap->setValue("gprs_accesspointname", "internet"); + gprsiap->setValue("gprs_password", ""); + gprsiap->setValue("gprs_username", ""); + gprsiap->setValue("ipv4_autodns", true); + gprsiap->setValue("ipv4_type", "AUTO"); + gprsiap->setValue("sim_imsi", "244070123456789"); + gprsiap->setValue("name", "MI6"); + gprsiap->setValue("type", "GPRS"); + + /* Create large number of IAPs in the gconf and see what happens */ + fflush(stdout); + printf("Creating %d IAPS: ", MAX_IAPS); + for (int i=0; isetValue("name", QString("test-iap-")+num); + iaps[i]->setValue("type", "WLAN_INFRA"); + iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); + iaps[i]->setValue("wlan_security", "WPA_PSK"); + iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); + printf("."); + fflush(stdout); + } + printf("\n"); + fflush(stdout); + + icd_stub = new QProcess(this); + icd_stub->start("/usr/bin/icd2_stub.py"); + QTest::qWait(1000); + + // Add a known network to scan list that icd2 stub returns + QProcess dbus_send; + // 007 network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); + dbus_send.waitForFinished(); + + // osso.net network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); + dbus_send.waitForFinished(); +#endif +} + +void tst_QNetworkConfiguration::cleanupTestCase() +{ +#ifdef MAEMO + iapconf->clear(); + delete iapconf; + iapconf2->clear(); + delete iapconf2; + gprsiap->clear(); + delete gprsiap; + + printf("Deleting %d IAPS : ", MAX_IAPS); + for (int i=0; iclear(); + delete iaps[i]; + printf("."); + fflush(stdout); + } + printf("\n"); + qDebug() << "Deleted" << MAX_IAPS << "IAPs"; + + // Terminate icd2 stub + icd_stub->terminate(); + icd_stub->waitForFinished(); +#endif +} + +void tst_QNetworkConfiguration::invalidPoint() +{ + QNetworkConfiguration pt; + + QVERIFY(pt.name().isEmpty()); + QVERIFY(!pt.isValid()); + QVERIFY(pt.type() == QNetworkConfiguration::Invalid); + QVERIFY(!(pt.state() & QNetworkConfiguration::Defined)); + QVERIFY(!(pt.state() & QNetworkConfiguration::Discovered)); + QVERIFY(!(pt.state() & QNetworkConfiguration::Active)); + QVERIFY(!pt.isRoamingAvailable()); + + QNetworkConfiguration pt2(pt); + QVERIFY(pt2.name().isEmpty()); + QVERIFY(!pt2.isValid()); + QVERIFY(pt2.type() == QNetworkConfiguration::Invalid); + QVERIFY(!(pt2.state() & QNetworkConfiguration::Defined)); + QVERIFY(!(pt2.state() & QNetworkConfiguration::Discovered)); + QVERIFY(!(pt2.state() & QNetworkConfiguration::Active)); + QVERIFY(!pt2.isRoamingAvailable()); + +} + +void tst_QNetworkConfiguration::comparison() +{ + //test copy constructor and assignment operator + //compare invalid connection points + QNetworkConfiguration pt1; + QVERIFY(!pt1.isValid()); + QVERIFY(pt1.type() == QNetworkConfiguration::Invalid); + + QNetworkConfiguration pt2(pt1); + QVERIFY(pt1==pt2); + QVERIFY(!(pt1!=pt2)); + QVERIFY(pt1.name() == pt2.name()); + QVERIFY(pt1.isValid() == pt2.isValid()); + QVERIFY(pt1.type() == pt2.type()); + QVERIFY(pt1.state() == pt2.state()); + QVERIFY(pt1.purpose() == pt2.purpose()); + + + QNetworkConfiguration pt3; + pt3 = pt1; + QVERIFY(pt1==pt3); + QVERIFY(!(pt1!=pt3)); + QVERIFY(pt1.name() == pt3.name()); + QVERIFY(pt1.isValid() == pt3.isValid()); + QVERIFY(pt1.type() == pt3.type()); + QVERIFY(pt1.state() == pt3.state()); + QVERIFY(pt1.purpose() == pt3.purpose()); + + //test case must run on machine that has valid connection points + QNetworkConfigurationManager manager; + QList preScanConfigs = manager.allConfigurations(); + + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(QNetworkConfiguration::Discovered); + QVERIFY(configs.count()); + QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); + QVERIFY(defaultConfig.isValid()); + QVERIFY(defaultConfig.type() != QNetworkConfiguration::Invalid); + QVERIFY(!defaultConfig.name().isEmpty()); + + pt3 = defaultConfig; + QVERIFY(defaultConfig==pt3); + QVERIFY(!(defaultConfig!=pt3)); + QVERIFY(defaultConfig.name() == pt3.name()); + QVERIFY(defaultConfig.isValid() == pt3.isValid()); + QVERIFY(defaultConfig.type() == pt3.type()); + QVERIFY(defaultConfig.state() == pt3.state()); + QVERIFY(defaultConfig.purpose() == pt3.purpose()); +} + +void tst_QNetworkConfiguration::children() +{ + QNetworkConfigurationManager manager; + QList configs = manager.allConfigurations(); + + foreach(QNetworkConfiguration c, configs) + { + if ( c.type() == QNetworkConfiguration::ServiceNetwork ) { + qDebug() << "found service network" << c.name() << c.children().count(); + QVERIFY(c.isValid()); + QList members = c.children(); + foreach(QNetworkConfiguration child, members) { + QVERIFY(child.isValid()); + QVERIFY(configs.contains(child)); + qDebug() << "\t" << child.name(); + } + } + } +} + +void tst_QNetworkConfiguration::isRoamingAvailable() +{ + QNetworkConfigurationManager manager; + QList configs = manager.allConfigurations(); + + //force update to get maximum list + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + foreach(QNetworkConfiguration c, configs) + { + QVERIFY(QNetworkConfiguration::UserChoice != c.type()); + QVERIFY(QNetworkConfiguration::Invalid != c.type()); + if ( c.type() == QNetworkConfiguration::ServiceNetwork ) { + //cannot test flag as some SNAPs may not support roaming anyway + //QVERIFY(c.roamingavailable()) + if ( c.children().count() <= 1 ) + QVERIFY(!c.isRoamingAvailable()); + foreach(QNetworkConfiguration child, c.children()) { + QVERIFY(QNetworkConfiguration::InternetAccessPoint == child.type()); + QCOMPARE(child.children().count(), 0); + } + } else { + QVERIFY(!c.isRoamingAvailable()); + } + } +} + +QTEST_MAIN(tst_QNetworkConfiguration) +#include "tst_qnetworkconfiguration.moc" diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro new file mode 100644 index 0000000..4cb8555 --- /dev/null +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -0,0 +1,12 @@ +SOURCES += main.cpp +TARGET = qnetworksessionlackey +INCLUDEPATH += ../../../../src/bearer +DEPENDPATH += ../../../../src/bearer + +QT = core network + +CONFIG+= testcase + +include(../../../../common.pri) + +qtAddLibrary(QtBearer) diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp new file mode 100644 index 0000000..53f6f4f --- /dev/null +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include + +QTM_USE_NAMESPACE + + +#define NO_DISCOVERED_CONFIGURATIONS_ERROR 1 +#define SESSION_OPEN_ERROR 2 + +int main(int argc, char** argv) +{ + QCoreApplication app(argc, argv); + + QNetworkConfigurationManager manager; + QList discovered = + manager.allConfigurations(QNetworkConfiguration::Discovered); + + if (discovered.isEmpty()) + return NO_DISCOVERED_CONFIGURATIONS_ERROR; + + // Cannot read/write to processes on WinCE or Symbian. + // Easiest alternative is to use sockets for IPC. + + QLocalSocket oopSocket; + + oopSocket.connectToServer("tst_qnetworksession"); + oopSocket.waitForConnected(-1); + + qDebug() << "Lackey started"; + + QNetworkSession *session = 0; + do { + if (session) { + delete session; + session = 0; + } + + qDebug() << "Discovered configurations:" << discovered.count(); + + if (discovered.isEmpty()) { + qDebug() << "No more configurations"; + break; + } + + qDebug() << "Taking first configuration"; + + QNetworkConfiguration config = discovered.takeFirst(); + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + qDebug() << config.name() << "is active"; + continue; + } + + qDebug() << "Creating session for" << config.name() << config.identifier(); + + session = new QNetworkSession(config); + + QString output = QString("Starting session for %1\n").arg(config.identifier()); + oopSocket.write(output.toAscii()); + oopSocket.waitForBytesWritten(); + + session->open(); + session->waitForOpened(); + } while (!(session && session->isActive())); + + qDebug() << "loop done"; + + if (!session) { + qDebug() << "Could not start session"; + + oopSocket.disconnectFromServer(); + oopSocket.waitForDisconnected(-1); + + return SESSION_OPEN_ERROR; + } + + QString output = QString("Started session for %1\n").arg(session->configuration().identifier()); + oopSocket.write(output.toAscii()); + oopSocket.waitForBytesWritten(); + + oopSocket.waitForReadyRead(); + oopSocket.readLine(); + + session->stop(); + + delete session; + + oopSocket.disconnectFromServer(); + oopSocket.waitForDisconnected(-1); + + return 0; +} diff --git a/tests/auto/qnetworksession/qnetworksession.pro b/tests/auto/qnetworksession/qnetworksession.pro new file mode 100644 index 0000000..14dbb3e --- /dev/null +++ b/tests/auto/qnetworksession/qnetworksession.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = lackey tst_qnetworksession diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp new file mode 100644 index 0000000..cbd4c8f --- /dev/null +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -0,0 +1,873 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "../../qbearertestcommon.h" +#include +#include + +#ifdef MAEMO +#include +#include +#endif + +QTM_USE_NAMESPACE + +Q_DECLARE_METATYPE(QNetworkConfiguration) +Q_DECLARE_METATYPE(QNetworkSession::State); +Q_DECLARE_METATYPE(QNetworkSession::SessionError); + +class tst_QNetworkSession : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + +private slots: + void invalidSession(); + + void sessionProperties_data(); + void sessionProperties(); + + void userChoiceSession_data(); + void userChoiceSession(); + + void sessionOpenCloseStop_data(); + void sessionOpenCloseStop(); + + void outOfProcessSession(); + +private: + QNetworkConfigurationManager manager; + + uint inProcessSessionManagementCount; + +#ifdef MAEMO + Maemo::IAPConf *iapconf; + Maemo::IAPConf *iapconf2; + Maemo::IAPConf *gprsiap; +#define MAX_IAPS 10 + Maemo::IAPConf *iaps[MAX_IAPS]; + QProcess *icd_stub; +#endif +}; + +void tst_QNetworkSession::initTestCase() +{ + qRegisterMetaType("QNetworkSession::State"); + qRegisterMetaType("QNetworkSession::SessionError"); + qRegisterMetaType("QNetworkConfiguration"); + +#ifdef MAEMO + iapconf = new Maemo::IAPConf("007"); + iapconf->setValue("ipv4_type", "AUTO"); + iapconf->setValue("wlan_wepkey1", "connt"); + iapconf->setValue("wlan_wepdefkey", 1); + iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); + iapconf->setValue("name", "James Bond"); + iapconf->setValue("type", "WLAN_INFRA"); + + gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); + gprsiap->setValue("ask_password", false); + gprsiap->setValue("gprs_accesspointname", "internet"); + gprsiap->setValue("gprs_password", ""); + gprsiap->setValue("gprs_username", ""); + gprsiap->setValue("ipv4_autodns", true); + gprsiap->setValue("ipv4_type", "AUTO"); + gprsiap->setValue("sim_imsi", "244070123456789"); + gprsiap->setValue("name", "MI6"); + gprsiap->setValue("type", "GPRS"); + + iapconf2 = new Maemo::IAPConf("osso.net"); + iapconf2->setValue("ipv4_type", "AUTO"); + iapconf2->setValue("wlan_wepkey1", "osso.net"); + iapconf2->setValue("wlan_wepdefkey", 1); + iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); + iapconf2->setValue("name", "osso.net"); + iapconf2->setValue("type", "WLAN_INFRA"); + iapconf2->setValue("wlan_security", "WEP"); + + /* Create large number of IAPs in the gconf and see what happens */ + fflush(stdout); + printf("Creating %d IAPS: ", MAX_IAPS); + for (int i=0; isetValue("name", QString("test-iap-")+num); + iaps[i]->setValue("type", "WLAN_INFRA"); + iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); + iaps[i]->setValue("wlan_security", "WPA_PSK"); + iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); + printf("."); + fflush(stdout); + } + printf("\n"); + fflush(stdout); + + icd_stub = new QProcess(this); + icd_stub->start("/usr/bin/icd2_stub.py"); + QTest::qWait(1000); + + // Add a known network to scan list that icd2 stub returns + QProcess dbus_send; + // 007 network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); + dbus_send.waitForFinished(); + + // osso.net network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); + dbus_send.waitForFinished(); +#endif + + inProcessSessionManagementCount = 0; + + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); + QTRY_VERIFY(spy.count() == 1); +} + +void tst_QNetworkSession::cleanupTestCase() +{ + if (!(manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport) && + (manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces) && + inProcessSessionManagementCount == 0) { + QFAIL("No usable configurations found to complete all possible " + "tests in inProcessSessionManagement()"); + } + +#ifdef MAEMO + iapconf->clear(); + delete iapconf; + iapconf2->clear(); + delete iapconf2; + gprsiap->clear(); + delete gprsiap; + + printf("Deleting %d IAPS : ", MAX_IAPS); + for (int i=0; iclear(); + delete iaps[i]; + printf("."); + fflush(stdout); + } + printf("\n"); + qDebug() << "Deleted" << MAX_IAPS << "IAPs"; + + icd_stub->terminate(); + icd_stub->waitForFinished(); +#endif +} + +void tst_QNetworkSession::invalidSession() +{ + QNetworkSession session(QNetworkConfiguration(), 0); + QVERIFY(!session.isActive()); + QVERIFY(session.state() == QNetworkSession::Invalid); +} + +void tst_QNetworkSession::sessionProperties_data() +{ + QTest::addColumn("configuration"); + + QTest::newRow("invalid configuration") << QNetworkConfiguration(); + + foreach (const QNetworkConfiguration &config, manager.allConfigurations()) { + const QString name = config.name().isEmpty() ? QString("") : config.name(); + QTest::newRow(name.toLocal8Bit().constData()) << config; + } +} + +void tst_QNetworkSession::sessionProperties() +{ + QFETCH(QNetworkConfiguration, configuration); + + QNetworkSession session(configuration); + + QVERIFY(session.configuration() == configuration); + + QStringList validBearerNames = QStringList() << QString() + << QLatin1String("Ethernet") + << QLatin1String("WLAN") + << QLatin1String("2G") + << QLatin1String("CDMA2000") + << QLatin1String("WCDMA") + << QLatin1String("HSPA") + << QLatin1String("Bluetooth") + << QLatin1String("WiMAX"); + + if (!configuration.isValid()) + QVERIFY(session.bearerName().isEmpty()); + else + QVERIFY(validBearerNames.contains(session.bearerName())); + + // QNetworkSession::interface() should return an invalid interface unless + // session is in the connected state. + QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); + + if (!configuration.isValid()) { + QVERIFY(configuration.state() == QNetworkConfiguration::Undefined && + session.state() == QNetworkSession::Invalid); + } else { + switch (configuration.state()) { + case QNetworkConfiguration::Undefined: + QVERIFY(session.state() == QNetworkSession::NotAvailable); + break; + case QNetworkConfiguration::Defined: + QVERIFY(session.state() == QNetworkSession::NotAvailable); + break; + case QNetworkConfiguration::Discovered: + QVERIFY(session.state() == QNetworkSession::Connecting || + session.state() == QNetworkSession::Disconnected); + break; + case QNetworkConfiguration::Active: + QVERIFY(session.state() == QNetworkSession::Connected || + session.state() == QNetworkSession::Closing || + session.state() == QNetworkSession::Roaming); + break; + default: + QFAIL("Invalid configuration state"); + }; + } +} + +void tst_QNetworkSession::userChoiceSession_data() +{ + QTest::addColumn("configuration"); + + QNetworkConfiguration config = manager.defaultConfiguration(); + if (config.type() == QNetworkConfiguration::UserChoice) + QTest::newRow("UserChoice") << config; + else + QSKIP("Default configuration is not a UserChoice configuration.", SkipAll); +} + +void tst_QNetworkSession::userChoiceSession() +{ + QFETCH(QNetworkConfiguration, configuration); + + QVERIFY(configuration.type() == QNetworkConfiguration::UserChoice); + + QNetworkSession session(configuration); + + QVERIFY(session.configuration() == configuration); + + QVERIFY(!session.isActive()); + + QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString().isEmpty()); + + + // The remaining tests require the session to be not NotAvailable. + if (session.state() == QNetworkSession::NotAvailable) + QSKIP("Network is not available.", SkipSingle); + + QSignalSpy sessionOpenedSpy(&session, SIGNAL(opened())); + QSignalSpy sessionClosedSpy(&session, SIGNAL(closed())); + QSignalSpy stateChangedSpy(&session, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError))); + + // Test opening the session. + { + bool expectStateChange = session.state() != QNetworkSession::Connected; + + session.open(); + + session.waitForOpened(); + + if (session.isActive()) + QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); + if (!errorSpy.isEmpty()) { + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring up the interface, + // but the operation is not supported. + QSKIP("Configuration does not support open().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring up the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to open session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else if (error == QNetworkSession::UnknownSessionError) { + QSKIP("Unknown session error.", SkipSingle); + } else { + QFAIL("Error opening session."); + } + } else if (!sessionOpenedSpy.isEmpty()) { + QCOMPARE(sessionOpenedSpy.count(), 1); + QVERIFY(sessionClosedSpy.isEmpty()); + QVERIFY(errorSpy.isEmpty()); + + if (expectStateChange) + QTRY_VERIFY(!stateChangedSpy.isEmpty()); + + QVERIFY(session.state() == QNetworkSession::Connected); + QVERIFY(session.interface().isValid()); + + const QString userChoiceIdentifier = + session.sessionProperty("UserChoiceConfigurationIdentifier").toString(); + + QVERIFY(!userChoiceIdentifier.isEmpty()); + QVERIFY(userChoiceIdentifier != configuration.identifier()); + + QNetworkConfiguration userChoiceConfiguration = + manager.configurationFromIdentifier(userChoiceIdentifier); + + QVERIFY(userChoiceConfiguration.isValid()); + QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice); + + const QString testIdentifier("abc"); + //resetting UserChoiceConfigurationIdentifier is ignored (read only property) + session.setSessionProperty("UserChoiceConfigurationIdentifier", testIdentifier); + QVERIFY(session.sessionProperty("UserChoiceConfigurationIdentifier").toString() != testIdentifier); + + const QString activeIdentifier = + session.sessionProperty("ActiveConfigurationIdentifier").toString(); + + QVERIFY(!activeIdentifier.isEmpty()); + QVERIFY(activeIdentifier != configuration.identifier()); + + QNetworkConfiguration activeConfiguration = + manager.configurationFromIdentifier(activeIdentifier); + + QVERIFY(activeConfiguration.isValid()); + QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint); + + //resetting ActiveConfigurationIdentifier is ignored (read only property) + session.setSessionProperty("ActiveConfigurationIdentifier", testIdentifier); + QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString() != testIdentifier); + + if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) { + QVERIFY(userChoiceConfiguration == activeConfiguration); + } else { + QVERIFY(userChoiceConfiguration.type() == QNetworkConfiguration::ServiceNetwork); + QVERIFY(userChoiceConfiguration.children().contains(activeConfiguration)); + } + } else { + QFAIL("Timeout waiting for session to open."); + } + } +} + +void tst_QNetworkSession::sessionOpenCloseStop_data() +{ + QTest::addColumn("configuration"); + QTest::addColumn("forceSessionStop"); + + foreach (const QNetworkConfiguration &config, manager.allConfigurations()) { + const QString name = config.name().isEmpty() ? QString("") : config.name(); + QTest::newRow((name + QLatin1String(" close")).toLocal8Bit().constData()) + << config << false; + QTest::newRow((name + QLatin1String(" stop")).toLocal8Bit().constData()) + << config << true; + } +} + +void tst_QNetworkSession::sessionOpenCloseStop() +{ + QFETCH(QNetworkConfiguration, configuration); + QFETCH(bool, forceSessionStop); + + QNetworkSession session(configuration); + + // Test initial state of the session. + { + QVERIFY(session.configuration() == configuration); + QVERIFY(!session.isActive()); + // session may be invalid if configuration is removed between when + // sessionOpenCloseStop_data() is called and here. + QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) || + (!configuration.isValid() && (session.state() == QNetworkSession::Invalid))); + QVERIFY(session.error() == QNetworkSession::UnknownSessionError); + } + + // The remaining tests require the session to be not NotAvailable. + if (session.state() == QNetworkSession::NotAvailable) + QSKIP("Network is not available.", SkipSingle); + + QSignalSpy sessionOpenedSpy(&session, SIGNAL(opened())); + QSignalSpy sessionClosedSpy(&session, SIGNAL(closed())); + QSignalSpy stateChangedSpy(&session, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError))); + + // Test opening the session. + { + QNetworkSession::State previousState = session.state(); + bool expectStateChange = previousState != QNetworkSession::Connected; + + session.open(); + + session.waitForOpened(); + + if (session.isActive()) + QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); + if (!errorSpy.isEmpty()) { + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + + QVERIFY(session.state() == previousState); + + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring up the interface, + // but the operation is not supported. + QSKIP("Configuration does not support open().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring up the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to open session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else if (error == QNetworkSession::UnknownSessionError) { + QSKIP("Unknown Session error.", SkipSingle); + } else { + QFAIL("Error opening session."); + } + } else if (!sessionOpenedSpy.isEmpty()) { + QCOMPARE(sessionOpenedSpy.count(), 1); + QVERIFY(sessionClosedSpy.isEmpty()); + QVERIFY(errorSpy.isEmpty()); + + if (expectStateChange) { + QTRY_VERIFY(stateChangedSpy.count() >= 2); + + QNetworkSession::State state = + qvariant_cast(stateChangedSpy.at(0).at(0)); + QVERIFY(state == QNetworkSession::Connecting); + + state = qvariant_cast(stateChangedSpy.at(1).at(0)); + QVERIFY(state == QNetworkSession::Connected); + } + + QVERIFY(session.state() == QNetworkSession::Connected); + QVERIFY(session.interface().isValid()); + } else { + QFAIL("Timeout waiting for session to open."); + } + } + + sessionOpenedSpy.clear(); + sessionClosedSpy.clear(); + stateChangedSpy.clear(); + errorSpy.clear(); + + QNetworkSession session2(configuration); + + QSignalSpy sessionOpenedSpy2(&session2, SIGNAL(opened())); + QSignalSpy sessionClosedSpy2(&session2, SIGNAL(closed())); + QSignalSpy stateChangedSpy2(&session2, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy errorSpy2(&session2, SIGNAL(error(QNetworkSession::SessionError))); + + // Test opening a second session. + { + QVERIFY(session2.configuration() == configuration); + QVERIFY(!session2.isActive()); + QVERIFY(session2.state() == QNetworkSession::Connected); + QVERIFY(session.error() == QNetworkSession::UnknownSessionError); + + session2.open(); + + QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); + + QVERIFY(session.isActive()); + QVERIFY(session2.isActive()); + QVERIFY(session.state() == QNetworkSession::Connected); + QVERIFY(session2.state() == QNetworkSession::Connected); + QVERIFY(session.interface().isValid()); + QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); + QCOMPARE(session.interface().index(), session2.interface().index()); + } + + sessionOpenedSpy2.clear(); + + if (forceSessionStop) { + // Test forcing the second session to stop the interface. + QNetworkSession::State previousState = session.state(); +#ifdef Q_CC_NOKIAX86 + // For S60 emulator builds: RConnection::Stop does not work on all Emulators + bool expectStateChange = false; +#else + bool expectStateChange = previousState != QNetworkSession::Disconnected; +#endif + + session2.stop(); + + QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); + + QVERIFY(!session2.isActive()); + + if (!errorSpy2.isEmpty()) { + QVERIFY(!errorSpy.isEmpty()); + + // check for SessionAbortedError + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + QNetworkSession::SessionError error2 = + qvariant_cast(errorSpy2.first().at(0)); + + QVERIFY(error == QNetworkSession::SessionAbortedError); + QVERIFY(error2 == QNetworkSession::SessionAbortedError); + + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorSpy2.count(), 1); + + errorSpy.clear(); + errorSpy2.clear(); + } + + QVERIFY(errorSpy.isEmpty()); + QVERIFY(errorSpy2.isEmpty()); + + if (expectStateChange) + QTRY_VERIFY(stateChangedSpy2.count() >= 2 || !errorSpy2.isEmpty()); + + if (!errorSpy2.isEmpty()) { + QVERIFY(session2.state() == previousState); + QVERIFY(session.state() == previousState); + + QNetworkSession::SessionError error = + qvariant_cast(errorSpy2.first().at(0)); + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring down the interface, + // but the operation is not supported. + QSKIP("Configuration does not support stop().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring down the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to stop session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else { + QFAIL("Error stopping session."); + } + } else if (!sessionClosedSpy2.isEmpty()) { + if (expectStateChange) { + if (configuration.type() == QNetworkConfiguration::ServiceNetwork) { + bool roamedSuccessfully = false; + + QCOMPARE(stateChangedSpy2.count(), 4); + + QNetworkSession::State state = + qvariant_cast(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Connecting); + + state = qvariant_cast(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Connected); + + state = qvariant_cast(stateChangedSpy2.at(2).at(0)); + QVERIFY(state == QNetworkSession::Closing); + + state = qvariant_cast(stateChangedSpy2.at(3).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + + QTRY_VERIFY(stateChangedSpy.count() > 0); + state = qvariant_cast(stateChangedSpy.at(0).at(0)); + if (state == QNetworkSession::Roaming) { + QTRY_VERIFY(!errorSpy.isEmpty() || stateChangedSpy.count() > 1); + if (stateChangedSpy.count() > 1) { + state = qvariant_cast(stateChangedSpy.at(1).at(0)); + if (state == QNetworkSession::Connected) { + roamedSuccessfully = true; + QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); + } + } + } + if (roamedSuccessfully) { + QString configId = session.sessionProperty("ActiveConfigurationIdentifier").toString(); + QNetworkConfiguration config = manager.configurationFromIdentifier(configId); + QNetworkSession session3(config); + QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); + QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened())); + + session3.open(); + session3.waitForOpened(); + + if (session.isActive()) + QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); + + session.stop(); + + QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); + QTRY_VERIFY(session3.state() == QNetworkSession::Disconnected); + } +#ifndef Q_CC_NOKIAX86 + if (!roamedSuccessfully) + QVERIFY(!errorSpy.isEmpty()); +#endif + } else { + QCOMPARE(stateChangedSpy2.count(), 2); + + QNetworkSession::State state = + qvariant_cast(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Closing); + + state = qvariant_cast(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + } + + QTRY_VERIFY(!sessionClosedSpy.isEmpty()); + QVERIFY(session.state() == QNetworkSession::Disconnected); + QVERIFY(session2.state() == QNetworkSession::Disconnected); + } + + QVERIFY(errorSpy2.isEmpty()); + + ++inProcessSessionManagementCount; + } else { + QFAIL("Timeout waiting for session to stop."); + } + +#ifndef Q_CC_NOKIAX86 + QVERIFY(!sessionClosedSpy.isEmpty()); +#endif + QVERIFY(!sessionClosedSpy2.isEmpty()); + +#ifndef Q_CC_NOKIAX86 + QVERIFY(!session.isActive()); +#endif + QVERIFY(!session2.isActive()); + } else { + // Test closing the second session. + { + int stateChangedCountBeforeClose = stateChangedSpy2.count(); + session2.close(); + + QTRY_VERIFY(!sessionClosedSpy2.isEmpty()); +#ifndef Q_CC_NOKIAX86 + QVERIFY(stateChangedSpy2.count() == stateChangedCountBeforeClose); +#endif + + QVERIFY(sessionClosedSpy.isEmpty()); + + QVERIFY(session.isActive()); + QVERIFY(!session2.isActive()); + QVERIFY(session.state() == QNetworkSession::Connected); + QVERIFY(session2.state() == QNetworkSession::Connected); + QVERIFY(session.interface().isValid()); + QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); + QCOMPARE(session.interface().index(), session2.interface().index()); + } + + sessionClosedSpy2.clear(); + + // Test closing the first session. + { +#ifdef Q_CC_NOKIAX86 + // For S60 emulator builds: RConnection::Close does not actually + // close network connection on all Emulators + bool expectStateChange = false; +#else + bool expectStateChange = session.state() != QNetworkSession::Disconnected && + manager.capabilities() & QNetworkConfigurationManager::SystemSessionSupport; +#endif + + session.close(); + + QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty()); + + QVERIFY(!session.isActive()); + + if (expectStateChange) + QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty()); + + if (!errorSpy.isEmpty()) { + QNetworkSession::SessionError error = + qvariant_cast(errorSpy.first().at(0)); + if (error == QNetworkSession::OperationNotSupportedError) { + // The session needed to bring down the interface, + // but the operation is not supported. + QSKIP("Configuration does not support close().", SkipSingle); + } else if (error == QNetworkSession::InvalidConfigurationError) { + // The session needed to bring down the interface, but it is not possible for the + // specified configuration. + if ((session.configuration().state() & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + QFAIL("Failed to close session for Discovered configuration."); + } else { + QSKIP("Cannot test session for non-Discovered configuration.", SkipSingle); + } + } else { + QFAIL("Error closing session."); + } + } else if (!sessionClosedSpy.isEmpty()) { + QVERIFY(sessionOpenedSpy.isEmpty()); + QCOMPARE(sessionClosedSpy.count(), 1); + if (expectStateChange) + QVERIFY(!stateChangedSpy.isEmpty()); + QVERIFY(errorSpy.isEmpty()); + + if (expectStateChange) + QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); + + ++inProcessSessionManagementCount; + } else { + QFAIL("Timeout waiting for session to close."); + } + } + } +} + +QDebug operator<<(QDebug debug, const QList &list) +{ + debug.nospace() << "( "; + foreach (const QNetworkConfiguration &config, list) + debug.nospace() << config.identifier() << ", "; + debug.nospace() << ")\n"; + return debug; +} + +void tst_QNetworkSession::outOfProcessSession() +{ + QNetworkConfigurationManager manager; + + QList before = manager.allConfigurations(QNetworkConfiguration::Active); + + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); + + // Cannot read/write to processes on WinCE or Symbian. + // Easiest alternative is to use sockets for IPC. + + QLocalServer oopServer; + oopServer.listen("tst_qnetworksession"); + + QProcess lackey; + lackey.start("qnetworksessionlackey"); + QVERIFY(lackey.waitForStarted()); + + QVERIFY(oopServer.waitForNewConnection(-1)); + QLocalSocket *oopSocket = oopServer.nextPendingConnection(); + + do { + QByteArray output; + + if(oopSocket->waitForReadyRead()) + output = oopSocket->readLine().trimmed(); + + if (output.startsWith("Started session ")) { + QString identifier = QString::fromLocal8Bit(output.mid(16).constData()); + + QNetworkConfiguration changed; + + do { + QTRY_VERIFY(!spy.isEmpty()); + + changed = qvariant_cast(spy.takeFirst().at(0)); + + } while (changed.identifier() != identifier); + + QVERIFY((changed.state() & QNetworkConfiguration::Active) == + QNetworkConfiguration::Active); + + QVERIFY(!before.contains(changed)); + + QList after = + manager.allConfigurations(QNetworkConfiguration::Active); + + QVERIFY(after.contains(changed)); + + spy.clear(); + + oopSocket->write("stop\n"); + oopSocket->waitForBytesWritten(); + + do { + QTRY_VERIFY(!spy.isEmpty()); + + changed = qvariant_cast(spy.takeFirst().at(0)); + } while (changed.identifier() != identifier); + + QVERIFY((changed.state() & QNetworkConfiguration::Active) != + QNetworkConfiguration::Active); + + QList afterStop = + manager.allConfigurations(QNetworkConfiguration::Active); + + QVERIFY(!afterStop.contains(changed)); + + oopSocket->disconnectFromServer(); + oopSocket->waitForDisconnected(-1); + + lackey.waitForFinished(); + } + // This is effected by QTBUG-4903, process will always report as running + //} while (lackey.state() == QProcess::Running); + + // Workaround: the socket in the lackey will disconnect on exit + } while (oopSocket->state() == QLocalSocket::ConnectedState); + + switch (lackey.exitCode()) { + case 0: + break; + case 1: + QSKIP("No discovered configurations found.", SkipAll); + break; + case 2: + QSKIP("Lackey could not start session.", SkipAll); + default: + QSKIP("Lackey failed", SkipAll); + } +} + +QTEST_MAIN(tst_QNetworkSession) + +#include "tst_qnetworksession.moc" + diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro new file mode 100644 index 0000000..1410601 --- /dev/null +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -0,0 +1,21 @@ +SOURCES += tst_qnetworksession.cpp +HEADERS += ../../qbearertestcommon.h +TARGET = tst_qnetworksession +CONFIG += testcase + +QT = core network + +INCLUDEPATH += ../../../../src/bearer + +include(../../../../common.pri) +qtAddLibrary(QtBearer) + +wince* { + LACKEY.sources = $$OUTPUT_DIR/build/tests/bin/qnetworksessionlackey.exe + LACKEY.path = . + DEPLOYMENT += LACKEY +} + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp new file mode 100644 index 0000000..68590cc --- /dev/null +++ b/tests/manual/bearerex/bearerex.cpp @@ -0,0 +1,565 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "bearerex.h" + +#include + +Q_DECLARE_METATYPE(QNetworkConfiguration) + +BearerEx::BearerEx(QWidget* parent) + : QMainWindow(parent) +{ + setupUi(this); + + createMenus(); + + connect(&m_NetworkConfigurationManager, SIGNAL(updateCompleted()), this, SLOT(configurationsUpdateCompleted())); + connect(&m_NetworkConfigurationManager, SIGNAL(configurationAdded(const QNetworkConfiguration&)), + this, SLOT(configurationAdded(const QNetworkConfiguration&))); + connect(&m_NetworkConfigurationManager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)), + this, SLOT(configurationRemoved(const QNetworkConfiguration&))); + connect(&m_NetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)), + this, SLOT(onlineStateChanged(bool))); + connect(&m_NetworkConfigurationManager, SIGNAL(configurationChanged(const QNetworkConfiguration&)), + this, SLOT(configurationChanged(const QNetworkConfiguration&))); + showConfigurations(); +} + +void BearerEx::createMenus() +{ + QAction* act1 = new QAction(tr("Show Details"), this); + menuBar()->addAction(act1); + connect(act1, SIGNAL(triggered()), this, SLOT(on_showDetailsButton_clicked())); + + m_openAction = new QAction(tr("Open Session"), this); + menuBar()->addAction(m_openAction); + connect(m_openAction, SIGNAL(triggered()), this, SLOT(on_openSessionButton_clicked())); + + QAction* exitAct = new QAction(tr("Exit"), this); + menuBar()->addAction(exitAct); + connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); +} + +void BearerEx::showConfigurations() +{ + listWidget->clear(); + QListWidgetItem* listItem; + + QNetworkConfiguration defaultConfig = m_NetworkConfigurationManager.defaultConfiguration(); + if (defaultConfig.type() == QNetworkConfiguration::UserChoice) { + listItem = new QListWidgetItem(); + QFont font = listItem->font(); + font.setBold(true); + font.setUnderline(true); + listItem->setFont(font); + listItem->setText(" UserChoice"); + listItem->setData(Qt::UserRole, qVariantFromValue(defaultConfig)); + listWidget->addItem(listItem); + } + + QList configurations = m_NetworkConfigurationManager.allConfigurations(); + for (int i=0; ifont(); + font.setBold(true); + font.setUnderline(true); + listItem->setFont(font); + } + listItem->setText(text); + listItem->setData(Qt::UserRole, qVariantFromValue(configurations[i])); + listWidget->addItem(listItem); + } +} + +void BearerEx::on_updateConfigurationsButton_clicked() +{ + m_NetworkConfigurationManager.updateConfigurations(); +} + +void BearerEx::on_updateListButton_clicked() +{ + showConfigurations(); +} + +void BearerEx::on_showDetailsButton_clicked() +{ + QListWidgetItem* item = listWidget->currentItem(); + if (!item) { + return; + } + + QNetworkConfiguration networkConfiguration = qVariantValue(item->data(Qt::UserRole)); + DetailedInfoDialog infoDialog(&networkConfiguration,this); + infoDialog.exec(); +} + +void BearerEx::on_createSessionButton_clicked() +{ + QListWidgetItem* item = listWidget->currentItem(); + if (!item) { + return; + } + QNetworkConfiguration networkConfiguration = qVariantValue(item->data(Qt::UserRole)); + int newTabIndex = mainTabWidget->count(); + SessionTab* newTab = new SessionTab(&networkConfiguration,&m_NetworkConfigurationManager,eventListWidget,newTabIndex-1); + QString label = QString("S")+QString::number(newTabIndex-1); + mainTabWidget->insertTab(newTabIndex,newTab,label); + mainTabWidget->setCurrentIndex(newTabIndex); +} + +void BearerEx::on_clearEventListButton_clicked() +{ + eventListWidget->clear(); +} + +void BearerEx::configurationAdded(const QNetworkConfiguration& config) +{ + QListWidgetItem* listItem = new QListWidgetItem(); + listItem->setText(QString("Added: ")+config.name()); + eventListWidget->addItem(listItem); +} + +void BearerEx::configurationRemoved(const QNetworkConfiguration& config) +{ + QListWidgetItem* listItem = new QListWidgetItem(); + listItem->setText(QString("Removed: ")+config.name()); + eventListWidget->addItem(listItem); +} + +void BearerEx::onlineStateChanged(bool isOnline) +{ + QListWidgetItem* listItem = new QListWidgetItem(); + QFont font = listItem->font(); + font.setBold(true); + listItem->setFont(font); + if (isOnline) { + listItem->setText(QString("> Online")); + } else { + listItem->setText(QString("< Offline")); + } + eventListWidget->addItem(listItem); +} + +void BearerEx::configurationChanged(const QNetworkConfiguration & config) +{ + QListWidgetItem* listItem = new QListWidgetItem(); + QString state; + switch (config.state()) + { + case QNetworkConfiguration::Undefined: + state = "Undef : "; + break; + case QNetworkConfiguration::Defined: + state = "Def : "; + break; + case QNetworkConfiguration::Discovered: + state = "Disc : "; + break; + case QNetworkConfiguration::Active: + state = "Act : "; + break; + } + listItem->setText(state+config.name()); + eventListWidget->addItem(listItem); +} + +void BearerEx::configurationsUpdateCompleted() +{ + QMessageBox msgBox; + msgBox.setStandardButtons(QMessageBox::Close); + msgBox.setText("Configurations update completed."); + msgBox.exec(); +} + +DetailedInfoDialog::DetailedInfoDialog(QNetworkConfiguration* apNetworkConfiguration, QWidget * parent) + : QDialog(parent) +{ + setupUi(this); + + tableWidget->setColumnCount(2); + int rowCount = 2; + + if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { + rowCount = rowCount + apNetworkConfiguration->children().count(); + } + + tableWidget->setRowCount(rowCount); + tableWidget->setColumnWidth(1,250); + tableWidget->setItem(0, 0, new QTableWidgetItem(tr("Name"))); + tableWidget->setItem(0, 1, new QTableWidgetItem(apNetworkConfiguration->name())); + tableWidget->setItem(1, 0, new QTableWidgetItem(tr("Id"))); + tableWidget->setItem(1, 1, new QTableWidgetItem(apNetworkConfiguration->identifier())); + if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { + for (int i=0; ichildren().count(); i++) { + tableWidget->setItem(i+2, 0, new QTableWidgetItem(QString("IAP")+QString::number(i+1))); + tableWidget->setItem(i+2, 1, new QTableWidgetItem(apNetworkConfiguration->children()[i].name())); + } + } + + tableWidget->setFocusPolicy(Qt::NoFocus); + +#ifdef Q_OS_SYMBIAN + this->showMaximized(); +#endif +} + +SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, + QNetworkConfigurationManager* configManager, + QListWidget* eventListWidget, + int index, + BearerEx * parent) + : QWidget(parent), m_http(0), m_eventListWidget(eventListWidget), + m_index(index), m_httpRequestOngoing(false), m_alrEnabled (false) +{ + setupUi(this); + + m_ConfigManager = configManager; + m_NetworkSession = new QNetworkSession(*apNetworkConfiguration); + + // Update initial Session state to UI + newState(m_NetworkSession->state()); + + connect(m_NetworkSession, SIGNAL(newConfigurationActivated()), this, SLOT(newConfigurationActivated())); + connect(m_NetworkSession, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(stateChanged(QNetworkSession::State))); + connect(m_NetworkSession, SIGNAL(opened()), this, SLOT(opened())); + connect(m_NetworkSession, SIGNAL(closed()), this, SLOT(closed())); + connect(m_NetworkSession, SIGNAL(error(QNetworkSession::SessionError)), this, SLOT(error(QNetworkSession::SessionError))); + + if (apNetworkConfiguration->type() == QNetworkConfiguration::InternetAccessPoint) { + snapLabel->hide(); + snapLineEdit->hide(); + alrButton->hide(); + iapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); + } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { + snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); + } + bearerLineEdit->setText(m_NetworkSession->bearerName()); + sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ + QString(" / ")+ + QString::number(m_NetworkSession->bytesReceived())); + snapLineEdit->setFocusPolicy(Qt::NoFocus); + iapLineEdit->setFocusPolicy(Qt::NoFocus); + bearerLineEdit->setFocusPolicy(Qt::NoFocus); + sentRecDataLineEdit->setFocusPolicy(Qt::NoFocus); + stateLineEdit->setFocusPolicy(Qt::NoFocus); +} + +SessionTab::~SessionTab() +{ + delete m_NetworkSession; + delete m_http; +} + +void SessionTab::on_createQHttpButton_clicked() +{ + if (m_httpRequestOngoing) { + return; + } + + if (m_http) { + disconnect(m_http, 0, 0, 0); + delete m_http; + } + m_http = new QHttp(this); + createQHttpButton->setText("Recreate QHttp"); + connect(m_http, SIGNAL(done(bool)), this, SLOT(done(bool))); +} + +void SessionTab::on_sendRequestButton_clicked() +{ + if (m_http) { + QString urlstring("http://www.google.com"); + QUrl url(urlstring); + m_http->setHost(url.host(), QHttp::ConnectionModeHttp, url.port() == -1 ? 0 : url.port()); + m_http->get(urlstring); + m_httpRequestOngoing = true; + } else { + QMessageBox msgBox; + msgBox.setStandardButtons(QMessageBox::Close); + msgBox.setText("QHttp not created.\nCreate QHttp First."); + msgBox.exec(); + } +} + +void SessionTab::on_openSessionButton_clicked() +{ + m_NetworkSession->open(); + if (m_NetworkSession->isActive()) { + newState(m_NetworkSession->state()); + } +} + +void SessionTab::on_closeSessionButton_clicked() +{ + m_NetworkSession->close(); + if (!m_NetworkSession->isActive()) { + newState(m_NetworkSession->state()); + } +} + +void SessionTab::on_stopConnectionButton_clicked() +{ + m_NetworkSession->stop(); +} + +void SessionTab::on_alrButton_clicked() +{ + if (!m_alrEnabled) { + connect(m_NetworkSession, SIGNAL(preferredConfigurationChanged(const QNetworkConfiguration&, bool)), + this, SLOT(preferredConfigurationChanged(const QNetworkConfiguration&, bool))); + alrButton->setText("Disable ALR"); + m_alrEnabled = true; + } else { + disconnect(m_NetworkSession, SIGNAL(preferredConfigurationChanged(const QNetworkConfiguration&, bool)), 0, 0); + alrButton->setText("Enable ALR"); + m_alrEnabled = false; + } +} + +void SessionTab::on_deleteSessionButton_clicked() +{ + setWindowTitle("Bearer Example"); + delete this; +} + +void SessionTab::newConfigurationActivated() +{ + QMessageBox msgBox; + msgBox.setText("New configuration activated."); + msgBox.setInformativeText("Do you want to accept new configuration?"); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox.setDefaultButton(QMessageBox::Yes); + if (msgBox.exec() == QMessageBox::Yes) { + m_NetworkSession->accept(); + iapLineEdit->setText(m_config.name()+" ("+m_config.identifier()+")"); + } else { + m_NetworkSession->reject(); + } +} + +void SessionTab::preferredConfigurationChanged(const QNetworkConfiguration& config, bool /*isSeamless*/) +{ + m_config = config; + QMessageBox msgBox; + msgBox.setText("Roaming to new configuration."); + msgBox.setInformativeText("Do you want to migrate to "+config.name()+"?"); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox.setDefaultButton(QMessageBox::Yes); + if (msgBox.exec() == QMessageBox::Yes) { + m_NetworkSession->migrate(); + } else { + m_NetworkSession->ignore(); + } +} + +void SessionTab::opened() +{ + QListWidgetItem* listItem = new QListWidgetItem(); + QFont font = listItem->font(); + font.setBold(true); + listItem->setFont(font); + listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); + m_eventListWidget->addItem(listItem); + + QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); + if (!identifier.isNull()) { + QString configId = identifier.toString(); + QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); + if (config.isValid()) { + iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + } + } + + if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) { + QVariant identifier = m_NetworkSession->property("UserChoiceConfigurationIdentifier"); + if (!identifier.isNull()) { + QString configId = identifier.toString(); + QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); + if (config.isValid() && (config.type() == QNetworkConfiguration::ServiceNetwork)) { + snapLineEdit->setText(config.name()); + } + } + } +} + +void SessionTab::closed() +{ + QListWidgetItem* listItem = new QListWidgetItem(); + QFont font = listItem->font(); + font.setBold(true); + listItem->setFont(font); + listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Closed")); + m_eventListWidget->addItem(listItem); +} + +QString SessionTab::stateString(QNetworkSession::State state) +{ + QString stateString; + switch (state) + { + case QNetworkSession::Invalid: + stateString = "Invalid"; + break; + case QNetworkSession::NotAvailable: + stateString = "NotAvailable"; + break; + case QNetworkSession::Connecting: + stateString = "Connecting"; + break; + case QNetworkSession::Connected: + stateString = "Connected"; + break; + case QNetworkSession::Closing: + stateString = "Closing"; + break; + case QNetworkSession::Disconnected: + stateString = "Disconnected"; + break; + case QNetworkSession::Roaming: + stateString = "Roaming"; + break; + } + return stateString; +} + +void SessionTab::stateChanged(QNetworkSession::State state) +{ + newState(state); + + QListWidgetItem* listItem = new QListWidgetItem(); + listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+stateString(state)); + m_eventListWidget->addItem(listItem); +} + +void SessionTab::newState(QNetworkSession::State state) +{ + if (state == QNetworkSession::Connected) { + QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); + if (!identifier.isNull()) { + QString configId = identifier.toString(); + QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); + if (config.isValid()) { + iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + } + } + } + + bearerLineEdit->setText(m_NetworkSession->bearerName()); + + QString active; + if (m_NetworkSession->isActive()) { + active = " (A)"; + } + stateLineEdit->setText(stateString(state)+active); +} + +void SessionTab::error(QNetworkSession::SessionError error) +{ + QListWidgetItem* listItem = new QListWidgetItem(); + QMessageBox msgBox; + msgBox.setStandardButtons(QMessageBox::Close); + + QString errorString; + switch (error) + { + case QNetworkSession::UnknownSessionError: + errorString = "UnknownSessionError"; + break; + case QNetworkSession::SessionAbortedError: + errorString = "SessionAbortedError"; + break; + case QNetworkSession::RoamingError: + errorString = "RoamingError"; + break; + case QNetworkSession::OperationNotSupportedError: + errorString = "OperationNotSupportedError"; + break; + case QNetworkSession::InvalidConfigurationError: + errorString = "InvalidConfigurationError"; + break; + } + listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+errorString); + m_eventListWidget->addItem(listItem); + + msgBox.setText(errorString); + msgBox.exec(); +} + +void SessionTab::done(bool error) +{ + m_httpRequestOngoing = false; + + QMessageBox msgBox; + msgBox.setStandardButtons(QMessageBox::Close); + if (error) { + msgBox.setText("HTTP request failed."); + } else { + QString result(m_http->readAll()); + msgBox.setText(QString("HTTP request finished successfully.\nReceived ")+QString::number(result.length())+QString(" bytes.")); + } + msgBox.exec(); + + sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ + QString(" / ")+ + QString::number(m_NetworkSession->bytesReceived())); +} + +// End of file + diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h new file mode 100644 index 0000000..f18180e --- /dev/null +++ b/tests/manual/bearerex/bearerex.h @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 ACCESSPOINTMANAGEREX_H +#define ACCESSPOINTMANAGEREX_H + +#include + +#include "ui_bearerex.h" +#include "ui_detailedinfodialog.h" +#include "ui_sessiondialog.h" + +#include "qnetworkconfigmanager.h" +#include "qnetworksession.h" +#include "xqlistwidget.h" + +class QHttp; +class SessionTab; + +QTM_USE_NAMESPACE + +class BearerEx : public QMainWindow, public Ui::BearerExMainWindow +{ + Q_OBJECT + +public: + BearerEx(QWidget* parent = 0); + void createMenus(); + void showConfigurations(); + +private Q_SLOTS: + void on_updateConfigurationsButton_clicked(); + void on_updateListButton_clicked(); + void on_showDetailsButton_clicked(); + void on_createSessionButton_clicked(); + void on_clearEventListButton_clicked(); + + void configurationsUpdateCompleted(); + void configurationAdded(const QNetworkConfiguration& config); + void configurationRemoved(const QNetworkConfiguration& config); + void onlineStateChanged(bool isOnline); + void configurationChanged(const QNetworkConfiguration & config); + +private: + QNetworkConfigurationManager m_NetworkConfigurationManager; + QAction* m_openAction; +}; + +class DetailedInfoDialog : public QDialog, public Ui::DetailedInfoDialog +{ + Q_OBJECT + +public: + DetailedInfoDialog(QNetworkConfiguration* apNetworkConfiguration = 0, QWidget* parent = 0); +}; + + +class SessionTab : public QWidget, public Ui::SessionTab +{ + Q_OBJECT + +public: + SessionTab(QNetworkConfiguration* apNetworkConfiguration = 0, QNetworkConfigurationManager* configManager = 0, + QListWidget* eventListWidget = 0, int index = 0, BearerEx* parent = 0); + ~SessionTab(); + + QString stateString(QNetworkSession::State state); + +private Q_SLOTS: + void on_createQHttpButton_clicked(); + void on_sendRequestButton_clicked(); + void on_openSessionButton_clicked(); + void on_closeSessionButton_clicked(); + void on_stopConnectionButton_clicked(); + void on_deleteSessionButton_clicked(); + void on_alrButton_clicked(); + void done(bool error); + + void newConfigurationActivated(); + void preferredConfigurationChanged(const QNetworkConfiguration& config, bool isSeamless); + void stateChanged(QNetworkSession::State state); + void newState(QNetworkSession::State state); + void opened(); + void closed(); + void error(QNetworkSession::SessionError error); + +private: //data + QHttp* m_http; + QNetworkSession* m_NetworkSession; + QNetworkConfigurationManager* m_ConfigManager; + QListWidget* m_eventListWidget; + QNetworkConfiguration m_config; + int m_index; + bool m_httpRequestOngoing; + bool m_alrEnabled; +}; + +#endif // ACCESSPOINTMANAGEREX_H + +// End of file + diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro new file mode 100644 index 0000000..a870eb1 --- /dev/null +++ b/tests/manual/bearerex/bearerex.pro @@ -0,0 +1,34 @@ +TEMPLATE = app +TARGET = BearerEx + +QT += core \ + gui \ + network + +FORMS += sessiondialog.ui \ + bearerex.ui \ + detailedinfodialog.ui +include(../../common.pri) +#not really a test case but deployment happens same way +CONFIG += testcase + +DEPENDPATH += . +INCLUDEPATH += . \ + ../../src/bearer + +# Example headers and sources +HEADERS += bearerex.h \ + xqlistwidget.h + +SOURCES += bearerex.cpp \ + main.cpp \ + xqlistwidget.cpp + +symbian: { + bearerex.sources = Qtbearer.dll + bearerex.path = /sys/bin + DEPLOYMENT += bearerex + + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} +qtAddLibrary(QtBearer) diff --git a/tests/manual/bearerex/bearerex.ui b/tests/manual/bearerex/bearerex.ui new file mode 100644 index 0000000..e5ab62f --- /dev/null +++ b/tests/manual/bearerex/bearerex.ui @@ -0,0 +1,95 @@ + + BearerExMainWindow + + + + 0 + 0 + 360 + 640 + + + + Bearer Example + + + + + + + + Main + + + + + + Network Configurations + + + Qt::AlignCenter + + + + + + + + + + + + Update Configs + + + + + + + Update List + + + + + + + Create Session + + + + + + + Show Details + + + + + + + + + + Events + + + + + + + + + Clear + + + + + + + + + + + + + diff --git a/tests/manual/bearerex/detailedinfodialog.ui b/tests/manual/bearerex/detailedinfodialog.ui new file mode 100644 index 0000000..c4a21fa --- /dev/null +++ b/tests/manual/bearerex/detailedinfodialog.ui @@ -0,0 +1,54 @@ + + DetailedInfoDialog + + + + 0 + 0 + 308 + 396 + + + + Bearer Example + + + + + + Detailed information + + + + + + + + + + QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DetailedInfoDialog + accept() + + + 205 + 371 + + + 223 + 8 + + + + + diff --git a/tests/manual/bearerex/main.cpp b/tests/manual/bearerex/main.cpp new file mode 100644 index 0000000..e13a494 --- /dev/null +++ b/tests/manual/bearerex/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include "bearerex.h" + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + BearerEx bearerEx; +#ifdef Q_OS_SYMBIAN + bearerEx.showMaximized(); +#else + bearerEx.show(); +#endif + return app.exec(); +} + +// End of file + diff --git a/tests/manual/bearerex/sessiondialog.ui b/tests/manual/bearerex/sessiondialog.ui new file mode 100644 index 0000000..fcf2136 --- /dev/null +++ b/tests/manual/bearerex/sessiondialog.ui @@ -0,0 +1,139 @@ + + SessionTab + + + + + + + + SNAP + + + + + + + true + + + + + + + IAP + + + + + + + true + + + true + + + + + + + Bearer + + + + + + + true + + + + + + + Sent/Rec. + + + + + + + true + + + + + + + State + + + + + + + true + + + + + + + + + + + Open Session + + + + + + + Close Session + + + + + + + Stop Conn. + + + + + + + Create QHttp + + + + + + + Send Test Req. + + + + + + + Enable ALR + + + + + + + Delete Session + + + + + + + + + + diff --git a/tests/manual/bearerex/xqlistwidget.cpp b/tests/manual/bearerex/xqlistwidget.cpp new file mode 100644 index 0000000..0618725 --- /dev/null +++ b/tests/manual/bearerex/xqlistwidget.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "xqlistwidget.h" + +XQListWidget::XQListWidget(QWidget* parent) : QListWidget(parent) +{ +} + +void XQListWidget::keyPressEvent(QKeyEvent* event) +{ + switch (event->key()) + { + case Qt::Key_Left: + { + focusPreviousChild(); + break; + } + case Qt::Key_Right: + { + focusNextChild(); + break; + } + default: + { + QListWidget::keyPressEvent(event); + } + } +} diff --git a/tests/manual/bearerex/xqlistwidget.h b/tests/manual/bearerex/xqlistwidget.h new file mode 100644 index 0000000..1053328 --- /dev/null +++ b/tests/manual/bearerex/xqlistwidget.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 XQLISTWIDGET_H +#define XQLISTWIDGET_H + +#include +#include + +class XQListWidget: public QListWidget +{ +public: + XQListWidget(QWidget* parent = 0); + +protected: + void keyPressEvent(QKeyEvent* event); +}; + +#endif // XQLISTWIDGET_H + + diff --git a/tests/manual/networkmanager/README b/tests/manual/networkmanager/README new file mode 100644 index 0000000..4bc7171 --- /dev/null +++ b/tests/manual/networkmanager/README @@ -0,0 +1,2 @@ +This application serves as prototype/test-bed for NetworkManager development. The excellent (non-existing) documentation +for the various NetworkManager interfaces makes this harder than it should be. diff --git a/tests/manual/networkmanager/dialog.ui b/tests/manual/networkmanager/dialog.ui new file mode 100644 index 0000000..1301908 --- /dev/null +++ b/tests/manual/networkmanager/dialog.ui @@ -0,0 +1,213 @@ + + + Dialog + + + + 0 + 0 + 919 + 657 + + + + Dialog + + + + + + + + Connections + + + + + + + + Path + + + + + State + + + + + Id + + + + + Settings + + + + + + + + + + + + Devices: + + + + + + + + Path + + + + + Managed + + + + + Interface + + + + + Driver + + + + + Type + + + + + State + + + + + IP4 Address + + + + + IP4 Config + + + + + Hostname + + + + + Domains + + + + + + + + + + Qt::Horizontal + + + + 908 + 20 + + + + + + + + true + + + + SSID + + + + + Strength + + + + + Wpa + + + + + Rsn + + + + + Freq + + + + + Hardware Address + + + + + Mode + + + + + Max Bitrate + + + + + + + + + + Start + + + + + + + Stop + + + + + + + Scan + + + + + + + Update + + + + + + + + + + diff --git a/tests/manual/networkmanager/networkmanager.pro b/tests/manual/networkmanager/networkmanager.pro new file mode 100644 index 0000000..31b2af1 --- /dev/null +++ b/tests/manual/networkmanager/networkmanager.pro @@ -0,0 +1,19 @@ +SOURCES += networkmanagertest.cpp nmview.cpp +HEADERS += nmview.h +TARGET = tst_networkmanagertest + +QT = core network dbus gui + +#not really a test case but deployment happens same way +CONFIG += testcase + +requires(contains(QT_CONFIG,dbus)) + +INCLUDEPATH += ../../src/bearer +include(../../common.pri) + +qtAddLibrary(QtBearer) + +#MOC_DIR = .moc +#OBJECTS_DIR = .obj +FORMS += dialog.ui diff --git a/tests/manual/networkmanager/networkmanagertest.cpp b/tests/manual/networkmanager/networkmanagertest.cpp new file mode 100644 index 0000000..a39b041 --- /dev/null +++ b/tests/manual/networkmanager/networkmanagertest.cpp @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nmview.h" + +#include + +typedef QMap< QString, QMap > SettingsMap; +Q_DECLARE_METATYPE(SettingsMap) + +void printConnectionDetails(const QString& service) +{ + QDBusConnection dbc = QDBusConnection::systemBus(); + if (!dbc.isConnected()) { + qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); + return; + } + QDBusInterface allCons(service, NM_DBUS_PATH_SETTINGS, NM_DBUS_IFACE_SETTINGS, dbc); + if (allCons.isValid()) { + QDBusReply > reply = allCons.call("ListConnections"); + if ( reply.isValid() ) { + qWarning() << "Known connections:"; + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + qWarning() << " " << path.path(); + QDBusInterface sysIface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, path.path(), NM_DBUS_IFACE_SETTINGS_CONNECTION, dbc); + if (sysIface.isValid()) { + QDBusMessage r = sysIface.call("GetSettings"); + QDBusReply< SettingsMap > rep = sysIface.call("GetSettings"); + qWarning() << " GetSettings:" << r.arguments() << r.signature() << rep.isValid() << sysIface.lastError(); + QMap< QString, QMap > map = rep.value(); + QList list = map.keys(); + foreach (QString key, list) { + QMap innerMap = map[key]; + qWarning() << " Key: " << key; + QMap::const_iterator i = innerMap.constBegin(); + while (i != innerMap.constEnd()) { + QString k = i.key(); + qWarning() << " Key: " << k << " Entry: " << i.value(); + if (k == "addresses" && i.value().canConvert()) { + QDBusArgument arg = i.value().value(); + arg.beginArray(); + while (!arg.atEnd()) { + QDBusVariant addr; + arg >> addr; + uint ip = addr.variant().toUInt(); + qWarning() << ip; + qWarning() << " " << QHostAddress(htonl(ip)).toString(); + } + + } + i++; + } + } + } + } + } + } + + +} + +void readConnectionManagerDetails() +{ + qDBusRegisterMetaType(); + QDBusConnection dbc = QDBusConnection::systemBus(); + if (!dbc.isConnected()) { + qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); + return; + } + + QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); + if (!iface.isValid()) { + qWarning() << "Could not find NetworkManager"; + return; + } + + uint state = iface.property("State").toUInt(); + switch(state) { + case NM_STATE_UNKNOWN: + qWarning() << "State: Unknown"; break; + case NM_STATE_ASLEEP: + qWarning() << "State: Asleep"; break; + case NM_STATE_CONNECTING: + qWarning() << "State: Connecting"; break; + case NM_STATE_CONNECTED: + qWarning() << "State: Connected"; break; + case NM_STATE_DISCONNECTED: + qWarning() << "State: Disconnected"; break; + } + //get list of network devices + QDBusReply > reply = iface.call("GetDevices"); + if ( reply.isValid() ) { + qWarning() << "Current devices:"; + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + qWarning() << " " << path.path(); + QDBusInterface devIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_DEVICE, dbc); + if (devIface.isValid()) { + qWarning() << " Managed: " << devIface.property("Managed").toBool(); + qWarning() << " Interface: " << devIface.property("Interface").toString(); + qWarning() << " HAL UDI: " << devIface.property("Udi").toString(); + qWarning() << " Driver: " << devIface.property("Driver").toString(); + QVariant v = devIface.property("DeviceType"); + switch(v.toUInt()) { + case DEVICE_TYPE_UNKNOWN: + qWarning() << " DeviceType: Unknown" ; + break; + case DEVICE_TYPE_802_3_ETHERNET: + qWarning() << " DeviceType: Ethernet" ; + break; + case DEVICE_TYPE_802_11_WIRELESS: + qWarning() << " DeviceType: Wireless" ; + break; + case DEVICE_TYPE_GSM: + qWarning() << " DeviceType: GSM" ; + break; + case DEVICE_TYPE_CDMA: + qWarning() << " DeviceType: CDMA" ; + break; + + } + v = devIface.property("State"); + switch(v.toUInt()) { + case NM_DEVICE_STATE_UNKNOWN: + qWarning() << " State: Unknown" ; break; + case NM_DEVICE_STATE_UNMANAGED: + qWarning() << " State: Unmanaged" ; break; + case NM_DEVICE_STATE_UNAVAILABLE: + qWarning() << " State: Unavailable" ; break; + case NM_DEVICE_STATE_DISCONNECTED: + qWarning() << " State: Disconnected" ; break; + case NM_DEVICE_STATE_PREPARE: + qWarning() << " State: Preparing" ; break; + case NM_DEVICE_STATE_CONFIG: + qWarning() << " State: Being configured" ; break; + case NM_DEVICE_STATE_NEED_AUTH: + qWarning() << " State: Awaiting secrets" ; break; + case NM_DEVICE_STATE_IP_CONFIG: + qWarning() << " State: IP requested" ; break; + case NM_DEVICE_STATE_ACTIVATED: + qWarning() << " State: Activated" ; break; + case NM_DEVICE_STATE_FAILED: + qWarning() << " State: FAILED" ; break; + } + quint32 ip = devIface.property("Ip4Address").toUInt(); + qWarning() << " IP4Address: " << QHostAddress(htonl(ip)).toString(); + if (v.toUInt() == NM_DEVICE_STATE_ACTIVATED) { + QString path = devIface.property("Ip4Config").value().path(); + qWarning() << " IP4Config: " << path; + QDBusInterface ipIface(NM_DBUS_SERVICE, path, NM_DBUS_INTERFACE_IP4_CONFIG, dbc); + if (ipIface.isValid()) { + qWarning() << " Hostname: " << ipIface.property("Hostname").toString(); + qWarning() << " Domains: " << ipIface.property("Domains").toStringList(); + qWarning() << " NisDomain: " << ipIface.property("NisDomain").toString(); + QDBusArgument arg= ipIface.property("Addresses").value(); + //qWarning() << " " << arg.currentType(); + qWarning() << " Addresses: " << ipIface.property("Addresses"); + qWarning() << " Nameservers: " << ipIface.property("Nameservers"); + qWarning() << " NisServers: " << ipIface.property("NisServers"); + } + + } + + } + } + } + + //get list of active connections + QVariant prop = iface.property("ActiveConnections"); + QList connections = prop.value >(); + QString activePath; + if ( connections.count() ) + qWarning() << "Active connections:"; + foreach(QDBusObjectPath path, connections) { + qWarning() << " " << path.path(); + activePath = path.path(); + QString serviceName; + QDBusInterface conIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_ACTIVE_CONNECTION, dbc); + if (conIface.isValid()) { + qWarning() << " default connection: " << conIface.property("Default").toBool(); + serviceName = conIface.property("ServiceName").toString(); + qWarning() << " service name: " << serviceName; + qWarning() << " connection path: " << conIface.property("Connection").value().path(); + qWarning() << " specific object:" << conIface.property("SpecificObject").value().path(); + qWarning() << " sharedServiceName: " << conIface.property("SharedServiceName").toString(); + QList devs = conIface.property("Devices").value >(); + qWarning() << " devices: "; + foreach(QDBusObjectPath p, devs) + qWarning() << " " << path.path(); + QVariant v = conIface.property("State"); + switch (v.toInt()) { + case NM_ACTIVE_CONNECTION_STATE_UNKNOWN: + qWarning()<< " State: unknown"; break; + case NM_ACTIVE_CONNECTION_STATE_ACTIVATING: + qWarning()<< " State: activating"; break; + case NM_ACTIVE_CONNECTION_STATE_ACTIVATED: + qWarning()<< " State: activated"; break; + } + } else { + qWarning() << conIface.lastError(); + } + + } + + printConnectionDetails(NM_DBUS_SERVICE_SYSTEM_SETTINGS); + printConnectionDetails(NM_DBUS_SERVICE_USER_SETTINGS); + + + //turn active connection off + /*QDBusObjectPath dbop("/org/freedesktop/NetworkManager/ActiveConnection/1"); + QVariant asd = QVariant::fromValue(dbop); + iface.call(QLatin1String("DeactivateConnection"), asd); + qWarning() << iface.lastError();*/ + + /*QDBusObjectPath p1device("/org/freedesktop/Hal/devices/net_00_60_6e_82_02_65"); + QVariant p1v = QVariant::fromValue(p1device); + QDBusObjectPath p1con("/org/freedesktop/NetworkManagerSettings/0"); + QVariant p1c = QVariant::fromValue(p1con); + QDBusObjectPath p1sp(""); + QVariant p1sp1 = QVariant::fromValue(p1sp); + iface.call(QLatin1String("ActivateConnection"), + QString("/org/freedesktop/NetworkManagerSystemSettings"), p1c,p1v, p1v ); + qWarning() << iface.lastError(); + */ +} + +int main( int argc, char** argv) +{ + QApplication app(argc, argv); + //readConnectionManagerDetails(); + QMainWindow main; + NMView view; + main.setCentralWidget(&view); + main.show(); + return app.exec(); + +} diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp new file mode 100644 index 0000000..ca9d907 --- /dev/null +++ b/tests/manual/networkmanager/nmview.cpp @@ -0,0 +1,1030 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "nmview.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +//#include "ui_dialog.h" + +#include +#include +#include +#include + +//static QDBusConnection dbc = QDBusConnection::systemBus(); +//typedef QMap< QString, QMap > SettingsMap; +//Q_DECLARE_METATYPE(SettingsMap) + + +NMView::NMView(QDialog* parent) + : QDialog(parent, 0), dbc(QDBusConnection::systemBus()) +{ + init(); + + if (!dbc.isConnected()) { + qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); + return; + } + updateConnections(); + getDevices(); +} + +NMView::~NMView() +{ +} +void NMView::init() +{ + setupUi(this); + sess = 0; +// readSettings(); + connect(startButton, SIGNAL(clicked()), this, SLOT(activate())); + connect(stopButton, SIGNAL(clicked()), this, SLOT(deactivate())); + connect(scanButton, SIGNAL(clicked()), this, SLOT(findAccessPoints())); + connect(updateButton, SIGNAL(clicked()), this, SLOT(update())); + + connect(cons, SIGNAL(itemActivated(QTreeWidgetItem*, int)), + this,SLOT(connectionItemActivated(QTreeWidgetItem*, int))); + + + connect(devicesTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*, int)), + this, SLOT(deviceItemActivated(QTreeWidgetItem*, int))); + + cons->header()->setResizeMode(QHeaderView::ResizeToContents); + devicesTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); + accessPointsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); +// accessPointsTreeWidget->header()->setResizeMode(QHeaderView::ResizeToContents); + + manager = new QNetworkConfigurationManager(this); + + connect(manager, SIGNAL(updateCompleted()), this, SLOT(updateCompleted())); + + connect(manager, SIGNAL(configurationAdded(const QNetworkConfiguration &)), + this, SLOT(configurationAdded(const QNetworkConfiguration&))); + + devicesTreeWidget->header()->hideSection(0); + devicesTreeWidget->header()->hideSection(1); + devicesTreeWidget->header()->hideSection(3); + devicesTreeWidget->header()->hideSection(5); + devicesTreeWidget->header()->hideSection(6); + devicesTreeWidget->header()->hideSection(7); + devicesTreeWidget->header()->hideSection(8); + devicesTreeWidget->header()->hideSection(9); +} + +void NMView::updateConnections() +{ + cons->clear(); + manager->updateConfigurations(); + QList configs = manager->allConfigurations(); + foreach(QNetworkConfiguration p, configs) { + QStringList strlist; + strlist << p.name(); + strlist << stateToString(p.state()); + strlist << p.identifier(); + strlist << typeToString(p.type()); + QTreeWidgetItem *item; + item = new QTreeWidgetItem(strlist); + cons->insertTopLevelItem(0, item); + } + cons->sortItems ( 1, Qt::AscendingOrder); +} + +void NMView::getActiveConnections() +{ + QList configs = manager->allConfigurations(QNetworkConfiguration::Active); + foreach(QNetworkConfiguration p, configs) { + qWarning() << __FUNCTION__ << p.name() << p.identifier(); + } + +// QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); +// if (!iface.isValid()) { +// qWarning() << "Could not find NetworkManager"; +// return; +// } + +// QVariant prop = iface.property("ActiveConnections"); +// QList connections = prop.value >(); +// foreach(QDBusObjectPath path, connections) { +// QDBusInterface conDetails(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_ACTIVE_CONNECTION, dbc); +// if (conDetails.isValid()) { +// QString desc = path.path(); +// conDetails.property("Connection Path").value().path(); + +// QList devices = conDetails.property("Devices").value >(); +// +// foreach(QDBusObjectPath devpath, devices) { +// QDBusInterface devIface(NM_DBUS_SERVICE, devpath.path(), NM_DBUS_INTERFACE_DEVICE, dbc); +// desc += " "+devIface.property("Interface").toString(); +// desc += " "+QHostAddress(htonl(devIface.property("Ip4Address").toUInt())).toString(); + +// } + +// qWarning() << conDetails.property("Connection").value().path() << path.path(); + +// QListWidgetItem* item = new QListWidgetItem(desc, activeCons); +// item->setData(Qt::UserRole, path.path()); +// } +// } +} + +void NMView::update() +{ +// if(sess) +// qWarning() << __FUNCTION__<< sess->bytesWritten() << sess->bearerName(); +// QNetworkManagerInterface *dbIface; +// dbIface = new QNetworkManagerInterface; +// QList connections = dbIface->activeConnections(); +// +// foreach(QDBusObjectPath conpath, connections) { +// QNetworkManagerConnectionActive *aConn; +// aConn = new QNetworkManagerConnectionActive(conpath.path()); +// // in case of accesspoint, specificObject will hold the accessPOintObjectPath +// qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); +// QList devs = aConn->devices(); +// foreach(QDBusObjectPath device, devs) { +// qWarning() << " " << device.path(); +// } +// } + + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + foreach (QString service, connectionServices) { + QDBusInterface allCons(service, + NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, + dbc); + if (allCons.isValid()) { + QDBusReply > reply = allCons.call("ListConnections"); + if ( reply.isValid() ) { + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + QDBusInterface sysIface(service, + path.path(), + NM_DBUS_IFACE_SETTINGS_CONNECTION, + dbc); + if (sysIface.isValid()) { + qWarning() << ""; + qWarning() << path.path(); + + // QDBusMessage r = sysIface.call("GetSettings"); + QDBusReply< QNmSettingsMap > rep = sysIface.call("GetSettings"); + + QMap< QString, QMap > map = rep.value(); + QList list = map.keys(); + foreach (QString key, list) { + QMap innerMap = map[key]; + qWarning() << " Key: " << key; + QMap::const_iterator i = innerMap.constBegin(); + + while (i != innerMap.constEnd()) { + QString k = i.key(); + qWarning() << " Key: " << k << " Entry: " << i.value(); + i++; + }//end innerMap + }//end foreach key + }//end settings connection + } // foreach path + } //end ListConnections + } //end settingsInterface + }// end services + QDBusInterface iface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + dbc); + if (iface.isValid()) { + QVariant prop = iface.property("ActiveConnections"); + QList connections = prop.value >(); + foreach(QDBusObjectPath conpath, connections) { + qWarning() << "Active connection" << conpath.path(); + QDBusInterface conDetails(NM_DBUS_SERVICE, + conpath.path(), + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + dbc); + if (conDetails.isValid()) { + + QVariant prop = conDetails.property("Connection"); + QDBusObjectPath connection = prop.value(); + qWarning() << conDetails.property("Default").toBool() << connection.path(); + +// QVariant Sprop = conDetails.property("Devices"); +// QList so = Sprop.value >(); +// foreach(QDBusObjectPath device, so) { +// if(device.path() == devicePath) { +// path = connection.path(); +// } +// break; +// } + } + } + } +qWarning() << ""; +} + +void NMView::deactivate() +{ + QList configs = manager->allConfigurations(QNetworkConfiguration::Active); + foreach(QNetworkConfiguration p, configs) { + qWarning() << "Active cons" << p.name(); + if(p.name() == cons->currentItem()->text(0) + && p.identifier() == cons->currentItem()->text(2)) { + qWarning() <<__FUNCTION__<< p.name(); + if(!sess) { + sess = new QNetworkSession(p); + + connect(sess, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(stateChanged(QNetworkSession::State))); + + connect(sess, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(networkSessionError(QNetworkSession::SessionError))); + } + sess->close(); + delete sess; + sess = 0; + } + } +} + +void NMView::activate() +{ + qWarning() << __FUNCTION__ << cons->currentItem()->text(0); + + QList configs = manager->allConfigurations(); + foreach(QNetworkConfiguration p, configs) { + if(p.name() == cons->currentItem()->text(0)) { + + sess = new QNetworkSession(p); + + connect(sess, SIGNAL(newConfigurationActivated()), + this, SLOT(getActiveConnections())); + + connect(sess, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(stateChanged(QNetworkSession::State))); + + connect(sess, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(networkSessionError(QNetworkSession::SessionError))); + + sess->open(); + } + } +} + +void NMView::getDevices() +{ + qWarning() << ""; + qWarning() << __FUNCTION__; + devicesTreeWidget->clear(); + //qDBusRegisterMetaType(); + + if (!dbc.isConnected()) { + qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); + return; + } + QDBusInterface iface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + dbc); +//NetworkManager interface + if (!iface.isValid()) { + qWarning() << "Could not find NetworkManager"; + return; + } + +// uint state = iface.property("State").toUInt(); +// switch(state) { +// case NM_STATE_UNKNOWN: +// qWarning() << "State: Unknown"; break; +// case NM_STATE_ASLEEP: +// qWarning() << "State: Asleep"; break; +// case NM_STATE_CONNECTING: +// qWarning() << "State: Connecting"; break; +// case NM_STATE_CONNECTED: +// qWarning() << "State: Connected"; break; +// case NM_STATE_DISCONNECTED: +// qWarning() << "State: Disconnected"; break; +// } + + //get list of network devices + QTreeWidgetItem *item; + QDBusReply > reply = iface.call("GetDevices"); + if ( reply.isValid() ) { +// qWarning() << "Current devices:"; + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + QStringList devicesList; + qWarning() << " " << path.path(); + devicesList << path.path(); + + QDBusInterface devIface(NM_DBUS_SERVICE, + path.path(), + NM_DBUS_INTERFACE_DEVICE, + dbc); + if (devIface.isValid()) { + + + + ////// connect the dbus signal +// /*if(*/dbc.connect(NM_DBUS_SERVICE, +// path.path(), +// NM_DBUS_INTERFACE_DEVICE, +// "StateChanged", +// this,SLOT(deviceStateChanged(quint32))); +// { +// qWarning() << "XXXXXXXXXX dbus connect successful" << path.path(); +// } + + + // qWarning() << " Managed: " << devIface.property("Managed").toBool(); + devicesList << devIface.property("Managed").toString(); + // qWarning() << " Interface: " << devIface.property("Interface").toString(); + devicesList << devIface.property("Interface").toString(); + // qWarning() << " HAL UDI: " << devIface.property("Udi").toString(); + // qWarning() << " Driver: " << devIface.property("Driver").toString(); + devicesList << devIface.property("Driver").toString(); + + QString x = deviceTypeToString(devIface.property("DeviceType").toUInt()); + // qWarning() << " Type:" << x; + devicesList << x; + + if( devIface.property("DeviceType").toUInt() == DEVICE_TYPE_802_11_WIRELESS) { + qWarning() << "Device is WIFI"; + // // findAccessPoints(path.path()); + } + + QVariant v = devIface.property("State"); + x = deviceStateToString(v.toUInt()); +// qWarning() << " State:" << x; + devicesList << x; + + quint32 ip = devIface.property("Ip4Address").toUInt(); +// qWarning() << " IP4Address: " << QHostAddress(htonl(ip)).toString(); + devicesList << QHostAddress(htonl(ip)).toString(); + + + if (v.toUInt() == NM_DEVICE_STATE_ACTIVATED) { + QString path = devIface.property("Ip4Config").value().path(); +// qWarning() << " IP4Config: " << path; + devicesList << path; + QDBusInterface ipIface(NM_DBUS_SERVICE, + path, + NM_DBUS_INTERFACE_IP4_CONFIG, + dbc); + if (ipIface.isValid()) { + // qWarning() << " Hostname: " << ipIface.property("Hostname").toString(); + devicesList << ipIface.property("Hostname").toString(); +// qWarning() << " Domains: " << ipIface.property("Domains").toStringList(); + devicesList << ipIface.property("Domains").toStringList().join(", "); +// qWarning() << " NisDomain: " << ipIface.property("NisDomain").toString(); + QDBusArgument arg= ipIface.property("Addresses").value(); +// qWarning() << " Addresses: " << ipIface.property("Addresses"); +// qWarning() << " Nameservers: " << ipIface.property("Nameservers"); +// qWarning() << " NisServers: " << ipIface.property("NisServers"); + } + + } + + } + item = new QTreeWidgetItem(devicesList); + devicesTreeWidget->insertTopLevelItem(0, item); + } + } + + +// netconfig(); + +} + +void NMView::readSettings() +{ + QDBusInterface settingsiface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, + NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, + dbc); + //NetworkManagerSettings interface + if (settingsiface.isValid()) { + QDBusReply > reply = settingsiface.call("ListConnections"); + if ( reply.isValid() ) { + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + qWarning() <<__FUNCTION__ << path.path(); + + } + } + } + + QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); + if (!iface.isValid()) { + qWarning() << "Could not find NetworkManager"; + return; + } + + // QStringList list = item->text().split(" -> "); + + QVariant prop = iface.property("ActiveConnections"); + QList connections = prop.value >(); + foreach(QDBusObjectPath path, connections) { + QDBusInterface conDetails(NM_DBUS_SERVICE, + path.path(), + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + dbc); + + if (conDetails.isValid()) { + QString desc = path.path(); + qWarning() << desc; + //if ( item->text(0) == conDetails.property("Connection").value().path() ) { + // QListWidgetItem* item = new QTreeWidgetItem( desc, + // cons); + // item->setData(Qt::UserRole, desc); + // activeItemActivated( item ); + //} + } + } +} + +void NMView::printConnectionDetails(const QString& service) +{ + Q_UNUSED(service); + +// +// qWarning() << __FUNCTION__ << service; +// +// QDBusConnection dbc = QDBusConnection::systemBus(); +// if (!dbc.isConnected()) { +// qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); +// return; +// } +// QDBusInterface allCons(service, +// NM_DBUS_PATH_SETTINGS, +// NM_DBUS_IFACE_SETTINGS, +// dbc); +// +// if (allCons.isValid()) { +// QDBusReply > reply = allCons.call("ListConnections"); +// +// if ( reply.isValid() ) { +// qWarning() << "Known connections:"; +// QList list = reply.value(); +// +// foreach(QDBusObjectPath path, list) { +// qWarning() << " " << path.path(); +// +// QDBusInterface sysIface(NM_DBUS_SERVICE_SYSTEM_SETTINGS, +// path.path(), +// NM_DBUS_IFACE_SETTINGS_CONNECTION, +// dbc); +// +// if (sysIface.isValid()) { +// QDBusMessage r = sysIface.call("GetSettings"); +// QDBusReply< QSettingsMap > rep = sysIface.call("GetSettings"); +// +// qWarning() << " GetSettings:" << r.arguments() << r.signature() << rep.isValid() << sysIface.lastError(); +// +// QMap< QString, QMap > map = rep.value(); +// QList list = map.keys(); +// +// foreach (QString key, list) { +// QMap innerMap = map[key]; +// qWarning() << " Key: " << key; +// QMap::const_iterator i = innerMap.constBegin(); +// +// while (i != innerMap.constEnd()) { +// QString k = i.key(); +// qWarning() << " Key: " << k << " Entry: " << i.value(); +// +// if (k == "addresses" && i.value().canConvert()) { +// QDBusArgument arg = i.value().value(); +// arg.beginArray(); +// +// while (!arg.atEnd()) { +// QDBusVariant addr; +// arg >> addr; +// uint ip = addr.variant().toUInt(); +// qWarning() << ip; +// qWarning() << " " << QHostAddress(htonl(ip)).toString(); +// } +// +// } +// i++; +// } +// } +// } +// } +// } +// } + qWarning() << ""; +} + +void NMView::getNetworkDevices() +{ + +} + +void NMView::connectionItemActivated( QTreeWidgetItem * item, int col ) +{ + Q_UNUSED(col); + + qWarning() <<__FUNCTION__<< item->text(0); + QDBusInterface iface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + dbc); + if (!iface.isValid()) { + qWarning() << "Could not find NetworkManager"; + return; + } + QVariant prop = iface.property("ActiveConnections"); + QList connections = prop.value >(); + foreach(QDBusObjectPath path, connections) { + QDBusInterface conDetails(NM_DBUS_SERVICE, + path.path(), + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + dbc); + + if (conDetails.isValid()) { + QString desc = path.path(); + qWarning() << desc; + if ( item->text(0) == conDetails.property("Connection").value().path() ) { +// QListWidgetItem* item = new QTreeWidgetItem( desc, +// cons); +// item->setData(Qt::UserRole, desc); +// activeItemActivated( item ); + } + } + } +} + + + +void NMView::deviceItemActivated( QTreeWidgetItem * item , int section) +{ + Q_UNUSED(item); + Q_UNUSED(section); + + // qWarning() << item->text(section) << item->text(4); + //if(item->text(4) == "Wireless") findAccessPoints(item->text(0)); +} + + +void NMView::netconfig() +{ +// qWarning() << __FUNCTION__; + +// qDBusRegisterMetaType(); + QDBusConnection dbc = QDBusConnection::systemBus(); + if (!dbc.isConnected()) { + qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); + return; + } + + QDBusInterface iface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_IFACE_SETTINGS_CONNECTION, + dbc); + if (!iface.isValid()) { + qWarning() << "Could not find NetworkManager Settings"; + return; + } else { + QDBusReply > reply = iface.call("ListConnections"); + QList list = reply.value(); +// qWarning() << reply.value(); + foreach(QDBusObjectPath path, list) { + qWarning() << " " << path.path(); + } + } +} + + +void NMView::findAccessPoints() +{ + accessPointsTreeWidget->clear(); + + QDBusInterface iface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + dbc); + + QDBusReply > reply = iface.call("GetDevices"); + if ( reply.isValid() ) { + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + QDBusInterface devIface(NM_DBUS_SERVICE, + path.path(), + NM_DBUS_INTERFACE_DEVICE, + dbc); + if (devIface.isValid()) { + + if( devIface.property("DeviceType").toUInt() == DEVICE_TYPE_802_11_WIRELESS) { + +// qWarning() <<"deviface"<< devIface.path(); + QDBusInterface wififace(NM_DBUS_SERVICE, + devIface.path(), + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + dbc); + if (!wififace.isValid()) { + qWarning() << "Could not find NetworkManager wireless interface"; + return; + } + +///////////////////////// +// if(dbc.connect(NM_DBUS_SERVICE, +// path.path(), +// NM_DBUS_INTERFACE_DEVICE_WIRELESS, +// "PropertiesChanged", +// this,SLOT(aPPropertiesChanged( QMap))) ) { +// qWarning() << "PropertiesChanged connect"; +// } else { +// qWarning() << "NOT connect"; + +// } +///////////////////////// + qWarning() <<"wififace"<< wififace.path(); + QDBusReply > reply2 = wififace.call("GetAccessPoints"); + if ( reply2.isValid() ) { + QTreeWidgetItem *item; + QList list2 = reply2.value(); + foreach(QDBusObjectPath path2, list2) { + QDBusInterface accessPointIface(NM_DBUS_SERVICE, + path2.path(), + NM_DBUS_INTERFACE_ACCESS_POINT, + dbc); + if (accessPointIface.isValid()) { +//// qWarning() <<"path2" << path2.path(); + +// if(dbc.connect(NM_DBUS_SERVICE, //signal strength +// path2.path(), +// NM_DBUS_INTERFACE_ACCESS_POINT, +// "PropertiesChanged", +// this,SLOT(aPPropertiesChanged( QMap))) ) { +// qWarning() << "PropertiesChanged connect"; +// } else { +// qWarning() << "NOT connect"; +// +// } + + QStringList accessPoints; + accessPoints << accessPointIface.property("Ssid").toString(); + accessPoints << QString::number(accessPointIface.property("Strength").toInt()); + accessPoints << securityCapabilitiesToString(accessPointIface.property("WpaFlags" ).toInt()); + accessPoints << securityCapabilitiesToString(accessPointIface.property("RsnFlags" ).toInt()); + accessPoints << accessPointIface.property("Frequency" ).toString(); + accessPoints << accessPointIface.property("HwAddress" ).toString(); + accessPoints << deviceModeToString(accessPointIface.property("Mode" ).toInt()); + accessPoints << accessPointIface.property("MaxBitrate" ).toString(); + //HwAddress + // if(accessPointIface.property("Flags" ).toInt() == NM_802_11_AP_FLAGS_PRIVACY ) { + // qWarning() << "Secure"; + // } + item = new QTreeWidgetItem(accessPoints); + accessPointsTreeWidget->insertTopLevelItem(0, item); + } + } + } + } + } + } + } +} + +QString NMView::deviceStateToString(int state) +{ + QString ret; + switch(state) { + case NM_DEVICE_STATE_UNKNOWN: + ret = "Unknown"; + break; + case NM_DEVICE_STATE_UNMANAGED: + ret = "Unmanaged"; + break; + case NM_DEVICE_STATE_UNAVAILABLE: + ret = "Unavailable"; + break; + case NM_DEVICE_STATE_DISCONNECTED: + ret = "Disconnected"; + break; + case NM_DEVICE_STATE_PREPARE: + ret = "Preparing to connect"; + break; + case NM_DEVICE_STATE_CONFIG: + ret = "Being configured"; + break; + case NM_DEVICE_STATE_NEED_AUTH: + ret = "Awaiting secrets"; + break; + case NM_DEVICE_STATE_IP_CONFIG: + ret = "IP requested"; + break; + case NM_DEVICE_STATE_ACTIVATED: + ret = "Activated"; + break; + case NM_DEVICE_STATE_FAILED: + ret = "FAILED"; + break; + }; + return ret; +} + +QString NMView::deviceTypeToString(int device) +{ + QString ret; + switch(device) { + case DEVICE_TYPE_UNKNOWN: + ret = "Unknown"; + break; + case DEVICE_TYPE_802_3_ETHERNET: + ret = "Ethernet"; + break; + case DEVICE_TYPE_802_11_WIRELESS: + ret = "Wireless"; + break; + case DEVICE_TYPE_GSM: + ret = "GSM"; + break; + case DEVICE_TYPE_CDMA: + ret = "CDMA"; + break; + }; + return ret; +} + +QString NMView::securityCapabilitiesToString(int caps) +{ + int check = caps; +// qWarning() << __FUNCTION__<< caps; + QString ret; + if( check == 0 ) + ret += "None."; + if( (check & NM_802_11_AP_SEC_PAIR_WEP40)) + ret += " 40-bit WEP encryption. "; + if( (check & NM_802_11_AP_SEC_PAIR_WEP104) ) + ret += " 104-bit WEP encryption. "; + if( (check & NM_802_11_AP_SEC_PAIR_TKIP) ) + ret += " TKIP encryption. "; + if( (check & NM_802_11_AP_SEC_PAIR_CCMP) ) + ret += " CCMP encryption. "; + if( (check & NM_802_11_AP_SEC_GROUP_WEP40)) + ret += " 40-bit WEP cipher. "; + if( (check & NM_802_11_AP_SEC_GROUP_WEP104)) + ret += " 104-bit WEP cipher. "; + if( (check & NM_802_11_AP_SEC_GROUP_TKIP) ) + ret += " TKIP cipher. "; + if( (check & NM_802_11_AP_SEC_GROUP_CCMP) ) + ret += " CCMP cipher. "; + if( (check & NM_802_11_AP_SEC_KEY_MGMT_PSK)) + ret += " PSK key management. "; + if( (check & NM_802_11_AP_SEC_KEY_MGMT_802_1X) ) + ret += " 802.1x key management. "; + return ret; +} + +QString NMView::deviceModeToString(int mode) +{ + QString ret; + switch (mode) { + case NM_802_11_MODE_UNKNOWN: + ret = "Unknown"; + break; + case NM_802_11_MODE_ADHOC: + ret = " (Adhoc)."; + break; + case NM_802_11_MODE_INFRA: + ret = " (Infrastructure)"; + }; + return ret; +} + +void NMView::netManagerState(quint32 state) +{ + qWarning() << __FUNCTION__ << state;// << old << reason; + switch(state) { + case NM_STATE_UNKNOWN: + qWarning() << "The NetworkManager daemon is in an unknown state. "; + break; + case NM_STATE_ASLEEP: + qWarning() << "The NetworkManager daemon is asleep and all interfaces managed by it are inactive. "; + break; + case NM_STATE_CONNECTING: + qWarning() << "The NetworkManager daemon is connecting a device. FIXME: What does this mean when one device is active and another is connecting? "; + break; + case NM_STATE_CONNECTED: + qWarning() <<"The NetworkManager daemon is connected. "; + break; + case NM_STATE_DISCONNECTED: + qWarning() << "The NetworkManager daemon is disconnected."; + break; + + }; +} + +void NMView::deviceStateChanged(quint32 state) +{ + qWarning() << __FUNCTION__ << state; + switch(state) { + case NM_DEVICE_STATE_UNKNOWN : + qWarning() <<"The device is in an unknown state. "; + break; + case NM_DEVICE_STATE_UNMANAGED: + qWarning() <<"The device is not managed by NetworkManager."; + break; + case NM_DEVICE_STATE_UNAVAILABLE: + qWarning() <<"The device cannot be used (carrier off, rfkill, etc)."; + break; + case NM_DEVICE_STATE_DISCONNECTED: + qWarning() <<"The device is not connected."; + break; + case NM_DEVICE_STATE_PREPARE: + qWarning() <<"The device is preparing to connect."; + break; + case NM_DEVICE_STATE_CONFIG: + qWarning() <<"The device is being configured."; + break; + case NM_DEVICE_STATE_NEED_AUTH: + qWarning() <<"The device is awaiting secrets necessary to continue connection."; + break; + case NM_DEVICE_STATE_IP_CONFIG: + qWarning() <<"The IP settings of the device are being requested and configured."; + break; + case NM_DEVICE_STATE_ACTIVATED: + qWarning() <<"The device is active."; + break; + case NM_DEVICE_STATE_FAILED: + qWarning() <<"The device is in a failure state following an attempt to activate it."; + break; + }; +} + +void NMView::updateCompleted() +{ + qWarning() << __FUNCTION__; +} + +void NMView::newConfigurationActivated() +{ + qWarning() << __FUNCTION__; + getActiveConnections(); +} + +void NMView::stateChanged(QNetworkSession::State state) +{ + // QString stateStringstr; + switch (state) { + case QNetworkSession::Invalid: + stateString = "Invalid session"; + break; + case QNetworkSession::NotAvailable: + stateString = "Session is defined but not yet discovered"; + break; + case QNetworkSession::Connecting: + stateString = "Session is being established"; + break; + case QNetworkSession::Connected: + stateString = "Session is active and can be used for socket operations"; + cons->currentItem()->setText(1, "Active"); + break; + case QNetworkSession::Closing: + stateString = "Session is being shutdown"; + break; + case QNetworkSession::Disconnected: + qWarning() << __FUNCTION__; + manager->updateConfigurations(); + stateString = "Session disconnected"; + cons->currentItem()->setText(1,"Discovered") ; + break; + case QNetworkSession::Roaming: + stateString = "session is roaming from one AP to another"; + break; + }; + qWarning() << __FUNCTION__ << state << stateString; +} + +QString NMView::stateToString(int state) +{ + switch (state) { + case QNetworkConfiguration::Undefined: + return "Undefined"; + break; + case QNetworkConfiguration::Defined: + return "Defined"; + break; + case QNetworkConfiguration::Discovered: + return "Discovered"; + break; + case QNetworkConfiguration::Active: + return "Active"; + break; + }; + return ""; +} + +void NMView::configurationAdded(const QNetworkConfiguration &config) +{ + qWarning() << __FUNCTION__<< config.name() << config.identifier(); +} + +QString NMView::typeToString(int type) +{ + switch(type) { + case QNetworkConfiguration::InternetAccessPoint: + return "Internet AccessPoint"; + break; + case QNetworkConfiguration::ServiceNetwork: + return "Service Network"; + break; + }; + return QString(); +} + +void NMView::aPPropertiesChanged( QMap map) +{ + //QMap::const_iterator iterator = d->values.find(type + QLatin1String("Path")) + QMapIterator i(map); + while (i.hasNext()) { + i.next(); + if( i.key() == "State") { + qWarning() << __FUNCTION__ << i.key() << ": " << i.value().toUInt(); +// deviceStateChanged(i.value().toUInt()); + } else if( i.key() == "ActiveAccessPoint") { + qWarning() << __FUNCTION__ << i.key() << ": " << i.value().value().path(); + } else if( i.key() == "Strength") + qWarning() << __FUNCTION__ << i.key() << ": " << i.value().toUInt(); + else + qWarning() << __FUNCTION__ << i.key() << ": " << i.value(); + } +} + +void NMView::networkSessionError(QNetworkSession::SessionError error) +{ + QString errorStr; + switch(error) { + case QNetworkSession::RoamingError: + errorStr = "Roaming error"; + break; + case QNetworkSession::SessionAbortedError: + errorStr = "Session aborted by user or system"; + break; + default: + case QNetworkSession::UnknownSessionError: + errorStr = "Unidentified Error"; + break; + }; + + QMessageBox::warning(this, tr("NMView"), errorStr, QMessageBox::Ok); +} diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h new file mode 100644 index 0000000..641385e --- /dev/null +++ b/tests/manual/networkmanager/nmview.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "ui_dialog.h" + +QTM_USE_NAMESPACE + +class QListWidget; +class QTreeWidget; +class QTreeWidgetItem; + +class NMView : public QDialog, private Ui::Dialog +{ + Q_OBJECT +public: + NMView(QDialog* parent = 0); + virtual ~NMView(); + +private: + void init(); + QString stateString; + + QDBusConnection dbc; + void printConnectionDetails(const QString&); + + QString deviceStateToString(int state); + QString deviceTypeToString(int device); + QString securityCapabilitiesToString(int caps); + QString deviceModeToString(int mode); +//QDBusInterface getInterface(); + QNetworkConfigurationManager *manager; + QNetworkSession *sess; + QString stateToString(int state); + QString typeToString(int type); + +private slots: + void update(); + void deactivate(); + void activate(); + void getActiveConnections(); + void updateConnections(); + void getDevices(); + // void readConnectionManagerDetails(); + void getNetworkDevices(); + void connectionItemActivated( QTreeWidgetItem *, int); +// void activeItemActivated( QListWidgetItem *); + void deviceItemActivated( QTreeWidgetItem *, int); + void netconfig(); + void findAccessPoints(); + + void netManagerState(quint32); + void readSettings(); + void updateCompleted(); + void newConfigurationActivated(); + + void stateChanged(QNetworkSession::State); + void deviceStateChanged(quint32 state); + + void configurationAdded(const QNetworkConfiguration &config); + void aPPropertiesChanged( QMap map); + void networkSessionError(QNetworkSession::SessionError); + +}; diff --git a/tests/manual/networkmanager/startdlg.cpp b/tests/manual/networkmanager/startdlg.cpp new file mode 100644 index 0000000..4720932 --- /dev/null +++ b/tests/manual/networkmanager/startdlg.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $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 "startdlg.h" +#include + + +StartDialog::StartDialog(QWidget * parent) + :QDialog(parent) +{ + QVBoxLayout *layout = new QVBoxLayout(this); + box = new QComboBox(); + layout->addWidget(box); + + QHBoxLayout* hbox = new QHBoxLayout(); + QPushButton* start = new QPushButton("Start"); + connect(start, SIGNAL(clicked()), this, SLOT(accept())); + QPushButton* cancel = new QPushButton("Cancel"); + connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); + + + hbox->addWidget(start); + hbox->addWidget(cancel); + + layout->addLayout(hbox); + + QDBusConnection dbc = QDBusConnection::systemBus(); + if (!dbc.isConnected()) { + qWarning() << "Unable to connect to D-Bus:" << dbc.lastError(); + return; + } + QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbc); + if (!iface.isValid()) { + qWarning() << "Could not find NetworkManager"; + return; + } + QDBusReply > reply = iface.call("GetDevices"); + if ( reply.isValid() ) { + QList list = reply.value(); + foreach(QDBusObjectPath path, list) { + QDBusInterface devIface(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_DEVICE, dbc); + if ( devIface.isValid() ) { + box->addItem(devIface.property("Interface").toString(), QVariant(path.path())); + } + } + } +} + +QString StartDialog::device() const +{ + return dev; +} + +void StartDialog::accept() +{ + dev = box->itemData(box->currentIndex(), Qt::UserRole).toString(); + QDialog::accept(); +} diff --git a/tests/manual/networkmanager/startdlg.h b/tests/manual/networkmanager/startdlg.h new file mode 100644 index 0000000..a9f1e7c --- /dev/null +++ b/tests/manual/networkmanager/startdlg.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +class StartDialog : public QDialog +{ + Q_OBJECT +public: + StartDialog(QWidget* parent = 0); + + QString device() const; + +public slots: + void accept(); +private: + QString dev; + QComboBox* box; +}; -- cgit v0.12 From aedf9f81641ba4a85b15e35e6ac8ff457265133a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 13:54:49 +1000 Subject: Make compile. --- examples/network/bearercloud/bearercloud.h | 2 +- examples/network/bearercloud/bearercloud.pro | 18 --- examples/network/bearercloud/cloud.h | 2 +- examples/network/bearermonitor/bearermonitor.h | 2 +- examples/network/bearermonitor/bearermonitor.pro | 24 ++-- examples/network/bearermonitor/sessionwidget.h | 2 +- examples/network/network.pro | 4 +- src/network/bearer/bearer.pri | 130 +++++++++++++++++++++ src/network/bearer/qcorewlanengine_mac.mm | 4 +- src/network/bearer/qcorewlanengine_mac_p.h | 5 +- src/network/bearer/qgenericengine.cpp | 4 +- src/network/bearer/qgenericengine_p.h | 4 +- src/network/bearer/qnativewifiengine_win.cpp | 4 +- src/network/bearer/qnativewifiengine_win_p.h | 4 +- src/network/bearer/qnetworkconfigmanager.cpp | 4 +- src/network/bearer/qnetworkconfigmanager.h | 8 +- src/network/bearer/qnetworkconfigmanager_maemo.cpp | 4 +- src/network/bearer/qnetworkconfigmanager_maemo_p.h | 4 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 4 +- src/network/bearer/qnetworkconfigmanager_p.h | 4 +- src/network/bearer/qnetworkconfigmanager_s60_p.cpp | 4 +- src/network/bearer/qnetworkconfigmanager_s60_p.h | 4 +- src/network/bearer/qnetworkconfiguration.cpp | 4 +- src/network/bearer/qnetworkconfiguration.h | 9 +- src/network/bearer/qnetworkconfiguration_maemo_p.h | 4 +- src/network/bearer/qnetworkconfiguration_p.h | 4 +- src/network/bearer/qnetworkconfiguration_s60_p.cpp | 4 +- src/network/bearer/qnetworkconfiguration_s60_p.h | 4 +- src/network/bearer/qnetworkmanagerservice_p.cpp | 4 +- src/network/bearer/qnetworkmanagerservice_p.h | 13 +-- src/network/bearer/qnetworksession.cpp | 4 +- src/network/bearer/qnetworksession.h | 8 +- src/network/bearer/qnetworksession_maemo.cpp | 4 +- src/network/bearer/qnetworksession_maemo_p.h | 4 +- src/network/bearer/qnetworksession_p.cpp | 4 +- src/network/bearer/qnetworksession_p.h | 5 +- src/network/bearer/qnetworksession_s60_p.cpp | 4 +- src/network/bearer/qnetworksession_s60_p.h | 4 +- src/network/bearer/qnetworksessionengine.cpp | 4 +- src/network/bearer/qnetworksessionengine_p.h | 5 +- src/network/bearer/qnlaengine_win.cpp | 4 +- src/network/bearer/qnlaengine_win_p.h | 4 +- src/network/bearer/qnmdbushelper.cpp | 4 +- src/network/bearer/qnmdbushelper_p.h | 5 +- src/network/bearer/qnmwifiengine_unix.cpp | 10 +- src/network/bearer/qnmwifiengine_unix_p.h | 4 +- src/network/network.pro | 1 + tests/auto/auto.pro | 3 + .../qnetworkconfigmanager.pro | 12 +- .../tst_qnetworkconfigmanager.cpp | 2 +- .../qnetworkconfiguration.pro | 12 +- .../tst_qnetworkconfiguration.cpp | 2 +- tests/auto/qnetworksession/lackey/lackey.pro | 10 +- tests/auto/qnetworksession/lackey/main.cpp | 2 +- .../tst_qnetworksession/tst_qnetworksession.cpp | 2 +- .../tst_qnetworksession/tst_qnetworksession.pro | 18 +-- tests/manual/bearerex/bearerex.h | 2 +- tests/manual/bearerex/bearerex.pro | 16 --- tests/manual/networkmanager/networkmanager.pro | 10 -- tests/manual/networkmanager/nmview.cpp | 2 +- tests/manual/networkmanager/nmview.h | 2 +- 61 files changed, 245 insertions(+), 219 deletions(-) create mode 100644 src/network/bearer/bearer.pri diff --git a/examples/network/bearercloud/bearercloud.h b/examples/network/bearercloud/bearercloud.h index c18ffd3..79b441f 100644 --- a/examples/network/bearercloud/bearercloud.h +++ b/examples/network/bearercloud/bearercloud.h @@ -45,7 +45,7 @@ #include #include -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class Cloud; diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro index 308ddda..c45d62a 100644 --- a/examples/network/bearercloud/bearercloud.pro +++ b/examples/network/bearercloud/bearercloud.pro @@ -10,21 +10,3 @@ RESOURCES = icons.qrc TARGET = bearercloud QT = core gui network svg - -INCLUDEPATH += ../../src/bearer - -include(../examples.pri) - -qtAddLibrary(QtBearer) - -CONFIG += console - -include(../examples.pri) - - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - INCLUDEPATH += ../../ - contains(CONFIG, debug) { - } -} diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h index 4ce43df..f844725 100644 --- a/examples/network/bearercloud/cloud.h +++ b/examples/network/bearercloud/cloud.h @@ -43,7 +43,7 @@ #include #include -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class QGraphicsTextItem; class QGraphicsSvgItem; diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h index d1f4601..9306d90 100644 --- a/examples/network/bearermonitor/bearermonitor.h +++ b/examples/network/bearermonitor/bearermonitor.h @@ -50,7 +50,7 @@ #include "ui_bearermonitor_640_480.h" #endif -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class SessionWidget; diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index c8fb3c2..a854b55 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -4,7 +4,7 @@ HEADERS = sessionwidget.h \ SOURCES = main.cpp \ bearermonitor.cpp \ sessionwidget.cpp - + FORMS = bearermonitor_240_320.ui \ bearermonitor_640_480.ui \ sessionwidget.ui @@ -13,20 +13,10 @@ TARGET = bearermonitor QT = core gui network -INCLUDEPATH += ../../src/bearer - -include(../examples.pri) - -qtAddLibrary(QtBearer) -win32:!wince*:LIBS += -lWs2_32 -wince*:LIBS += -lWs2 - -CONFIG += console - -include(../examples.pri) - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - contains(CONFIG, debug) { - } +win32 { + !wince* { + LIBS += -lWs2_32 + } else { + LIBS += -lWs2 + } } diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index cb6591e..8bc60e4 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -46,7 +46,7 @@ #include -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class SessionWidget : public QWidget, public Ui_SessionWidget { diff --git a/examples/network/network.pro b/examples/network/network.pro index c5a97fb..bd632b8 100644 --- a/examples/network/network.pro +++ b/examples/network/network.pro @@ -11,7 +11,9 @@ SUBDIRS = blockingfortuneclient \ loopback \ threadedfortuneserver \ googlesuggest \ - torrent + torrent \ + bearercloud \ + bearermonitor # no QProcess !vxworks:!qnx:SUBDIRS += network-chat diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri new file mode 100644 index 0000000..d8ddce5 --- /dev/null +++ b/src/network/bearer/bearer.pri @@ -0,0 +1,130 @@ +# Qt network bearer management module + +#DEFINES += BEARER_MANAGEMENT_DEBUG + +HEADERS += bearer/qnetworkconfiguration.h \ + bearer/qnetworksession.h \ + bearer/qnetworkconfigmanager.h + +SOURCES += bearer/qnetworksession.cpp \ + bearer/qnetworkconfigmanager.cpp \ + bearer/qnetworkconfiguration.cpp + +symbian { + exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ + exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { + message("Building with SNAP support") + DEFINES += SNAP_FUNCTIONALITY_AVAILABLE + LIBS += -lcmmanager + } else { + message("Building without SNAP support") + LIBS += -lapengine + } + + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + + HEADERS += bearer/qnetworkconfigmanager_s60_p.h \ + bearer/qnetworkconfiguration_s60_p.h \ + bearer/qnetworksession_s60_p.h + SOURCES += bearer/qnetworkconfigmanager_s60_p.cpp \ + bearer/qnetworkconfiguration_s60_p.cpp \ + bearer/qnetworksession_s60_p.cpp + + LIBS += -lcommdb \ + -lapsettingshandlerui \ + -lconnmon \ + -lcentralrepository \ + -lesock \ + -linsock \ + -lecom \ + -lefsrv \ + -lnetmeta +} else:maemo { + QT += dbus + CONFIG += link_pkgconfig + + exists(../debug) { + message("Enabling debug messages.") + DEFINES += BEARER_MANAGEMENT_DEBUG + } + + HEADERS += bearer/qnetworksession_maemo_p.h \ + bearer/qnetworkconfigmanager_maemo_p.h \ + bearer/qnetworkconfiguration_maemo_p.h + + SOURCES += bearer/qnetworkconfigmanager_maemo.cpp \ + bearer/qnetworksession_maemo.cpp + + documentation.path = $$QT_MOBILITY_PREFIX/doc + documentation.files = doc/html + + PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet + + CONFIG += create_pc create_prl + QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet + pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig + pkgconfig.files = QtBearer.pc + + INSTALLS += pkgconfig documentation +} else { + DEFINES += BEARER_ENGINE + + HEADERS += bearer/qnetworkconfigmanager_p.h \ + bearer/qnetworkconfiguration_p.h \ + bearer/qnetworksession_p.h \ + bearer/qnetworksessionengine_p.h \ + bearer/qgenericengine_p.h + + SOURCES += bearer/qnetworkconfigmanager_p.cpp \ + bearer/qnetworksession_p.cpp \ + bearer/qnetworksessionengine.cpp \ + bearer/qgenericengine.cpp + + unix:!mac:contains(networkmanager_enabled, yes) { + contains(QT_CONFIG,dbus) { + DEFINES += BACKEND_NM + QT += dbus + + HEADERS += bearer/qnmdbushelper_p.h \ + bearer/qnetworkmanagerservice_p.h \ + bearer/qnmwifiengine_unix_p.h + + SOURCES += bearer/qnmdbushelper.cpp \ + bearer/qnetworkmanagerservice_p.cpp \ + bearer/qnmwifiengine_unix.cpp + } else { + message("NetworkManager backend requires Qt DBus support") + } + } + + win32 { + HEADERS += bearer/qnlaengine_win_p.h \ + bearer/qnetworksessionengine_win_p.h + + SOURCES += bearer/qnlaengine_win.cpp + + !wince* { + HEADERS += bearer/qnativewifiengine_win_p.h + + SOURCES += bearer/qnativewifiengine_win.cpp + + LIBS += -lWs2_32 + } else { + LIBS += -lWs2 + } + } + + macx { + HEADERS += bearer/qcorewlanengine_mac_p.h + SOURCES+= bearer/qcorewlanengine_mac.mm + LIBS += -framework Foundation -framework SystemConfiguration + + contains(corewlan_enabled, yes) { + isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { + LIBS += -framework CoreWLAN + DEFINES += MAC_SDK_10_6 + } + } + } +} + diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm index 5451615..5854384 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -63,7 +63,7 @@ #include QMap networkInterfaces; -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) @@ -457,5 +457,5 @@ bool QCoreWlanEngine::getAllScInterfaces() #include "moc_qcorewlanengine_mac_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qcorewlanengine_mac_p.h b/src/network/bearer/qcorewlanengine_mac_p.h index fc8e4b5..660ddb5 100644 --- a/src/network/bearer/qcorewlanengine_mac_p.h +++ b/src/network/bearer/qcorewlanengine_mac_p.h @@ -56,7 +56,8 @@ #include "qnetworksessionengine_p.h" #include #include -QTM_BEGIN_NAMESPACE + +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -94,7 +95,7 @@ private: bool isKnownSsid(const QString &interfaceName, const QString &ssid); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp index 184a69c..2e48ce8 100644 --- a/src/network/bearer/qgenericengine.cpp +++ b/src/network/bearer/qgenericengine.cpp @@ -53,7 +53,7 @@ #include "qnetworksessionengine_win_p.h" #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QGenericEngine, genericEngine) @@ -230,5 +230,5 @@ QGenericEngine *QGenericEngine::instance() } #include "moc_qgenericengine_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qgenericengine_p.h b/src/network/bearer/qgenericengine_p.h index 976776e..88de2a0 100644 --- a/src/network/bearer/qgenericengine_p.h +++ b/src/network/bearer/qgenericengine_p.h @@ -58,7 +58,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -88,7 +88,7 @@ private: QTimer pollTimer; }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif diff --git a/src/network/bearer/qnativewifiengine_win.cpp b/src/network/bearer/qnativewifiengine_win.cpp index d8fe5fb..b4b3888 100644 --- a/src/network/bearer/qnativewifiengine_win.cpp +++ b/src/network/bearer/qnativewifiengine_win.cpp @@ -52,7 +52,7 @@ #include #undef interface -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNativeWifiEngine, nativeWifiEngine) @@ -723,4 +723,4 @@ QNativeWifiEngine *QNativeWifiEngine::instance() #include "moc_qnativewifiengine_win_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnativewifiengine_win_p.h b/src/network/bearer/qnativewifiengine_win_p.h index 0d5bcb0..adc75e1 100644 --- a/src/network/bearer/qnativewifiengine_win_p.h +++ b/src/network/bearer/qnativewifiengine_win_p.h @@ -57,7 +57,7 @@ #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -90,6 +90,6 @@ private: Qt::HANDLE handle; }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 264f0df..4b28b22 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -47,7 +47,7 @@ #include "qnetworkconfigmanager_p.h" #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); @@ -329,5 +329,5 @@ void QNetworkConfigurationManager::updateConfigurations() #include "moc_qnetworkconfigmanager.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 98641f6..940fcc5 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -42,17 +42,15 @@ #ifndef QNETWORKCONFIGURATIONMANAGER_H #define QNETWORKCONFIGURATIONMANAGER_H -#include "qmobilityglobal.h" - #include #include "qnetworkconfiguration.h" QT_BEGIN_HEADER -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationManagerPrivate; -class Q_BEARER_EXPORT QNetworkConfigurationManager : public QObject +class Q_NETWORK_EXPORT QNetworkConfigurationManager : public QObject { Q_OBJECT @@ -93,7 +91,7 @@ Q_SIGNALS: Q_DECLARE_OPERATORS_FOR_FLAGS(QNetworkConfigurationManager::Capabilities) -QTM_END_NAMESPACE +QT_END_NAMESPACE QT_END_HEADER diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp index 795b054..26909f9 100644 --- a/src/network/bearer/qnetworkconfigmanager_maemo.cpp +++ b/src/network/bearer/qnetworkconfigmanager_maemo.cpp @@ -53,7 +53,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE #define IAP "/system/osso/connectivity/IAP" static int iap_prefix_len; @@ -757,4 +757,4 @@ void QNetworkConfigurationManagerPrivate::configChanged(QNetworkConfigurationPri #include "qnetworkconfigmanager_maemo.moc" #include "moc_qnetworkconfigmanager_maemo_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_maemo_p.h b/src/network/bearer/qnetworkconfigmanager_maemo_p.h index e182495..a5462b8 100644 --- a/src/network/bearer/qnetworkconfigmanager_maemo_p.h +++ b/src/network/bearer/qnetworkconfigmanager_maemo_p.h @@ -60,7 +60,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationManagerPrivate : public QObject @@ -136,6 +136,6 @@ Q_SIGNALS: void onlineStateChanged(bool isOnline); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 8b15f41..49135c1 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -59,7 +59,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() { @@ -446,5 +446,5 @@ void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() #include "moc_qnetworkconfigmanager_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 0c42f9b..184d1bd 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -59,7 +59,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE #ifdef BEARER_ENGINE class QNetworkSessionEngine; @@ -173,6 +173,6 @@ private Q_SLOTS: #endif }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp index 760a194..8859a4e 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp @@ -58,7 +58,7 @@ #include #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE static const int KValueThatWillBeAddedToSNAPId = 1000; static const int KUserChoiceIAPId = 0; @@ -971,4 +971,4 @@ void AccessPointsAvailabilityScanner::RunL() } } #include "moc_qnetworkconfigmanager_s60_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h index 296d67f..cd48df6 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -65,7 +65,7 @@ class CCommsDatabase; class QTimer; -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkSessionPrivate; class AccessPointsAvailabilityScanner; @@ -177,6 +177,6 @@ private: // Data TConnMonIapInfoBuf iIapBuf; }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index c92b356..9422f07 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -47,7 +47,7 @@ #include "qnetworkconfiguration_p.h" #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE /*! \class QNetworkConfiguration @@ -345,5 +345,5 @@ QList QNetworkConfiguration::children() const } -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index f8c17d5..e1fbc43 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -42,18 +42,17 @@ #ifndef QNETWORKCONFIGURATION_H #define QNETWORKCONFIGURATION_H -#include "qmobilityglobal.h" - +#include #include #include #include QT_BEGIN_HEADER -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; -class Q_BEARER_EXPORT QNetworkConfiguration +class Q_NETWORK_EXPORT QNetworkConfiguration { public: QNetworkConfiguration(); @@ -106,7 +105,7 @@ private: QExplicitlySharedDataPointer d; }; -QTM_END_NAMESPACE +QT_END_NAMESPACE QT_END_HEADER diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h index 8d786aa..8d7fbcf 100644 --- a/src/network/bearer/qnetworkconfiguration_maemo_p.h +++ b/src/network/bearer/qnetworkconfiguration_maemo_p.h @@ -57,7 +57,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate : public QSharedData { @@ -104,6 +104,6 @@ private: QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index a3bcd9a..1dd53c4 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -57,7 +57,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate : public QSharedData { @@ -99,6 +99,6 @@ private: QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 61548ba..289e09c 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -41,7 +41,7 @@ #include "qnetworkconfiguration_s60_p.h" -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE QNetworkConfigurationPrivate::QNetworkConfigurationPrivate() : isValid(false), type(QNetworkConfiguration::Invalid), @@ -57,4 +57,4 @@ QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate() serviceNetworkMembers.clear(); } -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h index 44f8f56..bccad0c 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -56,7 +56,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate : public QSharedData { @@ -102,7 +102,7 @@ private: QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkmanagerservice_p.cpp b/src/network/bearer/qnetworkmanagerservice_p.cpp index 2f91af0..4e25533 100644 --- a/src/network/bearer/qnetworkmanagerservice_p.cpp +++ b/src/network/bearer/qnetworkmanagerservice_p.cpp @@ -57,7 +57,7 @@ #include "qnetworkmanagerservice_p.h" //Q_DECLARE_METATYPE(QList) -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE static QDBusConnection dbusConnection = QDBusConnection::systemBus(); //static QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbusConnection); @@ -1008,4 +1008,4 @@ QStringList QNetworkManagerIp4Config::domains() const #include "moc_qnetworkmanagerservice_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkmanagerservice_p.h b/src/network/bearer/qnetworkmanagerservice_p.h index 8569e71..91bf69d 100644 --- a/src/network/bearer/qnetworkmanagerservice_p.h +++ b/src/network/bearer/qnetworkmanagerservice_p.h @@ -64,19 +64,16 @@ #include -#include +#include "qnmdbushelper_p.h" +QT_BEGIN_NAMESPACE -QTM_BEGIN_NAMESPACE typedef QMap< QString, QMap > QNmSettingsMap; typedef QList ServerThing; -QTM_END_NAMESPACE -Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QNmSettingsMap)) -Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(ServerThing)) +Q_DECLARE_METATYPE(QNmSettingsMap) +Q_DECLARE_METATYPE(ServerThing) - -QTM_BEGIN_NAMESPACE class QNetworkManagerInterfacePrivate; class QNetworkManagerInterface : public QObject { @@ -395,6 +392,6 @@ public: }; //// -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKMANAGERSERVICE_H diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index d3a323a..bdae9bc 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -52,7 +52,7 @@ #include "qnetworksession_p.h" #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE /*! \class QNetworkSession @@ -686,4 +686,4 @@ void QNetworkSession::disconnectNotify(const char *signal) #include "moc_qnetworksession.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 47377c4..61093c7 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -42,8 +42,6 @@ #ifndef QNETWORKSESSION_H #define QNETWORKSESSION_H -#include "qmobilityglobal.h" - #include #include #include @@ -54,10 +52,10 @@ QT_BEGIN_HEADER -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkSessionPrivate; -class Q_BEARER_EXPORT QNetworkSession : public QObject +class Q_NETWORK_EXPORT QNetworkSession : public QObject { Q_OBJECT public: @@ -128,7 +126,7 @@ private: friend class QNetworkSessionPrivate; }; -QTM_END_NAMESPACE +QT_END_NAMESPACE QT_END_HEADER diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp index c7c7a31..742499c 100644 --- a/src/network/bearer/qnetworksession_maemo.cpp +++ b/src/network/bearer/qnetworksession_maemo.cpp @@ -54,7 +54,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE static QHash properties; @@ -1178,4 +1178,4 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const #include "qnetworksession_maemo.moc" #include "moc_qnetworksession_maemo_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h index e233087..6594176 100644 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -62,7 +62,7 @@ #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkSessionPrivate : public QObject { @@ -161,7 +161,7 @@ private: void cleanupSession(void); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKSESSIONPRIVATE_H diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index c6f9833..6df4fdb9 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -63,7 +63,7 @@ #include "qnmwifiengine_unix_p.h" #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE #if defined(BACKEND_NM) static bool NetworkManagerAvailable() @@ -538,5 +538,5 @@ if(serviceName.isEmpty()) #endif #include "moc_qnetworksession_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a2aaa6a..45e0ebf 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -63,7 +63,8 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE + #ifdef BEARER_ENGINE class QNetworkSessionEngine; #endif @@ -161,7 +162,7 @@ private: #endif }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKSESSIONPRIVATE_H diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp index 764c1c4..0a54b87 100644 --- a/src/network/bearer/qnetworksession_s60_p.cpp +++ b/src/network/bearer/qnetworksession_s60_p.cpp @@ -49,7 +49,7 @@ #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE QNetworkSessionPrivate::QNetworkSessionPrivate() : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid), @@ -1165,4 +1165,4 @@ void ConnectionProgressNotifier::RunL() #include "moc_qnetworksession_s60_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h index cfb99c9..6e62f10 100644 --- a/src/network/bearer/qnetworksession_s60_p.h +++ b/src/network/bearer/qnetworksession_s60_p.h @@ -67,7 +67,7 @@ typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*); -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class ConnectionProgressNotifier; @@ -207,7 +207,7 @@ private: // Data }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif //QNETWORKSESSIONPRIVATE_H diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp index 55fc4f3..7148d14 100644 --- a/src/network/bearer/qnetworksessionengine.cpp +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -41,7 +41,7 @@ #include "qnetworksessionengine_p.h" -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE QNetworkSessionEngine::QNetworkSessionEngine(QObject *parent) : QObject(parent) @@ -53,5 +53,5 @@ QNetworkSessionEngine::~QNetworkSessionEngine() } #include "moc_qnetworksessionengine_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 795a209..6be750f 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -53,13 +53,12 @@ // We mean it. // -#include #include #include #include #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class QNetworkSessionEngine : public QObject @@ -93,6 +92,6 @@ Q_SIGNALS: void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif diff --git a/src/network/bearer/qnlaengine_win.cpp b/src/network/bearer/qnlaengine_win.cpp index b606ef4..b1156d0 100644 --- a/src/network/bearer/qnlaengine_win.cpp +++ b/src/network/bearer/qnlaengine_win.cpp @@ -51,7 +51,7 @@ #include "qnetworksessionengine_win_p.h" -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNlaEngine, nlaEngine) @@ -586,7 +586,7 @@ QNlaEngine *QNlaEngine::instance() #include "qnlaengine_win.moc" #include "moc_qnlaengine_win_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnlaengine_win_p.h b/src/network/bearer/qnlaengine_win_p.h index 394b8cf..d9d752b 100644 --- a/src/network/bearer/qnlaengine_win_p.h +++ b/src/network/bearer/qnlaengine_win_p.h @@ -57,7 +57,7 @@ #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class QNlaThread; @@ -99,6 +99,6 @@ private: QMap configurationInterface; }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif diff --git a/src/network/bearer/qnmdbushelper.cpp b/src/network/bearer/qnmdbushelper.cpp index 3b780f6..e8ac78e 100644 --- a/src/network/bearer/qnmdbushelper.cpp +++ b/src/network/bearer/qnmdbushelper.cpp @@ -54,7 +54,7 @@ #include -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE void QNmDBusHelper::deviceStateChanged(quint32 state) { @@ -114,4 +114,4 @@ void QNmDBusHelper::slotSettingsRemoved() } #include "moc_qnmdbushelper_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnmdbushelper_p.h b/src/network/bearer/qnmdbushelper_p.h index f0248dc..ebd4e63 100644 --- a/src/network/bearer/qnmdbushelper_p.h +++ b/src/network/bearer/qnmdbushelper_p.h @@ -53,14 +53,13 @@ // We mean it. // -#include #if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) #include #include #include #endif -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE #if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) @@ -85,6 +84,6 @@ Q_SIGNALS: }; #endif -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif// QNMDBUSHELPERPRIVATE_H diff --git a/src/network/bearer/qnmwifiengine_unix.cpp b/src/network/bearer/qnmwifiengine_unix.cpp index f558fa8..c228bcc 100644 --- a/src/network/bearer/qnmwifiengine_unix.cpp +++ b/src/network/bearer/qnmwifiengine_unix.cpp @@ -51,16 +51,12 @@ #include +QT_BEGIN_NAMESPACE - -QTM_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNmWifiEngine, nmWifiEngine) typedef QList > QNmSettingsAddressMap; -QTM_END_NAMESPACE - -Q_DECLARE_METATYPE(QTM_PREPEND_NAMESPACE(QNmSettingsAddressMap)) -QTM_BEGIN_NAMESPACE +Q_DECLARE_METATYPE(QNmSettingsAddressMap) QNmWifiEngine::QNmWifiEngine(QObject *parent) : QNetworkSessionEngine(parent) @@ -1129,5 +1125,5 @@ QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) #include "moc_qnmwifiengine_unix_p.cpp" -QTM_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/network/bearer/qnmwifiengine_unix_p.h b/src/network/bearer/qnmwifiengine_unix_p.h index 1287800..a1bdb7b 100644 --- a/src/network/bearer/qnmwifiengine_unix_p.h +++ b/src/network/bearer/qnmwifiengine_unix_p.h @@ -67,7 +67,7 @@ -QTM_BEGIN_NAMESPACE +QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -157,7 +157,7 @@ private slots: void slotActivationFinished(QDBusPendingCallWatcher*); }; -QTM_END_NAMESPACE +QT_END_NAMESPACE #endif diff --git a/src/network/network.pro b/src/network/network.pro index e890b94..8582d8a 100644 --- a/src/network/network.pro +++ b/src/network/network.pro @@ -17,6 +17,7 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore include(../qbase.pri) include(access/access.pri) +include(bearer/bearer.pri) include(kernel/kernel.pri) include(socket/socket.pri) include(ssl/ssl.pri) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index d5d72a7..176cc3a 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -434,7 +434,10 @@ SUBDIRS += \ qmargins \ qnetworkaddressentry \ qnetworkcachemetadata \ + qnetworkconfigmanager \ + qnetworkconfiguration \ qnetworkdiskcache \ + qnetworksession \ qobjectperformance \ qpainterpathstroker \ qplugin \ diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro index 0b2ed1a..b539dd3 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -1,15 +1,5 @@ +load(qttest_p4) SOURCES += tst_qnetworkconfigmanager.cpp HEADERS += ../qbearertestcommon.h -TARGET = tst_qnetworkconfigurationmanager -CONFIG += testcase QT = core network - -INCLUDEPATH += ../../../src/bearer - -include(../../../common.pri) -qtAddLibrary(QtBearer) - -symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp index 796677d..f92704d 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -49,7 +49,7 @@ #include #endif -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class tst_QNetworkConfigurationManager : public QObject { Q_OBJECT diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro index 61e4097..078983d 100644 --- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -1,15 +1,5 @@ +load(qttest_p4) SOURCES += tst_qnetworkconfiguration.cpp HEADERS += ../qbearertestcommon.h -TARGET = tst_qnetworkconfiguration -CONFIG += testcase QT = core network - -INCLUDEPATH += ../../../src/bearer - -include(../../../common.pri) -qtAddLibrary(QtBearer) - -symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index cbb13f3..ac0f054 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -49,7 +49,7 @@ #include #endif -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class tst_QNetworkConfiguration : public QObject { Q_OBJECT diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index 4cb8555..ccbdd98 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -1,12 +1,4 @@ +load(qttest_p4) SOURCES += main.cpp -TARGET = qnetworksessionlackey -INCLUDEPATH += ../../../../src/bearer -DEPENDPATH += ../../../../src/bearer QT = core network - -CONFIG+= testcase - -include(../../../../common.pri) - -qtAddLibrary(QtBearer) diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 53f6f4f..8190292 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -48,7 +48,7 @@ #include -QTM_USE_NAMESPACE +QT_USE_NAMESPACE #define NO_DISCOVERED_CONFIGURATIONS_ERROR 1 diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index cbd4c8f..b5935e1 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -51,7 +51,7 @@ #include #endif -QTM_USE_NAMESPACE +QT_USE_NAMESPACE Q_DECLARE_METATYPE(QNetworkConfiguration) Q_DECLARE_METATYPE(QNetworkSession::State); diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index 1410601..bf33122 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -1,21 +1,5 @@ +load(qttest_p4) SOURCES += tst_qnetworksession.cpp HEADERS += ../../qbearertestcommon.h -TARGET = tst_qnetworksession -CONFIG += testcase QT = core network - -INCLUDEPATH += ../../../../src/bearer - -include(../../../../common.pri) -qtAddLibrary(QtBearer) - -wince* { - LACKEY.sources = $$OUTPUT_DIR/build/tests/bin/qnetworksessionlackey.exe - LACKEY.path = . - DEPLOYMENT += LACKEY -} - -symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h index f18180e..04da6ca 100644 --- a/tests/manual/bearerex/bearerex.h +++ b/tests/manual/bearerex/bearerex.h @@ -54,7 +54,7 @@ class QHttp; class SessionTab; -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class BearerEx : public QMainWindow, public Ui::BearerExMainWindow { diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro index a870eb1..476e87c 100644 --- a/tests/manual/bearerex/bearerex.pro +++ b/tests/manual/bearerex/bearerex.pro @@ -8,13 +8,6 @@ QT += core \ FORMS += sessiondialog.ui \ bearerex.ui \ detailedinfodialog.ui -include(../../common.pri) -#not really a test case but deployment happens same way -CONFIG += testcase - -DEPENDPATH += . -INCLUDEPATH += . \ - ../../src/bearer # Example headers and sources HEADERS += bearerex.h \ @@ -23,12 +16,3 @@ HEADERS += bearerex.h \ SOURCES += bearerex.cpp \ main.cpp \ xqlistwidget.cpp - -symbian: { - bearerex.sources = Qtbearer.dll - bearerex.path = /sys/bin - DEPLOYMENT += bearerex - - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} -qtAddLibrary(QtBearer) diff --git a/tests/manual/networkmanager/networkmanager.pro b/tests/manual/networkmanager/networkmanager.pro index 31b2af1..84289d3 100644 --- a/tests/manual/networkmanager/networkmanager.pro +++ b/tests/manual/networkmanager/networkmanager.pro @@ -4,16 +4,6 @@ TARGET = tst_networkmanagertest QT = core network dbus gui -#not really a test case but deployment happens same way -CONFIG += testcase - requires(contains(QT_CONFIG,dbus)) -INCLUDEPATH += ../../src/bearer -include(../../common.pri) - -qtAddLibrary(QtBearer) - -#MOC_DIR = .moc -#OBJECTS_DIR = .obj FORMS += dialog.ui diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp index ca9d907..35a0204 100644 --- a/tests/manual/networkmanager/nmview.cpp +++ b/tests/manual/networkmanager/nmview.cpp @@ -68,7 +68,7 @@ #include #include #include -#include +#include //static QDBusConnection dbc = QDBusConnection::systemBus(); //typedef QMap< QString, QMap > SettingsMap; diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h index 641385e..7db56d4 100644 --- a/tests/manual/networkmanager/nmview.h +++ b/tests/manual/networkmanager/nmview.h @@ -47,7 +47,7 @@ #include "ui_dialog.h" -QTM_USE_NAMESPACE +QT_USE_NAMESPACE class QListWidget; class QTreeWidget; -- cgit v0.12 From ce2439e97af96f6a704522b1aefebd888efd4fff Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 14:34:51 +1000 Subject: Fix up license headers. --- config.tests/mac/corelwan/corewlantest.mm | 2 +- config.tests/unix/networkmanager/main.cpp | 2 +- examples/network/bearercloud/bearercloud.cpp | 2 +- examples/network/bearercloud/bearercloud.h | 2 +- examples/network/bearercloud/cloud.cpp | 2 +- examples/network/bearercloud/cloud.h | 2 +- examples/network/bearercloud/main.cpp | 2 +- examples/network/bearermonitor/bearermonitor.cpp | 2 +- examples/network/bearermonitor/bearermonitor.h | 2 +- examples/network/bearermonitor/main.cpp | 2 +- examples/network/bearermonitor/sessionwidget.cpp | 2 +- examples/network/bearermonitor/sessionwidget.h | 2 +- src/network/bearer/qcorewlanengine_mac_p.h | 2 +- src/network/bearer/qgenericengine.cpp | 2 +- src/network/bearer/qgenericengine_p.h | 2 +- src/network/bearer/qnativewifiengine_win.cpp | 2 +- src/network/bearer/qnativewifiengine_win_p.h | 2 +- src/network/bearer/qnetworkconfigmanager.cpp | 2 +- src/network/bearer/qnetworkconfigmanager.h | 2 +- src/network/bearer/qnetworkconfigmanager_maemo.cpp | 2 +- src/network/bearer/qnetworkconfigmanager_maemo_p.h | 2 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 2 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworkconfigmanager_s60_p.cpp | 2 +- src/network/bearer/qnetworkconfigmanager_s60_p.h | 2 +- src/network/bearer/qnetworkconfiguration.cpp | 2 +- src/network/bearer/qnetworkconfiguration.h | 2 +- src/network/bearer/qnetworkconfiguration_maemo_p.h | 2 +- src/network/bearer/qnetworkconfiguration_p.h | 2 +- src/network/bearer/qnetworkconfiguration_s60_p.cpp | 2 +- src/network/bearer/qnetworkconfiguration_s60_p.h | 2 +- src/network/bearer/qnetworkmanagerservice_p.cpp | 2 +- src/network/bearer/qnetworkmanagerservice_p.h | 2 +- src/network/bearer/qnetworksession.cpp | 2 +- src/network/bearer/qnetworksession.h | 2 +- src/network/bearer/qnetworksession_maemo.cpp | 2 +- src/network/bearer/qnetworksession_maemo_p.h | 2 +- src/network/bearer/qnetworksession_p.cpp | 2 +- src/network/bearer/qnetworksession_p.h | 2 +- src/network/bearer/qnetworksession_s60_p.cpp | 2 +- src/network/bearer/qnetworksession_s60_p.h | 2 +- src/network/bearer/qnetworksessionengine.cpp | 2 +- src/network/bearer/qnetworksessionengine_p.h | 2 +- src/network/bearer/qnetworksessionengine_win_p.h | 2 +- src/network/bearer/qnlaengine_win.cpp | 2 +- src/network/bearer/qnlaengine_win_p.h | 2 +- src/network/bearer/qnmdbushelper.cpp | 2 +- src/network/bearer/qnmdbushelper_p.h | 2 +- src/network/bearer/qnmwifiengine_unix.cpp | 2 +- src/network/bearer/qnmwifiengine_unix_p.h | 2 +- tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp | 2 +- tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp | 2 +- tests/auto/qnetworksession/lackey/main.cpp | 2 +- tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp | 2 +- tests/manual/bearerex/bearerex.cpp | 3 ++- tests/manual/bearerex/bearerex.h | 3 ++- tests/manual/bearerex/main.cpp | 3 ++- tests/manual/bearerex/xqlistwidget.cpp | 3 ++- tests/manual/bearerex/xqlistwidget.h | 3 ++- tests/manual/networkmanager/networkmanagertest.cpp | 2 +- tests/manual/networkmanager/nmview.cpp | 2 +- tests/manual/networkmanager/nmview.h | 2 +- tests/manual/networkmanager/startdlg.cpp | 3 ++- tests/manual/networkmanager/startdlg.h | 3 ++- 64 files changed, 71 insertions(+), 64 deletions(-) diff --git a/config.tests/mac/corelwan/corewlantest.mm b/config.tests/mac/corelwan/corewlantest.mm index bcddf44..3a29d84 100644 --- a/config.tests/mac/corelwan/corewlantest.mm +++ b/config.tests/mac/corelwan/corewlantest.mm @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the config.tests of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/config.tests/unix/networkmanager/main.cpp b/config.tests/unix/networkmanager/main.cpp index 6f2bae6..27e6bd1 100644 --- a/config.tests/unix/networkmanager/main.cpp +++ b/config.tests/unix/networkmanager/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the config.tests of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearercloud/bearercloud.cpp b/examples/network/bearercloud/bearercloud.cpp index 182d4ec..27a296d 100644 --- a/examples/network/bearercloud/bearercloud.cpp +++ b/examples/network/bearercloud/bearercloud.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearercloud/bearercloud.h b/examples/network/bearercloud/bearercloud.h index 79b441f..f09cb53 100644 --- a/examples/network/bearercloud/bearercloud.h +++ b/examples/network/bearercloud/bearercloud.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 4a1bde7..dcb7caf 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h index f844725..7a45ff2 100644 --- a/examples/network/bearercloud/cloud.h +++ b/examples/network/bearercloud/cloud.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearercloud/main.cpp b/examples/network/bearercloud/main.cpp index 33c55e9..86ef46f 100644 --- a/examples/network/bearercloud/main.cpp +++ b/examples/network/bearercloud/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 70c8269..5b2bad1 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h index 9306d90..d7025dd 100644 --- a/examples/network/bearermonitor/bearermonitor.h +++ b/examples/network/bearermonitor/bearermonitor.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearermonitor/main.cpp b/examples/network/bearermonitor/main.cpp index 9685181..b7ac4fe 100644 --- a/examples/network/bearermonitor/main.cpp +++ b/examples/network/bearermonitor/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 7633dd7..1e59935 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index 8bc60e4..868de3a 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qcorewlanengine_mac_p.h b/src/network/bearer/qcorewlanengine_mac_p.h index 660ddb5..d6454ca 100644 --- a/src/network/bearer/qcorewlanengine_mac_p.h +++ b/src/network/bearer/qcorewlanengine_mac_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp index 2e48ce8..14fa886 100644 --- a/src/network/bearer/qgenericengine.cpp +++ b/src/network/bearer/qgenericengine.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qgenericengine_p.h b/src/network/bearer/qgenericengine_p.h index 88de2a0..28d6e90 100644 --- a/src/network/bearer/qgenericengine_p.h +++ b/src/network/bearer/qgenericengine_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnativewifiengine_win.cpp b/src/network/bearer/qnativewifiengine_win.cpp index b4b3888..46d4ead 100644 --- a/src/network/bearer/qnativewifiengine_win.cpp +++ b/src/network/bearer/qnativewifiengine_win.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnativewifiengine_win_p.h b/src/network/bearer/qnativewifiengine_win_p.h index adc75e1..4817867 100644 --- a/src/network/bearer/qnativewifiengine_win_p.h +++ b/src/network/bearer/qnativewifiengine_win_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 4b28b22..5031dd4 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 940fcc5..b7ab72b 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp index 26909f9..2188d61 100644 --- a/src/network/bearer/qnetworkconfigmanager_maemo.cpp +++ b/src/network/bearer/qnetworkconfigmanager_maemo.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager_maemo_p.h b/src/network/bearer/qnetworkconfigmanager_maemo_p.h index a5462b8..5cc99c2 100644 --- a/src/network/bearer/qnetworkconfigmanager_maemo_p.h +++ b/src/network/bearer/qnetworkconfigmanager_maemo_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 49135c1..47b23d2 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 184d1bd..f2e2ee5 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp index 8859a4e..b5bd4d2 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h index cd48df6..c4d4e30 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 9422f07..c105dfb 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index e1fbc43..63c37e5 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h index 8d7fbcf..0ae6ea6 100644 --- a/src/network/bearer/qnetworkconfiguration_maemo_p.h +++ b/src/network/bearer/qnetworkconfiguration_maemo_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 1dd53c4..69d7e18 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 289e09c..978c62c 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h index bccad0c..faacd64 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkmanagerservice_p.cpp b/src/network/bearer/qnetworkmanagerservice_p.cpp index 4e25533..9516f31 100644 --- a/src/network/bearer/qnetworkmanagerservice_p.cpp +++ b/src/network/bearer/qnetworkmanagerservice_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworkmanagerservice_p.h b/src/network/bearer/qnetworkmanagerservice_p.h index 91bf69d..520aeac 100644 --- a/src/network/bearer/qnetworkmanagerservice_p.h +++ b/src/network/bearer/qnetworkmanagerservice_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index bdae9bc..8ebe1c2 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 61093c7..0573c70 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp index 742499c..a35d8cb 100644 --- a/src/network/bearer/qnetworksession_maemo.cpp +++ b/src/network/bearer/qnetworksession_maemo.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h index 6594176..c5483a9 100644 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index 6df4fdb9..8e39216 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 45e0ebf..0e11b3d 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp index 0a54b87..ed5269e 100644 --- a/src/network/bearer/qnetworksession_s60_p.cpp +++ b/src/network/bearer/qnetworksession_s60_p.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h index 6e62f10..9aaedb7 100644 --- a/src/network/bearer/qnetworksession_s60_p.h +++ b/src/network/bearer/qnetworksession_s60_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp index 7148d14..9e6839e 100644 --- a/src/network/bearer/qnetworksessionengine.cpp +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 6be750f..8eb17d4 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnetworksessionengine_win_p.h b/src/network/bearer/qnetworksessionengine_win_p.h index cf01719..e68a35b 100644 --- a/src/network/bearer/qnetworksessionengine_win_p.h +++ b/src/network/bearer/qnetworksessionengine_win_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnlaengine_win.cpp b/src/network/bearer/qnlaengine_win.cpp index b1156d0..579b0e1 100644 --- a/src/network/bearer/qnlaengine_win.cpp +++ b/src/network/bearer/qnlaengine_win.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnlaengine_win_p.h b/src/network/bearer/qnlaengine_win_p.h index d9d752b..1e7d051 100644 --- a/src/network/bearer/qnlaengine_win_p.h +++ b/src/network/bearer/qnlaengine_win_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnmdbushelper.cpp b/src/network/bearer/qnmdbushelper.cpp index e8ac78e..5d7403b 100644 --- a/src/network/bearer/qnmdbushelper.cpp +++ b/src/network/bearer/qnmdbushelper.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnmdbushelper_p.h b/src/network/bearer/qnmdbushelper_p.h index ebd4e63..99b0357 100644 --- a/src/network/bearer/qnmdbushelper_p.h +++ b/src/network/bearer/qnmdbushelper_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnmwifiengine_unix.cpp b/src/network/bearer/qnmwifiengine_unix.cpp index c228bcc..5870a9f 100644 --- a/src/network/bearer/qnmwifiengine_unix.cpp +++ b/src/network/bearer/qnmwifiengine_unix.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/network/bearer/qnmwifiengine_unix_p.h b/src/network/bearer/qnmwifiengine_unix_p.h index a1bdb7b..3af73ea 100644 --- a/src/network/bearer/qnmwifiengine_unix_p.h +++ b/src/network/bearer/qnmwifiengine_unix_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp index f92704d..f065f78 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index ac0f054..9ac9e47 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 8190292..9f32696 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index b5935e1..fc0db05 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index 68590cc..c5bf786 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "bearerex.h" #include diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h index 04da6ca..ff5f23c 100644 --- a/tests/manual/bearerex/bearerex.h +++ b/tests/manual/bearerex/bearerex.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef ACCESSPOINTMANAGEREX_H #define ACCESSPOINTMANAGEREX_H diff --git a/tests/manual/bearerex/main.cpp b/tests/manual/bearerex/main.cpp index e13a494..20b167e 100644 --- a/tests/manual/bearerex/main.cpp +++ b/tests/manual/bearerex/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include #include "bearerex.h" diff --git a/tests/manual/bearerex/xqlistwidget.cpp b/tests/manual/bearerex/xqlistwidget.cpp index 0618725..8104779 100644 --- a/tests/manual/bearerex/xqlistwidget.cpp +++ b/tests/manual/bearerex/xqlistwidget.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "xqlistwidget.h" XQListWidget::XQListWidget(QWidget* parent) : QListWidget(parent) diff --git a/tests/manual/bearerex/xqlistwidget.h b/tests/manual/bearerex/xqlistwidget.h index 1053328..0649c2b 100644 --- a/tests/manual/bearerex/xqlistwidget.h +++ b/tests/manual/bearerex/xqlistwidget.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef XQLISTWIDGET_H #define XQLISTWIDGET_H diff --git a/tests/manual/networkmanager/networkmanagertest.cpp b/tests/manual/networkmanager/networkmanagertest.cpp index a39b041..8a6c5fa 100644 --- a/tests/manual/networkmanager/networkmanagertest.cpp +++ b/tests/manual/networkmanager/networkmanagertest.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp index 35a0204..f7611f0 100644 --- a/tests/manual/networkmanager/nmview.cpp +++ b/tests/manual/networkmanager/nmview.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h index 7db56d4..b725ade 100644 --- a/tests/manual/networkmanager/nmview.h +++ b/tests/manual/networkmanager/nmview.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/tests/manual/networkmanager/startdlg.cpp b/tests/manual/networkmanager/startdlg.cpp index 4720932..e34b5e9 100644 --- a/tests/manual/networkmanager/startdlg.cpp +++ b/tests/manual/networkmanager/startdlg.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "startdlg.h" #include diff --git a/tests/manual/networkmanager/startdlg.h b/tests/manual/networkmanager/startdlg.h index a9f1e7c..32c8557 100644 --- a/tests/manual/networkmanager/startdlg.h +++ b/tests/manual/networkmanager/startdlg.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include #include #include -- cgit v0.12 From f9d1d43e714c467d4101c6bd8eca072fdf9fbdec Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 14:01:30 +1000 Subject: Fix compile warnings. --- src/network/bearer/qgenericengine.cpp | 2 +- src/network/bearer/qnetworksession.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp index 14fa886..d14f0fa 100644 --- a/src/network/bearer/qgenericengine.cpp +++ b/src/network/bearer/qgenericengine.cpp @@ -159,7 +159,7 @@ QList QGenericEngine::getConfigurations(bool *ok continue; // ignore WLAN interface handled in seperate engine - if (qGetInterfaceType(interface.name()) == "WLAN") + if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) continue; QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 8ebe1c2..dbea087 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -509,14 +509,14 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const if (!d->publicConfig.isValid()) return QVariant(); - if (key == "ActiveConfigurationIdentifier") { + if (key == QLatin1String("ActiveConfigurationIdentifier")) { if (!d->isActive) return QString(); else return d->activeConfig.identifier(); } - if (key == "UserChoiceConfigurationIdentifier") { + if (key == QLatin1String("UserChoiceConfigurationIdentifier")) { if (!d->isActive || d->publicConfig.type() != QNetworkConfiguration::UserChoice) return QString(); @@ -539,9 +539,10 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const */ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) { - if (key == "ActiveConfigurationIdentifier" - || key == "UserChoiceConfigurationIdentifier") + if (key == QLatin1String("ActiveConfigurationIdentifier") || + key == QLatin1String("UserChoiceConfigurationIdentifier")) { return; + } d->setSessionProperty(key, value); } -- cgit v0.12 From d5b6c723973449914134231c01a381ef9af9f6d4 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 14:40:53 +1000 Subject: Make unit tests compile. --- tests/auto/qnetworksession/lackey/lackey.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index ccbdd98..6cc1b43 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -1,4 +1,4 @@ -load(qttest_p4) SOURCES += main.cpp +TARGET = qnetworksessionlackey QT = core network -- cgit v0.12 From 27b47c630f8b71897ba56c983c24afe1538f33dc Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 1 Dec 2009 15:46:59 +1000 Subject: Convert generic engine into a plugin. --- src/network/bearer/bearer.pri | 12 +- src/network/bearer/qbearerplugin.cpp | 58 ++++++ src/network/bearer/qbearerplugin.h | 82 +++++++++ src/network/bearer/qgenericengine.cpp | 234 ------------------------- src/network/bearer/qgenericengine_p.h | 94 ---------- src/network/bearer/qnetworkconfigmanager.cpp | 7 + src/network/bearer/qnetworkconfigmanager_p.cpp | 23 ++- src/network/bearer/qnetworkconfigmanager_p.h | 4 +- src/network/bearer/qnetworkconfiguration_p.h | 2 +- src/network/bearer/qnetworksession_p.cpp | 10 +- src/network/bearer/qnetworksessionengine_p.h | 4 +- src/plugins/bearer/bearer.pro | 3 + src/plugins/bearer/generic/generic.pro | 13 ++ src/plugins/bearer/generic/main.cpp | 88 ++++++++++ src/plugins/bearer/generic/qgenericengine.cpp | 234 +++++++++++++++++++++++++ src/plugins/bearer/generic/qgenericengine.h | 83 +++++++++ src/plugins/plugins.pro | 2 +- 17 files changed, 606 insertions(+), 347 deletions(-) create mode 100644 src/network/bearer/qbearerplugin.cpp create mode 100644 src/network/bearer/qbearerplugin.h delete mode 100644 src/network/bearer/qgenericengine.cpp delete mode 100644 src/network/bearer/qgenericengine_p.h create mode 100644 src/plugins/bearer/bearer.pro create mode 100644 src/plugins/bearer/generic/generic.pro create mode 100644 src/plugins/bearer/generic/main.cpp create mode 100644 src/plugins/bearer/generic/qgenericengine.cpp create mode 100644 src/plugins/bearer/generic/qgenericengine.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index d8ddce5..4f53621 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -4,11 +4,13 @@ HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworksession.h \ - bearer/qnetworkconfigmanager.h + bearer/qnetworkconfigmanager.h \ + bearer/qbearerplugin.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ - bearer/qnetworkconfiguration.cpp + bearer/qnetworkconfiguration.cpp \ + bearer/qbearerplugin.cpp symbian { exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ @@ -72,13 +74,11 @@ symbian { HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ - bearer/qnetworksessionengine_p.h \ - bearer/qgenericengine_p.h + bearer/qnetworksessionengine_p.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ bearer/qnetworksession_p.cpp \ - bearer/qnetworksessionengine.cpp \ - bearer/qgenericengine.cpp + bearer/qnetworksessionengine.cpp unix:!mac:contains(networkmanager_enabled, yes) { contains(QT_CONFIG,dbus) { diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp new file mode 100644 index 0000000..252ee71 --- /dev/null +++ b/src/network/bearer/qbearerplugin.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qbearerplugin.h" + +#include + +QT_BEGIN_NAMESPACE + +QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent) +: QObject(parent) +{ + qDebug() << Q_FUNC_INFO; +} + +QBearerEnginePlugin::~QBearerEnginePlugin() +{ +} + +QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h new file mode 100644 index 0000000..036d712 --- /dev/null +++ b/src/network/bearer/qbearerplugin.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEARERPLUGIN_H +#define QBEARERPLUGIN_H + +#include "qnetworksessionengine_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface +{ + virtual QBearerEngine *create(const QString &key = QString()) const = 0; +}; + +#define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface" +Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid) + +class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QBearerEngineFactoryInterface:QFactoryInterface) + +public: + explicit QBearerEnginePlugin(QObject *parent = 0); + virtual ~QBearerEnginePlugin(); + + virtual QStringList keys() const = 0; + virtual QBearerEngine *create(const QString &key = QString()) const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp deleted file mode 100644 index d14f0fa..0000000 --- a/src/network/bearer/qgenericengine.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgenericengine_p.h" -#include "qnetworkconfiguration_p.h" - -#include -#include -#include -#include - -#include - -#ifdef Q_OS_WIN -#include "qnetworksessionengine_win_p.h" -#endif - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QGenericEngine, genericEngine) - -static QString qGetInterfaceType(const QString &interface) -{ -#ifdef Q_OS_WIN32 - unsigned long oid; - DWORD bytesWritten; - - NDIS_MEDIUM medium; - NDIS_PHYSICAL_MEDIUM physicalMedium; - - HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, - FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); - if (handle == INVALID_HANDLE_VALUE) - return QString(); - - oid = OID_GEN_MEDIA_SUPPORTED; - bytesWritten = 0; - bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), - &medium, sizeof(medium), &bytesWritten, 0); - if (!result) { - CloseHandle(handle); - return QString(); - } - - oid = OID_GEN_PHYSICAL_MEDIUM; - bytesWritten = 0; - result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), - &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); - if (!result) { - CloseHandle(handle); - - if (medium == NdisMedium802_3) - return QLatin1String("Ethernet"); - else - return QString(); - } - - CloseHandle(handle); - - if (medium == NdisMedium802_3) { - switch (physicalMedium) { - case NdisPhysicalMediumWirelessLan: - return QLatin1String("WLAN"); - case NdisPhysicalMediumBluetooth: - return QLatin1String("Bluetooth"); - case NdisPhysicalMediumWiMax: - return QLatin1String("WiMAX"); - default: -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Physical Medium" << physicalMedium; -#endif - return QLatin1String("Ethernet"); - } - } - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << medium << physicalMedium; -#endif -#else - Q_UNUSED(interface); -#endif - - return QString(); -} - -QGenericEngine::QGenericEngine(QObject *parent) -: QNetworkSessionEngine(parent) -{ - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); - pollTimer.setInterval(10000); -} - -QGenericEngine::~QGenericEngine() -{ -} - -QList QGenericEngine::getConfigurations(bool *ok) -{ - if (ok) - *ok = true; - - QList foundConfigurations; - - // Immediately after connecting with a wireless access point - // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a - // second time results in a non-empty list. If we loose interfaces we will end up removing - // network configurations which will break current sessions. - QList interfaces = QNetworkInterface::allInterfaces(); - if (interfaces.isEmpty()) - interfaces = QNetworkInterface::allInterfaces(); - - // create configuration for each interface - while (!interfaces.isEmpty()) { - QNetworkInterface interface = interfaces.takeFirst(); - - if (!interface.isValid()) - continue; - - // ignore loopback interface - if (interface.flags() & QNetworkInterface::IsLoopBack) - continue; - - // ignore WLAN interface handled in seperate engine - if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) - continue; - - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - const QString humanReadableName = interface.humanReadableName(); - cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; - cpPriv->isValid = true; - - uint identifier; - if (interface.index()) - identifier = qHash(QLatin1String("NLA:") + QString::number(interface.index())); - else - identifier = qHash(QLatin1String("NLA:") + interface.hardwareAddress()); - - cpPriv->id = QString::number(identifier); - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - if (interface.flags() & QNetworkInterface::IsUp) - cpPriv->state |= QNetworkConfiguration::Active; - - configurationInterface[identifier] = interface.name(); - - foundConfigurations.append(cpPriv); - } - - pollTimer.start(); - - return foundConfigurations; -} - -QString QGenericEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id.toUInt()); -} - -bool QGenericEngine::hasIdentifier(const QString &id) -{ - return configurationInterface.contains(id.toUInt()); -} - -QString QGenericEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - -void QGenericEngine::connectToId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} - -void QGenericEngine::disconnectFromId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} - -void QGenericEngine::requestUpdate() -{ - emit configurationsChanged(); -} - -QGenericEngine *QGenericEngine::instance() -{ - return genericEngine(); -} - -#include "moc_qgenericengine_p.cpp" -QT_END_NAMESPACE - diff --git a/src/network/bearer/qgenericengine_p.h b/src/network/bearer/qgenericengine_p.h deleted file mode 100644 index 28d6e90..0000000 --- a/src/network/bearer/qgenericengine_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGENERICENGINE_P_H -#define QGENERICENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworksessionengine_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; - -class QGenericEngine : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - QGenericEngine(QObject *parent = 0); - ~QGenericEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - static QGenericEngine *instance(); - -private: - QMap configurationInterface; - QTimer pollTimer; -}; - -QT_END_NAMESPACE - -#endif - diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 5031dd4..02cc652 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -51,6 +51,13 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); +#ifndef Q_OS_SYMBIAN +QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() +{ + return connManager(); +} +#endif + /*! \class QNetworkConfigurationManager diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 47b23d2..3e82ab7 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include "qnetworkconfigmanager_p.h" -#include "qgenericengine_p.h" #ifdef Q_OS_WIN #include "qnlaengine_win_p.h" @@ -55,12 +54,19 @@ #include "qcorewlanengine_mac_p.h" #endif +#include "qbearerplugin.h" + +#include + #include #include #include QT_BEGIN_NAMESPACE +Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, + (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) + void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() { capFlags = QNetworkConfigurationManager::ForcedRoaming; @@ -228,6 +234,9 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() updateState = NotUpdating; onlineConfigurations = 0; + QFactoryLoader *l = loader(); + QStringList keys = l->keys(); + #if defined (Q_OS_DARWIN) coreWifi = QCoreWlanEngine::instance(); if (coreWifi) { @@ -242,10 +251,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() this, SLOT(updateConfigurations())); } else { #endif - generic = QGenericEngine::instance(); - if (generic) { - connect(generic, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + QBearerEnginePlugin *genericPlugin = + qobject_cast(l->instance(QLatin1String("generic"))); + if (genericPlugin) { + generic = genericPlugin->create(QLatin1String("generic")); + if (generic) { + connect(generic, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } } #if defined(BACKEND_NM) } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index f2e2ee5..2ac6401 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -135,7 +135,7 @@ private: #endif #ifdef BEARER_ENGINE - QGenericEngine *generic; + QNetworkSessionEngine *generic; #ifdef Q_OS_WIN QNlaEngine *nla; #ifndef Q_OS_WINCE @@ -173,6 +173,8 @@ private Q_SLOTS: #endif }; +QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); + QT_END_NAMESPACE #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 69d7e18..f00bcfa 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -55,7 +55,7 @@ #include "qnetworkconfiguration.h" #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index 8e39216..c2491ae 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -42,7 +42,7 @@ #include "qnetworksession_p.h" #include "qnetworksession.h" #include "qnetworksessionengine_p.h" -#include "qgenericengine_p.h" +#include "qnetworkconfigmanager_p.h" #ifdef Q_OS_WIN #include "qnlaengine_win_p.h" @@ -81,6 +81,8 @@ static bool NetworkManagerAvailable() static QNetworkSessionEngine *getEngineFromId(const QString &id) { + QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); + #ifdef Q_OS_WIN QNlaEngine *nla = QNlaEngine::instance(); if (nla && nla->hasIdentifier(id)) @@ -106,9 +108,9 @@ static QNetworkSessionEngine *getEngineFromId(const QString &id) return coreWifi; #endif - QGenericEngine *generic = QGenericEngine::instance(); - if (generic && generic->hasIdentifier(id)) - return generic; + QNetworkSessionEngine *engine = priv->configurationEngine.value(id); + if (engine && engine->hasIdentifier(id)) + return engine; return 0; } diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 8eb17d4..9fbd4ac 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; -class QNetworkSessionEngine : public QObject +class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject { Q_OBJECT @@ -92,6 +92,8 @@ Q_SIGNALS: void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); }; +typedef QNetworkSessionEngine QBearerEngine; + QT_END_NAMESPACE #endif diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro new file mode 100644 index 0000000..0e3ef48 --- /dev/null +++ b/src/plugins/bearer/bearer.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS += generic diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro new file mode 100644 index 0000000..d32dbe6 --- /dev/null +++ b/src/plugins/bearer/generic/generic.pro @@ -0,0 +1,13 @@ +TARGET = qgenericbearer +include(../../qpluginbase.pri) + +QT += network + +DEFINES += BEARER_ENGINE + +HEADERS += qgenericengine.h +SOURCES += qgenericengine.cpp main.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp new file mode 100644 index 0000000..c877fce --- /dev/null +++ b/src/plugins/bearer/generic/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 plugins 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 "qgenericengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QGenericEnginePlugin : public QBearerEnginePlugin +{ +public: + QGenericEnginePlugin(); + ~QGenericEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QGenericEnginePlugin::QGenericEnginePlugin() +{ +} + +QGenericEnginePlugin::~QGenericEnginePlugin() +{ +} + +QStringList QGenericEnginePlugin::keys() const +{ + qDebug() << Q_FUNC_INFO; + + return QStringList() << QLatin1String("generic"); +} + +QBearerEngine *QGenericEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key == QLatin1String("generic")) + return new QGenericEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QGenericEnginePlugin) +Q_EXPORT_PLUGIN2(qgenericbearer, QGenericEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp new file mode 100644 index 0000000..89db82b --- /dev/null +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -0,0 +1,234 @@ +/**************************************************************************** +** +** 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 plugins 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 "qgenericengine.h" + +#include + +#include +#include +#include +#include + +#include + +#ifdef Q_OS_WIN +#include "qnetworksessionengine_win_p.h" +#endif + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QGenericEngine, genericEngine) + +static QString qGetInterfaceType(const QString &interface) +{ +#ifdef Q_OS_WIN32 + unsigned long oid; + DWORD bytesWritten; + + NDIS_MEDIUM medium; + NDIS_PHYSICAL_MEDIUM physicalMedium; + + HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, + FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + if (handle == INVALID_HANDLE_VALUE) + return QString(); + + oid = OID_GEN_MEDIA_SUPPORTED; + bytesWritten = 0; + bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &medium, sizeof(medium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + return QString(); + } + + oid = OID_GEN_PHYSICAL_MEDIUM; + bytesWritten = 0; + result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + + if (medium == NdisMedium802_3) + return QLatin1String("Ethernet"); + else + return QString(); + } + + CloseHandle(handle); + + if (medium == NdisMedium802_3) { + switch (physicalMedium) { + case NdisPhysicalMediumWirelessLan: + return QLatin1String("WLAN"); + case NdisPhysicalMediumBluetooth: + return QLatin1String("Bluetooth"); + case NdisPhysicalMediumWiMax: + return QLatin1String("WiMAX"); + default: +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Physical Medium" << physicalMedium; +#endif + return QLatin1String("Ethernet"); + } + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << medium << physicalMedium; +#endif +#else + Q_UNUSED(interface); +#endif + + return QString(); +} + +QGenericEngine::QGenericEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QGenericEngine::~QGenericEngine() +{ +} + +QList QGenericEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + + QList foundConfigurations; + + // Immediately after connecting with a wireless access point + // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a + // second time results in a non-empty list. If we loose interfaces we will end up removing + // network configurations which will break current sessions. + QList interfaces = QNetworkInterface::allInterfaces(); + if (interfaces.isEmpty()) + interfaces = QNetworkInterface::allInterfaces(); + + // create configuration for each interface + while (!interfaces.isEmpty()) { + QNetworkInterface interface = interfaces.takeFirst(); + + if (!interface.isValid()) + continue; + + // ignore loopback interface + if (interface.flags() & QNetworkInterface::IsLoopBack) + continue; + + // ignore WLAN interface handled in seperate engine + if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) + continue; + + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString humanReadableName = interface.humanReadableName(); + cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; + cpPriv->isValid = true; + + uint identifier; + if (interface.index()) + identifier = qHash(QLatin1String("NLA:") + QString::number(interface.index())); + else + identifier = qHash(QLatin1String("NLA:") + interface.hardwareAddress()); + + cpPriv->id = QString::number(identifier); + cpPriv->state = QNetworkConfiguration::Discovered; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + if (interface.flags() & QNetworkInterface::IsUp) + cpPriv->state |= QNetworkConfiguration::Active; + + configurationInterface[identifier] = interface.name(); + + foundConfigurations.append(cpPriv); + } + + pollTimer.start(); + + return foundConfigurations; +} + +QString QGenericEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QGenericEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QGenericEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QGenericEngine::connectToId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::disconnectFromId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::requestUpdate() +{ + emit configurationsChanged(); +} + +QGenericEngine *QGenericEngine::instance() +{ + return genericEngine(); +} + +QT_END_NAMESPACE + diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h new file mode 100644 index 0000000..9923a9b --- /dev/null +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** 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 plugins 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 QGENERICENGINE_H +#define QGENERICENGINE_H + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QGenericEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QGenericEngine(QObject *parent = 0); + ~QGenericEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QGenericEngine *instance(); + +private: + QMap configurationInterface; + QTimer pollTimer; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 004b816..d6a426f 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs -SUBDIRS *= accessible imageformats sqldrivers iconengines script +SUBDIRS *= accessible imageformats sqldrivers iconengines script bearer unix:!symbian { contains(QT_CONFIG,iconv)|contains(QT_CONFIG,gnu-libiconv):SUBDIRS *= codecs } else { -- cgit v0.12 From 70d0623570936696ca28536a46a3be63c691f50b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 2 Dec 2009 09:26:54 +1000 Subject: Add compile test for NetworkManager. --- .../unix/networkmanager/networkmanager.pro | 14 +- configure | 217 +++++++++++---------- 2 files changed, 119 insertions(+), 112 deletions(-) diff --git a/config.tests/unix/networkmanager/networkmanager.pro b/config.tests/unix/networkmanager/networkmanager.pro index 554f513..c41204f 100644 --- a/config.tests/unix/networkmanager/networkmanager.pro +++ b/config.tests/unix/networkmanager/networkmanager.pro @@ -1,11 +1,3 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Mon Oct 19 12:58:26 2009 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp +SOURCES = main.cpp +CONFIG -= qt dylib +mac:CONFIG -= app_bundle diff --git a/configure b/configure index 0b11bf3..dcd7d2d 100755 --- a/configure +++ b/configure @@ -765,6 +765,7 @@ OPT_HELP= CFG_SILENT=no CFG_GRAPHICS_SYSTEM=default CFG_ALSA=auto +CFG_NETWORKMANAGER=auto # initalize variables used for installation QT_INSTALL_PREFIX= @@ -5820,6 +5821,14 @@ if [ "$CFG_ALSA" = "auto" ]; then fi fi +if [ "$CFG_NETWORKMANAGER" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/networkmanager "NetworkManager" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_NETWORKMANAGER=yes + else + CFG_NETWORKMANAGER=no + fi +fi + if [ -f "$relpath/src/declarative/declarative.pro" ]; then if [ "$CFG_DECLARATIVE" = "auto" ]; then CFG_DECLARATIVE=yes @@ -6297,6 +6306,10 @@ if [ "$CFG_ALSA" = "yes" ]; then QT_CONFIG="$QT_CONFIG alsa" fi +if [ "$CFG_NETWORKMANAGER" = "yes" ]; then + QT_CONFIG="$QT_CONFIG networkmanager" +fi + # # Some Qt modules are too advanced in C++ for some old compilers # Detect here the platforms where they are known to work. @@ -6997,6 +7010,7 @@ fi [ "$CFG_XRANDR" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XRANDR" [ "$CFG_XINPUT" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT" [ "$CFG_ALSA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA" +[ "$CFG_NETWORKMANAGER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NETWORKMANAGER" # sort QCONFIG_FLAGS for neatness if we can [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq` @@ -7332,163 +7346,163 @@ fi if [ "$OPT_VERBOSE" = "yes" ]; then if echo '\c' | grep '\c' >/dev/null; then - echo -n "qmake vars .......... " + echo -n "qmake vars ............. " else - echo "qmake vars .......... \c" + echo "qmake vars ............. \c" fi cat "$QMAKE_VARS_FILE" | tr '\n' ' ' - echo "qmake switches ...... $QMAKE_SWITCHES" + echo "qmake switches ......... $QMAKE_SWITCHES" fi -[ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ......... $INCREMENTAL" -echo "Build ............... $CFG_BUILD_PARTS" -echo "Configuration ....... $QMAKE_CONFIG $QT_CONFIG" +[ "$CFG_INCREMENTAL" = "yes" ] && [ '!' -z "$INCREMENTAL" ] && echo "Incremental ............ $INCREMENTAL" +echo "Build .................. $CFG_BUILD_PARTS" +echo "Configuration .......... $QMAKE_CONFIG $QT_CONFIG" if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then - echo "Debug ............... yes (combined)" + echo "Debug .................. yes (combined)" if [ "$CFG_DEBUG" = "yes" ]; then - echo "Default Link ........ debug" + echo "Default Link ........... debug" else - echo "Default Link ........ release" + echo "Default Link ........... release" fi else - echo "Debug ............... $CFG_DEBUG" -fi -echo "Qt 3 compatibility .. $CFG_QT3SUPPORT" -[ "$CFG_DBUS" = "no" ] && echo "QtDBus module ....... no" -[ "$CFG_DBUS" = "yes" ] && echo "QtDBus module ....... yes (run-time)" -[ "$CFG_DBUS" = "linked" ] && echo "QtDBus module ....... yes (linked)" -echo "QtConcurrent code.... $CFG_CONCURRENT" -echo "QtScript module ..... $CFG_SCRIPT" -echo "QtScriptTools module $CFG_SCRIPTTOOLS" -echo "QtXmlPatterns module $CFG_XMLPATTERNS" -echo "Phonon module ....... $CFG_PHONON" -echo "Multimedia module ... $CFG_MULTIMEDIA" -echo "SVG module .......... $CFG_SVG" -echo "WebKit module ....... $CFG_WEBKIT" + echo "Debug .................. $CFG_DEBUG" +fi +echo "Qt 3 compatibility ..... $CFG_QT3SUPPORT" +[ "$CFG_DBUS" = "no" ] && echo "QtDBus module .......... no" +[ "$CFG_DBUS" = "yes" ] && echo "QtDBus module .......... yes (run-time)" +[ "$CFG_DBUS" = "linked" ] && echo "QtDBus module .......... yes (linked)" +echo "QtConcurrent code ...... $CFG_CONCURRENT" +echo "QtScript module ........ $CFG_SCRIPT" +echo "QtScriptTools module ... $CFG_SCRIPTTOOLS" +echo "QtXmlPatterns module ... $CFG_XMLPATTERNS" +echo "Phonon module .......... $CFG_PHONON" +echo "Multimedia module ...... $CFG_MULTIMEDIA" +echo "SVG module ............. $CFG_SVG" +echo "WebKit module .......... $CFG_WEBKIT" if [ "$CFG_WEBKIT" = "yes" ]; then if [ "$CFG_JAVASCRIPTCORE_JIT" = "auto" ]; then - echo "JavaScriptCore JIT .. To be decided by JavaScriptCore" + echo "JavaScriptCore JIT ..... To be decided by JavaScriptCore" else - echo "JavaScriptCore JIT .. $CFG_JAVASCRIPTCORE_JIT" + echo "JavaScriptCore JIT ..... $CFG_JAVASCRIPTCORE_JIT" fi fi -echo "Declarative module .. $CFG_DECLARATIVE" -echo "STL support ......... $CFG_STL" -echo "PCH support ......... $CFG_PRECOMPILE" -echo "MMX/3DNOW/SSE/SSE2.. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}" +echo "Declarative module ..... $CFG_DECLARATIVE" +echo "STL support ............ $CFG_STL" +echo "PCH support ............ $CFG_PRECOMPILE" +echo "MMX/3DNOW/SSE/SSE2 ..... ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}" if [ "${CFG_ARCH}" = "arm" ]; then - echo "iWMMXt support ...... ${CFG_IWMMXT}" -fi -[ "${PLATFORM_QWS}" != "yes" ] && echo "Graphics System ..... $CFG_GRAPHICS_SYSTEM" -echo "IPv6 support ........ $CFG_IPV6" -echo "IPv6 ifname support . $CFG_IPV6IFNAME" -echo "getaddrinfo support . $CFG_GETADDRINFO" -echo "getifaddrs support .. $CFG_GETIFADDRS" -echo "Accessibility ....... $CFG_ACCESSIBILITY" -echo "NIS support ......... $CFG_NIS" -echo "CUPS support ........ $CFG_CUPS" -echo "Iconv support ....... $CFG_ICONV" -echo "Glib support ........ $CFG_GLIB" -echo "GStreamer support ... $CFG_GSTREAMER" -echo "Large File support .. $CFG_LARGEFILE" -echo "GIF support ......... $CFG_GIF" + echo "iWMMXt support ......... ${CFG_IWMMXT}" +fi +[ "${PLATFORM_QWS}" != "yes" ] && echo "Graphics System ........ $CFG_GRAPHICS_SYSTEM" +echo "IPv6 support ........... $CFG_IPV6" +echo "IPv6 ifname support .... $CFG_IPV6IFNAME" +echo "getaddrinfo support .... $CFG_GETADDRINFO" +echo "getifaddrs support ..... $CFG_GETIFADDRS" +echo "Accessibility .......... $CFG_ACCESSIBILITY" +echo "NIS support ............ $CFG_NIS" +echo "CUPS support ........... $CFG_CUPS" +echo "Iconv support .......... $CFG_ICONV" +echo "Glib support ........... $CFG_GLIB" +echo "GStreamer support ...... $CFG_GSTREAMER" +echo "Large File support ..... $CFG_LARGEFILE" +echo "GIF support ............ $CFG_GIF" if [ "$CFG_TIFF" = "no" ]; then - echo "TIFF support ........ $CFG_TIFF" + echo "TIFF support ........... $CFG_TIFF" else - echo "TIFF support ........ $CFG_TIFF ($CFG_LIBTIFF)" + echo "TIFF support ........... $CFG_TIFF ($CFG_LIBTIFF)" fi if [ "$CFG_JPEG" = "no" ]; then - echo "JPEG support ........ $CFG_JPEG" + echo "JPEG support ........... $CFG_JPEG" else - echo "JPEG support ........ $CFG_JPEG ($CFG_LIBJPEG)" + echo "JPEG support ........... $CFG_JPEG ($CFG_LIBJPEG)" fi if [ "$CFG_PNG" = "no" ]; then - echo "PNG support ......... $CFG_PNG" + echo "PNG support ............ $CFG_PNG" else - echo "PNG support ......... $CFG_PNG ($CFG_LIBPNG)" + echo "PNG support ............ $CFG_PNG ($CFG_LIBPNG)" fi if [ "$CFG_MNG" = "no" ]; then - echo "MNG support ......... $CFG_MNG" + echo "MNG support ............ $CFG_MNG" else - echo "MNG support ......... $CFG_MNG ($CFG_LIBMNG)" + echo "MNG support ............ $CFG_MNG ($CFG_LIBMNG)" fi -echo "zlib support ........ $CFG_ZLIB" -echo "Session management .. $CFG_SM" +echo "zlib support ........... $CFG_ZLIB" +echo "Session management ..... $CFG_SM" if [ "$PLATFORM_QWS" = "yes" ]; then - echo "Embedded support .... $CFG_EMBEDDED" + echo "Embedded support ....... $CFG_EMBEDDED" if [ "$CFG_QWS_FREETYPE" = "auto" ]; then - echo "Freetype2 support ... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)" + echo "Freetype2 support ...... $CFG_QWS_FREETYPE ($CFG_LIBFREETYPE)" else - echo "Freetype2 support ... $CFG_QWS_FREETYPE" + echo "Freetype2 support ...... $CFG_QWS_FREETYPE" fi # Normalize the decoration output first CFG_GFX_ON=`echo ${CFG_GFX_ON}` CFG_GFX_PLUGIN=`echo ${CFG_GFX_PLUGIN}` - echo "Graphics (qt) ....... ${CFG_GFX_ON}" - echo "Graphics (plugin) ... ${CFG_GFX_PLUGIN}" + echo "Graphics (qt) .......... ${CFG_GFX_ON}" + echo "Graphics (plugin) ...... ${CFG_GFX_PLUGIN}" CFG_DECORATION_ON=`echo ${CFG_DECORATION_ON}` CFG_DECORATION_PLUGIN=`echo ${CFG_DECORATION_PLUGIN}` - echo "Decorations (qt) .... $CFG_DECORATION_ON" - echo "Decorations (plugin) $CFG_DECORATION_PLUGIN" + echo "Decorations (qt) ....... $CFG_DECORATION_ON" + echo "Decorations (plugin) ... $CFG_DECORATION_PLUGIN" CFG_KBD_ON=`echo ${CFG_KBD_ON}` CFG_KBD_PLUGIN=`echo ${CFG_KBD_PLUGIN}` - echo "Keyboard driver (qt). ${CFG_KBD_ON}" - echo "Keyboard driver (plugin) ${CFG_KBD_PLUGIN}" + echo "Keyboard driver (qt) ... ${CFG_KBD_ON}" + echo "Keyboard driver (plugin) .. ${CFG_KBD_PLUGIN}" CFG_MOUSE_ON=`echo ${CFG_MOUSE_ON}` CFG_MOUSE_PLUGIN=`echo ${CFG_MOUSE_PLUGIN}` - echo "Mouse driver (qt) ... $CFG_MOUSE_ON" - echo "Mouse driver (plugin) $CFG_MOUSE_PLUGIN" + echo "Mouse driver (qt) ...... $CFG_MOUSE_ON" + echo "Mouse driver (plugin) .. $CFG_MOUSE_PLUGIN" fi if [ "$CFG_OPENGL" = "desktop" ]; then - echo "OpenGL support ...... yes (Desktop OpenGL)" + echo "OpenGL support ......... yes (Desktop OpenGL)" elif [ "$CFG_OPENGL" = "es1" ]; then - echo "OpenGL support ...... yes (OpenGL ES 1.x Common profile)" + echo "OpenGL support ......... yes (OpenGL ES 1.x Common profile)" elif [ "$CFG_OPENGL" = "es1cl" ]; then - echo "OpenGL support ...... yes (OpenGL ES 1.x Common Lite profile)" + echo "OpenGL support ......... yes (OpenGL ES 1.x Common Lite profile)" elif [ "$CFG_OPENGL" = "es2" ]; then - echo "OpenGL support ...... yes (OpenGL ES 2.x)" + echo "OpenGL support ......... yes (OpenGL ES 2.x)" else - echo "OpenGL support ...... no" + echo "OpenGL support ......... no" fi if [ "$CFG_EGL" != "no" ]; then if [ "$CFG_EGL_GLES_INCLUDES" != "no" ]; then - echo "EGL support ......... yes " + echo "EGL support ............ yes " else - echo "EGL support ......... yes " + echo "EGL support ............ yes " fi fi if [ "$CFG_OPENVG" ]; then if [ "$CFG_OPENVG_SHIVA" = "yes" ]; then - echo "OpenVG support ...... ShivaVG" + echo "OpenVG support ......... ShivaVG" else - echo "OpenVG support ...... $CFG_OPENVG" + echo "OpenVG support ......... $CFG_OPENVG" fi fi if [ "$PLATFORM_X11" = "yes" ]; then - echo "NAS sound support ... $CFG_NAS" - echo "XShape support ...... $CFG_XSHAPE" - echo "XSync support ....... $CFG_XSYNC" - echo "Xinerama support .... $CFG_XINERAMA" - echo "Xcursor support ..... $CFG_XCURSOR" - echo "Xfixes support ...... $CFG_XFIXES" - echo "Xrandr support ...... $CFG_XRANDR" - echo "Xrender support ..... $CFG_XRENDER" - echo "Xi support .......... $CFG_XINPUT" - echo "MIT-SHM support ..... $CFG_MITSHM" - echo "FontConfig support .. $CFG_FONTCONFIG" - echo "XKB Support ......... $CFG_XKB" - echo "immodule support .... $CFG_IM" - echo "GTK theme support ... $CFG_QGTKSTYLE" -fi -[ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support ....... $CFG_SQL_mysql" -[ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support .. $CFG_SQL_psql" -[ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........ $CFG_SQL_odbc" -[ "$CFG_SQL_oci" != "no" ] && echo "OCI support ......... $CFG_SQL_oci" -[ "$CFG_SQL_tds" != "no" ] && echo "TDS support ......... $CFG_SQL_tds" -[ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ......... $CFG_SQL_db2" -[ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ... $CFG_SQL_ibase" -[ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support .... $CFG_SQL_sqlite2" -[ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ...... $CFG_SQL_sqlite ($CFG_SQLITE)" + echo "NAS sound support ...... $CFG_NAS" + echo "XShape support ......... $CFG_XSHAPE" + echo "XSync support .......... $CFG_XSYNC" + echo "Xinerama support ....... $CFG_XINERAMA" + echo "Xcursor support ........ $CFG_XCURSOR" + echo "Xfixes support ......... $CFG_XFIXES" + echo "Xrandr support ......... $CFG_XRANDR" + echo "Xrender support ........ $CFG_XRENDER" + echo "Xi support ............. $CFG_XINPUT" + echo "MIT-SHM support ........ $CFG_MITSHM" + echo "FontConfig support ..... $CFG_FONTCONFIG" + echo "XKB Support ............ $CFG_XKB" + echo "immodule support ....... $CFG_IM" + echo "GTK theme support ...... $CFG_QGTKSTYLE" +fi +[ "$CFG_SQL_mysql" != "no" ] && echo "MySQL support .......... $CFG_SQL_mysql" +[ "$CFG_SQL_psql" != "no" ] && echo "PostgreSQL support ..... $CFG_SQL_psql" +[ "$CFG_SQL_odbc" != "no" ] && echo "ODBC support ........... $CFG_SQL_odbc" +[ "$CFG_SQL_oci" != "no" ] && echo "OCI support ............ $CFG_SQL_oci" +[ "$CFG_SQL_tds" != "no" ] && echo "TDS support ............ $CFG_SQL_tds" +[ "$CFG_SQL_db2" != "no" ] && echo "DB2 support ............ $CFG_SQL_db2" +[ "$CFG_SQL_ibase" != "no" ] && echo "InterBase support ...... $CFG_SQL_ibase" +[ "$CFG_SQL_sqlite2" != "no" ] && echo "SQLite 2 support ....... $CFG_SQL_sqlite2" +[ "$CFG_SQL_sqlite" != "no" ] && echo "SQLite support ......... $CFG_SQL_sqlite ($CFG_SQLITE)" OPENSSL_LINKAGE="" if [ "$CFG_OPENSSL" = "yes" ]; then @@ -7496,9 +7510,9 @@ if [ "$CFG_OPENSSL" = "yes" ]; then elif [ "$CFG_OPENSSL" = "linked" ]; then OPENSSL_LINKAGE="(linked)" fi -echo "OpenSSL support ..... $CFG_OPENSSL $OPENSSL_LINKAGE" +echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE" -[ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........ $CFG_PTMALLOC" +[ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC" # complain about not being able to use dynamic plugins if we are using a static build if [ "$CFG_SHARED" = "no" ]; then @@ -7521,7 +7535,8 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" echo "NOTE: Mac OS X frameworks implicitly build debug and release Qt libraries." echo fi -echo "alsa support ........ $CFG_ALSA" +echo "alsa support ........... $CFG_ALSA" +echo "NetworkManager support . $CFG_NETWORKMANAGER" echo sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'` -- cgit v0.12 From 5c07b6b24144774f16a20115eec1a6700d0db254 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 15:08:34 +1000 Subject: Convert NetworkManager engine into a plugin. Conflicts: src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp src/plugins/bearer/networkmanager/qnetworkmanagerservice.h src/plugins/bearer/networkmanager/qnmdbushelper.cpp src/plugins/bearer/networkmanager/qnmdbushelper.h src/plugins/bearer/networkmanager/qnmwifiengine.cpp src/plugins/bearer/networkmanager/qnmwifiengine.h --- src/network/bearer/bearer.pri | 17 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 32 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworkmanagerservice_p.cpp | 1011 ------------------ src/network/bearer/qnetworkmanagerservice_p.h | 397 ------- src/network/bearer/qnetworksession_p.cpp | 33 +- src/network/bearer/qnmdbushelper.cpp | 117 -- src/network/bearer/qnmdbushelper_p.h | 89 -- src/network/bearer/qnmwifiengine_unix.cpp | 1129 -------------------- src/network/bearer/qnmwifiengine_unix_p.h | 164 --- src/plugins/bearer/bearer.pro | 1 + src/plugins/bearer/networkmanager/main.cpp | 88 ++ .../bearer/networkmanager/networkmanager.pro | 19 + .../networkmanager/qnetworkmanagerservice.cpp | 1009 +++++++++++++++++ .../bearer/networkmanager/qnetworkmanagerservice.h | 397 +++++++ .../bearer/networkmanager/qnmdbushelper.cpp | 114 ++ src/plugins/bearer/networkmanager/qnmdbushelper.h | 87 ++ .../bearer/networkmanager/qnmwifiengine.cpp | 1128 +++++++++++++++++++ src/plugins/bearer/networkmanager/qnmwifiengine.h | 165 +++ 19 files changed, 3032 insertions(+), 2967 deletions(-) delete mode 100644 src/network/bearer/qnetworkmanagerservice_p.cpp delete mode 100644 src/network/bearer/qnetworkmanagerservice_p.h delete mode 100644 src/network/bearer/qnmdbushelper.cpp delete mode 100644 src/network/bearer/qnmdbushelper_p.h delete mode 100644 src/network/bearer/qnmwifiengine_unix.cpp delete mode 100644 src/network/bearer/qnmwifiengine_unix_p.h create mode 100644 src/plugins/bearer/networkmanager/main.cpp create mode 100644 src/plugins/bearer/networkmanager/networkmanager.pro create mode 100644 src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp create mode 100644 src/plugins/bearer/networkmanager/qnetworkmanagerservice.h create mode 100644 src/plugins/bearer/networkmanager/qnmdbushelper.cpp create mode 100644 src/plugins/bearer/networkmanager/qnmdbushelper.h create mode 100644 src/plugins/bearer/networkmanager/qnmwifiengine.cpp create mode 100644 src/plugins/bearer/networkmanager/qnmwifiengine.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 4f53621..bed2597 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -80,22 +80,7 @@ symbian { bearer/qnetworksession_p.cpp \ bearer/qnetworksessionengine.cpp - unix:!mac:contains(networkmanager_enabled, yes) { - contains(QT_CONFIG,dbus) { - DEFINES += BACKEND_NM - QT += dbus - - HEADERS += bearer/qnmdbushelper_p.h \ - bearer/qnetworkmanagerservice_p.h \ - bearer/qnmwifiengine_unix_p.h - - SOURCES += bearer/qnmdbushelper.cpp \ - bearer/qnetworkmanagerservice_p.cpp \ - bearer/qnmwifiengine_unix.cpp - } else { - message("NetworkManager backend requires Qt DBus support") - } - } + contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM win32 { HEADERS += bearer/qnlaengine_win_p.h \ diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 3e82ab7..7b68394 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -47,9 +47,6 @@ #ifdef Q_OS_WIN32 #include "qnativewifiengine_win_p.h" #endif -#if defined(BACKEND_NM) -#include "qnmwifiengine_unix_p.h" -#endif #ifdef Q_OS_DARWIN #include "qcorewlanengine_mac_p.h" #endif @@ -244,13 +241,21 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() this, SLOT(updateConfigurations())); } #else -#if defined(BACKEND_NM) - nmWifi = QNmWifiEngine::instance(); - if (nmWifi) { - connect(nmWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); - } else { +#ifdef BACKEND_NM + if (keys.contains(QLatin1String("networkmanager"))) { + QBearerEnginePlugin *nmPlugin = + qobject_cast(l->instance(QLatin1String("networkmanager"))); + if (nmPlugin) { + nmWifi = nmPlugin->create(QLatin1String("networkmanager")); + if (nmWifi) { + connect(nmWifi, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } + } + } #endif + + if (keys.contains(QLatin1String("generic"))) { QBearerEnginePlugin *genericPlugin = qobject_cast(l->instance(QLatin1String("generic"))); if (genericPlugin) { @@ -260,10 +265,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() this, SLOT(updateConfigurations())); } } -#if defined(BACKEND_NM) } #endif -#endif #ifdef Q_OS_WIN nla = QNlaEngine::instance(); @@ -293,7 +296,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() #if defined(BACKEND_NM) if (engine == nmWifi) updateState &= ~NmUpdating; - else if (engine == generic) + if (engine == generic) updateState &= ~GenericUpdating; #else if (engine == generic) @@ -319,7 +322,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() #if defined(BACKEND_NM) if (nmWifi) engines << nmWifi; - else if (generic) + if (generic) engines << generic; #else if (generic) @@ -431,7 +434,8 @@ void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() if (nmWifi) { updateState |= NmUpdating; nmWifi->requestUpdate(); - } else if (generic) { + } + if (generic) { updateState |= GenericUpdating; generic->requestUpdate(); } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 2ac6401..6a61891 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -143,7 +143,7 @@ private: #endif #endif #ifdef BACKEND_NM - QNmWifiEngine *nmWifi; + QNetworkSessionEngine *nmWifi; #endif #ifdef Q_OS_DARWIN QCoreWlanEngine *coreWifi; diff --git a/src/network/bearer/qnetworkmanagerservice_p.cpp b/src/network/bearer/qnetworkmanagerservice_p.cpp deleted file mode 100644 index 9516f31..0000000 --- a/src/network/bearer/qnetworkmanagerservice_p.cpp +++ /dev/null @@ -1,1011 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include "qnetworkmanagerservice_p.h" - -//Q_DECLARE_METATYPE(QList) -QT_BEGIN_NAMESPACE - -static QDBusConnection dbusConnection = QDBusConnection::systemBus(); -//static QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbusConnection); - -class QNetworkManagerInterfacePrivate -{ -public: - QDBusInterface *connectionInterface; - bool valid; -}; - -QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfacePrivate(); - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - dbusConnection); - if (!d->connectionInterface->isValid()) { - qWarning() << "Could not find NetworkManager"; - d->valid = false; - return; - } - d->valid = true; - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), - this,SIGNAL(propertiesChanged( const QString &, QMap))); - connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), - this, SIGNAL(stateChanged(const QString&, quint32))); - -} - -QNetworkManagerInterface::~QNetworkManagerInterface() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterface::isValid() -{ - return d->valid; -} - -bool QNetworkManagerInterface::setConnections() -{ - if(!isValid() ) - return false; - bool allOk = false; - if (!dbusConnection.connect(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - "PropertiesChanged", - nmDBusHelper,SLOT(slotPropertiesChanged( QMap)))) { - allOk = true; - } - if (!dbusConnection.connect(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - "DeviceAdded", - this,SIGNAL(deviceAdded(QDBusObjectPath)))) { - allOk = true; - } - if (!dbusConnection.connect(NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE, - "DeviceRemoved", - this,SIGNAL(deviceRemoved(QDBusObjectPath)))) { - allOk = true; - } - - return allOk; -} - -QDBusInterface *QNetworkManagerInterface::connectionInterface() const -{ - return d->connectionInterface; -} - -QList QNetworkManagerInterface::getDevices() const -{ - QDBusReply > reply = d->connectionInterface->call("GetDevices"); - return reply.value(); -} - -void QNetworkManagerInterface::activateConnection( const QString &serviceName, - QDBusObjectPath connectionPath, - QDBusObjectPath devicePath, - QDBusObjectPath specificObject) -{ - QDBusPendingCall pendingCall = d->connectionInterface->asyncCall("ActivateConnection", - QVariant(serviceName), - QVariant::fromValue(connectionPath), - QVariant::fromValue(devicePath), - QVariant::fromValue(specificObject)); - - QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingCall, this); - connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SIGNAL(activationFinished(QDBusPendingCallWatcher*))); -} - -void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const -{ - d->connectionInterface->call("DeactivateConnection", QVariant::fromValue(connectionPath)); -} - -bool QNetworkManagerInterface::wirelessEnabled() const -{ - return d->connectionInterface->property("WirelessEnabled").toBool(); -} - -bool QNetworkManagerInterface::wirelessHardwareEnabled() const -{ - return d->connectionInterface->property("WirelessHardwareEnabled").toBool(); -} - -QList QNetworkManagerInterface::activeConnections() const -{ - QVariant prop = d->connectionInterface->property("ActiveConnections"); - return prop.value >(); -} - -quint32 QNetworkManagerInterface::state() -{ - return d->connectionInterface->property("State").toUInt(); -} - -///////////// -class QNetworkManagerInterfaceAccessPointPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfaceAccessPointPrivate(); - d->path = dbusPathName; - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_ACCESS_POINT, - dbusConnection); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find InterfaceAccessPoint"; - return; - } - d->valid = true; - -} - -QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceAccessPoint::isValid() -{ - return d->valid; -} - -bool QNetworkManagerInterfaceAccessPoint::setConnections() -{ - if(!isValid() ) - return false; - - bool allOk = false; - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), - this,SIGNAL(propertiesChanged( const QString &, QMap))); - - if(dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_ACCESS_POINT, - "PropertiesChanged", - nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { - allOk = true; - - } - return allOk; -} - -QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const -{ - return d->connectionInterface; -} - -quint32 QNetworkManagerInterfaceAccessPoint::flags() const -{ - return d->connectionInterface->property("Flags").toUInt(); -} - -quint32 QNetworkManagerInterfaceAccessPoint::wpaFlags() const -{ - return d->connectionInterface->property("WpaFlags").toUInt(); -} - -quint32 QNetworkManagerInterfaceAccessPoint::rsnFlags() const -{ - return d->connectionInterface->property("RsnFlags").toUInt(); -} - -QString QNetworkManagerInterfaceAccessPoint::ssid() const -{ - return d->connectionInterface->property("Ssid").toString(); -} - -quint32 QNetworkManagerInterfaceAccessPoint::frequency() const -{ - return d->connectionInterface->property("Frequency").toUInt(); -} - -QString QNetworkManagerInterfaceAccessPoint::hwAddress() const -{ - return d->connectionInterface->property("HwAddress").toString(); -} - -quint32 QNetworkManagerInterfaceAccessPoint::mode() const -{ - return d->connectionInterface->property("Mode").toUInt(); -} - -quint32 QNetworkManagerInterfaceAccessPoint::maxBitrate() const -{ - return d->connectionInterface->property("MaxBitrate").toUInt(); -} - -quint32 QNetworkManagerInterfaceAccessPoint::strength() const -{ - return d->connectionInterface->property("Strength").toUInt(); -} - -///////////// -class QNetworkManagerInterfaceDevicePrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) - : QObject(parent) -{ - d = new QNetworkManagerInterfaceDevicePrivate(); - d->path = deviceObjectPath; - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE, - dbusConnection); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find NetworkManager"; - return; - } - d->valid = true; -} - -QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDevice::isValid() -{ - return d->valid; -} - -bool QNetworkManagerInterfaceDevice::setConnections() -{ - if(!isValid() ) - return false; - - bool allOk = false; - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), - this, SIGNAL(stateChanged(const QString&, quint32))); - if(dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE, - "StateChanged", - nmDBusHelper,SLOT(deviceStateChanged(quint32)))) { - allOk = true; - } - return allOk; -} - -QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const -{ - return d->connectionInterface; -} - -QString QNetworkManagerInterfaceDevice::udi() const -{ - return d->connectionInterface->property("Udi").toString(); -} - -QNetworkInterface QNetworkManagerInterfaceDevice::interface() const -{ - return QNetworkInterface::interfaceFromName(d->connectionInterface->property("Interface").toString()); -} - -quint32 QNetworkManagerInterfaceDevice::ip4Address() const -{ - return d->connectionInterface->property("Ip4Address").toUInt(); -} - -quint32 QNetworkManagerInterfaceDevice::state() const -{ - return d->connectionInterface->property("State").toUInt(); -} - -quint32 QNetworkManagerInterfaceDevice::deviceType() const -{ - return d->connectionInterface->property("DeviceType").toUInt(); -} - -QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const -{ - QVariant prop = d->connectionInterface->property("Ip4Config"); - return prop.value(); -} - -///////////// -class QNetworkManagerInterfaceDeviceWiredPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent) -{ - d = new QNetworkManagerInterfaceDeviceWiredPrivate(); - d->path = ifaceDevicePath; - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE_WIRED, - dbusConnection, parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find InterfaceDeviceWired"; - return; - } - d->valid = true; -} - -QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDeviceWired::isValid() -{ - - return d->valid; -} - -bool QNetworkManagerInterfaceDeviceWired::setConnections() -{ - if(!isValid() ) - return false; - - bool allOk = false; - - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), - this,SIGNAL(propertiesChanged( const QString &, QMap))); - if(dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE_WIRED, - "PropertiesChanged", - nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { - allOk = true; - } - return allOk; -} - -QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const -{ - return d->connectionInterface; -} - -QString QNetworkManagerInterfaceDeviceWired::hwAddress() const -{ - return d->connectionInterface->property("HwAddress").toString(); -} - -quint32 QNetworkManagerInterfaceDeviceWired::speed() const -{ - return d->connectionInterface->property("Speed").toUInt(); -} - -bool QNetworkManagerInterfaceDeviceWired::carrier() const -{ - return d->connectionInterface->property("Carrier").toBool(); -} - -///////////// -class QNetworkManagerInterfaceDeviceWirelessPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent) -{ - d = new QNetworkManagerInterfaceDeviceWirelessPrivate(); - d->path = ifaceDevicePath; - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE_WIRELESS, - dbusConnection, parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find InterfaceDeviceWireless"; - return; - } - d->valid = true; -} - -QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerInterfaceDeviceWireless::isValid() -{ - return d->valid; -} - -bool QNetworkManagerInterfaceDeviceWireless::setConnections() -{ - if(!isValid() ) - return false; - - bool allOk = false; - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), - this,SIGNAL(propertiesChanged( const QString &, QMap))); - - connect(nmDBusHelper, SIGNAL(pathForAccessPointAdded(const QString &,QDBusObjectPath)), - this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); - - connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(const QString &,QDBusObjectPath)), - this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); - - if(!dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE_WIRELESS, - "AccessPointAdded", - nmDBusHelper, SLOT(slotAccessPointAdded( QDBusObjectPath )))) { - allOk = true; - } - - - if(!dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE_WIRELESS, - "AccessPointRemoved", - nmDBusHelper, SLOT(slotAccessPointRemoved( QDBusObjectPath )))) { - allOk = true; - } - - - if(!dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_DEVICE_WIRELESS, - "PropertiesChanged", - nmDBusHelper,SLOT(slotPropertiesChanged( QMap)))) { - allOk = true; - } - - return allOk; -} - -QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const -{ - return d->connectionInterface; -} - -QList QNetworkManagerInterfaceDeviceWireless::getAccessPoints() -{ - QDBusReply > reply = d->connectionInterface->call("GetAccessPoints"); - return reply.value(); -} - -QString QNetworkManagerInterfaceDeviceWireless::hwAddress() const -{ - return d->connectionInterface->property("HwAddress").toString(); -} - -quint32 QNetworkManagerInterfaceDeviceWireless::mode() const -{ - return d->connectionInterface->property("Mode").toUInt(); -} - -quint32 QNetworkManagerInterfaceDeviceWireless::bitrate() const -{ - return d->connectionInterface->property("Bitrate").toUInt(); -} - -QDBusObjectPath QNetworkManagerInterfaceDeviceWireless::activeAccessPoint() const -{ - return d->connectionInterface->property("ActiveAccessPoint").value(); -} - -quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const -{ - return d->connectionInterface->property("WirelelessCapabilities").toUInt(); -} - -///////////// -class QNetworkManagerSettingsPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent) - : QObject(parent) -{ -// qWarning() << __PRETTY_FUNCTION__; - d = new QNetworkManagerSettingsPrivate(); - d->path = settingsService; - d->connectionInterface = new QDBusInterface(settingsService, - NM_DBUS_PATH_SETTINGS, - NM_DBUS_IFACE_SETTINGS, - dbusConnection); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find NetworkManagerSettings"; - return; - } - d->valid = true; -} - -QNetworkManagerSettings::~QNetworkManagerSettings() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerSettings::isValid() -{ - return d->valid; -} - -bool QNetworkManagerSettings::setConnections() -{ - bool allOk = false; - - if (!dbusConnection.connect(d->path, NM_DBUS_PATH_SETTINGS, - NM_DBUS_IFACE_SETTINGS, "NewConnection", - this, SIGNAL(newConnection(QDBusObjectPath)))) { - allOk = true; - } - - return allOk; -} - -QList QNetworkManagerSettings::listConnections() -{ - QDBusReply > reply = d->connectionInterface->call("ListConnections"); - return reply.value(); -} - -QDBusInterface *QNetworkManagerSettings::connectionInterface() const -{ - return d->connectionInterface; -} - - -///////////// -class QNetworkManagerSettingsConnectionPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - QString service; - QNmSettingsMap settingsMap; - bool valid; -}; - -QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent) -{ - qDBusRegisterMetaType(); - d = new QNetworkManagerSettingsConnectionPrivate(); - d->path = connectionObjectPath; - d->service = settingsService; - d->connectionInterface = new QDBusInterface(settingsService, - d->path, - NM_DBUS_IFACE_SETTINGS_CONNECTION, - dbusConnection, parent); - if (!d->connectionInterface->isValid()) { - qWarning() << "Could not find NetworkManagerSettingsConnection"; - d->valid = false; - return; - } - d->valid = true; - QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings"); - d->settingsMap = rep.value(); -} - -QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerSettingsConnection::isValid() -{ - return d->valid; -} - -bool QNetworkManagerSettingsConnection::setConnections() -{ - if(!isValid() ) - return false; - - bool allOk = false; - if(!dbusConnection.connect(d->service, d->path, - NM_DBUS_IFACE_SETTINGS_CONNECTION, "NewConnection", - this, SIGNAL(updated(QNmSettingsMap)))) { - allOk = true; - } - - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)), - this,SIGNAL(removed( const QString &))); - - if (!dbusConnection.connect(d->service, d->path, - NM_DBUS_IFACE_SETTINGS_CONNECTION, "Removed", - nmDBusHelper, SIGNAL(slotSettingsRemoved()))) { - allOk = true; - } - - return allOk; -} -//QNetworkManagerSettingsConnection::update(QNmSettingsMap map) -//{ -// d->connectionInterface->call("Update", QVariant::fromValue(map)); -//} - -QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const -{ - return d->connectionInterface; -} - -QNmSettingsMap QNetworkManagerSettingsConnection::getSettings() -{ - QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings"); - d->settingsMap = rep.value(); - return d->settingsMap; -} - -NMDeviceType QNetworkManagerSettingsConnection::getType() -{ - QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); - while (i != d->settingsMap.end() && i.key() == "connection") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("type"); - while (ii != innerMap.end() && ii.key() == "type") { - QString devType = ii.value().toString(); - if (devType == "802-3-ethernet") { - return DEVICE_TYPE_802_3_ETHERNET; - } - if (devType == "802-11-wireless") { - return DEVICE_TYPE_802_11_WIRELESS; - } - ii++; - } - i++; - } - return DEVICE_TYPE_UNKNOWN; -} - -bool QNetworkManagerSettingsConnection::isAutoConnect() -{ - QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); - while (i != d->settingsMap.end() && i.key() == "connection") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("autoconnect"); - while (ii != innerMap.end() && ii.key() == "autoconnect") { - return ii.value().toBool(); - ii++; - } - i++; - } - return true; //default networkmanager is autoconnect -} - -quint64 QNetworkManagerSettingsConnection::getTimestamp() -{ - QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); - while (i != d->settingsMap.end() && i.key() == "connection") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("timestamp"); - while (ii != innerMap.end() && ii.key() == "timestamp") { - return ii.value().toUInt(); - ii++; - } - i++; - } - return 0; -} - -QString QNetworkManagerSettingsConnection::getId() -{ - QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); - while (i != d->settingsMap.end() && i.key() == "connection") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("id"); - while (ii != innerMap.end() && ii.key() == "id") { - return ii.value().toString(); - ii++; - } - i++; - } - return QString(); -} - -QString QNetworkManagerSettingsConnection::getUuid() -{ - QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); - while (i != d->settingsMap.end() && i.key() == "connection") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("uuid"); - while (ii != innerMap.end() && ii.key() == "uuid") { - return ii.value().toString(); - ii++; - } - i++; - } - // is no uuid, return the connection path - return d->connectionInterface->path(); -} - -QString QNetworkManagerSettingsConnection::getSsid() -{ - QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); - while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("ssid"); - while (ii != innerMap.end() && ii.key() == "ssid") { - return ii.value().toString(); - ii++; - } - i++; - } - return QString(); -} - -QString QNetworkManagerSettingsConnection::getMacAddress() -{ - if(getType() == DEVICE_TYPE_802_3_ETHERNET) { - QNmSettingsMap::const_iterator i = d->settingsMap.find("802-3-ethernet"); - while (i != d->settingsMap.end() && i.key() == "802-3-ethernet") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("mac-address"); - while (ii != innerMap.end() && ii.key() == "mac-address") { - return ii.value().toString(); - ii++; - } - i++; - } - } - - else if(getType() == DEVICE_TYPE_802_11_WIRELESS) { - QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); - while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("mac-address"); - while (ii != innerMap.end() && ii.key() == "mac-address") { - return ii.value().toString(); - ii++; - } - i++; - } - } - return QString(); -} - -QStringList QNetworkManagerSettingsConnection::getSeenBssids() -{ - if(getType() == DEVICE_TYPE_802_11_WIRELESS) { - QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); - while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { - QMap innerMap = i.value(); - QMap::const_iterator ii = innerMap.find("seen-bssids"); - while (ii != innerMap.end() && ii.key() == "seen-bssids") { - return ii.value().toStringList(); - ii++; - } - i++; - } - } - return QStringList(); -} - -///////////// -class QNetworkManagerConnectionActivePrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent) -{ - d = new QNetworkManagerConnectionActivePrivate(); - d->path = activeConnectionObjectPath; - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - dbusConnection, parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find NetworkManagerSettingsConnection"; - return; - } - d->valid = true; -} - -QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerConnectionActive::isValid() -{ - return d->valid; -} - -bool QNetworkManagerConnectionActive::setConnections() -{ - if(!isValid() ) - return false; - - bool allOk = false; - nmDBusHelper = new QNmDBusHelper; - connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), - this,SIGNAL(propertiesChanged( const QString &, QMap))); - if(dbusConnection.connect(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - "PropertiesChanged", - nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { - allOk = true; - } - - return allOk; -} - -QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const -{ - return d->connectionInterface; -} - -QString QNetworkManagerConnectionActive::serviceName() const -{ - return d->connectionInterface->property("ServiceName").toString(); -} - -QDBusObjectPath QNetworkManagerConnectionActive::connection() const -{ - QVariant prop = d->connectionInterface->property("Connection"); - return prop.value(); -} - -QDBusObjectPath QNetworkManagerConnectionActive::specificObject() const -{ - QVariant prop = d->connectionInterface->property("SpecificObject"); - return prop.value(); -} - -QList QNetworkManagerConnectionActive::devices() const -{ - QVariant prop = d->connectionInterface->property("Devices"); - return prop.value >(); -} - -quint32 QNetworkManagerConnectionActive::state() const -{ - return d->connectionInterface->property("State").toUInt(); -} - -bool QNetworkManagerConnectionActive::defaultRoute() const -{ - return d->connectionInterface->property("Default").toBool(); -} - - -//// -class QNetworkManagerIp4ConfigPrivate -{ -public: - QDBusInterface *connectionInterface; - QString path; - bool valid; -}; - -QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent) -{ - d = new QNetworkManagerIp4ConfigPrivate(); - d->path = deviceObjectPath; - d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, - d->path, - NM_DBUS_INTERFACE_IP4_CONFIG, - dbusConnection, parent); - if (!d->connectionInterface->isValid()) { - d->valid = false; - qWarning() << "Could not find NetworkManagerIp4Config"; - return; - } - d->valid = true; -} - -QNetworkManagerIp4Config::~QNetworkManagerIp4Config() -{ - delete d->connectionInterface; - delete d; -} - -bool QNetworkManagerIp4Config::isValid() -{ - return d->valid; -} - -QStringList QNetworkManagerIp4Config::domains() const -{ - return d->connectionInterface->property("Domains").toStringList(); -} - -#include "moc_qnetworkmanagerservice_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkmanagerservice_p.h b/src/network/bearer/qnetworkmanagerservice_p.h deleted file mode 100644 index 520aeac..0000000 --- a/src/network/bearer/qnetworkmanagerservice_p.h +++ /dev/null @@ -1,397 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKMANAGERSERVICE_H -#define QNETWORKMANAGERSERVICE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include "qnmdbushelper_p.h" - -QT_BEGIN_NAMESPACE - -typedef QMap< QString, QMap > QNmSettingsMap; -typedef QList ServerThing; - -Q_DECLARE_METATYPE(QNmSettingsMap) -Q_DECLARE_METATYPE(ServerThing) - -class QNetworkManagerInterfacePrivate; -class QNetworkManagerInterface : public QObject -{ - Q_OBJECT - -public: - - QNetworkManagerInterface(QObject *parent = 0); - ~QNetworkManagerInterface(); - - QList getDevices() const; - void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject); - void deactivateConnection(QDBusObjectPath connectionPath) const; - - QDBusObjectPath path() const; - QDBusInterface *connectionInterface() const; - - bool wirelessEnabled() const; - bool wirelessHardwareEnabled() const; - QList activeConnections() const; - quint32 state(); - bool setConnections(); - bool isValid(); - -Q_SIGNALS: - void deviceAdded(QDBusObjectPath); - void deviceRemoved(QDBusObjectPath); - void propertiesChanged( const QString &, QMap); - void stateChanged(const QString&, quint32); - void activationFinished(QDBusPendingCallWatcher*); - -private Q_SLOTS: -private: -// Q_DISABLE_COPY(QNetworkManagerInterface); ?? - QNetworkManagerInterfacePrivate *d; - QNmDBusHelper *nmDBusHelper; -}; //end QNetworkManagerInterface - -//////// -class QNetworkManagerInterfaceAccessPointPrivate; -class QNetworkManagerInterfaceAccessPoint : public QObject -{ - Q_OBJECT - -public: - - // NM_DEVICE_STATE - enum DeviceState { - Unknown = 0, - Unmanaged, - Unavailable, - Disconnected, - Prepare, - Config, - NeedAuthentication, - IpConfig, - Activated, - Failed - }; - - enum ApFlag { - ApNone = 0x0, - Privacy = 0x1 - }; - - Q_DECLARE_FLAGS(ApFlags, ApFlag); - - enum ApSecurityFlag { - ApSecurityNone = 0x0, - PairWep40 = 0x1, - PairWep104 = 0x2, - PairTkip = 0x4, - PairCcmp = 0x8, - GroupWep40 = 0x10, - GroupWep104 = 0x20, - GroupTkip = 0x40, - GroupCcmp = 0x80, - KeyPsk = 0x100, - Key8021x = 0x200 - }; - - Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag); - - QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0); - ~QNetworkManagerInterfaceAccessPoint(); - - QDBusInterface *connectionInterface() const; - - quint32 flags() const; - quint32 wpaFlags() const; - quint32 rsnFlags() const; - QString ssid() const; - quint32 frequency() const; - QString hwAddress() const; - quint32 mode() const; - quint32 maxBitrate() const; - quint32 strength() const; - bool setConnections(); - bool isValid(); - -Q_SIGNALS: - void propertiesChanged(QMap ); - void propertiesChanged( const QString &, QMap); -private: - QNetworkManagerInterfaceAccessPointPrivate *d; - QNmDBusHelper *nmDBusHelper; - -}; //end QNetworkManagerInterfaceAccessPoint - -//////// -class QNetworkManagerInterfaceDevicePrivate; -class QNetworkManagerInterfaceDevice : public QObject -{ - Q_OBJECT - -public: - - QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0); - ~QNetworkManagerInterfaceDevice(); - - QString udi() const; - QNetworkInterface interface() const; - QDBusInterface *connectionInterface() const; - quint32 ip4Address() const; - quint32 state() const; - quint32 deviceType() const; - - QDBusObjectPath ip4config() const; - bool setConnections(); - bool isValid(); - -Q_SIGNALS: - void stateChanged(const QString &, quint32); - -private: - QNetworkManagerInterfaceDevicePrivate *d; - QNmDBusHelper *nmDBusHelper; -}; //end QNetworkManagerInterfaceDevice - -//////// -class QNetworkManagerInterfaceDeviceWiredPrivate; -class QNetworkManagerInterfaceDeviceWired : public QObject -{ - Q_OBJECT - -public: - - QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent = 0); - ~QNetworkManagerInterfaceDeviceWired(); - - QDBusInterface *connectionInterface() const; - QString hwAddress() const; - quint32 speed() const; - bool carrier() const; - bool setConnections(); - bool isValid(); - -Q_SIGNALS: - void propertiesChanged( const QString &, QMap); -private: - QNetworkManagerInterfaceDeviceWiredPrivate *d; - QNmDBusHelper *nmDBusHelper; -}; // end QNetworkManagerInterfaceDeviceWired - -//// -class QNetworkManagerInterfaceDeviceWirelessPrivate; -class QNetworkManagerInterfaceDeviceWireless : public QObject -{ - Q_OBJECT - -public: - - enum DeviceCapability { - None = 0x0, - Wep40 = 0x1, - Wep104 = 0x2, - Tkip = 0x4, - Ccmp = 0x8, - Wpa = 0x10, - Rsn = 0x20 - }; - - QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent = 0); - ~QNetworkManagerInterfaceDeviceWireless(); - - QDBusObjectPath path() const; - QList getAccessPoints(); - QDBusInterface *connectionInterface() const; - - QString hwAddress() const; - quint32 mode() const; - quint32 bitrate() const; - QDBusObjectPath activeAccessPoint() const; - quint32 wirelessCapabilities() const; - bool setConnections(); - bool isValid(); - -Q_SIGNALS: - void propertiesChanged( const QString &, QMap); - void accessPointAdded(const QString &,QDBusObjectPath); - void accessPointRemoved(const QString &,QDBusObjectPath); -private: - QNetworkManagerInterfaceDeviceWirelessPrivate *d; - QNmDBusHelper *nmDBusHelper; -}; // end QNetworkManagerInterfaceDeviceWireless - -//// -class QNetworkManagerSettingsPrivate; -class QNetworkManagerSettings : public QObject -{ - Q_OBJECT - -public: - - QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0); - ~QNetworkManagerSettings(); - - QDBusInterface *connectionInterface() const; - QList listConnections(); - bool setConnections(); - bool isValid(); - -Q_SIGNALS: - void newConnection(QDBusObjectPath); -private: - QNetworkManagerSettingsPrivate *d; -}; //end QNetworkManagerSettings - -//// -class QNetworkManagerSettingsConnectionPrivate; -class QNetworkManagerSettingsConnection : public QObject -{ - Q_OBJECT - -public: - - QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0); - ~QNetworkManagerSettingsConnection(); - - QDBusInterface *connectionInterface() const; - QNmSettingsMap getSettings(); - // void update(QNmSettingsMap map); - bool setConnections(); - NMDeviceType getType(); - bool isAutoConnect(); - quint64 getTimestamp(); - QString getId(); - QString getUuid(); - QString getSsid(); - QString getMacAddress(); - QStringList getSeenBssids(); - bool isValid(); - -Q_SIGNALS: - - void updated(QMap< QString, QMap > s); - void removed(const QString &); - -private: - QNmDBusHelper *nmDBusHelper; - QNetworkManagerSettingsConnectionPrivate *d; -}; //end QNetworkManagerSettingsConnection - -//// -class QNetworkManagerConnectionActivePrivate; -class QNetworkManagerConnectionActive : public QObject -{ - Q_OBJECT - -public: - - enum ActiveConnectionState { - Unknown = 0, - Activating = 1, - Activated = 2 - }; - - QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0); - ~ QNetworkManagerConnectionActive(); - - QDBusInterface *connectionInterface() const; - QString serviceName() const; - QDBusObjectPath connection() const; - QDBusObjectPath specificObject() const; - QList devices() const; - quint32 state() const; - bool defaultRoute() const; - bool setConnections(); - bool isValid(); - - -Q_SIGNALS: - void propertiesChanged(QList); - void propertiesChanged( const QString &, QMap); -private: - QNetworkManagerConnectionActivePrivate *d; - QNmDBusHelper *nmDBusHelper; -}; //QNetworkManagerConnectionActive - -//// -class QNetworkManagerIp4ConfigPrivate; -class QNetworkManagerIp4Config : public QObject -{ - Q_OBJECT - -public: - QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0); - ~QNetworkManagerIp4Config(); - - // QList nameservers(); - QStringList domains() const; - bool isValid(); - - private: - QNetworkManagerIp4ConfigPrivate *d; -}; -//// - -QT_END_NAMESPACE - -#endif //QNETWORKMANAGERSERVICE_H diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index c2491ae..cb170e8 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -59,26 +59,8 @@ #include -#if defined(BACKEND_NM) -#include "qnmwifiengine_unix_p.h" -#endif - QT_BEGIN_NAMESPACE -#if defined(BACKEND_NM) -static bool NetworkManagerAvailable() -{ - QDBusConnection dbusConnection = QDBusConnection::systemBus(); - if (dbusConnection.isConnected()) { - QDBusConnectionInterface *dbiface = dbusConnection.interface(); - QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); - if (reply.isValid()) - return reply.value(); - } - return false; -} -#endif - static QNetworkSessionEngine *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); @@ -95,13 +77,6 @@ static QNetworkSessionEngine *getEngineFromId(const QString &id) return nativeWifi; #endif -#if defined(BACKEND_NM) - if(NetworkManagerAvailable()) { - QNmWifiEngine *nmwiifi = QNmWifiEngine::instance(); - if (nmwiifi && nmwiifi->hasIdentifier(id)) - return nmwiifi; - } -#endif #ifdef Q_OS_DARWIN QCoreWlanEngine *coreWifi = QCoreWlanEngine::instance(); if (coreWifi && coreWifi->hasIdentifier(id)) @@ -322,7 +297,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const quint64 QNetworkSessionPrivate::bytesWritten() const { -#if defined(BACKEND_NM) +#if defined(BACKEND_NM) && 0 if( state == QNetworkSession::Connected ) { if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { foreach (const QNetworkConfiguration &config, publicConfig.children()) { @@ -340,7 +315,7 @@ quint64 QNetworkSessionPrivate::bytesWritten() const quint64 QNetworkSessionPrivate::bytesReceived() const { -#if defined(BACKEND_NM) +#if defined(BACKEND_NM) && 0 if( state == QNetworkSession::Connected ) { if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { foreach (const QNetworkConfiguration &config, publicConfig.children()) { @@ -445,7 +420,7 @@ void QNetworkSessionPrivate::networkConfigurationsChanged() updateStateFromServiceNetwork(); else updateStateFromActiveConfig(); -#if defined(BACKEND_NM) +#if defined(BACKEND_NM) && 0 setActiveTimeStamp(); #endif } @@ -492,7 +467,7 @@ void QNetworkSessionPrivate::connectionError(const QString &id, QNetworkSessionE } } -#if defined(BACKEND_NM) +#if defined(BACKEND_NM) && 0 void QNetworkSessionPrivate::setActiveTimeStamp() { if(NetworkManagerAvailable()) { diff --git a/src/network/bearer/qnmdbushelper.cpp b/src/network/bearer/qnmdbushelper.cpp deleted file mode 100644 index 5d7403b..0000000 --- a/src/network/bearer/qnmdbushelper.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// this class is for helping qdbus get stuff - -#include "qnmdbushelper_p.h" - -#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) -#include - -#include -#include -#include -#include -#endif - -#include - -QT_BEGIN_NAMESPACE - -void QNmDBusHelper::deviceStateChanged(quint32 state) - { - QDBusMessage msg = this->message(); - if(state == NM_DEVICE_STATE_ACTIVATED - || state == NM_DEVICE_STATE_DISCONNECTED - || state == NM_DEVICE_STATE_UNAVAILABLE - || state == NM_DEVICE_STATE_FAILED) { - emit pathForStateChanged(msg.path(), state); - } - } - -void QNmDBusHelper::slotAccessPointAdded(QDBusObjectPath path) -{ - if(path.path().length() > 2) { - QDBusMessage msg = this->message(); - emit pathForAccessPointAdded(msg.path(), path); - } -} - -void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path) -{ - if(path.path().length() > 2) { - QDBusMessage msg = this->message(); - emit pathForAccessPointRemoved(msg.path(), path); - } -} - -void QNmDBusHelper::slotPropertiesChanged(QMap map) -{ - QDBusMessage msg = this->message(); - QMapIterator i(map); - while (i.hasNext()) { - i.next(); - if( i.key() == "State") { //state only applies to device interfaces - quint32 state = i.value().toUInt(); - if( state == NM_DEVICE_STATE_ACTIVATED - || state == NM_DEVICE_STATE_DISCONNECTED - || state == NM_DEVICE_STATE_UNAVAILABLE - || state == NM_DEVICE_STATE_FAILED) { - emit pathForPropertiesChanged( msg.path(), map); - } - } else if( i.key() == "ActiveAccessPoint") { - // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value().path(); - // } else if( i.key() == "Strength") - // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt(); - // else - // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value(); - } - } -} - -void QNmDBusHelper::slotSettingsRemoved() -{ - QDBusMessage msg = this->message(); - emit pathForSettingsRemoved(msg.path()); -} - -#include "moc_qnmdbushelper_p.cpp" -QT_END_NAMESPACE diff --git a/src/network/bearer/qnmdbushelper_p.h b/src/network/bearer/qnmdbushelper_p.h deleted file mode 100644 index 99b0357..0000000 --- a/src/network/bearer/qnmdbushelper_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNMDBUSHELPERPRIVATE_H -#define QNMDBUSHELPERPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) -#include -#include -#include -#endif - -QT_BEGIN_NAMESPACE - -#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) - -class QNmDBusHelper: public QObject, protected QDBusContext - { - Q_OBJECT - public: - - public slots: - void deviceStateChanged(quint32); - void slotAccessPointAdded( QDBusObjectPath ); - void slotAccessPointRemoved( QDBusObjectPath ); - void slotPropertiesChanged( QMap); - void slotSettingsRemoved(); - -Q_SIGNALS: - void pathForStateChanged(const QString &, quint32); - void pathForAccessPointAdded(const QString &, QDBusObjectPath ); - void pathForAccessPointRemoved(const QString &, QDBusObjectPath ); - void pathForPropertiesChanged(const QString &, QMap); - void pathForSettingsRemoved(const QString &); -}; -#endif - -QT_END_NAMESPACE - -#endif// QNMDBUSHELPERPRIVATE_H diff --git a/src/network/bearer/qnmwifiengine_unix.cpp b/src/network/bearer/qnmwifiengine_unix.cpp deleted file mode 100644 index 5870a9f..0000000 --- a/src/network/bearer/qnmwifiengine_unix.cpp +++ /dev/null @@ -1,1129 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnmwifiengine_unix_p.h" -#include "qnetworkconfiguration_p.h" -#include - -#include - -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QNmWifiEngine, nmWifiEngine) -typedef QList > QNmSettingsAddressMap; - -Q_DECLARE_METATYPE(QNmSettingsAddressMap) - -QNmWifiEngine::QNmWifiEngine(QObject *parent) -: QNetworkSessionEngine(parent) -{ - iface = new QNetworkManagerInterface(); - if(!iface->isValid()) { - return; - } - iface->setConnections(); - connect(iface,SIGNAL(deviceAdded(QDBusObjectPath)), - this,SLOT(addDevice(QDBusObjectPath))); - connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), - this,SLOT(removeDevice(QDBusObjectPath))); - - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - addDevice(path); - } - - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - settingsiface->setConnections(); - connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), - this,(SLOT(newConnection(QDBusObjectPath)))); - } - - updated = false; -} - -QNmWifiEngine::~QNmWifiEngine() -{ -} - -QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface) -{ - QString newname; - if (devIface->state() == NM_DEVICE_STATE_ACTIVATED) { - QString path = devIface->ip4config().path(); - QNetworkManagerIp4Config * ipIface; - ipIface = new QNetworkManagerIp4Config(path); - newname = ipIface->domains().join(" "); - } - //fallback to interface name - if(newname.isEmpty()) - newname = devIface->interface().name(); - return newname; -} - - -QList QNmWifiEngine::getConfigurations(bool *ok) -{ -// qWarning() << Q_FUNC_INFO << updated; - if (ok) - *ok = false; - - if(!updated) { - foundConfigurations.clear(); - if(knownSsids.isEmpty()) - getKnownSsids(); // list of ssids that have user configurations. - - scanForAccessPoints(); - getActiveConnectionsPaths(); - knownConnections(); - - accessPointConnections(); - -// findConnections(); - //add access points - updated = true; - } - return foundConfigurations; -} - -void QNmWifiEngine::findConnections() -{ - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - - //// eth - switch (devIface->deviceType()) { -// qWarning() << devIface->connectionInterface()->path(); - - case DEVICE_TYPE_802_3_ETHERNET: - { - QString ident; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - - ident = devWiredIface->hwAddress(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = getNameForConfiguration(devIface); - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = devWiredIface->carrier(); - - cpPriv->serviceInterface = devIface->interface(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - switch (devIface->state()) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_FAILED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_UNAVAILABLE: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_DISCONNECTED: - { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Defined); - } - break; - case NM_DEVICE_STATE_ACTIVATED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); - break; - default: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - }; - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { -// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; -// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// -// //// connections -// QStringList connectionServices; -// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; -// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -// -// QString connPath; -// -// foreach (QString service, connectionServices) { -// QString ident; -// QNetworkManagerSettings *settingsiface; -// settingsiface = new QNetworkManagerSettings(service); -// QList list = settingsiface->listConnections(); -// -// foreach(QDBusObjectPath path, list) { //for each connection path -//qWarning() << path.path(); -// ident = path.path(); -// bool addIt = false; -// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -// cpPriv->isValid = true; -// cpPriv->id = ident; -// cpPriv->internet = true; -// -// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered -// | QNetworkConfiguration::Defined); -// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; -// -// QNetworkManagerSettingsConnection *sysIface; -// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// cpPriv->name = sysIface->getId();//ii.value().toString(); -//qWarning() << cpPriv->name; -// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// // get the wifi interface state first.. do we need this? -// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); -// } -// -// //#if 0 -// foreach(QString conpath, activeConnectionPaths) { -// QNetworkManagerConnectionActive *aConn; -// aConn = new QNetworkManagerConnectionActive(conpath); -// // in case of accesspoint, specificObject will hold the accessPOintObjectPath -// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); -// if( aConn->connection().path() == ident) { -// -// QList devs = aConn->devices(); -// foreach(QDBusObjectPath device, devs) { -// QNetworkManagerInterfaceDevice *ifaceDevice; -// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); -// cpPriv->serviceInterface = ifaceDevice->interface(); -// cpPriv->state = getStateFlag(ifaceDevice->state()); -// //cpPriv->accessPoint = aConn->specificObject().path(); -// -// break; -// } -// } -// } -// //#endif -// // } //end while connection -// if(addIt) { -// foundConfigurations.append(cpPriv); -// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); -// } -// } -// } //end each connection service -// -// // ////////////// AccessPoints -//// QList apList = devWirelessIface->getAccessPoints(); -////// qWarning() << apList.count(); -//// foreach(QDBusObjectPath path, apList) { -//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); -//// if(cpPriv->isValid) { -//// foundConfigurations.append(cpPriv); -//// } -//// } - } // end DEVICE_TYPE_802_11_WIRELESS - break; - }; - } //end foreach device -} - -void QNmWifiEngine::knownConnections() -{ -// qWarning() << Q_FUNC_INFO; - //// connections - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - - QString connPath; - - foreach (QString service, connectionServices) { - QString ident; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - -// qWarning() <setConnections(); - connect(sysIface, SIGNAL(removed(QString)), - this,SLOT(settingsConnectionRemoved(QString))); - - cpPriv->name = sysIface->getId(); - cpPriv->isValid = true; - cpPriv->id = sysIface->getUuid(); -// cpPriv->id = ident; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -//qWarning() << cpPriv->name; - cpPriv->state = getStateForId(cpPriv->id); - - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - - if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { - QString mac = sysIface->getMacAddress(); - if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; - QString devPath; - devPath = deviceConnectionPath(mac); - - // qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - cpPriv->internet = devWiredIface->carrier(); - - // use this mac addy - } else { - cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_3_ETHERNET, cpPriv->id); - } - - cpPriv->internet = true;//sysIface->isAutoConnect(); - - addIt = true; - } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { - QString mac = sysIface->getMacAddress();; - if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; - QString devPath; - devPath = deviceConnectionPath(mac); -// qWarning() << Q_FUNC_INFO << devPath; - - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - // use this mac addy - } else { - cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); - } - // cpPriv->serviceInterface = devIface->interface(); - addIt = true; - // get the wifi interface state first.. do we need this? - // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - } - if(addIt) { - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - } //end each connection service - } -} - -void QNmWifiEngine::accessPointConnections() -{ - //qWarning() << Q_FUNC_INFO; - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - QList apList = availableAccessPoints.uniqueKeys(); - - QList::const_iterator i; - for (i = apList.constBegin(); i != apList.constEnd(); ++i) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); - if(cpPriv->isValid) { - foundConfigurations.append(cpPriv); - // qWarning() << "adding" << cpPriv->name << "to things"; - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - } - } - } -} - -QString QNmWifiEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id); -} - -bool QNmWifiEngine::hasIdentifier(const QString &id) -{ - if (configurationInterface.contains(id)) - return true; - foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { - if (cpPriv->id == id) - return true; - } - return false; -} - -QString QNmWifiEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(interface == devIface->interface().name()) { - switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: - return QLatin1String("Ethernet"); - break; - case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: - return QLatin1String("WLAN"); - break; - case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: - return QLatin1String("2G"); - break; - case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: - return QLatin1String("CDMA2000"); - break; - default: - break; - }; - } - } - return QString(); -} - -void QNmWifiEngine::connectToId(const QString &id) -{ -// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; - activatingConnectionPath = id; - QStringList connectionSettings = getConnectionPathForId(id); - if(connectionSettings.isEmpty()) { - emit connectionError(id, OperationNotSupported); - return; - } - - QDBusObjectPath connectionPath(connectionSettings.at(1)); - QString interface = getInterfaceFromId(id); - - interface = QNetworkInterface::interfaceFromName(interface).hardwareAddress().toLower(); - QString devPath; - devPath = deviceConnectionPath(interface); - QDBusObjectPath devicePath(devPath); - - iface = new QNetworkManagerInterface(); - iface->activateConnection( - connectionSettings.at(0), - connectionPath, - devicePath, - connectionPath); - - connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), - this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); -} - -void QNmWifiEngine::disconnectFromId(const QString &id) -{ - QString activeConnectionPath = getActiveConnectionPath(id); - //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; - - if (!activeConnectionPath.isEmpty()) { - QNetworkManagerConnectionActive *activeCon; - activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); - QNetworkManagerSettingsConnection *settingsCon; - settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); - - if(settingsCon->isAutoConnect()) { -// qWarning() << id << "is autoconnect"; - emit connectionError(id, OperationNotSupported); - //unsupported - } else { -// qWarning() <deactivateConnection(dbpath); - activatingConnectionPath = ""; - } - } -} - -void QNmWifiEngine::requestUpdate() -{ - updated = false; - knownSsids.clear(); - availableAccessPoints.clear(); - emitConfigurationsChanged(); -} - -QNmWifiEngine *QNmWifiEngine::instance() -{ - QDBusConnection dbusConnection = QDBusConnection::systemBus(); - if (dbusConnection.isConnected()) { - QDBusConnectionInterface *dbiface = dbusConnection.interface(); - QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); - if (reply.isValid() && reply.value()) - return nmWifiEngine(); - } - - return 0; -} - -void QNmWifiEngine::getKnownSsids() -{ - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << sysIface->getSsid(); - knownSsids << sysIface->getSsid(); - } - } -} - -void QNmWifiEngine::getActiveConnectionsPaths() -{ -// qWarning() << Q_FUNC_INFO; - QNetworkManagerInterface *dbIface; - activeConnectionPaths.clear(); - dbIface = new QNetworkManagerInterface; - QList connections = dbIface->activeConnections(); - - foreach(QDBusObjectPath conpath, connections) { - activeConnectionPaths << conpath.path(); -// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); - - QNetworkManagerConnectionActive *activeConn; - activeConn = new QNetworkManagerConnectionActive(conpath.path()); - -// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); - - } -} - -QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) -{ //foreach accessPoint - //qWarning() << Q_FUNC_INFO << iPath << path.path(); - - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(iPath); - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); - - QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); - - QString ident = accessPointIface->connectionInterface()->path(); - quint32 nmState = devIface->state(); - - QString ssid = accessPointIface->ssid(); - QString hwAddy = accessPointIface->hwAddress(); - QString sInterface = devIface->interface().name(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - bool addIt = true; - //qWarning() << availableAccessPoints.count() << ssid; - -// if(availableAccessPoints.contains(ssid)) { -// addIt = false; -// -// } -// foreach (QNetworkConfigurationPrivate *cpPriv, foundConfigurations) { -// if (cpPriv->name == ssid) { //weed out duplicate ssid's ?? -// addIt = false; -// break; -// } -// } - - if(addIt) { - - cpPriv->name = ssid; - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = devIface->interface(); - - //qWarning() <<__FUNCTION__ << ssid; - - cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); - - if(activeAPPath == accessPointIface->connectionInterface()->path()) { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Active); - } - if(accessPointIface->flags() == NM_802_11_AP_FLAGS_PRIVACY) - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - else - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - return cpPriv; - } else { - cpPriv->isValid = false; - } - return cpPriv; -} - - - QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) -{ - QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; -//qWarning() << nmState << knownSsids; - // this is the state of the wifi device interface - if(isKnown) - state = ( QNetworkConfiguration::Defined); - - switch(nmState) { //device interface state, not AP state - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_UNAVAILABLE: - state = (QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_DISCONNECTED: - { - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - } - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - } - break; - }; - return state; -} - -QString QNmWifiEngine::getActiveConnectionPath(const QString &id) -{ - //qWarning() << Q_FUNC_INFO << id; - QStringList connectionSettings = getConnectionPathForId(id); - //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath path, connections) { - QNetworkManagerConnectionActive *conDetailsD; - conDetailsD = new QNetworkManagerConnectionActive( path.path()); - if(conDetailsD->connection().path() == connectionSettings.at(1) - && conDetailsD->serviceName() == connectionSettings.at(0)) - return path.path(); - } - return QString(); -} - - QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) - { -// qWarning() << Q_FUNC_INFO << nmstate; - QNetworkConfiguration::StateFlags flag; - switch (nmstate) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_FAILED: - case NM_DEVICE_STATE_UNMANAGED: - flag = (QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_UNAVAILABLE: - flag = (QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_DISCONNECTED: - flag = ( flag | QNetworkConfiguration::Discovered ); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - flag = ( flag | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Active ); - } - break; - default: - flag = ( QNetworkConfiguration::Defined); - break; - }; - return flag; - } - -void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) -{ -// qWarning() << Q_FUNC_INFO << path << nmState; - - if(nmState == NM_DEVICE_STATE_ACTIVATED - || nmState == NM_DEVICE_STATE_DISCONNECTED - || nmState == NM_DEVICE_STATE_UNAVAILABLE - || nmState == NM_DEVICE_STATE_FAILED) { - -/* InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, -*/ -// qWarning() << Q_FUNC_INFO << ident; - QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); - switch (nmState) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_FAILED: - state = (QNetworkConfiguration::Undefined); - emit connectionError(activatingConnectionPath, ConnectError); - requestUpdate(); -// qWarning() << Q_FUNC_INFO; - break; - case NM_DEVICE_STATE_UNAVAILABLE: - state = (QNetworkConfiguration::Defined); -// emit connectionError(activatingConnectionPath, ConnectError); - requestUpdate(); - break; - case NM_DEVICE_STATE_DISCONNECTED: - state = ( state | QNetworkConfiguration::Discovered ); - requestUpdate(); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - state = ( state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Active ); - requestUpdate(); - } - break; - default: - state = ( QNetworkConfiguration::Defined); - break; - }; - } -} - -void QNmWifiEngine::addDevice(QDBusObjectPath path) -{ - //qWarning() << Q_FUNC_INFO << path.path(); - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - devIface->setConnections(); - connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), - this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); - - if(!devicePaths.contains(path.path())) - devicePaths << path.path(); - - switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET: - { - QNetworkManagerInterfaceDeviceWired * devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - devWiredIface->setConnections(); - connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), - this,SLOT(cmpPropertiesChanged( const QString &, QMap))); - requestUpdate(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); - devWirelessIface->setConnections(); - - connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), - this,SLOT(cmpPropertiesChanged( const QString &, QMap))); - - connect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), - this,SLOT(accessPointAdded(const QString &,QDBusObjectPath))); - - connect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), - this,SLOT(accessPointRemoved(const QString &,QDBusObjectPath))); - requestUpdate(); - - } - break; - default: - break; - }; -} - -void QNmWifiEngine::removeDevice(QDBusObjectPath /*path*/) -{ -// qWarning() << Q_FUNC_INFO << path.path(); -// disconnect(devIface,SIGNAL(stateChanged(const QString &, quint32)), -// this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); -// -// if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// // devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// // devWirelessIface->setConnections(); -// -// disconnect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), -// this,SIGNAL(cmpPropertiesChanged( const QString &, QMap))); -// -// disconnect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), -// this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); -// -// disconnect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), -// this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); -// -// } -} -void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap map) -{ - QMapIterator i(map); - while (i.hasNext()) { - i.next(); -// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); - if( i.key() == "State") { //only applies to device interfaces - updateDeviceInterfaceState(path, i.value().toUInt()); - } - if( i.key() == "ActiveAccessPoint") { - } - if( i.key() == "Carrier") { //someone got plugged in - // requestUpdate(); - } - } -} - -void QNmWifiEngine::accessPointRemoved( const QString &aPath, QDBusObjectPath /*oPath*/) -{ - //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); - - if(aPath.contains("devices")) { - requestUpdate(); - } -} - -void QNmWifiEngine::accessPointAdded( const QString &aPath, QDBusObjectPath oPath) -{ - //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv = addAccessPoint( aPath, oPath); - requestUpdate(); -} - -QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id) -{ - //qWarning() << Q_FUNC_INFO << id; - bool isAvailable = false; - QStringList conPath = getConnectionPathForId(id); - QString aconpath = getActiveConnectionPath(id); - - //qWarning() << Q_FUNC_INFO << id << aconpath; - - if(!aconpath.isEmpty()) { - //active connection - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(aconpath); - - QList devs = aConn->devices(); - - foreach(QDBusObjectPath dev, devs) { - //qWarning() << "foreach" << dev.path(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); - - if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { - - if(isAddressOfConnection(id, ifaceDevice->ip4Address())) { - // this is it! - return getStateFlag(ifaceDevice->state()); - } else { - continue; - } - - if(ifaceDevice->state() == NM_DEVICE_STATE_UNAVAILABLE || - ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { - isAvailable = true; - - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); - if(!devWiredIface->carrier()) - return QNetworkConfiguration::Defined; - } //end eth - } else if(ifaceDevice->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - qWarning() << "FIXME!!!!!!!!!!!!!!!!!"; - } - - return getStateFlag(ifaceDevice->state()); - } - } else { - // not active - //qWarning() << Q_FUNC_INFO << "Not active"; - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); - if(sysIface->isValid()) { - if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { - QString ssid = sysIface->getSsid(); - bool ok = false; - - if(knownSsids.contains(ssid, Qt::CaseSensitive)) { - foreach(QString onessid, knownSsids) { - // qWarning() << ssid << onessid; - if(onessid == ssid && availableAccessPoints.contains(ssid)) { - // qWarning() < devices = aConn->devices(); - foreach(QDBusObjectPath device, devices) { - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); - if(ifaceDevice->ip4Address() == ipaddress) { - return true; - } - } - return false; -} - -QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) -{ - // check active connections first. - QStringList conIdPath = getConnectionPathForId(id); -// qWarning() << Q_FUNC_INFO << id << conIdPath; - - QNetworkInterface interface; - foreach(QString conpath, activeConnectionPaths) { - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(conpath); - - if(aConn->connection().path() == conIdPath.at(1) - && aConn->serviceName() == conIdPath.at(0)) { - - QList devs = aConn->devices(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one - interface = ifaceDevice->interface(); - return interface; - } - } - -//try guessing - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(devIface->deviceType() == type /*&& devIface->managed()*/) { - interface = devIface->interface(); - if(devIface->state() == NM_STATE_DISCONNECTED) { - return interface; - } - } - } - return interface; -} - -quint64 QNmWifiEngine::receivedDataForId(const QString &id) const -{ - if(configurationInterface.count() > 1) - return 0; - quint64 result = 0; - - QString devFile; - devFile = configurationInterface.value(id); - QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); - if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&rx); - in >> result; - rx.close(); - } - return result; -} - -quint64 QNmWifiEngine::sentDataForId(const QString &id) const -{ - if(configurationInterface.count() > 1) - return 0; - quint64 result = 0; - QString devFile; - devFile = configurationInterface.value(id); - - QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); - if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&tx); - in >> result; - tx.close(); - } - return result; -} - -void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) -{ - //qWarning() << Q_FUNC_INFO; - requestUpdate(); -} - -void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) -{ - //qWarning() << Q_FUNC_INFO; - requestUpdate(); -} - -void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) -{ - QDBusPendingReply reply = *openCall; - if (reply.isError()) { - qWarning() <<"Error" << reply.error().name() << reply.error().message() - < list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - - if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - -// qWarning() << devIface->connectionInterface()->path(); - - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); - ////////////// AccessPoints - QList apList = devWirelessIface->getAccessPoints(); - - foreach(QDBusObjectPath path, apList) { - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); - QString ssid = accessPointIface->ssid(); - availableAccessPoints.insert(ssid, path); - } - } - } -} - -QString QNmWifiEngine::deviceConnectionPath(const QString &mac) -{ -// qWarning() << __FUNCTION__ << mac; - QString newMac = mac; - newMac = newMac.replace(":","_").toLower(); - //device object path might not contain just mac address - //might contain extra numbers on the end. thanks HAL - foreach(QString device, devicePaths) { - if(device.contains(newMac)) { - newMac = device; - break; - } - } - return newMac; -} - -QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) -{ - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << uuid << sysIface->getUuid(); - if(sysIface->getUuid() == uuid) { -// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); - return QStringList() << service << sysIface->connectionInterface()->path(); - } - } - } - return QStringList(); -} - -#include "moc_qnmwifiengine_unix_p.cpp" - -QT_END_NAMESPACE - diff --git a/src/network/bearer/qnmwifiengine_unix_p.h b/src/network/bearer/qnmwifiengine_unix_p.h deleted file mode 100644 index 3af73ea..0000000 --- a/src/network/bearer/qnmwifiengine_unix_p.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNMWIFIENGINE_P_H -#define QNMWIFIENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -//#include - -#include -#include -#include -#include - -#include "qnetworksessionengine_p.h" -#include -#include -#include - - - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; - -class QNmWifiEngine : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - QNmWifiEngine(QObject *parent = 0); - ~QNmWifiEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - static QNmWifiEngine *instance(); - - QStringList knownSsids; - inline void emitConfigurationsChanged() { emit configurationsChanged(); } - QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); - - QStringList getConnectionPathForId(const QString &uuid); - //QString getConnectionPathForId(const QString &name = QString()); - quint64 sentDataForId(const QString &id) const; - quint64 receivedDataForId(const QString &id) const; - -private: - bool updated; - QString activatingConnectionPath; - QStringList activeConnectionPaths; - - - QMap availableAccessPoints; - void scanForAccessPoints(); - - QStringList devicePaths; - - void getActiveConnectionsPaths(); - void getKnownSsids(); - void accessPointConnections(); - void knownConnections(); - void findConnections(); - QString deviceConnectionPath(const QString &mac); - - QList foundConfigurations; - // QHash > allConfigurations; - - QNetworkManagerInterface *iface; - - QNetworkConfiguration::StateFlags getAPState(qint32 vState, bool isKnown); - QNetworkConfiguration::StateFlags getStateFlag(quint32 nmstate); - - QString getActiveConnectionPath(const QString &identifier); - QString getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface); - - QNetworkConfiguration::StateFlags getStateForId(const QString &id); - - QNetworkInterface getBestInterface(quint32 type, const QString &conPath); - - QMap configurationInterface; - - bool isAddressOfConnection(const QString &conPath, quint32 ipaddress); - -private slots: - void updateDeviceInterfaceState(const QString &, quint32); - void addDevice(QDBusObjectPath path); - void removeDevice(QDBusObjectPath path); - -Q_SIGNALS: - void configurationChanged(const QNetworkConfiguration& config); - void updateAccessPointState(const QString &, quint32); -// void slotActivationFinished(QDBusPendingCallWatcher*); - -private slots: - void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); - void accessPointRemoved( const QString &aPath, QDBusObjectPath oPath); - void cmpPropertiesChanged(const QString &, QMap map); - void newConnection(QDBusObjectPath); - void settingsConnectionRemoved(const QString &); - void slotActivationFinished(QDBusPendingCallWatcher*); -}; - -QT_END_NAMESPACE - -#endif - - diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 0e3ef48..60ba81b 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs SUBDIRS += generic +contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp new file mode 100644 index 0000000..c79fe91 --- /dev/null +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnmwifiengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkManagerEnginePlugin : public QBearerEnginePlugin +{ +public: + QNetworkManagerEnginePlugin(); + ~QNetworkManagerEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QNetworkManagerEnginePlugin::QNetworkManagerEnginePlugin() +{ +} + +QNetworkManagerEnginePlugin::~QNetworkManagerEnginePlugin() +{ +} + +QStringList QNetworkManagerEnginePlugin::keys() const +{ + qDebug() << Q_FUNC_INFO; + + return QStringList() << QLatin1String("networkmanager"); +} + +QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key == QLatin1String("networkmanager")) + return new QNmWifiEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QNetworkManagerEnginePlugin) +Q_EXPORT_PLUGIN2(qnmbearer, QNetworkManagerEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro new file mode 100644 index 0000000..36d150a --- /dev/null +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -0,0 +1,19 @@ +TARGET = qnmbearer +include(../../qpluginbase.pri) + +QT += network dbus + +DEFINES += BEARER_ENGINE BACKEND_NM + +HEADERS += qnmdbushelper.h \ + qnetworkmanagerservice.h \ + qnmwifiengine.h + +SOURCES += main.cpp \ + qnmdbushelper.cpp \ + qnetworkmanagerservice.cpp \ + qnmwifiengine.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp new file mode 100644 index 0000000..e95c2e6 --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -0,0 +1,1009 @@ +/**************************************************************************** +** +** 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 plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "qnmdbushelper.h" +#include "qnetworkmanagerservice.h" + +//Q_DECLARE_METATYPE(QList) +QT_BEGIN_NAMESPACE + +static QDBusConnection dbusConnection = QDBusConnection::systemBus(); +//static QDBusInterface iface(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, dbusConnection); + +class QNetworkManagerInterfacePrivate +{ +public: + QDBusInterface *connectionInterface; + bool valid; +}; + +QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) + : QObject(parent) +{ + d = new QNetworkManagerInterfacePrivate(); + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + dbusConnection); + if (!d->connectionInterface->isValid()) { + qWarning() << "Could not find NetworkManager"; + d->valid = false; + return; + } + d->valid = true; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), + this, SIGNAL(stateChanged(const QString&, quint32))); + +} + +QNetworkManagerInterface::~QNetworkManagerInterface() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterface::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterface::setConnections() +{ + if(!isValid() ) + return false; + bool allOk = false; + if (!dbusConnection.connect(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap)))) { + allOk = true; + } + if (!dbusConnection.connect(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + "DeviceAdded", + this,SIGNAL(deviceAdded(QDBusObjectPath)))) { + allOk = true; + } + if (!dbusConnection.connect(NM_DBUS_SERVICE, + NM_DBUS_PATH, + NM_DBUS_INTERFACE, + "DeviceRemoved", + this,SIGNAL(deviceRemoved(QDBusObjectPath)))) { + allOk = true; + } + + return allOk; +} + +QDBusInterface *QNetworkManagerInterface::connectionInterface() const +{ + return d->connectionInterface; +} + +QList QNetworkManagerInterface::getDevices() const +{ + QDBusReply > reply = d->connectionInterface->call("GetDevices"); + return reply.value(); +} + +void QNetworkManagerInterface::activateConnection( const QString &serviceName, + QDBusObjectPath connectionPath, + QDBusObjectPath devicePath, + QDBusObjectPath specificObject) +{ + QDBusPendingCall pendingCall = d->connectionInterface->asyncCall("ActivateConnection", + QVariant(serviceName), + QVariant::fromValue(connectionPath), + QVariant::fromValue(devicePath), + QVariant::fromValue(specificObject)); + + QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingCall, this); + connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), + this, SIGNAL(activationFinished(QDBusPendingCallWatcher*))); +} + +void QNetworkManagerInterface::deactivateConnection(QDBusObjectPath connectionPath) const +{ + d->connectionInterface->call("DeactivateConnection", QVariant::fromValue(connectionPath)); +} + +bool QNetworkManagerInterface::wirelessEnabled() const +{ + return d->connectionInterface->property("WirelessEnabled").toBool(); +} + +bool QNetworkManagerInterface::wirelessHardwareEnabled() const +{ + return d->connectionInterface->property("WirelessHardwareEnabled").toBool(); +} + +QList QNetworkManagerInterface::activeConnections() const +{ + QVariant prop = d->connectionInterface->property("ActiveConnections"); + return prop.value >(); +} + +quint32 QNetworkManagerInterface::state() +{ + return d->connectionInterface->property("State").toUInt(); +} + +///////////// +class QNetworkManagerInterfaceAccessPointPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent) + : QObject(parent) +{ + d = new QNetworkManagerInterfaceAccessPointPrivate(); + d->path = dbusPathName; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACCESS_POINT, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find InterfaceAccessPoint"; + return; + } + d->valid = true; + +} + +QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceAccessPoint::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterfaceAccessPoint::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACCESS_POINT, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { + allOk = true; + + } + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceAccessPoint::connectionInterface() const +{ + return d->connectionInterface; +} + +quint32 QNetworkManagerInterfaceAccessPoint::flags() const +{ + return d->connectionInterface->property("Flags").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::wpaFlags() const +{ + return d->connectionInterface->property("WpaFlags").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::rsnFlags() const +{ + return d->connectionInterface->property("RsnFlags").toUInt(); +} + +QString QNetworkManagerInterfaceAccessPoint::ssid() const +{ + return d->connectionInterface->property("Ssid").toString(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::frequency() const +{ + return d->connectionInterface->property("Frequency").toUInt(); +} + +QString QNetworkManagerInterfaceAccessPoint::hwAddress() const +{ + return d->connectionInterface->property("HwAddress").toString(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::mode() const +{ + return d->connectionInterface->property("Mode").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::maxBitrate() const +{ + return d->connectionInterface->property("MaxBitrate").toUInt(); +} + +quint32 QNetworkManagerInterfaceAccessPoint::strength() const +{ + return d->connectionInterface->property("Strength").toUInt(); +} + +///////////// +class QNetworkManagerInterfaceDevicePrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) + : QObject(parent) +{ + d = new QNetworkManagerInterfaceDevicePrivate(); + d->path = deviceObjectPath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManager"; + return; + } + d->valid = true; +} + +QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceDevice::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterfaceDevice::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), + this, SIGNAL(stateChanged(const QString&, quint32))); + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE, + "StateChanged", + nmDBusHelper,SLOT(deviceStateChanged(quint32)))) { + allOk = true; + } + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceDevice::connectionInterface() const +{ + return d->connectionInterface; +} + +QString QNetworkManagerInterfaceDevice::udi() const +{ + return d->connectionInterface->property("Udi").toString(); +} + +QNetworkInterface QNetworkManagerInterfaceDevice::interface() const +{ + return QNetworkInterface::interfaceFromName(d->connectionInterface->property("Interface").toString()); +} + +quint32 QNetworkManagerInterfaceDevice::ip4Address() const +{ + return d->connectionInterface->property("Ip4Address").toUInt(); +} + +quint32 QNetworkManagerInterfaceDevice::state() const +{ + return d->connectionInterface->property("State").toUInt(); +} + +quint32 QNetworkManagerInterfaceDevice::deviceType() const +{ + return d->connectionInterface->property("DeviceType").toUInt(); +} + +QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const +{ + QVariant prop = d->connectionInterface->property("Ip4Config"); + return prop.value(); +} + +///////////// +class QNetworkManagerInterfaceDeviceWiredPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent) +{ + d = new QNetworkManagerInterfaceDeviceWiredPrivate(); + d->path = ifaceDevicePath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRED, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find InterfaceDeviceWired"; + return; + } + d->valid = true; +} + +QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceDeviceWired::isValid() +{ + + return d->valid; +} + +bool QNetworkManagerInterfaceDeviceWired::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRED, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { + allOk = true; + } + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceDeviceWired::connectionInterface() const +{ + return d->connectionInterface; +} + +QString QNetworkManagerInterfaceDeviceWired::hwAddress() const +{ + return d->connectionInterface->property("HwAddress").toString(); +} + +quint32 QNetworkManagerInterfaceDeviceWired::speed() const +{ + return d->connectionInterface->property("Speed").toUInt(); +} + +bool QNetworkManagerInterfaceDeviceWired::carrier() const +{ + return d->connectionInterface->property("Carrier").toBool(); +} + +///////////// +class QNetworkManagerInterfaceDeviceWirelessPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent) +{ + d = new QNetworkManagerInterfaceDeviceWirelessPrivate(); + d->path = ifaceDevicePath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find InterfaceDeviceWireless"; + return; + } + d->valid = true; +} + +QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerInterfaceDeviceWireless::isValid() +{ + return d->valid; +} + +bool QNetworkManagerInterfaceDeviceWireless::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + + connect(nmDBusHelper, SIGNAL(pathForAccessPointAdded(const QString &,QDBusObjectPath)), + this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); + + connect(nmDBusHelper, SIGNAL(pathForAccessPointRemoved(const QString &,QDBusObjectPath)), + this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); + + if(!dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + "AccessPointAdded", + nmDBusHelper, SLOT(slotAccessPointAdded( QDBusObjectPath )))) { + allOk = true; + } + + + if(!dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + "AccessPointRemoved", + nmDBusHelper, SLOT(slotAccessPointRemoved( QDBusObjectPath )))) { + allOk = true; + } + + + if(!dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_DEVICE_WIRELESS, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap)))) { + allOk = true; + } + + return allOk; +} + +QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const +{ + return d->connectionInterface; +} + +QList QNetworkManagerInterfaceDeviceWireless::getAccessPoints() +{ + QDBusReply > reply = d->connectionInterface->call("GetAccessPoints"); + return reply.value(); +} + +QString QNetworkManagerInterfaceDeviceWireless::hwAddress() const +{ + return d->connectionInterface->property("HwAddress").toString(); +} + +quint32 QNetworkManagerInterfaceDeviceWireless::mode() const +{ + return d->connectionInterface->property("Mode").toUInt(); +} + +quint32 QNetworkManagerInterfaceDeviceWireless::bitrate() const +{ + return d->connectionInterface->property("Bitrate").toUInt(); +} + +QDBusObjectPath QNetworkManagerInterfaceDeviceWireless::activeAccessPoint() const +{ + return d->connectionInterface->property("ActiveAccessPoint").value(); +} + +quint32 QNetworkManagerInterfaceDeviceWireless::wirelessCapabilities() const +{ + return d->connectionInterface->property("WirelelessCapabilities").toUInt(); +} + +///////////// +class QNetworkManagerSettingsPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent) + : QObject(parent) +{ +// qWarning() << __PRETTY_FUNCTION__; + d = new QNetworkManagerSettingsPrivate(); + d->path = settingsService; + d->connectionInterface = new QDBusInterface(settingsService, + NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, + dbusConnection); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManagerSettings"; + return; + } + d->valid = true; +} + +QNetworkManagerSettings::~QNetworkManagerSettings() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerSettings::isValid() +{ + return d->valid; +} + +bool QNetworkManagerSettings::setConnections() +{ + bool allOk = false; + + if (!dbusConnection.connect(d->path, NM_DBUS_PATH_SETTINGS, + NM_DBUS_IFACE_SETTINGS, "NewConnection", + this, SIGNAL(newConnection(QDBusObjectPath)))) { + allOk = true; + } + + return allOk; +} + +QList QNetworkManagerSettings::listConnections() +{ + QDBusReply > reply = d->connectionInterface->call("ListConnections"); + return reply.value(); +} + +QDBusInterface *QNetworkManagerSettings::connectionInterface() const +{ + return d->connectionInterface; +} + + +///////////// +class QNetworkManagerSettingsConnectionPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + QString service; + QNmSettingsMap settingsMap; + bool valid; +}; + +QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent) +{ + qDBusRegisterMetaType(); + d = new QNetworkManagerSettingsConnectionPrivate(); + d->path = connectionObjectPath; + d->service = settingsService; + d->connectionInterface = new QDBusInterface(settingsService, + d->path, + NM_DBUS_IFACE_SETTINGS_CONNECTION, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + qWarning() << "Could not find NetworkManagerSettingsConnection"; + d->valid = false; + return; + } + d->valid = true; + QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings"); + d->settingsMap = rep.value(); +} + +QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerSettingsConnection::isValid() +{ + return d->valid; +} + +bool QNetworkManagerSettingsConnection::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + if(!dbusConnection.connect(d->service, d->path, + NM_DBUS_IFACE_SETTINGS_CONNECTION, "NewConnection", + this, SIGNAL(updated(QNmSettingsMap)))) { + allOk = true; + } + + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)), + this,SIGNAL(removed( const QString &))); + + if (!dbusConnection.connect(d->service, d->path, + NM_DBUS_IFACE_SETTINGS_CONNECTION, "Removed", + nmDBusHelper, SIGNAL(slotSettingsRemoved()))) { + allOk = true; + } + + return allOk; +} +//QNetworkManagerSettingsConnection::update(QNmSettingsMap map) +//{ +// d->connectionInterface->call("Update", QVariant::fromValue(map)); +//} + +QDBusInterface *QNetworkManagerSettingsConnection::connectionInterface() const +{ + return d->connectionInterface; +} + +QNmSettingsMap QNetworkManagerSettingsConnection::getSettings() +{ + QDBusReply< QNmSettingsMap > rep = d->connectionInterface->call("GetSettings"); + d->settingsMap = rep.value(); + return d->settingsMap; +} + +NMDeviceType QNetworkManagerSettingsConnection::getType() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("type"); + while (ii != innerMap.end() && ii.key() == "type") { + QString devType = ii.value().toString(); + if (devType == "802-3-ethernet") { + return DEVICE_TYPE_802_3_ETHERNET; + } + if (devType == "802-11-wireless") { + return DEVICE_TYPE_802_11_WIRELESS; + } + ii++; + } + i++; + } + return DEVICE_TYPE_UNKNOWN; +} + +bool QNetworkManagerSettingsConnection::isAutoConnect() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("autoconnect"); + while (ii != innerMap.end() && ii.key() == "autoconnect") { + return ii.value().toBool(); + ii++; + } + i++; + } + return true; //default networkmanager is autoconnect +} + +quint64 QNetworkManagerSettingsConnection::getTimestamp() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("timestamp"); + while (ii != innerMap.end() && ii.key() == "timestamp") { + return ii.value().toUInt(); + ii++; + } + i++; + } + return 0; +} + +QString QNetworkManagerSettingsConnection::getId() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("id"); + while (ii != innerMap.end() && ii.key() == "id") { + return ii.value().toString(); + ii++; + } + i++; + } + return QString(); +} + +QString QNetworkManagerSettingsConnection::getUuid() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("connection"); + while (i != d->settingsMap.end() && i.key() == "connection") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("uuid"); + while (ii != innerMap.end() && ii.key() == "uuid") { + return ii.value().toString(); + ii++; + } + i++; + } + // is no uuid, return the connection path + return d->connectionInterface->path(); +} + +QString QNetworkManagerSettingsConnection::getSsid() +{ + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); + while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("ssid"); + while (ii != innerMap.end() && ii.key() == "ssid") { + return ii.value().toString(); + ii++; + } + i++; + } + return QString(); +} + +QString QNetworkManagerSettingsConnection::getMacAddress() +{ + if(getType() == DEVICE_TYPE_802_3_ETHERNET) { + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-3-ethernet"); + while (i != d->settingsMap.end() && i.key() == "802-3-ethernet") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("mac-address"); + while (ii != innerMap.end() && ii.key() == "mac-address") { + return ii.value().toString(); + ii++; + } + i++; + } + } + + else if(getType() == DEVICE_TYPE_802_11_WIRELESS) { + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); + while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("mac-address"); + while (ii != innerMap.end() && ii.key() == "mac-address") { + return ii.value().toString(); + ii++; + } + i++; + } + } + return QString(); +} + +QStringList QNetworkManagerSettingsConnection::getSeenBssids() +{ + if(getType() == DEVICE_TYPE_802_11_WIRELESS) { + QNmSettingsMap::const_iterator i = d->settingsMap.find("802-11-wireless"); + while (i != d->settingsMap.end() && i.key() == "802-11-wireless") { + QMap innerMap = i.value(); + QMap::const_iterator ii = innerMap.find("seen-bssids"); + while (ii != innerMap.end() && ii.key() == "seen-bssids") { + return ii.value().toStringList(); + ii++; + } + i++; + } + } + return QStringList(); +} + +///////////// +class QNetworkManagerConnectionActivePrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent) +{ + d = new QNetworkManagerConnectionActivePrivate(); + d->path = activeConnectionObjectPath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManagerSettingsConnection"; + return; + } + d->valid = true; +} + +QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerConnectionActive::isValid() +{ + return d->valid; +} + +bool QNetworkManagerConnectionActive::setConnections() +{ + if(!isValid() ) + return false; + + bool allOk = false; + nmDBusHelper = new QNmDBusHelper; + connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), + this,SIGNAL(propertiesChanged( const QString &, QMap))); + if(dbusConnection.connect(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_ACTIVE_CONNECTION, + "PropertiesChanged", + nmDBusHelper,SLOT(slotPropertiesChanged( QMap))) ) { + allOk = true; + } + + return allOk; +} + +QDBusInterface *QNetworkManagerConnectionActive::connectionInterface() const +{ + return d->connectionInterface; +} + +QString QNetworkManagerConnectionActive::serviceName() const +{ + return d->connectionInterface->property("ServiceName").toString(); +} + +QDBusObjectPath QNetworkManagerConnectionActive::connection() const +{ + QVariant prop = d->connectionInterface->property("Connection"); + return prop.value(); +} + +QDBusObjectPath QNetworkManagerConnectionActive::specificObject() const +{ + QVariant prop = d->connectionInterface->property("SpecificObject"); + return prop.value(); +} + +QList QNetworkManagerConnectionActive::devices() const +{ + QVariant prop = d->connectionInterface->property("Devices"); + return prop.value >(); +} + +quint32 QNetworkManagerConnectionActive::state() const +{ + return d->connectionInterface->property("State").toUInt(); +} + +bool QNetworkManagerConnectionActive::defaultRoute() const +{ + return d->connectionInterface->property("Default").toBool(); +} + + +//// +class QNetworkManagerIp4ConfigPrivate +{ +public: + QDBusInterface *connectionInterface; + QString path; + bool valid; +}; + +QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent) +{ + d = new QNetworkManagerIp4ConfigPrivate(); + d->path = deviceObjectPath; + d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, + d->path, + NM_DBUS_INTERFACE_IP4_CONFIG, + dbusConnection, parent); + if (!d->connectionInterface->isValid()) { + d->valid = false; + qWarning() << "Could not find NetworkManagerIp4Config"; + return; + } + d->valid = true; +} + +QNetworkManagerIp4Config::~QNetworkManagerIp4Config() +{ + delete d->connectionInterface; + delete d; +} + +bool QNetworkManagerIp4Config::isValid() +{ + return d->valid; +} + +QStringList QNetworkManagerIp4Config::domains() const +{ + return d->connectionInterface->property("Domains").toStringList(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h new file mode 100644 index 0000000..8bed45b --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -0,0 +1,397 @@ +/**************************************************************************** +** +** 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 plugins 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 QNETWORKMANAGERSERVICE_H +#define QNETWORKMANAGERSERVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include "qnmdbushelper.h" + +QT_BEGIN_NAMESPACE + +typedef QMap< QString, QMap > QNmSettingsMap; +typedef QList ServerThing; + +Q_DECLARE_METATYPE(QNmSettingsMap) +Q_DECLARE_METATYPE(ServerThing) + +class QNetworkManagerInterfacePrivate; +class QNetworkManagerInterface : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerInterface(QObject *parent = 0); + ~QNetworkManagerInterface(); + + QList getDevices() const; + void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject); + void deactivateConnection(QDBusObjectPath connectionPath) const; + + QDBusObjectPath path() const; + QDBusInterface *connectionInterface() const; + + bool wirelessEnabled() const; + bool wirelessHardwareEnabled() const; + QList activeConnections() const; + quint32 state(); + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void deviceAdded(QDBusObjectPath); + void deviceRemoved(QDBusObjectPath); + void propertiesChanged( const QString &, QMap); + void stateChanged(const QString&, quint32); + void activationFinished(QDBusPendingCallWatcher*); + +private Q_SLOTS: +private: +// Q_DISABLE_COPY(QNetworkManagerInterface); ?? + QNetworkManagerInterfacePrivate *d; + QNmDBusHelper *nmDBusHelper; +}; //end QNetworkManagerInterface + +//////// +class QNetworkManagerInterfaceAccessPointPrivate; +class QNetworkManagerInterfaceAccessPoint : public QObject +{ + Q_OBJECT + +public: + + // NM_DEVICE_STATE + enum DeviceState { + Unknown = 0, + Unmanaged, + Unavailable, + Disconnected, + Prepare, + Config, + NeedAuthentication, + IpConfig, + Activated, + Failed + }; + + enum ApFlag { + ApNone = 0x0, + Privacy = 0x1 + }; + + Q_DECLARE_FLAGS(ApFlags, ApFlag); + + enum ApSecurityFlag { + ApSecurityNone = 0x0, + PairWep40 = 0x1, + PairWep104 = 0x2, + PairTkip = 0x4, + PairCcmp = 0x8, + GroupWep40 = 0x10, + GroupWep104 = 0x20, + GroupTkip = 0x40, + GroupCcmp = 0x80, + KeyPsk = 0x100, + Key8021x = 0x200 + }; + + Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag); + + QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0); + ~QNetworkManagerInterfaceAccessPoint(); + + QDBusInterface *connectionInterface() const; + + quint32 flags() const; + quint32 wpaFlags() const; + quint32 rsnFlags() const; + QString ssid() const; + quint32 frequency() const; + QString hwAddress() const; + quint32 mode() const; + quint32 maxBitrate() const; + quint32 strength() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void propertiesChanged(QMap ); + void propertiesChanged( const QString &, QMap); +private: + QNetworkManagerInterfaceAccessPointPrivate *d; + QNmDBusHelper *nmDBusHelper; + +}; //end QNetworkManagerInterfaceAccessPoint + +//////// +class QNetworkManagerInterfaceDevicePrivate; +class QNetworkManagerInterfaceDevice : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0); + ~QNetworkManagerInterfaceDevice(); + + QString udi() const; + QNetworkInterface interface() const; + QDBusInterface *connectionInterface() const; + quint32 ip4Address() const; + quint32 state() const; + quint32 deviceType() const; + + QDBusObjectPath ip4config() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void stateChanged(const QString &, quint32); + +private: + QNetworkManagerInterfaceDevicePrivate *d; + QNmDBusHelper *nmDBusHelper; +}; //end QNetworkManagerInterfaceDevice + +//////// +class QNetworkManagerInterfaceDeviceWiredPrivate; +class QNetworkManagerInterfaceDeviceWired : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent = 0); + ~QNetworkManagerInterfaceDeviceWired(); + + QDBusInterface *connectionInterface() const; + QString hwAddress() const; + quint32 speed() const; + bool carrier() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void propertiesChanged( const QString &, QMap); +private: + QNetworkManagerInterfaceDeviceWiredPrivate *d; + QNmDBusHelper *nmDBusHelper; +}; // end QNetworkManagerInterfaceDeviceWired + +//// +class QNetworkManagerInterfaceDeviceWirelessPrivate; +class QNetworkManagerInterfaceDeviceWireless : public QObject +{ + Q_OBJECT + +public: + + enum DeviceCapability { + None = 0x0, + Wep40 = 0x1, + Wep104 = 0x2, + Tkip = 0x4, + Ccmp = 0x8, + Wpa = 0x10, + Rsn = 0x20 + }; + + QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent = 0); + ~QNetworkManagerInterfaceDeviceWireless(); + + QDBusObjectPath path() const; + QList getAccessPoints(); + QDBusInterface *connectionInterface() const; + + QString hwAddress() const; + quint32 mode() const; + quint32 bitrate() const; + QDBusObjectPath activeAccessPoint() const; + quint32 wirelessCapabilities() const; + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void propertiesChanged( const QString &, QMap); + void accessPointAdded(const QString &,QDBusObjectPath); + void accessPointRemoved(const QString &,QDBusObjectPath); +private: + QNetworkManagerInterfaceDeviceWirelessPrivate *d; + QNmDBusHelper *nmDBusHelper; +}; // end QNetworkManagerInterfaceDeviceWireless + +//// +class QNetworkManagerSettingsPrivate; +class QNetworkManagerSettings : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0); + ~QNetworkManagerSettings(); + + QDBusInterface *connectionInterface() const; + QList listConnections(); + bool setConnections(); + bool isValid(); + +Q_SIGNALS: + void newConnection(QDBusObjectPath); +private: + QNetworkManagerSettingsPrivate *d; +}; //end QNetworkManagerSettings + +//// +class QNetworkManagerSettingsConnectionPrivate; +class QNetworkManagerSettingsConnection : public QObject +{ + Q_OBJECT + +public: + + QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent = 0); + ~QNetworkManagerSettingsConnection(); + + QDBusInterface *connectionInterface() const; + QNmSettingsMap getSettings(); + // void update(QNmSettingsMap map); + bool setConnections(); + NMDeviceType getType(); + bool isAutoConnect(); + quint64 getTimestamp(); + QString getId(); + QString getUuid(); + QString getSsid(); + QString getMacAddress(); + QStringList getSeenBssids(); + bool isValid(); + +Q_SIGNALS: + + void updated(QMap< QString, QMap > s); + void removed(const QString &); + +private: + QNmDBusHelper *nmDBusHelper; + QNetworkManagerSettingsConnectionPrivate *d; +}; //end QNetworkManagerSettingsConnection + +//// +class QNetworkManagerConnectionActivePrivate; +class QNetworkManagerConnectionActive : public QObject +{ + Q_OBJECT + +public: + + enum ActiveConnectionState { + Unknown = 0, + Activating = 1, + Activated = 2 + }; + + QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0); + ~ QNetworkManagerConnectionActive(); + + QDBusInterface *connectionInterface() const; + QString serviceName() const; + QDBusObjectPath connection() const; + QDBusObjectPath specificObject() const; + QList devices() const; + quint32 state() const; + bool defaultRoute() const; + bool setConnections(); + bool isValid(); + + +Q_SIGNALS: + void propertiesChanged(QList); + void propertiesChanged( const QString &, QMap); +private: + QNetworkManagerConnectionActivePrivate *d; + QNmDBusHelper *nmDBusHelper; +}; //QNetworkManagerConnectionActive + +//// +class QNetworkManagerIp4ConfigPrivate; +class QNetworkManagerIp4Config : public QObject +{ + Q_OBJECT + +public: + QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0); + ~QNetworkManagerIp4Config(); + + // QList nameservers(); + QStringList domains() const; + bool isValid(); + + private: + QNetworkManagerIp4ConfigPrivate *d; +}; +//// + +QT_END_NAMESPACE + +#endif //QNETWORKMANAGERSERVICE_H diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp new file mode 100644 index 0000000..1d16e55 --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** 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 plugins 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 class is for helping qdbus get stuff + +#include "qnmdbushelper.h" + +#include + +#include +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +void QNmDBusHelper::deviceStateChanged(quint32 state) + { + QDBusMessage msg = this->message(); + if(state == NM_DEVICE_STATE_ACTIVATED + || state == NM_DEVICE_STATE_DISCONNECTED + || state == NM_DEVICE_STATE_UNAVAILABLE + || state == NM_DEVICE_STATE_FAILED) { + emit pathForStateChanged(msg.path(), state); + } + } + +void QNmDBusHelper::slotAccessPointAdded(QDBusObjectPath path) +{ + if(path.path().length() > 2) { + QDBusMessage msg = this->message(); + emit pathForAccessPointAdded(msg.path(), path); + } +} + +void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path) +{ + if(path.path().length() > 2) { + QDBusMessage msg = this->message(); + emit pathForAccessPointRemoved(msg.path(), path); + } +} + +void QNmDBusHelper::slotPropertiesChanged(QMap map) +{ + QDBusMessage msg = this->message(); + QMapIterator i(map); + while (i.hasNext()) { + i.next(); + if( i.key() == "State") { //state only applies to device interfaces + quint32 state = i.value().toUInt(); + if( state == NM_DEVICE_STATE_ACTIVATED + || state == NM_DEVICE_STATE_DISCONNECTED + || state == NM_DEVICE_STATE_UNAVAILABLE + || state == NM_DEVICE_STATE_FAILED) { + emit pathForPropertiesChanged( msg.path(), map); + } + } else if( i.key() == "ActiveAccessPoint") { + // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value().path(); + // } else if( i.key() == "Strength") + // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt(); + // else + // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value(); + } + } +} + +void QNmDBusHelper::slotSettingsRemoved() +{ + QDBusMessage msg = this->message(); + emit pathForSettingsRemoved(msg.path()); +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h new file mode 100644 index 0000000..9794f98 --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** 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 plugins 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 QNMDBUSHELPERPRIVATE_H +#define QNMDBUSHELPERPRIVATE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) + +class QNmDBusHelper: public QObject, protected QDBusContext + { + Q_OBJECT + public: + + public slots: + void deviceStateChanged(quint32); + void slotAccessPointAdded( QDBusObjectPath ); + void slotAccessPointRemoved( QDBusObjectPath ); + void slotPropertiesChanged( QMap); + void slotSettingsRemoved(); + +Q_SIGNALS: + void pathForStateChanged(const QString &, quint32); + void pathForAccessPointAdded(const QString &, QDBusObjectPath ); + void pathForAccessPointRemoved(const QString &, QDBusObjectPath ); + void pathForPropertiesChanged(const QString &, QMap); + void pathForSettingsRemoved(const QString &); +}; +#endif + +QT_END_NAMESPACE + +#endif// QNMDBUSHELPERPRIVATE_H diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp new file mode 100644 index 0000000..4a814ec --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp @@ -0,0 +1,1128 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnmwifiengine.h" + +#include +#include + +#include + +#include +#include +#include "qnetworkmanagerservice.h" + +#include + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QNmWifiEngine, nmWifiEngine) +typedef QList > QNmSettingsAddressMap; + +Q_DECLARE_METATYPE(QNmSettingsAddressMap) + +QNmWifiEngine::QNmWifiEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + iface = new QNetworkManagerInterface(); + if(!iface->isValid()) { + return; + } + iface->setConnections(); + connect(iface,SIGNAL(deviceAdded(QDBusObjectPath)), + this,SLOT(addDevice(QDBusObjectPath))); + connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), + this,SLOT(removeDevice(QDBusObjectPath))); + + QList list = iface->getDevices(); + + foreach(QDBusObjectPath path, list) { + addDevice(path); + } + + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + foreach (QString service, connectionServices) { + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + settingsiface->setConnections(); + connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), + this,(SLOT(newConnection(QDBusObjectPath)))); + } + + updated = false; +} + +QNmWifiEngine::~QNmWifiEngine() +{ +} + +QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface) +{ + QString newname; + if (devIface->state() == NM_DEVICE_STATE_ACTIVATED) { + QString path = devIface->ip4config().path(); + QNetworkManagerIp4Config * ipIface; + ipIface = new QNetworkManagerIp4Config(path); + newname = ipIface->domains().join(" "); + } + //fallback to interface name + if(newname.isEmpty()) + newname = devIface->interface().name(); + return newname; +} + + +QList QNmWifiEngine::getConfigurations(bool *ok) +{ +// qWarning() << Q_FUNC_INFO << updated; + if (ok) + *ok = false; + + if(!updated) { + foundConfigurations.clear(); + if(knownSsids.isEmpty()) + getKnownSsids(); // list of ssids that have user configurations. + + scanForAccessPoints(); + getActiveConnectionsPaths(); + knownConnections(); + + accessPointConnections(); + +// findConnections(); + //add access points + updated = true; + } + return foundConfigurations; +} + +void QNmWifiEngine::findConnections() +{ + QList list = iface->getDevices(); + + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + + //// eth + switch (devIface->deviceType()) { +// qWarning() << devIface->connectionInterface()->path(); + + case DEVICE_TYPE_802_3_ETHERNET: + { + QString ident; + QNetworkManagerInterfaceDeviceWired *devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + + ident = devWiredIface->hwAddress(); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv->name = getNameForConfiguration(devIface); + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->internet = devWiredIface->carrier(); + + cpPriv->serviceInterface = devIface->interface(); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + switch (devIface->state()) { + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_UNMANAGED: + case NM_DEVICE_STATE_FAILED: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); + break; + case NM_DEVICE_STATE_UNAVAILABLE: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); + break; + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + case NM_DEVICE_STATE_DISCONNECTED: + { + cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered + | QNetworkConfiguration::Defined); + } + break; + case NM_DEVICE_STATE_ACTIVATED: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); + break; + default: + cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); + break; + }; + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + foundConfigurations.append(cpPriv); + configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + } + break; + case DEVICE_TYPE_802_11_WIRELESS: + { +// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; +// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); +// +// //// connections +// QStringList connectionServices; +// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; +// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; +// +// QString connPath; +// +// foreach (QString service, connectionServices) { +// QString ident; +// QNetworkManagerSettings *settingsiface; +// settingsiface = new QNetworkManagerSettings(service); +// QList list = settingsiface->listConnections(); +// +// foreach(QDBusObjectPath path, list) { //for each connection path +//qWarning() << path.path(); +// ident = path.path(); +// bool addIt = false; +// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); +// cpPriv->isValid = true; +// cpPriv->id = ident; +// cpPriv->internet = true; +// +// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; +// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered +// | QNetworkConfiguration::Defined); +// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; +// +// QNetworkManagerSettingsConnection *sysIface; +// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); +// cpPriv->name = sysIface->getId();//ii.value().toString(); +//qWarning() << cpPriv->name; +// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ +// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { +// cpPriv->serviceInterface = devIface->interface(); +// addIt = true; +// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ +// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { +// cpPriv->serviceInterface = devIface->interface(); +// addIt = true; +// // get the wifi interface state first.. do we need this? +// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); +// } +// +// //#if 0 +// foreach(QString conpath, activeConnectionPaths) { +// QNetworkManagerConnectionActive *aConn; +// aConn = new QNetworkManagerConnectionActive(conpath); +// // in case of accesspoint, specificObject will hold the accessPOintObjectPath +// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); +// if( aConn->connection().path() == ident) { +// +// QList devs = aConn->devices(); +// foreach(QDBusObjectPath device, devs) { +// QNetworkManagerInterfaceDevice *ifaceDevice; +// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); +// cpPriv->serviceInterface = ifaceDevice->interface(); +// cpPriv->state = getStateFlag(ifaceDevice->state()); +// //cpPriv->accessPoint = aConn->specificObject().path(); +// +// break; +// } +// } +// } +// //#endif +// // } //end while connection +// if(addIt) { +// foundConfigurations.append(cpPriv); +// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); +// } +// } +// } //end each connection service +// +// // ////////////// AccessPoints +//// QList apList = devWirelessIface->getAccessPoints(); +////// qWarning() << apList.count(); +//// foreach(QDBusObjectPath path, apList) { +//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); +//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); +//// if(cpPriv->isValid) { +//// foundConfigurations.append(cpPriv); +//// } +//// } + } // end DEVICE_TYPE_802_11_WIRELESS + break; + }; + } //end foreach device +} + +void QNmWifiEngine::knownConnections() +{ +// qWarning() << Q_FUNC_INFO; + //// connections + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + + QString connPath; + + foreach (QString service, connectionServices) { + QString ident; + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + QList list = settingsiface->listConnections(); + +// qWarning() <setConnections(); + connect(sysIface, SIGNAL(removed(QString)), + this,SLOT(settingsConnectionRemoved(QString))); + + cpPriv->name = sysIface->getId(); + cpPriv->isValid = true; + cpPriv->id = sysIface->getUuid(); +// cpPriv->id = ident; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; +//qWarning() << cpPriv->name; + cpPriv->state = getStateForId(cpPriv->id); + + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + + if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { + QString mac = sysIface->getMacAddress(); + if(!mac.length() > 2) { + qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; + QString devPath; + devPath = deviceConnectionPath(mac); + + // qWarning() << Q_FUNC_INFO << devPath; + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(devPath); + cpPriv->serviceInterface = devIface->interface(); + QNetworkManagerInterfaceDeviceWired *devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + cpPriv->internet = devWiredIface->carrier(); + + // use this mac addy + } else { + cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_3_ETHERNET, cpPriv->id); + } + + cpPriv->internet = true;//sysIface->isAutoConnect(); + + addIt = true; + } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { + QString mac = sysIface->getMacAddress();; + if(!mac.length() > 2) { + qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; + QString devPath; + devPath = deviceConnectionPath(mac); +// qWarning() << Q_FUNC_INFO << devPath; + + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(devPath); + cpPriv->serviceInterface = devIface->interface(); + // use this mac addy + } else { + cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); + } + // cpPriv->serviceInterface = devIface->interface(); + addIt = true; + // get the wifi interface state first.. do we need this? + // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); + } + if(addIt) { + foundConfigurations.append(cpPriv); + configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + } + } //end each connection service + } +} + +void QNmWifiEngine::accessPointConnections() +{ + //qWarning() << Q_FUNC_INFO; + QList list = iface->getDevices(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(path.path()); + if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + QList apList = availableAccessPoints.uniqueKeys(); + + QList::const_iterator i; + for (i = apList.constBegin(); i != apList.constEnd(); ++i) { + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); + if(cpPriv->isValid) { + foundConfigurations.append(cpPriv); + // qWarning() << "adding" << cpPriv->name << "to things"; + configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + } + } + } + } +} + +QString QNmWifiEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id); +} + +bool QNmWifiEngine::hasIdentifier(const QString &id) +{ + if (configurationInterface.contains(id)) + return true; + foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { + if (cpPriv->id == id) + return true; + } + return false; +} + +QString QNmWifiEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + QList list = iface->getDevices(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(path.path()); + if(interface == devIface->interface().name()) { + switch(devIface->deviceType()) { + case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: + return QLatin1String("Ethernet"); + break; + case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: + return QLatin1String("WLAN"); + break; + case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: + return QLatin1String("2G"); + break; + case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: + return QLatin1String("CDMA2000"); + break; + default: + break; + }; + } + } + return QString(); +} + +void QNmWifiEngine::connectToId(const QString &id) +{ +// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; + activatingConnectionPath = id; + QStringList connectionSettings = getConnectionPathForId(id); + if(connectionSettings.isEmpty()) { + emit connectionError(id, OperationNotSupported); + return; + } + + QDBusObjectPath connectionPath(connectionSettings.at(1)); + QString interface = getInterfaceFromId(id); + + interface = QNetworkInterface::interfaceFromName(interface).hardwareAddress().toLower(); + QString devPath; + devPath = deviceConnectionPath(interface); + QDBusObjectPath devicePath(devPath); + + iface = new QNetworkManagerInterface(); + iface->activateConnection( + connectionSettings.at(0), + connectionPath, + devicePath, + connectionPath); + + connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), + this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); +} + +void QNmWifiEngine::disconnectFromId(const QString &id) +{ + QString activeConnectionPath = getActiveConnectionPath(id); + //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; + + if (!activeConnectionPath.isEmpty()) { + QNetworkManagerConnectionActive *activeCon; + activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); + QNetworkManagerSettingsConnection *settingsCon; + settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); + + if(settingsCon->isAutoConnect()) { +// qWarning() << id << "is autoconnect"; + emit connectionError(id, OperationNotSupported); + //unsupported + } else { +// qWarning() <deactivateConnection(dbpath); + activatingConnectionPath = ""; + } + } +} + +void QNmWifiEngine::requestUpdate() +{ + updated = false; + knownSsids.clear(); + availableAccessPoints.clear(); + emitConfigurationsChanged(); +} + +QNmWifiEngine *QNmWifiEngine::instance() +{ + QDBusConnection dbusConnection = QDBusConnection::systemBus(); + if (dbusConnection.isConnected()) { + QDBusConnectionInterface *dbiface = dbusConnection.interface(); + QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); + if (reply.isValid() && reply.value()) + return nmWifiEngine(); + } + + return 0; +} + +void QNmWifiEngine::getKnownSsids() +{ + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; +//qWarning() << Q_FUNC_INFO; + foreach (QString service, connectionServices) { + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(service, path.path()); +// qWarning() << sysIface->getSsid(); + knownSsids << sysIface->getSsid(); + } + } +} + +void QNmWifiEngine::getActiveConnectionsPaths() +{ +// qWarning() << Q_FUNC_INFO; + QNetworkManagerInterface *dbIface; + activeConnectionPaths.clear(); + dbIface = new QNetworkManagerInterface; + QList connections = dbIface->activeConnections(); + + foreach(QDBusObjectPath conpath, connections) { + activeConnectionPaths << conpath.path(); +// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); + + QNetworkManagerConnectionActive *activeConn; + activeConn = new QNetworkManagerConnectionActive(conpath.path()); + +// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); + + } +} + +QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) +{ //foreach accessPoint + //qWarning() << Q_FUNC_INFO << iPath << path.path(); + + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(iPath); + QNetworkManagerInterfaceDeviceWireless *devWirelessIface; + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); + + QString activeAPPath = devWirelessIface->activeAccessPoint().path(); + + QNetworkManagerInterfaceAccessPoint *accessPointIface; + accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + + QString ident = accessPointIface->connectionInterface()->path(); + quint32 nmState = devIface->state(); + + QString ssid = accessPointIface->ssid(); + QString hwAddy = accessPointIface->hwAddress(); + QString sInterface = devIface->interface().name(); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + bool addIt = true; + //qWarning() << availableAccessPoints.count() << ssid; + +// if(availableAccessPoints.contains(ssid)) { +// addIt = false; +// +// } +// foreach (QNetworkConfigurationPrivate *cpPriv, foundConfigurations) { +// if (cpPriv->name == ssid) { //weed out duplicate ssid's ?? +// addIt = false; +// break; +// } +// } + + if(addIt) { + + cpPriv->name = ssid; + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->serviceInterface = devIface->interface(); + + //qWarning() <<__FUNCTION__ << ssid; + + cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); + + if(activeAPPath == accessPointIface->connectionInterface()->path()) { + cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Active); + } + if(accessPointIface->flags() == NM_802_11_AP_FLAGS_PRIVACY) + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + else + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + return cpPriv; + } else { + cpPriv->isValid = false; + } + return cpPriv; +} + + + QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) +{ + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; +//qWarning() << nmState << knownSsids; + // this is the state of the wifi device interface + if(isKnown) + state = ( QNetworkConfiguration::Defined); + + switch(nmState) { //device interface state, not AP state + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_UNMANAGED: + case NM_DEVICE_STATE_UNAVAILABLE: + state = (QNetworkConfiguration::Undefined); + break; + case NM_DEVICE_STATE_DISCONNECTED: + { + if(isKnown) + state = ( state | QNetworkConfiguration::Discovered); + } + break; + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + if(isKnown) + state = ( state | QNetworkConfiguration::Discovered); + break; + case NM_DEVICE_STATE_ACTIVATED: + { + if(isKnown) + state = ( state | QNetworkConfiguration::Discovered); + } + break; + }; + return state; +} + +QString QNmWifiEngine::getActiveConnectionPath(const QString &id) +{ + //qWarning() << Q_FUNC_INFO << id; + QStringList connectionSettings = getConnectionPathForId(id); + //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); + QNetworkManagerInterface * ifaceD; + ifaceD = new QNetworkManagerInterface(); + QList connections = ifaceD->activeConnections(); + foreach(QDBusObjectPath path, connections) { + QNetworkManagerConnectionActive *conDetailsD; + conDetailsD = new QNetworkManagerConnectionActive( path.path()); + if(conDetailsD->connection().path() == connectionSettings.at(1) + && conDetailsD->serviceName() == connectionSettings.at(0)) + return path.path(); + } + return QString(); +} + + QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) + { +// qWarning() << Q_FUNC_INFO << nmstate; + QNetworkConfiguration::StateFlags flag; + switch (nmstate) { + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_FAILED: + case NM_DEVICE_STATE_UNMANAGED: + flag = (QNetworkConfiguration::Undefined); + break; + case NM_DEVICE_STATE_PREPARE: + case NM_DEVICE_STATE_CONFIG: + case NM_DEVICE_STATE_NEED_AUTH: + case NM_DEVICE_STATE_IP_CONFIG: + case NM_DEVICE_STATE_UNAVAILABLE: + flag = (QNetworkConfiguration::Defined); + break; + case NM_DEVICE_STATE_DISCONNECTED: + flag = ( flag | QNetworkConfiguration::Discovered ); + break; + case NM_DEVICE_STATE_ACTIVATED: + { + flag = ( flag | QNetworkConfiguration::Discovered + | QNetworkConfiguration::Active ); + } + break; + default: + flag = ( QNetworkConfiguration::Defined); + break; + }; + return flag; + } + +void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) +{ +// qWarning() << Q_FUNC_INFO << path << nmState; + + if(nmState == NM_DEVICE_STATE_ACTIVATED + || nmState == NM_DEVICE_STATE_DISCONNECTED + || nmState == NM_DEVICE_STATE_UNAVAILABLE + || nmState == NM_DEVICE_STATE_FAILED) { + +/* InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, +*/ +// qWarning() << Q_FUNC_INFO << ident; + QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); + switch (nmState) { + case NM_DEVICE_STATE_UNKNOWN: + case NM_DEVICE_STATE_FAILED: + state = (QNetworkConfiguration::Undefined); + emit connectionError(activatingConnectionPath, ConnectError); + requestUpdate(); +// qWarning() << Q_FUNC_INFO; + break; + case NM_DEVICE_STATE_UNAVAILABLE: + state = (QNetworkConfiguration::Defined); +// emit connectionError(activatingConnectionPath, ConnectError); + requestUpdate(); + break; + case NM_DEVICE_STATE_DISCONNECTED: + state = ( state | QNetworkConfiguration::Discovered ); + requestUpdate(); + break; + case NM_DEVICE_STATE_ACTIVATED: + { + state = ( state | QNetworkConfiguration::Discovered + | QNetworkConfiguration::Active ); + requestUpdate(); + } + break; + default: + state = ( QNetworkConfiguration::Defined); + break; + }; + } +} + +void QNmWifiEngine::addDevice(QDBusObjectPath path) +{ + //qWarning() << Q_FUNC_INFO << path.path(); + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface->setConnections(); + connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), + this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); + + if(!devicePaths.contains(path.path())) + devicePaths << path.path(); + + switch(devIface->deviceType()) { + case DEVICE_TYPE_802_3_ETHERNET: + { + QNetworkManagerInterfaceDeviceWired * devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + devWiredIface->setConnections(); + connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), + this,SLOT(cmpPropertiesChanged( const QString &, QMap))); + requestUpdate(); + } + break; + case DEVICE_TYPE_802_11_WIRELESS: + { + QNetworkManagerInterfaceDeviceWireless *devWirelessIface; + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + devWirelessIface->setConnections(); + + connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), + this,SLOT(cmpPropertiesChanged( const QString &, QMap))); + + connect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), + this,SLOT(accessPointAdded(const QString &,QDBusObjectPath))); + + connect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), + this,SLOT(accessPointRemoved(const QString &,QDBusObjectPath))); + requestUpdate(); + + } + break; + default: + break; + }; +} + +void QNmWifiEngine::removeDevice(QDBusObjectPath /*path*/) +{ +// qWarning() << Q_FUNC_INFO << path.path(); +// disconnect(devIface,SIGNAL(stateChanged(const QString &, quint32)), +// this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); +// +// if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { +// // devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); +// // devWirelessIface->setConnections(); +// +// disconnect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), +// this,SIGNAL(cmpPropertiesChanged( const QString &, QMap))); +// +// disconnect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), +// this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); +// +// disconnect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), +// this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); +// +// } +} +void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap map) +{ + QMapIterator i(map); + while (i.hasNext()) { + i.next(); +// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); + if( i.key() == "State") { //only applies to device interfaces + updateDeviceInterfaceState(path, i.value().toUInt()); + } + if( i.key() == "ActiveAccessPoint") { + } + if( i.key() == "Carrier") { //someone got plugged in + // requestUpdate(); + } + } +} + +void QNmWifiEngine::accessPointRemoved( const QString &aPath, QDBusObjectPath /*oPath*/) +{ + //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); + + if(aPath.contains("devices")) { + requestUpdate(); + } +} + +void QNmWifiEngine::accessPointAdded( const QString &aPath, QDBusObjectPath oPath) +{ + //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); + + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + cpPriv = addAccessPoint( aPath, oPath); + requestUpdate(); +} + +QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id) +{ + //qWarning() << Q_FUNC_INFO << id; + bool isAvailable = false; + QStringList conPath = getConnectionPathForId(id); + QString aconpath = getActiveConnectionPath(id); + + //qWarning() << Q_FUNC_INFO << id << aconpath; + + if(!aconpath.isEmpty()) { + //active connection + QNetworkManagerConnectionActive *aConn; + aConn = new QNetworkManagerConnectionActive(aconpath); + + QList devs = aConn->devices(); + + foreach(QDBusObjectPath dev, devs) { + //qWarning() << "foreach" << dev.path(); + QNetworkManagerInterfaceDevice *ifaceDevice; + ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); + + if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { + + if(isAddressOfConnection(id, ifaceDevice->ip4Address())) { + // this is it! + return getStateFlag(ifaceDevice->state()); + } else { + continue; + } + + if(ifaceDevice->state() == NM_DEVICE_STATE_UNAVAILABLE || + ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { + isAvailable = true; + + QNetworkManagerInterfaceDeviceWired *devWiredIface; + devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); + if(!devWiredIface->carrier()) + return QNetworkConfiguration::Defined; + } //end eth + } else if(ifaceDevice->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + qWarning() << "FIXME!!!!!!!!!!!!!!!!!"; + } + + return getStateFlag(ifaceDevice->state()); + } + } else { + // not active + //qWarning() << Q_FUNC_INFO << "Not active"; + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); + if(sysIface->isValid()) { + if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { + QString ssid = sysIface->getSsid(); + bool ok = false; + + if(knownSsids.contains(ssid, Qt::CaseSensitive)) { + foreach(QString onessid, knownSsids) { + // qWarning() << ssid << onessid; + if(onessid == ssid && availableAccessPoints.contains(ssid)) { + // qWarning() < devices = aConn->devices(); + foreach(QDBusObjectPath device, devices) { + QNetworkManagerInterfaceDevice *ifaceDevice; + ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); + if(ifaceDevice->ip4Address() == ipaddress) { + return true; + } + } + return false; +} + +QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) +{ + // check active connections first. + QStringList conIdPath = getConnectionPathForId(id); +// qWarning() << Q_FUNC_INFO << id << conIdPath; + + QNetworkInterface interface; + foreach(QString conpath, activeConnectionPaths) { + QNetworkManagerConnectionActive *aConn; + aConn = new QNetworkManagerConnectionActive(conpath); + + if(aConn->connection().path() == conIdPath.at(1) + && aConn->serviceName() == conIdPath.at(0)) { + + QList devs = aConn->devices(); + QNetworkManagerInterfaceDevice *ifaceDevice; + ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one + interface = ifaceDevice->interface(); + return interface; + } + } + +//try guessing + QList list = iface->getDevices(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + if(devIface->deviceType() == type /*&& devIface->managed()*/) { + interface = devIface->interface(); + if(devIface->state() == NM_STATE_DISCONNECTED) { + return interface; + } + } + } + return interface; +} + +quint64 QNmWifiEngine::receivedDataForId(const QString &id) const +{ + if(configurationInterface.count() > 1) + return 0; + quint64 result = 0; + + QString devFile; + devFile = configurationInterface.value(id); + QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); + if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&rx); + in >> result; + rx.close(); + } + return result; +} + +quint64 QNmWifiEngine::sentDataForId(const QString &id) const +{ + if(configurationInterface.count() > 1) + return 0; + quint64 result = 0; + QString devFile; + devFile = configurationInterface.value(id); + + QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); + if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + return result; +} + +void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) +{ + //qWarning() << Q_FUNC_INFO; + requestUpdate(); +} + +void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) +{ + //qWarning() << Q_FUNC_INFO; + requestUpdate(); +} + +void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) +{ + QDBusPendingReply reply = *openCall; + if (reply.isError()) { + qWarning() <<"Error" << reply.error().name() << reply.error().message() + < list = iface->getDevices(); + + foreach(QDBusObjectPath path, list) { + QNetworkManagerInterfaceDevice *devIface; + devIface = new QNetworkManagerInterfaceDevice(path.path()); + + if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + +// qWarning() << devIface->connectionInterface()->path(); + + QNetworkManagerInterfaceDeviceWireless *devWirelessIface; + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + ////////////// AccessPoints + QList apList = devWirelessIface->getAccessPoints(); + + foreach(QDBusObjectPath path, apList) { + QNetworkManagerInterfaceAccessPoint *accessPointIface; + accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + QString ssid = accessPointIface->ssid(); + availableAccessPoints.insert(ssid, path); + } + } + } +} + +QString QNmWifiEngine::deviceConnectionPath(const QString &mac) +{ +// qWarning() << __FUNCTION__ << mac; + QString newMac = mac; + newMac = newMac.replace(":","_").toLower(); + //device object path might not contain just mac address + //might contain extra numbers on the end. thanks HAL + foreach(QString device, devicePaths) { + if(device.contains(newMac)) { + newMac = device; + break; + } + } + return newMac; +} + +QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) +{ + QStringList connectionServices; + connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; + connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; +//qWarning() << Q_FUNC_INFO; + foreach (QString service, connectionServices) { + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(service); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(service, path.path()); +// qWarning() << uuid << sysIface->getUuid(); + if(sysIface->getUuid() == uuid) { +// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); + return QStringList() << service << sysIface->connectionInterface()->path(); + } + } + } + return QStringList(); +} + +QT_END_NAMESPACE + diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.h b/src/plugins/bearer/networkmanager/qnmwifiengine.h new file mode 100644 index 0000000..4d514e7 --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnmwifiengine.h @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** 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 plugins 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 QNMWIFIENGINE_P_H +#define QNMWIFIENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +//#include + +#include +#include +#include + +#include "qnetworkmanagerservice.h" + +#include +#include +#include +#include + + + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QNmWifiEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QNmWifiEngine(QObject *parent = 0); + ~QNmWifiEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QNmWifiEngine *instance(); + + QStringList knownSsids; + inline void emitConfigurationsChanged() { emit configurationsChanged(); } + QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); + + QStringList getConnectionPathForId(const QString &uuid); + //QString getConnectionPathForId(const QString &name = QString()); + quint64 sentDataForId(const QString &id) const; + quint64 receivedDataForId(const QString &id) const; + +private: + bool updated; + QString activatingConnectionPath; + QStringList activeConnectionPaths; + + + QMap availableAccessPoints; + void scanForAccessPoints(); + + QStringList devicePaths; + + void getActiveConnectionsPaths(); + void getKnownSsids(); + void accessPointConnections(); + void knownConnections(); + void findConnections(); + QString deviceConnectionPath(const QString &mac); + + QList foundConfigurations; + // QHash > allConfigurations; + + QNetworkManagerInterface *iface; + + QNetworkConfiguration::StateFlags getAPState(qint32 vState, bool isKnown); + QNetworkConfiguration::StateFlags getStateFlag(quint32 nmstate); + + QString getActiveConnectionPath(const QString &identifier); + QString getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface); + + QNetworkConfiguration::StateFlags getStateForId(const QString &id); + + QNetworkInterface getBestInterface(quint32 type, const QString &conPath); + + QMap configurationInterface; + + bool isAddressOfConnection(const QString &conPath, quint32 ipaddress); + +private slots: + void updateDeviceInterfaceState(const QString &, quint32); + void addDevice(QDBusObjectPath path); + void removeDevice(QDBusObjectPath path); + +Q_SIGNALS: + void configurationChanged(const QNetworkConfiguration& config); + void updateAccessPointState(const QString &, quint32); +// void slotActivationFinished(QDBusPendingCallWatcher*); + +private slots: + void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); + void accessPointRemoved( const QString &aPath, QDBusObjectPath oPath); + void cmpPropertiesChanged(const QString &, QMap map); + void newConnection(QDBusObjectPath); + void settingsConnectionRemoved(const QString &); + void slotActivationFinished(QDBusPendingCallWatcher*); +}; + +QT_END_NAMESPACE + +#endif + + -- cgit v0.12 From c2254fdcba61c0aceb89f2f5e6dc926a9493c1a2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 12:36:31 +1000 Subject: Fix QNetworkSession unit tests. Fix out of process test by trimming input read from lackey. Don't fail in cleanupTestCase() if sessionOpenCloseStop() is not run due to command line. --- .../qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index fc0db05..c7ce963 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -170,7 +170,7 @@ void tst_QNetworkSession::initTestCase() dbus_send.waitForFinished(); #endif - inProcessSessionManagementCount = 0; + inProcessSessionManagementCount = -1; QSignalSpy spy(&manager, SIGNAL(updateCompleted())); manager.updateConfigurations(); @@ -415,6 +415,8 @@ void tst_QNetworkSession::sessionOpenCloseStop_data() QTest::newRow((name + QLatin1String(" stop")).toLocal8Bit().constData()) << config << true; } + + inProcessSessionManagementCount = 0; } void tst_QNetworkSession::sessionOpenCloseStop() @@ -803,7 +805,7 @@ void tst_QNetworkSession::outOfProcessSession() output = oopSocket->readLine().trimmed(); if (output.startsWith("Started session ")) { - QString identifier = QString::fromLocal8Bit(output.mid(16).constData()); + QString identifier = QString::fromLocal8Bit(output.mid(20).constData()); QNetworkConfiguration changed; -- cgit v0.12 From 2374a4209f9edcc865b18f63e07a50cdaddc70b7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 12:44:11 +1000 Subject: Convert NLA engine nito a plugin. --- src/network/bearer/bearer.pri | 17 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 17 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworksession_p.cpp | 11 +- src/network/bearer/qnetworksessionengine_win_p.h | 145 ------ src/network/bearer/qnlaengine_win.cpp | 592 ----------------------- src/network/bearer/qnlaengine_win_p.h | 104 ---- src/plugins/bearer/bearer.pro | 1 + src/plugins/bearer/generic/generic.pro | 3 +- src/plugins/bearer/generic/qgenericengine.cpp | 2 +- src/plugins/bearer/nla/main.cpp | 88 ++++ src/plugins/bearer/nla/nla.pro | 20 + src/plugins/bearer/nla/qnlaengine.cpp | 591 ++++++++++++++++++++++ src/plugins/bearer/nla/qnlaengine.h | 105 ++++ src/plugins/bearer/platformdefs_win.h | 134 +++++ 15 files changed, 958 insertions(+), 874 deletions(-) delete mode 100644 src/network/bearer/qnetworksessionengine_win_p.h delete mode 100644 src/network/bearer/qnlaengine_win.cpp delete mode 100644 src/network/bearer/qnlaengine_win_p.h create mode 100644 src/plugins/bearer/nla/main.cpp create mode 100644 src/plugins/bearer/nla/nla.pro create mode 100644 src/plugins/bearer/nla/qnlaengine.cpp create mode 100644 src/plugins/bearer/nla/qnlaengine.h create mode 100644 src/plugins/bearer/platformdefs_win.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index bed2597..2c2d255 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -82,21 +82,10 @@ symbian { contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM - win32 { - HEADERS += bearer/qnlaengine_win_p.h \ - bearer/qnetworksessionengine_win_p.h + win32:!wince* { + HEADERS += bearer/qnativewifiengine_win_p.h - SOURCES += bearer/qnlaengine_win.cpp - - !wince* { - HEADERS += bearer/qnativewifiengine_win_p.h - - SOURCES += bearer/qnativewifiengine_win.cpp - - LIBS += -lWs2_32 - } else { - LIBS += -lWs2 - } + SOURCES += bearer/qnativewifiengine_win.cpp } macx { diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 7b68394..c61bcd3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -41,9 +41,6 @@ #include "qnetworkconfigmanager_p.h" -#ifdef Q_OS_WIN -#include "qnlaengine_win_p.h" -#endif #ifdef Q_OS_WIN32 #include "qnativewifiengine_win_p.h" #endif @@ -269,11 +266,17 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() #endif #ifdef Q_OS_WIN - nla = QNlaEngine::instance(); - if (nla) { - connect(nla, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + if (keys.contains(QLatin1String("nla"))) { + QBearerEnginePlugin *nlaPlugin = + qobject_cast(l->instance(QLatin1String("nla"))); + if (nlaPlugin) { + nla = nlaPlugin->create(QLatin1String("nla")); + if (nla) { + connect(nla, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } } + } #endif #ifdef Q_OS_WIN32 diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 6a61891..7b824f0 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -137,7 +137,7 @@ private: #ifdef BEARER_ENGINE QNetworkSessionEngine *generic; #ifdef Q_OS_WIN - QNlaEngine *nla; + QNetworkSessionEngine *nla; #ifndef Q_OS_WINCE QNativeWifiEngine *nativeWifi; #endif diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index cb170e8..1ce94e2 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -44,9 +44,6 @@ #include "qnetworksessionengine_p.h" #include "qnetworkconfigmanager_p.h" -#ifdef Q_OS_WIN -#include "qnlaengine_win_p.h" -#endif #ifdef Q_OS_WIN32 #include "qnativewifiengine_win_p.h" #endif @@ -59,18 +56,14 @@ #include +#undef interface + QT_BEGIN_NAMESPACE static QNetworkSessionEngine *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); -#ifdef Q_OS_WIN - QNlaEngine *nla = QNlaEngine::instance(); - if (nla && nla->hasIdentifier(id)) - return nla; -#endif - #ifdef Q_OS_WIN32 QNativeWifiEngine *nativeWifi = QNativeWifiEngine::instance(); if (nativeWifi && nativeWifi->hasIdentifier(id)) diff --git a/src/network/bearer/qnetworksessionengine_win_p.h b/src/network/bearer/qnetworksessionengine_win_p.h deleted file mode 100644 index e68a35b..0000000 --- a/src/network/bearer/qnetworksessionengine_win_p.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONENGINE_WIN_P_H -#define QNETWORKSESSIONENGINE_WIN_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#undef interface -#include - -#ifndef NS_NLA - -#define NS_NLA 15 - -enum NLA_BLOB_DATA_TYPE { - NLA_RAW_DATA = 0, - NLA_INTERFACE = 1, - NLA_802_1X_LOCATION = 2, - NLA_CONNECTIVITY = 3, - NLA_ICS = 4 -}; - -enum NLA_CONNECTIVITY_TYPE { - NLA_NETWORK_AD_HOC = 0, - NLA_NETWORK_MANAGED = 1, - NLA_NETWORK_UNMANAGED = 2, - NLA_NETWORK_UNKNOWN = 3 -}; - -enum NLA_INTERNET { - NLA_INTERNET_UNKNOWN = 0, - NLA_INTERNET_NO = 1, - NLA_INTERNET_YES = 2 -}; - -struct NLA_BLOB { - struct { - NLA_BLOB_DATA_TYPE type; - DWORD dwSize; - DWORD nextOffset; - } header; - - union { - // NLA_RAW_DATA - CHAR rawData[1]; - - // NLA_INTERFACE - struct { - DWORD dwType; - DWORD dwSpeed; - CHAR adapterName[1]; - } interfaceData; - - // NLA_802_1X_LOCATION - struct { - CHAR information[1]; - } locationData; - - // NLA_CONNECTIVITY - struct { - NLA_CONNECTIVITY_TYPE type; - NLA_INTERNET internet; - } connectivity; - - // NLA_ICS - struct { - struct { - DWORD speed; - DWORD type; - DWORD state; - WCHAR machineName[256]; - WCHAR sharedAdapterName[256]; - } remote; - } ICS; - } data; -}; -#endif - -enum NDIS_MEDIUM { - NdisMedium802_3 = 0, -}; - -enum NDIS_PHYSICAL_MEDIUM { - NdisPhysicalMediumWirelessLan = 1, - NdisPhysicalMediumBluetooth = 10, - NdisPhysicalMediumWiMax = 12, -}; - -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 - -#define IOCTL_NDIS_QUERY_GLOBAL_STATS \ - CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) - -#endif // QNETWORKSESSIONENGINE_WIN_P_H diff --git a/src/network/bearer/qnlaengine_win.cpp b/src/network/bearer/qnlaengine_win.cpp deleted file mode 100644 index 579b0e1..0000000 --- a/src/network/bearer/qnlaengine_win.cpp +++ /dev/null @@ -1,592 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnlaengine_win_p.h" -#include "qnetworkconfiguration_p.h" - -#include -#include -#include -#include - -#include - -#include "qnetworksessionengine_win_p.h" - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QNlaEngine, nlaEngine) - -QWindowsSockInit::QWindowsSockInit() -: version(0) -{ - //### should we try for 2.2 on all platforms ?? - WSAData wsadata; - - // IPv6 requires Winsock v2.0 or better. - if (WSAStartup(MAKEWORD(2,0), &wsadata) != 0) { - qWarning("QBearerManagementAPI: WinSock v2.0 initialization failed."); - } else { - version = 0x20; - } -} - -QWindowsSockInit::~QWindowsSockInit() -{ - WSACleanup(); -} - -#ifdef BEARER_MANAGEMENT_DEBUG -static void printBlob(NLA_BLOB *blob) -{ - qDebug() << "==== BEGIN NLA_BLOB ===="; - - qDebug() << "type:" << blob->header.type; - qDebug() << "size:" << blob->header.dwSize; - qDebug() << "next offset:" << blob->header.nextOffset; - - switch (blob->header.type) { - case NLA_RAW_DATA: - qDebug() << "Raw Data"; - qDebug() << '\t' << blob->data.rawData; - break; - case NLA_INTERFACE: - qDebug() << "Interface"; - qDebug() << "\ttype:" << blob->data.interfaceData.dwType; - qDebug() << "\tspeed:" << blob->data.interfaceData.dwSpeed; - qDebug() << "\tadapter:" << blob->data.interfaceData.adapterName; - break; - case NLA_802_1X_LOCATION: - qDebug() << "802.1x Location"; - qDebug() << '\t' << blob->data.locationData.information; - break; - case NLA_CONNECTIVITY: - qDebug() << "Connectivity"; - qDebug() << "\ttype:" << blob->data.connectivity.type; - qDebug() << "\tinternet:" << blob->data.connectivity.internet; - break; - case NLA_ICS: - qDebug() << "ICS"; - qDebug() << "\tspeed:" << blob->data.ICS.remote.speed; - qDebug() << "\ttype:" << blob->data.ICS.remote.type; - qDebug() << "\tstate:" << blob->data.ICS.remote.state; - qDebug() << "\tmachine name:" << blob->data.ICS.remote.machineName; - qDebug() << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; - break; - default: - qDebug() << "UNKNOWN BLOB TYPE"; - } - - qDebug() << "===== END NLA_BLOB ====="; -} -#endif - -static QString qGetInterfaceType(const QString &interface) -{ -#ifdef Q_OS_WINCE - Q_UNUSED(interface) -#else - unsigned long oid; - DWORD bytesWritten; - - NDIS_MEDIUM medium; - NDIS_PHYSICAL_MEDIUM physicalMedium; - - HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, - FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); - if (handle == INVALID_HANDLE_VALUE) - return QString(); - - oid = OID_GEN_MEDIA_SUPPORTED; - bytesWritten = 0; - bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), - &medium, sizeof(medium), &bytesWritten, 0); - if (!result) { - CloseHandle(handle); - return QString(); - } - - oid = OID_GEN_PHYSICAL_MEDIUM; - bytesWritten = 0; - result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), - &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); - if (!result) { - CloseHandle(handle); - - if (medium == NdisMedium802_3) - return QLatin1String("Ethernet"); - else - return QString(); - } - - CloseHandle(handle); - - if (medium == NdisMedium802_3) { - switch (physicalMedium) { - case NdisPhysicalMediumWirelessLan: - return QLatin1String("WLAN"); - case NdisPhysicalMediumBluetooth: - return QLatin1String("Bluetooth"); - case NdisPhysicalMediumWiMax: - return QLatin1String("WiMAX"); - default: -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Physical Medium" << physicalMedium; -#endif - return QLatin1String("Ethernet"); - } - } - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << medium << physicalMedium; -#endif - -#endif - - return QString(); -} - -class QNlaThread : public QThread -{ - Q_OBJECT - -public: - QNlaThread(QNlaEngine *parent = 0); - ~QNlaThread(); - - QList getConfigurations(); - - void forceUpdate(); - -protected: - virtual void run(); - -private: - void updateConfigurations(QList &configs); - DWORD parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const; - QNetworkConfigurationPrivate *parseQuerySet(const WSAQUERYSET *querySet) const; - void fetchConfigurations(); - -signals: - void networksChanged(); - -private: - QMutex mutex; - HANDLE handle; - bool done; - QList fetchedConfigurations; -}; - -QNlaThread::QNlaThread(QNlaEngine *parent) -: QThread(parent), handle(0), done(false) -{ -} - -QNlaThread::~QNlaThread() -{ - mutex.lock(); - - done = true; - - if (handle) { - /* cancel completion event */ - if (WSALookupServiceEnd(handle) == SOCKET_ERROR) - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); - } - mutex.unlock(); - - wait(); -} - -QList QNlaThread::getConfigurations() -{ - QMutexLocker locker(&mutex); - - QList foundConfigurations; - - for (int i = 0; i < fetchedConfigurations.count(); ++i) { - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - - foundConfigurations.append(config); - } - - return foundConfigurations; -} - -void QNlaThread::forceUpdate() -{ - mutex.lock(); - - if (handle) { - /* cancel completion event */ - if (WSALookupServiceEnd(handle) == SOCKET_ERROR) - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); - handle = 0; - } - mutex.unlock(); -} - -void QNlaThread::run() -{ - WSAEVENT changeEvent = WSACreateEvent(); - if (changeEvent == WSA_INVALID_EVENT) { - qWarning("WSACreateEvent error %d", WSAGetLastError()); - return; - } - - while (true) { - fetchConfigurations(); - - WSAQUERYSET qsRestrictions; - - memset(&qsRestrictions, 0, sizeof(qsRestrictions)); - qsRestrictions.dwSize = sizeof(qsRestrictions); - qsRestrictions.dwNameSpace = NS_NLA; - - mutex.lock(); - if (done) { - mutex.unlock(); - break; - } - int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL, &handle); - mutex.unlock(); - - if (result == SOCKET_ERROR) { - qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); - break; - } - - WSACOMPLETION completion; - WSAOVERLAPPED overlapped; - - memset(&overlapped, 0, sizeof(overlapped)); - overlapped.hEvent = changeEvent; - - memset(&completion, 0, sizeof(completion)); - completion.Type = NSP_NOTIFY_EVENT; - completion.Parameters.Event.lpOverlapped = &overlapped; - - DWORD bytesReturned = 0; - result = WSANSPIoctl(handle, SIO_NSP_NOTIFY_CHANGE, 0, 0, 0, 0, - &bytesReturned, &completion); - if (result == SOCKET_ERROR) { - int error = WSAGetLastError(); - if (error != WSA_IO_PENDING) { - qWarning("WSANSPIoctl error %d", error); - break; - } - } - -#ifndef Q_OS_WINCE - // Not interested in unrelated IO completion events - // although we also don't want to block them - while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION) {} -#else - WaitForSingleObject(changeEvent, WSA_INFINITE); -#endif - - mutex.lock(); - if (handle) { - result = WSALookupServiceEnd(handle); - if (result == SOCKET_ERROR) { - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); - mutex.unlock(); - break; - } - handle = 0; - } - mutex.unlock(); - } - - WSACloseEvent(changeEvent); -} - -void QNlaThread::updateConfigurations(QList &configs) -{ - mutex.lock(); - - while (!fetchedConfigurations.isEmpty()) - delete fetchedConfigurations.takeFirst(); - - fetchedConfigurations = configs; - - mutex.unlock(); - - emit networksChanged(); -} - -DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const -{ -#ifdef BEARER_MANAGEMENT_DEBUG - printBlob(blob); -#endif - - switch (blob->header.type) { - case NLA_RAW_DATA: -#ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__); -#endif - break; - case NLA_INTERFACE: - cpPriv->state = QNetworkConfiguration::Active; - if (QNlaEngine *engine = qobject_cast(parent())) { - engine->configurationInterface[cpPriv->id.toUInt()] = - QString(blob->data.interfaceData.adapterName); - } - break; - case NLA_802_1X_LOCATION: -#ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__); -#endif - break; - case NLA_CONNECTIVITY: - if (blob->data.connectivity.internet == NLA_INTERNET_YES) - cpPriv->internet = true; - else - cpPriv->internet = false; -#ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__); -#endif - break; - case NLA_ICS: -#ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type NLA_ICS", __FUNCTION__); -#endif - break; - default: -#ifdef BEARER_MANAGEMENT_DEBUG - qWarning("%s: unhandled header type %d", __FUNCTION__, blob->header.type); -#endif - ; - } - - return blob->header.nextOffset; -} - -QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *querySet) const -{ - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - - cpPriv->name = QString::fromWCharArray(querySet->lpszServiceInstanceName); - cpPriv->isValid = true; - cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name)); - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "size:" << querySet->dwSize; - qDebug() << "service instance name:" << QString::fromUtf16(querySet->lpszServiceInstanceName); - qDebug() << "service class id:" << querySet->lpServiceClassId; - qDebug() << "version:" << querySet->lpVersion; - qDebug() << "comment:" << QString::fromUtf16(querySet->lpszComment); - qDebug() << "namespace:" << querySet->dwNameSpace; - qDebug() << "namespace provider id:" << querySet->lpNSProviderId; - qDebug() << "context:" << QString::fromUtf16(querySet->lpszContext); - qDebug() << "number of protocols:" << querySet->dwNumberOfProtocols; - qDebug() << "protocols:" << querySet->lpafpProtocols; - qDebug() << "query string:" << QString::fromUtf16(querySet->lpszQueryString); - qDebug() << "number of cs addresses:" << querySet->dwNumberOfCsAddrs; - qDebug() << "cs addresses:" << querySet->lpcsaBuffer; - qDebug() << "output flags:" << querySet->dwOutputFlags; -#endif - - if (querySet->lpBlob) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "blob size:" << querySet->lpBlob->cbSize; - qDebug() << "blob data:" << querySet->lpBlob->pBlobData; -#endif - - DWORD offset = 0; - do { - NLA_BLOB *blob = reinterpret_cast(querySet->lpBlob->pBlobData + offset); - DWORD nextOffset = parseBlob(blob, cpPriv); - if (nextOffset == offset) - break; - else - offset = nextOffset; - } while (offset != 0 && offset < querySet->lpBlob->cbSize); - } - - return cpPriv; -} - -void QNlaThread::fetchConfigurations() -{ - QList foundConfigurations; - - WSAQUERYSET qsRestrictions; - HANDLE hLookup = 0; - - memset(&qsRestrictions, 0, sizeof(qsRestrictions)); - qsRestrictions.dwSize = sizeof(qsRestrictions); - qsRestrictions.dwNameSpace = NS_NLA; - - int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL | LUP_DEEP, &hLookup); - if (result == SOCKET_ERROR) { - qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); - mutex.lock(); - fetchedConfigurations.clear(); - mutex.unlock(); - } - - char buffer[0x10000]; - while (result == 0) { - DWORD bufferLength = sizeof(buffer); - result = WSALookupServiceNext(hLookup, LUP_RETURN_ALL, - &bufferLength, reinterpret_cast(buffer)); - - if (result == SOCKET_ERROR) { - int error = WSAGetLastError(); - - if (error == WSA_E_NO_MORE) - break; - - if (error == WSAEFAULT) { - qDebug() << "buffer not big enough" << bufferLength; - break; - } - - qWarning("WSALookupServiceNext error %d", WSAGetLastError()); - break; - } - - QNetworkConfigurationPrivate *cpPriv = - parseQuerySet(reinterpret_cast(buffer)); - - foundConfigurations.append(cpPriv); - } - - if (hLookup) { - result = WSALookupServiceEnd(hLookup); - if (result == SOCKET_ERROR) { - qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); - } - } - - updateConfigurations(foundConfigurations); -} - -QNlaEngine::QNlaEngine(QObject *parent) -: QNetworkSessionEngine(parent), nlaThread(0) -{ - nlaThread = new QNlaThread(this); - connect(nlaThread, SIGNAL(networksChanged()), - this, SIGNAL(configurationsChanged())); - nlaThread->start(); - - qApp->processEvents(QEventLoop::ExcludeUserInputEvents); -} - -QNlaEngine::~QNlaEngine() -{ - delete nlaThread; -} - -QList QNlaEngine::getConfigurations(bool *ok) -{ - if (ok) - *ok = true; - - return nlaThread->getConfigurations(); -} - -QString QNlaEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id.toUInt()); -} - -bool QNlaEngine::hasIdentifier(const QString &id) -{ - if (configurationInterface.contains(id.toUInt())) - return true; - - foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { - if (cpPriv->id == id) - return true; - } - - return false; -} - -QString QNlaEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - -void QNlaEngine::connectToId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} - -void QNlaEngine::disconnectFromId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} - -void QNlaEngine::requestUpdate() -{ - nlaThread->forceUpdate(); -} - -QNlaEngine *QNlaEngine::instance() -{ - return nlaEngine(); -} - -#include "qnlaengine_win.moc" -#include "moc_qnlaengine_win_p.cpp" -QT_END_NAMESPACE - - - diff --git a/src/network/bearer/qnlaengine_win_p.h b/src/network/bearer/qnlaengine_win_p.h deleted file mode 100644 index 1e7d051..0000000 --- a/src/network/bearer/qnlaengine_win_p.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNLAENGINE_P_H -#define QNLAENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworksessionengine_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; -class QNlaThread; - -class QWindowsSockInit -{ -public: - QWindowsSockInit(); - ~QWindowsSockInit(); - int version; -}; - -class QNlaEngine : public QNetworkSessionEngine -{ - Q_OBJECT - - friend class QNlaThread; - -public: - QNlaEngine(QObject *parent = 0); - ~QNlaEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - static QNlaEngine *instance(); - -private: - QWindowsSockInit winSock; - QNlaThread *nlaThread; - QMap configurationInterface; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 60ba81b..51323b0 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -2,3 +2,4 @@ TEMPLATE = subdirs SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager +win32:SUBDIRS += nla diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index d32dbe6..506417c 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -5,7 +5,8 @@ QT += network DEFINES += BEARER_ENGINE -HEADERS += qgenericengine.h +HEADERS += qgenericengine.h \ + ../platformdefs_win.h SOURCES += qgenericengine.cpp main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 89db82b..4be27ba 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -51,7 +51,7 @@ #include #ifdef Q_OS_WIN -#include "qnetworksessionengine_win_p.h" +#include "../platformdefs_win.h" #endif QT_BEGIN_NAMESPACE diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp new file mode 100644 index 0000000..f0d36c4 --- /dev/null +++ b/src/plugins/bearer/nla/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnlaengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QNlaEnginePlugin : public QBearerEnginePlugin +{ +public: + QNlaEnginePlugin(); + ~QNlaEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QNlaEnginePlugin::QNlaEnginePlugin() +{ +} + +QNlaEnginePlugin::~QNlaEnginePlugin() +{ +} + +QStringList QNlaEnginePlugin::keys() const +{ + qDebug() << Q_FUNC_INFO; + + return QStringList() << QLatin1String("nla"); +} + +QBearerEngine *QNlaEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key == QLatin1String("nla")) + return new QNlaEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QNlaEnginePlugin) +Q_EXPORT_PLUGIN2(qnlabearer, QNlaEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro new file mode 100644 index 0000000..78f3271 --- /dev/null +++ b/src/plugins/bearer/nla/nla.pro @@ -0,0 +1,20 @@ +TARGET = qnlabearer +include(../../qpluginbase.pri) + +QT += network + +!wince* { + LIBS += -lWs2_32 +} else { + LIBS += -lWs2 +} + +DEFINES += BEARER_ENGINE + +HEADERS += qnlaengine.h \ + ../platformdefs_win.h +SOURCES += qnlaengine.cpp main.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp new file mode 100644 index 0000000..527776f --- /dev/null +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -0,0 +1,591 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnlaengine.h" +#include + +#include +#include +#include +#include + +#include + +#include "../platformdefs_win.h" + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QNlaEngine, nlaEngine) + +QWindowsSockInit2::QWindowsSockInit2() +: version(0) +{ + //### should we try for 2.2 on all platforms ?? + WSAData wsadata; + + // IPv6 requires Winsock v2.0 or better. + if (WSAStartup(MAKEWORD(2,0), &wsadata) != 0) { + qWarning("QBearerManagementAPI: WinSock v2.0 initialization failed."); + } else { + version = 0x20; + } +} + +QWindowsSockInit2::~QWindowsSockInit2() +{ + WSACleanup(); +} + +#ifdef BEARER_MANAGEMENT_DEBUG +static void printBlob(NLA_BLOB *blob) +{ + qDebug() << "==== BEGIN NLA_BLOB ===="; + + qDebug() << "type:" << blob->header.type; + qDebug() << "size:" << blob->header.dwSize; + qDebug() << "next offset:" << blob->header.nextOffset; + + switch (blob->header.type) { + case NLA_RAW_DATA: + qDebug() << "Raw Data"; + qDebug() << '\t' << blob->data.rawData; + break; + case NLA_INTERFACE: + qDebug() << "Interface"; + qDebug() << "\ttype:" << blob->data.interfaceData.dwType; + qDebug() << "\tspeed:" << blob->data.interfaceData.dwSpeed; + qDebug() << "\tadapter:" << blob->data.interfaceData.adapterName; + break; + case NLA_802_1X_LOCATION: + qDebug() << "802.1x Location"; + qDebug() << '\t' << blob->data.locationData.information; + break; + case NLA_CONNECTIVITY: + qDebug() << "Connectivity"; + qDebug() << "\ttype:" << blob->data.connectivity.type; + qDebug() << "\tinternet:" << blob->data.connectivity.internet; + break; + case NLA_ICS: + qDebug() << "ICS"; + qDebug() << "\tspeed:" << blob->data.ICS.remote.speed; + qDebug() << "\ttype:" << blob->data.ICS.remote.type; + qDebug() << "\tstate:" << blob->data.ICS.remote.state; + qDebug() << "\tmachine name:" << blob->data.ICS.remote.machineName; + qDebug() << "\tshared adapter name:" << blob->data.ICS.remote.sharedAdapterName; + break; + default: + qDebug() << "UNKNOWN BLOB TYPE"; + } + + qDebug() << "===== END NLA_BLOB ====="; +} +#endif + +static QString qGetInterfaceType(const QString &interface) +{ +#ifdef Q_OS_WINCE + Q_UNUSED(interface) +#else + unsigned long oid; + DWORD bytesWritten; + + NDIS_MEDIUM medium; + NDIS_PHYSICAL_MEDIUM physicalMedium; + + HANDLE handle = CreateFile((TCHAR *)QString(QLatin1String("\\\\.\\%1")).arg(interface).utf16(), + 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + if (handle == INVALID_HANDLE_VALUE) + return QString(); + + oid = OID_GEN_MEDIA_SUPPORTED; + bytesWritten = 0; + bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &medium, sizeof(medium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + return QString(); + } + + oid = OID_GEN_PHYSICAL_MEDIUM; + bytesWritten = 0; + result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid), + &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0); + if (!result) { + CloseHandle(handle); + + if (medium == NdisMedium802_3) + return QLatin1String("Ethernet"); + else + return QString(); + } + + CloseHandle(handle); + + if (medium == NdisMedium802_3) { + switch (physicalMedium) { + case NdisPhysicalMediumWirelessLan: + return QLatin1String("WLAN"); + case NdisPhysicalMediumBluetooth: + return QLatin1String("Bluetooth"); + case NdisPhysicalMediumWiMax: + return QLatin1String("WiMAX"); + default: +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Physical Medium" << physicalMedium; +#endif + return QLatin1String("Ethernet"); + } + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << medium << physicalMedium; +#endif + +#endif + + return QString(); +} + +class QNlaThread : public QThread +{ + Q_OBJECT + +public: + QNlaThread(QNlaEngine *parent = 0); + ~QNlaThread(); + + QList getConfigurations(); + + void forceUpdate(); + +protected: + virtual void run(); + +private: + void updateConfigurations(QList &configs); + DWORD parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const; + QNetworkConfigurationPrivate *parseQuerySet(const WSAQUERYSET *querySet) const; + void fetchConfigurations(); + +signals: + void networksChanged(); + +private: + QMutex mutex; + HANDLE handle; + bool done; + QList fetchedConfigurations; +}; + +QNlaThread::QNlaThread(QNlaEngine *parent) +: QThread(parent), handle(0), done(false) +{ +} + +QNlaThread::~QNlaThread() +{ + mutex.lock(); + + done = true; + + if (handle) { + /* cancel completion event */ + if (WSALookupServiceEnd(handle) == SOCKET_ERROR) + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + } + mutex.unlock(); + + wait(); +} + +QList QNlaThread::getConfigurations() +{ + QMutexLocker locker(&mutex); + + QList foundConfigurations; + + for (int i = 0; i < fetchedConfigurations.count(); ++i) { + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; + config->name = fetchedConfigurations.at(i)->name; + config->isValid = fetchedConfigurations.at(i)->isValid; + config->id = fetchedConfigurations.at(i)->id; + config->state = fetchedConfigurations.at(i)->state; + config->type = fetchedConfigurations.at(i)->type; + config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; + config->purpose = fetchedConfigurations.at(i)->purpose; + config->internet = fetchedConfigurations.at(i)->internet; + + foundConfigurations.append(config); + } + + return foundConfigurations; +} + +void QNlaThread::forceUpdate() +{ + mutex.lock(); + + if (handle) { + /* cancel completion event */ + if (WSALookupServiceEnd(handle) == SOCKET_ERROR) + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + handle = 0; + } + mutex.unlock(); +} + +void QNlaThread::run() +{ + WSAEVENT changeEvent = WSACreateEvent(); + if (changeEvent == WSA_INVALID_EVENT) { + qWarning("WSACreateEvent error %d", WSAGetLastError()); + return; + } + + while (true) { + fetchConfigurations(); + + WSAQUERYSET qsRestrictions; + + memset(&qsRestrictions, 0, sizeof(qsRestrictions)); + qsRestrictions.dwSize = sizeof(qsRestrictions); + qsRestrictions.dwNameSpace = NS_NLA; + + mutex.lock(); + if (done) { + mutex.unlock(); + break; + } + int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL, &handle); + mutex.unlock(); + + if (result == SOCKET_ERROR) { + qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); + break; + } + + WSACOMPLETION completion; + WSAOVERLAPPED overlapped; + + memset(&overlapped, 0, sizeof(overlapped)); + overlapped.hEvent = changeEvent; + + memset(&completion, 0, sizeof(completion)); + completion.Type = NSP_NOTIFY_EVENT; + completion.Parameters.Event.lpOverlapped = &overlapped; + + DWORD bytesReturned = 0; + result = WSANSPIoctl(handle, SIO_NSP_NOTIFY_CHANGE, 0, 0, 0, 0, + &bytesReturned, &completion); + if (result == SOCKET_ERROR) { + int error = WSAGetLastError(); + if (error != WSA_IO_PENDING) { + qWarning("WSANSPIoctl error %d", error); + break; + } + } + +#ifndef Q_OS_WINCE + // Not interested in unrelated IO completion events + // although we also don't want to block them + while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION) {} +#else + WaitForSingleObject(changeEvent, WSA_INFINITE); +#endif + + mutex.lock(); + if (handle) { + result = WSALookupServiceEnd(handle); + if (result == SOCKET_ERROR) { + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + mutex.unlock(); + break; + } + handle = 0; + } + mutex.unlock(); + } + + WSACloseEvent(changeEvent); +} + +void QNlaThread::updateConfigurations(QList &configs) +{ + mutex.lock(); + + while (!fetchedConfigurations.isEmpty()) + delete fetchedConfigurations.takeFirst(); + + fetchedConfigurations = configs; + + mutex.unlock(); + + emit networksChanged(); +} + +DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv) const +{ +#ifdef BEARER_MANAGEMENT_DEBUG + printBlob(blob); +#endif + + switch (blob->header.type) { + case NLA_RAW_DATA: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_RAW_DATA", __FUNCTION__); +#endif + break; + case NLA_INTERFACE: + cpPriv->state = QNetworkConfiguration::Active; + if (QNlaEngine *engine = qobject_cast(parent())) { + engine->configurationInterface[cpPriv->id.toUInt()] = + QString::fromLatin1(blob->data.interfaceData.adapterName); + } + break; + case NLA_802_1X_LOCATION: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_802_1X_LOCATION", __FUNCTION__); +#endif + break; + case NLA_CONNECTIVITY: + if (blob->data.connectivity.internet == NLA_INTERNET_YES) + cpPriv->internet = true; + else + cpPriv->internet = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__); +#endif + break; + case NLA_ICS: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type NLA_ICS", __FUNCTION__); +#endif + break; + default: +#ifdef BEARER_MANAGEMENT_DEBUG + qWarning("%s: unhandled header type %d", __FUNCTION__, blob->header.type); +#endif + ; + } + + return blob->header.nextOffset; +} + +QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *querySet) const +{ + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + + cpPriv->name = QString::fromWCharArray(querySet->lpszServiceInstanceName); + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name)); + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "size:" << querySet->dwSize; + qDebug() << "service instance name:" << QString::fromUtf16(querySet->lpszServiceInstanceName); + qDebug() << "service class id:" << querySet->lpServiceClassId; + qDebug() << "version:" << querySet->lpVersion; + qDebug() << "comment:" << QString::fromUtf16(querySet->lpszComment); + qDebug() << "namespace:" << querySet->dwNameSpace; + qDebug() << "namespace provider id:" << querySet->lpNSProviderId; + qDebug() << "context:" << QString::fromUtf16(querySet->lpszContext); + qDebug() << "number of protocols:" << querySet->dwNumberOfProtocols; + qDebug() << "protocols:" << querySet->lpafpProtocols; + qDebug() << "query string:" << QString::fromUtf16(querySet->lpszQueryString); + qDebug() << "number of cs addresses:" << querySet->dwNumberOfCsAddrs; + qDebug() << "cs addresses:" << querySet->lpcsaBuffer; + qDebug() << "output flags:" << querySet->dwOutputFlags; +#endif + + if (querySet->lpBlob) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "blob size:" << querySet->lpBlob->cbSize; + qDebug() << "blob data:" << querySet->lpBlob->pBlobData; +#endif + + DWORD offset = 0; + do { + NLA_BLOB *blob = reinterpret_cast(querySet->lpBlob->pBlobData + offset); + DWORD nextOffset = parseBlob(blob, cpPriv); + if (nextOffset == offset) + break; + else + offset = nextOffset; + } while (offset != 0 && offset < querySet->lpBlob->cbSize); + } + + return cpPriv; +} + +void QNlaThread::fetchConfigurations() +{ + QList foundConfigurations; + + WSAQUERYSET qsRestrictions; + HANDLE hLookup = 0; + + memset(&qsRestrictions, 0, sizeof(qsRestrictions)); + qsRestrictions.dwSize = sizeof(qsRestrictions); + qsRestrictions.dwNameSpace = NS_NLA; + + int result = WSALookupServiceBegin(&qsRestrictions, LUP_RETURN_ALL | LUP_DEEP, &hLookup); + if (result == SOCKET_ERROR) { + qWarning("%s: WSALookupServiceBegin error %d", __FUNCTION__, WSAGetLastError()); + mutex.lock(); + fetchedConfigurations.clear(); + mutex.unlock(); + } + + char buffer[0x10000]; + while (result == 0) { + DWORD bufferLength = sizeof(buffer); + result = WSALookupServiceNext(hLookup, LUP_RETURN_ALL, + &bufferLength, reinterpret_cast(buffer)); + + if (result == SOCKET_ERROR) { + int error = WSAGetLastError(); + + if (error == WSA_E_NO_MORE) + break; + + if (error == WSAEFAULT) { + qDebug() << "buffer not big enough" << bufferLength; + break; + } + + qWarning("WSALookupServiceNext error %d", WSAGetLastError()); + break; + } + + QNetworkConfigurationPrivate *cpPriv = + parseQuerySet(reinterpret_cast(buffer)); + + foundConfigurations.append(cpPriv); + } + + if (hLookup) { + result = WSALookupServiceEnd(hLookup); + if (result == SOCKET_ERROR) { + qWarning("WSALookupServiceEnd error %d", WSAGetLastError()); + } + } + + updateConfigurations(foundConfigurations); +} + +QNlaEngine::QNlaEngine(QObject *parent) +: QNetworkSessionEngine(parent), nlaThread(0) +{ + nlaThread = new QNlaThread(this); + connect(nlaThread, SIGNAL(networksChanged()), + this, SIGNAL(configurationsChanged())); + nlaThread->start(); + + qApp->processEvents(QEventLoop::ExcludeUserInputEvents); +} + +QNlaEngine::~QNlaEngine() +{ + delete nlaThread; +} + +QList QNlaEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + + return nlaThread->getConfigurations(); +} + +QString QNlaEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QNlaEngine::hasIdentifier(const QString &id) +{ + if (configurationInterface.contains(id.toUInt())) + return true; + + foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { + if (cpPriv->id == id) + return true; + } + + return false; +} + +QString QNlaEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QNlaEngine::connectToId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QNlaEngine::disconnectFromId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QNlaEngine::requestUpdate() +{ + nlaThread->forceUpdate(); +} + +QNlaEngine *QNlaEngine::instance() +{ + return nlaEngine(); +} + +#include "qnlaengine.moc" +QT_END_NAMESPACE + + + diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h new file mode 100644 index 0000000..76505fb --- /dev/null +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNLAENGINE_P_H +#define QNLAENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; +class QNlaThread; + +class QWindowsSockInit2 +{ +public: + QWindowsSockInit2(); + ~QWindowsSockInit2(); + int version; +}; + +class QNlaEngine : public QNetworkSessionEngine +{ + Q_OBJECT + + friend class QNlaThread; + +public: + QNlaEngine(QObject *parent = 0); + ~QNlaEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QNlaEngine *instance(); + +private: + QWindowsSockInit2 winSock; + QNlaThread *nlaThread; + QMap configurationInterface; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h new file mode 100644 index 0000000..133b7b1 --- /dev/null +++ b/src/plugins/bearer/platformdefs_win.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_WIN_H +#define QPLATFORMDEFS_WIN_H + +#include +#include +#undef interface +#include + +#ifndef NS_NLA + +#define NS_NLA 15 + +enum NLA_BLOB_DATA_TYPE { + NLA_RAW_DATA = 0, + NLA_INTERFACE = 1, + NLA_802_1X_LOCATION = 2, + NLA_CONNECTIVITY = 3, + NLA_ICS = 4 +}; + +enum NLA_CONNECTIVITY_TYPE { + NLA_NETWORK_AD_HOC = 0, + NLA_NETWORK_MANAGED = 1, + NLA_NETWORK_UNMANAGED = 2, + NLA_NETWORK_UNKNOWN = 3 +}; + +enum NLA_INTERNET { + NLA_INTERNET_UNKNOWN = 0, + NLA_INTERNET_NO = 1, + NLA_INTERNET_YES = 2 +}; + +struct NLA_BLOB { + struct { + NLA_BLOB_DATA_TYPE type; + DWORD dwSize; + DWORD nextOffset; + } header; + + union { + // NLA_RAW_DATA + CHAR rawData[1]; + + // NLA_INTERFACE + struct { + DWORD dwType; + DWORD dwSpeed; + CHAR adapterName[1]; + } interfaceData; + + // NLA_802_1X_LOCATION + struct { + CHAR information[1]; + } locationData; + + // NLA_CONNECTIVITY + struct { + NLA_CONNECTIVITY_TYPE type; + NLA_INTERNET internet; + } connectivity; + + // NLA_ICS + struct { + struct { + DWORD speed; + DWORD type; + DWORD state; + WCHAR machineName[256]; + WCHAR sharedAdapterName[256]; + } remote; + } ICS; + } data; +}; +#endif + +enum NDIS_MEDIUM { + NdisMedium802_3 = 0, +}; + +enum NDIS_PHYSICAL_MEDIUM { + NdisPhysicalMediumWirelessLan = 1, + NdisPhysicalMediumBluetooth = 10, + NdisPhysicalMediumWiMax = 12, +}; + +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 + +#define IOCTL_NDIS_QUERY_GLOBAL_STATS \ + CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, 0, METHOD_OUT_DIRECT, FILE_ANY_ACCESS) + +#endif -- cgit v0.12 From 3d9d69e56b33935a1af825d837ca81081332963f Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 13:46:36 +1000 Subject: Convert NativeWifi engine into a plugin. --- src/network/bearer/bearer.pri | 6 - src/network/bearer/qnativewifiengine_win.cpp | 726 --------------------- src/network/bearer/qnativewifiengine_win_p.h | 95 --- src/network/bearer/qnetworkconfigmanager_p.cpp | 25 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworksession_p.cpp | 9 - src/plugins/bearer/bearer.pro | 1 + src/plugins/bearer/nativewifi/main.cpp | 143 ++++ src/plugins/bearer/nativewifi/nativewifi.pro | 13 + src/plugins/bearer/nativewifi/platformdefs.h | 322 +++++++++ .../bearer/nativewifi/qnativewifiengine.cpp | 406 ++++++++++++ src/plugins/bearer/nativewifi/qnativewifiengine.h | 95 +++ 12 files changed, 998 insertions(+), 845 deletions(-) delete mode 100644 src/network/bearer/qnativewifiengine_win.cpp delete mode 100644 src/network/bearer/qnativewifiengine_win_p.h create mode 100644 src/plugins/bearer/nativewifi/main.cpp create mode 100644 src/plugins/bearer/nativewifi/nativewifi.pro create mode 100644 src/plugins/bearer/nativewifi/platformdefs.h create mode 100644 src/plugins/bearer/nativewifi/qnativewifiengine.cpp create mode 100644 src/plugins/bearer/nativewifi/qnativewifiengine.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 2c2d255..9476239 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -82,12 +82,6 @@ symbian { contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM - win32:!wince* { - HEADERS += bearer/qnativewifiengine_win_p.h - - SOURCES += bearer/qnativewifiengine_win.cpp - } - macx { HEADERS += bearer/qcorewlanengine_mac_p.h SOURCES+= bearer/qcorewlanengine_mac.mm diff --git a/src/network/bearer/qnativewifiengine_win.cpp b/src/network/bearer/qnativewifiengine_win.cpp deleted file mode 100644 index 46d4ead..0000000 --- a/src/network/bearer/qnativewifiengine_win.cpp +++ /dev/null @@ -1,726 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnativewifiengine_win_p.h" -#include "qnetworkconfiguration_p.h" - -#include -#include -#include -#include - -#include - -#include -#undef interface - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QNativeWifiEngine, nativeWifiEngine) - -#define WLAN_MAX_NAME_LENGTH 256 -#define WLAN_MAX_PHY_TYPE_NUMBER 8 -#define WLAN_NOTIFICATION_SOURCE_ALL 0x0000ffff -#define WLAN_AVAILABLE_NETWORK_CONNECTED 1 -#define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2 -#define DOT11_SSID_MAX_LENGTH 32 - -struct WLAN_NOTIFICATION_DATA { - DWORD NotificationSource; - DWORD NotificationCode; - GUID InterfaceGuid; - DWORD dwDataSize; - PVOID pData; -}; - -enum WLAN_INTERFACE_STATE { - wlan_interface_state_not_ready = 0, - wlan_interface_state_connected, - wlan_interface_state_ad_hoc_network_formed, - wlan_interface_state_disconnecting, - wlan_interface_state_disconnected, - wlan_interface_state_associating, - wlan_interface_state_discovering, - wlan_interface_state_authenticating -}; - -struct WLAN_INTERFACE_INFO { - GUID InterfaceGuid; - WCHAR strInterfaceDescription[WLAN_MAX_NAME_LENGTH]; - WLAN_INTERFACE_STATE isState; -}; - -struct WLAN_INTERFACE_INFO_LIST { - DWORD dwNumberOfItems; - DWORD dwIndex; - WLAN_INTERFACE_INFO InterfaceInfo[1]; -}; - -struct DOT11_SSID { - ULONG uSSIDLength; - UCHAR ucSSID[DOT11_SSID_MAX_LENGTH]; -}; - -struct NDIS_OBJECT_HEADER { - UCHAR Type; - UCHAR Revision; - USHORT Size; -}; - -typedef UCHAR DOT11_MAC_ADDRESS[6]; -struct DOT11_BSSID_LIST { - NDIS_OBJECT_HEADER Header; - ULONG uNumberOfEntries; - ULONG uTotalNumOfEntries; - DOT11_MAC_ADDRESS BSSIDs[1]; -}; - -enum DOT11_BSS_TYPE { - dot11_BSS_type_infrastructure = 1, - dot11_BSS_type_independent = 2, - dot11_BSS_type_any = 3 -}; - -enum DOT11_PHY_TYPE { - dot11_phy_type_unknown = 0, - dot11_phy_type_any = dot11_phy_type_unknown, - dot11_phy_type_fhss = 1, - dot11_phy_type_dsss = 2, - dot11_phy_type_irbaseband = 3, - dot11_phy_type_ofdm = 4, - dot11_phy_type_hrdsss = 5, - dot11_phy_type_erp = 6, - dot11_phy_type_ht = 7, - dot11_phy_type_IHV_start = 0x80000000, - dot11_phy_type_IHV_end = 0xffffffff -}; - -enum DOT11_AUTH_ALGORITHM { - DOT11_AUTH_ALGO_80211_OPEN = 1, - DOT11_AUTH_ALGO_80211_SHARED_KEY = 2, - DOT11_AUTH_ALGO_WPA = 3, - DOT11_AUTH_ALGO_WPA_PSK = 4, - DOT11_AUTH_ALGO_WPA_NONE = 5, - DOT11_AUTH_ALGO_RSNA = 6, - DOT11_AUTH_ALGO_RSNA_PSK = 7, - DOT11_AUTH_ALGO_IHV_START = 0x80000000, - DOT11_AUTH_ALGO_IHV_END = 0xffffffff -}; - -enum DOT11_CIPHER_ALGORITHM { - DOT11_CIPHER_ALGO_NONE = 0x00, - DOT11_CIPHER_ALGO_WEP40 = 0x01, - DOT11_CIPHER_ALGO_TKIP = 0x02, - DOT11_CIPHER_ALGO_CCMP = 0x04, - DOT11_CIPHER_ALGO_WEP104 = 0x05, - DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100, - DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100, - DOT11_CIPHER_ALGO_WEP = 0x101, - DOT11_CIPHER_ALGO_IHV_START = 0x80000000, - DOT11_CIPHER_ALGO_IHV_END = 0xffffffff -}; - -struct WLAN_AVAILABLE_NETWORK { - WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; - DOT11_SSID dot11Ssid; - DOT11_BSS_TYPE dot11BssType; - ULONG uNumberOfBssids; - BOOL bNetworkConnectable; - DWORD wlanNotConnectableReason; - ULONG uNumberOfPhyTypes; - DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER]; - BOOL bMorePhyTypes; - ULONG wlanSignalQuality; - BOOL bSecurityEnabled; - DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; - DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; - DWORD dwFlags; - DWORD dwReserved; -}; - -struct WLAN_AVAILABLE_NETWORK_LIST { - DWORD dwNumberOfItems; - DWORD dwIndex; - WLAN_AVAILABLE_NETWORK Network[1]; -}; - -enum WLAN_INTF_OPCODE { - wlan_intf_opcode_autoconf_start = 0x000000000, - wlan_intf_opcode_autoconf_enabled, - wlan_intf_opcode_background_scan_enabled, - wlan_intf_opcode_media_streaming_mode, - wlan_intf_opcode_radio_state, - wlan_intf_opcode_bss_type, - wlan_intf_opcode_interface_state, - wlan_intf_opcode_current_connection, - wlan_intf_opcode_channel_number, - wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs, - wlan_intf_opcode_supported_adhoc_auth_cipher_pairs, - wlan_intf_opcode_supported_country_or_region_string_list, - wlan_intf_opcode_current_operation_mode, - wlan_intf_opcode_supported_safe_mode, - wlan_intf_opcode_certified_safe_mode, - wlan_intf_opcode_autoconf_end = 0x0fffffff, - wlan_intf_opcode_msm_start = 0x10000100, - wlan_intf_opcode_statistics, - wlan_intf_opcode_rssi, - wlan_intf_opcode_msm_end = 0x1fffffff, - wlan_intf_opcode_security_start = 0x20010000, - wlan_intf_opcode_security_end = 0x2fffffff, - wlan_intf_opcode_ihv_start = 0x30000000, - wlan_intf_opcode_ihv_end = 0x3fffffff -}; - -enum WLAN_OPCODE_VALUE_TYPE { - wlan_opcode_value_type_query_only = 0, - wlan_opcode_value_type_set_by_group_policy, - wlan_opcode_value_type_set_by_user, - wlan_opcode_value_type_invalid -}; - -enum WLAN_CONNECTION_MODE { - wlan_connection_mode_profile = 0, - wlan_connection_mode_temporary_profile, - wlan_connection_mode_discovery_secure, - wlan_connection_mode_discovery_unsecure, - wlan_connection_mode_auto, - wlan_connection_mode_invalid -}; - -struct WLAN_CONNECTION_PARAMETERS { - WLAN_CONNECTION_MODE wlanConnectionMode; - LPCWSTR strProfile; - DOT11_SSID *pDot11Ssid; - DOT11_BSSID_LIST *pDesiredBssidList; - DOT11_BSS_TYPE dot11BssType; - DWORD dwFlags; -}; - -struct WLAN_RAW_DATA { - DWORD dwDataSize; - BYTE DataBlob[1]; -}; - -enum WLAN_NOTIFICATION_ACM { - wlan_notification_acm_start = 0, - wlan_notification_acm_autoconf_enabled, - wlan_notification_acm_autoconf_disabled, - wlan_notification_acm_background_scan_enabled, - wlan_notification_acm_background_scan_disabled, - wlan_notification_acm_bss_type_change, - wlan_notification_acm_power_setting_change, - wlan_notification_acm_scan_complete, - wlan_notification_acm_scan_fail, - wlan_notification_acm_connection_start, - wlan_notification_acm_connection_complete, - wlan_notification_acm_connection_attempt_fail, - wlan_notification_acm_filter_list_change, - wlan_notification_acm_interface_arrival, - wlan_notification_acm_interface_removal, - wlan_notification_acm_profile_change, - wlan_notification_acm_profile_name_change, - wlan_notification_acm_profiles_exhausted, - wlan_notification_acm_network_not_available, - wlan_notification_acm_network_available, - wlan_notification_acm_disconnecting, - wlan_notification_acm_disconnected, - wlan_notification_acm_adhoc_network_state_change, - wlan_notification_acm_end -}; - -struct WLAN_ASSOCIATION_ATTRIBUTES { - DOT11_SSID dot11Ssid; - DOT11_BSS_TYPE dot11BssType; - DOT11_MAC_ADDRESS dot11Bssid; - DOT11_PHY_TYPE dot11PhyType; - ULONG uDot11PhyIndex; - ULONG wlanSignalQuality; - ULONG ulRxRate; - ULONG ulTxRate; -}; - -struct WLAN_SECURITY_ATTRIBUTES { - BOOL bSecurityEnabled; - BOOL bOneXEnabled; - DOT11_AUTH_ALGORITHM dot11AuthAlgorithm; - DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm; -}; - -struct WLAN_CONNECTION_ATTRIBUTES { - WLAN_INTERFACE_STATE isState; - WLAN_CONNECTION_MODE wlanConnectionMode; - WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; - WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; - WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes; -}; - -typedef void (WINAPI *WLAN_NOTIFICATION_CALLBACK)(WLAN_NOTIFICATION_DATA *, PVOID); - -typedef DWORD (WINAPI *WlanOpenHandleProto) - (DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle); -typedef DWORD (WINAPI *WlanRegisterNotificationProto) - (HANDLE hClientHandle, DWORD dwNotifSource, BOOL bIgnoreDuplicate, - WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext, - PVOID pReserved, PDWORD pdwPrevNotifSource); -typedef DWORD (WINAPI *WlanEnumInterfacesProto) - (HANDLE hClientHandle, PVOID pReserved, WLAN_INTERFACE_INFO_LIST **ppInterfaceList); -typedef DWORD (WINAPI *WlanGetAvailableNetworkListProto) - (HANDLE hClientHandle, const GUID* pInterfaceGuid, DWORD dwFlags, PVOID pReserved, - WLAN_AVAILABLE_NETWORK_LIST **ppAvailableNetworkList); -typedef DWORD (WINAPI *WlanQueryInterfaceProto) - (HANDLE hClientHandle, const GUID *pInterfaceGuid, WLAN_INTF_OPCODE OpCode, PVOID pReserved, - PDWORD pdwDataSize, PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType); -typedef DWORD (WINAPI *WlanConnectProto) - (HANDLE hClientHandle, const GUID *pInterfaceGuid, - const WLAN_CONNECTION_PARAMETERS *pConnectionParameters, PVOID pReserved); -typedef DWORD (WINAPI *WlanDisconnectProto) - (HANDLE hClientHandle, const GUID *pInterfaceGuid, PVOID pReserved); -typedef DWORD (WINAPI *WlanScanProto) - (HANDLE hClientHandle, const GUID *pInterfaceGuid, const DOT11_SSID *pDot11Ssid, - const WLAN_RAW_DATA *pIeData, PVOID pReserved); -typedef VOID (WINAPI *WlanFreeMemoryProto)(PVOID pMemory); -typedef DWORD (WINAPI *WlanCloseHandleProto)(HANDLE hClientHandle, PVOID pReserved); - -static WlanOpenHandleProto local_WlanOpenHandle = 0; -static WlanRegisterNotificationProto local_WlanRegisterNotification = 0; -static WlanEnumInterfacesProto local_WlanEnumInterfaces = 0; -static WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList = 0; -static WlanQueryInterfaceProto local_WlanQueryInterface = 0; -static WlanConnectProto local_WlanConnect = 0; -static WlanDisconnectProto local_WlanDisconnect = 0; -static WlanScanProto local_WlanScan = 0; -static WlanFreeMemoryProto local_WlanFreeMemory = 0; -static WlanCloseHandleProto local_WlanCloseHandle = 0; - -static void resolveLibrary() -{ - static volatile bool triedResolve = false; - - if (!triedResolve) { -#ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle)); -#endif - - if (!triedResolve) { - local_WlanOpenHandle = (WlanOpenHandleProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanOpenHandle"); - local_WlanRegisterNotification = (WlanRegisterNotificationProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanRegisterNotification"); - local_WlanEnumInterfaces = (WlanEnumInterfacesProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanEnumInterfaces"); - local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanGetAvailableNetworkList"); - local_WlanQueryInterface = (WlanQueryInterfaceProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanQueryInterface"); - local_WlanConnect = (WlanConnectProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanConnect"); - local_WlanDisconnect = (WlanDisconnectProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanDisconnect"); - local_WlanScan = (WlanScanProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanScan"); - local_WlanFreeMemory = (WlanFreeMemoryProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanFreeMemory"); - local_WlanCloseHandle = (WlanCloseHandleProto) - QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanCloseHandle"); - - triedResolve = true; - } - } -} - -void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) -{ - Q_UNUSED(d); - - switch (data->NotificationCode) { - case wlan_notification_acm_connection_complete: - case wlan_notification_acm_disconnected: - d->emitConfigurationsChanged(); - break; - default: - qDebug() << "wlan unknown notification"; - } -} - -QNativeWifiEngine::QNativeWifiEngine(QObject *parent) -: QNetworkSessionEngine(parent), handle(0) -{ - DWORD clientVersion; - - DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle); - if (result != ERROR_SUCCESS) { - if (result != ERROR_SERVICE_NOT_ACTIVE) - qWarning("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); - - return; - } - - result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true, - WLAN_NOTIFICATION_CALLBACK(qNotificationCallback), - this, 0, 0); - if (result != ERROR_SUCCESS) - qWarning("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); - - // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. - // We need to poll for changes in available wireless networks. - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); - pollTimer.setInterval(10000); -} - -QNativeWifiEngine::~QNativeWifiEngine() -{ - local_WlanCloseHandle(handle, 0); -} - -QList QNativeWifiEngine::getConfigurations(bool *ok) -{ - if (ok) - *ok = false; - - QList foundConfigurations; - - // enumerate interfaces - WLAN_INTERFACE_INFO_LIST *interfaceList; - DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - return foundConfigurations; - } - - for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { - const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; - - WLAN_AVAILABLE_NETWORK_LIST *networkList; - result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, - 3, 0, &networkList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", - __FUNCTION__, result); - continue; - } - - QStringList seenNetworks; - - for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { - WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; - - QString networkName; - - if (network.strProfileName[0] != 0) { - networkName = QString::fromWCharArray(network.strProfileName); - } else { - networkName = QByteArray(reinterpret_cast(network.dot11Ssid.ucSSID), - network.dot11Ssid.uSSIDLength); - } - - // don't add duplicate networks - if (seenNetworks.contains(networkName)) - continue; - else - seenNetworks.append(networkName); - - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - - cpPriv->isValid = true; - - cpPriv->name = networkName; - cpPriv->id = QString::number(qHash(QLatin1String("WLAN:") + cpPriv->name)); - - if (!(network.dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE)) - cpPriv->state = QNetworkConfiguration::Undefined; - - if (network.strProfileName[0] != 0) { - if (network.bNetworkConnectable) { - if (network.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) - cpPriv->state = QNetworkConfiguration::Active; - else - cpPriv->state = QNetworkConfiguration::Discovered; - } else { - cpPriv->state = QNetworkConfiguration::Defined; - } - } - - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - - foundConfigurations.append(cpPriv); - } - - local_WlanFreeMemory(networkList); - } - - local_WlanFreeMemory(interfaceList); - - if (ok) - *ok = true; - - pollTimer.start(); - - return foundConfigurations; -} - -QString QNativeWifiEngine::getInterfaceFromId(const QString &id) -{ - // enumerate interfaces - WLAN_INTERFACE_INFO_LIST *interfaceList; - DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - return QString(); - } - - for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { - const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; - - DWORD dataSize; - WLAN_CONNECTION_ATTRIBUTES *connectionAttributes; - result = local_WlanQueryInterface(handle, &interface.InterfaceGuid, - wlan_intf_opcode_current_connection, 0, &dataSize, - reinterpret_cast(&connectionAttributes), 0); - if (result != ERROR_SUCCESS) { - if (result != ERROR_INVALID_STATE) - qWarning("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result); - - continue; - } - - if (qHash(QLatin1String("WLAN:") + - QString::fromWCharArray(connectionAttributes->strProfileName)) == id.toUInt()) { - QString guid("{%1-%2-%3-%4%5-%6%7%8%9%10%11}"); - - guid = guid.arg(interface.InterfaceGuid.Data1, 8, 16, QChar('0')); - guid = guid.arg(interface.InterfaceGuid.Data2, 4, 16, QChar('0')); - guid = guid.arg(interface.InterfaceGuid.Data3, 4, 16, QChar('0')); - for (int i = 0; i < 8; ++i) - guid = guid.arg(interface.InterfaceGuid.Data4[i], 2, 16, QChar('0')); - - local_WlanFreeMemory(connectionAttributes); - - return guid.toUpper(); - } - - local_WlanFreeMemory(connectionAttributes); - } - - return QString(); -} - -bool QNativeWifiEngine::hasIdentifier(const QString &id) -{ - // enumerate interfaces - WLAN_INTERFACE_INFO_LIST *interfaceList; - DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - return false; - } - - for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { - const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; - - WLAN_AVAILABLE_NETWORK_LIST *networkList; - result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, - 3, 0, &networkList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", - __FUNCTION__, result); - continue; - } - - for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { - WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; - - QString networkName; - - if (network.strProfileName[0] != 0) { - networkName = QString::fromWCharArray(network.strProfileName); - } else { - networkName = QByteArray(reinterpret_cast(network.dot11Ssid.ucSSID), - network.dot11Ssid.uSSIDLength); - } - - if (qHash(QLatin1String("WLAN:") + networkName) == id.toUInt()) { - local_WlanFreeMemory(networkList); - local_WlanFreeMemory(interfaceList); - return true; - } - } - - local_WlanFreeMemory(networkList); - } - - local_WlanFreeMemory(interfaceList); - - return false; -} - -QString QNativeWifiEngine::bearerName(const QString &) -{ - return QLatin1String("WLAN"); -} - -void QNativeWifiEngine::connectToId(const QString &id) -{ - WLAN_INTERFACE_INFO_LIST *interfaceList; - DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - emit connectionError(id, InterfaceLookupError); - return; - } - - QString profile; - - for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { - const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; - - WLAN_AVAILABLE_NETWORK_LIST *networkList; - result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, - 3, 0, &networkList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", - __FUNCTION__, result); - continue; - } - - for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { - WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; - - profile = QString::fromWCharArray(network.strProfileName); - - if (qHash(QLatin1String("WLAN:") + profile) == id.toUInt()) - break; - else - profile.clear(); - } - - local_WlanFreeMemory(networkList); - - if (!profile.isEmpty()) { - WLAN_CONNECTION_PARAMETERS parameters; - parameters.wlanConnectionMode = wlan_connection_mode_profile; - parameters.strProfile = reinterpret_cast(profile.utf16()); - parameters.pDot11Ssid = 0; - parameters.pDesiredBssidList = 0; - parameters.dot11BssType = dot11_BSS_type_any; - parameters.dwFlags = 0; - - DWORD result = local_WlanConnect(handle, &interface.InterfaceGuid, ¶meters, 0); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result); - emit connectionError(id, ConnectError); - break; - } - - break; - } - } - - local_WlanFreeMemory(interfaceList); - - if (profile.isEmpty()) - emit connectionError(id, InterfaceLookupError); -} - -void QNativeWifiEngine::disconnectFromId(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) { - emit connectionError(id, InterfaceLookupError); - return; - } - - QStringList split = interface.mid(1, interface.length() - 2).split('-'); - - GUID guid; - guid.Data1 = split.at(0).toUInt(0, 16); - guid.Data2 = split.at(1).toUShort(0, 16); - guid.Data3 = split.at(2).toUShort(0, 16); - guid.Data4[0] = split.at(3).left(2).toUShort(0, 16); - guid.Data4[1] = split.at(3).right(2).toUShort(0, 16); - for (int i = 0; i < 6; ++i) - guid.Data4[i + 2] = split.at(4).mid(i*2, 2).toUShort(0, 16); - - DWORD result = local_WlanDisconnect(handle, &guid, 0); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result); - emit connectionError(id, DisconnectionError); - return; - } -} - -void QNativeWifiEngine::requestUpdate() -{ - // enumerate interfaces - WLAN_INTERFACE_INFO_LIST *interfaceList; - DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); - if (result != ERROR_SUCCESS) { - qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - return; - } - - for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { - result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0); - if (result != ERROR_SUCCESS) - qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); - } -} - -QNativeWifiEngine *QNativeWifiEngine::instance() -{ - resolveLibrary(); - - // native wifi dll not available - if (!local_WlanOpenHandle) - return 0; - - QNativeWifiEngine *engine = nativeWifiEngine(); - - // could not initialise subsystem - if (engine && engine->handle == 0) - return 0; - - return engine; -} - -#include "moc_qnativewifiengine_win_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnativewifiengine_win_p.h b/src/network/bearer/qnativewifiengine_win_p.h deleted file mode 100644 index 4817867..0000000 --- a/src/network/bearer/qnativewifiengine_win_p.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNATIVEWIFIENGINE_P_H -#define QNATIVEWIFIENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworksessionengine_p.h" - -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; - -class QNativeWifiEngine : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - QNativeWifiEngine(QObject *parent = 0); - ~QNativeWifiEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - inline void emitConfigurationsChanged() { emit configurationsChanged(); } - - static QNativeWifiEngine *instance(); - -private: - QTimer pollTimer; - - Qt::HANDLE handle; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c61bcd3..c35edbf 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -41,9 +41,6 @@ #include "qnetworkconfigmanager_p.h" -#ifdef Q_OS_WIN32 -#include "qnativewifiengine_win_p.h" -#endif #ifdef Q_OS_DARWIN #include "qcorewlanengine_mac_p.h" #endif @@ -239,6 +236,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } #else #ifdef BACKEND_NM + nmWifi = 0; if (keys.contains(QLatin1String("networkmanager"))) { QBearerEnginePlugin *nmPlugin = qobject_cast(l->instance(QLatin1String("networkmanager"))); @@ -252,6 +250,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } #endif + generic = 0; if (keys.contains(QLatin1String("generic"))) { QBearerEnginePlugin *genericPlugin = qobject_cast(l->instance(QLatin1String("generic"))); @@ -266,10 +265,12 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() #endif #ifdef Q_OS_WIN + nla = 0; if (keys.contains(QLatin1String("nla"))) { QBearerEnginePlugin *nlaPlugin = qobject_cast(l->instance(QLatin1String("nla"))); if (nlaPlugin) { + qDebug() << "creating nla backend"; nla = nlaPlugin->create(QLatin1String("nla")); if (nla) { connect(nla, SIGNAL(configurationsChanged()), @@ -280,13 +281,21 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() #endif #ifdef Q_OS_WIN32 - nativeWifi = QNativeWifiEngine::instance(); - if (nativeWifi) { - connect(nativeWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + nativeWifi = 0; + if (keys.contains(QLatin1String("nativewifi"))) { + QBearerEnginePlugin *nativeWifiPlugin = + qobject_cast(l->instance(QLatin1String("nativewifi"))); + if (nativeWifiPlugin) { + qDebug() << "Creating native wifi backend"; + nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); + if (nativeWifi) { + connect(nativeWifi, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; + capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; + } } + } #endif } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 7b824f0..5d0df18 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -139,7 +139,7 @@ private: #ifdef Q_OS_WIN QNetworkSessionEngine *nla; #ifndef Q_OS_WINCE - QNativeWifiEngine *nativeWifi; + QNetworkSessionEngine *nativeWifi; #endif #endif #ifdef BACKEND_NM diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index 1ce94e2..3c9054b 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -44,9 +44,6 @@ #include "qnetworksessionengine_p.h" #include "qnetworkconfigmanager_p.h" -#ifdef Q_OS_WIN32 -#include "qnativewifiengine_win_p.h" -#endif #ifdef Q_OS_DARWIN #include "qcorewlanengine_mac_p.h" #endif @@ -64,12 +61,6 @@ static QNetworkSessionEngine *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); -#ifdef Q_OS_WIN32 - QNativeWifiEngine *nativeWifi = QNativeWifiEngine::instance(); - if (nativeWifi && nativeWifi->hasIdentifier(id)) - return nativeWifi; -#endif - #ifdef Q_OS_DARWIN QCoreWlanEngine *coreWifi = QCoreWlanEngine::instance(); if (coreWifi && coreWifi->hasIdentifier(id)) diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 51323b0..80d6f4b 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -3,3 +3,4 @@ TEMPLATE = subdirs SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla +win32:!wince*:SUBDIRS += nativewifi diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp new file mode 100644 index 0000000..2aced02 --- /dev/null +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnativewifiengine.h" +#include "platformdefs.h" + +#include +#include +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +static void resolveLibrary() +{ + static volatile bool triedResolve = false; + + if (!triedResolve) { +#ifndef QT_NO_THREAD + QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle)); +#endif + + if (!triedResolve) { + local_WlanOpenHandle = (WlanOpenHandleProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanOpenHandle"); + local_WlanRegisterNotification = (WlanRegisterNotificationProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanRegisterNotification"); + local_WlanEnumInterfaces = (WlanEnumInterfacesProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanEnumInterfaces"); + local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanGetAvailableNetworkList"); + local_WlanQueryInterface = (WlanQueryInterfaceProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanQueryInterface"); + local_WlanConnect = (WlanConnectProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanConnect"); + local_WlanDisconnect = (WlanDisconnectProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanDisconnect"); + local_WlanScan = (WlanScanProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanScan"); + local_WlanFreeMemory = (WlanFreeMemoryProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanFreeMemory"); + local_WlanCloseHandle = (WlanCloseHandleProto) + QLibrary::resolve(QLatin1String("wlanapi.dll"), "WlanCloseHandle"); + + triedResolve = true; + } + } +} + +class QNativeWifiEnginePlugin : public QBearerEnginePlugin +{ +public: + QNativeWifiEnginePlugin(); + ~QNativeWifiEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QNativeWifiEnginePlugin::QNativeWifiEnginePlugin() +{ +} + +QNativeWifiEnginePlugin::~QNativeWifiEnginePlugin() +{ +} + +QStringList QNativeWifiEnginePlugin::keys() const +{ + qDebug() << Q_FUNC_INFO; + + return QStringList() << QLatin1String("nativewifi"); +} + +QBearerEngine *QNativeWifiEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key != QLatin1String("nativewifi")) + return 0; + + resolveLibrary(); + + // native wifi dll not available + if (!local_WlanOpenHandle) + return 0; + + QNativeWifiEngine *engine = new QNativeWifiEngine; + + // could not initialise subsystem + if (engine && !engine->available()) { + delete engine; + return 0; + } + + return engine; +} + +Q_EXPORT_STATIC_PLUGIN(QNativeWifiEnginePlugin) +Q_EXPORT_PLUGIN2(qnativewifibearer, QNativeWifiEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro new file mode 100644 index 0000000..3aab552 --- /dev/null +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -0,0 +1,13 @@ +TARGET = qnativewifibearer +include(../../qpluginbase.pri) + +QT += network + +DEFINES += BEARER_ENGINE + +HEADERS += qnativewifiengine.h platformdefs.h +SOURCES += qnativewifiengine.cpp main.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h new file mode 100644 index 0000000..38fbae4 --- /dev/null +++ b/src/plugins/bearer/nativewifi/platformdefs.h @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** 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 plugins 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 PLATFORMDEFS_H +#define PLATFORMDEFS_H + +#include +#undef interface + +#define WLAN_MAX_NAME_LENGTH 256 +#define WLAN_MAX_PHY_TYPE_NUMBER 8 +#define WLAN_NOTIFICATION_SOURCE_ALL 0x0000ffff +#define WLAN_AVAILABLE_NETWORK_CONNECTED 1 +#define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 2 +#define DOT11_SSID_MAX_LENGTH 32 + +struct WLAN_NOTIFICATION_DATA { + DWORD NotificationSource; + DWORD NotificationCode; + GUID InterfaceGuid; + DWORD dwDataSize; + PVOID pData; +}; + +enum WLAN_INTERFACE_STATE { + wlan_interface_state_not_ready = 0, + wlan_interface_state_connected, + wlan_interface_state_ad_hoc_network_formed, + wlan_interface_state_disconnecting, + wlan_interface_state_disconnected, + wlan_interface_state_associating, + wlan_interface_state_discovering, + wlan_interface_state_authenticating +}; + +struct WLAN_INTERFACE_INFO { + GUID InterfaceGuid; + WCHAR strInterfaceDescription[WLAN_MAX_NAME_LENGTH]; + WLAN_INTERFACE_STATE isState; +}; + +struct WLAN_INTERFACE_INFO_LIST { + DWORD dwNumberOfItems; + DWORD dwIndex; + WLAN_INTERFACE_INFO InterfaceInfo[1]; +}; + +struct DOT11_SSID { + ULONG uSSIDLength; + UCHAR ucSSID[DOT11_SSID_MAX_LENGTH]; +}; + +struct NDIS_OBJECT_HEADER { + UCHAR Type; + UCHAR Revision; + USHORT Size; +}; + +typedef UCHAR DOT11_MAC_ADDRESS[6]; +struct DOT11_BSSID_LIST { + NDIS_OBJECT_HEADER Header; + ULONG uNumberOfEntries; + ULONG uTotalNumOfEntries; + DOT11_MAC_ADDRESS BSSIDs[1]; +}; + +enum DOT11_BSS_TYPE { + dot11_BSS_type_infrastructure = 1, + dot11_BSS_type_independent = 2, + dot11_BSS_type_any = 3 +}; + +enum DOT11_PHY_TYPE { + dot11_phy_type_unknown = 0, + dot11_phy_type_any = dot11_phy_type_unknown, + dot11_phy_type_fhss = 1, + dot11_phy_type_dsss = 2, + dot11_phy_type_irbaseband = 3, + dot11_phy_type_ofdm = 4, + dot11_phy_type_hrdsss = 5, + dot11_phy_type_erp = 6, + dot11_phy_type_ht = 7, + dot11_phy_type_IHV_start = 0x80000000, + dot11_phy_type_IHV_end = 0xffffffff +}; + +enum DOT11_AUTH_ALGORITHM { + DOT11_AUTH_ALGO_80211_OPEN = 1, + DOT11_AUTH_ALGO_80211_SHARED_KEY = 2, + DOT11_AUTH_ALGO_WPA = 3, + DOT11_AUTH_ALGO_WPA_PSK = 4, + DOT11_AUTH_ALGO_WPA_NONE = 5, + DOT11_AUTH_ALGO_RSNA = 6, + DOT11_AUTH_ALGO_RSNA_PSK = 7, + DOT11_AUTH_ALGO_IHV_START = 0x80000000, + DOT11_AUTH_ALGO_IHV_END = 0xffffffff +}; + +enum DOT11_CIPHER_ALGORITHM { + DOT11_CIPHER_ALGO_NONE = 0x00, + DOT11_CIPHER_ALGO_WEP40 = 0x01, + DOT11_CIPHER_ALGO_TKIP = 0x02, + DOT11_CIPHER_ALGO_CCMP = 0x04, + DOT11_CIPHER_ALGO_WEP104 = 0x05, + DOT11_CIPHER_ALGO_WPA_USE_GROUP = 0x100, + DOT11_CIPHER_ALGO_RSN_USE_GROUP = 0x100, + DOT11_CIPHER_ALGO_WEP = 0x101, + DOT11_CIPHER_ALGO_IHV_START = 0x80000000, + DOT11_CIPHER_ALGO_IHV_END = 0xffffffff +}; + +struct WLAN_AVAILABLE_NETWORK { + WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; + DOT11_SSID dot11Ssid; + DOT11_BSS_TYPE dot11BssType; + ULONG uNumberOfBssids; + BOOL bNetworkConnectable; + DWORD wlanNotConnectableReason; + ULONG uNumberOfPhyTypes; + DOT11_PHY_TYPE dot11PhyTypes[WLAN_MAX_PHY_TYPE_NUMBER]; + BOOL bMorePhyTypes; + ULONG wlanSignalQuality; + BOOL bSecurityEnabled; + DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm; + DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm; + DWORD dwFlags; + DWORD dwReserved; +}; + +struct WLAN_AVAILABLE_NETWORK_LIST { + DWORD dwNumberOfItems; + DWORD dwIndex; + WLAN_AVAILABLE_NETWORK Network[1]; +}; + +enum WLAN_INTF_OPCODE { + wlan_intf_opcode_autoconf_start = 0x000000000, + wlan_intf_opcode_autoconf_enabled, + wlan_intf_opcode_background_scan_enabled, + wlan_intf_opcode_media_streaming_mode, + wlan_intf_opcode_radio_state, + wlan_intf_opcode_bss_type, + wlan_intf_opcode_interface_state, + wlan_intf_opcode_current_connection, + wlan_intf_opcode_channel_number, + wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs, + wlan_intf_opcode_supported_adhoc_auth_cipher_pairs, + wlan_intf_opcode_supported_country_or_region_string_list, + wlan_intf_opcode_current_operation_mode, + wlan_intf_opcode_supported_safe_mode, + wlan_intf_opcode_certified_safe_mode, + wlan_intf_opcode_autoconf_end = 0x0fffffff, + wlan_intf_opcode_msm_start = 0x10000100, + wlan_intf_opcode_statistics, + wlan_intf_opcode_rssi, + wlan_intf_opcode_msm_end = 0x1fffffff, + wlan_intf_opcode_security_start = 0x20010000, + wlan_intf_opcode_security_end = 0x2fffffff, + wlan_intf_opcode_ihv_start = 0x30000000, + wlan_intf_opcode_ihv_end = 0x3fffffff +}; + +enum WLAN_OPCODE_VALUE_TYPE { + wlan_opcode_value_type_query_only = 0, + wlan_opcode_value_type_set_by_group_policy, + wlan_opcode_value_type_set_by_user, + wlan_opcode_value_type_invalid +}; + +enum WLAN_CONNECTION_MODE { + wlan_connection_mode_profile = 0, + wlan_connection_mode_temporary_profile, + wlan_connection_mode_discovery_secure, + wlan_connection_mode_discovery_unsecure, + wlan_connection_mode_auto, + wlan_connection_mode_invalid +}; + +struct WLAN_CONNECTION_PARAMETERS { + WLAN_CONNECTION_MODE wlanConnectionMode; + LPCWSTR strProfile; + DOT11_SSID *pDot11Ssid; + DOT11_BSSID_LIST *pDesiredBssidList; + DOT11_BSS_TYPE dot11BssType; + DWORD dwFlags; +}; + +struct WLAN_RAW_DATA { + DWORD dwDataSize; + BYTE DataBlob[1]; +}; + +enum WLAN_NOTIFICATION_ACM { + wlan_notification_acm_start = 0, + wlan_notification_acm_autoconf_enabled, + wlan_notification_acm_autoconf_disabled, + wlan_notification_acm_background_scan_enabled, + wlan_notification_acm_background_scan_disabled, + wlan_notification_acm_bss_type_change, + wlan_notification_acm_power_setting_change, + wlan_notification_acm_scan_complete, + wlan_notification_acm_scan_fail, + wlan_notification_acm_connection_start, + wlan_notification_acm_connection_complete, + wlan_notification_acm_connection_attempt_fail, + wlan_notification_acm_filter_list_change, + wlan_notification_acm_interface_arrival, + wlan_notification_acm_interface_removal, + wlan_notification_acm_profile_change, + wlan_notification_acm_profile_name_change, + wlan_notification_acm_profiles_exhausted, + wlan_notification_acm_network_not_available, + wlan_notification_acm_network_available, + wlan_notification_acm_disconnecting, + wlan_notification_acm_disconnected, + wlan_notification_acm_adhoc_network_state_change, + wlan_notification_acm_end +}; + +struct WLAN_ASSOCIATION_ATTRIBUTES { + DOT11_SSID dot11Ssid; + DOT11_BSS_TYPE dot11BssType; + DOT11_MAC_ADDRESS dot11Bssid; + DOT11_PHY_TYPE dot11PhyType; + ULONG uDot11PhyIndex; + ULONG wlanSignalQuality; + ULONG ulRxRate; + ULONG ulTxRate; +}; + +struct WLAN_SECURITY_ATTRIBUTES { + BOOL bSecurityEnabled; + BOOL bOneXEnabled; + DOT11_AUTH_ALGORITHM dot11AuthAlgorithm; + DOT11_CIPHER_ALGORITHM dot11CipherAlgorithm; +}; + +struct WLAN_CONNECTION_ATTRIBUTES { + WLAN_INTERFACE_STATE isState; + WLAN_CONNECTION_MODE wlanConnectionMode; + WCHAR strProfileName[WLAN_MAX_NAME_LENGTH]; + WLAN_ASSOCIATION_ATTRIBUTES wlanAssociationAttributes; + WLAN_SECURITY_ATTRIBUTES wlanSecurityAttributes; +}; + +typedef void (WINAPI *WLAN_NOTIFICATION_CALLBACK)(WLAN_NOTIFICATION_DATA *, PVOID); + +typedef DWORD (WINAPI *WlanOpenHandleProto) + (DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle); +typedef DWORD (WINAPI *WlanRegisterNotificationProto) + (HANDLE hClientHandle, DWORD dwNotifSource, BOOL bIgnoreDuplicate, + WLAN_NOTIFICATION_CALLBACK funcCallback, PVOID pCallbackContext, + PVOID pReserved, PDWORD pdwPrevNotifSource); +typedef DWORD (WINAPI *WlanEnumInterfacesProto) + (HANDLE hClientHandle, PVOID pReserved, WLAN_INTERFACE_INFO_LIST **ppInterfaceList); +typedef DWORD (WINAPI *WlanGetAvailableNetworkListProto) + (HANDLE hClientHandle, const GUID* pInterfaceGuid, DWORD dwFlags, PVOID pReserved, + WLAN_AVAILABLE_NETWORK_LIST **ppAvailableNetworkList); +typedef DWORD (WINAPI *WlanQueryInterfaceProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, WLAN_INTF_OPCODE OpCode, PVOID pReserved, + PDWORD pdwDataSize, PVOID *ppData, WLAN_OPCODE_VALUE_TYPE *pWlanOpcodeValueType); +typedef DWORD (WINAPI *WlanConnectProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, + const WLAN_CONNECTION_PARAMETERS *pConnectionParameters, PVOID pReserved); +typedef DWORD (WINAPI *WlanDisconnectProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, PVOID pReserved); +typedef DWORD (WINAPI *WlanScanProto) + (HANDLE hClientHandle, const GUID *pInterfaceGuid, const DOT11_SSID *pDot11Ssid, + const WLAN_RAW_DATA *pIeData, PVOID pReserved); +typedef VOID (WINAPI *WlanFreeMemoryProto)(PVOID pMemory); +typedef DWORD (WINAPI *WlanCloseHandleProto)(HANDLE hClientHandle, PVOID pReserved); + +extern WlanOpenHandleProto local_WlanOpenHandle; +extern WlanRegisterNotificationProto local_WlanRegisterNotification; +extern WlanEnumInterfacesProto local_WlanEnumInterfaces; +extern WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList; +extern WlanQueryInterfaceProto local_WlanQueryInterface; +extern WlanConnectProto local_WlanConnect; +extern WlanDisconnectProto local_WlanDisconnect; +extern WlanScanProto local_WlanScan; +extern WlanFreeMemoryProto local_WlanFreeMemory; +extern WlanCloseHandleProto local_WlanCloseHandle; + +#endif // PLATFORMDEFS_H diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp new file mode 100644 index 0000000..5ca49a9 --- /dev/null +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -0,0 +1,406 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnativewifiengine.h" +#include "platformdefs.h" + +#include + +#include + +#include + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QNativeWifiEngine, nativeWifiEngine) + +WlanOpenHandleProto local_WlanOpenHandle = 0; +WlanRegisterNotificationProto local_WlanRegisterNotification = 0; +WlanEnumInterfacesProto local_WlanEnumInterfaces = 0; +WlanGetAvailableNetworkListProto local_WlanGetAvailableNetworkList = 0; +WlanQueryInterfaceProto local_WlanQueryInterface = 0; +WlanConnectProto local_WlanConnect = 0; +WlanDisconnectProto local_WlanDisconnect = 0; +WlanScanProto local_WlanScan = 0; +WlanFreeMemoryProto local_WlanFreeMemory = 0; +WlanCloseHandleProto local_WlanCloseHandle = 0; + + + +void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) +{ + Q_UNUSED(d); + + switch (data->NotificationCode) { + case wlan_notification_acm_connection_complete: + case wlan_notification_acm_disconnected: + d->emitConfigurationsChanged(); + break; + default: + qDebug() << "wlan unknown notification"; + } +} + +QNativeWifiEngine::QNativeWifiEngine(QObject *parent) +: QNetworkSessionEngine(parent), handle(0) +{ + DWORD clientVersion; + + DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle); + if (result != ERROR_SUCCESS) { + if (result != ERROR_SERVICE_NOT_ACTIVE) + qWarning("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result); + + return; + } + + result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true, + WLAN_NOTIFICATION_CALLBACK(qNotificationCallback), + this, 0, 0); + if (result != ERROR_SUCCESS) + qWarning("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result); + + // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. + // We need to poll for changes in available wireless networks. + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QNativeWifiEngine::~QNativeWifiEngine() +{ + local_WlanCloseHandle(handle, 0); +} + +QList QNativeWifiEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = false; + + QList foundConfigurations; + + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return foundConfigurations; + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + WLAN_AVAILABLE_NETWORK_LIST *networkList; + result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, + 3, 0, &networkList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); + continue; + } + + QStringList seenNetworks; + + for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { + WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; + + QString networkName; + + if (network.strProfileName[0] != 0) { + networkName = QString::fromWCharArray(network.strProfileName); + } else { + networkName = QByteArray(reinterpret_cast(network.dot11Ssid.ucSSID), + network.dot11Ssid.uSSIDLength); + } + + // don't add duplicate networks + if (seenNetworks.contains(networkName)) + continue; + else + seenNetworks.append(networkName); + + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + + cpPriv->isValid = true; + + cpPriv->name = networkName; + cpPriv->id = QString::number(qHash(QLatin1String("WLAN:") + cpPriv->name)); + + if (!(network.dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE)) + cpPriv->state = QNetworkConfiguration::Undefined; + + if (network.strProfileName[0] != 0) { + if (network.bNetworkConnectable) { + if (network.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) + cpPriv->state = QNetworkConfiguration::Active; + else + cpPriv->state = QNetworkConfiguration::Discovered; + } else { + cpPriv->state = QNetworkConfiguration::Defined; + } + } + + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + + foundConfigurations.append(cpPriv); + } + + local_WlanFreeMemory(networkList); + } + + local_WlanFreeMemory(interfaceList); + + if (ok) + *ok = true; + + pollTimer.start(); + + return foundConfigurations; +} + +QString QNativeWifiEngine::getInterfaceFromId(const QString &id) +{ + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return QString(); + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + DWORD dataSize; + WLAN_CONNECTION_ATTRIBUTES *connectionAttributes; + result = local_WlanQueryInterface(handle, &interface.InterfaceGuid, + wlan_intf_opcode_current_connection, 0, &dataSize, + reinterpret_cast(&connectionAttributes), 0); + if (result != ERROR_SUCCESS) { + if (result != ERROR_INVALID_STATE) + qWarning("%s: WlanQueryInterface failed with error %ld\n", __FUNCTION__, result); + + continue; + } + + if (qHash(QLatin1String("WLAN:") + + QString::fromWCharArray(connectionAttributes->strProfileName)) == id.toUInt()) { + QString guid("{%1-%2-%3-%4%5-%6%7%8%9%10%11}"); + + guid = guid.arg(interface.InterfaceGuid.Data1, 8, 16, QChar('0')); + guid = guid.arg(interface.InterfaceGuid.Data2, 4, 16, QChar('0')); + guid = guid.arg(interface.InterfaceGuid.Data3, 4, 16, QChar('0')); + for (int i = 0; i < 8; ++i) + guid = guid.arg(interface.InterfaceGuid.Data4[i], 2, 16, QChar('0')); + + local_WlanFreeMemory(connectionAttributes); + + return guid.toUpper(); + } + + local_WlanFreeMemory(connectionAttributes); + } + + return QString(); +} + +bool QNativeWifiEngine::hasIdentifier(const QString &id) +{ + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return false; + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + WLAN_AVAILABLE_NETWORK_LIST *networkList; + result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, + 3, 0, &networkList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); + continue; + } + + for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { + WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; + + QString networkName; + + if (network.strProfileName[0] != 0) { + networkName = QString::fromWCharArray(network.strProfileName); + } else { + networkName = QByteArray(reinterpret_cast(network.dot11Ssid.ucSSID), + network.dot11Ssid.uSSIDLength); + } + + if (qHash(QLatin1String("WLAN:") + networkName) == id.toUInt()) { + local_WlanFreeMemory(networkList); + local_WlanFreeMemory(interfaceList); + return true; + } + } + + local_WlanFreeMemory(networkList); + } + + local_WlanFreeMemory(interfaceList); + + return false; +} + +QString QNativeWifiEngine::bearerName(const QString &) +{ + return QLatin1String("WLAN"); +} + +void QNativeWifiEngine::connectToId(const QString &id) +{ + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + emit connectionError(id, InterfaceLookupError); + return; + } + + QString profile; + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + const WLAN_INTERFACE_INFO &interface = interfaceList->InterfaceInfo[i]; + + WLAN_AVAILABLE_NETWORK_LIST *networkList; + result = local_WlanGetAvailableNetworkList(handle, &interface.InterfaceGuid, + 3, 0, &networkList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanGetAvailableNetworkList failed with error %ld\n", + __FUNCTION__, result); + continue; + } + + for (unsigned int j = 0; j < networkList->dwNumberOfItems; ++j) { + WLAN_AVAILABLE_NETWORK &network = networkList->Network[j]; + + profile = QString::fromWCharArray(network.strProfileName); + + if (qHash(QLatin1String("WLAN:") + profile) == id.toUInt()) + break; + else + profile.clear(); + } + + local_WlanFreeMemory(networkList); + + if (!profile.isEmpty()) { + WLAN_CONNECTION_PARAMETERS parameters; + parameters.wlanConnectionMode = wlan_connection_mode_profile; + parameters.strProfile = reinterpret_cast(profile.utf16()); + parameters.pDot11Ssid = 0; + parameters.pDesiredBssidList = 0; + parameters.dot11BssType = dot11_BSS_type_any; + parameters.dwFlags = 0; + + DWORD result = local_WlanConnect(handle, &interface.InterfaceGuid, ¶meters, 0); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result); + emit connectionError(id, ConnectError); + break; + } + + break; + } + } + + local_WlanFreeMemory(interfaceList); + + if (profile.isEmpty()) + emit connectionError(id, InterfaceLookupError); +} + +void QNativeWifiEngine::disconnectFromId(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) { + emit connectionError(id, InterfaceLookupError); + return; + } + + QStringList split = interface.mid(1, interface.length() - 2).split('-'); + + GUID guid; + guid.Data1 = split.at(0).toUInt(0, 16); + guid.Data2 = split.at(1).toUShort(0, 16); + guid.Data3 = split.at(2).toUShort(0, 16); + guid.Data4[0] = split.at(3).left(2).toUShort(0, 16); + guid.Data4[1] = split.at(3).right(2).toUShort(0, 16); + for (int i = 0; i < 6; ++i) + guid.Data4[i + 2] = split.at(4).mid(i*2, 2).toUShort(0, 16); + + DWORD result = local_WlanDisconnect(handle, &guid, 0); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result); + emit connectionError(id, DisconnectionError); + return; + } +} + +void QNativeWifiEngine::requestUpdate() +{ + // enumerate interfaces + WLAN_INTERFACE_INFO_LIST *interfaceList; + DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); + if (result != ERROR_SUCCESS) { + qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); + return; + } + + for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { + result = local_WlanScan(handle, &interfaceList->InterfaceInfo[i].InterfaceGuid, 0, 0, 0); + if (result != ERROR_SUCCESS) + qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h new file mode 100644 index 0000000..6686ea8 --- /dev/null +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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 plugins 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 QNATIVEWIFIENGINE_P_H +#define QNATIVEWIFIENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QNativeWifiEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QNativeWifiEngine(QObject *parent = 0); + ~QNativeWifiEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + inline void emitConfigurationsChanged() { emit configurationsChanged(); } + + inline bool available() const { return handle != 0; } + +private: + QTimer pollTimer; + + Qt::HANDLE handle; +}; + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 33934fc640c8f7cad0841ab2ae9c1ec22fd09654 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 15:38:14 +1000 Subject: Fix license headers. --- src/network/bearer/qcorewlanengine_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm index 5854384..2455f86 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the QtNetwork module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From a28dff36ae1e25be3748b2c26dcbb5b7b4ea6100 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 15:42:07 +1000 Subject: Update license headers. --- src/plugins/bearer/nla/qnlaengine.cpp | 2 +- src/plugins/bearer/nla/qnlaengine.h | 2 +- src/plugins/bearer/platformdefs_win.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 527776f..2ad9cac 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 76505fb..1e66c83 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index 133b7b1..f2f44a1 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From 13a519ce2d85ee006f2a30a50029195465249b01 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 15:44:21 +1000 Subject: Update license headers. --- tests/auto/qbearertestcommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qbearertestcommon.h b/tests/auto/qbearertestcommon.h index 3356bd6..0bfe622 100644 --- a/tests/auto/qbearertestcommon.h +++ b/tests/auto/qbearertestcommon.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the Qt Mobility Components. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From 0bcb2788e1eb225e0e3babb4ca113bcb5769dfc2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 14:55:23 +1000 Subject: Add config.test for CoreWlan. Untested, I don't have a mac. --- config.tests/mac/corewlan/corewlan.pro | 3 ++ config.tests/mac/corewlan/corewlantest.mm | 49 +++++++++++++++++++++++++++++++ configure | 15 ++++++++++ 3 files changed, 67 insertions(+) create mode 100644 config.tests/mac/corewlan/corewlan.pro create mode 100644 config.tests/mac/corewlan/corewlantest.mm diff --git a/config.tests/mac/corewlan/corewlan.pro b/config.tests/mac/corewlan/corewlan.pro new file mode 100644 index 0000000..8451af3 --- /dev/null +++ b/config.tests/mac/corewlan/corewlan.pro @@ -0,0 +1,3 @@ +SOURCES = corewlantest.mm +LIBS += -framework CoreWLAN -framework Foundation +CONFIG -= app_bundle qt diff --git a/config.tests/mac/corewlan/corewlantest.mm b/config.tests/mac/corewlan/corewlantest.mm new file mode 100644 index 0000000..3a29d84 --- /dev/null +++ b/config.tests/mac/corewlan/corewlantest.mm @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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 config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +int main() +{ + [CWInterface interfaceWithName:@"en2"]; + return 0; +} diff --git a/configure b/configure index dcd7d2d..b686081 100755 --- a/configure +++ b/configure @@ -766,6 +766,7 @@ CFG_SILENT=no CFG_GRAPHICS_SYSTEM=default CFG_ALSA=auto CFG_NETWORKMANAGER=auto +CFG_COREWLAN=auto # initalize variables used for installation QT_INSTALL_PREFIX= @@ -5365,6 +5366,14 @@ if [ "$PLATFORM_MAC" = "yes" ]; then # Always enable Phonon (unless it was explicitly disabled) CFG_PHONON=yes fi + + if [ "$CFG_COREWLAN" = "auto" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/corewlan "CoreWlan" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_COREWLAN=yes + else + CFG_COREWLAN=no + fi + fi fi # QWS @@ -6310,6 +6319,10 @@ if [ "$CFG_NETWORKMANAGER" = "yes" ]; then QT_CONFIG="$QT_CONFIG networkmanager" fi +if [ "$CFG_COREWLAN" = "yes" ]; then + QT_CONFIG="$QT_CONFIG corewlan" +fi + # # Some Qt modules are too advanced in C++ for some old compilers # Detect here the platforms where they are known to work. @@ -7011,6 +7024,7 @@ fi [ "$CFG_XINPUT" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_RUNTIME_XINPUT" [ "$CFG_ALSA" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ALSA" [ "$CFG_NETWORKMANAGER" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NETWORKMANAGER" +[ "$CFG_COREWLAN" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_COREWLAN" # sort QCONFIG_FLAGS for neatness if we can [ '!' -z "$AWK" ] && QCONFIG_FLAGS=`echo $QCONFIG_FLAGS | $AWK '{ gsub(" ", "\n"); print }' | sort | uniq` @@ -7537,6 +7551,7 @@ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" fi echo "alsa support ........... $CFG_ALSA" echo "NetworkManager support . $CFG_NETWORKMANAGER" +echo "CoreWlan support ....... $CFG_COREWLAN" echo sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'` -- cgit v0.12 From f7eb78d6b7cc0e07275ab64bec2743c5b2c0705f Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 3 Dec 2009 15:00:24 +1000 Subject: Convert CoreWlan engine into a plugin. --- src/network/bearer/bearer.pri | 13 - src/network/bearer/qcorewlanengine_mac.mm | 461 ------------------------- src/network/bearer/qcorewlanengine_mac_p.h | 101 ------ src/network/bearer/qnetworkconfigmanager_p.cpp | 23 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworksession_p.cpp | 13 - src/plugins/bearer/bearer.pro | 1 + src/plugins/bearer/corewlan/corewlan.pro | 21 ++ src/plugins/bearer/corewlan/main.cpp | 88 +++++ src/plugins/bearer/corewlan/qcorewlanengine.h | 91 +++++ src/plugins/bearer/corewlan/qcorewlanengine.mm | 459 ++++++++++++++++++++++++ 11 files changed, 672 insertions(+), 601 deletions(-) delete mode 100644 src/network/bearer/qcorewlanengine_mac.mm delete mode 100644 src/network/bearer/qcorewlanengine_mac_p.h create mode 100644 src/plugins/bearer/corewlan/corewlan.pro create mode 100644 src/plugins/bearer/corewlan/main.cpp create mode 100644 src/plugins/bearer/corewlan/qcorewlanengine.h create mode 100644 src/plugins/bearer/corewlan/qcorewlanengine.mm diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 9476239..5bae333 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -81,18 +81,5 @@ symbian { bearer/qnetworksessionengine.cpp contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM - - macx { - HEADERS += bearer/qcorewlanengine_mac_p.h - SOURCES+= bearer/qcorewlanengine_mac.mm - LIBS += -framework Foundation -framework SystemConfiguration - - contains(corewlan_enabled, yes) { - isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { - LIBS += -framework CoreWLAN - DEFINES += MAC_SDK_10_6 - } - } - } } diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm deleted file mode 100644 index 2455f86..0000000 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ /dev/null @@ -1,461 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcorewlanengine_mac_p.h" -#include "qnetworkconfiguration_p.h" - -#include -#include -#include -#include - -#include - -#if defined(MAC_SDK_10_6) //not much functionality without this -#include -#include -#include -#include -#endif - -#include -#include -#include - -#include -QMap networkInterfaces; - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) - -inline QString cfstringRefToQstring(CFStringRef cfStringRef) { -// return QString([cfStringRef UTF8String]); - QString retVal; - CFIndex maxLength = 2 * CFStringGetLength(cfStringRef) + 1/*zero term*/; // max UTF8 - char *cstring = new char[maxLength]; - if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) { - retVal = QString::fromUtf8(cstring); - } - delete cstring; - return retVal; -} - -inline CFStringRef qstringToCFStringRef(const QString &string) -{ - return CFStringCreateWithCharacters(0, reinterpret_cast(string.unicode()), - string.length()); -} - -inline NSString *qstringToNSString(const QString &qstr) -{ return [reinterpret_cast(qstringToCFStringRef(qstr)) autorelease]; } - -inline QString nsstringToQString(const NSString *nsstr) -{ return cfstringRefToQstring(reinterpret_cast(nsstr)); } - -inline QStringList nsarrayToQStringList(void *nsarray) -{ - QStringList result; - NSArray *array = static_cast(nsarray); - for (NSUInteger i=0; i<[array count]; ++i) - result << nsstringToQString([array objectAtIndex:i]); - return result; -} - -static QString qGetInterfaceType(const QString &interfaceString) -{ - return networkInterfaces.value(interfaceString); -} - -QCoreWlanEngine::QCoreWlanEngine(QObject *parent) -: QNetworkSessionEngine(parent) -{ - getAllScInterfaces(); - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); - pollTimer.setInterval(10000); -} - -QCoreWlanEngine::~QCoreWlanEngine() -{ -} - -QList QCoreWlanEngine::getWifiConfigurations() -{ - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - QString interfaceName = i.key(); - if (i.value() == "WLAN") { - if(!isWifiReady(interfaceName)) { - qWarning() << "wifi not powered on"; - return QList(); - } else { - // QList profs = getWlanProfiles(interfaceName); - scanForSsids(interfaceName); - } - } else { - - } - } - return QList (); -} - -QList QCoreWlanEngine::getConfigurations(bool *ok) -{ - if (ok) - *ok = true; - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - QList foundConfigurations; - QList wificonfigs = getWifiConfigurations(); - - uint identifier; - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - if (i.value() == "WLAN") { - QList fetchedConfigurations = scanForSsids(i.key()); - for (int i = 0; i < fetchedConfigurations.count(); ++i) { - - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; - - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; - - identifier = config->name.toUInt(); - configurationInterface[identifier] = config->serviceInterface.name(); - foundConfigurations.append(config); - } - } - - QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - const QString humanReadableName = interface.humanReadableName(); - cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; - cpPriv->isValid = true; - - if (interface.index()) - identifier = interface.index(); - else - identifier = qHash(interface.hardwareAddress()); - - cpPriv->id = QString::number(identifier); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Undefined; - - if (interface.flags() & QNetworkInterface::IsRunning) { - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->internet = true; - } - if ( !interface.addressEntries().isEmpty()) { - cpPriv->state |= QNetworkConfiguration::Active; - cpPriv->internet = true; - } - configurationInterface[identifier] = interface.name(); - foundConfigurations.append(cpPriv); - } - [autoreleasepool release]; - pollTimer.start(); - return foundConfigurations; -} - -QString QCoreWlanEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id.toUInt()); -} - -bool QCoreWlanEngine::hasIdentifier(const QString &id) -{ - return configurationInterface.contains(id.toUInt()); -} - -QString QCoreWlanEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - -void QCoreWlanEngine::connectToId(const QString &id) -{ - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - QString interfaceString = getInterfaceFromId(id); - - if(networkInterfaces.value(interfaceString) == "WLAN") { -#if defined(MAC_SDK_10_6) - CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; - CWConfiguration *userConfig = [ wifiInterface configuration]; - - NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile - - NSEnumerator *enumerator = [remNets objectEnumerator]; - CWWirelessProfile *wProfile; - NSUInteger index=0; - while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile - - if(id == nsstringToQString([wProfile ssid])) { - CW8021XProfile *user8021XProfile = nil; - user8021XProfile = [ wProfile user8021XProfile]; - - NSError *err = nil; - NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; - - if(user8021XProfile) { - [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; - } else { - [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; - } - - NSDictionary *parametersDict = nil; - NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; - if(!err) { - for(uint row=0; row < [apArray count]; row++ ) { - CWNetwork *apNetwork = [apArray objectAtIndex:row]; - if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { - bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; - if(!result) { - qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); - emit connectionError(id, ConnectError); - } else { - [autoreleasepool release]; - return; - } - } - } - } - } - index++; - } - emit connectionError(id, InterfaceLookupError); -#endif - } else { - // not wifi - } - emit connectionError(id, OperationNotSupported); - [autoreleasepool release]; -} - -void QCoreWlanEngine::disconnectFromId(const QString &id) -{ - QString interfaceString = getInterfaceFromId(id); - if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now -#if defined(MAC_SDK_10_6) - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; - [wifiInterface disassociate]; - if([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) { - emit connectionError(id, DisconnectionError); - } - [autoreleasepool release]; - return; -#endif - } else { - - } - emit connectionError(id, OperationNotSupported); -} - -void QCoreWlanEngine::requestUpdate() -{ - getAllScInterfaces(); - emit configurationsChanged(); -} - -QCoreWlanEngine *QCoreWlanEngine::instance() -{ - return coreWlanEngine(); -} - -QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) -{ - QList foundConfigs; -#if defined(MAC_SDK_10_6) - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; - NSError *err = nil; - NSDictionary *parametersDict = nil; - NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; - - if(!err) { - for(uint row=0; row < [apArray count]; row++ ) { - CWNetwork *apNetwork = [apArray objectAtIndex:row]; - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QString networkSsid = nsstringToQString([apNetwork ssid]); - cpPriv->name = networkSsid; - cpPriv->isValid = true; - cpPriv->id = networkSsid; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); - - CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; - CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; - if(!userNetworkProfile) { - } else { - qWarning() <<"Has profile!" ; - } - - if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); - if( cpPriv->name == interfaceSsidString) { - cpPriv->state |= QNetworkConfiguration::Active; - } - } else { - if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { - cpPriv->state = QNetworkConfiguration::Discovered; - } else { - cpPriv->state = QNetworkConfiguration::Defined; - } - } - if(!cpPriv->state) { - cpPriv->state = QNetworkConfiguration::Undefined; - } - if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - else - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - foundConfigs.append(cpPriv); - } - } else { - qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) - < QCoreWlanEngine::getWlanProfiles(const QString &interfaceName) -{ - Q_UNUSED(interfaceName) -#if defined(MAC_SDK_10_6) -// for( CW8021XProfile *each8021XProfile in [CW8021XProfile allUser8021XProfiles] ) { -// qWarning() << "Profile name" << nsstringToQString([each8021XProfile ssid]); -// } - -#endif - return QList (); -} - -bool QCoreWlanEngine::getAllScInterfaces() -{ - networkInterfaces.clear(); - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - CFArrayRef interfaces = SCNetworkInterfaceCopyAll(); - if (interfaces != NULL) { - CFIndex interfaceCount; - CFIndex interfaceIndex; - interfaceCount = CFArrayGetCount(interfaces); - for (interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++) { - - CFStringRef bsdName; - CFTypeRef thisInterface = CFArrayGetValueAtIndex(interfaces, interfaceIndex); - bsdName = SCNetworkInterfaceGetBSDName((SCNetworkInterfaceRef)thisInterface); - QString interfaceName = cfstringRefToQstring(bsdName); - QString typeStr; - CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface); - if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) { - typeStr = "WLAN"; -// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) { -// typeStr = "Bluetooth"; - } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) { - typeStr = "Ethernet"; - } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) { - typeStr = "Ethernet"; //ok a bit fudged - } - if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) { - networkInterfaces.insert(interfaceName,typeStr); - } - } - } - CFRelease(interfaces); - - [autoreleasepool release]; - return true; -} - -#include "moc_qcorewlanengine_mac_p.cpp" - -QT_END_NAMESPACE - diff --git a/src/network/bearer/qcorewlanengine_mac_p.h b/src/network/bearer/qcorewlanengine_mac_p.h deleted file mode 100644 index d6454ca..0000000 --- a/src/network/bearer/qcorewlanengine_mac_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QCOREWLANENGINE_P_H -#define QCOREWLANENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworksessionengine_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; - -class QCoreWlanEngine : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - QCoreWlanEngine(QObject *parent = 0); - ~QCoreWlanEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - static QCoreWlanEngine *instance(); - static bool getAllScInterfaces(); - -private: - bool isWifiReady(const QString &dev); - QMap configurationInterface; - QTimer pollTimer; - QList scanForSsids(const QString &interfaceName); - - QList getWlanProfiles(const QString &interfaceName); - - QList getWifiConfigurations(); - bool isKnownSsid(const QString &interfaceName, const QString &ssid); -}; - -QT_END_NAMESPACE - -#endif - diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c35edbf..f8e0d7b 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -40,11 +40,6 @@ ****************************************************************************/ #include "qnetworkconfigmanager_p.h" - -#ifdef Q_OS_DARWIN -#include "qcorewlanengine_mac_p.h" -#endif - #include "qbearerplugin.h" #include @@ -229,10 +224,17 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QStringList keys = l->keys(); #if defined (Q_OS_DARWIN) - coreWifi = QCoreWlanEngine::instance(); - if (coreWifi) { - connect(coreWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + coreWifi = 0; + if (keys.contains(QLatin1String("corewlan"))) { + QBearerEnginePlugin *coreWlanPlugin = + qobject_cast(l->instance(QLatin1String("corewlan"))); + if (coreWlanPlugin) { + coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); + if (coreWifi) { + connect(coreWifi, SIGNAL(configurationsChanged()), + this, SLOT(updateConfigurations())); + } + } } #else #ifdef BACKEND_NM @@ -473,7 +475,4 @@ void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() #endif } -#include "moc_qnetworkconfigmanager_p.cpp" - QT_END_NAMESPACE - diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 5d0df18..95358bc 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -146,7 +146,7 @@ private: QNetworkSessionEngine *nmWifi; #endif #ifdef Q_OS_DARWIN - QCoreWlanEngine *coreWifi; + QNetworkSessionEngine *coreWifi; #endif uint onlineConfigurations; diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index 3c9054b..df0ad3e 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -44,29 +44,18 @@ #include "qnetworksessionengine_p.h" #include "qnetworkconfigmanager_p.h" -#ifdef Q_OS_DARWIN -#include "qcorewlanengine_mac_p.h" -#endif #include #include #include #include -#undef interface - QT_BEGIN_NAMESPACE static QNetworkSessionEngine *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); -#ifdef Q_OS_DARWIN - QCoreWlanEngine *coreWifi = QCoreWlanEngine::instance(); - if (coreWifi && coreWifi->hasIdentifier(id)) - return coreWifi; - -#endif QNetworkSessionEngine *engine = priv->configurationEngine.value(id); if (engine && engine->hasIdentifier(id)) return engine; @@ -498,6 +487,4 @@ if(serviceName.isEmpty()) } #endif -#include "moc_qnetworksession_p.cpp" QT_END_NAMESPACE - diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 80d6f4b..58d2613 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -4,3 +4,4 @@ SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi +macx:SUBDIRS += corewlan diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro new file mode 100644 index 0000000..ffac6df --- /dev/null +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -0,0 +1,21 @@ +TARGET = qcorewlanbearer +include(../../qpluginbase.pri) + +QT += network +LIBS += -framework Foundation -framework SystemConfiguration + +contains(QT_CONFIG, corewlan) { + isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { + LIBS += -framework CoreWLAN + DEFINES += MAC_SDK_10_6 + } +} + +DEFINES += BEARER_ENGINE + +HEADERS += qcorewlanengine.h +SOURCES += qcorewlanengine.mm main.cpp + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp new file mode 100644 index 0000000..c0d1efe --- /dev/null +++ b/src/plugins/bearer/corewlan/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 plugins 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 "qcorewlanengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QCoreWlanEnginePlugin : public QBearerEnginePlugin +{ +public: + QCoreWlanEnginePlugin(); + ~QCoreWlanEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QCoreWlanEnginePlugin::QCoreWlanEnginePlugin() +{ +} + +QCoreWlanEnginePlugin::~QCoreWlanEnginePlugin() +{ +} + +QStringList QCoreWlanEnginePlugin::keys() const +{ + qDebug() << Q_FUNC_INFO; + + return QStringList() << QLatin1String("corewlan"); +} + +QBearerEngine *QCoreWlanEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key == QLatin1String("corewlan")) + return new QCoreWlanEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QCoreWlanEnginePlugin) +Q_EXPORT_PLUGIN2(qcorewlanbearer, QCoreWlanEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h new file mode 100644 index 0000000..7ccfeea --- /dev/null +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** 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 plugins 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 QCOREWLANENGINE_P_H +#define QCOREWLANENGINE_P_H + +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; + +class QCoreWlanEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QCoreWlanEngine(QObject *parent = 0); + ~QCoreWlanEngine(); + + QList getConfigurations(bool *ok = 0); + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + static QCoreWlanEngine *instance(); + static bool getAllScInterfaces(); + +private: + bool isWifiReady(const QString &dev); + QMap configurationInterface; + QTimer pollTimer; + QList scanForSsids(const QString &interfaceName); + + QList getWlanProfiles(const QString &interfaceName); + + QList getWifiConfigurations(); + bool isKnownSsid(const QString &interfaceName, const QString &ssid); +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm new file mode 100644 index 0000000..9dea217 --- /dev/null +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -0,0 +1,459 @@ +/**************************************************************************** +** +** 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 plugins 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 "qcorewlanengine.h" + +#include + +#include +#include +#include +#include + +#include + +#if defined(MAC_SDK_10_6) //not much functionality without this +#include +#include +#include +#include +#endif + +#include +#include +#include + +#include +QMap networkInterfaces; + +QT_BEGIN_NAMESPACE + +Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) + +inline QString cfstringRefToQstring(CFStringRef cfStringRef) { +// return QString([cfStringRef UTF8String]); + QString retVal; + CFIndex maxLength = 2 * CFStringGetLength(cfStringRef) + 1/*zero term*/; // max UTF8 + char *cstring = new char[maxLength]; + if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) { + retVal = QString::fromUtf8(cstring); + } + delete cstring; + return retVal; +} + +inline CFStringRef qstringToCFStringRef(const QString &string) +{ + return CFStringCreateWithCharacters(0, reinterpret_cast(string.unicode()), + string.length()); +} + +inline NSString *qstringToNSString(const QString &qstr) +{ return [reinterpret_cast(qstringToCFStringRef(qstr)) autorelease]; } + +inline QString nsstringToQString(const NSString *nsstr) +{ return cfstringRefToQstring(reinterpret_cast(nsstr)); } + +inline QStringList nsarrayToQStringList(void *nsarray) +{ + QStringList result; + NSArray *array = static_cast(nsarray); + for (NSUInteger i=0; i<[array count]; ++i) + result << nsstringToQString([array objectAtIndex:i]); + return result; +} + +static QString qGetInterfaceType(const QString &interfaceString) +{ + return networkInterfaces.value(interfaceString); +} + +QCoreWlanEngine::QCoreWlanEngine(QObject *parent) +: QNetworkSessionEngine(parent) +{ + getAllScInterfaces(); + connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + pollTimer.setInterval(10000); +} + +QCoreWlanEngine::~QCoreWlanEngine() +{ +} + +QList QCoreWlanEngine::getWifiConfigurations() +{ + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + QString interfaceName = i.key(); + if (i.value() == "WLAN") { + if(!isWifiReady(interfaceName)) { + qWarning() << "wifi not powered on"; + return QList(); + } else { + // QList profs = getWlanProfiles(interfaceName); + scanForSsids(interfaceName); + } + } else { + + } + } + return QList (); +} + +QList QCoreWlanEngine::getConfigurations(bool *ok) +{ + if (ok) + *ok = true; + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + QList foundConfigurations; + QList wificonfigs = getWifiConfigurations(); + + uint identifier; + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + if (i.value() == "WLAN") { + QList fetchedConfigurations = scanForSsids(i.key()); + for (int i = 0; i < fetchedConfigurations.count(); ++i) { + + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; + config->name = fetchedConfigurations.at(i)->name; + config->isValid = fetchedConfigurations.at(i)->isValid; + config->id = fetchedConfigurations.at(i)->id; + + config->state = fetchedConfigurations.at(i)->state; + config->type = fetchedConfigurations.at(i)->type; + config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; + config->purpose = fetchedConfigurations.at(i)->purpose; + config->internet = fetchedConfigurations.at(i)->internet; + config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; + + identifier = config->name.toUInt(); + configurationInterface[identifier] = config->serviceInterface.name(); + foundConfigurations.append(config); + } + } + + QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString humanReadableName = interface.humanReadableName(); + cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; + cpPriv->isValid = true; + + if (interface.index()) + identifier = interface.index(); + else + identifier = qHash(interface.hardwareAddress()); + + cpPriv->id = QString::number(identifier); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Undefined; + + if (interface.flags() & QNetworkInterface::IsRunning) { + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->internet = true; + } + if ( !interface.addressEntries().isEmpty()) { + cpPriv->state |= QNetworkConfiguration::Active; + cpPriv->internet = true; + } + configurationInterface[identifier] = interface.name(); + foundConfigurations.append(cpPriv); + } + [autoreleasepool release]; + pollTimer.start(); + return foundConfigurations; +} + +QString QCoreWlanEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QCoreWlanEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QCoreWlanEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QCoreWlanEngine::connectToId(const QString &id) +{ + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + QString interfaceString = getInterfaceFromId(id); + + if(networkInterfaces.value(interfaceString) == "WLAN") { +#if defined(MAC_SDK_10_6) + CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; + CWConfiguration *userConfig = [ wifiInterface configuration]; + + NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile + + NSEnumerator *enumerator = [remNets objectEnumerator]; + CWWirelessProfile *wProfile; + NSUInteger index=0; + while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile + + if(id == nsstringToQString([wProfile ssid])) { + CW8021XProfile *user8021XProfile = nil; + user8021XProfile = [ wProfile user8021XProfile]; + + NSError *err = nil; + NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; + + if(user8021XProfile) { + [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; + } else { + [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; + } + + NSDictionary *parametersDict = nil; + NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { + CWNetwork *apNetwork = [apArray objectAtIndex:row]; + if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { + bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; + if(!result) { + qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); + emit connectionError(id, ConnectError); + } else { + [autoreleasepool release]; + return; + } + } + } + } + } + index++; + } + emit connectionError(id, InterfaceLookupError); +#endif + } else { + // not wifi + } + emit connectionError(id, OperationNotSupported); + [autoreleasepool release]; +} + +void QCoreWlanEngine::disconnectFromId(const QString &id) +{ + QString interfaceString = getInterfaceFromId(id); + if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now +#if defined(MAC_SDK_10_6) + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; + [wifiInterface disassociate]; + if([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) { + emit connectionError(id, DisconnectionError); + } + [autoreleasepool release]; + return; +#endif + } else { + + } + emit connectionError(id, OperationNotSupported); +} + +void QCoreWlanEngine::requestUpdate() +{ + getAllScInterfaces(); + emit configurationsChanged(); +} + +QCoreWlanEngine *QCoreWlanEngine::instance() +{ + return coreWlanEngine(); +} + +QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) +{ + QList foundConfigs; +#if defined(MAC_SDK_10_6) + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; + NSError *err = nil; + NSDictionary *parametersDict = nil; + NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { + CWNetwork *apNetwork = [apArray objectAtIndex:row]; + QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QString networkSsid = nsstringToQString([apNetwork ssid]); + cpPriv->name = networkSsid; + cpPriv->isValid = true; + cpPriv->id = networkSsid; + cpPriv->internet = true; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); + + CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; + CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; + if(!userNetworkProfile) { + } else { + qWarning() <<"Has profile!" ; + } + + if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { + QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); + if( cpPriv->name == interfaceSsidString) { + cpPriv->state |= QNetworkConfiguration::Active; + } + } else { + if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { + cpPriv->state = QNetworkConfiguration::Discovered; + } else { + cpPriv->state = QNetworkConfiguration::Defined; + } + } + if(!cpPriv->state) { + cpPriv->state = QNetworkConfiguration::Undefined; + } + if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + else + cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + foundConfigs.append(cpPriv); + } + } else { + qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) + < QCoreWlanEngine::getWlanProfiles(const QString &interfaceName) +{ + Q_UNUSED(interfaceName) +#if defined(MAC_SDK_10_6) +// for( CW8021XProfile *each8021XProfile in [CW8021XProfile allUser8021XProfiles] ) { +// qWarning() << "Profile name" << nsstringToQString([each8021XProfile ssid]); +// } + +#endif + return QList (); +} + +bool QCoreWlanEngine::getAllScInterfaces() +{ + networkInterfaces.clear(); + NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; + + CFArrayRef interfaces = SCNetworkInterfaceCopyAll(); + if (interfaces != NULL) { + CFIndex interfaceCount; + CFIndex interfaceIndex; + interfaceCount = CFArrayGetCount(interfaces); + for (interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++) { + + CFStringRef bsdName; + CFTypeRef thisInterface = CFArrayGetValueAtIndex(interfaces, interfaceIndex); + bsdName = SCNetworkInterfaceGetBSDName((SCNetworkInterfaceRef)thisInterface); + QString interfaceName = cfstringRefToQstring(bsdName); + QString typeStr; + CFStringRef type = SCNetworkInterfaceGetInterfaceType((SCNetworkInterfaceRef)thisInterface); + if ( CFEqual(type, kSCNetworkInterfaceTypeIEEE80211)) { + typeStr = "WLAN"; +// } else if (CFEqual(type, kSCNetworkInterfaceTypeBluetooth)) { +// typeStr = "Bluetooth"; + } else if(CFEqual(type, kSCNetworkInterfaceTypeEthernet)) { + typeStr = "Ethernet"; + } else if(CFEqual(type, kSCNetworkInterfaceTypeFireWire)) { + typeStr = "Ethernet"; //ok a bit fudged + } + if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) { + networkInterfaces.insert(interfaceName,typeStr); + } + } + } + CFRelease(interfaces); + + [autoreleasepool release]; + return true; +} + +QT_END_NAMESPACE -- cgit v0.12 From 19e64169b8f3b0b0c12d99327e8c68c5c8a26498 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 7 Dec 2009 16:03:38 +1000 Subject: Remove debug. --- src/network/bearer/qbearerplugin.cpp | 1 - src/plugins/bearer/corewlan/main.cpp | 4 ---- src/plugins/bearer/generic/main.cpp | 4 ---- src/plugins/bearer/nativewifi/main.cpp | 4 ---- src/plugins/bearer/networkmanager/main.cpp | 4 ---- src/plugins/bearer/nla/main.cpp | 4 ---- 6 files changed, 21 deletions(-) diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 252ee71..7b81b13 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -48,7 +48,6 @@ QT_BEGIN_NAMESPACE QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent) : QObject(parent) { - qDebug() << Q_FUNC_INFO; } QBearerEnginePlugin::~QBearerEnginePlugin() diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index c0d1efe..ce0611e 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -67,15 +67,11 @@ QCoreWlanEnginePlugin::~QCoreWlanEnginePlugin() QStringList QCoreWlanEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("corewlan"); } QBearerEngine *QCoreWlanEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("corewlan")) return new QCoreWlanEngine; else diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index c877fce..a7df023 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -67,15 +67,11 @@ QGenericEnginePlugin::~QGenericEnginePlugin() QStringList QGenericEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("generic"); } QBearerEngine *QGenericEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("generic")) return new QGenericEngine; else diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 2aced02..64ed73d 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -108,15 +108,11 @@ QNativeWifiEnginePlugin::~QNativeWifiEnginePlugin() QStringList QNativeWifiEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("nativewifi"); } QBearerEngine *QNativeWifiEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key != QLatin1String("nativewifi")) return 0; diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index c79fe91..d4b74a1 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -67,15 +67,11 @@ QNetworkManagerEnginePlugin::~QNetworkManagerEnginePlugin() QStringList QNetworkManagerEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("networkmanager"); } QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("networkmanager")) return new QNmWifiEngine; else diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp index f0d36c4..541d2c5 100644 --- a/src/plugins/bearer/nla/main.cpp +++ b/src/plugins/bearer/nla/main.cpp @@ -67,15 +67,11 @@ QNlaEnginePlugin::~QNlaEnginePlugin() QStringList QNlaEnginePlugin::keys() const { - qDebug() << Q_FUNC_INFO; - return QStringList() << QLatin1String("nla"); } QBearerEngine *QNlaEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("nla")) return new QNlaEngine; else -- cgit v0.12 From 63d59200884a68e569cce9d0ee470447b8239f6b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 7 Dec 2009 16:11:11 +1000 Subject: Convert generic engine plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager.cpp | 66 +++-- src/network/bearer/qnetworkconfigmanager_p.cpp | 318 +++++---------------- src/network/bearer/qnetworkconfigmanager_p.h | 70 +---- src/network/bearer/qnetworkconfiguration_p.h | 3 +- src/network/bearer/qnetworksessionengine.cpp | 11 + src/network/bearer/qnetworksessionengine_p.h | 23 +- src/plugins/bearer/generic/qgenericengine.cpp | 149 ++++++---- src/plugins/bearer/generic/qgenericengine.h | 4 +- .../bearer/networkmanager/qnmwifiengine.cpp | 8 +- src/plugins/bearer/networkmanager/qnmwifiengine.h | 4 +- 10 files changed, 266 insertions(+), 390 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 02cc652..6c0b17d 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -45,6 +45,7 @@ #include "qnetworkconfigmanager_s60_p.h" #else #include "qnetworkconfigmanager_p.h" +#include "qnetworksessionengine_p.h" #endif QT_BEGIN_NAMESPACE @@ -234,28 +235,31 @@ QList QNetworkConfigurationManager::allConfigurations(QNe { QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - - //find all InternetAccessPoints - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - result << pt; + + foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + QStringList cpsIdents = engine->accessPointConfigurations.keys(); + + //find all InternetAccessPoints + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + engine->accessPointConfigurations.value(ii); + if ((p->state & filter) == filter) { + QNetworkConfiguration pt; + pt.d = engine->accessPointConfigurations.value(ii); + result << pt; + } } - } - //find all service networks - cpsIdents = conPriv->snapConfigurations.keys(); - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->snapConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->snapConfigurations.value(ii); - result << pt; + //find all service networks + cpsIdents = engine->snapConfigurations.keys(); + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + engine->snapConfigurations.value(ii); + if ((p->state & filter) == filter) { + QNetworkConfiguration pt; + pt.d = engine->snapConfigurations.value(ii); + result << pt; + } } } @@ -271,15 +275,23 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier(const QString& identifier) const { QNetworkConfigurationManagerPrivate* conPriv = connManager(); + QNetworkConfiguration item; - if (conPriv->accessPointConfigurations.contains(identifier)) - item.d = conPriv->accessPointConfigurations.value(identifier); - else if (conPriv->snapConfigurations.contains(identifier)) - item.d = conPriv->snapConfigurations.value(identifier); - else if (conPriv->userChoiceConfigurations.contains(identifier)) - item.d = conPriv->userChoiceConfigurations.value(identifier); - return item; + foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + if (engine->accessPointConfigurations.contains(identifier)) + item.d = engine->accessPointConfigurations.value(identifier); + else if (engine->snapConfigurations.contains(identifier)) + item.d = engine->snapConfigurations.value(identifier); + else if (engine->userChoiceConfigurations.contains(identifier)) + item.d = engine->userChoiceConfigurations.value(identifier); + else + continue; + + return item; + } + + return item; } /*! diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index f8e0d7b..09714e5 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -53,50 +53,34 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) +QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() +{ + while (!sessionEngines.isEmpty()) + delete sessionEngines.takeFirst(); +} + void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() { capFlags = QNetworkConfigurationManager::ForcedRoaming; } -void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivate *cpPriv, QNetworkSessionEngine *engine) +void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { - QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); - - ptr.data()->isValid = cpPriv->isValid; - ptr.data()->name = cpPriv->name; - ptr.data()->id = cpPriv->id; - ptr.data()->state = cpPriv->state; - ptr.data()->type = cpPriv->type; - ptr.data()->roamingSupported = cpPriv->roamingSupported; - ptr.data()->purpose = cpPriv->purpose; - ptr.data()->internet = cpPriv->internet; - - accessPointConfigurations.insert(cpPriv->id, ptr); - configurationEngine.insert(cpPriv->id, engine); - if (!firstUpdate) { QNetworkConfiguration item; item.d = ptr; emit configurationAdded(item); } - if (ptr.data()->state == QNetworkConfiguration::Active) { + if (ptr->state == QNetworkConfiguration::Active) { ++onlineConfigurations; if (!firstUpdate && onlineConfigurations == 1) emit onlineStateChanged(true); } } -void QNetworkConfigurationManagerPrivate::configurationRemoved(const QString &id) +void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigurationPrivatePointer ptr) { - if (!accessPointConfigurations.contains(id)) - return; - - QExplicitlySharedDataPointer ptr = - accessPointConfigurations.take(id); - - configurationEngine.remove(id); - ptr.data()->isValid = false; if (!firstUpdate) { @@ -112,57 +96,34 @@ void QNetworkConfigurationManagerPrivate::configurationRemoved(const QString &id } } -void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivate *cpPriv) +void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivatePointer ptr) { - if (!accessPointConfigurations.contains(cpPriv->id)) - return; - - QExplicitlySharedDataPointer ptr = - accessPointConfigurations.value(cpPriv->id); - - if (ptr.data()->isValid != cpPriv->isValid || - ptr.data()->name != cpPriv->name || - ptr.data()->id != cpPriv->id || - ptr.data()->state != cpPriv->state || - ptr.data()->type != cpPriv->type || - ptr.data()->roamingSupported != cpPriv->roamingSupported || - ptr.data()->purpose != cpPriv->purpose || - ptr.data()->internet != cpPriv->internet) { - - const QNetworkConfiguration::StateFlags oldState = ptr.data()->state; - - ptr.data()->isValid = cpPriv->isValid; - ptr.data()->name = cpPriv->name; - ptr.data()->id = cpPriv->id; - ptr.data()->state = cpPriv->state; - ptr.data()->type = cpPriv->type; - ptr.data()->roamingSupported = cpPriv->roamingSupported; - ptr.data()->purpose = cpPriv->purpose; - ptr.data()->internet = cpPriv->internet; + if (!firstUpdate) { + QNetworkConfiguration item; + item.d = ptr; + emit configurationChanged(item); + } - if (!firstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationChanged(item); - } + qDebug() << "Need to recalculate online state."; + QNetworkConfiguration::StateFlags oldState = ptr->state; - if (ptr.data()->state == QNetworkConfiguration::Active && oldState != ptr.data()->state) { - // configuration went online - ++onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 1) - emit onlineStateChanged(true); - } else if (ptr.data()->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { - // configuration went offline - --onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - } + if (ptr->state == QNetworkConfiguration::Active && oldState != ptr->state) { + // configuration went online + ++onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 1) + emit onlineStateChanged(true); + } else if (ptr->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { + // configuration went offline + --onlineConfigurations; + if (!firstUpdate && onlineConfigurations == 0) + emit onlineStateChanged(false); } } void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() { - if (!snapConfigurations.contains(QLatin1String("Internet Service Network"))) { +#if 0 + if (!generic->snapConfigurations.contains(QLatin1String("Internet Service Network"))) { QNetworkConfigurationPrivate *serviceNetwork = new QNetworkConfigurationPrivate; serviceNetwork->name = tr("Internet"); serviceNetwork->isValid = true; @@ -172,7 +133,7 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() QExplicitlySharedDataPointer ptr(serviceNetwork); - snapConfigurations.insert(serviceNetwork->id, ptr); + generic->snapConfigurations.insert(serviceNetwork->id, ptr); if (!firstUpdate) { QNetworkConfiguration item; @@ -182,15 +143,15 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() } QExplicitlySharedDataPointer ptr = - snapConfigurations.value(QLatin1String("Internet Service Network")); + generic->snapConfigurations.value(QLatin1String("Internet Service Network")); QList > serviceNetworkMembers; QHash >::const_iterator i = - accessPointConfigurations.constBegin(); + generic->accessPointConfigurations.constBegin(); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined; - while (i != accessPointConfigurations.constEnd()) { + while (i != generic->accessPointConfigurations.constEnd()) { QExplicitlySharedDataPointer child = i.value(); if (child.data()->internet && ((child.data()->state & QNetworkConfiguration::Defined) @@ -212,186 +173,92 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() item.d = ptr; emit configurationChanged(item); } +#endif } void QNetworkConfigurationManagerPrivate::updateConfigurations() { if (firstUpdate) { - updateState = NotUpdating; onlineConfigurations = 0; QFactoryLoader *l = loader(); QStringList keys = l->keys(); -#if defined (Q_OS_DARWIN) - coreWifi = 0; if (keys.contains(QLatin1String("corewlan"))) { QBearerEnginePlugin *coreWlanPlugin = qobject_cast(l->instance(QLatin1String("corewlan"))); if (coreWlanPlugin) { - coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); + QNetworkSessionEngine *coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); if (coreWifi) { - connect(coreWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(coreWifi); } } } -#else -#ifdef BACKEND_NM - nmWifi = 0; + if (keys.contains(QLatin1String("networkmanager"))) { QBearerEnginePlugin *nmPlugin = qobject_cast(l->instance(QLatin1String("networkmanager"))); if (nmPlugin) { - nmWifi = nmPlugin->create(QLatin1String("networkmanager")); + QNetworkSessionEngine *nmWifi = nmPlugin->create(QLatin1String("networkmanager")); if (nmWifi) { - connect(nmWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(nmWifi); } } } -#endif - generic = 0; if (keys.contains(QLatin1String("generic"))) { QBearerEnginePlugin *genericPlugin = qobject_cast(l->instance(QLatin1String("generic"))); if (genericPlugin) { - generic = genericPlugin->create(QLatin1String("generic")); + QNetworkSessionEngine *generic = genericPlugin->create(QLatin1String("generic")); if (generic) { - connect(generic, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(generic); + connect(generic, SIGNAL(updateCompleted()), + this, SIGNAL(configurationUpdateComplete())); + connect(generic, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(generic, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(generic, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } -#endif -#ifdef Q_OS_WIN - nla = 0; if (keys.contains(QLatin1String("nla"))) { QBearerEnginePlugin *nlaPlugin = qobject_cast(l->instance(QLatin1String("nla"))); if (nlaPlugin) { - qDebug() << "creating nla backend"; - nla = nlaPlugin->create(QLatin1String("nla")); + QNetworkSessionEngine *nla = nlaPlugin->create(QLatin1String("nla")); if (nla) { - connect(nla, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(nla); } } } -#endif -#ifdef Q_OS_WIN32 - nativeWifi = 0; if (keys.contains(QLatin1String("nativewifi"))) { QBearerEnginePlugin *nativeWifiPlugin = qobject_cast(l->instance(QLatin1String("nativewifi"))); if (nativeWifiPlugin) { - qDebug() << "Creating native wifi backend"; - nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); + QNetworkSessionEngine *nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); if (nativeWifi) { - connect(nativeWifi, SIGNAL(configurationsChanged()), - this, SLOT(updateConfigurations())); + sessionEngines.append(nativeWifi); capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; } } } -#endif } QNetworkSessionEngine *engine = qobject_cast(sender()); - if (updateState & Updating && engine) { -#if defined (Q_OS_DARWIN) - if (engine == coreWifi) - updateState &= ~CoreWifiUpdating; -#else -#if defined(BACKEND_NM) - if (engine == nmWifi) - updateState &= ~NmUpdating; - if (engine == generic) - updateState &= ~GenericUpdating; -#else - if (engine == generic) - updateState &= ~GenericUpdating; -#endif -#endif - -#ifdef Q_OS_WIN - else if (engine == nla) - updateState &= ~NlaUpdating; -#ifdef Q_OS_WIN32 - else if (engine == nativeWifi) - updateState &= ~NativeWifiUpdating; -#endif -#endif - } - QList engines; - if (firstUpdate) { -#if defined (Q_OS_DARWIN) - if (coreWifi) - engines << coreWifi; -#else -#if defined(BACKEND_NM) - if (nmWifi) - engines << nmWifi; - if (generic) - engines << generic; -#else - if (generic) - engines << generic; -#endif -#endif - -#ifdef Q_OS_WIN - if (nla) - engines << nla; -#ifdef Q_OS_WIN32 - if (nativeWifi) - engines << nativeWifi; -#endif -#endif - } else if (engine) { - engines << engine; - } - - while (!engines.isEmpty()) { - engine = engines.takeFirst(); - - bool ok; - QList foundConfigurations = engine->getConfigurations(&ok); - - // Find removed configurations. - QList removedIdentifiers = configurationEngine.keys(); - for (int i = 0; i < foundConfigurations.count(); ++i) - removedIdentifiers.removeOne(foundConfigurations.at(i)->id); - - // Update or add configurations. - while (!foundConfigurations.isEmpty()) { - QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst(); - - if (accessPointConfigurations.contains(cpPriv->id)) - configurationChanged(cpPriv); - else - configurationAdded(cpPriv, engine); - - delete cpPriv; - } - - // Remove configurations. - while (!removedIdentifiers.isEmpty()) { - const QString id = removedIdentifiers.takeFirst(); - - if (configurationEngine.value(id) == engine) - configurationRemoved(id); - } + if (!updatingEngines.isEmpty() && engine) { + int index = sessionEngines.indexOf(engine); + if (index >= 0) + updatingEngines.remove(index); } - updateInternetServiceConfiguration(); - - if (updateState == Updating) { - updateState = NotUpdating; + if (updating && updatingEngines.isEmpty()) { + updating = false; emit configurationUpdateComplete(); } @@ -407,22 +274,25 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - QExplicitlySharedDataPointer firstActive; - QExplicitlySharedDataPointer firstDiscovered; + QNetworkConfigurationPrivatePointer firstActive; + QNetworkConfigurationPrivatePointer firstDiscovered; - QHash >::const_iterator i = - accessPointConfigurations.constBegin(); - while (i != accessPointConfigurations.constEnd()) { - QNetworkConfigurationPrivate *priv = i.value().data(); + foreach (QNetworkSessionEngine *engine, sessionEngines) { + QHash::const_iterator i = + engine->accessPointConfigurations.constBegin(); - if (!firstActive && priv->isValid && - (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) - firstActive = i.value(); - if (!firstDiscovered && priv->isValid && - (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) - firstDiscovered = i.value(); + while (i != engine->accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer priv = i.value(); - ++i; + if (!firstActive && priv->isValid && + (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) + firstActive = priv; + if (!firstDiscovered && priv->isValid && + (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) + firstDiscovered = priv; + + ++i; + } } QNetworkConfiguration item; @@ -437,42 +307,12 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() { - updateState = Updating; -#if defined (Q_OS_DARWIN) - if (coreWifi) { - updateState |= CoreWifiUpdating; - coreWifi->requestUpdate(); - } -#else -#if defined(BACKEND_NM) - if (nmWifi) { - updateState |= NmUpdating; - nmWifi->requestUpdate(); - } - if (generic) { - updateState |= GenericUpdating; - generic->requestUpdate(); - } -#else - if (generic) { - updateState |= GenericUpdating; - generic->requestUpdate(); - } -#endif -#endif -#ifdef Q_OS_WIN - if (nla) { - updateState |= NlaUpdating; - nla->requestUpdate(); - } -#endif + updating = true; -#ifdef Q_OS_WIN32 - if (nativeWifi) { - updateState |= NativeWifiUpdating; - nativeWifi->requestUpdate(); + for (int i = 0; i < sessionEngines.count(); ++i) { + updatingEngines.insert(i); + sessionEngines.at(i)->requestUpdate(); } -#endif } QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 95358bc..27a0252 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -56,20 +56,9 @@ #include "qnetworkconfigmanager.h" #include "qnetworkconfiguration_p.h" -#include -#include - QT_BEGIN_NAMESPACE -#ifdef BEARER_ENGINE class QNetworkSessionEngine; -class QGenericEngine; -class QNlaEngine; -class QNativeWifiEngine; -class QNmWifiEngine; -class QCoreWlanEngine; -#endif - class QNetworkConfigurationManagerPrivate : public QObject { @@ -82,22 +71,7 @@ public: updateConfigurations(); } - virtual ~QNetworkConfigurationManagerPrivate() - { - QList configIdents = snapConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = accessPointConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - } + virtual ~QNetworkConfigurationManagerPrivate(); QNetworkConfiguration defaultConfiguration(); @@ -106,12 +80,6 @@ public: void performAsyncConfigurationUpdate(); - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash > accessPointConfigurations; - QHash > snapConfigurations; - QHash > userChoiceConfigurations; #ifdef BEARER_ENGINE QHash configurationEngine; #endif @@ -135,41 +103,21 @@ private: #endif #ifdef BEARER_ENGINE - QNetworkSessionEngine *generic; -#ifdef Q_OS_WIN - QNetworkSessionEngine *nla; -#ifndef Q_OS_WINCE - QNetworkSessionEngine *nativeWifi; -#endif -#endif -#ifdef BACKEND_NM - QNetworkSessionEngine *nmWifi; -#endif -#ifdef Q_OS_DARWIN - QNetworkSessionEngine *coreWifi; -#endif +public: + QList sessionEngines; +private: uint onlineConfigurations; - enum EngineUpdate { - NotUpdating = 0x00, - Updating = 0x01, - GenericUpdating = 0x02, - NlaUpdating = 0x04, - NativeWifiUpdating = 0x08, - NmUpdating = 0x20, - CoreWifiUpdating = 0x40, - }; - Q_DECLARE_FLAGS(EngineUpdateState, EngineUpdate) - - EngineUpdateState updateState; + bool updating; + QSet updatingEngines; #endif private Q_SLOTS: #ifdef BEARER_ENGINE - void configurationAdded(QNetworkConfigurationPrivate *cpPriv, QNetworkSessionEngine *engine); - void configurationRemoved(const QString &id); - void configurationChanged(QNetworkConfigurationPrivate *cpPriv); + void configurationAdded(QNetworkConfigurationPrivatePointer ptr); + void configurationRemoved(QNetworkConfigurationPrivatePointer ptr); + void configurationChanged(QNetworkConfigurationPrivatePointer ptr); #endif }; diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index f00bcfa..8e69248 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -59,6 +59,7 @@ QT_BEGIN_NAMESPACE +typedef QExplicitlySharedDataPointer QNetworkConfigurationPrivatePointer; class QNetworkConfigurationPrivate : public QSharedData { public: @@ -89,7 +90,7 @@ public: bool internet; #endif - QList > serviceNetworkMembers; + QList serviceNetworkMembers; QNetworkInterface serviceInterface; private: diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp index 9e6839e..0aa9d19 100644 --- a/src/network/bearer/qnetworksessionengine.cpp +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -50,6 +50,17 @@ QNetworkSessionEngine::QNetworkSessionEngine(QObject *parent) QNetworkSessionEngine::~QNetworkSessionEngine() { + foreach (const QString &oldIface, snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + foreach (const QString &oldIface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } } #include "moc_qnetworksessionengine_p.cpp" diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 9fbd4ac..0145976 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -53,14 +53,19 @@ // We mean it. // +#include "qnetworkconfiguration_p.h" + #include #include #include #include +#include +#include QT_BEGIN_NAMESPACE -class QNetworkConfigurationPrivate; +class QNetworkConfiguration; + class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject { Q_OBJECT @@ -76,7 +81,6 @@ public: QNetworkSessionEngine(QObject *parent = 0); virtual ~QNetworkSessionEngine(); - virtual QList getConfigurations(bool *ok = 0) = 0; virtual QString getInterfaceFromId(const QString &id) = 0; virtual bool hasIdentifier(const QString &id) = 0; @@ -87,8 +91,21 @@ public: virtual void requestUpdate() = 0; +public: + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash accessPointConfigurations; + QHash snapConfigurations; + QHash userChoiceConfigurations; + Q_SIGNALS: - void configurationsChanged(); + void configurationAdded(QNetworkConfigurationPrivatePointer config); + void configurationRemoved(QNetworkConfigurationPrivatePointer config); + void configurationChanged(QNetworkConfigurationPrivatePointer config); + + void updateCompleted(); + void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); }; diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 4be27ba..11dfb3e 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -125,21 +125,58 @@ static QString qGetInterfaceType(const QString &interface) QGenericEngine::QGenericEngine(QObject *parent) : QNetworkSessionEngine(parent) { - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); + doRequestUpdate(); } QGenericEngine::~QGenericEngine() { } -QList QGenericEngine::getConfigurations(bool *ok) +QString QGenericEngine::getInterfaceFromId(const QString &id) +{ + return configurationInterface.value(id.toUInt()); +} + +bool QGenericEngine::hasIdentifier(const QString &id) +{ + return configurationInterface.contains(id.toUInt()); +} + +QString QGenericEngine::bearerName(const QString &id) +{ + QString interface = getInterfaceFromId(id); + + if (interface.isEmpty()) + return QString(); + + return qGetInterfaceType(interface); +} + +void QGenericEngine::connectToId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::disconnectFromId(const QString &id) +{ + emit connectionError(id, OperationNotSupported); +} + +void QGenericEngine::requestUpdate() { - if (ok) - *ok = true; + pollTimer.stop(); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} - QList foundConfigurations; +QGenericEngine *QGenericEngine::instance() +{ + return genericEngine(); +} +void QGenericEngine::doRequestUpdate() +{ // Immediately after connecting with a wireless access point // QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a // second time results in a non-empty list. If we loose interfaces we will end up removing @@ -148,6 +185,8 @@ QList QGenericEngine::getConfigurations(bool *ok if (interfaces.isEmpty()) interfaces = QNetworkInterface::allInterfaces(); + QStringList previous = accessPointConfigurations.keys(); + // create configuration for each interface while (!interfaces.isEmpty()) { QNetworkInterface interface = interfaces.takeFirst(); @@ -163,71 +202,77 @@ QList QGenericEngine::getConfigurations(bool *ok if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) continue; - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - const QString humanReadableName = interface.humanReadableName(); - cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; - cpPriv->isValid = true; - uint identifier; if (interface.index()) - identifier = qHash(QLatin1String("NLA:") + QString::number(interface.index())); + identifier = qHash(QLatin1String("generic:") + QString::number(interface.index())); else - identifier = qHash(QLatin1String("NLA:") + interface.hardwareAddress()); + identifier = qHash(QLatin1String("generic:") + interface.hardwareAddress()); + + const QString id = QString::number(identifier); - cpPriv->id = QString::number(identifier); - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + previous.removeAll(id); + + QString name = interface.humanReadableName(); + if (name.isEmpty()) + name = interface.name(); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Discovered; if (interface.flags() & QNetworkInterface::IsUp) - cpPriv->state |= QNetworkConfiguration::Active; + state |= QNetworkConfiguration::Active; - configurationInterface[identifier] = interface.name(); + if (accessPointConfigurations.contains(id)) { + QExplicitlySharedDataPointer ptr = + accessPointConfigurations.value(id); - foundConfigurations.append(cpPriv); - } + bool changed = false; - pollTimer.start(); + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } - return foundConfigurations; -} + if (ptr->name != name) { + ptr->name = name; + changed = true; + } -QString QGenericEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id.toUInt()); -} + if (ptr->id != id) { + ptr->id = id; + changed = true; + } -bool QGenericEngine::hasIdentifier(const QString &id) -{ - return configurationInterface.contains(id.toUInt()); -} + if (ptr->state != state) { + ptr->state = state; + changed = true; + } -QString QGenericEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); + if (changed) + emit configurationChanged(ptr); + } else { + QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); - if (interface.isEmpty()) - return QString(); + ptr->name = name; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; - return qGetInterfaceType(interface); -} + accessPointConfigurations.insert(id, ptr); -void QGenericEngine::connectToId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} + emit configurationAdded(ptr); + } + } -void QGenericEngine::disconnectFromId(const QString &id) -{ - emit connectionError(id, OperationNotSupported); -} + while (!previous.isEmpty()) { + QExplicitlySharedDataPointer ptr = + accessPointConfigurations.take(previous.takeFirst()); -void QGenericEngine::requestUpdate() -{ - emit configurationsChanged(); -} + emit configurationRemoved(ptr); + } -QGenericEngine *QGenericEngine::instance() -{ - return genericEngine(); + pollTimer.start(); + + emit updateCompleted(); } QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 9923a9b..62f964a 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -59,7 +59,6 @@ public: QGenericEngine(QObject *parent = 0); ~QGenericEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -72,6 +71,9 @@ public: static QGenericEngine *instance(); +private Q_SLOTS: + void doRequestUpdate(); + private: QMap configurationInterface; QTimer pollTimer; diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp index 4a814ec..b215023 100644 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp +++ b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp @@ -112,7 +112,7 @@ QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *d } -QList QNmWifiEngine::getConfigurations(bool *ok) +QList QNmWifiEngine::getConfigurations(bool *ok) { // qWarning() << Q_FUNC_INFO << updated; if (ok) @@ -133,7 +133,7 @@ QList QNmWifiEngine::getConfigurations(bool *ok) //add access points updated = true; } - return foundConfigurations; + return QList(); //foundConfigurations; } void QNmWifiEngine::findConnections() @@ -411,7 +411,7 @@ bool QNmWifiEngine::hasIdentifier(const QString &id) { if (configurationInterface.contains(id)) return true; - foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { + foreach (QNetworkConfigurationPrivatePointer cpPriv, getConfigurations()) { if (cpPriv->id == id) return true; } @@ -506,7 +506,7 @@ void QNmWifiEngine::requestUpdate() updated = false; knownSsids.clear(); availableAccessPoints.clear(); - emitConfigurationsChanged(); + //emitConfigurationsChanged(); } QNmWifiEngine *QNmWifiEngine::instance() diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.h b/src/plugins/bearer/networkmanager/qnmwifiengine.h index 4d514e7..d651ef4 100644 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.h +++ b/src/plugins/bearer/networkmanager/qnmwifiengine.h @@ -80,7 +80,7 @@ public: QNmWifiEngine(QObject *parent = 0); ~QNmWifiEngine(); - QList getConfigurations(bool *ok = 0); + QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -94,7 +94,7 @@ public: static QNmWifiEngine *instance(); QStringList knownSsids; - inline void emitConfigurationsChanged() { emit configurationsChanged(); } + //inline void emitConfigurationsChanged() { emit configurationsChanged(); } QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); QStringList getConnectionPathForId(const QString &uuid); -- cgit v0.12 From ee8b1156400791a077280138863336ea93a774a7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 9 Dec 2009 16:49:06 +1000 Subject: Keep track of which QNetworkInterface is for each QNetworkConfiguration. --- src/plugins/bearer/generic/qgenericengine.cpp | 6 ++++-- src/plugins/bearer/generic/qgenericengine.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 11dfb3e..e70d23d 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -136,12 +136,12 @@ QGenericEngine::~QGenericEngine() QString QGenericEngine::getInterfaceFromId(const QString &id) { - return configurationInterface.value(id.toUInt()); + return configurationInterface.value(id); } bool QGenericEngine::hasIdentifier(const QString &id) { - return configurationInterface.contains(id.toUInt()); + return configurationInterface.contains(id); } QString QGenericEngine::bearerName(const QString &id) @@ -258,6 +258,7 @@ void QGenericEngine::doRequestUpdate() ptr->type = QNetworkConfiguration::InternetAccessPoint; accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interface.name()); emit configurationAdded(ptr); } @@ -267,6 +268,7 @@ void QGenericEngine::doRequestUpdate() QExplicitlySharedDataPointer ptr = accessPointConfigurations.take(previous.takeFirst()); + configurationInterface.remove(ptr->id); emit configurationRemoved(ptr); } diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 62f964a..32d762d 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -75,7 +75,7 @@ private Q_SLOTS: void doRequestUpdate(); private: - QMap configurationInterface; + QMap configurationInterface; QTimer pollTimer; }; -- cgit v0.12 From 7858758772ad01e6a772cb048e4f1eda7f4ec9c3 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 9 Dec 2009 15:44:52 +1000 Subject: Rework NetworkManager backend. --- src/network/bearer/qnetworkconfigmanager.cpp | 2 + src/network/bearer/qnetworkconfigmanager_p.cpp | 47 +- src/network/bearer/qnetworkconfigmanager_p.h | 5 +- src/network/bearer/qnetworksession_p.cpp | 30 +- src/network/bearer/qnetworksessionengine_p.h | 3 + src/plugins/bearer/generic/qgenericengine.cpp | 26 +- src/plugins/bearer/generic/qgenericengine.h | 2 + src/plugins/bearer/networkmanager/main.cpp | 4 +- .../bearer/networkmanager/networkmanager.pro | 4 +- .../networkmanager/qnetworkmanagerengine.cpp | 654 ++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 125 +++ .../networkmanager/qnetworkmanagerservice.cpp | 6 +- .../bearer/networkmanager/qnetworkmanagerservice.h | 4 +- .../bearer/networkmanager/qnmdbushelper.cpp | 3 + src/plugins/bearer/networkmanager/qnmdbushelper.h | 14 - .../bearer/networkmanager/qnmwifiengine.cpp | 1128 -------------------- src/plugins/bearer/networkmanager/qnmwifiengine.h | 165 --- 17 files changed, 863 insertions(+), 1359 deletions(-) create mode 100644 src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp create mode 100644 src/plugins/bearer/networkmanager/qnetworkmanagerengine.h delete mode 100644 src/plugins/bearer/networkmanager/qnmwifiengine.cpp delete mode 100644 src/plugins/bearer/networkmanager/qnmwifiengine.h diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 6c0b17d..6b73e3c 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -48,6 +48,8 @@ #include "qnetworksessionengine_p.h" #endif +#include + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 09714e5..6f833f3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -73,15 +73,15 @@ void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurati } if (ptr->state == QNetworkConfiguration::Active) { - ++onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 1) + onlineConfigurations.insert(ptr); + if (!firstUpdate && onlineConfigurations.count() == 1) emit onlineStateChanged(true); } } void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigurationPrivatePointer ptr) { - ptr.data()->isValid = false; + ptr->isValid = false; if (!firstUpdate) { QNetworkConfiguration item; @@ -89,11 +89,9 @@ void QNetworkConfigurationManagerPrivate::configurationRemoved(QNetworkConfigura emit configurationRemoved(item); } - if (ptr.data()->state == QNetworkConfiguration::Active) { - --onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - } + onlineConfigurations.remove(ptr); + if (!firstUpdate && onlineConfigurations.isEmpty()) + emit onlineStateChanged(false); } void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivatePointer ptr) @@ -104,20 +102,17 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura emit configurationChanged(item); } - qDebug() << "Need to recalculate online state."; - QNetworkConfiguration::StateFlags oldState = ptr->state; + bool previous = !onlineConfigurations.isEmpty(); - if (ptr->state == QNetworkConfiguration::Active && oldState != ptr->state) { - // configuration went online - ++onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 1) - emit onlineStateChanged(true); - } else if (ptr->state != QNetworkConfiguration::Active && oldState == QNetworkConfiguration::Active) { - // configuration went offline - --onlineConfigurations; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - } + if (ptr->state == QNetworkConfiguration::Active) + onlineConfigurations.insert(ptr); + else + onlineConfigurations.remove(ptr); + + bool online = !onlineConfigurations.isEmpty(); + + if (!firstUpdate && online != previous) + emit onlineStateChanged(online); } void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() @@ -179,7 +174,7 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() void QNetworkConfigurationManagerPrivate::updateConfigurations() { if (firstUpdate) { - onlineConfigurations = 0; + updating = false; QFactoryLoader *l = loader(); QStringList keys = l->keys(); @@ -202,6 +197,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QNetworkSessionEngine *nmWifi = nmPlugin->create(QLatin1String("networkmanager")); if (nmWifi) { sessionEngines.append(nmWifi); + connect(nmWifi, SIGNAL(updateCompleted()), + this, SIGNAL(configurationUpdateComplete())); + connect(nmWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(nmWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(nmWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 27a0252..37e88d3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -80,9 +80,6 @@ public: void performAsyncConfigurationUpdate(); -#ifdef BEARER_ENGINE - QHash configurationEngine; -#endif bool firstUpdate; public slots: @@ -107,7 +104,7 @@ public: QList sessionEngines; private: - uint onlineConfigurations; + QSet onlineConfigurations; bool updating; QSet updatingEngines; diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index df0ad3e..8421fbc 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -56,9 +56,10 @@ static QNetworkSessionEngine *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - QNetworkSessionEngine *engine = priv->configurationEngine.value(id); - if (engine && engine->hasIdentifier(id)) - return engine; + foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { + if (engine->hasIdentifier(id)) + return engine; + } return 0; } @@ -104,6 +105,7 @@ void QNetworkSessionPrivate::syncStateWithInterface() this, SLOT(forcedSessionClose(QNetworkConfiguration))); opened = false; + isActive = false; state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; @@ -341,6 +343,7 @@ void QNetworkSessionPrivate::updateStateFromServiceNetwork() } state = QNetworkSession::Connected; + qDebug() << oldState << "->" << state; if (state != oldState) emit q->stateChanged(state); @@ -352,31 +355,22 @@ void QNetworkSessionPrivate::updateStateFromServiceNetwork() else state = QNetworkSession::Disconnected; + qDebug() << oldState << "->" << state; if (state != oldState) emit q->stateChanged(state); } void QNetworkSessionPrivate::updateStateFromActiveConfig() { - QNetworkSession::State oldState = state; + if (!engine) + return; - bool newActive = false; + QNetworkSession::State oldState = state; - if (!activeConfig.isValid()) { - state = QNetworkSession::Invalid; - } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Connected; - newActive = opened; - } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - state = QNetworkSession::Disconnected; - } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { - state = QNetworkSession::NotAvailable; - } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { - state = QNetworkSession::NotAvailable; - } + state = engine->sessionStateForId(activeConfig.identifier()); bool oldActive = isActive; - isActive = newActive; + isActive = (state == QNetworkSession::Connected) ? opened : false; if (!oldActive && isActive) emit quitPendingWaitsForOpened(); diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 0145976..a698c40 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -54,6 +54,7 @@ // #include "qnetworkconfiguration_p.h" +#include "qnetworksession.h" #include #include @@ -91,6 +92,8 @@ public: virtual void requestUpdate() = 0; + virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index e70d23d..339ef9c 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -249,7 +249,7 @@ void QGenericEngine::doRequestUpdate() if (changed) emit configurationChanged(ptr); } else { - QExplicitlySharedDataPointer ptr(new QNetworkConfigurationPrivate); + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); ptr->name = name; ptr->isValid = true; @@ -277,5 +277,29 @@ void QGenericEngine::doRequestUpdate() emit updateCompleted(); } +QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 32d762d..9359d7f 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -69,6 +69,8 @@ public: void requestUpdate(); + QNetworkSession::State sessionStateForId(const QString &id); + static QGenericEngine *instance(); private Q_SLOTS: diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index d4b74a1..b561415 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qnmwifiengine.h" +#include "qnetworkmanagerengine.h" #include @@ -73,7 +73,7 @@ QStringList QNetworkManagerEnginePlugin::keys() const QBearerEngine *QNetworkManagerEnginePlugin::create(const QString &key) const { if (key == QLatin1String("networkmanager")) - return new QNmWifiEngine; + return new QNetworkManagerEngine; else return 0; } diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 36d150a..79c68ea 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -7,12 +7,12 @@ DEFINES += BEARER_ENGINE BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ - qnmwifiengine.h + qnetworkmanagerengine.h SOURCES += main.cpp \ qnmdbushelper.cpp \ qnetworkmanagerservice.cpp \ - qnmwifiengine.cpp + qnetworkmanagerengine.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp new file mode 100644 index 0000000..3de20a3 --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -0,0 +1,654 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnetworkmanagerengine.h" +#include "qnetworkmanagerservice.h" + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) +: QNetworkSessionEngine(parent), + interface(new QNetworkManagerInterface(this)), + systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), + userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) +{ + interface->setConnections(); + connect(interface, SIGNAL(deviceAdded(QDBusObjectPath)), + this, SLOT(deviceAdded(QDBusObjectPath))); + connect(interface, SIGNAL(deviceRemoved(QDBusObjectPath)), + this, SLOT(deviceRemoved(QDBusObjectPath))); +#if 0 + connect(interface, SIGNAL(stateChanged(const QString,quint32)), + this, SIGNAL(configurationsChanged())); +#endif + connect(interface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), + this, SLOT(activationFinished(QDBusPendingCallWatcher*))); + connect(interface, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(interfacePropertiesChanged(QString,QMap))); + + qDBusRegisterMetaType(); + + systemSettings->setConnections(); + connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)), + this, SLOT(newConnection(QDBusObjectPath))); + + userSettings->setConnections(); + connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)), + this, SLOT(newConnection(QDBusObjectPath))); + + // Get current list of access points. + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) + deviceAdded(devicePath); + + // Get connections. + foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) + newConnection(settingsPath, systemSettings); + foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) + newConnection(settingsPath, userSettings); + + // Get active connections. + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive *activeConnection = + new QNetworkManagerConnectionActive(acPath.path()); + activeConnections.insert(acPath.path(), activeConnection); + + activeConnection->setConnections(); + connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(activeConnectionPropertiesChanged(QString,QMap))); + } +} + +QNetworkManagerEngine::~QNetworkManagerEngine() +{ +} + +void QNetworkManagerEngine::doRequestUpdate() +{ +} + +QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) +{ + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' + + activeConnection.connection().path())); + + if (id == identifier) { + QList devices = activeConnection.devices(); + + if (devices.isEmpty()) + continue; + + if (devices.count() > 1) + qDebug() << "multiple network interfaces for" << id; + + QNetworkManagerInterfaceDevice device(devices.at(0).path()); + return device.interface().name(); + } + } + + return QString(); +} + +bool QNetworkManagerEngine::hasIdentifier(const QString &id) +{ + if (connectionFromId(id)) + return true; + + for (int i = 0; i < accessPoints.count(); ++i) { + QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); + + const QString identifier = + QString::number(qHash(accessPoint->connectionInterface()->path())); + + if (id == identifier) + return true; + } + + return false; +} + +QString QNetworkManagerEngine::bearerName(const QString &id) +{ + QNetworkManagerSettingsConnection *connection = connectionFromId(id); + + if (!connection) + return QString(); + + QNmSettingsMap map = connection->getSettings(); + const QString connectionType = map.value("connection").value("type").toString(); + + if (connectionType == "802-3-ethernet") + return QLatin1String("Ethernet"); + else if (connectionType == "802-11-wireless") + return QLatin1String("WLAN"); + else if (connectionType == "gsm") + return QLatin1String("2G"); + else if (connectionType == "cdma") + return QLatin1String("CDMA2000"); + else + return QString(); +} + +void QNetworkManagerEngine::connectToId(const QString &id) +{ + QNetworkManagerSettingsConnection *connection = connectionFromId(id); + + if (!connection) + return; + + QNmSettingsMap map = connection->getSettings(); + const QString connectionType = map.value("connection").value("type").toString(); + + QString dbusDevicePath; + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { + QNetworkManagerInterfaceDevice device(devicePath.path()); + if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET && + connectionType == QLatin1String("802-3-ethernet")) { + dbusDevicePath = devicePath.path(); + break; + } else if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS && + connectionType == QLatin1String("802-11-wireless")) { + dbusDevicePath = devicePath.path(); + break; + } + } + + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + interface->activateConnection(service, QDBusObjectPath(settingsPath), + QDBusObjectPath(dbusDevicePath), QDBusObjectPath("/")); +} + +void QNetworkManagerEngine::disconnectFromId(const QString &id) +{ + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' + + activeConnection.connection().path())); + + if (id == identifier && accessPointConfigurations.contains(id)) { + interface->deactivateConnection(acPath); + break; + } + } +} + +void QNetworkManagerEngine::requestUpdate() +{ + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, + const QMap &properties) +{ + QMapIterator i(properties); + while (i.hasNext()) { + i.next(); + + if (i.key() == QLatin1String("ActiveConnections")) { + // Active connections changed, update configurations. + + QList activeConnections = + qdbus_cast >(i.value().value()); + + QStringList identifiers = accessPointConfigurations.keys(); + foreach (const QString &id, identifiers) + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + QStringList priorActiveConnections = this->activeConnections.keys(); + + foreach (const QDBusObjectPath &acPath, activeConnections) { + priorActiveConnections.removeOne(acPath.path()); + QNetworkManagerConnectionActive *activeConnection = + this->activeConnections.value(acPath.path()); + if (!activeConnection) { + activeConnection = new QNetworkManagerConnectionActive(acPath.path()); + this->activeConnections.insert(acPath.path(), activeConnection); + + activeConnection->setConnections(); + connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(activeConnectionPropertiesChanged(QString,QMap))); + } + + const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' + + activeConnection->connection().path())); + + identifiers.removeOne(id); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr) { + if (activeConnection->state() == 2 && + ptr->state != QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Active; + emit configurationChanged(ptr); + } + } + } + + while (!priorActiveConnections.isEmpty()) + delete this->activeConnections.take(priorActiveConnections.takeFirst()); + + while (!identifiers.isEmpty()) { + // These configurations are not active + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(identifiers.takeFirst()); + + if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + } + } + } + } +} + +void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, + const QMap &properties) +{ + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); + + if (!activeConnection) + return; + + const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' + + activeConnection->connection().path())); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr) { + if (activeConnection->state() == 2 && + ptr->state != QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Active; + emit configurationChanged(ptr); + } + } +} + +void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) +{ + QNetworkManagerInterfaceDevice device(path.path()); + if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) { + QNetworkManagerInterfaceDeviceWireless *wirelessDevice = + new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path()); + wirelessDevices.insert(path.path(), wirelessDevice); + + wirelessDevice->setConnections(); + connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)), + this, SLOT(newAccessPoint(QString,QDBusObjectPath))); + connect(wirelessDevice, SIGNAL(accessPointRemoved(QString,QDBusObjectPath)), + this, SLOT(removeAccessPoint(QString,QDBusObjectPath))); + connect(wirelessDevice, SIGNAL(propertiesChanged(QString,QMap)), + this, SLOT(devicePropertiesChanged(QString,QMap))); + + foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints()) + newAccessPoint(QString(), apPath); + } +} + +void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path) +{ + delete wirelessDevices.value(path.path()); +} + +void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, + QNetworkManagerSettings *settings) +{ + if (!settings) + settings = qobject_cast(sender()); + + if (!settings) + return; + + QNetworkManagerSettingsConnection *connection = + new QNetworkManagerSettingsConnection(settings->connectionInterface()->service(), + path.path()); + connections.append(connection); + + connect(connection, SIGNAL(removed(QString)), this, SLOT(removeConnection(QString))); + connect(connection, SIGNAL(updated(const QNmSettingsMap&)), + this, SLOT(updateConnection(const QNmSettingsMap&))); + + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + QNetworkConfigurationPrivate *cpPriv = + parseConnection(service, settingsPath, connection->getSettings()); + + // Check if connection is active. + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + if (activeConnection.serviceName() == service && + activeConnection.connection().path() == settingsPath && + activeConnection.state() == 2) { + cpPriv->state |= QNetworkConfiguration::Active; + break; + } + } + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); +} + +void QNetworkManagerEngine::removeConnection(const QString &path) +{ + QNetworkManagerSettingsConnection *connection = + qobject_cast(sender()); + if (!connection) + return; + + connections.removeAll(connection); + + const QString id = QString::number(qHash(connection->connectionInterface()->service() + ' ' + + connection->connectionInterface()->path())); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id); + ptr->isValid = false; + emit configurationRemoved(ptr); +} + +void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) +{ + QNetworkManagerSettingsConnection *connection = + qobject_cast(sender()); + if (!connection) + return; + + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + qDebug() << "Should parse connection directly into existing configuration"; + QNetworkConfigurationPrivate *cpPriv = parseConnection(service, settingsPath, settings); + + // Check if connection is active. + foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { + QNetworkManagerConnectionActive activeConnection(acPath.path()); + + if (activeConnection.serviceName() == service && + activeConnection.connection().path() == settingsPath && + activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { + cpPriv->state |= QNetworkConfiguration::Active; + break; + } + } + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id); + + ptr->isValid = cpPriv->isValid; + ptr->name = cpPriv->name; + ptr->id = cpPriv->id; + ptr->state = cpPriv->state; + + emit configurationChanged(ptr); + delete cpPriv; +} + +void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) +{ + QDBusPendingReply reply = *watcher; + if (reply.isError()) { + qDebug() << "error connecting NM connection"; + } else { + QDBusObjectPath result = reply.value(); + + QNetworkManagerConnectionActive activeConnection(result.path()); + + const QString id = QString::number(qHash(activeConnection.serviceName() + ' ' + + activeConnection.connection().path())); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr) { + if (activeConnection.state() == 2 && + ptr->state != QNetworkConfiguration::Active) { + ptr->state = QNetworkConfiguration::Active; + emit configurationChanged(ptr); + } + } + } +} + +void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) +{ + QNetworkManagerInterfaceAccessPoint *accessPoint = + new QNetworkManagerInterfaceAccessPoint(objectPath.path()); + accessPoints.append(accessPoint); + + accessPoint->setConnections(); + connect(accessPoint, SIGNAL(propertiesChanged(QMap)), + this, SLOT(updateAccessPoint(QMap))); + + // Check if configuration for this SSID already exists. + for (int i = 0; i < accessPoints.count(); ++i) { + if (accessPoint != accessPoints.at(i) && + accessPoint->ssid() == accessPoints.at(i)->ssid()) { + return; + } + } + + // Check if configuration exists for connection. + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); + + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + return; + } + } + + // New access point. + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = accessPoint->ssid(); + ptr->isValid = true; + ptr->id = QString::number(qHash(objectPath.path())); + ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->purpose = QNetworkConfiguration::PublicPurpose; + ptr->state = QNetworkConfiguration::Undefined; + + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); +} + +void QNetworkManagerEngine::removeAccessPoint(const QString &path, + const QDBusObjectPath &objectPath) +{ + for (int i = 0; i < accessPoints.count(); ++i) { + QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); + + if (accessPoint->connectionInterface()->path() == objectPath.path()) { + accessPoints.removeOne(accessPoint); + + if (configuredAccessPoints.contains(accessPoint)) { + // find connection and change state to Defined + configuredAccessPoints.removeOne(accessPoint); + qDebug() << "At least one connection is no longer discovered."; + } else { + // emit configurationRemoved(cpPriv); + qDebug() << "An unconfigured wifi access point was removed."; + } + + break; + } + } +} + +void QNetworkManagerEngine::updateAccessPoint(const QMap &map) +{ + QNetworkManagerInterfaceAccessPoint *accessPoint = + qobject_cast(sender()); + if (!accessPoint) + return; + + qDebug() << "update access point" << accessPoint; +} + +QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &service, + const QString &settingsPath, + const QNmSettingsMap &map) +{ + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + cpPriv->name = map.value("connection").value("id").toString(); + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(service + ' ' + settingsPath)); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + + cpPriv->purpose = QNetworkConfiguration::PublicPurpose; + + cpPriv->state = QNetworkConfiguration::Defined; + + const QString connectionType = map.value("connection").value("type").toString(); + + if (connectionType == QLatin1String("802-3-ethernet")) { + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { + QNetworkManagerInterfaceDevice device(devicePath.path()); + if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET) { + QNetworkManagerInterfaceDeviceWired wiredDevice(device.connectionInterface()->path()); + if (wiredDevice.carrier()) { + cpPriv->state |= QNetworkConfiguration::Discovered; + break; + } + + } + } + } else if (connectionType == QLatin1String("802-11-wireless")) { + const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString(); + + for (int i = 0; i < accessPoints.count(); ++i) { + if (connectionSsid == accessPoints.at(i)->ssid()) { + cpPriv->state |= QNetworkConfiguration::Discovered; + if (!configuredAccessPoints.contains(accessPoints.at(i))) { + configuredAccessPoints.append(accessPoints.at(i)); + + const QString accessPointId = + QString::number(qHash(accessPoints.at(i)->connectionInterface()->path())); + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(accessPointId); + emit configurationRemoved(ptr); + } + break; + } + } + } + + return cpPriv; +} + +QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const +{ + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + + const QString identifier = QString::number(qHash(service + ' ' + settingsPath)); + + if (id == identifier) + return connection; + } + + return 0; +} + +QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) + return QNetworkSession::Invalid; + + foreach (const QString &acPath, activeConnections.keys()) { + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(acPath); + + const QString identifier = QString::number(qHash(activeConnection->serviceName() + ' ' + + activeConnection->connection().path())); + + if (id == identifier) { + switch (activeConnection->state()) { + case 0: + return QNetworkSession::Disconnected; + case 1: + return QNetworkSession::Connecting; + case 2: + return QNetworkSession::Connected; + } + } + } + + if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) + return QNetworkSession::Disconnected; + else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) + return QNetworkSession::NotAvailable; + else if ((ptr->state & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) + return QNetworkSession::NotAvailable; + + return QNetworkSession::Invalid; +} + +QT_END_NAMESPACE + diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h new file mode 100644 index 0000000..9e8af3b --- /dev/null +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** 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 plugins 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 QNETWORKMANAGERENGINE_P_H +#define QNETWORKMANAGERENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include "qnetworkmanagerservice.h" + +#include +#include + +QT_BEGIN_NAMESPACE + +class QNetworkManagerEngine : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + QNetworkManagerEngine(QObject *parent = 0); + ~QNetworkManagerEngine(); + + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); + + QString bearerName(const QString &id); + + void connectToId(const QString &id); + void disconnectFromId(const QString &id); + + void requestUpdate(); + + QNetworkSession::State sessionStateForId(const QString &id); + +private Q_SLOTS: + void interfacePropertiesChanged(const QString &path, + const QMap &properties); + void activeConnectionPropertiesChanged(const QString &path, + const QMap &properties); + + void deviceAdded(const QDBusObjectPath &path); + void deviceRemoved(const QDBusObjectPath &path); + + void newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings = 0); + void removeConnection(const QString &path); + void updateConnection(const QNmSettingsMap &settings); + void activationFinished(QDBusPendingCallWatcher *watcher); + + void newAccessPoint(const QString &path, const QDBusObjectPath &objectPath); + void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath); + void updateAccessPoint(const QMap &map); + + void doRequestUpdate(); + +private: + QNetworkConfigurationPrivate *parseConnection(const QString &service, + const QString &settingsPath, + const QNmSettingsMap &map); + QNetworkManagerSettingsConnection *connectionFromId(const QString &id) const; + +private: + QNetworkManagerInterface *interface; + QNetworkManagerSettings *systemSettings; + QNetworkManagerSettings *userSettings; + QHash wirelessDevices; + QHash activeConnections; + QList connections; + QList accessPoints; + QList configuredAccessPoints; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index e95c2e6..9376324 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -95,6 +95,7 @@ QNetworkManagerInterface::~QNetworkManagerInterface() { delete d->connectionInterface; delete d; + delete nmDBusHelper; } bool QNetworkManagerInterface::isValid() @@ -692,9 +693,12 @@ bool QNetworkManagerSettingsConnection::setConnections() bool allOk = false; if(!dbusConnection.connect(d->service, d->path, - NM_DBUS_IFACE_SETTINGS_CONNECTION, "NewConnection", + NM_DBUS_IFACE_SETTINGS_CONNECTION, "Updated", this, SIGNAL(updated(QNmSettingsMap)))) { allOk = true; + } else { + QDBusError error = dbusConnection.lastError(); + qDebug() << error.name() << error.message() << error.type(); } nmDBusHelper = new QNmDBusHelper; diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index 8bed45b..dbed01e 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -329,8 +329,8 @@ public: Q_SIGNALS: - void updated(QMap< QString, QMap > s); - void removed(const QString &); + void updated(const QNmSettingsMap &settings); + void removed(const QString &path); private: QNmDBusHelper *nmDBusHelper; diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp index 1d16e55..f93a63d 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp @@ -96,11 +96,14 @@ void QNmDBusHelper::slotPropertiesChanged(QMap map) emit pathForPropertiesChanged( msg.path(), map); } } else if( i.key() == "ActiveAccessPoint") { + emit pathForPropertiesChanged(msg.path(), map); // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value().path(); // } else if( i.key() == "Strength") // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt(); // else // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value(); + } else if (i.key() == "ActiveConnections") { + emit pathForPropertiesChanged(msg.path(), map); } } } diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h index 9794f98..410b69f 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.h +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h @@ -42,25 +42,12 @@ #ifndef QNMDBUSHELPERPRIVATE_H #define QNMDBUSHELPERPRIVATE_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - #include #include #include QT_BEGIN_NAMESPACE -#if !defined(QT_NO_DBUS) && !defined(Q_OS_MAC) - class QNmDBusHelper: public QObject, protected QDBusContext { Q_OBJECT @@ -80,7 +67,6 @@ Q_SIGNALS: void pathForPropertiesChanged(const QString &, QMap); void pathForSettingsRemoved(const QString &); }; -#endif QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp b/src/plugins/bearer/networkmanager/qnmwifiengine.cpp deleted file mode 100644 index b215023..0000000 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.cpp +++ /dev/null @@ -1,1128 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 "qnmwifiengine.h" - -#include -#include - -#include - -#include -#include -#include "qnetworkmanagerservice.h" - -#include - -QT_BEGIN_NAMESPACE - -Q_GLOBAL_STATIC(QNmWifiEngine, nmWifiEngine) -typedef QList > QNmSettingsAddressMap; - -Q_DECLARE_METATYPE(QNmSettingsAddressMap) - -QNmWifiEngine::QNmWifiEngine(QObject *parent) -: QNetworkSessionEngine(parent) -{ - iface = new QNetworkManagerInterface(); - if(!iface->isValid()) { - return; - } - iface->setConnections(); - connect(iface,SIGNAL(deviceAdded(QDBusObjectPath)), - this,SLOT(addDevice(QDBusObjectPath))); - connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), - this,SLOT(removeDevice(QDBusObjectPath))); - - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - addDevice(path); - } - - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - settingsiface->setConnections(); - connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), - this,(SLOT(newConnection(QDBusObjectPath)))); - } - - updated = false; -} - -QNmWifiEngine::~QNmWifiEngine() -{ -} - -QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface) -{ - QString newname; - if (devIface->state() == NM_DEVICE_STATE_ACTIVATED) { - QString path = devIface->ip4config().path(); - QNetworkManagerIp4Config * ipIface; - ipIface = new QNetworkManagerIp4Config(path); - newname = ipIface->domains().join(" "); - } - //fallback to interface name - if(newname.isEmpty()) - newname = devIface->interface().name(); - return newname; -} - - -QList QNmWifiEngine::getConfigurations(bool *ok) -{ -// qWarning() << Q_FUNC_INFO << updated; - if (ok) - *ok = false; - - if(!updated) { - foundConfigurations.clear(); - if(knownSsids.isEmpty()) - getKnownSsids(); // list of ssids that have user configurations. - - scanForAccessPoints(); - getActiveConnectionsPaths(); - knownConnections(); - - accessPointConnections(); - -// findConnections(); - //add access points - updated = true; - } - return QList(); //foundConfigurations; -} - -void QNmWifiEngine::findConnections() -{ - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - - //// eth - switch (devIface->deviceType()) { -// qWarning() << devIface->connectionInterface()->path(); - - case DEVICE_TYPE_802_3_ETHERNET: - { - QString ident; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - - ident = devWiredIface->hwAddress(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = getNameForConfiguration(devIface); - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = devWiredIface->carrier(); - - cpPriv->serviceInterface = devIface->interface(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - switch (devIface->state()) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_FAILED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_UNAVAILABLE: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_DISCONNECTED: - { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Defined); - } - break; - case NM_DEVICE_STATE_ACTIVATED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); - break; - default: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - }; - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { -// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; -// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// -// //// connections -// QStringList connectionServices; -// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; -// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -// -// QString connPath; -// -// foreach (QString service, connectionServices) { -// QString ident; -// QNetworkManagerSettings *settingsiface; -// settingsiface = new QNetworkManagerSettings(service); -// QList list = settingsiface->listConnections(); -// -// foreach(QDBusObjectPath path, list) { //for each connection path -//qWarning() << path.path(); -// ident = path.path(); -// bool addIt = false; -// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -// cpPriv->isValid = true; -// cpPriv->id = ident; -// cpPriv->internet = true; -// -// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered -// | QNetworkConfiguration::Defined); -// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; -// -// QNetworkManagerSettingsConnection *sysIface; -// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// cpPriv->name = sysIface->getId();//ii.value().toString(); -//qWarning() << cpPriv->name; -// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// // get the wifi interface state first.. do we need this? -// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); -// } -// -// //#if 0 -// foreach(QString conpath, activeConnectionPaths) { -// QNetworkManagerConnectionActive *aConn; -// aConn = new QNetworkManagerConnectionActive(conpath); -// // in case of accesspoint, specificObject will hold the accessPOintObjectPath -// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); -// if( aConn->connection().path() == ident) { -// -// QList devs = aConn->devices(); -// foreach(QDBusObjectPath device, devs) { -// QNetworkManagerInterfaceDevice *ifaceDevice; -// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); -// cpPriv->serviceInterface = ifaceDevice->interface(); -// cpPriv->state = getStateFlag(ifaceDevice->state()); -// //cpPriv->accessPoint = aConn->specificObject().path(); -// -// break; -// } -// } -// } -// //#endif -// // } //end while connection -// if(addIt) { -// foundConfigurations.append(cpPriv); -// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); -// } -// } -// } //end each connection service -// -// // ////////////// AccessPoints -//// QList apList = devWirelessIface->getAccessPoints(); -////// qWarning() << apList.count(); -//// foreach(QDBusObjectPath path, apList) { -//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); -//// if(cpPriv->isValid) { -//// foundConfigurations.append(cpPriv); -//// } -//// } - } // end DEVICE_TYPE_802_11_WIRELESS - break; - }; - } //end foreach device -} - -void QNmWifiEngine::knownConnections() -{ -// qWarning() << Q_FUNC_INFO; - //// connections - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; - - QString connPath; - - foreach (QString service, connectionServices) { - QString ident; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - -// qWarning() <setConnections(); - connect(sysIface, SIGNAL(removed(QString)), - this,SLOT(settingsConnectionRemoved(QString))); - - cpPriv->name = sysIface->getId(); - cpPriv->isValid = true; - cpPriv->id = sysIface->getUuid(); -// cpPriv->id = ident; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -//qWarning() << cpPriv->name; - cpPriv->state = getStateForId(cpPriv->id); - - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - - if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { - QString mac = sysIface->getMacAddress(); - if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; - QString devPath; - devPath = deviceConnectionPath(mac); - - // qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - cpPriv->internet = devWiredIface->carrier(); - - // use this mac addy - } else { - cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_3_ETHERNET, cpPriv->id); - } - - cpPriv->internet = true;//sysIface->isAutoConnect(); - - addIt = true; - } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { - QString mac = sysIface->getMacAddress();; - if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; - QString devPath; - devPath = deviceConnectionPath(mac); -// qWarning() << Q_FUNC_INFO << devPath; - - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - // use this mac addy - } else { - cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); - } - // cpPriv->serviceInterface = devIface->interface(); - addIt = true; - // get the wifi interface state first.. do we need this? - // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - } - if(addIt) { - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - } //end each connection service - } -} - -void QNmWifiEngine::accessPointConnections() -{ - //qWarning() << Q_FUNC_INFO; - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - QList apList = availableAccessPoints.uniqueKeys(); - - QList::const_iterator i; - for (i = apList.constBegin(); i != apList.constEnd(); ++i) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); - if(cpPriv->isValid) { - foundConfigurations.append(cpPriv); - // qWarning() << "adding" << cpPriv->name << "to things"; - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - } - } - } -} - -QString QNmWifiEngine::getInterfaceFromId(const QString &id) -{ - return configurationInterface.value(id); -} - -bool QNmWifiEngine::hasIdentifier(const QString &id) -{ - if (configurationInterface.contains(id)) - return true; - foreach (QNetworkConfigurationPrivatePointer cpPriv, getConfigurations()) { - if (cpPriv->id == id) - return true; - } - return false; -} - -QString QNmWifiEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(interface == devIface->interface().name()) { - switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: - return QLatin1String("Ethernet"); - break; - case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: - return QLatin1String("WLAN"); - break; - case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: - return QLatin1String("2G"); - break; - case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: - return QLatin1String("CDMA2000"); - break; - default: - break; - }; - } - } - return QString(); -} - -void QNmWifiEngine::connectToId(const QString &id) -{ -// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; - activatingConnectionPath = id; - QStringList connectionSettings = getConnectionPathForId(id); - if(connectionSettings.isEmpty()) { - emit connectionError(id, OperationNotSupported); - return; - } - - QDBusObjectPath connectionPath(connectionSettings.at(1)); - QString interface = getInterfaceFromId(id); - - interface = QNetworkInterface::interfaceFromName(interface).hardwareAddress().toLower(); - QString devPath; - devPath = deviceConnectionPath(interface); - QDBusObjectPath devicePath(devPath); - - iface = new QNetworkManagerInterface(); - iface->activateConnection( - connectionSettings.at(0), - connectionPath, - devicePath, - connectionPath); - - connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), - this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); -} - -void QNmWifiEngine::disconnectFromId(const QString &id) -{ - QString activeConnectionPath = getActiveConnectionPath(id); - //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; - - if (!activeConnectionPath.isEmpty()) { - QNetworkManagerConnectionActive *activeCon; - activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); - QNetworkManagerSettingsConnection *settingsCon; - settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); - - if(settingsCon->isAutoConnect()) { -// qWarning() << id << "is autoconnect"; - emit connectionError(id, OperationNotSupported); - //unsupported - } else { -// qWarning() <deactivateConnection(dbpath); - activatingConnectionPath = ""; - } - } -} - -void QNmWifiEngine::requestUpdate() -{ - updated = false; - knownSsids.clear(); - availableAccessPoints.clear(); - //emitConfigurationsChanged(); -} - -QNmWifiEngine *QNmWifiEngine::instance() -{ - QDBusConnection dbusConnection = QDBusConnection::systemBus(); - if (dbusConnection.isConnected()) { - QDBusConnectionInterface *dbiface = dbusConnection.interface(); - QDBusReply reply = dbiface->isServiceRegistered("org.freedesktop.NetworkManager"); - if (reply.isValid() && reply.value()) - return nmWifiEngine(); - } - - return 0; -} - -void QNmWifiEngine::getKnownSsids() -{ - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << sysIface->getSsid(); - knownSsids << sysIface->getSsid(); - } - } -} - -void QNmWifiEngine::getActiveConnectionsPaths() -{ -// qWarning() << Q_FUNC_INFO; - QNetworkManagerInterface *dbIface; - activeConnectionPaths.clear(); - dbIface = new QNetworkManagerInterface; - QList connections = dbIface->activeConnections(); - - foreach(QDBusObjectPath conpath, connections) { - activeConnectionPaths << conpath.path(); -// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); - - QNetworkManagerConnectionActive *activeConn; - activeConn = new QNetworkManagerConnectionActive(conpath.path()); - -// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); - - } -} - -QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) -{ //foreach accessPoint - //qWarning() << Q_FUNC_INFO << iPath << path.path(); - - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(iPath); - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); - - QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); - - QString ident = accessPointIface->connectionInterface()->path(); - quint32 nmState = devIface->state(); - - QString ssid = accessPointIface->ssid(); - QString hwAddy = accessPointIface->hwAddress(); - QString sInterface = devIface->interface().name(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - bool addIt = true; - //qWarning() << availableAccessPoints.count() << ssid; - -// if(availableAccessPoints.contains(ssid)) { -// addIt = false; -// -// } -// foreach (QNetworkConfigurationPrivate *cpPriv, foundConfigurations) { -// if (cpPriv->name == ssid) { //weed out duplicate ssid's ?? -// addIt = false; -// break; -// } -// } - - if(addIt) { - - cpPriv->name = ssid; - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = devIface->interface(); - - //qWarning() <<__FUNCTION__ << ssid; - - cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); - - if(activeAPPath == accessPointIface->connectionInterface()->path()) { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Active); - } - if(accessPointIface->flags() == NM_802_11_AP_FLAGS_PRIVACY) - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - else - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - return cpPriv; - } else { - cpPriv->isValid = false; - } - return cpPriv; -} - - - QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) -{ - QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; -//qWarning() << nmState << knownSsids; - // this is the state of the wifi device interface - if(isKnown) - state = ( QNetworkConfiguration::Defined); - - switch(nmState) { //device interface state, not AP state - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_UNAVAILABLE: - state = (QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_DISCONNECTED: - { - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - } - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - if(isKnown) - state = ( state | QNetworkConfiguration::Discovered); - } - break; - }; - return state; -} - -QString QNmWifiEngine::getActiveConnectionPath(const QString &id) -{ - //qWarning() << Q_FUNC_INFO << id; - QStringList connectionSettings = getConnectionPathForId(id); - //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath path, connections) { - QNetworkManagerConnectionActive *conDetailsD; - conDetailsD = new QNetworkManagerConnectionActive( path.path()); - if(conDetailsD->connection().path() == connectionSettings.at(1) - && conDetailsD->serviceName() == connectionSettings.at(0)) - return path.path(); - } - return QString(); -} - - QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) - { -// qWarning() << Q_FUNC_INFO << nmstate; - QNetworkConfiguration::StateFlags flag; - switch (nmstate) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_FAILED: - case NM_DEVICE_STATE_UNMANAGED: - flag = (QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_UNAVAILABLE: - flag = (QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_DISCONNECTED: - flag = ( flag | QNetworkConfiguration::Discovered ); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - flag = ( flag | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Active ); - } - break; - default: - flag = ( QNetworkConfiguration::Defined); - break; - }; - return flag; - } - -void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) -{ -// qWarning() << Q_FUNC_INFO << path << nmState; - - if(nmState == NM_DEVICE_STATE_ACTIVATED - || nmState == NM_DEVICE_STATE_DISCONNECTED - || nmState == NM_DEVICE_STATE_UNAVAILABLE - || nmState == NM_DEVICE_STATE_FAILED) { - -/* InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, -*/ -// qWarning() << Q_FUNC_INFO << ident; - QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); - switch (nmState) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_FAILED: - state = (QNetworkConfiguration::Undefined); - emit connectionError(activatingConnectionPath, ConnectError); - requestUpdate(); -// qWarning() << Q_FUNC_INFO; - break; - case NM_DEVICE_STATE_UNAVAILABLE: - state = (QNetworkConfiguration::Defined); -// emit connectionError(activatingConnectionPath, ConnectError); - requestUpdate(); - break; - case NM_DEVICE_STATE_DISCONNECTED: - state = ( state | QNetworkConfiguration::Discovered ); - requestUpdate(); - break; - case NM_DEVICE_STATE_ACTIVATED: - { - state = ( state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Active ); - requestUpdate(); - } - break; - default: - state = ( QNetworkConfiguration::Defined); - break; - }; - } -} - -void QNmWifiEngine::addDevice(QDBusObjectPath path) -{ - //qWarning() << Q_FUNC_INFO << path.path(); - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - devIface->setConnections(); - connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), - this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); - - if(!devicePaths.contains(path.path())) - devicePaths << path.path(); - - switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET: - { - QNetworkManagerInterfaceDeviceWired * devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - devWiredIface->setConnections(); - connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), - this,SLOT(cmpPropertiesChanged( const QString &, QMap))); - requestUpdate(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); - devWirelessIface->setConnections(); - - connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), - this,SLOT(cmpPropertiesChanged( const QString &, QMap))); - - connect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), - this,SLOT(accessPointAdded(const QString &,QDBusObjectPath))); - - connect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), - this,SLOT(accessPointRemoved(const QString &,QDBusObjectPath))); - requestUpdate(); - - } - break; - default: - break; - }; -} - -void QNmWifiEngine::removeDevice(QDBusObjectPath /*path*/) -{ -// qWarning() << Q_FUNC_INFO << path.path(); -// disconnect(devIface,SIGNAL(stateChanged(const QString &, quint32)), -// this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); -// -// if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// // devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// // devWirelessIface->setConnections(); -// -// disconnect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), -// this,SIGNAL(cmpPropertiesChanged( const QString &, QMap))); -// -// disconnect(devWirelessIface, SIGNAL(accessPointAdded(const QString &,QDBusObjectPath)), -// this,SIGNAL(accessPointAdded(const QString &,QDBusObjectPath))); -// -// disconnect(devWirelessIface, SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath)), -// this,SIGNAL(accessPointRemoved(const QString &,QDBusObjectPath))); -// -// } -} -void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap map) -{ - QMapIterator i(map); - while (i.hasNext()) { - i.next(); -// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); - if( i.key() == "State") { //only applies to device interfaces - updateDeviceInterfaceState(path, i.value().toUInt()); - } - if( i.key() == "ActiveAccessPoint") { - } - if( i.key() == "Carrier") { //someone got plugged in - // requestUpdate(); - } - } -} - -void QNmWifiEngine::accessPointRemoved( const QString &aPath, QDBusObjectPath /*oPath*/) -{ - //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); - - if(aPath.contains("devices")) { - requestUpdate(); - } -} - -void QNmWifiEngine::accessPointAdded( const QString &aPath, QDBusObjectPath oPath) -{ - //qWarning() << Q_FUNC_INFO << aPath << oPath.path(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv = addAccessPoint( aPath, oPath); - requestUpdate(); -} - -QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id) -{ - //qWarning() << Q_FUNC_INFO << id; - bool isAvailable = false; - QStringList conPath = getConnectionPathForId(id); - QString aconpath = getActiveConnectionPath(id); - - //qWarning() << Q_FUNC_INFO << id << aconpath; - - if(!aconpath.isEmpty()) { - //active connection - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(aconpath); - - QList devs = aConn->devices(); - - foreach(QDBusObjectPath dev, devs) { - //qWarning() << "foreach" << dev.path(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); - - if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { - - if(isAddressOfConnection(id, ifaceDevice->ip4Address())) { - // this is it! - return getStateFlag(ifaceDevice->state()); - } else { - continue; - } - - if(ifaceDevice->state() == NM_DEVICE_STATE_UNAVAILABLE || - ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { - isAvailable = true; - - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); - if(!devWiredIface->carrier()) - return QNetworkConfiguration::Defined; - } //end eth - } else if(ifaceDevice->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - qWarning() << "FIXME!!!!!!!!!!!!!!!!!"; - } - - return getStateFlag(ifaceDevice->state()); - } - } else { - // not active - //qWarning() << Q_FUNC_INFO << "Not active"; - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); - if(sysIface->isValid()) { - if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { - QString ssid = sysIface->getSsid(); - bool ok = false; - - if(knownSsids.contains(ssid, Qt::CaseSensitive)) { - foreach(QString onessid, knownSsids) { - // qWarning() << ssid << onessid; - if(onessid == ssid && availableAccessPoints.contains(ssid)) { - // qWarning() < devices = aConn->devices(); - foreach(QDBusObjectPath device, devices) { - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); - if(ifaceDevice->ip4Address() == ipaddress) { - return true; - } - } - return false; -} - -QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) -{ - // check active connections first. - QStringList conIdPath = getConnectionPathForId(id); -// qWarning() << Q_FUNC_INFO << id << conIdPath; - - QNetworkInterface interface; - foreach(QString conpath, activeConnectionPaths) { - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(conpath); - - if(aConn->connection().path() == conIdPath.at(1) - && aConn->serviceName() == conIdPath.at(0)) { - - QList devs = aConn->devices(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one - interface = ifaceDevice->interface(); - return interface; - } - } - -//try guessing - QList list = iface->getDevices(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - if(devIface->deviceType() == type /*&& devIface->managed()*/) { - interface = devIface->interface(); - if(devIface->state() == NM_STATE_DISCONNECTED) { - return interface; - } - } - } - return interface; -} - -quint64 QNmWifiEngine::receivedDataForId(const QString &id) const -{ - if(configurationInterface.count() > 1) - return 0; - quint64 result = 0; - - QString devFile; - devFile = configurationInterface.value(id); - QFile rx("/sys/class/net/"+devFile+"/statistics/rx_bytes"); - if(rx.exists() && rx.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&rx); - in >> result; - rx.close(); - } - return result; -} - -quint64 QNmWifiEngine::sentDataForId(const QString &id) const -{ - if(configurationInterface.count() > 1) - return 0; - quint64 result = 0; - QString devFile; - devFile = configurationInterface.value(id); - - QFile tx("/sys/class/net/"+devFile+"/statistics/tx_bytes"); - if(tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { - QTextStream in(&tx); - in >> result; - tx.close(); - } - return result; -} - -void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) -{ - //qWarning() << Q_FUNC_INFO; - requestUpdate(); -} - -void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) -{ - //qWarning() << Q_FUNC_INFO; - requestUpdate(); -} - -void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) -{ - QDBusPendingReply reply = *openCall; - if (reply.isError()) { - qWarning() <<"Error" << reply.error().name() << reply.error().message() - < list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); - - if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { - -// qWarning() << devIface->connectionInterface()->path(); - - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); - ////////////// AccessPoints - QList apList = devWirelessIface->getAccessPoints(); - - foreach(QDBusObjectPath path, apList) { - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); - QString ssid = accessPointIface->ssid(); - availableAccessPoints.insert(ssid, path); - } - } - } -} - -QString QNmWifiEngine::deviceConnectionPath(const QString &mac) -{ -// qWarning() << __FUNCTION__ << mac; - QString newMac = mac; - newMac = newMac.replace(":","_").toLower(); - //device object path might not contain just mac address - //might contain extra numbers on the end. thanks HAL - foreach(QString device, devicePaths) { - if(device.contains(newMac)) { - newMac = device; - break; - } - } - return newMac; -} - -QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) -{ - QStringList connectionServices; - connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; - connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; - foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << uuid << sysIface->getUuid(); - if(sysIface->getUuid() == uuid) { -// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); - return QStringList() << service << sysIface->connectionInterface()->path(); - } - } - } - return QStringList(); -} - -QT_END_NAMESPACE - diff --git a/src/plugins/bearer/networkmanager/qnmwifiengine.h b/src/plugins/bearer/networkmanager/qnmwifiengine.h deleted file mode 100644 index d651ef4..0000000 --- a/src/plugins/bearer/networkmanager/qnmwifiengine.h +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** -** -** 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 plugins 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 QNMWIFIENGINE_P_H -#define QNMWIFIENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -//#include - -#include -#include -#include - -#include "qnetworkmanagerservice.h" - -#include -#include -#include -#include - - - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate; - -class QNmWifiEngine : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - QNmWifiEngine(QObject *parent = 0); - ~QNmWifiEngine(); - - QList getConfigurations(bool *ok = 0); - QString getInterfaceFromId(const QString &id); - bool hasIdentifier(const QString &id); - - QString bearerName(const QString &id); - - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - - void requestUpdate(); - - static QNmWifiEngine *instance(); - - QStringList knownSsids; - //inline void emitConfigurationsChanged() { emit configurationsChanged(); } - QNetworkConfigurationPrivate * addAccessPoint(const QString &, QDBusObjectPath ); - - QStringList getConnectionPathForId(const QString &uuid); - //QString getConnectionPathForId(const QString &name = QString()); - quint64 sentDataForId(const QString &id) const; - quint64 receivedDataForId(const QString &id) const; - -private: - bool updated; - QString activatingConnectionPath; - QStringList activeConnectionPaths; - - - QMap availableAccessPoints; - void scanForAccessPoints(); - - QStringList devicePaths; - - void getActiveConnectionsPaths(); - void getKnownSsids(); - void accessPointConnections(); - void knownConnections(); - void findConnections(); - QString deviceConnectionPath(const QString &mac); - - QList foundConfigurations; - // QHash > allConfigurations; - - QNetworkManagerInterface *iface; - - QNetworkConfiguration::StateFlags getAPState(qint32 vState, bool isKnown); - QNetworkConfiguration::StateFlags getStateFlag(quint32 nmstate); - - QString getActiveConnectionPath(const QString &identifier); - QString getNameForConfiguration(QNetworkManagerInterfaceDevice *devIface); - - QNetworkConfiguration::StateFlags getStateForId(const QString &id); - - QNetworkInterface getBestInterface(quint32 type, const QString &conPath); - - QMap configurationInterface; - - bool isAddressOfConnection(const QString &conPath, quint32 ipaddress); - -private slots: - void updateDeviceInterfaceState(const QString &, quint32); - void addDevice(QDBusObjectPath path); - void removeDevice(QDBusObjectPath path); - -Q_SIGNALS: - void configurationChanged(const QNetworkConfiguration& config); - void updateAccessPointState(const QString &, quint32); -// void slotActivationFinished(QDBusPendingCallWatcher*); - -private slots: - void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); - void accessPointRemoved( const QString &aPath, QDBusObjectPath oPath); - void cmpPropertiesChanged(const QString &, QMap map); - void newConnection(QDBusObjectPath); - void settingsConnectionRemoved(const QString &); - void slotActivationFinished(QDBusPendingCallWatcher*); -}; - -QT_END_NAMESPACE - -#endif - - -- cgit v0.12 From b22d0a9c4d6e3309287aefdc1a300e2fc566c2c7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 10 Dec 2009 16:57:42 +1000 Subject: Remove unused global statics. --- src/plugins/bearer/corewlan/qcorewlanengine.h | 1 - src/plugins/bearer/corewlan/qcorewlanengine.mm | 7 ------- src/plugins/bearer/generic/qgenericengine.cpp | 7 ------- src/plugins/bearer/generic/qgenericengine.h | 2 -- src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 4 ---- src/plugins/bearer/nla/qnlaengine.cpp | 9 --------- src/plugins/bearer/nla/qnlaengine.h | 2 -- 7 files changed, 32 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 7ccfeea..2be81d1 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -70,7 +70,6 @@ public: void requestUpdate(); - static QCoreWlanEngine *instance(); static bool getAllScInterfaces(); private: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 9dea217..c6ea56a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -66,8 +66,6 @@ QMap networkInterfaces; QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QCoreWlanEngine, coreWlanEngine) - inline QString cfstringRefToQstring(CFStringRef cfStringRef) { // return QString([cfStringRef UTF8String]); QString retVal; @@ -310,11 +308,6 @@ void QCoreWlanEngine::requestUpdate() emit configurationsChanged(); } -QCoreWlanEngine *QCoreWlanEngine::instance() -{ - return coreWlanEngine(); -} - QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) { QList foundConfigs; diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 339ef9c..0d9a958 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QGenericEngine, genericEngine) - static QString qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WIN32 @@ -170,11 +168,6 @@ void QGenericEngine::requestUpdate() QTimer::singleShot(0, this, SLOT(doRequestUpdate())); } -QGenericEngine *QGenericEngine::instance() -{ - return genericEngine(); -} - void QGenericEngine::doRequestUpdate() { // Immediately after connecting with a wireless access point diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 9359d7f..a671ceb 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -71,8 +71,6 @@ public: QNetworkSession::State sessionStateForId(const QString &id); - static QGenericEngine *instance(); - private Q_SLOTS: void doRequestUpdate(); diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 5ca49a9..93fc9ca 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -50,8 +50,6 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QNativeWifiEngine, nativeWifiEngine) - WlanOpenHandleProto local_WlanOpenHandle = 0; WlanRegisterNotificationProto local_WlanRegisterNotification = 0; WlanEnumInterfacesProto local_WlanEnumInterfaces = 0; @@ -63,8 +61,6 @@ WlanScanProto local_WlanScan = 0; WlanFreeMemoryProto local_WlanFreeMemory = 0; WlanCloseHandleProto local_WlanCloseHandle = 0; - - void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) { Q_UNUSED(d); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 2ad9cac..47bd8d5 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QNlaEngine, nlaEngine) - QWindowsSockInit2::QWindowsSockInit2() : version(0) { @@ -579,13 +577,6 @@ void QNlaEngine::requestUpdate() nlaThread->forceUpdate(); } -QNlaEngine *QNlaEngine::instance() -{ - return nlaEngine(); -} - #include "qnlaengine.moc" QT_END_NAMESPACE - - diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 1e66c83..464275d 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -92,8 +92,6 @@ public: void requestUpdate(); - static QNlaEngine *instance(); - private: QWindowsSockInit2 winSock; QNlaThread *nlaThread; -- cgit v0.12 From 6f0a0af87c2063cd1dac75134f5cd05291a9196d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 10 Dec 2009 17:10:53 +1000 Subject: Convert NLA plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 12 ++- src/plugins/bearer/nla/qnlaengine.cpp | 101 ++++++++++++++++++++----- src/plugins/bearer/nla/qnlaengine.h | 6 +- 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 6f833f3..495be4a 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -198,7 +198,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (nmWifi) { sessionEngines.append(nmWifi); connect(nmWifi, SIGNAL(updateCompleted()), - this, SIGNAL(configurationUpdateComplete())); + this, SLOT(updateConfigurations())); connect(nmWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); connect(nmWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), @@ -217,7 +217,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (generic) { sessionEngines.append(generic); connect(generic, SIGNAL(updateCompleted()), - this, SIGNAL(configurationUpdateComplete())); + this, SLOT(updateConfigurations())); connect(generic, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); connect(generic, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), @@ -235,6 +235,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QNetworkSessionEngine *nla = nlaPlugin->create(QLatin1String("nla")); if (nla) { sessionEngines.append(nla); + connect(nla, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(nla, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(nla, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(nla, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 47bd8d5..a9fc2ee 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -238,21 +238,8 @@ QList QNlaThread::getConfigurations() { QMutexLocker locker(&mutex); - QList foundConfigurations; - - for (int i = 0; i < fetchedConfigurations.count(); ++i) { - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - - foundConfigurations.append(config); - } + QList foundConfigurations = fetchedConfigurations; + fetchedConfigurations.clear(); return foundConfigurations; } @@ -324,7 +311,10 @@ void QNlaThread::run() #ifndef Q_OS_WINCE // Not interested in unrelated IO completion events // although we also don't want to block them - while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION) {} + while (WaitForSingleObjectEx(changeEvent, WSA_INFINITE, true) != WAIT_IO_COMPLETION && + handle) + { + } #else WaitForSingleObject(changeEvent, WSA_INFINITE); #endif @@ -515,7 +505,7 @@ QNlaEngine::QNlaEngine(QObject *parent) { nlaThread = new QNlaThread(this); connect(nlaThread, SIGNAL(networksChanged()), - this, SIGNAL(configurationsChanged())); + this, SLOT(networksChanged())); nlaThread->start(); qApp->processEvents(QEventLoop::ExcludeUserInputEvents); @@ -526,12 +516,57 @@ QNlaEngine::~QNlaEngine() delete nlaThread; } -QList QNlaEngine::getConfigurations(bool *ok) +void QNlaEngine::networksChanged() { - if (ok) - *ok = true; + QStringList previous = accessPointConfigurations.keys(); + + QList foundConfigurations = nlaThread->getConfigurations(); + while (!foundConfigurations.isEmpty()) { + QNetworkConfigurationPrivate *cpPriv = foundConfigurations.takeFirst(); + + previous.removeAll(cpPriv->id); + + if (accessPointConfigurations.contains(cpPriv->id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id); + + bool changed = false; + + if (ptr->isValid != cpPriv->isValid) { + ptr->isValid = cpPriv->isValid; + changed = true; + } + + if (ptr->name != cpPriv->name) { + ptr->name = cpPriv->name; + changed = true; + } + + if (ptr->state != cpPriv->state) { + ptr->state = cpPriv->state; + changed = true; + } - return nlaThread->getConfigurations(); + if (changed) + emit configurationChanged(ptr); + + delete cpPriv; + } else { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + + accessPointConfigurations.insert(ptr->id, ptr); + + emit configurationAdded(ptr); + } + } + + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(previous.takeFirst()); + + emit configurationRemoved(ptr); + } + + emit updateCompleted(); } QString QNlaEngine::getInterfaceFromId(const QString &id) @@ -577,6 +612,30 @@ void QNlaEngine::requestUpdate() nlaThread->forceUpdate(); } +QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 464275d..dd038d1 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -81,7 +81,6 @@ public: QNlaEngine(QObject *parent = 0); ~QNlaEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -92,6 +91,11 @@ public: void requestUpdate(); + QNetworkSession::State sessionStateForId(const QString &id); + +private Q_SLOTS: + void networksChanged(); + private: QWindowsSockInit2 winSock; QNlaThread *nlaThread; -- cgit v0.12 From a60b9d95fddb75a53cde258dbf4b9063a58a88b8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 11 Dec 2009 11:27:14 +1000 Subject: Convert Native Wifi plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 14 ++- .../bearer/nativewifi/qnativewifiengine.cpp | 115 ++++++++++++++++----- src/plugins/bearer/nativewifi/qnativewifiengine.h | 7 +- 3 files changed, 106 insertions(+), 30 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 495be4a..c9b10dd 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -251,9 +251,21 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QBearerEnginePlugin *nativeWifiPlugin = qobject_cast(l->instance(QLatin1String("nativewifi"))); if (nativeWifiPlugin) { - QNetworkSessionEngine *nativeWifi = nativeWifiPlugin->create(QLatin1String("nativewifi")); + QNetworkSessionEngine *nativeWifi = + nativeWifiPlugin->create(QLatin1String("nativewifi")); if (nativeWifi) { sessionEngines.append(nativeWifi); + connect(nativeWifi, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(nativeWifi, + SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(nativeWifi, + SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(nativeWifi, + SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; } diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 93fc9ca..e65eeea 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -68,7 +68,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) switch (data->NotificationCode) { case wlan_notification_acm_connection_complete: case wlan_notification_acm_disconnected: - d->emitConfigurationsChanged(); + QMetaObject::invokeMethod(d, "scanComplete", Qt::QueuedConnection); break; default: qDebug() << "wlan unknown notification"; @@ -96,8 +96,9 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent) // On Windows XP SP2 and SP3 only connection and disconnection notifications are available. // We need to poll for changes in available wireless networks. - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(scanComplete())); pollTimer.setInterval(10000); + scanComplete(); } QNativeWifiEngine::~QNativeWifiEngine() @@ -105,19 +106,16 @@ QNativeWifiEngine::~QNativeWifiEngine() local_WlanCloseHandle(handle, 0); } -QList QNativeWifiEngine::getConfigurations(bool *ok) +void QNativeWifiEngine::scanComplete() { - if (ok) - *ok = false; - - QList foundConfigurations; + QStringList previous = accessPointConfigurations.keys(); // enumerate interfaces WLAN_INTERFACE_INFO_LIST *interfaceList; DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList); if (result != ERROR_SUCCESS) { qWarning("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result); - return foundConfigurations; + return; } for (unsigned int i = 0; i < interfaceList->dwNumberOfItems; ++i) { @@ -146,36 +144,66 @@ QList QNativeWifiEngine::getConfigurations(bool network.dot11Ssid.uSSIDLength); } - // don't add duplicate networks - if (seenNetworks.contains(networkName)) - continue; - else - seenNetworks.append(networkName); - - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + const QString id = QString::number(qHash(QLatin1String("WLAN:") + networkName)); - cpPriv->isValid = true; + previous.removeAll(id); - cpPriv->name = networkName; - cpPriv->id = QString::number(qHash(QLatin1String("WLAN:") + cpPriv->name)); + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; if (!(network.dwFlags & WLAN_AVAILABLE_NETWORK_HAS_PROFILE)) - cpPriv->state = QNetworkConfiguration::Undefined; + state = QNetworkConfiguration::Undefined; if (network.strProfileName[0] != 0) { if (network.bNetworkConnectable) { if (network.dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) - cpPriv->state = QNetworkConfiguration::Active; + state = QNetworkConfiguration::Active; else - cpPriv->state = QNetworkConfiguration::Discovered; + state = QNetworkConfiguration::Discovered; } else { - cpPriv->state = QNetworkConfiguration::Defined; + state = QNetworkConfiguration::Defined; } } - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + if (seenNetworks.contains(networkName)) + continue; + else + seenNetworks.append(networkName); + + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); - foundConfigurations.append(cpPriv); + bool changed = false; + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->name != networkName) { + ptr->name = networkName; + changed = true; + } + + if (ptr->state != state) { + ptr->state = state; + changed = true; + } + + if (changed) + emit configurationChanged(ptr); + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = networkName; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + + accessPointConfigurations.insert(id, ptr); + + emit configurationAdded(ptr); + } } local_WlanFreeMemory(networkList); @@ -183,12 +211,16 @@ QList QNativeWifiEngine::getConfigurations(bool local_WlanFreeMemory(interfaceList); - if (ok) - *ok = true; + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(previous.takeFirst()); + + emit configurationRemoved(ptr); + } pollTimer.start(); - return foundConfigurations; + emit updateCompleted(); } QString QNativeWifiEngine::getInterfaceFromId(const QString &id) @@ -227,6 +259,7 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) guid = guid.arg(interface.InterfaceGuid.Data4[i], 2, 16, QChar('0')); local_WlanFreeMemory(connectionAttributes); + local_WlanFreeMemory(interfaceList); return guid.toUpper(); } @@ -234,6 +267,8 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) local_WlanFreeMemory(connectionAttributes); } + local_WlanFreeMemory(interfaceList); + return QString(); } @@ -397,6 +432,32 @@ void QNativeWifiEngine::requestUpdate() if (result != ERROR_SUCCESS) qWarning("%s: WlanScan failed with error %ld\n", __FUNCTION__, result); } + + local_WlanFreeMemory(interfaceList); +} + +QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; } QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 6686ea8..5d6af40 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; +struct WLAN_NOTIFICATION_DATA; class QNativeWifiEngine : public QNetworkSessionEngine { @@ -69,7 +70,6 @@ public: QNativeWifiEngine(QObject *parent = 0); ~QNativeWifiEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -80,10 +80,13 @@ public: void requestUpdate(); - inline void emitConfigurationsChanged() { emit configurationsChanged(); } + QNetworkSession::State sessionStateForId(const QString &id); inline bool available() const { return handle != 0; } +public Q_SLOTS: + void scanComplete(); + private: QTimer pollTimer; -- cgit v0.12 From 33ff53925ba6d62ecc868920c6bc914824feec54 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 11 Dec 2009 12:45:40 +1000 Subject: Remove unused BEARER_ENGINE preprocessor define. --- src/network/bearer/bearer.pri | 2 -- src/network/bearer/qnetworkconfigmanager_p.h | 6 ------ src/network/bearer/qnetworkconfiguration_p.h | 9 ++------- src/network/bearer/qnetworksession_p.h | 11 ++--------- src/plugins/bearer/corewlan/corewlan.pro | 2 -- src/plugins/bearer/generic/generic.pro | 2 -- src/plugins/bearer/nativewifi/nativewifi.pro | 2 -- src/plugins/bearer/networkmanager/networkmanager.pro | 2 +- src/plugins/bearer/nla/nla.pro | 2 -- 9 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 5bae333..4f6c549 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -69,8 +69,6 @@ symbian { INSTALLS += pkgconfig documentation } else { - DEFINES += BEARER_ENGINE - HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 37e88d3..a45d534 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -93,13 +93,10 @@ Q_SIGNALS: void onlineStateChanged(bool isOnline); private: -#ifdef BEARER_ENGINE void updateInternetServiceConfiguration(); void abort(); -#endif -#ifdef BEARER_ENGINE public: QList sessionEngines; @@ -108,14 +105,11 @@ private: bool updating; QSet updatingEngines; -#endif private Q_SLOTS: -#ifdef BEARER_ENGINE void configurationAdded(QNetworkConfigurationPrivatePointer ptr); void configurationRemoved(QNetworkConfigurationPrivatePointer ptr); void configurationChanged(QNetworkConfigurationPrivatePointer ptr); -#endif }; QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 8e69248..365ec95 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -64,12 +64,9 @@ class QNetworkConfigurationPrivate : public QSharedData { public: QNetworkConfigurationPrivate () - : isValid(false), type(QNetworkConfiguration::Invalid), - roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose) + : isValid(false), type(QNetworkConfiguration::Invalid), + roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), internet(false) { -#ifdef BEARER_ENGINE - internet = false; -#endif } ~QNetworkConfigurationPrivate() @@ -86,9 +83,7 @@ public: bool roamingSupported; QNetworkConfiguration::Purpose purpose; -#ifdef BEARER_ENGINE bool internet; -#endif QList serviceNetworkMembers; QNetworkInterface serviceInterface; diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 0e11b3d..0a45c92 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -55,9 +55,7 @@ #include "qnetworkconfigmanager_p.h" #include "qnetworksession.h" -#ifdef BEARER_ENGINE #include "qnetworksessionengine_p.h" -#endif #include "qnetworksession.h" #include @@ -65,9 +63,7 @@ QT_BEGIN_NAMESPACE -#ifdef BEARER_ENGINE class QNetworkSessionEngine; -#endif class QNetworkSessionPrivate : public QObject { @@ -117,12 +113,10 @@ Q_SIGNALS: void quitPendingWaitsForOpened(); private Q_SLOTS: -#ifdef BEARER_ENGINE void networkConfigurationsChanged(); void configurationChanged(const QNetworkConfiguration &config); void forcedSessionClose(const QNetworkConfiguration &config); void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); -#endif private: QNetworkConfigurationManager manager; @@ -146,17 +140,16 @@ private: QNetworkSession::State state; bool isActive; -#ifdef BEARER_ENGINE bool opened; QNetworkSessionEngine *engine; -#endif + QNetworkSession::SessionError lastError; QNetworkSession* q; friend class QNetworkSession; -#if defined(BEARER_ENGINE) && defined(BACKEND_NM) +#if defined(BACKEND_NM) QDateTime startTime; void setActiveTimeStamp(); #endif diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index ffac6df..ac04e95 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -11,8 +11,6 @@ contains(QT_CONFIG, corewlan) { } } -DEFINES += BEARER_ENGINE - HEADERS += qcorewlanengine.h SOURCES += qcorewlanengine.mm main.cpp diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 506417c..0015041 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -3,8 +3,6 @@ include(../../qpluginbase.pri) QT += network -DEFINES += BEARER_ENGINE - HEADERS += qgenericengine.h \ ../platformdefs_win.h SOURCES += qgenericengine.cpp main.cpp diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 3aab552..583edd4 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -3,8 +3,6 @@ include(../../qpluginbase.pri) QT += network -DEFINES += BEARER_ENGINE - HEADERS += qnativewifiengine.h platformdefs.h SOURCES += qnativewifiengine.cpp main.cpp diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 79c68ea..57f7ca7 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -3,7 +3,7 @@ include(../../qpluginbase.pri) QT += network dbus -DEFINES += BEARER_ENGINE BACKEND_NM +DEFINES += BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 78f3271..62a920a 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -9,8 +9,6 @@ QT += network LIBS += -lWs2 } -DEFINES += BEARER_ENGINE - HEADERS += qnlaengine.h \ ../platformdefs_win.h SOURCES += qnlaengine.cpp main.cpp -- cgit v0.12 From 56c7d0baf1b7611f17938cf0eb920ccdae53e7ed Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 11:19:18 +1000 Subject: Remove bearer.pro. --- src/network/bearer/bearer.pro | 163 ------------------------------------------ 1 file changed, 163 deletions(-) delete mode 100644 src/network/bearer/bearer.pro diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro deleted file mode 100644 index 2255b7c..0000000 --- a/src/network/bearer/bearer.pro +++ /dev/null @@ -1,163 +0,0 @@ -# Qt bearer management library -TEMPLATE = lib -TARGET = QtBearer - -QT += network -include (../../common.pri) - -DEFINES += QT_BUILD_BEARER_LIB QT_MAKEDLL - -#DEFINES += BEARER_MANAGEMENT_DEBUG - -PUBLIC_HEADERS += qnetworkconfiguration.h \ - qnetworksession.h \ - qnetworkconfigmanager.h - -HEADERS += $$PUBLIC_HEADERS -SOURCES += qnetworksession.cpp \ - qnetworkconfigmanager.cpp \ - qnetworkconfiguration.cpp - -symbian: { - exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { - message("Building with SNAP support") - DEFINES += SNAP_FUNCTIONALITY_AVAILABLE=1 - LIBS += -lcmmanager - } else { - message("Building without SNAP support") - LIBS += -lapengine - } - - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE - - HEADERS += qnetworkconfigmanager_s60_p.h \ - qnetworkconfiguration_s60_p.h \ - qnetworksession_s60_p.h - SOURCES += qnetworkconfigmanager_s60_p.cpp \ - qnetworkconfiguration_s60_p.cpp \ - qnetworksession_s60_p.cpp - - LIBS += -lcommdb \ - -lapsettingshandlerui \ - -lconnmon \ - -lcentralrepository \ - -lesock \ - -linsock \ - -lecom \ - -lefsrv \ - -lnetmeta - - deploy.path = $${EPOCROOT} - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - - for(header, exportheaders.sources) { - BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" - } - - bearer_deployment.sources = QtBearer.dll - bearer_deployment.path = /sys/bin - DEPLOYMENT += bearer_deployment - - TARGET.CAPABILITY = All -TCB -} else { - maemo { - QT += dbus - CONFIG += link_pkgconfig - - exists(../debug) { - message("Enabling debug messages.") - DEFINES += BEARER_MANAGEMENT_DEBUG - } - - HEADERS += qnetworksession_maemo_p.h \ - qnetworkconfigmanager_maemo_p.h \ - qnetworkconfiguration_maemo_p.h - - SOURCES += qnetworkconfigmanager_maemo.cpp \ - qnetworksession_maemo.cpp - - documentation.path = $$QT_MOBILITY_PREFIX/doc - documentation.files = doc/html - - PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - - CONFIG += create_pc create_prl - QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig - pkgconfig.files = QtBearer.pc - - INSTALLS += pkgconfig documentation - - } else { - - DEFINES += BEARER_ENGINE - - HEADERS += qnetworkconfigmanager_p.h \ - qnetworkconfiguration_p.h \ - qnetworksession_p.h \ - qnetworksessionengine_p.h \ - qgenericengine_p.h - - SOURCES += qnetworkconfigmanager_p.cpp \ - qnetworksession_p.cpp \ - qnetworksessionengine.cpp \ - qgenericengine.cpp - - unix:!mac:contains(networkmanager_enabled, yes) { - contains(QT_CONFIG,dbus) { - DEFINES += BACKEND_NM - QT += dbus - - HEADERS += qnmdbushelper_p.h \ - qnetworkmanagerservice_p.h \ - qnmwifiengine_unix_p.h - - SOURCES += qnmdbushelper.cpp \ - qnetworkmanagerservice_p.cpp \ - qnmwifiengine_unix.cpp - } else { - message("NetworkManager backend requires Qt DBus support") - } - } - - win32: { - HEADERS += qnlaengine_win_p.h \ - qnetworksessionengine_win_p.h - - !wince*:HEADERS += qnativewifiengine_win_p.h - - SOURCES += qnlaengine_win.cpp - - !wince*:SOURCES += qnativewifiengine_win.cpp - - !wince*:LIBS += -lWs2_32 - wince*:LIBS += -lWs2 - } - } - macx: { - HEADERS += qcorewlanengine_mac_p.h - SOURCES+= qcorewlanengine_mac.mm - LIBS += -framework Foundation -framework SystemConfiguration - - contains(corewlan_enabled, yes) { - isEmpty(QMAKE_MAC_SDK) { - SDK6="yes" - } else { - contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10.6.sdk") { - SDK6="yes" - } - } - - !isEmpty(SDK6) { - LIBS += -framework CoreWLAN - DEFINES += MAC_SDK_10_6 - } - } - - - } -} - -include(../../features/deploy.pri) -- cgit v0.12 From 2fa4daa2acd0af503f5802eff773f1fa2117a788 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 22 Dec 2009 09:20:17 +1000 Subject: Fix memory leak in NLA engine. --- src/plugins/bearer/nla/qnlaengine.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index a9fc2ee..bf0d74f 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -576,15 +576,7 @@ QString QNlaEngine::getInterfaceFromId(const QString &id) bool QNlaEngine::hasIdentifier(const QString &id) { - if (configurationInterface.contains(id.toUInt())) - return true; - - foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { - if (cpPriv->id == id) - return true; - } - - return false; + return configurationInterface.contains(id.toUInt()); } QString QNlaEngine::bearerName(const QString &id) -- cgit v0.12 From c68598b2bd82abee5da2596949e1e95c9a59e584 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 12:13:14 +1000 Subject: Emit updateCompleted() when requestUpdate() is called. --- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 8 ++++++++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 3de20a3..0af3675 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -116,6 +116,7 @@ QNetworkManagerEngine::~QNetworkManagerEngine() void QNetworkManagerEngine::doRequestUpdate() { + emit updateCompleted(); } QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) @@ -319,6 +320,13 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat } } +void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, + const QMap &properties) +{ + qDebug() << Q_FUNC_INFO << path; + qDebug() << properties; +} + void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) { QNetworkManagerInterfaceDevice device(path.path()); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 9e8af3b..1636c91 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -87,6 +87,8 @@ private Q_SLOTS: const QMap &properties); void activeConnectionPropertiesChanged(const QString &path, const QMap &properties); + void devicePropertiesChanged(const QString &path, + const QMap &properties); void deviceAdded(const QDBusObjectPath &path); void deviceRemoved(const QDBusObjectPath &path); -- cgit v0.12 From c3049983cf0ac72ae4a524a0a365ea88e950bfc0 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 17:11:20 +1000 Subject: Convert Core Wlan plugin to be incremental. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 8 + src/plugins/bearer/corewlan/qcorewlanengine.h | 14 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 239 +++++++++++++++++++++---- 3 files changed, 220 insertions(+), 41 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c9b10dd..cb83789 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -186,6 +186,14 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QNetworkSessionEngine *coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); if (coreWifi) { sessionEngines.append(coreWifi); + connect(coreWifi, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(coreWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(coreWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(coreWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); } } } diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 2be81d1..ea9bcfd 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QCOREWLANENGINE_P_H -#define QCOREWLANENGINE_P_H +#ifndef QCOREWLANENGINE_H +#define QCOREWLANENGINE_H #include @@ -59,7 +59,6 @@ public: QCoreWlanEngine(QObject *parent = 0); ~QCoreWlanEngine(); - QList getConfigurations(bool *ok = 0); QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); @@ -70,13 +69,18 @@ public: void requestUpdate(); + QNetworkSession::State sessionStateForId(const QString &id); + static bool getAllScInterfaces(); +private Q_SLOTS: + void doRequestUpdate(); + private: bool isWifiReady(const QString &dev); - QMap configurationInterface; + QMap configurationInterface; QTimer pollTimer; - QList scanForSsids(const QString &interfaceName); + QStringList scanForSsids(const QString &interfaceName); QList getWlanProfiles(const QString &interfaceName); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index c6ea56a..7e14e69 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -107,9 +107,9 @@ static QString qGetInterfaceType(const QString &interfaceString) QCoreWlanEngine::QCoreWlanEngine(QObject *parent) : QNetworkSessionEngine(parent) { - getAllScInterfaces(); - connect(&pollTimer, SIGNAL(timeout()), this, SIGNAL(configurationsChanged())); + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); + doRequestUpdate(); } QCoreWlanEngine::~QCoreWlanEngine() @@ -137,6 +137,7 @@ QList QCoreWlanEngine::getWifiConfigurations() return QList (); } +#if 0 QList QCoreWlanEngine::getConfigurations(bool *ok) { if (ok) @@ -202,15 +203,16 @@ QList QCoreWlanEngine::getConfigurations(bool *o pollTimer.start(); return foundConfigurations; } +#endif QString QCoreWlanEngine::getInterfaceFromId(const QString &id) { - return configurationInterface.value(id.toUInt()); + return configurationInterface.value(id); } bool QCoreWlanEngine::hasIdentifier(const QString &id) { - return configurationInterface.contains(id.toUInt()); + return configurationInterface.contains(id); } QString QCoreWlanEngine::bearerName(const QString &id) @@ -304,13 +306,119 @@ void QCoreWlanEngine::disconnectFromId(const QString &id) void QCoreWlanEngine::requestUpdate() { + pollTimer.stop(); + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +void QCoreWlanEngine::doRequestUpdate() +{ getAllScInterfaces(); - emit configurationsChanged(); + + QStringList previous = accessPointConfigurations.keys(); + + QMapIterator i(networkInterfaces); + while (i.hasNext()) { + i.next(); + if (i.value() == QLatin1String("WLAN")) { + QStringList added = scanForSsids(i.key()); + while (!added.isEmpty()) { + previous.removeAll(added.takeFirst()); + } + } + + qDebug() << "Found configuration" << i.key(); + QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); + + if (!interface.isValid()) + continue; + + uint identifier; + if (interface.index()) + identifier = qHash(QLatin1String("corewlan:") + QString::number(interface.index())); + else + identifier = qHash(QLatin1String("corewlan:") + interface.hardwareAddress()); + + const QString id = QString::number(identifier); + + previous.removeAll(id); + + QString name = interface.humanReadableName(); + if (name.isEmpty()) + name = interface.name(); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; + + qDebug() << "interface flags:" << interface.flags(); + + if (interface.flags() && QNetworkInterface::IsRunning) + state = QNetworkConfiguration::Defined; + + if (!interface.addressEntries().isEmpty()) + state = QNetworkConfiguration::Active; + + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + bool changed = false; + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->name != name) { + ptr->name = name; + changed = true; + } + + if (ptr->id != id) { + ptr->id = id; + changed = true; + } + + if (ptr->state != state) { + ptr->state = state; + changed = true; + } + + if (changed) { + qDebug() << "Configuration changed" << ptr->name << ptr->id; + emit configurationChanged(ptr); + } + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = name; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + + accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interface.name()); + + qDebug() << "Configuration Added" << ptr->name << ptr->id; + emit configurationAdded(ptr); + } + } + + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); + + qDebug() << "Configuration Removed" << ptr->name << ptr->id; + configurationInterface.remove(ptr->id); + emit configurationRemoved(ptr); + } + + pollTimer.start(); + + emit updateCompleted(); } -QList QCoreWlanEngine::scanForSsids(const QString &interfaceName) +QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) { - QList foundConfigs; + QStringList found; + #if defined(MAC_SDK_10_6) NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; @@ -319,45 +427,80 @@ QList QCoreWlanEngine::scanForSsids(const QStrin NSDictionary *parametersDict = nil; NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; - if(!err) { + if (!err) { for(uint row=0; row < [apArray count]; row++ ) { CWNetwork *apNetwork = [apArray objectAtIndex:row]; - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QString networkSsid = nsstringToQString([apNetwork ssid]); - cpPriv->name = networkSsid; - cpPriv->isValid = true; - cpPriv->id = networkSsid; - cpPriv->internet = true; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); + + const QString networkSsid = nsstringToQString([apNetwork ssid]); + + const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); + found.append(id); + + QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; + + if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { + QString interfaceSsidString = nsstringToQString([currentInterface ssid]); + qDebug() << "interfaceSsidString:" << interfaceSsidString; + if (networkSsid == nsstringToQString([currentInterface ssid])) + state = QNetworkConfiguration::Active; + } else { + if (isKnownSsid(interfaceName, networkSsid)) + state = QNetworkConfiguration::Discovered; + else + state = QNetworkConfiguration::Defined; + } + qDebug() << "state is:" << state; CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; - if(!userNetworkProfile) { - } else { + if (userNetworkProfile) { qWarning() <<"Has profile!" ; } - if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); - if( cpPriv->name == interfaceSsidString) { - cpPriv->state |= QNetworkConfiguration::Active; + if (accessPointConfigurations.contains(id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + bool changed = false; + + if (!ptr->isValid) { + ptr->isValid = true; + changed = true; } - } else { - if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { - cpPriv->state = QNetworkConfiguration::Discovered; - } else { - cpPriv->state = QNetworkConfiguration::Defined; + + if (ptr->name != networkSsid) { + ptr->name = networkSsid; + changed = true; } + + if (ptr->id != id) { + ptr->id = id; + changed = true; + } + + if (ptr->state != state) { + ptr->state = state; + changed = true; + } + + if (changed) { + qDebug() << "WLAN Configuration Changed" << interfaceName << ptr->name << ptr->id; + emit configurationChanged(ptr); + } + } else { + QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); + + ptr->name = networkSsid; + ptr->isValid = true; + ptr->id = id; + ptr->state = state; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + + accessPointConfigurations.insert(id, ptr); + configurationInterface.insert(id, interfaceName); + + qDebug() << "WLAN Configuration Added" << interfaceName << ptr->name << ptr->id; + emit configurationAdded(ptr); } - if(!cpPriv->state) { - cpPriv->state = QNetworkConfiguration::Undefined; - } - if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - else - cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; - foundConfigs.append(cpPriv); } } else { qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) @@ -367,7 +510,7 @@ QList QCoreWlanEngine::scanForSsids(const QStrin #else Q_UNUSED(interfaceName); #endif - return foundConfigs; + return found; } bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) @@ -449,4 +592,28 @@ bool QCoreWlanEngine::getAllScInterfaces() return true; } +QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + + if (!ptr) + return QNetworkSession::Invalid; + + if (!ptr->isValid) { + return QNetworkSession::Invalid; + } else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return QNetworkSession::Connected; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + return QNetworkSession::Disconnected; + } else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + return QNetworkSession::NotAvailable; + } else if ((ptr->state & QNetworkConfiguration::Undefined) == + QNetworkConfiguration::Undefined) { + return QNetworkSession::NotAvailable; + } + + return QNetworkSession::Invalid; +} + QT_END_NAMESPACE -- cgit v0.12 From ca7fe1713ff82dcde8fb2fdfb0664b5dfa830bd7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 4 Jan 2010 17:26:36 +1000 Subject: Remove some unused functions and debug output. --- src/plugins/bearer/corewlan/qcorewlanengine.h | 1 - src/plugins/bearer/corewlan/qcorewlanengine.mm | 106 +------------------------ 2 files changed, 2 insertions(+), 105 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index ea9bcfd..237680a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -84,7 +84,6 @@ private: QList getWlanProfiles(const QString &interfaceName); - QList getWifiConfigurations(); bool isKnownSsid(const QString &interfaceName, const QString &ssid); }; diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 7e14e69..6625443 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -116,95 +116,6 @@ QCoreWlanEngine::~QCoreWlanEngine() { } -QList QCoreWlanEngine::getWifiConfigurations() -{ - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - QString interfaceName = i.key(); - if (i.value() == "WLAN") { - if(!isWifiReady(interfaceName)) { - qWarning() << "wifi not powered on"; - return QList(); - } else { - // QList profs = getWlanProfiles(interfaceName); - scanForSsids(interfaceName); - } - } else { - - } - } - return QList (); -} - -#if 0 -QList QCoreWlanEngine::getConfigurations(bool *ok) -{ - if (ok) - *ok = true; - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - QList foundConfigurations; - QList wificonfigs = getWifiConfigurations(); - - uint identifier; - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - if (i.value() == "WLAN") { - QList fetchedConfigurations = scanForSsids(i.key()); - for (int i = 0; i < fetchedConfigurations.count(); ++i) { - - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; - - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; - - identifier = config->name.toUInt(); - configurationInterface[identifier] = config->serviceInterface.name(); - foundConfigurations.append(config); - } - } - - QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; - const QString humanReadableName = interface.humanReadableName(); - cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; - cpPriv->isValid = true; - - if (interface.index()) - identifier = interface.index(); - else - identifier = qHash(interface.hardwareAddress()); - - cpPriv->id = QString::number(identifier); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Undefined; - - if (interface.flags() & QNetworkInterface::IsRunning) { - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->internet = true; - } - if ( !interface.addressEntries().isEmpty()) { - cpPriv->state |= QNetworkConfiguration::Active; - cpPriv->internet = true; - } - configurationInterface[identifier] = interface.name(); - foundConfigurations.append(cpPriv); - } - [autoreleasepool release]; - pollTimer.start(); - return foundConfigurations; -} -#endif - QString QCoreWlanEngine::getInterfaceFromId(const QString &id) { return configurationInterface.value(id); @@ -326,7 +237,6 @@ void QCoreWlanEngine::doRequestUpdate() } } - qDebug() << "Found configuration" << i.key(); QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); if (!interface.isValid()) @@ -348,8 +258,6 @@ void QCoreWlanEngine::doRequestUpdate() QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; - qDebug() << "interface flags:" << interface.flags(); - if (interface.flags() && QNetworkInterface::IsRunning) state = QNetworkConfiguration::Defined; @@ -381,10 +289,8 @@ void QCoreWlanEngine::doRequestUpdate() changed = true; } - if (changed) { - qDebug() << "Configuration changed" << ptr->name << ptr->id; + if (changed) emit configurationChanged(ptr); - } } else { QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); @@ -397,7 +303,6 @@ void QCoreWlanEngine::doRequestUpdate() accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interface.name()); - qDebug() << "Configuration Added" << ptr->name << ptr->id; emit configurationAdded(ptr); } } @@ -405,7 +310,6 @@ void QCoreWlanEngine::doRequestUpdate() while (!previous.isEmpty()) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); - qDebug() << "Configuration Removed" << ptr->name << ptr->id; configurationInterface.remove(ptr->id); emit configurationRemoved(ptr); } @@ -439,8 +343,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { - QString interfaceSsidString = nsstringToQString([currentInterface ssid]); - qDebug() << "interfaceSsidString:" << interfaceSsidString; if (networkSsid == nsstringToQString([currentInterface ssid])) state = QNetworkConfiguration::Active; } else { @@ -449,7 +351,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) else state = QNetworkConfiguration::Defined; } - qDebug() << "state is:" << state; CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; @@ -482,10 +383,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) changed = true; } - if (changed) { - qDebug() << "WLAN Configuration Changed" << interfaceName << ptr->name << ptr->id; + if (changed) emit configurationChanged(ptr); - } } else { QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate); @@ -498,7 +397,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interfaceName); - qDebug() << "WLAN Configuration Added" << interfaceName << ptr->name << ptr->id; emit configurationAdded(ptr); } } -- cgit v0.12 From 31e6fc5ae7f7fbe2f23b519cb76dcc579dac1f41 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 5 Jan 2010 09:06:49 +1000 Subject: Bearer Management Integration 2. --- config.tests/mac/corelwan/corewlan.pro | 4 - config.tests/mac/corelwan/corewlantest.mm | 49 --- config.tests/mac/corewlan/corewlan.pro | 4 + config.tests/mac/corewlan/corewlantest.mm | 49 +++ examples/network/bearercloud/bearercloud.pro | 13 +- examples/network/bearercloud/cloud.cpp | 12 +- examples/network/bearercloud/cloud.h | 2 + examples/network/bearermonitor/bearermonitor.pro | 12 +- examples/network/bearermonitor/sessionwidget.cpp | 15 +- src/network/bearer/bearer.pro | 19 +- src/network/bearer/qcorewlanengine_mac.mm | 121 +++--- src/network/bearer/qcorewlanengine_mac_p.h | 3 +- src/network/bearer/qgenericengine.cpp | 39 +- src/network/bearer/qgenericengine_p.h | 2 +- src/network/bearer/qnativewifiengine_win.cpp | 7 +- src/network/bearer/qnativewifiengine_win_p.h | 2 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 3 + src/network/bearer/qnetworkconfigmanager_s60_p.h | 3 + src/network/bearer/qnetworkconfiguration.cpp | 56 ++- src/network/bearer/qnetworkconfiguration.h | 1 + src/network/bearer/qnetworkconfiguration_maemo_p.h | 13 + src/network/bearer/qnetworkconfiguration_p.h | 6 + src/network/bearer/qnetworkconfiguration_s60_p.cpp | 16 + src/network/bearer/qnetworkconfiguration_s60_p.h | 1 + src/network/bearer/qnetworkmanagerservice_p.cpp | 44 +- src/network/bearer/qnetworksession.cpp | 146 ++++--- src/network/bearer/qnetworksession.h | 3 +- src/network/bearer/qnetworksession_maemo.cpp | 47 +- src/network/bearer/qnetworksession_maemo_p.h | 6 +- src/network/bearer/qnetworksession_p.cpp | 32 +- src/network/bearer/qnetworksession_p.h | 4 +- src/network/bearer/qnetworksession_s60_p.cpp | 76 +--- src/network/bearer/qnetworksession_s60_p.h | 3 +- src/network/bearer/qnetworksessionengine_p.h | 2 +- src/network/bearer/qnlaengine_win.cpp | 26 +- src/network/bearer/qnmwifiengine_unix.cpp | 473 ++++++--------------- src/network/bearer/qnmwifiengine_unix_p.h | 7 +- .../qnetworkconfigmanager.pro | 3 +- .../tst_qnetworkconfigmanager.cpp | 8 +- .../qnetworkconfiguration.pro | 3 +- .../tst_qnetworkconfiguration.cpp | 8 +- tests/auto/qnetworksession/lackey/lackey.pro | 3 +- tests/auto/qnetworksession/lackey/main.cpp | 2 +- .../tst_qnetworksession/tst_qnetworksession.cpp | 86 ++-- .../tst_qnetworksession/tst_qnetworksession.pro | 3 +- tests/manual/bearerex/bearerex.cpp | 37 +- tests/manual/bearerex/bearerex.h | 3 + tests/manual/bearerex/bearerex.pro | 11 +- tests/manual/networkmanager/networkmanager.pro | 3 +- tests/manual/networkmanager/nmview.cpp | 2 - tests/manual/networkmanager/nmview.h | 2 + 51 files changed, 696 insertions(+), 799 deletions(-) delete mode 100644 config.tests/mac/corelwan/corewlan.pro delete mode 100644 config.tests/mac/corelwan/corewlantest.mm create mode 100644 config.tests/mac/corewlan/corewlan.pro create mode 100644 config.tests/mac/corewlan/corewlantest.mm diff --git a/config.tests/mac/corelwan/corewlan.pro b/config.tests/mac/corelwan/corewlan.pro deleted file mode 100644 index 54a6c36..0000000 --- a/config.tests/mac/corelwan/corewlan.pro +++ /dev/null @@ -1,4 +0,0 @@ -SOURCES=corewlantest.mm -TARGET=corewlan -LIBS += -framework CoreWLAN -framework Foundation -CONFIG-=app_bundle diff --git a/config.tests/mac/corelwan/corewlantest.mm b/config.tests/mac/corelwan/corewlantest.mm deleted file mode 100644 index bcddf44..0000000 --- a/config.tests/mac/corelwan/corewlantest.mm +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** 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 Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main() -{ - [CWInterface interfaceWithName:@"en2"]; - return 0; -} diff --git a/config.tests/mac/corewlan/corewlan.pro b/config.tests/mac/corewlan/corewlan.pro new file mode 100644 index 0000000..54a6c36 --- /dev/null +++ b/config.tests/mac/corewlan/corewlan.pro @@ -0,0 +1,4 @@ +SOURCES=corewlantest.mm +TARGET=corewlan +LIBS += -framework CoreWLAN -framework Foundation +CONFIG-=app_bundle diff --git a/config.tests/mac/corewlan/corewlantest.mm b/config.tests/mac/corewlan/corewlantest.mm new file mode 100644 index 0000000..bcddf44 --- /dev/null +++ b/config.tests/mac/corewlan/corewlantest.mm @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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 Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +int main() +{ + [CWInterface interfaceWithName:@"en2"]; + return 0; +} diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro index 308ddda..75e3049 100644 --- a/examples/network/bearercloud/bearercloud.pro +++ b/examples/network/bearercloud/bearercloud.pro @@ -15,16 +15,9 @@ INCLUDEPATH += ../../src/bearer include(../examples.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer CONFIG += console -include(../examples.pri) - - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - INCLUDEPATH += ../../ - contains(CONFIG, debug) { - } -} +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 4a1bde7..61bd88e 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -226,7 +226,7 @@ QVariant Cloud::itemChange(GraphicsItemChange change, const QVariant &value) void Cloud::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - if (session->isActive()) + if (session->isOpen()) session->close(); else session->open(); @@ -258,7 +258,7 @@ void Cloud::stateChanged(QNetworkSession::State state) tooltip += tr("
Interface: %1").arg(interface.humanReadableName()); tooltip += tr("
Id: %1").arg(configuration.identifier()); - const QString bearerName = session->bearerName(); + const QString bearerName = configuration.bearerName(); if (!bearerName.isEmpty()) tooltip += tr("
Bearer: %1").arg(bearerName); @@ -289,10 +289,10 @@ void Cloud::stateChanged(QNetworkSession::State state) s = s.arg(tr("Unknown")); } - if (session->isActive()) - s = s.arg(tr("Active")); + if (session->isOpen()) + s = s.arg(tr("Open")); else - s = s.arg(tr("Inactive")); + s = s.arg(tr("Closed")); tooltip += s; @@ -307,7 +307,7 @@ void Cloud::stateChanged(QNetworkSession::State state) //! [1] void Cloud::newConfigurationActivated() { - const QString bearerName = session->bearerName(); + const QString bearerName = configuration.bearerName(); if (!svgCache.contains(bearerName)) { if (bearerName == QLatin1String("WLAN")) svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg"))); diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h index 4ce43df..b542bf7 100644 --- a/examples/network/bearercloud/cloud.h +++ b/examples/network/bearercloud/cloud.h @@ -45,8 +45,10 @@ #include QTM_USE_NAMESPACE +QT_BEGIN_NAMESPACE class QGraphicsTextItem; class QGraphicsSvgItem; +QT_END_NAMESPACE class Cloud : public QObject, public QGraphicsItem { diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index c8fb3c2..acbee71 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -17,16 +17,12 @@ INCLUDEPATH += ../../src/bearer include(../examples.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer + win32:!wince*:LIBS += -lWs2_32 wince*:LIBS += -lWs2 CONFIG += console -include(../examples.pri) - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - contains(CONFIG, debug) { - } -} +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 7633dd7..0277d87 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "sessionwidget.h" +#include "qnetworkconfigmanager.h" SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent) : QWidget(parent) @@ -79,7 +80,13 @@ void SessionWidget::updateSession() updateSessionState(session->state()); updateSessionError(session->error()); - bearer->setText(session->bearerName()); + if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) + bearer->setText(session->configuration().bearerName()); + else { + QNetworkConfigurationManager mgr; + QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString()); + bearer->setText(c.bearerName()); + } interfaceName->setText(session->interface().humanReadableName()); interfaceGuid->setText(session->interface().name()); @@ -140,10 +147,10 @@ void SessionWidget::updateSessionState(QNetworkSession::State state) s = s.arg(tr("Unknown")); } - if (session->isActive()) - s = s.arg(tr("Active")); + if (session->isOpen()) + s = s.arg(tr("Open")); else - s = s.arg(tr("Inactive")); + s = s.arg(tr("Closed")); sessionState->setText(s); } diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro index 2255b7c..ce39db6 100644 --- a/src/network/bearer/bearer.pro +++ b/src/network/bearer/bearer.pro @@ -19,8 +19,7 @@ SOURCES += qnetworksession.cpp \ qnetworkconfiguration.cpp symbian: { - exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { + contains(snap_enabled, yes) { message("Building with SNAP support") DEFINES += SNAP_FUNCTIONALITY_AVAILABLE=1 LIBS += -lcmmanager @@ -48,21 +47,21 @@ symbian: { -lefsrv \ -lnetmeta + TARGET.CAPABILITY = ALL -TCB + TARGET.UID3 = 0x2002AC81 + deploy.path = $${EPOCROOT} exportheaders.sources = $$PUBLIC_HEADERS exportheaders.path = epoc32/include - for(header, exportheaders.sources) { BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" } - - bearer_deployment.sources = QtBearer.dll - bearer_deployment.path = /sys/bin - DEPLOYMENT += bearer_deployment - - TARGET.CAPABILITY = All -TCB + + QtBearerManagement.sources = QtBearer.dll + QtBearerManagement.path = /sys/bin + DEPLOYMENT += QtBearerManagement } else { - maemo { + maemo6 { QT += dbus CONFIG += link_pkgconfig diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm index 5451615..41ec79a 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -102,7 +102,7 @@ inline QStringList nsarrayToQStringList(void *nsarray) static QString qGetInterfaceType(const QString &interfaceString) { - return networkInterfaces.value(interfaceString); + return networkInterfaces.value(interfaceString, QLatin1String("Unknown")); } QCoreWlanEngine::QCoreWlanEngine(QObject *parent) @@ -115,66 +115,52 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent) QCoreWlanEngine::~QCoreWlanEngine() { -} - -QList QCoreWlanEngine::getWifiConfigurations() -{ - QMapIterator i(networkInterfaces); - while (i.hasNext()) { - i.next(); - QString interfaceName = i.key(); - if (i.value() == "WLAN") { - if(!isWifiReady(interfaceName)) { - qWarning() << "wifi not powered on"; - return QList(); - } else { - // QList profs = getWlanProfiles(interfaceName); - scanForSsids(interfaceName); - } - } else { - - } + QNetworkConfigurationPrivate* cpPriv = 0; + foundConfigurations.clear(); + while(!foundConfigurations.isEmpty()) { + cpPriv = foundConfigurations.takeFirst(); + delete cpPriv; } - return QList (); } QList QCoreWlanEngine::getConfigurations(bool *ok) { if (ok) *ok = true; - NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; - - QList foundConfigurations; - QList wificonfigs = getWifiConfigurations(); + foundConfigurations.clear(); uint identifier; QMapIterator i(networkInterfaces); + QNetworkConfigurationPrivate* cpPriv = 0; while (i.hasNext()) { i.next(); if (i.value() == "WLAN") { QList fetchedConfigurations = scanForSsids(i.key()); for (int i = 0; i < fetchedConfigurations.count(); ++i) { - QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate; - config->name = fetchedConfigurations.at(i)->name; - config->isValid = fetchedConfigurations.at(i)->isValid; - config->id = fetchedConfigurations.at(i)->id; + QNetworkConfigurationPrivate *config = new QNetworkConfigurationPrivate(); + cpPriv = fetchedConfigurations.at(i); + config->name = cpPriv->name; + config->isValid = cpPriv->isValid; + config->id = cpPriv->id; - config->state = fetchedConfigurations.at(i)->state; - config->type = fetchedConfigurations.at(i)->type; - config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; - config->purpose = fetchedConfigurations.at(i)->purpose; - config->internet = fetchedConfigurations.at(i)->internet; - config->serviceInterface = fetchedConfigurations.at(i)->serviceInterface; + config->state = cpPriv->state; + config->type = cpPriv->type; + config->roamingSupported = cpPriv->roamingSupported; + config->purpose = cpPriv->purpose; + config->internet = cpPriv->internet; + config->serviceInterface = cpPriv->serviceInterface; + config->bearer = cpPriv->bearer; identifier = config->name.toUInt(); configurationInterface[identifier] = config->serviceInterface.name(); foundConfigurations.append(config); + delete cpPriv; } } QNetworkInterface interface = QNetworkInterface::interfaceFromName(i.key()); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; + QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate(); const QString humanReadableName = interface.humanReadableName(); cpPriv->name = humanReadableName.isEmpty() ? interface.name() : humanReadableName; cpPriv->isValid = true; @@ -197,9 +183,10 @@ QList QCoreWlanEngine::getConfigurations(bool *o cpPriv->internet = true; } configurationInterface[identifier] = interface.name(); + cpPriv->bearer = interface.name().isEmpty()? QLatin1String("Unknown") : qGetInterfaceType(interface.name()); foundConfigurations.append(cpPriv); } - [autoreleasepool release]; + pollTimer.start(); return foundConfigurations; } @@ -214,16 +201,6 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id.toUInt()); } -QString QCoreWlanEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - void QCoreWlanEngine::connectToId(const QString &id) { NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; @@ -239,14 +216,22 @@ void QCoreWlanEngine::connectToId(const QString &id) NSEnumerator *enumerator = [remNets objectEnumerator]; CWWirelessProfile *wProfile; NSUInteger index=0; + CWNetwork *apNetwork; + NSDictionary *parametersDict; + NSArray* apArray; + + CW8021XProfile *user8021XProfile; + NSError *err; + NSMutableDictionary *params; + while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile if(id == nsstringToQString([wProfile ssid])) { - CW8021XProfile *user8021XProfile = nil; + user8021XProfile = nil; user8021XProfile = [ wProfile user8021XProfile]; - NSError *err = nil; - NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; + err = nil; + params = [NSMutableDictionary dictionaryWithCapacity:0]; if(user8021XProfile) { [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; @@ -254,17 +239,22 @@ void QCoreWlanEngine::connectToId(const QString &id) [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; } - NSDictionary *parametersDict = nil; - NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + parametersDict = nil; + apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; + if(!err) { + for(uint row=0; row < [apArray count]; row++ ) { - CWNetwork *apNetwork = [apArray objectAtIndex:row]; + apNetwork = [apArray objectAtIndex:row]; if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { + bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; + if(!result) { qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]); emit connectionError(id, ConnectError); } else { + [apNetwork release]; [autoreleasepool release]; return; } @@ -274,6 +264,8 @@ void QCoreWlanEngine::connectToId(const QString &id) } index++; } + [apNetwork release]; + emit connectionError(id, InterfaceLookupError); #endif } else { @@ -325,24 +317,21 @@ QList QCoreWlanEngine::scanForSsids(const QStrin NSDictionary *parametersDict = nil; NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + CWNetwork *apNetwork; if(!err) { for(uint row=0; row < [apArray count]; row++ ) { - CWNetwork *apNetwork = [apArray objectAtIndex:row]; + NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init]; + + apNetwork = [apArray objectAtIndex:row]; QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); QString networkSsid = nsstringToQString([apNetwork ssid]); cpPriv->name = networkSsid; cpPriv->isValid = true; cpPriv->id = networkSsid; cpPriv->internet = true; + cpPriv->bearer = QLatin1String("WLAN"); cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(nsstringToQString([[CWInterface interface] name])); - - CWWirelessProfile *networkProfile = apNetwork.wirelessProfile; - CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile; - if(!userNetworkProfile) { - } else { - qWarning() <<"Has profile!" ; - } + cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName); if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); @@ -364,12 +353,14 @@ QList QCoreWlanEngine::scanForSsids(const QStrin else cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; foundConfigs.append(cpPriv); + [looppool release]; } } else { qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription]) < getWlanProfiles(const QString &interfaceName); - QList getWifiConfigurations(); bool isKnownSsid(const QString &interfaceName, const QString &ssid); + QList foundConfigurations; + }; QTM_END_NAMESPACE diff --git a/src/network/bearer/qgenericengine.cpp b/src/network/bearer/qgenericengine.cpp index 184a69c..10cea0c 100644 --- a/src/network/bearer/qgenericengine.cpp +++ b/src/network/bearer/qgenericengine.cpp @@ -53,6 +53,13 @@ #include "qnetworksessionengine_win_p.h" #endif +#ifdef Q_OS_LINUX +#include +#include +#include +#include +#endif + QTM_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QGenericEngine, genericEngine) @@ -69,7 +76,7 @@ static QString qGetInterfaceType(const QString &interface) HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QString(); + return QLatin1String("Unknown"); oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -77,7 +84,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QString(); + return QLatin1String("Unknown"); } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -90,7 +97,7 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) return QLatin1String("Ethernet"); else - return QString(); + return QLatin1String("Unknown"); } CloseHandle(handle); @@ -114,11 +121,24 @@ static QString qGetInterfaceType(const QString &interface) #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << medium << physicalMedium; #endif +#elif defined(Q_OS_LINUX) + int sock = socket(AF_INET, SOCK_DGRAM, 0); + + ifreq request; + strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name)); + if (ioctl(sock, SIOCGIFHWADDR, &request) >= 0) { + switch (request.ifr_hwaddr.sa_family) { + case ARPHRD_ETHER: + return QLatin1String("Ethernet"); + } + } + + close(sock); #else Q_UNUSED(interface); #endif - return QString(); + return QLatin1String("Unknown"); } QGenericEngine::QGenericEngine(QObject *parent) @@ -176,6 +196,11 @@ QList QGenericEngine::getConfigurations(bool *ok cpPriv->id = QString::number(identifier); cpPriv->state = QNetworkConfiguration::Discovered; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + if (interface.name().isEmpty()) + cpPriv->bearer = QLatin1String("Unknown"); + else + cpPriv->bearer = qGetInterfaceType(interface.name()); + if (interface.flags() & QNetworkInterface::IsUp) cpPriv->state |= QNetworkConfiguration::Active; @@ -199,15 +224,15 @@ bool QGenericEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id.toUInt()); } -QString QGenericEngine::bearerName(const QString &id) +/*QString QGenericEngine::bearerName(const QString &id) { QString interface = getInterfaceFromId(id); if (interface.isEmpty()) - return QString(); + return QLatin1String("Unknown"); return qGetInterfaceType(interface); -} +}*/ void QGenericEngine::connectToId(const QString &id) { diff --git a/src/network/bearer/qgenericengine_p.h b/src/network/bearer/qgenericengine_p.h index 976776e..5c08aa2 100644 --- a/src/network/bearer/qgenericengine_p.h +++ b/src/network/bearer/qgenericengine_p.h @@ -74,7 +74,7 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); + //QString bearerName(const QString &id); void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/network/bearer/qnativewifiengine_win.cpp b/src/network/bearer/qnativewifiengine_win.cpp index d8fe5fb..008a9cf 100644 --- a/src/network/bearer/qnativewifiengine_win.cpp +++ b/src/network/bearer/qnativewifiengine_win.cpp @@ -479,6 +479,8 @@ QList QNativeWifiEngine::getConfigurations(bool } cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->bearer = QLatin1String("WLAN"); + foundConfigurations.append(cpPriv); } @@ -537,6 +539,7 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id) } local_WlanFreeMemory(connectionAttributes); + local_WlanFreeMemory(interfaceList); } return QString(); @@ -591,10 +594,10 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) return false; } -QString QNativeWifiEngine::bearerName(const QString &) +/*QString QNativeWifiEngine::bearerName(const QString &) { return QLatin1String("WLAN"); -} +}*/ void QNativeWifiEngine::connectToId(const QString &id) { diff --git a/src/network/bearer/qnativewifiengine_win_p.h b/src/network/bearer/qnativewifiengine_win_p.h index 0d5bcb0..e911746 100644 --- a/src/network/bearer/qnativewifiengine_win_p.h +++ b/src/network/bearer/qnativewifiengine_win_p.h @@ -73,7 +73,7 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); + //QString bearerName(const QString &id); void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 8b15f41..39426d0 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -78,6 +78,7 @@ void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurati ptr.data()->roamingSupported = cpPriv->roamingSupported; ptr.data()->purpose = cpPriv->purpose; ptr.data()->internet = cpPriv->internet; + ptr.data()->bearer = cpPriv->bearer; accessPointConfigurations.insert(cpPriv->id, ptr); configurationEngine.insert(cpPriv->id, engine); @@ -135,6 +136,7 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura ptr.data()->type != cpPriv->type || ptr.data()->roamingSupported != cpPriv->roamingSupported || ptr.data()->purpose != cpPriv->purpose || + ptr.data()->bearer != cpPriv->bearer || ptr.data()->internet != cpPriv->internet) { const QNetworkConfiguration::StateFlags oldState = ptr.data()->state; @@ -147,6 +149,7 @@ void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigura ptr.data()->roamingSupported = cpPriv->roamingSupported; ptr.data()->purpose = cpPriv->purpose; ptr.data()->internet = cpPriv->internet; + ptr.data()->bearer = cpPriv->bearer; if (!firstUpdate) { QNetworkConfiguration item; diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h index 296d67f..679fa6c 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -63,7 +63,10 @@ #endif class CCommsDatabase; + +QT_BEGIN_NAMESPACE class QTimer; +QT_END_NAMESPACE QTM_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index c92b356..56907c3 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -164,9 +164,9 @@ QTM_BEGIN_NAMESPACE QNetworkConfiguration::Defined. If the configuration is a service network this flag is set if at least one of the underlying access points configurations has the Discovered state. - \value Active The configuration is currently used by an open/active network session - (see \l QNetworkSession::isActive()). However this does not mean that the - current process is the entity that created the active session. It merely + \value Active The configuration is currently used by an open network session + (see \l QNetworkSession::isOpen()). However this does not mean that the + current process is the entity that created the open session. It merely indicates that if a new QNetworkSession were to be constructed based on this configuration \l QNetworkSession::state() would return \l QNetworkSession::Connected. This state implies the @@ -344,6 +344,56 @@ QList QNetworkConfiguration::children() const return results; } +/*! + Returns the type of bearer. The string is not translated and + therefore can not be shown to the user. The subsequent table presents the currently known + bearer types: + + \table + \header + \o Value + \o Description + \row + \o Unknown + \o The session is based on an unknown or unspecified bearer type. + \row + \o Ethernet + \o The session is based on Ethernet. + \row + \o WLAN + \o The session is based on Wireless LAN. + \row + \o 2G + \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. + \row + \o CDMA2000 + \o The session uses CDMA. + \row + \o WCDMA + \o The session uses W-CDMA/UMTS. + \row + \o HSPA + \o The session uses High Speed Packet Access. + \row + \o Bluetooth + \o The session uses Bluetooth. + \row + \o WiMAX + \o The session uses WiMAX. + \endtable + + This function returns an empty string if this is an invalid configuration, + a network configuration of type \l QNetworkConfiguration::ServiceNetwork or + \l QNetworkConfiguration::UserChoice. +*/ +QString QNetworkConfiguration::bearerName() const +{ + if (!isValid()) + return QString(); + + return d->bearerName(); +} + QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index f8c17d5..860be4b 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -91,6 +91,7 @@ public: StateFlags state() const; Type type() const; Purpose purpose() const; + QString bearerName() const; QString identifier() const; bool isRoamingAvailable() const; QList children() const; diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h index 8d786aa..2597605 100644 --- a/src/network/bearer/qnetworkconfiguration_maemo_p.h +++ b/src/network/bearer/qnetworkconfiguration_maemo_p.h @@ -89,6 +89,19 @@ public: /* In Maemo the id field (defined above) is the IAP id (which typically is UUID) */ QByteArray network_id; /* typically WLAN ssid or similar */ QString iap_type; /* is this one WLAN or GPRS */ + QString bearerName() const + { + if (iap_type == "WLAN_INFRA" || + iap_type == "WLAN_ADHOC") + return QString("WLAN"); + else if (iap_type == "GPRS") + return QString("HSPA"); + + //return whatever it is + //this may have to be split up later on + return iap_type; + } + uint32_t network_attrs; /* network attributes for this IAP, this is the value returned by icd and passed to it when connecting */ QString service_type; diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index a3bcd9a..c2834e6 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -78,6 +78,12 @@ public: } QString name; + QString bearer; + inline QString bearerName() const + { + return bearer; + } + bool isValid; QString id; QNetworkConfiguration::StateFlags state; diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 61548ba..02115d9 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -57,4 +57,20 @@ QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate() serviceNetworkMembers.clear(); } +QString QNetworkConfigurationPrivate::bearerName() const +{ + switch (bearer) { + case QNetworkConfigurationPrivate::BearerEthernet: return QLatin1String("Ethernet"); + case QNetworkConfigurationPrivate::BearerWLAN: return QLatin1String("WLAN"); + case QNetworkConfigurationPrivate::Bearer2G: return QLatin1String("2G"); + case QNetworkConfigurationPrivate::BearerCDMA2000: return QLatin1String("CDMA2000"); + case QNetworkConfigurationPrivate::BearerWCDMA: return QLatin1String("WCDMA"); + case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); + case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); + case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); + default: return QLatin1String("Unknown"); + } +} + + QTM_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h index 44f8f56..6c87200 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -87,6 +87,7 @@ public: QList > serviceNetworkMembers; QNetworkConfigurationPrivate::Bearer bearer; + QString bearerName() const; TUint32 numericId; TUint connectionId; diff --git a/src/network/bearer/qnetworkmanagerservice_p.cpp b/src/network/bearer/qnetworkmanagerservice_p.cpp index 2f91af0..5804686 100644 --- a/src/network/bearer/qnetworkmanagerservice_p.cpp +++ b/src/network/bearer/qnetworkmanagerservice_p.cpp @@ -70,7 +70,7 @@ public: }; QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) - : QObject(parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfacePrivate(); d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE, @@ -93,6 +93,8 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent) QNetworkManagerInterface::~QNetworkManagerInterface() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -195,7 +197,7 @@ public: }; QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent) - : QObject(parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceAccessPointPrivate(); d->path = dbusPathName; @@ -214,6 +216,8 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -229,6 +233,9 @@ bool QNetworkManagerInterfaceAccessPoint::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -304,7 +311,7 @@ public: }; QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent) - : QObject(parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceDevicePrivate(); d->path = deviceObjectPath; @@ -322,6 +329,8 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -337,6 +346,9 @@ bool QNetworkManagerInterfaceDevice::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)), this, SIGNAL(stateChanged(const QString&, quint32))); @@ -396,6 +408,7 @@ public: }; QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceDeviceWiredPrivate(); d->path = ifaceDevicePath; @@ -413,6 +426,8 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -430,6 +445,9 @@ bool QNetworkManagerInterfaceDeviceWired::setConnections() bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -473,6 +491,7 @@ public: }; QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerInterfaceDeviceWirelessPrivate(); d->path = ifaceDevicePath; @@ -490,6 +509,8 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -505,6 +526,9 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -592,7 +616,6 @@ public: QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent) : QObject(parent) { -// qWarning() << __PRETTY_FUNCTION__; d = new QNetworkManagerSettingsPrivate(); d->path = settingsService; d->connectionInterface = new QDBusInterface(settingsService, @@ -655,6 +678,7 @@ public: }; QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { qDBusRegisterMetaType(); d = new QNetworkManagerSettingsConnectionPrivate(); @@ -676,6 +700,8 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -697,6 +723,9 @@ bool QNetworkManagerSettingsConnection::setConnections() allOk = true; } + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)), this,SIGNAL(removed( const QString &))); @@ -880,6 +909,7 @@ public: }; QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent) + : QObject(parent), nmDBusHelper(0) { d = new QNetworkManagerConnectionActivePrivate(); d->path = activeConnectionObjectPath; @@ -897,6 +927,8 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() { + if (nmDBusHelper) + delete nmDBusHelper; delete d->connectionInterface; delete d; } @@ -912,6 +944,9 @@ bool QNetworkManagerConnectionActive::setConnections() return false; bool allOk = false; + if (nmDBusHelper) + delete nmDBusHelper; + nmDBusHelper = 0; nmDBusHelper = new QNmDBusHelper; connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap)), this,SIGNAL(propertiesChanged( const QString &, QMap))); @@ -975,6 +1010,7 @@ public: }; QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent) + : QObject(parent) { d = new QNetworkManagerIp4ConfigPrivate(); d->path = deviceObjectPath; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index d3a323a..6171350 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -46,7 +46,7 @@ #ifdef Q_OS_SYMBIAN #include "qnetworksession_s60_p.h" -#elif MAEMO +#elif Q_WS_MAEMO_6 #include "qnetworksession_maemo_p.h" #else #include "qnetworksession_p.h" @@ -72,34 +72,41 @@ QTM_BEGIN_NAMESPACE QNetworkSession supports session management within the same process and depending on the platform's capabilities may support out-of-process sessions. If the same - network configuration is used by multiple active sessions the underlying network interface is only terminated once + network configuration is used by multiple open sessions the underlying network interface is only terminated once the last session has been closed. \section1 Roaming Applications may connect to the preferredConfigurationChanged() signal in order to receive notifications when a more suitable access point becomes available. - In response to this signal the application may initiate the roaming via migrate() - or may ignore() the new access point. Once the session has roamed the + In response to this signal the application must either initiate the roaming via migrate() + or ignore() the new access point. Once the session has roamed the newConfigurationActivated() signal is emitted. The application may now test the - carrier and can accept() or reject() it. The session will return to the previous - access point if the roaming was rejected. + carrier and must either accept() or reject() it. The session will return to the previous + access point if the roaming was rejected. The subsequent state diagram depicts the required + state transitions. + + \image roaming-states.png - Some platforms may support the notion of forced roaming and application level roaming (ALR). + Some platforms may distinguish forced roaming and application level roaming (ALR). ALR implies that the application controls (via migrate(), ignore(), accept() and reject()) - whether a network session can roam from one network configuration to the next. Such control is useful + whether a network session can roam from one access point to the next. Such control is useful if the application maintains stateful socket connections and wants to control the transition from - one interface to the next. - - Forced roaming implies that the system automatically roams to the next network without + one interface to the next. Forced roaming implies that the system automatically roams to the next network without consulting the application. This has the advantage that the application can make use of roaming features without actually being aware of it. It is expected that the application detects that the underlying socket is broken and automatically reconnects via the new network link. - If the platform supports both modes of roaming an application indicates its preference + If the platform supports both modes of roaming, an application indicates its preference by connecting to the preferredConfigurationChanged() signal. Connecting to this signal means that the application wants to take control over the roaming behavior and therefore implies application - level roaming. + level roaming. If the client does not connect to the preferredConfigurationChanged(), forced roaming + is used. If forced roaming is not supported the network session will not roam by default. + + Some applications may want to suppress any form of roaming altogether. Possible use cases may be + high priority downloads or remote services which cannot handle a roaming enabled client. Clients + can suppress roaming by connecting to the preferredConfigurationChanged() signal and answer each + signal emission with ignore(). \sa QNetworkConfiguration, QNetworkConfigurationManager */ @@ -119,7 +126,7 @@ QTM_BEGIN_NAMESPACE \value Connecting The network session is being established. \value Connected The network session is connected. If the current process wishes to use this session it has to register its interest by calling open(). A network session - is considered to be ready for socket operations if it isActive() and connected. + is considered to be ready for socket operations if it isOpen() and connected. \value Closing The network session is in the process of being shut down. \value Disconnected The network session is not connected. The associated QNetworkConfiguration has the state QNetworkConfiguration::Discovered. @@ -167,9 +174,8 @@ QTM_BEGIN_NAMESPACE details such as proxy settings and \a isSeamless indicates whether roaming will break the sessions IP address. - As a consequence to this signal the application may start the roaming process - by calling migrate() or may chose to ignore() the new access point. If the application - doesn't call either of the two functions the session ignores the migration opportunity. + As a consequence to this signal the application must either start the roaming process + by calling migrate() or choose to ignore() the new access point. If the roaming process is non-seamless the IP address will change which means that a socket becomes invalid. However seamless mobility can ensure that the local IP address @@ -194,7 +200,7 @@ QTM_BEGIN_NAMESPACE This signal is emitted once the session has roamed to the new access point. The application may reopen its socket and test the suitability of the new network link. - Subsequently it may accept() or reject() the new access point. + Subsequently it must either accept() or reject() the new access point. \sa accept(), reject() */ @@ -239,13 +245,13 @@ QNetworkSession::~QNetworkSession() } /*! - Creates an active/open session which increases the session counter on the underlying network interface. + Creates an open session which increases the session counter on the underlying network interface. The system will not terminate a network interface until the session reference counter reaches zero. - Therefore an active session allows an application to register its use of the interface. + Therefore an open session allows an application to register its use of the interface. - The interface is started if it is not active yet. Some platforms may not provide support - for out-of-process sessions. On such platforms the session counter ignores any sessions - held by another process. The platform capabilities can be + As a result of calling open() the interface will be started if it is not connected/up yet. + Some platforms may not provide support for out-of-process sessions. On such platforms the session + counter ignores any sessions held by another process. The platform capabilities can be detected via QNetworkConfigurationManager::capabilities(). Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired @@ -253,7 +259,7 @@ QNetworkSession::~QNetworkSession() It is not a requirement to open a session in order to monitor the underlying network interface. - \sa close(), stop(), isActive() + \sa close(), stop(), isOpen() */ void QNetworkSession::open() { @@ -279,7 +285,7 @@ void QNetworkSession::open() */ bool QNetworkSession::waitForOpened(int msecs) { - if (d->isActive) + if (d->isOpen) return true; if (d->state != Connecting) @@ -297,13 +303,13 @@ bool QNetworkSession::waitForOpened(int msecs) loop->disconnect(); loop->deleteLater(); - return d->isActive; + return d->isOpen; } /*! Decreases the session counter on the associated network configuration. If the session counter reaches zero the active network interface is shut down. This also means that state() will only change from \l Connected to - \l Disconnected if this was the last active session. + \l Disconnected if the current session was the last open session. If the platform does not support out-of-process sessions calling this function does not stop the interface. In this case \l{stop()} has to be used to force a shut down. @@ -312,7 +318,7 @@ bool QNetworkSession::waitForOpened(int msecs) Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired by connecting to the stateChanged(), opened() or error() signals. - \sa open(), stop(), isActive() + \sa open(), stop(), isOpen() */ void QNetworkSession::close() { @@ -320,7 +326,7 @@ void QNetworkSession::close() } /*! - Invalidates all active sessions against the network interface and therefore stops the + Invalidates all open sessions against the network interface and therefore stops the underlying network interface. This function always changes the session's state() flag to \l Disconnected. @@ -341,15 +347,19 @@ QNetworkConfiguration QNetworkSession::configuration() const return d->publicConfig; } -/*! - Returns the type of bearer currently used by this session. The string is not translated and therefore can - not be shown to the user. The subsequent table presents the currently known bearer types: +/* + Returns the type of bearer currently used by this session. The string is not translated and + therefore can not be shown to the user. The subsequent table presents the currently known + bearer types: \table \header \o Value \o Description \row + \o Unknown + \o The session is based on an unknown or unspecified bearer type. + \row \o Ethernet \o The session is based on Ethernet. \row @@ -380,12 +390,14 @@ QNetworkConfiguration QNetworkSession::configuration() const active configuration is returned. Therefore the bearer type may change over time. - This function returns an empty string if this session is based on an invalid configuration. + This function returns an empty string if this session is based on an invalid configuration, or + a network configuration of type \l QNetworkConfiguration::ServiceNetwork with no + \l {QNetworkConfiguration::children()}{children}. */ -QString QNetworkSession::bearerName() const +/*QString QNetworkSession::bearerName() const { return d->bearerName(); -} +}*/ /*! Returns the network interface that is used by this session. @@ -402,25 +414,29 @@ QNetworkInterface QNetworkSession::interface() const } /*! - Returns true if this object holds an active session on the underlying network interface. + Returns true if this session is open. If the number of all open sessions is greater than + zero the underlying network interface will remain connected/up. + The session can be controlled via open() and close(). */ -bool QNetworkSession::isActive() const +bool QNetworkSession::isOpen() const { - return d->isActive; + return d->isOpen; } /*! - Returns the state of the session. If the session is based on a - single access point configuration the state of the session is the same as the state of the - associated network interface. Therefore a network session object can be used to monitor - network interfaces. + Returns the state of the session. + + If the session is based on a single access point configuration the state of the + session is the same as the state of the associated network interface. Therefore + a network session object can be used to monitor network interfaces. A \l QNetworkConfiguration::ServiceNetwork based session summarizes the state of all its children - and therefore returns the \l Connected state if at least one of its sub configurations is connected. + and therefore returns the \l Connected state if at least one of the service network's + \l {QNetworkConfiguration::children()}{children()} configurations is active. - Note that it is not required to hold an active session in order to obtain the network interface state. - A connected but inactive session may be used to monitor network interfaces whereas an active and connected + Note that it is not required to hold an open session in order to obtain the network interface state. + A connected but closed session may be used to monitor network interfaces whereas an open and connected session object may prevent the network interface from being shut down. \sa error(), stateChanged() @@ -463,8 +479,8 @@ QString QNetworkSession::errorString() const \header \o Key \o Description \row - \o ActiveConfigurationIdentifier - \o If the session \l isActive() this property returns the identifier of the + \o ActiveConfiguration + \o If the session \l isOpen() this property returns the identifier of the QNetworkConfiguration that is used by this session; otherwise an empty string. The main purpose of this key is to determine which Internet access point is used @@ -476,7 +492,7 @@ QString QNetworkSession::errorString() const QNetworkSession* session = new QNetworkSession(ap); ... //code activates session - QString ident = session->sessionProperty("ActiveConfigurationIdentifier").toString(); + QString ident = session->sessionProperty("ActiveConfiguration").toString(); if ( ap.type() == QNetworkConfiguration::ServiceNetwork ) { Q_ASSERT( ap.identifier() != ident ); Q_ASSERT( ap.children().contains( mgr.configurationFromIdentifier(ident) ) ); @@ -485,17 +501,17 @@ QString QNetworkSession::errorString() const } \endcode \row - \o UserChoiceConfigurationIdentifier - \o If the session \l isActive() and is bound to a QNetworkConfiguration of type + \o UserChoiceConfiguration + \o If the session \l isOpen() and is bound to a QNetworkConfiguration of type UserChoice, this property returns the identifier of the QNetworkConfiguration that the configuration resolved to when \l open() was called; otherwise an empty string. The purpose of this key is to determine the real QNetworkConfiguration that the - session is using. This key is different to \i ActiveConfigurationIdentifier in that + session is using. This key is different to \i ActiveConfiguration in that this key may return an identifier for either a \l {QNetworkConfiguration::ServiceNetwork}{service network} or a \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations - whereas \i ActiveConfigurationIdentifier always returns identifiers for + whereas \i ActiveConfiguration always returns identifiers to \l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations. \row \o ConnectInBackground @@ -509,15 +525,15 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const if (!d->publicConfig.isValid()) return QVariant(); - if (key == "ActiveConfigurationIdentifier") { - if (!d->isActive) + if (key == "ActiveConfiguration") { + if (!d->isOpen) return QString(); else return d->activeConfig.identifier(); } - if (key == "UserChoiceConfigurationIdentifier") { - if (!d->isActive || d->publicConfig.type() != QNetworkConfiguration::UserChoice) + if (key == "UserChoiceConfiguration") { + if (!d->isOpen || d->publicConfig.type() != QNetworkConfiguration::UserChoice) return QString(); if (d->serviceConfig.isValid()) @@ -534,13 +550,13 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const \a key. Removing an already set property can be achieved by passing an invalid QVariant. - Note that the \i UserChoiceConfigurationIdentifier and \i ActiveConfigurationIdentifier + Note that the \i UserChoiceConfiguration and \i ActiveConfiguration properties are read only and cannot be changed using this method. */ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) { - if (key == "ActiveConfigurationIdentifier" - || key == "UserChoiceConfigurationIdentifier") + if (key == "ActiveConfiguration" + || key == "UserChoiceConfiguration") return; d->setSessionProperty(key, value); @@ -560,16 +576,14 @@ void QNetworkSession::migrate() } /*! - This function indicates that the application does not wish to roam the session. This - is the default behavior if an application doesn't call migrate() in response to a - preferredConfigurationChanged() signal. + This function indicates that the application does not wish to roam the session. \sa migrate() */ void QNetworkSession::ignore() { - //TODO Do we really need this function if we consider that this is - // the default behavior if nobody calls migrate()? + // Needed on at least Symbian platform: the roaming must be explicitly + // ignore()'d or migrate()'d d->ignore(); } @@ -602,7 +616,7 @@ void QNetworkSession::reject() /*! Returns the amount of data sent in bytes; otherwise 0. - This field value includes the usage across all active network + This field value includes the usage across all open network sessions which use the same network interface. If the session is based on a service network configuration the number of @@ -619,7 +633,7 @@ quint64 QNetworkSession::bytesWritten() const /*! Returns the amount of data received in bytes; otherwise 0. - This field value includes the usage across all active network + This field value includes the usage across all open network sessions which use the same network interface. If the session is based on a service network configuration the number of diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 47377c4..7e52674 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -82,9 +82,8 @@ public: QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0); virtual ~QNetworkSession(); - bool isActive() const; + bool isOpen() const; QNetworkConfiguration configuration() const; - QString bearerName() const; QNetworkInterface interface() const; State state() const; diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp index c7c7a31..b3afc77 100644 --- a/src/network/bearer/qnetworksession_maemo.cpp +++ b/src/network/bearer/qnetworksession_maemo.cpp @@ -305,14 +305,14 @@ void QNetworkSessionPrivate::updateState(QNetworkSession::State newState) state = newState; if (state == QNetworkSession::Disconnected) { - isActive = false; + isOpen = false; currentNetworkInterface.clear(); if (publicConfig.type() == QNetworkConfiguration::UserChoice) activeConfig.d->state = QNetworkConfiguration::Defined; publicConfig.d->state = QNetworkConfiguration::Defined; } else if (state == QNetworkSession::Connected) { - isActive = true; + isOpen = true; if (publicConfig.type() == QNetworkConfiguration::UserChoice) { activeConfig.d->state = QNetworkConfiguration::Active; activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; @@ -436,7 +436,7 @@ void QNetworkSessionPrivate::syncStateWithInterface() /* Initially we are not active although the configuration might be in * connected state. */ - isActive = false; + isOpen = false; opened = false; QObject::connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); @@ -684,13 +684,13 @@ void QNetworkSessionPrivate::updateStateFromActiveConfig() clearConfiguration(activeConfig); } - bool oldActive = isActive; - isActive = newActive; + bool oldActive = isOpen; + isOpen = newActive; - if (!oldActive && isActive) + if (!oldActive && isOpen) emit quitPendingWaitsForOpened(); - if (oldActive && !isActive) + if (oldActive && !isOpen) emit q->closed(); if (oldState != state) { @@ -776,7 +776,7 @@ void QNetworkSessionPrivate::open() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (!isActive) { + } else if (!isOpen) { if (publicConfig.type() == QNetworkConfiguration::UserChoice) { /* Caller is trying to connect to default IAP. @@ -810,8 +810,8 @@ void QNetworkSessionPrivate::open() return; } - isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isActive) + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) emit quitPendingWaitsForOpened(); } else { /* We seem to be active so inform caller */ @@ -826,7 +826,6 @@ void QNetworkSessionPrivate::do_open() bool st; QString result; QString iap = publicConfig.identifier(); - QString bearer_name; if (state == QNetworkSession::Connected) { #ifdef BEARER_MANAGEMENT_DEBUG @@ -922,14 +921,7 @@ void QNetworkSessionPrivate::do_open() if (!name.isEmpty()) config.d->name = name; - bearer_name = connect_result.connect.network_type; - if (bearer_name == "WLAN_INFRA" || - bearer_name == "WLAN_ADHOC") - currentBearerName = "WLAN"; - else if (bearer_name == "GPRS") - currentBearerName = "HSPA"; - else - currentBearerName = bearer_name; + config.d->iap_type = connect_result.connect.network_type; config.d->isValid = true; config.d->state = QNetworkConfiguration::Active; @@ -1032,9 +1024,9 @@ void QNetworkSessionPrivate::close() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (isActive) { + } else if (isOpen) { opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -1067,11 +1059,11 @@ void QNetworkSessionPrivate::stop() mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data()); opened = false; - isActive = false; + isOpen = false; } else { opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -1142,15 +1134,6 @@ QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const } -QString QNetworkSessionPrivate::bearerName() const -{ - if (!publicConfig.isValid()) - return QString(); - - return currentBearerName; -} - - QString QNetworkSessionPrivate::errorString() const { QString errorStr; diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h index e233087..892262d 100644 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -69,7 +69,7 @@ class QNetworkSessionPrivate : public QObject Q_OBJECT public: QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isActive(false), + tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) { } @@ -88,7 +88,6 @@ public: QNetworkInterface currentInterface() const; QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); - QString bearerName() const; void open(); void close(); @@ -142,7 +141,7 @@ private: void cleanupAnyConfiguration(); QNetworkSession::State state; - bool isActive; + bool isOpen; bool opened; icd_connection_flags connectFlags; @@ -152,7 +151,6 @@ private: friend class QNetworkSession; QDateTime startTime; - QString currentBearerName; QString currentNetworkInterface; friend class IcdListener; void updateState(QNetworkSession::State); diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp index c6f9833..1dfc949 100644 --- a/src/network/bearer/qnetworksession_p.cpp +++ b/src/network/bearer/qnetworksession_p.cpp @@ -189,7 +189,7 @@ void QNetworkSessionPrivate::open() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (!isActive) { + } else if (!isOpen) { if ((activeConfig.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { lastError =QNetworkSession::InvalidConfigurationError; @@ -206,8 +206,8 @@ void QNetworkSessionPrivate::open() engine->connectToId(activeConfig.identifier()); } - isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isActive) + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) emit quitPendingWaitsForOpened(); } } @@ -217,9 +217,9 @@ void QNetworkSessionPrivate::close() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit q->error(lastError); - } else if (isActive) { + } else if (isOpen) { opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -240,7 +240,7 @@ void QNetworkSessionPrivate::stop() } opened = false; - isActive = false; + isOpen = false; emit q->closed(); } } @@ -286,13 +286,13 @@ void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QV { } -QString QNetworkSessionPrivate::bearerName() const +/*QString QNetworkSessionPrivate::bearerName() const { if (!publicConfig.isValid() || !engine) return QString(); return engine->bearerName(activeConfig.identifier()); -} +}*/ QString QNetworkSessionPrivate::errorString() const { @@ -321,7 +321,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const quint64 QNetworkSessionPrivate::bytesWritten() const { #if defined(BACKEND_NM) - if( state == QNetworkSession::Connected ) { + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { foreach (const QNetworkConfiguration &config, publicConfig.children()) { if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { @@ -339,7 +339,7 @@ quint64 QNetworkSessionPrivate::bytesWritten() const quint64 QNetworkSessionPrivate::bytesReceived() const { #if defined(BACKEND_NM) - if( state == QNetworkSession::Connected ) { + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { foreach (const QNetworkConfiguration &config, publicConfig.children()) { if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { @@ -425,12 +425,12 @@ void QNetworkSessionPrivate::updateStateFromActiveConfig() state = QNetworkSession::NotAvailable; } - bool oldActive = isActive; - isActive = newActive; + bool oldActive = isOpen; + isOpen = newActive; - if (!oldActive && isActive) + if (!oldActive && isOpen) emit quitPendingWaitsForOpened(); - if (oldActive && !isActive) + if (oldActive && !isOpen) emit q->closed(); if (oldState != state) @@ -460,7 +460,7 @@ void QNetworkSessionPrivate::forcedSessionClose(const QNetworkConfiguration &con { if (activeConfig == config) { opened = false; - isActive = false; + isOpen = false; emit q->closed(); @@ -530,7 +530,7 @@ if(serviceName.isEmpty()) QNetworkManagerSettingsConnection *sysIface; sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); - // isActive = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; } if(startTime.isNull()) startTime = QDateTime::currentDateTime(); diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a2aaa6a..09fcfca 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -73,7 +73,7 @@ class QNetworkSessionPrivate : public QObject Q_OBJECT public: QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isActive(false) + tx_data(0), rx_data(0), m_activeTime(0), isOpen(false) { } @@ -143,7 +143,7 @@ private: QNetworkConfiguration activeConfig; QNetworkSession::State state; - bool isActive; + bool isOpen; #ifdef BEARER_ENGINE bool opened; diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp index 764c1c4..f9cb09f 100644 --- a/src/network/bearer/qnetworksession_s60_p.cpp +++ b/src/network/bearer/qnetworksession_s60_p.cpp @@ -53,7 +53,7 @@ QTM_BEGIN_NAMESPACE QNetworkSessionPrivate::QNetworkSessionPrivate() : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid), - isActive(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), + isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), iALREnabled(0) { CActiveScheduler::Add(this); @@ -69,7 +69,7 @@ QNetworkSessionPrivate::QNetworkSessionPrivate() QNetworkSessionPrivate::~QNetworkSessionPrivate() { - isActive = false; + isOpen = false; // Cancel Connection Progress Notifications first. // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() @@ -233,7 +233,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const void QNetworkSessionPrivate::open() { - if (isActive || !publicConfig.d || (state == QNetworkSession::Connecting)) { + if (isOpen || !publicConfig.d || (state == QNetworkSession::Connecting)) { return; } @@ -296,7 +296,7 @@ void QNetworkSessionPrivate::open() error = iDynamicSetdefaultif(&ifr); } - isActive = true; + isOpen = true; // Make sure that state will be Connected newState(QNetworkSession::Connected); emit quitPendingWaitsForOpened(); @@ -333,7 +333,7 @@ void QNetworkSessionPrivate::open() } if (error != KErrNone) { - isActive = false; + isOpen = false; iError = QNetworkSession::UnknownSessionError; emit q->error(iError); if (ipConnectionNotifier) { @@ -372,12 +372,12 @@ TUint QNetworkSessionPrivate::iapClientCount(TUint aIAPId) const void QNetworkSessionPrivate::close(bool allowSignals) { - if (!isActive) { + if (!isOpen) { return; } TUint activeIap = activeConfig.d.data()->numericId; - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); @@ -419,13 +419,13 @@ void QNetworkSessionPrivate::close(bool allowSignals) void QNetworkSessionPrivate::stop() { - if (!isActive) { + if (!isOpen) { return; } - isActive = false; + isOpen = false; newState(QNetworkSession::Closing); iConnection.Stop(RConnection::EStopAuthoritative); - isActive = true; + isOpen = true; close(false); emit q->closed(); } @@ -510,8 +510,8 @@ void QNetworkSessionPrivate::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, T void QNetworkSessionPrivate::Error(TInt /*aError*/) { - if (isActive) { - isActive = false; + if (isOpen) { + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::RoamingError; @@ -558,40 +558,6 @@ QNetworkConfiguration QNetworkSessionPrivate::bestConfigFromSNAP(const QNetworkC return config; } -QString QNetworkSessionPrivate::bearerName() const -{ - QNetworkConfiguration config; - if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - config = publicConfig; - } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - if (activeConfig.isValid()) { - config = activeConfig; - } else { - config = bestConfigFromSNAP(publicConfig); - } - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (activeConfig.isValid()) { - config = activeConfig; - } - } - - if (!config.isValid()) { - return QString(); - } - - switch (config.d.data()->bearer) { - case QNetworkConfigurationPrivate::BearerEthernet: return QString("Ethernet"); - case QNetworkConfigurationPrivate::BearerWLAN: return QString("WLAN"); - case QNetworkConfigurationPrivate::Bearer2G: return QString("2G"); - case QNetworkConfigurationPrivate::BearerCDMA2000: return QString("CDMA2000"); - case QNetworkConfigurationPrivate::BearerWCDMA: return QString("WCDMA"); - case QNetworkConfigurationPrivate::BearerHSPA: return QString("HSPA"); - case QNetworkConfigurationPrivate::BearerBluetooth: return QString("Bluetooth"); - case QNetworkConfigurationPrivate::BearerWiMAX: return QString("WiMAX"); - default: return QString(); - } -} - quint64 QNetworkSessionPrivate::bytesWritten() const { return transferredData(KUplinkData); @@ -673,7 +639,7 @@ quint64 QNetworkSessionPrivate::transferredData(TUint dataType) const quint64 QNetworkSessionPrivate::activeTime() const { - if (!isActive || startTime.isNull()) { + if (!isOpen || startTime.isNull()) { return 0; } return startTime.secsTo(QDateTime::currentDateTime()); @@ -785,7 +751,7 @@ void QNetworkSessionPrivate::RunL() } if (error != KErrNone) { - isActive = false; + isOpen = false; iError = QNetworkSession::UnknownSessionError; emit q->error(iError); Cancel(); @@ -802,7 +768,7 @@ void QNetworkSessionPrivate::RunL() iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); } #endif - isActive = true; + isOpen = true; activeConfig = newActiveConfig; activeInterface = interface(activeConfig.d.data()->numericId); if (publicConfig.type() == QNetworkConfiguration::UserChoice) { @@ -818,7 +784,7 @@ void QNetworkSessionPrivate::RunL() } break; case KErrNotFound: // Connection failed - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::InvalidConfigurationError; @@ -832,7 +798,7 @@ void QNetworkSessionPrivate::RunL() case KErrCancel: // Connection attempt cancelled case KErrAlreadyExists: // Connection already exists default: - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::UnknownSessionError; @@ -855,7 +821,7 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc { // Make sure that activeConfig is always updated when SNAP is signaled to be // connected. - if (isActive && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && + if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && newState == QNetworkSession::Connected) { activeConfig = activeConfiguration(accessPointId); activeInterface = interface(activeConfig.d.data()->numericId); @@ -872,12 +838,12 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc } bool emitSessionClosed = false; - if (isActive && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { + if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { // Active & Connected state should change directly to Disconnected state // only when something forces connection to close (eg. when another // application or session stops connection or when network drops // unexpectedly). - isActive = false; + isOpen = false; activeConfig = QNetworkConfiguration(); serviceConfig = QNetworkConfiguration(); iError = QNetworkSession::SessionAbortedError; @@ -903,7 +869,7 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc emit q->stateChanged(state); retVal = true; } - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isActive) { + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) { if (activeConfig.d.data()->numericId == accessPointId) { state = newState; emit q->stateChanged(state); diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h index cfb99c9..ed322dd 100644 --- a/src/network/bearer/qnetworksession_s60_p.h +++ b/src/network/bearer/qnetworksession_s60_p.h @@ -92,7 +92,6 @@ public: QNetworkInterface currentInterface() const; QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); - QString bearerName() const; void setALREnabled(bool enabled); @@ -158,7 +157,7 @@ private: // data mutable QNetworkInterface activeInterface; QNetworkSession::State state; - bool isActive; + bool isOpen; QNetworkSession* q; QDateTime startTime; diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 795a209..3977b15 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -81,7 +81,7 @@ public: virtual QString getInterfaceFromId(const QString &id) = 0; virtual bool hasIdentifier(const QString &id) = 0; - virtual QString bearerName(const QString &id) = 0; + //virtual QString bearerName(const QString &id) = 0; virtual void connectToId(const QString &id) = 0; virtual void disconnectFromId(const QString &id) = 0; diff --git a/src/network/bearer/qnlaengine_win.cpp b/src/network/bearer/qnlaengine_win.cpp index b606ef4..a3f6017 100644 --- a/src/network/bearer/qnlaengine_win.cpp +++ b/src/network/bearer/qnlaengine_win.cpp @@ -133,7 +133,7 @@ static QString qGetInterfaceType(const QString &interface) HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QString(); + return QLatin1String("Unknown"); oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QString(); + return QLatin1String("Unknown"); } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -154,7 +154,7 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) return QLatin1String("Ethernet"); else - return QString(); + return QLatin1String("Unknown"); } CloseHandle(handle); @@ -181,7 +181,7 @@ static QString qGetInterfaceType(const QString &interface) #endif - return QString(); + return QLatin1String("Unknown"); } class QNlaThread : public QThread @@ -252,6 +252,9 @@ QList QNlaThread::getConfigurations() config->roamingSupported = fetchedConfigurations.at(i)->roamingSupported; config->purpose = fetchedConfigurations.at(i)->purpose; config->internet = fetchedConfigurations.at(i)->internet; + if (QNlaEngine *engine = qobject_cast(parent())) { + config->bearer = engine->bearerName(config->id); + } foundConfigurations.append(config); } @@ -546,12 +549,17 @@ bool QNlaEngine::hasIdentifier(const QString &id) if (configurationInterface.contains(id.toUInt())) return true; - foreach (QNetworkConfigurationPrivate *cpPriv, nlaThread->getConfigurations()) { - if (cpPriv->id == id) - return true; + bool result = false; + QList l = nlaThread->getConfigurations(); + while (!l.isEmpty()) { + QNetworkConfigurationPrivate* cpPriv = l.takeFirst(); + if (!result && cpPriv->id == id) { + result = true; + } + delete cpPriv; } - - return false; + + return result; } QString QNlaEngine::bearerName(const QString &id) diff --git a/src/network/bearer/qnmwifiengine_unix.cpp b/src/network/bearer/qnmwifiengine_unix.cpp index f558fa8..2444919 100644 --- a/src/network/bearer/qnmwifiengine_unix.cpp +++ b/src/network/bearer/qnmwifiengine_unix.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -65,7 +66,7 @@ QTM_BEGIN_NAMESPACE QNmWifiEngine::QNmWifiEngine(QObject *parent) : QNetworkSessionEngine(parent) { - iface = new QNetworkManagerInterface(); + iface = new QNetworkManagerInterface(this); if(!iface->isValid()) { return; } @@ -74,6 +75,8 @@ QNmWifiEngine::QNmWifiEngine(QObject *parent) this,SLOT(addDevice(QDBusObjectPath))); connect(iface,SIGNAL(deviceRemoved(QDBusObjectPath)), this,SLOT(removeDevice(QDBusObjectPath))); + connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), + this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); QList list = iface->getDevices(); @@ -84,9 +87,9 @@ QNmWifiEngine::QNmWifiEngine(QObject *parent) QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; + QNetworkManagerSettings *settingsiface; foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface = new QNetworkManagerSettings(service, this); settingsiface->setConnections(); connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)), this,(SLOT(newConnection(QDBusObjectPath)))); @@ -107,6 +110,7 @@ QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *d QNetworkManagerIp4Config * ipIface; ipIface = new QNetworkManagerIp4Config(path); newname = ipIface->domains().join(" "); + delete ipIface; } //fallback to interface name if(newname.isEmpty()) @@ -117,17 +121,16 @@ QString QNmWifiEngine::getNameForConfiguration(QNetworkManagerInterfaceDevice *d QList QNmWifiEngine::getConfigurations(bool *ok) { -// qWarning() << Q_FUNC_INFO << updated; if (ok) *ok = false; if(!updated) { foundConfigurations.clear(); if(knownSsids.isEmpty()) - getKnownSsids(); // list of ssids that have user configurations. + updateKnownSsids(); // list of ssids that have user configurations. scanForAccessPoints(); - getActiveConnectionsPaths(); + updateActiveConnectionsPaths(); knownConnections(); accessPointConnections(); @@ -139,160 +142,8 @@ QList QNmWifiEngine::getConfigurations(bool *ok) return foundConfigurations; } -void QNmWifiEngine::findConnections() -{ - QList list = iface->getDevices(); - - foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); - - //// eth - switch (devIface->deviceType()) { -// qWarning() << devIface->connectionInterface()->path(); - - case DEVICE_TYPE_802_3_ETHERNET: - { - QString ident; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); - - ident = devWiredIface->hwAddress(); - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = getNameForConfiguration(devIface); - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->internet = devWiredIface->carrier(); - - cpPriv->serviceInterface = devIface->interface(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - switch (devIface->state()) { - case NM_DEVICE_STATE_UNKNOWN: - case NM_DEVICE_STATE_UNMANAGED: - case NM_DEVICE_STATE_FAILED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - case NM_DEVICE_STATE_UNAVAILABLE: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Defined); - break; - case NM_DEVICE_STATE_PREPARE: - case NM_DEVICE_STATE_CONFIG: - case NM_DEVICE_STATE_NEED_AUTH: - case NM_DEVICE_STATE_IP_CONFIG: - case NM_DEVICE_STATE_DISCONNECTED: - { - cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered - | QNetworkConfiguration::Defined); - } - break; - case NM_DEVICE_STATE_ACTIVATED: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Active ); - break; - default: - cpPriv->state = (cpPriv->state | QNetworkConfiguration::Undefined); - break; - }; - cpPriv->purpose = QNetworkConfiguration::PublicPurpose; - foundConfigurations.append(cpPriv); - configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); - } - break; - case DEVICE_TYPE_802_11_WIRELESS: - { -// QNetworkManagerInterfaceDeviceWireless *devWirelessIface; -// devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); -// -// //// connections -// QStringList connectionServices; -// connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; -// connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -// -// QString connPath; -// -// foreach (QString service, connectionServices) { -// QString ident; -// QNetworkManagerSettings *settingsiface; -// settingsiface = new QNetworkManagerSettings(service); -// QList list = settingsiface->listConnections(); -// -// foreach(QDBusObjectPath path, list) { //for each connection path -//qWarning() << path.path(); -// ident = path.path(); -// bool addIt = false; -// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -// cpPriv->isValid = true; -// cpPriv->id = ident; -// cpPriv->internet = true; -// -// cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -// cpPriv->state = ( cpPriv->state | QNetworkConfiguration::Discovered -// | QNetworkConfiguration::Defined); -// cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; -// -// QNetworkManagerSettingsConnection *sysIface; -// sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// cpPriv->name = sysIface->getId();//ii.value().toString(); -//qWarning() << cpPriv->name; -// if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET/*type == "802-3-ethernet"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS/*type == "802-11-wireless"*/ -// && devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// cpPriv->serviceInterface = devIface->interface(); -// addIt = true; -// // get the wifi interface state first.. do we need this? -// // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); -// } -// -// //#if 0 -// foreach(QString conpath, activeConnectionPaths) { -// QNetworkManagerConnectionActive *aConn; -// aConn = new QNetworkManagerConnectionActive(conpath); -// // in case of accesspoint, specificObject will hold the accessPOintObjectPath -// // qWarning() << aConn->connection().path() << aConn->specificObject().path() << aConn->devices().count(); -// if( aConn->connection().path() == ident) { -// -// QList devs = aConn->devices(); -// foreach(QDBusObjectPath device, devs) { -// QNetworkManagerInterfaceDevice *ifaceDevice; -// ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); -// cpPriv->serviceInterface = ifaceDevice->interface(); -// cpPriv->state = getStateFlag(ifaceDevice->state()); -// //cpPriv->accessPoint = aConn->specificObject().path(); -// -// break; -// } -// } -// } -// //#endif -// // } //end while connection -// if(addIt) { -// foundConfigurations.append(cpPriv); -// configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); -// } -// } -// } //end each connection service -// -// // ////////////// AccessPoints -//// QList apList = devWirelessIface->getAccessPoints(); -////// qWarning() << apList.count(); -//// foreach(QDBusObjectPath path, apList) { -//// QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); -//// cpPriv = addAccessPoint( devIface->connectionInterface()->path(), path); -//// if(cpPriv->isValid) { -//// foundConfigurations.append(cpPriv); -//// } -//// } - } // end DEVICE_TYPE_802_11_WIRELESS - break; - }; - } //end foreach device -} - void QNmWifiEngine::knownConnections() { -// qWarning() << Q_FUNC_INFO; //// connections QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; @@ -300,21 +151,18 @@ void QNmWifiEngine::knownConnections() QString connPath; + QScopedPointer settingsiface; foreach (QString service, connectionServices) { QString ident; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface.reset(new QNetworkManagerSettings(service)); QList list = settingsiface->listConnections(); -// qWarning() <setConnections(); connect(sysIface, SIGNAL(removed(QString)), this,SLOT(settingsConnectionRemoved(QString))); @@ -322,27 +170,23 @@ void QNmWifiEngine::knownConnections() cpPriv->name = sysIface->getId(); cpPriv->isValid = true; cpPriv->id = sysIface->getUuid(); -// cpPriv->id = ident; cpPriv->internet = true; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; -//qWarning() << cpPriv->name; cpPriv->state = getStateForId(cpPriv->id); cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; + if(sysIface->getType() == DEVICE_TYPE_802_3_ETHERNET) { QString mac = sysIface->getMacAddress(); if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type ethernet"; QString devPath; devPath = deviceConnectionPath(mac); - // qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + QNetworkManagerInterfaceDevice devIface(devPath); + cpPriv->serviceInterface = devIface.interface(); + QScopedPointer devWiredIface; + devWiredIface.reset(new QNetworkManagerInterfaceDeviceWired(devIface.connectionInterface()->path())); cpPriv->internet = devWiredIface->carrier(); // use this mac addy @@ -356,19 +200,15 @@ void QNmWifiEngine::knownConnections() } else if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { QString mac = sysIface->getMacAddress();; if(!mac.length() > 2) { - qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXX" << mac << "type wireless"; QString devPath; devPath = deviceConnectionPath(mac); -// qWarning() << Q_FUNC_INFO << devPath; - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(devPath); - cpPriv->serviceInterface = devIface->interface(); + QNetworkManagerInterfaceDevice devIface(devPath); + cpPriv->serviceInterface = devIface.interface(); // use this mac addy } else { cpPriv->serviceInterface = getBestInterface( DEVICE_TYPE_802_11_WIRELESS, cpPriv->id); } - // cpPriv->serviceInterface = devIface->interface(); addIt = true; // get the wifi interface state first.. do we need this? // QString activeAPPath = devWirelessIface->activeAccessPoint().path(); @@ -376,6 +216,7 @@ void QNmWifiEngine::knownConnections() if(addIt) { foundConfigurations.append(cpPriv); configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + cpPriv->bearer = bearerName(cpPriv->id); } } //end each connection service } @@ -383,22 +224,21 @@ void QNmWifiEngine::knownConnections() void QNmWifiEngine::accessPointConnections() { - //qWarning() << Q_FUNC_INFO; QList list = iface->getDevices(); + QScopedPointer devIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { QList apList = availableAccessPoints.uniqueKeys(); QList::const_iterator i; for (i = apList.constBegin(); i != apList.constEnd(); ++i) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); + QNetworkConfigurationPrivate* cpPriv; cpPriv = addAccessPoint( devIface->connectionInterface()->path(), availableAccessPoints[*i]); if(cpPriv->isValid) { foundConfigurations.append(cpPriv); - // qWarning() << "adding" << cpPriv->name << "to things"; configurationInterface[cpPriv->id] = cpPriv->serviceInterface.name(); + cpPriv->bearer = bearerName(cpPriv->id); } } } @@ -414,46 +254,43 @@ bool QNmWifiEngine::hasIdentifier(const QString &id) { if (configurationInterface.contains(id)) return true; - foreach (QNetworkConfigurationPrivate *cpPriv, getConfigurations()) { - if (cpPriv->id == id) - return true; - } + return false; } QString QNmWifiEngine::bearerName(const QString &id) { QString interface = getInterfaceFromId(id); - + QScopedPointer devIface; QList list = iface->getDevices(); foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); + if(interface == devIface->interface().name()) { + switch(devIface->deviceType()) { - case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: - return QLatin1String("Ethernet"); - break; - case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: - return QLatin1String("WLAN"); - break; - case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: - return QLatin1String("2G"); - break; - case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: - return QLatin1String("CDMA2000"); - break; - default: - break; - }; + case DEVICE_TYPE_802_3_ETHERNET/*NM_DEVICE_TYPE_ETHERNET*/: + return QLatin1String("Ethernet"); + break; + case DEVICE_TYPE_802_11_WIRELESS/*NM_DEVICE_TYPE_WIFI*/: + return QLatin1String("WLAN"); + break; + case DEVICE_TYPE_GSM/*NM_DEVICE_TYPE_GSM*/: + return QLatin1String("2G"); + break; + case DEVICE_TYPE_CDMA/*NM_DEVICE_TYPE_CDMA*/: + return QLatin1String("CDMA2000"); + break; + default: + break; + } } } - return QString(); + return QLatin1String("Unknown"); } void QNmWifiEngine::connectToId(const QString &id) { -// qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id; activatingConnectionPath = id; QStringList connectionSettings = getConnectionPathForId(id); if(connectionSettings.isEmpty()) { @@ -469,34 +306,26 @@ void QNmWifiEngine::connectToId(const QString &id) devPath = deviceConnectionPath(interface); QDBusObjectPath devicePath(devPath); - iface = new QNetworkManagerInterface(); iface->activateConnection( connectionSettings.at(0), connectionPath, devicePath, connectionPath); - - connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)), - this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*))); } void QNmWifiEngine::disconnectFromId(const QString &id) { QString activeConnectionPath = getActiveConnectionPath(id); - //qWarning() <<"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << __FUNCTION__ << id << activeConnectionPath ; if (!activeConnectionPath.isEmpty()) { - QNetworkManagerConnectionActive *activeCon; - activeCon = new QNetworkManagerConnectionActive(activeConnectionPath); - QNetworkManagerSettingsConnection *settingsCon; - settingsCon = new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path()); + QScopedPointer activeCon; + activeCon.reset(new QNetworkManagerConnectionActive(activeConnectionPath)); + QScopedPointer settingsCon; + settingsCon.reset(new QNetworkManagerSettingsConnection(activeCon->serviceName(), activeCon->connection().path())); - if(settingsCon->isAutoConnect()) { -// qWarning() << id << "is autoconnect"; + if(settingsCon->getType() == DEVICE_TYPE_802_3_ETHERNET /*NM_DEVICE_TYPE_ETHERNET*/) { //use depreciated value for now emit connectionError(id, OperationNotSupported); - //unsupported } else { -// qWarning() <deactivateConnection(dbpath); activatingConnectionPath = ""; @@ -525,58 +354,43 @@ QNmWifiEngine *QNmWifiEngine::instance() return 0; } -void QNmWifiEngine::getKnownSsids() +void QNmWifiEngine::updateKnownSsids() { QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; + + QScopedPointer settingsiface; foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface.reset(new QNetworkManagerSettings(service)); QList list = settingsiface->listConnections(); foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << sysIface->getSsid(); - knownSsids << sysIface->getSsid(); + QNetworkManagerSettingsConnection sysIface(service, path.path()); + knownSsids << sysIface.getSsid(); } } } -void QNmWifiEngine::getActiveConnectionsPaths() -{ -// qWarning() << Q_FUNC_INFO; - QNetworkManagerInterface *dbIface; +void QNmWifiEngine::updateActiveConnectionsPaths() +{ //need to know which connection paths are currently active/connected + QScopedPointer dbIface; activeConnectionPaths.clear(); - dbIface = new QNetworkManagerInterface; + dbIface.reset(new QNetworkManagerInterface); QList connections = dbIface->activeConnections(); - foreach(QDBusObjectPath conpath, connections) { - activeConnectionPaths << conpath.path(); -// qWarning() << __FUNCTION__ << conpath.path() << activeConnectionPaths.count(); - - QNetworkManagerConnectionActive *activeConn; - activeConn = new QNetworkManagerConnectionActive(conpath.path()); - -// qWarning() << activeConn->connection().path() /*<< activeConn->specificObject().path() */<< activeConn->devices()[0].path(); - - } + activeConnectionPaths << conpath.path(); + } } QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path) -{ //foreach accessPoint - //qWarning() << Q_FUNC_INFO << iPath << path.path(); +{ - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(iPath); - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(iPath); + QScopedPointer devIface(new QNetworkManagerInterfaceDevice(iPath)); + QScopedPointer devWirelessIface(new QNetworkManagerInterfaceDeviceWireless(iPath)); QString activeAPPath = devWirelessIface->activeAccessPoint().path(); - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + QScopedPointer accessPointIface(new QNetworkManagerInterfaceAccessPoint(path.path())); QString ident = accessPointIface->connectionInterface()->path(); quint32 nmState = devIface->state(); @@ -587,7 +401,6 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); bool addIt = true; - //qWarning() << availableAccessPoints.count() << ssid; // if(availableAccessPoints.contains(ssid)) { // addIt = false; @@ -609,8 +422,6 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa cpPriv->type = QNetworkConfiguration::InternetAccessPoint; cpPriv->serviceInterface = devIface->interface(); - //qWarning() <<__FUNCTION__ << ssid; - cpPriv->state = getAPState(nmState, knownSsids.contains(cpPriv->name)); if(activeAPPath == accessPointIface->connectionInterface()->path()) { @@ -631,7 +442,6 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa QNetworkConfiguration::StateFlags QNmWifiEngine::getAPState(qint32 nmState, bool isKnown) { QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined; -//qWarning() << nmState << knownSsids; // this is the state of the wifi device interface if(isKnown) state = ( QNetworkConfiguration::Defined); @@ -667,15 +477,12 @@ QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPa QString QNmWifiEngine::getActiveConnectionPath(const QString &id) { - //qWarning() << Q_FUNC_INFO << id; - QStringList connectionSettings = getConnectionPathForId(id); - //qWarning() << Q_FUNC_INFO << id << connectionSettings.count(); - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - QList connections = ifaceD->activeConnections(); + QStringList connectionSettings = getConnectionPathForId(id); + QNetworkManagerInterface ifaceD; + QList connections = ifaceD.activeConnections(); + QScopedPointer conDetailsD; foreach(QDBusObjectPath path, connections) { - QNetworkManagerConnectionActive *conDetailsD; - conDetailsD = new QNetworkManagerConnectionActive( path.path()); + conDetailsD.reset(new QNetworkManagerConnectionActive( path.path())); if(conDetailsD->connection().path() == connectionSettings.at(1) && conDetailsD->serviceName() == connectionSettings.at(0)) return path.path(); @@ -685,7 +492,6 @@ QString QNmWifiEngine::getActiveConnectionPath(const QString &id) QNetworkConfiguration::StateFlags QNmWifiEngine::getStateFlag(quint32 nmstate) { -// qWarning() << Q_FUNC_INFO << nmstate; QNetworkConfiguration::StateFlags flag; switch (nmstate) { case NM_DEVICE_STATE_UNKNOWN: @@ -718,8 +524,6 @@ QString QNmWifiEngine::getActiveConnectionPath(const QString &id) void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 nmState) { -// qWarning() << Q_FUNC_INFO << path << nmState; - if(nmState == NM_DEVICE_STATE_ACTIVATED || nmState == NM_DEVICE_STATE_DISCONNECTED || nmState == NM_DEVICE_STATE_UNAVAILABLE @@ -730,7 +534,6 @@ void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 OperationNotSupported, DisconnectionError, */ -// qWarning() << Q_FUNC_INFO << ident; QNetworkConfiguration::StateFlags state = (QNetworkConfiguration::Defined); switch (nmState) { case NM_DEVICE_STATE_UNKNOWN: @@ -738,7 +541,6 @@ void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 state = (QNetworkConfiguration::Undefined); emit connectionError(activatingConnectionPath, ConnectError); requestUpdate(); -// qWarning() << Q_FUNC_INFO; break; case NM_DEVICE_STATE_UNAVAILABLE: state = (QNetworkConfiguration::Defined); @@ -765,8 +567,7 @@ void QNmWifiEngine::updateDeviceInterfaceState(const QString &/*path*/, quint32 void QNmWifiEngine::addDevice(QDBusObjectPath path) { - //qWarning() << Q_FUNC_INFO << path.path(); - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path(), this); devIface->setConnections(); connect(devIface,SIGNAL(stateChanged(const QString &, quint32)), this, SLOT(updateDeviceInterfaceState(const QString&, quint32))); @@ -778,7 +579,7 @@ void QNmWifiEngine::addDevice(QDBusObjectPath path) case DEVICE_TYPE_802_3_ETHERNET: { QNetworkManagerInterfaceDeviceWired * devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path()); + devWiredIface = new QNetworkManagerInterfaceDeviceWired(devIface->connectionInterface()->path(), this); devWiredIface->setConnections(); connect(devWiredIface, SIGNAL(propertiesChanged(const QString &,QMap)), this,SLOT(cmpPropertiesChanged( const QString &, QMap))); @@ -788,7 +589,7 @@ void QNmWifiEngine::addDevice(QDBusObjectPath path) case DEVICE_TYPE_802_11_WIRELESS: { QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path(), this); devWirelessIface->setConnections(); connect(devWirelessIface, SIGNAL(propertiesChanged(const QString &,QMap)), @@ -834,7 +635,6 @@ void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap i(map); while (i.hasNext()) { i.next(); -// qWarning() << Q_FUNC_INFO << path << i.key() << i.value().toUInt(); if( i.key() == "State") { //only applies to device interfaces updateDeviceInterfaceState(path, i.value().toUInt()); } @@ -848,8 +648,6 @@ void QNmWifiEngine::cmpPropertiesChanged(const QString &path, QMap devs = aConn->devices(); + QList devs = aConn.devices(); + QScopedPointer ifaceDevice; + QScopedPointer devWiredIface; foreach(QDBusObjectPath dev, devs) { - //qWarning() << "foreach" << dev.path(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(dev.path()); + ifaceDevice.reset(new QNetworkManagerInterfaceDevice(dev.path())); if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) { @@ -898,8 +690,7 @@ QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id ifaceDevice->state() == NM_DEVICE_STATE_DISCONNECTED) { isAvailable = true; - QNetworkManagerInterfaceDeviceWired *devWiredIface; - devWiredIface = new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path()); + devWiredIface.reset(new QNetworkManagerInterfaceDeviceWired(ifaceDevice->connectionInterface()->path())); if(!devWiredIface->carrier()) return QNetworkConfiguration::Defined; } //end eth @@ -911,9 +702,8 @@ QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id } } else { // not active - //qWarning() << Q_FUNC_INFO << "Not active"; - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1)); + QScopedPointer sysIface; + sysIface.reset(new QNetworkManagerSettingsConnection(conPath.at(0),conPath.at(1))); if(sysIface->isValid()) { if(sysIface->getType() == DEVICE_TYPE_802_11_WIRELESS) { QString ssid = sysIface->getSsid(); @@ -921,21 +711,16 @@ QNetworkConfiguration::StateFlags QNmWifiEngine::getStateForId(const QString &id if(knownSsids.contains(ssid, Qt::CaseSensitive)) { foreach(QString onessid, knownSsids) { - // qWarning() << ssid << onessid; if(onessid == ssid && availableAccessPoints.contains(ssid)) { - // qWarning() < devices = aConn->devices(); - foreach(QDBusObjectPath device, devices) { - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(device.path()); - if(ifaceDevice->ip4Address() == ipaddress) { - return true; - } + + QScopedPointer aConn; + aConn.reset(new QNetworkManagerConnectionActive(aConPath)); + QScopedPointer ifaceDevice; + QList devices = aConn->devices(); + foreach(QDBusObjectPath device, devices) { + ifaceDevice.reset(new QNetworkManagerInterfaceDevice(device.path())); + if(ifaceDevice->ip4Address() == ipaddress) { + return true; } - return false; + } + return false; } QNetworkInterface QNmWifiEngine::getBestInterface( quint32 type, const QString &id) { // check active connections first. - QStringList conIdPath = getConnectionPathForId(id); -// qWarning() << Q_FUNC_INFO << id << conIdPath; + QStringList conIdPath = getConnectionPathForId(id); QNetworkInterface interface; - foreach(QString conpath, activeConnectionPaths) { - QNetworkManagerConnectionActive *aConn; - aConn = new QNetworkManagerConnectionActive(conpath); + QScopedPointer aConn; + foreach(QString conpath, activeConnectionPaths) { + aConn.reset(new QNetworkManagerConnectionActive(conpath)); if(aConn->connection().path() == conIdPath.at(1) && aConn->serviceName() == conIdPath.at(0)) { QList devs = aConn->devices(); - QNetworkManagerInterfaceDevice *ifaceDevice; - ifaceDevice = new QNetworkManagerInterfaceDevice(devs[0].path()); //just take the first one - interface = ifaceDevice->interface(); - return interface; + QNetworkManagerInterfaceDevice ifaceDevice(devs[0].path()); //just take the first one + return ifaceDevice.interface(); } } -//try guessing + //try guessing QList list = iface->getDevices(); + QScopedPointer devIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); if(devIface->deviceType() == type /*&& devIface->managed()*/) { - interface = devIface->interface(); if(devIface->state() == NM_STATE_DISCONNECTED) { - return interface; + return devIface->interface(); } } } - return interface; + return QNetworkInterface(); } quint64 QNmWifiEngine::receivedDataForId(const QString &id) const @@ -1037,13 +819,11 @@ quint64 QNmWifiEngine::sentDataForId(const QString &id) const void QNmWifiEngine::newConnection(QDBusObjectPath /*path*/) { - //qWarning() << Q_FUNC_INFO; requestUpdate(); } void QNmWifiEngine::settingsConnectionRemoved(const QString &/*path*/) { - //qWarning() << Q_FUNC_INFO; requestUpdate(); } @@ -1054,10 +834,9 @@ void QNmWifiEngine::slotActivationFinished(QDBusPendingCallWatcher *openCall) qWarning() <<"Error" << reply.error().name() << reply.error().message() < list = iface->getDevices(); + QScopedPointer devIface; + QScopedPointer devWirelessIface; + QScopedPointer accessPointIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerInterfaceDevice *devIface; - devIface = new QNetworkManagerInterfaceDevice(path.path()); + devIface.reset(new QNetworkManagerInterfaceDevice(path.path())); if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) { -// qWarning() << devIface->connectionInterface()->path(); - - QNetworkManagerInterfaceDeviceWireless *devWirelessIface; - devWirelessIface = new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()); + devWirelessIface.reset(new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path())); ////////////// AccessPoints QList apList = devWirelessIface->getAccessPoints(); foreach(QDBusObjectPath path, apList) { - QNetworkManagerInterfaceAccessPoint *accessPointIface; - accessPointIface = new QNetworkManagerInterfaceAccessPoint(path.path()); + accessPointIface.reset(new QNetworkManagerInterfaceAccessPoint(path.path())); QString ssid = accessPointIface->ssid(); availableAccessPoints.insert(ssid, path); } @@ -1109,19 +886,15 @@ QStringList QNmWifiEngine::getConnectionPathForId(const QString &uuid) QStringList connectionServices; connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS; connectionServices << NM_DBUS_SERVICE_USER_SETTINGS; -//qWarning() << Q_FUNC_INFO; + QScopedPointer settingsiface; foreach (QString service, connectionServices) { - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(service); + settingsiface.reset(new QNetworkManagerSettings(service)); QList list = settingsiface->listConnections(); + QScopedPointer sysIface; foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(service, path.path()); -// qWarning() << uuid << sysIface->getUuid(); - if(sysIface->getUuid() == uuid) { -// qWarning() <<__FUNCTION__ << service << sysIface->getId() << sysIface->connectionInterface()->path(); + sysIface.reset(new QNetworkManagerSettingsConnection(service, path.path())); + if(sysIface->getUuid() == uuid) return QStringList() << service << sysIface->connectionInterface()->path(); - } } } return QStringList(); diff --git a/src/network/bearer/qnmwifiengine_unix_p.h b/src/network/bearer/qnmwifiengine_unix_p.h index 1287800..470c8d3 100644 --- a/src/network/bearer/qnmwifiengine_unix_p.h +++ b/src/network/bearer/qnmwifiengine_unix_p.h @@ -112,11 +112,10 @@ private: QStringList devicePaths; - void getActiveConnectionsPaths(); - void getKnownSsids(); + void updateActiveConnectionsPaths(); + void updateKnownSsids(); void accessPointConnections(); void knownConnections(); - void findConnections(); QString deviceConnectionPath(const QString &mac); QList foundConfigurations; @@ -145,8 +144,6 @@ private slots: Q_SIGNALS: void configurationChanged(const QNetworkConfiguration& config); - void updateAccessPointState(const QString &, quint32); -// void slotActivationFinished(QDBusPendingCallWatcher*); private slots: void accessPointAdded( const QString &aPath, QDBusObjectPath oPath); diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro index 0b2ed1a..bdd4926 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -8,7 +8,8 @@ QT = core network INCLUDEPATH += ../../../src/bearer include(../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp index 796677d..6ab0e6f 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp @@ -44,7 +44,7 @@ #include "qnetworkconfiguration.h" #include "qnetworkconfigmanager.h" -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include #include #endif @@ -66,7 +66,7 @@ private slots: void configurationFromIdentifier(); private: -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -78,7 +78,7 @@ private: void tst_QNetworkConfigurationManager::initTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -152,7 +152,7 @@ void tst_QNetworkConfigurationManager::initTestCase() void tst_QNetworkConfigurationManager::cleanupTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro index 61e4097..c5a08b3 100644 --- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -8,7 +8,8 @@ QT = core network INCLUDEPATH += ../../../src/bearer include(../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index cbb13f3..e929a61 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -44,7 +44,7 @@ #include "qnetworkconfiguration.h" #include "qnetworkconfigmanager.h" -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include #include #endif @@ -65,7 +65,7 @@ private slots: void isRoamingAvailable(); private: -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -77,7 +77,7 @@ private: void tst_QNetworkConfiguration::initTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -150,7 +150,7 @@ void tst_QNetworkConfiguration::initTestCase() void tst_QNetworkConfiguration::cleanupTestCase() { -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index 4cb8555..b8a006b 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -9,4 +9,5 @@ CONFIG+= testcase include(../../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 53f6f4f..f3a7a07 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -107,7 +107,7 @@ int main(int argc, char** argv) session->open(); session->waitForOpened(); - } while (!(session && session->isActive())); + } while (!(session && session->isOpen())); qDebug() << "loop done"; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index cbd4c8f..86b3e46 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -46,7 +46,7 @@ #include #include -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 #include #include #endif @@ -84,7 +84,7 @@ private: uint inProcessSessionManagementCount; -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -100,7 +100,7 @@ void tst_QNetworkSession::initTestCase() qRegisterMetaType("QNetworkSession::SessionError"); qRegisterMetaType("QNetworkConfiguration"); -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -186,7 +186,7 @@ void tst_QNetworkSession::cleanupTestCase() "tests in inProcessSessionManagement()"); } -#ifdef MAEMO +#ifdef Q_WS_MAEMO_6 iapconf->clear(); delete iapconf; iapconf2->clear(); @@ -212,7 +212,7 @@ void tst_QNetworkSession::cleanupTestCase() void tst_QNetworkSession::invalidSession() { QNetworkSession session(QNetworkConfiguration(), 0); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); QVERIFY(session.state() == QNetworkSession::Invalid); } @@ -236,7 +236,7 @@ void tst_QNetworkSession::sessionProperties() QVERIFY(session.configuration() == configuration); - QStringList validBearerNames = QStringList() << QString() + QStringList validBearerNames = QStringList() << QLatin1String("Unknown") << QLatin1String("Ethernet") << QLatin1String("WLAN") << QLatin1String("2G") @@ -246,10 +246,21 @@ void tst_QNetworkSession::sessionProperties() << QLatin1String("Bluetooth") << QLatin1String("WiMAX"); - if (!configuration.isValid()) - QVERIFY(session.bearerName().isEmpty()); - else - QVERIFY(validBearerNames.contains(session.bearerName())); + if (!configuration.isValid()) { + QVERIFY(configuration.bearerName().isEmpty()); + } else { + switch (configuration.type()) + { + case QNetworkConfiguration::ServiceNetwork: + case QNetworkConfiguration::UserChoice: + default: + QVERIFY(configuration.bearerName().isEmpty()); + break; + case QNetworkConfiguration::InternetAccessPoint: + QVERIFY(validBearerNames.contains(configuration.bearerName())); + break; + } + } // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. @@ -302,9 +313,9 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); - QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString().isEmpty()); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); // The remaining tests require the session to be not NotAvailable. @@ -324,7 +335,7 @@ void tst_QNetworkSession::userChoiceSession() session.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); if (!errorSpy.isEmpty()) { QNetworkSession::SessionError error = @@ -359,7 +370,7 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(session.interface().isValid()); const QString userChoiceIdentifier = - session.sessionProperty("UserChoiceConfigurationIdentifier").toString(); + session.sessionProperty("UserChoiceConfiguration").toString(); QVERIFY(!userChoiceIdentifier.isEmpty()); QVERIFY(userChoiceIdentifier != configuration.identifier()); @@ -371,12 +382,12 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice); const QString testIdentifier("abc"); - //resetting UserChoiceConfigurationIdentifier is ignored (read only property) - session.setSessionProperty("UserChoiceConfigurationIdentifier", testIdentifier); - QVERIFY(session.sessionProperty("UserChoiceConfigurationIdentifier").toString() != testIdentifier); + //resetting UserChoiceConfiguration is ignored (read only property) + session.setSessionProperty("UserChoiceConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("UserChoiceConfiguration").toString() != testIdentifier); const QString activeIdentifier = - session.sessionProperty("ActiveConfigurationIdentifier").toString(); + session.sessionProperty("ActiveConfiguration").toString(); QVERIFY(!activeIdentifier.isEmpty()); QVERIFY(activeIdentifier != configuration.identifier()); @@ -387,9 +398,9 @@ void tst_QNetworkSession::userChoiceSession() QVERIFY(activeConfiguration.isValid()); QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint); - //resetting ActiveConfigurationIdentifier is ignored (read only property) - session.setSessionProperty("ActiveConfigurationIdentifier", testIdentifier); - QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString() != testIdentifier); + //resetting ActiveConfiguration is ignored (read only property) + session.setSessionProperty("ActiveConfiguration", testIdentifier); + QVERIFY(session.sessionProperty("ActiveConfiguration").toString() != testIdentifier); if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) { QVERIFY(userChoiceConfiguration == activeConfiguration); @@ -427,7 +438,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() // Test initial state of the session. { QVERIFY(session.configuration() == configuration); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); // session may be invalid if configuration is removed between when // sessionOpenCloseStop_data() is called and here. QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) || @@ -453,7 +464,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() session.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); if (!errorSpy.isEmpty()) { QNetworkSession::SessionError error = @@ -517,7 +528,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() // Test opening a second session. { QVERIFY(session2.configuration() == configuration); - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.error() == QNetworkSession::UnknownSessionError); @@ -525,8 +536,8 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(session.isActive()); - QVERIFY(session2.isActive()); + QVERIFY(session.isOpen()); + QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.interface().isValid()); @@ -550,7 +561,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); if (!errorSpy2.isEmpty()) { QVERIFY(!errorSpy.isEmpty()); @@ -632,7 +643,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() } } if (roamedSuccessfully) { - QString configId = session.sessionProperty("ActiveConfigurationIdentifier").toString(); + QString configId = session.sessionProperty("ActiveConfiguration").toString(); QNetworkConfiguration config = manager.configurationFromIdentifier(configId); QNetworkSession session3(config); QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); @@ -641,7 +652,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() session3.open(); session3.waitForOpened(); - if (session.isActive()) + if (session.isOpen()) QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); session.stop(); @@ -682,9 +693,9 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!sessionClosedSpy2.isEmpty()); #ifndef Q_CC_NOKIAX86 - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); #endif - QVERIFY(!session2.isActive()); + QVERIFY(!session2.isOpen()); } else { // Test closing the second session. { @@ -698,8 +709,8 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(sessionClosedSpy.isEmpty()); - QVERIFY(session.isActive()); - QVERIFY(!session2.isActive()); + QVERIFY(session.isOpen()); + QVERIFY(!session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); QVERIFY(session.interface().isValid()); @@ -724,7 +735,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty()); - QVERIFY(!session.isActive()); + QVERIFY(!session.isOpen()); if (expectStateChange) QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty()); @@ -781,12 +792,15 @@ void tst_QNetworkSession::outOfProcessSession() QList before = manager.allConfigurations(QNetworkConfiguration::Active); - QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); + // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. QLocalServer oopServer; + // First remove possible earlier listening address which would cause listen to fail + // (e.g. previously abruptly ended unit test might cause this) + QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); QProcess lackey; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index 1410601..ccc405e 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -8,7 +8,8 @@ QT = core network INCLUDEPATH += ../../../../src/bearer include(../../../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer wince* { LACKEY.sources = $$OUTPUT_DIR/build/tests/bin/qnetworksessionlackey.exe diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index 68590cc..f62d8d2 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -69,10 +69,6 @@ void BearerEx::createMenus() menuBar()->addAction(act1); connect(act1, SIGNAL(triggered()), this, SLOT(on_showDetailsButton_clicked())); - m_openAction = new QAction(tr("Open Session"), this); - menuBar()->addAction(m_openAction); - connect(m_openAction, SIGNAL(triggered()), this, SLOT(on_openSessionButton_clicked())); - QAction* exitAct = new QAction(tr("Exit"), this); menuBar()->addAction(exitAct); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); @@ -290,7 +286,7 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); } - bearerLineEdit->setText(m_NetworkSession->bearerName()); + bearerLineEdit->setText(apNetworkConfiguration->bearerName()); sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ QString(" / ")+ QString::number(m_NetworkSession->bytesReceived())); @@ -341,7 +337,7 @@ void SessionTab::on_sendRequestButton_clicked() void SessionTab::on_openSessionButton_clicked() { m_NetworkSession->open(); - if (m_NetworkSession->isActive()) { + if (m_NetworkSession->isOpen()) { newState(m_NetworkSession->state()); } } @@ -349,7 +345,7 @@ void SessionTab::on_openSessionButton_clicked() void SessionTab::on_closeSessionButton_clicked() { m_NetworkSession->close(); - if (!m_NetworkSession->isActive()) { + if (!m_NetworkSession->isOpen()) { newState(m_NetworkSession->state()); } } @@ -418,7 +414,7 @@ void SessionTab::opened() listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); m_eventListWidget->addItem(listItem); - QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); + QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -428,7 +424,7 @@ void SessionTab::opened() } if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) { - QVariant identifier = m_NetworkSession->property("UserChoiceConfigurationIdentifier"); + QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration"); if (!identifier.isNull()) { QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); @@ -490,22 +486,21 @@ void SessionTab::stateChanged(QNetworkSession::State state) void SessionTab::newState(QNetworkSession::State state) { - if (state == QNetworkSession::Connected) { - QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier"); - if (!identifier.isNull()) { - QString configId = identifier.toString(); - QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); - if (config.isValid()) { - iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); - } + QVariant identifier = m_NetworkSession->property("ActiveConfiguration"); + if (state == QNetworkSession::Connected && !identifier.isNull()) { + QString configId = identifier.toString(); + QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); + if (config.isValid()) { + iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + bearerLineEdit->setText(config.bearerName()); } + } else { + bearerLineEdit->setText(m_NetworkSession->configuration().bearerName()); } - bearerLineEdit->setText(m_NetworkSession->bearerName()); - QString active; - if (m_NetworkSession->isActive()) { - active = " (A)"; + if (m_NetworkSession->isOpen()) { + active = " (O)"; } stateLineEdit->setText(stateString(state)+active); } diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h index f18180e..b8a2393 100644 --- a/tests/manual/bearerex/bearerex.h +++ b/tests/manual/bearerex/bearerex.h @@ -51,7 +51,10 @@ #include "qnetworksession.h" #include "xqlistwidget.h" +QT_BEGIN_NAMESPACE class QHttp; +QT_END_NAMESPACE + class SessionTab; QTM_USE_NAMESPACE diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro index a870eb1..e480d43 100644 --- a/tests/manual/bearerex/bearerex.pro +++ b/tests/manual/bearerex/bearerex.pro @@ -24,11 +24,6 @@ SOURCES += bearerex.cpp \ main.cpp \ xqlistwidget.cpp -symbian: { - bearerex.sources = Qtbearer.dll - bearerex.path = /sys/bin - DEPLOYMENT += bearerex - - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/tests/manual/networkmanager/networkmanager.pro b/tests/manual/networkmanager/networkmanager.pro index 31b2af1..7ff370a 100644 --- a/tests/manual/networkmanager/networkmanager.pro +++ b/tests/manual/networkmanager/networkmanager.pro @@ -12,7 +12,8 @@ requires(contains(QT_CONFIG,dbus)) INCLUDEPATH += ../../src/bearer include(../../common.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer #MOC_DIR = .moc #OBJECTS_DIR = .obj diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp index ca9d907..fde5cae 100644 --- a/tests/manual/networkmanager/nmview.cpp +++ b/tests/manual/networkmanager/nmview.cpp @@ -188,8 +188,6 @@ void NMView::getActiveConnections() void NMView::update() { -// if(sess) -// qWarning() << __FUNCTION__<< sess->bytesWritten() << sess->bearerName(); // QNetworkManagerInterface *dbIface; // dbIface = new QNetworkManagerInterface; // QList connections = dbIface->activeConnections(); diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h index 641385e..e15aacd 100644 --- a/tests/manual/networkmanager/nmview.h +++ b/tests/manual/networkmanager/nmview.h @@ -49,9 +49,11 @@ QTM_USE_NAMESPACE +QT_BEGIN_NAMESPACE class QListWidget; class QTreeWidget; class QTreeWidgetItem; +QT_END_NAMESPACE class NMView : public QDialog, private Ui::Dialog { -- cgit v0.12 From 4ef1103e6b399cb9421fb001f81af47bca20d2a7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 09:35:51 +1000 Subject: Fix failure on Windows after merge. --- src/plugins/bearer/nla/qnlaengine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index be1cd28..51897f0 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -406,8 +406,6 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name)); cpPriv->state = QNetworkConfiguration::Defined; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - if (QNlaEngine *engine = qobject_cast(parent())) - config->bearer = engine->bearerName(config->id); #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "size:" << querySet->dwSize; @@ -443,6 +441,9 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query } while (offset != 0 && offset < querySet->lpBlob->cbSize); } + if (QNlaEngine *engine = qobject_cast(parent())) + cpPriv->bearer = engine->bearerName(cpPriv->id); + return cpPriv; } -- cgit v0.12 From b2fc251bb4628a06282d1dcaeda79222b300b912 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 09:43:03 +1000 Subject: Bearer Management Integration 3. --- src/network/bearer/qcorewlanengine_mac.mm | 16 ++-------------- src/network/bearer/qcorewlanengine_mac_p.h | 2 -- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/network/bearer/qcorewlanengine_mac.mm index 41ec79a..6fad457 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/network/bearer/qcorewlanengine_mac.mm @@ -75,7 +75,7 @@ inline QString cfstringRefToQstring(CFStringRef cfStringRef) { if (CFStringGetCString(CFStringRef(cfStringRef), cstring, maxLength, kCFStringEncodingUTF8)) { retVal = QString::fromUtf8(cstring); } - delete cstring; + delete[] cstring; return retVal; } @@ -315,7 +315,7 @@ QList QCoreWlanEngine::scanForSsids(const QStrin CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; NSError *err = nil; NSDictionary *parametersDict = nil; - NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]]; + NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; CWNetwork *apNetwork; if(!err) { @@ -396,18 +396,6 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s return false; } -QList QCoreWlanEngine::getWlanProfiles(const QString &interfaceName) -{ - Q_UNUSED(interfaceName) -#if defined(MAC_SDK_10_6) -// for( CW8021XProfile *each8021XProfile in [CW8021XProfile allUser8021XProfiles] ) { -// qWarning() << "Profile name" << nsstringToQString([each8021XProfile ssid]); -// } - -#endif - return QList (); -} - bool QCoreWlanEngine::getAllScInterfaces() { networkInterfaces.clear(); diff --git a/src/network/bearer/qcorewlanengine_mac_p.h b/src/network/bearer/qcorewlanengine_mac_p.h index 6ad093a..5bdba3d 100644 --- a/src/network/bearer/qcorewlanengine_mac_p.h +++ b/src/network/bearer/qcorewlanengine_mac_p.h @@ -88,8 +88,6 @@ private: QTimer pollTimer; QList scanForSsids(const QString &interfaceName); - QList getWlanProfiles(const QString &interfaceName); - bool isKnownSsid(const QString &interfaceName, const QString &ssid); QList foundConfigurations; -- cgit v0.12 From 6cdcb06d6d8fb60f250aa0389e8d545d0d52fb79 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 10:01:30 +1000 Subject: Fix failures on Mac OS X after merge. --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 3ceebbd..2a3fecf 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -306,6 +306,7 @@ void QCoreWlanEngine::doRequestUpdate() ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->bearer = qGetInterfaceType(interface.name()); accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interface.name()); @@ -345,6 +346,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName) apNetwork = [apArray objectAtIndex:row]; + const QString networkSsid = nsstringToQString([apNetwork ssid]); + const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid)); found.append(id); -- cgit v0.12 From 6b700e2bc14d2b159c2faa6f3fe8ca6d77d42f5b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 6 Jan 2010 10:01:55 +1000 Subject: Fix test compile failure when using frameworks on Mac OS X. --- src/network/bearer/qbearerplugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h index 036d712..970410b 100644 --- a/src/network/bearer/qbearerplugin.h +++ b/src/network/bearer/qbearerplugin.h @@ -42,7 +42,7 @@ #ifndef QBEARERPLUGIN_H #define QBEARERPLUGIN_H -#include "qnetworksessionengine_p.h" +#include #include #include -- cgit v0.12 From bd532d0cb6da5d09e048192171d7f5263e22eca6 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 4 Dec 2009 09:48:46 +1000 Subject: Fix build on Maemo, force type to qreal. --- src/gui/painting/qpainter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fc1863f..ab5773e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + // QtCore #include #include @@ -5918,7 +5919,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) if (QPixmapCache::find(key, pixmap)) return pixmap; - const qreal halfPeriod = qMax(qreal(2), radiusBase * 1.61803399); // the golden ratio + const qreal halfPeriod = qMax(qreal(2), radiusBase * qreal(1.61803399)); // the golden ratio const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod); const int radius = qFloor(radiusBase); -- cgit v0.12 From b2477aec2adad08c4f44ffcdc2f9ad1c0ce4a56b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 7 Jan 2010 13:03:34 +1000 Subject: Make compile for Symbian. --- src/network/bearer/bearer.pri | 12 ++++---- src/network/bearer/qnetworkconfigmanager.cpp | 36 ++++++++++++++++++++++++ src/network/bearer/qnetworkconfigmanager_s60_p.h | 4 +-- src/network/bearer/qnetworkconfiguration_s60_p.h | 2 +- src/plugins/bearer/bearer.pro | 2 ++ 5 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 4f6c549..766e717 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -4,13 +4,11 @@ HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworksession.h \ - bearer/qnetworkconfigmanager.h \ - bearer/qbearerplugin.h + bearer/qnetworkconfigmanager.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ - bearer/qnetworkconfiguration.cpp \ - bearer/qbearerplugin.cpp + bearer/qnetworkconfiguration.cpp symbian { exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ @@ -72,11 +70,13 @@ symbian { HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ - bearer/qnetworksessionengine_p.h + bearer/qnetworksessionengine_p.h \ + bearer/qbearerplugin.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ bearer/qnetworksession_p.cpp \ - bearer/qnetworksessionengine.cpp + bearer/qnetworksessionengine.cpp \ + bearer/qbearerplugin.cpp contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM } diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 6b73e3c..7f58e07 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -238,6 +238,32 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); +#ifdef Q_OS_SYMBIAN + QList cpsIdents = conPriv->accessPointConfigurations.keys(); + + //find all InternetAccessPoints + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->accessPointConfigurations.value(ii); + if ( (p->state & filter) == filter ) { + QNetworkConfiguration pt; + pt.d = conPriv->accessPointConfigurations.value(ii); + result << pt; + } + } + + //find all service networks + cpsIdents = conPriv->snapConfigurations.keys(); + foreach (const QString &ii, cpsIdents) { + QExplicitlySharedDataPointer p = + conPriv->snapConfigurations.value(ii); + if ( (p->state & filter) == filter ) { + QNetworkConfiguration pt; + pt.d = conPriv->snapConfigurations.value(ii); + result << pt; + } + } +#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { QStringList cpsIdents = engine->accessPointConfigurations.keys(); @@ -264,6 +290,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe } } } +#endif return result; } @@ -280,6 +307,14 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; +#ifdef Q_OS_SYMBIAN + if (conPriv->accessPointConfigurations.contains(identifier)) + item.d = conPriv->accessPointConfigurations.value(identifier); + else if (conPriv->snapConfigurations.contains(identifier)) + item.d = conPriv->snapConfigurations.value(identifier); + else if (conPriv->userChoiceConfigurations.contains(identifier)) + item.d = conPriv->userChoiceConfigurations.value(identifier); +#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); @@ -292,6 +327,7 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( return item; } +#endif return item; } diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h index 568803d..3378898 100644 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include -#include +#include +#include "qnetworkconfiguration_s60_p.h" #include #include diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h index 0973152..5e75c13 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ b/src/network/bearer/qnetworkconfiguration_s60_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 58d2613..05fce8c 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,7 +1,9 @@ TEMPLATE = subdirs +!symbian:!maemo { SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan +} -- cgit v0.12 From aed972b88e96596114ef8a5a350063744220f8c4 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 11 Jan 2010 12:09:34 +1000 Subject: Return empty bearer name for invalid, ServiceNetwork and UserChoice. --- src/network/bearer/qnetworkconfiguration_s60_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 3064840..d01d4d9 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -68,7 +68,7 @@ QString QNetworkConfigurationPrivate::bearerName() const case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); - default: return QLatin1String("Unknown"); + default: return QString(); } } -- cgit v0.12 From e620ab4a391ea1c86718856b31f6a5c4928a18a7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 12 Jan 2010 16:15:26 +1000 Subject: Partially convert Symbian backend into a plugin. QNetworkSession functionality not converted yet. --- src/network/bearer/bearer.pri | 30 +- src/network/bearer/qnetworkconfigmanager.cpp | 42 - src/network/bearer/qnetworkconfigmanager_p.cpp | 122 +-- src/network/bearer/qnetworkconfigmanager_p.h | 2 - src/network/bearer/qnetworkconfigmanager_s60_p.cpp | 974 --------------------- src/network/bearer/qnetworkconfigmanager_s60_p.h | 185 ---- src/network/bearer/qnetworkconfiguration.cpp | 4 - src/network/bearer/qnetworkconfiguration_p.h | 1 - src/network/bearer/qnetworkconfiguration_s60_p.cpp | 17 - src/network/bearer/qnetworkconfiguration_s60_p.h | 109 --- src/network/bearer/qnetworksession.cpp | 8 +- src/network/bearer/qnetworksessionengine.cpp | 6 + src/network/bearer/qnetworksessionengine_p.h | 3 + src/plugins/bearer/bearer.pro | 3 +- src/plugins/bearer/corewlan/qcorewlanengine.h | 2 + src/plugins/bearer/corewlan/qcorewlanengine.mm | 5 + src/plugins/bearer/generic/qgenericengine.cpp | 7 + src/plugins/bearer/generic/qgenericengine.h | 2 + .../bearer/nativewifi/qnativewifiengine.cpp | 6 + src/plugins/bearer/nativewifi/qnativewifiengine.h | 2 + .../networkmanager/qnetworkmanagerengine.cpp | 6 + .../bearer/networkmanager/qnetworkmanagerengine.h | 2 + src/plugins/bearer/nla/qnlaengine.cpp | 5 + src/plugins/bearer/nla/qnlaengine.h | 2 + src/plugins/bearer/symbian/main.cpp | 86 ++ src/plugins/bearer/symbian/symbian.pro | 33 + src/plugins/bearer/symbian/symbianengine.cpp | 931 ++++++++++++++++++++ src/plugins/bearer/symbian/symbianengine.h | 201 +++++ src/s60installs/s60installs.pro | 10 +- 29 files changed, 1334 insertions(+), 1472 deletions(-) delete mode 100644 src/network/bearer/qnetworkconfigmanager_s60_p.cpp delete mode 100644 src/network/bearer/qnetworkconfigmanager_s60_p.h delete mode 100644 src/network/bearer/qnetworkconfiguration_s60_p.h create mode 100644 src/plugins/bearer/symbian/main.cpp create mode 100644 src/plugins/bearer/symbian/symbian.pro create mode 100644 src/plugins/bearer/symbian/symbianengine.cpp create mode 100644 src/plugins/bearer/symbian/symbianengine.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 766e717..169c8b7 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -10,35 +10,11 @@ SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ bearer/qnetworkconfiguration.cpp -symbian { - exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ - exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { - message("Building with SNAP support") - DEFINES += SNAP_FUNCTIONALITY_AVAILABLE - LIBS += -lcmmanager - } else { - message("Building without SNAP support") - LIBS += -lapengine - } - - INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +symbian_disabled { + HEADERS += bearer/qnetworksession_s60_p.h - HEADERS += bearer/qnetworkconfigmanager_s60_p.h \ - bearer/qnetworkconfiguration_s60_p.h \ - bearer/qnetworksession_s60_p.h - SOURCES += bearer/qnetworkconfigmanager_s60_p.cpp \ - bearer/qnetworkconfiguration_s60_p.cpp \ + SOURCES += bearer/qnetworkconfiguration_s60_p.cpp \ bearer/qnetworksession_s60_p.cpp - - LIBS += -lcommdb \ - -lapsettingshandlerui \ - -lconnmon \ - -lcentralrepository \ - -lesock \ - -linsock \ - -lecom \ - -lefsrv \ - -lnetmeta } else:maemo { QT += dbus CONFIG += link_pkgconfig diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 7f58e07..f4daf4a 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -41,12 +41,8 @@ #include "qnetworkconfigmanager.h" -#ifdef Q_OS_SYMBIAN -#include "qnetworkconfigmanager_s60_p.h" -#else #include "qnetworkconfigmanager_p.h" #include "qnetworksessionengine_p.h" -#endif #include @@ -54,12 +50,10 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); -#ifndef Q_OS_SYMBIAN QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() { return connManager(); } -#endif /*! \class QNetworkConfigurationManager @@ -238,32 +232,6 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); -#ifdef Q_OS_SYMBIAN - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - - //find all InternetAccessPoints - foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - result << pt; - } - } - - //find all service networks - cpsIdents = conPriv->snapConfigurations.keys(); - foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->snapConfigurations.value(ii); - if ( (p->state & filter) == filter ) { - QNetworkConfiguration pt; - pt.d = conPriv->snapConfigurations.value(ii); - result << pt; - } - } -#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { QStringList cpsIdents = engine->accessPointConfigurations.keys(); @@ -290,7 +258,6 @@ QList QNetworkConfigurationManager::allConfigurations(QNe } } } -#endif return result; } @@ -307,14 +274,6 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; -#ifdef Q_OS_SYMBIAN - if (conPriv->accessPointConfigurations.contains(identifier)) - item.d = conPriv->accessPointConfigurations.value(identifier); - else if (conPriv->snapConfigurations.contains(identifier)) - item.d = conPriv->snapConfigurations.value(identifier); - else if (conPriv->userChoiceConfigurations.contains(identifier)) - item.d = conPriv->userChoiceConfigurations.value(identifier); -#else foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); @@ -327,7 +286,6 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( return item; } -#endif return item; } diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index cb83789..c00d6d3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -59,11 +59,6 @@ QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() delete sessionEngines.takeFirst(); } -void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() -{ - capFlags = QNetworkConfigurationManager::ForcedRoaming; -} - void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { if (!firstUpdate) { @@ -177,106 +172,25 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() updating = false; QFactoryLoader *l = loader(); - QStringList keys = l->keys(); - - if (keys.contains(QLatin1String("corewlan"))) { - QBearerEnginePlugin *coreWlanPlugin = - qobject_cast(l->instance(QLatin1String("corewlan"))); - if (coreWlanPlugin) { - QNetworkSessionEngine *coreWifi = coreWlanPlugin->create(QLatin1String("corewlan")); - if (coreWifi) { - sessionEngines.append(coreWifi); - connect(coreWifi, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(coreWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(coreWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(coreWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - - if (keys.contains(QLatin1String("networkmanager"))) { - QBearerEnginePlugin *nmPlugin = - qobject_cast(l->instance(QLatin1String("networkmanager"))); - if (nmPlugin) { - QNetworkSessionEngine *nmWifi = nmPlugin->create(QLatin1String("networkmanager")); - if (nmWifi) { - sessionEngines.append(nmWifi); - connect(nmWifi, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(nmWifi, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(nmWifi, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(nmWifi, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - - if (keys.contains(QLatin1String("generic"))) { - QBearerEnginePlugin *genericPlugin = - qobject_cast(l->instance(QLatin1String("generic"))); - if (genericPlugin) { - QNetworkSessionEngine *generic = genericPlugin->create(QLatin1String("generic")); - if (generic) { - sessionEngines.append(generic); - connect(generic, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(generic, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(generic, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(generic, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - - if (keys.contains(QLatin1String("nla"))) { - QBearerEnginePlugin *nlaPlugin = - qobject_cast(l->instance(QLatin1String("nla"))); - if (nlaPlugin) { - QNetworkSessionEngine *nla = nlaPlugin->create(QLatin1String("nla")); - if (nla) { - sessionEngines.append(nla); - connect(nla, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(nla, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(nla, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(nla, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - } - } - } - if (keys.contains(QLatin1String("nativewifi"))) { - QBearerEnginePlugin *nativeWifiPlugin = - qobject_cast(l->instance(QLatin1String("nativewifi"))); - if (nativeWifiPlugin) { - QNetworkSessionEngine *nativeWifi = - nativeWifiPlugin->create(QLatin1String("nativewifi")); - if (nativeWifi) { - sessionEngines.append(nativeWifi); - connect(nativeWifi, SIGNAL(updateCompleted()), - this, SLOT(updateConfigurations())); - connect(nativeWifi, - SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); - connect(nativeWifi, - SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); - connect(nativeWifi, - SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), - this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; - } + foreach (const QString &key, l->keys()) { + QBearerEnginePlugin *plugin = qobject_cast(l->instance(key)); + if (plugin) { + QNetworkSessionEngine *engine = plugin->create(key); + if (!engine) + continue; + + sessionEngines.append(engine); + connect(engine, SIGNAL(updateCompleted()), + this, SLOT(updateConfigurations())); + connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); + connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); + + capFlags |= engine->capabilities(); } } } diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index a45d534..d7a813b 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -67,7 +67,6 @@ public: QNetworkConfigurationManagerPrivate() : QObject(0), capFlags(0), firstUpdate(true) { - registerPlatformCapabilities(); updateConfigurations(); } @@ -76,7 +75,6 @@ public: QNetworkConfiguration defaultConfiguration(); QNetworkConfigurationManager::Capabilities capFlags; - void registerPlatformCapabilities(); void performAsyncConfigurationUpdate(); diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp b/src/network/bearer/qnetworkconfigmanager_s60_p.cpp deleted file mode 100644 index b5bd4d2..0000000 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.cpp +++ /dev/null @@ -1,974 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworkconfigmanager_s60_p.h" - -#include -#include -#include - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - #include - #include - #include - #include - #include - #include -#else - #include - #include - #include -#endif - -QT_BEGIN_NAMESPACE - -static const int KValueThatWillBeAddedToSNAPId = 1000; -static const int KUserChoiceIAPId = 0; - -QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() - : QObject(0), CActive(CActive::EPriorityIdle), capFlags(0), iFirstUpdate(true), iInitOk(true) -{ - CActiveScheduler::Add(this); - - registerPlatformCapabilities(); - TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); - if (error != KErrNone) { - iInitOk = false; - return; - } - - TRAP_IGNORE(iConnectionMonitor.ConnectL()); - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - TRAP(error, iCmManager.OpenL()); - if (error != KErrNone) { - iInitOk = false; - return; - } -#endif - - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = "UserChoice"; - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->isValid = true; - cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); - cpPriv->numericId = KUserChoiceIAPId; - cpPriv->connectionId = 0; - cpPriv->type = QNetworkConfiguration::UserChoice; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - QExplicitlySharedDataPointer ptr(cpPriv); - userChoiceConfigurations.insert(cpPriv->id, ptr); - - updateConfigurations(); - updateStatesToSnaps(); - - // Start monitoring IAP and/or SNAP changes in Symbian CommsDB - startCommsDatabaseNotifications(); -} - -QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() -{ - Cancel(); - - QList configIdents = snapConfigurations.keys(); - foreach(QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = accessPointConfigurations.keys(); - foreach(QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = userChoiceConfigurations.keys(); - foreach(QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - priv->manager = 0; - } - - iConnectionMonitor.CancelNotifications(); - iConnectionMonitor.Close(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iCmManager.Close(); -#endif - - delete ipAccessPointsAvailabilityScanner; - delete ipCommsDB; -} - - -void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() -{ - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; - capFlags |= QNetworkConfigurationManager::DirectConnectionRouting; - capFlags |= QNetworkConfigurationManager::SystemSessionSupport; -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming; - capFlags |= QNetworkConfigurationManager::ForcedRoaming; -#endif - capFlags |= QNetworkConfigurationManager::DataStatistics; -} - -void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() -{ - if (!iInitOk || iUpdateGoingOn) { - return; - } - iUpdateGoingOn = true; - - stopCommsDatabaseNotifications(); - updateConfigurations(); // Synchronous call - updateAvailableAccessPoints(); // Asynchronous call -} - -void QNetworkConfigurationManagerPrivate::updateConfigurations() -{ - if (!iInitOk) { - return; - } - - TRAP_IGNORE(updateConfigurationsL()); -} - -void QNetworkConfigurationManagerPrivate::updateConfigurationsL() -{ - QList knownConfigs = accessPointConfigurations.keys(); - QList knownSnapConfigs = snapConfigurations.keys(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - // S60 version is >= Series60 3rd Edition Feature Pack 2 - TInt error = KErrNone; - - // Loop through all IAPs - RArray connectionMethods; // IAPs - CleanupClosePushL(connectionMethods); - iCmManager.ConnectionMethodL(connectionMethods); - for(int i = 0; i < connectionMethods.Count(); i++) { - RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]); - CleanupClosePushL(connectionMethod); - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString ident = QString::number(qHash(iapId)); - if (accessPointConfigurations.contains(ident)) { - knownConfigs.removeOne(ident); - } else { - QNetworkConfigurationPrivate* cpPriv = NULL; - TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); - if (error == KErrNone) { - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(cpPriv->id, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } - } - CleanupStack::PopAndDestroy(&connectionMethod); - } - CleanupStack::PopAndDestroy(&connectionMethods); - - // Loop through all SNAPs - RArray destinations; - CleanupClosePushL(destinations); - iCmManager.AllDestinationsL(destinations); - for(int i = 0; i < destinations.Count(); i++) { - RCmDestination destination; - destination = iCmManager.DestinationL(destinations[i]); - CleanupClosePushL(destination); - QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids - if (snapConfigurations.contains(ident)) { - knownSnapConfigs.removeOne(ident); - } else { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - CleanupStack::PushL(cpPriv); - - HBufC *pName = destination.NameLC(); - cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); - CleanupStack::PopAndDestroy(pName); - pName = NULL; - - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->numericId = destination.Id(); - cpPriv->connectionId = 0; - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->type = QNetworkConfiguration::ServiceNetwork; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - - QExplicitlySharedDataPointer ptr(cpPriv); - snapConfigurations.insert(ident, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - - CleanupStack::Pop(cpPriv); - } - QExplicitlySharedDataPointer privSNAP = snapConfigurations.value(ident); - - for (int j=0; j < destination.ConnectionMethodCount(); j++) { - RCmConnectionMethod connectionMethod = destination.ConnectionMethodL(j); - CleanupClosePushL(connectionMethod); - - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString iface = QString::number(qHash(iapId)); - // Check that IAP can be found from accessPointConfigurations list - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data() == 0) { - QNetworkConfigurationPrivate* cpPriv = NULL; - TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); - if (error == KErrNone) { - QExplicitlySharedDataPointer ptr(cpPriv); - ptr.data()->serviceNetworkPtr = privSNAP; - accessPointConfigurations.insert(cpPriv->id, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - privSNAP->serviceNetworkMembers.append(ptr); - } - } else { - knownConfigs.removeOne(iface); - // Check that IAP can be found from related SNAP's configuration list - bool iapFound = false; - for (int i=0; iserviceNetworkMembers.count(); i++) { - if (privSNAP->serviceNetworkMembers[i]->numericId == iapId) { - iapFound = true; - break; - } - } - if (!iapFound) { - priv.data()->serviceNetworkPtr = privSNAP; - privSNAP->serviceNetworkMembers.append(priv); - } - } - - CleanupStack::PopAndDestroy(&connectionMethod); - } - - if (privSNAP->serviceNetworkMembers.count() > 1) { - // Roaming is supported only if SNAP contains more than one IAP - privSNAP->roamingSupported = true; - } - - CleanupStack::PopAndDestroy(&destination); - } - CleanupStack::PopAndDestroy(&destinations); - -#else - // S60 version is < Series60 3rd Edition Feature Pack 2 - CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP)); - - // Loop through all IAPs - TUint32 apId = 0; - TInt retVal = pDbTView->GotoFirstRecord(); - while (retVal == KErrNone) { - pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); - QString ident = QString::number(qHash(apId)); - if (accessPointConfigurations.contains(ident)) { - knownConfigs.removeOne(ident); - } else { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - if (readNetworkConfigurationValuesFromCommsDb(apId, cpPriv)) { - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(ident, ptr); - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } else { - delete cpPriv; - } - } - retVal = pDbTView->GotoNextRecord(); - } - CleanupStack::PopAndDestroy(pDbTView); -#endif - updateActiveAccessPoints(); - - foreach (QString oldIface, knownConfigs) { - //remove non existing IAP - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - } - // Remove non existing IAP from SNAPs - QList snapConfigIdents = snapConfigurations.keys(); - foreach (QString iface, snapConfigIdents) { - QExplicitlySharedDataPointer priv2 = snapConfigurations.value(iface); - // => Check if one of the IAPs of the SNAP is active - for (int i=0; iserviceNetworkMembers.count(); i++) { - if (priv2->serviceNetworkMembers[i]->numericId == priv->numericId) { - priv2->serviceNetworkMembers.removeAt(i); - break; - } - } - } - } - foreach (QString oldIface, knownSnapConfigs) { - //remove non existing SNAPs - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - if (!iFirstUpdate) { - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - } - } - - iFirstUpdate = false; -} - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -QNetworkConfigurationPrivate* QNetworkConfigurationManagerPrivate::configFromConnectionMethodL( - RCmConnectionMethod& connectionMethod) -{ - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - CleanupStack::PushL(cpPriv); - - TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); - QString ident = QString::number(qHash(iapId)); - - HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName); - CleanupStack::PushL(pName); - cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); - CleanupStack::PopAndDestroy(pName); - pName = NULL; - - TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); - switch (bearerId) { - case KCommDbBearerCSD: - cpPriv->bearer = QNetworkConfigurationPrivate::Bearer2G; - break; - case KCommDbBearerWcdma: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerWCDMA; - break; - case KCommDbBearerLAN: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerEthernet; - break; - case KCommDbBearerVirtual: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - case KCommDbBearerPAN: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - case KCommDbBearerWLAN: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerWLAN; - break; - default: - cpPriv->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - } - - TInt error = KErrNone; - TUint32 bearerType = connectionMethod.GetIntAttributeL(CMManager::ECmBearerType); - switch (bearerType) { - case KUidPacketDataBearerType: - // "Packet data" Bearer => Mapping is done using "Access point name" - TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EPacketDataAPName)); - break; - case KUidWlanBearerType: - // "Wireless LAN" Bearer => Mapping is done using "WLAN network name" = SSID - TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EWlanSSID)); - break; - } - if (!pName) { - // "Data call" Bearer or "High Speed (GSM)" Bearer => Mapping is done using "Dial-up number" - TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EDialDefaultTelNum)); - } - - if (error == KErrNone && pName) { - CleanupStack::PushL(pName); - cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()); - CleanupStack::PopAndDestroy(pName); - pName = NULL; - } - - cpPriv->state = QNetworkConfiguration::Defined; - TBool isConnected = connectionMethod.GetBoolAttributeL(CMManager::ECmConnected); - if (isConnected) { - cpPriv->state = QNetworkConfiguration::Active; - } - - cpPriv->isValid = true; - cpPriv->id = ident; - cpPriv->numericId = iapId; - cpPriv->connectionId = 0; - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - - CleanupStack::Pop(cpPriv); - return cpPriv; -} -#else -bool QNetworkConfigurationManagerPrivate::readNetworkConfigurationValuesFromCommsDb( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration) -{ - TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration)); - if (error != KErrNone) { - return false; - } - return true; -} - -void QNetworkConfigurationManagerPrivate::readNetworkConfigurationValuesFromCommsDbL( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration) -{ - CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB); - CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC(); - TBuf name; - - CApUtils* pApUtils = CApUtils::NewLC(*ipCommsDB); - TUint32 apId = pApUtils->WapIdFromIapIdL(aApId); - - pDataHandler->AccessPointDataL(apId,*pAPItem); - pAPItem->ReadTextL(EApIapName, name); - if (name.Compare(_L("Easy WLAN")) == 0) { - // "Easy WLAN" won't be accepted to the Configurations list - User::Leave(KErrNotFound); - } - - QString ident = QString::number(qHash(aApId)); - - apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()); - apNetworkConfiguration->isValid = true; - apNetworkConfiguration->id = ident; - apNetworkConfiguration->numericId = aApId; - apNetworkConfiguration->connectionId = 0; - apNetworkConfiguration->state = (QNetworkConfiguration::Defined); - apNetworkConfiguration->type = QNetworkConfiguration::InternetAccessPoint; - apNetworkConfiguration->purpose = QNetworkConfiguration::UnknownPurpose; - apNetworkConfiguration->roamingSupported = false; - switch (pAPItem->BearerTypeL()) { - case EApBearerTypeCSD: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::Bearer2G; - break; - case EApBearerTypeGPRS: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::Bearer2G; - break; - case EApBearerTypeHSCSD: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerHSPA; - break; - case EApBearerTypeCDMA: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerCDMA2000; - break; - case EApBearerTypeWLAN: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerWLAN; - break; - case EApBearerTypeLAN: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerEthernet; - break; - case EApBearerTypeLANModem: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerEthernet; - break; - default: - apNetworkConfiguration->bearer = QNetworkConfigurationPrivate::BearerUnknown; - break; - } - apNetworkConfiguration->manager = this; - - CleanupStack::PopAndDestroy(pApUtils); - CleanupStack::PopAndDestroy(pAPItem); - CleanupStack::PopAndDestroy(pDataHandler); -} -#endif - -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() -{ - QNetworkConfiguration config; - - if (iInitOk) { - stopCommsDatabaseNotifications(); - TRAP_IGNORE(config = defaultConfigurationL()); - startCommsDatabaseNotifications(); - } - - return config; -} - -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfigurationL() -{ - QNetworkConfiguration item; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - // Check Default Connection (SNAP or IAP) - TCmDefConnValue defaultConnectionValue; - iCmManager.ReadDefConnL(defaultConnectionValue); - if (defaultConnectionValue.iType == ECmDefConnDestination) { - QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId)); - QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); - if (priv.data() != 0) { - item.d = priv; - } - } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { - QString iface = QString::number(qHash(defaultConnectionValue.iId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data() != 0) { - item.d = priv; - } - } -#endif - - if (!item.isValid()) { - QString iface = QString::number(qHash(KUserChoiceIAPId)); - QExplicitlySharedDataPointer priv = userChoiceConfigurations.value(iface); - if (priv.data() != 0) { - item.d = priv; - } - } - - return item; -} - -void QNetworkConfigurationManagerPrivate::updateActiveAccessPoints() -{ - bool online = false; - QList inactiveConfigs = accessPointConfigurations.keys(); - - TRequestStatus status; - TUint connectionCount; - iConnectionMonitor.GetConnectionCount(connectionCount, status); - User::WaitForRequest(status); - - // Go through all connections and set state of related IAPs to Active - TUint connectionId; - TUint subConnectionCount; - TUint apId; - if (status.Int() == KErrNone) { - for (TUint i = 1; i <= connectionCount; i++) { - iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); - if (priv.data()) { - online = true; - inactiveConfigs.removeOne(ident); - priv.data()->connectionId = connectionId; - // Configuration is Active - changeConfigurationStateTo(priv, QNetworkConfiguration::Active); - } - } - } - - // Make sure that state of rest of the IAPs won't be Active - foreach (QString iface, inactiveConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()) { - // Configuration is either Defined or Discovered - changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Discovered); - } - } - - if (iOnline != online) { - iOnline = online; - emit this->onlineStateChanged(iOnline); - } -} - -void QNetworkConfigurationManagerPrivate::updateAvailableAccessPoints() -{ - if (!ipAccessPointsAvailabilityScanner) { - ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor); - } - if (ipAccessPointsAvailabilityScanner) { - // Scanning may take a while because WLAN scanning will be done (if device supports WLAN). - ipAccessPointsAvailabilityScanner->StartScanning(); - } -} - -void QNetworkConfigurationManagerPrivate::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo) -{ - iUpdateGoingOn = false; - if (scanSuccessful) { - QList unavailableConfigs = accessPointConfigurations.keys(); - - // Set state of returned IAPs to Discovered - // if state is not already Active - for(TUint i=0; i priv = accessPointConfigurations.value(ident); - if (priv.data()) { - unavailableConfigs.removeOne(ident); - if (priv.data()->state < QNetworkConfiguration::Active) { - // Configuration is either Discovered or Active - changeConfigurationStateAtMinTo(priv, QNetworkConfiguration::Discovered); - } - } - } - - // Make sure that state of rest of the IAPs won't be Discovered or Active - foreach (QString iface, unavailableConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()) { - // Configuration is Defined - changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Defined); - } - } - } - - updateStatesToSnaps(); - - startCommsDatabaseNotifications(); - - emit this->configurationUpdateComplete(); -} - -void QNetworkConfigurationManagerPrivate::updateStatesToSnaps() -{ - // Go through SNAPs and set correct state to SNAPs - QList snapConfigIdents = snapConfigurations.keys(); - foreach (QString iface, snapConfigIdents) { - bool discovered = false; - bool active = false; - QExplicitlySharedDataPointer priv = snapConfigurations.value(iface); - // => Check if one of the IAPs of the SNAP is discovered or active - // => If one of IAPs is active, also SNAP is active - // => If one of IAPs is discovered but none of the IAPs is active, SNAP is discovered - for (int i=0; iserviceNetworkMembers.count(); i++) { - QExplicitlySharedDataPointer priv2 = priv->serviceNetworkMembers[i]; - if ((priv->serviceNetworkMembers[i]->state & QNetworkConfiguration::Active) - == QNetworkConfiguration::Active) { - active = true; - break; - } else if ((priv->serviceNetworkMembers[i]->state & QNetworkConfiguration::Discovered) - == QNetworkConfiguration::Discovered) { - discovered = true; - } - } - if (active) { - changeConfigurationStateTo(priv, QNetworkConfiguration::Active); - } else if (discovered) { - changeConfigurationStateTo(priv, QNetworkConfiguration::Discovered); - } else { - changeConfigurationStateTo(priv, QNetworkConfiguration::Defined); - } - } -} - -bool QNetworkConfigurationManagerPrivate::changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState) -{ - if (newState != sharedData.data()->state) { - sharedData.data()->state = newState; - QNetworkConfiguration item; - item.d = sharedData; - if (!iFirstUpdate) { - emit configurationChanged(item); - } - return true; - } - return false; -} - -/* changeConfigurationStateAtMinTo function does not overwrite possible better - * state (e.g. Discovered state does not overwrite Active state) but - * makes sure that state is at minimum given state. -*/ -bool QNetworkConfigurationManagerPrivate::changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState) -{ - if ((newState | sharedData.data()->state) != sharedData.data()->state) { - sharedData.data()->state = (sharedData.data()->state | newState); - QNetworkConfiguration item; - item.d = sharedData; - if (!iFirstUpdate) { - emit configurationChanged(item); - } - return true; - } - return false; -} - -/* changeConfigurationStateAtMaxTo function overwrites possible better - * state (e.g. Discovered state overwrites Active state) and - * makes sure that state is at maximum given state (e.g. Discovered state - * does not overwrite Defined state). -*/ -bool QNetworkConfigurationManagerPrivate::changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState) -{ - if ((newState & sharedData.data()->state) != sharedData.data()->state) { - sharedData.data()->state = (newState & sharedData.data()->state); - QNetworkConfiguration item; - item.d = sharedData; - if (!iFirstUpdate) { - emit configurationChanged(item); - } - return true; - } - return false; -} - -void QNetworkConfigurationManagerPrivate::startCommsDatabaseNotifications() -{ - if (!iWaitingCommsDatabaseNotifications) { - iWaitingCommsDatabaseNotifications = ETrue; - if (!IsActive()) { - SetActive(); - // Start waiting for new notification - ipCommsDB->RequestNotification(iStatus); - } - } -} - -void QNetworkConfigurationManagerPrivate::stopCommsDatabaseNotifications() -{ - if (iWaitingCommsDatabaseNotifications) { - iWaitingCommsDatabaseNotifications = EFalse; - if (!IsActive()) { - SetActive(); - // Make sure that notifier recorded events will not be returned - // as soon as the client issues the next RequestNotification() request. - ipCommsDB->RequestNotification(iStatus); - ipCommsDB->CancelRequestNotification(); - } else { - ipCommsDB->CancelRequestNotification(); - } - } -} - -void QNetworkConfigurationManagerPrivate::RunL() -{ - if (iStatus != KErrCancel) { - RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); - switch (event) { - case RDbNotifier::EUnlock: /** All read locks have been removed. */ - case RDbNotifier::ECommit: /** A transaction has been committed. */ - case RDbNotifier::ERollback: /** A transaction has been rolled back */ - case RDbNotifier::ERecover: /** The database has been recovered */ - // Note that if further database events occur while a client is handling - // a request completion, the notifier records the most significant database - // event and this is signalled as soon as the client issues the next - // RequestNotification() request. - // => Stop recording notifications - stopCommsDatabaseNotifications(); - TRAPD(error, updateConfigurationsL()); - if (error == KErrNone) { - updateStatesToSnaps(); - } - iWaitingCommsDatabaseNotifications = true; - break; - default: - // Do nothing - break; - } - } - - if (iWaitingCommsDatabaseNotifications) { - if (!IsActive()) { - SetActive(); - // Start waiting for new notification - ipCommsDB->RequestNotification(iStatus); - } - } -} - -void QNetworkConfigurationManagerPrivate::DoCancel() -{ - ipCommsDB->CancelRequestNotification(); -} - - -void QNetworkConfigurationManagerPrivate::EventL(const CConnMonEventBase& aEvent) -{ - switch (aEvent.EventType()) { - case EConnMonCreateConnection: - { - CConnMonCreateConnection* realEvent; - realEvent = (CConnMonCreateConnection*) &aEvent; - TUint subConnectionCount = 0; - TUint apId; - TUint connectionId = realEvent->ConnectionId(); - TRequestStatus status; - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - QString ident = QString::number(qHash(apId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); - if (priv.data()) { - priv.data()->connectionId = connectionId; - // Configuration is Active - if (changeConfigurationStateTo(priv, QNetworkConfiguration::Active)) { - updateStatesToSnaps(); - } - if (!iOnline) { - iOnline = true; - emit this->onlineStateChanged(iOnline); - } - } - } - break; - - case EConnMonDeleteConnection: - { - CConnMonDeleteConnection* realEvent; - realEvent = (CConnMonDeleteConnection*) &aEvent; - TUint connectionId = realEvent->ConnectionId(); - QExplicitlySharedDataPointer priv = dataByConnectionId(connectionId); - if (priv.data()) { - priv.data()->connectionId = 0; - // Configuration is either Defined or Discovered - if (changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Discovered)) { - updateStatesToSnaps(); - } - } - - bool online = false; - QList iapConfigs = accessPointConfigurations.keys(); - foreach (QString iface, iapConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()->state == QNetworkConfiguration::Active) { - online = true; - break; - } - } - if (iOnline != online) { - iOnline = online; - emit this->onlineStateChanged(iOnline); - } - } - break; - - case EConnMonIapAvailabilityChange: - { - CConnMonIapAvailabilityChange* realEvent; - realEvent = (CConnMonIapAvailabilityChange*) &aEvent; - TConnMonIapInfo iaps = realEvent->IapAvailability(); - QList unDiscoveredConfigs = accessPointConfigurations.keys(); - for ( TUint i = 0; i < iaps.Count(); i++ ) { - QString ident = QString::number(qHash(iaps.iIap[i].iIapId)); - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(ident); - if (priv.data()) { - // Configuration is either Discovered or Active - changeConfigurationStateAtMinTo(priv, QNetworkConfiguration::Discovered); - unDiscoveredConfigs.removeOne(ident); - } - } - foreach (QString iface, unDiscoveredConfigs) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.value(iface); - if (priv.data()) { - // Configuration is Defined - changeConfigurationStateAtMaxTo(priv, QNetworkConfiguration::Defined); - } - } - } - break; - - default: - // For unrecognized events - break; - } -} - -QExplicitlySharedDataPointer QNetworkConfigurationManagerPrivate::dataByConnectionId(TUint aConnectionId) -{ - QNetworkConfiguration item; - - QHash >::const_iterator i = - accessPointConfigurations.constBegin(); - while (i != accessPointConfigurations.constEnd()) { - QExplicitlySharedDataPointer priv = i.value(); - if (priv.data()->connectionId == aConnectionId) { - return priv; - } - ++i; - } - - return QExplicitlySharedDataPointer(); -} - -AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, - RConnectionMonitor& connectionMonitor) - : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor) -{ - CActiveScheduler::Add(this); -} - -AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner() -{ - Cancel(); -} - -void AccessPointsAvailabilityScanner::DoCancel() -{ - iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute); -} - -void AccessPointsAvailabilityScanner::StartScanning() -{ - iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); - if (!IsActive()) { - SetActive(); - } -} - -void AccessPointsAvailabilityScanner::RunL() -{ - if (iStatus.Int() != KErrNone) { - iIapBuf().iCount = 0; - iOwner.accessPointScanningReady(false,iIapBuf()); - } else { - iOwner.accessPointScanningReady(true,iIapBuf()); - } -} -#include "moc_qnetworkconfigmanager_s60_p.cpp" -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h deleted file mode 100644 index 3378898..0000000 --- a/src/network/bearer/qnetworkconfigmanager_s60_p.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONMANAGERPRIVATE_H -#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include "qnetworkconfiguration_s60_p.h" - -#include -#include -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - #include -#endif - -class CCommsDatabase; - -QT_BEGIN_NAMESPACE -class QTimer; -QT_END_NAMESPACE - -QT_BEGIN_NAMESPACE - -class QNetworkSessionPrivate; -class AccessPointsAvailabilityScanner; - -class QNetworkConfigurationManagerPrivate : public QObject, public CActive, public MConnectionMonitorObserver -{ - Q_OBJECT - -public: - QNetworkConfigurationManagerPrivate(); - virtual ~QNetworkConfigurationManagerPrivate(); - - QNetworkConfiguration defaultConfiguration(); - void performAsyncConfigurationUpdate(); - -Q_SIGNALS: - void configurationAdded(const QNetworkConfiguration& config); - void configurationRemoved(const QNetworkConfiguration& config); - void configurationUpdateComplete(); - void configurationChanged(const QNetworkConfiguration& config); - void onlineStateChanged(bool isOnline); - -public Q_SLOTS: - void updateConfigurations(); - -private: - void registerPlatformCapabilities(); - void updateStatesToSnaps(); - bool changeConfigurationStateTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState); - bool changeConfigurationStateAtMinTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState); - bool changeConfigurationStateAtMaxTo(QExplicitlySharedDataPointer& sharedData, - QNetworkConfiguration::StateFlags newState); -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - QNetworkConfigurationPrivate* configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); -#else - bool readNetworkConfigurationValuesFromCommsDb( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); - void readNetworkConfigurationValuesFromCommsDbL( - TUint32 aApId, QNetworkConfigurationPrivate* apNetworkConfiguration); -#endif - - void updateConfigurationsL(); - void updateActiveAccessPoints(); - void updateAvailableAccessPoints(); - void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); - void startCommsDatabaseNotifications(); - void stopCommsDatabaseNotifications(); - - QNetworkConfiguration defaultConfigurationL(); - TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; - void startMonitoringIAPData(TUint32 aIapId); - QExplicitlySharedDataPointer dataByConnectionId(TUint aConnectionId); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // MConnectionMonitorObserver - void EventL(const CConnMonEventBase& aEvent); - -public: // Data - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash > accessPointConfigurations; - QHash > snapConfigurations; - QHash > userChoiceConfigurations; - QNetworkConfigurationManager::Capabilities capFlags; - -private: // Data - bool iFirstUpdate; - CCommsDatabase* ipCommsDB; - RConnectionMonitor iConnectionMonitor; - - TBool iWaitingCommsDatabaseNotifications; - TBool iOnline; - TBool iInitOk; - TBool iUpdateGoingOn; - - - AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; - - friend class QNetworkSessionPrivate; - friend class AccessPointsAvailabilityScanner; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - RCmManager iCmManager; -#endif -}; - -class AccessPointsAvailabilityScanner : public CActive -{ -public: - AccessPointsAvailabilityScanner(QNetworkConfigurationManagerPrivate& owner, - RConnectionMonitor& connectionMonitor); - ~AccessPointsAvailabilityScanner(); - - void StartScanning(); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // Data - QNetworkConfigurationManagerPrivate& iOwner; - RConnectionMonitor& iConnectionMonitor; - TConnMonIapInfoBuf iIapBuf; -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index e1b2828..1585be1 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -41,11 +41,7 @@ #include "qnetworkconfiguration.h" -#ifdef Q_OS_SYMBIAN -#include "qnetworkconfiguration_s60_p.h" -#else #include "qnetworkconfiguration_p.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 68d6ba4..bfc42f5 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -92,7 +92,6 @@ public: bool internet; QList serviceNetworkMembers; - QNetworkInterface serviceInterface; private: diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index d01d4d9..142415a 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -39,24 +39,8 @@ ** ****************************************************************************/ -#include "qnetworkconfiguration_s60_p.h" - QT_BEGIN_NAMESPACE -QNetworkConfigurationPrivate::QNetworkConfigurationPrivate() - : isValid(false), type(QNetworkConfiguration::Invalid), - roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), - bearer(QNetworkConfigurationPrivate::BearerUnknown), numericId(0), - connectionId(0), manager(0) -{ -} - -QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate() -{ - //release pointers to member configurations - serviceNetworkMembers.clear(); -} - QString QNetworkConfigurationPrivate::bearerName() const { switch (bearer) { @@ -72,5 +56,4 @@ QString QNetworkConfigurationPrivate::bearerName() const } } - QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h deleted file mode 100644 index 5e75c13..0000000 --- a/src/network/bearer/qnetworkconfiguration_s60_p.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONPRIVATE_H -#define QNETWORKCONFIGURATIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate : public QSharedData -{ -public: - enum Bearer { - BearerEthernet, - BearerWLAN, - Bearer2G, - BearerCDMA2000, - BearerWCDMA, - BearerHSPA, - BearerBluetooth, - BearerWiMAX, - BearerUnknown = -1 - }; - - QNetworkConfigurationPrivate(); - ~QNetworkConfigurationPrivate(); - - QString name; - bool isValid; - QString id; - QNetworkConfiguration::StateFlags state; - QNetworkConfiguration::Type type; - bool roamingSupported; - QNetworkConfiguration::Purpose purpose; - - QList > serviceNetworkMembers; - - QNetworkConfigurationPrivate::Bearer bearer; - QString bearerName() const; - TUint32 numericId; - TUint connectionId; - - TAny* manager; - - QString mappingName; - - QExplicitlySharedDataPointer serviceNetworkPtr; - -private: - // disallow detaching - QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); - QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONPRIVATE_H - diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 74b9787..5f87d95 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -44,9 +44,7 @@ #include "qnetworksession.h" -#ifdef Q_OS_SYMBIAN -#include "qnetworksession_s60_p.h" -#elif Q_WS_MAEMO_6 +#if Q_WS_MAEMO_6 #include "qnetworksession_maemo_p.h" #else #include "qnetworksession_p.h" @@ -672,7 +670,7 @@ void QNetworkSession::connectNotify(const char *signal) QObject::connectNotify(signal); //check for preferredConfigurationChanged() signal connect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN_disabled if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { d->setALREnabled(true); } @@ -692,7 +690,7 @@ void QNetworkSession::disconnectNotify(const char *signal) QObject::disconnectNotify(signal); //check for preferredConfigurationChanged() signal disconnect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN +#ifdef Q_OS_SYMBIAN_disabled if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { d->setALREnabled(false); } diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp index 0aa9d19..0744add 100644 --- a/src/network/bearer/qnetworksessionengine.cpp +++ b/src/network/bearer/qnetworksessionengine.cpp @@ -61,6 +61,12 @@ QNetworkSessionEngine::~QNetworkSessionEngine() priv->isValid = false; priv->id.clear(); } + + foreach (const QString &oldIface, userChoiceConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } } #include "moc_qnetworksessionengine_p.cpp" diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 202a7dc..a1a3370 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -55,6 +55,7 @@ #include "qnetworkconfiguration_p.h" #include "qnetworksession.h" +#include "qnetworkconfigmanager.h" #include #include @@ -94,6 +95,8 @@ public: virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 05fce8c..ab0a816 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,9 +1,10 @@ TEMPLATE = subdirs -!symbian:!maemo { +!maemo { SUBDIRS += generic contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan +symbian:SUBDIRS += symbian } diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 45a5ee9..dd07d83 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -71,6 +71,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + static bool getAllScInterfaces(); private Q_SLOTS: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 2a3fecf..7ee0723 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -512,4 +512,9 @@ QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 9294fad..d50aa75 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -142,6 +142,8 @@ static QString qGetInterfaceType(const QString &interface) QGenericEngine::QGenericEngine(QObject *parent) : QNetworkSessionEngine(parent) { + qDebug() << Q_FUNC_INFO; + connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); doRequestUpdate(); @@ -314,5 +316,10 @@ QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QGenericEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index a671ceb..730301b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -71,6 +71,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + private Q_SLOTS: void doRequestUpdate(); diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 0050770..82ddaf9 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -461,4 +461,10 @@ QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QNativeWifiEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::CanStartAndStopInterfaces; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 511a6a4..9d92562 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -82,6 +82,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + inline bool available() const { return handle != 0; } public Q_SLOTS: diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 20dee1f..e1fcd46 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -667,5 +667,11 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::CanStartAndStopInterfaces; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 1636c91..3752dce 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -82,6 +82,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 51897f0..d3e3fd2 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -631,6 +631,11 @@ QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id) return QNetworkSession::Invalid; } +QNetworkConfigurationManager::Capabilities QNlaEngine::capabilities() const +{ + return QNetworkConfigurationManager::ForcedRoaming; +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index dd038d1..5e80db1 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -93,6 +93,8 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; + private Q_SLOTS: void networksChanged(); diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp new file mode 100644 index 0000000..8865f4d --- /dev/null +++ b/src/plugins/bearer/symbian/main.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** 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 plugins 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 "symbianengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QSymbianEnginePlugin : public QBearerEnginePlugin +{ +public: + QSymbianEnginePlugin(); + ~QSymbianEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QSymbianEnginePlugin::QSymbianEnginePlugin() +{ +} + +QSymbianEnginePlugin::~QSymbianEnginePlugin() +{ +} + +QStringList QSymbianEnginePlugin::keys() const +{ + return QStringList() << QLatin1String("symbian"); +} + +QBearerEngine *QSymbianEnginePlugin::create(const QString &key) const +{ + qDebug() << Q_FUNC_INFO; + + if (key == QLatin1String("symbian")) + return new SymbianEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QSymbianEnginePlugin) +Q_EXPORT_PLUGIN2(qsymbianbearer, QSymbianEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro new file mode 100644 index 0000000..d3ffb37 --- /dev/null +++ b/src/plugins/bearer/symbian/symbian.pro @@ -0,0 +1,33 @@ +TARGET = qsymbianbearer +include(../../qpluginbase.pri) + +QT += network + +HEADERS += symbianengine.h +SOURCES += symbianengine.cpp main.cpp + +exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ +exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { + message("Building with SNAP support") + DEFINES += SNAP_FUNCTIONALITY_AVAILABLE + LIBS += -lcmmanager +} else { + message("Building without SNAP support") + LIBS += -lapengine +} + +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +LIBS += -lcommdb \ + -lapsettingshandlerui \ + -lconnmon \ + -lcentralrepository \ + -lesock \ + -linsock \ + -lecom \ + -lefsrv \ + -lnetmeta + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp new file mode 100644 index 0000000..8c31990 --- /dev/null +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -0,0 +1,931 @@ +/**************************************************************************** +** +** 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 plugins 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 "symbianengine.h" + +#include +#include +#include + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include +#endif + +QT_BEGIN_NAMESPACE + +static const int KValueThatWillBeAddedToSNAPId = 1000; +static const int KUserChoiceIAPId = 0; + +SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() +: bearer(BearerUnknown), numericId(0), connectionId(0), manager(0) +{ +} + +SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate() +{ +} + +inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) +{ + return static_cast(ptr.data()); +} + +SymbianEngine::SymbianEngine(QObject *parent) +: QNetworkSessionEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) +{ + qDebug() << Q_FUNC_INFO; + + CActiveScheduler::Add(this); + + TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); + if (error != KErrNone) { + iInitOk = false; + return; + } + + TRAP_IGNORE(iConnectionMonitor.ConnectL()); + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + TRAP(error, iCmManager.OpenL()); + if (error != KErrNone) { + iInitOk = false; + return; + } +#endif + + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + cpPriv->name = "UserChoice"; + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->state = QNetworkConfiguration::Discovered; + cpPriv->isValid = true; + cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); + cpPriv->numericId = KUserChoiceIAPId; + cpPriv->connectionId = 0; + cpPriv->type = QNetworkConfiguration::UserChoice; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + userChoiceConfigurations.insert(ptr->id, ptr); + + updateConfigurations(); + updateStatesToSnaps(); + + // Start monitoring IAP and/or SNAP changes in Symbian CommsDB + startCommsDatabaseNotifications(); +} + +SymbianEngine::~SymbianEngine() +{ + Cancel(); + + iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iCmManager.Close(); +#endif + + delete ipAccessPointsAvailabilityScanner; + delete ipCommsDB; +} + + +QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const +{ + QNetworkConfigurationManager::Capabilities capFlags; + + capFlags = QNetworkConfigurationManager::CanStartAndStopInterfaces | + QNetworkConfigurationManager::DirectConnectionRouting | + QNetworkConfigurationManager::SystemSessionSupport | + QNetworkConfigurationManager::DataStatistics; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming | + QNetworkConfigurationManager::ForcedRoaming; +#endif + + return capFlags; +} + +void SymbianEngine::requestUpdate() +{ + if (!iInitOk || iUpdateGoingOn) { + return; + } + iUpdateGoingOn = true; + + stopCommsDatabaseNotifications(); + updateConfigurations(); // Synchronous call + updateAvailableAccessPoints(); // Asynchronous call +} + +void SymbianEngine::updateConfigurations() +{ + if (!iInitOk) { + return; + } + + TRAP_IGNORE(updateConfigurationsL()); +} + +void SymbianEngine::updateConfigurationsL() +{ + QList knownConfigs = accessPointConfigurations.keys(); + QList knownSnapConfigs = snapConfigurations.keys(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + // S60 version is >= Series60 3rd Edition Feature Pack 2 + TInt error = KErrNone; + + // Loop through all IAPs + RArray connectionMethods; // IAPs + CleanupClosePushL(connectionMethods); + iCmManager.ConnectionMethodL(connectionMethods); + for(int i = 0; i < connectionMethods.Count(); i++) { + RCmConnectionMethod connectionMethod = iCmManager.ConnectionMethodL(connectionMethods[i]); + CleanupClosePushL(connectionMethod); + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString ident = QString::number(qHash(iapId)); + if (accessPointConfigurations.contains(ident)) { + knownConfigs.removeOne(ident); + } else { + SymbianNetworkConfigurationPrivate* cpPriv = NULL; + TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); + if (error == KErrNone) { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + } + CleanupStack::PopAndDestroy(&connectionMethod); + } + CleanupStack::PopAndDestroy(&connectionMethods); + + // Loop through all SNAPs + RArray destinations; + CleanupClosePushL(destinations); + iCmManager.AllDestinationsL(destinations); + for(int i = 0; i < destinations.Count(); i++) { + RCmDestination destination; + destination = iCmManager.DestinationL(destinations[i]); + CleanupClosePushL(destination); + QString ident = QString::number(qHash(destination.Id()+KValueThatWillBeAddedToSNAPId)); //TODO: Check if it's ok to add 1000 SNAP Id to prevent SNAP ids overlapping IAP ids + if (snapConfigurations.contains(ident)) { + knownSnapConfigs.removeOne(ident); + } else { + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + CleanupStack::PushL(cpPriv); + + HBufC *pName = destination.NameLC(); + cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->numericId = destination.Id(); + cpPriv->connectionId = 0; + cpPriv->state = QNetworkConfiguration::Defined; + cpPriv->type = QNetworkConfiguration::ServiceNetwork; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + snapConfigurations.insert(ident, ptr); + emit configurationAdded(ptr); + + CleanupStack::Pop(cpPriv); + } + QNetworkConfigurationPrivatePointer privSNAP = snapConfigurations.value(ident); + + for (int j=0; j < destination.ConnectionMethodCount(); j++) { + RCmConnectionMethod connectionMethod = destination.ConnectionMethodL(j); + CleanupClosePushL(connectionMethod); + + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString iface = QString::number(qHash(iapId)); + // Check that IAP can be found from accessPointConfigurations list + QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.value(iface); + if (!priv) { + SymbianNetworkConfigurationPrivate *cpPriv = NULL; + TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); + if (error == KErrNone) { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + toSymbianConfig(ptr)->serviceNetworkPtr = privSNAP; + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + privSNAP->serviceNetworkMembers.append(ptr); + } + } else { + knownConfigs.removeOne(iface); + // Check that IAP can be found from related SNAP's configuration list + bool iapFound = false; + for (int i = 0; i < privSNAP->serviceNetworkMembers.count(); i++) { + if (toSymbianConfig(privSNAP->serviceNetworkMembers[i])->numericId == iapId) { + iapFound = true; + break; + } + } + if (!iapFound) { + toSymbianConfig(priv)->serviceNetworkPtr = privSNAP; + privSNAP->serviceNetworkMembers.append(priv); + } + } + + CleanupStack::PopAndDestroy(&connectionMethod); + } + + if (privSNAP->serviceNetworkMembers.count() > 1) { + // Roaming is supported only if SNAP contains more than one IAP + privSNAP->roamingSupported = true; + } + + CleanupStack::PopAndDestroy(&destination); + } + CleanupStack::PopAndDestroy(&destinations); + +#else + // S60 version is < Series60 3rd Edition Feature Pack 2 + CCommsDbTableView* pDbTView = ipCommsDB->OpenTableLC(TPtrC(IAP)); + + // Loop through all IAPs + TUint32 apId = 0; + TInt retVal = pDbTView->GotoFirstRecord(); + while (retVal == KErrNone) { + pDbTView->ReadUintL(TPtrC(COMMDB_ID), apId); + QString ident = QString::number(qHash(apId)); + if (accessPointConfigurations.contains(ident)) { + knownConfigs.removeOne(ident); + } else { + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + if (readNetworkConfigurationValuesFromCommsDb(apId, cpPriv)) { + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ident, ptr); + + emit configurationAdded(ptr); + } else { + delete cpPriv; + } + } + retVal = pDbTView->GotoNextRecord(); + } + CleanupStack::PopAndDestroy(pDbTView); +#endif + updateActiveAccessPoints(); + + foreach (const QString &oldIface, knownConfigs) { + //remove non existing IAP + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface); + emit configurationRemoved(ptr); + + // Remove non existing IAP from SNAPs + foreach (const QString &iface, snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr2 = snapConfigurations.value(iface); + // => Check if one of the IAPs of the SNAP is active + for (int i = 0; i < ptr2->serviceNetworkMembers.count(); ++i) { + if (toSymbianConfig(ptr2->serviceNetworkMembers[i])->numericId == + toSymbianConfig(ptr)->numericId) { + ptr2->serviceNetworkMembers.removeAt(i); + break; + } + } + } + } + + foreach (const QString &oldIface, knownSnapConfigs) { + //remove non existing SNAPs + QNetworkConfigurationPrivatePointer ptr = snapConfigurations.take(oldIface); + emit configurationRemoved(ptr); + } +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( + RCmConnectionMethod& connectionMethod) +{ + SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; + CleanupStack::PushL(cpPriv); + + TUint32 iapId = connectionMethod.GetIntAttributeL(CMManager::ECmIapId); + QString ident = QString::number(qHash(iapId)); + + HBufC *pName = connectionMethod.GetStringAttributeL(CMManager::ECmName); + CleanupStack::PushL(pName); + cpPriv->name = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + + TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); + switch (bearerId) { + case KCommDbBearerCSD: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case KCommDbBearerWcdma: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + break; + case KCommDbBearerLAN: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + break; + case KCommDbBearerVirtual: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + case KCommDbBearerPAN: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + case KCommDbBearerWLAN: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + break; + default: + cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + } + + TInt error = KErrNone; + TUint32 bearerType = connectionMethod.GetIntAttributeL(CMManager::ECmBearerType); + switch (bearerType) { + case KUidPacketDataBearerType: + // "Packet data" Bearer => Mapping is done using "Access point name" + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EPacketDataAPName)); + break; + case KUidWlanBearerType: + // "Wireless LAN" Bearer => Mapping is done using "WLAN network name" = SSID + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EWlanSSID)); + break; + } + if (!pName) { + // "Data call" Bearer or "High Speed (GSM)" Bearer => Mapping is done using "Dial-up number" + TRAP(error, pName = connectionMethod.GetStringAttributeL(CMManager::EDialDefaultTelNum)); + } + + if (error == KErrNone && pName) { + CleanupStack::PushL(pName); + cpPriv->mappingName = QString::fromUtf16(pName->Ptr(),pName->Length()); + CleanupStack::PopAndDestroy(pName); + pName = NULL; + } + + cpPriv->state = QNetworkConfiguration::Defined; + TBool isConnected = connectionMethod.GetBoolAttributeL(CMManager::ECmConnected); + if (isConnected) { + cpPriv->state = QNetworkConfiguration::Active; + } + + cpPriv->isValid = true; + cpPriv->id = ident; + cpPriv->numericId = iapId; + cpPriv->connectionId = 0; + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; + cpPriv->roamingSupported = false; + cpPriv->manager = this; + + CleanupStack::Pop(cpPriv); + return cpPriv; +} +#else +bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration) +{ + TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration)); + if (error != KErrNone) { + return false; + } + return true; +} + +void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration) +{ + CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB); + CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC(); + TBuf name; + + CApUtils* pApUtils = CApUtils::NewLC(*ipCommsDB); + TUint32 apId = pApUtils->WapIdFromIapIdL(aApId); + + pDataHandler->AccessPointDataL(apId,*pAPItem); + pAPItem->ReadTextL(EApIapName, name); + if (name.Compare(_L("Easy WLAN")) == 0) { + // "Easy WLAN" won't be accepted to the Configurations list + User::Leave(KErrNotFound); + } + + QString ident = QString::number(qHash(aApId)); + + apNetworkConfiguration->name = QString::fromUtf16(name.Ptr(),name.Length()); + apNetworkConfiguration->isValid = true; + apNetworkConfiguration->id = ident; + apNetworkConfiguration->numericId = aApId; + apNetworkConfiguration->connectionId = 0; + apNetworkConfiguration->state = (QNetworkConfiguration::Defined); + apNetworkConfiguration->type = QNetworkConfiguration::InternetAccessPoint; + apNetworkConfiguration->purpose = QNetworkConfiguration::UnknownPurpose; + apNetworkConfiguration->roamingSupported = false; + switch (pAPItem->BearerTypeL()) { + case EApBearerTypeCSD: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EApBearerTypeGPRS: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + break; + case EApBearerTypeHSCSD: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + break; + case EApBearerTypeCDMA: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + break; + case EApBearerTypeWLAN: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + break; + case EApBearerTypeLAN: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + break; + case EApBearerTypeLANModem: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + break; + default: + apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + break; + } + apNetworkConfiguration->manager = this; + + CleanupStack::PopAndDestroy(pApUtils); + CleanupStack::PopAndDestroy(pAPItem); + CleanupStack::PopAndDestroy(pDataHandler); +} +#endif + +QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration() +{ + QNetworkConfigurationPrivatePointer ptr; + + if (iInitOk) { + stopCommsDatabaseNotifications(); + TRAP_IGNORE(ptr = defaultConfigurationL()); + startCommsDatabaseNotifications(); + } + + return ptr; +} + +QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL() +{ + QNetworkConfigurationPrivatePointer ptr; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + // Check Default Connection (SNAP or IAP) + TCmDefConnValue defaultConnectionValue; + iCmManager.ReadDefConnL(defaultConnectionValue); + if (defaultConnectionValue.iType == ECmDefConnDestination) { + QString iface = QString::number(qHash(defaultConnectionValue.iId+KValueThatWillBeAddedToSNAPId)); + ptr = snapConfigurations.value(iface); + } else if (defaultConnectionValue.iType == ECmDefConnConnectionMethod) { + QString iface = QString::number(qHash(defaultConnectionValue.iId)); + ptr = accessPointConfigurations.value(iface); + } +#endif + + if (!ptr->isValid) { + QString iface = QString::number(qHash(KUserChoiceIAPId)); + ptr = userChoiceConfigurations.value(iface); + } + + return ptr; +} + +void SymbianEngine::updateActiveAccessPoints() +{ + bool online = false; + QList inactiveConfigs = accessPointConfigurations.keys(); + + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + + // Go through all connections and set state of related IAPs to Active + TUint connectionId; + TUint subConnectionCount; + TUint apId; + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + online = true; + inactiveConfigs.removeOne(ident); + + toSymbianConfig(ptr)->connectionId = connectionId; + + // Configuration is Active + changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); + } + } + } + + // Make sure that state of rest of the IAPs won't be Active + foreach (const QString &iface, inactiveConfigs) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr) { + // Configuration is either Defined or Discovered + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered); + } + } + + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } +} + +void SymbianEngine::updateAvailableAccessPoints() +{ + if (!ipAccessPointsAvailabilityScanner) { + ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor); + } + if (ipAccessPointsAvailabilityScanner) { + // Scanning may take a while because WLAN scanning will be done (if device supports WLAN). + ipAccessPointsAvailabilityScanner->StartScanning(); + } +} + +void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo) +{ + iUpdateGoingOn = false; + if (scanSuccessful) { + QList unavailableConfigs = accessPointConfigurations.keys(); + + // Set state of returned IAPs to Discovered + // if state is not already Active + for(TUint i=0; istate < QNetworkConfiguration::Active) { + // Configuration is either Discovered or Active + changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered); + } + } + } + + // Make sure that state of rest of the IAPs won't be Discovered or Active + foreach (const QString &iface, unavailableConfigs) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr) { + // Configuration is Defined + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined); + } + } + } + + updateStatesToSnaps(); + + startCommsDatabaseNotifications(); + + qDebug() << Q_FUNC_INFO << "updateCompleted()"; + emit updateCompleted(); +} + +void SymbianEngine::updateStatesToSnaps() +{ + // Go through SNAPs and set correct state to SNAPs + QList snapConfigIdents = snapConfigurations.keys(); + foreach (QString iface, snapConfigIdents) { + bool discovered = false; + bool active = false; + QNetworkConfigurationPrivatePointer ptr = snapConfigurations.value(iface); + // => Check if one of the IAPs of the SNAP is discovered or active + // => If one of IAPs is active, also SNAP is active + // => If one of IAPs is discovered but none of the IAPs is active, SNAP is discovered + for (int i=0; iserviceNetworkMembers.count(); i++) { + if ((ptr->serviceNetworkMembers[i]->state & QNetworkConfiguration::Active) + == QNetworkConfiguration::Active) { + active = true; + break; + } else if ((ptr->serviceNetworkMembers[i]->state & QNetworkConfiguration::Discovered) + == QNetworkConfiguration::Discovered) { + discovered = true; + } + } + if (active) { + changeConfigurationStateTo(ptr, QNetworkConfiguration::Active); + } else if (discovered) { + changeConfigurationStateTo(ptr, QNetworkConfiguration::Discovered); + } else { + changeConfigurationStateTo(ptr, QNetworkConfiguration::Defined); + } + } +} + +bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState) +{ + if (newState != ptr->state) { + ptr->state = newState; + emit configurationChanged(ptr); + return true; + } + return false; +} + +/* changeConfigurationStateAtMinTo function does not overwrite possible better + * state (e.g. Discovered state does not overwrite Active state) but + * makes sure that state is at minimum given state. +*/ +bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState) +{ + if ((newState | ptr->state) != ptr->state) { + ptr->state = (ptr->state | newState); + emit configurationChanged(ptr); + return true; + } + return false; +} + +/* changeConfigurationStateAtMaxTo function overwrites possible better + * state (e.g. Discovered state overwrites Active state) and + * makes sure that state is at maximum given state (e.g. Discovered state + * does not overwrite Defined state). +*/ +bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState) +{ + if ((newState & ptr->state) != ptr->state) { + ptr->state = (newState & ptr->state); + emit configurationChanged(ptr); + return true; + } + return false; +} + +void SymbianEngine::startCommsDatabaseNotifications() +{ + if (!iWaitingCommsDatabaseNotifications) { + iWaitingCommsDatabaseNotifications = ETrue; + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + +void SymbianEngine::stopCommsDatabaseNotifications() +{ + if (iWaitingCommsDatabaseNotifications) { + iWaitingCommsDatabaseNotifications = EFalse; + if (!IsActive()) { + SetActive(); + // Make sure that notifier recorded events will not be returned + // as soon as the client issues the next RequestNotification() request. + ipCommsDB->RequestNotification(iStatus); + ipCommsDB->CancelRequestNotification(); + } else { + ipCommsDB->CancelRequestNotification(); + } + } +} + +void SymbianEngine::RunL() +{ + if (iStatus != KErrCancel) { + RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); + switch (event) { + case RDbNotifier::EUnlock: /** All read locks have been removed. */ + case RDbNotifier::ECommit: /** A transaction has been committed. */ + case RDbNotifier::ERollback: /** A transaction has been rolled back */ + case RDbNotifier::ERecover: /** The database has been recovered */ + // Note that if further database events occur while a client is handling + // a request completion, the notifier records the most significant database + // event and this is signalled as soon as the client issues the next + // RequestNotification() request. + // => Stop recording notifications + stopCommsDatabaseNotifications(); + TRAPD(error, updateConfigurationsL()); + if (error == KErrNone) { + updateStatesToSnaps(); + } + iWaitingCommsDatabaseNotifications = true; + break; + default: + // Do nothing + break; + } + } + + if (iWaitingCommsDatabaseNotifications) { + if (!IsActive()) { + SetActive(); + // Start waiting for new notification + ipCommsDB->RequestNotification(iStatus); + } + } +} + +void SymbianEngine::DoCancel() +{ + ipCommsDB->CancelRequestNotification(); +} + + +void SymbianEngine::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) { + case EConnMonCreateConnection: + { + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint subConnectionCount = 0; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + QString ident = QString::number(qHash(apId)); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + toSymbianConfig(ptr)->connectionId = connectionId; + // Configuration is Active + if (changeConfigurationStateTo(ptr, QNetworkConfiguration::Active)) + updateStatesToSnaps(); + + if (!iOnline) { + iOnline = true; + emit this->onlineStateChanged(iOnline); + } + } + } + break; + + case EConnMonDeleteConnection: + { + CConnMonDeleteConnection* realEvent; + realEvent = (CConnMonDeleteConnection*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + + QNetworkConfigurationPrivatePointer ptr = dataByConnectionId(connectionId); + if (ptr) { + toSymbianConfig(ptr)->connectionId = 0; + // Configuration is either Defined or Discovered + if (changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Discovered)) + updateStatesToSnaps(); + } + + bool online = false; + foreach (const QString &iface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr->state == QNetworkConfiguration::Active) { + online = true; + break; + } + } + if (iOnline != online) { + iOnline = online; + emit this->onlineStateChanged(iOnline); + } + } + break; + + case EConnMonIapAvailabilityChange: + { + CConnMonIapAvailabilityChange* realEvent; + realEvent = (CConnMonIapAvailabilityChange*) &aEvent; + TConnMonIapInfo iaps = realEvent->IapAvailability(); + QList unDiscoveredConfigs = accessPointConfigurations.keys(); + for ( TUint i = 0; i < iaps.Count(); i++ ) { + QString ident = QString::number(qHash(iaps.iIap[i].iIapId)); + + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(ident); + if (ptr) { + // Configuration is either Discovered or Active + changeConfigurationStateAtMinTo(ptr, QNetworkConfiguration::Discovered); + unDiscoveredConfigs.removeOne(ident); + } + } + foreach (const QString &iface, unDiscoveredConfigs) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); + if (ptr) { + // Configuration is Defined + changeConfigurationStateAtMaxTo(ptr, QNetworkConfiguration::Defined); + } + } + } + break; + + default: + // For unrecognized events + break; + } +} + +QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId) +{ + QNetworkConfiguration item; + + QHash::const_iterator i = + accessPointConfigurations.constBegin(); + while (i != accessPointConfigurations.constEnd()) { + QNetworkConfigurationPrivatePointer ptr = i.value(); + if (toSymbianConfig(ptr)->connectionId == aConnectionId) + return ptr; + + ++i; + } + + return QNetworkConfigurationPrivatePointer(); +} + +AccessPointsAvailabilityScanner::AccessPointsAvailabilityScanner(SymbianEngine& owner, + RConnectionMonitor& connectionMonitor) + : CActive(CActive::EPriorityStandard), iOwner(owner), iConnectionMonitor(connectionMonitor) +{ + CActiveScheduler::Add(this); +} + +AccessPointsAvailabilityScanner::~AccessPointsAvailabilityScanner() +{ + Cancel(); +} + +void AccessPointsAvailabilityScanner::DoCancel() +{ + iConnectionMonitor.CancelAsyncRequest(EConnMonGetPckgAttribute); +} + +void AccessPointsAvailabilityScanner::StartScanning() +{ + iConnectionMonitor.GetPckgAttribute(EBearerIdAll, 0, KIapAvailability, iIapBuf, iStatus); + if (!IsActive()) { + SetActive(); + } +} + +void AccessPointsAvailabilityScanner::RunL() +{ + if (iStatus.Int() != KErrNone) { + iIapBuf().iCount = 0; + iOwner.accessPointScanningReady(false,iIapBuf()); + } else { + iOwner.accessPointScanningReady(true,iIapBuf()); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h new file mode 100644 index 0000000..0ca30da --- /dev/null +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -0,0 +1,201 @@ +/**************************************************************************** +** +** 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 plugins 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 SYMBIANENGINE_H +#define SYMBIANENGINE_H + +#include +#include + +#include +#include +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include +#endif + +class CCommsDatabase; + +QT_BEGIN_NAMESPACE +class QTimer; +QT_END_NAMESPACE + +QT_BEGIN_NAMESPACE + +class QNetworkSessionPrivate; +class AccessPointsAvailabilityScanner; + +class SymbianNetworkConfigurationPrivate : public QNetworkConfigurationPrivate +{ +public: + enum Bearer { + BearerEthernet, + BearerWLAN, + Bearer2G, + BearerCDMA2000, + BearerWCDMA, + BearerHSPA, + BearerBluetooth, + BearerWiMAX, + BearerUnknown = -1 + }; + + SymbianNetworkConfigurationPrivate(); + ~SymbianNetworkConfigurationPrivate(); + + Bearer bearer; + + TUint32 numericId; + TUint connectionId; + + TAny *manager; + + QNetworkConfigurationPrivatePointer serviceNetworkPtr; + + QString mappingName; +}; + +class SymbianEngine : public QNetworkSessionEngine, public CActive, + public MConnectionMonitorObserver +{ + Q_OBJECT + +public: + SymbianEngine(QObject *parent = 0); + virtual ~SymbianEngine(); + + QString getInterfaceFromId(const QString &id) { return QString(); } + bool hasIdentifier(const QString &id) { return false; } + + void connectToId(const QString &id) { } + void disconnectFromId(const QString &id) { } + + void requestUpdate(); + + QNetworkSession::State sessionStateForId(const QString &id) { return QNetworkSession::Invalid; } + + QNetworkConfigurationManager::Capabilities capabilities() const; + + QNetworkConfigurationPrivatePointer defaultConfiguration(); + +Q_SIGNALS: + void onlineStateChanged(bool isOnline); + +public Q_SLOTS: + void updateConfigurations(); + +private: + void updateStatesToSnaps(); + bool changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState); + bool changeConfigurationStateAtMinTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState); + bool changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr, + QNetworkConfiguration::StateFlags newState); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + SymbianNetworkConfigurationPrivate *configFromConnectionMethodL(RCmConnectionMethod& connectionMethod); +#else + bool readNetworkConfigurationValuesFromCommsDb( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration); + void readNetworkConfigurationValuesFromCommsDbL( + TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration); +#endif + + void updateConfigurationsL(); + void updateActiveAccessPoints(); + void updateAvailableAccessPoints(); + void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo); + void startCommsDatabaseNotifications(); + void stopCommsDatabaseNotifications(); + + QNetworkConfigurationPrivatePointer defaultConfigurationL(); + TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const; + void startMonitoringIAPData(TUint32 aIapId); + QNetworkConfigurationPrivatePointer dataByConnectionId(TUint aConnectionId); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +private: // Data + CCommsDatabase* ipCommsDB; + RConnectionMonitor iConnectionMonitor; + + TBool iWaitingCommsDatabaseNotifications; + TBool iOnline; + TBool iInitOk; + TBool iUpdateGoingOn; + + + AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner; + + friend class QNetworkSessionPrivate; + friend class AccessPointsAvailabilityScanner; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + RCmManager iCmManager; +#endif +}; + +class AccessPointsAvailabilityScanner : public CActive +{ +public: + AccessPointsAvailabilityScanner(SymbianEngine& owner, + RConnectionMonitor& connectionMonitor); + ~AccessPointsAvailabilityScanner(); + + void StartScanning(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // Data + SymbianEngine& iOwner; + RConnectionMonitor& iConnectionMonitor; + TConnMonIapInfoBuf iIapBuf; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 2d9c489..57df601 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -79,7 +79,12 @@ symbian: { DEPLOYMENT += phonon_backend_plugins } - DEPLOYMENT += qtresources qtlibraries imageformats_plugins codecs_plugins graphicssystems_plugins + DEPLOYMENT += qtresources \ + qtlibraries \ + imageformats_plugins \ + codecs_plugins \ + graphicssystems_plugins \ + bearer_plugins contains(QT_CONFIG, svg): { qtlibraries.sources += QtSvg.dll @@ -115,6 +120,9 @@ symbian: { graphicssystems_plugins.sources += qvggraphicssystem.dll } + bearer_plugins.path = c:$$QT_PLUGINS_BASE_DIR/bearer + bearer_plugins.sources += qgenericbearer.dll qsymbianbearer.dll + BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" } -- cgit v0.12 From b840dbe4ddd6937cd76c9c41baa16a8077224acd Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 14:26:49 +1000 Subject: Port session functionality. --- src/network/bearer/bearer.pri | 8 +- src/network/bearer/qnetworkconfigmanager_p.h | 2 +- src/network/bearer/qnetworkconfiguration_p.h | 8 +- src/network/bearer/qnetworkconfiguration_s60_p.cpp | 59 - src/network/bearer/qnetworksession.cpp | 143 ++- src/network/bearer/qnetworksession_p.cpp | 484 --------- src/network/bearer/qnetworksession_p.h | 93 +- src/network/bearer/qnetworksession_s60_p.cpp | 1134 -------------------- src/network/bearer/qnetworksession_s60_p.h | 212 ---- src/network/bearer/qnetworksessionengine_p.h | 2 + src/plugins/bearer/generic/generic.pro | 5 +- src/plugins/bearer/generic/qgenericengine.cpp | 8 +- src/plugins/bearer/generic/qgenericengine.h | 3 + src/plugins/bearer/qnetworksession_impl.cpp | 485 +++++++++ src/plugins/bearer/qnetworksession_impl.h | 136 +++ src/plugins/bearer/symbian/main.cpp | 2 - .../bearer/symbian/qnetworksession_impl.cpp | 1125 +++++++++++++++++++ src/plugins/bearer/symbian/qnetworksession_impl.h | 196 ++++ src/plugins/bearer/symbian/symbian.pro | 8 +- src/plugins/bearer/symbian/symbianengine.cpp | 67 +- src/plugins/bearer/symbian/symbianengine.h | 21 +- .../tst_qnetworksession/tst_qnetworksession.cpp | 16 +- 22 files changed, 2152 insertions(+), 2065 deletions(-) delete mode 100644 src/network/bearer/qnetworkconfiguration_s60_p.cpp delete mode 100644 src/network/bearer/qnetworksession_p.cpp delete mode 100644 src/network/bearer/qnetworksession_s60_p.cpp delete mode 100644 src/network/bearer/qnetworksession_s60_p.h create mode 100644 src/plugins/bearer/qnetworksession_impl.cpp create mode 100644 src/plugins/bearer/qnetworksession_impl.h create mode 100644 src/plugins/bearer/symbian/qnetworksession_impl.cpp create mode 100644 src/plugins/bearer/symbian/qnetworksession_impl.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 169c8b7..0450961 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -10,12 +10,7 @@ SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ bearer/qnetworkconfiguration.cpp -symbian_disabled { - HEADERS += bearer/qnetworksession_s60_p.h - - SOURCES += bearer/qnetworkconfiguration_s60_p.cpp \ - bearer/qnetworksession_s60_p.cpp -} else:maemo { +maemo { QT += dbus CONFIG += link_pkgconfig @@ -50,7 +45,6 @@ symbian_disabled { bearer/qbearerplugin.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ - bearer/qnetworksession_p.cpp \ bearer/qnetworksessionengine.cpp \ bearer/qbearerplugin.cpp diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index d7a813b..4ef1f09 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -110,7 +110,7 @@ private Q_SLOTS: void configurationChanged(QNetworkConfigurationPrivatePointer ptr); }; -QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); +Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate(); QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index bfc42f5..40aea8b 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -75,13 +75,15 @@ public: serviceNetworkMembers.clear(); } - QString name; - QString bearer; - inline QString bearerName() const + virtual QString bearerName() const { return bearer; } + QString bearer; + + QString name; + bool isValid; QString id; QNetworkConfiguration::StateFlags state; diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp deleted file mode 100644 index 142415a..0000000 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -QT_BEGIN_NAMESPACE - -QString QNetworkConfigurationPrivate::bearerName() const -{ - switch (bearer) { - case QNetworkConfigurationPrivate::BearerEthernet: return QLatin1String("Ethernet"); - case QNetworkConfigurationPrivate::BearerWLAN: return QLatin1String("WLAN"); - case QNetworkConfigurationPrivate::Bearer2G: return QLatin1String("2G"); - case QNetworkConfigurationPrivate::BearerCDMA2000: return QLatin1String("CDMA2000"); - case QNetworkConfigurationPrivate::BearerWCDMA: return QLatin1String("WCDMA"); - case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); - case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); - case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); - default: return QString(); - } -} - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 5f87d95..6b0ccaf 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -43,6 +43,8 @@ #include #include "qnetworksession.h" +#include "qnetworksessionengine_p.h" +#include "qnetworkconfigmanager_p.h" #if Q_WS_MAEMO_6 #include "qnetworksession_maemo_p.h" @@ -224,14 +226,25 @@ QT_BEGIN_NAMESPACE \sa QNetworkConfiguration */ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) - : QObject(parent) +: QObject(parent), d(0) { - d = new QNetworkSessionPrivate; - d->q = this; - d->publicConfig = connectionConfig; - d->syncStateWithInterface(); - QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), - this, SIGNAL(opened())); + foreach (QNetworkSessionEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { + if (engine->hasIdentifier(connectionConfig.identifier())) { + d = engine->createSessionBackend(); + d->q = this; + d->publicConfig = connectionConfig; + d->syncStateWithInterface(); + connect(d, SIGNAL(quitPendingWaitsForOpened()), this, SIGNAL(opened())); + connect(d, SIGNAL(error(QNetworkSession::SessionError)), + this, SIGNAL(error(QNetworkSession::SessionError))); + connect(d, SIGNAL(stateChanged(QNetworkSession::State)), + this, SIGNAL(stateChanged(QNetworkSession::State))); + connect(d, SIGNAL(closed()), this, SIGNAL(closed())); + connect(d, SIGNAL(newConfigurationActivated()), + this, SIGNAL(newConfigurationActivated())); + break; + } + } } /*! @@ -261,7 +274,8 @@ QNetworkSession::~QNetworkSession() */ void QNetworkSession::open() { - d->open(); + if (d) + d->open(); } /*! @@ -283,6 +297,9 @@ void QNetworkSession::open() */ bool QNetworkSession::waitForOpened(int msecs) { + if (!d) + return false; + if (d->isOpen) return true; @@ -320,7 +337,8 @@ bool QNetworkSession::waitForOpened(int msecs) */ void QNetworkSession::close() { - d->close(); + if (d) + d->close(); } /*! @@ -332,7 +350,8 @@ void QNetworkSession::close() */ void QNetworkSession::stop() { - d->stop(); + if (d) + d->stop(); } /*! @@ -342,61 +361,9 @@ void QNetworkSession::stop() */ QNetworkConfiguration QNetworkSession::configuration() const { - return d->publicConfig; + return d ? d->publicConfig : QNetworkConfiguration(); } -/* - Returns the type of bearer currently used by this session. The string is not translated and - therefore can not be shown to the user. The subsequent table presents the currently known - bearer types: - - \table - \header - \o Value - \o Description - \row - \o Unknown - \o The session is based on an unknown or unspecified bearer type. - \row - \o Ethernet - \o The session is based on Ethernet. - \row - \o WLAN - \o The session is based on Wireless LAN. - \row - \o 2G - \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. - \row - \o CDMA2000 - \o The session uses CDMA. - \row - \o WCDMA - \o The session uses W-CDMA/UMTS. - \row - \o HSPA - \o The session uses High Speed Packet Access. - \row - \o Bluetooth - \o The session uses Bluetooth. - \row - \o WiMAX - \o The session uses WiMAX. - \endtable - - If the session is based on a network configuration of type - \l QNetworkConfiguration::ServiceNetwork the type of the preferred or currently - active configuration is returned. Therefore the bearer type may change - over time. - - This function returns an empty string if this session is based on an invalid configuration, or - a network configuration of type \l QNetworkConfiguration::ServiceNetwork with no - \l {QNetworkConfiguration::children()}{children}. -*/ -/*QString QNetworkSession::bearerName() const -{ - return d->bearerName(); -}*/ - /*! Returns the network interface that is used by this session. @@ -408,7 +375,7 @@ QNetworkConfiguration QNetworkSession::configuration() const */ QNetworkInterface QNetworkSession::interface() const { - return d->currentInterface(); + return d ? d->currentInterface() : QNetworkInterface(); } /*! @@ -419,7 +386,7 @@ QNetworkInterface QNetworkSession::interface() const */ bool QNetworkSession::isOpen() const { - return d->isOpen; + return d ? d->isOpen : false; } /*! @@ -441,7 +408,7 @@ bool QNetworkSession::isOpen() const */ QNetworkSession::State QNetworkSession::state() const { - return d->state; + return d ? d->state : QNetworkSession::Invalid; } /*! @@ -451,7 +418,7 @@ QNetworkSession::State QNetworkSession::state() const */ QNetworkSession::SessionError QNetworkSession::error() const { - return d->error(); + return d ? d->error() : InvalidConfigurationError; } /*! @@ -462,7 +429,7 @@ QNetworkSession::SessionError QNetworkSession::error() const */ QString QNetworkSession::errorString() const { - return d->errorString(); + return d ? d->errorString() : tr("Invalid configuration."); } /*! @@ -520,6 +487,9 @@ QString QNetworkSession::errorString() const */ QVariant QNetworkSession::sessionProperty(const QString& key) const { + if (!d) + return QVariant(); + if (!d->publicConfig.isValid()) return QVariant(); @@ -553,6 +523,9 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const */ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value) { + if (!d) + return; + if (key == QLatin1String("ActiveConfiguration") || key == QLatin1String("UserChoiceConfiguration")) { return; @@ -571,7 +544,8 @@ void QNetworkSession::setSessionProperty(const QString& key, const QVariant& val */ void QNetworkSession::migrate() { - d->migrate(); + if (d) + d->migrate(); } /*! @@ -583,7 +557,8 @@ void QNetworkSession::ignore() { // Needed on at least Symbian platform: the roaming must be explicitly // ignore()'d or migrate()'d - d->ignore(); + if (d) + d->ignore(); } /*! @@ -596,7 +571,8 @@ void QNetworkSession::ignore() */ void QNetworkSession::accept() { - d->accept(); + if (d) + d->accept(); } /*! @@ -608,7 +584,8 @@ void QNetworkSession::accept() */ void QNetworkSession::reject() { - d->reject(); + if (d) + d->reject(); } @@ -626,7 +603,7 @@ void QNetworkSession::reject() */ quint64 QNetworkSession::bytesWritten() const { - return d->bytesWritten(); + return d ? d->bytesWritten() : Q_UINT64_C(0); } /*! @@ -643,7 +620,7 @@ quint64 QNetworkSession::bytesWritten() const */ quint64 QNetworkSession::bytesReceived() const { - return d->bytesReceived(); + return d ? d->bytesReceived() : Q_UINT64_C(0); } /*! @@ -651,7 +628,7 @@ quint64 QNetworkSession::bytesReceived() const */ quint64 QNetworkSession::activeTime() const { - return d->activeTime(); + return d ? d->activeTime() : Q_UINT64_C(0); } /*! @@ -670,11 +647,11 @@ void QNetworkSession::connectNotify(const char *signal) QObject::connectNotify(signal); //check for preferredConfigurationChanged() signal connect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN_disabled - if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { + if (!d) + return; + + if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) d->setALREnabled(true); - } -#endif } /*! @@ -690,11 +667,11 @@ void QNetworkSession::disconnectNotify(const char *signal) QObject::disconnectNotify(signal); //check for preferredConfigurationChanged() signal disconnect notification //This is not required on all platforms -#ifdef Q_OS_SYMBIAN_disabled - if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) { + if (!d) + return; + + if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0) d->setALREnabled(false); - } -#endif } #include "moc_qnetworksession.cpp" diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp deleted file mode 100644 index b615797..0000000 --- a/src/network/bearer/qnetworksession_p.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworksession_p.h" -#include "qnetworksession.h" -#include "qnetworksessionengine_p.h" -#include "qnetworkconfigmanager_p.h" - -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -static QNetworkSessionEngine *getEngineFromId(const QString &id) -{ - QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - - foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { - if (engine->hasIdentifier(id)) - return engine; - } - - return 0; -} - -class QNetworkSessionManagerPrivate : public QObject -{ - Q_OBJECT - -public: - QNetworkSessionManagerPrivate(QObject *parent = 0); - ~QNetworkSessionManagerPrivate(); - - void forceSessionClose(const QNetworkConfiguration &config); - -Q_SIGNALS: - void forcedSessionClose(const QNetworkConfiguration &config); -}; - -#include "qnetworksession_p.moc" - -Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); - -QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) -: QObject(parent) -{ -} - -QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() -{ -} - -void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) -{ - emit forcedSessionClose(config); -} - -void QNetworkSessionPrivate::syncStateWithInterface() -{ - connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); - connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), - this, SLOT(configurationChanged(QNetworkConfiguration))); - connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), - this, SLOT(forcedSessionClose(QNetworkConfiguration))); - - opened = false; - isOpen = false; - state = QNetworkSession::Invalid; - lastError = QNetworkSession::UnknownSessionError; - - qRegisterMetaType - ("QNetworkSessionEngine::ConnectionError"); - - switch (publicConfig.type()) { - case QNetworkConfiguration::InternetAccessPoint: - activeConfig = publicConfig; - engine = getEngineFromId(activeConfig.identifier()); - if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - Qt::QueuedConnection); - } - break; - case QNetworkConfiguration::ServiceNetwork: - serviceConfig = publicConfig; - // Defer setting engine and signals until open(). - // fall through - case QNetworkConfiguration::UserChoice: - // Defer setting serviceConfig and activeConfig until open(). - // fall through - default: - engine = 0; - } - - networkConfigurationsChanged(); -} - -void QNetworkSessionPrivate::open() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (!isOpen) { - if ((activeConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - lastError =QNetworkSession::InvalidConfigurationError; - emit q->error(lastError); - return; - } - opened = true; - - if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && - (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - state = QNetworkSession::Connecting; - emit q->stateChanged(state); - - engine->connectToId(activeConfig.identifier()); - } - - isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isOpen) - emit quitPendingWaitsForOpened(); - } -} - -void QNetworkSessionPrivate::close() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (isOpen) { - opened = false; - isOpen = false; - emit q->closed(); - } -} - -void QNetworkSessionPrivate::stop() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else { - if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Closing; - emit q->stateChanged(state); - - engine->disconnectFromId(activeConfig.identifier()); - - sessionManager()->forceSessionClose(activeConfig); - } - - opened = false; - isOpen = false; - emit q->closed(); - } -} - -void QNetworkSessionPrivate::migrate() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -void QNetworkSessionPrivate::accept() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -void QNetworkSessionPrivate::ignore() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -void QNetworkSessionPrivate::reject() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - -QNetworkInterface QNetworkSessionPrivate::currentInterface() const -{ - if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) - return QNetworkInterface(); - - QString interface = engine->getInterfaceFromId(activeConfig.identifier()); - - if (interface.isEmpty()) - return QNetworkInterface(); - return QNetworkInterface::interfaceFromName(interface); -} - -QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const -{ - return QVariant(); -} - -void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) -{ -} - -/*QString QNetworkSessionPrivate::bearerName() const -{ - if (!publicConfig.isValid() || !engine) - return QString(); - - return engine->bearerName(activeConfig.identifier()); -}*/ - -QString QNetworkSessionPrivate::errorString() const -{ - switch (lastError) { - case QNetworkSession::UnknownSessionError: - return tr("Unknown session error."); - case QNetworkSession::SessionAbortedError: - return tr("The session was aborted by the user or system."); - case QNetworkSession::OperationNotSupportedError: - return tr("The requested operation is not supported by the system."); - case QNetworkSession::InvalidConfigurationError: - return tr("The specified configuration cannot be used."); - case QNetworkSession::RoamingError: - return tr("Roaming was aborted or is not possible."); - - } - - return QString(); -} - -QNetworkSession::SessionError QNetworkSessionPrivate::error() const -{ - return lastError; -} - -quint64 QNetworkSessionPrivate::bytesWritten() const -{ -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); - } - } -#endif - return tx_data; -} - -quint64 QNetworkSessionPrivate::bytesReceived() const -{ -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); - } - } -#endif - return rx_data; -} - -quint64 QNetworkSessionPrivate::activeTime() const -{ -#if defined(BACKEND_NM) - if (startTime.isNull()) { - return 0; - } - if(state == QNetworkSession::Connected ) - return startTime.secsTo(QDateTime::currentDateTime()); -#endif - return m_activeTime; -} - -void QNetworkSessionPrivate::updateStateFromServiceNetwork() -{ - QNetworkSession::State oldState = state; - - foreach (const QNetworkConfiguration &config, serviceConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) - continue; - - if (activeConfig != config) { - if (engine) { - disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); - } - - activeConfig = config; - engine = getEngineFromId(activeConfig.identifier()); - if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - Qt::QueuedConnection); - } - emit q->newConfigurationActivated(); - } - - state = QNetworkSession::Connected; - qDebug() << oldState << "->" << state; - if (state != oldState) - emit q->stateChanged(state); - - return; - } - - if (serviceConfig.children().isEmpty()) - state = QNetworkSession::NotAvailable; - else - state = QNetworkSession::Disconnected; - - qDebug() << oldState << "->" << state; - if (state != oldState) - emit q->stateChanged(state); -} - -void QNetworkSessionPrivate::updateStateFromActiveConfig() -{ - if (!engine) - return; - - QNetworkSession::State oldState = state; - - state = engine->sessionStateForId(activeConfig.identifier()); - - bool oldActive = isOpen; - isOpen = (state == QNetworkSession::Connected) ? opened : false; - - if (!oldActive && isOpen) - emit quitPendingWaitsForOpened(); - if (oldActive && !isOpen) - emit q->closed(); - - if (oldState != state) - emit q->stateChanged(state); -} - -void QNetworkSessionPrivate::networkConfigurationsChanged() -{ - if (serviceConfig.isValid()) - updateStateFromServiceNetwork(); - else - updateStateFromActiveConfig(); -#if defined(BACKEND_NM) && 0 - setActiveTimeStamp(); -#endif -} - -void QNetworkSessionPrivate::configurationChanged(const QNetworkConfiguration &config) -{ - if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig)) - updateStateFromServiceNetwork(); - else if (config == activeConfig) - updateStateFromActiveConfig(); -} - -void QNetworkSessionPrivate::forcedSessionClose(const QNetworkConfiguration &config) -{ - if (activeConfig == config) { - opened = false; - isOpen = false; - - emit q->closed(); - - lastError = QNetworkSession::SessionAbortedError; - emit q->error(lastError); - } -} - -void QNetworkSessionPrivate::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) -{ - if (activeConfig.identifier() == id) { - networkConfigurationsChanged(); - switch (error) { - case QNetworkSessionEngine::OperationNotSupported: - lastError = QNetworkSession::OperationNotSupportedError; - opened = false; - break; - case QNetworkSessionEngine::InterfaceLookupError: - case QNetworkSessionEngine::ConnectError: - case QNetworkSessionEngine::DisconnectionError: - default: - lastError = QNetworkSession::UnknownSessionError; - } - - emit quitPendingWaitsForOpened(); - emit q->error(lastError); - } -} - -#if defined(BACKEND_NM) && 0 -void QNetworkSessionPrivate::setActiveTimeStamp() -{ - if(NetworkManagerAvailable()) { - startTime = QDateTime(); - return; - } - QString connectionIdent = q->configuration().identifier(); - QString interface = currentInterface().hardwareAddress().toLower(); - QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); - - QString path; - QString serviceName; - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath conpath, connections) { - QNetworkManagerConnectionActive *conDetails; - conDetails = new QNetworkManagerConnectionActive(conpath.path()); - QDBusObjectPath connection = conDetails->connection(); - serviceName = conDetails->serviceName(); - QList so = conDetails->devices(); - foreach(QDBusObjectPath device, so) { - - if(device.path() == devicePath) { - path = connection.path(); - } - break; - } - } -if(serviceName.isEmpty()) - return; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(serviceName); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); - startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); - // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - } - if(startTime.isNull()) - startTime = QDateTime::currentDateTime(); -} -#endif - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index cd73c9a..6395250 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -53,28 +53,26 @@ // We mean it. // -#include "qnetworkconfigmanager_p.h" #include "qnetworksession.h" -#include "qnetworksessionengine_p.h" +#include "qnetworkconfiguration_p.h" -#include "qnetworksession.h" #include -#include QT_BEGIN_NAMESPACE -class QNetworkSessionEngine; - -class QNetworkSessionPrivate : public QObject +class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject { Q_OBJECT + + friend class QNetworkSession; + public: - QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isOpen(false) + QNetworkSessionPrivate() + : state(QNetworkSession::Invalid), isOpen(false) { } - ~QNetworkSessionPrivate() + virtual ~QNetworkSessionPrivate() { } @@ -82,49 +80,46 @@ public: //that the state is immediately updated (w/o actually opening //a session). Also this function should take care of //notification hooks to discover future state changes. - void syncStateWithInterface(); + virtual void syncStateWithInterface() = 0; + + virtual QNetworkInterface currentInterface() const = 0; + virtual QVariant sessionProperty(const QString& key) const = 0; + virtual void setSessionProperty(const QString& key, const QVariant& value) = 0; - QNetworkInterface currentInterface() const; - QVariant sessionProperty(const QString& key) const; - void setSessionProperty(const QString& key, const QVariant& value); - QString bearerName() const; + virtual void open() = 0; + virtual void close() = 0; + virtual void stop() = 0; - void open(); - void close(); - void stop(); - void migrate(); - void accept(); - void ignore(); - void reject(); + virtual void setALREnabled(bool enabled) { } + virtual void migrate() = 0; + virtual void accept() = 0; + virtual void ignore() = 0; + virtual void reject() = 0; - QString errorString() const; //must return translated string - QNetworkSession::SessionError error() const; + virtual QString errorString() const = 0; //must return translated string + virtual QNetworkSession::SessionError error() const = 0; - quint64 bytesWritten() const; - quint64 bytesReceived() const; - quint64 activeTime() const; + virtual quint64 bytesWritten() const = 0; + virtual quint64 bytesReceived() const = 0; + virtual quint64 activeTime() const = 0; -private: - void updateStateFromServiceNetwork(); - void updateStateFromActiveConfig(); +protected: + inline QNetworkConfigurationPrivatePointer privateConfiguration(const QNetworkConfiguration &config) const + { + return config.d; + } Q_SIGNALS: //releases any pending waitForOpened() calls void quitPendingWaitsForOpened(); -private Q_SLOTS: - void networkConfigurationsChanged(); - void configurationChanged(const QNetworkConfiguration &config); - void forcedSessionClose(const QNetworkConfiguration &config); - void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); - -private: - QNetworkConfigurationManager manager; - - quint64 tx_data; - quint64 rx_data; - quint64 m_activeTime; + void error(QNetworkSession::SessionError error); + void stateChanged(QNetworkSession::State state); + void closed(); + void newConfigurationActivated(); + void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); +protected: // The config set on QNetworkSession. QNetworkConfiguration publicConfig; @@ -140,19 +135,7 @@ private: QNetworkSession::State state; bool isOpen; - bool opened; - - QNetworkSessionEngine *engine; - - QNetworkSession::SessionError lastError; - - QNetworkSession* q; - friend class QNetworkSession; - -#if defined(BACKEND_NM) - QDateTime startTime; - void setActiveTimeStamp(); -#endif + QNetworkSession *q; }; QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp deleted file mode 100644 index 4d427c8..0000000 --- a/src/network/bearer/qnetworksession_s60_p.cpp +++ /dev/null @@ -1,1134 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qnetworksession_s60_p.h" -#include "qnetworkconfiguration_s60_p.h" -#include "qnetworkconfigmanager_s60_p.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -QNetworkSessionPrivate::QNetworkSessionPrivate() - : CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid), - isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError), - iALREnabled(0) -{ - CActiveScheduler::Add(this); - - // Try to load "Open C" dll dynamically and - // try to attach to setdefaultif function dynamically. - if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { - iDynamicSetdefaultif = (TOpenCSetdefaultifFunction)iOpenCLibrary.Lookup(564); - } - - TRAP_IGNORE(iConnectionMonitor.ConnectL()); -} - -QNetworkSessionPrivate::~QNetworkSessionPrivate() -{ - isOpen = false; - - // Cancel Connection Progress Notifications first. - // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() - // => deleting ipConnectionNotifier results RConnection::CancelProgressNotification() - delete ipConnectionNotifier; - ipConnectionNotifier = NULL; - - // Cancel possible RConnection::Start() - Cancel(); - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (iMobility) { - delete iMobility; - iMobility = NULL; - } -#endif - - iConnection.Close(); - iSocketServ.Close(); - if (iDynamicSetdefaultif) { - iDynamicSetdefaultif(0); - } - - iConnectionMonitor.CancelNotifications(); - iConnectionMonitor.Close(); - - iOpenCLibrary.Close(); -} - -void QNetworkSessionPrivate::syncStateWithInterface() -{ - if (!publicConfig.d) { - return; - } - - // Start monitoring changes in IAP states - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); - - // Check open connections to see if there is already - // an open connection to selected IAP or SNAP - TUint count; - TRequestStatus status; - iConnectionMonitor.GetConnectionCount(count, status); - User::WaitForRequest(status); - if (status.Int() != KErrNone) { - return; - } - - TUint numSubConnections; - TUint connectionId; - for (TUint i = 1; i <= count; i++) { - TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); - if (ret == KErrNone) { - TUint apId; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - TInt connectionStatus; - iConnectionMonitor.GetIntAttribute(connectionId, 0, KConnectionStatus, connectionStatus, status); - User::WaitForRequest(status); - if (connectionStatus == KLinkLayerOpen) { - if (state != QNetworkSession::Closing) { - if (newState(QNetworkSession::Connected, apId)) { - return; - } - } - } - } - } - } - - if (state != QNetworkSession::Connected) { - // There were no open connections to used IAP or SNAP - if ((publicConfig.d.data()->state & QNetworkConfiguration::Discovered) == - QNetworkConfiguration::Discovered) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::NotAvailable); - } - } -} - -QNetworkInterface QNetworkSessionPrivate::interface(TUint iapId) const -{ - QString interfaceName; - - TSoInetInterfaceInfo ifinfo; - TPckg ifinfopkg(ifinfo); - TSoInetIfQuery ifquery; - TPckg ifquerypkg(ifquery); - - // Open dummy socket for interface queries - RSocket socket; - TInt retVal = socket.Open(iSocketServ, _L("udp")); - if (retVal != KErrNone) { - return QNetworkInterface(); - } - - // Start enumerating interfaces - socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); - while(socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifinfopkg) == KErrNone) { - ifquery.iName = ifinfo.iName; - TInt err = socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifquerypkg); - if(err == KErrNone && ifquery.iZone[1] == iapId) { // IAP ID is index 1 of iZone - if(ifinfo.iAddress.Address() > 0) { - interfaceName = QString::fromUtf16(ifinfo.iName.Ptr(),ifinfo.iName.Length()); - break; - } - } - } - - socket.Close(); - - if (interfaceName.isEmpty()) { - return QNetworkInterface(); - } - - return QNetworkInterface::interfaceFromName(interfaceName); -} - -QNetworkInterface QNetworkSessionPrivate::currentInterface() const -{ - if (!publicConfig.isValid() || state != QNetworkSession::Connected) { - return QNetworkInterface(); - } - - return activeInterface; -} - -QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const -{ - return QVariant(); -} - -void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) -{ -} - -QString QNetworkSessionPrivate::errorString() const -{ - switch (iError) { - case QNetworkSession::UnknownSessionError: - return tr("Unknown session error."); - case QNetworkSession::SessionAbortedError: - return tr("The session was aborted by the user or system."); - case QNetworkSession::OperationNotSupportedError: - return tr("The requested operation is not supported by the system."); - case QNetworkSession::InvalidConfigurationError: - return tr("The specified configuration cannot be used."); - case QNetworkSession::RoamingError: - return tr("Roaming was aborted or is not possible."); - } - - return QString(); -} - -QNetworkSession::SessionError QNetworkSessionPrivate::error() const -{ - return iError; -} - -void QNetworkSessionPrivate::open() -{ - if (isOpen || !publicConfig.d || (state == QNetworkSession::Connecting)) { - return; - } - - // Cancel notifications from RConnectionMonitor - // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring - iConnectionMonitor.CancelNotifications(); - - TInt error = iSocketServ.Connect(); - if (error != KErrNone) { - // Could not open RSocketServ - newState(QNetworkSession::Invalid); - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - syncStateWithInterface(); - return; - } - - error = iConnection.Open(iSocketServ); - if (error != KErrNone) { - // Could not open RConnection - iSocketServ.Close(); - newState(QNetworkSession::Invalid); - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - syncStateWithInterface(); - return; - } - - // Use RConnection::ProgressNotification for IAP/SNAP monitoring - // (<=> ConnectionProgressNotifier uses RConnection::ProgressNotification) - if (!ipConnectionNotifier) { - ipConnectionNotifier = new ConnectionProgressNotifier(*this,iConnection); - } - if (ipConnectionNotifier) { - ipConnectionNotifier->StartNotifications(); - } - - if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - // Search through existing connections. - // If there is already connection which matches to given IAP - // try to attach to existing connection. - TBool connected(EFalse); - TConnectionInfoBuf connInfo; - TUint count; - if (iConnection.EnumerateConnections(count) == KErrNone) { - for (TUint i=1; i<=count; i++) { - // Note: GetConnectionInfo expects 1-based index. - if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) { - if (connInfo().iIapId == publicConfig.d.data()->numericId) { - if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { - activeConfig = publicConfig; - activeInterface = interface(activeConfig.d.data()->numericId); - connected = ETrue; - startTime = QDateTime::currentDateTime(); - if (iDynamicSetdefaultif) { - // Use name of the IAP to set default IAP - QByteArray nameAsByteArray = publicConfig.name().toUtf8(); - ifreq ifr; - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - - error = iDynamicSetdefaultif(&ifr); - } - isOpen = true; - // Make sure that state will be Connected - newState(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - break; - } - } - } - } - } - if (!connected) { - TCommDbConnPref pref; - pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); - pref.SetIapId(publicConfig.d.data()->numericId); - iConnection.Start(pref, iStatus); - if (!IsActive()) { - SetActive(); - } - newState(QNetworkSession::Connecting); - } - } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - TConnSnapPref snapPref(publicConfig.d.data()->numericId); - iConnection.Start(snapPref, iStatus); - if (!IsActive()) { - SetActive(); - } - newState(QNetworkSession::Connecting); - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - iKnownConfigsBeforeConnectionStart = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); - iConnection.Start(iStatus); - if (!IsActive()) { - SetActive(); - } - newState(QNetworkSession::Connecting); - } - - if (error != KErrNone) { - isOpen = false; - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - } -} - -TUint QNetworkSessionPrivate::iapClientCount(TUint aIAPId) const -{ - TRequestStatus status; - TUint connectionCount; - iConnectionMonitor.GetConnectionCount(connectionCount, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - for (TUint i = 1; i <= connectionCount; i++) { - TUint connectionId; - TUint subConnectionCount; - iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); - TUint apId; - iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); - User::WaitForRequest(status); - if (apId == aIAPId) { - TConnMonClientEnumBuf buf; - iConnectionMonitor.GetPckgAttribute(connectionId, 0, KClientInfo, buf, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - return buf().iCount; - } - } - } - } - return 0; -} - -void QNetworkSessionPrivate::close(bool allowSignals) -{ - if (!isOpen) { - return; - } - - TUint activeIap = activeConfig.d.data()->numericId; - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - - Cancel(); -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (iMobility) { - delete iMobility; - iMobility = NULL; - } -#endif - - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - - iConnection.Close(); - iSocketServ.Close(); - if (iDynamicSetdefaultif) { - iDynamicSetdefaultif(0); - } - -#ifdef Q_CC_NOKIAX86 - if ((allowSignals && iapClientCount(activeIap) <= 0) || -#else - if ((allowSignals && iapClientCount(activeIap) <= 1) || -#endif - (publicConfig.type() == QNetworkConfiguration::UserChoice)) { - newState(QNetworkSession::Closing); - } - - syncStateWithInterface(); - if (allowSignals) { - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - newState(QNetworkSession::Disconnected); - } - emit q->closed(); - } -} - -void QNetworkSessionPrivate::stop() -{ - if (!isOpen) { - return; - } - isOpen = false; - newState(QNetworkSession::Closing); - iConnection.Stop(RConnection::EStopAuthoritative); - isOpen = true; - close(false); - emit q->closed(); -} - -void QNetworkSessionPrivate::migrate() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->MigrateToPreferredCarrier(); -#endif -} - -void QNetworkSessionPrivate::ignore() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->IgnorePreferredCarrier(); - if (!iALRUpgradingConnection) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::Connected,iOldRoamingIap); - } -#endif -} - -void QNetworkSessionPrivate::accept() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->NewCarrierAccepted(); - if (iDynamicSetdefaultif) { - // Use name of the IAP to set default IAP - QByteArray nameAsByteArray = activeConfig.name().toUtf8(); - ifreq ifr; - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - - iDynamicSetdefaultif(&ifr); - } - newState(QNetworkSession::Connected, iNewRoamingIap); -#endif -} - -void QNetworkSessionPrivate::reject() -{ -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - iMobility->NewCarrierRejected(); - if (!iALRUpgradingConnection) { - newState(QNetworkSession::Disconnected); - } else { - newState(QNetworkSession::Connected, iOldRoamingIap); - } -#endif -} - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -void QNetworkSessionPrivate::PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, - TAccessPointInfo aNewAPInfo, - TBool aIsUpgrade, - TBool aIsSeamless) -{ - iOldRoamingIap = aOldAPInfo.AccessPoint(); - iNewRoamingIap = aNewAPInfo.AccessPoint(); - newState(QNetworkSession::Roaming); - if (iALREnabled > 0) { - iALRUpgradingConnection = aIsUpgrade; - QList configs = publicConfig.children(); - for (int i=0; i < configs.count(); i++) { - if (configs[i].d.data()->numericId == aNewAPInfo.AccessPoint()) { - emit q->preferredConfigurationChanged(configs[i],aIsSeamless); - } - } - } else { - migrate(); - } -} - -void QNetworkSessionPrivate::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/) -{ - if (iALREnabled > 0) { - emit q->newConfigurationActivated(); - } else { - accept(); - } -} - -void QNetworkSessionPrivate::Error(TInt /*aError*/) -{ - if (isOpen) { - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::RoamingError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - // In some cases IAP is still in Connected state when - // syncStateWithInterface(); is called - // => Following call makes sure that Session state - // changes immediately to Disconnected. - newState(QNetworkSession::Disconnected); - emit q->closed(); - } -} -#endif - -void QNetworkSessionPrivate::setALREnabled(bool enabled) -{ - if (enabled) { - iALREnabled++; - } else { - iALREnabled--; - } -} - -QNetworkConfiguration QNetworkSessionPrivate::bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const -{ - QNetworkConfiguration config; - QList subConfigurations = snapConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].state() == QNetworkConfiguration::Active) { - config = subConfigurations[i]; - break; - } else if (!config.isValid() && subConfigurations[i].state() == QNetworkConfiguration::Discovered) { - config = subConfigurations[i]; - } - } - if (!config.isValid() && subConfigurations.count() > 0) { - config = subConfigurations[0]; - } - return config; -} - -quint64 QNetworkSessionPrivate::bytesWritten() const -{ - return transferredData(KUplinkData); -} - -quint64 QNetworkSessionPrivate::bytesReceived() const -{ - return transferredData(KDownlinkData); -} - -quint64 QNetworkSessionPrivate::transferredData(TUint dataType) const -{ - if (!publicConfig.isValid()) { - return 0; - } - - QNetworkConfiguration config; - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (serviceConfig.isValid()) { - config = serviceConfig; - } else { - if (activeConfig.isValid()) { - config = activeConfig; - } - } - } else { - config = publicConfig; - } - - if (!config.isValid()) { - return 0; - } - - TUint count; - TRequestStatus status; - iConnectionMonitor.GetConnectionCount(count, status); - User::WaitForRequest(status); - if (status.Int() != KErrNone) { - return 0; - } - - TUint transferredData = 0; - TUint numSubConnections; - TUint connectionId; - bool configFound; - for (TUint i = 1; i <= count; i++) { - TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); - if (ret == KErrNone) { - TUint apId; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - configFound = false; - if (config.type() == QNetworkConfiguration::ServiceNetwork) { - QList configs = config.children(); - for (int i=0; i < configs.count(); i++) { - if (configs[i].d.data()->numericId == apId) { - configFound = true; - break; - } - } - } else if (config.d.data()->numericId == apId) { - configFound = true; - } - if (configFound) { - TUint tData; - iConnectionMonitor.GetUintAttribute(connectionId, 0, dataType, tData, status ); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - transferredData += tData; - } - } - } - } - } - - return transferredData; -} - -quint64 QNetworkSessionPrivate::activeTime() const -{ - if (!isOpen || startTime.isNull()) { - return 0; - } - return startTime.secsTo(QDateTime::currentDateTime()); -} - -QNetworkConfiguration QNetworkSessionPrivate::activeConfiguration(TUint32 iapId) const -{ - if (iapId == 0) { - _LIT(KSetting, "IAP\\Id"); - iConnection.GetIntSetting(KSetting, iapId); - } - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - // Try to search IAP from the used SNAP using IAP Id - QList children = publicConfig.children(); - for (int i=0; i < children.count(); i++) { - if (children[i].d.data()->numericId == iapId) { - return children[i]; - } - } - - // Given IAP Id was not found from the used SNAP - // => Try to search matching IAP using mappingName - // mappingName contains: - // 1. "Access point name" for "Packet data" Bearer - // 2. "WLAN network name" (= SSID) for "Wireless LAN" Bearer - // 3. "Dial-up number" for "Data call Bearer" or "High Speed (GSM)" Bearer - // <=> Note: It's possible that in this case reported IAP is - // clone of the one of the IAPs of the used SNAP - // => If mappingName matches, clone has been found - QNetworkConfiguration pt; - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); - if (pt.d) { - for (int i=0; i < children.count(); i++) { - if (children[i].d.data()->mappingName == pt.d.data()->mappingName) { - return children[i]; - } - } - } else { - // Given IAP Id was not found from known IAPs array - return QNetworkConfiguration(); - } - - // Matching IAP was not found from used SNAP - // => IAP from another SNAP is returned - // (Note: Returned IAP matches to given IAP Id) - return pt; - } -#endif - - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - if (publicConfig.d.data()->manager) { - QNetworkConfiguration pt; - // Try to found User Selected IAP from known IAPs (accessPointConfigurations) - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(QString::number(qHash(iapId))); - if (pt.d) { - return pt; - } else { - // Check if new (WLAN) IAP was created in IAP/SNAP dialog - // 1. Sync internal configurations array to commsdb first - ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->updateConfigurations(); - // 2. Check if new configuration was created during connection creation - QList knownConfigs = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.keys(); - if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { - // Configuration count increased => new configuration was created - // => Search new, created configuration - QString newIapId; - for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) { - if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) { - newIapId = knownConfigs[i]; - break; - } - } - if (newIapId.isEmpty()) { - newIapId = knownConfigs[knownConfigs.count()-1]; - } - pt.d = ((QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager)->accessPointConfigurations.value(newIapId); - if (pt.d) { - return pt; - } - } - } - } - return QNetworkConfiguration(); - } - - return publicConfig; -} - -void QNetworkSessionPrivate::RunL() -{ - TInt statusCode = iStatus.Int(); - - switch (statusCode) { - case KErrNone: // Connection created succesfully - { - TInt error = KErrNone; - QNetworkConfiguration newActiveConfig = activeConfiguration(); - if (!newActiveConfig.isValid()) { - error = KErrGeneral; - } else if (iDynamicSetdefaultif) { - // Use name of the IAP to set default IAP - QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); - ifreq ifr; - strcpy(ifr.ifr_name, nameAsByteArray.constData()); - - error = iDynamicSetdefaultif(&ifr); - } - - if (error != KErrNone) { - isOpen = false; - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - return; - } - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - // Activate ALR monitoring - iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); - } -#endif - isOpen = true; - activeConfig = newActiveConfig; - activeInterface = interface(activeConfig.d.data()->numericId); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - QNetworkConfiguration pt; - pt.d = activeConfig.d.data()->serviceNetworkPtr; - serviceConfig = pt; - } - - startTime = QDateTime::currentDateTime(); - - newState(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - } - break; - case KErrNotFound: // Connection failed - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::InvalidConfigurationError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - break; - case KErrCancel: // Connection attempt cancelled - case KErrAlreadyExists: // Connection already exists - default: - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::UnknownSessionError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - syncStateWithInterface(); - break; - } -} - -void QNetworkSessionPrivate::DoCancel() -{ - iConnection.Close(); -} - -bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint accessPointId) -{ - // Make sure that activeConfig is always updated when SNAP is signaled to be - // connected. - if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && - newState == QNetworkSession::Connected) { - activeConfig = activeConfiguration(accessPointId); - activeInterface = interface(activeConfig.d.data()->numericId); - } - - // Make sure that same state is not signaled twice in a row. - if (state == newState) { - return true; - } - - // Make sure that Connecting state does not overwrite Roaming state - if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) { - return false; - } - - bool emitSessionClosed = false; - if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { - // Active & Connected state should change directly to Disconnected state - // only when something forces connection to close (eg. when another - // application or session stops connection or when network drops - // unexpectedly). - isOpen = false; - activeConfig = QNetworkConfiguration(); - serviceConfig = QNetworkConfiguration(); - iError = QNetworkSession::SessionAbortedError; - emit q->error(iError); - Cancel(); - if (ipConnectionNotifier) { - ipConnectionNotifier->StopNotifications(); - } - // Start monitoring changes in IAP states - TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); - emitSessionClosed = true; // Emit SessionClosed after state change has been reported - } - - bool retVal = false; - if (accessPointId == 0) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } else { - if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->numericId == accessPointId) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } - } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) { - if (activeConfig.d.data()->numericId == accessPointId) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } - } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++) { - if (subConfigurations[i].d.data()->numericId == accessPointId) { - if (newState == QNetworkSession::Connected) { - // Make sure that when AccessPoint is reported to be Connected - // also state of the related configuration changes to Active. - subConfigurations[i].d.data()->state = QNetworkConfiguration::Active; - - state = newState; - emit q->stateChanged(state); - retVal = true; - } else { - if (newState == QNetworkSession::Disconnected) { - // Make sure that when AccessPoint is reported to be disconnected - // also state of the related configuration changes from Active to Defined. - subConfigurations[i].d.data()->state = QNetworkConfiguration::Defined; - } - QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); - if ((config.state() == QNetworkConfiguration::Defined) || - (config.state() == QNetworkConfiguration::Discovered)) { - state = newState; - emit q->stateChanged(state); - retVal = true; - } - } - } - } - } - } - - if (emitSessionClosed) { - emit q->closed(); - } - - return retVal; -} - -void QNetworkSessionPrivate::handleSymbianConnectionStatusChange(TInt aConnectionStatus, - TInt aError, - TUint accessPointId) -{ - switch (aConnectionStatus) - { - // Connection unitialised - case KConnectionUninitialised: - break; - - // Starting connetion selection - case KStartingSelection: - break; - - // Selection finished - case KFinishedSelection: - if (aError == KErrNone) - { - // The user successfully selected an IAP to be used - break; - } - else - { - // The user pressed e.g. "Cancel" and did not select an IAP - newState(QNetworkSession::Disconnected,accessPointId); - } - break; - - // Connection failure - case KConnectionFailure: - newState(QNetworkSession::NotAvailable); - break; - - // Prepearing connection (e.g. dialing) - case KPsdStartingConfiguration: - case KPsdFinishedConfiguration: - case KCsdFinishedDialling: - case KCsdScanningScript: - case KCsdGettingLoginInfo: - case KCsdGotLoginInfo: - break; - - // Creating connection (e.g. GPRS activation) - case KCsdStartingConnect: - case KCsdFinishedConnect: - newState(QNetworkSession::Connecting,accessPointId); - break; - - // Starting log in - case KCsdStartingLogIn: - break; - - // Finished login - case KCsdFinishedLogIn: - break; - - // Connection open - case KConnectionOpen: - break; - - case KLinkLayerOpen: - newState(QNetworkSession::Connected,accessPointId); - break; - - // Connection blocked or suspended - case KDataTransferTemporarilyBlocked: - break; - - // Hangup or GRPS deactivation - case KConnectionStartingClose: - newState(QNetworkSession::Closing,accessPointId); - break; - - // Connection closed - case KConnectionClosed: - break; - - case KLinkLayerClosed: - newState(QNetworkSession::Disconnected,accessPointId); - break; - - // Unhandled state - default: - break; - } -} - -void QNetworkSessionPrivate::EventL(const CConnMonEventBase& aEvent) -{ - switch (aEvent.EventType()) - { - case EConnMonConnectionStatusChange: - { - CConnMonConnectionStatusChange* realEvent; - realEvent = (CConnMonConnectionStatusChange*) &aEvent; - - TUint connectionId = realEvent->ConnectionId(); - TInt connectionStatus = realEvent->ConnectionStatus(); - - // Try to Find IAP Id using connection Id - TUint apId = 0; - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].d.data()->connectionId == connectionId) { - apId = subConfigurations[i].d.data()->numericId; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->connectionId == connectionId) { - apId = publicConfig.d.data()->numericId; - } - } - - if (apId > 0) { - handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId); - } - } - break; - - case EConnMonCreateConnection: - { - CConnMonCreateConnection* realEvent; - realEvent = (CConnMonCreateConnection*) &aEvent; - TUint apId; - TUint connectionId = realEvent->ConnectionId(); - TRequestStatus status; - iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); - User::WaitForRequest(status); - if (status.Int() == KErrNone) { - // Store connection id to related AccessPoint Configuration - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].d.data()->numericId == apId) { - subConfigurations[i].d.data()->connectionId = connectionId; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->numericId == apId) { - publicConfig.d.data()->connectionId = connectionId; - } - } - } - } - break; - - case EConnMonDeleteConnection: - { - CConnMonDeleteConnection* realEvent; - realEvent = (CConnMonDeleteConnection*) &aEvent; - TUint connectionId = realEvent->ConnectionId(); - // Remove connection id from related AccessPoint Configuration - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - QList subConfigurations = publicConfig.children(); - for (int i = 0; i < subConfigurations.count(); i++ ) { - if (subConfigurations[i].d.data()->connectionId == connectionId) { - subConfigurations[i].d.data()->connectionId = 0; - break; - } - } - } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { - if (publicConfig.d.data()->connectionId == connectionId) { - publicConfig.d.data()->connectionId = 0; - } - } - } - break; - - default: - // For unrecognized events - break; - } -} - -ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivate& owner, RConnection& connection) - : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) -{ - CActiveScheduler::Add(this); -} - -ConnectionProgressNotifier::~ConnectionProgressNotifier() -{ - Cancel(); -} - -void ConnectionProgressNotifier::StartNotifications() -{ - if (!IsActive()) { - SetActive(); - } - iConnection.ProgressNotification(iProgress, iStatus); -} - -void ConnectionProgressNotifier::StopNotifications() -{ - Cancel(); -} - -void ConnectionProgressNotifier::DoCancel() -{ - iConnection.CancelProgressNotification(); -} - -void ConnectionProgressNotifier::RunL() -{ - if (iStatus == KErrNone) { - iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError); - - SetActive(); - iConnection.ProgressNotification(iProgress, iStatus); - } -} - -#include "moc_qnetworksession_s60_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h deleted file mode 100644 index 9ac5ed8..0000000 --- a/src/network/bearer/qnetworksession_s60_p.h +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONPRIVATE_H -#define QNETWORKSESSIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworksession.h" - -#include - -#include -#include -#include -#include -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - #include -#endif - -typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*); - -QT_BEGIN_NAMESPACE - -class ConnectionProgressNotifier; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -class QNetworkSessionPrivate : public QObject, public CActive, public MMobilityProtocolResp, - public MConnectionMonitorObserver -#else -class QNetworkSessionPrivate : public QObject, public CActive, public MConnectionMonitorObserver -#endif -{ - Q_OBJECT -public: - QNetworkSessionPrivate(); - ~QNetworkSessionPrivate(); - - //called by QNetworkSession constructor and ensures - //that the state is immediately updated (w/o actually opening - //a session). Also this function should take care of - //notification hooks to discover future state changes. - void syncStateWithInterface(); - - QNetworkInterface currentInterface() const; - QVariant sessionProperty(const QString& key) const; - void setSessionProperty(const QString& key, const QVariant& value); - - void setALREnabled(bool enabled); - - void open(); - void close(bool allowSignals = true); - void stop(); - void migrate(); - void accept(); - void ignore(); - void reject(); - - QString errorString() const; //must return translated string - QNetworkSession::SessionError error() const; - quint64 bytesWritten() const; - quint64 bytesReceived() const; - quint64 activeTime() const; - -#ifdef SNAP_FUNCTIONALITY_AVAILABLE -public: // From MMobilityProtocolResp - void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, - TAccessPointInfo aNewAPInfo, - TBool aIsUpgrade, - TBool aIsSeamless); - - void NewCarrierActive(TAccessPointInfo aNewAPInfo, TBool aIsSeamless); - - void Error(TInt aError); -#endif - -Q_SIGNALS: - //releases any pending waitForOpened() calls - void quitPendingWaitsForOpened(); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // MConnectionMonitorObserver - void EventL(const CConnMonEventBase& aEvent); - -private: - TUint iapClientCount(TUint aIAPId) const; - quint64 transferredData(TUint dataType) const; - bool newState(QNetworkSession::State newState, TUint accessPointId = 0); - void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); - QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; - QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; - QNetworkInterface interface(TUint iapId) const; - -private: // data - // The config set on QNetworkSession - mutable QNetworkConfiguration publicConfig; - - // If publicConfig is a ServiceNetwork this is a copy of publicConfig. - // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual - // ServiceNetwork configuration. - mutable QNetworkConfiguration serviceConfig; - - // This is the actual active configuration currently in use by the session. - // Either a copy of publicConfig or one of serviceConfig.children(). - mutable QNetworkConfiguration activeConfig; - - mutable QNetworkInterface activeInterface; - - QNetworkSession::State state; - bool isOpen; - - QNetworkSession* q; - QDateTime startTime; - - RLibrary iOpenCLibrary; - TOpenCSetdefaultifFunction iDynamicSetdefaultif; - - mutable RSocketServ iSocketServ; - mutable RConnection iConnection; - mutable RConnectionMonitor iConnectionMonitor; - ConnectionProgressNotifier* ipConnectionNotifier; -#ifdef SNAP_FUNCTIONALITY_AVAILABLE - CActiveCommsMobilityApiExt* iMobility; -#endif - - QNetworkSession::SessionError iError; - TInt iALREnabled; - TBool iALRUpgradingConnection; - - QList iKnownConfigsBeforeConnectionStart; - - TUint32 iOldRoamingIap; - TUint32 iNewRoamingIap; - - friend class QNetworkSession; - friend class ConnectionProgressNotifier; -}; - -class ConnectionProgressNotifier : public CActive -{ -public: - ConnectionProgressNotifier(QNetworkSessionPrivate& owner, RConnection& connection); - ~ConnectionProgressNotifier(); - - void StartNotifications(); - void StopNotifications(); - -protected: // From CActive - void RunL(); - void DoCancel(); - -private: // Data - QNetworkSessionPrivate& iOwner; - RConnection& iConnection; - TNifProgressBuf iProgress; - -}; - -QT_END_NAMESPACE - -#endif //QNETWORKSESSIONPRIVATE_H - diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index a1a3370..02772cb 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -97,6 +97,8 @@ public: virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; + virtual QNetworkSessionPrivate *createSessionBackend() = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 0015041..d039731 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -4,8 +4,11 @@ include(../../qpluginbase.pri) QT += network HEADERS += qgenericengine.h \ + ../qnetworksession_impl.h \ ../platformdefs_win.h -SOURCES += qgenericengine.cpp main.cpp +SOURCES += qgenericengine.cpp \ + ../qnetworksession_impl.cpp \ + main.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index d50aa75..e9770e1 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qgenericengine.h" +#include "../qnetworksession_impl.h" #include @@ -142,8 +143,6 @@ static QString qGetInterfaceType(const QString &interface) QGenericEngine::QGenericEngine(QObject *parent) : QNetworkSessionEngine(parent) { - qDebug() << Q_FUNC_INFO; - connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); doRequestUpdate(); @@ -321,5 +320,10 @@ QNetworkConfigurationManager::Capabilities QGenericEngine::capabilities() const return QNetworkConfigurationManager::ForcedRoaming; } +QNetworkSessionPrivate *QGenericEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 730301b..04b845e 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -50,6 +50,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; +class QNetworkSessionPrivate; class QGenericEngine : public QNetworkSessionEngine { @@ -73,6 +74,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void doRequestUpdate(); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp new file mode 100644 index 0000000..49a2d72 --- /dev/null +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -0,0 +1,485 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnetworksession_impl.h" + +#include +#include +#include + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +static QNetworkSessionEngine *getEngineFromId(const QString &id) +{ + QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); + + foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { + if (engine->hasIdentifier(id)) + return engine; + } + + return 0; +} + +class QNetworkSessionManagerPrivate : public QObject +{ + Q_OBJECT + +public: + QNetworkSessionManagerPrivate(QObject *parent = 0); + ~QNetworkSessionManagerPrivate(); + + void forceSessionClose(const QNetworkConfiguration &config); + +Q_SIGNALS: + void forcedSessionClose(const QNetworkConfiguration &config); +}; + +#include "qnetworksession_p.moc" + +Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); + +QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) +: QObject(parent) +{ +} + +QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() +{ +} + +void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) +{ + emit forcedSessionClose(config); +} + +void QNetworkSessionPrivateImpl::syncStateWithInterface() +{ + connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); + connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), + this, SLOT(forcedSessionClose(QNetworkConfiguration))); + + opened = false; + isOpen = false; + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + + qRegisterMetaType + ("QNetworkSessionEngine::ConnectionError"); + + switch (publicConfig.type()) { + case QNetworkConfiguration::InternetAccessPoint: + activeConfig = publicConfig; + engine = getEngineFromId(activeConfig.identifier()); + if (engine) { + connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + Qt::QueuedConnection); + } + break; + case QNetworkConfiguration::ServiceNetwork: + serviceConfig = publicConfig; + // Defer setting engine and signals until open(). + // fall through + case QNetworkConfiguration::UserChoice: + // Defer setting serviceConfig and activeConfig until open(). + // fall through + default: + engine = 0; + } + + networkConfigurationsChanged(); +} + +void QNetworkSessionPrivateImpl::open() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (!isOpen) { + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + lastError =QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(lastError); + return; + } + opened = true; + + if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active && + (activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Connecting; + emit stateChanged(state); + + engine->connectToId(activeConfig.identifier()); + } + + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) + emit quitPendingWaitsForOpened(); + } +} + +void QNetworkSessionPrivateImpl::close() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (isOpen) { + opened = false; + isOpen = false; + emit closed(); + } +} + +void QNetworkSessionPrivateImpl::stop() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else { + if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Closing; + emit stateChanged(state); + + engine->disconnectFromId(activeConfig.identifier()); + + sessionManager()->forceSessionClose(activeConfig); + } + + opened = false; + isOpen = false; + emit closed(); + } +} + +void QNetworkSessionPrivateImpl::migrate() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivateImpl::accept() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivateImpl::ignore() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +void QNetworkSessionPrivateImpl::reject() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + +QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const +{ + if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) + return QNetworkInterface(); + + QString interface = engine->getInterfaceFromId(activeConfig.identifier()); + + if (interface.isEmpty()) + return QNetworkInterface(); + return QNetworkInterface::interfaceFromName(interface); +} + +QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& /*key*/) const +{ + return QVariant(); +} + +void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) +{ +} + +/*QString QNetworkSessionPrivateImpl::bearerName() const +{ + if (!publicConfig.isValid() || !engine) + return QString(); + + return engine->bearerName(activeConfig.identifier()); +}*/ + +QString QNetworkSessionPrivateImpl::errorString() const +{ + switch (lastError) { + case QNetworkSession::UnknownSessionError: + return tr("Unknown session error."); + case QNetworkSession::SessionAbortedError: + return tr("The session was aborted by the user or system."); + case QNetworkSession::OperationNotSupportedError: + return tr("The requested operation is not supported by the system."); + case QNetworkSession::InvalidConfigurationError: + return tr("The specified configuration cannot be used."); + case QNetworkSession::RoamingError: + return tr("Roaming was aborted or is not possible."); + + } + + return QString(); +} + +QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const +{ + return lastError; +} + +quint64 QNetworkSessionPrivateImpl::bytesWritten() const +{ +#if defined(BACKEND_NM) && 0 + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &config, publicConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); + } + } + } else { + return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); + } + } +#endif + return tx_data; +} + +quint64 QNetworkSessionPrivateImpl::bytesReceived() const +{ +#if defined(BACKEND_NM) && 0 + if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + foreach (const QNetworkConfiguration &config, publicConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); + } + } + } else { + return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); + } + } +#endif + return rx_data; +} + +quint64 QNetworkSessionPrivateImpl::activeTime() const +{ +#if defined(BACKEND_NM) + if (startTime.isNull()) { + return 0; + } + if(state == QNetworkSession::Connected ) + return startTime.secsTo(QDateTime::currentDateTime()); +#endif + return m_activeTime; +} + +void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() +{ + QNetworkSession::State oldState = state; + + foreach (const QNetworkConfiguration &config, serviceConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) + continue; + + if (activeConfig != config) { + if (engine) { + disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); + } + + activeConfig = config; + engine = getEngineFromId(activeConfig.identifier()); + if (engine) { + connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + Qt::QueuedConnection); + } + emit newConfigurationActivated(); + } + + state = QNetworkSession::Connected; + qDebug() << oldState << "->" << state; + if (state != oldState) + emit stateChanged(state); + + return; + } + + if (serviceConfig.children().isEmpty()) + state = QNetworkSession::NotAvailable; + else + state = QNetworkSession::Disconnected; + + qDebug() << oldState << "->" << state; + if (state != oldState) + emit stateChanged(state); +} + +void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() +{ + if (!engine) + return; + + QNetworkSession::State oldState = state; + + state = engine->sessionStateForId(activeConfig.identifier()); + + bool oldActive = isOpen; + isOpen = (state == QNetworkSession::Connected) ? opened : false; + + if (!oldActive && isOpen) + emit quitPendingWaitsForOpened(); + if (oldActive && !isOpen) + emit closed(); + + if (oldState != state) + emit stateChanged(state); +} + +void QNetworkSessionPrivateImpl::networkConfigurationsChanged() +{ + if (serviceConfig.isValid()) + updateStateFromServiceNetwork(); + else + updateStateFromActiveConfig(); +#if defined(BACKEND_NM) && 0 + setActiveTimeStamp(); +#endif +} + +void QNetworkSessionPrivateImpl::configurationChanged(const QNetworkConfiguration &config) +{ + if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig)) + updateStateFromServiceNetwork(); + else if (config == activeConfig) + updateStateFromActiveConfig(); +} + +void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration &config) +{ + if (activeConfig == config) { + opened = false; + isOpen = false; + + emit closed(); + + lastError = QNetworkSession::SessionAbortedError; + emit QNetworkSessionPrivate::error(lastError); + } +} + +void QNetworkSessionPrivateImpl::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) +{ + if (activeConfig.identifier() == id) { + networkConfigurationsChanged(); + switch (error) { + case QNetworkSessionEngine::OperationNotSupported: + lastError = QNetworkSession::OperationNotSupportedError; + opened = false; + break; + case QNetworkSessionEngine::InterfaceLookupError: + case QNetworkSessionEngine::ConnectError: + case QNetworkSessionEngine::DisconnectionError: + default: + lastError = QNetworkSession::UnknownSessionError; + } + + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(lastError); + } +} + +#if defined(BACKEND_NM) && 0 +void QNetworkSessionPrivateImpl::setActiveTimeStamp() +{ + if(NetworkManagerAvailable()) { + startTime = QDateTime(); + return; + } + QString connectionIdent = q->configuration().identifier(); + QString interface = currentInterface().hardwareAddress().toLower(); + QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); + + QString path; + QString serviceName; + QNetworkManagerInterface * ifaceD; + ifaceD = new QNetworkManagerInterface(); + + QList connections = ifaceD->activeConnections(); + foreach(QDBusObjectPath conpath, connections) { + QNetworkManagerConnectionActive *conDetails; + conDetails = new QNetworkManagerConnectionActive(conpath.path()); + QDBusObjectPath connection = conDetails->connection(); + serviceName = conDetails->serviceName(); + QList so = conDetails->devices(); + foreach(QDBusObjectPath device, so) { + + if(device.path() == devicePath) { + path = connection.path(); + } + break; + } + } +if(serviceName.isEmpty()) + return; + QNetworkManagerSettings *settingsiface; + settingsiface = new QNetworkManagerSettings(serviceName); + QList list = settingsiface->listConnections(); + foreach(QDBusObjectPath path, list) { + QNetworkManagerSettingsConnection *sysIface; + sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); + startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); + // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + } + if(startTime.isNull()) + startTime = QDateTime::currentDateTime(); +} +#endif + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h new file mode 100644 index 0000000..104d1f0 --- /dev/null +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** 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 plugins 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 QNETWORKSESSION_IMPL_H +#define QNETWORKSESSION_IMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkSessionEngine; + +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate +{ + Q_OBJECT +public: + QNetworkSessionPrivateImpl() : + tx_data(0), rx_data(0), m_activeTime(0) + { + } + + ~QNetworkSessionPrivateImpl() + { + } + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + void open(); + void close(); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +private Q_SLOTS: + void networkConfigurationsChanged(); + void configurationChanged(const QNetworkConfiguration &config); + void forcedSessionClose(const QNetworkConfiguration &config); + void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); + +private: + QNetworkConfigurationManager manager; + + quint64 tx_data; + quint64 rx_data; + quint64 m_activeTime; + + bool opened; + + QNetworkSessionEngine *engine; + + QNetworkSession::SessionError lastError; + +#if defined(BACKEND_NM) + QDateTime startTime; + void setActiveTimeStamp(); +#endif +}; + +QT_END_NAMESPACE + +#endif //QNETWORKSESSION_IMPL_H + diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 8865f4d..22d654a 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -72,8 +72,6 @@ QStringList QSymbianEnginePlugin::keys() const QBearerEngine *QSymbianEnginePlugin::create(const QString &key) const { - qDebug() << Q_FUNC_INFO; - if (key == QLatin1String("symbian")) return new SymbianEngine; else diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp new file mode 100644 index 0000000..24948cf --- /dev/null +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -0,0 +1,1125 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnetworksession_impl.h" +#include "symbianengine.h" + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) + : CActive(CActive::EPriorityStandard), engine(engine), ipConnectionNotifier(0), + iError(QNetworkSession::UnknownSessionError), + iALREnabled(0) +{ + CActiveScheduler::Add(this); + + // Try to load "Open C" dll dynamically and + // try to attach to setdefaultif function dynamically. + if (iOpenCLibrary.Load(_L("libc")) == KErrNone) { + iDynamicSetdefaultif = (TOpenCSetdefaultifFunction)iOpenCLibrary.Lookup(564); + } + + TRAP_IGNORE(iConnectionMonitor.ConnectL()); +} + +QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl() +{ + isOpen = false; + + // Cancel Connection Progress Notifications first. + // Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start() + // => deleting ipConnectionNotifier results RConnection::CancelProgressNotification() + delete ipConnectionNotifier; + ipConnectionNotifier = NULL; + + // Cancel possible RConnection::Start() + Cancel(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iMobility) { + delete iMobility; + iMobility = NULL; + } +#endif + + iConnection.Close(); + iSocketServ.Close(); + if (iDynamicSetdefaultif) { + iDynamicSetdefaultif(0); + } + + iConnectionMonitor.CancelNotifications(); + iConnectionMonitor.Close(); + + iOpenCLibrary.Close(); +} + +void QNetworkSessionPrivateImpl::syncStateWithInterface() +{ + if (!privateConfiguration(publicConfig)) + return; + + // Start monitoring changes in IAP states + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + + // Check open connections to see if there is already + // an open connection to selected IAP or SNAP + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return; + } + + TUint numSubConnections; + TUint connectionId; + for (TUint i = 1; i <= count; i++) { + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + TInt connectionStatus; + iConnectionMonitor.GetIntAttribute(connectionId, 0, KConnectionStatus, connectionStatus, status); + User::WaitForRequest(status); + if (connectionStatus == KLinkLayerOpen) { + if (state != QNetworkSession::Closing) { + if (newState(QNetworkSession::Connected, apId)) { + return; + } + } + } + } + } + } + + if (state != QNetworkSession::Connected) { + // There were no open connections to used IAP or SNAP + if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::NotAvailable); + } + } +} + +QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const +{ + QString interfaceName; + + TSoInetInterfaceInfo ifinfo; + TPckg ifinfopkg(ifinfo); + TSoInetIfQuery ifquery; + TPckg ifquerypkg(ifquery); + + // Open dummy socket for interface queries + RSocket socket; + TInt retVal = socket.Open(iSocketServ, _L("udp")); + if (retVal != KErrNone) { + return QNetworkInterface(); + } + + // Start enumerating interfaces + socket.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl); + while(socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, ifinfopkg) == KErrNone) { + ifquery.iName = ifinfo.iName; + TInt err = socket.GetOpt(KSoInetIfQueryByName, KSolInetIfQuery, ifquerypkg); + if(err == KErrNone && ifquery.iZone[1] == iapId) { // IAP ID is index 1 of iZone + if(ifinfo.iAddress.Address() > 0) { + interfaceName = QString::fromUtf16(ifinfo.iName.Ptr(),ifinfo.iName.Length()); + break; + } + } + } + + socket.Close(); + + if (interfaceName.isEmpty()) { + return QNetworkInterface(); + } + + return QNetworkInterface::interfaceFromName(interfaceName); +} + +QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const +{ + if (!publicConfig.isValid() || state != QNetworkSession::Connected) { + return QNetworkInterface(); + } + + return activeInterface; +} + +QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& /*key*/) const +{ + return QVariant(); +} + +void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/) +{ +} + +QString QNetworkSessionPrivateImpl::errorString() const +{ + switch (iError) { + case QNetworkSession::UnknownSessionError: + return tr("Unknown session error."); + case QNetworkSession::SessionAbortedError: + return tr("The session was aborted by the user or system."); + case QNetworkSession::OperationNotSupportedError: + return tr("The requested operation is not supported by the system."); + case QNetworkSession::InvalidConfigurationError: + return tr("The specified configuration cannot be used."); + case QNetworkSession::RoamingError: + return tr("Roaming was aborted or is not possible."); + } + + return QString(); +} + +QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const +{ + return iError; +} + +void QNetworkSessionPrivateImpl::open() +{ + if (isOpen || !privateConfiguration(publicConfig) || (state == QNetworkSession::Connecting)) { + return; + } + + // Cancel notifications from RConnectionMonitor + // => RConnection::ProgressNotification will be used for IAP/SNAP monitoring + iConnectionMonitor.CancelNotifications(); + + TInt error = iSocketServ.Connect(); + if (error != KErrNone) { + // Could not open RSocketServ + newState(QNetworkSession::Invalid); + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + syncStateWithInterface(); + return; + } + + error = iConnection.Open(iSocketServ); + if (error != KErrNone) { + // Could not open RConnection + iSocketServ.Close(); + newState(QNetworkSession::Invalid); + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + syncStateWithInterface(); + return; + } + + // Use RConnection::ProgressNotification for IAP/SNAP monitoring + // (<=> ConnectionProgressNotifier uses RConnection::ProgressNotification) + if (!ipConnectionNotifier) { + ipConnectionNotifier = new ConnectionProgressNotifier(*this,iConnection); + } + if (ipConnectionNotifier) { + ipConnectionNotifier->StartNotifications(); + } + + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + // Search through existing connections. + // If there is already connection which matches to given IAP + // try to attach to existing connection. + TBool connected(EFalse); + TConnectionInfoBuf connInfo; + TUint count; + if (iConnection.EnumerateConnections(count) == KErrNone) { + for (TUint i=1; i<=count; i++) { + // Note: GetConnectionInfo expects 1-based index. + if (iConnection.GetConnectionInfo(i, connInfo) == KErrNone) { + if (connInfo().iIapId == toSymbianConfig(privateConfiguration(publicConfig))->numericId) { + if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { + activeConfig = publicConfig; + activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); + connected = ETrue; + startTime = QDateTime::currentDateTime(); + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = publicConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + error = iDynamicSetdefaultif(&ifr); + } + isOpen = true; + // Make sure that state will be Connected + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + break; + } + } + } + } + } + if (!connected) { + TCommDbConnPref pref; + pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); + pref.SetIapId(toSymbianConfig(privateConfiguration(publicConfig))->numericId); + iConnection.Start(pref, iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + TConnSnapPref snapPref(toSymbianConfig(privateConfiguration(publicConfig))->numericId); + iConnection.Start(snapPref, iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + iKnownConfigsBeforeConnectionStart = engine->accessPointConfigurations.keys(); + iConnection.Start(iStatus); + if (!IsActive()) { + SetActive(); + } + newState(QNetworkSession::Connecting); + } + + if (error != KErrNone) { + isOpen = false; + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + } +} + +TUint QNetworkSessionPrivateImpl::iapClientCount(TUint aIAPId) const +{ + TRequestStatus status; + TUint connectionCount; + iConnectionMonitor.GetConnectionCount(connectionCount, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + for (TUint i = 1; i <= connectionCount; i++) { + TUint connectionId; + TUint subConnectionCount; + iConnectionMonitor.GetConnectionInfo(i, connectionId, subConnectionCount); + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, subConnectionCount, KIAPId, apId, status); + User::WaitForRequest(status); + if (apId == aIAPId) { + TConnMonClientEnumBuf buf; + iConnectionMonitor.GetPckgAttribute(connectionId, 0, KClientInfo, buf, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + return buf().iCount; + } + } + } + } + return 0; +} + +void QNetworkSessionPrivateImpl::close(bool allowSignals) +{ + if (!isOpen) { + return; + } + + TUint activeIap = toSymbianConfig(privateConfiguration(activeConfig))->numericId; + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + + Cancel(); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iMobility) { + delete iMobility; + iMobility = NULL; + } +#endif + + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + + iConnection.Close(); + iSocketServ.Close(); + if (iDynamicSetdefaultif) { + iDynamicSetdefaultif(0); + } + +#ifdef Q_CC_NOKIAX86 + if ((allowSignals && iapClientCount(activeIap) <= 0) || +#else + if ((allowSignals && iapClientCount(activeIap) <= 1) || +#endif + (publicConfig.type() == QNetworkConfiguration::UserChoice)) { + newState(QNetworkSession::Closing); + } + + syncStateWithInterface(); + if (allowSignals) { + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + newState(QNetworkSession::Disconnected); + } + emit closed(); + } +} + +void QNetworkSessionPrivateImpl::stop() +{ + if (!isOpen) { + return; + } + isOpen = false; + newState(QNetworkSession::Closing); + iConnection.Stop(RConnection::EStopAuthoritative); + isOpen = true; + close(false); + emit closed(); +} + +void QNetworkSessionPrivateImpl::migrate() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->MigrateToPreferredCarrier(); +#endif +} + +void QNetworkSessionPrivateImpl::ignore() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->IgnorePreferredCarrier(); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected,iOldRoamingIap); + } +#endif +} + +void QNetworkSessionPrivateImpl::accept() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->NewCarrierAccepted(); + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = activeConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + iDynamicSetdefaultif(&ifr); + } + newState(QNetworkSession::Connected, iNewRoamingIap); +#endif +} + +void QNetworkSessionPrivateImpl::reject() +{ +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + iMobility->NewCarrierRejected(); + if (!iALRUpgradingConnection) { + newState(QNetworkSession::Disconnected); + } else { + newState(QNetworkSession::Connected, iOldRoamingIap); + } +#endif +} + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless) +{ + iOldRoamingIap = aOldAPInfo.AccessPoint(); + iNewRoamingIap = aNewAPInfo.AccessPoint(); + newState(QNetworkSession::Roaming); + if (iALREnabled > 0) { + iALRUpgradingConnection = aIsUpgrade; + QList configs = publicConfig.children(); + for (int i=0; i < configs.count(); i++) { + if (toSymbianConfig(privateConfiguration(configs[i]))->numericId == aNewAPInfo.AccessPoint()) { + emit preferredConfigurationChanged(configs[i], aIsSeamless); + } + } + } else { + migrate(); + } +} + +void QNetworkSessionPrivateImpl::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, TBool /*aIsSeamless*/) +{ + if (iALREnabled > 0) { + emit newConfigurationActivated(); + } else { + accept(); + } +} + +void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) +{ + if (isOpen) { + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::RoamingError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + // In some cases IAP is still in Connected state when + // syncStateWithInterface(); is called + // => Following call makes sure that Session state + // changes immediately to Disconnected. + newState(QNetworkSession::Disconnected); + emit closed(); + } +} +#endif + +void QNetworkSessionPrivateImpl::setALREnabled(bool enabled) +{ + if (enabled) { + iALREnabled++; + } else { + iALREnabled--; + } +} + +QNetworkConfiguration QNetworkSessionPrivateImpl::bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const +{ + QNetworkConfiguration config; + QList subConfigurations = snapConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (subConfigurations[i].state() == QNetworkConfiguration::Active) { + config = subConfigurations[i]; + break; + } else if (!config.isValid() && subConfigurations[i].state() == QNetworkConfiguration::Discovered) { + config = subConfigurations[i]; + } + } + if (!config.isValid() && subConfigurations.count() > 0) { + config = subConfigurations[0]; + } + return config; +} + +quint64 QNetworkSessionPrivateImpl::bytesWritten() const +{ + return transferredData(KUplinkData); +} + +quint64 QNetworkSessionPrivateImpl::bytesReceived() const +{ + return transferredData(KDownlinkData); +} + +quint64 QNetworkSessionPrivateImpl::transferredData(TUint dataType) const +{ + if (!publicConfig.isValid()) { + return 0; + } + + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (serviceConfig.isValid()) { + config = serviceConfig; + } else { + if (activeConfig.isValid()) { + config = activeConfig; + } + } + } else { + config = publicConfig; + } + + if (!config.isValid()) { + return 0; + } + + TUint count; + TRequestStatus status; + iConnectionMonitor.GetConnectionCount(count, status); + User::WaitForRequest(status); + if (status.Int() != KErrNone) { + return 0; + } + + TUint transferredData = 0; + TUint numSubConnections; + TUint connectionId; + bool configFound; + for (TUint i = 1; i <= count; i++) { + TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections); + if (ret == KErrNone) { + TUint apId; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + configFound = false; + if (config.type() == QNetworkConfiguration::ServiceNetwork) { + QList configs = config.children(); + for (int i=0; i < configs.count(); i++) { + if (toSymbianConfig(privateConfiguration(configs[i]))->numericId == apId) { + configFound = true; + break; + } + } + } else if (toSymbianConfig(privateConfiguration(config))->numericId == apId) { + configFound = true; + } + if (configFound) { + TUint tData; + iConnectionMonitor.GetUintAttribute(connectionId, 0, dataType, tData, status ); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + transferredData += tData; + } + } + } + } + } + + return transferredData; +} + +quint64 QNetworkSessionPrivateImpl::activeTime() const +{ + if (!isOpen || startTime.isNull()) { + return 0; + } + return startTime.secsTo(QDateTime::currentDateTime()); +} + +QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 iapId) const +{ + if (iapId == 0) { + _LIT(KSetting, "IAP\\Id"); + iConnection.GetIntSetting(KSetting, iapId); + } + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + // Try to search IAP from the used SNAP using IAP Id + QList children = publicConfig.children(); + for (int i=0; i < children.count(); i++) { + if (toSymbianConfig(privateConfiguration(children[i]))->numericId == iapId) { + return children[i]; + } + } + + // Given IAP Id was not found from the used SNAP + // => Try to search matching IAP using mappingName + // mappingName contains: + // 1. "Access point name" for "Packet data" Bearer + // 2. "WLAN network name" (= SSID) for "Wireless LAN" Bearer + // 3. "Dial-up number" for "Data call Bearer" or "High Speed (GSM)" Bearer + // <=> Note: It's possible that in this case reported IAP is + // clone of the one of the IAPs of the used SNAP + // => If mappingName matches, clone has been found + QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId))); + if (privateConfiguration(pt)) { + for (int i=0; i < children.count(); i++) { + if (toSymbianConfig(privateConfiguration(children[i]))->mappingName == toSymbianConfig(privateConfiguration(pt))->mappingName) { + return children[i]; + } + } + } else { + // Given IAP Id was not found from known IAPs array + return QNetworkConfiguration(); + } + + // Matching IAP was not found from used SNAP + // => IAP from another SNAP is returned + // (Note: Returned IAP matches to given IAP Id) + return pt; + } +#endif + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (engine) { + QNetworkConfiguration pt = QNetworkConfigurationManager().configurationFromIdentifier(QString::number(qHash(iapId))); + // Try to found User Selected IAP from known IAPs (accessPointConfigurations) + if (pt.isValid()) { + return pt; + } else { + // Check if new (WLAN) IAP was created in IAP/SNAP dialog + // 1. Sync internal configurations array to commsdb first + engine->updateConfigurations(); + // 2. Check if new configuration was created during connection creation + QList knownConfigs = engine->accessPointConfigurations.keys(); + if (knownConfigs.count() > iKnownConfigsBeforeConnectionStart.count()) { + // Configuration count increased => new configuration was created + // => Search new, created configuration + QString newIapId; + for (int i=0; i < iKnownConfigsBeforeConnectionStart.count(); i++) { + if (knownConfigs[i] != iKnownConfigsBeforeConnectionStart[i]) { + newIapId = knownConfigs[i]; + break; + } + } + if (newIapId.isEmpty()) { + newIapId = knownConfigs[knownConfigs.count()-1]; + } + pt = QNetworkConfigurationManager().configurationFromIdentifier(newIapId); + if (pt.isValid()) + return pt; + } + } + } + return QNetworkConfiguration(); + } + + return publicConfig; +} + +void QNetworkSessionPrivateImpl::RunL() +{ + TInt statusCode = iStatus.Int(); + + switch (statusCode) { + case KErrNone: // Connection created succesfully + { + TInt error = KErrNone; + QNetworkConfiguration newActiveConfig = activeConfiguration(); + if (!newActiveConfig.isValid()) { + error = KErrGeneral; + } else if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = newActiveConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + error = iDynamicSetdefaultif(&ifr); + } + + if (error != KErrNone) { + isOpen = false; + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + return; + } + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + // Activate ALR monitoring + iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this); + } +#endif + isOpen = true; + activeConfig = newActiveConfig; + activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + serviceConfig = QNetworkConfigurationManager().configurationFromIdentifier(toSymbianConfig(privateConfiguration(activeConfig))->serviceNetworkPtr->id); + } + + startTime = QDateTime::currentDateTime(); + + newState(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + } + break; + case KErrNotFound: // Connection failed + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + break; + case KErrCancel: // Connection attempt cancelled + case KErrAlreadyExists: // Connection already exists + default: + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::UnknownSessionError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + syncStateWithInterface(); + break; + } +} + +void QNetworkSessionPrivateImpl::DoCancel() +{ + iConnection.Close(); +} + +bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint accessPointId) +{ + // Make sure that activeConfig is always updated when SNAP is signaled to be + // connected. + if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork && + newState == QNetworkSession::Connected) { + activeConfig = activeConfiguration(accessPointId); + activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); + } + + // Make sure that same state is not signaled twice in a row. + if (state == newState) { + return true; + } + + // Make sure that Connecting state does not overwrite Roaming state + if (state == QNetworkSession::Roaming && newState == QNetworkSession::Connecting) { + return false; + } + + bool emitSessionClosed = false; + if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) { + // Active & Connected state should change directly to Disconnected state + // only when something forces connection to close (eg. when another + // application or session stops connection or when network drops + // unexpectedly). + isOpen = false; + activeConfig = QNetworkConfiguration(); + serviceConfig = QNetworkConfiguration(); + iError = QNetworkSession::SessionAbortedError; + emit QNetworkSessionPrivate::error(iError); + Cancel(); + if (ipConnectionNotifier) { + ipConnectionNotifier->StopNotifications(); + } + // Start monitoring changes in IAP states + TRAP_IGNORE(iConnectionMonitor.NotifyEventL(*this)); + emitSessionClosed = true; // Emit SessionClosed after state change has been reported + } + + bool retVal = false; + if (accessPointId == 0) { + state = newState; + emit stateChanged(state); + retVal = true; + } else { + if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->numericId == accessPointId) { + state = newState; + emit stateChanged(state); + retVal = true; + } + } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) { + if (toSymbianConfig(privateConfiguration(activeConfig))->numericId == accessPointId) { + state = newState; + emit stateChanged(state); + retVal = true; + } + } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId == accessPointId) { + if (newState == QNetworkSession::Connected) { + // Make sure that when AccessPoint is reported to be Connected + // also state of the related configuration changes to Active. + privateConfiguration(subConfigurations[i])->state = QNetworkConfiguration::Active; + + state = newState; + emit stateChanged(state); + retVal = true; + } else { + if (newState == QNetworkSession::Disconnected) { + // Make sure that when AccessPoint is reported to be disconnected + // also state of the related configuration changes from Active to Defined. + privateConfiguration(subConfigurations[i])->state = QNetworkConfiguration::Defined; + } + QNetworkConfiguration config = bestConfigFromSNAP(publicConfig); + if ((config.state() == QNetworkConfiguration::Defined) || + (config.state() == QNetworkConfiguration::Discovered)) { + state = newState; + emit stateChanged(state); + retVal = true; + } + } + } + } + } + } + + if (emitSessionClosed) { + emit closed(); + } + + return retVal; +} + +void QNetworkSessionPrivateImpl::handleSymbianConnectionStatusChange(TInt aConnectionStatus, + TInt aError, + TUint accessPointId) +{ + switch (aConnectionStatus) + { + // Connection unitialised + case KConnectionUninitialised: + break; + + // Starting connetion selection + case KStartingSelection: + break; + + // Selection finished + case KFinishedSelection: + if (aError == KErrNone) + { + // The user successfully selected an IAP to be used + break; + } + else + { + // The user pressed e.g. "Cancel" and did not select an IAP + newState(QNetworkSession::Disconnected,accessPointId); + } + break; + + // Connection failure + case KConnectionFailure: + newState(QNetworkSession::NotAvailable); + break; + + // Prepearing connection (e.g. dialing) + case KPsdStartingConfiguration: + case KPsdFinishedConfiguration: + case KCsdFinishedDialling: + case KCsdScanningScript: + case KCsdGettingLoginInfo: + case KCsdGotLoginInfo: + break; + + // Creating connection (e.g. GPRS activation) + case KCsdStartingConnect: + case KCsdFinishedConnect: + newState(QNetworkSession::Connecting,accessPointId); + break; + + // Starting log in + case KCsdStartingLogIn: + break; + + // Finished login + case KCsdFinishedLogIn: + break; + + // Connection open + case KConnectionOpen: + break; + + case KLinkLayerOpen: + newState(QNetworkSession::Connected,accessPointId); + break; + + // Connection blocked or suspended + case KDataTransferTemporarilyBlocked: + break; + + // Hangup or GRPS deactivation + case KConnectionStartingClose: + newState(QNetworkSession::Closing,accessPointId); + break; + + // Connection closed + case KConnectionClosed: + break; + + case KLinkLayerClosed: + newState(QNetworkSession::Disconnected,accessPointId); + break; + + // Unhandled state + default: + break; + } +} + +void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent) +{ + switch (aEvent.EventType()) + { + case EConnMonConnectionStatusChange: + { + CConnMonConnectionStatusChange* realEvent; + realEvent = (CConnMonConnectionStatusChange*) &aEvent; + + TUint connectionId = realEvent->ConnectionId(); + TInt connectionStatus = realEvent->ConnectionStatus(); + + // Try to Find IAP Id using connection Id + TUint apId = 0; + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId == connectionId) { + apId = toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->connectionId == connectionId) { + apId = toSymbianConfig(privateConfiguration(publicConfig))->numericId; + } + } + + if (apId > 0) { + handleSymbianConnectionStatusChange(connectionStatus, KErrNone, apId); + } + } + break; + + case EConnMonCreateConnection: + { + CConnMonCreateConnection* realEvent; + realEvent = (CConnMonCreateConnection*) &aEvent; + TUint apId; + TUint connectionId = realEvent->ConnectionId(); + TRequestStatus status; + iConnectionMonitor.GetUintAttribute(connectionId, 0, KIAPId, apId, status); + User::WaitForRequest(status); + if (status.Int() == KErrNone) { + // Store connection id to related AccessPoint Configuration + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId == apId) { + toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId = connectionId; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->numericId == apId) { + toSymbianConfig(privateConfiguration(publicConfig))->connectionId = connectionId; + } + } + } + } + break; + + case EConnMonDeleteConnection: + { + CConnMonDeleteConnection* realEvent; + realEvent = (CConnMonDeleteConnection*) &aEvent; + TUint connectionId = realEvent->ConnectionId(); + // Remove connection id from related AccessPoint Configuration + if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { + QList subConfigurations = publicConfig.children(); + for (int i = 0; i < subConfigurations.count(); i++ ) { + if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId == connectionId) { + toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId = 0; + break; + } + } + } else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) { + if (toSymbianConfig(privateConfiguration(publicConfig))->connectionId == connectionId) { + toSymbianConfig(privateConfiguration(publicConfig))->connectionId = 0; + } + } + } + break; + + default: + // For unrecognized events + break; + } +} + +ConnectionProgressNotifier::ConnectionProgressNotifier(QNetworkSessionPrivateImpl &owner, RConnection &connection) + : CActive(CActive::EPriorityStandard), iOwner(owner), iConnection(connection) +{ + CActiveScheduler::Add(this); +} + +ConnectionProgressNotifier::~ConnectionProgressNotifier() +{ + Cancel(); +} + +void ConnectionProgressNotifier::StartNotifications() +{ + if (!IsActive()) { + SetActive(); + } + iConnection.ProgressNotification(iProgress, iStatus); +} + +void ConnectionProgressNotifier::StopNotifications() +{ + Cancel(); +} + +void ConnectionProgressNotifier::DoCancel() +{ + iConnection.CancelProgressNotification(); +} + +void ConnectionProgressNotifier::RunL() +{ + if (iStatus == KErrNone) { + iOwner.handleSymbianConnectionStatusChange(iProgress().iStage, iProgress().iError); + + SetActive(); + iConnection.ProgressNotification(iProgress, iStatus); + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h new file mode 100644 index 0000000..2e75d96 --- /dev/null +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** 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 plugins 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 QNETWORKSESSION_IMPL_H +#define QNETWORKSESSION_IMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +#include + +#include +#include +#include +#include +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + #include +#endif + +typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*); + +QT_BEGIN_NAMESPACE + +class ConnectionProgressNotifier; +class SymbianEngine; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MMobilityProtocolResp, + public MConnectionMonitorObserver +#else +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate, public CActive, public MConnectionMonitorObserver +#endif +{ + Q_OBJECT +public: + QNetworkSessionPrivateImpl(SymbianEngine *engine); + ~QNetworkSessionPrivateImpl(); + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + void setALREnabled(bool enabled); + + void open(); + inline void close() { close(true); } + void close(bool allowSignals); + void stop(); + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE +public: // From MMobilityProtocolResp + void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo, + TAccessPointInfo aNewAPInfo, + TBool aIsUpgrade, + TBool aIsSeamless); + + void NewCarrierActive(TAccessPointInfo aNewAPInfo, TBool aIsSeamless); + + void Error(TInt aError); +#endif + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // MConnectionMonitorObserver + void EventL(const CConnMonEventBase& aEvent); + +private: + TUint iapClientCount(TUint aIAPId) const; + quint64 transferredData(TUint dataType) const; + bool newState(QNetworkSession::State newState, TUint accessPointId = 0); + void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); + QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; + QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; + QNetworkInterface interface(TUint iapId) const; + +private: // data + SymbianEngine *engine; + + mutable QNetworkInterface activeInterface; + + QDateTime startTime; + + RLibrary iOpenCLibrary; + TOpenCSetdefaultifFunction iDynamicSetdefaultif; + + mutable RSocketServ iSocketServ; + mutable RConnection iConnection; + mutable RConnectionMonitor iConnectionMonitor; + ConnectionProgressNotifier* ipConnectionNotifier; +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + CActiveCommsMobilityApiExt* iMobility; +#endif + + QNetworkSession::SessionError iError; + TInt iALREnabled; + TBool iALRUpgradingConnection; + + QList iKnownConfigsBeforeConnectionStart; + + TUint32 iOldRoamingIap; + TUint32 iNewRoamingIap; + + friend class ConnectionProgressNotifier; +}; + +class ConnectionProgressNotifier : public CActive +{ +public: + ConnectionProgressNotifier(QNetworkSessionPrivateImpl &owner, RConnection &connection); + ~ConnectionProgressNotifier(); + + void StartNotifications(); + void StopNotifications(); + +protected: // From CActive + void RunL(); + void DoCancel(); + +private: // Data + QNetworkSessionPrivateImpl &iOwner; + RConnection& iConnection; + TNifProgressBuf iProgress; + +}; + +QT_END_NAMESPACE + +#endif //QNETWORKSESSION_IMPL_H + diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro index d3ffb37..9fd1a74 100644 --- a/src/plugins/bearer/symbian/symbian.pro +++ b/src/plugins/bearer/symbian/symbian.pro @@ -3,8 +3,12 @@ include(../../qpluginbase.pri) QT += network -HEADERS += symbianengine.h -SOURCES += symbianengine.cpp main.cpp +HEADERS += symbianengine.h \ + qnetworksession_impl.h + +SOURCES += symbianengine.cpp \ + qnetworksession_impl.cpp \ + main.cpp exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \ exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) { diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 8c31990..f5c5007 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "symbianengine.h" +#include "qnetworksession_impl.h" #include #include @@ -64,7 +65,7 @@ static const int KValueThatWillBeAddedToSNAPId = 1000; static const int KUserChoiceIAPId = 0; SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() -: bearer(BearerUnknown), numericId(0), connectionId(0), manager(0) +: bearer(BearerUnknown), numericId(0), connectionId(0) { } @@ -72,16 +73,33 @@ SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate() { } -inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) -{ - return static_cast(ptr.data()); +QString SymbianNetworkConfigurationPrivate::bearerName() const +{ + switch (bearer) { + case BearerEthernet: + return QLatin1String("Ethernet"); + case BearerWLAN: + return QLatin1String("WLAN"); + case Bearer2G: + return QLatin1String("2G"); + case BearerCDMA2000: + return QLatin1String("CDMA2000"); + case BearerWCDMA: + return QLatin1String("WCDMA"); + case BearerHSPA: + return QLatin1String("HSPA"); + case BearerBluetooth: + return QLatin1String("Bluetooth"); + case BearerWiMAX: + return QLatin1String("WiMAX"); + default: + return QString(); + } } SymbianEngine::SymbianEngine(QObject *parent) : QNetworkSessionEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) { - qDebug() << Q_FUNC_INFO; - CActiveScheduler::Add(this); TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP)); @@ -112,7 +130,6 @@ SymbianEngine::SymbianEngine(QObject *parent) cpPriv->type = QNetworkConfiguration::UserChoice; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - cpPriv->manager = this; QNetworkConfigurationPrivatePointer ptr(cpPriv); userChoiceConfigurations.insert(ptr->id, ptr); @@ -139,6 +156,34 @@ SymbianEngine::~SymbianEngine() delete ipCommsDB; } +QString SymbianEngine::getInterfaceFromId(const QString &id) +{ + qFatal("getInterfaceFromId(%s) not implemented\n", qPrintable(id)); + return QString(); +} + +bool SymbianEngine::hasIdentifier(const QString &id) +{ + return accessPointConfigurations.contains(id) || + snapConfigurations.contains(id) || + userChoiceConfigurations.contains(id); +} + +void SymbianEngine::connectToId(const QString &id) +{ + qFatal("connectToId(%s) not implemented\n", qPrintable(id)); +} + +void SymbianEngine::disconnectFromId(const QString &id) +{ + qFatal("disconnectFromId(%s) not implemented\n", qPrintable(id)); +} + +QNetworkSession::State SymbianEngine::sessionStateForId(const QString &id) +{ + qFatal("sessionStateForId(%s) not implemented\n", qPrintable(id)); + return QNetworkSession::Invalid; +} QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const { @@ -157,6 +202,11 @@ QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const return capFlags; } +QNetworkSessionPrivate *SymbianEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl(this); +} + void SymbianEngine::requestUpdate() { if (!iInitOk || iUpdateGoingOn) { @@ -239,7 +289,6 @@ void SymbianEngine::updateConfigurationsL() cpPriv->type = QNetworkConfiguration::ServiceNetwork; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - cpPriv->manager = this; QNetworkConfigurationPrivatePointer ptr(cpPriv); snapConfigurations.insert(ident, ptr); @@ -428,7 +477,6 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( cpPriv->type = QNetworkConfiguration::InternetAccessPoint; cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; cpPriv->roamingSupported = false; - cpPriv->manager = this; CleanupStack::Pop(cpPriv); return cpPriv; @@ -498,7 +546,6 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; break; } - apNetworkConfiguration->manager = this; CleanupStack::PopAndDestroy(pApUtils); CleanupStack::PopAndDestroy(pAPItem); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 0ca30da..cd5aa43 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -80,18 +80,23 @@ public: SymbianNetworkConfigurationPrivate(); ~SymbianNetworkConfigurationPrivate(); + QString bearerName() const; + Bearer bearer; TUint32 numericId; TUint connectionId; - TAny *manager; - QNetworkConfigurationPrivatePointer serviceNetworkPtr; QString mappingName; }; +inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) +{ + return static_cast(ptr.data()); +} + class SymbianEngine : public QNetworkSessionEngine, public CActive, public MConnectionMonitorObserver { @@ -101,18 +106,20 @@ public: SymbianEngine(QObject *parent = 0); virtual ~SymbianEngine(); - QString getInterfaceFromId(const QString &id) { return QString(); } - bool hasIdentifier(const QString &id) { return false; } + QString getInterfaceFromId(const QString &id); + bool hasIdentifier(const QString &id); - void connectToId(const QString &id) { } - void disconnectFromId(const QString &id) { } + void connectToId(const QString &id); + void disconnectFromId(const QString &id); void requestUpdate(); - QNetworkSession::State sessionStateForId(const QString &id) { return QNetworkSession::Invalid; } + QNetworkSession::State sessionStateForId(const QString &id); QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); Q_SIGNALS: diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index 061108a..d3923e9 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -82,7 +82,7 @@ private slots: private: QNetworkConfigurationManager manager; - uint inProcessSessionManagementCount; + int inProcessSessionManagementCount; #ifdef Q_WS_MAEMO_6 Maemo::IAPConf *iapconf; @@ -249,6 +249,9 @@ void tst_QNetworkSession::sessionProperties() if (!configuration.isValid()) { QVERIFY(configuration.bearerName().isEmpty()); } else { + qDebug() << "Type:" << configuration.type() + << "Bearer:" << configuration.bearerName(); + switch (configuration.type()) { case QNetworkConfiguration::ServiceNetwork: @@ -264,6 +267,8 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. + qDebug() << "Session state:" << session.state(); + qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); if (!configuration.isValid()) { @@ -790,6 +795,8 @@ QDebug operator<<(QDebug debug, const QList &list) void tst_QNetworkSession::outOfProcessSession() { + qDebug() << "START"; + QNetworkConfigurationManager manager; QList before = manager.allConfigurations(QNetworkConfiguration::Active); @@ -805,13 +812,16 @@ void tst_QNetworkSession::outOfProcessSession() QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); + qDebug() << "starting lackey"; QProcess lackey; lackey.start("qnetworksessionlackey"); + qDebug() << lackey.error() << lackey.errorString(); QVERIFY(lackey.waitForStarted()); + qDebug() << "waiting for connection"; QVERIFY(oopServer.waitForNewConnection(-1)); QLocalSocket *oopSocket = oopServer.nextPendingConnection(); - + qDebug() << "got connection"; do { QByteArray output; @@ -875,12 +885,12 @@ void tst_QNetworkSession::outOfProcessSession() break; case 1: QSKIP("No discovered configurations found.", SkipAll); - break; case 2: QSKIP("Lackey could not start session.", SkipAll); default: QSKIP("Lackey failed", SkipAll); } + qDebug("STOP"); } QTEST_MAIN(tst_QNetworkSession) -- cgit v0.12 From 35c7808149558d9798d158605fbd835ea167ca53 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 15:20:33 +1000 Subject: Make compile on Unix. --- src/network/bearer/qnetworksession_p.h | 2 +- .../bearer/networkmanager/qnetworkmanagerengine.cpp | 18 ++++++++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ src/plugins/bearer/qnetworksession_impl.cpp | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 6395250..a6bb7cb 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -90,7 +90,7 @@ public: virtual void close() = 0; virtual void stop() = 0; - virtual void setALREnabled(bool enabled) { } + virtual void setALREnabled(bool /*enabled*/) { } virtual void migrate() = 0; virtual void accept() = 0; virtual void ignore() = 0; diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index e1fcd46..9064005 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -41,6 +41,7 @@ #include "qnetworkmanagerengine.h" #include "qnetworkmanagerservice.h" +#include "../qnetworksession_impl.h" #include @@ -238,6 +239,8 @@ void QNetworkManagerEngine::requestUpdate() void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(path) + QMapIterator i(properties); while (i.hasNext()) { i.next(); @@ -302,6 +305,8 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(properties) + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); if (!activeConnection) @@ -396,6 +401,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, void QNetworkManagerEngine::removeConnection(const QString &path) { + Q_UNUSED(path) + QNetworkManagerSettingsConnection *connection = qobject_cast(sender()); if (!connection) @@ -473,6 +480,8 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + QNetworkManagerInterfaceAccessPoint *accessPoint = new QNetworkManagerInterfaceAccessPoint(objectPath.path()); accessPoints.append(accessPoint); @@ -524,6 +533,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec void QNetworkManagerEngine::removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + for (int i = 0; i < accessPoints.count(); ++i) { QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); @@ -546,6 +557,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, void QNetworkManagerEngine::updateAccessPoint(const QMap &map) { + Q_UNUSED(map) + QNetworkManagerInterfaceAccessPoint *accessPoint = qobject_cast(sender()); if (!accessPoint) @@ -673,5 +686,10 @@ QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() QNetworkConfigurationManager::CanStartAndStopInterfaces; } +QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 3752dce..11255fc 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -84,6 +84,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 49a2d72..a826fd6 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -79,7 +79,7 @@ Q_SIGNALS: void forcedSessionClose(const QNetworkConfiguration &config); }; -#include "qnetworksession_p.moc" +#include "qnetworksession_impl.moc" Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); -- cgit v0.12 From a30021ded7501bb122c8f3c37cc9ced96e00e7d2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 15:20:33 +1000 Subject: Make compile on Unix. --- src/network/bearer/qnetworksession_p.h | 2 +- src/plugins/bearer/networkmanager/networkmanager.pro | 6 ++++-- .../bearer/networkmanager/qnetworkmanagerengine.cpp | 18 ++++++++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ src/plugins/bearer/qnetworksession_impl.cpp | 2 +- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 6395250..a6bb7cb 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -90,7 +90,7 @@ public: virtual void close() = 0; virtual void stop() = 0; - virtual void setALREnabled(bool enabled) { } + virtual void setALREnabled(bool /*enabled*/) { } virtual void migrate() = 0; virtual void accept() = 0; virtual void ignore() = 0; diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 57f7ca7..2050125 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -7,12 +7,14 @@ DEFINES += BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ - qnetworkmanagerengine.h + qnetworkmanagerengine.h \ + ../qnetworksession_impl.h SOURCES += main.cpp \ qnmdbushelper.cpp \ qnetworkmanagerservice.cpp \ - qnetworkmanagerengine.cpp + qnetworkmanagerengine.cpp \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index e1fcd46..9064005 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -41,6 +41,7 @@ #include "qnetworkmanagerengine.h" #include "qnetworkmanagerservice.h" +#include "../qnetworksession_impl.h" #include @@ -238,6 +239,8 @@ void QNetworkManagerEngine::requestUpdate() void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(path) + QMapIterator i(properties); while (i.hasNext()) { i.next(); @@ -302,6 +305,8 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path, const QMap &properties) { + Q_UNUSED(properties) + QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path); if (!activeConnection) @@ -396,6 +401,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path, void QNetworkManagerEngine::removeConnection(const QString &path) { + Q_UNUSED(path) + QNetworkManagerSettingsConnection *connection = qobject_cast(sender()); if (!connection) @@ -473,6 +480,8 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + QNetworkManagerInterfaceAccessPoint *accessPoint = new QNetworkManagerInterfaceAccessPoint(objectPath.path()); accessPoints.append(accessPoint); @@ -524,6 +533,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec void QNetworkManagerEngine::removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath) { + Q_UNUSED(path) + for (int i = 0; i < accessPoints.count(); ++i) { QNetworkManagerInterfaceAccessPoint *accessPoint = accessPoints.at(i); @@ -546,6 +557,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, void QNetworkManagerEngine::updateAccessPoint(const QMap &map) { + Q_UNUSED(map) + QNetworkManagerInterfaceAccessPoint *accessPoint = qobject_cast(sender()); if (!accessPoint) @@ -673,5 +686,10 @@ QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() QNetworkConfigurationManager::CanStartAndStopInterfaces; } +QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 3752dce..11255fc 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -84,6 +84,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 49a2d72..a826fd6 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -79,7 +79,7 @@ Q_SIGNALS: void forcedSessionClose(const QNetworkConfiguration &config); }; -#include "qnetworksession_p.moc" +#include "qnetworksession_impl.moc" Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); -- cgit v0.12 From a82fbee158bb117e5746fe097505d0a8035bb7d1 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 16:01:05 +1000 Subject: Make compile on Windows. --- src/plugins/bearer/nativewifi/nativewifi.pro | 8 ++++++-- src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 6 ++++++ src/plugins/bearer/nativewifi/qnativewifiengine.h | 2 ++ src/plugins/bearer/nla/nla.pro | 7 +++++-- src/plugins/bearer/nla/qnlaengine.cpp | 7 +++++++ src/plugins/bearer/nla/qnlaengine.h | 2 ++ 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 583edd4..6e99c62 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -3,8 +3,12 @@ include(../../qpluginbase.pri) QT += network -HEADERS += qnativewifiengine.h platformdefs.h -SOURCES += qnativewifiengine.cpp main.cpp +HEADERS += qnativewifiengine.h \ + platformdefs.h \ + ../qnetworksession_impl.h +SOURCES += main.cpp \ + qnativewifiengine.cpp \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 82ddaf9..1cd419b 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -41,6 +41,7 @@ #include "qnativewifiengine.h" #include "platformdefs.h" +#include "../qnetworksession_impl.h" #include @@ -467,4 +468,9 @@ QNetworkConfigurationManager::Capabilities QNativeWifiEngine::capabilities() con QNetworkConfigurationManager::CanStartAndStopInterfaces; } +QNetworkSessionPrivate *QNativeWifiEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 9d92562..39b6ea4 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -84,6 +84,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + inline bool available() const { return handle != 0; } public Q_SLOTS: diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 62a920a..9bd3526 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -10,8 +10,11 @@ QT += network } HEADERS += qnlaengine.h \ - ../platformdefs_win.h -SOURCES += qnlaengine.cpp main.cpp + ../platformdefs_win.h \ + ../qnetworksession_impl.h +SOURCES += main.cpp \ + qnlaengine.cpp \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index d3e3fd2..6c90429 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "qnlaengine.h" +#include "../qnetworksession_impl.h" + #include #include @@ -636,6 +638,11 @@ QNetworkConfigurationManager::Capabilities QNlaEngine::capabilities() const return QNetworkConfigurationManager::ForcedRoaming; } +QNetworkSessionPrivate *QNlaEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 5e80db1..5f0c294 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -95,6 +95,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + private Q_SLOTS: void networksChanged(); -- cgit v0.12 From ce1f282a5b061e4800735b2a39abfad1ee441e18 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 20 Jan 2010 11:01:04 +1000 Subject: Make compile on Mac OS X. --- src/plugins/bearer/corewlan/corewlan.pro | 8 ++++++-- src/plugins/bearer/corewlan/qcorewlanengine.h | 2 ++ src/plugins/bearer/corewlan/qcorewlanengine.mm | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index ac04e95..1660215 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -11,8 +11,12 @@ contains(QT_CONFIG, corewlan) { } } -HEADERS += qcorewlanengine.h -SOURCES += qcorewlanengine.mm main.cpp +HEADERS += qcorewlanengine.h \ + ../qnetworksession_impl.h + +SOURCES += main.cpp \ + qcorewlanengine.mm \ + ../qnetworksession_impl.cpp QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index dd07d83..8fedf4b 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -73,6 +73,8 @@ public: QNetworkConfigurationManager::Capabilities capabilities() const; + QNetworkSessionPrivate *createSessionBackend(); + static bool getAllScInterfaces(); private Q_SLOTS: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 7ee0723..404edb4 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qcorewlanengine.h" +#include "../qnetworksession_impl.h" #include @@ -517,4 +518,9 @@ QNetworkConfigurationManager::Capabilities QCoreWlanEngine::capabilities() const return QNetworkConfigurationManager::ForcedRoaming; } +QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl; +} + QT_END_NAMESPACE -- cgit v0.12 From 084c9659719ac310630ac0c1a81d013176f9c350 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 22 Jan 2010 14:22:40 +1000 Subject: Connect up preferredConfigurationChanged() signal. --- src/network/bearer/qnetworksession.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 6b0ccaf..78e38ba 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -240,6 +240,8 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, connect(d, SIGNAL(stateChanged(QNetworkSession::State)), this, SIGNAL(stateChanged(QNetworkSession::State))); connect(d, SIGNAL(closed()), this, SIGNAL(closed())); + connect(d, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + this, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))); connect(d, SIGNAL(newConfigurationActivated()), this, SIGNAL(newConfigurationActivated())); break; -- cgit v0.12 From d3b580fe8b2b0c185f0eadbf794156058496eff3 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 25 Jan 2010 09:53:12 +1000 Subject: Return default configuration from engines. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 34 ++++++-------------------- src/network/bearer/qnetworksessionengine_p.h | 2 ++ src/plugins/bearer/generic/qgenericengine.cpp | 5 ++++ src/plugins/bearer/generic/qgenericengine.h | 2 ++ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c00d6d3..bc3cfbd 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -212,42 +212,24 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } /*! - Returns the first active configuration found, if one exists; otherwise returns the first - discovered configuration found, if one exists; otherwise returns an empty configuration. + Returns the default configuration of the first plugin, if one exists; otherwise returns an + invalid configuration. \internal */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - QNetworkConfigurationPrivatePointer firstActive; - QNetworkConfigurationPrivatePointer firstDiscovered; - foreach (QNetworkSessionEngine *engine, sessionEngines) { - QHash::const_iterator i = - engine->accessPointConfigurations.constBegin(); - - while (i != engine->accessPointConfigurations.constEnd()) { - QNetworkConfigurationPrivatePointer priv = i.value(); - - if (!firstActive && priv->isValid && - (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) - firstActive = priv; - if (!firstDiscovered && priv->isValid && - (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) - firstDiscovered = priv; + QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); - ++i; + if (ptr) { + QNetworkConfiguration config; + config.d = ptr; + return config; } } - QNetworkConfiguration item; - - if (firstActive) - item.d = firstActive; - else if (firstDiscovered) - item.d = firstDiscovered; - - return item; + return QNetworkConfiguration(); } void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 02772cb..029c2c5 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -99,6 +99,8 @@ public: virtual QNetworkSessionPrivate *createSessionBackend() = 0; + virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index e9770e1..55d1ae4 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -325,5 +325,10 @@ QNetworkSessionPrivate *QGenericEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QGenericEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 04b845e..b44685b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -76,6 +76,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void doRequestUpdate(); -- cgit v0.12 From 1e06b5e995c6df715da8db53c8375d458277144d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 29 Jan 2010 10:30:42 +1000 Subject: Bearer Management Integration 4. --- config.tests/unix/networkmanager/main.cpp | 4 +- .../unix/networkmanager/networkmanager.pro | 3 + examples/network/bearercloud/bearercloud.pro | 2 +- examples/network/bearermonitor/bearermonitor.pro | 2 +- examples/network/bearermonitor/sessionwidget.ui | 426 +++++++++++---------- src/network/bearer/bearer.pro | 9 +- src/network/bearer/qnetworkconfigmanager_maemo.cpp | 1 - src/network/bearer/qnetworkconfiguration_s60_p.cpp | 2 +- src/network/bearer/qnetworksession.cpp | 7 +- src/network/bearer/qnetworksession_maemo_p.h | 11 +- .../qnetworkconfigmanager.pro | 6 + .../qnetworkconfiguration.pro | 6 + .../tst_qnetworksession/tst_qnetworksession.pro | 6 + 13 files changed, 258 insertions(+), 227 deletions(-) diff --git a/config.tests/unix/networkmanager/main.cpp b/config.tests/unix/networkmanager/main.cpp index 6f2bae6..60c6dfc 100644 --- a/config.tests/unix/networkmanager/main.cpp +++ b/config.tests/unix/networkmanager/main.cpp @@ -38,7 +38,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +#if defined(QT_NO_DBUS) +sjkp //error is no QtDBus +#endif #include int main(int argc, char** argv) diff --git a/config.tests/unix/networkmanager/networkmanager.pro b/config.tests/unix/networkmanager/networkmanager.pro index 554f513..3af4fcb 100644 --- a/config.tests/unix/networkmanager/networkmanager.pro +++ b/config.tests/unix/networkmanager/networkmanager.pro @@ -9,3 +9,6 @@ INCLUDEPATH += . # Input SOURCES += main.cpp +!contains(QT_CONFIG,dbus): { + DEFINES += QT_NO_DBUS +} diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro index 75e3049..856d3f7 100644 --- a/examples/network/bearercloud/bearercloud.pro +++ b/examples/network/bearercloud/bearercloud.pro @@ -20,4 +20,4 @@ MOBILITY = bearer CONFIG += console -symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +symbian:TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro index acbee71..046021a 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -25,4 +25,4 @@ wince*:LIBS += -lWs2 CONFIG += console -symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +symbian:TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui index f02f306..65ca43b 100644 --- a/examples/network/bearermonitor/sessionwidget.ui +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -7,240 +7,248 @@ 0 0 340 - 220 + 286 Form - + - + - - - Session ID: - - + + + + + Session ID: + + + + + + + + 0 + 0 + + + + + + + + - - - - 0 - 0 - - - - - - - - - - - - - - - - 0 - 0 - - - - Session State: - - - - - - - - 0 - 0 - - - - Invalid - - - - - - - - - - - Configuration: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Bearer: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Interface Name: - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Interface GUID: - - + + + + + + 0 + 0 + + + + Session State: + + + + + + + + 0 + 0 + + + + Invalid + + + + - - - - 0 - 0 - - - - - - + + + + + Configuration: + + + + + + + + 0 + 0 + + + + + + + + - - - - - - - Last Error: - - + + + + + Bearer: + + + + + + + + 0 + 0 + + + + + + + + - - - - 0 - 0 - - - - - - + + + + + Interface Name: + + + + + + + + 0 + 0 + + + + + + + + - - - - - - - Error String - - + + + + + Interface GUID: + + + + + + + + 0 + 0 + + + + + + + + - - - - 0 - 0 - - - - - - - - - - - - - - - Open - - + + + + + Last Error: + + + + + + + + 0 + 0 + + + + + + + + - - - Blocking Open - - + + + + + Error String + + + + + + + + 0 + 0 + + + + + + + + - - - Close - - + + + + + Open + + + + + + + Blocking Open + + + + - - - Stop - - + + + + + Close + + + + + + + Stop + + + + diff --git a/src/network/bearer/bearer.pro b/src/network/bearer/bearer.pro index ce39db6..b8e4d06 100644 --- a/src/network/bearer/bearer.pro +++ b/src/network/bearer/bearer.pro @@ -50,19 +50,11 @@ symbian: { TARGET.CAPABILITY = ALL -TCB TARGET.UID3 = 0x2002AC81 - deploy.path = $${EPOCROOT} - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - for(header, exportheaders.sources) { - BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" - } - QtBearerManagement.sources = QtBearer.dll QtBearerManagement.path = /sys/bin DEPLOYMENT += QtBearerManagement } else { maemo6 { - QT += dbus CONFIG += link_pkgconfig exists(../debug) { @@ -159,4 +151,5 @@ symbian: { } } +CONFIG += middleware include(../../features/deploy.pri) diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp index 795b054..1482fa7 100644 --- a/src/network/bearer/qnetworkconfigmanager_maemo.cpp +++ b/src/network/bearer/qnetworkconfigmanager_maemo.cpp @@ -44,7 +44,6 @@ #include "qnetworkconfigmanager_maemo_p.h" #include -#include #include #include diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp index 02115d9..ee50bd5 100644 --- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp +++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp @@ -68,7 +68,7 @@ QString QNetworkConfigurationPrivate::bearerName() const case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA"); case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth"); case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX"); - default: return QLatin1String("Unknown"); + default: return QString(); } } diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 6171350..28afcfe 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -141,7 +141,7 @@ QTM_BEGIN_NAMESPACE \value UnknownSessionError An unidentified error occurred. \value SessionAbortedError The session was aborted by the user or system. - \value RoamingError The session cannot roam to the new configuration. + \value RoamingError The session cannot roam to a new configuration. \value OperationNotSupportedError The operation is not supported for current configuration. \value InvalidConfigurationError The operation cannot currently be performed for the current configuration. @@ -328,7 +328,10 @@ void QNetworkSession::close() /*! Invalidates all open sessions against the network interface and therefore stops the underlying network interface. This function always changes the session's state() flag to - \l Disconnected. + \l Disconnected. + + On Symbian platform, a 'NetworkControl' capability is required for + full interface-level stop (without the capability, only the current session is stopped). \sa open(), close() */ diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h index 892262d..e3b7ffb 100644 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ b/src/network/bearer/qnetworksession_maemo_p.h @@ -52,7 +52,6 @@ // // We mean it. // - #include "qnetworkconfigmanager_maemo_p.h" #include "qnetworksession.h" @@ -60,7 +59,9 @@ #include #include +#ifdef Q_WS_MAEMO_6 #include +#endif QTM_BEGIN_NAMESPACE @@ -69,8 +70,12 @@ class QNetworkSessionPrivate : public QObject Q_OBJECT public: QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), - connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) + tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), +#ifdef Q_WS_MAEMO_6 + connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) +#else + connectFlags(0) +#endif { } diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro index bdd4926..4b60a55 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro @@ -14,3 +14,9 @@ MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData } + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro index c5a08b3..3cdb113 100644 --- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro +++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro @@ -14,3 +14,9 @@ MOBILITY = bearer symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData } + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index ccc405e..18b5c23 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -20,3 +20,9 @@ wince* { symbian { TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData } + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} -- cgit v0.12 From 0a903bf4995ed65367eb17c024af3f16aef57510 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 1 Feb 2010 15:28:32 +1000 Subject: Add defaultConfiguration() function to all bearer management engines. --- src/plugins/bearer/corewlan/qcorewlanengine.h | 2 ++ src/plugins/bearer/corewlan/qcorewlanengine.mm | 5 +++++ src/plugins/bearer/nativewifi/qnativewifiengine.cpp | 5 +++++ src/plugins/bearer/nativewifi/qnativewifiengine.h | 2 ++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 5 +++++ src/plugins/bearer/networkmanager/qnetworkmanagerengine.h | 2 ++ src/plugins/bearer/nla/qnlaengine.cpp | 5 +++++ src/plugins/bearer/nla/qnlaengine.h | 2 ++ 8 files changed, 28 insertions(+) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 8fedf4b..61d80cf 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -75,6 +75,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + static bool getAllScInterfaces(); private Q_SLOTS: diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 404edb4..2cbccb5 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -523,4 +523,9 @@ QNetworkSessionPrivate *QCoreWlanEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QCoreWlanEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 1cd419b..af538a8 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -473,4 +473,9 @@ QNetworkSessionPrivate *QNativeWifiEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QNativeWifiEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 39b6ea4..83d9e2c 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -86,6 +86,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + inline bool available() const { return handle != 0; } public Q_SLOTS: diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 9064005..439772a 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -691,5 +691,10 @@ QNetworkSessionPrivate *QNetworkManagerEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 11255fc..5f8110c 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -86,6 +86,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void interfacePropertiesChanged(const QString &path, const QMap &properties); diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 6c90429..0ed62e3 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -643,6 +643,11 @@ QNetworkSessionPrivate *QNlaEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QNlaEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + #include "qnlaengine.moc" QT_END_NAMESPACE diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 5f0c294..515a13c 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -97,6 +97,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void networksChanged(); -- cgit v0.12 From 29f24e41b91c05d551c7ac16625a2961744c8339 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 14:52:45 +1000 Subject: Bearer Management Integration 5. --- src/network/bearer/qnetworksession.cpp | 3 ++ tests/auto/qnetworksession/lackey/lackey.pro | 5 +++ tests/auto/qnetworksession/lackey/main.cpp | 19 ++++++--- .../tst_qnetworksession/tst_qnetworksession.cpp | 46 ++++++++++++++++------ .../tst_qnetworksession/tst_qnetworksession.pro | 2 +- 5 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 28afcfe..0ea773a 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -408,6 +408,9 @@ QNetworkConfiguration QNetworkSession::configuration() const This function only returns a valid QNetworkInterface when this session is \l Connected. The returned interface may change as a result of a roaming process. + + Note: this function does not work in Symbian emulator due to the way the + connectivity is emulated on Windows. \sa state() */ diff --git a/tests/auto/qnetworksession/lackey/lackey.pro b/tests/auto/qnetworksession/lackey/lackey.pro index b8a006b..96edf99f 100644 --- a/tests/auto/qnetworksession/lackey/lackey.pro +++ b/tests/auto/qnetworksession/lackey/lackey.pro @@ -9,5 +9,10 @@ CONFIG+= testcase include(../../../../common.pri) +symbian { + # Needed for interprocess communication and opening QNetworkSession + TARGET.CAPABILITY = NetworkControl NetworkServices +} + CONFIG += mobility MOBILITY = bearer diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index f3a7a07..cc155f2 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -54,16 +54,23 @@ QTM_USE_NAMESPACE #define NO_DISCOVERED_CONFIGURATIONS_ERROR 1 #define SESSION_OPEN_ERROR 2 + int main(int argc, char** argv) { QCoreApplication app(argc, argv); QNetworkConfigurationManager manager; QList discovered = +#if defined (Q_OS_SYMBIAN) + // On Symbian, on the first query (before updateConfigurations() call + // the discovered-states are not correct, so defined-state will do. + manager.allConfigurations(QNetworkConfiguration::Defined); +#else manager.allConfigurations(QNetworkConfiguration::Discovered); - - if (discovered.isEmpty()) +#endif + if (discovered.isEmpty()) { return NO_DISCOVERED_CONFIGURATIONS_ERROR; + } // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. @@ -85,15 +92,16 @@ int main(int argc, char** argv) qDebug() << "Discovered configurations:" << discovered.count(); if (discovered.isEmpty()) { - qDebug() << "No more configurations"; + qDebug() << "No more discovered configurations"; break; } qDebug() << "Taking first configuration"; QNetworkConfiguration config = discovered.takeFirst(); + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - qDebug() << config.name() << "is active"; + qDebug() << config.name() << " is active, therefore skipping it (looking for configs in 'discovered' state)."; continue; } @@ -104,12 +112,11 @@ int main(int argc, char** argv) QString output = QString("Starting session for %1\n").arg(config.identifier()); oopSocket.write(output.toAscii()); oopSocket.waitForBytesWritten(); - session->open(); session->waitForOpened(); } while (!(session && session->isOpen())); - qDebug() << "loop done"; + qDebug() << "lackey: loop done"; if (!session) { qDebug() << "Could not start session"; diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp index 86b3e46..adb8edd 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp @@ -66,6 +66,8 @@ public slots: void cleanupTestCase(); private slots: + + void outOfProcessSession(); void invalidSession(); void sessionProperties_data(); @@ -77,8 +79,6 @@ private slots: void sessionOpenCloseStop_data(); void sessionOpenCloseStop(); - void outOfProcessSession(); - private: QNetworkConfigurationManager manager; @@ -264,7 +264,10 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); +#endif if (!configuration.isValid()) { QVERIFY(configuration.state() == QNetworkConfiguration::Undefined && @@ -311,13 +314,14 @@ void tst_QNetworkSession::userChoiceSession() QNetworkSession session(configuration); + // Check that configuration was really set QVERIFY(session.configuration() == configuration); QVERIFY(!session.isOpen()); + // Check that session is not active QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty()); - // The remaining tests require the session to be not NotAvailable. if (session.state() == QNetworkSession::NotAvailable) QSKIP("Network is not available.", SkipSingle); @@ -367,7 +371,10 @@ void tst_QNetworkSession::userChoiceSession() QTRY_VERIFY(!stateChangedSpy.isEmpty()); QVERIFY(session.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif const QString userChoiceIdentifier = session.sessionProperty("UserChoiceConfiguration").toString(); @@ -507,7 +514,10 @@ void tst_QNetworkSession::sessionOpenCloseStop() } QVERIFY(session.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif } else { QFAIL("Timeout waiting for session to open."); } @@ -540,7 +550,10 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); QCOMPARE(session.interface().index(), session2.interface().index()); } @@ -713,7 +726,10 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); +#if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) + // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); +#endif QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); QCOMPARE(session.interface().index(), session2.interface().index()); } @@ -786,17 +802,23 @@ QDebug operator<<(QDebug debug, const QList &list) return debug; } +// Note: outOfProcessSession requires that at least one configuration is +// at Discovered -state (Defined is ok for symbian as well, as long as it is possible to open). void tst_QNetworkSession::outOfProcessSession() { +#if defined(Q_OS_SYMBIAN) && defined(__WINS__) + QSKIP("Symbian emulator does not support two [QR]PRocesses linking a dll (QtBearer.dll) with global writeable static data.", SkipAll); +#endif QNetworkConfigurationManager manager; - + // Create a QNetworkConfigurationManager to detect configuration changes made in Lackey. This + // is actually the essence of this testcase - to check that platform mediates/reflects changes + // regardless of process boundaries. The interprocess communication is more like a way to get + // this test-case act correctly and timely. QList before = manager.allConfigurations(QNetworkConfiguration::Active); + QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration))); - // Cannot read/write to processes on WinCE or Symbian. // Easiest alternative is to use sockets for IPC. - QLocalServer oopServer; // First remove possible earlier listening address which would cause listen to fail // (e.g. previously abruptly ended unit test might cause this) @@ -813,19 +835,17 @@ void tst_QNetworkSession::outOfProcessSession() do { QByteArray output; - if(oopSocket->waitForReadyRead()) + if(oopSocket->waitForReadyRead()) { output = oopSocket->readLine().trimmed(); + } if (output.startsWith("Started session ")) { - QString identifier = QString::fromLocal8Bit(output.mid(16).constData()); - + QString identifier = QString::fromLocal8Bit(output.mid(20).constData()); QNetworkConfiguration changed; do { QTRY_VERIFY(!spy.isEmpty()); - changed = qvariant_cast(spy.takeFirst().at(0)); - } while (changed.identifier() != identifier); QVERIFY((changed.state() & QNetworkConfiguration::Active) == @@ -870,10 +890,10 @@ void tst_QNetworkSession::outOfProcessSession() switch (lackey.exitCode()) { case 0: + qDebug("Lackey returned exit success (0)"); break; case 1: QSKIP("No discovered configurations found.", SkipAll); - break; case 2: QSKIP("Lackey could not start session.", SkipAll); default: diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro index 18b5c23..f04a8fb 100644 --- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro +++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro @@ -18,7 +18,7 @@ wince* { } symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData PowerMgmt } maemo6 { -- cgit v0.12 From 28f95681f4a6fc2e95180f573b658637a82c4c12 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 18 Jan 2010 13:58:47 +1000 Subject: Start adding network session support into QNetworkAccessManager. --- src/network/access/qnetworkaccessbackend.cpp | 30 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessbackend_p.h | 4 ++++ src/network/access/qnetworkaccessmanager.cpp | 30 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessmanager.h | 4 ++++ src/network/access/qnetworkaccessmanager_p.h | 5 ++++- src/network/access/qnetworkreplyimpl.cpp | 4 +++- 6 files changed, 75 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 8ac64d2..54d9dbd 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -49,6 +49,8 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" +#include "qnetworksession.h" +#include "qhostinfo.h" #include "private/qnoncontiguousbytedevice_p.h" @@ -341,4 +343,32 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) #endif } +void QNetworkAccessBackend::start() +{ + qDebug() << "Checking for localhost"; + QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); + foreach (const QHostAddress &address, hostInfo.addresses()) { + if (address == QHostAddress::LocalHost || + address == QHostAddress::LocalHostIPv6) { + // Don't need session for local host access. + qDebug() << "Access is to localhost"; + open(); + return; + } + } + + qDebug() << "Connecting session signals"; + connect(manager->session, SIGNAL(opened()), this, SLOT(sessionOpened())); + + qDebug() << "Open session if required"; + if (!manager->session->isOpen()) + manager->session->open(); +} + +void QNetworkAccessBackend::sessionOpened() +{ + qDebug() << "Session opened, calling open()"; + open(); +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 43d993c..04cc5b0 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -111,6 +111,7 @@ public: // socket). virtual void open() = 0; + virtual void start(); virtual void closeDownstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; @@ -186,6 +187,9 @@ protected slots: void sslErrors(const QList &errors); void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); +private slots: + void sessionOpened(); + private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e16aedc..38ab1c6 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -59,6 +59,8 @@ #include "QtCore/qvector.h" #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" +#include "QtNetwork/qnetworkconfigmanager.h" +#include "QtNetwork/qnetworksession.h" QT_BEGIN_NAMESPACE @@ -346,6 +348,9 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) : QObject(*new QNetworkAccessManagerPrivate, parent) { ensureInitialized(); + + d_func()->session = + new QNetworkSession(QNetworkConfigurationManager().defaultConfiguration(), this); } /*! @@ -665,6 +670,31 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ } /*! + \since 4.7 + + Sets the network configuration that will be used to \a config. + + \sa configuration() +*/ +void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config) +{ + delete d_func()->session; + d_func()->session = new QNetworkSession(config, this); +} + +/*! + \since 4.7 + + Returns the network configuration. + + \sa setConfiguration() +*/ +QNetworkConfiguration QNetworkAccessManager::configuration() const +{ + return d_func()->session->configuration(); +} + +/*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index d2fe527..8e1c3b6 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -62,6 +62,7 @@ class QNetworkReply; class QNetworkProxy; class QNetworkProxyFactory; class QSslError; +class QNetworkConfiguration; class QNetworkReplyImplPrivate; class QNetworkAccessManagerPrivate; @@ -103,6 +104,9 @@ public: QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data); QNetworkReply *deleteResource(const QNetworkRequest &request); + void setConfiguration(const QNetworkConfiguration &config); + QNetworkConfiguration configuration() const; + Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 1749373..4eeff4b 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -65,6 +65,7 @@ class QAuthenticator; class QAbstractNetworkCache; class QNetworkAuthenticationCredential; class QNetworkCookieJar; +class QNetworkSession; class QNetworkAccessManagerPrivate: public QObjectPrivate { @@ -74,7 +75,8 @@ public: #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif - cookieJarCreated(false) + cookieJarCreated(false), + session(0) { } ~QNetworkAccessManagerPrivate(); @@ -112,6 +114,7 @@ public: bool cookieJarCreated; + QNetworkSession *session; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 59c7d76..f097a2b 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -82,7 +82,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } - backend->open(); + backend->start(); + + //backend->open(); if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) pendingNotifications.append(NotifyDownstreamReadyWrite); -- cgit v0.12 From 2149a313e671b22382828b58d2520807a5a061e1 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 19 Jan 2010 10:59:57 +1000 Subject: Progress. --- src/network/access/qnetworkaccessbackend.cpp | 19 +++++++++++++++++++ src/network/access/qnetworkaccessbackend_p.h | 2 ++ src/network/access/qnetworkaccessmanager.cpp | 22 +++++++++++++++++++--- src/network/access/qnetworkaccessmanager.h | 3 +++ src/network/access/qnetworkaccessmanager_p.h | 6 ++++++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 54d9dbd..c712fff 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -363,12 +363,31 @@ void QNetworkAccessBackend::start() qDebug() << "Open session if required"; if (!manager->session->isOpen()) manager->session->open(); + else + sessionOpened(); } void QNetworkAccessBackend::sessionOpened() { + manager->sendDebugMessage(QLatin1String("Session opened")); qDebug() << "Session opened, calling open()"; open(); } +void QNetworkAccessBackend::preferredConfigurationChanged(const QNetworkConfiguration &config, + bool isSeamless) +{ + QString message = QString::fromLatin1("preferredConfiguirationChanged %1 %2") + .arg(config.name()) .arg(isSeamless); + + manager->sendDebugMessage(message); + manager->session->ignore(); +} + +void QNetworkAccessBackend::newConfigurationActivated() +{ + manager->sendDebugMessage(QLatin1String("newConfigurationActivated")); + manager->session->reject(); +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 04cc5b0..62ac736 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -189,6 +189,8 @@ protected slots: private slots: void sessionOpened(); + void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + void newConfigurationActivated(); private: friend class QNetworkAccessManager; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 38ab1c6..b8edefa 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -349,8 +349,8 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) { ensureInitialized(); - d_func()->session = - new QNetworkSession(QNetworkConfigurationManager().defaultConfiguration(), this); + QNetworkConfigurationManager manager; + d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); } /*! @@ -672,7 +672,7 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ /*! \since 4.7 - Sets the network configuration that will be used to \a config. + Sets the network configuration that will be used when creating a network session to \a config. \sa configuration() */ @@ -695,6 +695,22 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const } /*! + \since 4.7 + + Returns the current active network configuration. + + \sa configuration() +*/ +QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const +{ + QNetworkConfigurationManager manager; + + return manager.configurationFromIdentifier( + d_func()->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + +} + +/*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 8e1c3b6..82bbd03 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -106,6 +106,7 @@ public: void setConfiguration(const QNetworkConfiguration &config); QNetworkConfiguration configuration() const; + QNetworkConfiguration activeConfiguration() const; Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY @@ -117,6 +118,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif + void debugMessage(const QString &message); + protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 4eeff4b..b6a266c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -101,6 +101,12 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); + void sendDebugMessage(const QString &message) + { + Q_Q(QNetworkAccessManager); + emit q->debugMessage(message); + } + // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; -- cgit v0.12 From df551752b7f430ab44bb1dd2ad0aa8c2a5187ef8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 28 Jan 2010 11:27:49 +1000 Subject: Bearer Management Integration. Perform application level roaming when all pending QNetworkReplys have completed. Emit temporary network failure error when connection to network is lost but is possibly recovering due to roaming. Don't save downloads in cache if they are not complete. --- src/network/access/qnetworkaccessbackend.cpp | 24 ++------- src/network/access/qnetworkaccessbackend_p.h | 4 +- src/network/access/qnetworkaccessmanager.cpp | 79 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessmanager.h | 6 +++ src/network/access/qnetworkaccessmanager_p.h | 11 +++- src/network/access/qnetworkreply.cpp | 4 ++ src/network/access/qnetworkreply.h | 1 + src/network/access/qnetworkreplyimpl.cpp | 29 +++++++++- 8 files changed, 134 insertions(+), 24 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index c712fff..22df248 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -49,7 +49,6 @@ #include "qnetworkaccesscachebackend_p.h" #include "qabstractnetworkcache.h" -#include "qnetworksession.h" #include "qhostinfo.h" #include "private/qnoncontiguousbytedevice_p.h" @@ -345,22 +344,20 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) void QNetworkAccessBackend::start() { - qDebug() << "Checking for localhost"; QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); foreach (const QHostAddress &address, hostInfo.addresses()) { if (address == QHostAddress::LocalHost || address == QHostAddress::LocalHostIPv6) { // Don't need session for local host access. - qDebug() << "Access is to localhost"; open(); return; } } - qDebug() << "Connecting session signals"; connect(manager->session, SIGNAL(opened()), this, SLOT(sessionOpened())); + connect(manager->session, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(sessionError(QNetworkSession::SessionError))); - qDebug() << "Open session if required"; if (!manager->session->isOpen()) manager->session->open(); else @@ -369,25 +366,12 @@ void QNetworkAccessBackend::start() void QNetworkAccessBackend::sessionOpened() { - manager->sendDebugMessage(QLatin1String("Session opened")); - qDebug() << "Session opened, calling open()"; open(); } -void QNetworkAccessBackend::preferredConfigurationChanged(const QNetworkConfiguration &config, - bool isSeamless) +void QNetworkAccessBackend::sessionError(QNetworkSession::SessionError error) { - QString message = QString::fromLatin1("preferredConfiguirationChanged %1 %2") - .arg(config.name()) .arg(isSeamless); - - manager->sendDebugMessage(message); - manager->session->ignore(); -} - -void QNetworkAccessBackend::newConfigurationActivated() -{ - manager->sendDebugMessage(QLatin1String("newConfigurationActivated")); - manager->session->reject(); + manager->sendDebugMessage(QString::fromLatin1("Session error %1").arg(error)); } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 62ac736..08a8a2a 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -54,6 +54,7 @@ // #include "qnetworkreplyimpl_p.h" +#include "QtNetwork/qnetworksession.h" #include "QtCore/qobject.h" QT_BEGIN_NAMESPACE @@ -189,8 +190,7 @@ protected slots: private slots: void sessionOpened(); - void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); - void newConfigurationActivated(); + void sessionError(QNetworkSession::SessionError error); private: friend class QNetworkAccessManager; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index b8edefa..3f8ef01 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -351,6 +351,17 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) QNetworkConfigurationManager manager; d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); + + connect(d_func()->session, SIGNAL(opened()), this, SLOT(_q_sessionOpened())); + connect(d_func()->session, SIGNAL(closed()), this, SLOT(_q_sessionClosed())); + connect(d_func()->session, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(_q_sessionStateChanged(QNetworkSession::State))); + connect(d_func()->session, SIGNAL(error(QNetworkSession::SessionError)), + this, SLOT(_q_sessionError(QNetworkSession::SessionError))); + connect(d_func()->session, SIGNAL(newConfigurationActivated()), + this, SLOT(_q_sessionNewConfigurationActivated())); + connect(d_func()->session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + this, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); } /*! @@ -792,6 +803,20 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() QNetworkReply *reply = qobject_cast(q->sender()); if (reply) emit q->finished(reply); + + if (deferredMigration) { + bool repliesPending = false; + foreach (QObject *child, q->children()) { + if (child != reply && child->inherits("QNetworkReply")) { + repliesPending = true; + break; + } + } + if (!repliesPending) { + emit q->debugMessage(QLatin1String("Migrating as there are no pending replies.")); + session->migrate(); + } + } } void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList &errors) @@ -1044,6 +1069,60 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { } +void QNetworkAccessManagerPrivate::_q_sessionOpened() +{ + Q_Q(QNetworkAccessManager); +} + +void QNetworkAccessManagerPrivate::_q_sessionClosed() +{ + Q_Q(QNetworkAccessManager); + + emit q->debugMessage(QLatin1String("Session Closed")); +} + +void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError error) +{ + Q_Q(QNetworkAccessManager); + + emit q->debugMessage(QString::fromLatin1("Session error %1").arg(error)); +} + +void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) +{ + Q_Q(QNetworkAccessManager); +} + +void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() +{ + Q_Q(QNetworkAccessManager); + + foreach (QObject *child, q->children()) { + QNetworkReply *reply = qobject_cast(child); + if (reply) { + emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1").arg(reply->url().toString())); + } + } + + session->accept(); +} + +void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless) +{ + Q_Q(QNetworkAccessManager); + + deferredMigration = false; + foreach (QObject *child, q->children()) { + if (child->inherits("QNetworkReply")) { + deferredMigration = true; + break; + } + } + + if (!deferredMigration) + session->migrate(); +} + QT_END_NAMESPACE #include "moc_qnetworkaccessmanager.cpp" diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 82bbd03..14aaf78 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -129,6 +129,12 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList)) + Q_PRIVATE_SLOT(d_func(), void _q_sessionOpened()) + Q_PRIVATE_SLOT(d_func(), void _q_sessionClosed()) + Q_PRIVATE_SLOT(d_func(), void _q_sessionError(QNetworkSession::SessionError)) + Q_PRIVATE_SLOT(d_func(), void _q_sessionStateChanged(QNetworkSession::State)) + Q_PRIVATE_SLOT(d_func(), void _q_sessionNewConfigurationActivated()) + Q_PRIVATE_SLOT(d_func(), void _q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index b6a266c..b9e3964 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,7 +76,8 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0) + session(0), + deferredMigration(false) { } ~QNetworkAccessManagerPrivate(); @@ -107,6 +108,13 @@ public: emit q->debugMessage(message); } + void _q_sessionOpened(); + void _q_sessionClosed(); + void _q_sessionError(QNetworkSession::SessionError error); + void _q_sessionStateChanged(QNetworkSession::State state); + void _q_sessionNewConfigurationActivated(); + void _q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -121,6 +129,7 @@ public: bool cookieJarCreated; QNetworkSession *session; + bool deferredMigration; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 0a8ea5d..e299b5b 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -125,6 +125,10 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() encrypted channel could not be established. The sslErrors() signal should have been emitted. + \value TemporaryNetworkFailureError the connection was broken due + to disconnection from the network, however the system has initiated + roaming to another access point. The request should be resubmitted. + \value ProxyConnectionRefusedError the connection to the proxy server was refused (the proxy server is not accepting requests) diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 5be4cce..b39557a 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -77,6 +77,7 @@ public: TimeoutError, OperationCanceledError, SslHandshakeFailedError, + TemporaryNetworkFailureError, UnknownNetworkError = 99, // proxy errors (101-199): diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index f097a2b..7eca323 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -47,6 +47,7 @@ #include "QtCore/qdatetime.h" #include "QtNetwork/qsslconfiguration.h" #include "qnetworkaccesshttpbackend_p.h" +#include "qnetworkaccessmanager_p.h" #include @@ -516,7 +517,33 @@ void QNetworkReplyImplPrivate::finished() emit q->uploadProgress(0, 0); resumeNotificationHandling(); - completeCacheSave(); + if (manager->d_func()->session->state() == QNetworkSession::Roaming) { + // only content with a known size will fail with a temporary network failure error + if (!totalSize.isNull()) { + qDebug() << "Connection broke during download."; + qDebug() << "Don't worry, we've already started roaming :)"; + + if (bytesDownloaded == totalSize) { + qDebug() << "Luckily download has already finished."; + } else { + qDebug() << "Download hasn't finished"; + + if (q->bytesAvailable() == bytesDownloaded) { + qDebug() << "User hasn't read data from reply, we could continue after reconnect."; + error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); + } else if (q->bytesAvailable() < bytesDownloaded) { + qDebug() << "User has already read data from reply."; + error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); + } + } + } + } + + // if we don't know the total size of or we received everything save the cache + if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) + completeCacheSave(); + else + qDebug() << "Not saving cache."; // note: might not be a good idea, since users could decide to delete us // which would delete the backend too... -- cgit v0.12 From 75a0b3e5526b0a6cf01deb60f0dc37b61928206a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 28 Jan 2010 13:15:50 +1000 Subject: Wait until session is in the connected state before starting transfer. --- src/network/access/qnetworkaccessbackend.cpp | 19 +++++++++++++------ src/network/access/qnetworkaccessbackend_p.h | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 22df248..d9bce9d 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -354,19 +354,26 @@ void QNetworkAccessBackend::start() } } - connect(manager->session, SIGNAL(opened()), this, SLOT(sessionOpened())); + connect(manager->session, SIGNAL(stateChanged(QNetworkSession::State)), + this, SLOT(sessionStateChanged(QNetworkSession::State))); connect(manager->session, SIGNAL(error(QNetworkSession::SessionError)), this, SLOT(sessionError(QNetworkSession::SessionError))); - if (!manager->session->isOpen()) + switch (manager->session->state()) { + case QNetworkSession::Roaming: + break; + case QNetworkSession::Connected: + open(); + break; + default: manager->session->open(); - else - sessionOpened(); + } } -void QNetworkAccessBackend::sessionOpened() +void QNetworkAccessBackend::sessionStateChanged(QNetworkSession::State state) { - open(); + if (state == QNetworkSession::Connected) + open(); } void QNetworkAccessBackend::sessionError(QNetworkSession::SessionError error) diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 08a8a2a..7b7821e 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -189,7 +189,7 @@ protected slots: void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); private slots: - void sessionOpened(); + void sessionStateChanged(QNetworkSession::State state); void sessionError(QNetworkSession::SessionError error); private: -- cgit v0.12 From 72f9a360c5f378092884654257266b4569932336 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 1 Feb 2010 13:25:03 +1000 Subject: Progress. --- src/network/access/qnetworkaccessbackend.cpp | 43 +++++++---------- src/network/access/qnetworkaccessbackend_p.h | 6 +-- src/network/access/qnetworkaccessmanager.cpp | 71 ++++++++++++++++++++++++---- src/network/access/qnetworkreplyimpl.cpp | 40 +++++++++++----- src/network/access/qnetworkreplyimpl_p.h | 3 +- 5 files changed, 109 insertions(+), 54 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index d9bce9d..f35cb59 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -342,7 +342,12 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) #endif } -void QNetworkAccessBackend::start() +/*! + Starts the backend. Returns true if the backend is started. Returns false if the backend + could not be started due to an unopened or roaming session. The caller should recall this + function once the session has been opened or the roaming process has finished. +*/ +bool QNetworkAccessBackend::start() { QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); foreach (const QHostAddress &address, hostInfo.addresses()) { @@ -350,35 +355,23 @@ void QNetworkAccessBackend::start() address == QHostAddress::LocalHostIPv6) { // Don't need session for local host access. open(); - return; + return true; } } - connect(manager->session, SIGNAL(stateChanged(QNetworkSession::State)), - this, SLOT(sessionStateChanged(QNetworkSession::State))); - connect(manager->session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(sessionError(QNetworkSession::SessionError))); - - switch (manager->session->state()) { - case QNetworkSession::Roaming: - break; - case QNetworkSession::Connected: - open(); - break; - default: - manager->session->open(); + if (manager->session->isOpen()) { + if (manager->session->state() == QNetworkSession::Connected) { + qDebug() << "Session is open and state is connected"; + open(); + return true; + } else { + qDebug() << "we are roaming, connecting, etc. delay until roaming completes"; + } + } else { + qDebug() << "session not open"; } -} -void QNetworkAccessBackend::sessionStateChanged(QNetworkSession::State state) -{ - if (state == QNetworkSession::Connected) - open(); -} - -void QNetworkAccessBackend::sessionError(QNetworkSession::SessionError error) -{ - manager->sendDebugMessage(QString::fromLatin1("Session error %1").arg(error)); + return false; } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 7b7821e..b8b369f 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -112,7 +112,7 @@ public: // socket). virtual void open() = 0; - virtual void start(); + virtual bool start(); virtual void closeDownstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; @@ -188,10 +188,6 @@ protected slots: void sslErrors(const QList &errors); void emitReplyUploadProgress(qint64 bytesSent, qint64 bytesTotal); -private slots: - void sessionStateChanged(QNetworkSession::State state); - void sessionError(QNetworkSession::SessionError error); - private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 3f8ef01..a7a81f8 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -807,13 +807,24 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() if (deferredMigration) { bool repliesPending = false; foreach (QObject *child, q->children()) { - if (child != reply && child->inherits("QNetworkReply")) { - repliesPending = true; - break; + if (child != reply && child->inherits("QNetworkReplyImpl")) { + QNetworkReplyImpl *replyImpl = qobject_cast(child); + qDebug() << "reply state is" << replyImpl->d_func()->state; + switch (replyImpl->d_func()->state) { + case QNetworkReplyImplPrivate::Idle: + case QNetworkReplyImplPrivate::Finished: + case QNetworkReplyImplPrivate::Aborted: + break; + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + repliesPending = true; + break; + } } } if (!repliesPending) { - emit q->debugMessage(QLatin1String("Migrating as there are no pending replies.")); + deferredMigration = false; + qDebug() << "Migrating as there are no pending replies."; session->migrate(); } } @@ -1072,6 +1083,15 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); + + qDebug() << "Session Opened"; + + // start waiting children + foreach (QObject *child, q->children()) { + QNetworkReplyImpl *reply = qobject_cast(child); + if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) + QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); + } } void QNetworkAccessManagerPrivate::_q_sessionClosed() @@ -1091,6 +1111,8 @@ void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) { Q_Q(QNetworkAccessManager); + + qDebug() << "session state changed to" << state; } void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() @@ -1098,13 +1120,30 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() Q_Q(QNetworkAccessManager); foreach (QObject *child, q->children()) { - QNetworkReply *reply = qobject_cast(child); + QNetworkReplyImpl *reply = qobject_cast(child); if (reply) { - emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1").arg(reply->url().toString())); + switch (reply->d_func()->state) { + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1") + .arg(reply->url().toString())); + break; + default: + qDebug() << "Testing new interface for" << reply->url(); + ; + } } } + qDebug() << "Accepting new configuration."; session->accept(); + + // start waiting children + foreach (QObject *child, q->children()) { + QNetworkReplyImpl *reply = qobject_cast(child); + if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) + QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); + } } void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless) @@ -1113,14 +1152,26 @@ void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const deferredMigration = false; foreach (QObject *child, q->children()) { - if (child->inherits("QNetworkReply")) { - deferredMigration = true; - break; + if (child->inherits("QNetworkReplyImpl")) { + QNetworkReplyImpl *replyImpl = qobject_cast(child); + qDebug() << "reply state is" << replyImpl->d_func()->state; + switch (replyImpl->d_func()->state) { + case QNetworkReplyImplPrivate::Idle: + case QNetworkReplyImplPrivate::Finished: + case QNetworkReplyImplPrivate::Aborted: + break; + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + deferredMigration = true; + break; + } } } - if (!deferredMigration) + if (!deferredMigration) { + qDebug() << "Migrating as there are no pending replies."; session->migrate(); + } } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7eca323..5d52913 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -83,7 +83,18 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } - backend->start(); + if (!backend->start()) { + // backend failed to start because the session state is not Connected. + // QNetworkAccessManager will call reply->backend->start() again for us when the session + // state changes. + qDebug() << "Waiting for session for" << url; + state = WaitingForSession; + + if (!manager->d_func()->session->isOpen()) + manager->d_func()->session->open(); + + return; + } //backend->open(); if (state != Finished) { @@ -504,20 +515,10 @@ void QNetworkReplyImplPrivate::finished() if (state == Finished || state == Aborted) return; - state = Finished; - pendingNotifications.clear(); - pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (totalSize.isNull() || totalSize == -1) { - emit q->downloadProgress(bytesDownloaded, bytesDownloaded); - } - - if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) - emit q->uploadProgress(0, 0); - resumeNotificationHandling(); - - if (manager->d_func()->session->state() == QNetworkSession::Roaming) { + if (state == Working && errorCode != QNetworkReply::OperationCanceledError && + manager->d_func()->session->state() == QNetworkSession::Roaming) { // only content with a known size will fail with a temporary network failure error if (!totalSize.isNull()) { qDebug() << "Connection broke during download."; @@ -538,6 +539,19 @@ void QNetworkReplyImplPrivate::finished() } } } + resumeNotificationHandling(); + + state = Finished; + pendingNotifications.clear(); + + pauseNotificationHandling(); + if (totalSize.isNull() || totalSize == -1) { + emit q->downloadProgress(bytesDownloaded, bytesDownloaded); + } + + if (bytesUploaded == -1 && (outgoingData || outgoingDataBuffer)) + emit q->uploadProgress(0, 0); + resumeNotificationHandling(); // if we don't know the total size of or we received everything save the cache if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 168e5cf..861b2b2 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -114,7 +114,8 @@ public: Buffering, Working, Finished, - Aborted + Aborted, + WaitingForSession }; typedef QQueue NotificationQueue; -- cgit v0.12 From 280a68446c1f96ae9d19134e4201bc78ee0b072a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 2 Feb 2010 14:04:15 +1000 Subject: Ensure that default network interface is set appropriately. Default network interface was not always being set when the active network configuration changed. --- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 24948cf..619fd9f 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -818,6 +818,16 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint newState == QNetworkSession::Connected) { activeConfig = activeConfiguration(accessPointId); activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId); +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + if (iDynamicSetdefaultif) { + // Use name of the IAP to set default IAP + QByteArray nameAsByteArray = activeConfig.name().toUtf8(); + ifreq ifr; + strcpy(ifr.ifr_name, nameAsByteArray.constData()); + + iDynamicSetdefaultif(&ifr); + } +#endif } // Make sure that same state is not signaled twice in a row. -- cgit v0.12 From 130a461c07ed35d1aeb27c8110efca773773c614 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 10:59:12 +1000 Subject: Don't try to resolve names to determine if dest is localhost. --- src/network/access/qnetworkaccessbackend.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index f35cb59..2eebcf9 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -349,14 +349,14 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { - QHostInfo hostInfo = QHostInfo::fromName(reply->url.host()); - foreach (const QHostAddress &address, hostInfo.addresses()) { - if (address == QHostAddress::LocalHost || - address == QHostAddress::LocalHostIPv6) { - // Don't need session for local host access. - open(); - return true; - } + // This is not ideal. + const QString host = reply->url.host(); + if (host == QLatin1String("localhost") || + QHostAddress(host) == QHostAddress::LocalHost || + QHostAddress(host) == QHostAddress::LocalHostIPv6) { + // Don't need an open session for localhost access. + open(); + return true; } if (manager->session->isOpen()) { -- cgit v0.12 From 8f5c1dd293b046e7f51d12b767464345c253943f Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 11:02:23 +1000 Subject: Don't build generic bearer engine on Symbian. --- src/plugins/bearer/bearer.pro | 7 +++---- src/s60installs/s60installs.pro | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index ab0a816..7347735 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -1,10 +1,9 @@ TEMPLATE = subdirs -!maemo { -SUBDIRS += generic -contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager +!maemo:contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager):SUBDIRS += networkmanager win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan symbian:SUBDIRS += symbian -} + +isEmpty(SUBDIRS):SUBDIRS += generic diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index b763786..d0bd59e 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -121,7 +121,7 @@ symbian: { } bearer_plugins.path = c:$$QT_PLUGINS_BASE_DIR/bearer - bearer_plugins.sources += qgenericbearer.dll qsymbianbearer.dll + bearer_plugins.sources += qsymbianbearer.dll BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" -- cgit v0.12 From 038e81412918dafaf50eaf7f9d6757e2677e4bb6 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 11:58:27 +1000 Subject: Remove debug. --- src/network/access/qnetworkaccessbackend.cpp | 13 +++---------- src/network/access/qnetworkaccessmanager.cpp | 2 -- src/network/access/qnetworkreplyimpl.cpp | 3 --- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 2eebcf9..bab6d14 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -359,16 +359,9 @@ bool QNetworkAccessBackend::start() return true; } - if (manager->session->isOpen()) { - if (manager->session->state() == QNetworkSession::Connected) { - qDebug() << "Session is open and state is connected"; - open(); - return true; - } else { - qDebug() << "we are roaming, connecting, etc. delay until roaming completes"; - } - } else { - qDebug() << "session not open"; + if (manager->session->isOpen() && manager->session->state() == QNetworkSession::Connected) { + open(); + return true; } return false; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index a7a81f8..dbcdddf 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1084,8 +1084,6 @@ void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); - qDebug() << "Session Opened"; - // start waiting children foreach (QObject *child, q->children()) { QNetworkReplyImpl *reply = qobject_cast(child); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 5d52913..fbe90ef 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -87,7 +87,6 @@ void QNetworkReplyImplPrivate::_q_startOperation() // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. - qDebug() << "Waiting for session for" << url; state = WaitingForSession; if (!manager->d_func()->session->isOpen()) @@ -556,8 +555,6 @@ void QNetworkReplyImplPrivate::finished() // if we don't know the total size of or we received everything save the cache if (totalSize.isNull() || totalSize == -1 || bytesDownloaded == totalSize) completeCacheSave(); - else - qDebug() << "Not saving cache."; // note: might not be a good idea, since users could decide to delete us // which would delete the backend too... -- cgit v0.12 From 92eac408783fd4b1e2db2759c3212b580ff24205 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 3 Feb 2010 15:48:32 +1000 Subject: Fix compile warnings. --- src/network/access/qnetworkaccessmanager.cpp | 63 +++++++++++----------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index dbcdddf..4e28641 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -805,28 +805,24 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() emit q->finished(reply); if (deferredMigration) { - bool repliesPending = false; foreach (QObject *child, q->children()) { - if (child != reply && child->inherits("QNetworkReplyImpl")) { - QNetworkReplyImpl *replyImpl = qobject_cast(child); - qDebug() << "reply state is" << replyImpl->d_func()->state; - switch (replyImpl->d_func()->state) { - case QNetworkReplyImplPrivate::Idle: - case QNetworkReplyImplPrivate::Finished: - case QNetworkReplyImplPrivate::Aborted: - break; - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: - repliesPending = true; - break; - } + if (child == reply) + continue; + + QNetworkReplyImpl *replyImpl = qobject_cast(child); + if (!replyImpl) + continue; + + QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; + if (state == QNetworkReplyImplPrivate::Buffering || + state == QNetworkReplyImplPrivate::Working) { + return; } } - if (!repliesPending) { - deferredMigration = false; - qDebug() << "Migrating as there are no pending replies."; - session->migrate(); - } + + deferredMigration = false; + qDebug() << "Migrating as there are no pending replies."; + session->migrate(); } } @@ -1108,8 +1104,6 @@ void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) { - Q_Q(QNetworkAccessManager); - qDebug() << "session state changed to" << state; } @@ -1144,32 +1138,25 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() } } -void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless) +void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { Q_Q(QNetworkAccessManager); - deferredMigration = false; foreach (QObject *child, q->children()) { - if (child->inherits("QNetworkReplyImpl")) { - QNetworkReplyImpl *replyImpl = qobject_cast(child); - qDebug() << "reply state is" << replyImpl->d_func()->state; - switch (replyImpl->d_func()->state) { - case QNetworkReplyImplPrivate::Idle: - case QNetworkReplyImplPrivate::Finished: - case QNetworkReplyImplPrivate::Aborted: - break; - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: + QNetworkReplyImpl *replyImpl = qobject_cast(child); + if (replyImpl) { + QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; + if (state == QNetworkReplyImplPrivate::Buffering || + state == QNetworkReplyImplPrivate::Working) { deferredMigration = true; - break; + return; } } } - if (!deferredMigration) { - qDebug() << "Migrating as there are no pending replies."; - session->migrate(); - } + deferredMigration = false; + qDebug() << "Migrating as there are no pending replies."; + session->migrate(); } QT_END_NAMESPACE -- cgit v0.12 From 392123ef5432643d1047d1e1dd71512ec39d382d Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 3 Feb 2010 13:27:43 +0100 Subject: Fixed bug where GL widget was not fully updated on Vista. There were cases where the QGLWidget would not be fully updated on screen on Windows Vista and Windows 7 with Aero disabled. Task-number: QTBUG-7865 Reviewed-by: Prasanth --- src/gui/kernel/qapplication_win.cpp | 28 +++++++++++++++++++--------- src/gui/kernel/qwidget.cpp | 2 +- src/gui/kernel/qwidget_p.h | 2 +- src/opengl/qgl_mac.mm | 2 -- src/opengl/qgl_p.h | 4 +++- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 5a4f4e6..d0c986d 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -927,7 +927,11 @@ const QString qt_reg_winclass(QWidget *w) // register window class uint style; bool icon; QString cname; - if (flags & Qt::MSWindowsOwnDC) { + if (qt_widget_private(w)->isGLWidget) { + cname = QLatin1String("QGLWidget"); + style = CS_DBLCLKS; + icon = true; + } else if (flags & Qt::MSWindowsOwnDC) { cname = QLatin1String("QWidgetOwnDC"); style = CS_DBLCLKS; #ifndef Q_OS_WINCE @@ -1011,7 +1015,7 @@ const QString qt_reg_winclass(QWidget *w) // register window class ATOM atom; #ifndef Q_OS_WINCE - HBRUSH bgBrush = (HBRUSH)GetSysColorBrush(COLOR_WINDOW); + HBRUSH bgBrush = qt_widget_private(w)->isGLWidget ? 0 : (HBRUSH)GetSysColorBrush(COLOR_WINDOW); QT_WA({ WNDCLASS wc; wc.style = style; @@ -3626,13 +3630,19 @@ bool QETWidget::translatePaintEvent(const MSG &msg) return true; setAttribute(Qt::WA_PendingUpdate, false); - const QRegion dirtyInBackingStore(qt_dirtyRegion(this)); - // Make sure the invalidated region contains the region we're about to repaint. - // BeginPaint will set the clip to the invalidated region and it is impossible - // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient - // as it may return an invalid context (especially on Windows Vista). - if (!dirtyInBackingStore.isEmpty()) - InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false); + + if (d_func()->isGLWidget) { + if (d_func()->usesDoubleBufferedGLContext) + InvalidateRect(internalWinId(), 0, false); + } else { + const QRegion dirtyInBackingStore(qt_dirtyRegion(this)); + // Make sure the invalidated region contains the region we're about to repaint. + // BeginPaint will set the clip to the invalidated region and it is impossible + // to enlarge it afterwards (only shrink it). Using GetDCEx is not suffient + // as it may return an invalid context (especially on Windows Vista). + if (!dirtyInBackingStore.isEmpty()) + InvalidateRgn(internalWinId(), dirtyInBackingStore.handle(), false); + } PAINTSTRUCT ps; d_func()->hd = BeginPaint(internalWinId(), &ps); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 91e43ce..e8ec3a5 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -183,6 +183,7 @@ QWidgetPrivate::QWidgetPrivate(int version) : ,inDirtyList(0) ,isScrolled(0) ,isMoved(0) + , isGLWidget(0) ,usesDoubleBufferedGLContext(0) #ifdef Q_WS_WIN ,noPaintOnScreen(0) @@ -194,7 +195,6 @@ QWidgetPrivate::QWidgetPrivate(int version) : #endif #ifdef Q_WS_MAC ,needWindowChange(0) - ,isGLWidget(0) #endif ,polished(0) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 2b09220..ee56bb2 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -537,6 +537,7 @@ public: uint inDirtyList : 1; uint isScrolled : 1; uint isMoved : 1; + uint isGLWidget : 1; uint usesDoubleBufferedGLContext : 1; #ifdef Q_WS_WIN @@ -593,7 +594,6 @@ public: // This is new stuff uint needWindowChange : 1; - uint isGLWidget : 1; #endif #if defined(Q_WS_X11) || defined (Q_WS_WIN) || defined(Q_WS_MAC) diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index dd9d9ff..3329ff9 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -882,8 +882,6 @@ void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget) break; current = current->parentWidget(); } - - isGLWidget = 1; } bool QGLWidgetPrivate::renderCxPm(QPixmap*) diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 793c4d7..56fe11f 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -160,7 +160,9 @@ public: #if defined(Q_WS_X11) && defined(QT_OPENGL_ES) , eglSurfaceWindowId(0) #endif - {} + { + isGLWidget = 1; + } ~QGLWidgetPrivate() {} -- cgit v0.12 From 68d510148615b5fb4d3b6ce5faa516c110c53d58 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Feb 2010 09:16:19 +1000 Subject: Only create session when valid configuration is available. Only create a network session when a valid configuration is available. Don't execute session code if a network session has not been created. --- src/network/access/qnetworkaccessbackend.cpp | 5 +++ src/network/access/qnetworkaccessmanager.cpp | 63 +++++++++++++++++++--------- src/network/access/qnetworkaccessmanager_p.h | 2 + src/network/access/qnetworkreplyimpl.cpp | 16 ++++--- 4 files changed, 62 insertions(+), 24 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index bab6d14..0bfeb3b 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -349,6 +349,11 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { + if (!manager->session) { + open(); + return true; + } + // This is not ideal. const QString host = reply->url.host(); if (host == QLatin1String("localhost") || diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 4e28641..e17beb9 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -350,18 +350,7 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) ensureInitialized(); QNetworkConfigurationManager manager; - d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); - - connect(d_func()->session, SIGNAL(opened()), this, SLOT(_q_sessionOpened())); - connect(d_func()->session, SIGNAL(closed()), this, SLOT(_q_sessionClosed())); - connect(d_func()->session, SIGNAL(stateChanged(QNetworkSession::State)), - this, SLOT(_q_sessionStateChanged(QNetworkSession::State))); - connect(d_func()->session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(_q_sessionError(QNetworkSession::SessionError))); - connect(d_func()->session, SIGNAL(newConfigurationActivated()), - this, SLOT(_q_sessionNewConfigurationActivated())); - connect(d_func()->session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), - this, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); + d_func()->createSession(manager.defaultConfiguration()); } /*! @@ -689,8 +678,7 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ */ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config) { - delete d_func()->session; - d_func()->session = new QNetworkSession(config, this); + d_func()->createSession(config); } /*! @@ -702,7 +690,12 @@ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config */ QNetworkConfiguration QNetworkAccessManager::configuration() const { - return d_func()->session->configuration(); + Q_D(const QNetworkAccessManager); + + if (d->session) + return d->session->configuration(); + else + return QNetworkConfiguration(); } /*! @@ -714,11 +707,16 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const */ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const { - QNetworkConfigurationManager manager; + Q_D(const QNetworkAccessManager); - return manager.configurationFromIdentifier( - d_func()->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + if (d->session) { + QNetworkConfigurationManager manager; + return manager.configurationFromIdentifier( + d->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + } else { + return QNetworkConfiguration(); + } } /*! @@ -800,11 +798,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera void QNetworkAccessManagerPrivate::_q_replyFinished() { Q_Q(QNetworkAccessManager); + QNetworkReply *reply = qobject_cast(q->sender()); if (reply) emit q->finished(reply); - if (deferredMigration) { + if (session && deferredMigration) { foreach (QObject *child, q->children()) { if (child == reply) continue; @@ -1076,6 +1075,32 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { } +void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config) +{ + Q_Q(QNetworkAccessManager); + + if (session) + delete session; + + if (!config.isValid()) { + session = 0; + return; + } + + session = new QNetworkSession(config, q); + + QObject::connect(session, SIGNAL(opened()), q, SLOT(_q_sessionOpened())); + QObject::connect(session, SIGNAL(closed()), q, SLOT(_q_sessionClosed())); + QObject::connect(session, SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_sessionStateChanged(QNetworkSession::State))); + QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), + q, SLOT(_q_sessionError(QNetworkSession::SessionError))); + QObject::connect(session, SIGNAL(newConfigurationActivated()), + q, SLOT(_q_sessionNewConfigurationActivated())); + QObject::connect(session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + q, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); +} + void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index b9e3964..92b2782 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -108,6 +108,8 @@ public: emit q->debugMessage(message); } + void createSession(const QNetworkConfiguration &config); + void _q_sessionOpened(); void _q_sessionClosed(); void _q_sessionError(QNetworkSession::SessionError error); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index fbe90ef..72c378a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -89,13 +89,18 @@ void QNetworkReplyImplPrivate::_q_startOperation() // state changes. state = WaitingForSession; - if (!manager->d_func()->session->isOpen()) - manager->d_func()->session->open(); + QNetworkSession *session = manager->d_func()->session; + + if (session) { + if (!session->isOpen()) + session->open(); + } else { + qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); + } return; } - //backend->open(); if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) pendingNotifications.append(NotifyDownstreamReadyWrite); @@ -516,8 +521,9 @@ void QNetworkReplyImplPrivate::finished() pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (state == Working && errorCode != QNetworkReply::OperationCanceledError && - manager->d_func()->session->state() == QNetworkSession::Roaming) { + QNetworkSession *session = manager->d_func()->session; + if (session && session->state() == QNetworkSession::Roaming && + state == Working && errorCode != QNetworkReply::OperationCanceledError) { // only content with a known size will fail with a temporary network failure error if (!totalSize.isNull()) { qDebug() << "Connection broke during download."; -- cgit v0.12 From dc5350f9325eb0daef6550e7a6ff14a82d030d63 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Feb 2010 16:55:05 +1000 Subject: Migrate in progress http downloads. --- src/network/access/qnetworkaccessbackend_p.h | 1 + src/network/access/qnetworkaccessmanager.cpp | 18 ++++++- src/network/access/qnetworkreplyimpl.cpp | 70 +++++++++++++++++++++++++++- src/network/access/qnetworkreplyimpl_p.h | 6 ++- 4 files changed, 91 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index b8b369f..830ec7e 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -192,6 +192,7 @@ private: friend class QNetworkAccessManager; friend class QNetworkAccessManagerPrivate; friend class QNetworkAccessBackendUploadIODevice; + friend class QNetworkReplyImplPrivate; QNetworkAccessManagerPrivate *manager; QNetworkReplyImplPrivate *reply; }; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e17beb9..617e398 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1155,11 +1155,25 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() qDebug() << "Accepting new configuration."; session->accept(); - // start waiting children foreach (QObject *child, q->children()) { QNetworkReplyImpl *reply = qobject_cast(child); - if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) + if (!reply) + continue; + + switch (reply->d_func()->state) { + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + case QNetworkReplyImplPrivate::Reconnecting: + // Migrate existing downloads to new configuration. + reply->d_func()->migrateBackend(); + break; + case QNetworkReplyImplPrivate::WaitingForSession: + // Start waiting requests. QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); + break; + default: + qDebug() << "How do we handle replies in state" << reply->d_func()->state; + } } } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 72c378a..932d81a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -58,7 +58,7 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() copyDevice(0), cacheEnabled(false), cacheSaveDevice(0), notificationHandlingPaused(false), - bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), + bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), preMigrationDownloaded(-1), httpStatusCode(0), state(Idle) { @@ -152,6 +152,8 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() lastBytesDownloaded = bytesDownloaded; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (preMigrationDownloaded != Q_INT64_C(-1)) + totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); emit q->downloadProgress(bytesDownloaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); @@ -475,6 +477,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) QPointer qq = q; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (preMigrationDownloaded != Q_INT64_C(-1)) + totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); emit q->downloadProgress(bytesDownloaded, totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong()); @@ -521,6 +525,8 @@ void QNetworkReplyImplPrivate::finished() pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (preMigrationDownloaded != Q_INT64_C(-1)) + totalSize = totalSize.toLongLong() + preMigrationDownloaded; QNetworkSession *session = manager->d_func()->session; if (session && session->state() == QNetworkSession::Roaming && state == Working && errorCode != QNetworkReply::OperationCanceledError) { @@ -768,6 +774,68 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } +void QNetworkReplyImplPrivate::migrateBackend() +{ + Q_Q(QNetworkReplyImpl); + + if (state == QNetworkReplyImplPrivate::Finished || + state == QNetworkReplyImplPrivate::Aborted) { + qDebug() << "Network reply is already finished/aborted."; + return; + } + + if (!qobject_cast(backend)) { + qDebug() << "Resume only support by http backend, not migrating."; + return; + } + + if (outgoingData) { + qDebug() << "Request has outgoing data, not migrating."; + return; + } + + qDebug() << "Need to check for only cacheable content."; + + // stop both upload and download + if (outgoingData) + outgoingData->disconnect(q); + if (copyDevice) + copyDevice->disconnect(q); + + state = QNetworkReplyImplPrivate::Reconnecting; + + if (backend) { + backend->deleteLater(); + backend = 0; + } + + RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); + if (it == rawHeaders.constEnd() || it->second == "none") { + qDebug() << "Range header not supported by server/resource."; + qFatal("Should fail with TemporaryNetworkFailure."); + } + + cookedHeaders.clear(); + rawHeaders.clear(); + + preMigrationDownloaded = bytesDownloaded; + + request.setRawHeader("Range", "bytes=" + QByteArray::number(preMigrationDownloaded) + '-'); + + backend = manager->d_func()->findBackend(operation, request); + + if (backend) { + backend->setParent(q); + backend->reply = this; + } + + if (qobject_cast(backend)) { + _q_startOperation(); + } else { + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + } +} + QT_END_NAMESPACE #include "moc_qnetworkreplyimpl_p.cpp" diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 861b2b2..9de16e6 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -115,7 +115,8 @@ public: Working, Finished, Aborted, - WaitingForSession + WaitingForSession, + Reconnecting }; typedef QQueue NotificationQueue; @@ -162,6 +163,8 @@ public: QIODevice *copyDevice; QAbstractNetworkCache *networkCache() const; + void migrateBackend(); + bool cacheEnabled; QIODevice *cacheSaveDevice; @@ -178,6 +181,7 @@ public: qint64 bytesDownloaded; qint64 lastBytesDownloaded; qint64 bytesUploaded; + qint64 preMigrationDownloaded; QString httpReasonPhrase; int httpStatusCode; -- cgit v0.12 From df4b88078124fe993795bd436f3093b0120ffce2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 4 Feb 2010 16:57:47 +1000 Subject: Add hooks for testing. --- src/network/access/qnetworkreply.h | 2 ++ src/network/access/qnetworkreplyimpl.cpp | 7 +++++++ src/network/access/qnetworkreplyimpl_p.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index b39557a..0f1fe8a 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -138,6 +138,8 @@ public: void ignoreSslErrors(const QList &errors); #endif + virtual void migrateBackend() { qWarning("Your backend doesn't support migration!"); } // Testing + public Q_SLOTS: virtual void ignoreSslErrors(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 932d81a..0c7aca8 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -774,6 +774,13 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } +void QNetworkReplyImpl::migrateBackend() +{ + Q_D(QNetworkReplyImpl); + + d->migrateBackend(); +} + void QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 9de16e6..ac82ca0 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -92,6 +92,8 @@ public: Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList &errors); #endif + void migrateBackend(); + Q_DECLARE_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) -- cgit v0.12 From a307e9662c2b57ad16c2329754ea4795615de125 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 5 Feb 2010 10:51:25 +1000 Subject: Remove implementation specific functions out of QNetworkSessionEngine. --- src/network/bearer/qnetworksessionengine_p.h | 19 +----- src/plugins/bearer/corewlan/corewlan.pro | 3 +- src/plugins/bearer/corewlan/qcorewlanengine.h | 6 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 4 +- src/plugins/bearer/generic/generic.pro | 1 + src/plugins/bearer/generic/qgenericengine.cpp | 14 +--- src/plugins/bearer/generic/qgenericengine.h | 6 +- src/plugins/bearer/nativewifi/nativewifi.pro | 4 +- .../bearer/nativewifi/qnativewifiengine.cpp | 4 +- src/plugins/bearer/nativewifi/qnativewifiengine.h | 6 +- .../bearer/networkmanager/networkmanager.pro | 3 +- .../networkmanager/qnetworkmanagerengine.cpp | 4 +- .../bearer/networkmanager/qnetworkmanagerengine.h | 6 +- src/plugins/bearer/nla/nla.pro | 4 +- src/plugins/bearer/nla/qnlaengine.cpp | 4 +- src/plugins/bearer/nla/qnlaengine.h | 7 +- src/plugins/bearer/qnetworksession_impl.cpp | 34 ++++------ src/plugins/bearer/qnetworksession_impl.h | 11 ++-- src/plugins/bearer/qnetworksessionengine_impl.h | 77 ++++++++++++++++++++++ src/plugins/bearer/symbian/symbianengine.cpp | 24 +------ src/plugins/bearer/symbian/symbianengine.h | 8 +-- 21 files changed, 137 insertions(+), 112 deletions(-) create mode 100644 src/plugins/bearer/qnetworksessionengine_impl.h diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 029c2c5..39c3d17 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -73,28 +73,13 @@ class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject Q_OBJECT public: - enum ConnectionError { - InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, - }; - QNetworkSessionEngine(QObject *parent = 0); virtual ~QNetworkSessionEngine(); - virtual QString getInterfaceFromId(const QString &id) = 0; virtual bool hasIdentifier(const QString &id) = 0; - //virtual QString bearerName(const QString &id) = 0; - - virtual void connectToId(const QString &id) = 0; - virtual void disconnectFromId(const QString &id) = 0; - virtual void requestUpdate() = 0; - virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; - virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; virtual QNetworkSessionPrivate *createSessionBackend() = 0; @@ -115,8 +100,6 @@ Q_SIGNALS: void configurationChanged(QNetworkConfigurationPrivatePointer config); void updateCompleted(); - - void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); }; typedef QNetworkSessionEngine QBearerEngine; diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 1660215..c59d602 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -12,7 +12,8 @@ contains(QT_CONFIG, corewlan) { } HEADERS += qcorewlanengine.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h SOURCES += main.cpp \ qcorewlanengine.mm \ diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 61d80cf..7199ace 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #ifndef QCOREWLANENGINE_H #define QCOREWLANENGINE_H -#include +#include "../qnetworksessionengine_impl.h" #include #include @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; -class QCoreWlanEngine : public QNetworkSessionEngine +class QCoreWlanEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 2cbccb5..ca193ab 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -106,7 +106,7 @@ static QString qGetInterfaceType(const QString &interfaceString) } QCoreWlanEngine::QCoreWlanEngine(QObject *parent) -: QNetworkSessionEngine(parent) +: QNetworkSessionEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index d039731..dbf96d1 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -5,6 +5,7 @@ QT += network HEADERS += qgenericengine.h \ ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h \ ../platformdefs_win.h SOURCES += qgenericengine.cpp \ ../qnetworksession_impl.cpp \ diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 55d1ae4..dea820d 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) } QGenericEngine::QGenericEngine(QObject *parent) -: QNetworkSessionEngine(parent) +: QNetworkSessionEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); @@ -162,16 +162,6 @@ bool QGenericEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id); } -/*QString QGenericEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QLatin1String("Unknown"); - - return qGetInterfaceType(interface); -}*/ - void QGenericEngine::connectToId(const QString &id) { emit connectionError(id, OperationNotSupported); diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index b44685b..d755228 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #ifndef QGENERICENGINE_H #define QGENERICENGINE_H -#include +#include "../qnetworksessionengine_impl.h" #include #include @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class QNetworkSessionPrivate; -class QGenericEngine : public QNetworkSessionEngine +class QGenericEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 6e99c62..928d819 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -5,7 +5,9 @@ QT += network HEADERS += qnativewifiengine.h \ platformdefs.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h + SOURCES += main.cpp \ qnativewifiengine.cpp \ ../qnetworksession_impl.cpp diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index af538a8..9f0d4c0 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -77,7 +77,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) } QNativeWifiEngine::QNativeWifiEngine(QObject *parent) -: QNetworkSessionEngine(parent), handle(0) +: QNetworkSessionEngineImpl(parent), handle(0) { DWORD clientVersion; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 83d9e2c..41217e2 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,7 +53,7 @@ // We mean it. // -#include +#include "../qnetworksessionengine_impl.h" #include @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; struct WLAN_NOTIFICATION_DATA; -class QNativeWifiEngine : public QNetworkSessionEngine +class QNativeWifiEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 2050125..6f271c6 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -8,7 +8,8 @@ DEFINES += BACKEND_NM HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ qnetworkmanagerengine.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h SOURCES += main.cpp \ qnmdbushelper.cpp \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 439772a..129f7d2 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) -: QNetworkSessionEngine(parent), +: QNetworkSessionEngineImpl(parent), interface(new QNetworkManagerInterface(this)), systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 5f8110c..f454628 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,7 +53,7 @@ // We mean it. // -#include +#include "../qnetworksessionengine_impl.h" #include "qnetworkmanagerservice.h" @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QNetworkManagerEngine : public QNetworkSessionEngine +class QNetworkManagerEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 9bd3526..4c5e492 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -11,7 +11,9 @@ QT += network HEADERS += qnlaengine.h \ ../platformdefs_win.h \ - ../qnetworksession_impl.h + ../qnetworksession_impl.h \ + ../qnetworksessionengine_impl.h + SOURCES += main.cpp \ qnlaengine.cpp \ ../qnetworksession_impl.cpp diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 0ed62e3..ed802c0 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -506,7 +506,7 @@ void QNlaThread::fetchConfigurations() } QNlaEngine::QNlaEngine(QObject *parent) -: QNetworkSessionEngine(parent), nlaThread(0) +: QNetworkSessionEngineImpl(parent), nlaThread(0) { nlaThread = new QNlaThread(this); connect(nlaThread, SIGNAL(networksChanged()), diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 515a13c..fa010b9 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,7 +53,8 @@ // We mean it. // -#include +#include "../qnetworksessionengine_impl.h" + #include #include @@ -71,7 +72,7 @@ public: int version; }; -class QNlaEngine : public QNetworkSessionEngine +class QNlaEngine : public QNetworkSessionEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index a826fd6..6de3423 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,9 +40,9 @@ ****************************************************************************/ #include "qnetworksession_impl.h" +#include "qnetworksessionengine_impl.h" #include -#include #include #include @@ -53,13 +53,14 @@ QT_BEGIN_NAMESPACE -static QNetworkSessionEngine *getEngineFromId(const QString &id) +static QNetworkSessionEngineImpl *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { - if (engine->hasIdentifier(id)) - return engine; + QNetworkSessionEngineImpl *engineImpl = qobject_cast(engine); + if (engineImpl && engineImpl->hasIdentifier(id)) + return engineImpl; } return 0; @@ -110,8 +111,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; - qRegisterMetaType - ("QNetworkSessionEngine::ConnectionError"); + qRegisterMetaType + ("QNetworkSessionEngineImpl::ConnectionError"); switch (publicConfig.type()) { case QNetworkConfiguration::InternetAccessPoint: @@ -239,14 +240,6 @@ void QNetworkSessionPrivateImpl::setSessionProperty(const QString& /*key*/, cons { } -/*QString QNetworkSessionPrivateImpl::bearerName() const -{ - if (!publicConfig.isValid() || !engine) - return QString(); - - return engine->bearerName(activeConfig.identifier()); -}*/ - QString QNetworkSessionPrivateImpl::errorString() const { switch (lastError) { @@ -414,18 +407,19 @@ void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration } } -void QNetworkSessionPrivateImpl::connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error) +void QNetworkSessionPrivateImpl::connectionError(const QString &id, + QNetworkSessionEngineImpl::ConnectionError error) { if (activeConfig.identifier() == id) { networkConfigurationsChanged(); switch (error) { - case QNetworkSessionEngine::OperationNotSupported: + case QNetworkSessionEngineImpl::OperationNotSupported: lastError = QNetworkSession::OperationNotSupportedError; opened = false; break; - case QNetworkSessionEngine::InterfaceLookupError: - case QNetworkSessionEngine::ConnectError: - case QNetworkSessionEngine::DisconnectionError: + case QNetworkSessionEngineImpl::InterfaceLookupError: + case QNetworkSessionEngineImpl::ConnectError: + case QNetworkSessionEngineImpl::DisconnectionError: default: lastError = QNetworkSession::UnknownSessionError; } diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 104d1f0..1fd97d3 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -53,15 +53,16 @@ // We mean it. // +#include "qnetworksessionengine_impl.h" + #include -#include #include #include QT_BEGIN_NAMESPACE -class QNetworkSessionEngine; +class QNetworkSessionEngineImpl; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { @@ -109,7 +110,7 @@ private Q_SLOTS: void networkConfigurationsChanged(); void configurationChanged(const QNetworkConfiguration &config); void forcedSessionClose(const QNetworkConfiguration &config); - void connectionError(const QString &id, QNetworkSessionEngine::ConnectionError error); + void connectionError(const QString &id, QNetworkSessionEngineImpl::ConnectionError error); private: QNetworkConfigurationManager manager; @@ -120,7 +121,7 @@ private: bool opened; - QNetworkSessionEngine *engine; + QNetworkSessionEngineImpl *engine; QNetworkSession::SessionError lastError; diff --git a/src/plugins/bearer/qnetworksessionengine_impl.h b/src/plugins/bearer/qnetworksessionengine_impl.h new file mode 100644 index 0000000..1294cc5 --- /dev/null +++ b/src/plugins/bearer/qnetworksessionengine_impl.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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 plugins 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 QNETWORKSESSIONENGINE_IMPL_H +#define QNETWORKSESSIONENGINE_IMPL_H + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkSessionEngineImpl : public QNetworkSessionEngine +{ + Q_OBJECT + +public: + enum ConnectionError { + InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, + }; + + QNetworkSessionEngineImpl(QObject *parent = 0) : QNetworkSessionEngine(parent) { } + ~QNetworkSessionEngineImpl() { } + + virtual void connectToId(const QString &id) = 0; + virtual void disconnectFromId(const QString &id) = 0; + + virtual QString getInterfaceFromId(const QString &id) = 0; + + virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + +Q_SIGNALS: + void connectionError(const QString &id, ConnectionError error); +}; + +QT_END_NAMESPACE + +#endif // QNETWORKSESSIONENGINE_IMPL_H diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index f5c5007..3d0ec0f 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -156,12 +156,6 @@ SymbianEngine::~SymbianEngine() delete ipCommsDB; } -QString SymbianEngine::getInterfaceFromId(const QString &id) -{ - qFatal("getInterfaceFromId(%s) not implemented\n", qPrintable(id)); - return QString(); -} - bool SymbianEngine::hasIdentifier(const QString &id) { return accessPointConfigurations.contains(id) || @@ -169,22 +163,6 @@ bool SymbianEngine::hasIdentifier(const QString &id) userChoiceConfigurations.contains(id); } -void SymbianEngine::connectToId(const QString &id) -{ - qFatal("connectToId(%s) not implemented\n", qPrintable(id)); -} - -void SymbianEngine::disconnectFromId(const QString &id) -{ - qFatal("disconnectFromId(%s) not implemented\n", qPrintable(id)); -} - -QNetworkSession::State SymbianEngine::sessionStateForId(const QString &id) -{ - qFatal("sessionStateForId(%s) not implemented\n", qPrintable(id)); - return QNetworkSession::Invalid; -} - QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const { QNetworkConfigurationManager::Capabilities capFlags; diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index cd5aa43..4a4a8c1 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -106,16 +106,10 @@ public: SymbianEngine(QObject *parent = 0); virtual ~SymbianEngine(); - QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - void connectToId(const QString &id); - void disconnectFromId(const QString &id); - void requestUpdate(); - QNetworkSession::State sessionStateForId(const QString &id); - QNetworkConfigurationManager::Capabilities capabilities() const; QNetworkSessionPrivate *createSessionBackend(); -- cgit v0.12 From b1029a6bd7131d540f76ead8783ed0978f7163aa Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 5 Feb 2010 11:13:05 +1000 Subject: Rename internal QNetworkSessionEngine* to QBearerEngine*. --- src/network/bearer/bearer.pri | 4 +- src/network/bearer/qbearerengine.cpp | 74 ++++++++++++++ src/network/bearer/qbearerengine_p.h | 107 ++++++++++++++++++++ src/network/bearer/qbearerplugin.h | 4 +- src/network/bearer/qnetworkconfigmanager.cpp | 8 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 8 +- src/network/bearer/qnetworkconfigmanager_p.h | 6 +- src/network/bearer/qnetworksession.cpp | 4 +- src/network/bearer/qnetworksessionengine.cpp | 74 -------------- src/network/bearer/qnetworksessionengine_p.h | 109 --------------------- src/plugins/bearer/corewlan/corewlan.pro | 2 +- src/plugins/bearer/corewlan/qcorewlanengine.h | 4 +- src/plugins/bearer/corewlan/qcorewlanengine.mm | 2 +- src/plugins/bearer/generic/generic.pro | 2 +- src/plugins/bearer/generic/qgenericengine.cpp | 2 +- src/plugins/bearer/generic/qgenericengine.h | 4 +- src/plugins/bearer/nativewifi/nativewifi.pro | 2 +- .../bearer/nativewifi/qnativewifiengine.cpp | 2 +- src/plugins/bearer/nativewifi/qnativewifiengine.h | 4 +- .../bearer/networkmanager/networkmanager.pro | 2 +- .../networkmanager/qnetworkmanagerengine.cpp | 2 +- .../bearer/networkmanager/qnetworkmanagerengine.h | 4 +- src/plugins/bearer/nla/nla.pro | 2 +- src/plugins/bearer/nla/qnlaengine.cpp | 2 +- src/plugins/bearer/nla/qnlaengine.h | 4 +- src/plugins/bearer/qbearerengine_impl.h | 77 +++++++++++++++ src/plugins/bearer/qnetworksession_impl.cpp | 34 +++---- src/plugins/bearer/qnetworksession_impl.h | 8 +- src/plugins/bearer/qnetworksessionengine_impl.h | 77 --------------- src/plugins/bearer/symbian/symbianengine.cpp | 2 +- src/plugins/bearer/symbian/symbianengine.h | 4 +- 31 files changed, 319 insertions(+), 321 deletions(-) create mode 100644 src/network/bearer/qbearerengine.cpp create mode 100644 src/network/bearer/qbearerengine_p.h delete mode 100644 src/network/bearer/qnetworksessionengine.cpp delete mode 100644 src/network/bearer/qnetworksessionengine_p.h create mode 100644 src/plugins/bearer/qbearerengine_impl.h delete mode 100644 src/plugins/bearer/qnetworksessionengine_impl.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 66b0ca4..14e7c0c 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -40,11 +40,11 @@ maemo { HEADERS += bearer/qnetworkconfigmanager_p.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ - bearer/qnetworksessionengine_p.h \ + bearer/qbearerengine_p.h \ bearer/qbearerplugin.h SOURCES += bearer/qnetworkconfigmanager_p.cpp \ - bearer/qnetworksessionengine.cpp \ + bearer/qbearerengine.cpp \ bearer/qbearerplugin.cpp contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp new file mode 100644 index 0000000..4d56047 --- /dev/null +++ b/src/network/bearer/qbearerengine.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qbearerengine_p.h" + +QT_BEGIN_NAMESPACE + +QBearerEngine::QBearerEngine(QObject *parent) +: QObject(parent) +{ +} + +QBearerEngine::~QBearerEngine() +{ + foreach (const QString &oldIface, snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + foreach (const QString &oldIface, accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } + + foreach (const QString &oldIface, userChoiceConfigurations.keys()) { + QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); + priv->isValid = false; + priv->id.clear(); + } +} + +#include "moc_qbearerengine_p.cpp" + +QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h new file mode 100644 index 0000000..7e96877 --- /dev/null +++ b/src/network/bearer/qbearerengine_p.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEARERENGINE_P_H +#define QBEARERENGINE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qnetworkconfiguration_p.h" +#include "qnetworksession.h" +#include "qnetworkconfigmanager.h" + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfiguration; + +class Q_NETWORK_EXPORT QBearerEngine : public QObject +{ + Q_OBJECT + +public: + QBearerEngine(QObject *parent = 0); + virtual ~QBearerEngine(); + + virtual bool hasIdentifier(const QString &id) = 0; + + virtual void requestUpdate() = 0; + + virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; + + virtual QNetworkSessionPrivate *createSessionBackend() = 0; + + virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; + +public: + //this table contains an up to date list of all configs at any time. + //it must be updated if configurations change, are added/removed or + //the members of ServiceNetworks change + QHash accessPointConfigurations; + QHash snapConfigurations; + QHash userChoiceConfigurations; + +Q_SIGNALS: + void configurationAdded(QNetworkConfigurationPrivatePointer config); + void configurationRemoved(QNetworkConfigurationPrivatePointer config); + void configurationChanged(QNetworkConfigurationPrivatePointer config); + + void updateCompleted(); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h index 970410b..1958188 100644 --- a/src/network/bearer/qbearerplugin.h +++ b/src/network/bearer/qbearerplugin.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #ifndef QBEARERPLUGIN_H #define QBEARERPLUGIN_H -#include +#include "qbearerengine_p.h" #include #include diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index f4daf4a..d46048b 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -42,7 +42,7 @@ #include "qnetworkconfigmanager.h" #include "qnetworkconfigmanager_p.h" -#include "qnetworksessionengine_p.h" +#include "qbearerengine_p.h" #include @@ -232,7 +232,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe QList result; QNetworkConfigurationManagerPrivate* conPriv = connManager(); - foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + foreach (QBearerEngine *engine, conPriv->sessionEngines) { QStringList cpsIdents = engine->accessPointConfigurations.keys(); //find all InternetAccessPoints @@ -274,7 +274,7 @@ QNetworkConfiguration QNetworkConfigurationManager::configurationFromIdentifier( QNetworkConfiguration item; - foreach (QNetworkSessionEngine *engine, conPriv->sessionEngines) { + foreach (QBearerEngine *engine, conPriv->sessionEngines) { if (engine->accessPointConfigurations.contains(identifier)) item.d = engine->accessPointConfigurations.value(identifier); else if (engine->snapConfigurations.contains(identifier)) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index bc3cfbd..a94fd2f 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -176,7 +176,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() foreach (const QString &key, l->keys()) { QBearerEnginePlugin *plugin = qobject_cast(l->instance(key)); if (plugin) { - QNetworkSessionEngine *engine = plugin->create(key); + QBearerEngine *engine = plugin->create(key); if (!engine) continue; @@ -195,7 +195,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } } - QNetworkSessionEngine *engine = qobject_cast(sender()); + QBearerEngine *engine = qobject_cast(sender()); if (!updatingEngines.isEmpty() && engine) { int index = sessionEngines.indexOf(engine); if (index >= 0) @@ -219,7 +219,7 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - foreach (QNetworkSessionEngine *engine, sessionEngines) { + foreach (QBearerEngine *engine, sessionEngines) { QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); if (ptr) { diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 4ef1f09..f6603ce 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -class QNetworkSessionEngine; +class QBearerEngine; class QNetworkConfigurationManagerPrivate : public QObject { @@ -96,7 +96,7 @@ private: void abort(); public: - QList sessionEngines; + QList sessionEngines; private: QSet onlineConfigurations; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index c00921f..ba50ed6 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -43,7 +43,7 @@ #include #include "qnetworksession.h" -#include "qnetworksessionengine_p.h" +#include "qbearerengine_p.h" #include "qnetworkconfigmanager_p.h" #if Q_WS_MAEMO_6 @@ -228,7 +228,7 @@ QT_BEGIN_NAMESPACE QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) : QObject(parent), d(0) { - foreach (QNetworkSessionEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { + foreach (QBearerEngine *engine, qNetworkConfigurationManagerPrivate()->sessionEngines) { if (engine->hasIdentifier(connectionConfig.identifier())) { d = engine->createSessionBackend(); d->q = this; diff --git a/src/network/bearer/qnetworksessionengine.cpp b/src/network/bearer/qnetworksessionengine.cpp deleted file mode 100644 index 0744add..0000000 --- a/src/network/bearer/qnetworksessionengine.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworksessionengine_p.h" - -QT_BEGIN_NAMESPACE - -QNetworkSessionEngine::QNetworkSessionEngine(QObject *parent) -: QObject(parent) -{ -} - -QNetworkSessionEngine::~QNetworkSessionEngine() -{ - foreach (const QString &oldIface, snapConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - foreach (const QString &oldIface, accessPointConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - foreach (const QString &oldIface, userChoiceConfigurations.keys()) { - QNetworkConfigurationPrivatePointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } -} - -#include "moc_qnetworksessionengine_p.cpp" -QT_END_NAMESPACE - diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h deleted file mode 100644 index 39c3d17..0000000 --- a/src/network/bearer/qnetworksessionengine_p.h +++ /dev/null @@ -1,109 +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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONENGINE_P_H -#define QNETWORKSESSIONENGINE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qnetworkconfiguration_p.h" -#include "qnetworksession.h" -#include "qnetworkconfigmanager.h" - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfiguration; - -class Q_NETWORK_EXPORT QNetworkSessionEngine : public QObject -{ - Q_OBJECT - -public: - QNetworkSessionEngine(QObject *parent = 0); - virtual ~QNetworkSessionEngine(); - - virtual bool hasIdentifier(const QString &id) = 0; - - virtual void requestUpdate() = 0; - - virtual QNetworkConfigurationManager::Capabilities capabilities() const = 0; - - virtual QNetworkSessionPrivate *createSessionBackend() = 0; - - virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; - -public: - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash accessPointConfigurations; - QHash snapConfigurations; - QHash userChoiceConfigurations; - -Q_SIGNALS: - void configurationAdded(QNetworkConfigurationPrivatePointer config); - void configurationRemoved(QNetworkConfigurationPrivatePointer config); - void configurationChanged(QNetworkConfigurationPrivatePointer config); - - void updateCompleted(); -}; - -typedef QNetworkSessionEngine QBearerEngine; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index c59d602..50c72b2 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -13,7 +13,7 @@ contains(QT_CONFIG, corewlan) { HEADERS += qcorewlanengine.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qcorewlanengine.mm \ diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 7199ace..54f2027 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -42,7 +42,7 @@ #ifndef QCOREWLANENGINE_H #define QCOREWLANENGINE_H -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include #include @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; -class QCoreWlanEngine : public QNetworkSessionEngineImpl +class QCoreWlanEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index ca193ab..fff65e4 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -106,7 +106,7 @@ static QString qGetInterfaceType(const QString &interfaceString) } QCoreWlanEngine::QCoreWlanEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent) +: QBearerEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index dbf96d1..1d141fd 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -5,7 +5,7 @@ QT += network HEADERS += qgenericengine.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h \ + ../qbearerengine_impl.h \ ../platformdefs_win.h SOURCES += qgenericengine.cpp \ ../qnetworksession_impl.cpp \ diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index dea820d..c6ab4df 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) } QGenericEngine::QGenericEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent) +: QBearerEngineImpl(parent) { connect(&pollTimer, SIGNAL(timeout()), this, SLOT(doRequestUpdate())); pollTimer.setInterval(10000); diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index d755228..cd9a976 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -42,7 +42,7 @@ #ifndef QGENERICENGINE_H #define QGENERICENGINE_H -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include #include @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class QNetworkSessionPrivate; -class QGenericEngine : public QNetworkSessionEngineImpl +class QGenericEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index 928d819..f277a04 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -6,7 +6,7 @@ QT += network HEADERS += qnativewifiengine.h \ platformdefs.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qnativewifiengine.cpp \ diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 9f0d4c0..d88534b 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -77,7 +77,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) } QNativeWifiEngine::QNativeWifiEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent), handle(0) +: QBearerEngineImpl(parent), handle(0) { DWORD clientVersion; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 41217e2..a9a9375 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; struct WLAN_NOTIFICATION_DATA; -class QNativeWifiEngine : public QNetworkSessionEngineImpl +class QNativeWifiEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 6f271c6..5bac121 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -9,7 +9,7 @@ HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ qnetworkmanagerengine.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbearerengine_impl.h SOURCES += main.cpp \ qnmdbushelper.cpp \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 129f7d2..2c550f0 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent), +: QBearerEngineImpl(parent), interface(new QNetworkManagerInterface(this)), systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_SYSTEM_SETTINGS, this)), userSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE_USER_SETTINGS, this)) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index f454628..848f166 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include "qnetworkmanagerservice.h" @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QNetworkManagerEngine : public QNetworkSessionEngineImpl +class QNetworkManagerEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 4c5e492..5ba171e 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -12,7 +12,7 @@ QT += network HEADERS += qnlaengine.h \ ../platformdefs_win.h \ ../qnetworksession_impl.h \ - ../qnetworksessionengine_impl.h + ../qbeaerengine_impl.h SOURCES += main.cpp \ qnlaengine.cpp \ diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index ed802c0..fbfac17 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -506,7 +506,7 @@ void QNlaThread::fetchConfigurations() } QNlaEngine::QNlaEngine(QObject *parent) -: QNetworkSessionEngineImpl(parent), nlaThread(0) +: QBearerEngineImpl(parent), nlaThread(0) { nlaThread = new QNlaThread(this); connect(nlaThread, SIGNAL(networksChanged()), diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index fa010b9..14c5201 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -53,7 +53,7 @@ // We mean it. // -#include "../qnetworksessionengine_impl.h" +#include "../qbearerengine_impl.h" #include @@ -72,7 +72,7 @@ public: int version; }; -class QNlaEngine : public QNetworkSessionEngineImpl +class QNlaEngine : public QBearerEngineImpl { Q_OBJECT diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h new file mode 100644 index 0000000..6fffe27 --- /dev/null +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** 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 plugins 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 QBEARERENGINE_IMPL_H +#define QBEARERENGINE_IMPL_H + +#include + +QT_BEGIN_NAMESPACE + +class QBearerEngineImpl : public QBearerEngine +{ + Q_OBJECT + +public: + enum ConnectionError { + InterfaceLookupError = 0, + ConnectError, + OperationNotSupported, + DisconnectionError, + }; + + QBearerEngineImpl(QObject *parent = 0) : QBearerEngine(parent) { } + ~QBearerEngineImpl() { } + + virtual void connectToId(const QString &id) = 0; + virtual void disconnectFromId(const QString &id) = 0; + + virtual QString getInterfaceFromId(const QString &id) = 0; + + virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + +Q_SIGNALS: + void connectionError(const QString &id, ConnectionError error); +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 6de3423..c823d89 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qnetworksession_impl.h" -#include "qnetworksessionengine_impl.h" +#include "qbearerengine_impl.h" #include #include @@ -53,12 +53,12 @@ QT_BEGIN_NAMESPACE -static QNetworkSessionEngineImpl *getEngineFromId(const QString &id) +static QBearerEngineImpl *getEngineFromId(const QString &id) { QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); - foreach (QNetworkSessionEngine *engine, priv->sessionEngines) { - QNetworkSessionEngineImpl *engineImpl = qobject_cast(engine); + foreach (QBearerEngine *engine, priv->sessionEngines) { + QBearerEngineImpl *engineImpl = qobject_cast(engine); if (engineImpl && engineImpl->hasIdentifier(id)) return engineImpl; } @@ -111,16 +111,16 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; - qRegisterMetaType - ("QNetworkSessionEngineImpl::ConnectionError"); + qRegisterMetaType + ("QBearerEngineImpl::ConnectionError"); switch (publicConfig.type()) { case QNetworkConfiguration::InternetAccessPoint: activeConfig = publicConfig; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), Qt::QueuedConnection); } break; @@ -322,15 +322,15 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() if (activeConfig != config) { if (engine) { - disconnect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError))); + disconnect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngine::ConnectionError))); } activeConfig = config; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QNetworkSessionEngine::ConnectionError)), - this, SLOT(connectionError(QString,QNetworkSessionEngine::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), Qt::QueuedConnection); } emit newConfigurationActivated(); @@ -408,18 +408,18 @@ void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration } void QNetworkSessionPrivateImpl::connectionError(const QString &id, - QNetworkSessionEngineImpl::ConnectionError error) + QBearerEngineImpl::ConnectionError error) { if (activeConfig.identifier() == id) { networkConfigurationsChanged(); switch (error) { - case QNetworkSessionEngineImpl::OperationNotSupported: + case QBearerEngineImpl::OperationNotSupported: lastError = QNetworkSession::OperationNotSupportedError; opened = false; break; - case QNetworkSessionEngineImpl::InterfaceLookupError: - case QNetworkSessionEngineImpl::ConnectError: - case QNetworkSessionEngineImpl::DisconnectionError: + case QBearerEngineImpl::InterfaceLookupError: + case QBearerEngineImpl::ConnectError: + case QBearerEngineImpl::DisconnectionError: default: lastError = QNetworkSession::UnknownSessionError; } diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 1fd97d3..0126a99 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -53,7 +53,7 @@ // We mean it. // -#include "qnetworksessionengine_impl.h" +#include "qbearerengine_impl.h" #include #include @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE -class QNetworkSessionEngineImpl; +class QBearerEngineImpl; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { @@ -110,7 +110,7 @@ private Q_SLOTS: void networkConfigurationsChanged(); void configurationChanged(const QNetworkConfiguration &config); void forcedSessionClose(const QNetworkConfiguration &config); - void connectionError(const QString &id, QNetworkSessionEngineImpl::ConnectionError error); + void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error); private: QNetworkConfigurationManager manager; @@ -121,7 +121,7 @@ private: bool opened; - QNetworkSessionEngineImpl *engine; + QBearerEngineImpl *engine; QNetworkSession::SessionError lastError; diff --git a/src/plugins/bearer/qnetworksessionengine_impl.h b/src/plugins/bearer/qnetworksessionengine_impl.h deleted file mode 100644 index 1294cc5..0000000 --- a/src/plugins/bearer/qnetworksessionengine_impl.h +++ /dev/null @@ -1,77 +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 plugins 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 QNETWORKSESSIONENGINE_IMPL_H -#define QNETWORKSESSIONENGINE_IMPL_H - -#include - -QT_BEGIN_NAMESPACE - -class QNetworkSessionEngineImpl : public QNetworkSessionEngine -{ - Q_OBJECT - -public: - enum ConnectionError { - InterfaceLookupError = 0, - ConnectError, - OperationNotSupported, - DisconnectionError, - }; - - QNetworkSessionEngineImpl(QObject *parent = 0) : QNetworkSessionEngine(parent) { } - ~QNetworkSessionEngineImpl() { } - - virtual void connectToId(const QString &id) = 0; - virtual void disconnectFromId(const QString &id) = 0; - - virtual QString getInterfaceFromId(const QString &id) = 0; - - virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; - -Q_SIGNALS: - void connectionError(const QString &id, ConnectionError error); -}; - -QT_END_NAMESPACE - -#endif // QNETWORKSESSIONENGINE_IMPL_H diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 3d0ec0f..2d0b5ee 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -98,7 +98,7 @@ QString SymbianNetworkConfigurationPrivate::bearerName() const } SymbianEngine::SymbianEngine(QObject *parent) -: QNetworkSessionEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) +: QBearerEngine(parent), CActive(CActive::EPriorityIdle), iInitOk(true) { CActiveScheduler::Add(this); diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 4a4a8c1..587585b 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -42,7 +42,7 @@ #ifndef SYMBIANENGINE_H #define SYMBIANENGINE_H -#include +#include #include #include @@ -97,7 +97,7 @@ inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfiguration return static_cast(ptr.data()); } -class SymbianEngine : public QNetworkSessionEngine, public CActive, +class SymbianEngine : public QBearerEngine, public CActive, public MConnectionMonitorObserver { Q_OBJECT -- cgit v0.12 From c470f8d1523ec974a7f0e1cb61ef13f0e953c500 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 5 Feb 2010 13:59:49 +1000 Subject: Fix Network Manager and CoreWlan config tests. --- config.tests/unix/networkmanager/main.cpp | 5 +++-- config.tests/unix/networkmanager/networkmanager.pro | 4 ---- configure | 4 +++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/config.tests/unix/networkmanager/main.cpp b/config.tests/unix/networkmanager/main.cpp index f8b3d3c..7b91ae0 100644 --- a/config.tests/unix/networkmanager/main.cpp +++ b/config.tests/unix/networkmanager/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -40,8 +40,9 @@ ****************************************************************************/ #if defined(QT_NO_DBUS) -sjkp //error is no QtDBus +#error Qt is not configured with DBus support. #endif + #include int main(int argc, char** argv) diff --git a/config.tests/unix/networkmanager/networkmanager.pro b/config.tests/unix/networkmanager/networkmanager.pro index 686286d..c41204f 100644 --- a/config.tests/unix/networkmanager/networkmanager.pro +++ b/config.tests/unix/networkmanager/networkmanager.pro @@ -1,7 +1,3 @@ SOURCES = main.cpp CONFIG -= qt dylib mac:CONFIG -= app_bundle - -!contains(QT_CONFIG,dbus): { - DEFINES += QT_NO_DBUS -} \ No newline at end of file diff --git a/configure b/configure index 13f58c8..a55e9ee 100755 --- a/configure +++ b/configure @@ -7587,7 +7587,9 @@ fi echo "OpenSSL support ........ $CFG_OPENSSL $OPENSSL_LINKAGE" echo "Alsa support ........... $CFG_ALSA" echo "NetworkManager support . $CFG_NETWORKMANAGER" -echo "CoreWlan support ....... $CFG_COREWLAN" +if [ "$PLATFORM_MAC" = "yes" ]; then + echo "CoreWlan support ....... $CFG_COREWLAN" +fi echo [ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC" -- cgit v0.12 From 10628947d5ab1cfcd571ada10c0eab4b7f1f02ac Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 10:16:34 +1000 Subject: Display session statistics. --- examples/network/bearermonitor/sessionwidget.cpp | 18 ++++++++- examples/network/bearermonitor/sessionwidget.h | 5 ++- examples/network/bearermonitor/sessionwidget.ui | 50 +++++++++++++++++++++++- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index d03c5bf..46ffb20 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -43,7 +43,7 @@ #include "qnetworkconfigmanager.h" SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent) -: QWidget(parent) +: QWidget(parent), statsTimer(-1) { setupUi(this); @@ -75,11 +75,25 @@ SessionWidget::~SessionWidget() delete session; } +void SessionWidget::timerEvent(QTimerEvent *e) +{ + if (e->timerId() == statsTimer) { + rxData->setText(QString::number(session->bytesReceived())); + txData->setText(QString::number(session->bytesWritten())); + activeTime->setText(QString::number(session->activeTime())); + } +} + void SessionWidget::updateSession() { updateSessionState(session->state()); updateSessionError(session->error()); + if (session->state() == QNetworkSession::Connected) + statsTimer = startTimer(1000); + else + killTimer(statsTimer); + if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) bearer->setText(session->configuration().bearerName()); else { diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index 868de3a..cc9c067 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -56,6 +56,8 @@ public: SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0); ~SessionWidget(); + void timerEvent(QTimerEvent *); + private: void updateSessionState(QNetworkSession::State state); void updateSessionError(QNetworkSession::SessionError error); @@ -69,6 +71,7 @@ private Q_SLOTS: private: QNetworkSession *session; + int statsTimer; }; #endif diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui index 65ca43b..45135f5 100644 --- a/examples/network/bearermonitor/sessionwidget.ui +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -7,7 +7,7 @@ 0 0 340 - 286 + 276 @@ -215,6 +215,54 @@ + + + + + 0 + + + Qt::AlignCenter + + + + + + + 0 + + + Qt::AlignCenter + + + + + + + + + + + Active Time: + + + + + + + + 0 + 0 + + + + 0 seconds + + + + + + -- cgit v0.12 From 5096692696b18df82914fc1f63597e00c24fa5d2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 10:45:09 +1000 Subject: Remove remaining Network Manager ifdef'ed code from common code. --- src/network/bearer/bearer.pri | 2 - .../bearer/networkmanager/networkmanager.pro | 2 - .../networkmanager/qnetworkmanagerengine.cpp | 61 +++++++++++++ .../bearer/networkmanager/qnetworkmanagerengine.h | 4 + src/plugins/bearer/qbearerengine_impl.h | 4 + src/plugins/bearer/qnetworksession_impl.cpp | 100 +++------------------ src/plugins/bearer/qnetworksession_impl.h | 13 +-- 7 files changed, 86 insertions(+), 100 deletions(-) diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 14e7c0c..7dc9195 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -46,7 +46,5 @@ maemo { SOURCES += bearer/qnetworkconfigmanager_p.cpp \ bearer/qbearerengine.cpp \ bearer/qbearerplugin.cpp - - contains(QT_CONFIG, networkmanager):DEFINES += BACKEND_NM } diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index 5bac121..bf0d29a 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -3,8 +3,6 @@ include(../../qpluginbase.pri) QT += network dbus -DEFINES += BACKEND_NM - HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ qnetworkmanagerengine.h \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 2c550f0..9a9bdad 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -680,6 +680,67 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i return QNetworkSession::Invalid; } +quint64 QNetworkManagerEngine::bytesWritten(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + const QString networkInterface = getInterfaceFromId(id); + if (!networkInterface.isEmpty()) { + const QString devFile = QLatin1String("/sys/class/net/") + + networkInterface + + QLatin1String("/statistics/tx_bytes"); + + quint64 result = Q_UINT64_C(0); + + QFile tx(devFile); + if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + + return result; + } + } + + return Q_UINT64_C(0); +} + +quint64 QNetworkManagerEngine::bytesReceived(const QString &id) +{ + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); + if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + const QString networkInterface = getInterfaceFromId(id); + if (!networkInterface.isEmpty()) { + const QString devFile = QLatin1String("/sys/class/net/") + + networkInterface + + QLatin1String("/statistics/rx_bytes"); + + quint64 result = Q_UINT64_C(0); + + QFile tx(devFile); + if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) { + QTextStream in(&tx); + in >> result; + tx.close(); + } + + return result; + } + } + + return Q_UINT64_C(0); +} + +quint64 QNetworkManagerEngine::startTime(const QString &id) +{ + QNetworkManagerSettingsConnection *connection = connectionFromId(id); + if (connection) + return connection->getTimestamp(); + else + return Q_UINT64_C(0); +} + QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const { return QNetworkConfigurationManager::ForcedRoaming | diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 848f166..70efc05 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -82,6 +82,10 @@ public: QNetworkSession::State sessionStateForId(const QString &id); + quint64 bytesWritten(const QString &id); + quint64 bytesReceived(const QString &id); + quint64 startTime(const QString &id); + QNetworkConfigurationManager::Capabilities capabilities() const; QNetworkSessionPrivate *createSessionBackend(); diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 6fffe27..3772639 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -68,6 +68,10 @@ public: virtual QNetworkSession::State sessionStateForId(const QString &id) = 0; + virtual quint64 bytesWritten(const QString &) { return Q_UINT64_C(0); } + virtual quint64 bytesReceived(const QString &) { return Q_UINT64_C(0); } + virtual quint64 startTime(const QString &) { return Q_UINT64_C(0); } + Q_SIGNALS: void connectionError(const QString &id, ConnectionError error); }; diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index c823d89..8f95e77 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -266,50 +266,26 @@ QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const quint64 QNetworkSessionPrivateImpl::bytesWritten() const { -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(config.d->id))->sentDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->sentDataForId(activeConfig.d->id); - } - } -#endif - return tx_data; + if (engine && state == QNetworkSession::Connected) + return engine->bytesWritten(activeConfig.identifier()); + else + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::bytesReceived() const { -#if defined(BACKEND_NM) && 0 - if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) { - if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) { - foreach (const QNetworkConfiguration &config, publicConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(config.d->id); - } - } - } else { - return static_cast(getEngineFromId(activeConfig.d->id))->receivedDataForId(activeConfig.d->id); - } - } -#endif - return rx_data; + if (engine && state == QNetworkSession::Connected) + return engine->bytesReceived(activeConfig.identifier()); + else + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::activeTime() const { -#if defined(BACKEND_NM) - if (startTime.isNull()) { - return 0; - } - if(state == QNetworkSession::Connected ) - return startTime.secsTo(QDateTime::currentDateTime()); -#endif - return m_activeTime; + if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0)) + return QDateTime::currentDateTime().toTime_t() - startTime; + else + return Q_UINT64_C(0); } void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() @@ -381,9 +357,8 @@ void QNetworkSessionPrivateImpl::networkConfigurationsChanged() updateStateFromServiceNetwork(); else updateStateFromActiveConfig(); -#if defined(BACKEND_NM) && 0 - setActiveTimeStamp(); -#endif + + startTime = engine->startTime(activeConfig.identifier()); } void QNetworkSessionPrivateImpl::configurationChanged(const QNetworkConfiguration &config) @@ -429,51 +404,4 @@ void QNetworkSessionPrivateImpl::connectionError(const QString &id, } } -#if defined(BACKEND_NM) && 0 -void QNetworkSessionPrivateImpl::setActiveTimeStamp() -{ - if(NetworkManagerAvailable()) { - startTime = QDateTime(); - return; - } - QString connectionIdent = q->configuration().identifier(); - QString interface = currentInterface().hardwareAddress().toLower(); - QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_"); - - QString path; - QString serviceName; - QNetworkManagerInterface * ifaceD; - ifaceD = new QNetworkManagerInterface(); - - QList connections = ifaceD->activeConnections(); - foreach(QDBusObjectPath conpath, connections) { - QNetworkManagerConnectionActive *conDetails; - conDetails = new QNetworkManagerConnectionActive(conpath.path()); - QDBusObjectPath connection = conDetails->connection(); - serviceName = conDetails->serviceName(); - QList so = conDetails->devices(); - foreach(QDBusObjectPath device, so) { - - if(device.path() == devicePath) { - path = connection.path(); - } - break; - } - } -if(serviceName.isEmpty()) - return; - QNetworkManagerSettings *settingsiface; - settingsiface = new QNetworkManagerSettings(serviceName); - QList list = settingsiface->listConnections(); - foreach(QDBusObjectPath path, list) { - QNetworkManagerSettingsConnection *sysIface; - sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path()); - startTime = QDateTime::fromTime_t(sysIface->getTimestamp()); - // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - } - if(startTime.isNull()) - startTime = QDateTime::currentDateTime(); -} -#endif - QT_END_NAMESPACE diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 0126a99..7349e77 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -68,8 +68,8 @@ class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { Q_OBJECT public: - QNetworkSessionPrivateImpl() : - tx_data(0), rx_data(0), m_activeTime(0) + QNetworkSessionPrivateImpl() + : startTime(0) { } @@ -115,20 +115,13 @@ private Q_SLOTS: private: QNetworkConfigurationManager manager; - quint64 tx_data; - quint64 rx_data; - quint64 m_activeTime; - bool opened; QBearerEngineImpl *engine; QNetworkSession::SessionError lastError; -#if defined(BACKEND_NM) - QDateTime startTime; - void setActiveTimeStamp(); -#endif + quint64 startTime; }; QT_END_NAMESPACE -- cgit v0.12 From 992af6c30d5e1216bf7a6db2521c16f0b508e396 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 10:50:14 +1000 Subject: Missed this in a previous commit. --- src/plugins/bearer/qbearerengine_impl.h | 2 +- src/plugins/bearer/qnetworksession_impl.cpp | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 3772639..740def3 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -73,7 +73,7 @@ public: virtual quint64 startTime(const QString &) { return Q_UINT64_C(0); } Q_SIGNALS: - void connectionError(const QString &id, ConnectionError error); + void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error); }; QT_END_NAMESPACE diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 8f95e77..de1c91a 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -119,8 +119,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() activeConfig = publicConfig; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), - this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)), Qt::QueuedConnection); } break; @@ -298,15 +298,18 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() if (activeConfig != config) { if (engine) { - disconnect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), - this, SLOT(connectionError(QString,QBearerEngine::ConnectionError))); + disconnect(engine, + SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, + SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError))); } activeConfig = config; engine = getEngineFromId(activeConfig.identifier()); if (engine) { - connect(engine, SIGNAL(connectionError(QString,QBearerEngine::ConnectionError)), - this, SLOT(connectionError(QString,QBearerEngine::ConnectionError)), + connect(engine, + SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)), Qt::QueuedConnection); } emit newConfigurationActivated(); -- cgit v0.12 From 8df1491dfb261ab41f9f360af8e23fd283ad1ca5 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 11:04:00 +1000 Subject: Calculate default configuration if one is not provided by engines. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 62 +++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index a94fd2f..9ebb0b3 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -173,6 +173,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() QFactoryLoader *l = loader(); + QBearerEngine *generic = 0; + foreach (const QString &key, l->keys()) { QBearerEnginePlugin *plugin = qobject_cast(l->instance(key)); if (plugin) { @@ -180,7 +182,11 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (!engine) continue; - sessionEngines.append(engine); + if (key == QLatin1String("generic")) + generic = engine; + else + sessionEngines.append(engine); + connect(engine, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations())); connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), @@ -193,6 +199,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() capFlags |= engine->capabilities(); } } + + sessionEngines.append(generic); } QBearerEngine *engine = qobject_cast(sender()); @@ -229,6 +237,58 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( } } + // Engines don't have a default configuration. + + // Return first active snap + QNetworkConfigurationPrivatePointer firstDiscovered; + + foreach (QBearerEngine *engine, sessionEngines) { + foreach (const QString &id, engine->snapConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = engine->snapConfigurations.value(id); + + if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + QNetworkConfiguration config; + config.d = ptr; + return config; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + firstDiscovered = ptr; + } + } + } + + // No Active SNAPs return first Discovered SNAP. + if (firstDiscovered) { + QNetworkConfiguration config; + config.d = firstDiscovered; + return config; + } + + // No Active or Discovered SNAPs, do same for InternetAccessPoints. + firstDiscovered.reset(); + + foreach (QBearerEngine *engine, sessionEngines) { + foreach (const QString &id, engine->accessPointConfigurations.keys()) { + QNetworkConfigurationPrivatePointer ptr = engine->accessPointConfigurations.value(id); + + if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + QNetworkConfiguration config; + config.d = ptr; + return config; + } else if ((ptr->state & QNetworkConfiguration::Discovered) == + QNetworkConfiguration::Discovered) { + firstDiscovered = ptr; + } + } + } + + // No Active InternetAccessPoint return first Discovered InternetAccessPoint. + if (firstDiscovered) { + QNetworkConfiguration config; + config.d = firstDiscovered; + return config; + } + return QNetworkConfiguration(); } -- cgit v0.12 From 76160422d532b2ccf63a5c477f74a6645428c0f7 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 12:51:27 +1000 Subject: Emit signals when access points appear & disappear. --- .../networkmanager/qnetworkmanagerengine.cpp | 66 +++++++++++++++++----- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 9a9bdad..51afe3e 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -499,19 +499,21 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec } // Check if configuration exists for connection. - for (int i = 0; i < connections.count(); ++i) { - QNetworkManagerSettingsConnection *connection = connections.at(i); + if (!accessPoint->ssid().isEmpty()) { + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); - if (accessPoint->ssid() == connection->getSsid()) { - const QString service = connection->connectionInterface()->service(); - const QString settingsPath = connection->connectionInterface()->path(); - const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); - QNetworkConfigurationPrivatePointer ptr = - accessPointConfigurations.value(connectionId); - ptr->state = QNetworkConfiguration::Discovered; - emit configurationChanged(ptr); - return; + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + return; + } } } @@ -544,12 +546,32 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path, if (configuredAccessPoints.contains(accessPoint)) { // find connection and change state to Defined configuredAccessPoints.removeOne(accessPoint); - qDebug() << "At least one connection is no longer discovered."; + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = + QString::number(qHash(service + ' ' + settingsPath)); + + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Defined; + emit configurationChanged(ptr); + return; + } + } } else { - // emit configurationRemoved(cpPriv); - qDebug() << "An unconfigured wifi access point was removed."; + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(QString::number(qHash(objectPath.path()))); + + if (ptr) + emit configurationRemoved(ptr); } + delete accessPoint; + break; } } @@ -564,7 +586,21 @@ void QNetworkManagerEngine::updateAccessPoint(const QMap &map if (!accessPoint) return; - qDebug() << "update access point" << accessPoint; + for (int i = 0; i < connections.count(); ++i) { + QNetworkManagerSettingsConnection *connection = connections.at(i); + + if (accessPoint->ssid() == connection->getSsid()) { + const QString service = connection->connectionInterface()->service(); + const QString settingsPath = connection->connectionInterface()->path(); + const QString connectionId = QString::number(qHash(service + ' ' + settingsPath)); + + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.value(connectionId); + ptr->state = QNetworkConfiguration::Discovered; + emit configurationChanged(ptr); + return; + } + } } QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QString &service, -- cgit v0.12 From 2963cb346814d47fd59e04bfd9bcd5fde88d5bd8 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 17:29:45 +1000 Subject: Only add generic engine when it is available. --- src/network/bearer/qnetworkconfigmanager_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 9ebb0b3..a624376 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -200,7 +200,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } } - sessionEngines.append(generic); + if (generic) + sessionEngines.append(generic); } QBearerEngine *engine = qobject_cast(sender()); -- cgit v0.12 From c6157559204b61b11537ab0c0aba16eb182b09fe Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Mon, 8 Feb 2010 17:37:48 +1000 Subject: Automatically migrate in-progress transfers after roaming. Automatically migrate in-progress transfers after roaming to a new access point for backends that support it. Currently only works for http transfers that do not upload data (i.e. HTTP GET). --- src/network/access/qnetworkaccessmanager.cpp | 35 +++----------------------- src/network/access/qnetworkaccessmanager_p.h | 4 +-- src/network/access/qnetworkreplyimpl.cpp | 37 +++++++++++++++++++--------- src/network/access/qnetworkreplyimpl_p.h | 2 +- 4 files changed, 31 insertions(+), 47 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 617e398..8df580d 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -802,27 +802,6 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() QNetworkReply *reply = qobject_cast(q->sender()); if (reply) emit q->finished(reply); - - if (session && deferredMigration) { - foreach (QObject *child, q->children()) { - if (child == reply) - continue; - - QNetworkReplyImpl *replyImpl = qobject_cast(child); - if (!replyImpl) - continue; - - QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; - if (state == QNetworkReplyImplPrivate::Buffering || - state == QNetworkReplyImplPrivate::Working) { - return; - } - } - - deferredMigration = false; - qDebug() << "Migrating as there are no pending replies."; - session->migrate(); - } } void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList &errors) @@ -1136,6 +1115,7 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() { Q_Q(QNetworkAccessManager); +#if 0 foreach (QObject *child, q->children()) { QNetworkReplyImpl *reply = qobject_cast(child); if (reply) { @@ -1151,6 +1131,7 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() } } } +#endif qDebug() << "Accepting new configuration."; session->accept(); @@ -1183,18 +1164,10 @@ void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const foreach (QObject *child, q->children()) { QNetworkReplyImpl *replyImpl = qobject_cast(child); - if (replyImpl) { - QNetworkReplyImplPrivate::State state = replyImpl->d_func()->state; - if (state == QNetworkReplyImplPrivate::Buffering || - state == QNetworkReplyImplPrivate::Working) { - deferredMigration = true; - return; - } - } + if (replyImpl) + replyImpl->migrateBackend(); } - deferredMigration = false; - qDebug() << "Migrating as there are no pending replies."; session->migrate(); } diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 92b2782..e916158 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,8 +76,7 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0), - deferredMigration(false) + session(0) { } ~QNetworkAccessManagerPrivate(); @@ -131,7 +130,6 @@ public: bool cookieJarCreated; QNetworkSession *session; - bool deferredMigration; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 0c7aca8..9721e32 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -477,6 +477,17 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) QPointer qq = q; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); + if (totalSize.isNull()) { + RawHeadersList::ConstIterator it = findRawHeader("Content-Range"); + if (it != rawHeaders.constEnd()) { + int index = it->second.lastIndexOf('/'); + if (index != -1) + totalSize = it->second.mid(index + 1).toLongLong() - preMigrationDownloaded; + } else { + qDebug() << "Could not find Content-Length or Content-Range header"; + } + } + if (preMigrationDownloaded != Q_INT64_C(-1)) totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); @@ -520,7 +531,8 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QIODevice *data) void QNetworkReplyImplPrivate::finished() { Q_Q(QNetworkReplyImpl); - if (state == Finished || state == Aborted) + + if (state == Finished || state == Aborted || state == WaitingForSession) return; pauseNotificationHandling(); @@ -540,11 +552,10 @@ void QNetworkReplyImplPrivate::finished() } else { qDebug() << "Download hasn't finished"; - if (q->bytesAvailable() == bytesDownloaded) { - qDebug() << "User hasn't read data from reply, we could continue after reconnect."; - error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); - } else if (q->bytesAvailable() < bytesDownloaded) { - qDebug() << "User has already read data from reply."; + if (migrateBackend()) { + return; + } else { + qDebug() << "Could not migrate backend, application needs to send another requeset."; error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); } } @@ -781,24 +792,24 @@ void QNetworkReplyImpl::migrateBackend() d->migrateBackend(); } -void QNetworkReplyImplPrivate::migrateBackend() +bool QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); if (state == QNetworkReplyImplPrivate::Finished || state == QNetworkReplyImplPrivate::Aborted) { qDebug() << "Network reply is already finished/aborted."; - return; + return false; } if (!qobject_cast(backend)) { qDebug() << "Resume only support by http backend, not migrating."; - return; + return false; } if (outgoingData) { qDebug() << "Request has outgoing data, not migrating."; - return; + return false; } qDebug() << "Need to check for only cacheable content."; @@ -812,14 +823,14 @@ void QNetworkReplyImplPrivate::migrateBackend() state = QNetworkReplyImplPrivate::Reconnecting; if (backend) { - backend->deleteLater(); + delete backend; backend = 0; } RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); if (it == rawHeaders.constEnd() || it->second == "none") { qDebug() << "Range header not supported by server/resource."; - qFatal("Should fail with TemporaryNetworkFailure."); + return false; } cookedHeaders.clear(); @@ -841,6 +852,8 @@ void QNetworkReplyImplPrivate::migrateBackend() } else { QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); } + + return true; } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index ac82ca0..89b976f 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -165,7 +165,7 @@ public: QIODevice *copyDevice; QAbstractNetworkCache *networkCache() const; - void migrateBackend(); + bool migrateBackend(); bool cacheEnabled; QIODevice *cacheSaveDevice; -- cgit v0.12 From a8d09369fea1574b24309d7b7b2bb373021bf387 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 18 Jan 2010 14:16:16 +0100 Subject: Make QTextCodec reentrant. QTextCodec::codecForName and codedForMib were not reentrant Reviewed-by: Brad Reviewed-by: Denis --- src/corelib/codecs/qsimplecodec.cpp | 2 +- src/corelib/codecs/qtextcodec.cpp | 46 ++++++++++++++++++++++++++------ tests/auto/qtextcodec/tst_qtextcodec.cpp | 46 ++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 9 deletions(-) diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp index 445565a..4cc7912 100644 --- a/src/corelib/codecs/qsimplecodec.cpp +++ b/src/corelib/codecs/qsimplecodec.cpp @@ -681,7 +681,7 @@ QByteArray QSimpleTextCodec::convertFromUnicode(const QChar *in, int length, Con int u; const QChar* ucp = in; unsigned char* rp = (unsigned char *)r.data(); - const unsigned char* rmp = (const unsigned char *)reverseMap->data(); + const unsigned char* rmp = (const unsigned char *)reverseMap->constData(); int rmsize = (int) reverseMap->size(); while(i--) { diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 698ca9e..e9c1803 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -79,7 +79,7 @@ # endif #endif // QT_NO_CODECS #include "qlocale.h" -#include "private/qmutexpool_p.h" +#include "qmutex.h" #include #include @@ -659,13 +659,13 @@ static void setupLocaleMapper() #endif } - -static void setup() -{ #ifndef QT_NO_THREAD - QMutexLocker locker(QMutexPool::globalInstanceGet(&all)); +Q_GLOBAL_STATIC_WITH_ARGS(QMutex, textCodecsMutex, (QMutex::Recursive)); #endif +// textCodecsMutex need to be locked to enter this function +static void setup() +{ if (all) return; @@ -903,8 +903,6 @@ QTextCodec::ConverterState::~ConverterState() */ /*! - \nonreentrant - Constructs a QTextCodec, and gives it the highest precedence. The QTextCodec should always be constructed on the heap (i.e. with \c new). Qt takes ownership and will delete it when the application @@ -912,6 +910,9 @@ QTextCodec::ConverterState::~ConverterState() */ QTextCodec::QTextCodec() { +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif setup(); all->prepend(this); } @@ -929,8 +930,12 @@ QTextCodec::~QTextCodec() if (!destroying_is_ok) qWarning("QTextCodec::~QTextCodec: Called by application"); #endif - if (all) + if (all) { +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif all->removeAll(this); + } } /*! @@ -951,6 +956,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) if (name.isEmpty()) return 0; +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif setup(); for (int i = 0; i < all->size(); ++i) { @@ -973,6 +981,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) */ QTextCodec* QTextCodec::codecForMib(int mib) { +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif setup(); // Qt 3 used 1000 (mib for UCS2) as its identifier for the utf16 codec. Map @@ -1001,6 +1012,9 @@ QTextCodec* QTextCodec::codecForMib(int mib) */ QList QTextCodec::availableCodecs() { +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif setup(); QList codecs; @@ -1008,6 +1022,11 @@ QList QTextCodec::availableCodecs() codecs += all->at(i)->name(); codecs += all->at(i)->aliases(); } + +#ifndef QT_NO_THREAD + locker.unlock(); +#endif + #ifndef QT_NO_TEXTCODECPLUGIN QFactoryLoader *l = loader(); QStringList keys = l->keys(); @@ -1031,11 +1050,19 @@ QList QTextCodec::availableCodecs() */ QList QTextCodec::availableMibs() { +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif setup(); QList codecs; for (int i = 0; i < all->size(); ++i) codecs += all->at(i)->mibEnum(); + +#ifndef QT_NO_THREAD + locker.unlock(); +#endif + #ifndef QT_NO_TEXTCODECPLUGIN QFactoryLoader *l = loader(); QStringList keys = l->keys(); @@ -1082,6 +1109,9 @@ QTextCodec* QTextCodec::codecForLocale() if (localeMapper) return localeMapper; +#ifndef QT_NO_THREAD + QMutexLocker locker(textCodecsMutex()); +#endif setup(); return localeMapper; diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index eb348fb..65b0448 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -47,6 +47,8 @@ #include #include #include +#include +#include #ifdef Q_OS_SYMBIAN #define SRCDIR "" @@ -58,6 +60,9 @@ class tst_QTextCodec : public QObject Q_OBJECT private slots: + + void threadSafety(); + void toUnicode_data(); void toUnicode(); void codecForName_data(); @@ -1904,5 +1909,46 @@ void tst_QTextCodec::toLocal8Bit() } #endif +static QByteArray loadAndConvert(const QByteArray &codecName) +{ + QTextCodec *c = QTextCodec::codecForName(codecName); + if (!c) { + qDebug() << "WARNING " << codecName << " not found? "; + return QByteArray(); + } + QString str = QString::fromLatin1(codecName); + QByteArray b = c->fromUnicode(str); + c->toUnicode(b); + return codecName; +} + +static int loadAndConvertMIB(int mib) +{ + QTextCodec *c = QTextCodec::codecForMib(mib); + if (!c) { + qDebug() << "WARNING " << mib << " not found? "; + return 0; + } + QString str = QString::number(mib); + QByteArray b = c->fromUnicode(str); + c->toUnicode(b); + return mib; +} + + +void tst_QTextCodec::threadSafety() +{ + QThreadPool::globalInstance()->setMaxThreadCount(12); + + QList codecList = QTextCodec::availableCodecs(); + QFuture res = QtConcurrent::mapped(codecList, loadAndConvert); + + QList mibList = QTextCodec::availableMibs(); + QFuture res2 = QtConcurrent::mapped(mibList, loadAndConvertMIB); + + QCOMPARE(res.results(), codecList); + QCOMPARE(res2.results(), mibList); +} + QTEST_MAIN(tst_QTextCodec) #include "tst_qtextcodec.moc" -- cgit v0.12 From 7724c474a941ea3516da6102a16b30ca254afe53 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 8 Feb 2010 12:25:10 +0100 Subject: QGraphicsItem: Do not crash at exit if there is static QGraphicsItem. The DataStore could have been destroyed before. Even if having static QGraphicsItem is not really supported, it is better not to crash Task-number: QTBUG-7629 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 3 ++- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index b4e19d1..39c41c4 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1392,7 +1392,8 @@ QGraphicsItem::~QGraphicsItem() } delete d_ptr->transformData; - qt_dataStore()->data.remove(this); + if (QGraphicsItemCustomDataStore *dataStore = qt_dataStore()) + dataStore->data.remove(this); } /*! diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 7b54a3b..7c1b97e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -90,6 +90,8 @@ Q_DECLARE_METATYPE(QRectF) #define COMPARE_REGIONS QTRY_COMPARE #endif +static QGraphicsRectItem staticItem; //QTBUG-7629, we should not crash at exit. + static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::MouseButton button = Qt::LeftButton) { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); -- cgit v0.12 From 8d9c9386be6e45fdf919a3ac5bf79f5cde315142 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Feb 2010 18:21:47 +0100 Subject: drastically improve load time of TS files it isn't such a good idea to insert rows one by one into the model. so instead batch the "announcement" of new data. unloading single models is still slow, but that's a corner use case, so don't bother fixing it now, especially as it is harder to do it. --- tools/linguist/linguist/messagemodel.cpp | 48 +++++++++++++++++++++----------- tools/linguist/linguist/messagemodel.h | 2 +- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/tools/linguist/linguist/messagemodel.cpp b/tools/linguist/linguist/messagemodel.cpp index 6572059..4e2b473 100644 --- a/tools/linguist/linguist/messagemodel.cpp +++ b/tools/linguist/linguist/messagemodel.cpp @@ -584,12 +584,16 @@ void MultiContextItem::putMessageItem(int pos, MessageItem *m) m_messageLists.last()[pos] = m; } -void MultiContextItem::appendMessageItem(MessageItem *m) +void MultiContextItem::appendMessageItems(const QList &m) { + QList nullItems = m; // Basically, just a reservation + for (int i = 0; i < nullItems.count(); ++i) + nullItems[i] = 0; for (int i = 0; i < m_messageLists.count() - 1; ++i) - m_messageLists[i].append(0); - m_messageLists.last().append(m); - m_multiMessageList.append(MultiMessageItem(m)); + m_messageLists[i] += nullItems; + m_messageLists.last() += m; + foreach (MessageItem *mi, m) + m_multiMessageList.append(MultiMessageItem(mi)); } void MultiContextItem::removeMultiMessageItem(int pos) @@ -710,33 +714,43 @@ void MultiDataModel::append(DataModel *dm, bool readWrite) m_msgModel->endInsertColumns(); } m_msgModel->endInsertColumns(); + int appendedContexts = 0; for (int i = 0; i < dm->contextCount(); ++i) { ContextItem *c = dm->contextItem(i); int mcx = findContextIndex(c->context()); if (mcx >= 0) { MultiContextItem *mc = multiContextItem(mcx); mc->assignLastModel(c, readWrite); + QList appendItems; for (int j = 0; j < c->messageCount(); ++j) { MessageItem *m = c->messageItem(j); int msgIdx = mc->findMessage(m->text(), m->comment()); - if (msgIdx >= 0) { + if (msgIdx >= 0) mc->putMessageItem(msgIdx, m); - } else { - int msgCnt = mc->messageCount(); - m_msgModel->beginInsertRows(m_msgModel->createIndex(mcx, 0, 0), msgCnt, msgCnt); - mc->appendMessageItem(m); - m_msgModel->endInsertRows(); - ++m_numMessages; - } + else + appendItems << m; + } + if (!appendItems.isEmpty()) { + int msgCnt = mc->messageCount(); + m_msgModel->beginInsertRows(m_msgModel->createIndex(mcx, 0, 0), + msgCnt, msgCnt + appendItems.size() - 1); + mc->appendMessageItems(appendItems); + m_msgModel->endInsertRows(); + m_numMessages += appendItems.size(); } } else { - MultiContextItem item(modelCount() - 1, c, readWrite); - m_msgModel->beginInsertRows(QModelIndex(), contextCount(), contextCount()); - m_multiContextList.append(item); - m_msgModel->endInsertRows(); - m_numMessages += item.messageCount(); + m_multiContextList << MultiContextItem(modelCount() - 1, c, readWrite); + m_numMessages += c->messageCount(); + ++appendedContexts; } } + if (appendedContexts) { + // Do that en block to avoid itemview inefficiency. It doesn't hurt that we + // announce the availability of the data "long" after it was actually added. + m_msgModel->beginInsertRows(QModelIndex(), + contextCount() - appendedContexts, contextCount() - 1); + m_msgModel->endInsertRows(); + } dm->setWritable(readWrite); updateCountsOnAdd(modelCount() - 1, readWrite); connect(dm, SIGNAL(modifiedChanged()), SLOT(onModifiedChanged())); diff --git a/tools/linguist/linguist/messagemodel.h b/tools/linguist/linguist/messagemodel.h index 3e0107e..7d98873 100644 --- a/tools/linguist/linguist/messagemodel.h +++ b/tools/linguist/linguist/messagemodel.h @@ -332,7 +332,7 @@ private: void removeModel(int pos); void moveModel(int oldPos, int newPos); // newPos is *before* removing at oldPos void putMessageItem(int pos, MessageItem *m); - void appendMessageItem(MessageItem *m); + void appendMessageItems(const QList &m); void removeMultiMessageItem(int pos); void incrementFinishedCount() { ++m_finishedCount; } void decrementFinishedCount() { --m_finishedCount; } -- cgit v0.12 From e49fa5d9ab3c15918fe5fe92d30d7640e23a1307 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 8 Feb 2010 12:54:35 +0100 Subject: generate code which does not break QT_USE_FAST_CONCATENATION with old gcc --- util/qlalr/cppgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/qlalr/cppgenerator.cpp b/util/qlalr/cppgenerator.cpp index a95f5e4..f52a86f 100644 --- a/util/qlalr/cppgenerator.cpp +++ b/util/qlalr/cppgenerator.cpp @@ -457,7 +457,7 @@ void CppGenerator::generateDecl (QTextStream &out) out << "class " << grammar.table_name << endl << "{" << endl << "public:" << endl - << " enum {" << endl; + << " enum VariousConstants {" << endl; foreach (Name t, grammar.terminals) { -- cgit v0.12 From 95f8f814f2f77654d846660644f0e8a5c48eeb26 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 8 Feb 2010 14:08:29 +0100 Subject: QLineEdit: regression: read-only line edits would eat shortcuts. Restore Qt 4.5 behaviour. Task-number: QTBUG-7395 Reviewed-by: Thierry --- src/gui/widgets/qlinecontrol.cpp | 2 ++ tests/auto/qlineedit/tst_qlineedit.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index b0a64ea..db099e8 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1371,6 +1371,8 @@ bool QLineControl::processEvent(QEvent* ev) processInputMethodEvent(static_cast(ev)); break; #ifndef QT_NO_SHORTCUT case QEvent::ShortcutOverride:{ + if (isReadOnly()) + return false; QKeyEvent* ke = static_cast(ev); if (ke == QKeySequence::Copy || ke == QKeySequence::Paste diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 7283916..69e7699 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -271,6 +271,7 @@ private slots: void taskQTBUG_4401_enterKeyClearsPassword(); void taskQTBUG_4679_moveToStartEndOfBlock(); void taskQTBUG_4679_selectToStartEndOfBlock(); + void taskQTBUG_7395_readOnlyShortcut(); protected slots: #ifdef QT3_SUPPORT @@ -3638,5 +3639,25 @@ void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock() #endif // Q_OS_MAC } +void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() +{ + //ReadOnly QLineEdit should not intercept shortcut. + QLineEdit le; + le.setReadOnly(true); + + QAction action(QString::fromLatin1("hello"), &le); + action.setShortcut(QString::fromLatin1("p")); + QSignalSpy spy(&action, SIGNAL(triggered())); + le.addAction(&action); + + le.show(); + QApplication::setActiveWindow(&le); + QTest::qWaitForWindowShown(&le); + le.setFocus(); + QTRY_VERIFY(le.hasFocus()); + QTest::keyClick(0, Qt::Key_P); + QCOMPARE(spy.count(), 1); +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" -- cgit v0.12 From 43a9c48554579d76e1f1267fbd70f488f22fd408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 8 Feb 2010 14:55:40 +0100 Subject: Fixed QImagReader::setAutoDetectImageFormat() to work with plugins. Only the compiled in formats where checked when setAutoDetectImageFormat(false) was set on a QImageReader object. Task-number: QTBUG-7980 Reviewed-by: aavit --- src/gui/image/qimagereader.cpp | 28 +++++++++++++++++++-------- tests/auto/qimagereader/tst_qimagereader.cpp | 29 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index c9e015c..9320cfc 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -263,25 +263,37 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device, device->seek(pos); } - if (!handler && !testFormat.isEmpty() && autoDetectImageFormat && !ignoresFormatAndExtension) { + if (!handler && !testFormat.isEmpty() && !ignoresFormatAndExtension) { // check if any plugin supports the format (they are not allowed to // read from the device yet). const qint64 pos = device ? device->pos() : 0; - for (int i = 0; i < keys.size(); ++i) { - if (i != suffixPluginIndex) { - QImageIOPlugin *plugin = qobject_cast(l->instance(keys.at(i))); - if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { + + if (autoDetectImageFormat) { + for (int i = 0; i < keys.size(); ++i) { + if (i != suffixPluginIndex) { + QImageIOPlugin *plugin = qobject_cast(l->instance(keys.at(i))); + if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { #ifdef QIMAGEREADER_DEBUG - qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format"; + qDebug() << "QImageReader::createReadHandler: the" << keys.at(i) << "plugin can read this format"; #endif - handler = plugin->create(device, testFormat); - break; + handler = plugin->create(device, testFormat); + break; + } } } + } else { + QImageIOPlugin *plugin = qobject_cast(l->instance(QLatin1String(testFormat))); + if (plugin && plugin->capabilities(device, testFormat) & QImageIOPlugin::CanRead) { +#ifdef QIMAGEREADER_DEBUG + qDebug() << "QImageReader::createReadHandler: the" << testFormat << "plugin can read this format"; +#endif + handler = plugin->create(device, testFormat); + } } if (device && !device->isSequential()) device->seek(pos); } + #endif // QT_NO_LIBRARY // if we don't have a handler yet, check if we have built-in support for diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 121a8fa..99244c2 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -1633,6 +1633,35 @@ void tst_QImageReader::autoDetectImageFormat() QVERIFY(reader.canRead()); QVERIFY(!reader.read().isNull()); } + +#ifdef QTEST_HAVE_JPEG + { + QImageReader io(prefix + "YCbCr_rgb.jpg"); + io.setAutoDetectImageFormat(false); + // This should fail since no format string is given + QImage image; + QVERIFY(!io.read(&image)); + } + { + QImageReader io(prefix + "YCbCr_rgb.jpg", "jpg"); + io.setAutoDetectImageFormat(false); + QImage image; + QVERIFY(io.read(&image)); + } +#endif + { + QImageReader io(prefix + "tst7.png"); + io.setAutoDetectImageFormat(false); + // This should fail since no format string is given + QImage image; + QVERIFY(!io.read(&image)); + } + { + QImageReader io(prefix + "tst7.png", "png"); + io.setAutoDetectImageFormat(false); + QImage image; + QVERIFY(io.read(&image)); + } } void tst_QImageReader::fileNameProbing() -- cgit v0.12 From 020830966e08239854ac207ec28663a80c6e0647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 8 Feb 2010 14:01:08 +0100 Subject: Restructure tests/benchmarks directory. We follow the same structure as used in the src directory. This makes it easier to navigate through the jungel, especially now that we are going to add functional tests etc. --- tests/benchmarks/benchmarks.pro | 52 +- tests/benchmarks/blendbench/blendbench.pro | 8 - tests/benchmarks/blendbench/main.cpp | 152 -- .../containers-associative.pro | 8 - tests/benchmarks/containers-associative/main.cpp | 143 -- .../containers-sequential.pro | 8 - tests/benchmarks/containers-sequential/main.cpp | 265 ---- tests/benchmarks/corelib/corelib.pro | 6 + tests/benchmarks/corelib/io/io.pro | 9 + tests/benchmarks/corelib/io/qdir/qdir.pro | 8 + tests/benchmarks/corelib/io/qdir/tst_qdir.cpp | 198 +++ tests/benchmarks/corelib/io/qdiriterator/main.cpp | 251 +++ .../corelib/io/qdiriterator/qdiriterator.pro | 23 + .../io/qdiriterator/qfilesystemiterator.cpp | 678 ++++++++ .../corelib/io/qdiriterator/qfilesystemiterator.h | 99 ++ tests/benchmarks/corelib/io/qfile/main.cpp | 675 ++++++++ tests/benchmarks/corelib/io/qfile/qfile.pro | 7 + tests/benchmarks/corelib/io/qfileinfo/main.cpp | 83 + .../benchmarks/corelib/io/qfileinfo/qfileinfo.pro | 12 + tests/benchmarks/corelib/io/qiodevice/main.cpp | 107 ++ .../benchmarks/corelib/io/qiodevice/qiodevice.pro | 13 + .../benchmarks/corelib/io/qtemporaryfile/main.cpp | 103 ++ .../corelib/io/qtemporaryfile/qtemporaryfile.pro | 12 + tests/benchmarks/corelib/kernel/events/events.pro | 7 + tests/benchmarks/corelib/kernel/events/main.cpp | 187 +++ tests/benchmarks/corelib/kernel/kernel.pro | 6 + .../benchmarks/corelib/kernel/qmetaobject/main.cpp | 159 ++ .../corelib/kernel/qmetaobject/qmetaobject.pro | 5 + tests/benchmarks/corelib/kernel/qobject/main.cpp | 180 +++ tests/benchmarks/corelib/kernel/qobject/object.cpp | 65 + tests/benchmarks/corelib/kernel/qobject/object.h | 75 + .../benchmarks/corelib/kernel/qobject/qobject.pro | 9 + .../corelib/kernel/qvariant/qvariant.pro | 11 + .../corelib/kernel/qvariant/tst_qvariant.cpp | 180 +++ .../thread/qthreadstorage/qthreadstorage.pro | 6 + .../thread/qthreadstorage/tst_qthreadstorage.cpp | 124 ++ tests/benchmarks/corelib/thread/thread.pro | 3 + .../containers-associative.pro | 8 + .../corelib/tools/containers-associative/main.cpp | 143 ++ .../containers-sequential.pro | 8 + .../corelib/tools/containers-sequential/main.cpp | 265 ++++ tests/benchmarks/corelib/tools/qbytearray/main.cpp | 92 ++ .../corelib/tools/qbytearray/qbytearray.pro | 12 + tests/benchmarks/corelib/tools/qrect/main.cpp | 329 ++++ tests/benchmarks/corelib/tools/qrect/qrect.pro | 12 + tests/benchmarks/corelib/tools/qregexp/main.cpp | 290 ++++ tests/benchmarks/corelib/tools/qregexp/qregexp.pro | 12 + tests/benchmarks/corelib/tools/qstring/main.cpp | 147 ++ tests/benchmarks/corelib/tools/qstring/qstring.pro | 16 + tests/benchmarks/corelib/tools/qstring/utf-8.txt | 72 + .../corelib/tools/qstringbuilder/main.cpp | 464 ++++++ .../tools/qstringbuilder/qstringbuilder.pro | 12 + .../corelib/tools/qstringlist/.gitignore | 1 + .../benchmarks/corelib/tools/qstringlist/main.cpp | 193 +++ .../corelib/tools/qstringlist/qstringlist.pro | 6 + tests/benchmarks/corelib/tools/tools.pro | 10 + tests/benchmarks/events/events.pro | 7 - tests/benchmarks/events/main.cpp | 187 --- tests/benchmarks/gui/animation/animation.pro | 2 + .../gui/animation/qanimation/dummyanimation.cpp | 61 + .../gui/animation/qanimation/dummyanimation.h | 60 + .../gui/animation/qanimation/dummyobject.cpp | 66 + .../gui/animation/qanimation/dummyobject.h | 64 + tests/benchmarks/gui/animation/qanimation/main.cpp | 191 +++ .../gui/animation/qanimation/qanimation.pro | 18 + .../gui/animation/qanimation/rectanimation.cpp | 94 ++ .../gui/animation/qanimation/rectanimation.h | 70 + tests/benchmarks/gui/graphicsview/graphicsview.pro | 7 + .../qgraphicsanchorlayout.pro | 6 + .../tst_qgraphicsanchorlayout.cpp | 433 ++++++ .../graphicsview/qgraphicsitem/qgraphicsitem.pro | 5 + .../qgraphicsitem/tst_qgraphicsitem.cpp | 243 +++ .../graphicsview/qgraphicsscene/qgraphicsscene.pro | 6 + .../qgraphicsscene/tst_qgraphicsscene.cpp | 248 +++ .../qgraphicsview/benchapps/chipTest/chip.cpp | 176 +++ .../qgraphicsview/benchapps/chipTest/chip.debug | Bin 0 -> 863805 bytes .../qgraphicsview/benchapps/chipTest/chip.h | 68 + .../qgraphicsview/benchapps/chipTest/chip.pro | 19 + .../qgraphicsview/benchapps/chipTest/fileprint.png | Bin 0 -> 1456 bytes .../qgraphicsview/benchapps/chipTest/images.qrc | 10 + .../qgraphicsview/benchapps/chipTest/main.cpp | 57 + .../benchapps/chipTest/mainwindow.cpp | 87 ++ .../qgraphicsview/benchapps/chipTest/mainwindow.h | 66 + .../qgraphicsview/benchapps/chipTest/qt4logo.png | Bin 0 -> 48333 bytes .../benchapps/chipTest/rotateleft.png | Bin 0 -> 1754 bytes .../benchapps/chipTest/rotateright.png | Bin 0 -> 1732 bytes .../qgraphicsview/benchapps/chipTest/view.cpp | 257 +++ .../qgraphicsview/benchapps/chipTest/view.h | 86 ++ .../qgraphicsview/benchapps/chipTest/zoomin.png | Bin 0 -> 1622 bytes .../qgraphicsview/benchapps/chipTest/zoomout.png | Bin 0 -> 1601 bytes .../qgraphicsview/benchapps/moveItems/main.cpp | 106 ++ .../benchapps/moveItems/moveItems.pro | 1 + .../qgraphicsview/benchapps/scrolltest/main.cpp | 146 ++ .../benchapps/scrolltest/scrolltest.pro | 1 + .../graphicsview/qgraphicsview/chiptester/chip.cpp | 182 +++ .../graphicsview/qgraphicsview/chiptester/chip.h | 68 + .../qgraphicsview/chiptester/chiptester.cpp | 144 ++ .../qgraphicsview/chiptester/chiptester.h | 85 + .../qgraphicsview/chiptester/chiptester.pri | 12 + .../qgraphicsview/chiptester/images.qrc | 5 + .../qgraphicsview/chiptester/qt4logo.png | Bin 0 -> 48333 bytes .../graphicsview/qgraphicsview/images/designer.png | Bin 0 -> 4205 bytes .../qgraphicsview/images/wine-big.jpeg | Bin 0 -> 12249 bytes .../graphicsview/qgraphicsview/images/wine.jpeg | Bin 0 -> 2265 bytes .../graphicsview/qgraphicsview/qgraphicsview.pro | 16 + .../graphicsview/qgraphicsview/qgraphicsview.qrc | 9 + .../gui/graphicsview/qgraphicsview/random.data | Bin 0 -> 800 bytes .../qgraphicsview/tst_qgraphicsview.cpp | 908 +++++++++++ .../qgraphicswidget/qgraphicswidget.pro | 6 + .../qgraphicswidget/tst_qgraphicswidget.cpp | 94 ++ tests/benchmarks/gui/gui.pro | 11 + .../benchmarks/gui/image/blendbench/blendbench.pro | 8 + tests/benchmarks/gui/image/blendbench/main.cpp | 152 ++ tests/benchmarks/gui/image/image.pro | 6 + .../gui/image/qimagereader/images/16bpp.bmp | Bin 0 -> 153654 bytes .../gui/image/qimagereader/images/4bpp-rle.bmp | Bin 0 -> 23662 bytes .../gui/image/qimagereader/images/YCbCr_cmyk.jpg | Bin 0 -> 3699 bytes .../gui/image/qimagereader/images/YCbCr_cmyk.png | Bin 0 -> 230 bytes .../gui/image/qimagereader/images/YCbCr_rgb.jpg | Bin 0 -> 2045 bytes .../gui/image/qimagereader/images/away.png | Bin 0 -> 753 bytes .../gui/image/qimagereader/images/ball.mng | Bin 0 -> 34394 bytes .../gui/image/qimagereader/images/bat1.gif | Bin 0 -> 953 bytes .../gui/image/qimagereader/images/bat2.gif | Bin 0 -> 980 bytes .../gui/image/qimagereader/images/beavis.jpg | Bin 0 -> 20688 bytes .../gui/image/qimagereader/images/black.png | Bin 0 -> 697 bytes .../gui/image/qimagereader/images/black.xpm | 65 + .../gui/image/qimagereader/images/colorful.bmp | Bin 0 -> 65002 bytes .../image/qimagereader/images/corrupt-colors.xpm | 26 + .../gui/image/qimagereader/images/corrupt-data.tif | Bin 0 -> 8590 bytes .../image/qimagereader/images/corrupt-pixels.xpm | 7 + .../gui/image/qimagereader/images/corrupt.bmp | Bin 0 -> 116 bytes .../gui/image/qimagereader/images/corrupt.gif | Bin 0 -> 2608 bytes .../gui/image/qimagereader/images/corrupt.jpg | Bin 0 -> 18 bytes .../gui/image/qimagereader/images/corrupt.mng | Bin 0 -> 183 bytes .../gui/image/qimagereader/images/corrupt.png | Bin 0 -> 95 bytes .../gui/image/qimagereader/images/corrupt.xbm | 5 + .../qimagereader/images/crash-signed-char.bmp | Bin 0 -> 45748 bytes .../gui/image/qimagereader/images/earth.gif | Bin 0 -> 51712 bytes .../gui/image/qimagereader/images/fire.mng | Bin 0 -> 44430 bytes .../gui/image/qimagereader/images/font.bmp | Bin 0 -> 1026 bytes .../gui/image/qimagereader/images/gnus.xbm | 622 ++++++++ .../gui/image/qimagereader/images/image.pbm | 8 + .../gui/image/qimagereader/images/image.pgm | 10 + .../gui/image/qimagereader/images/image.png | Bin 0 -> 549 bytes .../gui/image/qimagereader/images/image.ppm | 7 + .../gui/image/qimagereader/images/kollada-noext | Bin 0 -> 13907 bytes .../gui/image/qimagereader/images/kollada.png | Bin 0 -> 13907 bytes .../gui/image/qimagereader/images/marble.xpm | 470 ++++++ .../gui/image/qimagereader/images/namedcolors.xpm | 18 + .../image/qimagereader/images/negativeheight.bmp | Bin 0 -> 24630 bytes .../gui/image/qimagereader/images/noclearcode.bmp | Bin 0 -> 326 bytes .../gui/image/qimagereader/images/noclearcode.gif | Bin 0 -> 130 bytes .../image/qimagereader/images/nontransparent.xpm | 788 ++++++++++ .../qimagereader/images/pngwithcompressedtext.png | Bin 0 -> 757 bytes .../gui/image/qimagereader/images/pngwithtext.png | Bin 0 -> 796 bytes .../images/rgba_adobedeflate_littleendian.tif | Bin 0 -> 4784 bytes .../qimagereader/images/rgba_lzw_littleendian.tif | Bin 0 -> 26690 bytes .../images/rgba_nocompression_bigendian.tif | Bin 0 -> 160384 bytes .../images/rgba_nocompression_littleendian.tif | Bin 0 -> 160388 bytes .../images/rgba_packbits_littleendian.tif | Bin 0 -> 161370 bytes .../images/rgba_zipdeflate_littleendian.tif | Bin 0 -> 14728 bytes .../gui/image/qimagereader/images/runners.ppm | Bin 0 -> 960016 bytes .../gui/image/qimagereader/images/task210380.jpg | Bin 0 -> 975535 bytes .../gui/image/qimagereader/images/teapot.ppm | 31 + .../gui/image/qimagereader/images/test.ppm | 2 + .../gui/image/qimagereader/images/test.xpm | 260 ++++ .../gui/image/qimagereader/images/transparent.xpm | 788 ++++++++++ .../gui/image/qimagereader/images/trolltech.gif | Bin 0 -> 42629 bytes .../gui/image/qimagereader/images/tst7.bmp | Bin 0 -> 582 bytes .../gui/image/qimagereader/images/tst7.png | Bin 0 -> 167 bytes .../gui/image/qimagereader/qimagereader.pro | 27 + .../gui/image/qimagereader/tst_qimagereader.cpp | 244 +++ tests/benchmarks/gui/image/qpixmap/qpixmap.pro | 5 + tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp | 227 +++ .../gui/image/qpixmapcache/qpixmapcache.pro | 6 + .../gui/image/qpixmapcache/tst_qpixmapcache.cpp | 226 +++ tests/benchmarks/gui/itemviews/itemviews.pro | 3 + .../gui/itemviews/qtableview/qtableview.pro | 6 + .../gui/itemviews/qtableview/tst_qtableview.cpp | 367 +++++ tests/benchmarks/gui/kernel/kernel.pro | 4 + tests/benchmarks/gui/kernel/qapplication/main.cpp | 71 + .../gui/kernel/qapplication/qapplication.pro | 10 + tests/benchmarks/gui/kernel/qwidget/qwidget.pro | 4 + .../benchmarks/gui/kernel/qwidget/tst_qwidget.cpp | 332 ++++ tests/benchmarks/gui/math3d/math3d.pro | 4 + .../gui/math3d/qmatrix4x4/qmatrix4x4.pro | 6 + .../gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp | 672 ++++++++ .../gui/math3d/qquaternion/qquaternion.pro | 6 + .../gui/math3d/qquaternion/tst_qquaternion.cpp | 124 ++ tests/benchmarks/gui/painting/painting.pro | 5 + .../benchmarks/gui/painting/qpainter/qpainter.pro | 5 + .../gui/painting/qpainter/tst_qpainter.cpp | 1633 ++++++++++++++++++++ tests/benchmarks/gui/painting/qregion/main.cpp | 89 ++ tests/benchmarks/gui/painting/qregion/qregion.pro | 10 + .../gui/painting/qtransform/qtransform.pro | 6 + .../gui/painting/qtransform/tst_qtransform.cpp | 592 +++++++ .../gui/styles/qstylesheetstyle/main.cpp | 192 +++ .../styles/qstylesheetstyle/qstylesheetstyle.pro | 11 + tests/benchmarks/gui/styles/styles.pro | 3 + tests/benchmarks/gui/text/qfontmetrics/main.cpp | 112 ++ .../gui/text/qfontmetrics/qfontmetrics.pro | 5 + tests/benchmarks/gui/text/qtext/bidi.txt | 4 + tests/benchmarks/gui/text/qtext/main.cpp | 415 +++++ tests/benchmarks/gui/text/qtext/qtext.pro | 14 + tests/benchmarks/gui/text/text.pro | 4 + tests/benchmarks/network/access/access.pro | 4 + .../access/qfile_vs_qnetworkaccessmanager/main.cpp | 193 +++ .../qfile_vs_qnetworkaccessmanager.pro | 13 + .../network/access/qnetworkreply/qnetworkreply.pro | 13 + .../access/qnetworkreply/tst_qnetworkreply.cpp | 656 ++++++++ tests/benchmarks/network/kernel/kernel.pro | 3 + tests/benchmarks/network/kernel/qhostinfo/main.cpp | 96 ++ .../network/kernel/qhostinfo/qhostinfo.pro | 13 + tests/benchmarks/network/network.pro | 5 + .../network/socket/qtcpserver/qtcpserver.pro | 13 + .../network/socket/qtcpserver/tst_qtcpserver.cpp | 277 ++++ tests/benchmarks/network/socket/socket.pro | 3 + tests/benchmarks/qanimation/dummyanimation.cpp | 61 - tests/benchmarks/qanimation/dummyanimation.h | 60 - tests/benchmarks/qanimation/dummyobject.cpp | 66 - tests/benchmarks/qanimation/dummyobject.h | 64 - tests/benchmarks/qanimation/main.cpp | 191 --- tests/benchmarks/qanimation/qanimation.pro | 18 - tests/benchmarks/qanimation/rectanimation.cpp | 94 -- tests/benchmarks/qanimation/rectanimation.h | 70 - tests/benchmarks/qapplication/main.cpp | 71 - tests/benchmarks/qapplication/qapplication.pro | 10 - tests/benchmarks/qbytearray/main.cpp | 92 -- tests/benchmarks/qbytearray/qbytearray.pro | 12 - tests/benchmarks/qdir/qdir.pro | 8 - tests/benchmarks/qdir/tst_qdir.cpp | 198 --- tests/benchmarks/qdiriterator/main.cpp | 251 --- tests/benchmarks/qdiriterator/qdiriterator.pro | 23 - .../qdiriterator/qfilesystemiterator.cpp | 678 -------- .../benchmarks/qdiriterator/qfilesystemiterator.h | 99 -- tests/benchmarks/qfile/main.cpp | 675 -------- tests/benchmarks/qfile/qfile.pro | 7 - .../qfile_vs_qnetworkaccessmanager/main.cpp | 193 --- .../qfile_vs_qnetworkaccessmanager.pro | 13 - tests/benchmarks/qfileinfo/main.cpp | 83 - tests/benchmarks/qfileinfo/qfileinfo.pro | 12 - tests/benchmarks/qfontmetrics/main.cpp | 112 -- tests/benchmarks/qfontmetrics/qfontmetrics.pro | 5 - .../qgraphicsanchorlayout.pro | 6 - .../tst_qgraphicsanchorlayout.cpp | 433 ------ tests/benchmarks/qgraphicsitem/qgraphicsitem.pro | 5 - .../benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp | 243 --- tests/benchmarks/qgraphicsscene/qgraphicsscene.pro | 6 - .../qgraphicsscene/tst_qgraphicsscene.cpp | 248 --- .../qgraphicsview/benchapps/chipTest/chip.cpp | 176 --- .../qgraphicsview/benchapps/chipTest/chip.debug | Bin 863805 -> 0 bytes .../qgraphicsview/benchapps/chipTest/chip.h | 68 - .../qgraphicsview/benchapps/chipTest/chip.pro | 19 - .../qgraphicsview/benchapps/chipTest/fileprint.png | Bin 1456 -> 0 bytes .../qgraphicsview/benchapps/chipTest/images.qrc | 10 - .../qgraphicsview/benchapps/chipTest/main.cpp | 57 - .../benchapps/chipTest/mainwindow.cpp | 87 -- .../qgraphicsview/benchapps/chipTest/mainwindow.h | 66 - .../qgraphicsview/benchapps/chipTest/qt4logo.png | Bin 48333 -> 0 bytes .../benchapps/chipTest/rotateleft.png | Bin 1754 -> 0 bytes .../benchapps/chipTest/rotateright.png | Bin 1732 -> 0 bytes .../qgraphicsview/benchapps/chipTest/view.cpp | 257 --- .../qgraphicsview/benchapps/chipTest/view.h | 86 -- .../qgraphicsview/benchapps/chipTest/zoomin.png | Bin 1622 -> 0 bytes .../qgraphicsview/benchapps/chipTest/zoomout.png | Bin 1601 -> 0 bytes .../qgraphicsview/benchapps/moveItems/main.cpp | 106 -- .../benchapps/moveItems/moveItems.pro | 1 - .../qgraphicsview/benchapps/scrolltest/main.cpp | 146 -- .../benchapps/scrolltest/scrolltest.pro | 1 - tests/benchmarks/qgraphicsview/chiptester/chip.cpp | 182 --- tests/benchmarks/qgraphicsview/chiptester/chip.h | 68 - .../qgraphicsview/chiptester/chiptester.cpp | 144 -- .../qgraphicsview/chiptester/chiptester.h | 85 - .../qgraphicsview/chiptester/chiptester.pri | 12 - .../benchmarks/qgraphicsview/chiptester/images.qrc | 5 - .../qgraphicsview/chiptester/qt4logo.png | Bin 48333 -> 0 bytes tests/benchmarks/qgraphicsview/images/designer.png | Bin 4205 -> 0 bytes .../benchmarks/qgraphicsview/images/wine-big.jpeg | Bin 12249 -> 0 bytes tests/benchmarks/qgraphicsview/images/wine.jpeg | Bin 2265 -> 0 bytes tests/benchmarks/qgraphicsview/qgraphicsview.pro | 16 - tests/benchmarks/qgraphicsview/qgraphicsview.qrc | 9 - tests/benchmarks/qgraphicsview/random.data | Bin 800 -> 0 bytes .../benchmarks/qgraphicsview/tst_qgraphicsview.cpp | 908 ----------- .../benchmarks/qgraphicswidget/qgraphicswidget.pro | 6 - .../qgraphicswidget/tst_qgraphicswidget.cpp | 94 -- tests/benchmarks/qhostinfo/main.cpp | 96 -- tests/benchmarks/qhostinfo/qhostinfo.pro | 13 - tests/benchmarks/qimagereader/images/16bpp.bmp | Bin 153654 -> 0 bytes tests/benchmarks/qimagereader/images/4bpp-rle.bmp | Bin 23662 -> 0 bytes .../benchmarks/qimagereader/images/YCbCr_cmyk.jpg | Bin 3699 -> 0 bytes .../benchmarks/qimagereader/images/YCbCr_cmyk.png | Bin 230 -> 0 bytes tests/benchmarks/qimagereader/images/YCbCr_rgb.jpg | Bin 2045 -> 0 bytes tests/benchmarks/qimagereader/images/away.png | Bin 753 -> 0 bytes tests/benchmarks/qimagereader/images/ball.mng | Bin 34394 -> 0 bytes tests/benchmarks/qimagereader/images/bat1.gif | Bin 953 -> 0 bytes tests/benchmarks/qimagereader/images/bat2.gif | Bin 980 -> 0 bytes tests/benchmarks/qimagereader/images/beavis.jpg | Bin 20688 -> 0 bytes tests/benchmarks/qimagereader/images/black.png | Bin 697 -> 0 bytes tests/benchmarks/qimagereader/images/black.xpm | 65 - tests/benchmarks/qimagereader/images/colorful.bmp | Bin 65002 -> 0 bytes .../qimagereader/images/corrupt-colors.xpm | 26 - .../qimagereader/images/corrupt-data.tif | Bin 8590 -> 0 bytes .../qimagereader/images/corrupt-pixels.xpm | 7 - tests/benchmarks/qimagereader/images/corrupt.bmp | Bin 116 -> 0 bytes tests/benchmarks/qimagereader/images/corrupt.gif | Bin 2608 -> 0 bytes tests/benchmarks/qimagereader/images/corrupt.jpg | Bin 18 -> 0 bytes tests/benchmarks/qimagereader/images/corrupt.mng | Bin 183 -> 0 bytes tests/benchmarks/qimagereader/images/corrupt.png | Bin 95 -> 0 bytes tests/benchmarks/qimagereader/images/corrupt.xbm | 5 - .../qimagereader/images/crash-signed-char.bmp | Bin 45748 -> 0 bytes tests/benchmarks/qimagereader/images/earth.gif | Bin 51712 -> 0 bytes tests/benchmarks/qimagereader/images/fire.mng | Bin 44430 -> 0 bytes tests/benchmarks/qimagereader/images/font.bmp | Bin 1026 -> 0 bytes tests/benchmarks/qimagereader/images/gnus.xbm | 622 -------- tests/benchmarks/qimagereader/images/image.pbm | 8 - tests/benchmarks/qimagereader/images/image.pgm | 10 - tests/benchmarks/qimagereader/images/image.png | Bin 549 -> 0 bytes tests/benchmarks/qimagereader/images/image.ppm | 7 - tests/benchmarks/qimagereader/images/kollada-noext | Bin 13907 -> 0 bytes tests/benchmarks/qimagereader/images/kollada.png | Bin 13907 -> 0 bytes tests/benchmarks/qimagereader/images/marble.xpm | 470 ------ .../benchmarks/qimagereader/images/namedcolors.xpm | 18 - .../qimagereader/images/negativeheight.bmp | Bin 24630 -> 0 bytes .../benchmarks/qimagereader/images/noclearcode.bmp | Bin 326 -> 0 bytes .../benchmarks/qimagereader/images/noclearcode.gif | Bin 130 -> 0 bytes .../qimagereader/images/nontransparent.xpm | 788 ---------- .../qimagereader/images/pngwithcompressedtext.png | Bin 757 -> 0 bytes .../benchmarks/qimagereader/images/pngwithtext.png | Bin 796 -> 0 bytes .../images/rgba_adobedeflate_littleendian.tif | Bin 4784 -> 0 bytes .../qimagereader/images/rgba_lzw_littleendian.tif | Bin 26690 -> 0 bytes .../images/rgba_nocompression_bigendian.tif | Bin 160384 -> 0 bytes .../images/rgba_nocompression_littleendian.tif | Bin 160388 -> 0 bytes .../images/rgba_packbits_littleendian.tif | Bin 161370 -> 0 bytes .../images/rgba_zipdeflate_littleendian.tif | Bin 14728 -> 0 bytes tests/benchmarks/qimagereader/images/runners.ppm | Bin 960016 -> 0 bytes .../benchmarks/qimagereader/images/task210380.jpg | Bin 975535 -> 0 bytes tests/benchmarks/qimagereader/images/teapot.ppm | 31 - tests/benchmarks/qimagereader/images/test.ppm | 2 - tests/benchmarks/qimagereader/images/test.xpm | 260 ---- .../benchmarks/qimagereader/images/transparent.xpm | 788 ---------- tests/benchmarks/qimagereader/images/trolltech.gif | Bin 42629 -> 0 bytes tests/benchmarks/qimagereader/images/tst7.bmp | Bin 582 -> 0 bytes tests/benchmarks/qimagereader/images/tst7.png | Bin 167 -> 0 bytes tests/benchmarks/qimagereader/qimagereader.pro | 27 - tests/benchmarks/qimagereader/tst_qimagereader.cpp | 244 --- tests/benchmarks/qiodevice/main.cpp | 107 -- tests/benchmarks/qiodevice/qiodevice.pro | 13 - tests/benchmarks/qmatrix4x4/qmatrix4x4.pro | 6 - tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp | 672 -------- tests/benchmarks/qmetaobject/main.cpp | 159 -- tests/benchmarks/qmetaobject/qmetaobject.pro | 5 - tests/benchmarks/qnetworkreply/qnetworkreply.pro | 13 - .../benchmarks/qnetworkreply/tst_qnetworkreply.cpp | 656 -------- tests/benchmarks/qobject/main.cpp | 180 --- tests/benchmarks/qobject/object.cpp | 65 - tests/benchmarks/qobject/object.h | 75 - tests/benchmarks/qobject/qobject.pro | 9 - tests/benchmarks/qpainter/qpainter.pro | 5 - tests/benchmarks/qpainter/tst_qpainter.cpp | 1633 -------------------- tests/benchmarks/qpixmap/qpixmap.pro | 5 - tests/benchmarks/qpixmap/tst_qpixmap.cpp | 227 --- tests/benchmarks/qpixmapcache/qpixmapcache.pro | 6 - tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp | 226 --- tests/benchmarks/qquaternion/qquaternion.pro | 6 - tests/benchmarks/qquaternion/tst_qquaternion.cpp | 124 -- tests/benchmarks/qrect/main.cpp | 329 ---- tests/benchmarks/qrect/qrect.pro | 12 - tests/benchmarks/qregexp/main.cpp | 290 ---- tests/benchmarks/qregexp/qregexp.pro | 12 - tests/benchmarks/qregion/main.cpp | 89 -- tests/benchmarks/qregion/qregion.pro | 10 - tests/benchmarks/qscriptclass/qscriptclass.pro | 7 - tests/benchmarks/qscriptclass/tst_qscriptclass.cpp | 511 ------ tests/benchmarks/qscriptengine/qscriptengine.pro | 12 - .../benchmarks/qscriptengine/tst_qscriptengine.cpp | 289 ---- tests/benchmarks/qscriptvalue/qscriptvalue.pro | 7 - tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp | 205 --- tests/benchmarks/qstring/main.cpp | 147 -- tests/benchmarks/qstring/qstring.pro | 16 - tests/benchmarks/qstring/utf-8.txt | 72 - tests/benchmarks/qstringbuilder/main.cpp | 464 ------ tests/benchmarks/qstringbuilder/qstringbuilder.pro | 12 - tests/benchmarks/qstringlist/.gitignore | 1 - tests/benchmarks/qstringlist/main.cpp | 193 --- tests/benchmarks/qstringlist/qstringlist.pro | 6 - tests/benchmarks/qstylesheetstyle/main.cpp | 192 --- .../qstylesheetstyle/qstylesheetstyle.pro | 11 - tests/benchmarks/qsvgrenderer/data/tiger.svg | 730 --------- tests/benchmarks/qsvgrenderer/qsvgrenderer.pro | 9 - tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc | 6 - tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp | 103 -- tests/benchmarks/qtableview/qtableview.pro | 6 - tests/benchmarks/qtableview/tst_qtableview.cpp | 367 ----- tests/benchmarks/qtcpserver/qtcpserver.pro | 13 - tests/benchmarks/qtcpserver/tst_qtcpserver.cpp | 277 ---- tests/benchmarks/qtemporaryfile/main.cpp | 103 -- tests/benchmarks/qtemporaryfile/qtemporaryfile.pro | 12 - tests/benchmarks/qtext/bidi.txt | 4 - tests/benchmarks/qtext/main.cpp | 415 ----- tests/benchmarks/qtext/qtext.pro | 14 - tests/benchmarks/qthreadstorage/qthreadstorage.pro | 6 - .../qthreadstorage/tst_qthreadstorage.cpp | 124 -- tests/benchmarks/qtransform/qtransform.pro | 6 - tests/benchmarks/qtransform/tst_qtransform.cpp | 592 ------- tests/benchmarks/qvariant/qvariant.pro | 11 - tests/benchmarks/qvariant/tst_qvariant.cpp | 180 --- tests/benchmarks/qwidget/qwidget.pro | 4 - tests/benchmarks/qwidget/tst_qwidget.cpp | 332 ---- .../script/qscriptclass/qscriptclass.pro | 7 + .../script/qscriptclass/tst_qscriptclass.cpp | 511 ++++++ .../script/qscriptengine/qscriptengine.pro | 12 + .../script/qscriptengine/tst_qscriptengine.cpp | 289 ++++ .../script/qscriptvalue/qscriptvalue.pro | 7 + .../script/qscriptvalue/tst_qscriptvalue.cpp | 205 +++ tests/benchmarks/script/script.pro | 5 + tests/benchmarks/svg/qsvgrenderer/data/tiger.svg | 730 +++++++++ tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro | 9 + tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.qrc | 6 + .../svg/qsvgrenderer/tst_qsvgrenderer.cpp | 103 ++ tests/benchmarks/svg/svg.pro | 3 + tests/tests.pro | 3 +- 421 files changed, 21488 insertions(+), 21421 deletions(-) delete mode 100644 tests/benchmarks/blendbench/blendbench.pro delete mode 100644 tests/benchmarks/blendbench/main.cpp delete mode 100644 tests/benchmarks/containers-associative/containers-associative.pro delete mode 100644 tests/benchmarks/containers-associative/main.cpp delete mode 100644 tests/benchmarks/containers-sequential/containers-sequential.pro delete mode 100644 tests/benchmarks/containers-sequential/main.cpp create mode 100644 tests/benchmarks/corelib/corelib.pro create mode 100644 tests/benchmarks/corelib/io/io.pro create mode 100644 tests/benchmarks/corelib/io/qdir/qdir.pro create mode 100644 tests/benchmarks/corelib/io/qdir/tst_qdir.cpp create mode 100644 tests/benchmarks/corelib/io/qdiriterator/main.cpp create mode 100755 tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro create mode 100644 tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp create mode 100644 tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h create mode 100644 tests/benchmarks/corelib/io/qfile/main.cpp create mode 100644 tests/benchmarks/corelib/io/qfile/qfile.pro create mode 100644 tests/benchmarks/corelib/io/qfileinfo/main.cpp create mode 100644 tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro create mode 100644 tests/benchmarks/corelib/io/qiodevice/main.cpp create mode 100755 tests/benchmarks/corelib/io/qiodevice/qiodevice.pro create mode 100644 tests/benchmarks/corelib/io/qtemporaryfile/main.cpp create mode 100644 tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro create mode 100644 tests/benchmarks/corelib/kernel/events/events.pro create mode 100644 tests/benchmarks/corelib/kernel/events/main.cpp create mode 100644 tests/benchmarks/corelib/kernel/kernel.pro create mode 100644 tests/benchmarks/corelib/kernel/qmetaobject/main.cpp create mode 100644 tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro create mode 100644 tests/benchmarks/corelib/kernel/qobject/main.cpp create mode 100644 tests/benchmarks/corelib/kernel/qobject/object.cpp create mode 100644 tests/benchmarks/corelib/kernel/qobject/object.h create mode 100644 tests/benchmarks/corelib/kernel/qobject/qobject.pro create mode 100644 tests/benchmarks/corelib/kernel/qvariant/qvariant.pro create mode 100644 tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp create mode 100644 tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro create mode 100644 tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp create mode 100644 tests/benchmarks/corelib/thread/thread.pro create mode 100644 tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro create mode 100644 tests/benchmarks/corelib/tools/containers-associative/main.cpp create mode 100644 tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro create mode 100644 tests/benchmarks/corelib/tools/containers-sequential/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qbytearray/main.cpp create mode 100755 tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro create mode 100644 tests/benchmarks/corelib/tools/qrect/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qrect/qrect.pro create mode 100644 tests/benchmarks/corelib/tools/qregexp/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qregexp/qregexp.pro create mode 100644 tests/benchmarks/corelib/tools/qstring/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qstring/qstring.pro create mode 100644 tests/benchmarks/corelib/tools/qstring/utf-8.txt create mode 100644 tests/benchmarks/corelib/tools/qstringbuilder/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro create mode 100644 tests/benchmarks/corelib/tools/qstringlist/.gitignore create mode 100644 tests/benchmarks/corelib/tools/qstringlist/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro create mode 100644 tests/benchmarks/corelib/tools/tools.pro delete mode 100644 tests/benchmarks/events/events.pro delete mode 100644 tests/benchmarks/events/main.cpp create mode 100644 tests/benchmarks/gui/animation/animation.pro create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyanimation.h create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyobject.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyobject.h create mode 100644 tests/benchmarks/gui/animation/qanimation/main.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/qanimation.pro create mode 100644 tests/benchmarks/gui/animation/qanimation/rectanimation.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/rectanimation.h create mode 100644 tests/benchmarks/gui/graphicsview/graphicsview.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/fileprint.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/images.qrc create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/qt4logo.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateleft.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateright.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomin.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomout.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/moveItems.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/scrolltest.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/images.qrc create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/qt4logo.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/images/designer.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine-big.jpeg create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine.jpeg create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.qrc create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/random.data create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp create mode 100644 tests/benchmarks/gui/gui.pro create mode 100644 tests/benchmarks/gui/image/blendbench/blendbench.pro create mode 100644 tests/benchmarks/gui/image/blendbench/main.cpp create mode 100644 tests/benchmarks/gui/image/image.pro create mode 100644 tests/benchmarks/gui/image/qimagereader/images/16bpp.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/4bpp-rle.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/YCbCr_rgb.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/away.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/ball.mng create mode 100644 tests/benchmarks/gui/image/qimagereader/images/bat1.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/bat2.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/beavis.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/black.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/black.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/colorful.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt-colors.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt-data.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt-pixels.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.mng create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.xbm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/crash-signed-char.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/earth.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/fire.mng create mode 100644 tests/benchmarks/gui/image/qimagereader/images/font.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/gnus.xbm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.pbm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.pgm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/kollada-noext create mode 100644 tests/benchmarks/gui/image/qimagereader/images/kollada.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/marble.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/namedcolors.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/negativeheight.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/noclearcode.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/noclearcode.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/nontransparent.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/pngwithcompressedtext.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/pngwithtext.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_lzw_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_packbits_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/runners.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/task210380.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/teapot.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/test.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/test.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/transparent.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/trolltech.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/tst7.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/tst7.png create mode 100644 tests/benchmarks/gui/image/qimagereader/qimagereader.pro create mode 100644 tests/benchmarks/gui/image/qimagereader/tst_qimagereader.cpp create mode 100644 tests/benchmarks/gui/image/qpixmap/qpixmap.pro create mode 100644 tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp create mode 100644 tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro create mode 100644 tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp create mode 100644 tests/benchmarks/gui/itemviews/itemviews.pro create mode 100644 tests/benchmarks/gui/itemviews/qtableview/qtableview.pro create mode 100644 tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp create mode 100644 tests/benchmarks/gui/kernel/kernel.pro create mode 100644 tests/benchmarks/gui/kernel/qapplication/main.cpp create mode 100644 tests/benchmarks/gui/kernel/qapplication/qapplication.pro create mode 100644 tests/benchmarks/gui/kernel/qwidget/qwidget.pro create mode 100644 tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp create mode 100644 tests/benchmarks/gui/math3d/math3d.pro create mode 100644 tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro create mode 100644 tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp create mode 100644 tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro create mode 100644 tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp create mode 100644 tests/benchmarks/gui/painting/painting.pro create mode 100644 tests/benchmarks/gui/painting/qpainter/qpainter.pro create mode 100644 tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp create mode 100644 tests/benchmarks/gui/painting/qregion/main.cpp create mode 100644 tests/benchmarks/gui/painting/qregion/qregion.pro create mode 100644 tests/benchmarks/gui/painting/qtransform/qtransform.pro create mode 100644 tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp create mode 100644 tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp create mode 100644 tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro create mode 100644 tests/benchmarks/gui/styles/styles.pro create mode 100644 tests/benchmarks/gui/text/qfontmetrics/main.cpp create mode 100644 tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro create mode 100644 tests/benchmarks/gui/text/qtext/bidi.txt create mode 100644 tests/benchmarks/gui/text/qtext/main.cpp create mode 100644 tests/benchmarks/gui/text/qtext/qtext.pro create mode 100644 tests/benchmarks/gui/text/text.pro create mode 100644 tests/benchmarks/network/access/access.pro create mode 100644 tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp create mode 100644 tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro create mode 100644 tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro create mode 100644 tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp create mode 100644 tests/benchmarks/network/kernel/kernel.pro create mode 100644 tests/benchmarks/network/kernel/qhostinfo/main.cpp create mode 100755 tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro create mode 100644 tests/benchmarks/network/network.pro create mode 100644 tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro create mode 100644 tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp create mode 100644 tests/benchmarks/network/socket/socket.pro delete mode 100644 tests/benchmarks/qanimation/dummyanimation.cpp delete mode 100644 tests/benchmarks/qanimation/dummyanimation.h delete mode 100644 tests/benchmarks/qanimation/dummyobject.cpp delete mode 100644 tests/benchmarks/qanimation/dummyobject.h delete mode 100644 tests/benchmarks/qanimation/main.cpp delete mode 100644 tests/benchmarks/qanimation/qanimation.pro delete mode 100644 tests/benchmarks/qanimation/rectanimation.cpp delete mode 100644 tests/benchmarks/qanimation/rectanimation.h delete mode 100644 tests/benchmarks/qapplication/main.cpp delete mode 100644 tests/benchmarks/qapplication/qapplication.pro delete mode 100644 tests/benchmarks/qbytearray/main.cpp delete mode 100755 tests/benchmarks/qbytearray/qbytearray.pro delete mode 100644 tests/benchmarks/qdir/qdir.pro delete mode 100644 tests/benchmarks/qdir/tst_qdir.cpp delete mode 100644 tests/benchmarks/qdiriterator/main.cpp delete mode 100755 tests/benchmarks/qdiriterator/qdiriterator.pro delete mode 100644 tests/benchmarks/qdiriterator/qfilesystemiterator.cpp delete mode 100644 tests/benchmarks/qdiriterator/qfilesystemiterator.h delete mode 100644 tests/benchmarks/qfile/main.cpp delete mode 100644 tests/benchmarks/qfile/qfile.pro delete mode 100644 tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp delete mode 100644 tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro delete mode 100644 tests/benchmarks/qfileinfo/main.cpp delete mode 100644 tests/benchmarks/qfileinfo/qfileinfo.pro delete mode 100644 tests/benchmarks/qfontmetrics/main.cpp delete mode 100644 tests/benchmarks/qfontmetrics/qfontmetrics.pro delete mode 100644 tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro delete mode 100644 tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp delete mode 100644 tests/benchmarks/qgraphicsitem/qgraphicsitem.pro delete mode 100644 tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp delete mode 100644 tests/benchmarks/qgraphicsscene/qgraphicsscene.pro delete mode 100644 tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.debug delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.h delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.pro delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/fileprint.png delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/images.qrc delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/main.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.h delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/qt4logo.png delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateleft.png delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateright.png delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/view.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/view.h delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomin.png delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomout.png delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/moveItems/main.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/moveItems/moveItems.pro delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp delete mode 100644 tests/benchmarks/qgraphicsview/benchapps/scrolltest/scrolltest.pro delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/chip.cpp delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/chip.h delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/chiptester.cpp delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/chiptester.h delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/chiptester.pri delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/images.qrc delete mode 100644 tests/benchmarks/qgraphicsview/chiptester/qt4logo.png delete mode 100644 tests/benchmarks/qgraphicsview/images/designer.png delete mode 100644 tests/benchmarks/qgraphicsview/images/wine-big.jpeg delete mode 100644 tests/benchmarks/qgraphicsview/images/wine.jpeg delete mode 100644 tests/benchmarks/qgraphicsview/qgraphicsview.pro delete mode 100644 tests/benchmarks/qgraphicsview/qgraphicsview.qrc delete mode 100644 tests/benchmarks/qgraphicsview/random.data delete mode 100644 tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp delete mode 100644 tests/benchmarks/qgraphicswidget/qgraphicswidget.pro delete mode 100644 tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp delete mode 100644 tests/benchmarks/qhostinfo/main.cpp delete mode 100755 tests/benchmarks/qhostinfo/qhostinfo.pro delete mode 100644 tests/benchmarks/qimagereader/images/16bpp.bmp delete mode 100644 tests/benchmarks/qimagereader/images/4bpp-rle.bmp delete mode 100644 tests/benchmarks/qimagereader/images/YCbCr_cmyk.jpg delete mode 100644 tests/benchmarks/qimagereader/images/YCbCr_cmyk.png delete mode 100644 tests/benchmarks/qimagereader/images/YCbCr_rgb.jpg delete mode 100644 tests/benchmarks/qimagereader/images/away.png delete mode 100644 tests/benchmarks/qimagereader/images/ball.mng delete mode 100644 tests/benchmarks/qimagereader/images/bat1.gif delete mode 100644 tests/benchmarks/qimagereader/images/bat2.gif delete mode 100644 tests/benchmarks/qimagereader/images/beavis.jpg delete mode 100644 tests/benchmarks/qimagereader/images/black.png delete mode 100644 tests/benchmarks/qimagereader/images/black.xpm delete mode 100644 tests/benchmarks/qimagereader/images/colorful.bmp delete mode 100644 tests/benchmarks/qimagereader/images/corrupt-colors.xpm delete mode 100644 tests/benchmarks/qimagereader/images/corrupt-data.tif delete mode 100644 tests/benchmarks/qimagereader/images/corrupt-pixels.xpm delete mode 100644 tests/benchmarks/qimagereader/images/corrupt.bmp delete mode 100644 tests/benchmarks/qimagereader/images/corrupt.gif delete mode 100644 tests/benchmarks/qimagereader/images/corrupt.jpg delete mode 100644 tests/benchmarks/qimagereader/images/corrupt.mng delete mode 100644 tests/benchmarks/qimagereader/images/corrupt.png delete mode 100644 tests/benchmarks/qimagereader/images/corrupt.xbm delete mode 100644 tests/benchmarks/qimagereader/images/crash-signed-char.bmp delete mode 100644 tests/benchmarks/qimagereader/images/earth.gif delete mode 100644 tests/benchmarks/qimagereader/images/fire.mng delete mode 100644 tests/benchmarks/qimagereader/images/font.bmp delete mode 100644 tests/benchmarks/qimagereader/images/gnus.xbm delete mode 100644 tests/benchmarks/qimagereader/images/image.pbm delete mode 100644 tests/benchmarks/qimagereader/images/image.pgm delete mode 100644 tests/benchmarks/qimagereader/images/image.png delete mode 100644 tests/benchmarks/qimagereader/images/image.ppm delete mode 100644 tests/benchmarks/qimagereader/images/kollada-noext delete mode 100644 tests/benchmarks/qimagereader/images/kollada.png delete mode 100644 tests/benchmarks/qimagereader/images/marble.xpm delete mode 100644 tests/benchmarks/qimagereader/images/namedcolors.xpm delete mode 100644 tests/benchmarks/qimagereader/images/negativeheight.bmp delete mode 100644 tests/benchmarks/qimagereader/images/noclearcode.bmp delete mode 100644 tests/benchmarks/qimagereader/images/noclearcode.gif delete mode 100644 tests/benchmarks/qimagereader/images/nontransparent.xpm delete mode 100644 tests/benchmarks/qimagereader/images/pngwithcompressedtext.png delete mode 100644 tests/benchmarks/qimagereader/images/pngwithtext.png delete mode 100644 tests/benchmarks/qimagereader/images/rgba_adobedeflate_littleendian.tif delete mode 100644 tests/benchmarks/qimagereader/images/rgba_lzw_littleendian.tif delete mode 100644 tests/benchmarks/qimagereader/images/rgba_nocompression_bigendian.tif delete mode 100644 tests/benchmarks/qimagereader/images/rgba_nocompression_littleendian.tif delete mode 100644 tests/benchmarks/qimagereader/images/rgba_packbits_littleendian.tif delete mode 100644 tests/benchmarks/qimagereader/images/rgba_zipdeflate_littleendian.tif delete mode 100644 tests/benchmarks/qimagereader/images/runners.ppm delete mode 100644 tests/benchmarks/qimagereader/images/task210380.jpg delete mode 100644 tests/benchmarks/qimagereader/images/teapot.ppm delete mode 100644 tests/benchmarks/qimagereader/images/test.ppm delete mode 100644 tests/benchmarks/qimagereader/images/test.xpm delete mode 100644 tests/benchmarks/qimagereader/images/transparent.xpm delete mode 100644 tests/benchmarks/qimagereader/images/trolltech.gif delete mode 100644 tests/benchmarks/qimagereader/images/tst7.bmp delete mode 100644 tests/benchmarks/qimagereader/images/tst7.png delete mode 100644 tests/benchmarks/qimagereader/qimagereader.pro delete mode 100644 tests/benchmarks/qimagereader/tst_qimagereader.cpp delete mode 100644 tests/benchmarks/qiodevice/main.cpp delete mode 100755 tests/benchmarks/qiodevice/qiodevice.pro delete mode 100644 tests/benchmarks/qmatrix4x4/qmatrix4x4.pro delete mode 100644 tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp delete mode 100644 tests/benchmarks/qmetaobject/main.cpp delete mode 100644 tests/benchmarks/qmetaobject/qmetaobject.pro delete mode 100644 tests/benchmarks/qnetworkreply/qnetworkreply.pro delete mode 100644 tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp delete mode 100644 tests/benchmarks/qobject/main.cpp delete mode 100644 tests/benchmarks/qobject/object.cpp delete mode 100644 tests/benchmarks/qobject/object.h delete mode 100644 tests/benchmarks/qobject/qobject.pro delete mode 100644 tests/benchmarks/qpainter/qpainter.pro delete mode 100644 tests/benchmarks/qpainter/tst_qpainter.cpp delete mode 100644 tests/benchmarks/qpixmap/qpixmap.pro delete mode 100644 tests/benchmarks/qpixmap/tst_qpixmap.cpp delete mode 100644 tests/benchmarks/qpixmapcache/qpixmapcache.pro delete mode 100644 tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp delete mode 100644 tests/benchmarks/qquaternion/qquaternion.pro delete mode 100644 tests/benchmarks/qquaternion/tst_qquaternion.cpp delete mode 100644 tests/benchmarks/qrect/main.cpp delete mode 100644 tests/benchmarks/qrect/qrect.pro delete mode 100644 tests/benchmarks/qregexp/main.cpp delete mode 100644 tests/benchmarks/qregexp/qregexp.pro delete mode 100644 tests/benchmarks/qregion/main.cpp delete mode 100644 tests/benchmarks/qregion/qregion.pro delete mode 100644 tests/benchmarks/qscriptclass/qscriptclass.pro delete mode 100644 tests/benchmarks/qscriptclass/tst_qscriptclass.cpp delete mode 100644 tests/benchmarks/qscriptengine/qscriptengine.pro delete mode 100644 tests/benchmarks/qscriptengine/tst_qscriptengine.cpp delete mode 100644 tests/benchmarks/qscriptvalue/qscriptvalue.pro delete mode 100644 tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp delete mode 100644 tests/benchmarks/qstring/main.cpp delete mode 100644 tests/benchmarks/qstring/qstring.pro delete mode 100644 tests/benchmarks/qstring/utf-8.txt delete mode 100644 tests/benchmarks/qstringbuilder/main.cpp delete mode 100644 tests/benchmarks/qstringbuilder/qstringbuilder.pro delete mode 100644 tests/benchmarks/qstringlist/.gitignore delete mode 100644 tests/benchmarks/qstringlist/main.cpp delete mode 100644 tests/benchmarks/qstringlist/qstringlist.pro delete mode 100644 tests/benchmarks/qstylesheetstyle/main.cpp delete mode 100644 tests/benchmarks/qstylesheetstyle/qstylesheetstyle.pro delete mode 100644 tests/benchmarks/qsvgrenderer/data/tiger.svg delete mode 100644 tests/benchmarks/qsvgrenderer/qsvgrenderer.pro delete mode 100644 tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc delete mode 100644 tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp delete mode 100644 tests/benchmarks/qtableview/qtableview.pro delete mode 100644 tests/benchmarks/qtableview/tst_qtableview.cpp delete mode 100644 tests/benchmarks/qtcpserver/qtcpserver.pro delete mode 100644 tests/benchmarks/qtcpserver/tst_qtcpserver.cpp delete mode 100644 tests/benchmarks/qtemporaryfile/main.cpp delete mode 100644 tests/benchmarks/qtemporaryfile/qtemporaryfile.pro delete mode 100644 tests/benchmarks/qtext/bidi.txt delete mode 100644 tests/benchmarks/qtext/main.cpp delete mode 100644 tests/benchmarks/qtext/qtext.pro delete mode 100644 tests/benchmarks/qthreadstorage/qthreadstorage.pro delete mode 100644 tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp delete mode 100644 tests/benchmarks/qtransform/qtransform.pro delete mode 100644 tests/benchmarks/qtransform/tst_qtransform.cpp delete mode 100644 tests/benchmarks/qvariant/qvariant.pro delete mode 100644 tests/benchmarks/qvariant/tst_qvariant.cpp delete mode 100644 tests/benchmarks/qwidget/qwidget.pro delete mode 100644 tests/benchmarks/qwidget/tst_qwidget.cpp create mode 100644 tests/benchmarks/script/qscriptclass/qscriptclass.pro create mode 100644 tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp create mode 100644 tests/benchmarks/script/qscriptengine/qscriptengine.pro create mode 100644 tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp create mode 100644 tests/benchmarks/script/qscriptvalue/qscriptvalue.pro create mode 100644 tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp create mode 100644 tests/benchmarks/script/script.pro create mode 100644 tests/benchmarks/svg/qsvgrenderer/data/tiger.svg create mode 100644 tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro create mode 100644 tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.qrc create mode 100644 tests/benchmarks/svg/qsvgrenderer/tst_qsvgrenderer.cpp create mode 100644 tests/benchmarks/svg/svg.pro diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index 7a27cc9..c406d54 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -1,48 +1,8 @@ TEMPLATE = subdirs -SUBDIRS = containers-associative \ - containers-sequential \ - qanimation \ - qbytearray \ - qfileinfo \ - qfile_vs_qnetworkaccessmanager \ - qfontmetrics \ - qhostinfo \ - qpainter \ - qtestlib-simple events \ - qtext \ - qiodevice \ - qpixmap \ - blendbench \ - qstring \ - qstringlist \ - qmatrix4x4 \ - qnetworkreply \ - qobject \ - qrect \ - qregexp \ - qregion \ - qvariant \ - qwidget \ - qtwidgets \ - qapplication \ - qdir \ - qdiriterator \ - qgraphicsanchorlayout \ - qgraphicsitem \ - qgraphicswidget \ - qmetaobject \ - qpixmapcache \ - qquaternion \ - qscriptclass \ - qscriptengine \ - qscriptvalue \ - qstringbuilder \ - qstylesheetstyle \ - qsvgrenderer \ - qtcpserver \ - qtableview \ - qthreadstorage - - - +SUBDIRS = \ + corelib \ + gui \ + network \ + script \ + svg contains(QT_CONFIG, opengl): SUBDIRS += opengl diff --git a/tests/benchmarks/blendbench/blendbench.pro b/tests/benchmarks/blendbench/blendbench.pro deleted file mode 100644 index a3228c5..0000000 --- a/tests/benchmarks/blendbench/blendbench.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_blendbench -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/blendbench/main.cpp b/tests/benchmarks/blendbench/main.cpp deleted file mode 100644 index 92d1633..0000000 --- a/tests/benchmarks/blendbench/main.cpp +++ /dev/null @@ -1,152 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include - -#include - -void paint(QPaintDevice *device) -{ - QPainter p(device); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(0, 0, device->width(), device->height(), Qt::transparent); - - QLinearGradient g(QPoint(0, 0), QPoint(1, 1)); -// g.setCoordinateMode(QGradient::ObjectBoundingMode); - g.setColorAt(0, Qt::magenta); - g.setColorAt(0, Qt::white); - -// p.setOpacity(0.8); - p.setPen(Qt::NoPen); - p.setBrush(g); - p.setRenderHint(QPainter::Antialiasing); - p.setOpacity(0.9); - p.drawEllipse(0, 0, device->width(), device->height()); -} - -QLatin1String compositionModes[] = { - QLatin1String("SourceOver"), - QLatin1String("DestinationOver"), - QLatin1String("Clear"), - QLatin1String("Source"), - QLatin1String("Destination"), - QLatin1String("SourceIn"), - QLatin1String("DestinationIn"), - QLatin1String("SourceOut"), - QLatin1String("DestinationOut"), - QLatin1String("SourceAtop"), - QLatin1String("DestinationAtop"), - QLatin1String("Xor"), - - //svg 1.2 blend modes - QLatin1String("Plus"), - QLatin1String("Multiply"), - QLatin1String("Screen"), - QLatin1String("Overlay"), - QLatin1String("Darken"), - QLatin1String("Lighten"), - QLatin1String("ColorDodge"), - QLatin1String("ColorBurn"), - QLatin1String("HardLight"), - QLatin1String("SoftLight"), - QLatin1String("Difference"), - QLatin1String("Exclusion") -}; - -enum BrushType { ImageBrush, SolidBrush }; -QLatin1String brushTypes[] = { - QLatin1String("ImageBrush"), - QLatin1String("SolidBrush"), -}; - -class BlendBench : public QObject -{ - Q_OBJECT -private slots: - void blendBench_data(); - void blendBench(); -}; - -void BlendBench::blendBench_data() -{ - int first = 0; - int limit = 12; - if (qApp->arguments().contains("--extended")) { - first = 12; - limit = 24; - } - - QTest::addColumn("brushType"); - QTest::addColumn("compositionMode"); - - for (int brush = ImageBrush; brush <= SolidBrush; ++brush) - for (int mode = first; mode < limit; ++mode) - QTest::newRow(QString("brush=%1; mode=%2") - .arg(brushTypes[brush]).arg(compositionModes[mode]).toAscii().data()) - << brush << mode; -} - -void BlendBench::blendBench() -{ - QFETCH(int, brushType); - QFETCH(int, compositionMode); - - QImage img(512, 512, QImage::Format_ARGB32_Premultiplied); - QImage src(512, 512, QImage::Format_ARGB32_Premultiplied); - paint(&src); - QPainter p(&img); - p.setPen(Qt::NoPen); - - p.setCompositionMode(QPainter::CompositionMode(compositionMode)); - if (brushType == ImageBrush) { - p.setBrush(QBrush(src)); - } else if (brushType == SolidBrush) { - p.setBrush(QColor(127, 127, 127, 127)); - } - - QBENCHMARK { - p.drawRect(0, 0, 512, 512); - } -} - -QTEST_MAIN(BlendBench) - -#include "main.moc" diff --git a/tests/benchmarks/containers-associative/containers-associative.pro b/tests/benchmarks/containers-associative/containers-associative.pro deleted file mode 100644 index c6f3fa6..0000000 --- a/tests/benchmarks/containers-associative/containers-associative.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_containers-associative -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/containers-associative/main.cpp b/tests/benchmarks/containers-associative/main.cpp deleted file mode 100644 index 4c6dae4..0000000 --- a/tests/benchmarks/containers-associative/main.cpp +++ /dev/null @@ -1,143 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include - -#include - -class tst_associative_containers : public QObject -{ - Q_OBJECT -private slots: - void insert_data(); - void insert(); - void lookup_data(); - void lookup(); -}; - -template -void testInsert(int size) -{ - T container; - - QBENCHMARK { - for (int i = 0; i < size; ++i) - container.insert(i, i); - } -} - -void tst_associative_containers::insert_data() -{ - QTest::addColumn("useHash"); - QTest::addColumn("size"); - - for (int size = 10; size < 20000; size += 100) { - - const QByteArray sizeString = QByteArray::number(size); - - QTest::newRow(("hash--" + sizeString).constData()) << true << size; - QTest::newRow(("map--" + sizeString).constData()) << false << size; - } -} - -void tst_associative_containers::insert() -{ - QFETCH(bool, useHash); - QFETCH(int, size); - - QHash testHash; - QMap testMap; - - if (useHash) { - testInsert >(size); - } else { - testInsert >(size); - } -} - -void tst_associative_containers::lookup_data() -{ -// setReportType(LineChartReport); -// setChartTitle("Time to call value(), with an increasing number of items in the container"); - - QTest::addColumn("useHash"); - QTest::addColumn("size"); - - for (int size = 10; size < 20000; size += 100) { - - const QByteArray sizeString = QByteArray::number(size); - - QTest::newRow(("hash--" + sizeString).constData()) << true << size; - QTest::newRow(("map--" + sizeString).constData()) << false << size; - } -} - -template -void testLookup(int size) -{ - T container; - - for (int i = 0; i < size; ++i) - container.insert(i, i); - - int val; - - QBENCHMARK { - for (int i = 0; i < size; ++i) - val = container.value(i); - - } -} - -void tst_associative_containers::lookup() -{ - QFETCH(bool, useHash); - QFETCH(int, size); - - if (useHash) { - testLookup >(size); - } else { - testLookup >(size); - } -} - -QTEST_MAIN(tst_associative_containers) -#include "main.moc" diff --git a/tests/benchmarks/containers-sequential/containers-sequential.pro b/tests/benchmarks/containers-sequential/containers-sequential.pro deleted file mode 100644 index bf6db44..0000000 --- a/tests/benchmarks/containers-sequential/containers-sequential.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_containers-sequential -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/containers-sequential/main.cpp b/tests/benchmarks/containers-sequential/main.cpp deleted file mode 100644 index a6e405c..0000000 --- a/tests/benchmarks/containers-sequential/main.cpp +++ /dev/null @@ -1,265 +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 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 -#include -#include - -#include - -template // 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 -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 -class UseCases_QVector : public UseCases -{ - void insert(int size) - { - QVector v; - T t; - QBENCHMARK { - for (int i = 0; i < size; ++i) - v.append(t); - } - } - - void lookup(int size) - { - QVector 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(ts); - delete[] ts; - } -}; - -// This subclass implements the use cases using std::vector as efficiently as possible. -template -class UseCases_stdvector : public UseCases -{ - void insert(int size) - { - std::vector v; - T t; - QBENCHMARK { - for (int i = 0; i < size; ++i) - v.push_back(t); - } - } - - void lookup(int size) - { - std::vector 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(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; - useCases_stdvector_int = new UseCases_stdvector; - - useCases_QVector_Large = new UseCases_QVector; - useCases_stdvector_Large = new UseCases_stdvector; - } - -private: - UseCases *useCases_QVector_int; - UseCases *useCases_stdvector_int; - UseCases *useCases_QVector_Large; - UseCases *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("useStd"); - QTest::addColumn("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("useStd"); - QTest::addColumn("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); -} - -void tst_vector_vs_std::lookup_int_data() -{ - QTest::addColumn("useStd"); - QTest::addColumn("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::lookup_int() -{ - QFETCH(bool, useStd); - QFETCH(int, size); - - if (useStd) - useCases_stdvector_int->lookup(size); - else - useCases_QVector_int->lookup(size); -} - -void tst_vector_vs_std::lookup_Large_data() -{ - QTest::addColumn("useStd"); - QTest::addColumn("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/tests/benchmarks/corelib/corelib.pro b/tests/benchmarks/corelib/corelib.pro new file mode 100644 index 0000000..72fca33 --- /dev/null +++ b/tests/benchmarks/corelib/corelib.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +SUBDIRS = \ + io \ + kernel \ + thread \ + tools diff --git a/tests/benchmarks/corelib/io/io.pro b/tests/benchmarks/corelib/io/io.pro new file mode 100644 index 0000000..97445d7 --- /dev/null +++ b/tests/benchmarks/corelib/io/io.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qdir \ + qdiriterator \ + qfile \ + qfileinfo \ + qiodevice \ + qtemporaryfile + diff --git a/tests/benchmarks/corelib/io/qdir/qdir.pro b/tests/benchmarks/corelib/io/qdir/qdir.pro new file mode 100644 index 0000000..2cdebfd --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/qdir.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qdir +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += tst_qdir.cpp diff --git a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp b/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp new file mode 100644 index 0000000..aea9fd0 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** 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 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 + +#ifdef Q_OS_WIN +# include +#else +# include +# include +# include +# include +#endif + +class Test : public QObject{ + Q_OBJECT +public slots: + void initTestCase() { + QDir testdir = QDir::tempPath(); + + const QString subfolder_name = QLatin1String("test_speed"); + QVERIFY(testdir.mkdir(subfolder_name)); + QVERIFY(testdir.cd(subfolder_name)); + + for (uint i=0; i<10000; ++i) { + QFile file(testdir.absolutePath() + "/testfile_" + QString::number(i)); + file.open(QIODevice::WriteOnly); + } + } + void cleanupTestCase() { + { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + testdir.setSorting(QDir::Unsorted); + testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); + foreach (const QString &filename, testdir.entryList()) { + testdir.remove(filename); + } + } + const QDir temp = QDir(QDir::tempPath()); + temp.rmdir(QLatin1String("test_speed")); + } +private slots: + void baseline() {} + + void sizeSpeed() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + QBENCHMARK { + QFileInfoList fileInfoList = testdir.entryInfoList(QDir::Files, QDir::Unsorted); + foreach (const QFileInfo &fileInfo, fileInfoList) { + fileInfo.isDir(); + fileInfo.size(); + } + } + } + void sizeSpeedIterator() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + QBENCHMARK { + QDirIterator dit(testdir.path(), QDir::Files); + while (dit.hasNext()) { + dit.fileInfo().isDir(); + dit.fileInfo().size(); + dit.next(); + } + } + } + + void sizeSpeedWithoutFilter() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + QBENCHMARK { + QFileInfoList fileInfoList = testdir.entryInfoList(QDir::NoFilter, QDir::Unsorted); + foreach (const QFileInfo &fileInfo, fileInfoList) { + fileInfo.size(); + } + } + } + void sizeSpeedWithoutFilterIterator() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + QBENCHMARK { + QDirIterator dit(testdir.path()); + while (dit.hasNext()) { + dit.fileInfo().isDir(); + dit.fileInfo().size(); + dit.next(); + } + } + } + + void sizeSpeedWithoutFileInfoList() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + testdir.setSorting(QDir::Unsorted); + QBENCHMARK { + QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Unsorted); + foreach (const QString &filename, fileList) { + QFileInfo fileInfo(filename); + fileInfo.size(); + } + } + } + + void iDontWantAnyStat() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + testdir.setSorting(QDir::Unsorted); + testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); + QBENCHMARK { + QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Unsorted); + foreach (const QString &filename, fileList) { + + } + } + } + void iDontWantAnyStatIterator() { + QBENCHMARK { + QDirIterator dit(QDir::tempPath() + QLatin1String("/test_speed")); + while (dit.hasNext()) { + dit.next(); + } + } + } + + void sizeSpeedWithoutFilterLowLevel() { +#ifdef Q_OS_WIN + const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16(); + wchar_t appendedPath[MAX_PATH]; + wcscpy(appendedPath, dirpath); + wcscat(appendedPath, L"\\*"); + + WIN32_FIND_DATA fd; + HANDLE hSearch = FindFirstFileW(appendedPath, &fd); + QVERIFY(hSearch == INVALID_HANDLE_VALUE); + + QBENCHMARK { + do { + + } while (FindNextFile(hSearch, &fd)); + } + FindClose(hSearch); +#else + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + DIR *dir = opendir(qPrintable(testdir.absolutePath())); + QVERIFY(dir); + + QVERIFY(!chdir(qPrintable(testdir.absolutePath()))); + QBENCHMARK { + struct dirent *item = readdir(dir); + while (item) { + char *fileName = item->d_name; + + struct stat fileStat; + QVERIFY(!stat(fileName, &fileStat)); + + item = readdir(dir); + } + } + closedir(dir); +#endif + } +}; + +QTEST_MAIN(Test) +#include "tst_qdir.moc" diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp new file mode 100644 index 0000000..afa6b7b --- /dev/null +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -0,0 +1,251 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +#ifdef Q_OS_WIN +# include +# include +#else +# include +# include +# include +# include +# include +#endif + +#include + +#include "qfilesystemiterator.h" + +class tst_qdiriterator : public QObject +{ + Q_OBJECT +private slots: + void posix(); + void posix_data() { data(); } + void diriterator(); + void diriterator_data() { data(); } + void fsiterator(); + void fsiterator_data() { data(); } + void data(); +}; + + +void tst_qdiriterator::data() +{ +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) + QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath()); + qtdir += "/depot"; +#else +#if defined(Q_OS_WIN) + const char *qtdir = "C:\\depot\\qt\\main"; +#else + const char *qtdir = ::getenv("QTDIR"); +#endif + if (!qtdir) { + fprintf(stderr, "QTDIR not set\n"); + exit(1); + } +#endif + + QTest::addColumn("dirpath"); + QByteArray ba = QByteArray(qtdir) + "/src/corelib"; + QByteArray ba1 = ba + "/io"; + QTest::newRow(ba) << ba; + //QTest::newRow(ba1) << ba1; +} + +#ifdef Q_OS_WIN +static int posix_helper(const wchar_t *dirpath) +{ + int count = 0; + HANDLE hSearch; + WIN32_FIND_DATA fd; + + const size_t origDirPathLength = wcslen(dirpath); + + wchar_t appendedPath[MAX_PATH]; + wcscpy(appendedPath, dirpath); + wcscat(appendedPath, L"\\*"); + hSearch = FindFirstFile(appendedPath, &fd); + appendedPath[origDirPathLength] = 0; + + if (hSearch == INVALID_HANDLE_VALUE) { + qWarning("FindFirstFile failed"); + return count; + } + + do { + if (!(fd.cFileName[0] == L'.' && fd.cFileName[1] == 0) && + !(fd.cFileName[0] == L'.' && fd.cFileName[1] == L'.' && fd.cFileName[2] == 0)) + { + if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + wcscat(appendedPath, L"\\"); + wcscat(appendedPath, fd.cFileName); + count += posix_helper(appendedPath); + appendedPath[origDirPathLength] = 0; + } + else { + ++count; + } + } + } while (FindNextFile(hSearch, &fd)); + FindClose(hSearch); + + return count; +} + +#else + +static int posix_helper(const char *dirpath) +{ + //qDebug() << "DIR" << dirpath; + DIR *dir = ::opendir(dirpath); + if (!dir) + return 0; + + dirent *entry = 0; + + int count = 0; + while ((entry = ::readdir(dir))) { + if (qstrcmp(entry->d_name, ".") == 0) + continue; + if (qstrcmp(entry->d_name, "..") == 0) + continue; + ++count; + QByteArray ba = dirpath; + ba += '/'; + ba += entry->d_name; + struct stat st; + lstat(ba.constData(), &st); + if (S_ISDIR(st.st_mode)) + count += posix_helper(ba.constData()); + } + + ::closedir(dir); + return count; +} +#endif + + +void tst_qdiriterator::posix() +{ + QFETCH(QByteArray, dirpath); + + int count = 0; + QString path(dirpath); + QBENCHMARK { +#ifdef Q_OS_WIN + count = posix_helper(path.utf16()); +#else + count = posix_helper(dirpath.constData()); +#endif + } + qDebug() << count; +} + +void tst_qdiriterator::diriterator() +{ + QFETCH(QByteArray, dirpath); + + int count = 0; + + QBENCHMARK { + int c = 0; + + QDirIterator dir(dirpath, + //QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot, + //QDir::AllEntries | QDir::Hidden, + QDir::Files, + QDirIterator::Subdirectories); + + while (dir.hasNext()) { + dir.next(); + //printf("%s\n", qPrintable(dir.fileName())); + 0 && printf("%d %s\n", + dir.fileInfo().isDir(), + //qPrintable(dir.fileInfo().absoluteFilePath()), + //qPrintable(dir.path()), + qPrintable(dir.filePath())); + ++c; + } + count = c; + } + qDebug() << count; +} + +void tst_qdiriterator::fsiterator() +{ + QFETCH(QByteArray, dirpath); + + int count = 0; + int dump = 0; + + QBENCHMARK { + int c = 0; + + dump && printf("\n\n\n\n"); + QFileSystemIterator dir(dirpath, + //QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot, + //QDir::AllEntries | QDir::Hidden, + //QDir::Files | QDir::NoDotAndDotDot, + QDir::Files, + QFileSystemIterator::Subdirectories); + + for (; !dir.atEnd(); dir.next()) { + dump && printf("%d %s\n", + dir.fileInfo().isDir(), + //qPrintable(dir.fileInfo().absoluteFilePath()), + //qPrintable(dir.path()), + qPrintable(dir.filePath()) + ); + ++c; + } + count = c; + } + qDebug() << count; +} + +QTEST_MAIN(tst_qdiriterator) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro new file mode 100755 index 0000000..e06d746 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -0,0 +1,23 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qdiriterator +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release +CONFIG += debug + + +SOURCES += main.cpp + +SOURCES += qfilesystemiterator.cpp +HEADERS += qfilesystemiterator.h + +wince*|symbian: { + corelibdir.sources = $$QT_SOURCE_TREE/src/corelib + corelibdir.path = ./depot/src + DEPLOYMENT += corelibdir +} + diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp new file mode 100644 index 0000000..267d53f --- /dev/null +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -0,0 +1,678 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +/*! + \since 4.5 + \class QFileSystemIterator + \brief The QFileSystemIterator class provides an iterator for directory entrylists. + + You can use QFileSystemIterator to navigate entries of a directory one at a time. + It is similar to QDir::entryList() and QDir::entryInfoList(), but because + it lists entries one at a time instead of all at once, it scales better + and is more suitable for large directories. It also supports listing + directory contents recursively, and following symbolic links. Unlike + QDir::entryList(), QFileSystemIterator does not support sorting. + + The QFileSystemIterator constructor takes a QDir or a directory as + argument. After construction, the iterator is located before the first + directory entry. Here's how to iterate over all the entries sequentially: + + \snippet doc/src/snippets/code/src.corelib.io.qdiriterator.cpp 0 + + The next() function returns the path to the next directory entry and + advances the iterator. You can also call filePath() to get the current + file path without advancing the iterator. The fileName() function returns + only the name of the file, similar to how QDir::entryList() works. You can + also call fileInfo() to get a QFileInfo for the current entry. + + Unlike Qt's container iterators, QFileSystemIterator is uni-directional (i.e., + you cannot iterate directories in reverse order) and does not allow random + access. + + QFileSystemIterator works with all supported file engines, and is implemented + using QAbstractFileEngineIterator. + + \sa QDir, QDir::entryList(), QAbstractFileEngineIterator +*/ + +/*! \enum QFileSystemIterator::IteratorFlag + + This enum describes flags that you can combine to configure the behavior + of QFileSystemIterator. + + \value NoIteratorFlags The default value, representing no flags. The + iterator will return entries for the assigned path. + + \value Subdirectories List entries inside all subdirectories as well. + + \value FollowSymlinks When combined with Subdirectories, this flag + enables iterating through all subdirectories of the assigned path, + following all symbolic links. Symbolic link loops (e.g., "link" => "." or + "link" => "..") are automatically detected and ignored. +*/ + +#include "qfilesystemiterator.h" + +#include +#include +#include +#include + +#ifdef Q_OS_WIN +# include +# include +#else +# include +# include +# include +# include +#endif + +QT_BEGIN_NAMESPACE + +class QFileSystemIteratorPrivate +{ +public: + QFileSystemIteratorPrivate(const QString &path, const QStringList &nameFilters, + QDir::Filters filters, QFileSystemIterator::IteratorFlags flags); + ~QFileSystemIteratorPrivate(); + + void pushSubDirectory(const QByteArray &path); + void advance(); + bool isAcceptable() const; + bool shouldFollowDirectory(const QFileInfo &); + //bool matchesFilters(const QAbstractFileEngineIterator *it) const; + inline bool atEnd() const { return m_dirPaths.isEmpty(); } + +#ifdef Q_OS_WIN + QStack m_dirStructs; + WIN32_FIND_DATA* m_entry; + WIN32_FIND_DATA m_fileSearchResult; + bool m_bFirstSearchResult; +#else + QStack m_dirStructs; + dirent *m_entry; +#endif + + QSet visitedLinks; + QStack m_dirPaths; + QFileInfo fileInfo; + QString currentFilePath; + QFileSystemIterator::IteratorFlags iteratorFlags; + QDir::Filters filters; + QStringList nameFilters; + + enum { DontShowDir, ShowDotDotDir, ShowDotDir, ShowDir } + m_currentDirShown, m_nextDirShown; + + QFileSystemIterator *q; + +private: + bool advanceHelper(); // returns true if we know we have something suitable +}; + +/*! + \internal +*/ +QFileSystemIteratorPrivate::QFileSystemIteratorPrivate(const QString &path, + const QStringList &nameFilters, QDir::Filters filters, + QFileSystemIterator::IteratorFlags flags) + : iteratorFlags(flags) +{ + if (filters == QDir::NoFilter) + filters = QDir::AllEntries; + this->filters = filters; + this->nameFilters = nameFilters; + + fileInfo.setFile(path); + QString dir = fileInfo.isSymLink() ? fileInfo.canonicalFilePath() : path; + pushSubDirectory(dir.toLocal8Bit()); + // skip to acceptable entry + while (true) { + if (atEnd()) + return; + if (isAcceptable()) + return; + if (advanceHelper()) + return; + } +} + +/*! + \internal +*/ +QFileSystemIteratorPrivate::~QFileSystemIteratorPrivate() +{ +#ifdef Q_OS_WIN + while (!m_dirStructs.isEmpty()) + ::FindClose(m_dirStructs.pop()); +#else + while (!m_dirStructs.isEmpty()) + ::closedir(m_dirStructs.pop()); +#endif +} + +#ifdef Q_OS_WIN +static bool isDotOrDotDot(const wchar_t* name) +{ + if (name[0] == L'.' && name[1] == 0) + return true; + if (name[0] == L'.' && name[1] == L'.' && name[2] == 0) + return true; + return false; +} +#else +static bool isDotOrDotDot(const char *name) +{ + if (name[0] == '.' && name[1] == 0) + return true; + if (name[0] == '.' && name[1] == '.' && name[2] == 0) + return true; + return false; +} +#endif + +/*! + \internal +*/ +void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path) +{ +/* + if (iteratorFlags & QFileSystemIterator::FollowSymlinks) { + if (fileInfo.filePath() != path) + fileInfo.setFile(path); + if (fileInfo.isSymLink()) { + visitedLinks << fileInfo.canonicalFilePath(); + } else { + visitedLinks << fileInfo.absoluteFilePath(); + } + } +*/ + +#ifdef Q_OS_WIN + wchar_t szSearchPath[MAX_PATH]; + wcscpy(szSearchPath, QString(path).utf16()); + wcscat(szSearchPath, L"\\*"); + HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); + m_bFirstSearchResult = true; +#else + DIR *dir = ::opendir(path.constData()); + //m_entry = ::readdir(dir); + //while (m_entry && isDotOrDotDot(m_entry->d_name)) + // m_entry = ::readdir(m_dirStructs.top()); +#endif + m_dirStructs.append(dir); + m_dirPaths.append(path); + m_entry = 0; + if (filters & QDir::Dirs) + m_nextDirShown = ShowDir; + else + m_nextDirShown = DontShowDir; + m_currentDirShown = DontShowDir; +} + +/*! + \internal +*/ +bool QFileSystemIteratorPrivate::isAcceptable() const +{ + if (!m_entry) + return false; + return true; +} + +/*! + \internal +*/ + + +void QFileSystemIteratorPrivate::advance() +{ + while (true) { + if (advanceHelper()) + return; + if (atEnd()) + return; + if (isAcceptable()) + return; + } +} + +bool QFileSystemIteratorPrivate::advanceHelper() +{ + if (m_dirStructs.isEmpty()) + return true; + + //printf("ADV %d %d\n", int(m_currentDirShown), int(m_nextDirShown)); + + if ((filters & QDir::Dirs)) { + m_currentDirShown = m_nextDirShown; + if (m_nextDirShown == ShowDir) { + //printf("RESTING ON DIR %s %x\n", m_dirPaths.top().constData(), int(filters)); + m_nextDirShown = (filters & QDir::NoDotAndDotDot) ? DontShowDir : ShowDotDir; + // skip start directory itself + if (m_dirStructs.size() == 1 && m_currentDirShown == ShowDir) + return advanceHelper(); + return true; + } + if (m_nextDirShown == ShowDotDir) { + //printf("RESTING ON DOT %s %x\n", m_dirPaths.top().constData(), int(filters)); + m_nextDirShown = ShowDotDotDir; + return true; + } + if (m_nextDirShown == ShowDotDotDir) { + //printf("RESTING ON DOTDOT %s %x\n", m_dirPaths.top().constData(), int(filters)); + m_nextDirShown = DontShowDir; + return true; + } + m_currentDirShown = DontShowDir; + } + +#ifdef Q_OS_WIN + m_entry = &m_fileSearchResult; + if (m_bFirstSearchResult) { + m_bFirstSearchResult = false; + } else { + if (!FindNextFile(m_dirStructs.top(), m_entry)) + m_entry = 0; + } + + while (m_entry && isDotOrDotDot(m_entry->cFileName)) + if (!FindNextFile(m_dirStructs.top(), m_entry)) + m_entry = 0; + + if (!m_entry) { + m_dirPaths.pop(); + FindClose(m_dirStructs.pop()); + return false; + } + + if (m_entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + QByteArray ba = m_dirPaths.top(); + ba += '\\'; + ba += QString::fromWCharArray(m_entry->cFileName); + pushSubDirectory(ba); + } +#else + m_entry = ::readdir(m_dirStructs.top()); + while (m_entry && isDotOrDotDot(m_entry->d_name)) + m_entry = ::readdir(m_dirStructs.top()); + //return false; // further iteration possibly needed + //printf("READ %p %s\n", m_entry, m_entry ? m_entry->d_name : ""); + + if (!m_entry) { + m_dirPaths.pop(); + DIR *dir = m_dirStructs.pop(); + ::closedir(dir); + return false; // further iteration possibly needed + } + + const char *name = m_entry->d_name; + + QByteArray ba = m_dirPaths.top(); + ba += '/'; + ba += name; + struct stat st; + lstat(ba.constData(), &st); + + if (S_ISDIR(st.st_mode)) { + pushSubDirectory(ba); + return false; // further iteration possibly needed + } +#endif + return false; // further iteration possiblye needed +} + +/*! + \internal + */ +bool QFileSystemIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo) +{ + // If we're doing flat iteration, we're done. + if (!(iteratorFlags & QFileSystemIterator::Subdirectories)) + return false; + + // Never follow non-directory entries + if (!fileInfo.isDir()) + return false; + + + // Never follow . and .. + if (fileInfo.fileName() == QLatin1String(".") || fileInfo.fileName() == QLatin1String("..")) + return false; + + + // Check symlinks + if (fileInfo.isSymLink() && !(iteratorFlags & QFileSystemIterator::FollowSymlinks)) { + // Follow symlinks only if FollowSymlinks was passed + return false; + } + + // Stop link loops + if (visitedLinks.contains(fileInfo.canonicalFilePath())) + return false; + + return true; +} + + +/*! + \internal + + This convenience function implements the iterator's filtering logics and + applies then to the current directory entry. + + It returns true if the current entry matches the filters (i.e., the + current entry will be returned as part of the directory iteration); + otherwise, false is returned. +*/ +#if 0 +bool QFileSystemIteratorPrivate::matchesFilters(const QAbstractFileEngineIterator *it) const +{ + const bool filterPermissions = ((filters & QDir::PermissionMask) + && (filters & QDir::PermissionMask) != QDir::PermissionMask); + const bool skipDirs = !(filters & (QDir::Dirs | QDir::AllDirs)); + const bool skipFiles = !(filters & QDir::Files); + const bool skipSymlinks = (filters & QDir::NoSymLinks); + const bool doReadable = !filterPermissions || (filters & QDir::Readable); + const bool doWritable = !filterPermissions || (filters & QDir::Writable); + const bool doExecutable = !filterPermissions || (filters & QDir::Executable); + const bool includeHidden = (filters & QDir::Hidden); + const bool includeSystem = (filters & QDir::System); + +#ifndef QT_NO_REGEXP + // Prepare name filters + QList regexps; + bool hasNameFilters = !nameFilters.isEmpty() && !(nameFilters.contains(QLatin1String("*"))); + if (hasNameFilters) { + for (int i = 0; i < nameFilters.size(); ++i) { + regexps << QRegExp(nameFilters.at(i), + (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive, + QRegExp::Wildcard); + } + } +#endif + + QString fileName = it->currentFileName(); + if (fileName.isEmpty()) { + // invalid entry + return false; + } + + QFileInfo fi = it->currentFileInfo(); + QString filePath = it->currentFilePath(); + +#ifndef QT_NO_REGEXP + // Pass all entries through name filters, except dirs if the AllDirs + // filter is passed. + if (hasNameFilters && !((filters & QDir::AllDirs) && fi.isDir())) { + bool matched = false; + for (int i = 0; i < regexps.size(); ++i) { + if (regexps.at(i).exactMatch(fileName)) { + matched = true; + break; + } + } + if (!matched) + return false; + } +#endif + + bool dotOrDotDot = (fileName == QLatin1String(".") || fileName == QLatin1String("..")); + if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) + return false; + + bool isHidden = !dotOrDotDot && fi.isHidden(); + if (!includeHidden && isHidden) + return false; + + bool isSystem = (!fi.isFile() && !fi.isDir() && !fi.isSymLink()) + || (!fi.exists() && fi.isSymLink()); + if (!includeSystem && isSystem) + return false; + + bool alwaysShow = (filters & QDir::TypeMask) == 0 + && ((isHidden && includeHidden) + || (includeSystem && isSystem)); + + // Skip files and directories + if ((filters & QDir::AllDirs) == 0 && skipDirs && fi.isDir()) { + if (!alwaysShow) + return false; + } + + if ((skipFiles && (fi.isFile() || !fi.exists())) + || (skipSymlinks && fi.isSymLink())) { + if (!alwaysShow) + return false; + } + + if (filterPermissions + && ((doReadable && !fi.isReadable()) + || (doWritable && !fi.isWritable()) + || (doExecutable && !fi.isExecutable()))) { + return false; + } + + if (!includeSystem && !dotOrDotDot && ((fi.exists() && !fi.isFile() && !fi.isDir() && !fi.isSymLink()) + || (!fi.exists() && fi.isSymLink()))) { + return false; + } + + return true; +} +#endif + +/*! + Constructs a QFileSystemIterator that can iterate over \a dir's entrylist, using + \a dir's name filters and regular filters. You can pass options via \a + flags to decide how the directory should be iterated. + + By default, \a flags is NoIteratorFlags, which provides the same behavior + as in QDir::entryList(). + + The sorting in \a dir is ignored. + + \sa atEnd(), next(), IteratorFlags +*/ +QFileSystemIterator::QFileSystemIterator(const QDir &dir, IteratorFlags flags) + : d(new QFileSystemIteratorPrivate(dir.path(), dir.nameFilters(), dir.filter(), flags)) +{ + d->q = this; +} + +/*! + Constructs a QFileSystemIterator that can iterate over \a path, with no name + filtering and \a filters for entry filtering. You can pass options via \a + flags to decide how the directory should be iterated. + + By default, \a filters is QDir::NoFilter, and \a flags is NoIteratorFlags, + which provides the same behavior as in QDir::entryList(). + + \sa atEnd(), next(), IteratorFlags +*/ +QFileSystemIterator::QFileSystemIterator(const QString &path, QDir::Filters filters, IteratorFlags flags) + : d(new QFileSystemIteratorPrivate(path, QStringList(QLatin1String("*")), filters, flags)) +{ + d->q = this; +} + +/*! + Constructs a QFileSystemIterator that can iterate over \a path. You can pass + options via \a flags to decide how the directory should be iterated. + + By default, \a flags is NoIteratorFlags, which provides the same behavior + as in QDir::entryList(). + + \sa atEnd(), next(), IteratorFlags +*/ +QFileSystemIterator::QFileSystemIterator(const QString &path, IteratorFlags flags) + : d(new QFileSystemIteratorPrivate(path, QStringList(QLatin1String("*")), QDir::NoFilter, flags)) +{ + d->q = this; +} + +/*! + Constructs a QFileSystemIterator that can iterate over \a path, using \a + nameFilters and \a filters. You can pass options via \a flags to decide + how the directory should be iterated. + + By default, \a flags is NoIteratorFlags, which provides the same behavior + as QDir::entryList(). + + \sa atEnd(), next(), IteratorFlags +*/ +QFileSystemIterator::QFileSystemIterator(const QString &path, const QStringList &nameFilters, + QDir::Filters filters, IteratorFlags flags) + : d(new QFileSystemIteratorPrivate(path, nameFilters, filters, flags)) +{ + d->q = this; +} + +/*! + Destroys the QFileSystemIterator. +*/ +QFileSystemIterator::~QFileSystemIterator() +{ + delete d; +} + +/*! + Advances the iterator to the next entry, and returns the file path of this + new entry. If atEnd() returns true, this function does nothing, and + returns a null QString. + + You can call fileName() or filePath() to get the current entry file name + or path, or fileInfo() to get a QFileInfo for the current entry. + + \sa hasNext(), fileName(), filePath(), fileInfo() +*/ +void QFileSystemIterator::next() +{ + d->advance(); +} + +/*! + Returns true if there is at least one more entry in the directory; + otherwise, false is returned. + + \sa next(), fileName(), filePath(), fileInfo() +*/ +bool QFileSystemIterator::atEnd() const +{ + return d->atEnd(); +} + +/*! + Returns the file name for the current directory entry, without the path + prepended. If the current entry is invalid (i.e., isValid() returns + false), a null QString is returned. + + This function is provided for the convenience when iterating single + directories. For recursive iteration, you should call filePath() or + fileInfo() instead. + + \sa filePath(), fileInfo() +*/ +QString QFileSystemIterator::fileName() const +{ + if (d->atEnd() || !d->m_entry) + return QString(); + if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDir) + return QString(); + if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDir) + return QLatin1String("@"); + if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDotDir) + return QLatin1String("@@"); +#ifdef Q_OS_WIN + return QString::fromWCharArray(d->m_entry->cFileName); +#else + return QString::fromLocal8Bit(d->m_entry->d_name); +#endif +} + +/*! + Returns the full file path for the current directory entry. If the current + entry is invalid (i.e., isValid() returns false), a null QString is + returned. + + \sa fileInfo(), fileName() +*/ +QString QFileSystemIterator::filePath() const +{ + if (d->atEnd()) + return QString(); + QByteArray ba = d->m_dirPaths.top(); + if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDir) + ba += "/."; + else if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDotDir) + ba += "/.."; + else if (d->m_entry) { + ba += '/'; +#ifdef Q_OS_WIN + ba += QString::fromWCharArray(d->m_entry->cFileName); +#else + ba += d->m_entry->d_name; +#endif + } + return QString::fromLocal8Bit(ba); +} + +/*! + Returns a QFileInfo for the current directory entry. If the current entry + is invalid (i.e., isValid() returns false), a null QFileInfo is returned. + + \sa filePath(), fileName() +*/ +QFileInfo QFileSystemIterator::fileInfo() const +{ + return QFileInfo(filePath()); +} + +/*! + Returns the base directory of the iterator. +*/ +QString QFileSystemIterator::path() const +{ + return QString::fromLocal8Bit(d->m_dirPaths.top()); +} + +QT_END_NAMESPACE diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h new file mode 100644 index 0000000..4aad3a1 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILESYSTEMITERATOR_H +#define QFILESYSTEMITERATOR_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +class QFileSystemIteratorPrivate; +class //Q_CORE_EXPORT +QFileSystemIterator +{ +public: + enum IteratorFlag { + NoIteratorFlags = 0x0, + FollowSymlinks = 0x1, + Subdirectories = 0x2 + }; + Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) + + QFileSystemIterator(const QDir &dir, IteratorFlags flags = NoIteratorFlags); + QFileSystemIterator(const QString &path, + IteratorFlags flags = NoIteratorFlags); + QFileSystemIterator(const QString &path, + QDir::Filters filter, + IteratorFlags flags = NoIteratorFlags); + QFileSystemIterator(const QString &path, + const QStringList &nameFilters, + QDir::Filters filters = QDir::NoFilter, + IteratorFlags flags = NoIteratorFlags); + + virtual ~QFileSystemIterator(); + + void next(); + bool atEnd() const; + + QString fileName() const; + QString filePath() const; + QFileInfo fileInfo() const; + QString path() const; + +private: + Q_DISABLE_COPY(QFileSystemIterator) + + QFileSystemIteratorPrivate *d; + friend class QDir; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QFileSystemIterator::IteratorFlags) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp new file mode 100644 index 0000000..103b77c --- /dev/null +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -0,0 +1,675 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef Q_OS_WIN +# include +# include +#endif + +#define BUFSIZE 1024*512 +#define FACTOR 1024*512 +#define TF_SIZE FACTOR*81 + +// 10 predefined (but random() seek positions +// hardcoded to be comparable over several runs +const int seekpos[] = {TF_SIZE*0.52, + TF_SIZE*0.23, + TF_SIZE*0.73, + TF_SIZE*0.77, + TF_SIZE*0.80, + TF_SIZE*0.12, + TF_SIZE*0.53, + TF_SIZE*0.21, + TF_SIZE*0.27, + TF_SIZE*0.78}; + +const int sp_size = sizeof(seekpos)/sizeof(int); + +class tst_qfile: public QObject +{ +Q_ENUMS(BenchmarkType) +Q_OBJECT +public: + enum BenchmarkType { + QFileBenchmark = 1, + QFSFileEngineBenchmark, + Win32Benchmark, + PosixBenchmark, + QFileFromPosixBenchmark + }; +private slots: + void initTestCase(); + void cleanupTestCase(); + + void open_data(); + void open(); + void seek_data(); + void seek(); + + void readSmallFiles_QFile(); + void readSmallFiles_QFSFileEngine(); + void readSmallFiles_posix(); + void readSmallFiles_Win32(); + + void readSmallFiles_QFile_data(); + void readSmallFiles_QFSFileEngine_data(); + void readSmallFiles_posix_data(); + void readSmallFiles_Win32_data(); + + void readBigFile_QFile_data(); + void readBigFile_QFSFileEngine_data(); + void readBigFile_posix_data(); + void readBigFile_Win32_data(); + + void readBigFile_QFile(); + void readBigFile_QFSFileEngine(); + void readBigFile_posix(); + void readBigFile_Win32(); + +private: + void readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b); + void readBigFile(); + void readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b); + void readSmallFiles(); + void createFile(); + void fillFile(int factor=FACTOR); + void removeFile(); + void createSmallFiles(); + void removeSmallFiles(); + QString filename; + QString tmpDirName; +}; + +Q_DECLARE_METATYPE(tst_qfile::BenchmarkType) +Q_DECLARE_METATYPE(QIODevice::OpenMode) +Q_DECLARE_METATYPE(QIODevice::OpenModeFlag) + +void tst_qfile::createFile() +{ + removeFile(); // Cleanup in case previous test case aborted before cleaning up + + QTemporaryFile tmpFile; + tmpFile.setAutoRemove(false); + if (!tmpFile.open()) + ::exit(1); + filename = tmpFile.fileName(); + tmpFile.close(); +} + +void tst_qfile::removeFile() +{ + if (!filename.isEmpty()) + QFile::remove(filename); +} + +void tst_qfile::fillFile(int factor) +{ + QFile tmpFile(filename); + tmpFile.open(QIODevice::WriteOnly); + //for (int row=0; row("testType"); + QTest::addColumn("blockSize"); + QTest::addColumn("textMode"); + QTest::addColumn("bufferedMode"); + + const int bs[] = {1024, 1024*2, 1024*8, 1024*16, 1024*32,1024*512}; + int bs_entries = sizeof(bs)/sizeof(const int); + + QString flagstring; + if (t & QIODevice::Text) flagstring += "textMode "; + if (b & QIODevice::Unbuffered) flagstring += "unbuffered "; + if (flagstring.isEmpty()) flagstring = "none"; + + for (int i=0; i("testType"); + QTest::newRow("QFile") << QFileBenchmark; + QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark; + QTest::newRow("Posix FILE*") << PosixBenchmark; +#ifdef Q_OS_WIN + QTest::newRow("Win32 API") << Win32Benchmark; +#endif +} + +void tst_qfile::seek() +{ + QFETCH(tst_qfile::BenchmarkType, testType); + int i = 0; + + createFile(); + fillFile(); + + switch (testType) { + case(QFileBenchmark): { + QFile file(filename); + file.open(QIODevice::ReadOnly); + QBENCHMARK { + i=(i+1)%sp_size; + file.seek(seekpos[i]); + } + file.close(); + } + break; + case(QFSFileEngineBenchmark): { + QFSFileEngine fse(filename); + fse.open(QIODevice::ReadOnly); + QBENCHMARK { + i=(i+1)%sp_size; + fse.seek(seekpos[i]); + } + fse.close(); + } + break; + case(PosixBenchmark): { + QByteArray data = filename.toLocal8Bit(); + const char* cfilename = data.constData(); + FILE* cfile = ::fopen(cfilename, "rb"); + QBENCHMARK { + i=(i+1)%sp_size; + ::fseek(cfile, seekpos[i], SEEK_SET); + } + ::fclose(cfile); + } + break; + case(QFileFromPosixBenchmark): { + // No gain in benchmarking this case + } + break; + case(Win32Benchmark): { +#ifdef Q_OS_WIN + HANDLE hndl; + + // ensure we don't account string conversion + wchar_t* cfilename = (wchar_t*)filename.utf16(); + + hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); + Q_ASSERT(hndl); + QBENCHMARK { + i=(i+1)%sp_size; + SetFilePointer(hndl, seekpos[i], NULL, 0); + } + CloseHandle(hndl); +#else + QFAIL("Not running on a Windows plattform!"); +#endif + } + break; + } + + removeFile(); +} + +void tst_qfile::open_data() +{ + QTest::addColumn("testType"); + QTest::newRow("QFile") << QFileBenchmark; + QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark; + QTest::newRow("Posix FILE*") << PosixBenchmark; + QTest::newRow("QFile from FILE*") << QFileFromPosixBenchmark; +#ifdef Q_OS_WIN + QTest::newRow("Win32 API") << Win32Benchmark; +#endif +} + +void tst_qfile::open() +{ + QFETCH(tst_qfile::BenchmarkType, testType); + + createFile(); + + switch (testType) { + case(QFileBenchmark): { + QBENCHMARK { + QFile file( filename ); + file.open( QIODevice::ReadOnly ); + file.close(); + } + } + break; + case(QFSFileEngineBenchmark): { + QBENCHMARK { + QFSFileEngine fse(filename); + fse.open(QIODevice::ReadOnly); + fse.close(); + } + } + break; + + case(PosixBenchmark): { + // ensure we don't account toLocal8Bit() + QByteArray data = filename.toLocal8Bit(); + const char* cfilename = data.constData(); + + QBENCHMARK { + FILE* cfile = ::fopen(cfilename, "rb"); + ::fclose(cfile); + } + } + break; + case(QFileFromPosixBenchmark): { + // ensure we don't account toLocal8Bit() + QByteArray data = filename.toLocal8Bit(); + const char* cfilename = data.constData(); + FILE* cfile = ::fopen(cfilename, "rb"); + + QBENCHMARK { + QFile file; + file.open(cfile, QIODevice::ReadOnly); + file.close(); + } + ::fclose(cfile); + } + break; + case(Win32Benchmark): { +#ifdef Q_OS_WIN + HANDLE hndl; + + // ensure we don't account string conversion + wchar_t* cfilename = (wchar_t*)filename.utf16(); + + QBENCHMARK { + hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); + Q_ASSERT(hndl); + CloseHandle(hndl); + } +#else + QFAIL("Not running on a non-Windows platform!"); +#endif + } + break; + } + + removeFile(); +} + + +void tst_qfile::readSmallFiles_QFile() { readSmallFiles(); } +void tst_qfile::readSmallFiles_QFSFileEngine() { readSmallFiles(); } +void tst_qfile::readSmallFiles_posix() { readSmallFiles(); } +void tst_qfile::readSmallFiles_Win32() { readSmallFiles(); } + +void tst_qfile::readSmallFiles_QFile_data() +{ + readSmallFiles_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::NotOpen); + readSmallFiles_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered); + readSmallFiles_data(QFileBenchmark, QIODevice::Text, QIODevice::NotOpen); + readSmallFiles_data(QFileBenchmark, QIODevice::Text, QIODevice::Unbuffered); + +} + +void tst_qfile::readSmallFiles_QFSFileEngine_data() +{ + readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::NotOpen); + readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered); + readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::NotOpen); + readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered); +} + +void tst_qfile::readSmallFiles_posix_data() +{ + readSmallFiles_data(PosixBenchmark, QIODevice::NotOpen, QIODevice::NotOpen); +} + +void tst_qfile::readSmallFiles_Win32_data() +{ + readSmallFiles_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen); +} + + +void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b) +{ + QTest::addColumn("testType"); + QTest::addColumn("blockSize"); + QTest::addColumn("textMode"); + QTest::addColumn("bufferedMode"); + + const int bs[] = {1024, 1024*2, 1024*8, 1024*16, 1024*32,1024*512}; + int bs_entries = sizeof(bs)/sizeof(const int); + + QString flagstring; + if (t & QIODevice::Text) flagstring += "textMode "; + if (b & QIODevice::Unbuffered) flagstring += "unbuffered "; + if (flagstring.isEmpty()) flagstring = "none"; + + for (int i=0; i fileList; + Q_FOREACH(QString file, files) { + QFile *f = new QFile(tmpDirName+ "/" + file); + f->open(QIODevice::ReadOnly|textMode|bufferedMode); + fileList.append(f); + } + + QBENCHMARK { + Q_FOREACH(QFile *file, fileList) { + while (!file->atEnd()) { + file->read(buffer, blockSize); + } + } + } + + Q_FOREACH(QFile *file, fileList) { + file->close(); + delete file; + } + } + break; + case(QFSFileEngineBenchmark): { + QList fileList; + Q_FOREACH(QString file, files) { + QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file); + fse->open(QIODevice::ReadOnly|textMode|bufferedMode); + fileList.append(fse); + } + + QBENCHMARK { + Q_FOREACH(QFSFileEngine *fse, fileList) { + while (fse->read(buffer, blockSize)); + } + } + + Q_FOREACH(QFSFileEngine *fse, fileList) { + fse->close(); + delete fse; + } + } + break; + case(PosixBenchmark): { + QList fileList; + Q_FOREACH(QString file, files) { + fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb")); + } + + QBENCHMARK { + Q_FOREACH(FILE* cfile, fileList) { + while(!feof(cfile)) + ::fread(buffer, blockSize, 1, cfile); + ::fseek(cfile, 0, SEEK_SET); + } + } + + Q_FOREACH(FILE* cfile, fileList) { + ::fclose(cfile); + } + } + break; + case(QFileFromPosixBenchmark): { + // No gain in benchmarking this case + } + break; + case(Win32Benchmark): { +#ifdef Q_OS_WIN + HANDLE hndl; + + // ensure we don't account string conversion + wchar_t* cfilename = (wchar_t*)filename.utf16(); + + hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); + Q_ASSERT(hndl); + wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; + DWORD numberOfBytesRead; + QBENCHMARK { + do { + ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL); + } while(numberOfBytesRead != 0); + } + delete nativeBuffer; + CloseHandle(hndl); +#else + QFAIL("Not running on a non-Windows platform!"); +#endif + } + break; + } + + removeSmallFiles(); + delete[] buffer; +} + +QTEST_MAIN(tst_qfile) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/io/qfile/qfile.pro b/tests/benchmarks/corelib/io/qfile/qfile.pro new file mode 100644 index 0000000..99505c3 --- /dev/null +++ b/tests/benchmarks/corelib/io/qfile/qfile.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qfile +QT -= gui +win32: DEFINES+= _CRT_SECURE_NO_WARNINGS + +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/main.cpp new file mode 100644 index 0000000..025787f --- /dev/null +++ b/tests/benchmarks/corelib/io/qfileinfo/main.cpp @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include + +#include "private/qfsfileengine_p.h" + +class qfileinfo : public QObject +{ + Q_OBJECT +private slots: + void canonicalFileNamePerformance(); + + void initTestCase(); + void cleanupTestCase(); +public: + qfileinfo() : QObject() {}; +}; + +void qfileinfo::initTestCase() +{ +} + +void qfileinfo::cleanupTestCase() +{ +} + +void qfileinfo::canonicalFileNamePerformance() +{ + QString appPath = QCoreApplication::applicationFilePath(); + QFSFileEnginePrivate::canonicalized(appPath); // warmup + QFSFileEnginePrivate::canonicalized(appPath); // more warmup + QBENCHMARK { + for (int i = 0; i < 5000; i++) { + QFSFileEnginePrivate::canonicalized(appPath); + } + } +} + +QTEST_MAIN(qfileinfo) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro new file mode 100644 index 0000000..295cb50 --- /dev/null +++ b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = qfileinfo +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/io/qiodevice/main.cpp b/tests/benchmarks/corelib/io/qiodevice/main.cpp new file mode 100644 index 0000000..4af697c --- /dev/null +++ b/tests/benchmarks/corelib/io/qiodevice/main.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include + +#include + + +class tst_qiodevice : public QObject +{ + Q_OBJECT +private slots: + void read_old(); + void read_old_data() { read_data(); } + //void read_new(); + //void read_new_data() { read_data(); } +private: + void read_data(); +}; + + +void tst_qiodevice::read_data() +{ + QTest::addColumn("size"); + QTest::newRow("10k") << qint64(10 * 1024); + QTest::newRow("100k") << qint64(100 * 1024); + QTest::newRow("1000k") << qint64(1000 * 1024); + QTest::newRow("10000k") << qint64(10000 * 1024); +#ifndef Q_OS_SYMBIAN // Symbian devices don't (yet) have enough available RAM to run these + QTest::newRow("100000k") << qint64(100000 * 1024); + QTest::newRow("1000000k") << qint64(1000000 * 1024); +#endif +} + +void tst_qiodevice::read_old() +{ + QFETCH(qint64, size); + + QString name = "tmp" + QString::number(size); + + { + QFile file(name); + file.open(QIODevice::WriteOnly); + file.seek(size); + file.write("x", 1); + file.close(); + } + + QBENCHMARK { + QFile file(name); + file.open(QIODevice::ReadOnly); + QByteArray ba; + qint64 s = size - 1024; + file.seek(512); + ba = file.read(s); // crash happens during this read / assignment operation + } + + { + QFile file(name); + file.remove(); + } +} + + +QTEST_MAIN(tst_qiodevice) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro b/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro new file mode 100755 index 0000000..749a4d6 --- /dev/null +++ b/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qiodevice +TARGET.EPOCHEAPSIZE = 0x100000 0x2000000 +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp b/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp new file mode 100644 index 0000000..8b71189 --- /dev/null +++ b/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include +#include + + +class tst_qtemporaryfile : public QObject +{ + Q_OBJECT +private slots: + void openclose_data(); + void openclose(); + void readwrite_data() { openclose_data(); } + void readwrite(); + +private: +}; + +void tst_qtemporaryfile::openclose_data() +{ + QTest::addColumn("amount"); + QTest::newRow("100") << qint64(100); + QTest::newRow("1000") << qint64(1000); + QTest::newRow("10000") << qint64(10000); +} + +void tst_qtemporaryfile::openclose() +{ + QFETCH(qint64, amount); + + QBENCHMARK { + for (qint64 i = 0; i < amount; ++i) { + QTemporaryFile file; + file.open(); + file.close(); + } + } +} + +void tst_qtemporaryfile::readwrite() +{ + QFETCH(qint64, amount); + + const int dataSize = 4096; + QByteArray data; + data.fill('a', dataSize); + QBENCHMARK { + for (qint64 i = 0; i < amount; ++i) { + QTemporaryFile file; + file.open(); + file.write(data); + file.seek(0); + file.read(dataSize); + file.close(); + } + } +} + +QTEST_MAIN(tst_qtemporaryfile) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro new file mode 100644 index 0000000..c1b04f4 --- /dev/null +++ b/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qtemporaryfile +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/kernel/events/events.pro b/tests/benchmarks/corelib/kernel/events/events.pro new file mode 100644 index 0000000..adf2317 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/events/events.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_events +DEPENDPATH += . +INCLUDEPATH += . +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/kernel/events/main.cpp b/tests/benchmarks/corelib/kernel/events/main.cpp new file mode 100644 index 0000000..0dd2c18 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/events/main.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include +#include + +class PingPong : public QObject +{ +public: + void setPeer(QObject *peer); + void resetCounter() {m_counter = 100;} + +protected: + bool event(QEvent *e); + +private: + QObject *m_peer; + int m_counter; +}; + +void PingPong::setPeer(QObject *peer) +{ + m_peer = peer; + m_counter = 100; +} + +bool PingPong::event(QEvent *) +{ + --m_counter; + if (m_counter > 0) { + QEvent *e = new QEvent(QEvent::User); + QCoreApplication::postEvent(m_peer, e); + } else { + QTestEventLoop::instance().exitLoop(); + } + return true; +} + +class EventTester : public QObject +{ +public: + int foo(int bar); + +protected: + bool event(QEvent *e); +}; + +bool EventTester::event(QEvent *e) +{ + if (e->type() == QEvent::User+1) + return foo(e->type()) != 0; + return false; +} + +int EventTester::foo(int bar) +{ + return bar + 1; +} + +class EventsBench : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + + void noEvent(); + void sendEvent_data(); + void sendEvent(); + void postEvent_data(); + void postEvent(); +}; + +void EventsBench::initTestCase() +{ +} + +void EventsBench::cleanupTestCase() +{ +} + +void EventsBench::noEvent() +{ + EventTester tst; + int val = 0; + QBENCHMARK { + val += tst.foo(1); + } +} + +void EventsBench::sendEvent_data() +{ + QTest::addColumn("filterEvents"); + QTest::newRow("no eventfilter") << false; + QTest::newRow("eventfilter") << true; +} + +void EventsBench::sendEvent() +{ + QFETCH(bool, filterEvents); + EventTester tst; + if (filterEvents) + tst.installEventFilter(this); + QEvent evt(QEvent::Type(QEvent::User+1)); + QBENCHMARK { + QCoreApplication::sendEvent(&tst, &evt); + } +} + +void EventsBench::postEvent_data() +{ + QTest::addColumn("filterEvents"); + // The first time an eventloop is executed, the case runs radically slower at least + // on some platforms, so test the "no eventfilter" case to get a comparable results + // with the "eventfilter" case. + QTest::newRow("first time, no eventfilter") << false; + QTest::newRow("no eventfilter") << false; + QTest::newRow("eventfilter") << true; +} + +void EventsBench::postEvent() +{ + QFETCH(bool, filterEvents); + PingPong ping; + PingPong pong; + ping.setPeer(&pong); + pong.setPeer(&ping); + if (filterEvents) { + ping.installEventFilter(this); + pong.installEventFilter(this); + } + + QBENCHMARK { + // In case multiple iterations are done, event needs to be created inside the QBENCHMARK, + // or it gets deleted once first iteration exits and can cause a crash. Similarly, + // ping and pong need their counters reset. + QEvent *e = new QEvent(QEvent::User); + ping.resetCounter(); + pong.resetCounter(); + QCoreApplication::postEvent(&ping, e); + QTestEventLoop::instance().enterLoop( 61 ); + } +} + +QTEST_MAIN(EventsBench) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/kernel/kernel.pro b/tests/benchmarks/corelib/kernel/kernel.pro new file mode 100644 index 0000000..91cf3c5 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/kernel.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +SUBDIRS = \ + events \ + qmetaobject \ + qobject \ + qvariant diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp b/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp new file mode 100644 index 0000000..c375a16 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +class tst_qmetaobject: public QObject +{ +Q_OBJECT +private slots: + void initTestCase(); + void cleanupTestCase(); + + void indexOfProperty_data(); + void indexOfProperty(); + void indexOfMethod_data(); + void indexOfMethod(); + void indexOfSignal_data(); + void indexOfSignal(); + void indexOfSlot_data(); + void indexOfSlot(); +}; + +void tst_qmetaobject::initTestCase() +{ +} + +void tst_qmetaobject::cleanupTestCase() +{ +} + +void tst_qmetaobject::indexOfProperty_data() +{ + QTest::addColumn("name"); + const QMetaObject *mo = &QTreeView::staticMetaObject; + for (int i = 0; i < mo->propertyCount(); ++i) { + QMetaProperty prop = mo->property(i); + QTest::newRow(prop.name()) << QByteArray(prop.name()); + } +} + +void tst_qmetaobject::indexOfProperty() +{ + QFETCH(QByteArray, name); + const char *p = name.constData(); + const QMetaObject *mo = &QTreeView::staticMetaObject; + QBENCHMARK { + (void)mo->indexOfProperty(p); + } +} + +void tst_qmetaobject::indexOfMethod_data() +{ + QTest::addColumn("method"); + const QMetaObject *mo = &QTreeView::staticMetaObject; + for (int i = 0; i < mo->methodCount(); ++i) { + QMetaMethod method = mo->method(i); + QByteArray sig = method.signature(); + QTest::newRow(sig) << sig; + } +} + +void tst_qmetaobject::indexOfMethod() +{ + QFETCH(QByteArray, method); + const char *p = method.constData(); + const QMetaObject *mo = &QTreeView::staticMetaObject; + QBENCHMARK { + (void)mo->indexOfMethod(p); + } +} + +void tst_qmetaobject::indexOfSignal_data() +{ + QTest::addColumn("signal"); + const QMetaObject *mo = &QTreeView::staticMetaObject; + for (int i = 0; i < mo->methodCount(); ++i) { + QMetaMethod method = mo->method(i); + if (method.methodType() != QMetaMethod::Signal) + continue; + QByteArray sig = method.signature(); + QTest::newRow(sig) << sig; + } +} + +void tst_qmetaobject::indexOfSignal() +{ + QFETCH(QByteArray, signal); + const char *p = signal.constData(); + const QMetaObject *mo = &QTreeView::staticMetaObject; + QBENCHMARK { + (void)mo->indexOfSignal(p); + } +} + +void tst_qmetaobject::indexOfSlot_data() +{ + QTest::addColumn("slot"); + const QMetaObject *mo = &QTreeView::staticMetaObject; + for (int i = 0; i < mo->methodCount(); ++i) { + QMetaMethod method = mo->method(i); + if (method.methodType() != QMetaMethod::Slot) + continue; + QByteArray sig = method.signature(); + QTest::newRow(sig) << sig; + } +} + +void tst_qmetaobject::indexOfSlot() +{ + QFETCH(QByteArray, slot); + const char *p = slot.constData(); + const QMetaObject *mo = &QTreeView::staticMetaObject; + QBENCHMARK { + (void)mo->indexOfSlot(p); + } +} + +QTEST_MAIN(tst_qmetaobject) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro new file mode 100644 index 0000000..78300f6 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qmetaobject + +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/kernel/qobject/main.cpp b/tests/benchmarks/corelib/kernel/qobject/main.cpp new file mode 100644 index 0000000..7f24ebd --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qobject/main.cpp @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include "object.h" +#include +#include + +enum { + CreationDeletionBenckmarkConstant = 34567, + SignalsAndSlotsBenchmarkConstant = 456789 +}; + +class QObjectBenchmark : public QObject +{ +Q_OBJECT +private slots: + void signal_slot_benchmark(); + void signal_slot_benchmark_data(); + void qproperty_benchmark_data(); + void qproperty_benchmark(); + void dynamic_property_benchmark(); + void connect_disconnect_benchmark_data(); + void connect_disconnect_benchmark(); +}; + +void QObjectBenchmark::signal_slot_benchmark_data() +{ + QTest::addColumn("type"); + QTest::newRow("simple function") << 0; + QTest::newRow("single signal/slot") << 1; + QTest::newRow("multi signal/slot") << 2; +} + +void QObjectBenchmark::signal_slot_benchmark() +{ + QFETCH(int, type); + + Object singleObject; + Object multiObject; + singleObject.setObjectName("single"); + multiObject.setObjectName("multi"); + + singleObject.connect(&singleObject, SIGNAL(signal0()), SLOT(slot0())); + + multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(slot0())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal1())); + multiObject.connect(&multiObject, SIGNAL(signal1()), SLOT(slot1())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal2())); + multiObject.connect(&multiObject, SIGNAL(signal2()), SLOT(slot2())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal3())); + multiObject.connect(&multiObject, SIGNAL(signal3()), SLOT(slot3())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal4())); + multiObject.connect(&multiObject, SIGNAL(signal4()), SLOT(slot4())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal5())); + multiObject.connect(&multiObject, SIGNAL(signal5()), SLOT(slot5())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal6())); + multiObject.connect(&multiObject, SIGNAL(signal6()), SLOT(slot6())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal7())); + multiObject.connect(&multiObject, SIGNAL(signal7()), SLOT(slot7())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal8())); + multiObject.connect(&multiObject, SIGNAL(signal8()), SLOT(slot8())); + // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal9())); + multiObject.connect(&multiObject, SIGNAL(signal9()), SLOT(slot9())); + + if (type == 0) { + QBENCHMARK { + singleObject.slot0(); + } + } else if (type == 1) { + QBENCHMARK { + singleObject.emitSignal0(); + } + } else { + QBENCHMARK { + multiObject.emitSignal0(); + } + } +} + +void QObjectBenchmark::qproperty_benchmark_data() +{ + QTest::addColumn("name"); + const QMetaObject *mo = &QTreeView::staticMetaObject; + for (int i = 0; i < mo->propertyCount(); ++i) { + QMetaProperty prop = mo->property(i); + QTest::newRow(prop.name()) << QByteArray(prop.name()); + } +} + +void QObjectBenchmark::qproperty_benchmark() +{ + QFETCH(QByteArray, name); + const char *p = name.constData(); + QTreeView obj; + QVariant v = obj.property(p); + QBENCHMARK { + obj.setProperty(p, v); + (void)obj.property(p); + } +} + +void QObjectBenchmark::dynamic_property_benchmark() +{ + QTreeView obj; + QBENCHMARK { + obj.setProperty("myProperty", 123); + (void)obj.property("myProperty"); + obj.setProperty("myOtherProperty", 123); + (void)obj.property("myOtherProperty"); + } +} + +void QObjectBenchmark::connect_disconnect_benchmark_data() +{ + QTest::addColumn("signal"); + const QMetaObject *mo = &QTreeView::staticMetaObject; + for (int i = 0; i < mo->methodCount(); ++i) { + QMetaMethod method = mo->method(i); + if (method.methodType() != QMetaMethod::Signal) + continue; + QByteArray sig = method.signature(); + QTest::newRow(sig) << sig; + } +} + +void QObjectBenchmark::connect_disconnect_benchmark() +{ + QFETCH(QByteArray, signal); + signal.prepend('2'); + const char *p = signal.constData(); + QTreeView obj; + QBENCHMARK { + QObject::connect(&obj, p, &obj, p); + QObject::disconnect(&obj, p, &obj, p); + } +} + +QTEST_MAIN(QObjectBenchmark) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/kernel/qobject/object.cpp b/tests/benchmarks/corelib/kernel/qobject/object.cpp new file mode 100644 index 0000000..d775a32 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qobject/object.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "object.h" + +void Object::emitSignal0() +{ emit signal0(); } + +void Object::slot0() +{ } +void Object::slot1() +{ } +void Object::slot2() +{ } +void Object::slot3() +{ } +void Object::slot4() +{ } +void Object::slot5() +{ } +void Object::slot6() +{ } +void Object::slot7() +{ } +void Object::slot8() +{ } +void Object::slot9() +{ } diff --git a/tests/benchmarks/corelib/kernel/qobject/object.h b/tests/benchmarks/corelib/kernel/qobject/object.h new file mode 100644 index 0000000..7e4933f --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qobject/object.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef OBJECT_H +#define OBJECT_H + +#include + +class Object : public QObject +{ + Q_OBJECT +public: + void emitSignal0(); +signals: + void signal0(); + void signal1(); + void signal2(); + void signal3(); + void signal4(); + void signal5(); + void signal6(); + void signal7(); + void signal8(); + void signal9(); +public slots: + void slot0(); + void slot1(); + void slot2(); + void slot3(); + void slot4(); + void slot5(); + void slot6(); + void slot7(); + void slot8(); + void slot9(); +}; + +#endif // OBJECT_H diff --git a/tests/benchmarks/corelib/kernel/qobject/qobject.pro b/tests/benchmarks/corelib/kernel/qobject/qobject.pro new file mode 100644 index 0000000..2855de4 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qobject/qobject.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qobject +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += object.h +SOURCES += main.cpp object.cpp diff --git a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro new file mode 100644 index 0000000..63b5442 --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qvariant +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release +#CONFIG += debug + + +SOURCES += tst_qvariant.cpp diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp new file mode 100644 index 0000000..82dc7dd --- /dev/null +++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp @@ -0,0 +1,180 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#define ITERATION_COUNT 1e5 + +class tst_qvariant : public QObject +{ + Q_OBJECT +private slots: + void testBound(); + + void doubleVariantCreation(); + void floatVariantCreation(); + void rectVariantCreation(); + void stringVariantCreation(); + void pixmapVariantCreation(); + + void doubleVariantSetValue(); + void floatVariantSetValue(); + void rectVariantSetValue(); + void stringVariantSetValue(); + + void doubleVariantAssignment(); + void floatVariantAssignment(); + void rectVariantAssignment(); + void stringVariantAssignment(); +}; + +void tst_qvariant::testBound() +{ + qreal d = qreal(.5); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + d = qBound(0, d, 1); + } + } +} + +template +static void variantCreation(T val) +{ + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + QVariant v(val); + } + } +} + +void tst_qvariant::doubleVariantCreation() +{ + variantCreation(0.0); +} + +void tst_qvariant::floatVariantCreation() +{ + variantCreation(0.0f); +} + +void tst_qvariant::rectVariantCreation() +{ + variantCreation(QRect(1, 2, 3, 4)); +} + +void tst_qvariant::stringVariantCreation() +{ + variantCreation(QString()); +} + +void tst_qvariant::pixmapVariantCreation() +{ + variantCreation(QPixmap()); +} + +template +static void variantSetValue(T d) +{ + QVariant v; + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + qVariantSetValue(v, d); + } + } +} + +void tst_qvariant::doubleVariantSetValue() +{ + variantSetValue(0.0); +} + +void tst_qvariant::floatVariantSetValue() +{ + variantSetValue(0.0f); +} + +void tst_qvariant::rectVariantSetValue() +{ + variantSetValue(QRect()); +} + +void tst_qvariant::stringVariantSetValue() +{ + variantSetValue(QString()); +} + +template +static void variantAssignment(T d) +{ + QVariant v; + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v = d; + } + } +} + +void tst_qvariant::doubleVariantAssignment() +{ + variantAssignment(0.0); +} + +void tst_qvariant::floatVariantAssignment() +{ + variantAssignment(0.0f); +} + +void tst_qvariant::rectVariantAssignment() +{ + variantAssignment(QRect()); +} + +void tst_qvariant::stringVariantAssignment() +{ + variantAssignment(QString()); +} + +QTEST_MAIN(tst_qvariant) + +#include "tst_qvariant.moc" diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro new file mode 100644 index 0000000..f9c1978 --- /dev/null +++ b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qthreadstorage + +SOURCES += tst_qthreadstorage.cpp + diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp new file mode 100644 index 0000000..faae4d7 --- /dev/null +++ b/tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//TESTED_FILES= + +QThreadStorage dummy[8]; + +QThreadStorage tls1; + +class tst_QThreadStorage : public QObject +{ + Q_OBJECT + +public: + tst_QThreadStorage(); + virtual ~tst_QThreadStorage(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void get(); + void set(); +}; + +tst_QThreadStorage::tst_QThreadStorage() +{ +} + +tst_QThreadStorage::~tst_QThreadStorage() +{ +} + +void tst_QThreadStorage::init() +{ + dummy[1].setLocalData(new int(5)); + dummy[2].setLocalData(new int(4)); + dummy[3].setLocalData(new int(3)); + tls1.setLocalData(new QString()); +} + +void tst_QThreadStorage::cleanup() +{ +} + +void tst_QThreadStorage::construct() +{ + QBENCHMARK { + QThreadStorage ts; + } +} + + +void tst_QThreadStorage::get() +{ + QThreadStorage ts; + ts.setLocalData(new int(45)); + + int count = 0; + QBENCHMARK { + int *i = ts.localData(); + count += *i; + } + ts.setLocalData(0); +} + +void tst_QThreadStorage::set() +{ + QThreadStorage ts; + + int count = 0; + QBENCHMARK { + ts.setLocalData(new int(count)); + count++; + } + ts.setLocalData(0); +} + + +QTEST_MAIN(tst_QThreadStorage) +#include "tst_qthreadstorage.moc" diff --git a/tests/benchmarks/corelib/thread/thread.pro b/tests/benchmarks/corelib/thread/thread.pro new file mode 100644 index 0000000..26570ba --- /dev/null +++ b/tests/benchmarks/corelib/thread/thread.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qthreadstorage diff --git a/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro b/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro new file mode 100644 index 0000000..c6f3fa6 --- /dev/null +++ b/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_containers-associative +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/main.cpp new file mode 100644 index 0000000..4c6dae4 --- /dev/null +++ b/tests/benchmarks/corelib/tools/containers-associative/main.cpp @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include + +class tst_associative_containers : public QObject +{ + Q_OBJECT +private slots: + void insert_data(); + void insert(); + void lookup_data(); + void lookup(); +}; + +template +void testInsert(int size) +{ + T container; + + QBENCHMARK { + for (int i = 0; i < size; ++i) + container.insert(i, i); + } +} + +void tst_associative_containers::insert_data() +{ + QTest::addColumn("useHash"); + QTest::addColumn("size"); + + for (int size = 10; size < 20000; size += 100) { + + const QByteArray sizeString = QByteArray::number(size); + + QTest::newRow(("hash--" + sizeString).constData()) << true << size; + QTest::newRow(("map--" + sizeString).constData()) << false << size; + } +} + +void tst_associative_containers::insert() +{ + QFETCH(bool, useHash); + QFETCH(int, size); + + QHash testHash; + QMap testMap; + + if (useHash) { + testInsert >(size); + } else { + testInsert >(size); + } +} + +void tst_associative_containers::lookup_data() +{ +// setReportType(LineChartReport); +// setChartTitle("Time to call value(), with an increasing number of items in the container"); + + QTest::addColumn("useHash"); + QTest::addColumn("size"); + + for (int size = 10; size < 20000; size += 100) { + + const QByteArray sizeString = QByteArray::number(size); + + QTest::newRow(("hash--" + sizeString).constData()) << true << size; + QTest::newRow(("map--" + sizeString).constData()) << false << size; + } +} + +template +void testLookup(int size) +{ + T container; + + for (int i = 0; i < size; ++i) + container.insert(i, i); + + int val; + + QBENCHMARK { + for (int i = 0; i < size; ++i) + val = container.value(i); + + } +} + +void tst_associative_containers::lookup() +{ + QFETCH(bool, useHash); + QFETCH(int, size); + + if (useHash) { + testLookup >(size); + } else { + testLookup >(size); + } +} + +QTEST_MAIN(tst_associative_containers) +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro b/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro new file mode 100644 index 0000000..bf6db44 --- /dev/null +++ b/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_containers-sequential +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp new file mode 100644 index 0000000..a6e405c --- /dev/null +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -0,0 +1,265 @@ +/**************************************************************************** +** +** 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 +#include +#include + +#include + +template // 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 +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 +class UseCases_QVector : public UseCases +{ + void insert(int size) + { + QVector v; + T t; + QBENCHMARK { + for (int i = 0; i < size; ++i) + v.append(t); + } + } + + void lookup(int size) + { + QVector 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(ts); + delete[] ts; + } +}; + +// This subclass implements the use cases using std::vector as efficiently as possible. +template +class UseCases_stdvector : public UseCases +{ + void insert(int size) + { + std::vector v; + T t; + QBENCHMARK { + for (int i = 0; i < size; ++i) + v.push_back(t); + } + } + + void lookup(int size) + { + std::vector 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(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; + useCases_stdvector_int = new UseCases_stdvector; + + useCases_QVector_Large = new UseCases_QVector; + useCases_stdvector_Large = new UseCases_stdvector; + } + +private: + UseCases *useCases_QVector_int; + UseCases *useCases_stdvector_int; + UseCases *useCases_QVector_Large; + UseCases *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("useStd"); + QTest::addColumn("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("useStd"); + QTest::addColumn("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); +} + +void tst_vector_vs_std::lookup_int_data() +{ + QTest::addColumn("useStd"); + QTest::addColumn("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::lookup_int() +{ + QFETCH(bool, useStd); + QFETCH(int, size); + + if (useStd) + useCases_stdvector_int->lookup(size); + else + useCases_QVector_int->lookup(size); +} + +void tst_vector_vs_std::lookup_Large_data() +{ + QTest::addColumn("useStd"); + QTest::addColumn("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/tests/benchmarks/corelib/tools/qbytearray/main.cpp b/tests/benchmarks/corelib/tools/qbytearray/main.cpp new file mode 100644 index 0000000..22d4815 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qbytearray/main.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include + +#include + + +class tst_qbytearray : public QObject +{ + Q_OBJECT +private slots: + void append(); + void append_data(); +}; + + +void tst_qbytearray::append_data() +{ + QTest::addColumn("size"); + QTest::newRow("1") << int(1); + QTest::newRow("10") << int(10); + QTest::newRow("100") << int(100); + QTest::newRow("1000") << int(1000); + QTest::newRow("10000") << int(10000); + QTest::newRow("100000") << int(100000); + QTest::newRow("1000000") << int(1000000); + QTest::newRow("10000000") << int(10000000); + QTest::newRow("100000000") << int(100000000); +} + +void tst_qbytearray::append() +{ + QFETCH(int, size); + +#ifdef Q_OS_SYMBIAN + if (size > 1000000) + QSKIP("Skipped due to limited memory in many Symbian devices.", SkipSingle); +#endif + + QByteArray ba; + QBENCHMARK { + QByteArray ba2(size, 'x'); + ba.append(ba2); + ba.clear(); + } +} + + +QTEST_MAIN(tst_qbytearray) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro b/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro new file mode 100755 index 0000000..a0bf021 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qbytearray +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/qrect/main.cpp b/tests/benchmarks/corelib/tools/qrect/main.cpp new file mode 100644 index 0000000..e293bfa --- /dev/null +++ b/tests/benchmarks/corelib/tools/qrect/main.cpp @@ -0,0 +1,329 @@ +/**************************************************************************** +** +** 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 QRect/QRectF functions. + +#include +#include + +class tst_qrect : public QObject +{ + Q_OBJECT +private slots: + // QRect functions: + void contains_point_data(); + void contains_point(); + void contains_rect_data(); + void contains_rect(); + void intersects_data(); + void intersects(); + void intersected_data(); + void intersected(); + void united_data(); + void united(); + + // QRectF functions: + void contains_point_f_data(); + void contains_point_f(); + void contains_rect_f_data(); + void contains_rect_f(); + void intersects_f_data(); + void intersects_f(); + void intersected_f_data(); + void intersected_f(); + void united_f_data(); + void united_f(); +}; + +struct RectRectCombination +{ + QString tag; + qreal x1, y1, w1, h1, x2, y2, w2, h2; + RectRectCombination( + const QString &tag, + const qreal x1, const qreal y1, const qreal w1, const qreal h1, + const qreal x2, const qreal y2, const qreal w2, const qreal h2) + : tag(tag), x1(x1), y1(y1), w1(w1), h1(h1), x2(x2), y2(y2), w2(w2), h2(h2) {} +}; + +static QList createRectRectCombinations() +{ + QList result; + result << RectRectCombination("null", 0, 0, 0, 0, 0, 0, 0, 0); + result << RectRectCombination("null1", 0, 0, 0, 0, 0, 0, 10, 10); + result << RectRectCombination("null2", 0, 0, 10, 10, 0, 0, 0, 0); + + result << RectRectCombination("miss", 0, 0, 10, 10, 11, 11, 10, 10); + result << RectRectCombination("intersect", 0, 0, 10, 10, 5, 5, 10, 10); + result << RectRectCombination("contain1", 0, 0, 10, 10, 1, 1, 8, 8); + result << RectRectCombination("contain2", 1, 1, 8, 8, 0, 0, 10, 10); + + result << RectRectCombination("miss_flip1", 9, 9, -10, -10, 11, 11, 10, 10); + result << RectRectCombination("intersect_flip1", 9, 9, -10, -10, 5, 5, 10, 10); + result << RectRectCombination("contain1_flip1", 9, 9, -10, -10, 1, 1, 8, 8); + result << RectRectCombination("contain2_flip1", 8, 8, -8, -8, 0, 0, 10, 10); + + result << RectRectCombination("miss_flip2", 0, 0, 10, 10, 20, 20, -10, -10); + result << RectRectCombination("intersect_flip2", 0, 0, 10, 10, 14, 14, -10, -10); + result << RectRectCombination("contain1_flip2", 0, 0, 10, 10, 8, 8, -8, -8); + result << RectRectCombination("contain2_flip2", 1, 1, 8, 8, 9, 9, -10, -10); + + return result; +} + +static void addRectRectData(bool includeProperArg = false) +{ + QTest::addColumn("rf1"); + QTest::addColumn("rf2"); + if (includeProperArg) + QTest::addColumn("proper"); + for (int i = 0; i < (includeProperArg ? 2 : 1); ++i) { + QList combinations = createRectRectCombinations(); + foreach (RectRectCombination c, combinations) { + QTestData &testData = QTest::newRow(c.tag.toLatin1().data()); + QRectF r1(c.x1, c.y1, c.w1, c.h1); + QRectF r2(c.x2, c.y2, c.w2, c.h2); + testData << r1 << r2; + if (includeProperArg) + testData << (i == 0); + } + } +} + +struct RectPointCombination +{ + QString tag; + qreal x, y, w, h, px, py; + RectPointCombination( + const QString &tag, + const qreal x, const qreal y, const qreal w, const qreal h, const qreal px, const qreal py) + : tag(tag), x(x), y(y), w(w), h(h), px(px), py(py) {} +}; + +static QList createRectPointCombinations() +{ + QList result; + result << RectPointCombination("null", 0, 0, 0, 0, 0, 0); + + result << RectPointCombination("miss", 0, 0, 10, 10, -1, -1); + result << RectPointCombination("contain", 0, 0, 10, 10, 0, 0); + result << RectPointCombination("contain_proper", 0, 0, 10, 10, 1, 1); + + result << RectPointCombination("miss_flip", 9, 9, -10, -10, -1, -1); + result << RectPointCombination("contain_flip", 9, 9, -10, -10, 0, 0); + result << RectPointCombination("contain_flip_proper", 9, 9, -10, -10, 1, 1); + + return result; +} + +static void addRectPointData(bool includeProperArg = false) +{ + QTest::addColumn("rf"); + QTest::addColumn("pf"); + if (includeProperArg) + QTest::addColumn("proper"); + for (int i = 0; i < (includeProperArg ? 2 : 1); ++i) { + QList combinations = createRectPointCombinations(); + foreach (RectPointCombination c, combinations) { + QTestData &testData = QTest::newRow(c.tag.toLatin1().data()); + QRectF r(c.x, c.y, c.w, c.h); + QPointF p(c.px, c.py); + testData << r << p; + if (includeProperArg) + testData << (i == 0); + } + } +} + +void tst_qrect::contains_point_data() +{ + addRectPointData(true); +} + +void tst_qrect::contains_point() +{ + QFETCH(QRectF, rf); + QFETCH(QPointF, pf); + QFETCH(bool, proper); + QRect r(rf.toRect()); + QPoint p(pf.toPoint()); + QBENCHMARK { + r.contains(p, proper); + } +} + +void tst_qrect::contains_rect_data() +{ + addRectRectData(true); +} + +void tst_qrect::contains_rect() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QFETCH(bool, proper); + QRect r1(rf1.toRect()); + QRect r2(rf2.toRect()); + QBENCHMARK { + r1.contains(r2, proper); + } +} + +void tst_qrect::intersects_data() +{ + addRectRectData(); +} + +void tst_qrect::intersects() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QRect r1(rf1.toRect()); + QRect r2(rf2.toRect()); + QBENCHMARK { + r1.intersects(r2); + } +} + +void tst_qrect::intersected_data() +{ + addRectRectData(); +} + +void tst_qrect::intersected() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QRect r1(rf1.toRect()); + QRect r2(rf2.toRect()); + QBENCHMARK { + r1.intersected(r2); + } +} + +void tst_qrect::united_data() +{ + addRectRectData(); +} + +void tst_qrect::united() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QRect r1(rf1.toRect()); + QRect r2(rf2.toRect()); + QBENCHMARK { + r1.united(r2); + } +} + +void tst_qrect::contains_point_f_data() +{ + addRectPointData(); +} + +void tst_qrect::contains_point_f() +{ + QFETCH(QRectF, rf); + QFETCH(QPointF, pf); + QBENCHMARK { + rf.contains(pf); + } +} + +void tst_qrect::contains_rect_f_data() +{ + addRectRectData(); +} + +void tst_qrect::contains_rect_f() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QBENCHMARK { + rf1.contains(rf2); + } +} + +void tst_qrect::intersects_f_data() +{ + addRectRectData(); +} + +void tst_qrect::intersects_f() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QBENCHMARK { + rf1.intersects(rf2); + } +} + +void tst_qrect::intersected_f_data() +{ + addRectRectData(); +} + +void tst_qrect::intersected_f() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QBENCHMARK { + rf1.intersected(rf2); + } +} + +void tst_qrect::united_f_data() +{ + addRectRectData(); +} + +void tst_qrect::united_f() +{ + QFETCH(QRectF, rf1); + QFETCH(QRectF, rf2); + QBENCHMARK { + rf1.united(rf2); + } +} + +QTEST_MAIN(tst_qrect) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qrect/qrect.pro b/tests/benchmarks/corelib/tools/qrect/qrect.pro new file mode 100644 index 0000000..6e35119 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qrect/qrect.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qrect +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/tools/qregexp/main.cpp new file mode 100644 index 0000000..ab9ed71 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qregexp/main.cpp @@ -0,0 +1,290 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +#include + + +class tst_qregexp : public QObject +{ + Q_OBJECT +private slots: + void escape_old(); + void escape_old_data() { escape_data(); } + void escape_new1(); + void escape_new1_data() { escape_data(); } + void escape_new2(); + void escape_new2_data() { escape_data(); } + void escape_new3(); + void escape_new3_data() { escape_data(); } + void escape_new4(); + void escape_new4_data() { escape_data(); } +private: + void escape_data(); +}; + + +static void verify(const QString "ed, const QString &expected) +{ + if (quoted != expected) + qDebug() << "ERROR:" << quoted << expected; +} + +void tst_qregexp::escape_data() +{ + QTest::addColumn("pattern"); + QTest::addColumn("expected"); + + QTest::newRow("escape 0") << "Hello world" << "Hello world"; + QTest::newRow("escape 1") << "(Hello world)" << "\\(Hello world\\)"; + { + QString s; + for (int i = 0; i < 10; ++i) + s += "(escape)"; + QTest::newRow("escape 10") << s << QRegExp::escape(s); + } + { + QString s; + for (int i = 0; i < 100; ++i) + s += "(escape)"; + QTest::newRow("escape 100") << s << QRegExp::escape(s); + } +} + +void tst_qregexp::escape_old() +{ + QFETCH(QString, pattern); + QFETCH(QString, expected); + + QBENCHMARK { + static const char meta[] = "$()*+.?[\\]^{|}"; + QString quoted = pattern; + int i = 0; + + while (i < quoted.length()) { + if (strchr(meta, quoted.at(i).toLatin1()) != 0) + quoted.insert(i++, QLatin1Char('\\')); + ++i; + } + + verify(quoted, expected); + } +} + +void tst_qregexp::escape_new1() +{ + QFETCH(QString, pattern); + QFETCH(QString, expected); + + QBENCHMARK { + QString quoted; + const int count = pattern.count(); + quoted.reserve(count * 2); + const QLatin1Char backslash('\\'); + for (int i = 0; i < count; i++) { + switch (pattern.at(i).toLatin1()) { + case '$': + case '(': + case ')': + case '*': + case '+': + case '.': + case '?': + case '[': + case '\\': + case ']': + case '^': + case '{': + case '|': + case '}': + quoted.append(backslash); + } + quoted.append(pattern.at(i)); + } + verify(quoted, expected); + } +} + +void tst_qregexp::escape_new2() +{ + QFETCH(QString, pattern); + QFETCH(QString, expected); + + QBENCHMARK { + int count = pattern.count(); + const QLatin1Char backslash('\\'); + QString quoted(count * 2, backslash); + const QChar *patternData = pattern.data(); + QChar *quotedData = quoted.data(); + int escaped = 0; + for ( ; --count >= 0; ++patternData) { + const QChar c = *patternData; + switch (c.unicode()) { + case '$': + case '(': + case ')': + case '*': + case '+': + case '.': + case '?': + case '[': + case '\\': + case ']': + case '^': + case '{': + case '|': + case '}': + ++escaped; + ++quotedData; + } + *quotedData = c; + ++quotedData; + } + quoted.resize(pattern.size() + escaped); + + verify(quoted, expected); + } +} + +void tst_qregexp::escape_new3() +{ + QFETCH(QString, pattern); + QFETCH(QString, expected); + + QBENCHMARK { + QString quoted; + const int count = pattern.count(); + quoted.reserve(count * 2); + const QLatin1Char backslash('\\'); + for (int i = 0; i < count; i++) { + switch (pattern.at(i).toLatin1()) { + case '$': + case '(': + case ')': + case '*': + case '+': + case '.': + case '?': + case '[': + case '\\': + case ']': + case '^': + case '{': + case '|': + case '}': + quoted += backslash; + } + quoted += pattern.at(i); + } + + verify(quoted, expected); + } +} + + +static inline bool needsEscaping(int c) +{ + switch (c) { + case '$': + case '(': + case ')': + case '*': + case '+': + case '.': + case '?': + case '[': + case '\\': + case ']': + case '^': + case '{': + case '|': + case '}': + return true; + } + return false; +} + +void tst_qregexp::escape_new4() +{ + QFETCH(QString, pattern); + QFETCH(QString, expected); + + QBENCHMARK { + const int n = pattern.size(); + const QChar *patternData = pattern.data(); + // try to prevent copy if no escape is needed + int i = 0; + for (int i = 0; i != n; ++i) { + const QChar c = patternData[i]; + if (needsEscaping(c.unicode())) + break; + } + if (i == n) { + verify(pattern, expected); + // no escaping needed, "return pattern" should be done here. + return; + } + const QLatin1Char backslash('\\'); + QString quoted(n * 2, backslash); + QChar *quotedData = quoted.data(); + for (int j = 0; j != i; ++j) + *quotedData++ = *patternData++; + int escaped = 0; + for (; i != n; ++i) { + const QChar c = *patternData; + if (needsEscaping(c.unicode())) { + ++escaped; + ++quotedData; + } + *quotedData = c; + ++quotedData; + ++patternData; + } + quoted.resize(n + escaped); + verify(quoted, expected); + // "return quoted" + } +} +QTEST_MAIN(tst_qregexp) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro new file mode 100644 index 0000000..83d723c --- /dev/null +++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qregexp +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp new file mode 100644 index 0000000..12826eb --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + +class tst_QString: public QObject +{ + Q_OBJECT +private slots: + void equals() const; + void equals_data() const; + void fromUtf8() const; +}; + +void tst_QString::equals() const +{ + QFETCH(QString, a); + QFETCH(QString, b); + + QBENCHMARK { + a == b; + } +} + +void tst_QString::equals_data() const +{ + static const struct { + ushort data[80]; + int dummy; // just to ensure 4-byte alignment + } data = { + { + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, // 16 + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, // 32 + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, // 48 + 64, 64, 64, 64, 64, 64, 64, 64, + 64, 64, 64, 64, 64, 64, 64, 64, // 64 + 64, 64, 64, 64, 96, 96, 96, 96, + 64, 64, 96, 96, 96, 96, 96, 96 // 80 + }, 0 + }; + const QChar *ptr = reinterpret_cast(data.data); + + QTest::addColumn("a"); + QTest::addColumn("b"); + QString base = QString::fromRawData(ptr, 64); + + QTest::newRow("different-length") << base << QString::fromRawData(ptr, 4); + QTest::newRow("same-string") << base << base; + QTest::newRow("same-data") << base << QString::fromRawData(ptr, 64); + + // try to avoid crossing a cache line (that is, at ptr[64]) + QTest::newRow("aligned-aligned-4n") + << QString::fromRawData(ptr, 60) << QString::fromRawData(ptr + 2, 60); + QTest::newRow("aligned-unaligned-4n") + << QString::fromRawData(ptr, 60) << QString::fromRawData(ptr + 1, 60); + QTest::newRow("unaligned-unaligned-4n") + << QString::fromRawData(ptr + 1, 60) << QString::fromRawData(ptr + 3, 60); + + QTest::newRow("aligned-aligned-4n+1") + << QString::fromRawData(ptr, 61) << QString::fromRawData(ptr + 2, 61); + QTest::newRow("aligned-unaligned-4n+1") + << QString::fromRawData(ptr, 61) << QString::fromRawData(ptr + 1, 61); + QTest::newRow("unaligned-unaligned-4n+1") + << QString::fromRawData(ptr + 1, 61) << QString::fromRawData(ptr + 3, 61); + + QTest::newRow("aligned-aligned-4n-1") + << QString::fromRawData(ptr, 59) << QString::fromRawData(ptr + 2, 59); + QTest::newRow("aligned-unaligned-4n-1") + << QString::fromRawData(ptr, 59) << QString::fromRawData(ptr + 1, 59); + QTest::newRow("unaligned-unaligned-4n-1") + << QString::fromRawData(ptr + 1, 59) << QString::fromRawData(ptr + 3, 59); + + QTest::newRow("aligned-aligned-2n") + << QString::fromRawData(ptr, 58) << QString::fromRawData(ptr + 2, 58); + QTest::newRow("aligned-unaligned-2n") + << QString::fromRawData(ptr, 58) << QString::fromRawData(ptr + 1, 58); + QTest::newRow("unaligned-unaligned-2n") + << QString::fromRawData(ptr + 1, 58) << QString::fromRawData(ptr + 3, 58); +} + +void tst_QString::fromUtf8() const +{ + QFile file(SRCDIR "utf-8.txt"); + if (!file.open(QFile::ReadOnly)) { + qFatal("Cannot open input file"); + return; + } + QByteArray data = file.readAll(); + const char *d = data.constData(); + int size = data.size(); + + QBENCHMARK { + QString::fromUtf8(d, size); + } +} + +QTEST_MAIN(tst_QString) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/tools/qstring/qstring.pro new file mode 100644 index 0000000..2e7c86a --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstring/qstring.pro @@ -0,0 +1,16 @@ +load(qttest_p4) +TARGET = tst_qstring +QT -= gui +SOURCES += main.cpp + +wince*:{ + DEFINES += SRCDIR=\\\"\\\" +} else:symbian* { + addFiles.sources = utf-8.txt + addFiles.path = . + DEPLOYMENT += addFiles + TARGET.EPOCHEAPSIZE="0x100 0x1000000" +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + diff --git a/tests/benchmarks/corelib/tools/qstring/utf-8.txt b/tests/benchmarks/corelib/tools/qstring/utf-8.txt new file mode 100644 index 0000000..a8a58de --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstring/utf-8.txt @@ -0,0 +1,72 @@ +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français +SprÃ¥k: Norsk +Γλώσσα: Ελληνικά +Язык: РуÑÑкий +언어 : 한국어 +言語: 日本語 +Langage : Français diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp new file mode 100644 index 0000000..9bd146f --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp @@ -0,0 +1,464 @@ +/**************************************************************************** +** +** 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 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$ +** +****************************************************************************/ + +// Select one of the scenarios below +#define SCENARIO 1 + +#if SCENARIO == 1 +// this is the "no harm done" version. Only operator% is active, +// with NO_CAST * defined +#define P % +#undef QT_USE_FAST_OPERATOR_PLUS +#undef QT_USE_FAST_CONCATENATION +#define QT_NO_CAST_FROM_ASCII +#define QT_NO_CAST_TO_ASCII +#endif + + +#if SCENARIO == 2 +// this is the "full" version. Operator+ is replaced by a QStringBuilder +// based version +// with NO_CAST * defined +#define P + +#define QT_USE_FAST_OPERATOR_PLUS +#define QT_USE_FAST_CONCATENATION +#define QT_NO_CAST_FROM_ASCII +#define QT_NO_CAST_TO_ASCII +#endif + +#if SCENARIO == 3 +// this is the "no harm done" version. Only operator% is active, +// with NO_CAST * _not_ defined +#define P % +#undef QT_USE_FAST_OPERATOR_PLUS +#undef QT_USE_FAST_CONCATENATION +#undef QT_NO_CAST_FROM_ASCII +#undef QT_NO_CAST_TO_ASCII +#endif + +#if SCENARIO == 4 +// this is the "full" version. Operator+ is replaced by a QStringBuilder +// based version +// with NO_CAST * _not_ defined +#define P + +#define QT_USE_FAST_OPERATOR_PLUS +#define QT_USE_FAST_CONCATENATION +#undef QT_NO_CAST_FROM_ASCII +#undef QT_NO_CAST_TO_ASCII +#endif + + +#include +#include +#include +#include + +#include + +#include + +#define COMPARE(a, b) QCOMPARE(a, b) +//#define COMPARE(a, b) + +#define SEP(s) qDebug() << "\n\n-------- " s " ---------"; + +#define LITERAL "some string literal" + +class tst_qstringbuilder : public QObject +{ + Q_OBJECT + +public: + tst_qstringbuilder() + : l1literal(LITERAL), + l1string(LITERAL), + ba(LITERAL), + string(l1string), + stdstring(LITERAL), + stringref(&string, 2, 10), + achar('c'), + r2(QLatin1String(LITERAL LITERAL)), + r3(QLatin1String(LITERAL LITERAL LITERAL)), + r4(QLatin1String(LITERAL LITERAL LITERAL LITERAL)), + r5(QLatin1String(LITERAL LITERAL LITERAL LITERAL LITERAL)) + {} + + +public: + enum { N = 10000 }; + + int run_traditional() + { + int s = 0; + for (int i = 0; i < N; ++i) { +#if 0 + s += QString(l1string + l1string).size(); + s += QString(l1string + l1string + l1string).size(); + s += QString(l1string + l1string + l1string + l1string).size(); + s += QString(l1string + l1string + l1string + l1string + l1string).size(); +#endif + s += QString(achar + l1string + achar).size(); + } + return s; + } + + int run_builder() + { + int s = 0; + for (int i = 0; i < N; ++i) { +#if 0 + s += QString(l1literal P l1literal).size(); + s += QString(l1literal P l1literal P l1literal).size(); + s += QString(l1literal P l1literal P l1literal P l1literal).size(); + s += QString(l1literal P l1literal P l1literal P l1literal P l1literal).size(); +#endif + s += QString(achar % l1literal % achar).size(); + } + return s; + } + +private slots: + + void separator_0() { + qDebug() << "\nIn each block the QStringBuilder based result appear first " + "(with a 'b_' prefix), QStringBased second ('q_' prefix), std::string " + "last ('s_' prefix)\n"; + } + + void separator_1() { SEP("literal + literal (builder first)"); } + + void b_2_l1literal() { + QBENCHMARK { r = l1literal P l1literal; } + COMPARE(r, r2); + } + #ifndef QT_NO_CAST_FROM_ASCII + void b_l1literal_LITERAL() { + QBENCHMARK { r = l1literal P LITERAL; } + COMPARE(r, r2); + } + #endif + void q_2_l1string() { + QBENCHMARK { r = l1string + l1string; } + COMPARE(r, r2); + } + + + void separator_2() { SEP("2 strings"); } + + void b_2_string() { + QBENCHMARK { r = string P string; } + COMPARE(r, r2); + } + void q_2_string() { + QBENCHMARK { r = string + string; } + COMPARE(r, r2); + } + void s_2_string() { + QBENCHMARK { stdr = stdstring + stdstring; } + COMPARE(stdr, stdstring + stdstring); + } + + + void separator_2c() { SEP("2 string refs"); } + + void b_2_stringref() { + QBENCHMARK { r = stringref % stringref; } + COMPARE(r, QString(stringref.toString() + stringref.toString())); + } + void q_2_stringref() { + QBENCHMARK { r = stringref.toString() + stringref.toString(); } + COMPARE(r, QString(stringref % stringref)); + } + + + void separator_2b() { SEP("3 strings"); } + + void b_3_string() { + QBENCHMARK { r = string P string P string; } + COMPARE(r, r3); + } + void q_3_string() { + QBENCHMARK { r = string + string + string; } + COMPARE(r, r3); + } + void s_3_string() { + QBENCHMARK { stdr = stdstring + stdstring + stdstring; } + COMPARE(stdr, stdstring + stdstring + stdstring); + } + + void separator_2e() { SEP("4 strings"); } + + void b_4_string() { + QBENCHMARK { r = string P string P string P string; } + COMPARE(r, r4); + } + void q_4_string() { + QBENCHMARK { r = string + string + string + string; } + COMPARE(r, r4); + } + void s_4_string() { + QBENCHMARK { stdr = stdstring + stdstring + stdstring + stdstring; } + COMPARE(stdr, stdstring + stdstring + stdstring + stdstring); + } + + + + void separator_2a() { SEP("string + literal (builder first)"); } + + void b_string_l1literal() { + QBENCHMARK { r = string % l1literal; } + COMPARE(r, r2); + } + #ifndef QT_NO_CAST_FROM_ASCII + void b_string_LITERAL() { + QBENCHMARK { r = string P LITERAL; } + COMPARE(r, r2); + } + void b_LITERAL_string() { + QBENCHMARK { r = LITERAL P string; } + COMPARE(r, r2); + } + #endif + void b_string_l1string() { + QBENCHMARK { r = string P l1string; } + COMPARE(r, r2); + } + void q_string_l1literal() { + QBENCHMARK { r = string + l1string; } + COMPARE(r, r2); + } + void q_string_l1string() { + QBENCHMARK { r = string + l1string; } + COMPARE(r, r2); + } + void s_LITERAL_string() { + QBENCHMARK { stdr = LITERAL + stdstring; } + COMPARE(stdr, stdstring + stdstring); + } + + + void separator_3() { SEP("3 literals"); } + + void b_3_l1literal() { + QBENCHMARK { r = l1literal P l1literal P l1literal; } + COMPARE(r, r3); + } + void q_3_l1string() { + QBENCHMARK { r = l1string + l1string + l1string; } + COMPARE(r, r3); + } + void s_3_l1string() { + QBENCHMARK { stdr = stdstring + LITERAL + LITERAL; } + COMPARE(stdr, stdstring + stdstring + stdstring); + } + + + void separator_4() { SEP("4 literals"); } + + void b_4_l1literal() { + QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal; } + COMPARE(r, r4); + } + void q_4_l1string() { + QBENCHMARK { r = l1string + l1string + l1string + l1string; } + COMPARE(r, r4); + } + + + void separator_5() { SEP("5 literals"); } + + void b_5_l1literal() { + QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal P l1literal; } + COMPARE(r, r5); + } + + void q_5_l1string() { + QBENCHMARK { r = l1string + l1string + l1string + l1string + l1string; } + COMPARE(r, r5); + } + + + void separator_6() { SEP("4 chars"); } + + void b_string_4_char() { + QBENCHMARK { r = string + achar + achar + achar + achar; } + COMPARE(r, QString(string P achar P achar P achar P achar)); + } + + void q_string_4_char() { + QBENCHMARK { r = string + achar + achar + achar + achar; } + COMPARE(r, QString(string P achar P achar P achar P achar)); + } + + void s_string_4_char() { + QBENCHMARK { stdr = stdstring + 'c' + 'c' + 'c' + 'c'; } + COMPARE(stdr, stdstring + 'c' + 'c' + 'c' + 'c'); + } + + + void separator_7() { SEP("char + string + char"); } + + void b_char_string_char() { + QBENCHMARK { r = achar + string + achar; } + COMPARE(r, QString(achar P string P achar)); + } + + void q_char_string_char() { + QBENCHMARK { r = achar + string + achar; } + COMPARE(r, QString(achar P string P achar)); + } + + void s_char_string_char() { + QBENCHMARK { stdr = 'c' + stdstring + 'c'; } + COMPARE(stdr, 'c' + stdstring + 'c'); + } + + + void separator_8() { SEP("string.arg"); } + + void b_string_arg() { + const QString pattern = l1string + QString::fromLatin1("%1") + l1string; + QBENCHMARK { r = l1literal P string P l1literal; } + COMPARE(r, r3); + } + + void q_string_arg() { + const QString pattern = l1string + QLatin1String("%1") + l1string; + QBENCHMARK { r = pattern.arg(string); } + COMPARE(r, r3); + } + + void q_bytearray_arg() { + QByteArray result; + QBENCHMARK { result = ba + ba + ba; } + } + + + void separator_9() { SEP("QString::reserve()"); } + + void b_reserve() { + QBENCHMARK { + r.clear(); + r = string P string P string P string; + } + COMPARE(r, r4); + } + void b_reserve_lit() { + QBENCHMARK { + r.clear(); + r = string P l1literal P string P string; + } + COMPARE(r, r4); + } + void s_reserve() { + QBENCHMARK { + r.clear(); + r.reserve(string.size() + string.size() + string.size() + string.size()); + r += string; + r += string; + r += string; + r += string; + } + COMPARE(r, r4); + } + void s_reserve_lit() { + QBENCHMARK { + r.clear(); + //r.reserve(string.size() + qstrlen(l1string.latin1()) + // + string.size() + string.size()); + r.reserve(1024); + r += string; + r += l1string; + r += string; + r += string; + } + COMPARE(r, r4); + } + +private: + const QLatin1Literal l1literal; + const QLatin1String l1string; + const QByteArray ba; + const QString string; + const std::string stdstring; + const QStringRef stringref; + const QLatin1Char achar; + const QString r2, r3, r4, r5; + + // short cuts for results + QString r; + std::string stdr; +}; + + +//void operator%(QString, int) {} + +int main(int argc, char *argv[]) +{ + //qDebug() << (QString("xx") * QLatin1String("y")).toString(); + //42 % 3; // Sanity test, should always work. + //QString("x") % 2; // Sanity test, should only compile when the + // operator%(QString, int) is visible. + + if (argc == 2 && (QLatin1String(argv[1]) == QLatin1String("--run-builder") + || QLatin1String(argv[1]) == QLatin1String("-b"))) { + tst_qstringbuilder test; + return test.run_builder(); + } + + if (argc == 2 && (QLatin1String(argv[1]) == QLatin1String("--run-traditional") + || QLatin1String(argv[1]) == QLatin1String("-t"))) { + tst_qstringbuilder test; + return test.run_traditional(); + } + + if (argc == 1) { + QCoreApplication app(argc, argv); + QStringList args = app.arguments(); + tst_qstringbuilder test; + return QTest::qExec(&test, argc, argv); + } + + qDebug() << "Usage: " << argv[0] << " [--run-builder|-r|--run-traditional|-t]"; +} + + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro b/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro new file mode 100644 index 0000000..79171b4 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qstringbuilder + +QMAKE_CXXFLAGS += -g +QMAKE_CFLAGS += -g + +QT -= gui + +CONFIG += release + +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/qstringlist/.gitignore b/tests/benchmarks/corelib/tools/qstringlist/.gitignore new file mode 100644 index 0000000..3e0cdc9 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstringlist/.gitignore @@ -0,0 +1 @@ +tst_qstringlist diff --git a/tests/benchmarks/corelib/tools/qstringlist/main.cpp b/tests/benchmarks/corelib/tools/qstringlist/main.cpp new file mode 100644 index 0000000..3fac598 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstringlist/main.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include +#include +#include + +class tst_QStringList: public QObject +{ + Q_OBJECT + +private slots: + void join() const; + void join_data() const; + + void split() const; + void split_data() const; + + void split_std() const; + void split_std_data() const { return split_data(); } + + void split_stdw() const; + void split_stdw_data() const { return split_data(); } + + void split_ba() const; + void split_ba_data() const { return split_data(); } + +private: + static QStringList populateList(const int count, const QString &unit); + static QString populateString(const int count, const QString &unit); +}; + +QStringList tst_QStringList::populateList(const int count, const QString &unit) +{ + QStringList retval; + + for (int i = 0; i < count; ++i) + retval.append(unit); + + return retval; +} + +QString tst_QStringList::populateString(const int count, const QString &unit) +{ + QString retval; + + for (int i = 0; i < count; ++i) { + retval.append(unit); + retval.append(QLatin1Char(':')); + } + + return retval; +} + +void tst_QStringList::join() const +{ + QFETCH(QStringList, input); + QFETCH(QString, separator); + + QBENCHMARK { + input.join(separator); + } +} + +void tst_QStringList::join_data() const +{ + QTest::addColumn("input"); + QTest::addColumn("separator"); + + QTest::newRow("") + << populateList(100, QLatin1String("unit")) + << QString(); + + QTest::newRow("") + << populateList(1000, QLatin1String("unit")) + << QString(); + + QTest::newRow("") + << populateList(10000, QLatin1String("unit")) + << QString(); + + QTest::newRow("") + << populateList(100000, QLatin1String("unit")) + << QString(); +} + +void tst_QStringList::split() const +{ + QFETCH(QString, input); + const QChar splitChar = ':'; + + QBENCHMARK { + input.split(splitChar); + } +} + +void tst_QStringList::split_data() const +{ + QTest::addColumn("input"); + QString unit = QLatin1String("unit"); + QTest::newRow("") << populateString(10, unit); + QTest::newRow("") << populateString(100, unit); + QTest::newRow("") << populateString(1000, unit); + QTest::newRow("") << populateString(10000, unit); +} + +void tst_QStringList::split_std() const +{ + QFETCH(QString, input); + const char split_char = ':'; + std::string stdinput = input.toStdString(); + + QBENCHMARK { + std::istringstream split(stdinput); + std::vector token; + for (std::string each; + std::getline(split, each, split_char); + token.push_back(each)) + ; + } +} + +void tst_QStringList::split_stdw() const +{ + QFETCH(QString, input); + const wchar_t split_char = ':'; + std::wstring stdinput = input.toStdWString(); + + QBENCHMARK { + std::wistringstream split(stdinput); + std::vector token; + for (std::wstring each; + std::getline(split, each, split_char); + token.push_back(each)) + ; + } +} + +void tst_QStringList::split_ba() const +{ + QFETCH(QString, input); + const char splitChar = ':'; + QByteArray ba = input.toLatin1(); + + QBENCHMARK { + ba.split(splitChar); + } +} + +QTEST_MAIN(tst_QStringList) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro b/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro new file mode 100644 index 0000000..11cceb0 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TARGET = tst_qstringlist +QT -= gui +SOURCES += main.cpp + +symbian: LIBS += -llibpthread diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro new file mode 100644 index 0000000..12c23fc --- /dev/null +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs +SUBDIRS = \ + containers-associative \ + containers-sequential \ + qbytearray \ + qrect \ + qregexp \ + qstring \ + qstringbuilder \ + qstringlist diff --git a/tests/benchmarks/events/events.pro b/tests/benchmarks/events/events.pro deleted file mode 100644 index adf2317..0000000 --- a/tests/benchmarks/events/events.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_events -DEPENDPATH += . -INCLUDEPATH += . -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/events/main.cpp b/tests/benchmarks/events/main.cpp deleted file mode 100644 index 0dd2c18..0000000 --- a/tests/benchmarks/events/main.cpp +++ /dev/null @@ -1,187 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include - -#include -#include - -class PingPong : public QObject -{ -public: - void setPeer(QObject *peer); - void resetCounter() {m_counter = 100;} - -protected: - bool event(QEvent *e); - -private: - QObject *m_peer; - int m_counter; -}; - -void PingPong::setPeer(QObject *peer) -{ - m_peer = peer; - m_counter = 100; -} - -bool PingPong::event(QEvent *) -{ - --m_counter; - if (m_counter > 0) { - QEvent *e = new QEvent(QEvent::User); - QCoreApplication::postEvent(m_peer, e); - } else { - QTestEventLoop::instance().exitLoop(); - } - return true; -} - -class EventTester : public QObject -{ -public: - int foo(int bar); - -protected: - bool event(QEvent *e); -}; - -bool EventTester::event(QEvent *e) -{ - if (e->type() == QEvent::User+1) - return foo(e->type()) != 0; - return false; -} - -int EventTester::foo(int bar) -{ - return bar + 1; -} - -class EventsBench : public QObject -{ - Q_OBJECT - -private slots: - void initTestCase(); - void cleanupTestCase(); - - void noEvent(); - void sendEvent_data(); - void sendEvent(); - void postEvent_data(); - void postEvent(); -}; - -void EventsBench::initTestCase() -{ -} - -void EventsBench::cleanupTestCase() -{ -} - -void EventsBench::noEvent() -{ - EventTester tst; - int val = 0; - QBENCHMARK { - val += tst.foo(1); - } -} - -void EventsBench::sendEvent_data() -{ - QTest::addColumn("filterEvents"); - QTest::newRow("no eventfilter") << false; - QTest::newRow("eventfilter") << true; -} - -void EventsBench::sendEvent() -{ - QFETCH(bool, filterEvents); - EventTester tst; - if (filterEvents) - tst.installEventFilter(this); - QEvent evt(QEvent::Type(QEvent::User+1)); - QBENCHMARK { - QCoreApplication::sendEvent(&tst, &evt); - } -} - -void EventsBench::postEvent_data() -{ - QTest::addColumn("filterEvents"); - // The first time an eventloop is executed, the case runs radically slower at least - // on some platforms, so test the "no eventfilter" case to get a comparable results - // with the "eventfilter" case. - QTest::newRow("first time, no eventfilter") << false; - QTest::newRow("no eventfilter") << false; - QTest::newRow("eventfilter") << true; -} - -void EventsBench::postEvent() -{ - QFETCH(bool, filterEvents); - PingPong ping; - PingPong pong; - ping.setPeer(&pong); - pong.setPeer(&ping); - if (filterEvents) { - ping.installEventFilter(this); - pong.installEventFilter(this); - } - - QBENCHMARK { - // In case multiple iterations are done, event needs to be created inside the QBENCHMARK, - // or it gets deleted once first iteration exits and can cause a crash. Similarly, - // ping and pong need their counters reset. - QEvent *e = new QEvent(QEvent::User); - ping.resetCounter(); - pong.resetCounter(); - QCoreApplication::postEvent(&ping, e); - QTestEventLoop::instance().enterLoop( 61 ); - } -} - -QTEST_MAIN(EventsBench) - -#include "main.moc" diff --git a/tests/benchmarks/gui/animation/animation.pro b/tests/benchmarks/gui/animation/animation.pro new file mode 100644 index 0000000..a4ba273 --- /dev/null +++ b/tests/benchmarks/gui/animation/animation.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = qanimation diff --git a/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp b/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp new file mode 100644 index 0000000..f79cc5b --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** 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 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 "dummyanimation.h" +#include "dummyobject.h" + + +DummyAnimation::DummyAnimation(DummyObject *d) : m_dummy(d) +{ +} + +void DummyAnimation::updateCurrentValue(const QVariant &value) +{ + if (state() == Stopped) + return; + if (m_dummy) + m_dummy->setRect(value.toRect()); +} + +void DummyAnimation::updateState(State state) +{ + Q_UNUSED(state); +} diff --git a/tests/benchmarks/gui/animation/qanimation/dummyanimation.h b/tests/benchmarks/gui/animation/qanimation/dummyanimation.h new file mode 100644 index 0000000..1df76be --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyanimation.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef _DUMMYANIMATION_H__ + +class DummyObject; + +class DummyAnimation : public QVariantAnimation +{ +public: + DummyAnimation(DummyObject *d); + + void updateCurrentValue(const QVariant &value); + void updateState(State state); + +private: + DummyObject *m_dummy; +}; + +#endif diff --git a/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp b/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp new file mode 100644 index 0000000..2b66cda --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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 QtGui 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 "dummyobject.h" + +DummyObject::DummyObject() +{ +} + +QRect DummyObject::rect() const +{ + return m_rect; +} + +void DummyObject::setRect(const QRect &r) +{ + m_rect = r; +} + +float DummyObject::opacity() const +{ + return m_opacity; +} + +void DummyObject::setOpacity(float o) +{ + m_opacity = o; +} diff --git a/tests/benchmarks/gui/animation/qanimation/dummyobject.h b/tests/benchmarks/gui/animation/qanimation/dummyobject.h new file mode 100644 index 0000000..31614fd --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyobject.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef _DUMMYOBJECT_H__ + +class DummyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(QRect rect READ rect WRITE setRect) + Q_PROPERTY(float opacity READ opacity WRITE setOpacity) +public: + DummyObject(); + QRect rect() const; + void setRect(const QRect &r); + float opacity() const; + void setOpacity(float); + +private: + QRect m_rect; + float m_opacity; +}; + + +#endif diff --git a/tests/benchmarks/gui/animation/qanimation/main.cpp b/tests/benchmarks/gui/animation/qanimation/main.cpp new file mode 100644 index 0000000..8b9884e --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/main.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** 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 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 +#include + +#include "dummyobject.h" +#include "dummyanimation.h" +#include "rectanimation.h" + +#define ITERATION_COUNT 10e3 + +class tst_qanimation : public QObject +{ + Q_OBJECT +private slots: + void itemPropertyAnimation(); + void itemPropertyAnimation_data() { data();} + void dummyAnimation(); + void dummyAnimation_data() { data();} + void dummyPropertyAnimation(); + void dummyPropertyAnimation_data() { data();} + void rectAnimation(); + void rectAnimation_data() { data();} + + void floatAnimation_data() { data(); } + void floatAnimation(); + +private: + void data(); +}; + + +void tst_qanimation::data() +{ + QTest::addColumn("started"); + QTest::newRow("NotRunning") << false; + QTest::newRow("Running") << true; +} + +void tst_qanimation::itemPropertyAnimation() +{ + QFETCH(bool, started); + QGraphicsWidget item; + + //then the property animation + { + QPropertyAnimation anim(&item, "pos"); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QPointF(0,0)); + anim.setEndValue(QPointF(ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } + +} + +void tst_qanimation::dummyAnimation() +{ + QFETCH(bool, started); + DummyObject dummy; + + //first the dummy animation + { + DummyAnimation anim(&dummy); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QRect(0, 0, 0, 0)); + anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < anim.duration(); ++i) { + anim.setCurrentTime(i); + } + } + } +} + +void tst_qanimation::dummyPropertyAnimation() +{ + QFETCH(bool, started); + DummyObject dummy; + + //then the property animation + { + QPropertyAnimation anim(&dummy, "rect"); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QRect(0, 0, 0, 0)); + anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } +} + +void tst_qanimation::rectAnimation() +{ + //this is the simplest animation you can do + QFETCH(bool, started); + DummyObject dummy; + + //then the property animation + { + RectAnimation anim(&dummy); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QRect(0, 0, 0, 0)); + anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } +} + +void tst_qanimation::floatAnimation() +{ + //this is the simplest animation you can do + QFETCH(bool, started); + DummyObject dummy; + + //then the property animation + { + QPropertyAnimation anim(&dummy, "opacity"); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(0.f); + anim.setEndValue(1.f); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } +} + + + +QTEST_MAIN(tst_qanimation) + +#include "main.moc" diff --git a/tests/benchmarks/gui/animation/qanimation/qanimation.pro b/tests/benchmarks/gui/animation/qanimation/qanimation.pro new file mode 100644 index 0000000..55cd75e --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/qanimation.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qanimation +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release +#CONFIG += debug + + +SOURCES += main.cpp \ + dummyobject.cpp \ + dummyanimation.cpp \ + rectanimation.cpp + +HEADERS += dummyobject.h \ + dummyanimation.h \ + rectanimation.h diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp b/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp new file mode 100644 index 0000000..e6d7a7e --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** 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 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 "rectanimation.h" +#include "dummyobject.h" + +static inline int interpolateInteger(int from, int to, qreal progress) +{ + return from + (to - from) * progress; +} + + +RectAnimation::RectAnimation(DummyObject *obj) : m_object(obj), m_dura(250) +{ +} + +void RectAnimation::setEndValue(const QRect &rect) +{ + m_end = rect; +} + +void RectAnimation::setStartValue(const QRect &rect) +{ + m_start = rect; +} + +void RectAnimation::setDuration(int d) +{ + m_dura = d; +} + +int RectAnimation::duration() const +{ + return m_dura; +} + + +void RectAnimation::updateCurrentTime(int currentTime) +{ + qreal progress = m_easing.valueForProgress( currentTime / qreal(m_dura) ); + QRect now; + now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress), + interpolateInteger(m_start.top(), m_end.top(), progress), + interpolateInteger(m_start.right(), m_end.right(), progress), + interpolateInteger(m_start.bottom(), m_end.bottom(), progress)); + + bool changed = (now != m_current); + if (changed) + m_current = now; + + if (state() == Stopped) + return; + + if (m_object) + m_object->setRect(m_current); +} diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.h b/tests/benchmarks/gui/animation/qanimation/rectanimation.h new file mode 100644 index 0000000..42b9376 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef _RECTANIMATION_H__ + +class DummyObject; + +//this class is even simpler than the dummy +//and uses no QVariant at all +class RectAnimation : public QAbstractAnimation +{ +public: + RectAnimation(DummyObject *obj); + + void setEndValue(const QRect &rect); + void setStartValue(const QRect &rect); + + void setDuration(int d); + int duration() const; + + virtual void updateCurrentTime(int currentTime); + +private: + DummyObject *m_object; + QEasingCurve m_easing; + QRect m_start, m_end, m_current; + int m_dura; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/graphicsview.pro b/tests/benchmarks/gui/graphicsview/graphicsview.pro new file mode 100644 index 0000000..93c00d2 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/graphicsview.pro @@ -0,0 +1,7 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qgraphicsanchorlayout \ + qgraphicsitem \ + qgraphicsscene \ + qgraphicsview \ + qgraphicswidget diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro new file mode 100644 index 0000000..0d563b9 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicsanchorlayout + +SOURCES += tst_qgraphicsanchorlayout.cpp + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp new file mode 100644 index 0000000..faacec4 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -0,0 +1,433 @@ +/**************************************************************************** +** +** 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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +class tst_QGraphicsAnchorLayout : public QObject +{ + Q_OBJECT +public: + tst_QGraphicsAnchorLayout() {} + ~tst_QGraphicsAnchorLayout() {} + +private slots: + void s60_hard_complex_data(); + void s60_hard_complex(); + void linearVsAnchorSizeHints_data(); + void linearVsAnchorSizeHints(); + void linearVsAnchorSetGeometry_data(); + void linearVsAnchorSetGeometry(); + void linearVsAnchorNested_data(); + void linearVsAnchorNested(); +}; + + +class RectWidget : public QGraphicsWidget +{ +public: + RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){} + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + { + Q_UNUSED(option); + Q_UNUSED(widget); + painter->drawRoundRect(rect()); + painter->drawLine(rect().topLeft(), rect().bottomRight()); + painter->drawLine(rect().bottomLeft(), rect().topRight()); + } +}; + +static QGraphicsWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0), + const QSizeF &preferred = QSize(150.0, 100.0), + const QSizeF &maximum = QSizeF(200.0, 100.0), + const QString &name = QString()) +{ + QGraphicsWidget *w = new RectWidget; + w->setMinimumSize(minimum); + w->setPreferredSize(preferred); + w->setMaximumSize(maximum); + w->setData(0, name); + return w; +} + +static void setAnchor(QGraphicsAnchorLayout *l, + QGraphicsLayoutItem *firstItem, + Qt::AnchorPoint firstEdge, + QGraphicsLayoutItem *secondItem, + Qt::AnchorPoint secondEdge, + qreal spacing) +{ + QGraphicsAnchor *anchor = l->addAnchor(firstItem, firstEdge, secondItem, secondEdge); + anchor->setSpacing(spacing); +} + +void tst_QGraphicsAnchorLayout::s60_hard_complex_data() +{ + QTest::addColumn("whichSizeHint"); + QTest::newRow("minimumSizeHint") + << int(Qt::MinimumSize); + QTest::newRow("preferredSizeHint") + << int(Qt::PreferredSize); + QTest::newRow("maximumSizeHint") + << int(Qt::MaximumSize); + // Add it as a reference to see how much overhead the body of effectiveSizeHint takes. + QTest::newRow("noSizeHint") + << -1; +} + +void tst_QGraphicsAnchorLayout::s60_hard_complex() +{ + QFETCH(int, whichSizeHint); + + // Test for "hard" complex case, taken from wiki + // https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases + QSizeF min(0, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *d = createItem(min, pref, max, "d"); + QGraphicsWidget *e = createItem(min, pref, max, "e"); + QGraphicsWidget *f = createItem(min, pref, max, "f"); + QGraphicsWidget *g = createItem(min, pref, max, "g"); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 10); + setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 10); + setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 10); + setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 10); + + // + setAnchor(l, b, Qt::AnchorLeft, e, Qt::AnchorLeft, 10); + setAnchor(l, e, Qt::AnchorRight, d, Qt::AnchorLeft, 10); + + // + setAnchor(l, a, Qt::AnchorHorizontalCenter, g, Qt::AnchorLeft, 10); + setAnchor(l, g, Qt::AnchorRight, f, Qt::AnchorHorizontalCenter, 10); + setAnchor(l, c, Qt::AnchorLeft, f, Qt::AnchorLeft, 10); + setAnchor(l, f, Qt::AnchorRight, d, Qt::AnchorRight, 10); + + // + setAnchor(l, l, Qt::AnchorTop, e, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, a, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, b, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, c, Qt::AnchorTop, 0); + setAnchor(l, e, Qt::AnchorBottom, d, Qt::AnchorTop, 0); + setAnchor(l, a, Qt::AnchorBottom, f, Qt::AnchorTop, 0); + setAnchor(l, a, Qt::AnchorBottom, b, Qt::AnchorBottom, 0); + setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorBottom, 0); + setAnchor(l, a, Qt::AnchorBottom, d, Qt::AnchorBottom, 0); + setAnchor(l, f, Qt::AnchorBottom, g, Qt::AnchorTop, 0); + setAnchor(l, g, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); + + // It won't query the size hint if it already has a size set. + // If only one of the sizes is unset it will query sizeHint only of for that hint type. + l->setMinimumSize(60,40); + l->setPreferredSize(220,40); + l->setMaximumSize(240,40); + + switch (whichSizeHint) { + case Qt::MinimumSize: + l->setMinimumSize(-1, -1); + break; + case Qt::PreferredSize: + l->setPreferredSize(-1, -1); + break; + case Qt::MaximumSize: + l->setMaximumSize(-1, -1); + break; + default: + break; + } + + QSizeF sizeHint; + // warm up instruction cache + l->invalidate(); + sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); + // ...then measure... + QBENCHMARK { + l->invalidate(); + sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); + } +} + +static QGraphicsLayout* createLayouts(int whichLayout) +{ + QSizeF min(0, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *d = createItem(min, pref, max, "d"); + + QGraphicsLayout *l; + if (whichLayout == 0) { + l = new QGraphicsLinearLayout; + QGraphicsLinearLayout *linear = static_cast(l); + linear->setContentsMargins(0, 0, 0, 0); + + linear->addItem(a); + linear->addItem(b); + linear->addItem(c); + linear->addItem(d); + } else { + l = new QGraphicsAnchorLayout; + QGraphicsAnchorLayout *anchor = static_cast(l); + anchor->setContentsMargins(0, 0, 0, 0); + + // Horizontal + setAnchor(anchor, anchor, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(anchor, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); + setAnchor(anchor, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + setAnchor(anchor, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); + setAnchor(anchor, d, Qt::AnchorRight, anchor, Qt::AnchorRight, 0); + + // Vertical + anchor->addAnchors(anchor, a, Qt::Vertical); + anchor->addAnchors(anchor, b, Qt::Vertical); + anchor->addAnchors(anchor, c, Qt::Vertical); + anchor->addAnchors(anchor, d, Qt::Vertical); + } + + return l; +} + +void tst_QGraphicsAnchorLayout::linearVsAnchorSizeHints_data() +{ + QTest::addColumn("whichLayout"); + QTest::addColumn("whichSizeHint"); + + QTest::newRow("QGraphicsLinearLayout::minimum") + << 0 << int(Qt::MinimumSize); + QTest::newRow("QGraphicsLinearLayout::preferred") + << 0 << int(Qt::PreferredSize); + QTest::newRow("QGraphicsLinearLayout::maximum") + << 0 << int(Qt::MaximumSize); + QTest::newRow("QGraphicsLinearLayout::noSizeHint") + << 0 << -1; + + QTest::newRow("QGraphicsAnchorLayout::minimum") + << 1 << int(Qt::MinimumSize); + QTest::newRow("QGraphicsAnchorLayout::preferred") + << 1 << int(Qt::PreferredSize); + QTest::newRow("QGraphicsAnchorLayout::maximum") + << 1 << int(Qt::MaximumSize); + QTest::newRow("QGraphicsAnchorLayout::noSizeHint") + << 1 << -1; +} + +void tst_QGraphicsAnchorLayout::linearVsAnchorSizeHints() +{ + QFETCH(int, whichSizeHint); + QFETCH(int, whichLayout); + + QGraphicsLayout *l = createLayouts(whichLayout); + + QSizeF sizeHint; + // warm up instruction cache + l->invalidate(); + sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); + // ...then measure... + + QBENCHMARK { + l->invalidate(); + sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); + } +} + +void tst_QGraphicsAnchorLayout::linearVsAnchorSetGeometry_data() +{ + QTest::addColumn("whichLayout"); + + QTest::newRow("QGraphicsLinearLayout") + << 0; + QTest::newRow("QGraphicsAnchorLayout") + << 1; +} + +void tst_QGraphicsAnchorLayout::linearVsAnchorSetGeometry() +{ + QFETCH(int, whichLayout); + + QGraphicsLayout *l = createLayouts(whichLayout); + + QRectF sizeHint; + qreal maxWidth; + qreal increment; + // warm up instruction cache + l->invalidate(); + sizeHint.setSize(l->effectiveSizeHint(Qt::MinimumSize)); + maxWidth = l->effectiveSizeHint(Qt::MaximumSize).width(); + increment = (maxWidth - sizeHint.width()) / 100; + l->setGeometry(sizeHint); + // ...then measure... + + QBENCHMARK { + l->invalidate(); + for (qreal width = sizeHint.width(); width <= maxWidth; width += increment) { + sizeHint.setWidth(width); + l->setGeometry(sizeHint); + } + } +} + +void tst_QGraphicsAnchorLayout::linearVsAnchorNested_data() +{ + QTest::addColumn("whichLayout"); + QTest::newRow("LinearLayout") + << 0; + QTest::newRow("AnchorLayout setup with null-anchors knot") + << 1; + QTest::newRow("AnchorLayout setup easy to simplificate") + << 2; +} + +void tst_QGraphicsAnchorLayout::linearVsAnchorNested() +{ + QFETCH(int, whichLayout); + + QSizeF min(10, 10); + QSizeF pref(80, 80); + QSizeF max(150, 150); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *d = createItem(min, pref, max, "d"); + + QGraphicsLayout *layout; + + if (whichLayout == 0) { + QGraphicsLinearLayout *linear1 = new QGraphicsLinearLayout; + QGraphicsLinearLayout *linear2 = new QGraphicsLinearLayout(Qt::Vertical); + QGraphicsLinearLayout *linear3 = new QGraphicsLinearLayout; + + linear1->addItem(a); + linear1->addItem(linear2); + linear2->addItem(b); + linear2->addItem(linear3); + linear3->addItem(c); + linear3->addItem(d); + + layout = linear1; + } else if (whichLayout == 1) { + QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout; + + // A + anchor->addCornerAnchors(a, Qt::TopLeftCorner, anchor, Qt::TopLeftCorner); + anchor->addCornerAnchors(a, Qt::TopRightCorner, b, Qt::TopLeftCorner); + anchor->addCornerAnchors(a, Qt::BottomLeftCorner, anchor, Qt::BottomLeftCorner); + anchor->addCornerAnchors(a, Qt::BottomRightCorner, c, Qt::BottomLeftCorner); + + // B + anchor->addCornerAnchors(b, Qt::TopRightCorner, anchor, Qt::TopRightCorner); + anchor->addCornerAnchors(b, Qt::BottomLeftCorner, c, Qt::TopLeftCorner); + anchor->addCornerAnchors(b, Qt::BottomRightCorner, d, Qt::TopRightCorner); + + // C + anchor->addCornerAnchors(c, Qt::TopRightCorner, d, Qt::TopLeftCorner); + anchor->addCornerAnchors(c, Qt::BottomRightCorner, d, Qt::BottomLeftCorner); + + // D + anchor->addCornerAnchors(d, Qt::BottomRightCorner, anchor, Qt::BottomRightCorner); + + layout = anchor; + } else { + QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout; + + // A + anchor->addAnchor(a, Qt::AnchorLeft, anchor, Qt::AnchorLeft); + anchor->addAnchors(a, anchor, Qt::Vertical); + anchor->addAnchor(a, Qt::AnchorRight, b, Qt::AnchorLeft); + anchor->addAnchor(a, Qt::AnchorRight, c, Qt::AnchorLeft); + + // B + anchor->addAnchor(b, Qt::AnchorTop, anchor, Qt::AnchorTop); + anchor->addAnchor(b, Qt::AnchorRight, anchor, Qt::AnchorRight); + anchor->addAnchor(b, Qt::AnchorBottom, c, Qt::AnchorTop); + anchor->addAnchor(b, Qt::AnchorBottom, d, Qt::AnchorTop); + + // C + anchor->addAnchor(c, Qt::AnchorRight, d, Qt::AnchorLeft); + anchor->addAnchor(c, Qt::AnchorBottom, anchor, Qt::AnchorBottom); + + // D + anchor->addAnchor(d, Qt::AnchorRight, anchor, Qt::AnchorRight); + anchor->addAnchor(d, Qt::AnchorBottom, anchor, Qt::AnchorBottom); + + layout = anchor; + } + + QSizeF sizeHint; + // warm up instruction cache + layout->invalidate(); + sizeHint = layout->effectiveSizeHint(Qt::PreferredSize); + + // ...then measure... + QBENCHMARK { + // To ensure that all sizeHints caches are invalidated in + // the LinearLayout setup, we must call updateGeometry on the + // children. If we didn't, only the top level layout would be + // re-calculated. + static_cast(a)->updateGeometry(); + static_cast(b)->updateGeometry(); + static_cast(c)->updateGeometry(); + static_cast(d)->updateGeometry(); + layout->invalidate(); + sizeHint = layout->effectiveSizeHint(Qt::PreferredSize); + } +} + +QTEST_MAIN(tst_QGraphicsAnchorLayout) + +#include "tst_qgraphicsanchorlayout.moc" diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro new file mode 100644 index 0000000..726bb96 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicsitem + +SOURCES += tst_qgraphicsitem.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp new file mode 100644 index 0000000..ac51072 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -0,0 +1,243 @@ +/**************************************************************************** +** +** 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 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 +#include +#include +#include + +//TESTED_FILES= + +class tst_QGraphicsItem : public QObject +{ + Q_OBJECT + +public: + tst_QGraphicsItem(); + virtual ~tst_QGraphicsItem(); + +public slots: + void init(); + void cleanup(); + +private slots: + void setParentItem(); + void setParentItem_deep(); + void setParentItem_deep_reversed(); + void deleteItemWithManyChildren(); + void setPos_data(); + void setPos(); + void setTransform_data(); + void setTransform(); + void rotate(); + void scale(); + void shear(); + void translate(); + void setRotation(); +}; + +tst_QGraphicsItem::tst_QGraphicsItem() +{ +} + +tst_QGraphicsItem::~tst_QGraphicsItem() +{ +} + +void tst_QGraphicsItem::init() +{ +} + +void tst_QGraphicsItem::cleanup() +{ +} + +void tst_QGraphicsItem::setParentItem() +{ + QBENCHMARK { + QGraphicsRectItem rect; + QGraphicsRectItem *childRect = new QGraphicsRectItem; + childRect->setParentItem(&rect); + } +} + +void tst_QGraphicsItem::setParentItem_deep() +{ + QBENCHMARK { + QGraphicsRectItem rect; + QGraphicsRectItem *lastRect = ▭ + for (int i = 0; i < 10; ++i) { + QGraphicsRectItem *childRect = new QGraphicsRectItem; + childRect->setParentItem(lastRect); + lastRect = childRect; + } + QGraphicsItem *first = rect.children().first(); + first->setParentItem(0); + } +} + +void tst_QGraphicsItem::setParentItem_deep_reversed() +{ + QBENCHMARK { + QGraphicsRectItem *lastRect = new QGraphicsRectItem; + for (int i = 0; i < 100; ++i) { + QGraphicsRectItem *parentRect = new QGraphicsRectItem; + lastRect->setParentItem(parentRect); + lastRect = parentRect; + } + delete lastRect; + } +} + +void tst_QGraphicsItem::deleteItemWithManyChildren() +{ + QBENCHMARK { + QGraphicsRectItem *rect = new QGraphicsRectItem; + for (int i = 0; i < 1000; ++i) + new QGraphicsRectItem(rect); + delete rect; + } +} + +void tst_QGraphicsItem::setPos_data() +{ + QTest::addColumn("pos"); + + QTest::newRow("0, 0") << QPointF(0, 0); + QTest::newRow("10, 10") << QPointF(10, 10); + QTest::newRow("-10, -10") << QPointF(-10, -10); +} + +void tst_QGraphicsItem::setPos() +{ + QFETCH(QPointF, pos); + + QGraphicsScene scene; + QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + rect->setPos(10, 10); + rect->transform(); // prevent lazy optimizing + } +} + +void tst_QGraphicsItem::setTransform_data() +{ + QTest::addColumn("transform"); + + QTest::newRow("id") << QTransform(); + QTest::newRow("rotate 45z") << QTransform().rotate(45); + QTest::newRow("scale 2x2") << QTransform().scale(2, 2); + QTest::newRow("translate 100, 100") << QTransform().translate(100, 100); + QTest::newRow("rotate 45x 45y 45z") << QTransform().rotate(45, Qt::XAxis) + .rotate(45, Qt::YAxis).rotate(45, Qt::ZAxis); +} + +void tst_QGraphicsItem::setTransform() +{ + QFETCH(QTransform, transform); + + QGraphicsScene scene; + QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + item->setTransform(transform); + item->transform(); // prevent lazy optimizing + } +} + +void tst_QGraphicsItem::rotate() +{ + QGraphicsScene scene; + QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + item->rotate(45); + item->transform(); // prevent lazy optimizing + } +} + +void tst_QGraphicsItem::scale() +{ + QGraphicsScene scene; + QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + item->scale(2, 2); + item->transform(); // prevent lazy optimizing + } +} + +void tst_QGraphicsItem::shear() +{ + QGraphicsScene scene; + QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + item->shear(1.5, 1.5); + item->transform(); // prevent lazy optimizing + } +} + +void tst_QGraphicsItem::translate() +{ + QGraphicsScene scene; + QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + item->translate(100, 100); + item->transform(); // prevent lazy optimizing + } +} + +void tst_QGraphicsItem::setRotation() +{ + QGraphicsScene scene; + QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); + + QBENCHMARK { + item->setRotation(45); + item->transform(); // prevent lazy optimizing + } +} + +QTEST_MAIN(tst_QGraphicsItem) +#include "tst_qgraphicsitem.moc" diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro new file mode 100644 index 0000000..b460e2a --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicsscene + +SOURCES += tst_qgraphicsscene.cpp + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp new file mode 100644 index 0000000..5bd07f9 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -0,0 +1,248 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +//TESTED_FILES= + +class tst_QGraphicsScene : public QObject +{ + Q_OBJECT + +public: + tst_QGraphicsScene(); + virtual ~tst_QGraphicsScene(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void addItem_data(); + void addItem(); + void itemAt_data(); + void itemAt(); + void initialShow(); +}; + +tst_QGraphicsScene::tst_QGraphicsScene() +{ +} + +tst_QGraphicsScene::~tst_QGraphicsScene() +{ +} + +void tst_QGraphicsScene::init() +{ +} + +void tst_QGraphicsScene::cleanup() +{ +} + +void tst_QGraphicsScene::construct() +{ + QBENCHMARK { + QGraphicsScene scene; + } +} + +void tst_QGraphicsScene::addItem_data() +{ + QTest::addColumn("indexMethod"); + QTest::addColumn("sceneRect"); + QTest::addColumn("numItems_X"); + QTest::addColumn("numItems_Y"); + QTest::addColumn("itemType"); + QTest::addColumn("itemRect"); + + QTest::newRow("null") << 0 << QRectF() << 0 << 0 << 0 << QRectF(); + QTest::newRow("0 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF() << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF() << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,0)") << 0 << QRectF() << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF() << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("0 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); + QTest::newRow("1 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); +} + +void tst_QGraphicsScene::addItem() +{ + QFETCH(int, indexMethod); + QFETCH(QRectF, sceneRect); + QFETCH(int, numItems_X); + QFETCH(int, numItems_Y); + QFETCH(int, itemType); + QFETCH(QRectF, itemRect); + + QGraphicsScene scene; + scene.setItemIndexMethod(indexMethod ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); + if (!sceneRect.isNull()) + scene.setSceneRect(sceneRect); + + QBENCHMARK { + QGraphicsItem *item = 0; + for (int y = 0; y < numItems_Y; ++y) { + for (int x = 0; x < numItems_X; ++x) { + switch (itemType) { + case QGraphicsRectItem::Type: + item = new QGraphicsRectItem(itemRect); + break; + case QGraphicsEllipseItem::Type: + default: + item = new QGraphicsEllipseItem(itemRect); + break; + } + item->setPos(x * itemRect.width(), y * itemRect.height()); + scene.addItem(item); + } + } + scene.itemAt(0, 0); + } + //let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list + qApp->processEvents(); +} + +void tst_QGraphicsScene::itemAt_data() +{ + QTest::addColumn("bspTreeDepth"); + QTest::addColumn("sceneRect"); + QTest::addColumn("numItems_X"); + QTest::addColumn("numItems_Y"); + QTest::addColumn("itemRect"); + + QTest::newRow("null") << 0 << QRectF() << 0 << 0 << QRectF(); + QTest::newRow("NoIndex 10x10") << -1 << QRectF() << 10 << 10 << QRectF(-10, -10, 20, 20); + QTest::newRow("NoIndex 25x25") << -1 << QRectF() << 25 << 25 << QRectF(-10, -10, 20, 20); + QTest::newRow("NoIndex 100x100") << -1 << QRectF() << 100 << 100 << QRectF(-10, -10, 20, 20); + QTest::newRow("NoIndex 250x250") << -1 << QRectF() << 250 << 250 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=auto 10x10") << 0 << QRectF() << 10 << 10 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=auto 25x25") << 0 << QRectF() << 25 << 25 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=auto 100x100") << 0 << QRectF() << 100 << 100 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=auto 250x250") << 0 << QRectF() << 250 << 250 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=16 10x10") << 16 << QRectF() << 10 << 10 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=16 25x25") << 16 << QRectF() << 25 << 25 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=16 100x100") << 16 << QRectF() << 100 << 100 << QRectF(-10, -10, 20, 20); + QTest::newRow("BspTreeIndex depth=16 250x250") << 16 << QRectF() << 250 << 250 << QRectF(-10, -10, 20, 20); +} + +void tst_QGraphicsScene::itemAt() +{ + QFETCH(int, bspTreeDepth); + QFETCH(QRectF, sceneRect); + QFETCH(int, numItems_X); + QFETCH(int, numItems_Y); + QFETCH(QRectF, itemRect); + + QGraphicsScene scene; + scene.setItemIndexMethod(bspTreeDepth >= 0 ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); + if (bspTreeDepth > 0) + scene.setBspTreeDepth(bspTreeDepth); + if (!sceneRect.isNull()) + scene.setSceneRect(sceneRect); + + QGraphicsItem *item = 0; + for (int y = 0; y < numItems_Y; ++y) { + for (int x = 0; x < numItems_X; ++x) { + QGraphicsRectItem *item = new QGraphicsRectItem(itemRect); + item->setPos((x - numItems_X/2) * itemRect.width(), (y - numItems_Y/2) * itemRect.height()); + scene.addItem(item); + } + } + + scene.itemAt(0, 0); // triggers indexing + + QBENCHMARK { + scene.itemAt(0, 0); + } + + //let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list + qApp->processEvents(); +} + +void tst_QGraphicsScene::initialShow() +{ + QGraphicsScene scene; + + QBENCHMARK { + for (int y = 0; y < 30000; ++y) { + QGraphicsRectItem *item = new QGraphicsRectItem(0, 0, 50, 50); + item->setPos((y/2) * item->rect().width(), (y/2) * item->rect().height()); + scene.addItem(item); + } + scene.itemAt(0, 0); // triggers indexing + //This call polish the items so we bench their processing too. + qApp->processEvents(); + } +} + +QTEST_MAIN(tst_QGraphicsScene) +#include "tst_qgraphicsscene.moc" diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp new file mode 100644 index 0000000..77b86c1 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chip.h" + +#include + +Chip::Chip(const QColor &color, int x, int y) +{ + this->x = x; + this->y = y; + this->color = color; + setZValue((x + y) % 2); + + setFlags(ItemIsSelectable | ItemIsMovable); + setAcceptsHoverEvents(true); +} + +QRectF Chip::boundingRect() const +{ + return QRectF(0, 0, 110, 70); +} + +QPainterPath Chip::shape() const +{ + QPainterPath path; + path.addRect(14, 14, 82, 42); + return path; +} + +void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(widget); + + QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; + if (option->state & QStyle::State_MouseOver) + fillColor = fillColor.light(125); + + if (option->levelOfDetail < 0.2) { + if (option->levelOfDetail < 0.125) { + painter->fillRect(QRectF(0, 0, 110, 70), fillColor); + return; + } + + painter->setPen(QPen(Qt::black, 0)); + painter->setBrush(fillColor); + painter->drawRect(13, 13, 97, 57); + return; + } + + QPen oldPen = painter->pen(); + QPen pen = oldPen; + int width = 0; + if (option->state & QStyle::State_Selected) + width += 2; + + pen.setWidth(width); + painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100))); + + painter->drawRect(QRect(14, 14, 79, 39)); + if (option->levelOfDetail >= 1) { + painter->setPen(QPen(Qt::gray, 1)); + painter->drawLine(15, 54, 94, 54); + painter->drawLine(94, 53, 94, 15); + painter->setPen(QPen(Qt::black, 0)); + } + + // Draw text + if (option->levelOfDetail >= 2) { + QFont font("Times", 10); + font.setStyleStrategy(QFont::ForceOutline); + painter->setFont(font); + painter->save(); + painter->scale(0.1, 0.1); + painter->drawText(170, 180, QString("Model: VSC-2000 (Very Small Chip) at %1x%2").arg(x).arg(y)); + painter->drawText(170, 200, QString("Serial number: DLWR-WEER-123L-ZZ33-SDSJ")); + painter->drawText(170, 220, QString("Manufacturer: Chip Manufacturer")); + painter->restore(); + } + + // Draw lines + QVarLengthArray lines; + if (option->levelOfDetail >= 0.5) { + for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { + lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5)); + lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62)); + } + for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { + lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5)); + lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5)); + } + } + if (option->levelOfDetail >= 0.4) { + const QLineF lineData[] = { + QLineF(25, 35, 35, 35), + QLineF(35, 30, 35, 40), + QLineF(35, 30, 45, 35), + QLineF(35, 40, 45, 35), + QLineF(45, 30, 45, 40), + QLineF(45, 35, 55, 35) + }; + lines.append(lineData, 6); + } + painter->drawLines(lines.data(), lines.size()); + + // Draw red ink + if (stuff.size() > 1) { + painter->setPen(QPen(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter->setBrush(Qt::NoBrush); + QPainterPath path; + path.moveTo(stuff.first()); + for (int i = 1; i < stuff.size(); ++i) + path.lineTo(stuff.at(i)); + painter->drawPath(path); + } +} + +void Chip::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + QGraphicsItem::mousePressEvent(event); + update(); +} + +void Chip::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->modifiers() & Qt::ShiftModifier) { + stuff << event->pos(); + update(); + return; + } + QGraphicsItem::mouseMoveEvent(event); +} + +void Chip::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + QGraphicsItem::mouseReleaseEvent(event); + update(); +} diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug new file mode 100644 index 0000000..8fe1e5b Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.h new file mode 100644 index 0000000..9db23f9 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHIP_H +#define CHIP_H + +#include +#include + +class Chip : public QGraphicsItem +{ +public: + Chip(const QColor &color, int x, int y); + + QRectF boundingRect() const; + QPainterPath shape() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + +private: + int x, y; + QColor color; + QList stuff; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro new file mode 100644 index 0000000..53fa23b --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro @@ -0,0 +1,19 @@ +RESOURCES += images.qrc + +HEADERS += mainwindow.h view.h chip.h +SOURCES += main.cpp +SOURCES += mainwindow.cpp view.cpp chip.cpp + +contains(QT_CONFIG, opengl):QT += opengl + +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} + +# install +target.path = $$[QT_INSTALL_DEMOS]/chip +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.html *.doc images +sources.path = $$[QT_INSTALL_DEMOS]/chip +INSTALLS += target sources + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/fileprint.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/fileprint.png new file mode 100644 index 0000000..ba7c02d Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/fileprint.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/images.qrc b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/images.qrc new file mode 100644 index 0000000..c7cdf0c --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/images.qrc @@ -0,0 +1,10 @@ + + + qt4logo.png + zoomin.png + zoomout.png + rotateleft.png + rotateright.png + fileprint.png + + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp new file mode 100644 index 0000000..ea2f94a --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" + +#include + +int main(int argc, char **argv) +{ + Q_INIT_RESOURCE(images); + + QApplication app(argc, argv); + app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); + + MainWindow window; + window.show(); + + return app.exec(); +} diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp new file mode 100644 index 0000000..452b42c --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mainwindow.h" +#include "view.h" +#include "chip.h" + +#include + +MainWindow::MainWindow(QWidget *parent) + : QWidget(parent) +{ + populateScene(); + + View *view = new View("Top left view"); + view->view()->setScene(scene); + QHBoxLayout *layout = new QHBoxLayout; + layout->addWidget(view); + setLayout(layout); + + setWindowTitle(tr("Chip Demo")); +} + +void MainWindow::populateScene() +{ + scene = new QGraphicsScene; + + QImage image(":/qt4logo.png"); + + // Populate scene + int xx = 0; + int nitems = 0; + for (int i = -11000; i < 11000; i += 110) { + ++xx; + int yy = 0; + for (int j = -7000; j < 7000; j += 70) { + ++yy; + qreal x = (i + 11000) / 22000.0; + qreal y = (j + 7000) / 14000.0; + + QColor color(image.pixel(int(image.width() * x), int(image.height() * y))); + QGraphicsItem *item = new Chip(color, xx, yy); + item->setPos(QPointF(i, j)); + scene->addItem(item); + + ++nitems; + } + } +} diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h new file mode 100644 index 0000000..558bbef --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsScene) +QT_FORWARD_DECLARE_CLASS(QGraphicsView) +QT_FORWARD_DECLARE_CLASS(QLabel) +QT_FORWARD_DECLARE_CLASS(QSlider) +QT_FORWARD_DECLARE_CLASS(QSplitter) + +class MainWindow : public QWidget +{ + Q_OBJECT +public: + MainWindow(QWidget *parent = 0); + +private: + void setupMatrix(); + void populateScene(); + + QGraphicsScene *scene; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/qt4logo.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/qt4logo.png new file mode 100644 index 0000000..157e86e Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/qt4logo.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateleft.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateleft.png new file mode 100644 index 0000000..8cfa931 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateleft.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateright.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateright.png new file mode 100644 index 0000000..ec5e866 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateright.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp new file mode 100644 index 0000000..1028f42 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp @@ -0,0 +1,257 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "view.h" + +#include +#include "valgrind/callgrind.h" +#ifndef QT_NO_OPENGL +#include +#endif + +#include + +class CountView : public QGraphicsView +{ +protected: + void paintEvent(QPaintEvent *event) + { + static int n = 0; + if (n) + CALLGRIND_START_INSTRUMENTATION + QGraphicsView::paintEvent(event); + if (n) + CALLGRIND_STOP_INSTRUMENTATION + if (++n == 500) + qApp->quit(); + } +}; + +View::View(const QString &name, QWidget *parent) + : QFrame(parent) +{ + setFrameStyle(Sunken | StyledPanel); + graphicsView = new CountView; + graphicsView->setRenderHint(QPainter::Antialiasing, false); + graphicsView->setDragMode(QGraphicsView::RubberBandDrag); + graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); + + int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize); + QSize iconSize(size, size); + + QToolButton *zoomInIcon = new QToolButton; + zoomInIcon->setAutoRepeat(true); + zoomInIcon->setAutoRepeatInterval(33); + zoomInIcon->setAutoRepeatDelay(0); + zoomInIcon->setIcon(QPixmap(":/zoomin.png")); + zoomInIcon->setIconSize(iconSize); + QToolButton *zoomOutIcon = new QToolButton; + zoomOutIcon->setAutoRepeat(true); + zoomOutIcon->setAutoRepeatInterval(33); + zoomOutIcon->setAutoRepeatDelay(0); + zoomOutIcon->setIcon(QPixmap(":/zoomout.png")); + zoomOutIcon->setIconSize(iconSize); + zoomSlider = new QSlider; + zoomSlider->setMinimum(0); + zoomSlider->setMaximum(500); + zoomSlider->setValue(250); + zoomSlider->setTickPosition(QSlider::TicksRight); + + // Zoom slider layout + QVBoxLayout *zoomSliderLayout = new QVBoxLayout; + zoomSliderLayout->addWidget(zoomInIcon); + zoomSliderLayout->addWidget(zoomSlider); + zoomSliderLayout->addWidget(zoomOutIcon); + + QToolButton *rotateLeftIcon = new QToolButton; + rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png")); + rotateLeftIcon->setIconSize(iconSize); + QToolButton *rotateRightIcon = new QToolButton; + rotateRightIcon->setIcon(QPixmap(":/rotateright.png")); + rotateRightIcon->setIconSize(iconSize); + rotateSlider = new QSlider; + rotateSlider->setOrientation(Qt::Horizontal); + rotateSlider->setMinimum(-360); + rotateSlider->setMaximum(360); + rotateSlider->setValue(0); + rotateSlider->setTickPosition(QSlider::TicksBelow); + + // Rotate slider layout + QHBoxLayout *rotateSliderLayout = new QHBoxLayout; + rotateSliderLayout->addWidget(rotateLeftIcon); + rotateSliderLayout->addWidget(rotateSlider); + rotateSliderLayout->addWidget(rotateRightIcon); + + resetButton = new QToolButton; + resetButton->setText(tr("0")); + resetButton->setEnabled(false); + + // Label layout + QHBoxLayout *labelLayout = new QHBoxLayout; + label = new QLabel(name); + antialiasButton = new QToolButton; + antialiasButton->setText(tr("Antialiasing")); + antialiasButton->setCheckable(true); + antialiasButton->setChecked(false); + openGlButton = new QToolButton; + openGlButton->setText(tr("OpenGL")); + openGlButton->setCheckable(true); +#ifndef QT_NO_OPENGL + openGlButton->setEnabled(QGLFormat::hasOpenGL()); +#else + openGlButton->setEnabled(false); +#endif + printButton = new QToolButton; + printButton->setIcon(QIcon(QPixmap(":/fileprint.png"))); + + labelLayout->addWidget(label); + labelLayout->addStretch(); + labelLayout->addWidget(antialiasButton); + labelLayout->addWidget(openGlButton); + labelLayout->addWidget(printButton); + + QGridLayout *topLayout = new QGridLayout; + topLayout->addLayout(labelLayout, 0, 0); + topLayout->addWidget(graphicsView, 1, 0); + topLayout->addLayout(zoomSliderLayout, 1, 1); + topLayout->addLayout(rotateSliderLayout, 2, 0); + topLayout->addWidget(resetButton, 2, 1); + setLayout(topLayout); + + connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView())); + connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix())); + connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix())); + connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled())); + connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled())); + connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing())); + connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL())); + connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft())); + connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight())); + connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn())); + connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut())); + connect(printButton, SIGNAL(clicked()), this, SLOT(print())); + + setupMatrix(); + + startTimer(0); +} + +QGraphicsView *View::view() const +{ + return graphicsView; +} + +void View::resetView() +{ + zoomSlider->setValue(250); + rotateSlider->setValue(0); + setupMatrix(); + graphicsView->ensureVisible(QRectF(0, 0, 0, 0)); + + resetButton->setEnabled(false); +} + +void View::setResetButtonEnabled() +{ + resetButton->setEnabled(true); +} + +void View::setupMatrix() +{ + qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50)); + + QMatrix matrix; + matrix.scale(scale, scale); + matrix.rotate(rotateSlider->value()); + + graphicsView->setMatrix(matrix); + setResetButtonEnabled(); +} + +void View::toggleOpenGL() +{ +#ifndef QT_NO_OPENGL + graphicsView->setViewport(openGlButton->isChecked() ? new QGLWidget(QGLFormat(QGL::SampleBuffers)) : new QWidget); +#endif +} + +void View::toggleAntialiasing() +{ + graphicsView->setRenderHint(QPainter::Antialiasing, antialiasButton->isChecked()); +} + +void View::print() +{ +#ifndef QT_NO_PRINTER + QPrinter printer; + QPrintDialog dialog(&printer, this); + if (dialog.exec() == QDialog::Accepted) { + QPainter painter(&printer); + graphicsView->render(&painter); + } +#endif +} + +void View::zoomIn() +{ + zoomSlider->setValue(zoomSlider->value() + 1); +} + +void View::zoomOut() +{ + zoomSlider->setValue(zoomSlider->value() - 1); +} + +void View::rotateLeft() +{ + rotateSlider->setValue(rotateSlider->value() - 10); +} + +void View::rotateRight() +{ + rotateSlider->setValue(rotateSlider->value() + 10); +} + +void View::timerEvent(QTimerEvent *) +{ + graphicsView->horizontalScrollBar()->setValue(graphicsView->horizontalScrollBar()->value() + 1); +} + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h new file mode 100644 index 0000000..fc5c226 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef VIEW_H +#define VIEW_H + +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsView) +QT_FORWARD_DECLARE_CLASS(QLabel) +QT_FORWARD_DECLARE_CLASS(QSlider) +QT_FORWARD_DECLARE_CLASS(QToolButton) + +class View : public QFrame +{ + Q_OBJECT +public: + View(const QString &name, QWidget *parent = 0); + + QGraphicsView *view() const; + +private slots: + void resetView(); + void setResetButtonEnabled(); + void setupMatrix(); + void toggleOpenGL(); + void toggleAntialiasing(); + void print(); + + void zoomIn(); + void zoomOut(); + void rotateLeft(); + void rotateRight(); + + void timerEvent(QTimerEvent *); + +private: + QGraphicsView *graphicsView; + QLabel *label; + QToolButton *openGlButton; + QToolButton *antialiasButton; + QToolButton *printButton; + QToolButton *resetButton; + QSlider *zoomSlider; + QSlider *rotateSlider; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomin.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomin.png new file mode 100644 index 0000000..8b0daee Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomin.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomout.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomout.png new file mode 100644 index 0000000..1575dd2 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomout.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp new file mode 100644 index 0000000..527713f --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include "valgrind/callgrind.h" + +#ifdef Q_WS_X11 +extern void qt_x11_wait_for_window_manager(QWidget *); +#endif + +class View : public QGraphicsView +{ + Q_OBJECT +public: + View(QGraphicsScene *scene, QGraphicsItem *item) + : QGraphicsView(scene), _item(item) + { + } + +protected: + void paintEvent(QPaintEvent *event) + { + static int n = 0; + if (n) + CALLGRIND_START_INSTRUMENTATION + QGraphicsView::paintEvent(event); + _item->moveBy(1, 1); + if (n) + CALLGRIND_STOP_INSTRUMENTATION + if (++n == 200) + qApp->quit(); + } + +private: + QGraphicsItem *_item; +}; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + if (argc < 2) { + qDebug("usage: ./%s ", argv[0]); + return 1; + } + + QGraphicsScene scene(-150, -150, 300, 300); + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + + QGraphicsRectItem *item = scene.addRect(-50, -50, 100, 100, QPen(Qt::NoPen), QBrush(Qt::blue)); + item->setFlag(QGraphicsItem::ItemIsMovable); + + for (int i = 0; i < atoi(argv[1]); ++i) { + QGraphicsRectItem *child = scene.addRect(-5, -5, 10, 10, QPen(Qt::NoPen), QBrush(Qt::blue)); + child->setPos(-50 + qrand() % 100, -50 + qrand() % 100); + child->setParentItem(item); + } + + View view(&scene, item); + view.resize(300, 300); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + + return app.exec(); +} + +#include "main.moc" diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/moveItems.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/moveItems.pro new file mode 100644 index 0000000..28dcadc --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/moveItems.pro @@ -0,0 +1 @@ +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp new file mode 100644 index 0000000..7419206 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include "valgrind/callgrind.h" + +class ItemMover : public QObject +{ + Q_OBJECT +public: + ItemMover(QGraphicsItem *item) + : _item(item) + { + startTimer(0); + } + +protected: + void timerEvent(QTimerEvent *event) + { + _item->moveBy(-1, 0); + } + +private: + QGraphicsItem *_item; +}; + +class ClipItem : public QGraphicsRectItem +{ +public: + ClipItem(qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) + : QGraphicsRectItem(x, y, w, h) + { + setPen(pen); + setBrush(brush); + } + + QPainterPath shape() const + { + QPainterPath path; + path.addRect(rect()); + return path; + } +}; + +class CountView : public QGraphicsView +{ +protected: + void paintEvent(QPaintEvent *event) + { + static int n = 0; + if (n) + CALLGRIND_START_INSTRUMENTATION + QGraphicsView::paintEvent(event); + if (n) + CALLGRIND_STOP_INSTRUMENTATION + if (++n == 500) + qApp->quit(); + } +}; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QGraphicsScene scene; + scene.setItemIndexMethod(QGraphicsScene::NoIndex); + + ClipItem *clipItem = new ClipItem(0, 0, 100, 100, QPen(), QBrush(Qt::blue)); + clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + clipItem->setData(0, "clipItem"); + scene.addItem(clipItem); + + QGraphicsRectItem *scrollItem = scene.addRect(0, 0, 10, 10, QPen(Qt::NoPen), QBrush(Qt::NoBrush)); + scrollItem->setParentItem(clipItem); + scrollItem->setFlag(QGraphicsItem::ItemIsMovable); + scrollItem->setData(0, "scrollItem"); + + for (int y = 0; y < 25; ++y) { + for (int x = 0; x < 25; ++x) { + ClipItem *rect = new ClipItem(0, 0, 90, 20, QPen(Qt::NoPen), QBrush(Qt::green)); + rect->setParentItem(scrollItem); + rect->setPos(x * 95, y * 25); + rect->setData(0, qPrintable(QString("rect %1 %2").arg(x).arg(y))); + rect->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QGraphicsEllipseItem *ellipse = new QGraphicsEllipseItem(-5, -5, 10, 10); + ellipse->setPen(QPen(Qt::NoPen)); + ellipse->setBrush(QBrush(Qt::yellow)); + ellipse->setParentItem(rect); + ellipse->setData(0, qPrintable(QString("ellipse %1 %2").arg(x).arg(y))); + } + } + + scrollItem->setRect(scrollItem->childrenBoundingRect()); + +#if 0 + ItemMover mover(scrollItem); +#endif + + CountView view; + view.setScene(&scene); + view.setSceneRect(-25, -25, 150, 150); + view.resize(300, 300); + view.show(); + + return app.exec(); +} + +#include "main.moc" diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/scrolltest.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/scrolltest.pro new file mode 100644 index 0000000..28dcadc --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/scrolltest.pro @@ -0,0 +1 @@ +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp new file mode 100644 index 0000000..4c1020a --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp @@ -0,0 +1,182 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chip.h" + +#include + +Chip::Chip(const QColor &color, int x, int y) +{ + this->x = x; + this->y = y; + this->color = color; + setZValue((x + y) % 2); + + setFlags(ItemIsSelectable | ItemIsMovable); + setAcceptsHoverEvents(true); +} + +QRectF Chip::boundingRect() const +{ + return QRectF(0, 0, 110, 70); +} + +QPainterPath Chip::shape() const +{ + QPainterPath path; + path.addRect(14, 14, 82, 42); + return path; +} + +void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(widget); + + QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; + if (option->state & QStyle::State_MouseOver) + fillColor = fillColor.light(125); + + if (option->levelOfDetail < 0.2) { + if (option->levelOfDetail < 0.125) { + painter->fillRect(QRectF(0, 0, 110, 70), fillColor); + return; + } + + QBrush b = painter->brush(); + painter->setBrush(fillColor); + painter->drawRect(13, 13, 97, 57); + painter->setBrush(b); + return; + } + + QPen oldPen = painter->pen(); + QPen pen = oldPen; + int width = 0; + if (option->state & QStyle::State_Selected) + width += 2; + + pen.setWidth(width); + QBrush b = painter->brush(); + painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100))); + + painter->drawRect(QRect(14, 14, 79, 39)); + painter->setBrush(b); + + if (option->levelOfDetail >= 1) { + painter->setPen(QPen(Qt::gray, 1)); + painter->drawLine(15, 54, 94, 54); + painter->drawLine(94, 53, 94, 15); + painter->setPen(QPen(Qt::black, 0)); + } + + // Draw text + if (option->levelOfDetail >= 2) { + QFont font("Times", 10); + font.setStyleStrategy(QFont::ForceOutline); + painter->setFont(font); + painter->save(); + painter->scale(0.1, 0.1); + painter->drawText(170, 180, QString("Model: VSC-2000 (Very Small Chip) at %1x%2").arg(x).arg(y)); + painter->drawText(170, 200, QString("Serial number: DLWR-WEER-123L-ZZ33-SDSJ")); + painter->drawText(170, 220, QString("Manufacturer: Chip Manufacturer")); + painter->restore(); + } + + // Draw lines + QVarLengthArray lines; + if (option->levelOfDetail >= 0.5) { + for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { + lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5)); + lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62)); + } + for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { + lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5)); + lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5)); + } + } + if (option->levelOfDetail >= 0.4) { + const QLineF lineData[] = { + QLineF(25, 35, 35, 35), + QLineF(35, 30, 35, 40), + QLineF(35, 30, 45, 35), + QLineF(35, 40, 45, 35), + QLineF(45, 30, 45, 40), + QLineF(45, 35, 55, 35) + }; + lines.append(lineData, 6); + } + painter->drawLines(lines.data(), lines.size()); + + // Draw red ink + if (stuff.size() > 1) { + QPen p = painter->pen(); + painter->setPen(QPen(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter->setBrush(Qt::NoBrush); + QPainterPath path; + path.moveTo(stuff.first()); + for (int i = 1; i < stuff.size(); ++i) + path.lineTo(stuff.at(i)); + painter->drawPath(path); + painter->setPen(p); + } +} + +void Chip::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + QGraphicsItem::mousePressEvent(event); + update(); +} + +void Chip::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if (event->modifiers() & Qt::ShiftModifier) { + stuff << event->pos(); + update(); + return; + } + QGraphicsItem::mouseMoveEvent(event); +} + +void Chip::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + QGraphicsItem::mouseReleaseEvent(event); + update(); +} diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h new file mode 100644 index 0000000..9db23f9 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHIP_H +#define CHIP_H + +#include +#include + +class Chip : public QGraphicsItem +{ +public: + Chip(const QColor &color, int x, int y); + + QRectF boundingRect() const; + QPainterPath shape() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + +private: + int x, y; + QColor color; + QList stuff; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp new file mode 100644 index 0000000..8cada67 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "chiptester.h" +#include "chip.h" + +#include +#ifndef QT_NO_OPENGL +#include +#endif + +ChipTester::ChipTester(QWidget *parent) + : QGraphicsView(parent), + npaints(0) +{ + resize(400, 300); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setFrameStyle(0); + setTransformationAnchor(NoAnchor); + + populateScene(); + setScene(scene); + + setWindowTitle(tr("Chip Demo")); +} + +void ChipTester::setAntialias(bool enabled) +{ + setRenderHint(QPainter::Antialiasing, enabled); +} + +void ChipTester::setOpenGL(bool enabled) +{ +#ifndef QT_NO_OPENGL + setViewport(enabled ? new QGLWidget(QGLFormat(QGL::SampleBuffers)) : 0); +#endif +} + +void ChipTester::setOperation(Operation operation) +{ + this->operation = operation; +} + +void ChipTester::runBenchmark() +{ + npaints = 0; + timerId = startTimer(0); + stopWatch.start(); + eventLoop.exec(); + killTimer(timerId); +} + +void ChipTester::paintEvent(QPaintEvent *event) +{ + QGraphicsView::paintEvent(event); + if (++npaints == 50) + eventLoop.quit(); +} + +void ChipTester::timerEvent(QTimerEvent *) +{ + switch (operation) { + case Rotate360: + rotate(1); + break; + case ZoomInOut: { + qreal s = 0.05 + (npaints / 20.0); + setTransform(QTransform().scale(s, s)); + break; + } + case Translate: { + int offset = horizontalScrollBar()->minimum() + + (npaints % (horizontalScrollBar()->maximum() - horizontalScrollBar()->minimum())); + horizontalScrollBar()->setValue(offset); + break; + } + } +} + +void ChipTester::populateScene() +{ + scene = new QGraphicsScene; + + QImage image(":/qt4logo.png"); + + // Populate scene + int xx = 0; + int nitems = 0; + for (int i = -1100; i < 1100; i += 110) { + ++xx; + int yy = 0; + for (int j = -700; j < 700; j += 70) { + ++yy; + qreal x = (i + 1100) / 2200.0; + qreal y = (j + 700) / 1400.0; + + QColor color(image.pixel(int(image.width() * x), int(image.height() * y))); + QGraphicsItem *item = new Chip(color, xx, yy); + item->setPos(QPointF(i, j)); + scene->addItem(item); + + ++nitems; + } + } +} diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h new file mode 100644 index 0000000..1a73bb7 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHIPTESTER_H +#define CHIPTESTER_H + +#include + +QT_FORWARD_DECLARE_CLASS(QGraphicsScene) +QT_FORWARD_DECLARE_CLASS(QGraphicsView) +QT_FORWARD_DECLARE_CLASS(QLabel) +QT_FORWARD_DECLARE_CLASS(QSlider) +QT_FORWARD_DECLARE_CLASS(QSplitter) + +class ChipTester : public QGraphicsView +{ + Q_OBJECT +public: + enum Operation { + Rotate360, + ZoomInOut, + Translate + }; + ChipTester(QWidget *parent = 0); + + void setAntialias(bool enabled); + void setOpenGL(bool enabled); + void runBenchmark(); + void setOperation(Operation operation); + +protected: + void paintEvent(QPaintEvent *event); + void timerEvent(QTimerEvent *event); + +private: + void populateScene(); + + QGraphicsView *view; + QGraphicsScene *scene; + int npaints; + int timerId; + QEventLoop eventLoop; + QTime stopWatch; + Operation operation; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri new file mode 100644 index 0000000..a9e0bf8 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri @@ -0,0 +1,12 @@ +SOURCES += \ + chiptester/chiptester.cpp \ + chiptester/chip.cpp + +HEADERS += \ + chiptester/chiptester.h \ + chiptester/chip.h + +RESOURCES += \ + chiptester/images.qrc + +contains(QT_CONFIG, opengl) QT += opengl diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/images.qrc b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/images.qrc new file mode 100644 index 0000000..73e8620 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/images.qrc @@ -0,0 +1,5 @@ + + + qt4logo.png + + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/qt4logo.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/qt4logo.png new file mode 100644 index 0000000..157e86e Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/qt4logo.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/images/designer.png b/tests/benchmarks/gui/graphicsview/qgraphicsview/images/designer.png new file mode 100644 index 0000000..0988fce Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/images/designer.png differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine-big.jpeg b/tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine-big.jpeg new file mode 100644 index 0000000..9900a50 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine-big.jpeg differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine.jpeg b/tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine.jpeg new file mode 100644 index 0000000..8fe1d3a Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine.jpeg differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro new file mode 100644 index 0000000..927d731 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro @@ -0,0 +1,16 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicsview + +SOURCES += tst_qgraphicsview.cpp +RESOURCES += qgraphicsview.qrc + +include(chiptester/chiptester.pri) + +symbian { + qt_not_deployed { + plugins.sources = qjpeg.dll + plugins.path = imageformats + DEPLOYMENT += plugins + } +} diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.qrc b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.qrc new file mode 100644 index 0000000..3681648 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.qrc @@ -0,0 +1,9 @@ + + + images/designer.png + images/wine.jpeg + images/wine-big.jpeg + random.data + + + diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/random.data b/tests/benchmarks/gui/graphicsview/qgraphicsview/random.data new file mode 100644 index 0000000..190a36c Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/qgraphicsview/random.data differ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp new file mode 100644 index 0000000..4cb07db --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -0,0 +1,908 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#ifdef Q_WS_X11 +QT_BEGIN_NAMESPACE +extern void qt_x11_wait_for_window_manager(QWidget *); +QT_END_NAMESPACE +#endif +#include "chiptester/chiptester.h" +//#define CALLGRIND_DEBUG +#ifdef CALLGRIND_DEBUG +#include "valgrind/callgrind.h" +#endif + +//TESTED_FILES= + +class QEventWaiter : public QEventLoop +{ +public: + QEventWaiter(QObject *receiver, QEvent::Type type) + : waiting(false), t(type) + { + receiver->installEventFilter(this); + } + + void wait() + { + waiting = true; + exec(); + } + + bool eventFilter(QObject *receiver, QEvent *event) + { + Q_UNUSED(receiver); + if (waiting && event->type() == t) { + waiting = false; + exit(); + } + return false; + } + +private: + bool waiting; + QEvent::Type t; +}; + +class tst_QGraphicsView : public QObject +{ + Q_OBJECT + +public: + tst_QGraphicsView(); + virtual ~tst_QGraphicsView(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void paintSingleItem(); + void paintDeepStackingItems(); + void paintDeepStackingItems_clipped(); + void moveSingleItem(); + void mapPointToScene_data(); + void mapPointToScene(); + void mapPointFromScene_data(); + void mapPointFromScene(); + void mapRectToScene_data(); + void mapRectToScene(); + void mapRectFromScene_data(); + void mapRectFromScene(); + void chipTester_data(); + void chipTester(); + void deepNesting_data(); + void deepNesting(); + void imageRiver_data(); + void imageRiver(); + void textRiver_data(); + void textRiver(); + void moveItemCache_data(); + void moveItemCache(); + void paintItemCache_data(); + void paintItemCache(); +}; + +tst_QGraphicsView::tst_QGraphicsView() +{ +} + +tst_QGraphicsView::~tst_QGraphicsView() +{ +} + +void tst_QGraphicsView::init() +{ +} + +void tst_QGraphicsView::cleanup() +{ +} + +void tst_QGraphicsView::construct() +{ + QBENCHMARK { + QGraphicsView view; + } +} + +void tst_QGraphicsView::paintSingleItem() +{ + QGraphicsScene scene(0, 0, 100, 100); + scene.addRect(0, 0, 10, 10); + + QGraphicsView view(&scene); + view.show(); + view.resize(100, 100); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + + QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); + QPainter painter(&image); + QBENCHMARK { + view.viewport()->render(&painter); + } +} + +#ifdef Q_OS_SYMBIAN +# define DEEP_STACKING_COUNT 85 +#else +# define DEEP_STACKING_COUNT 1000 +#endif + +void tst_QGraphicsView::paintDeepStackingItems() +{ + QGraphicsScene scene(0, 0, 100, 100); + QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); + QGraphicsRectItem *lastRect = item; + for (int i = 0; i < DEEP_STACKING_COUNT; ++i) { + QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); + rect->setPos(1, 1); + rect->setParentItem(lastRect); + lastRect = rect; + } + + QGraphicsView view(&scene); + view.show(); + view.resize(100, 100); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + + QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); + QPainter painter(&image); + QBENCHMARK { + view.viewport()->render(&painter); + } +} + +void tst_QGraphicsView::paintDeepStackingItems_clipped() +{ + QGraphicsScene scene(0, 0, 100, 100); + QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); + item->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + QGraphicsRectItem *lastRect = item; + for (int i = 0; i < DEEP_STACKING_COUNT; ++i) { + QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); + rect->setPos(1, 1); + rect->setParentItem(lastRect); + lastRect = rect; + } + + QGraphicsView view(&scene); + view.show(); + view.resize(100, 100); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + + QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); + QPainter painter(&image); + QBENCHMARK { + view.viewport()->render(&painter); + } +} + +void tst_QGraphicsView::moveSingleItem() +{ + QGraphicsScene scene(0, 0, 100, 100); + QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); + + QGraphicsView view(&scene); + view.show(); + view.resize(100, 100); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + + QEventWaiter waiter(view.viewport(), QEvent::Paint); + int n = 1; + QBENCHMARK { + item->setPos(25 * n, 25 * n); + waiter.wait(); + n = n ? 0 : 1; + } +} + +void tst_QGraphicsView::mapPointToScene_data() +{ + QTest::addColumn("transform"); + QTest::addColumn("point"); + + QTest::newRow("null") << QTransform() << QPoint(); + QTest::newRow("identity QPoint(100, 100)") << QTransform() << QPoint(100, 100); + QTest::newRow("rotate QPoint(100, 100)") << QTransform().rotate(90) << QPoint(100, 100); + QTest::newRow("scale QPoint(100, 100)") << QTransform().scale(5, 5) << QPoint(100, 100); + QTest::newRow("translate QPoint(100, 100)") << QTransform().translate(5, 5) << QPoint(100, 100); + QTest::newRow("shear QPoint(100, 100)") << QTransform().shear(1.5, 1.5) << QPoint(100, 100); + QTest::newRow("perspect QPoint(100, 100)") << QTransform().rotate(45, Qt::XAxis) << QPoint(100, 100); +} + +void tst_QGraphicsView::mapPointToScene() +{ + QFETCH(QTransform, transform); + QFETCH(QPoint, point); + + QGraphicsView view; + view.setTransform(transform); + QBENCHMARK { + view.mapToScene(point); + } +} + +void tst_QGraphicsView::mapPointFromScene_data() +{ + QTest::addColumn("transform"); + QTest::addColumn("point"); + + QTest::newRow("null") << QTransform() << QPointF(); + QTest::newRow("identity QPointF(100, 100)") << QTransform() << QPointF(100, 100); + QTest::newRow("rotate QPointF(100, 100)") << QTransform().rotate(90) << QPointF(100, 100); + QTest::newRow("scale QPointF(100, 100)") << QTransform().scale(5, 5) << QPointF(100, 100); + QTest::newRow("translate QPointF(100, 100)") << QTransform().translate(5, 5) << QPointF(100, 100); + QTest::newRow("shear QPointF(100, 100)") << QTransform().shear(1.5, 1.5) << QPointF(100, 100); + QTest::newRow("perspect QPointF(100, 100)") << QTransform().rotate(45, Qt::XAxis) << QPointF(100, 100); +} + +void tst_QGraphicsView::mapPointFromScene() +{ + QFETCH(QTransform, transform); + QFETCH(QPointF, point); + + QGraphicsView view; + view.setTransform(transform); + QBENCHMARK { + view.mapFromScene(point); + } +} + +void tst_QGraphicsView::mapRectToScene_data() +{ + QTest::addColumn("transform"); + QTest::addColumn("rect"); + + QTest::newRow("null") << QTransform() << QRect(); + QTest::newRow("identity QRect(0, 0, 100, 100)") << QTransform() << QRect(0, 0, 100, 100); + QTest::newRow("rotate QRect(0, 0, 100, 100)") << QTransform().rotate(90) << QRect(0, 0, 100, 100); + QTest::newRow("scale QRect(0, 0, 100, 100)") << QTransform().scale(5, 5) << QRect(0, 0, 100, 100); + QTest::newRow("translate QRect(0, 0, 100, 100)") << QTransform().translate(5, 5) << QRect(0, 0, 100, 100); + QTest::newRow("shear QRect(0, 0, 100, 100)") << QTransform().shear(1.5, 1.5) << QRect(0, 0, 100, 100); + QTest::newRow("perspect QRect(0, 0, 100, 100)") << QTransform().rotate(45, Qt::XAxis) << QRect(0, 0, 100, 100); +} + +void tst_QGraphicsView::mapRectToScene() +{ + QFETCH(QTransform, transform); + QFETCH(QRect, rect); + + QGraphicsView view; + view.setTransform(transform); + QBENCHMARK { + view.mapToScene(rect); + } +} + +void tst_QGraphicsView::mapRectFromScene_data() +{ + QTest::addColumn("transform"); + QTest::addColumn("rect"); + + QTest::newRow("null") << QTransform() << QRectF(); + QTest::newRow("identity QRectF(0, 0, 100, 100)") << QTransform() << QRectF(0, 0, 100, 100); + QTest::newRow("rotate QRectF(0, 0, 100, 100)") << QTransform().rotate(90) << QRectF(0, 0, 100, 100); + QTest::newRow("scale QRectF(0, 0, 100, 100)") << QTransform().scale(5, 5) << QRectF(0, 0, 100, 100); + QTest::newRow("translate QRectF(0, 0, 100, 100)") << QTransform().translate(5, 5) << QRectF(0, 0, 100, 100); + QTest::newRow("shear QRectF(0, 0, 100, 100)") << QTransform().shear(1.5, 1.5) << QRectF(0, 0, 100, 100); + QTest::newRow("perspect QRectF(0, 0, 100, 100)") << QTransform().rotate(45, Qt::XAxis) << QRectF(0, 0, 100, 100); +} + +void tst_QGraphicsView::mapRectFromScene() +{ + QFETCH(QTransform, transform); + QFETCH(QRectF, rect); + + QGraphicsView view; + view.setTransform(transform); + QBENCHMARK { + view.mapFromScene(rect); + } +} + +void tst_QGraphicsView::chipTester_data() +{ + QTest::addColumn("antialias"); + QTest::addColumn("opengl"); + QTest::addColumn("operation"); + QTest::newRow("rotate, normal") << false << false << 0; + QTest::newRow("rotate, normal, antialias") << true << false << 0; + QTest::newRow("rotate, opengl") << false << true << 0; + QTest::newRow("rotate, opengl, antialias") << true << true << 0; + QTest::newRow("zoom, normal") << false << false << 1; + QTest::newRow("zoom, normal, antialias") << true << false << 1; + QTest::newRow("zoom, opengl") << false << true << 1; + QTest::newRow("zoom, opengl, antialias") << true << true << 1; + QTest::newRow("translate, normal") << false << false << 2; + QTest::newRow("translate, normal, antialias") << true << false << 2; + QTest::newRow("translate, opengl") << false << true << 2; + QTest::newRow("translate, opengl, antialias") << true << true << 2; +} + +void tst_QGraphicsView::chipTester() +{ + QFETCH(bool, antialias); + QFETCH(bool, opengl); + QFETCH(int, operation); + + ChipTester tester; + tester.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&tester); +#endif + tester.setAntialias(antialias); + tester.setOpenGL(opengl); + tester.setOperation(ChipTester::Operation(operation)); + QBENCHMARK { + tester.runBenchmark(); + } +} + +static void addChildHelper(QGraphicsItem *parent, int n, bool rotate) +{ + if (!n) + return; + QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent); + item->setPos(10, 10); + if (rotate) + item->rotate(10); + addChildHelper(item, n - 1, rotate); +} + +void tst_QGraphicsView::deepNesting_data() +{ + QTest::addColumn("rotate"); + QTest::addColumn("sortCache"); + QTest::addColumn("bsp"); + + QTest::newRow("bsp, no transform") << false << false << true; + QTest::newRow("bsp, rotation") << true << false << true; + QTest::newRow("bsp, no transform, sort cache") << false << true << true; + QTest::newRow("bsp, rotation, sort cache") << true << true << true; + QTest::newRow("no transform") << false << false << false; + QTest::newRow("rotation") << true << false << false; + QTest::newRow("no transform, sort cache") << false << true << false; + QTest::newRow("rotation, sort cache") << true << true << false; +} + +void tst_QGraphicsView::deepNesting() +{ + QFETCH(bool, rotate); + QFETCH(bool, sortCache); + QFETCH(bool, bsp); + + QGraphicsScene scene; + for (int y = 0; y < 15; ++y) { + for (int x = 0; x < 15; ++x) { + QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50)); + if (rotate) item1->rotate(10); + item1->setPos(x * 25, y * 25); + addChildHelper(item1, 30, rotate); + } + } + scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); + scene.setSortCacheEnabled(sortCache); + + QGraphicsView view(&scene); + view.setRenderHint(QPainter::Antialiasing); + view.show(); +#ifdef Q_WS_X11 + qt_x11_wait_for_window_manager(&view); +#endif + QTest::qWait(250); + + QBENCHMARK { +#ifdef CALLGRIND_DEBUG + CALLGRIND_START_INSTRUMENTATION +#endif + view.viewport()->repaint(); +#ifdef CALLGRIND_DEBUG + CALLGRIND_STOP_INSTRUMENTATION +#endif + } +} + +class AnimatedPixmapItem : public QGraphicsPixmapItem +{ +public: + AnimatedPixmapItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0) + : QGraphicsPixmapItem(parent), rotateFactor(0), scaleFactor(0) + { + rotate = rot; + scale = scal; + xspeed = x; + yspeed = y; + } + +protected: + void advance(int i) + { + if (!i) + return; + int x = int(pos().x()) + pixmap().width(); + x += xspeed; + x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); + int y = int(pos().y()) + pixmap().width(); + y += yspeed; + y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); + setPos(x, y); + + int rot = rotateFactor; + int sca = scaleFactor; + if (rotate) + rotateFactor = 1 + (rot + xspeed) % 360; + if (scale) + scaleFactor = 1 + (sca + yspeed) % 50; + + if (rotate || scale) { + qreal s = 0.5 + scaleFactor / 50.0; + setTransform(QTransform().rotate(rotateFactor).scale(s, s)); + } + } + +private: + int xspeed; + int yspeed; + int rotateFactor; + int scaleFactor; + bool rotate; + bool scale; +}; + +class CountPaintEventView : public QGraphicsView +{ +public: + CountPaintEventView(QGraphicsScene *scene = 0) + : QGraphicsView(scene), count(0) + { } + + int count; + +protected: + void paintEvent(QPaintEvent *event) + { + ++count; + QGraphicsView::paintEvent(event); + }; +}; + +void tst_QGraphicsView::imageRiver_data() +{ + QTest::addColumn("direction"); + QTest::addColumn("rotation"); + QTest::addColumn("scale"); + QTest::newRow("horizontal") << 0 << false << false; + QTest::newRow("vertical") << 1 << false << false; + QTest::newRow("both") << 2 << false << false; + QTest::newRow("horizontal rot") << 0 << true << false; + QTest::newRow("horizontal scale") << 0 << false << true; + QTest::newRow("horizontal rot + scale") << 0 << true << true; +} + +void tst_QGraphicsView::imageRiver() +{ + QFETCH(int, direction); + QFETCH(bool, rotation); + QFETCH(bool, scale); + + QGraphicsScene scene(0, 0, 300, 300); + + CountPaintEventView view(&scene); + view.resize(300, 300); + view.setFrameStyle(0); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.show(); + + QPixmap pix(":/images/designer.png"); + QVERIFY(!pix.isNull()); + + QList items; + QFile file(":/random.data"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QDataStream str(&file); + for (int i = 0; i < 100; ++i) { + AnimatedPixmapItem *item; + if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale); + if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale); + if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale); + item->setPixmap(pix); + int rnd1, rnd2; + str >> rnd1 >> rnd2; + item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), + -pix.height() + rnd2 % (view.height() + pix.height())); + scene.addItem(item); + } + + view.count = 0; + + QBENCHMARK { +#ifdef CALLGRIND_DEBUG + CALLGRIND_START_INSTRUMENTATION +#endif + for (int i = 0; i < 100; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } +#ifdef CALLGRIND_DEBUG + CALLGRIND_STOP_INSTRUMENTATION +#endif + } +} + +class AnimatedTextItem : public QGraphicsSimpleTextItem +{ +public: + AnimatedTextItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0) + : QGraphicsSimpleTextItem(parent), rotateFactor(0), scaleFactor(25) + { + setText("River of text"); + rotate = rot; + scale = scal; + xspeed = x; + yspeed = y; + } + +protected: + void advance(int i) + { + if (!i) + return; + QRect r = boundingRect().toRect(); + int x = int(pos().x()) + r.width(); + x += xspeed; + x = (x % (300 + r.width() * 2)) - r.width(); + int y = int(pos().y()) + r.width(); + y += yspeed; + y = (y % (300 + r.width() * 2)) - r.width(); + setPos(x, y); + + int rot = rotateFactor; + int sca = scaleFactor; + if (rotate) + rotateFactor = 1 + (rot + xspeed) % 360; + if (scale) + scaleFactor = 1 + (sca + yspeed) % 50; + + if (rotate || scale) { + qreal s = 0.5 + scaleFactor / 50.0; + setTransform(QTransform().rotate(rotateFactor).scale(s, s)); + } + } + +private: + int xspeed; + int yspeed; + int rotateFactor; + int scaleFactor; + bool rotate; + bool scale; +}; + +void tst_QGraphicsView::textRiver_data() +{ + QTest::addColumn("direction"); + QTest::addColumn("rotation"); + QTest::addColumn("scale"); + QTest::newRow("horizontal") << 0 << false << false; + QTest::newRow("vertical") << 1 << false << false; + QTest::newRow("both") << 2 << false << false; + QTest::newRow("horizontal rot") << 0 << true << false; + QTest::newRow("horizontal scale") << 0 << false << true; + QTest::newRow("horizontal rot + scale") << 0 << true << true; +} + +void tst_QGraphicsView::textRiver() +{ + QFETCH(int, direction); + QFETCH(bool, rotation); + QFETCH(bool, scale); + + QGraphicsScene scene(0, 0, 300, 300); + + CountPaintEventView view(&scene); + view.resize(300, 300); + view.setFrameStyle(0); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.show(); + + QPixmap pix(":/images/designer.png"); + QVERIFY(!pix.isNull()); + + QList items; + QFile file(":/random.data"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QDataStream str(&file); + for (int i = 0; i < 100; ++i) { + AnimatedTextItem *item; + if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale); + if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale); + if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale); + int rnd1, rnd2; + str >> rnd1 >> rnd2; + item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), + -pix.height() + rnd2 % (view.height() + pix.height())); + scene.addItem(item); + } + + view.count = 0; + + QBENCHMARK { +#ifdef CALLGRIND_DEBUG + CALLGRIND_START_INSTRUMENTATION +#endif + for (int i = 0; i < 100; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } +#ifdef CALLGRIND_DEBUG + CALLGRIND_STOP_INSTRUMENTATION +#endif + } +} + +class AnimatedPixmapCacheItem : public QGraphicsPixmapItem +{ +public: + AnimatedPixmapCacheItem(int x, int y, QGraphicsItem *parent = 0) + : QGraphicsPixmapItem(parent) + { + xspeed = x; + yspeed = y; + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { + QGraphicsPixmapItem::paint(painter,option,widget); + //We just want to wait, and we don't want to process the event loop with qWait + QTest::qSleep(3); + } +protected: + void advance(int i) + { + if (!i) + return; + int x = int(pos().x()) + pixmap().width(); + x += xspeed; + x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); + int y = int(pos().y()) + pixmap().width(); + y += yspeed; + y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); + setPos(x, y); + } + +private: + int xspeed; + int yspeed; +}; + +void tst_QGraphicsView::moveItemCache_data() +{ + QTest::addColumn("direction"); + QTest::addColumn("rotation"); + QTest::addColumn("cacheMode"); + QTest::newRow("Horizontal movement : ItemCoordinate Cache") << 0 << false << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Horizontal movement : DeviceCoordinate Cache") << 0 << false << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Horizontal movement : No Cache") << 0 << false << (int)QGraphicsItem::NoCache; + QTest::newRow("Vertical + Horizontal movement : ItemCoordinate Cache") << 2 << false << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Vertical + Horizontal movement : DeviceCoordinate Cache") << 2 << false << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Vertical + Horizontal movement : No Cache") << 2 << false << (int)QGraphicsItem::NoCache; + QTest::newRow("Horizontal movement + Rotation : ItemCoordinate Cache") << 0 << true << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Horizontal movement + Rotation : DeviceCoordinate Cache") << 0 << true << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Horizontal movement + Rotation : No Cache") << 0 << true << (int)QGraphicsItem::NoCache; +} + +void tst_QGraphicsView::moveItemCache() +{ + QFETCH(int, direction); + QFETCH(bool, rotation); + QFETCH(int, cacheMode); + + QGraphicsScene scene(0, 0, 300, 300); + + CountPaintEventView view(&scene); + view.resize(600, 600); + view.setFrameStyle(0); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.show(); + + QPixmap pix(":/images/wine.jpeg"); + QVERIFY(!pix.isNull()); + + QList items; + QFile file(":/random.data"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QDataStream str(&file); + for (int i = 0; i < 50; ++i) { + AnimatedPixmapCacheItem *item; + if (direction == 0) item = new AnimatedPixmapCacheItem((i % 4) + 1, 0); + if (direction == 1) item = new AnimatedPixmapCacheItem(0, (i % 4) + 1); + if (direction == 2) item = new AnimatedPixmapCacheItem((i % 4) + 1, (i % 4) + 1); + item->setPixmap(pix); + item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); + if (rotation) + item->setTransform(QTransform().rotate(45)); + int rnd1, rnd2; + str >> rnd1 >> rnd2; + item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), + -pix.height() + rnd2 % (view.height() + pix.height())); + scene.addItem(item); + } + + view.count = 0; + + QBENCHMARK { +#ifdef CALLGRIND_DEBUG + CALLGRIND_START_INSTRUMENTATION +#endif + for (int i = 0; i < 100; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } +#ifdef CALLGRIND_DEBUG + CALLGRIND_STOP_INSTRUMENTATION +#endif + } +} + +class UpdatedPixmapCacheItem : public QGraphicsPixmapItem +{ +public: + UpdatedPixmapCacheItem(bool partial, QGraphicsItem *parent = 0) + : QGraphicsPixmapItem(parent), partial(partial) + { + } + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) + { + QGraphicsPixmapItem::paint(painter,option,widget); + } +protected: + void advance(int i) + { + if (partial) + update(QRectF(boundingRect().center().x(), boundingRect().center().x(), 30, 30)); + else + update(); + } + +private: + bool partial; +}; + +void tst_QGraphicsView::paintItemCache_data() +{ + QTest::addColumn("updatePartial"); + QTest::addColumn("rotation"); + QTest::addColumn("cacheMode"); + QTest::newRow("Partial Update : ItemCoordinate Cache") << true << false << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Partial Update : DeviceCoordinate Cache") << true << false << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Partial Update : No Cache") << true << false << (int)QGraphicsItem::NoCache; + QTest::newRow("Full Update : ItemCoordinate Cache") << false << false << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Full Update : DeviceCoordinate Cache") << false << false << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Full Update : No Cache") << false << false << (int)QGraphicsItem::NoCache; + QTest::newRow("Partial Update : ItemCoordinate Cache item rotated") << true << true << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Partial Update : DeviceCoordinate Cache item rotated") << true << true << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Partial Update : No Cache item rotated") << true << true << (int)QGraphicsItem::NoCache; + QTest::newRow("Full Update : ItemCoordinate Cache item rotated") << false << true << (int)QGraphicsItem::ItemCoordinateCache; + QTest::newRow("Full Update : DeviceCoordinate Cache item rotated") << false << true << (int)QGraphicsItem::DeviceCoordinateCache; + QTest::newRow("Full Update : No Cache item rotated") << false << true <<(int)QGraphicsItem::NoCache; +} + +void tst_QGraphicsView::paintItemCache() +{ + QFETCH(bool, updatePartial); + QFETCH(bool, rotation); + QFETCH(int, cacheMode); + + QGraphicsScene scene(0, 0, 300, 300); + + CountPaintEventView view(&scene); + view.resize(600, 600); + view.setFrameStyle(0); + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.show(); + + QPixmap pix(":/images/wine.jpeg"); + QVERIFY(!pix.isNull()); + + QList items; + QFile file(":/random.data"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QDataStream str(&file); + UpdatedPixmapCacheItem *item = new UpdatedPixmapCacheItem(updatePartial); + item->setPixmap(pix); + item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); + if (rotation) + item->setTransform(QTransform().rotate(45)); + item->setPos(-100, -100); + scene.addItem(item); + + QPixmap pix2(":/images/wine-big.jpeg"); + item = new UpdatedPixmapCacheItem(updatePartial); + item->setPixmap(pix2); + item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); + if (rotation) + item->setTransform(QTransform().rotate(45)); + item->setPos(0, 0); + scene.addItem(item); + + view.count = 0; + + QBENCHMARK { +#ifdef CALLGRIND_DEBUG + CALLGRIND_START_INSTRUMENTATION +#endif + for (int i = 0; i < 50; ++i) { + scene.advance(); + while (view.count < (i+1)) + qApp->processEvents(); + } +#ifdef CALLGRIND_DEBUG + CALLGRIND_STOP_INSTRUMENTATION +#endif + } +} + +QTEST_MAIN(tst_QGraphicsView) +#include "tst_qgraphicsview.moc" diff --git a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro new file mode 100644 index 0000000..f1ec54e --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qgraphicswidget +TEMPLATE = app +# Input +SOURCES += tst_qgraphicswidget.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/benchmarks/gui/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp new file mode 100644 index 0000000..7db98ce --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +//TESTED_FILES= + +class tst_QGraphicsWidget : public QObject +{ + Q_OBJECT + +public: + tst_QGraphicsWidget(); + virtual ~tst_QGraphicsWidget(); + +public slots: + void init(); + void cleanup(); + +private slots: + void move(); +}; + +tst_QGraphicsWidget::tst_QGraphicsWidget() +{ +} + +tst_QGraphicsWidget::~tst_QGraphicsWidget() +{ +} + +void tst_QGraphicsWidget::init() +{ +} + +void tst_QGraphicsWidget::cleanup() +{ +} + +void tst_QGraphicsWidget::move() +{ + QGraphicsScene scene; + QGraphicsWidget *widget = new QGraphicsWidget(); + scene.addItem(widget); + QGraphicsView view(&scene); + view.show(); + QBENCHMARK { + widget->setPos(qrand(),qrand()); + } +} + +QTEST_MAIN(tst_QGraphicsWidget) +#include "tst_qgraphicswidget.moc" diff --git a/tests/benchmarks/gui/gui.pro b/tests/benchmarks/gui/gui.pro new file mode 100644 index 0000000..946f184 --- /dev/null +++ b/tests/benchmarks/gui/gui.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs +SUBDIRS = \ + animation \ + graphicsview \ + image \ + itemviews \ + kernel \ + math3d \ + painting \ + styles \ + text diff --git a/tests/benchmarks/gui/image/blendbench/blendbench.pro b/tests/benchmarks/gui/image/blendbench/blendbench.pro new file mode 100644 index 0000000..a3228c5 --- /dev/null +++ b/tests/benchmarks/gui/image/blendbench/blendbench.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_blendbench +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp new file mode 100644 index 0000000..92d1633 --- /dev/null +++ b/tests/benchmarks/gui/image/blendbench/main.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include + +void paint(QPaintDevice *device) +{ + QPainter p(device); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(0, 0, device->width(), device->height(), Qt::transparent); + + QLinearGradient g(QPoint(0, 0), QPoint(1, 1)); +// g.setCoordinateMode(QGradient::ObjectBoundingMode); + g.setColorAt(0, Qt::magenta); + g.setColorAt(0, Qt::white); + +// p.setOpacity(0.8); + p.setPen(Qt::NoPen); + p.setBrush(g); + p.setRenderHint(QPainter::Antialiasing); + p.setOpacity(0.9); + p.drawEllipse(0, 0, device->width(), device->height()); +} + +QLatin1String compositionModes[] = { + QLatin1String("SourceOver"), + QLatin1String("DestinationOver"), + QLatin1String("Clear"), + QLatin1String("Source"), + QLatin1String("Destination"), + QLatin1String("SourceIn"), + QLatin1String("DestinationIn"), + QLatin1String("SourceOut"), + QLatin1String("DestinationOut"), + QLatin1String("SourceAtop"), + QLatin1String("DestinationAtop"), + QLatin1String("Xor"), + + //svg 1.2 blend modes + QLatin1String("Plus"), + QLatin1String("Multiply"), + QLatin1String("Screen"), + QLatin1String("Overlay"), + QLatin1String("Darken"), + QLatin1String("Lighten"), + QLatin1String("ColorDodge"), + QLatin1String("ColorBurn"), + QLatin1String("HardLight"), + QLatin1String("SoftLight"), + QLatin1String("Difference"), + QLatin1String("Exclusion") +}; + +enum BrushType { ImageBrush, SolidBrush }; +QLatin1String brushTypes[] = { + QLatin1String("ImageBrush"), + QLatin1String("SolidBrush"), +}; + +class BlendBench : public QObject +{ + Q_OBJECT +private slots: + void blendBench_data(); + void blendBench(); +}; + +void BlendBench::blendBench_data() +{ + int first = 0; + int limit = 12; + if (qApp->arguments().contains("--extended")) { + first = 12; + limit = 24; + } + + QTest::addColumn("brushType"); + QTest::addColumn("compositionMode"); + + for (int brush = ImageBrush; brush <= SolidBrush; ++brush) + for (int mode = first; mode < limit; ++mode) + QTest::newRow(QString("brush=%1; mode=%2") + .arg(brushTypes[brush]).arg(compositionModes[mode]).toAscii().data()) + << brush << mode; +} + +void BlendBench::blendBench() +{ + QFETCH(int, brushType); + QFETCH(int, compositionMode); + + QImage img(512, 512, QImage::Format_ARGB32_Premultiplied); + QImage src(512, 512, QImage::Format_ARGB32_Premultiplied); + paint(&src); + QPainter p(&img); + p.setPen(Qt::NoPen); + + p.setCompositionMode(QPainter::CompositionMode(compositionMode)); + if (brushType == ImageBrush) { + p.setBrush(QBrush(src)); + } else if (brushType == SolidBrush) { + p.setBrush(QColor(127, 127, 127, 127)); + } + + QBENCHMARK { + p.drawRect(0, 0, 512, 512); + } +} + +QTEST_MAIN(BlendBench) + +#include "main.moc" diff --git a/tests/benchmarks/gui/image/image.pro b/tests/benchmarks/gui/image/image.pro new file mode 100644 index 0000000..3094e72 --- /dev/null +++ b/tests/benchmarks/gui/image/image.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +SUBDIRS = \ + blendbench \ + qimagereader \ + qpixmap \ + qpixmapcache diff --git a/tests/benchmarks/gui/image/qimagereader/images/16bpp.bmp b/tests/benchmarks/gui/image/qimagereader/images/16bpp.bmp new file mode 100644 index 0000000..74ce63e Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/16bpp.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/4bpp-rle.bmp b/tests/benchmarks/gui/image/qimagereader/images/4bpp-rle.bmp new file mode 100644 index 0000000..ae71e67 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/4bpp-rle.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.jpg b/tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.jpg new file mode 100644 index 0000000..b8aa9ea Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.jpg differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.png b/tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.png new file mode 100644 index 0000000..a24db1b Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/YCbCr_rgb.jpg b/tests/benchmarks/gui/image/qimagereader/images/YCbCr_rgb.jpg new file mode 100644 index 0000000..8771224 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/YCbCr_rgb.jpg differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/away.png b/tests/benchmarks/gui/image/qimagereader/images/away.png new file mode 100644 index 0000000..0e21a37 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/away.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/ball.mng b/tests/benchmarks/gui/image/qimagereader/images/ball.mng new file mode 100644 index 0000000..8154478 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/ball.mng differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/bat1.gif b/tests/benchmarks/gui/image/qimagereader/images/bat1.gif new file mode 100644 index 0000000..cb6f4f7 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/bat1.gif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/bat2.gif b/tests/benchmarks/gui/image/qimagereader/images/bat2.gif new file mode 100644 index 0000000..fbbda4e Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/bat2.gif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/beavis.jpg b/tests/benchmarks/gui/image/qimagereader/images/beavis.jpg new file mode 100644 index 0000000..d555047 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/beavis.jpg differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/black.png b/tests/benchmarks/gui/image/qimagereader/images/black.png new file mode 100644 index 0000000..6c94085 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/black.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/black.xpm b/tests/benchmarks/gui/image/qimagereader/images/black.xpm new file mode 100644 index 0000000..d7925bf --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/black.xpm @@ -0,0 +1,65 @@ +/* XPM */ +static char * ddd_xpm[] = { +/* $Id: ddd.xpm,v 1.5 1999/08/19 11:30:07 andreas Exp $ + * DDD Logo. Copyright (C) 1997 TU Braunschweig, Germany. + * For details on DDD, see `http://www.gnu.org/software/ddd/'. + * width height ncolors chars_per_pixel */ +" 48 48 8 1", +/* Colors */ +" c None m None g None g4 None s Background ", +". c black m black g black g4 black s Legs ", +"X c grey m white g grey g4 grey s Body ", +"- c grey m white g grey g4 grey s Border ", +"o c #000040 m black g grey25 g4 grey25 s Handle1 ", +"O c blue4 m black g grey25 g4 grey25 s Handle2 ", +"+ c white m white g white g4 white s Light ", +"* c DarkGreen m black g grey25 g4 grey25 s Eye ", +/* Pixels */ +" . . ", +" . .. ", +" . . ", +" .. . ", +" .. .. .. ", +" .. . . . ", +" . . . . .. ", +" . .X. . ", +" . *.X.* .. ", +" .. .. .XXX. .. ... ", +" . .X...XXX...X. . ", +" .. ..XXX.XXX.XXX. .. ", +" .....XXXX...XXXX. . ", +" .. ..XXXXXXXXX.. .. ", +" ...XXXXXXX..... ", +" ......... ", +" .XXXXXXX. ", +" .....XXX..... ", +" .XXXXXoOOOOOOX. ... ", +" .. ..XXXoOOO-----OOO..... ", +" .........XXoO-----..----O .. ", +" .. ..X..oO--.........--O .. ", +" . ..XXXoO--..++.......--O .. ", +" .. .XXXXO-XXX+++XXXXXXXXX-O . ", +" .. .....oO-XX+++XXXXXXXXXXX-O .. ", +" .. .XXXoO--XX++XXXXXXXXXXXX-O .. ", +" .. ..XXXoO-..+++............-O .. ", +" . .. .XXoO--..++.............-OO .. ", +" . ... ...oO--..................-O ", +".. . .XXoO-XXXXXXXXXXXXXXXXXXX-O ", +" .. .XXoO-XXXXXXXXXXXXXXXXXXX-O ", +" .. .XoO-XXXXXXXXXXXXXXXXXXX-O. ", +" . ...oO-.................-O .. ", +" . .XXoO-.................-O .. ", +" . ..XoO-.................-O .. ", +" . ...oO-XXXXXXXXXXXXXXX-OOO . ", +" .. .XoOO-XXXXXXXXXXXXX-OOOOO . ", +" .. ..XoOO---.......---OOOOOO . ", +" .. ....oOO---...----OOOOOOOO ", +" . .XX..oOO-----OOOOOOOOOOO ", +" . .....OOOOOOOOooOOOOOOOOO ", +" . .XXooooooOo oOOOOOOOOO ", +" . .XXX. ooOOOOOOO ", +" .. ... ooOOOOOO ", +" . ooOOOOOO ", +" ooOOOOOO ", +" ooOOOOOO ", +" ooOOOOOO "}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/colorful.bmp b/tests/benchmarks/gui/image/qimagereader/images/colorful.bmp new file mode 100644 index 0000000..8ea6f4a Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/colorful.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt-colors.xpm b/tests/benchmarks/gui/image/qimagereader/images/corrupt-colors.xpm new file mode 100644 index 0000000..f8d80ed --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/corrupt-colors.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *marble_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 240 240 223 2", +/* colors */ +".. c #959595", +".# c #c5c5c5", +".a c #adadad", +".b c #dedede", +".c c #b7b7b7", +".d c #d2d2d2", +".e c #bebebe", +".f c #c9c9c9", +".g c #b8b8b8", +".h c #d6d6d6", +".i c #9e9e9e", +".j c #eaeaea", +".k c #b2b2b2", +".l c #cecece", +".m c #a5a5a5", +".n c #e4e4e4", +".o c #c4c4c4", +".p c #d9d9d9", +".q c #b1b1b1", +/* pixels */ +"aYbla9aN.N#x", diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt-data.tif b/tests/benchmarks/gui/image/qimagereader/images/corrupt-data.tif new file mode 100644 index 0000000..d63c688 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/corrupt-data.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt-pixels.xpm b/tests/benchmarks/gui/image/qimagereader/images/corrupt-pixels.xpm new file mode 100644 index 0000000..21031ee --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/corrupt-pixels.xpm @@ -0,0 +1,7 @@ +/* XPM */ +static char * test_xpm[] = { +"256 256 1 1", +" c grey", +" ", +" ", +" "}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt.bmp b/tests/benchmarks/gui/image/qimagereader/images/corrupt.bmp new file mode 100644 index 0000000..824190b Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/corrupt.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt.gif b/tests/benchmarks/gui/image/qimagereader/images/corrupt.gif new file mode 100644 index 0000000..0725945 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/corrupt.gif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt.jpg b/tests/benchmarks/gui/image/qimagereader/images/corrupt.jpg new file mode 100644 index 0000000..1959662 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/corrupt.jpg differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt.mng b/tests/benchmarks/gui/image/qimagereader/images/corrupt.mng new file mode 100644 index 0000000..17fd43a Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/corrupt.mng differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt.png b/tests/benchmarks/gui/image/qimagereader/images/corrupt.png new file mode 100644 index 0000000..9d8911c Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/corrupt.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/corrupt.xbm b/tests/benchmarks/gui/image/qimagereader/images/corrupt.xbm new file mode 100644 index 0000000..8510634 --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/corrupt.xbm @@ -0,0 +1,5 @@ +#define noname_width 271 +#define noname_height 273 +static char noname_bits[] = { + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/crash-signed-char.bmp b/tests/benchmarks/gui/image/qimagereader/images/crash-signed-char.bmp new file mode 100644 index 0000000..b35cda6 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/crash-signed-char.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/earth.gif b/tests/benchmarks/gui/image/qimagereader/images/earth.gif new file mode 100644 index 0000000..2c229eb Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/earth.gif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/fire.mng b/tests/benchmarks/gui/image/qimagereader/images/fire.mng new file mode 100644 index 0000000..c6695c8 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/fire.mng differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/font.bmp b/tests/benchmarks/gui/image/qimagereader/images/font.bmp new file mode 100644 index 0000000..28b8c66 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/font.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/gnus.xbm b/tests/benchmarks/gui/image/qimagereader/images/gnus.xbm new file mode 100644 index 0000000..58d1ac8 --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/gnus.xbm @@ -0,0 +1,622 @@ +#define noname_width 271 +#define noname_height 273 +static char noname_bits[] = { + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfa,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x49,0xe0,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x97,0xaa,0x8a,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x57,0x2a,0x41,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa9,0x52,0x16,0xfe,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,0x49,0x05, + 0xf9,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0x95,0xaa,0x58,0xf4,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x7f,0xa5,0x54,0x26,0xe1,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x54,0x49,0x49,0xe4,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x2a,0xa5, + 0x2a,0xd1,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0xd5,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xaf,0x52,0x95,0x54,0xc4,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab, + 0x24,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x57,0x29,0xa9,0x92,0x11,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x57,0xd5,0xfa,0xff,0xff,0xab,0xea,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97,0x4a,0x55,0x2a,0x41,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x25,0x29,0xe5,0xff,0xff,0x95,0xa4,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa7,0xa4, + 0x24,0xa5,0x14,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,0xa5,0xd4,0xff, + 0x3f,0x52,0xa9,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x29,0x55,0x55,0x55,0x41,0x7e,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xa9,0x54,0xea,0xff,0xdf,0x2a,0x55,0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x4a,0x49,0x12,0x7e,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0x55,0xa5,0x92,0xff,0x23,0xa5,0x4a,0xd6,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa5,0xa4,0x94,0xaa,0x42, + 0x7d,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0x4a,0x2a,0xa9,0xff,0xad,0x92,0x24, + 0xa9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2a, + 0x95,0x52,0x52,0x29,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x52,0x49,0x55, + 0xfe,0x91,0x54,0x55,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0x49,0x29,0x55,0x25,0x85,0x7c,0xff,0xff,0xff,0xff,0xff,0xff, + 0x4f,0x95,0xaa,0x92,0x7e,0x55,0x55,0xa9,0x4a,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2a,0x50,0x95,0xaa,0x24,0x7e,0xff,0xff, + 0xff,0xff,0xff,0xff,0x57,0x2a,0x95,0x54,0x79,0x95,0x92,0x92,0x94,0xfc,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xb9,0x62,0x29,0x49, + 0x85,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x49,0x49,0x95,0xba,0xa4,0x54, + 0xaa,0x52,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf, + 0x1a,0xf8,0xa7,0xaa,0x22,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x52, + 0x2a,0x75,0x55,0xa5,0x24,0xa5,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xbf,0x5a,0xfd,0x57,0x92,0x94,0x7e,0xff,0xff,0xff,0xff,0xff, + 0xff,0x4a,0x4a,0x55,0x49,0x89,0x92,0x94,0xaa,0x94,0xf4,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x1a,0xfc,0x2f,0x55,0x05,0x7c,0xff, + 0xff,0xff,0xff,0xff,0xff,0x55,0xa9,0x4a,0x55,0x2a,0x55,0x55,0x55,0x55,0xe5, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x4e,0xfd,0x5f, + 0x29,0xa5,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0xa4,0x54,0x52,0x4a,0x55,0xa9, + 0xa4,0x24,0xa5,0x94,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x2f,0x1d,0xfe,0x3f,0x95,0x04,0x7c,0xff,0xfd,0xff,0xff,0xff,0x3f,0x49,0xa5, + 0x54,0xa9,0xa4,0x92,0x4a,0x49,0x4a,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xaf,0x44,0xfe,0x5f,0xa9,0x52,0x7d,0xff,0xe5,0xff,0xff, + 0xff,0x5f,0x55,0x92,0x2a,0x95,0x52,0x4a,0x52,0xaa,0x52,0x4a,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97,0x16,0xff,0xbf,0x4a,0x05,0x7c, + 0xff,0xd9,0xff,0xff,0xff,0x5f,0x95,0x42,0xa5,0x52,0x95,0xaa,0xaa,0xaa,0x94, + 0x54,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x43,0xfe, + 0xbf,0x54,0x52,0x7d,0x7f,0x25,0xff,0xff,0xff,0xa7,0xa4,0x28,0x92,0x54,0x4a, + 0xa5,0x4a,0x92,0xaa,0x4a,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xab,0x12,0xfe,0x7f,0xa5,0x02,0x7c,0x7f,0x55,0xfd,0xff,0xff,0x95,0x2a, + 0x82,0x54,0xa5,0x54,0x2a,0xa9,0x2a,0xa5,0x52,0xf5,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x27,0x4b,0xff,0xff,0x4a,0x29,0x7d,0xff,0x92,0xfe, + 0xff,0xff,0x55,0x92,0x20,0xa8,0x94,0x2a,0xa5,0x94,0x52,0x29,0xa9,0xf4,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97,0x01,0xff,0x7f,0x52,0x42, + 0x7c,0xff,0x25,0xf9,0xff,0x7f,0xaa,0x02,0x8a,0x40,0x29,0x49,0x09,0x41,0x4a, + 0x55,0x25,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x57, + 0xff,0xff,0x95,0x12,0x7d,0xff,0xa9,0xfa,0xff,0x7f,0x25,0xa9,0x20,0x2a,0xa5, + 0xaa,0x42,0x92,0x54,0x92,0x54,0x95,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xaf,0x83,0xff,0xff,0xa9,0x42,0x7e,0xff,0xaa,0xf4,0xff,0xaf,0x54, + 0x01,0x82,0x80,0xaa,0x54,0x14,0x08,0xa2,0xaa,0x4a,0xd2,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xef,0xcf,0xd7,0xff,0xff,0x52,0x12,0x7f,0xff,0x4a, + 0xea,0xff,0x57,0x92,0xaa,0x28,0x24,0x29,0x25,0x81,0x82,0x08,0x49,0x52,0x55, + 0xff,0xff,0xff,0xff,0xbf,0xff,0xff,0xff,0xff,0xdf,0xef,0xe7,0xff,0xff,0x2a, + 0x05,0x7e,0xff,0x55,0xd5,0xff,0xa5,0x2a,0x00,0x8e,0x10,0x4a,0x89,0x24,0x28, + 0xa0,0xaa,0x2a,0x49,0xff,0xff,0xff,0xff,0xbf,0xff,0xff,0xff,0xff,0xe7,0xff, + 0xef,0xff,0xff,0xa5,0x50,0x7e,0xff,0x25,0xe5,0xff,0x2a,0xa5,0x52,0x7f,0x85, + 0x54,0x35,0x08,0x82,0x0a,0x55,0x95,0xaa,0xfc,0xff,0xff,0xff,0xcf,0xff,0xff, + 0xff,0xff,0xd7,0xff,0xff,0xff,0x7f,0x52,0x85,0x7e,0xff,0xab,0x94,0x1e,0x55, + 0x2a,0xc8,0xff,0x10,0x90,0x92,0xa0,0x08,0x20,0x24,0x52,0x25,0xfd,0xff,0xff, + 0xff,0xef,0xff,0xff,0xff,0xff,0xe9,0xff,0xff,0xff,0xff,0x94,0x10,0x7e,0xff, + 0x93,0xaa,0x6a,0x49,0x49,0xf2,0xff,0x85,0x52,0x09,0x0a,0xa2,0x4a,0x92,0x29, + 0xa9,0xf2,0xff,0xff,0xff,0xd3,0xff,0xff,0xff,0xff,0xeb,0xff,0xff,0xff,0x7f, + 0x55,0x25,0x7f,0xff,0x55,0x49,0x49,0x95,0x0a,0xf9,0xff,0x17,0x48,0x26,0x50, + 0x08,0x00,0xa9,0x4a,0x95,0xfa,0xff,0xff,0xff,0xeb,0xff,0xff,0xff,0xff,0xf2, + 0xff,0xff,0xff,0xff,0x92,0x80,0x7e,0xff,0xa7,0x54,0xaa,0xa4,0x52,0xfc,0xff, + 0xaf,0x42,0x89,0xfa,0xbf,0x54,0x20,0xa9,0xa4,0xd4,0xff,0xff,0xff,0xcb,0xff, + 0xff,0xff,0xff,0xf5,0xff,0xff,0xff,0xff,0x54,0x29,0x7f,0xff,0x4b,0xa5,0x92, + 0x2a,0x01,0xff,0xff,0x1f,0xa8,0x22,0xff,0xff,0x01,0xa5,0x2a,0x55,0xa9,0xff, + 0xff,0xff,0xd4,0xff,0xff,0xff,0x7f,0xfa,0xff,0xff,0xff,0x7f,0xa5,0x04,0x7f, + 0xff,0x57,0x2a,0x55,0xa9,0x54,0xfe,0xff,0x3f,0x05,0x89,0xff,0xff,0x5f,0x48, + 0x92,0x2a,0x95,0xff,0xff,0xff,0xea,0xff,0xff,0xff,0xff,0xd2,0xff,0xff,0xff, + 0x7f,0x2a,0x91,0x7f,0xff,0xa9,0x54,0x4a,0x52,0x02,0xff,0xff,0xff,0x50,0xd1, + 0xff,0xff,0x1f,0x81,0xaa,0xa4,0x52,0xfe,0xff,0x3f,0xe9,0xff,0xff,0xff,0x7f, + 0x1d,0xff,0xff,0xff,0xff,0x54,0x41,0x7f,0xff,0x93,0x92,0x52,0x95,0xc8,0xff, + 0xff,0xff,0x8b,0xc4,0xff,0xff,0x7f,0x24,0xa5,0x2a,0x49,0xf9,0xff,0x7f,0xd5, + 0xff,0xff,0xff,0xbf,0x4a,0xff,0xff,0xff,0xff,0x4a,0x14,0x7f,0xff,0x28,0xa5, + 0x94,0x2a,0xa0,0xff,0xff,0x7f,0x22,0xf0,0xff,0xff,0x7f,0x12,0x94,0xa4,0xaa, + 0xea,0xff,0xaf,0xea,0xff,0xff,0xff,0x5f,0x8e,0xff,0xff,0xff,0x7f,0xa9,0x40, + 0x7f,0xff,0x48,0x55,0x55,0x12,0xca,0xff,0xff,0xff,0x0a,0xf5,0xff,0xff,0xff, + 0x80,0x52,0x95,0x54,0xaa,0xfe,0x55,0xc4,0xff,0xff,0xff,0x5f,0xa5,0xff,0xff, + 0xff,0xff,0x94,0x14,0x7f,0xff,0x52,0x2a,0xa9,0x4a,0xe1,0xff,0xff,0xbf,0x24, + 0xf0,0xff,0xff,0xff,0x0b,0x28,0xa9,0x92,0x24,0x55,0x49,0xe5,0xd7,0xff,0xff, + 0xa7,0x8a,0xff,0xff,0xff,0x7f,0xa5,0xc0,0x7f,0xff,0x50,0x49,0x95,0x04,0xf8, + 0xff,0xff,0x5f,0x1f,0xfd,0xff,0xff,0xff,0x47,0x45,0x55,0xaa,0xaa,0x4a,0xaa, + 0xea,0xaf,0xff,0xff,0x2b,0xc3,0xff,0xff,0xff,0x7f,0x55,0x94,0x7f,0x7f,0x4a, + 0x55,0x52,0x51,0xfe,0xff,0xff,0x5f,0x4e,0xf8,0xff,0xff,0xff,0x1f,0x50,0x92, + 0x52,0x49,0xa9,0x92,0xe4,0xd3,0xff,0xff,0x4b,0xd5,0xff,0xff,0xff,0xff,0x94, + 0xc0,0x7f,0x3f,0xa0,0xa4,0xaa,0x04,0xfe,0xff,0xff,0xa7,0x1d,0xfd,0xff,0xff, + 0xff,0x9f,0x84,0xaa,0x4a,0xaa,0x24,0x55,0xf2,0x2b,0xff,0x7f,0xa9,0xc1,0xff, + 0xff,0xff,0x7f,0x4a,0x95,0x7f,0xbf,0x2a,0x95,0x24,0x50,0xff,0xff,0xff,0x97, + 0x5e,0xfe,0xff,0xff,0xff,0x3f,0x92,0x24,0x95,0x92,0xaa,0xa4,0xf2,0xcb,0xff, + 0x5f,0xd5,0xe5,0xff,0xff,0xff,0xff,0x52,0x80,0x7f,0x3f,0xa0,0x52,0x15,0x85, + 0xff,0xff,0xff,0xd7,0x38,0xfe,0xff,0xff,0xff,0xff,0x20,0xaa,0x52,0x55,0x55, + 0x55,0xf9,0x29,0xfd,0xab,0xa4,0xf0,0xff,0xff,0xff,0x7f,0x29,0xa9,0x7f,0xff, + 0x42,0x25,0x49,0xe8,0xff,0xff,0xff,0x69,0x7a,0xff,0xff,0xff,0xff,0xff,0x82, + 0x52,0xaa,0x24,0x89,0x4a,0xf8,0x55,0x2a,0x49,0x95,0xf5,0xff,0xff,0xff,0xbf, + 0x2a,0xc4,0x7f,0x7f,0x90,0x54,0x15,0xe2,0xff,0xff,0xff,0x25,0xbc,0xff,0xff, + 0xff,0xff,0xff,0x29,0x48,0x49,0xaa,0xaa,0xa4,0xfa,0x95,0x92,0x54,0x52,0xf0, + 0xff,0xff,0xff,0xbf,0x4a,0xd1,0x7f,0xff,0x05,0xaa,0x40,0xf8,0xff,0xff,0x7f, + 0xaa,0xfc,0xff,0xff,0xff,0xff,0xff,0x43,0xa9,0xaa,0x4a,0x52,0xa9,0xf8,0xa4, + 0xaa,0x52,0x95,0xfc,0xff,0xff,0xff,0x7f,0x52,0xc0,0x7f,0xff,0xa1,0x00,0x24, + 0xfa,0xff,0xff,0xff,0x0a,0xfe,0xff,0xff,0xff,0xff,0xff,0x17,0x92,0x24,0xa5, + 0x2a,0x55,0xfe,0xaa,0xa4,0x2a,0x29,0xf9,0xff,0xff,0xff,0xbf,0x2a,0xea,0x7f, + 0xff,0x05,0x92,0x90,0xfc,0xff,0xff,0xbf,0xa4,0xff,0xff,0xff,0xff,0xff,0xff, + 0x4f,0xa0,0xaa,0x54,0x49,0x25,0x7c,0x49,0x95,0xa4,0x12,0xfc,0xff,0xff,0xff, + 0x7f,0x8a,0xe0,0x7f,0xff,0xa3,0x04,0x05,0xfe,0xff,0xff,0xbf,0x06,0xff,0xff, + 0xff,0xff,0xff,0xff,0x1f,0x49,0x95,0x52,0xaa,0x12,0x7f,0x55,0x52,0x55,0x0a, + 0xfd,0xff,0xff,0xff,0x3f,0x29,0xe8,0x7f,0xff,0x0f,0x50,0x50,0xff,0xff,0xff, + 0x5f,0xca,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x04,0xa9,0x4a,0x25,0x45,0x3e, + 0xa9,0x2a,0xa9,0xa2,0xfc,0xff,0xff,0xff,0x7f,0x55,0xe1,0x7f,0xff,0x27,0x05, + 0xc4,0xff,0xff,0xff,0x9f,0x91,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x41,0x4a, + 0x29,0xa9,0x12,0x5e,0x95,0x94,0x4a,0x0a,0xfe,0xff,0xff,0xff,0xbf,0x12,0xf4, + 0x7f,0xff,0x8f,0x50,0xf1,0xff,0xff,0xff,0xa7,0xc2,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x14,0x92,0xaa,0x4a,0xa2,0xbf,0xa4,0x52,0x95,0x22,0xff,0xff,0xff, + 0xff,0x3f,0x45,0xf2,0x7f,0xff,0x3f,0x04,0xf4,0xff,0xff,0xff,0xd7,0xe8,0xff, + 0xff,0xff,0xff,0x5f,0xff,0xff,0x83,0xa8,0x94,0x54,0x09,0x2f,0x55,0x4a,0x52, + 0x49,0xff,0xff,0xff,0xff,0x5f,0x99,0xf0,0x7f,0xff,0x7f,0x51,0xfc,0xff,0xff, + 0xff,0x6b,0xf1,0xff,0xff,0xff,0xff,0x5f,0xfd,0xff,0x2b,0x2a,0xa9,0x12,0x20, + 0x5f,0xa9,0xaa,0x54,0x00,0xff,0xff,0xff,0xff,0x5f,0x15,0xf2,0x7f,0xff,0xff, + 0x8f,0xff,0xff,0xff,0xff,0x2b,0xfc,0xff,0xff,0xff,0xff,0x2f,0xfd,0xff,0x87, + 0xa0,0x4a,0xaa,0x8a,0x9f,0x4a,0x52,0x15,0xa9,0xff,0xff,0xff,0xff,0x5f,0x8a, + 0xfc,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x94,0xf8,0xff,0xff,0xff,0xff, + 0x57,0xf2,0xff,0x2f,0x82,0x52,0x05,0xd0,0x2f,0x95,0x4a,0x49,0x84,0xff,0xff, + 0xff,0xff,0xbf,0x24,0xf8,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x12,0xfd, + 0xff,0xff,0xff,0xff,0x4b,0xd5,0xff,0x9f,0x28,0x54,0x48,0xc5,0xbf,0x52,0x55, + 0x0a,0xe1,0xff,0xff,0xff,0xff,0x9f,0x4a,0xfa,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x1a,0xfe,0xff,0xff,0xff,0xff,0x57,0xa9,0xff,0x3f,0x82,0x00,0x21, + 0xf0,0x5f,0x2a,0x49,0x21,0xc4,0xff,0xff,0xff,0xff,0xaf,0x1a,0xfd,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0x3f,0x85,0xff,0xff,0xff,0xff,0xff,0x29,0xa5,0xff, + 0xff,0x24,0x52,0x88,0xfc,0xbf,0x92,0x2a,0x09,0xf1,0xff,0xff,0xff,0xff,0x9f, + 0x4c,0xfc,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x15,0xff,0xff,0xff,0x7f, + 0xff,0xa5,0x4a,0xff,0xff,0x90,0x08,0x01,0xfe,0x3f,0x55,0x52,0x24,0xf4,0xff, + 0xff,0xff,0xff,0xaf,0x02,0xfd,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xc6, + 0xff,0xff,0xff,0xbf,0xfe,0x95,0x54,0xff,0xff,0x05,0x42,0xa8,0xfe,0xbf,0xa4, + 0x2a,0x41,0xf9,0xff,0xff,0xff,0xff,0x5f,0x55,0xfc,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0x4f,0xd0,0xff,0xff,0xff,0xbf,0x7c,0xaa,0x92,0xfc,0xff,0x53,0x08, + 0x01,0xff,0x1f,0x4a,0x01,0x04,0xfc,0xff,0xff,0xff,0xff,0x27,0x05,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xc5,0xff,0xff,0xff,0x4f,0xbf,0x52,0xaa, + 0xfe,0xff,0x07,0x42,0xea,0xff,0xbf,0x50,0x54,0x51,0xff,0xff,0xff,0xff,0xff, + 0x97,0x56,0xfe,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xf0,0xff,0xff,0xff, + 0x2f,0x7f,0xa5,0x54,0xfd,0xff,0x3f,0x09,0xe0,0xff,0x1f,0x02,0x01,0x04,0xff, + 0xff,0xff,0xff,0xff,0xaf,0x02,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x4b, + 0xf5,0xff,0xff,0xff,0xab,0x9f,0x94,0x92,0xfc,0xff,0xff,0x40,0xfd,0xff,0x9f, + 0x48,0x48,0xa1,0xff,0xff,0xff,0xff,0xff,0xa7,0x56,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0x6b,0xf8,0xff,0xff,0xff,0xa4,0x5f,0xa9,0x2a,0xfd,0xff,0xff, + 0xff,0xff,0xff,0x3f,0x22,0x21,0xc4,0xff,0xff,0xff,0xff,0xff,0x2f,0x03,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0xfa,0xff,0xff,0x7f,0xd5,0x2f,0xa5, + 0xa4,0xfa,0xff,0xff,0xff,0xff,0xff,0xbf,0x08,0x08,0xf9,0xff,0xff,0xff,0xff, + 0xff,0x97,0x4a,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x94,0xfc,0xff,0xff, + 0x7f,0x69,0xac,0x2a,0x55,0xf9,0xff,0xff,0xff,0xff,0xff,0x7f,0xa2,0x22,0xf8, + 0xff,0xff,0xff,0xff,0xff,0x53,0x21,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0x15,0xfe,0xff,0xff,0x9f,0x2a,0x95,0x94,0x92,0xf4,0xff,0xff,0xff,0xff,0xff, + 0xff,0x08,0x88,0xfe,0xff,0xff,0xff,0xff,0xff,0x57,0x8b,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xa9,0xfe,0xff,0xff,0x5f,0x52,0xbc,0x52,0x55,0xf5,0xff, + 0xff,0xff,0xff,0xff,0xff,0x21,0x21,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0xa1, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x7f,0x0d,0xff,0xff,0xff,0x57,0x15,0x3f, + 0x55,0x49,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0xc8,0xff,0xff,0xff,0xff, + 0xff,0xff,0xd7,0x89,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xbf,0xd6,0xff,0xff, + 0xff,0x4b,0x45,0x3f,0x49,0xaa,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf9, + 0xff,0xff,0xff,0xff,0xff,0xff,0xc9,0xe2,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0x3f,0x81,0xff,0xff,0xff,0x29,0x11,0x5f,0x28,0x55,0xf5,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab,0xc8,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0x5f,0xd6,0xff,0xff,0x7f,0xaa,0xc2,0x0f,0x55,0x49,0xea, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa5, + 0xe2,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x9f,0xe1,0xff,0xff,0xbf,0x4a,0xd1, + 0x5f,0x48,0xa5,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xe9,0xe0,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x27,0xf4,0xff, + 0xff,0xbf,0x94,0xc4,0x07,0x91,0x2a,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xca,0xea,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xaf,0xf1,0xff,0xff,0x9f,0x52,0xe0,0x4b,0x44,0x52,0xe9,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6a,0xe0,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0x4b,0xfc,0xff,0xff,0xab,0x2a,0xf5,0x0f,0x51,0xa5, + 0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0x69,0xe5,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x55,0xf8,0xff,0xff,0x95,0x14, + 0xf0,0x5f,0x84,0x54,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0x75,0xf0,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x13,0xfd, + 0xff,0xff,0xa5,0x42,0xf9,0x7f,0x91,0x4a,0xf5,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xfa,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0x54,0xfe,0xff,0x7f,0x52,0x12,0xfa,0xff,0x20,0xa5,0xe4,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x34,0xf8,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0x25,0xff,0xff,0xaf,0xaa,0x48,0xfc,0xff,0x0b, + 0x29,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xb5,0xf8,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x52,0xff,0xff,0x2f,0x49, + 0x02,0xfe,0xff,0x43,0xaa,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x3f,0x3a,0xfa,0xff,0x7f,0xff,0xff,0xff,0xff,0x7f,0x4a, + 0xff,0xff,0xa5,0x2a,0xa9,0xff,0xff,0x17,0x25,0xe9,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x9a,0xfc,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0x2a,0xff,0x7f,0x95,0x54,0x80,0xff,0xff,0x07,0xa9,0xea,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x1d,0xfc, + 0xff,0x7f,0xff,0xff,0xff,0xff,0x3f,0xa9,0xfe,0x7f,0xa9,0x12,0xe5,0xff,0xff, + 0x5f,0x4a,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x5f,0xad,0xfe,0xff,0x7f,0xff,0xff,0xff,0xff,0x7f,0x95,0xea,0x97,0x54, + 0x4a,0xf0,0xff,0xff,0x1f,0xa8,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x5f,0x0e,0xfe,0xff,0x7f,0xff,0xff,0xff,0xff,0x5f, + 0x52,0x55,0xa9,0x92,0x02,0xfd,0xff,0xff,0x5f,0x53,0xf5,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x5e,0xfe,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xbf,0x2a,0x49,0x4a,0x55,0x49,0xfc,0xff,0xff,0x3f,0x94,0xf8, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0x0f, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x4f,0xa5,0xaa,0x92,0xa4,0x20,0xff,0xff, + 0xff,0xbf,0xa4,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x5f,0x57,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x5f,0x52,0x52,0xaa, + 0x2a,0x0a,0xff,0xff,0xff,0x7f,0x54,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x8f,0x07,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xa7,0x94,0x4a,0x55,0x4a,0xa0,0xff,0xff,0xff,0xff,0xa8,0xfa,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x57,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0x2f,0x55,0xa9,0x92,0x12,0xe9,0xff,0xff,0xff,0x7f,0x24, + 0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf, + 0x87,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x57,0xa5,0x4a,0xaa,0x44,0xf4,0xff, + 0xff,0xff,0xff,0x55,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xa7,0xab,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xab,0x94,0xa4, + 0x92,0x12,0xf9,0xff,0xff,0xff,0xff,0xa8,0xfa,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xab,0x83,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0x47,0xa9,0x2a,0x55,0x40,0xfc,0xff,0xff,0xff,0xff,0x25,0xf5,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xd7,0x97,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0x33,0x55,0xa9,0x24,0x15,0xfe,0xff,0xff,0xff,0xff, + 0x95,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xff,0xff,0xff,0xff,0xff, + 0x93,0xc3,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x57,0x25,0xa5,0x2a,0x40,0xff, + 0xff,0xff,0xff,0xff,0xa9,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe3,0xff, + 0xff,0xff,0xff,0xff,0xe7,0xd5,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x4b,0x92, + 0x54,0x92,0xd4,0xff,0xff,0xff,0xff,0xff,0x55,0xf5,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xe9,0xff,0xff,0xff,0xff,0xff,0xd5,0xc1,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0x97,0xaa,0x4a,0x05,0xe2,0xff,0xff,0xff,0xff,0xff,0x25,0xf1,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xe3,0xfd,0xff,0xff,0xff,0xff,0xd5,0xea,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0x57,0x55,0x25,0xa1,0xf0,0xff,0xff,0xff,0xff, + 0xff,0x95,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe8,0xfa,0xff,0xff,0xff, + 0xff,0xea,0xe0,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xa7,0x24,0x59,0x04,0xfa, + 0xff,0xff,0xff,0xff,0xff,0xa9,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe2, + 0xfd,0xff,0xff,0xff,0xff,0xc9,0xe9,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x4f, + 0x52,0x05,0xa1,0xfc,0xff,0xff,0xff,0xff,0xff,0xa5,0xfa,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x70,0xf9,0xff,0xff,0xff,0xff,0x74,0xe2,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0x47,0x95,0x92,0x04,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0xf8, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xe2,0xfa,0xff,0xff,0xff,0xff,0x72,0xe8, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x97,0xaa,0x20,0xd0,0xff,0xff,0xff,0xff, + 0xff,0xff,0x55,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xb8,0xfc,0xff,0xff, + 0xff,0xff,0xea,0xe2,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x07,0x04,0x82,0xc2, + 0xff,0xff,0xff,0xff,0xff,0xff,0x29,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0x71,0xfd,0xff,0xff,0xff,0x7f,0x2a,0xf8,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0x4f,0x91,0x28,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0xfc,0xff,0xff,0xff, + 0xff,0xff,0xff,0x1f,0x54,0xfe,0xff,0xff,0xff,0x7f,0x75,0xf2,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0x27,0x44,0x82,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0x29, + 0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0xb8,0xfc,0xff,0xff,0xff,0xbf,0x14, + 0xf1,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x0f,0x11,0x20,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x55,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x9a,0xfe,0xff, + 0xff,0xff,0x7f,0x5a,0xf8,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x5f,0x40,0x85, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x4f,0x2d,0xfd,0xff,0xff,0xff,0x9f,0x12,0xf9,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0x3f,0x14,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0xfe,0xff,0xff, + 0xff,0xff,0xff,0xff,0x07,0xa6,0xfe,0xff,0xff,0xff,0x5f,0x4d,0xfa,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0x40,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x09,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x4b,0xfe,0xff,0xff,0xff,0xbf, + 0x2c,0xf8,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xf5,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x43,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x57,0xff, + 0xff,0xff,0xff,0x5f,0x0a,0xfe,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x89,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xd5,0xa9,0xff,0xff,0xff,0xff,0xaf,0x5a,0xfc,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa3,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x81,0x95,0xff,0xff,0xff,0xff,0x9f,0x06,0xfd,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xc9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xca,0xa5,0xff,0xff,0xff,0xff, + 0x2f,0x95,0xfc,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0xea, + 0xff,0xff,0xff,0xff,0xaf,0x26,0xfe,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd5,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xf5,0xf4,0xff,0xff,0xff,0xff,0xaf,0x86,0xfe,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc1,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0x70,0xe5,0xff,0xff,0xff,0xff,0x4f,0x2e,0xfe, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xb2,0xfa,0xff,0xff,0xff, + 0xff,0x57,0x83,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xf3,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x78, + 0xf2,0xff,0xff,0xff,0xff,0xa7,0x22,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x5f,0x5d,0xfd,0xff,0xff,0xff,0xff,0x97,0x87,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x3c,0xfd,0xff,0xff,0xff,0xff,0x53,0xa3, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xac,0xfe,0xff,0xff, + 0xff,0xff,0x57,0x95,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, + 0x9e,0xfe,0xff,0xff,0xff,0xff,0x97,0x81,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xa7,0x57,0xfe,0xff,0xff,0xff,0xff,0xa9,0xa5,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0xaf,0xff,0xff,0xff,0xff,0xff,0x4b, + 0x89,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab,0x93,0xff,0xff, + 0xff,0xff,0xff,0x95,0xa2,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x83,0xab,0xff,0xff,0xff,0xff,0xff,0xd3,0xc8,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xff, + 0xff,0xff,0xff,0xff,0xe9,0xa5,0xff,0xff,0xff,0xff,0xff,0xa5,0xe1,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xd5,0xff,0xff,0xff,0xff,0xff, + 0xd5,0xc8,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xea,0xea,0xff, + 0xff,0xff,0xff,0xff,0x14,0xc1,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff, + 0xff,0xe0,0xe4,0xff,0xff,0xff,0xff,0xff,0x65,0xe8,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf, + 0xff,0xff,0xff,0xff,0x3f,0x72,0xe9,0xff,0xff,0xff,0xff,0xff,0x6a,0xe1,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xbf,0xb8,0xfa,0xff,0xff,0xff,0xff, + 0xff,0x52,0xea,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd3,0xff,0xff,0xff,0xff,0x1f,0x7a,0xf5, + 0xff,0xff,0xff,0xff,0x7f,0x2a,0xe0,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xff,0xff,0xff, + 0xff,0x8f,0x58,0xfa,0xff,0xff,0xff,0xff,0x7f,0x25,0xf5,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xb5,0xff,0xff,0xdf,0xff,0x57,0x5e,0xfd,0xff,0xff,0xff,0xff,0xff,0x34,0xe0, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xca,0xff,0xff,0x8f,0xff,0x07,0xac,0xfc,0xff,0xff,0xff, + 0xff,0x7f,0x2a,0xf5,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd4,0xff,0xff,0x57,0xff,0x2b,0x2d, + 0xfd,0xff,0xff,0xff,0xff,0xff,0xb2,0xf0,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd2,0xff,0xff, + 0x07,0xff,0x43,0x4a,0xff,0xff,0xff,0xff,0xff,0xbf,0x2a,0xf8,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x3f,0xc5,0xff,0xff,0x2b,0xfe,0x08,0xab,0xfe,0xff,0xff,0xff,0xff,0x7f,0xaa, + 0xf2,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xbf,0xea,0xff,0xff,0x83,0x36,0x20,0x55,0xff,0xff,0xff, + 0xff,0xff,0x3f,0x15,0xf0,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0xc2,0xff,0xff,0x48,0x4a,0x85, + 0x49,0xff,0xff,0xff,0xff,0xff,0x7f,0x59,0xfa,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0xf5,0xff, + 0x7f,0x10,0x29,0x50,0xa5,0xff,0xff,0xff,0xff,0xff,0x3f,0x15,0xf9,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x97,0xe4,0xff,0x7f,0x05,0x95,0x42,0xd5,0xff,0xff,0xff,0xff,0xff,0x7f, + 0x35,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xab,0xea,0xff,0xbf,0xa0,0x24,0xa8,0xd4,0xff,0xff, + 0xff,0xff,0xff,0x7f,0x19,0xf9,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x27,0xe5,0xff,0x3f,0x92,0xaa, + 0x50,0xe9,0xff,0xff,0xff,0xff,0xff,0x9f,0x4a,0xfc,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa9,0xe2, + 0xff,0x9f,0xa0,0xaa,0x2a,0xf5,0xff,0xff,0xff,0xff,0xff,0x5f,0x1a,0xf9,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x95,0xf8,0xff,0x5f,0x4a,0x92,0x4a,0xf5,0xff,0xff,0xff,0xff,0xff, + 0xbf,0x4a,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0x52,0xf2,0xff,0x1f,0x20,0x49,0xa5,0xfa,0xff, + 0xff,0xff,0xff,0xff,0x5f,0x1a,0xfd,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaa,0xf8,0xff,0x47,0xa9, + 0x2a,0x29,0xf9,0xff,0xff,0xff,0xff,0xff,0xbf,0x0a,0xfc,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x49, + 0xf2,0xff,0x17,0x92,0xaa,0xaa,0xfe,0xff,0xff,0xff,0xff,0xff,0x9f,0xac,0xfe, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x9f,0x2a,0xf8,0xff,0x43,0xa8,0x24,0x25,0xff,0xff,0xff,0xff,0xff, + 0xff,0xaf,0x0a,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x94,0xfa,0xff,0x91,0x54,0xaa,0x52,0xff, + 0xff,0xff,0xff,0xff,0xff,0x2f,0x4d,0xfd,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0x45,0xfc,0xff,0x03, + 0x92,0x52,0xaa,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x06,0xfc,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf, + 0x12,0xfe,0xff,0x50,0xaa,0x2a,0x95,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0xa5, + 0xfe,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xa7,0x44,0xff,0xff,0x0a,0x25,0xa5,0xa4,0xff,0xff,0xff,0xff, + 0xff,0xff,0x97,0x06,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x15,0xff,0xff,0x40,0xa9,0x92,0xea, + 0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x55,0xfd,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0xa1,0xff,0x7f, + 0x92,0x4a,0xaa,0xd4,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x06,0xfc,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x95,0x8a,0xff,0x3f,0x84,0x54,0xa9,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0x2f, + 0x25,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x52,0xe0,0xff,0xbf,0x50,0xa9,0x4a,0xf2,0xff,0xff,0xff, + 0xff,0xff,0xff,0xa7,0x8e,0xfe,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xa9,0xea,0xff,0x3f,0x24,0x95,0x54, + 0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x23,0xfe,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x4a,0xf0,0xff, + 0x9f,0x50,0x69,0x49,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0x8b,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xa5,0xf4,0xff,0x0f,0x2d,0x75,0xaa,0xfa,0xff,0xff,0xff,0xff,0xff,0xff, + 0xaf,0x03,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x9f,0x14,0xfa,0xff,0x2f,0xa8,0xfa,0x25,0xfd,0xff,0xff, + 0xff,0xff,0xff,0xff,0x97,0xd7,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xaa,0xfc,0xff,0x0f,0x4d,0xfd, + 0xa9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf,0x83,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x12,0xfc, + 0xff,0x27,0x92,0xfe,0xcb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd7,0xd7,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x97,0x0a,0xff,0xff,0x83,0x56,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xef,0xc7,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xab,0x24,0xff,0xff,0x2b,0xaa,0xfe,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xe7,0xef,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x45,0xff,0xff,0x05,0x95, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0x82, + 0xff,0xff,0x51,0xa9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7, + 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xa9,0xe8,0xff,0xff,0x85,0xca,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0x52,0xc1,0xff,0xff,0x90,0xd5,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x4d,0xe8,0xff,0xff,0xa5, + 0xe4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x51, + 0xf2,0xff,0x7f,0x40,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x3f,0x95,0xf8,0xff,0x7f,0xa9,0xea,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0x15,0xfa,0xff,0x3f,0xa4,0xf4,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xa4,0xfc,0xff,0x7f, + 0x71,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f, + 0x15,0xfe,0xff,0x3f,0x94,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xa7,0x0a,0xff,0xff,0x1f,0x79,0xf2,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab,0xa4,0xff,0xff,0x5f,0x8c,0xfa,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x53,0x82,0xff,0xff, + 0x1f,0x5c,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xa4,0x92,0xff,0xff,0xbf,0x56,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x9a,0xc4,0xff,0xff,0x0f,0x2e,0xfd,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa2,0xf0,0xff,0xff,0xaf,0xa7,0xfe, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x55,0xe4,0xff, + 0xff,0x0f,0x57,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xbf,0x54,0xf2,0xff,0xff,0x9f,0x4b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x9f,0x92,0xf8,0xff,0xff,0xc7,0xab,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x15,0xfe,0xff,0xff,0x97,0xd7, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa7,0x94,0xfc, + 0xff,0xff,0xc7,0xe3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x2f,0x05,0xfe,0xff,0xff,0xcf,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x53,0xa9,0xff,0xff,0xff,0xd3,0xeb,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x05,0xff,0xff,0xff,0xe3, + 0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x54,0xc2, + 0xff,0xff,0xff,0xeb,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x95,0xc8,0xff,0xff,0xff,0xf3,0xfa,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xa5,0xd2,0xff,0xff,0xff,0xff,0xf5,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xaa,0xe0,0xff,0xff,0xff, + 0xff,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x49, + 0xf8,0xff,0xff,0xff,0xff,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x9f,0x2a,0xf5,0xff,0xff,0xff,0xff,0xfd,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x4a,0xf8,0xff,0xff,0xff,0xff,0xfc,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x14,0xfd,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97, + 0x4a,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xab,0x04,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0x52,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x53,0x85,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x54,0xa2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x4a,0xc9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xa5,0xe0,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x94,0xe4,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x5f,0x55,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xbf,0x12,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0x54,0xfa,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x0a,0xfc, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x53,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x97,0x14,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x45,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x54,0x82, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x4a,0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x52,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x55,0xe8,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x24, + 0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0x55,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x24,0xf9,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x15,0xfe,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f, + 0x49,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x2f,0x95,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x01,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0xd5,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x57,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x97,0xd4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xe0,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x93,0xf4,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x57,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x2b,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x89,0xfc,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0xfc, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x05,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x49,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x22,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x89, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xe9,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, + 0xff,0xff,0xff,0x9f,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xf9,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xfc,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, + 0x6f,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xbf,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, + 0xff,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, + 0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/image.pbm b/tests/benchmarks/gui/image/qimagereader/images/image.pbm new file mode 100644 index 0000000..67e5efa --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/image.pbm @@ -0,0 +1,8 @@ +P1 +16 6 +1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 +1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 +1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 +1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 +1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 +1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 diff --git a/tests/benchmarks/gui/image/qimagereader/images/image.pgm b/tests/benchmarks/gui/image/qimagereader/images/image.pgm new file mode 100644 index 0000000..443bf40 --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/image.pgm @@ -0,0 +1,10 @@ +P2 +24 7 +15 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 +0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 +0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 +0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 +0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/benchmarks/gui/image/qimagereader/images/image.png b/tests/benchmarks/gui/image/qimagereader/images/image.png new file mode 100644 index 0000000..7d4890a Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/image.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/image.ppm b/tests/benchmarks/gui/image/qimagereader/images/image.ppm new file mode 100644 index 0000000..2a5640e --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/image.ppm @@ -0,0 +1,7 @@ +P3 +4 4 +15 + 0 0 0 0 0 0 0 0 0 15 0 15 + 0 0 0 0 15 7 0 0 0 0 0 0 + 0 0 0 0 0 0 0 15 7 0 0 0 +15 0 15 0 0 0 0 0 0 0 0 0 \ No newline at end of file diff --git a/tests/benchmarks/gui/image/qimagereader/images/kollada-noext b/tests/benchmarks/gui/image/qimagereader/images/kollada-noext new file mode 100644 index 0000000..2abd4bb Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/kollada-noext differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/kollada.png b/tests/benchmarks/gui/image/qimagereader/images/kollada.png new file mode 100644 index 0000000..2abd4bb Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/kollada.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/marble.xpm b/tests/benchmarks/gui/image/qimagereader/images/marble.xpm new file mode 100644 index 0000000..1c08049 --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/marble.xpm @@ -0,0 +1,470 @@ +/* XPM */ +static const char *marble_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 240 240 223 2", +/* colors */ +".. c #959595", +".# c #c5c5c5", +".a c #adadad", +".b c #dedede", +".c c #b7b7b7", +".d c #d2d2d2", +".e c #bebebe", +".f c #c9c9c9", +".g c #b8b8b8", +".h c #d6d6d6", +".i c #9e9e9e", +".j c #eaeaea", +".k c #b2b2b2", +".l c #cecece", +".m c #a5a5a5", +".n c #e4e4e4", +".o c #c4c4c4", +".p c #d9d9d9", +".q c #b1b1b1", +".r c #d8d8d8", +".s c #e0e0e0", +".t c #d6d6d6", +".u c #b6b6b6", +".v c #bfbfbf", +".w c #cbcbcb", +".x c #a5a5a5", +".y c #d1d1d1", +".z c #cdcdcd", +".A c #aaaaaa", +".B c #9a9a9a", +".C c #dedede", +".D c #aeaeae", +".E c #e6e6e6", +".F c #d3d3d3", +".G c #c8c8c8", +".H c #bababa", +".I c #c4c4c4", +".J c #cccccc", +".K c #bcbcbc", +".L c #f0f0f0", +".M c #b5b5b5", +".N c #e3e3e3", +".O c #c2c2c2", +".P c #adadad", +".Q c #c9c9c9", +".R c #e1e1e1", +".S c #a2a2a2", +".T c #d1d1d1", +".U c #bebebe", +".V c #dbdbdb", +".W c #dbdbdb", +".X c #c8c8c8", +".Y c #b9b9b9", +".Z c #a8a8a8", +".0 c #d3d3d3", +".1 c #9f9f9f", +".2 c #c1c1c1", +".3 c #ebebeb", +".4 c #b4b4b4", +".5 c #d9d9d9", +".6 c #cecece", +".7 c #e8e8e8", +".8 c #d6d6d6", +".9 c #c5c5c5", +"#. c #b0b0b0", +"## c #dadada", +"#a c #c5c5c5", +"#b c #d1d1d1", +"#c c #afafaf", +"#d c #b1b1b1", +"#e c #cbcbcb", +"#f c #c1c1c1", +"#g c #eeeeee", +"#h c #9b9b9b", +"#i c #c6c6c6", +"#j c #c0c0c0", +"#k c #cbcbcb", +"#l c #bdbdbd", +"#m c #a1a1a1", +"#n c #b7b7b7", +"#o c #a7a7a7", +"#p c #e6e6e6", +"#q c #c9c9c9", +"#r c #bbbbbb", +"#s c #e2e2e2", +"#t c #b8b8b8", +"#u c #cdcdcd", +"#v c #d3d3d3", +"#w c #cfcfcf", +"#x c #e0e0e0", +"#y c #d5d5d5", +"#z c #bdbdbd", +"#A c #cecece", +"#B c #c0c0c0", +"#C c #b7b7b7", +"#D c #e5e5e5", +"#E c #c4c4c4", +"#F c #e3e3e3", +"#G c #d3d3d3", +"#H c #dddddd", +"#I c #dddddd", +"#J c #acacac", +"#K c #a3a3a3", +"#L c #eaeaea", +"#M c #e1e1e1", +"#N c #b9b9b9", +"#O c #d5d5d5", +"#P c #bababa", +"#Q c #d7d7d7", +"#R c #b5b5b5", +"#S c #d1d1d1", +"#T c #c6c6c6", +"#U c #dcdcdc", +"#V c #b4b4b4", +"#W c #c6c6c6", +"#X c #a8a8a8", +"#Y c #a0a0a0", +"#Z c #cbcbcb", +"#0 c #bfbfbf", +"#1 c #cbcbcb", +"#2 c #a4a4a4", +"#3 c #c0c0c0", +"#4 c #bbbbbb", +"#5 c #9c9c9c", +"#6 c #a2a2a2", +"#7 c #dcdcdc", +"#8 c #c3c3c3", +"#9 c #9d9d9d", +"a. c #aaaaaa", +"a# c #d5d5d5", +"aa c #eeeeee", +"ab c #b6b6b6", +"ac c #b0b0b0", +"ad c #b3b3b3", +"ae c #c9c9c9", +"af c #e9e9e9", +"ag c #bdbdbd", +"ah c #a0a0a0", +"ai c #b0b0b0", +"aj c #e8e8e8", +"ak c #cacaca", +"al c #c3c3c3", +"am c #dbdbdb", +"an c #d0d0d0", +"ao c #d8d8d8", +"ap c #c7c7c7", +"aq c #dcdcdc", +"ar c #c7c7c7", +"as c #f0f0f0", +"at c #a3a3a3", +"au c #bfbfbf", +"av c #d9d9d9", +"aw c #dfdfdf", +"ax c #d3d3d3", +"ay c #c0c0c0", +"az c #cacaca", +"aA c #b3b3b3", +"aB c #cfcfcf", +"aC c #dadada", +"aD c #b2b2b2", +"aE c #e2e2e2", +"aF c #d7d7d7", +"aG c #c4c4c4", +"aH c #b8b8b8", +"aI c #cdcdcd", +"aJ c #a6a6a6", +"aK c #d2d2d2", +"aL c #cecece", +"aM c #acacac", +"aN c #dfdfdf", +"aO c #d5d5d5", +"aP c #c9c9c9", +"aQ c #bcbcbc", +"aR c #c6c6c6", +"aS c #cdcdcd", +"aT c #bebebe", +"aU c #f2f2f2", +"aV c #b6b6b6", +"aW c #e4e4e4", +"aX c #c3c3c3", +"aY c #e2e2e2", +"aZ c #d2d2d2", +"a0 c #dddddd", +"a1 c #dcdcdc", +"a2 c #ececec", +"a3 c #eaeaea", +"a4 c #cccccc", +"a5 c #c7c7c7", +"a6 c #c2c2c2", +"a7 c #cccccc", +"a8 c #a8a8a8", +"a9 c #e7e7e7", +"b. c #e4e4e4", +"b# c #d9d9d9", +"ba c #bababa", +"bb c #cfcfcf", +"bc c #d4d4d4", +"bd c #d0d0d0", +"be c #aeaeae", +"bf c #e1e1e1", +"bg c #d7d7d7", +"bh c #cfcfcf", +"bi c #b8b8b8", +"bj c #e6e6e6", +"bk c #c5c5c5", +"bl c #e4e4e4", +"bm c #d4d4d4", +"bn c #dfdfdf", +"bo c #dedede", +"bp c #ececec", +"bq c #bababa", +"br c #bcbcbc", +"bs c #b0b0b0", +"bt c #cccccc", +"bu c #a6a6a6", +"bv c #c1c1c1", +"bw c #bcbcbc", +"bx c #ababab", +"by c #d7d7d7", +"bz c #b7b7b7", +"bA c #b2b2b2", +"bB c #b4b4b4", +"bC c #bfbfbf", +/* pixels */ +"aYbla9a9a9.7#D.N#L#La9.7a9#D#D.7#D#D#DaY#x#xa0ama0ama0am#xbnbnbnaYaYaYaYaY#DaYaYaYbn#x#x#xaY.N#Da9a9a9a9a9a9a9a9a9.7a9a9a9#Da9#D#L#L#L#L#L#La2#La2a2a2a2a2a2#ga2#ga2#ga2a2#ga2a2#L#L#L#Lafa9a9a9bl#Dbl#Da9a9a9#L#L#Laf#L#Laf#L#L#L#L#L#L#L#L#L#La2#La2a2a2#La2#L#L#Laf#L#Laf#L#Laf#L#Laf#L#Laf#Laf#Laf#Laf#Laf#L#D#DblblaYaYaCa0.t.Fb#bnbnaCbnblblblblblaYaY.RaYblblblblblblblbla9a9a9a9a9a9#pa9a9#pa9#pa9#pa9#pa9#pa9a9bl#D#D#D#pa9#pafa9a9a9a9#L#Lafa9a9a9#D#D#pbl#U.V.Vb#.8am#xbn#IaYbl.N.N#x", +"am#I#Da9a9a9bj#D#La9.7#D#Da9#D#D#p#DaYaY#xbna0amamamb#a0a0a0a0bnawaYaYaYaYaYaYaY#xbnaY.R#xaYaY.Nafa9afa9afa9afa9.7a9.7a9bja9bja9#Lafa2afa2af#L#L.3#La2#La2bpa2#La2#ga2a2#ga2a2#g#L#Laf#L#La9afa9bl#Dbl#Da9afa9#L#Laf#L#Laf#L#Laf#L#L#L#L#L#L#L.7a2#La2a2#La2#La2#Laf#L#Laf#Laf#Lafajaf#L#Laf#L#L#Lafajafajafajaf.na9#s#Daw#xbnaCb#bg.Vbnbn.RaYaY#Mbl#pblaYblaYaYaYblblbl#D#Dbl#D#paf#pafa9#pa9afbla9#pa9#pa9#pa9#pa9#p#D#p#Da9#D#pa9#pa9#Da9#Da9af#L#La9.7#D#s#D#MaYbnaCb#aOb#aC#x#UaYaY#M#DaYbf", +"aOambn.sa9bja9.7a9.7a9#Da9bj#D#D#D#DaYaY#x#xa0amaFaFbgb#aF.Va0.VaYaYaYaYaYaYaYaYbn#xaY#xaY.N#D#Da9a9a9a9a9a9a9a9a9bja9#Da9#Da9#D#L#L#L#L#L#La2#La2afa2a2a2a2#ga2#g#La2bpa2bpa2#L#L#L#L#Lafa9a9#p#DaY#D#Da9a9.7a9af#Laf#L#Laf#Laf#L.7#L#L.7#L#L#L#La2a2a2#La2#L.3#Laf#Laf#Lajaf#Laja9#Lajaf#Lajafaja9#La9#La9#La9a9a9blaYaYaYawa0b#b#.paYaYblaY.Rbla9#pblblaYblaYa9#p#D#pa9#pa9#pa9a9a9#pa9a9#pa9bl#pa9#pa9#pa9#pa9#pa9a9#D#Dbla9a9a9a9a9#pa9a9a9#L#Lafa9a9#D#D#Da9awbn.pb#bgamaCbn#xaw#D#D#D.N#x", +"amamaC#x#D#s.7.7a9#Da9#D#D#D.N.N#xaYaYaY#xbna0a0aOaFb#aOb#bg.Vambna0bnaCa0aYaYaY#U.RaYaYaY#Dbl#Da9a9#La9af.7afa9.7a9.7a9bja9bja9#L#L.3#L.3#Laf#Lafa2#L#La2#La2bpa2a2#ga2#ga2a2#g#L#L#L#Lafa9afa9.Nblbl#Da9a9afa9#Laf#L#Laf#Laf#L#L#L#L#L#L#L.7#L#La2#L#La2aja2#Laj#Lafaj#Laf#L#Laf#Lafafajafaf#Lafaj#Lafajafaj#Laja9.n#D#MaY.R#xbga0bnbn.RaYbl#Ua9#pa9#D#Dbl#D#Dbl#Dbl#Dbla9#Da9a9#pafa9af#pa9#p#pa9#pa9#pa9#pa9#pa9#p#D#pa9#Da9a9af#pafa9af.7a9#Laf#L.7a9#s#D#saYaY#Ua0aObgao#x#IaYbl#D#s#D.sbf", +"amaOama0.N.Na9a9bja9#Dbj#D#D#DaY.N#x#x#x#xbnaCa0#H.Vbgb#b#aFbgambnbn#Ubnbnbnbnbn#xaYawaYbl#Da9#Da9a9a9a9a9a9a9a9a9bja9#Da9#sa9#D#Laf#L#L#L#La2a2a2afa2#La2#ga2a2#g#L#g#La2bpa2#L#L#L#Laf#La9a9#pbl#Dbl#Da9a9.7a9#Lajaf#Lajaf#Lajafafajafafajafaf.j#L.3a2#Laf#La2af#Laf#Laf#Laf#L.n#L.n#La9#L#Lafa9afa9aja9#La9af.7afa9#Dbl#IaYawa0a0#UbnaYblblaY#pa9#pa9#D#D#D#Dafa9afa9af#pa9#pa9afa9#pa9a9a9a9#pa9#pa9#p#pa9#pa9#pa9a9#D#Dbla9a9a9a9a9a9.7a9.7af#Laja9a9#D#D#saYawbnaCb#aobn#x.Nbl#s#D#D#D.N.N", +".CamaOao.WaY#D.7#s#Da9#D#D.NaY.N#x#I#xbn#xaY#x#U#xa0a0a0bgamb#ambga0ama0am#xa0a0.RaYaY#Dbl#Dbl#Da9a9a9a9afa9afa9.7a9#D.7#Dbja9.7af#La2#La2af#L#La2a2a2a2a2#L#g#L#ga2a2#ga2#ga2#g#L#L#L#Lafa9a9a9#Dawbl#Da9a9a9.7af#Laf#Laf#L#Laf#L#Laf#L#Laf#L#Laf#L.j#La2afajaf#Lafajaf.Eafaj#Laf#Laf#Lafaja9aj#Lajaf#Laf#Lafajafajaf.n#DblaYaYaCbn#xbnaYaYaY.Rbla9#p#Da9a9.7#La9a9a9a9a9afa9afa9a9afa9afa9afa9#p#pa9#pa9a9#pa9#pa9#p#D#pa9#Da9afafafaf.7a9a9.7#L#Lafa9.n#D#s#D#D#x#Ua0aCaC#x.saY.s#D.7a9.Ebj.N", +"#xa0.8a#.8.Cbf.N#D#D.N.NaY.N.saY#x#xaY#IaYaYaYaYaYaY#x#x#xa0aCam.Vb#bg#yb#.Va0bnaYaYblaY#Da9#D#Da9afa9af.7a9a9a9.7a9bja9#s#Da9.7ajaf#Laf#L#La2#L.3#La2#La2a2#ga2a2bpa2#L#g#La2bp#L#L#Laf#La9af#paYbl#D#Da9a9a9a9#L#L#Laf#Laf#L#Lafafafafaf#Lafaf#La2#La2afajaf#Lajaf.7af#Lafa9aja9aja9#L.n#Lafafa9#L.n#L.n#La9#Laf#La9a9#Mbl#xaY#x#IaYawaYaYaYaYblbl#pa9a9.7#L.7afaf#Laf#Lafa9afa9a9a9a9a9a9a9a9a9#pa9#pa9#pa9#pa9#pa9a9#D#D#Da9af#Lafa9a9a9.7af#Laja9a9#D#D#D#M.N#I#xaCa0#UaY#D.NaY#D.n.7bj#Dbj", +"#x#xa0#vbcaq#xbf#D#D.Nbl.s.NaYbf#x#x#xaYaYaYaYaYaY#M.NaY#x#x.Ca0b#bgb#bgbg.V.p.VawaYblbl#Dbl#Dafa9a9a9a9afa9afa9.7a9#Da9#D#s#Da9af#La2#La2#Laf#La2#La2#La2bpa2bpa2#ga2#ga2#ga2a2#L#L#L#Lafa9a9a9aYaYbl#Da9afa9a9ajaf#Lajaf#Lajafafaj#Lafajafafajafa2#La2#Laf#Lafa9#Lafaja9aj#Laf#Lafajaf#Laf.7afaj#Laf#Lafajaf.Eafajaf.n#Dbl#MaY#IaY#xaY.RaY.RaY#FaYa9a9a9#L#L#Lafa9afafa9#Laf#L#La9afa9afa9afa9#pa9#pa9#pa9#pa9#pa9#p#D#p#Da9a9afa9a9.7a9#L.7.7.naf#La9.n#D#s.N.N#x#UaCbnaY#s#DaY#sa9.7b..7#DaW", +".7aw#x.CaoaB.y.5#s.N#I.Ca0a0ama0#x.N.NaY.NaY#D#Dbl#DblaYawaY#U.CbgbmaBaSaZbma0a0blaYaY#Dbla9a9#Da9af.7afa9a9a9a9bl#D#D#D#D.N#D#D.7a9a9a9a9a9#La9afafafafafaf#Lafa2#La2#L#L#L#La2a2a2af#La9a9#D#DawaY#sbla9b..7#La9a9a9a9.7a9a9a9afa9af.nafafafafafajafajafajafajafaja9a9bl#MaY#s#Da9#Da9#sa9.na9.7af.Eaf.7af#Lafafa9a9bl#M.NaY#Ibn#UaYaYaw#Da9a9.n#p#pa9a9.7.7.7.7a9.7a9.7a9a9#Lafafaf#Lafa9a9a9#pa9a9#pa9#pa9a9a9a9afa9.7af.7.7.7afa9a9a9a9a9a9#L.na9.na9.na9.n#Maw.Nawaw.N#D#D.E.7bj.7#Dbjb.#D", +".7#D.s#x.5.y#va#.NaYbf.Ca0ao#xbn.s.N.N#D#D#Da9#Dbl#Dbl#DaYaYaYbn.p.taBan#uaZ.FbgbnawaYawbl#D#D#D#D#Dbl#D#D#D#D#D#Dblblawbl.N#D#Da9a9a9.7af.7a9a9afafafajafaf#L#L#La2a2a2a2a2#La2#La2af#La9#D#D#DaYaY#D#D#Da9a9.7a9a9.7a9a9a9.7a9#Lafafafaf#Lafafaja9af#pafa9af#pajaf.na9#s#DblaYa9a9.na9a9a9#Da9aj#Lafaj#La9aja9ajaf.nbl#DaYaw#xa0#x.b#xaY#D#D#p#p#p.na9a9a9#L.7a9a9a9a9a9.7a9#Lafafafafafafa9af#p.na9#pa9a9a9afa9af.7a9#L.7#L#La9a9.7a9a9.7.na9a9a9.na9.na9.na9#D#MaYaw.N#s#D.n.7.7.n.7.E#D#D.7", +".7a9aY#xaCam#v#vaCaqa0aqama0#UaY.NaY#D#D#D#D#D#Da9#D#D#Dbl.NaY#Ibnambm#SaZa#a#b#aCa0a0#x#x#xaYbl#D#Da9#Dbl#Dbl#DblaYaYaYaYbl#D#Da9a9a9afa9afafafafafafafafaf#Laf#L#L#Laf#Laf#Laf.j#L#L.n.7a9#s#Daw#x#M#Da9#Daj.7a9.na9.7.na9a9.naf#Lafajafafajafafafajafajafafaf#pa9bl#Mbl#Daw#D.n#Da9#D.na9.na9a9af.7afafajaf#Lafa9a9#sblaY#x#IbnbnaYaYawbla9a9#p#pbl#pa9#D.7.7a9.7a9.7a9a9#L#Lafaf#Lafafa9a9a9a9#pa9.n#pa9a9a9afa9a9#L#Laf.7afa9a9a9a9.7a9a9a9.naf.na9.na9.na9#M.Nawaw#D#s#D#Daj.7aj.7#D.7b.a9", +"a9#saY.s.Ca0aF#v#v.5#vaF.8a0#x#D#D.N#D#Da9bja9.7a9a9bl#D#DaYaY.N.R#Uama#aFaOaFaFb#b#b#a0aCa0#I#xaYblaYblbl#DblaYaw.R#IaYawaY#D#Da9a9a9a9a9a9a9a9a9#p.na9af#La9.7af#Laf#Lafajaf#L#L.3#La9#D#D.NaYaYaYbl#D#D.7a9.7a9.7a9a9a9.7a9.7a9a9a9a9.na9#pa9.n#pa9#pa9#p.na9#sbl#s#Dbl#DblaYa9a9a9.Ea9a9bja9a9.na9#sa9#Da9#Da9.nblbl#D#M#x#x#U#x#UaYaY#Da9#sa9#p.na9a9.7a9a9#La9a9#La9#L#L#L#Lafafa9#La9afa9#pa9#pa9a9a9a9.7#Laf#L#L#L.7#L.7.7a9.7.na9a9.na9.7.n#D#D#s#D#M#D#Mbl.s#D.s#Da9#D.7.na9a9.n.7#D.7", +".N.N.NaY#Uaqamaoa#aB.0a#ambn#xbl#D#D#D#D#Da9.7a9a9.7a9#D#D.s.NaYaY.RaCamamaF.5b#amaob#amama0a0a0#IaYawaYaYaYaYaYbnbnbnaYaYaYbl#D.na9a9.7afa9a9a9a9af#paf.na9afa9.n.7#La9.7a9#L#Laf#La9a9#D#D.N.NaYaY#Dbl.n#D.7af.7a9.na9.na9a9.na9.na9a9#pa9.na9a9a9.na9.na9a9a9aY#MaYbl#sbl#s#D.n#Da9#Da9#sa9.n#Da9a9.7a9.na9.na9a9#DawaY#x#x#xbnbnaYawaYbla9a9a9a9#pa9#Da9a9.7a9.7af#L#L#La9#Laf#Laja9.7a9.7a9a9.n#pa9a9.7#Da9a9#L#La9#Laf.7afa9a9a9.7a9a9bja9#sa9#D#M#D#M#D#sbl#saY#saY#s#D#s.7a9.E.7#D#D#D#D", +"#I.N#I#xamaCamaFaB.Gaz#u.8am#xaY#D#D#D.7a9bja9.7.7a9.7a9#D#D#D.N#Ubna0aCama0amao.Va0amaCama0aC.Cbnbnbnbn#x#Ubn#Uam#Ua0awaYaYaw#D#pa9a9#pa9a9a9#p.na9a9a9a9a9.7a9.7a9af.7afa9a9a9aj#La9.E#D#D#saYaY#Mbl#Dbja9.7.7a9a9a9.7a9#sa9#D#p#D#pbl#sbla9#D#sblbl#Dblbl#sblawaY.N#MaYbl#Dbla9.Ea9.na9.7a9a9#D#s#D#s#D#D#D#D#D#MaYbl.Naw#x#Ibn#I.R#xaY#Da9#Da9a9a9a9.na9a9a9.7a9a9#La9#La9a9#L#Laf#La9a9#Dbj#pa9a9a9#Da9.7.7afafa9.7a9.7#L.7a9.7a9a9#sa9.na9#D#D#D#s#D.sbl#Dawbl#saY#sbj#Da9#s#D.Nbl.saY.s.N", +".Cbf.C.Cam.5aoa#.la5.G.waZ#va0.C#D#D#D.7a9a9#L#La9#L.7.7.7#D#D#D#x#x#x#x#x#xa0bnam.Va0.Va0a0#xbnaY#x#Ia0a0aCa0aCa0ambnbnaYawblbl#Dbl#M#Dblbl#D#Mbl#pa9a9#Da9a9.7a9.7a9.7a9.7a9a9#La9.n#D#D.NaY.NaYaY#D#Da9#Daja9.7a9a9a9a9.7a9.n#D#M#D#sbl#sblbl#D#M#D#M#D#M#D#M#x#xawaY#Dawa9#Ma9#Da9#Da9#sa9#s#D#D#D#D#D#s#D#sbla9blaw#x#x#xa0#UbnaYawaYbl#D.na9a9a9a9a9#Da9#pa9#La9#L#La9.7af#L#L#L.7#L.7.7.na9a9#D#s.7#D.7.7afa9#La9af.7a9.7.na9.na9a9a9#Da9#s#Dawblaw#D.sbl#sbl.s#D#D#s#D#saY.Naw#xaYbf#x#x", +"aqaoamavam.8a##v.5#Saza7.w#u#vam#Da9#D.7a9.7a9a9.7#L.7#La9bj#D#D.Cbn#xbnaYaY#x#x.pb#.Vamaobnbn#xbnbn#xbn#xbn#xa0a0b#aCa0aw.R.Nblaw#Dbl#Dbl#Dblbl#pa9#Ma9a9.nbja9a9a9#La9a9a9.7a9.na9#D#D#DaY.N.NaYaYbl#D#sa9a9#La9.Ea9.7a9a9#Da9#M#Dbl#Mbl#sbl#s#Mbl#sbl#D#MaY#sa0#I.NaYaYblbl#Da9a9.na9.Ea9a9a9#D#D#s#D#s#D#D#D#Dbl#saY#x#xaC.Ca0#x.R#xaY#D#Da9a9a9a9a9a9#p.na9a9a9a9#La9#La9a9#L#L#L.7#La9.7.7a9a9a9#Da9.7af.7a9afa9.7a9.7#L.7a9a9bja9#s.7.na9#sbl.s.saYaw#saY#saY#saY#s#D#s#D#xaY#x.W.C.C.Waq", +"amaFaOaFaOaFama0aY#x.8.0#u#uan#uam#xaY#Da9a9.7a9#Laf#L#La9#D#D.sbl#D#sbl#xaYaw#x.Rbn#Ub#.Va0b#b##Ubnbnbnbna0#xbnbnaYaYaYbnbn#UbnaYaYblaYblawblawa9.n#p#pa9#pafafa9a9a9.na9a9a9a9bl#Dbl#Dbl#sblblawaY#D#Da9.7.7#Laf#Laf.n.7#D.7#D.NaYawaY#xbn#Ua0#U#Ubn#UbnaC#UaY#xawaY#M#D.na9ajaY.N#Dbla9a9.na9.nbl#DblaYaYaw#x#MblaYawbn#Ibna0.b#U.RawaY#Mblbl.na9a9a9a9a9afa9#Dbj#D#D#D#D#D.7#Lafa9afa9.7#Da9#sa9a9a9#Da9.7.7afa9a9a9a9#D#s#D#D#Daw.N.NaY.NaY#D#sbl#saY#saY.N.na9#D#s#DaY.N.N#I#x.CamaoaFbya#", +"bgb#amam.5aCa0.C#M#xa0aFaZ#uaB.0aO#xaY#Dafa9a9a9#L#L.7af.7#D#D#D#D#DaY#D.N.N#xaY.Cbna0a0b#aFb#aF.Vbnbna0#Ubnbn#x#U#x.R#xawaYbn#x.R#I.Raw.RaY#x.R#p#p#pbl.na9a9a9a9a9a9#Da9#s#D#M#Dblbl#sblbl#DblaY#Dbla9#Da9af.7ajaf#L.7a9.n#Da9#M#DaYaYaYaYbnaCbn.paCa0bgaoaC#UaC#I#xaY#MaYblbl#Mbl#M#D.na9a9.n#D#M#D#M#DaY#DaY#M#pawaY#Ibn.Ca0aYbnaY.RaYblbl#Da9a9.na9afa9a9af#D#D#D#D#D#Da9#Daf#L.7a9.7#Da9#D#pa9.na9a9b.a9.7.7a9.7a9bja9#D#D#D#D#DaY#Daw#Daw#D#D#M.N#saY.saY#sbl#sbl.Naw.Nawbna0aCa0.8a#aF.5", +"amamaCa0a0#x#xaYblaY#Ia0bc#u#ua#amam#x#D#Da9.7a9#Laf#La9a9.7#D#Dbl#D#D#MaYaYboaYbna0a0aoamb#aOb#b#am.Va0bnbn#Ubnbn#xaYaY.R#xawaYbn#UbnaCbn#Ubn#U.RawaYblaYblawbl#D#D#D#Dbl#Dbl#Dbl#Dblbl#Dblbl#DaYaw#D#Da9bj.7#La9#Lafa9a9bja9bj#D#MblawaYaw.R#Ubn.V.8#vaB#S#waOaoa0aC#x#x.N#I.NaY.NaY#D#D#D.n#Dbl#sbl#Dbl#saYaYblawaYaYbnbnaCbn#U.baYawaY#M#Dbla9.na9a9.na9.na9#s#D#s#D#s#D#D#D.na9a9a9a9#D#D#D#pa9a9#Da9#D#L.7a9.na9#D.n#D#D#D.saY.saY.NaY.saY#sbl#s#Daw#DaY.NaY.NaY.saY.NaY#x.Wa0a0a0aOam.8a#", +"#x#x#x#xaYaY.N.N.7#D#x#xb#aZ.ya#amaObn#Da9#Da9bj#L#L#D.7#Da9.7a9a9.nbl#D#DaYaY.NaC#xa0.Vamb#aFaF#vaFbga0a0bn#xaY#Ubn#U#xaYaYaYaYbn#xa0a0a0a0aCa0bn#Ubn.baYaYaYaYbl#D#M#Dbl#D#Dbl#Dbl#s#D#D#D#D#MaY#Dbl#D#Da9.7a9ajafaj.7a9a9#sa9a9#M#DaYaYaY.b#xbgb##vaBa7.Q.z#S.5aO.8aoao.Ca0.W#x#I.Naw.NawaY#DawaYblawaYaYawaYawaYaY#U.C#U.Ca0aY#x.RaY#xblbl#D#Dbla9a9a9a9a9a9#D#D#D.NaY.N#s#Da9a9#sa9a9#M#Dbl.na9a9a9a9bja9.7a9a9a9.7#D#D#D#saY#DaY#Daw#DaY.N#M#D#s#Dbl.s.N#M.Naw.N#xaY#x#I#x#Ua0a0aCamama0am", +"aYaYbl.s#D#D#D#Da9#D#s.N.CaOa#aF.5ao#x#Dbl#Da9#Da9a9.7a9.7a9a9.7a9a9a9#Dbl.NblaY#x#xbna0a0amaFaFbmaFaFamaCbn#U#xbnbnbnaY.b#x.R#xaYbn#xbnaCa0bna0#Ubn#Ubnbn#I#xaY.NblaYaYawaYaw#Dbl#Dbl#D#M#Dbl#DaYaY#Dbl.na9.7a9#La9#La9a9bja9#D#MaYblawaY.R#x#U#S#SaB#uaz#u#vaO.8aOaOaOaOaOaOaO.Caoa0.W.C#I#x#I#x#I#x#x#I#x.NaY#x#Ubn#UbnaCbnaC#I.R#IaYawbl.sbl#M#D#Ma9#D.n#Dbl#D#D#s#D#D#D#D#D#Ma9bl#D#D#DblaYa9#p#sa9#D.n.7.7.na9#s#D#s#D.NaY.saY.saY.NaY.saY#s#D#p.s#saYaY.N#IaYaYaw#x#IaY#I#x#x#I#x#x#x#x#x", +"#D#D#D.7.7.7.7.7.7a9a9#DaY.CaO.y.5.5bnaY#D#D#D#D#D#Da9bja9a9.7a9a9a9#Da9#sbl.N#MaYaY#xawbna0aCb#aOaFbgb#b#a0a0bn#Ibnaw#xaYaYaYaY#Ubn#IaYaYaYaYbnbn.R#xaw#x.R#Ibnaw#IaY.sbl.Nbl.N#D#M#Dbl#D#M#DblawaY#M#D#D#s.7a9aj#L.na9.n#D#s#D#DaY#IbnaY#UbnaCaB#SaB#u#uaBaO.5amaoam.8.5aO.y#1#1#u.yaOamamaoamamamaC.C.C#xbn#x#Ua0aC.CaCa0#Ia0.R#x#UaYaYblaY.N#D#p#D#sbl#Dbl#D#s#D#D#D#D#s#D#Da9#p#MblblawaYaY#Ma9bl#sa9bja9.7#Da9a9.7a9#Daw#DaY.saY#Daw#DaY#D#M#D#sbl.N#saY.saY#xbo.N.N.s.N.Naw.N#D#D#D#Da9#D", +"a9.7.7af#Lajbp#L.7#L#La9#DaYa0#va#a0a0.Cbl#D#D#Dbj#D#Da9.7a9#L#L.na9a9a9a9#D#D#Dbl#DaYaY#xaYbna0b#aFb#b#aob#aoambnbnbnbn#U#x.R#xaY.RaY.R#IaYaYawblblaYblaYaYaYawbn#I#x#UaYawbl#Daw.N#D#D.NaY.NawaY#xbl#D#D#Da9.Eafaf#La9#D#D#D#D#I#x#xaCa0aCaoaO.FaO#v#u#u#uaFbgaC.Caoa0ao.5aB.z.U.Oaz.y.y#vbm.y#v#v.5amaoamao.8amaoa0aoa0#Ua0#x#U#xbnaw.N.saY#sbl#Dbl#Dbl#D#M#D#D#D#D#D#D#D#D#D.nbl#Dbl#xaYaYaY#pbla9bl#D#s.7.7.na9#Da9#s#D.NaY.NaY.Naw.Naw.Naw#D#M#D#D#Maw.Naw#x#IaYaY#s#Da9.nbj.7.7b..7.7bp#L", +"#L.7#L#Lbpbp#Lbp.7#L#L.n#D.N.C.5a#amaCaoaY#D#D.N#Da9#Da9#La9#Lafafa9a9#Da9bl#Dbl.n#D.nblawaY#x.Ra0.Vbgamb#amaFaF#Ubn#U#xbnbnaYaYawaYawaYaYblaYaY.bblaYblblblaYaYaYaYaY#I#x#I#x#I.NaYaY.sbl.sbl.NaYaw.N#M#D#sa9.7a9a9.na9.n#D#s#D#xaCa0aoaob##SaBaOaF#S#uaB#v.5aoa0aCamaoao.8#v#v#3ar.wanazaz#3#C#3aX.w.yaOam.8amaCambga0aoa0aCbn#U#x#IaYaw.NaY.NaYaY#sbl#sbl#D#M#D#D#D#D#s#D#D#DblblaY#MaY#IaYawbl.nbl.n#D#Da9#D#Da9.Ea9#D#D#Daw#D#saY.Naw.NaY.N#M#D#s#D.saYawaY#I.N.N#sa9a9.7af#L.E#L#Laj#L#L#g", +"#L#L#L#L#La2bpa2#L.j.7.7#D.Nbf#IaFaBa7an.5a0#Daf#D.7#D.7a9a9#L#L#D#Da9#D#M#D#Dbl#Dbl#Dbl#Dbl#sblaw.RbnaCb#aOaFa#bg.VambnaCbnaw#x.RaYaYaY.baYawbl#pbl.n#Da9a9#D.7#s#D#D#D#D#D#MaYaw#IawaY#x.N#I#x#IaYaY#D#Da9.na9aja9.n#D.N.N#x.CaCb##vaB#uaBaB#v#SaOaOaOaObg.8am.W.WaCaCamaOaB#u#a#faz#Sa#aBaBaz#u#u#uaz.w.wa7#u#uaB.yao.5aC.C#Ia0.pa0aCbnawaY.sbl#saYaYaY#DaYaY#D#s#D#D#D#D#D#D#s#D#sblaY#x#I#x#D#D#D#Da9.n#D#sa9#D#D#D#s#D#D#D#sbl#s#D#saY.saY#MblaY.C.W#I.N#s#Da9#sa9.7.na9.7#L#L#L#L#L#L#L#L", +"bpaj#Lbp#Lbp#Lbpa2#L#L.7#D.Nbfbf.Va#an#uaB.8bn#D#Da9#Da9.7a9ajafa9bl#Dbl#D#D#M#D#D#Dbl#D#Dbl.NblaYawbnamb#aFbm#Sb#.Vaobn#xbnaYaY.baY#MaYblaYblaY#pbl#p.n#Da9.n#D#D#D#s#D#s#D#D#saY.s#x.s#I#x#Ibn.W#I#xaw.N#s#D#D#D#D.NaY#I#x.WaCaCaCaF#SaB#v#SaOaOaOb#aOb#bgamao#x#I.CaCao.8#u.w.OaG.G#SaBaBbmaB#v#v#va#aB#u.G.Galbk#Taz.w#v#v.5bg.5bga0ao.C#IaYaY#Dbl#DawaY#D#M.NaY#D#s#D#D#s#D#D#MaYblaY#I#x#x#M#s#D#s#D#D#D#D#Dbj#s#D#D#D#s#D#D#s#D#Daw#Daw.N#M#s#x#I.Cbf.s#D#D.n.7a9.7a9.7.E.7#L.7#L.7#L#L#L", +"#Lbp#L#g#La2bpa2a2#g#La9bj#D.Nbf.RaCaOaZ.yaFa0aY#D#D#s#Da9a9a9a9#D#Da9#Dbl#D#Dbl#D#M#D#D#M#Dbl#saY#xbnaCa0aOaF#Sb#bg.VbnaCbnaY#xaYaYaY.baYblaYbl#Ma9#p#Da9a9#D.7#D#sbl#Da9#Da9#D#D#D#saY.N#I#I#Iaoao.W#xaY.Naw.N#I#I#U.WaCaoamaobnaCaO#vaF#vaOaFbgambgambg.5.8amav.WaC.CaoaF#uaza6.OazaZaB#vaF#vaFaFam.5aF#v#SaB.G.O#3bv.G.GaPaP.w#u#vaFama0.C.C#IawaYawaY.NaYaYaY#MaYaYaYblaYawblaYaw.NaY#I#x#I#D.N#M#D#D#s#D#s#D#s#D#D#s#D#Dbl#s#p#saY#s.Naw.Nblaw#I#xaY.N.N#sa9.7a9.Ea9.Ea9#L#L#L#L#L#L#L#L#L", +"#La2bp#L#Lbp#Lbp#L#L#L.7#Dbj#D.NaYbna0aoa##vam.C#D#D#D#D.7#D.7a9a9#D#Dbl#D#Dbl#Dbl#Dbl#Dbl#D#DaYaYaYawbna0b#aO.Fbgb#ama0bnbn#IaY.bblawblaYaY#MaYa9#p#sa9a9#Da9#Da9a9a9a9a9.na9a9#s#D#D.saY.NaY#x.C.C.C.W#I#x#I.WaF.8a0a0a0a0aCa0aCaCb##vaFaO#vbgaob#aoaoamaoaCam.W.Caoa0.8#v#ubkab#aan#vaZ#vaFa#aoaobga0aoamamaOa#aBaZ#u.w.w.G#3#3#a.w.y.yaOb#aCbnbn#I#xbn#UaYawbfaYbfaw#x.s#xaY.NawaYbl#x#Ibn#I#Daw#D.s#D#s#D#D#D#D#D#D#D#D#s#D#D#Dbl#saY#saY.saYaw#xaw.N#s#D#D.7.n.7a9.7a9.7#La9aj.7#L.E#L.7#L", +"bp#L#L#g#L#g#La2#g#L#L#L.7#D#DbjawaYaCamaoa#.8aF.N.s#D#D#D.n#Da9#sbl#D#D#M#D#D#M#D#M#D#Dbl#sbl#saYaY#x#UbnaCb#b#bgb#bga0aCbn#x.RaYaYaYaYawblaYbl#p.n#pa9a9.nbja9.7a9.7#sa9#D.7.na9a9#D#D#D#saY.s#x#I#I#x.C.Wa0aoaoama0.W.C.Wa0#Ibn.paO#S#v#v#S#Sbgaoaoa0aoa0avaCaqaoavao.8#v.w#T.Y#3an#va#aOamaOa0bnaoambgamaoam.pa0bgb#aoaFaO.ybk#T.GaXaz.waBbyaCa0a0bnaCa0#Ibn#I#x#x#x#x#x#xaC#x#I#x#I#x#I.C#IaY#saY#saY#D#M#D#s#D#M#D#M#D#D#D.n#M#D.s#DawaYaw#x#IaYaw#sa9.7.n.7#L.7aj.7#L#L#L#L#L#L#L#L#L#L#L", +"#L#g#L#g#g#gbp#L#L#L#L.7af.7.7.7#D.N#xaob#.8a#a##DaY#D#D#D#Da9bjbl#D#Dbl#Dbl#D#DaY#DaY#D#M#DaYaYaYawaY#x#Ibna0aCbgb#bg.VaCbn#U#xaw.Raw#FaYblaYbl#D#p#Da9#Da9a9#Dafaj#Laf#Lajaf.7a9#Da9#sa9#D.Nbl.NaY.NaYaY#I.C.Wamaoaoaobga0aoa0aCam#vaBa##SaBaBaobgaoaoaC.Waqaoav.8ao.5aOaBazaX#4alaza##vaOam.5aC.Wa0.Wa0aob#.8bnaCaCaCaC.W.WaC.y.yaB#ubkbkaX.Oazae#vaO.5ao.pbga0a0a0#Ua0aCa0ao.CaCaCa0#IaCa0#IaYaw#D.sbl#s.N#s#Dbl#D#s#D#D#sbl#D#D#saYaw.saw.NaC#xaw#D#sa9.n.7a9aja9#La9aja9#L#L#L#L#L#L#L#L#L", +"#Lbp#ga2bpa2#L#g#L#L#L#L#L#L#LafbjaYaY#xama0.5aO.N.NaY.s#D#D#Da9#Dbl#s#Dbl#Dbl#D#M#D#M#DaYblaw#D#MaY#I.R#U#x#U#Ub#b#bga0aCa0#x.R.Raw.RaYawaYblaw#p.n#pa9.na9#Da9aja9af.Eaf#Lafajafaja9#Da9#s#Daw#D#s#D#s.NaY.NaY#U#Ua0.paobgb#bgaO#vaB#u#u.y#ua5aObgaoamaoamaoavam.8.8#v#v#u.w.GaTbw.G.0#vaFaoamaoa0aoama0aqamaoamaCaqaC.W.W#I#Iaxbgaobg#va7.Oau.U#3#3a5#uaB#vaFaoaoa0amaCamaob#aoamaoaoa0aC#Ibn.sawaY.sbl#saY#s#D#s#DaY#saY#D#D#s#p#s#DawaY#Iaw.C#I.N.naf.Ea9.7aj#L#Laj#L#L#Laj#L#L#L#L#L#L#L#L", +"a2#L#g#g#g#gbp#L#L#L#L#L.7#L.7#L.N.N.s#x#xao.5b#.NaY.N#D#D#D#D#D#M#D#Dbl#D#D#sbl#D#Dbl#Dbl.sblaY.NaY#x#I#x#U#UaC.Vbgb#bgaCaC#U#I.R#x.baY.RaYblaYa9#pa9#Da9#Da9bjaf#Laf#Laf#L#La9#La9a9a9.7#Da9#D#sa9a9a9#D.NaY.Na9#paY#Ua0aoaO.yaBaBazazan#u.Gbk.daOaO.8aoavao.8.8.8bd.yaL#uazaX#0#4#TaZaOaO.5aoa0.Camaoamaoamambcby.8.C.C.W.W.W#U.rbgaO#S.yaB#uaP#3.U#3arbk#u#vaFbgbgaob#aob#bgamaOaoaoaoaC#U#IawaY.sbl.s#D#Daw#DaY#s.N#M#D#s#D#s#D#M.NawaY.s#xaC.C#Ma9aj#L.7.naf#Laf#Lafaj#Laf#L#L#L#L#L#L#L#L", +"#g#g#Lbp#Lbp#Lbpa2a2#L#L#L#L.7#L#D.N.NaYbo.C.C.W.Vbn.N#Dbjbj.E.7#D#D#D#D#s#D#D#D#D#s#D#s#D#D#D#sawawaYaw#x#U#xaCa0aCa0aC.Vamb#a0aYaw.RaY#M#p#M#pajafaj#pa9a9#Mbl.na9a9a9a9a9a9afajafaja9#D#s#D#Dbl#D#s#D#s#D.n#Dbl#saYaYaw#x#IaCaOaB#1a5.w.wbkaV.Qbt.ybcbc.8bcbcaBaB#u#uaz.waP#T.O#zbw.6aF#vaOaFambga0amamaOaoaOaoaCa0.WaC.W.C#I.WaCaoaOaoaOaobg#v#v#S#1.Q#3agaV#1aB.8aOamaoaCbg#v.8aoa0aC#x#U#Iawaw#D.s#D#s#D#s.N#saY#s#Daw#D#Mbl#saYaw#x#I#xaC#D#sbj#D#D.7#s.7.7.E#L.7#Laf#L#La2a2a2#ga2#g#g#g", +"#gasbp#g#Lbp#Lbp#L#g#L#L#L.7af.7#D.NaYbf#x#x#x#xaCbn#I.N#Dbja9.7#D#D#D#D#D#D#D#D#D#D#D#D#D#s#D#DblawaYawbn#I.WbnaCa0.pa0aoa0aoam#UbnaYaYaYblblbl#paf#p.n#pa9bl#Da9a9a9aja9af.na9.7af.7a9a9a9#D#sa9#M#D#D#D#D#D#D#D#D#M.NaY#x#x#xa0am#vaB.z#u#Ebi#nbCaX.Q.y.y.QaXbka5#u#u.w.wbkaP.O#4#4.wa##v.5a#aoamambg.5aO.5a#aoamaC.WaC.W.W#IaCaC.WaCaoaoaoao.8bg.8#v#v#u#uaPagagaXbka5aBaBaB.y.z#S.8bgaoamaC#x#IaYaw#D#sbj#D.sbl.sbl.N#saY.s#D#MaYawaY#U#x#Ibj#s#Db.#Db.#Dbj.na9#La9aj.7#L#La2#ga2a2#g#gas#g", +"#ga2#ga2#g#g.7bpa2a2#L#L#L#L.7#L#D#D.N#M.N#I#x#xa0a0#x.s.N.N#D#D#D#s#D#D#D#D#D#s#D#s#D#D#s#D#D#M#D#MblawaYaw#x#I#Ubn#Ua0.pa0.pa0aCbn#Ubnaw.Rawbl.n#p#p#pa9a9bl#Dafa9a9#pa9a9a9afajafaja9.7#D.n#D#Dbl#D#s#D.n#D#s#D#D#DaY#saYaw.N#UbnaCaOaO#vaBbkbq#Rbqag#3.U#zaVau#Tazazbkbkbv#3#E#0ab.2#uaOaF#vaFaOaOaFaObyaO.8aCaCaC.C.W.W#I.W.WaCaC.WaC.WaCaCaCaCaoao.8.8#v#vbbbbap#3.U.U.U#4a5#E#1#SaFaOaOaFaC.W#x#IaY.s#D#saY.s#xawawaY.saY.sbl.NaY.s#x#x#Ia9.7.E.7.E.7.n.7a9#L.E#L.7#L#L.7#L#L#L#L#ga2bpbp", +"#g#g#L#gbp#g#Lbp#L#g#L#L#L#Laf.7#Da9#D#DaY.N.N.sbn#Ua0.C#x.N#s#D#D#D#D#D#s#D#D#Da9a9.na9a9a9a9#Dawbl#saYawaY#U#x#U#x#Ubn#Ibna0aCa0a0#UbnbnbnaY.Rbl.n#D#p.n#pa9bla9af.nafa9afa9a9#Laf#La9a9a9bja9a9a9.na9a9.7a9.7a9a9#s#D#DaY.Naw#xaw#xaCamaoaOaB.v.O.Obqadbx.abzbi.U#3#T#3bvagag#3#4#caT.w#vaF.y#v.5#vaOa#ao.5.5aC.CaC#I#I#I#Ibo#I#Iaw#Iawaw#I#U#7.W#IaC.WaCav.W.8#v#v.y.w.G#T#3.Oag.O.w#uaB.ya#aoamaC#x#I#x.N.s#xaw#I#x#Ibfaw.Nbl.s.Naw.NaY.saY.E.7af.Eaf.7#L.E.7aj.7#La9aj#Lafajafaja2#L#ga2#g", +"#ga2#ga2#Lbp#Lbpa2a2#L#L#L#L.7#La9.7a9#D#D#DaY.NaY#xa0#U.CaYbl#D#D#D#D#D#D#D#D#Da9a9#Da9#sa9.na9#D#M#Dbl#saYawaYawaYaYawbn#Ibn#IbnaC#xbn#Ibna0bnblblbl#Dblbla9a9.na9a9a9a9.na9a9af#L#L.na9bja9#D.na9a9a9.n.7.n.7.Ea9.7a9#s#D#D#D#sblaw#IaCaobg.d.O#ia5.G#zadadadabadaVaVbq#3#3bvbqaba8.YbkaBaO#uaFaOaFao.5aoaqaC#I#I#Iaw#I.s.sawbobo.sbo.sbobo.s#M#M.s#7aw#Iaw#I#U#IaCao.8aO#v#u.Q#3biag#3aXazaZ#vaOam.C#x#I#IaY#I#x#I#I#x#I#xaw.Naw#D#s#D#s#Da9#Laj#L#Laj#Laj#L#La9#L.E#L#L.7#Laf#Laf.7#L#L#L#L", +"a2a2#L#g#L#L#L#La2bp#L#L#L#L#L#L#L.7#La9.7#Da9#D#DaYbnama0#xaY#s#D#D#s#D#D#D#D#Daj#Lafajaf#La9a9.na9#M#D#MaY#MaYbl#MawaYaYaYaw#x.RaY.b#xbnbn#Ibnaw#xawbl#D#Ma9#pafa9afa9afa9afa9aj#Laf.7a9.n#Da9ajafa9aja9#L.7#Laf#L.E#L.7.Ea9#sblawaw#xaCaCaO.8aBazbka5.Gbk.U#3biad.a.a.DaVaVaV.M#d.S.Yaz#u.0.y#vaF.8a0.W.C#I.C#Iaw.Naw.s.s.s#s#s#s#s#s#s#s#s#s#s#s#s#M#s#s#s#s.n.n#M.raC#OaO#w#u#E.vbkazbkbkbk.w.yaOamaC.C.C#I#I#I#x#I#x#I#x#Ibf.s.N#s#D.7a9.E#L.E#L.E#L#L#L#L.7aj.7af#L#L#L#Laf.nafaj#L#L#Lbp", +"#gaa#ga2#L#L#L#Lbpa2#L#L#L.7#L.7#Laf#L#L#La9.7#D#saY#xa0ama0aYaY#D#D#D#D#Da9#D#Daf.7aja9#L.n#Laj#p.n#p#Dbl#s#DaY#sbl#D#MawaYaYaY#Mblbl.baYawbnbnaYaYaYaYbl#D#pa9a9a9a9a9a9a9a9a9afafaja9a9bja9#Dafafajaf#L.Eaf.Ea2#Lafaja9a9#s#D#sawaw#IaC.WaoaoaO#uae#1#u#uaz#u.O.Ubi.D#d.D#J.D.abu#6.Y.G.w.yaZ.8aoam.W#xaw#I.saw.saw.s.s#s#sbj.Eb.#sb.b.#sb..E#s#s#s#s.s#s.E#s#s#s#s.r#U#IaCaCbd#1#SaOao.ya5bkaza5.waOamaoaC#x.WaC.W#I#x#I#x#I.Naw#D#D#s.7#L.7#Laj#L#Laj#Laj#Laja9#L.E.7.n.7.Ea9a9a9a9a9.7#Laf", +"a2#g#L#g#L#L.7#La2#g#L#L#L#L#L#L#La2#Laf#Lbja9a9#DaY.C.VaFa0#xaw#D#D#D#D#D#D#D#Dajafaf#Laf#Lafaf#p.nbl.n#Dbl#M#D#Ma9#M#DaYaw#Dawbl#MaY#Mbn.RaYawbn#xaw#x#Mbla9.naf#paja9af.nafa9aja9#La9a9a9#s#Daja9#La9#Laf.7#L#Laj.n#L.7.n.7#s#Daw#x#I.CaC.8.8#v#v#v#vaO.z#1.z.Gbk.O#zbibBbBad.x#5#9.YaPaz.y.0bgaoam#Iaw.N#s#Dawaw.s#s#D#s#s#s.E.7.E.7.E.E.E.Eb..Eb..E.E.E.E.E.s.saw#IaC.WaC#Oam.d#vao.8aFaO.8.G#3.OaB.8amaCaCaC.Wa0#I#I#I#I#x.s.N#s#D.na9.n#Laj#L#Laj#Laj#Laj.7#L.7af#L#Laf#Lafa9a9.na9a9.7.7", +"#L#L#L#L#L#L#L#L#La2bpa2#ga2bp#L#L#L#L#L.7a9.7.7.NaY#xbnao.VaF.V#xaY#Ma9.na9a9#D#La9aja9aja9aj.7.na9.na9.na9.na9#p#s#p#D.na9a9.n#p.nbla9#sbl#saYaYaYaYaYaYaYaYaY#pa9#p#pa9#pa9.nafafaja9#D#D.N.N.nafajafaja9ajafajaf.7.na9#D.n#D#Dawaw#I.W#IaCaCaobdaO#v#v.y.y.y#u.QaX.9#TbC#r#r.aatatbB.2aX.GanaC.W#Ibobf.sbf#I#s#s#s#sb.b.bj#s.7.E.E.E.7.Ea9.Eaj#Lajajajajajaj.s#s#I.s.s#I.s.WaCaCaCaCa0.W.W.W#v#vbtbkbk#uaB.0aObgaoaoamaC.C.W.n.na9.E.7.E.7#Lbjb..Ea9aj#L#La2a2.jbpaj#L.E.7bjajaf#La9#Laf#Laf", +"#L#L#L#L#L#L#L#L#L#ga2a2bpa2a2a2#L#L#L#L#L.7#L.7#DaY#Ibnb#b#aOb##xaY#D#Da9.n.7#Dafajaf#Laf#Lafafa9aja9a9.na9.na9.na9.na9#p.na9a9afa9.n#p#D#M#DblaYawaYaw#xaw#xaY#p.na9a9a9a9#p#pafaf#pa9#D#s.N#sa9a9#La9#Laf#Laf.7aja9.n.7.n#Da9.saYaw#x#I#x.W.WaCao.8.8aObc#v.y#v#ubkbvbvaXbvbC.k.Dai.UaXbv.Ga7aOaoaNboaWbo.s.Nb.#sb.#D#s#sbjb.b.a9b.a9.E.7.Ebjajaja2aj#Laj.naj#D#s.sbo#I.sbo.saCaCaC#I#I#I.W#xavaoaO.y.z#1bkbkaBaBaO.5aoaoav.Wa9#s#L.E#L#L.7.E.7#D.7.E#L#L#Laja2bpa2#L#L#L#L.7af.7afajafaj#L#L", +"a2#La2#ga2#ga2#ga2#L#ga2a2#g#L#g#L#L#L.7af.7a9.7#Daw#x#xam#SaZa#aC#xaYa9a9a9#Da9aja9#L.n#L.n#Lajafa9.naf.na9a9.na9a9.na9.na9a9.n.na9a9.na9#D#D#saY#x.R#xaYbn#x#xblblbl#Mblbl#Dbl.n#p.nbl#D#D.N.N.naf.nafaja9#L.n#L#La9.7.n#D#s#saYaw#I#I#I#U#Ia0.Wao.8aObc.8.y.y#u#ubk#3bCapbkag.kbqaX.Q.Qbka5#u#v#vamava1bob..E.na9b..E#s.7.E.E.7.E.7.E.7.E.7.naj#L.jaja2ajajaj.n#D.s#I.s#I.saY#I#U#x#I#x#x#Ibo#x#I.CaoaO#v.y#1bkbk#u#vbcam.C#I#sa9.n.7.E#L.E.7#s#s.7.n#Lajbpa2bp.jbp.j#Laj#L#Lajafajaf#La2afa2", +"#ga2#ga2a2a2#g#La2#ga2#g#L#ga2a2#L#L#L#L.7.7#La9#D#D#xaCaF.0aZana0#xaYbla9.na9#D#Laf#Laf#Laf#La9af#L.na9af.nafa9ajaf#Laf#Lajaf#Lafajaf#L#D.n#D#DawaYaY#IaY#I#x#IaYawaYaYaYawaYawbl#Mbl#D#sbl.s#Da9.na9.7afajaf#Laf.Ea9.Ea9#sa9#s.N#I#x#I#x#Ia0#I.Wao.8.8aObc.ybba5bkaXaX#3bvag#n.c.#bt#baLbcbdaBaB.y#vam.Wbfb..7#s#s#s.7.E.E.E.7#s.E.E.7.n.7.E.7aj#g.ja2.jaja2#L.E.n#s.s.s#I.s.s#x#I#I#x.s#I.Nbo#x#I#I.CaoaoamaObkaz.Q.z#v.8.Wbf.N#s.N#s#D.sa9.E#D#D.E.7#L#Laj#Laj#g#L#g#L#gbp#L#L#L#L#L#La2bpa2", +"a2bpa2bpa2bpa2a2#g#La2bpa2a2bpa2#L#L#La9#L.7a9.E.7aYaY.Cam#vaZaZaobn#xbla9a9a9#s#L.n#L.n#L.n#Lajaf#Laf.na9a9ajaf#L#Laj#Laf#L#Laj#L#L#Laj.7a9.7a9#D#Dbl.NaYaY#xaY#xaY#x#U#xbn#IbnblaY#MaY.NaY#s#D.na9aja9af.7af.E#Laja9a9b.#D#s#Daw#x#I#I#x#I.Wbn.Wa0aoao.5.8.y.QazaX#3.O#3aVai#n#8aLax#O.W.Wao.8#1aB.y.5.Ca1bo.sbo#D#sb.#D.E.7aj.7.E#D.E.7.E.7.7.ja2.j#gbp.jaj.j.7#s#s#s#s.N.s#Iawaw#D.saw.N.s.s#D.s#x.W.WaoaC.8.0.y#v#v#v.d.8ao#I#Ibf.s#Db.bj.7#Dbj#L#Laj#L#L#La2aj#gaj#ga2asasa2a2a2a2#La2a2#g", +"#ga2a2a2#ga2a2#ga2a2#ga2a2#L#ga2#L#L#L#La9.7.7a9.7.N.s#xamaF#va#.5am#x.N#D.na9.7af#Laf#Laf#Lafa9#L.n#La9.naf#Laf#Lajaf#L#Laj#Lafa2ajaf#Laf.7.7.na9.n#D.nbl#D#DawaYawaY#U#x#U#x#UaYaw.Nblaw#D#D#sa9.na9.nafajaf#Lafaj.7.na9#sa9#saY#I#I#xaC#xao.CaCavaoao#v.yaI.Qae.O#zaV.Dah#Xag#b#O.r#7#7#7.W#QaObdaB.y#vaoaqbo#Ibobf.N.Ebj.E.7.E.E.7.E.7.E.7.Ebp.j#g#g.ja2#L.j.E.7#s.nb.#s#D.saw.Naw.s#D.s#s.N.s.sbo#I.C.Wam.8bgbgamao.C.8axbcaxaoaobo.N#s#Db.#s.7.E#L#L#L#Laj#L#g#La2#gas.jasbp.j#L#g.j#g#L#g", +"a2asa2asa2aa#ga2#g#L#g#Lbpa2#L#L#L#L#L.7.7.n.7.7a9.saYaY.Wa0amam.5am#IaYbla9a9a9aja9aja9aja9ajaf#Laf#L.na9#L.n#Lajaf#L.jafa2a2.ja2a2#Laj#Laja9#L#Laf#Lafa9.n#D#DaY#xaYaYaYawaY#U#xbnawaY.Naw#D#sa9.na9af.na9.na9.Ea9.na9.E#D#s#D#I#x#I#x.WaCaoaoao.8.8.8.y#1#1.Q#T#3bq.D#m#haibkavao#7aE.sbo.W.W.s.Wbd.GazaBbc.8##avbobfbobjbjb..7.7.E.7.E.7.E.7#g.j#g.j#g.jaja2.Eaj.n#D.nb.#sb.#D#s#s#D#s#D#s#s.s.N.N#I#x.Wam.WaC#x#I#xaCa0av.8.8.8ao.W#Ibo#s#s#Dbj.7#Lajaj#L#Laj#gaj#g#gasasaU#g#g#ga2bp#ga2#g", +"a2a2#ga2a2#ga2a2a2#ga2aja2bp.ja2#L.7#L#L.7a9.7a9bj.N.N.N#xa0a0aCaF.5bnaY#D.na9.7af#Laf#Laf#Laf#L.n#L.na9.naf#Laf#Laja2#La2aja2#La2aja2#Laf#L.E#L#Lajafaj#La9#L.nblblbl#MblaYaYawbn#U#x#xaw.N.s#D.nafa9.na9a9a9.na9aj.7#sa9#sa9#s#x#I#x.Wbnavamaoao.8aObd.ybt#ubbag.O#3bA.iaJ#3bbav.h#7b.b.boa1#IaE#I#QaB#uaPaz.Gbcbcavavbobfb.bj.E.7.E.7.7.E.7#L.j#g#g#gaj#g.jajaf.E.n#s#s#D.E#D#s#s#D.s#Db.aW#sbf.Nbo.C.Wav.Cam#Mblaw#x#Iaoaqaoaqavavaoav.s.Nb.#D#s.7.E#L#Laj#g#Lbpa2asas.jaUaU#ga2bpa2#g.jbpa2", +"#ga2#g#g#ga2#g#ga2#g#g#ga2#g#Lbpa2#L#L#L#L#La9.Ea9a9#saY#I.C.Wam#x#U#x#IaY.N#D#Daj#Laj.7.7a9.7.7a9#Laf#L#L#L.n#Lafafafajafaf#Laj#L#L#Laj#Laf#Laf.jaf#Laf#Laja9#Da9.na9#Da9.n#D#DawaYawawaYaY#MaY.7.n.7.n.7.Ea9.7ajaf.Ea9#s#D#D#D#Ibn#UaCaoao.8#vao.d.d.y.z.y#1bbagaX#3aAbx.caLav#7#I.s#7b.#sb.b..sbo#Iav#QaOaKbtau.GaZaFaq#Ibf.s.7.n#L.E#L.7aja3.Ebp.jbpbpajbpa3#s#D#s#s#s#s#D#sa9.n#D#s#D#s#D#s#x#Iaw#I.N#s#s#D#saY#saYaY#I#I#I#I#U.W#IaC.8ao.C#sa9#L.7.n#L#L#L.ja2.j#gasasas.jas#g.jas#gas#gas", +"a2#ga2#ga2#g#ga2#ga2a2bp#ga2bp#Lbpa2#L#Laja9.7#La9#D#D.N#x#x.C.CbnbnbnaYaY#D#D#D#L#La9aja9.7.E#D.nafajaf.Eafafaj#Lajaf#Lafajafaf#Lafajaf#L#Laj#L#La2afaj#La9a9.na9bja9.na9#D.na9awblaYawaYawaYawa9.na9.Ea9a9.na9ajaj#L.n#D#s#s.N#U#Ibn.WamaO.8#v#OaObdbd.yaLbb.Q#8.v#3aV.abCbd.8#7#7.sb..sb..sbj#s.s.s#I.Cav.8.8#u#uaB.ybcao.Wbf#D#s#D.7.E.7.Ea3ajbpajbpajbp#L.E#s#D#s#D#s#D#s#D.n.7#s#D#s#D.s.N#x#I.NaY.s.N#s#D#s#D#M.N.s#I#x#I#x#I#x#IaCbd.8ao#s#D#s#L.7aj#L#L.j#gas#g#g.j#gas.jas#gas#g.j#g#g", +"#g#La2#ga2#ga2bpa2bpa2#L#L#L#g#La2aj#L#L.7.7a9.7.n#D#saY.s.N#x#I#x#xawaY#Ibl.N.Naf.E#La9.7#sa9#D.n#Laf#Laf#La9afaf#Lajaf#Lafaj#Laj#L#L#Lajaf#Laf.j#Laf#Laf#La9a9a9a9.n#Da9.na9#D#D#s.N#s#D#s.N#s#D.Ea9a9.Ea9.7.na9.na9#s#D.s.N#x#Ibnbn.Waobg.8.8.d.d#vbd#v.z#1bb.QaX#3aA.kaXbcao#7.s.sb.b.b.b.#s#s#D.s.N.s#x.CavaFam#v.y#u.ybyby#Ibf.s.Nb..7.E#L.7.E#L.7.E.7.E.7#s#s#D#s#D#s#D#s#D#s#D#s#D.s.N.s#x#IaYbo.s#D#saW.n.7#s#D#s.N.s.s#I#I#I.CaCax#vaO.saw#s#D.n#Lafaja2a2.j#gas#g#g#g#g#g.j#g#gas#g.j", +"#ga2#ga2#g#L#ga2#ga2#g#L#g#L#L#L#g#L#L#L#L.n#L.7#D#D#D#DaYaY.N.NawaY#xaY#x.NaY#Ma9.7a9.Ea9#D#Da9a9af.7af.Eafaj#Lajafafafaj#Lafaf#Lafaj#Laf#Laj#La2af.j#Laf#La9.7a9.7a9.7a9#Da9a9#s#Dbl.saY#saY#s#D#s#D.na9.Ea9.7a9.n#D#s.N.s#xbobna0aCa0am.8aOaO.8#vbd#vbd.yaL#1.Qbk.Obi#R#8#v.rbo.saE#sb.#sbjb..7.E.n.E#s.s#I#xbo.Wavbc.y#u.yanaoaq.Cbo.N#D.E.7.E.7#L.E.7.E.7#s#D#s#D#s#D#s#D#D#s#s#s.N#s.Naw.N#x#xaw.N#s#D#sbj.n.7.E#DaE#saYboaCaCaoaoaoao#Oao#Iawaw#s#D.n.7a9aj#g#L#g.j#ga2#g.jas#gas.j#gasas", +"a2bp.jbpa2#ga2bpa2bpa2#L#Lbp#L#L#La2#L.7#L.7a9.7#s#D#D#D#D#s.NaYaYaY.s#x.s#xaYaY#D#s#D#D#D#s#D#sa9ajaf#Laf#La9af#Lajaf#Lafajafaj#L#Lafaj#L#L#L#L#L.jafa2#Laja9a9.na9a9.na9.na9#s#D#D#s#D#s#D#s#D#sa9#sa9#Da9.n#D#s#D#D.saY#xaY#IamaCamaobgaObcbdaOax#vbd#v#v.yaL#1.Qa5#3#R.vbc.W#7#s.sb.b.bjb.bj.E.7.Ea9bj#s#Daw#s.Nbo.C.8#van#ubc#v.8a0bf.s#D#sbj.7bj.7#D.7#sbjawaY#saY#s#D#s#Daw#DaY.saY.NaY.saY.saY.N.s#D#s#D.Ea9#s#s.N.sboawao.8.d.daoaC#I#x.sawbo#M#D#Daj.7#L#L.jbpa2bpa2#g#g#g.j#gas#gas#g", +"#ga2#ga2#g#L#g.ja2#g.jbpa2aj#Lbpaj#L#Laj#Laf.7af#D#D#s#D#D#D#D#D.N.saYaY#xaY#x#IaY.N#D#D#s#D#Da9#L.na9.na9ajafajaf#Lafajaf#Laf#Lafaj#L#Lajaf#L#La2a2a2#Laf#La9a9.7a9.7#Da9bja9a9.7#sa9#D#s#D#s#D#s#D#D#s#D#s#D#sa9#s.NawaY#I.C.WaF.8b#ao.8bg#vbd.8#vbd#vbd#v.d#v#1#1.wagbi#8ao#O.saE.sb.#sb.#s.Eaf.Ea9.E.n#D#s#Db.#s.N#Iaqambca#aB.y#vaO#I.Cbf#I#s#Db.#Db.#Dbj#saYawaw#D.saY#M.N#M.N#saY.s#x.s#x.s#x.s.N#s#Db.#D#Db..N.s.N#Ibo.W.CaoaxaoaxaCaC#I#x#I#I#Iaw#s#D.n#Laj#L#Lbp#L#L#L.j#ga2#g.ja2.j#g", +"#L#g#L#g.j#ga2bp#g#L#g#L#Lbp#L#L#La2.7#L.7.Ea9.EaY#D#D#s#D#s#D#saYbl.NawaY#UbnbnawaYawbl#D#p.na9afa9.n#La9#La9#Lajaf#Lafajafajaf#L#Laf#L#L#La2.ja2#La2#L#Laf.7a9a9a9a9.na9.na9a9.7a9#s#D.n#D#s#D#s.N#sbj#D#D#s#DblaYaw#x#I.CaCamaOaF.8.8aO#vbdaO#v.d#vaO.8aObd#v.zaBa5.O#r.Q#O.Wbo.s.sb.aEbjb.bjb.a9.E.7.n#s#D#s#D#D.s.N#Ibf.W.C#v#va#aOaF.8aoam.s#D#s#D#s#D#s.saYawaYaYawblaYaw#DaYaYaYbl.N#x#xaY.saY.N#s.N#saWawaY#I#x#I#x#IaC.C.WamaCaC.W#I#I#I#x#I#I#I.s#sa9.E#L.E#Laja2bpa2a2.j#ga2#ga2#ga2", +"aj#g.ja2#g#L#ga2#ga2#ga2bpa2#L#L#Lajaf.Eaf.7a9.7aY#s#D#D#D#Da9a9.saY.saYbn#x#xa0#I#x.NaY#M#Da9.na9aja9a9.nafajafafafajaf#Laf#Lafaj#Lajafaja2#L#La2.3#L.jaf#L.na9.7.n.7a9bja9#D.n.7#sa9.n#D#s#D#s#D#s#D#D#s#D#s#DawaY#Ibn#Ia0aoa0#v#vaOaFaObd#vax.ybc.d.8.8.8.8bd.y#1a5aX.v#1ao.W#7.saE.s#sb.#Db.#s.7.E#D#s#D#sa9#s#D#s#D#s#D.s.saFaFamaO.y#v#v.5#I#Iawbf.s#x.s#xawaYawaYblaw#DblaY#Mbl#saYaw#x#I#x.Naw.N#sbj#s#D#I.WaC.WaC.Wamao.8aoao.W#IaY.NaY.N.N.s#D.saw#s#D.n.Ea9aj#Laj#Laj#ga2#gas.j#g.j#g", +"a2#ga2#ga2aj#L#L.ja2a2aj#L.E#Laj#pa9a9#pa9.n#pa9#M#Dbl#Dbl#MaYaYaYawaYaYawaY#UaYa0.p.VbnaYawa9#La9a9ajaf#L#Lafaj#L#L#Laj#Laj#L#Laf#L#L#L#L#La2#La2a2#La2#La2#L#L#L#L#L.Ea9.7#s#D#La9.E#D.na9.na9.n#s#D#saw.Naw#xaw#I#x#I#U.CaCaoao.VaoaoaO.8aO.8#Oaoaxao.haC#Oao.daO#uagbibk#vav.W#I#s.E.Eaj.Ea3aj.n#L.E.7.nb.#s.N.saY.N#I.N#IaY#I#I.C.8#v.yaBaPaBa#aFa#.5aqaqaN#xbfbf.N.NaY.Naw.NaYaY.Naw.NbfaYawaYaYaw#x#I#xa1#U#I#U#I#x#I.N.s#D#s#D#Dbj#sbj.E.7.Ea9.7.7#L.7.7.7.7.E.7#L.7#Lbpa2.jas#g#gas#gas", +"a2.ja2#L.j#L#La2a2#g#L#Laf#L.7#La9#pa9a9#pa9#pa9bl#Dbl#sbl.NblawblaYblaY#xaYaY#Ubna0b##UbnaY.n.7#s#Da9.na9.n#Laf#Lajaf#Laf#Lafaj#Lajafaj#L#L#L.j#L.j#La2af#La9a9#L.7#L#La9.7a9#Da9.Ea9.n.7.n.7#s.na9#M#Daw#x.s#xawbn#I#U.CaCaCaCaobgaCaoaOaOax#vao.hao.W.W.Wav.haoax.y#E#zagapbc.Wbo.s#s.E.Ea3.E.7aja9.Ea9b.a9.EaY.Naw.Naw.Naw.N#I#x#Ia0amaF.yaBa7#u.ya#aoaqavaq#x.C#x#I.Naw.NaYaw#x#I#I#x.s#xboaYaY#I#x#I#x#IbfblaYbl.NaY#D.N.N#Dbj#sbj.Ebj.7bja9#L.E#Laj#Laj#L.E#L#L.7aj#La3ajas#g.jas.j#g.j#g", +"a2#gas.ja2#L#Laja2#Laj#L#L#La9.7.na9a9#Da9#Da9a9#s#D#D#s#D#s#D#Dbl#sbl#D#M#DaYaYaY#Ubga0bnaY#s#D#s#Da9a9.na9ajafaj#Laj#Laj#L#Laf#L#L#Laf#L.j#L#La2a2#La2#Lafa9a9ajafaja9a9#s#D#s#Da9.n#D#sbl#s#D#M#s#D#Maw.N#I#I#I#I#x#I#IaC.CaC.paCaCaoao#O.8ao.h.W.W.W.W.W.W.W#I#Q#v.w.Obiagbk.W.r#I#sb..E.E.Eaja9.E.n.7.n#D.saY.saY.Naw.NaY.Naw.N.s#xaCaq.8aF#Sa7a7#u.yaFam.5ao.Ca0.C#x#x#x#Ibn.R#x#x#xaY#xaY#Ibn#UaC.W#xbf.sbl#s#D#sa9.Ea9.7.E.7.7#L#L#Laj#Laj#L#L#L#L#L#L#Lbpajbp#Lbpbp#Lbp#g#gas#g#gas#gas", +"a2.ja2#La2aja2#L#L#Laf#L.Ea9aja9a9a9a9.na9a9.na9#D.n#Da9#Da9a9.na9a9#sa9#D#D#D#saY#xaCa0#U#x.N#s#D#D.na9a9.n#La9#L.n#Laf#Laf#Lajafaj#Laj#Laf#L#Lafajafafaj#L.Ea9#La9a9.n#D#D#D#D#D#s.Nbl#D#s.N#M#D#M#D.saYawaw#IaY#I#U#I#x#IaC.WaC.CaC#IaCavao.W.Wav.W.Wbo#I.W.Wbo.W#Q.y.w.Uau#3bd.8bo.s#s#sbjb.a9.E.n.7b.#sbj#s.Naw.Naw.NaY.saY#s#s#D#I#x#Ia0aoaFa#aBaBaBa##va#aoa0aoa0aoa0aC.Ca0#xaCbn#I#xaw#xa0aCa0#x.Caw.N.Na9a9a9a9.7a9.Ebj#L#Laj#L.E#L.7#L#L#Laj#L#Laj#Lajbp#L#Lbpajbpaj#Las.j#g.jas#g.j#g", +"a2a2a2.ja2#Laf#Lajaf#Laja9a9.7a9a9.na9a9a9a9a9a9.7a9.7.n.7.7a9.7.7#L.7a9#s#D#D#D#D#Mbnbn#x#xaY.N.s#D#D#sa9a9#Laj#L#L#Laj#Laj#L#L#Laf#Lafaj#Laj#La2a2afajafafa9a9a9.na9#Da9#s#D#D#MaYblawaYawaYbl.s.Naw#D.saYawawawaw.s#I#I.C.W.W#U#I#I#x.WaC.W.W.W#I#Ibo#xbo#I#Ibo.Wavbc.y#u.G#3.Qbc.Wbfaw.s#sbj.n.7.n.7#s#D.s#D.saY.NaY.N#M.NaYb.#D#s#Daw#Ia0#UaFaOamam.5.8.yaB.8aO.5ao.5amam.8amaCa0a0#x.C#I#Iaoam#I#xaY#D.N#Da9.7.7.7a9.7.7.7aj#L#L#L#L#Lajbp#Lbp#L#Laj#L#L#L#Lajbpaj#L#Lbp#L.j#gas#gas#gas#g", +"a2a2.j#La2#L#L#Laf#Lafa9a9a9#D#D.7#Laf#L#Lajafaj.7aj#L#L#L#Laj.7aj#Laj#Lbj.7.7b.a9#D#D#xaCa0.W.NaYaw#D#Da9.na9af#Lafajaf#Laf#Lafaj#Laj#L#L#Laf#L.3ajaf#La9aj.7a9a9a9a9a9bl#DblaY#DaY.NawaYblawaY.NaYaw.sbl#s#Maw.N.saw#x#I#I#I.C#I#x#I#I.W#Ibo#Ibo.Wbf#Ibo#Ibfbo#Ibo.W.8#Qbc.ybkbv.Q.8#I.s.s#s#sb..nbj#s.N#sbj#saY.Naw.saY.NaY.s#D#s.Nbo.N#I#I#xaCamao.Ca0b#aobyaOaF#v#vaB.y.ya#aOaF.5aCa0aC.CaCbn#xaY#D#D#D.7#D#Laj#L#Laj#L.7#L#Laj#L#Lajbp#Laj#L#gaja2bpa2bp#g.jas#gas#gas.j#gas#g#g#g.j#g.j#g", +"a2.ja2#L.j#Lajafajafa9a9a9#Da9.n#L#L.7#L#L#L.7#Laf#L#L#Laf#Laf#L#L#L#Laj#Laj.7.7#L.n#DaY#x.W.C.C.s.NaY#s#D#Da9#s#Laj#L#Laj#Laj#Laf#Laf#Lajafaj#Laja2afajafafa9.na9#pa9#M#Dbl#DaYaYaYawaY#xaYaYaYaw.Naw#D#sbl#s#M#s#saY.s.s#x#I#I#Iawawawbo.N.s#I.s.s.sbo.N.s.s#I#I#x#Ia1.Wao#vaLbkap.yaobo.N.N.s.7#s#sbj#s#D.sbjaY.saY.Nbl.saY.N.s.N.s.N.N#I#x.sbfbf.C.WaCaqamaq.5aoa##v.0#u#u#ua##vaOaFama0#x#xaYaY#D#Da9.7#L.Eaf#Lafaj#Lbpbp#Lbpa2bp.jbpa2#L#ga2aj#g#L.jbp.j#L#g#g.j#g.j#gas#g.j#g.jas#gas#gas", +"a2#L.ja2a2#L#L#Lafafa9.na9a9a9#D.7#L#Laj.7#L#L#L#L#Laj#L#Laj#Lajbpaj#Lbp#L.7.7bj#L.7#DaY#xa0.C.WaYaw.N#D#D#D#sa9aj#L.Eafajaf#Laf#Laj#Laj#L#L#L#L.3#L#Laf.7#La9a9a9a9#p#Dblbl.NblawaYaYaYaYawaYawaY.NaY.sbl#sa9.n#D#D#saw.s#I#I#xaw#x.saY.s.s.N.s.N.s.Naw#D.s.N.sbn#I#Iboa1#b.d.8#Tap.Qbcbo#D#sbo.nb.#D#s.Nb.#D.s.Naw.Naw.NaY.Naw.Nbf.s.N.sbfaY.N.saY.sbf.C.Waqavbga#a#a#.yaZ.0anaBbm#vaOaobn#I#xblaY#Ma9a9af#La2#L#L#Lbp#Lbpaj#L#g.ja2bpa2aj#gaja2#g#L#g#L#g#L#g.j#gas#gas#g.j#gas#gas.j#g#g.j#g", +"as.j#g#La2aj#Laja9ajaf#L#L.n#Laf#Laj#L#L#La2#ga2#ga2a2a2#ga2a2#g#L#Lbpaj#Laj#Laj#D.s#DblaY.VaObm.C#IaYaw#D#s#D#Dbl#Ma9a9af.7aj#Lajaf#Laf#Lajafaj#Lajafaj#Laj#L#Lajafa9a9.7#sa9#DaYaYaYaYaY#xaY#x.N#s#D#s#D#s#Db..n#sbj.n#D.sbfbo.s.s.N.s.N.s.s.N#s#D#s#D.s.N#Ibf.s#Ibo#I.Wav.8bcbta5.U#3aB.5.W.N#x#I#x.saY.s.N.N.s#D#Ma9b..E.7.nbfaw.NaY#xaY#Ibf#D#s.N.N#x.Waqavb#ambga#aO.0.y.yaoaCa0#x#xaY.N#D.Ebj.7.7.7.7.7.7#ga2#ga2#ga2#g#ga2#ga2aj#g#g#L#g#g#L.jbp#Lajbp#L#g.jas.jas#gas.j#ga2#ga2#g.jas#g", +".ja2#Laj#L#L.7.7af#Lafajaf#Laf#Lbpa2#La2#L#L#Lbp.ja2#g#ga2#ga2#g#L#L#L#L#L#L#L#L.7#D.NaYaYaobmaZamaCbn#x.NaY.N.N#Mbla9.nafajaf.7a9#Laj#Lajaf#L#Laf#L#L#Laf#Lafaja9af.7.n#Da9bja9#xawaYaYawaYaYaw#Dbl#s#D#D#s.7.n.7b..nbj#sbj.s.saw.s#D#saw#D.s#D#s#s.s.N.sbfawbf#Ibf.sbo#Iav.8bc#uaz#3bi.G#vaq.W#I#x#I#x#x#x.s#DaY#s#D#s#D#s#Db.aY.saY.N#I#I#x#x#I#x#I.C.WaqamamaFaObm#vaBaZ#va#bna0#xaYaw#D#D#Dbj.7.7.7.7.7.7.7#g.ja2#g.j#ga2bpa2a2a2#g#La2#L#g.j#g#gajbpbp#Lbp.j#gas#g#g.j#gas#g.j#g.ja2a2#ga2", +"#L#L#L#L#L.na9.n#Lafajaf#L#L.ja2#L#Lbp#Laj#g#L#L#gbp.j#L#gaj#ga2aj#g#Lbpajbp#Laj.7#D#sblaYb#aOa7b#amaoa0aC#x.baYbl#Mbla9#D#L.na9aj#Laf#L#Laj#Laj#Lajafaj#L#Laj#Lafajaf.7a9a9#Da9#Dblblblblblblbl#D#s#D#D.n.7.E.7.E.7.7.E#s#s#D.s.N.s#Db.#D#s#D#sbj#s#D#s.N.sbfboaYbo#Ibf.Wavbcbc.wa5au.M#3.w#v.5#Ibn#I#IaY.s.N.N#saY#s#D.s#D.s.NawaYawaY#I.C#Ibn.Wa0amamao.5.8.5#uanaB.ya#aoama0awaYaY.NaY#D#D#D#L#L#Lbp#L#L#L#Laj#gbpa2bpa2.j#g.j#L.j#L.jbp#g#Las#ga2#ga2aj#L#L#g.j#g.j#ga2#g.ja2#ga2#g#Laj#Laj", +"#D.na9#sa9#Da9#Daj#L#L#Lajaf#L#L#g.ja2#g#g#g.j#ga2a2#g#ga2#ga2bp#ga2#ga2#ga2#g#g#Lb.a9aY#UambmaZaO.t#SaFb#a0a0#UblaY#s#D.na9.7.n.7aj#Lajaf#Laf#Laf#L#Lafaj#Laf#L#Laf.7af.7.n.7#D#M#D#D#D#D#D#D#s#D#Da9#sa9.Ea9aj.7.E.E.7.7b.#sbj.s#s#D#s.N#saW#s.N#s.Nb..N.Nbo.N#xbo#x#I.Wav.8.yaz#T#3#z#z.O#uaF.CaC.C#x#I.Naw#D.sbl.saY.s.Nbo#Ibn#U#x#Ua0#Ua0aCb#am.8a##va#aBan#u#u.0aFama0#xaY.NaY#D#s#D.7.7.7#Lbpaj#Lbpajbp#Lbp#L#L#L#Lbp#L#L#L#L#Lbp#L#Lajbpas.ja2.j#ga2bp#Laja2#L#La2aja2#L#L#L#Laj#L#Laj#L", +"a9a9a9a9a9.na9a9#Lafajaf#L#La2a2aj#g#ga2#L#g#L#g.j#g#g.j#g#g.j#ga2#gaj#ga2#ga2#g#L#L#L#s#xb#aOa#.t#SaZaBbmbga0bnawaYblbl#Da9.n.7#Laf#L#Laj#Laj#L#Lajaf#L#L#Laj#Lajafajaf#La9a9a9#D#D.na9a9.na9a9a9.na9.7a9.E#L.Eafaj.7.E.7.nbj#s#Db.#Dbj#sbj#sbj#sbj#D#s.N.s.N#x.W#xbo#xavambcbb.O.O#a#a.Oba#3aBamaoa0.W#x.s.N#saY#saY#I#x#I#x#IaCa0aoamaob#aoamaF#v#vaB.0aB.0#ua#a#.5ao#xaY.Nbl#sbl#Da9.7.n.7.7aj#L#L#L#L#La2#Laj#Laj#L#g#L#L#Laj#Laj#L#L#Lbp#L.j#g#L#L#Laj.7#L#Laj#Laj#Laj#Laj.7aja9#La9aja9a9", +"#Da9#s#L.n#L#L#Laj#L#L#g#L.jbpa2#ga2#g.j#gas#gas#g#g#g#g.j#g#gas.j#g#g#g#g.jas#g#gaj#L#D#xaOaZan.FbmaBaZbmaFb##UaYblawaY#s#Da9.7.n#Laj#Laf#Lafajaf#L#Lajafajaf#L.3#Laf#La9aj.7a9#Ma9a9#Da9#Da9#Da9#D#La9aj.7aj#L.E#Laj.7.Ebj.nb.#s#D#sbj#s.N#s#D.s#D#sbj.N.sbf.s.C.Wa0.Wam.8.ybb#a.O.GaPaz.M#C.faOaoaq.W#xaw#D.s#D#I.N#I#xaCamaoaFaO#vaO#S.y#S#v#v#S#va#aOaFaOaFamaoa0#xaY#D#sa9#D#Da9.7.7#L#L#La2#L#g#L#g#Lajbp#L#Lbp#Laj#Laj#L#Laf#L#Laj#Lajbp#L#Laj#L.n.7a9#sa9.n.7.nbj.nbj.na9a9a9.na9#Da9a9", +".7#L#L#L#L#Laja2#L.jbp.j#L#g#L.j#g#g#gasas.jas#g.jas.jasasas.jas#gas.jasas#gas#gasbp#L.7awam.yan.Fbm.TaZaBaFam.R#IaYawbl.N#s#D#D#Lajaf#Laj#L#L#L#Lajaf#L#L#L#Laj#L.jafajafafafaja9#Da9a9a9a9a9.n#Lajaf.E#L#Laj.7.j#Laj#L.E.7.E#D#saW#D#sbj#sbj#Db.#DaE#D.sbf#IbfaCaq.Waoao#v.y.wbkaz.w.waz#3biau#uaOamao#xboaw.N.s#x#I#xaCambgbg#uaBa7#ua7an#ubh#vaFaOama0aCa0a0a0bn#UaY#sa9af#L#sa9.7a9aj#Lbpaj#g#L.j#gaj#g#L#Laj#Laj#L#L#Lbp#L.E#L.E#L#L#L.7#L.n.7a9#D#D.N.s.Na9#s#Da9#sa9#D.n#D#D#s#D#D#s#D.7", +"aj.7aj#gaj#gas.ja2bpa2#L#gaja2bpas.jas#gas#g.jasasasasas.jasaU.j#gas#gas#gas#gas#g.ja2#LaYa0.0aZ.Fa#aBaZa#aFbn#UaYaY.N#MaY#D#D#Daj#L#Laf#Lafajafajaf#L#Lajafaj#L.3#La2af#L.Eaf.7a9a9.n.7a9.n.7a9af#Laf#Lafaj#L#L.j#g.E#L.E.7#s.Ebj#s#sbj#D.s#Db..N#s#D.s.sbf.s#Iaqa0ao.C.8#vbbaPbk#u.w.Q.w.wau#N.Q.yavam#I#x.sawaY#I#IaCaoaoaO#vaz.Gaz.GazaS#uanaoaCa0.Wa0.CaC.CawaY#Da9a9#La9aja9a9.7aj#L#L#Lbpaja2bpa2bpa2#Laj#L#L#L#L#Laj#Laj#La9#L.7.7.E.7.E#D#D.N.s.N.s.N#x.7.7.n.7a9#sa9#D#s#D#D#D#D.7#D#D", +"#g#g.j#g#g#g.j#g#g.j#g.j#g#g#g.j#g#gas#gas#gas#g.jasasasas#gasasas#gas.jas#g.jas#g#g#ga2a9.C#SbhaFbgamam.8amaCa0aYaYaY#Da9.E#Laja9#Laj#Laj#L#L#L#L#Lajaf#L#Laf#Laja2ajaf#Lafa9a9.na9a9a9a9.7a9a9af.n#Lajaf.7#L.E#Lbpaj#g.n.7#s.N.s#DaY.saY.Naw#x.saYbo#x#x#I#x#I.8amaob##v#u.G.2bkaz#ubbaP.w.G.2.u.Oa#aoav#Ibfboawbo#xaoamaBan.Gba#a#ua#ao.5#Qaq.W#x#x#x#I#x#xaY#xawaYbl#D#M#Da9a9a9a9a9.7a9a9a9#L#Lajaf#Lajaf#La9.n#D#saY.NaYaY.N#sbl#D#MaY#M#D#D.n#Da9#D#D#D.n#Laj#L#L.E#Laj#L.7aj#Laj#Laj#Laj", +"#g.j#gas.j#gas.j#ga2a2#ga2.jas#gas.j#g.jas#g.jas#g#g.j#gas#gas#g.jas#gas#gasas#g#g#La2.j.7bnaF#ub#b#amb#ama0bn.CaY#M.N#sa9.na9#Lajaf#Laf#Lafajafaj#Laf#Laj#Laj#La2afafaj#L#La9.7a9.7a9.7a9a9a9.7afafafa9#L.n#L.7ajaja2.j.7.E#D.N#Daw.Naw.N#I#x#x#I#x#I#x#IaC.CaC.5bg.8aO.0.w#T.2.G#u.ybbbb#u.GaX.e#z#SaoaC.s.W.W#I#Iaoam#v#u.G#TarazbmaoamavaN.C#x#xawaY#x#IaY.saY#Daw#D#Da9a9a9#sa9.na9a9.na9.na9a9a9#sa9#Da9#sa9a9a9#D#Mbl.NawblblaY#MaYaYaYaw#D#D#s#D#D.n#D#D.n#La9ajaf#Laf#Laj#L#L#L#L#L#L#L", +"#g#g#g#gas#g#g#ga2.j#g.j#gas#g.j#g#gasas#g.jas#g.jas#gas.jas#gasas#gas#gas#g#gasa2aj#g#La9aYa0bmbgambgama0.C#x#xawaY.N#Da9.7#L#Laf#Laj#Laj#Laf#L#Lafaj#Laf#Laf#Laja2#Lafaf#L.na9.na9a9a9.Ea9a9.7ajafajaf#L.7#L.7bp.Ebp.Eaj.7#s.Naw.Naw.Naw#x#I.N#I#x#I.C.Wa0aoamao.5ao#vaBazal#3aB#vaF.y.yaB#u.wa6#z.w.8.C.Wam.CaoamaO#v#uaz.G.GaBaFama0#xawbfa1aY.NaY.NaYaY.NaY.N#D#D#D#Da9a9a9a9.7#D.n#D.7a9a9#D#s#D#D#D#s#D#Da9.na9a9#D#Daw.N#D#s#D#D#D#s#D#D.7.7.7.7.E.7.7.7#L#Laj#L#Laj#L#L#Laj#Lajbpaj#Lbp", +"as.jas.j#g.jas.ja2#ga2as#g.j#gas.j#g#g.jas#g#gas#g.j#g#gas#gas#gas.j#gas.jasas.j#ga2#gaj#LaY#Uamb#ama0a0aCbn#Ibn.Nblaw#Da9aja9aj#Laj#L#Laf#L#Lafaj#L#Laj#L#Laj#L.3aj.3#L#L#La9.7a9a9.7a9a9.7a9a9afa9#La9aj#L.n#L.E.7aj#L.E#D.sbfaw#M.NaY.s#x#IaY.C.W.C.W.Caqaqao.5aoaF#v#uaz#T.o#vaO.8.8bcbcaB#ualbaa5#vaoa0avaoaF#vbm#uaz#u#uaZa0am#x#M.N.N.N.N#D.Naw.N#s#D#D#D#D#sa9#Da9.n#L#L.na9a9.7a9a9.7#s#D#D#Da9#Da9#D#s#Laf.7a9.n#Da9a9#L.7#L.7aj.7#L#Laj#Laj#L#L#Laj#L.j#L#La2#La2#La2ajbp#Lbpa2#L#ga2", +"#g#g#g#gas#g#gas.j#g.j#g#gas#ga2#gas.j#g#g.jas.j#gas#g.jas#gas#gas#gas#gas#gas#gaa.j#g#L#LbjaY#Ua0aCa0a0#xbn#xawbl.N#D#Da9.7#L#Laf#Lafaj#Laj#L#Laf#Laf#Lafajaf#L#La2#Lajaf#La9a9.n.7a9a9a9a9a9#Lafafajafaf.7#L.7#L.7#Laja9#saY#IaY.saY.saY#I#x.s.C#xaC#x.Caoaqamao.8a##v#u.Ga5azaOaOaoao.8#v.ya5ba#z.w#vao.Wam#vaB#uaB#uaZa#aF.5#xawaYbla9.E#D#sa9#sa9#D.7.7a9#s.7a9.7.7#L#L#L#L#L#Lajaf#L#Lajafa9.7.na9a9.7a9a9.7aj#L.7#L.E#Lajafajaf#Laf#Lajaf#L#L#L#Laj#L#L#L#La2aj#gaj#gaj#g#La2.jbp.jbp.jbp", +"as.jas#g.jas.j#ga2as#gas.j#g.j#g.j#gas#ga2#g#gas#g.jas#gas#gas.j#gas#gas#gas#gas#g#ga2bp#L.na9bla0bnbn#UaYawaYaYaYbl#Da9.n.7afaj#Laj#L#L#L#Lafaj#Laj#Laj#L#L#L#L.ja2a2a2af#L.n.7a9a9a9a9.7.n.7a9afaf#Lafaj.7af.E#Laj#L.Ea9aw#x#IaY.saY.NawbfaY#x#I#x#I.C#I.C.Wa0.8am#v.0#u.G.w#uaO#v.8#Q.8bdbb.Q.K#z#u#vaFaoaBa7a7#u#SaFaoamaCbnaYaY#Da9aja9a9bj.7a9.7a9.Ea9.7.7af.7#L#Laj#L#La2ajafaf#L#Lafafafaj#Laf#Lajaf#L#La9#L#Laj#La2a2a2#ga2.j#g.ja2a2#gaj#gaj#g#La2bp.j#g.j#ga2#ga2#g#g#g.j#g#g#ga2a2#g", +"#g#g#g.jas#g#gas.j#g.jas#gas#ga2as.j#g.j#g.jas#ga2#g#g.jas#gasasas.jas#g.jas#g.jasaa#g#Lbp.7afajbn.RaYaYaYaYaYaYbl.N#D#D.7#L#L#Laf#Lafaj#L#L#L#Laf#Laf#L#La2#L.3#La2#L#L#Lafa9a9.n.7a9.7a9a9a9.7afaf#Laf#La9aj.7.7.7aja9#saw#x#I.N#saY#I.NaY.s#I#x#I#x#I#xaC.CaoamaO.yaB.waz#uaZ.8bc.8.8#Q.y.Q.w#4#4.wa##vaB.Qaz#vaFama0#x#x.N.s.N#D#sa9.7a9.E#D.E#L.7aj.7#Laja9aj.7#L#L#La2.ja2af#Lajafajafaj#Lafafajaf#Lafajaf#L#L#La2a2.j#ga2.jas#gas#g.jas#gasa2#g.j#g.j#g#g#g#g#g.j#g.jas.ja2#gas.ja2.j#g#g", +"as.jas#g#gas.j#ga2as#g#gas.j#g.j#g#g#ga2a2#g#g.j#g.jas#gas.jas#g#gas#gasas#gasasa2#g.jbp#LajafafaYbnaYaYblaYaY#MaY#D#sa9a9.7#L#L#Laj#L#La2afa2#L#L#Laja2#Laf#L#La2.j#L.3aj#La9.7a9a9a9a9.n.7a9a9afaj#La9aj#L.7#L#D.na9#s.naw#x#Ibl.Naw.Naw.NaY#xawaYaw#x#I#xaC#I.8aO.yan.w.G.w#vb#by.8.8bc.ybb.Qay.Y.G#u#1a5.GaBamamaobn.s#Da9.7aY#Da9.7a9.7.7#Da9aj.7af.7af.7#L.7afaj#La2a2a2.j#Laf#Laf#Laf#Laf#La2#La2#La2a2a2.7.j#La2#gaa.jasas#gas.jasasas.j#g.j#gas#gas#gas.jas.j#gas#g#gas#ga2.j#ga2#ga2a2", +"a2#ga2.jas#gasas#gas.j#g#g#gas#g.ja2a2a2.ja2a2#ga2#ga2.jas#gas#gas#gas.j#gas#gas#g.j#ga2bp#L#Laj#L.naY.R#xaYaY#D#Dbl#D.7#saf.7.n#L#L#L#L#Laj#L#Laja9#La9aj#L#L#La2a2a2.j#L#Lajafa9#sa9.7a9a9a9.E#Lafafajafa9.na9aj.na9#s#D.N#IaY#s.sbl.s#D#s#D#s.N#I#x.W.Cavam.5.8aF.0azal#T.w.0.8#v.8byaKbbaIaP#aba#N.O.GazaB.5#xaw.N.NaY#D#D#s.7.n.7#L#La9.7a9#L.7af.E#L.E#L#L#L#L#La2#La2bpa2#L#Laj#La2#L#Laja2aja2#ga2.jbpa2as#gas#gas#gas#g.j#g.j#g#g.j#gas#ga2.j#g.j#g.j#g#ga2#g#ga2.j#ga2a2#g#ga2#g.j#g#g", +"#g.j#g#g#g.j#gas.j#g#gas.j#g.j#ga2a2#ga2#g.ja2a2#g.jas#g#gas#gasas.j#gas#gas.j#gasasas#g.j#g#Lbp#La9#Dbl.RaYaY#D#D#Da9#D.7a9.7#L#L#Lbp#L#Lbp#L#L#L#L#L#g#La2a2#Las.ja2a2#Laf#L.7a9.7.na9a9.7a9a9af#L#La9#Lafaja9.na9.n#D.s.s#x#I.Nbl.s#D#M#DaY.saY#I#xaC.Caqao.5bgaO#uaz.G.G#u.y#x.W.8#v#v.y.0.ybabaay.f#uaB.8a0bfaYaY.N.N#D#D#Da9.7.7af.7.7af.E.7aj.7#La9#L.n#L#L.jaf#L#gaja2#L#La2#Lafaj#La2#L#g#g#L#g#L#ga2#g#gas#gas.jas#gasasas#gas#gas#g#g.j#g#gas#ga2as#g#ga2#g#L#gbpa2bp.j#L#gajbpa2bpa2", +"a2a2#g.jas#gas#g#gas.j#g#gas#g#g.ja2a2.ja2a2a2.jas#gas#gas#g.jas#gasas#gas#gasas#g#g#ga2#g#L#La2#La9a9#DaYbl#Dbl#Da9#Da9a9.7#L#La2#g.j#g#ga2#ga2.j#ga2.j#g#g#g#ga2a2#g#La2aj#L#L.n#Da9a9.na9a9.7#Lajafajaf.7a9.naf.na9aE.N#I#Ibn.saY.Naw.NaY.saY#x#I#x.Wa0ao.5.8aoaO#u.G.Gaz#ua##IaCaCaobg#va7azaH#zaz#uaFam#x#xaw.N.N#D#D.n#D.7.E#L#L#Laj#L#L#Laf.7#L#L.E#L#L#L#L#La2#La2#L#gaja2#L#La2#L#L#La2a2#g.j#ga2#g#L.jas#g.jas#gas#gas#g#g.j#gas.j#g.j#ga2.jas.j#g.j#g.j#ga2.j#ga2#g#L#g#gaja2bp.j#L#g", +"a2#g.jas#g#g.jas.j#gasa2#g.j#g.ja2a2#ga2#La2a2#g.jas#gas.jas#gas#gas#gas#gas#gasas.j#ga2#gaj#Lbp.j#La9a9#D#Dbl#Dbl#D.7a9.7.7af.7a2a2a2a2a2a2.ja2bpaj#Lbp#Lbpa2#L.j#g#La2#L.7#L.7a9a9a9.7a9.7a9.n#Lafaf.7afafaja9.na9.n#D#s#I#x#IaY.sawaY.saYaw.N#I#x#I.C.W.5av.5bgaOaB.G.O.G.y.5aO.8bgaFaB.Gau#N#zaz.0aFa0#x.NaY.N.N#D.n#D.7.7a9#L#La9#L.7#L.7#L.E#L#L#L#Laf.7#L#La2#L.jbpa2#La2#La2#Lajafa2#L.j#L#g#L#gaja2#g#g#gasasas#gasasas.jasasas#gas#gasa2.j#g#gas#gas#g#ga2bpa2bpaja2aj#ga2#L#g#La2bpa2", +"a2#ga2#g.jas#g#g#gas.j#ga2a2as#ga2aja2.j#g.j#La2#g#g.j#gas#g.j#g.jas#g.jas#g.jas#gas#ga2#g#La2#L#L#g#La2a9a9#D#D#Da9#Da9.7a9#L.7a2.j#g.ja2aja2#L#L#g#ga2.j#L.j#g#La2#Laj#L#La9.7.na9.na9a9a9a9a9#L#Lajafaja9a9.naf.n#s#s.N#I#x#U#I#x#x#I#x#I#x#I#x#I#x.Wamao.5.8ao#v#u.Garaz#ua#.y.0#u#u#aau#3alaza#b##I#xaw#D#sa9#s.7a9.7a9aj#L#La2aj#L#Laf#La2#L#La9aj.7#L#Laja2#L#g#La2#L#g#Laj#L#La2#L#La2#L#ga2#ga2#g#g#L#gas#g#gas#gasasasas#g#g.jasas.j#g#gas#g.j#g.j#ga2.jbpa2bpa2bpa2bp.jbp.jbp.jbp.jbp", +".j#g.ja2#g.j#ga2.j#ga2.j#g.j#g.ja2#ga2a2a2a2a2#g.j#gas#g.j#gas#gas#gasas#gas#gasa2.j#gaj#g#Lbp#La2#La2#L#La9#Dblbl#Da9bja9#L.7#L#L#Laf#L#L#Laf#Laj#L#L.7#L#L#L#L#L#L#L#L#La9#L.7a9#Da9a9.7a9.Ea9#Lafaf#Lafa9.na9.na9.E#D#s#x#I#I#I#I#x#I#x#I#x#I#x#I#x.WaC.5.8.8.5aBa5#a#TaPaPbk.U#3al#3#T.G.w.0aFaC#x#x.N#D#Dbj#Dbj.7.7aj#L#L#La2#L#La2#La2aj#L.7#L#L#L#L#Laf#Lbp.j#La2bpa2aja2#La2af#L#Laja2#L#g.jbpa2bpa2#g.j#gas.jasas.j#gas#gasasas#g#gas#ga2.jas#ga2#g.j#g#L#gaja2aj#gaja2bpa2#L#L#L#g#La2", +"a2#ga2#ga2a2#g.j#ga2#ga2a2#g#g#g.j#L.j#L.j#La2a2#gas.j#gas#g.jas#g.j#g.j#g.j#gas.j#ga2a2#gaj#L#L.ja2#g.j#g#L#Dbl#Da9a9a9.7a9.7a9a9a9a9a9a9#sa9#Da9a9.na9a9a9#Laf#Laj#L.7a9.E.7a9.n.7.n#Da9a9a9a9#Lajaf.Eaf.na9.naf#Ma9.s.s#I#x#I#x#I#x#I#x#I#x#I#x#I.CaCaq.8am#vaO#u.G.Uay#3#3bv.M#C.O#u.y.5am.C#UaYaYaw.N#D.7.7.7.7aj.7#L#Laj#ga2#ga2a2.ja2a2a2ajaf.7#L.7aj.7#La2a2bpa2aja2bpa2#L#Laja2#La2#L#ga2bpa2.j#g#ga2#gas#gas#gasasas.jas#g.j#gas.j#g.j#ga2a2.ja2a2#gas.j#L#g#L#g#L#gaj#Laj#L.j#La2aj#g", +"#g.j#g.j#g.ja2a2#ga2.j#g.j#g.j#ga2a2a2a2#g.ja2#g.j#gas.j#gas#gas#gas#gas#gas#g#ga2#g.j#L#g#La2bp#La2#gas#g#La9bl#D#Da9bja9.7.n.7a9b.#D#s#D#D#D#s#p.nbl#p.na9a9a9#L.7#L#L#La9.7.7a9#Da9.na9.n.7a9#Laf#Laf#Lafa9.na9.n.E#s.N.s#x#U#I#x#x#I#x#x#I#x#I#xaC.Wa0.8.8.8.yaB#T#4beaM.Y#T.fa7#uaOa0bf.s.N#Mbl#s#D#D.s#DaW.E#L#L#Laj#L#g#ga2a2.ja2a2a2aja2.7#Laj#Laf#L#L#L#L#ga2#L#g#La2#L#La2#L#L#L#La2aj#ga2#g#g#ga2#ga2as#gas#gas#g#gas#gasas.j#g#gas#g#g.ja2#g#g.ja2.j#L#g#L.jbp.j#La2aj#L#Lbpaj#g#L#g", +"a2a2a2#La2a2.j#ga2.ja2a2a2a2#ga2#ga2#ga2a2a2#ga2asaa#ga2#ga2#L.j#La2#L#Lajafa2#L.ja2#ga2#La2#L#L#L#Laf#Laj#L#L#La9bl#Da9blaYaYaYblbl#DaYaYawaYaYblblblblblblbla9#Da9#D#sa9#Da9#D.na9.7a9.7a9a9.n#Laf.Eaf.Eaf.naf.na9#M#D#saY.saw.N#s#s#D#s#s#D#s.C#I#I.C#Iao.5#v#u.OaVadbi#3#1aBbdaO.W.C#IaYbf.N#D#s.7#L#L#Laj#L#Lbp#Lbpbpa2bpa2.j#g#g#Lbp#Lbp#L#L#L.7.7.E#L.7#La2a2a2.ja2#ga2.ja2#L.3a2a2#g#g#g#L#ga2#ga2#g#ga2#ga2#ga2.j#ga2#g#gas#gas#g.jas.ja2#g#L.j#L#g#g#L.ja2a2#L#L#L.7#L#L#L#La2#L#Laj#L", +"a2a2.j#L.j#La2a2a2a2a2a2#ga2a2a2.ja2a2.ja2#ga2a2asa2asa2.j#L#g#La2#L.jaf.3#L#La2aa#ga2a2#L#Laj#Lafaj#L#L#Lbpaj#La9#D#p#Dbl#DaYaYbl#DblaYaw#xaYaYbl#Dbl#Dbl#Dbl#Da9#sa9#D.7#D.7#D.7a9a9a9a9a9.7a9.n#Laf#Laf#La9a9.n#s#D#M#DawaY#I#s#D#s#s#D#s#D#sbf#Ibf#I#Ia0bc.y.G#zad#4aXbk#v.8bgao.C#x.N#x.N.s.7bj#L.7aj#Lbp#Lajbp.j#L#gaj#g#L#gbpa2bp#L#La2#L#L#L#Laf#La9#L#L.j#ga2#ga2a2a2a2a2#La2aj#L#g#L#ga2#g#ga2#ga2#ga2#g#ga2#g#ga2bpa2as.j#g#g.j#ga2#g#L#Laj#Laj#Laj#L#gaja2ajafaj#L.Eafaj#L#Lajaf#L#L", +"a2#La2a2a2.j#ga2.j#L.j#ga2a2#ga2#ga2#ga2#ga2a2asa2.jasa2#ga2#La2#La2#L#L#Laf.j#L.j#L.jafaj#Laf#Lafafaf.7#L#L#Lbpa9#pa9#D#Dbl.sbl#D#MblaYaYaYaYawbl#D#M#Dbl#D#Mblbja9bja9#D.n#Da9.na9.7a9.7a9.na9#Laf.Eaf.Ea9.n.n#D#M#saYaw#IaY#IaY.s#D#s#D#s#D#s#I#x#I#I.Cao.y#1#T#rbq.G#u.yaOaCamaC#xawaY.s.N.N.7aj#Lbp#Lbpa2#ga2#Lbp#L#g#L#g#L#ga2#gaja2bp#Lbp#Laj.7aj.7aja9#L#L#L#L#L#Laj#L#L#L.j#La2#ga2#g#g#L#ga2#g#g#ga2#g#ga2#g#ga2#g.j#g#gas#g.jasa2.j#gaj#L#Laj#L#Laj#La2a2a2#L#L#La9#Lajaf#Lajaf#Laj#L", +"a2.ja2.ja2a2a2#ga2a2#ga2a2#g.ja2a2a2a2a2a2.ja2a2asas#ga2a2#L.j#La2aja2a2a2#Laf#Lafa2af#Laf#Lafajaf.E#Laj#L#Lbpa2a9.na9#Da9a9#D#Dblbl#DaYaYaYaYaY#Dbl#Dbla9#D#D#Da9#Da9#Da9bja9bja9.7a9a9.na9#Da9#D.na9a9a9a9#D#sbl#saYaw.s#x#I#I.saw.saY.s.Naw.N.s.s#IaCaoao#u.G#z.UaX#uaOaOao.W#x#IaY.N.N.N#D#D#L.7#Laj#La2#ga2#gbpa2bp.jbpa2bp.ja2#g#L#Laj#L#La9.7a9.7a9.7.7a9#L#L#Laj#L#L#La2af#La2#L#L#g#L#ga2#g#ga2#ga2#g#ga2#g#ga2bpa2bpa2#g.ja2#ga2#g.ja2#Laj#Laj#Laj#L#La2.j#Lajafaj#L.E#L#Laf#L#L#Laf#L", +"a2bpa2#La2.j#ga2aja2a2a2.ja2#ga2#g.j#ga2#ga2#ga2a2aa#ga2#ga2bpa2#La2afaja2afa2#Lajafajafajafa9a9af#Laf#L#L#L#Lbpafa9a9a9a9a9#D#D#Dbl#DblawaYaYaY#D#Dbl#D#Dbl#D#Da9b.a9.7a9#Da9#Da9.na9.7#D.na9.na9a9#D.n#D#s#D#M.NawaY#I#x#I#Ia0#IaY#Iaw.Nawbo#x.s#x#I.WaF.yaz#3.a#4a5#v#vaoaC#IaYaY.saYaw#D#sbj#Laj#Lbp#L.j#g.jbpa2aj#g#L#g#L#g#g#L#g#L#g#Lbp#L.na9a9.na9a9.na9#Lajaf#L#L#L#Laj#Lafa2#L#g#L#g#g#L#ga2#g#ga2#ga2#ga2#ga2.j#ga2#g.jas#g.j#g.j#ga2aj#L#Laj#L#Laj#Laj#La2#L#Laf.7af#Laj#Lajafaj#L#L", +"a2.ja2.j#L#ga2a2a2#ga2#ga2#ga2a2a2a2a2a2a2a2.ja2as.jasa2.j#La2#La2#La2a2#La2afajafafafafaf#pa9.n#Laf#L#L#L#L#g#Lafa9a9a9a9a9a9a9a9#DblaY#DaYawaY#D#M#D#D#M#Da9#Da9#Da9bja9.7#s.7a9.7a9.na9a9.7#D#s#D#s#D#Dbl#s.N#M.Naw#I#I#IaC.W#I#xbo#xbo.N#IaYbo.W.Wa0#vaz.Y#.aVapaOaO#O#I#I#xawbl.N#D#D.7a9.E#L#L#L#gaj#g#g#ga2bp#gbpa2bp.j#La2#g.j#L#La2#Lbpa9.7#D#D#s#Da9#D#L#L#L#L#L#L#L#L#L#La2#L.j#Lbpa2#ga2#g#g#L#ga2#g#g#ga2#gbp#g#L#g#g#g#ga2a2#g.ja2aj#Laj#L#Laj#Laja2#Lajafaj#Laj.7aj#Laf#L#L#Laf#L", +"a2#La2#ga2.ja2#ga2.ja2a2a2a2#g.j#ga2#g.j#ga2#ga2#gaa#ga2#ga2aja2#L.j#La2#L.jafaf.3ajaf.n#p.n#pa9afajaf#L.7#L#L#L#L#La9a9#D.7a9#Da9a9bl#DblaYaYaY#D#D#D#D#D#D#D#Da9bja9a9.7#Da9#Da9a9a9#Da9#sa9a9#D#D#D#D#s#D#saYaw#I#x#IaC#x.WaC#I#I#x#I#x#I#I#xa1ao#Q.8.w#4.P.4#u#Sao.WaCa0bobfbl#s#D.na9#L.7#L#Lajbpa2a2#g.jasbpa2#L#g#g#L#gbp#ga2#g#Lajbp#Laja9a9#M#Dbl#D.na9.7a9.7a9.Ea9a9.7af.jaf#La2#L#L#g.j#ga2#ga2#g#L#ga2#ga2bpa2a2.j#g.j#g.j#g.ja2#g.j#Laj#Laj#L#Laj#L#Lajaf#L#Laf.7af#Laj#Lajafaj#Laj", +"a2.j#L.j#La2#L.ja2a2#ga2#g.ja2a2a2a2a2a2a2a2a2a2asa2asa2a2a2bpa2af#La2afa2#L#Lajaf#pafafa9#p.n#p.7af#L#L#Laj#Lbpaf#La9.7a9a9bja9a9#D#Dbl#DaYaYaY#D#D#D#Da9#Da9#D#sa9a9bja9a9bja9.Ea9.7a9.Ea9a9a9#s#D#s#D#Dbl.s#Daw#x#IaC.WaCaCao.Wav#Ia1#I.Ca1#I.Cav.8aO.G#dbs#BaLaB.8aC#I.WaYbf#sbl#Da9a9.n#L.E#L#L.jbp.j#gasasa2bp.j#L#ga2bpa2#g#L#g#L#g#L#L#La9#Da9bl#s#p#Da9.7a9.E.7a9.7.7.n#Laf#L#L#gaj#L#g#ga2#g#gbp.j#ga2#g#ga2#g.jbp#gbpas#ga2#ga2#g.ja2.E#Laj#L#Laja2#Laja2aj#Laj#L.E#L.Eafajaf#L#Laf#L", +"#L#L#L#L#La2bpa2#Laj#L#La2bpa2bp.L.L.jasaa#ga2#gaja2a2a2a2#La2#La2a2#L.j#La2afa2.3aj#p#Mbl#D#D.7ajaf#Laj#L#Lbp#Laj#Laf.n.7a9a9.7#pa9#p.NaYaYbl#Dbl#D#Da9#Da9.7a9a9a9a9afa9.7a9.7#Dbl#Dbl#D#D#D#D#xaYaYawaYaYaY#Ubn#I#I#I.Wao#v#vaC#I#x.W#Ibo.C.WavaoaZ.o.Yab#3.QaOaoaC.W#I#x.s.Nbl#sa9a9aj#La9#L#L#g#L#ga2#g#L.j#g#g#g#ga2bp#ga2.ja2#L#Laf#La9.7bl#DblblaYaYaYaYaj#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La2#ga2a2a2#g#La2#La2#g#La2a2#L#L.ja2.ja2.j#L#Laj#L#L#Laj#Laj#Laj.3#Lafajaf#Lajafa9.na9a9.na9.na9", +"#L#Laj#L#Laj#La2bp#L#gaj#L#L#Lajaa.jaaaaa2#ga2bp.3#L#L#La2#L.j#La2a2a2#La2#La2#L.3af#pblbl#Da9a9afaja2#La2#La2#L#Laf#L.7a9a9bja9a9#p#DblaYaw.Nbl#Dbl#Dbl#D#D.7a9a9afa9a9a9a9aj.7bl#D#D#sbl#Dbl#MaYawaY#xaY#xawaY#x#U#x#I.Cao.8aBaxav.W.C.Waoao.8aO#vaPay#daVbk.0#OaoaC.W#x#I.N.N#Dbl.na9a9#L.7aj#g.j#ga2bpa2#g#gasas#g.j#g#ga2#g#La2.ja2#Laja9a9a9a9bl#DaYawaYaY#La9.Eaf#L#Laj#L#L#Laj#L#L#L#L#Lbpa2#L#g#La2#g#L#gaja2#ga2#ga2#La2a2a2#La2a2.3#L.jaf.jaf.j#L.3#Laj.3aja2#Laj.3#Laja9af.n#L#Laf#L", +"a9ajafaf#L#L#L#L#L#L#L#L#L#L#L#Laa#ga2#g.j#gbp#La2#L.ja2#La2#La2a2#La2a2a2#L.j#L.jaf.n#pbl#sa9.Eaf#Lafaj#Laj#L#Lajaf#La9a9bja9a9#Ma9bl#DaYaYbl#DaYbl#Dbl#Da9a9a9a9#p.naf.7a9.7a9.n#Da9#D#D#s#D#DaYblaY#MaY#MaYaY#MaYaw#I#IaC.8aObgaoaoao.8ambc#v#uar.M#d#4.G.y.8bgaoaC#x#I.N.N#s#pa9a9.7ajaf#L#La2bpa2.j#g#gaj#g#g#gas#ga2#g#L#La2a2#Laf#Laf#La9a9a9a9#D#Dbl.Nbl.E#L.7#L.7af.7#La9#L.7#L#L#L#L#La2#ga2#ga2#g#La2#L#ga2#L#g#L#Laj#L#Laj#Laj#Laj#Laf#L#La2afaj#Lajaf#Lajaf#Laj#Laja9afajaf#Lajafaj", +"afaf#Lafajafajafajaf.Eaf#Laj#L#L#La2#L#L#gbpa2bp#La2#L.3#L.jafa2#La2a2#La2a2#L.3afaf#p#Mbla9a9.7afajaf#L#L#L#g#L#La9aja9a9#Da9.7#pbl#DaYaYaYbl#DaYblaY#Dbl#D#D#Dafa9afa9a9a9.7.7.7#Da9bja9#D#D#s#D#D#saYbl.NblaY#M#D.saw#I.WaOaB#vaO#v.8aOaO#v.y#3ad.Z#.#T#vav.haoaC#x#IaY.s#D#D.n#Dajaf.7#Laj#L#ga2#g#gbpa2#ga2a2as#ga2#ga2bp#La2a2a2a2a2#L#L#La9afa9#M#DblawaY#L.7af.E#Laj#L#L#Lajaf#L#L#L#L#Lbpa2#L#g#La2#gaja2#L#ga2#g#La2a2aj#L#L#L#L#Laf#L#Laj#Laj#L#Laf#Laj#L.7aj#L.Eaf.7.na9#D.n#Da9#Da9", +"a9.na9a9a9a9#pa9a9a9a9a9a9a9a9.nafaj#L#L#L#Lbp#La2aja2#La2#La2a2#La2a2a2a2a2#La2aj#p#pbla9a9#Lajaf#Lafajafaj#L#Lajaf#La9.7.nbj#Da9blaYaY#x.N#DblaYblaY#DaY#Dbl#Da9a9a9a9.7a9.7.7a9.7.E.7.7.7.7a9#D#D#D#D#s#D#s#D.sbl#s.s#xaoaO#S.yaBaB#u#u#ubk#E#.ab#4#3.G.y.8bo#U#I#x.s.N#D#s#Da9#L.7aj#L#La2bp.jbpa2#La2#g#L#g.jas#g#ga2#Laja2#L.j#La2af#L#L#La9.7a9bj#Daw.Nbl.E#L.7#La9#L.7#L.7#L.7#L#L#L#L#La2#ga2a2#ga2#L#g#La2bpa2#La2bp#L#Laf#L#Lafaj.7ajaf#Laf#L#Laj#Laja9.na9.7afa9.Ea9a9a9a9a9a9.na9a9", +"a9a9a9a9a9a9a9.n#paf#paf#p.n#p#pbl#D.na9a9#L#L#L#La2#La2#La2#La2a2a2a2#La2#La2afa9#p#M#pa9.nafa2afajaf#L#Lbp#L#L#Laf#La9a9#Da9a9#D#DaY#x#xaYaY#DblaYblaY#Dbl#Dblafa9afa9#Da9.7a9#L.7a9#Laf.7.n.7a9a9#s#D#D#D#D#D#s#D.s#x#I.8#Saz#u#u#uaZ.w.GbiaV#4.U#3ara5#vao.W#x#IaYaw#D#sa9a9#L.n#Laf#L#gaj#L#ga2#g.ja2#g.j#gas#gas#gaja2bp#La2a2a2a2#L#Laf#L#L#La9a9#Dbl.NaY.7#L.n#L.E#L#Lafaj#L#L#L#L#L#L#Lbpa2#L#g#L#ga2#ga2#ga2a2#gaja2#L#L#L#Laj.7#La9#L#L#Lajafaj#Laf#L.n.7a9.Ea9.Ea9.n#D#s#D#s#D#D#s#D", +"a9.n#pa9.n#pa9#pa9.n#p.n#p#p#p.nblblbla9.na9#Laf#Lafa2aj.3#L.j#La2#La2#La2aja2#La9.nblbl#pa9#L.j#Laf#Laja2#La2aj#L#Laja9a9.7#D#s#p#DaY#x#x#xaY#DblblaYaYbl.Nbl#D#Dbl#D#Da9#Dbj#D.7#L.7#L.7af.7#L.7.na9a9.na9a9.n.NaYbobfaoaFaBazaz.w#uaP#3#4ad#4ap.O.O.O.w#S.8.5#Uaw#x.saY#s#D.n.7#L#Laja2aj#gas#L#gbp#gbpa2bpa2#gas.j#g#g#L#La2#La2#La2#L#L#L#L.7#L.7.7.E#D#s#D.na9#L.7af#L.7#L.7#La9#L#L#L#L#La2#ga2a2#ga2#L#g#La2bpa2#ga2#ga2.7a9.7#La9.7.7a9ajaf#L#Laf.7.na9#D.Ea9.7a9.7a9b.#D#D#D#D#D#D#D#D", +".n#pa9#paf#p.n#p.n#p#p#p#p#p.n#p.b.R#Mbl#p.nafajafaja2#La2#L.3#La2a2aja2#L.3#L.ja9#pbl#Mbl.nafa2afajaf#La2#Lbp#L#Laf#La9.n#D#s#DblaYaY#xbn#xaY#DblaYblaYblaY#Dbla9bla9#D#D#D#Dbja9#La9#La9.7.7a9.7a9.7.7.7.E.7#D.N.sbf.Wam.y#uaz.Oar.Gal.Mbxadalbkbkbkbkbka7.yaF#I#IaY#s#Da9#s#Daj#Laj#L#g#L#g#g#gaja2a2a2#ga2#gas#gas#ga2#g#gaja2a2a2af#Laf#La9#Lajaf.7a9#D#s#Da9.Ea9.E#L.E#Laj#L#L#L#L#L#L#L#L#L#g#L#g#La2#ga2#ga2#ga2#L#g#La2#L#L#L.7#Laf#La9#L.E.7.7.Ea9.n.7.n.7a9.7.n.7.na9#D#D#s#D#s#D#s#D", +"#Lafaj#L.7#L#L#Lafafajafaja9#pa9aYawaYaYawblblblafafaf#Laf#L#L#L.jaaafa2#L#Lafaf.n#F#M#pa9afaj.7#Lbp#Lbpbpaj#L.Eaf#Laj#D#D.N#D.N.naYaYbna0a0bnaY#DblaY#x#xaYaYblbl#D#Da9a9.7#L#L.7.7.7.7.7.7.E.7#Dbj#D.s.N.N#DboaY#MaY.W.8aZal#P#PaT#P#.a.ad.ObkaX.G.O#Taz#SaoaC#x#x#I.N.s#D.E.7af.7#L.E#L.Eaf#Laj#g#gbp.jbpa2aj#ga2#g#L#ga2#ga2#L#L#L#L#L#L#L#L.7#L.7a9.E#Da9#D.Ea9.7a9.7a9#La9#L.7aj#L#L#L#L#L#L#L#L#L#Lbpa2#L#L#g#L#ga2a2#ga2bpa2#La2#L#Laj#L#Laf#Laj#L.7#L.7af.7.E#L.7#L.7#L#sa9.7a9.7#L.7#L", +".E.7.7#La9aj.7#Lafajafafafa9a9.nblbl#MaYblbl#Dblafajafaj#L.E#L#Laaa2a2aja2afajaf#p#p#pa9.naf.7#L#gaj#Lajbp.7#L.7ajafa9#D#D.NaY#xblaY#x#xama0a0aY#p#Dbl#xbnaYblaY#Dbl#Da9a9.7af.7.7.7.7.7.7.7.7.7#D#s#D.N.N.N.N.N#IaY.N#Iamanay.P.PaDaD#..M.O.G#u#u.w.GaP#u.ybgaCaC#x#IaY.N#s.7a9.7aja9#La9#L.E#L#L#ga2a2#ga2#ga2#g#L#ga2#ga2#g#g.7#L.7#L.7#L.7.7af#L#L#La9#Db.#Da9.7a9.Eaf.7a9.7#L#L#L#L#L#L#L#L#L#L#L#L#La2#L#L#ga2a2#g#L#g#La2#ga2#g#L#ga2#La2#L.7#L.7a9aja9#L.E#La9aja9#L.n#L.na9aj#Laja9aj.7", +"#L#Lafaj#L#Laf#Lajafaf.Eaf#sa9a9a9a9#pbl.nbl.n#p.nafa9#Laf.7#L#L#L.ja2#La2af#L.n#p#Mbla9a9aja9#Laj#Lbp#L#L#L.7.7#D#D#saYaw.N#xbf#MaYaw#xbna0a0aYblaYaY#xbn#xaYaYbl#D#D#Da9#D.7#L.7.7.7.7.7.7.7bj#s.7#D#s#D.N.sbfa0#UaoaO.yan.2.g#m.AbA#4ar#u.0#u#S#vaBaB#uaB#v.5aoamaC#x#IaY.N.na9.7.E#L.7af#L#La2#g#L#g#L#gbp#ga2#ga2#g#g#ga2#g#L#L#L#L#L#L#L#L#L.E#L.7.7a9#Da9.Ea9.7a9.7.7#L#L#L.7#L#L#L#L#L#L#L#L#L#L#Lbpa2#La2bpa2a2#ga2#ga2#L#ga2a2a2#g#La2#Laj#L#L#L#L#L#La9#L.7#L.7aj.7#La9.7#La9.7#La9#L", +"#L#L.7#L.7#L.7#Lafaf#Laf#La9a9.na9#Da9.n#Da9#D#Dafaf#Lafaja9aj#La2a2af#Laf#Laja9#p#D#p.na9.7aj#L#L#L#L#Laj.7.7b.#D#saY.NaYbf#x#x#DaYaYaY#xbna0#xaYaYaY#xaYaYaYaY#Dblbl#D#Da9.7.7a9.7.7.7.7.7a9.7af.7#D.N.s.N#x#IaF.8amaF.0#uaybe#.ba#aaz#ua##vaOaOaO#v#v.y#uaBa#b#bga0a0awaYbl#D.Ea9a9a9.E.7a9.7#Laj#L#gaja2a2a2#ga2#g#ga2#ga2#g#L#L#L#L#L#L#L#L#L#L#L#La9.Ea9.7.7.n.7.n#La9.n.7af#L#L#L#L#L#L#L#L#L#L#L#La2bp#La2#ga2#g#La2bpa2#ga2#L#g#L#ga2#g#L#L#Laf.7#L.7#L#L#Laj#L#L#Laf#L.7#L.E#L.n#L.E#L", +"#L#Laj#L#L#Laj#L#L#Laj#L.7.7a9.7a9a9a9#Da9a9.na9.naf.Eaf#L.7#La9ajaf#Lajaf#La9a9#M#pbla9a9#L#L.7aj#Laj#Lbjbj#sbjaY.N.Naw.N.Nawbf#DblaYaYaY#xbn.CbnaYaYaYaY#xaYa0bl#D#D#Da9#D.7#L.7#La9#La9#L.7.7a9#sblaYaYbnaCa0.5amaFaB#u#a#4abarazaBa#aO.5ao.5aoaoamaOaB#u#uaZaCa0bn#xaYaY#Dbla9a9.na9a9a9#La9#La2a2#L#g#g#L#g#g#ga2#ga2#g#ga2#ga2a2#ga2a2#La2#L#L#Laf.7.7.7a9a9.7a9.7.7.7#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#g#La2bpa2#ga2a2bpa2#ga2a2#g#La2#L#L.7#Laj#L#Laj.7af.7#La9#L.7ajaf.7#L#L#L.7af#L", +"#L.7af.7#La9#L.7a2#L#L.7#L.n.7.na9a9.na9a9a9a9a9afaf#Laf#Laf.E#Lafajafaf#La9.na9#D#p#sa9.n.7aj#L.7#L.7a9.Ea9#Da9.NawaY.N.NaY.N.N#D#D#D#MaY#x#xa0ama0#xbnaYaYbn.CaYaYaY#D#D#D#D#Da9a9a9a9.7#Da9#s#D.NaY#x.Ca0amamaFaB.f.Oau#aazan#v#vaFam.5aCav.CavaoaoamaOaB#uan.Ca0#xawaY.s#D#s#Dbja9bja9.7a9a9a2#La2#La2a2a2a2#ga2#ga2#g#ga2#ga2#ga2a2#ga2#ga2#L#L#L.7a9.7a9.7.Ea9.Ea9.7af.7af#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La2a2#ga2#ga2#L#ga2#g#La2bpa2a2bp#L#L#L#L.7#L.7af#L#L#L#Laj#L#L#L#Laj#L#La9aj.7#L", +"#L#L#L#Laj#L#L#Lajaf#Laja9.7.7a9.7a9a9a9a9.na9a9aja9#Laja9#L.7#Laf#Lafaja9a9#D#D.nblbla9b.#L.7.E.7.n.7.n#D#D#s#D#D#D#D#s#D#D.n#D#D#D#s#Dblawa0.Cama0a0aYaY#xa0amblaY#D.N#D#Dbj#Dbj#D#D#D#D#D#D#D.N#x#x#xbg#vbmaBbk#a#Ea7a7aZ#va#amb#ao.C.W.Cbf#IaqaoaoaoaO#SaZ#ubn#I#xaY.Na9a9.7a9a9a9a9a9a9a9a9#Lajaf#L#L#L#La2a2#g#g#ga2#ga2#ga2a2#ga2a2#ga2a2#L#L#L#L.7.Ea9.7a9.7a9#La9#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#g#L#g#La2bpa2#g#La2#ga2#ga2#ga2#L#L#Lajaf#L#L#L.E#L.7#L.7#L.7#L.7af.7aj.7af.7#L", +".E.7.n#L.7#L.7af#L#L#L.7aj.7a9.Ea9a9a9.7a9a9.7a9afafafafaja9aj.7afaja9#La9a9#s#D#p#M#D#s#D.n.E.7a9.na9#D#sa9#D#D#D#s#D#D#Da9a9.n.N#D#D#Dbl#xa0ama0ambnaYaYbnama0aYaYaY.N#D#D#Dbj#D#D#D#D#s#D#Daw.C#I.Caobm.G#faG.yaBbh.l.taFb#.5a0a0aoa0#xbo#xboaqavaoamaC#Sa7an#I#x.N.s#Dbjaj#L.n#Da9#sa9a9a9a9#Laf#L#Laf#Laf#L#ga2#ga2#ga2#g#g#ga2#ga2#ga2a2#g#L#L#La9.7a9.7.7.7.n.7.7.7#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La2#ga2a2#ga2#ga2a2#g#L#g#La2bpa2#L#L#L#L.7#L.7#L#Lafaj#L#Lafaj#L#L#L#La9#L.7aj#L", +"#L#L#L#Lajafaj#Laf#Lafaf#Lafajaf#L.jafajaf#Laja9aj#Laj#L#L#L#Laj.7.7.E#Laj#L.7.7bl.NawaY.NaY.N.s#s#D#sa9bj.Ea9.Ea9.na9.n#D#s#D#Da9.n#D#D.saY.s#x.R.Rbn#x#x#xaY.NbnaYblbl.na9.7.7#D.N.N.N.Nbfbfbfavama#aSaG#z.G.0aoa0aC#xaCbn.Wbn#I#xaY#I#x#x#I#x#Ia0avao#v.0aBa7#IaYa9.7.E.7#D#Da9a9a9a9.7a9.7afa2a2a2a2a2#g#ga2#ga2#g#ga2#g#ga2#ga2#g#ga2#g#ga2a2#g#L#L#L.7a9.7.na9a9afaj#La2a2#L#Laf#L#L#La2#L#L#La2#La2#La2#La2#L#L#L#L#L#L#La2a2a2a2#g#ga2#g#La2#La2#Lajafa2.7#L.7af.7#L.7afaj#L#Lajafafaf#L", +"#Lafajaf#L#Laf#Lajafaj#L#Laf#Laf#Laf#Lafajaf#Da9.7a9.7.7af.Eaf.7.na9a9a9.7.7.n.7awaYawaYaw.s.N#D#Da9#D.na9.7a9.7.n.7.7.7#D#D.7.7#Da9#s#D.N#x.N#x#Ua0a0bna0bn#IaYb#am#xaY.N.N.N.Nbj#D.N#I#xaqaoa0a0a#a7#fa6az.0.5bnaCbnbn#x#x#x#xaYboaYbfaw.NaY#I#x#Iao.8.5#v#u.T#I.N#sbja9bj.7bj#sa9.Ea9a9.7a9a9#L.ja2a2.j#ga2#g.j#ga2#g#ga2#ga2#g#ga2#g#ga2#g#g#ga2#L#L#La9aja9a9af.7af#L#L#L#gafa2#La2afa2#La2.3#La2#La2#La2#La2#La2a2a2a2a2#La2a2#L#g#La2bpa2bpa2#ga2#L#La2#L#L#L#L#Laj#L#L#La2a2afafaj#Lajaf", +"#L#L#L#L#L#Laj.7af#Laf#Lajaf.Eafajaf#Lafa9a9.n#D#D.n#Da9#s#D#D#D#D#s#D#s#D#D#D#sbl#s#D.s#D#s#D#s.7aj.7#L.7aj.7#L.7af.Ea9#L.7a9.7.na9#D#D#D.NaY#xa0.Vaoamama0ambna#b#amambn#x.C.Cawbf#xa0amamaF#v#vaBazaSa7a#aq.W#x#x.s#xaw#xaw#x.N.NaY#xaY#x#I.N#I#xavam.8.yana7#U#x#D.7b..7a9#Da9a9a9a9.7a9af.7a2#La2#L#ga2#g#g#ga2#ga2#g#ga2#ga2#g#ga2#g#ga2#ga2#L#L#L#L.7a9.7a9a9a9#La2#La2a2#L#Lafa2#La2#La2#L#L#La2#La2#La2#La2#L#L#L#La2#La2a2a2a2#g#ga2#g#La2bpa2a2#Laj#L#L#L#L.7#L.7#L.7af#L#Laf#Laf#L#L", +".7#L#Laj#L#La9#La9a9a9a9a9a9a9a9af#L#D.n#D.7#D.7#D#D.N.s.N.N.N.sbl.NblaYblaYawaY#M#D#Ma9#D.nbj.7#L#L#Laj#L#Laj#Laj#L#L#L.7a9.E.7a9a9a9#DaY.s.N#xaCb#a#aFa#amamam#vaFamam#xa0#xam.CaCamamaObma7aza7aZbm.tam.C.Cbfaw#xaYaY.NaY.NaY#DaY.s#xawbfaY#x#x#Iaqao.8aZ#ua7ao#xaw#Da9b..7#Da9#s.7a9af.7a9a9a2#La2#La2#ga2#ga2#g#g#ga2#g#ga2#g#ga2#ga2#ga2#ga2#g#L#L.E#L.7afa9afa9#Laf#L#ga2#La2#La2#La2#La2af#La2#La2#La2#La2#La2a2a2#La2#La2a2#La2#La2bp#g#L#ga2a2#g#La2#L#L#L#L#L#L#Lafaj#Lafaj#Laf#Laf#L", +"a9a9a9a9a9a9a9.n.7a9.n.7a9a9.n#D.na9#s#D#D#D#D#D#D#D.sblaY#saY#DaY#MaY#saYblaY#D#D#s#D.7.n.7bj.E#L#Laj#La2#La2#L#L#L#L#L.n.7a9.7a9.E#D#D.NaY.N#Iamam#v.0a#aFa#a#bmbgamaCbna0aoa0amaF#vaBa7a7.l.TaFb#b#amam#x.Nbj#x.N.s.NaY.NaY.N.N.NaY#x.N#IaY#I#x#Iaoaq.8.ybhazb#bn.N.N.7a9#D#s.7a9a9a9.7a9#La9#Lajaf#L#L#Lbp#L#ga2#ga2#ga2#g#ga2#g#ga2#g#ga2#ga2#L#L#L#L.7a9.Ea9a9a9a2#L#La2#g#La2#La2#La2#La2#La2#La2#La2#La2#La2#L#La2#La2#La2a2a2#ga2#g#ga2#ga2bpa2a2#L#L#L#L#L#L#L#L.E#L.7a9a9a9a9a9a9.7a9", +".7a9a9a9.n.7a9a9#s#Da9#Da9#D#D#D.7#D#D#DaY.Naw.Naw.NaY.NaY.NaY#s#D#D#D#D#s#D#s#D.na9a9.n.7.7.7#L#g.ja2#g.j#g.j#g.j.3aj#L.7aja9.Ea9a9a9#D.N.s#x#x.Cb#aF.yaZa#a##Sa##SaFamamaOa#aZazazaza7a7bmaFaFa0a0a0bn#IaYaY.Naw.NaYaY.N.N.Naw.NaY.Naw#x.N#x.N#x#I.Cao.5.ya7az.5aoaY.s#D.E#D#Da9.na9.7.na9a9a9#Laf#L#L#L#L#Lbpa2#g#ga2#g#ga2#ga2#ga2#g#ga2#g#ga2#g#L#L#Laf.7#La9afa9#L#L#La2a2#La2#La2#La2#La2#La2#L#L#L#La2#La2#La2#La2#La2#La2a2#L#g#L#g#L#g#La2a2bpa2#g.j#L#L#L#L.7af#L#L#La9.7a9a9.Ea9a9a9", +"a9a9a9a9a9a9.na9#D#D#s#D#s#D#s#D#D#D.saY.s#xaY#x#D#M#D.nbl.nbl#Da9.Ea9.7a9.7a9.7#Laj#Laj#Laj#Laj#gas#gas#g#gas#ga2#L#La2af.7#L.7a9#s#D#D.NaYaYboa0a0aOa#a#a#aBbh.GaPa7az#uaS#TalbaaGa7aZaFaoambnaCa0#x#I#D#DaYaw.N.N.s.N.N#D.N.N.N.N#I.NaY.saY#I.N#I.C.8.5.ya7azaOb##x.N#Da9a9#sa9a9#D.na9.7a9.7a9a9.7#L#L.7bp#L#ga2#g#ga2#g#ga2#g#ga2#ga2#ga2#ga2#L#L#L#L.7a9.7.na9.7a2af#L#ga2#La2#La2#La2#La2#La2#L.3#La2#La2a2#La2#La2#La2#La2a2a2a2a2#g#ga2#ga2bp.ja2bpa2#L#Laj#L#Laj.7#L.7.na9a9.7a9a9.7a9", +"afa9afa9.na9a9a9#s#D#D#D#D#D#D#D.saY.NaY.Naw.NaY.n#Da9a9a9a9a9#Daj.7#L#Laj#Laj#Laj#L#L#Laj.7bp.7as.jas.jas.jas.ja2.ja2#L#Laja9aja9a9#D#D.Naw.N#x#xa0am#va#a#bmaB#l#0.2.2.2#0ab.4arazaZa#aFa0.W.C#x#x.NaYaYaYblbl.N.N.N.Nbj#Dbj.NaY.NaY.N.NaY.NaY.NaY.Waqao.0#ua7aBaO.Waw#D.na9#Da9.na9a9a9a9a9af.7afa9.7#L.7.7bpa2#g#ga2#ga2#g#ga2#ga2#g#ga2#g#ga2#g#L#L#L.7.Eafa9afa9#L#L#La2#g#La2#La2#La2#La2#La2#L#L#L#La2#La2a2#La2#La2#La2a2#La2#L#g#L#g#L#g#La2#Lbpa2#La2#La9#L.7#Laf#L#La9.7.na9a9a9.na9", +"#D#Ma9#Da9bl#M#DaYaYawaYblawaYaYaYawaYaYbl#D#D#s.7af.E#L.7aj.7#L#Lajbp#Lbp#L#L#L#ga2.j#g#g.j#g.j#g#g#g#g#g#g#g#g#ga2a2aj.7a9.7.7a9.na9#M#DaY.Nawbn#UaoaF#v.8am#va6a6ba#V.Z#oab.I.TbmaFaoam.C.C#I#x.s.N.N#D#D#D#DaY#DaYbl.NaY.N.s#D#M#D#D#s#D#D#s#Daw#x.CaC.5bc.yaBaZ#vam.Nbj#Db.#D#D.7a9.7#D#D.Na9a9.7a9#L#L#L#La2a2a2#ga2#ga2a2#L#L#L#L#L#L#L#L#Laf#L.na9a9#D#Da9a9a9a9#L#L#L#La2#La2#L#L#L#L#La2#La2a2a2a2#L#La2#La2#La2#La2#La2a2a2a2a2a2a2a2#L#L#L#L#L#L#L#L#L#L#L#L#L.7a9.7af#La9.7a9bja9#D", +"bl#D#D#M#D#Dbl#D#MaYbl.saY.NblawaYaYaY#M#D#s#D#D.7#L.7#L#L#L#Laj#g#L#gaja2aj#gajas.jas#gas#g.j#gas.jas.jas.jas.ja2.j#L#Laf.E#D#Daja9a9#DaY.s#x#IaCamama##uazaz.G#.a..Z#Valarak#aaZ#Sa#ama0#U.C.CaYaY.NawaY#D#D#DaYaY.sbl.N.s.N.Na9a9a9a9#D#D#D#D#s.N.N#I.CaobybcbhaB#vaF.WaY.s.Nbl.s#D.na9#D#DaYafa9a9a9#L#L#L#L#ga2#ga2#gaaa2as#L#L#L#L#L#L#L#L#L#L#La9a9#D.7#D.na9#D#L#L#L#L#L#L#L#L#La2a2a2a2#L#La2#L#L#La2#La2#La2#La2#La2#La2a2#La2#La2#La2#L#L#L#L#L#L#L#L#Laj#L#Laja9.7.Eafaja9a9#sa9#D#D", +"#D#M#Dbl#D#M#DblaY.NaYbl.NawaYaYaY#M#D#D#D#D.7afaja9#Lajbp#Lbpbp#Lajbp#Lbpbpa2bp#g#g#g.j#g#gas#g.j#g#g#g#g#g#g#ga2a2aj.7a9#Da9#Da9a9#s#D.s#x#I.Ca0aO#uazal.Y.A.1a.aHaGaz.Ta#bma##SaFaFbgama0.C#x.s.NaY.N.N#s#D#Dblbl#Dbl#D#D#D#D#Da9#D#D.7.E.7a9#D.saY#x.Wa0.8.5#S#uaB#S.5.C#x#x.NaYbl#Da9#D#D.Na9a9.7a9#L#L#L#La2asa2aaa2#ga2a2#L#L#L#L#L#L#L#La2af#L#La9.7a9#Da9a9.7#La9#L#L#L#L.3#La2#L#L#La2#Lafa2#La2a2#La2#La2#La2#La2#La2a2a2a2a2a2a2a2a2#L#L#L#L#L#L#L#L#La2.7#L#L.7af.7a9a9a9bja9#D#D#D", +"aYaYaYawaYaYaY.saY#M.NawblaY#Daw#Dbl#D#s#D#La9.7#L#L#L#L#L#L#Lbpa2bpa2aj#ga2bpa2as.j#gas.j#g.j#g#gbp.j#L#gaja2bp.j#Laf#L.7#s.N#sbjb..N#Ibf.Waq.8#vaz#zaHbs.m.B.BauaSa#aFaFbgama0ambga#aFamam.W.CaYaY.NawaY#D#D#D#sbl#D#D#D#D.Nb.a9a9.n.7#La9.7b.#Da9.s.Nbo.C.Cava#aZaBaBaOaOb#ao#x#IaY#D.n#Da9#Da9a9a9#L#L#L#L#La2a2#ga2#ga2#ga2bpa2#ga2a2#ga2a2#La2af#L.7a9a9.7a9a9#D#L#L#L#L#Laf#L#L#La2a2a2#La2#La2#La2#La2#La2#La2#La2#La2#La2#La2#La2#La2#L#L#L#L#L#L#L#L#L#L#Laf#L#La9.7.7a9.7a9#D#D#s#D#D", +"aYboaY#x#x#I#x#x#I#xaYawaY.NaYaY#D#M#Da9.7.7aj#L#L.E#L#Lbp#L#L#Lajbp#Lbp#Lajbpaj#gas#g#gas#gas.j#L#Lbp#Laj#gbp#L#Laj.7a9.7#Dbj.N.N.sbo.Caq.8#v#u#3adbe.A#Y#9.PbranaBb#amamaYaYaYa0am#vbmaOb#.C#x.s.N.NaY.N#Da9#D#pa9.na9#Da9.7a9.7a9.7a9.7.7.7.7a9#D#D.N.N#xbo.Cb#aOaF#vbma##vbmamam#xbl#D#D#D#Da9a9.7#Laf#L#L#L#g#La2bpa2#L#ga2a2bp#Lbp#L#Lbpa2#L#L#La9a9.7a9.7a9af.7af.7#L#L#La2#La2a2#L#La2a2#La2#La2#La2#L#La2#La2#La2#La2#La2a2a2a2a2a2a2a2#L#L#L#L#L#L#Laj#Laj#L.7aja9#L.na9#D#s#D#D#D.N.N", +"#x#x#x#I#x#x#IbnaYaY#IaYaY#MaY#M#D#D#Da9.7#L#L#L#L#L#L#L#Lbp.E#Lbpa2bp.j#L#g#L#g.j#gas.j#g.j#g#g#Lbpajbp#Lbp#Laj#L#Laj.7.n.N.N.sbf.C.Caoa#.w.ObB.u#.#oa8aMabalanaBa#a#a0#xaYaYaY.Wamb##Sa#b#a0.C#xaY.NaY.s#D#D#D.nbla9a9#D.n.7a9#L#L#L#Laj#L#L.7.E.7b.a9.s.N.N.s.Camam.8aF#vaZ#uaFb##xaYaY#D#D#sa9a9a9.7#L#L#L#La2a2#ga2#ga2a2#g#L#L#L#L#L#L#L#L#La2af.7a9a9.7a9a9a9#D#L#L#L#L#La2#La2#La2#La2a2a2a2a2#La2#L.3#L#La2#La2#La2#La2a2#La2#La2#La2#L#L#L#L#L#L#L.7#L#Laf#L#L#L.7a9.7bja9#D#s#D.N.saY", +".CaC.Ca0.Ca0#x.CawaYaY.Nbl.N#D#D#Da9.E.7aj#Lbp#L#L.7#Laj#L#Lbp#Lajbpaj#Lbpaj#Lbp#gas.j#gas#gas.jbpaj.7#Lajbp#Lbp#La9a9#D.N.s.N#x.WaqaO#ubk#zaHbA#Pbsbeab#a#ua#ambm.Fa0bn#xaY.N.s.Nbnb#bmaBa#aC.Caw.NaY.NaY#D#D#D#pa9a9a9a9.7a9#Laj.7#L#L#L#L#L#Lbja9bjbj#D.7.N.Nbo.C.Ca0a##vana7an#Sa0aYawbl#D#Da9a9.7af#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#Laf#La9.n.7#Da9.7afa9#L.7a2#L#g#La2#La2#La2#L#L#La2a2#La2#La2#La2#La2#La2#La2#La2a2a2a2a2a2a2#L#L#L#L#L#Laj#Lafaj#L#L.Eaf.7#La9#s#D#DaY.NawaY#x", +".C#xa0#x.W#x#x#x#DaY#Dbl.sblaY.Na9#D#L.7#L#L#Laj#Laj#L#Lbp#L.7#Lbpa2#L#g#L#g#L#g.j#gas#g#g.j#g.jbp.7#La3#La3aj.7.7aj.7#s.N.N#Ibf.8aF.y#3ad.A.MaT.P#V#P#Tan.5.C#Ia0b#bga0#xbf#xbf.N#xa0bm.T#Sao#x#x.NaY#s.N#D#D#D#p.nafa9.na9#L.7#L#L#L#Lbpaja3#L.Ebj.E.7#sbj#sbjbf.s#xavama#aBana7aZbgbnaY#D#D.7.na9a9.7#L#L#L#L#L#L#L#Lbp#L#L#L#L#L#L#L#L#L#L#La2a2#L.7a9a9a9.7a9a9a9#L#L#L#g#La2#La2#La2#La2a2#La2#La2#La2#La2#La2#La2#La2#La2a2#La2#La2#La2a2#L#L#L#L#L.7#L.7afaj#L#L#L.7a9#LaY.Naw.Naw#x#x#I", +"aY.saY.NaY#DaY.N.na9.na9a9a9a9aja9a9a9a9.7a9.7a9#Laf#L#Laj#L#gaj#Lajbpaj#Lajbpaj#Lafaj#L#L.7.Ea3#L.Ebj#D.s.N#Db..7.7.N.N.WamamaOakaybs#Y.maDbaaHaga7#SamamaC.C.CaYamb#aFb##xaY#D.n.Nawa0#vaZaZa##xaw.N#Daf.na9#s#Da9a9a9.7af#Laf#La2#g#g#L#Lbp#L#L#L#L#L#L.7.7.7.7bj.N.Caoam#vaZaz.fanama0aY#Ma9aY#D#Da9a9.7.7#D#L#La2#La2#L#L#La2a2a2a2a2a2a2a2.7afa9a9#D.7#D.7af#L#L#L#La2#ga2a2a2a2a2#ga2#ga2a2a2a2a2a2a2a2a2#La2#La2#L#L#L#La2#La2#La2a2a2#La2#L#Lafa9a9a9bja9#D#D#DaY.s.N#x#Ibn#x#x#x#x#U#x", +"aY.Naw#D#D#s#D#Da9a9a9a9a9afa9a9a9a9.Ea9a9.na9a9afajaf#La2#L#L#Lbp.7bp.7bp.7bp.7a2a2#Laj.7.E.7.E#L.E#D.s.N.Nbjbj.N.s.N#xa0aO#u#E#V#2....#KaD.YaGa7bmaFaFaoama0.CbnaCb#aOama0.N#D#Dbl#xa0bmaB#ua##x#xaY#sa9.7a9.7#D#D.7a9a9aj#L#L.j#La2bpa2#Lbp.E#Laj#L.E#L.7b.#Db.#D.s#xa0.8a##v.6azbhaOam#xaYbl#Dbl#Da9#Da9.7.7#La2#La2a2a2a2#La2a2a2a2a2a2#La2#L#L#L#D.7a9#Da9#L.3afa2#La2bpa2bp#g#L#g#La2#L#g#La2#La2#La2#La2a2#La2#La2a2a2#La2a2a2aja2#L#La2#Lafaj#La9.E#Da9#s#D#Daw.NaY#IaYaYaYawaYawaYaYaY", +"a9a9a9a9.na9a9.na9.na9.na9.na9a9a9.7a9a9.7a9.7a9#L#L#L#L#Laj#L#Laj#Laj#Laj#Laj#L.jbp#L#L.E#L.Ea3.n#D.Nbf.Cbo.Caobf.CamaOaBaz#EaraQ#.#o.Abzay.Gana#aFaFaOamam.C.Wbna0a0b#ama0#I.N#D#M#x.CaoaZbhaBa0#IaY#Da9#s.7a9#sa9#Da9a9#Laf#L#L#ga2#g#L#Lbpbp#L#L#L#L#L.7.7.7.7#D.NaY.Cambga#a7.6#ua#b#aoa0#xbl#D#Da9.7a9#Laf#L#La2#La2a2a2a2#L#L#L#L#La2#La2.7afa9a9#D.7#D.7afaf#L#La2#L#L#ga2a2#ga2#ga2#ga2a2a2a2a2a2a2a2a2#La2#La2#L#La2#L#L#Laf#L#Lafajaf#L#Lafa9a9a9#Db.#D#DaY#DaY.N.N.N.s#D.N#D.N#D#s#D", +"aj.7aj.7.7.7.7.7#Da9#Da9a9a9a9.7a9#Da9#s#D#D.n#Da9a9.na9.7.7bj.7bp#L#L#L#L#L#L#Laj#Laj.E.Ebjb..N#MawaCaoaoama0.Cb##va7#a.Oaz#uaZaZanaz#e.6anaZaFaBaOaF.5amama0a0#xaCa0ama0a0#xaYbl.NaY#xa0#vaZ.lama0#x#Mbl#D.7#D#Dbja9.Ea9af#L#La2#L#La2bp.j#Lbp#Laj#Lbpaj.7bj.7#s#D.s#x.Wa0amamanaB.0a##va#bgamaYaY#Da9a9a9#L#L#L#Laf#L#L#L.7#La2a2#La2#L#La2#L#L#L.7a9.7a9#Da9#L.3#La2#L#L#La2bpa2#g#La2bpa2bpa2#La2#La2#La2#La2#La2#La2a2#La2.3#L#La2#Laf#L#Lafaja9a9.7#s#D#D#Da9.s.N.s.Naw#Dbj.7b..7b..7bjbj", +"#L#Laf#Lajafaj#Laf.7.7.7.7.7a9.Ea9bja9#D.7a9bja9a9.7a9.7a9.7.Ebjaj#Laj.7.E.E.7.E.7.E#D.s#xbo.C.WaCamb#a#.y.0.yaB.Gazazazbhbma#aFaFa#a#aZaBa#.5.5#SaFambgama0amam#x#xbna0a0aCa0#xaYawaY#Ia0aO.lbh#vb#bnaY#s#D#s#D#Da9#Da9.7ajaf#Laja2bp#g#L#Lbp#Lajbp#L#L#Lbj.7.7#Da9#DaY#x.CaCam.5a#aOa#a##va#a##xawaY#Da9.7#L#L.7af.7#La9#Laf#L.7af#Laf#L#Laf#Laf.7a9.7a9a9#D#Daf#L#La2#L#L#L#La2a2a2#ga2a2#ga2a2a2a2a2a2a2a2a2#La2#La2#L#L#L#L#Laf#Lafa9a9a9a9a9a9a9bj#D#D#D#D#D#D#Da9#Da9#D#s#L.7#L.7#L.E#L#L", +"#Laj#Laj#L#L#L#L.7.n#La9aja9#L.7a9#s.7#Da9#Da9bj.n#Da9.7.E#Dbj#D#D#D#Da9#Da9#Da9.N#I#x.Wam.8.5#va#aBaP.G#a.U#4.Uaza7aZa#aFaFbmb#a#b#aFa#.8ama0ama0a0a0a0a0aC.Ca0#I#x#xa0b#a0a0a0aYaY.N.N#Iambm.lbmaFaobnaYaY#Dbj#D#s.7a9a9af#L#L#La2aj#ga2bp#Lbp#L#L#Lbp#L.7.E.7#D#D#D.saY#x.C.CaC.5am#v.5a#.0#va0bn#x.N#D#D.7.7a9.7a9.7a9.7.7a9#L#L#L.7af.7#L.7#L#L.7a9a9bja9#Da2afa2#La2#L#L#L#L#g#L#g#L#g#La2#La2#La2#La2#La2a2#L#L#La2afa2af#L#L#L.7a9.Ea9.7.n.7#Da9#s#D#D.N.N.sbj#sbjb..7bj#Laj#Laj#L#L.7#L", +"bjbj.7bj.7.E.7.7.7.7a9.7a9.7a9.7#D#D#D#D#s#D#D#D#D#D#D#D#D.N.s.N.sbfbobf#Ibf#xboa0.8.5#v.yan.w.G#TabaMa8#cabalaZa#aFa#b#b#a0b#b#ama0aoa0a0#x#x.CawaYaY#Ubn#xaYaY#x#x#x.Rbna0a0amaYaY#D#DaY#UaF#GaZ#S.V#UaY.s#Dbj#s#Da9.n.7#La2af#L#La2#g#gajbp#L#Lbp#L#L#L.7bj.7a9#s#Dbl.N#x#x#x#x.C.Cam#va#a#.0aF.8a0#x#x#D#D#Da9#D.7#Da9a9.7.7#Laf#L#L#L#Laf#Laf.7a9a9.7a9#D#Daf#La2#La2#L#L#L#ga2#ga2a2#ga2bpa2a2a2a2a2a2a2a2#Lafa2#L#L#L#L#Laf#La9a9#La9a9a9a9#D.7#D#D#D#D#D.s.Nbja9.7.7a9.E#L.7.7.7.7aj.7aj", +".7a9b..7.7bjbj#D.Eaf.7#L.7af.E#L#D#D#D#D#D#D#s#D#D#s#Dbj#D.s.N.N.C#x.C.C.C.W.C.Wby#vaBaz#T#4aH#..ga8bsbr.2al#TaZaFaFb#b#ama0a0a0.Cama0#xaY#x#x#xaYbl.NaYaYaYblaYbf#x#x#xbna0a0aobn#xaw#D.sa0.t#SbmbmaOa0#U.N#D#D#D#D#Da9a9#Laf#L#L#La2#L#g#L#Lbpa2ajbp#Laj.7.7.7#Dbl#DaY.N.N#Ibf.Naw.Cao.5.5a#a##va#ama0bf#D.N.N.7#Da9#D.7a9.7a9#L.7#La9#La9#L.7#L#La9.7a9bja9#Da2af#La2#L#L#L#L#g#La2bpa2bpa2#La2a2#La2#La2#La2#L#L#Laf#L.3#Laf.7a9af.7a9a9.7a9.7#D.n#D#D#D#D#Dbjbj#Dbj#s.7.E#La9.n.7.na9.7a9.7", +"#Laj#Lafajafaj#La9#D#s#D#D#D#DaYaYaYawaYaY.NaY.N.C.C#x#IaYaY#M.namav.8.5#v.0.w.G#aau#4#4#z#3.Ga7#Z#0aM.gaTayaZa0a0a0a0#xbn#x#U#xawblawaY#D#M#D#D#D#Da9#D#sblaY#Mbl#Mblbl#DaYaYaYa0#IaY.N.NaY#Ua0.t.tbm.Fam#x.Nb.#Da9a9.7af#L#La2aj#L#L#L#L#Laj#L.7#L#L#L.7#L.7af.7.7a9.7.n#D#D.NawaYaY#x.CaCamao.0a#aB.0.taFb#.VaY#Da9a9af.7#D.N#Laf#L#L#L#L#Lafa9a9a9a9a9.7.7.7a2#La2a2a2a2a2a2a2a2a2a2a2a2a2a2#g#L#ga2a2#ga2a2a2a2a2a2#L#Laf.7#pa9a9a9#Dbj#D.N.na9a9a9b.#D#D#D#D#s#D#D#D#s#D#D.n.7#L#L#Laj#L.7", +"aja2afaj#L.7.7#L#sa9#D#D#s#D#D.N#D#D#D.N.N.N.N#DaY.N#x#xaCamb#aF#SaZanaz.Galba.4.O#aaz#uaB.0aBan#Tbz.mab.2az.5#xa0bnaYaYaYaYaYaY#DaY.NaYbl#D#D#D#D.n#D#Dbl#Dbl.Na9bl#Dbl#DawaYaYbnaYaY#D.s.N#xaCbm.Fbm.tb#aC.N.Nbl.na9a9aj#L#L#L.7#L.7#L.E#L.7#L#L#L#L#L#L#Laj#La9aj.7.7.7#D.N#D#Dbl.N#xbn.Ca0ama##va##v#vbm#vaF#x#x#Da9a9#D#D#D#L#La9#L.7af.7#L#pa9afa9.7#D#La9#La2a2#La2#La2#La2#La2#La2#La2#La2#ga2a2bpa2bpa2a2a2a2a2a2#La9afa9.na9a9#D#D#Dbja9.nbj#D#D.NaY.saY.Nbl.sblaYaY.Na9.7#Laj.7.7#L.7", +"#Laj#L#Laja9.E.7#La9.Ea9#D#D#s#Db.#D#D.Nbo.Caqaq.bbnbga#aZaS.G#q#t.HaQauaGar#a#a#vaOaF.5b#.8#vaB.2.A.1aDaka#amaYaYaYaYaYaYaY#D#D#D#D#s#D#D#D#D#D.7.7a9#D#D#D#Dbla9a9.n#D#D#D#Dblaw#xaw.N#DaYaYbnb#aF.taOb#.C#I.Na9a9.7a9a9#L.7#L#L#L#L#Laf#L#L#L.n#L#L#L#L#L#L#L#La9a9.7a9.Ebj#D#D#D.s.N#x#x.W.Ca0amamaFa##vbmaBb#bnaY#D#D#Da9bjaf#L#L#Laf#L#L#La9a9a9a9a9a9.7.7a2af#L#L#L#L#L#L#L#La2#La2#L#L#L#L#L#L#L#L#L#L#La2#L#Laf#La9.7a9a9afa9a9bj#s#D.Nbl.NblaY.NaY#xaYawaYawaYbl.sbl#M.7.E#L.7#L.Ea3.E", +".7.7.E.7.Ebj.7.7.n.7a9.7#s.N.N#DaY.N#x.Cam.5a#aZaF#SaZa7arala6ay#W#W#kbhbmaFa#.5#x#x.CaCaoamaOaB#P#obsba#uam.C.NaYaYaY#D#D#D#D#Da9#Da9#D.7#Da9a9#La9.7.7a9bl#s#Da9a9a9bla9bl#D#DaY.NaYawaYaY#IaYa0aCb#.Va0a0#U.N#D#Da9.7a9.7aj#L#L#L#Laj.7#L#L#L#L#L#L#L#L#L#L.7#L#L.E#La9.7.7.7#D#D#DaY.s#x.C.C#x#Ia0aCama#a#aZa#.8a0#xaY#Da9af.7#Da9#D.7#Da9#Dafa9afa9.7a9#La9#L#L.3#L.3#L.3#L.3#Laf#L#L#L.3#L#L#L#L#L#L#L#L#L#L#L#L#La9.7a9a9a9#D.na9bl#DaY#s#x#x#x#Ia0#I#x#xawaYblaw.NaYaYaY.7#D.7.Ebja3.7.7", +"#Db.#D#D#s.N.s.NaY.Naw.N.NaYbo#xa0b#a#bmaS#aa6.Kbaba#a.faZaFb#amb#b#ama0.C#xbf#xbobf.NaY#xao#v#u.q.qaGanamaYaY#DaY#sbl#Da9.7#L.7.7.E.7a9.E#L.7.E#L#L#La9.nbjbl#Da9a9.7a9.7#D#D#DblaY#xaYaY#IaYaY#xbna0bnbna0aCbn#sbl#Da9.7af.7a9#L#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La9.7af.7a9aj.7#D#D.N.Nbo#x.Nbl#Ia0am.5aO.0aB.0b#.CaYbla9a9a9.7a9.7a9.7a9a9a9#pa9a9a9bj.7.7#L#L#L#L#L#L#L#L#L#L#Laf#L#L#L#L#L#L#L#L#L.7#La9#Lafa9bja9#D#D#D#Dbl#DaYaYaYaYaY.C#xama0.CaC.C.C#x#xboaYaY.NaY.N#s.N#D.N.s.NaEaW", +".N.N.s.N.Nbf#xbfaCa0a0a0a0amam.8aZbhazaGau#j.e.e.6ana#.5ambn#xaY#I#x#xbo.N.N#saW#x#Ibfaw#x.5aZ.G.q.KaBam#xaY.s#D.7#Da9.7.E#L#L#L#Laf#L#L#L#L#L#L#Laj#L#L.7#Da9#Da9.7a9#D#D#Da9#D#DawaY#IbnaYaY.Naw#xbnbnbna0bna0aY#D#D#Da9.7#L.7#L#L#L#La9#L#L#L#L#L#L#L#L#L#L#Laj#L#L#L.n.7.7.7#La9.E.7#D.N.N.N#saY.N#x.Wa0.5aF.0aZ#v.5a0aY#Da9.7#Da9bja9#D.7#Dafa9afa9.7a9#La9#La9#La9#La9#La9#La9#L.7a9af.7af.7#L.7.7#L.7af.7.7a9.7#D#D#D#D.N.saYaY#x#I#xbnbnaOaoaoamaCa0a0bn#Ibn#x#x#x#x#I#x#xaYboaY.N#xbf#x", +"#x#xa0.CaCa0aoa0aFa##v#vaZ#uaZaZarazazanbmaF.5a0.C#x#x.N#D#D#D#D#D#D.Nblbj#D.N.sbf#x#I.CbgaBaz.2baazaF#x.n.7#Dbla9.7.7#L#L#Lajbp#L#L.E#La9#L.7#L#Lbp#L#L.7#L#D.E#L#L.E.7.7.7.7#Dbj.N#xbna0#I.N#DaYawbna0bnbn.V#U#D#D#D#D#D.7a9.7#Laja9#Laj#L#L#L#L#L#L#L#L#L#L#L#La2#L#L#L#Laf.7#L#L#La9.7#s.N.N.7#D.N.N#x.CaCaq#vaZaBa#aF#xaYbl#D#D#D#D#D#D#D#Da9a9a9a9a9a9.7.7#L#La9.7a9a9#L#L#La9a9a9.7a9.7#L.7af.7af.7a9.7.7#D#D#D#D#D.N.NaY#x#x.Ca0b#ambgamaOb#aCa0.C#I#xaYa0a0#xbn#x#xbna0aCa0a0a0ao.CaCaq", +"aoa0aoaO.5.8aFaO#u#uaSazaG#3araza#a#amam.C#x.s.Nafaf#La9bjaWbfbf.N.NaY#xawaYaYaY#x.C#xaCamaB#aaT.GaF.C#D#La9#L#D.7#Laj#L#Lbpbp#Lajaf#L#La2#L.j#Lbp#L#Lbpa9.7#Da9.7#La9#La9.7a9.7#Dbl#xaCbn#xaY.s#D.N#Ubnbnbnbna0bl#D#D.7a9.7#L.7a9#L#L#L#L#L#L#L#L#L#L.7#L#L#L#L#L#Laj#L.7#L#L.7a2.7#L.7.7#D.N.Nbj#D.s.N.N#I.Ca0aFaZaBaZ#vam#xaY.7#Da9#D.7#Da9#Dafa9afa9.7a9.7a9#L#Lafa9#La9#L#La9af.7a9a9a9afa9a9#L.7.7a9#L.7af#D#D#D.N.N.NaY.s#xama0.8aF#Sa##va0a0a0#xbnaYaYawbn.WbnaCbnaCa0aCaFb#aO.5aOaF.8aF", +"aZ.ya#amaoaFaB.Taka6aGaraBaFa0#xbnaYaYaw#D#Da9#D#L.Eaf.7a9aj.7.7aja9.n.7#D#D.sbfaw.N.Wam#v.w.Ga7.C#IaY#D#s.7.n#Laja2#L#ga2#ga2#g#L#Lajafaj#L#L#Laj#L#L.na9a9.na9a9a9.na9a9#L.Ea9a9#saYaY#x.C#x#xaYbn#x#U#x#xa0aCbn#D.7#L.7a9a9#paj#L#L#L#L#L#L#L#L#L#L#L#g#L#L#L#L#L#L#L#L#L#L#Laj#Laf.Ea9.7.7a9#Da9#D#D#DaY.NawaY.pa#.0.0a#ambn.N.N#D#D#D#D#D.7a9af#L#L.7#L#L#L#L#L#La9a9.7a9#Da9a9#Da9bja9bj#D#D#D#D#D#D#D#D#D#s#D.saY#xbn.8aFaZaBaZa#aFama0aqaC#x.N#MaY#x.Ca0aFb#b#amamb#.5aFaoaOaFaOa#bmaZ.y", +"aZa#aOa##v#vaB.T#4#z#a#uaFa0aC#xaYawaYbl#Da9#Da9.7a9.7#L.7a9.7a9af.Ea9.7#s.N.N.N#D#Ia0.8a#bkaraZ#IaY.s#D#Da9.7#Lbpa2bpa2#g.j#ga2ajaf#L#L#Laja2#Laf.7#L.7a9.7#Da9afa9a9a9a9.7a9#La9#Dbl#x#x#I#x#xawaY#U#xbn#Ia0.CbgaYa9#L#L#Lafa9#Laj#Lbp#Lbp#Lbp#Lbp#L#ga2#g#La2#L#L#Laj#Lbpaj#L#L.7#La9.7.7a9.7.E#D#D#D#D.saY.N#Ua0#va##S.0aOamaY.N#D#D#Da9#D#Dafa9a9af#L#L#L.7af#Laf#La9#Da9.7a9a9.7#D#D#D#D#Da9bja9a9#D#D#s#D.N.N#x.Ca0aoaF#vaZbmbmaOa0.W.C#x.C#xbl.NawaY.CamaCamaCamamambgamb#.5aOa##Sa#.yaZ", +"#vaFaO#v.ybmaZazbaauazb#a0#x#xaYaYaY#D#sa9#D.E.7aj#L.7aja9aj#L.7aja9.n.7#D#D.sbfaY.WaCam#u#3a7aFaYaY#D#D.n.7ajafaj#gaj#g#L#g#Laj#L#Lajaf#Laf#Laj#L#L#La9a9#Da9a9.na9a9.7.n.7.7a9.na9aY#x#x#x#x#xaYaY#x.R#IbnbnaC.t.VaYa9.7aj#L#L#Lbp#L#Laj#La2#L.j#La2#g#g#g#gajbp#Lbp#L#L#L#Lbp#L#L#L.7a9.7.7.7a9#D#s#D#DaY.NaYaYa0ama#a#.yb#a0.N.N#D#Dbj#D#Da9a9a9.7a9bja9.7.7a9a9a9#D.7#D#D#D#D#Da9#Da9#D#D#Da9a9.n#D#DblaYaY.8b#.8aOaFaOaFaOb#bgama0#x#x#x.N#U#x#I#x#x#xaoama0bna0bnaoam.5amaOaFaFaF#va##vaZ", +"aOaOaF#va#a#az#faS#ubmb#a0#xaY#Dbl.n#Da9a9.7#L#L#L#L#L#L#L#Laj#L#L.Ea9a9#s.N.N.s#x.Wb##v#Ebk#va0aw#D#D#Da9#L#L#Lbpa2#L#ga2#ga2#g#Laf#L#L#Laj#Laf#L.7#L.n.7#D.na9a9a9a9a9a9.7a9#La9#sbl.NaY#xaYaYblaYaw#x#x#x.C.C.Fb#bnbl#Da9.E#L#Laj#L#Lbp#Lbp#Lbp#Lbp#L#g#L#g#L#Laj#Lbp#Lbp#L#L.7#L.n#L#L.7af.7#Da9#D#D#D.NaY.saY#Ibn.5a#a#aFambf#x.NaY#D#D#D#Da9a9a9.7a9.7.7#L#D.nbj#D#D#D#D.Na9b.bl#Daw#xaYaYaYaYaY#Ia0a0aoam#uanaBa##vb#bgb#bnbnaYaYaYaYblaw#x#x#x#Ua0.Wa0a0.W.C.Wama0ambg.5aFaFa##va#a##va#", +"b#ao#vbmaB#uaz.Gb#b#ama0#xaw.N#D#Da9a9a9.E#L#Laj#L#Laj#L#L#L#L#L.Ea9.n#D#D.N.N#x#Iao.5#u.Oazam.C#Dbl#sa9ajaf#La2.jbp.j#L#gajbpaj#Laj#Lajaf#L#Laj#L.n#La9a9a9a9#D.na9a9.Ea9.n.7a9a9#DaYaw#x.sbl#D#sblaYbl#I#x#Ua0b#bgb#bn#D#D.7#Lbj.7.7.7.7.E.7.7#L.j#La2#g#L#La2bp#L#Laj#L#Laj#L#L#L#L.7af.7.7.7a9.7#D#D#s.Nbl.NaYaY.CaCby#va#.8#xbfaY.N.s#D#Dbj#D#D#D#D#D#D#D#D#D#D#D#D.Naw.NaY#D.NaYaw#x#xa0aoamamaFaF#v.0bbanaBaZ#vaFb#am#x#xaYaYaYaY#IaY#D#D#x#x.Ca0avamama0.C#x.Ca0aoamaFa##uaZaBaZ.y#S.0.y", +".8aOa##Sazar#ua#a0am#x#x#x.N#D.7.na9#L#L#Laj#Lbp#L#Lbp#L#Laj#Laj#La9.7.n#D.sbo#x.Wao#v.f#f.ya0bf#M#D#Da9a9#L.ja2#La2bp.j#L#ga2a2#Laf#Laf#Laj#Laf#L.7aj#Da9b.bl#Da9.na9a9a9a9.7.n#D#MaYbfaYaY#Da9#D#D#Daw.NaY#x#Ib#b#bg.VaYbl#s#L.Ebj.7b..7.7.7.7#Lbp#Lbp#L.jbp#L#L#Lbp#Lbp#Lbp#L.7aj#La9.7a9#L.7a9#s#D#D#DaY.Naw.N.s.CamamaOa#a#.W#xbf#xaY#D#D#Da9#Da9#Da9bj#Dbj#D.N.Naw.N#x#xbfaYaw#x.Ca0a0aFbma#aBaZbbaZ#uaZ.0bgb#a0am#x#x#xaYblaY#MaYaY#Dbl#DaY#xaCamamaoaqaC.C.Wamao.5a#a#.yaSazaZ#uaZ.yaOaF", +".5aF#Sbhaza7aFa0a0bn#xaw.N#D.7.7af#L#L#L#La2#L.j#g#Lajbp#Lbp#Lbpaja9.n#D#s.N#I#I.WaF#uarazaF.W.Nbl#D.n#Laj#La2a2aj#g#L#g#L.jbpaj#Laj#L#Lajaf#Laj.7afa9.na9#D#D#Ma9#p#s#D#sa9.na9#DblawaYaw#Da9a9#D#D#saY.Naw#x#xaCb#.VaC.V#xaY#Dbj.nbja9bj#s.7.7aja2#L.j#Lbp#La2ajbp#L#L#L#L#L#L#L#L#L.Ea9.7.7a9#D.7#D#D#D#DaY.N.N.N#I.CaoaFa#aB.C#x#xbf#x.N.NaY#Dbl#D#D#D.N#D.NaY.saYaY.C.W.C.W.Caqa0.8a#aZaBan#u#uan#Sa#b#ama0bnaY#xaYaY.NaY.N#s#DaY#DblaY#Dbl#I#xam.8.5aOam.Cama0aoaFbmaBbha7#a#ea7an.y.yaF.8", +"bc.y.wara7b#a0aoaYaYaYbl#Da9.7.7#Laja2#L#g.j#g#ga2bpa2bp.jbpaj#Laf.Ea9#s#D#I#I.C.WaOaz#EaZb#.C.N#sbla9afafaj#L.j#L#g#L.jbpa2bpa2#Lafajaf#L#L#Laf.E.7.n#Da9#D#sbl.n#D#M#s#D#s#D#s#DawaY.NaY#Da9.n#D#D#D#DaY.NaY#I.CaCam.Vb##U#xawa9bj.7b..7bj.7bj#Laj#Lbp#La2#L#Lbp#L#Lbpaj#Lbpaj.7#L.7af.7a9.7.Ea9#D#D#s#D.N.saYb..Nbf.Wa0aF.0#ua0.W.C#Ibfaw.NaY#saY.N.N.N.N.N.N.N#xaY#I#x.W#x.C.Wam.8aZ.waz#ubha#aFaFb#ambn.bblawaY#MaY.N.s.N.N#D#D#D#DaY.saY#I#xaCam.8aFbyaoaCaoamama#a7azararaya6.G.Gaz#u#v.8", +".J.far.laobn#xaY#D#sa9#D.7a9aj#L#L#L#L#L#Lbp#Laj#g.j#ga2#L#L#Lbp.na9.7#s.N#I.Caobh#EaBaCbn.s#IaY#Ma9.n.7#L#L#L#Laj#Laj#L#Laj#L#L#L#L#L.7aja9.Ea9bl#M#D#M#DblaYblaYawaYaYawaY.NaYawaY#Mbl#D#D#D#Da9.n#D#s.Nbl.saY#x.RaY.N#xa0aFbm#IaYaY.N#s.7.E#L#L#La2#L#L#Lajbp#L#La2#L#L#L.7#La9a9a9.7#L.7.7.7#Da9#D#D#DaY.N.NaYaY#Ia0.5.8a#an.0.5bn#xbl.N#x.C#Dbl.sblaY#I#x.W.R#Ibna0aOa##vaZazararaz#ua#aFaO#x#I#x#Ibn#x#xaYaYaY#DblaY#Dbl#Dbl.NblaY.NaY#x#xaoaobnaY#xaCa#.0aOaOaOaFaFaFaFaF.l.Ta7bh.G.G#q#e", +"araza7aFam#xaYawa9#Da9a9a9#L#L#L#L#Lbp.j#L#La2#Las#ga2#gbp#Laj#L.7.7.n#D#M#xaCaFbk#iaOaC#xblaY.Na9a9a9afaja9aj#L#L#Laf#Laf#Laf#Lajafaja9#L.7a9.Ebl.n#D#M#DawaYawbn#Ubn#I#x#I#xawaYawaYaY#D#s#D#D#D.n#D#DaY.s#x.N#U#IawaY#xbna0aF#x.W#xaw.N#D.7b.afajaf#L#Lbp#L#La2#L#L.E#L.7a9.7a9a9.na9.7a9.7.7#D#s#D#D#D.Nbl.Naw.N#x.CamaF.0.y.yaF.CaYaw#x.Caq#Ibn#x#x#x#xbna0aoamaF#vana7.wazaZan#uaZaOamamamaY.RaYaYawaYaYaYaYblaY#D#Dbl#DaY#DblaY.N#xaY#I#xbnbnawaYbnam#va#ama0a0aoamamaoam.taFbmaZ.6ar.2#4", +".faBb#a0aY#xbl#Da9a9#D.E.7#L#L#L#g#ga2#g#g#g#g#g#g#g#ga2#L#L#L#L.n.7a9a9.N#Iam.8#f.Gb#bn#UaYaw.Na9.na9.7af#Laf#Lajafaj#Laj#Laj#Laf#Laf#L.na9a9#D#Mbl#M#DawaYaw#x#I#U#x#U#Ibn#I.NawblaY#s#D#D.N.sa9#s#D#M.NaY.s#xawaY#D.s#D.Nbnama0a0aC#x#xbl.NaY#La9#L.E#L#L#L#Laj#L#L#La9.7aja9a9a9a9#D.n.7a9.7#s#D#D.Naw.N.NaY#Dbl#I#xaC.5#va#aBaFa0aC.C.Caoa#ama0a0ambgaF#va##uan.w.wan.wanaZ#vaFb#ama0a0#x#xaYbfaY#xaY.Nbl.Nbl#D#D#Dbl#D#D#D#DaY#saY.N#x#x#xaYaYaYaY#Ia0bg.5bn#xbn#xbna0a0amaCb#ao.t#SaZar#a", +"aFama0aY#xaY#Da9#D#Da9a9#L#L#L#g#ga2#gbpa2bpa2bpa2#ga2#gbpajbp#L#Da9.7#saYaY.W.5#EaraFa0#U.NblaYa9a9a9ajaf.E#La2#L#L#L#Laf#Lafaj#Lafaja9#D.n#D#D#s#DblawaY#I#x#Ibnbn#I#U#x#IaY.N.Rawbl#D#D#D.s.N#D#D.saY.saY#I#x.N#s#s.7bj.N#xa0aob#amaoa0#I#xaY#D.na9.7a9bpaj#L#L#L#La9.Ea9#D#D#D#D#D#D#D#Dbj#DaY.Nbl.N.N#x#xbfaw.NaY#xama0aOa#aBa#bgama0.5a#.0aFaOaF#SaZan#ua7bhazaBbhaBa#aFb#b#aCbnbn#x#xaYaw.Nblaw#D#Dbl#D#D#s#D#p#Da9#D#D#Dbl#DaY#x#xaw#x#xaY.NaY#x#x.C.C.CawaYaw#xaw#x#Ibn#x#Ua0a0amaFbmbm", +"bn#xaYaYaY#Ma9af.7.n#L#L.7#L#ga2bp#ga2#g#ga2#ga2#ga2#L#L#L#L.7.7#s#D#s#D.N#xamaoaS.OaBam#xaYaw.N.na9a9#Laf#L#La2ajafaj#L#Laj#Lafaf.na9a9a9bl#D#Mbl#saYaw#x.b#x#x#U#Ibn#I#xawaY.saYaYbl#D#D#D.N#D#M#sblaw.N#I#x#I#D#sbj#Db..N.N.Camamb#am.pa0a0bn#D#Da9.7.7aj#Lbp#L#La9.7a9a9#s#D#MaY#D#Dbl.saY.N.N.N.s#x#xbf#I#x.NaY#I.CaCamam#vaBbm#SaF#va#a#aB#ubh#uanaBaBbmaZ.FaFb#b#a0aCbn#I#x.RaYawaYawaY.N#D#D#D#D#D#D#D#Da9#Da9#Da9#Da9a9.saYaw.Naw.N#xaY.N#x#xaY#xaC#xaYblaYaYaYaYaYaY#xaYblaY#Ua0a0.Vbn", +".NaY#D#Da9a9a9#La9.7.7#L#L#g#L#ga2bpa2bpa2bp#gbp#g#Lbpaj#L.7.Ebjbj#D#Dbl.s#xaoa##TalaBam#x.NaY#Da9a9a9af#L#L#L#L#L#Lafaj#Laf#Lajafa9a9#p.n#D#M.NblaYaYawaY#x#I#x#Ibn#U#Ibn#I.NaYawaY#sbl#saY.s.N#sbl#s.NawaY#I#x#I.N#D#s#D.N#Ibnaoa0#Ia0a0b#aoamaw.N#Da9.7#L#L#L.7.n#L.7#s#DaW#DaYaYaY#I.NaY.N.N#I#x#xbf#x.C.C.C#x#I.Ca0amama#a#a7azaza7aZaB#uan#uan.laZ#SbmaFaF.V#Ubn#UaYaYawaYaYawaY.NaY.N#D.N.n#Da9#D.n#D.7a9#Da9bj.nbja9#s#DblaY#D#x#xaYaY#x#M.N#x#I#x#x#xaY#Dbl#DaYaYaY#xaw#x#IaYaYaY.baYaY", +"#D#D#Da9a9#Lafaj#L#L#Laj#Lbp#ga2#g#ga2#g#ga2#ga2#g#L#Lbp.7.7.7#D#D#s#D.saY.C.8aB#4#zaZa0#xaYaw#Da9.na9#L#L#Laja2#Laj#L#Lafaj#L#L#p.n#pa9blblaYaYawawaYaY#I#x#x#Ibn#Ibn#I#x#U#x#IaYblaYaY.Nbl.saY#s#Daw#Dawbf#I#x#I#x.s.N.s#xa0aC.C.Ca0.CaCa0ambg#x.N.s#D.7aj.7aja9.7a9#sa9#D.s.NaYawaYaYaY.NaYaYbf#x.C#x.W.C.Caqavaqa0ao.5#va##vaS#W#aazazanbm#SaFaFa#aFaOaFbgb#aCbnbnaw#x#x.N.N#sbl#D#s.N.N.N.N.7.7.7.7.7.7a9.7.7.7a9.7a9.7.7.7aY#DawaY.NbfaY#x.NaY#x#x.C.WaY#D#M#DaY.NaY#x#x#x#x#x#xaYaY#Da9#D", +"a9.7.7.7afaj#Laf#L#L#L#La2#La2#gbpa2bp#g#L#g#L#g#Lbp#L#L.7.7.7bj.s#D.NaY.Nao#v.QaD#za#am#xaY.N#D#pa9a9ajaf#Laf#L#Lafa2#La2#Lafaja9#p.na9#MblawblawaYaY#I#x#I#x#x#Ubn#Ibnaw#x#IaYaYawaY#M.saY.N.s#D#M#D.s.Naw#x#I.W#x#I.s#x.W#Ua0.Cava0.W.Ca0a0a0#I#IaY#D.7#L#L#La9.E#D#D#D.N#D.sbnbn#x#x#x#x#I#x.C#x.W.Caqamavam.C.5.5aFbya#.y.0.Gakar#e.TaBaFaF.5aFaOamb#a0aoambn#Ua0.C.Ca1bfbf.Nbl.N#D.N.N.N.Na9aj.7af#Laf#L.Eaf#L#L#L.7.n.7.n#DaYblbfaYaY#x#x.s#xbo#x.C#x.Na9#D#DaY.N#x#IaY#xama0bn#x#D#D.7#L", +"#Laj#L#L.7#L#L#Laj#L#Lbp#g#g#g#La2a2a2a2#ga2#L#L#L#L#L#L.7a9.7a9#Da9.s#Iama##u#.bA.faFaYawaYaYbfa9a9afa9#L#L#Lajafajafafajaf#Lafafafa9a9bl#Dbl#s.RawaYaY.R#U.R#Ubn#Ubn#Ibn#U#x#x#M#D#D#Daw#D#s#DaYaw#s.n#D.s#I.Caoaoam.8.5aO##am#va#byaFbcaqav.CaFaOaFaC#x.N.saW.N#D.N.s.N#I#xbn#U#xaw.R#x#xbna0#U.Vamb#b#aFa#bmaBaZ#vaZ#v.0aB.yaFaO.5bgamamamaobn#U.C#Ua0aCbnbnawaY#MaYblaY.saY.7.n.7.na9.E.7.7#La9#Laj.7#L.7af#Lafaja9a9a9#Da9.Nbl.Naw#x.s#xaY#x#xbn#x.baYaY#Da9.na9#DaY#x#x#x#IaYaY#sbla9.na9", +".7af.7#Lajaf.7#L#Lbp.j#L#g#L#g#ga2#ga2#g#La2#L#Laj#L#L.7a9.7.n.7#sbl.NaYaoa#azbAa6a7am.RaYaYaY#xafa9a9af#Laf#L#L#Lafaj#Laf#Lafajafaja9.n#D#M#DaYaw.R.RaY.baY#UaY#Ubn#UaYbn#x#I#x#M#D#M#D.s#D#s#D.s#Dbl#s#s#MbfavaCbgaCaoaC.5ao.5#vaOaOam.8.8amavb#b#aoaC#xaw.N.N#s.s.NaYaw#xbnbnaCa0a0a0amamaoaFaFaFa#.yan#u.G.6aBaBbmaO.5b#.5b#amaoa0a0amaCa0a0aY#xbn#Ibn#Ibn#IblawaYaY#M.Nbl.N.n.7a9.7a9.7afa9.7aj.7#L#L#L#L.7#Laf#La9a9#D.7#D#s#DaYaY.NaY#x#xbn#x#x#U#xaYawaYa9a9a9bl.NaY#x#x#xaYaYbl#Da9.7a9", +"#L#L#L#L.7#L#L#L#La2#L#L#ga2#g#L#ga2a2a2#ga2#L#L#L.7#Laf.E.7.7#DawaY#I.CaoaBazbaaSa#.VbnawaYaY.N#pa9afa9a9#Laja9af#Lafafajaf#Lafa9#pa9blblbl#MaYaYaYaw.R#x#UaYbnaw#x.R#I.R#I#x#xaYaw.NaYaw.N.N.s#D.s.saw#I.CaoaoaO.F#vaOaO.8#vbc#va#aO#vaO.5.8aCaFaO#SaOaOao#I#x#MaYawbnbnaCa0b#a##va#a##vaZaZ#uazazbh.Galay.2alaFaOaFamaCa0aC.C#I#x#x#I#x#xaY#IaY#I#x#I#x#x#I#xbl#D#M#D#D#s#D#D.n.7.n.7.n.7.7.Eaf#L#L#L.7aj#L#Lajaf#La9.7a9a9.7bl#DaY.NaYaY#x#xaCa0#x#xbnawaY#D#Da9#D#DawaY#x#I#xaYaY#D#Da9a9a9", +".7#L.Eaf#L#Laj#L#L#L#g#L#g#L#g#g.ja2a2#ga2bp#L#L#Laf#L.7.7a9.7#Dblaw#x.W.5az#aalaZb#a0bnaYaY#DaY#p#Da9afa9a9#L#Laja9aja9#La9aja9.na9#sbl.n.NblaYaw.R#xawbnaY#U#U#x.R#Ibn#I#x#I#xawaYaY.saY.s.N.N.s.saw.W.Waobc.yaBaB#u#S.y.y#va#aB#u.Qaz.waBaZ.yaZaB.0aBaB#vaO.5bn.Vb#am#Sa#aB#u.wbhazazbh.waz.GarazaSaz#a#a#a#ea0a0#Ubn#x#I#x#xaY#MaYblblawbl.NblaYaYaY#U#IaYaY#D#M#D#s#D#D.n#D.7a9.7a9.7a9.7a9#L#L.7af#L.7af.7af#L#L.na9a9bja9#D#D#DawaYbfaw#xbna0#x#UaYaYaYbl.n#Dbl#DaY.N#xaY#xaYaY#D#Da9a9.7", +"#L#L#L#L.7#L#L#L#g#ga2#g#g#ga2bpa2#ga2a2#ga2#L#L.7#Laja9#La9#sa9.NaYaY.Wambk#zaraFamambnaYblaYbl#Dbla9a9.7a9.7a9a9.7a9a9.na9a9a9#Da9bl#DblawaY.N.RaYbnbnbn#Ubnbn#I#U#x#x#x#I#x#Ibl.Naw.NaYbf#I#x.s#x.WamaO.y#uazal.U#z.U#T.G.GaP#Tal#z.U#3al.Ualal#T.G#T.G#e.w.wa7#ua7a7aS.G#e#TaS.w.wanaz.wazaS#vaOa##va#aFaFam#UaY#xaYaY.NaY.s#D#D#D#s#D#D#D#s#D#saY.saY.NaY#sbl#D#M#D#D#Dbj#D.n#L.E#L.E#L#L#L.E#L#Laj#L#L#L#L#Laf#La9.7#Da9#D#D#DblbfaY.N#xaY.C#I#x#xaYaYaY#Dbl#D#D#Dblaw.NaYaYaYaY#D#pa9#La9", +"#L#L.7aj#L#L#L#L#g#L#gbpa2bpa2#ga2asa2#g#La2#L#L#L#L#La9.7.7#D#sbl.N#Ia0#vaz#z#eam.Va0bnaYaYaYaY#Dbl#D#Da9a9.7.7a9a9a9.7#Da9#sa9bl#sbl.sbl.NblawaYbn#Ubn#Ibn.C#Ubn#x#U#x#I#x#IbfaYaw.NaY.N.saYboaYaCam.y#u#aau#4aH.4#..4aHbrbw#0.2bw.2aT.2ay.YaH#4#zal.o#T#Tal.U#aar.G.Ga4aPa4a4.ya#aZ.ya#a#a#aOa0bnaCbnaCbn#I#xblaYaY.s#D#sa9#Da9.na9a9a9.na9a9#D#D#D#D#s#D#s#D#D#s#D#D.n.7.E.7.n.7#La9#La9.E#Laf#La9#L.7#L.7afaj#L#La9a9.n#D.7bl#D#DaY.NaY#x#xbn#x.R#xaYaYaY#DaY#Dbl#D#D#DaYaYaYaYaY#D#Da9a9a9", +"#L#Laf#L#L#L#L#La2#ga2#g#ga2#g#La2a2#ga2#ga2#L#L#L.E#L.7.n.7a9#D#D#I#xaoby.w#zaSa0aCa0bn#x.Rblblbl#D#D#D#D.7a9.Ea9.7a9a9.n.7a9a9#sbl#DblaYaw#x#x#xa0#xa0a0a0aCa0#I#U#x#I#x#I#xawaY#x#I.Nawbf#x#IaCbgaBaza6aT#P.uaybaay#3#aar.Gazaz.Gazaz.Gar#aa6.w#u#uaBaZaB#uazazazaS.0#S.0aFa#am.5aoa0am.Wam.C#I#x#x#I#x#I#xaw.N.N#s.N.N#Dbj#s#D#D.7.7.7#D#s.7a9.Ea9a9a9a9a9a9#s#p.na9bj#Dbjbj#Lajafaj#L#L#Laf.E#L#L#L#Laj#L#Laf#Laf.7a9bja9#D#D#DawaY#x.s#xaY#x#x#x#IaYaYawaYbl#D#D#DblaY#s#DaYaYaw#D#Daf.7af", +"#L.7#L#L#L#L#L#L#L#gbpa2bp#g#L#La2#ga2a2#g#L#L#L#L#L.7a9#L.7#D#saY#x.C.8#va7albh.Ca0a0bnaY.RblblaY#Dbla9#Da9.7.7a9a9a9a9a9#D.n#Dbl#Dblaw#DaY#x#IbnbnaCa0#Ua0aCa0.CaC#x#I#x#I#Ibf#x#I#x#I#x#Ibo.C.paOa7#aay.K.K.K#Ear.faZa7#uaBaB#vbmaBaZa7an.TaZaOaF.FaFaOb#b##SaZ#va#aOama0.W#xavam.C.W.C#xaw#x#x#Ibfbf#xbf.N.N.saYaY#D.N.E#D.7a9#D#s.7#s#D#D#sa9.7a9.7.E.7.Ea9#s#D#s#D#s#D.Ea9.Eaf.E#Lajafaj#L.7#L.n.7#La9#L.E#Laf#L.na9#D.7a9#Dbl.NaY.NaY#x#x#x#U#x.RaYaYaYaY.N#xbl#D#D#D#DblaYaYaYbl#Da9a9.7", +"#L.3a2a2a2a2asa2#ga2a2#ga2a2#ga2#ga2#ga2a2#ga2#L#L#Laj#L#L.7b..7#x#I#x#xaC#uar#e#Sa0.CaYaY#DaYaYa9#p#pa9a9a9a9a9#s#D#sbj#D#D#D#D#saYaY.Naw#x#x.Ca0aoa0a0aCbn#Ibnaw#U#U.CaCamaCaCaw#Mbn#UbnaCbgaoaZanaral.2alaPan.y.0.yaB.0a#a#a#.8aF#v.0#u.0#v.5aCam.8amaOamaoam.F.tbg#x.C.C#xaY.NaY.saY.Nawbf.N.N.N#D.s#D.N#D.Nbl#sbl#s#D#D#D.7.Ea9.7a9.7a9.7.7a9#s#D#D#Da9#D#D.na9.na9.na9a9.na9a9a9.naf#Lafaf.E#L.7#L#L#L#L#Lafaj#L#L#La9.na9bl#MblaYaY.baYaYbl#Dbl#DaYawaYaY#M#D#DaY#Dbl#D#DaYblbl#D#p#Dafa9", +"afa2#La2a2#gaa#ga2a2bpa2#L#g#L#ga2a2#g#L#g#La2#g#L#L#Lbpaj#D.7bjaY.N.N#Iao#u#aayaFa0bnaYaYblaYaY#pa9a9blbl#D#M#D#Da9#Da9#Da9#s#Dbl#D#MaY#x#x#x.Wama0a0aCa0a0amao#Uaobg.8am.8amama0bgb#.8aFa#.0aZ#ua7#uaS#uanaBa#.8aFaOamaOamaCamb#ao.5a#.0#vaF.5a0a0aC.Ca0.Wa0am#ybgaC#xbf#I.NawaY.NaY.saY.NaYaw#D.s.N.N.N.s.N.sbl#sbl#D#D#D.n#D.7a9.7.n.7.n.7.n#D#D#s#D#s#Da9#Daja9a9.nafa9aja9aja9aja9af#L.n#L.7af.Eaf.E#L.7#Laf#Lafaf#La9.7a9blblblawaYaY.baY#Mbl#DaYaYaYaYaY.NaY#Dbl#s#Dbl#D#MaYa9bl#D#Da9a9", +"afaf#La2a2a2#ga2#ga2a2#ga2a2#ga2bpa2a2#ga2#ga2#g#L#g#L#L#Lbj.Ebjaw#D.s#xaoana6abaOam#xaYaY#DaY.N#pa9#p#sbl#Dbl#D.n#D.na9.na9a9a9#sbl#DaY#I#x.Wbnb#bgb#amamao.8aFamaO.yaZ#u#u#S#vaZan.yaZaZ.6aSa4aBaZbma#aF.5ama0aCa0.CaCa0a0a0.Wbna0a0aoam.5aoa0#I#x#xbn#I#x#x#x.p.Vbn#x#I.NaYbl.N.NaY.N.NaY.N.NaYaY#DawblaY#DaYblaYblawaY.s#D#D.na9a9a9a9a9a9a9a9#D#D#Da9a9bja9a9.nafa9.Ea9a9.na9.na9.n#Lajaf#L.n#L.7#L#L#Laj#Lajaf#L#Laja9a9a9blblblaYaYaYaYaYbl#D#MblaYaYaYaYbl#saY#D#D#D.NaYblaYbl#D#p#Dafa9", +"afajaf#La2a2a2a2a2#g#L#g#L#g#La2#ga2bpa2#La2bpa2aj#Lbp#Lajbj.7#s#D#Daw.C#v.GaTaD#vb#a0bnawaYaYaYaYblaYaYaYawaYaw#D#D#D#D#D#D#s#Dbl#saYaw#xa0a0a0bgamaOamaOa#a#a#.yan#u.G.Gaz.w.w#u#uan#uan.w.6.GaFaOaFaoaobn#I#x#I#x#I#x#x#I#xaY#x#I#xbn.CaC.Ca0#x#x#IaY#xawaYaw.R.bbnawblaYaw#DaY.saY.Naw.N#M.N#D#s#DaY.N.saY.NawaYaw#Dbl#DaYaY#D#s#D#s#D#s#Db.a9#D#s#D#s#D.n#Daf#L.na9aja9aja9afa9aja9afaf.7af.7#La9aj.7a9#L.7afaj#Laf#La9a9a9.na9blblaYawaYaYblbl#Dbl.saYaYawblaY#D#Dbl#DblblaYblbl#Dbl#Da9a9", +"a9a9#L#L#L#L.jbpa2a2aja2#ga2#ga2#L#ga2#ga2#ga2#L#g#L#L#L#Lbj#s#D#saw#Iaq.y#3aH#Pa#bga0#UaYaY#xaYaYawaYaYaY#x.N#x.Naw.Naw.N.NaY.s#DblawbnaCamb#bgaFbma##S.0aB#u.yaz.w.waz.w#u.0a##SaFbma##Sa##Sa#amamaoa0#x#IaYawaYblawaYawaY#M.NaYaYawaY#I#x#x#U#x#x#xawaYaY#D#MaY#x.b#x#UaYaY#Daw#DaY#D#D#D#D#Dbl#Dbl#sblblbl#MaY.RaYaYawaY.s.Nbl#Dbl#D#Dbl#Dbl#D#s#D#D#D.7#D#Dajaf#La9.na9a9.na9.na9a9.n#Lajaf.E#L.7#La9aj.7#Lafaf#Laf#La9.Ea9a9#p.nblblaYaYaY#Dblbl.NblaYaYaY.Nbl#D#D#D#DaY#DaYblblbla9#Dafa9", +"a9afa9ajafbpa2#L#ga2bpa2#L#g#La2bpa2a2bpa2#L#ga2#L#Lbp.7aj.7#Db.bl#x.Waobb.2a6ak#vb#a0#x.RaY#xaYaYaY.R#x#x#x#I#xawaYaYaYaY#xaw#xaYaw.Ca0b#aF#vaZaZana7.waz.G.Ga7#uaBaB.0a#aFamambnbnaCa0a0aCa0a0aoa0#IaYaw.Nbl.NaY#MaYbl#DblaY#DawaY.Nblbl#xbn.Ca0#I#xaY.N#Mbl#DawaY#Ibn#Ubn#I#x#D#D#D#D#D#D#s#D#D#saY#Dbl.s#DaYblaYaYawaYaYaYblbl.nbl.nbl.nbl.n#D#D#D#s#D#D#s#D#Lafaja9#paja9aja9af.naf.naf#Laf.7aja9aj.7#Laf.7afajaf#Laja9a9a9afa9#Dbl#sbl.Nblbl#sblaYaYaYaYaY#DaYaY#Dbl#DaYblaY#MaY#Dbl#Da9a9", +"a9a9afa9#L#L#La2#ga2#La2#ga2a2#ga2#ga2a2#ga2a2bp#L.j#L#L.7#sbj#saY#Iaq.y.waXaraS#vb#a0#UaYaYawaYaYaYbn#x#U.Cbn.Caqaqavaqavaqaqaq#Ia0ao.5#vana7bh.Ga6al#aarbkaz#uaOamam.Cao#x#IaY#I#x#I#x#I#x#xawbn#xaw#D#D#D.sbfaY.N.saY.saY#D#D.Naw.N#saY.s.Cava0am.C#IaYaY#D#M.N#x.bbnaCa0a0#x#s#D#s#D#Da9#Da9blblbl#Mblblbl#MaYawblaYaYawaY.saYaYaYaYblblblbl#s#D#D#D#D#s#D#Daja9af.nafa9.na9.na9a9.na9#Lajaf.7af.7#L.n#L.E#Laf#L#Laf#La9a9.7a9a9a9a9#D#D#M#Dbl#Dblaw#DaYawaYaY#saYbl.Naw#DaYawblaYblbla9a9af", +"afa9.7a9#L#L#L#L#La2#g#La2bpa2bpa2#L#g#L#g#L#ga2#Lbp#Laj.7bj.s#D.Waoao.waX#aazaSaFa0#xaYaYaYaYaYaYaY#xa0a0.Caoa0.8.8.5ao.5amaoamaCaoam#v#ubh.G#eayaTay.Gaza7aBa#aoaC.CaC.CaYaY#Mbf#x#xaY#xawaYaY.NaYaw#D#s.N#xaNaw.Nbl.Nbl.N.N#s#x.NaY#D.NaY#xaqa0aoa0#x.NaY#MaY#x#xbnbn.Vamaoam#D#D#D#s#D#sbja9.N#M.Nbl.N#M.NblblaY.RawaYaYaYaYblawblaYawaYawaY#D#s#D#M#D#D#D#Daf#L#La9a9.naf#La9af.n#L.nafafa9aj.7aj.7#L.7#L.Eafaj#Laf#La9a9a9aja9a9.na9bl#D#D#DblblaYaYaYaYaYaY#DaY#DaYblbl#DaYaYbl#sbl#Da9a9", +".7a9a9.7a9a9.7a9#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#Lafa9a9#D#sbl.s.Waoan.G#Ea7aBaZ#vaFama0aCamamamb#.Va0aC.VaO.0#uaSaSazazan.Gak#a.Iay.Iar.Xar.Gazaz#uaB.yaO.5aoa0#Iaw.NaY.saY.N.N#D#s#D.N.N.N.N.s.NaY.NaY.NaY.saYa9bl#sbl#sbl.nbl#D#s#DawaY.saYawaY#x#U.CaC#xbf.N.s#I#x#Ia0aoamambf#I.N#D#DaYaY#Dbl#D#Dbl#D#Dbl#D#M#Dbl#Daw#D#M#DaYaYawaYblblaY#D.na9a9.na9.najaf.nafajaj#L#L#Laj#L.E#L.n#L.E#Lajaf#Laja9aja9.7a9#Lafafaj#L#Lajafa9a9a9bja9#D#D#sblaY#MaYaYaYaYaYaYaYawaYaYaY#xaY#UaYaYbl#Dafa9#L", +"a9bja9a9.7a9a9.7#L#L#L#L#L#L#L#L.E#L#L#L#L#L#L.7aj#L#sa9#saY.saYbo.5.w.GazaB#San.l#vbgama0#xama0ama0a0bgaFbmanazak#aar#eazaz#aa6.e.e.XaraSazbhan#S#v#vaFaoa0aC.Cawaw.Naw.Naw.Naw#Da9#s#D.s.N.s.N.NaY.s.Naw.NaY.Nbl#saYblbl#Dbl#D#D#DaY#D.NaY.N#x#Ibna0a0a0.C#I#x#x#I#xaCamaFaOamaYaYaYaY.N.Nawbl#s#Dbl#D#sbl#D#Dbl#Daw#Dbl#Dbl#D#Mblblblaw#Dawbl.na9.na9.na9a9.naf.n#L.7aj#Laj#Laja9aj.7aja9aj.7#L.Eaf.7#L.7af.7afaj#L#Laf#Laf#La9.7a9a9b.a9#D#DaYblaYaYblaYaYaw.RaYbnaY#U#xbnbna0aYaYaYbl#Da9a9", +"a9a9a9a9a9a9a9a9#L#L#L#L#L#Laf#Laf#Laf#L#Laf#Lafa9a9a9#D#D.Naw.N#x.8.w#e.lbma#az#uaZaFa0aC#x#x#x#x.WamamaF.y#ealayaG.G#eanaS#e#a.I#a.X.JanaZ#Sa#aOambga0.W#x#x.saY#saY.NaY.NaY.N#D#D#DaY.NaYaY#xawaYaYaYaYaY.saY#Dbl.N#M.Nawbl#D#M#D#MaYawaY#x#xbnaCam.8.5amamaCa0a0aob#aOaObm#v#x#I#x#xaY.N.NaY#Dbl#Dbl#D#Dbl#D#Dbl#Dbl#Dbl.sbl.N#Daw.NblaYblaYa9.n#p#sbl#Ma9bl.na9.na9.7.E.7.7.na9.na9a9.Ea9.n.7aja9.na9.Ea9.7af.7af#Laf#L#Lafa9a9a9#Da9#D#D#DblaYblaYawaYaY.R#xawaYaYaYbn.Cbn#xaYaYaY#D#D#D#D", +"a9a9a9a9a9.7a9a9a9a9a9#Laf#L#L#La9.7.na9a9a9a9a9a9a9#s#D#s#D.Nbl#I#v.G.G#uaF#van#uaZ.8a0bnbnawbnavam.5#van#ealbra6#a#e.wana7#e#e.fakaz.TaBa#a#aFa0aoa0.Wbn.s#M.N#saY.sbl.saY.saY#s.Naw.Naw.N#I.N#x#I#x#x#IaYaY#IaYawaYawaYaY#xawaYaYaY.NaY#x#x#Iamb#aFa#a#aOamamamaob#b#aF#Sbmbmaoa0#x#xawbl#D#D#Dbl#D#sbl#Dbl#sbl#D#D#sbl#D#D#D#Mbl#DawblaY#saY#Mbl#Dbl#M#D#M#M#Da9#sa9.n#D#D#sa9.Ea9b..na9.7a9.na9.n.7.7a9.7a9aj#Lafaj#Lafaj#La9.Ea9.7#D.E#D#DblaY#MaYaYaYaYaYaY.R#x.R#xbn#U#xbnbnaYaYbl#Dbl#D", +"a9a9a9a9afa9afa9af.nafaf#Lafa9a9afa9a9a9a9.na9.n#D#D#D#D#D#Daw.N#I.y.GazaZb#aOa#anaBa#aoa0aCbna0a0.5.8an.G.2.K#P#q#e.6anan.wazakazbha7aZaFam.8am#xaC.C#I#IaY#D#saY#saY.NaY.NaY.NblaYblaYaY#I#x#x#x#x#I#x#x#x#xaYaYbn#xbn#U#x.baY#x.s#x#x#I.Ca0.CbgaF#vbma#a#aOambgamb#aoaFaFaOaF#va0#x#I#x.Na9#D#s#Dbl#D#Dbl#D#Dbl#Dbl#D#Dbl#Dbl#DaYblaY#Dawbl#DaYaY#MaYawaYawaY.nbl#p#sa9#sa9#D#s#D#Da9#D.n#D.na9.na9a9.n#Da9#D#Lajaf#Laf#Laf#La9a9a9#Da9#Da9#DaYblaYaYblaYawbnawaYaYaYaYbn.Cbna0.Cbn#xaYaY#Da9", +"#pa9a9a9a9a9a9a9a9a9a9a9a9a9a9.na9a9a9a9a9a9#Da9#D#s#D#s#DaY.NaYaCaZ.6az.0aOaF#van#uan#vamamamamaOa#analba.g#P#P#a#Tan.y#uaZaza7an.laZa#bgama0.C#U.C#U#I.N#s#s#D#s.Naw.N#M.NaY.saYaw.Naw#x#x#x#U#x.baYbnaw#xawaY#Ubn#U#x#Ubn#xbn#xbn#Ia0a0a0aCa0b#.t.tbma#aFaFb#amamamam.Vb#b#.V#Sbga0#x#xbl#D#Dbl#Dbl#Dbl#s#Dbl#D#M#D#Dbl#sbl#Dblaw#DawblaY#DaYawaYaYaY#Ibn#Ibn#Mbl#s#D#D#Db.#D#sa9#s#s#s#D#s#D.n#D.na9#D#D#s#Dafafaf#L#Laf#L#La9a9.7.nbja9bj#DblawblaYaYaYaYaYaYaY#x.R#x#xbnbnbnawaYaYbl#Da9a9", +"a9a9#pa9#pa9#pa9a9a9a9a9a9a9#pa9a9.n#p.nbl.n#pa9#D#D#D#D#D.Nawbfbn#vazaS#SaF.8#vaZ.6aBa##va##v.0a7.faG#PaD#V.Kay.XazanaB.0#vbm#SbmaZ#vamama0aC#xa0.W#x#x#I.N#D#s.N#M.NaY.NaY.saYaYaYaYaYawbn#x#x#x#xbn#Ibn#x#x#xbn#xa0bna0bnaCbn#xa0#x#xbn.Ca0am.V.Vb#aOaFb#bgamaC.C.CaCa0a0aCa0a#aFbgbnaY.N#D.7#D#M#D#Dbl#Dbl#D#D#Dbl#D#Dbl#D#D#M.NblaY#DawblaYaY#Ibn#Ibn#Ubn#IaYawaYawaYawaY.s#D#s#Da9#sa9#s#D#sa9#Dbl#s#D#D#Daj#L#Lafaj#Lafaja9a9a9#Da9#D#Da9blaYblaYawaY.R#xaY#M.RaYawbna0#IaYbl#Da9a9afafa2", +"#pafa9afa9a9a9a9#pa9#pa9afa9a9a9#p#p#D#pbl#p.na9#D#D#D#DaY.NaY#Ia0#v.Gaz.0#vaF#vanaz.w#u.0#u.waP#A.f.Xa6.Ia6akaSanaZa#aFaoaFaOaF#SaFaFama0aC#x#x.Wa0.W#Ibf.N#sbj#M.N.saY#s.NaY.NaYaYaw#xaY#x#I#x.R#x#x#x#xaYbnaY.Cbnbn#xbn#x#xbn#x#I#xbn#xa0.Ca0.pb#b#aFb#aFb#.V.C.C#x.CaCa0#xa0.FaFaOa0aYbl#D#sbl#D#Dbl#Dbl#s#Dbl#D#M#Dbl#D#M.Nbl#DaYblawaY.saY#UaYbn#x#U#x#Ubnaw.Rawblaw.NawaY#s#s#s#s#D#s#D#sbl#Mbl.n#Dblbl#Dafaj#Laf#Laf#L#La9.7a9.7#s.7#DbjblaYblaYaYaYaYaYblaY#xaY#x#xbnaYbla9#p#p.naf#La2", +"#L#La9a9a9afa9af.j#L#La2af#La9a9#sa9#s#D#DaYaYblawaYaY#I#xbn.Ca0#Ubg.laz#uaBanaBa6#a.Xa6#aak#ebh#Sbm.Fa#aFb#amaoa0aCa0aoa0amb#.8b#aoa0aCa0#xaC#x#I#xaY.N#M#D#D#s#D#sa9.7a9.7.n.7#D#D#D#s#DaYaYaY#sbl#Mbl#Dbl#D#Dawbl.Naw.NaYaYawaYaYaYaw#DaYbl#DaY.RaYaYbnbna0a0#Ubnbn#x#x#x#I#xa0bgaBb#a0.s.s#L.NaY.N.saY.N.NaYbl.NblaY#I#x#x#x#Mbl#MaYaY#x.b#x#xbn.Wambgamamam#Ua0bnaCa0a0amaoaw#x#x#x#I#Iaw#Mblbl#sblbl#D#D#Da9#pa9a9a9a9#Laf.na9a9a9a9#paf#pa9a9#MaYaY#x#xbnaw.RaYbna0a0a0aY#D#pa9a9#La9#L#L", +"#L.7#Laf.7a9.7a9#Laf#Laf#La9.7#Da9a9blbl.Nbl#DaY#xaYaY#xaCa0amam.t#uazar#e#T#a#zacbaayaraS#uaZa#aFaFaFb#amaoama0a0a0aCa0a0ama0amaoa0a0a0aC#xaC#xbn#I.saY.s#D#sa9a9#sa9a9.Ea9.7a9#D#s#DaY#D#D#s.Nbl#D#D#D#D#Dbl#DaY#DaY#Dblbl#DaY#D#Dbl#DaYbl.NaY.baYaYaYa0#Ia0a0#x#UaY#x#U#x#xaYbnam.FaOa0#x.s.7aY.saY.NaY.NaY.sblawaY.N#x#Ibn#xaYawaY#xawbnaY#U#x#IaCa0aCbg.paobn#U#Ua0aCaCaCb#aCaC.C.Wa0.C.baYawawaYblaw#D.s.Nbla9#p.nafa9ajafa9#pa9#pafa9a9a9#pa9blaYaY.b#xaYaYawa0#xa0a0#UaYbla9a9a9a9#L.7#L", +"#Laf#La9.7af.7af#L#Laja9.7a9a9bj#D#D#D#MaY.NaYaY#MaY#Ua0amam.5.5aSal#PabbrayaTaTaGara7aZaZaZbm#vb#amamaCa0#x.C#x#I#x#x.CaC.CaC.5b#aob#aCamaC#xbn#I#xaY.s#D#sa9#s#Da9.Ea9.7a9.Ea9#D#D#D#D#s#D#D#D#Dbl#D#M#Dbl#sbl#DaYblaY.saY#DaY#MaY.Nbl.sbl#D#DaYaY.baYaYbn.CbnbnaYaYbn#x#x#x#xaYbnam#Sama0.N#s.NaY.Naw.Naw.NaY.NblaYaw#x#x#x#IaYaYawbl#x#I#xa0#Ia0aC.pbgb#bgb#.pa0.V.pb#.Vb#bgbm.taOaFaFao#U#x.bbn#IaYaYaY.NaYbl#Dbl#Da9a9a9a9a9a9a9a9a9a9.na9a9a9bl#DblaY#x#xaY.R#xaCama0#x#xbl#s#Daf.7af.7#L", +"#L#L.7a9.7a9a9.7af#La9a9a9#D#D#D#D#MaYaY.N#x#I#x#xaY#x#xamaO.0bbaT#PaD#VaTaRar#eaBaZbmaFaFamb#ama0aCama0.C.C#x#I#xaY#I#x#x.W.CaCaOaFaob#aoamaC.C#I.b.NaY#s#Da9.7.n.7a9.7.n.7a9.7#D#D#D#D#D#D#D#D#D#M#D#Dbl#D#Dbl#D#D#sbl#Dbl#D#D#D#D#Dbl#D#Dbl#DaYaYaYbn#x#x#x#IaYbnaY#IaY#xaY#IaYbna0aBbmao#x.NaY.saY.NaY.NaY.saYaw.NaY#x#I#x#xaw#x.N#I.C.CavaCaFaOa#aBa##vbm#Sbm.taFbmbmaZaBbh#kbhbhaZ#Sa#b#a0aCa0a0#U#xaYaw.Nbl#Mbl.n#D.n.7a9a9.na9a9#sa9#Da9a9a9.n#D#D#xaY#xawaYbnama0ambnaYblbl#Da9#Da9#L.7", +"a9a9a9afa9#La9a9.na9a9bj.n#D#D#saY.NaY#x#x#x#x#x#Ubnambga#.0#u#uaH#4#aazanaBaZbm#SaFaOb#bgamamama0.C.C.W.C#Ibf#xbf#I#x#x.C.Cao.8a#aOaOamaoa0.Wa0aY#xaw.N#D#s.7a9.7.n.7a9.7#L.7aj#D#D#s#D#D#D#s#D#D#Dbl#D#Dbl#D#Dbl#D#D#Dbl#D#Dbl#D#Dbl#D#D#D#DblaY.NaYawaY#xbn#xaYaYaYbn#x#x#x#x#U#xamaBaBaBa0.Caw#xaY#IaY#xaY#x#x#x#Ibn#xa0.Wa0.CaoamamaCamao.5azaz.G.Gar#e.G#a#eaz#ear#e#a.X#a#jaGak.faSaZ#vb#ambga0a0a0#I#x#xaw#xblaY#Da9#Da9#D#D#Da9#Da9#Da9.na9a9#D#DblaY#x.Rbna0.Cama0#x#xbl#Dbla9#D.7.7a9", +"a9.7a9.7a9.na9.7a9.7#s#D#D#D#D.N#x#x#x#I#x#x.Ca0amaOa#.yanaBan#u.6aBa#amb#a0b#amamb#amamamaoa0aoa0aCambn.C.C#x#Ia0.C.CaCamao.5aO#vaFaOb#aoa0a0.WaYaw.NaY#s#D.7.n.7a9.7.n.7a9.7a9#D#D#D#D#D#D#D#Dbl#D#Dbl#D#Dbl#D#D#Dbl#D#D#D#D#Dbl#D#D#D#Dbl#D#D#sbl#D.NaYaYaY#xaYaYaY#xaYaYaY#xaYa0a0bmaz#uaOam.C.W.C.C.C.C.W#x.W#xamamamaoam.5aoaF#v.y.0#uaB.wal.2ayal.2aya6aTa6alaR.2ayayaT#P#t.K.e.X.GaSaZaBaFb#amaoa0a0bna0aYaYawblbl#sa9bj.n.7#D.7a9bja9#Dafa9afa9bl.Naw.N#U.CaCaFaoamama0aYaY#D#D#Da9#L.7", +"a9a9.na9.7a9a9a9a9#D#D.N#s#DaY.saY#x.C.Ca0aoamao.0aZaBaZaB.0aBa#amb#a0aCaC.pa0a0aob#ama0am.C.Ca0.5b#amaCam.W.C.CaCa0ao.5amaOaF#vaF.8amamama0aqa0aYaw.Naw#D#Da9.7.n.7a9.7.7af.E#L#Da9#Da9#Da9#Da9#Da9#Da9#Da9#Da9a9a9afa9afa9afa9a9a9a9a9a9a9a9a9bl#D#Dbl.N.NaYaYaY.RawbnaY#x#I#xawa0b##Sazbha##vamaqao.Cavamao.5ao.5.8.8aF#v.0.yaZaB.waza7az.G.G#aararar.X#a.Xar#eazazaralalalayayaya6.Ial.XaSaS#va#aFaO.5aC.CaC#xbnaY.N#M#D#D#D.7a9.7.Ea9.7.7.Eaf#La9#D#D.N.NaYbnbnamamb#aoama0aYawblaY#D#D#D.7", +".7a9.7a9a9a9.Ea9bja9#s.NaYaw.NaYa0.Wa0aCamamao.5a7az.waZa#aFaFaFamamaC#xbn#xam.5amamamaoama0aoa0aOaFaoambgamaCam.8aFaOaFaOaFaF#vaFaFaOb#aoamaCamawaY.Naw#D#D.Ea9.7a9.7.n.7.7a9.7#D#D#D#D#D#D#D#D#D#Dbl#D#Mbl#D#Ma9a9a9a9a9a9a9a9.na9a9.na9a9.na9#D#D#D#DblaY.saYaYaYaY#xaY#xaY#xaYbnaObmazaZ#Sa#.8.8.8.5am.8.5.8a##va#.ybbbb.w#uazarar#a#eazaSaz#ua7aZaZaZaZ.Tbm#SbmbmaZan#uaSaz#aalaR.2.IaGaraSaZaBa#aFaoama0aC.R#IawaYbl#D#D#Da9.7.7a9.7.7a9.7af#L.na9#D#s.N.NaYaCamaoaFamama0aYaYaY#D#D#Dbj#D", +".N.N.N.N#D#D#D#DawaY.Nbf#xaqaqavamamaF#v.0#u.w#e#va#b#.5amamamaF#I#x#x#x#Ia0#x#x#x#I#x#xa0ao.5amamaoaFa#a#aBaZaZ.TaBaZ#SaFaFaF.5ao.5aoam.C.W#x#xaYaY.saY.N#s#D#Dajafaja9a9a9.7a9#Da9bja9#D.7#Da9#Dbl#Dbl#D#Dbl#D#Da9.7a9.7a9a9bja9#Da9#D#D#Dbl.Nbl#Dbl#D#D#Dbl.NaYaYaYaYaYawaYaY.Nbfa0b#bmaBana#bma#bm#u.6#T.oaR.Gararal#aalalal#Taraz.6#uan.0.0b#.8b#aob#aoambgamam.8aoamaO.8aFaBbhaz.Gar.X.X#abhazan.TaZbmbma#aCa0#xaYbfaY#s#D.s.N#D#D#sa9.7.7#s.7.7.7a9a9#D.7#DaYam.5aOa#amambf.N.N#s#D.NaYbf", +"aYaYaY.saY#s#D#D#D.s#x.Wao.8aq.5.yaB#uanaBan#uanaFaOamaob#aoamaobn#x#U.Ca0.C.C.Wbna0a0aoaF.5#va#.ya#.yaBaZaBbh#u#SaBaZaOa#.8aFbg.5aoamaobn.Cbn#x.sbl.NaY#D#Da9#Daf#L#La9.7a9a9.7#D#D#D#D#D#D#D#Dbl#Dbl#DaY#DaY#D#Da9a9.7a9#D.7a9a9a9a9#Dbl#D#D#D#D#D#D#D#D#D#D#DaYaYaYaYaYaYaYaY.N#x#xbgaFaZ#ua#bgaF#vanaz#ealalazazaz.Garaz#q#ebhananaZaZa#a#a#aCama0a0aoa0ama0aqaoamamaFaoam.8a##SaZ#uana7aSbhaBaZaZbmaOaFaOaFb#ambnbn#IaY.NaY#D#D#D#D.7.7b..7#D#Da9.7#s#D.n#D#MaY#Iama#aFaoa0#x.saY#D#Dbl.N#x", +".Nbo.N.N#xbf#xbf#x#Ia0a0aOa#aBaz.GaP.wan.ya#a#a#aCamambgama0a0a0.Wa0.C#xa0a0a0amamaoaFama#a#.0#vaSazbh#uanaBanaZa#aOaFaO.5aOaqamaoama0.C.C#Ibn#IaYaYaw#D#s#D.E.7#Laf#La9a9.7a9a9.7a9.7a9.7a9.7a9#D#D#D#D#Dbl#D#Da9.7#Da9.7a9.7#Da9.na9a9#D#Dbl#Dbl#Dbl#Dbl#D#D#p#D#D#D#D#D#D#D#D.N#DaYa0b##SaBaZamamaF#v.0#u.6.wan#u#uaSananaZaBa##vaFaFaoamamama0a0aCa0bna0#xaCa0a0.Cao.CaoamaoaF.5aOaFaFa#aFaFaF.5aoamaFamaFaob#bga0aobnbn#x#x#M#Dbl#s#Da9.7a9.s#D#D#D.N#DaY.N#Daw#xa0aoaF.5b##IaYaY#DawaYaw#x", +".N.N#Ibf#x.W.C.W.5#v.yaZ.G#z.Kba.o#e.w.0a#a##va#amamaOaFaOaFbgamama0amaoam.8.5.5a#aFaFa#aBan#ubh#a.Xar.Gbh#uaZaBaO.5aoamamaC.C.Wa0a0.W.C#I#x#x#xaY#saY#D#D.7af.7af#L#La9a9.7#D.7#Da9.7a9.7a9bja9a9a9a9a9a9a9a9afa9.7a9.7#L.7a9afa9a9a9a9a9#Da9#D#Dbl#D#D#D#p#D#D#D#D#Dbl#Dbl#Dbl.s.NaY#xa0a#aB.0amamamaFa#a#a#a#aBaZaZaZ#va#.0a#b#b#bgamambn.Cbn.Wa0.C.C.C.Wa0.C.C.C.Wa0.Ca0.Ca0aoamama0a0bn#Ubn.Wa0.Ca0.W.C#U#xb#.Vb#b#a0ama0a0aYaY#D#D#D#s#D#saYaY.s.NaYaw.NawaYaY#Ia0amamaOam.C#x#xaYaw#x#x.C", +".C.W.Caqaq.5.5.5anaP.o.Ya8#obs.g#TaS.wan.0#va##v.0bm.0a#.0a#a#.yamaoaFamaOa#aOa##va##S.0aZ#uaSaz#aaG#a.Gaz#uan#u#vaOam.8aCaq.W.C.C.Wa0#x#x#x#IaYawbl#D#sa9a9#L#Lajaf#L.na9a9.7a9.7a9#D.7#Da9.7a9a9a9af.7afa9.7a9.7af#L#Laf#La9.7afafa9.na9a9bl#Da9.na9a9a9a9a9afa9.na9a9.7a9a9a9.N#D.N#M#xaOaZaBamaOam.8am.8a#.5a##va#aoaFaFamamaoa0a0bnaC#x#x#x#x#I#xaY#xaY#xaY#I#x#x#x#I#x#I#xa0bn#I#xawbl.Nbl.Naw.NaY.NaY#xaYaCa0ao.Vbgb#b#b#awbnaYaYblblaYbl.NawblaY.NaYaYaYawaY#x#Ia0bga#aOamaC.C#xa0.Wa0am", +"aoaFa#aOa##v.y.ya4.2#4.4a8aDaTaRanananaZaBaFaFaF#v.0#v.0#v.0#v.0amb#aob#amam.5aFamaOaFa##v.0.yaZaz.wanazaz.w.w.waO#vao.5aoamaCam.Wa0#x#xaw#xaYaY#D#M#Da9a9.E#L#L#L#Laf.7a9.7#Da9.7a9#L#L#L#L.7#L#L#L#L#L#L#L#La2#La2#L#L#L#L#L#Lafajafafa9a9a9afa9a9a9a9a9afa9a9a9.7a9.7a9a9.7a9.N#D#D#DaYam#SaZaF.5aFamamamamaoaFamamb#amamaoa0a0bnaC#x#x#xaY#IaYaYaYaYaYaYaYaY#xaY#IaYaYaYaYaY.s#xaY#D#D#D.7.n#D#D#D#M#D.N.saY#xa0a0amamambgambnbn#UaY#x#xaY.saY#x.NaYaw#x#I#x#x#I#xa0a0aF#vaZ.5a#amaCa0am#v.5", +"an#uan#uan#ua7#uaz#a.Gaz.GaSaZaZ#vbybca#.5aoamb#.5b#amb#amb#amb#aCama0amamaob#amaCa0a0aoaFaFa#byaOby#v.yaZaB#u#ua##v#S#v.5ao.5aoa0#I#xaY#x#IaYaw#Dbla9#s#L#L#La9#Laf#La9#La9.7a9#L#L.7af.7af#Laf#L#L#L#L#L#L#L#Laf#Lafa2af#L.3#Lafafafafa9afa9a9#Laf#Laf#L#Laf#L#L#L#L#L#L#L#L#L.s#D#s.7#DaCa##ua#.0.5.5amama0a0amaoamaCamaCa0#xbn#x#x#x#xawbfaY.N.N.N.s.N.N.s.Nbl.Nbl.NaY.NaY.Nbl#D#D#s.7.7#D.7a9.n#p#Dbl#DblaY#x#x#xbnbnama0am.Vama0b#aCa0#x#xbn#I#x#x#xbnbn#x.Ca0a0aCam#van.wan#vbyaF#va#.yan", +"alal.Ga7bhaZaZaZa##Sa#aFb#ao.5.8aFaFamama0amamaobn#Ubn#Ua0#Ibn#Ua0a0a0aCa0amamao#x#xaCa0aoamao.5avam.8.8#v.yaB#u#SaBaB#u#S#vaO.8amaCbn#x#I#xawaYbl#sa9a9#La9.7ajafaj#La9#L.7#Da9.7#Laf#L#L#L#L.7a2#ga2a2a2a2a2a2#La2#L#La2#L#L#La2af#Laf.na9a9a9af#Laf#La9af.7af#L#L#L#L#Laj#L#L#D#D.7#s#D.CaBbhbb.y.0aOama0aoa0ama0ama0bnbn#xaYaCbnbn#x#xaYaY.Naw.NaY.NaY.NaY.NaY#DaY#M#Dbl#M#D#Da9.7a9#Dbjb..7afa9.na9bl#DaY.N#Ibf.W#xaC.Ca0amamb#b#a0ama0ama0#xbn#x#U#x#U.C#UamaCama0ao.0.w.6.wan.yan.yan.waP", +"#q.6a#aF.5aCa0a0bnbna0aCa0amb#am#U.Vbnbn#xa0.C#x#x.NaY.NaY.N.N.N#D#s.NaY.NawaY.N#M.s.N#x.C.Wamaq#UaCaCb#bgaOa##vbg#v#v#u.w#uaZ.yaO.5aoama0.RaYaw#D#D.7.n#Laj#L#L#L#La2#La2#La2#g#Laf#L#L#L#La2#La2#L#La2#La2#L#La2af#L.3#Laf#Lafajaf#La2#La2#La2#L#L#Laf#La2#L#L#L#La2#L#Laf#L#La2#La9#D#x#xaoaO.Xbha#ama0#x#x.CaC.Ca0aC.C#x#IbnaYaYawaYaYaYaYaY.N#D#D#D#D#D#D#D#D#D#D#D#D#D#D#D.7.E.7.7.7af.7.7aj#L#L.7.E.N.N.NaY.N.N.N.NaY.NaYbl#IaYbna0aoaFaOamaoamamamaFaF.5b#aOa#a#aZ#u#a.2.waP.w.w.waZan#u", +".GanaB.5a0a0#xaCbn#Ibna0a0a0amam.Va0bnbn#x#x#I.C.NaY.Naw.N#s#D#D#D#D#s#D#D#D#saY#D#DaY.saY#x.W.Cbn#Ua0aCaoamaOaFaob##v#uaB.y#vaOa#aO.5bga0#U#x.R#D#D.n.7.7#Lbp#L#La2#L#g#L#g#La2#L#L#Lafa2a2#La2#L#La2#La2#La2#Lafa2#L#La2#La2#Laf#L#Laf#Laf#L#L#Laf#L#La2#La2#La2af#Lafa2#L.3#L.j#La9#DaY#xa0#v#aa7a#b#a0bn#x.C#x#x#x#x#xbn#x#x#IaYaYaYaYaYawaY#D#D#D#D#D#D#D#D#Da9#D#D#Dbj#Da9a9#La9af.E.7a9#Laf#Laf.7a9#D.N.N.saY.Nbl#DaY#D.NaYaYaY#xa0b#.5aFbga#aFaFbma#.ybm#vaZ#SaBan.G#q.2.w#u.6#uan.y.0.0", +".6#u.0b#a0#x#xa0bnbn#x#xbn#Ibn#x.RawaY#x#I#x#xbfaYaw.N#D#D.7.7.7a9#D#Da9#Da9#D#Da9a9#D#D.N.N#x#x#I#x#Ia0ao.8am.8aCa0bg#v#vaOb#aoaFaOaFama0a0#Ubn#s#D#Da9.E#L#Lajbpa2#ga2a2aja2#gafa2#La2#La2#La2#Laf#La2#L#Laf#La2#Laf#Laf#Laf#L#Laf#L#Laf#La2afa2#La2af#La2#L.3#La2a2#L#L#L#L#La2#La9#s.N#xa0bg.Xana#aFamam.C#xbn#xbn#x#x#x#xbnaYaYaYawaYaYaYaY#Da9#Da9#Da9#Da9.7#D.7a9.7a9a9.7.7.7.7.7a9#L.7.n#L#Laja9a9#D.saY#D.N#D#D#D#D.saY#DaYaYa0a0amb#aFbm#SbmaBaB#ubha7aB#u#uazaz#Tal#q#uanaB.0a#.0a##u", +"azaBa#aobn#x#x#x#x#x#Ibn#xaY#xaYaYaYaYaY.NaY.NaY#D#D#D#D#D.7a9.7#sa9a9bja9.7#D.Ea9bj.n#D#D.NaY.N#MaYaY#Ia0aoaoam#IaCa0ao.5ao.CaCbg.5b#aoa0aC#xa0aYaY#s.7a9#Lbp#La2bpa2#L#g#L#ga2#Laf#L#La2#La2#La2#La2#La2#La2#Lafa2#Laf#L#L#L.3aj#L#La2ajaf#L#La2#L#La2#La2#La2#La2#La2a2a2afa2#La2#L#DblaY#IamazaSaBaFama0#x.C#xaY#xaY#x#U#x#xaYaYaYaYaYaYaY#D#D#D#Dbj#D#Dbj#Da9a9a9.7a9a9bja9.7afa9aja9.7af.7#Lafa9a9#D#D#D#D#D#D#D#D#D#D#D.NaY#I#xbnaoamam.5a#bma#aZaZaZaZ#uaZanaz#q#TaR.o#q#uaB.0a#.0#uaZ#u", +"an#vb#a0#x#x#xaYaYblaYaYaYaYaYaYaYaYaYblaY.N.N.sbl#D#Da9#D.7a9#L#D.7#sa9.7a9.7#Da9a9#Da9a9#s#D.Naw#Daw#xaCa0.C#x#U#xaCaoaCa0#Ibna0a0aoa0aCa0a0#UaY#M#D#Da9.7#L.7a2a2#ga2a2#ga2#g#La2#La2#La2#La2#La2#La2#Laf#L#Laf#Lafaj#Laf#L#Lafa2af#L#La2#Lafa2#Laf#La2#La2#La2#La2#L#La2#L#La2#Laj#Dbl.NaY#UaZ.TaBaFam.C.C#xaYaYaYaYaYaY#x#xawaYaYaYaYaY#Dbl#D.Ea9a9.7a9a9.7#D.7#Da9bja9.7a9a9.n.7a9a9a9.na9a9a9a9.na9a9a9#D#D#D#D#D.7#D#D#DaY#x#x#xbna0aCamaFaOa#bma#bmaBaZaZaB.6.Gal.o#e.GazanaBaZ#u#u#uan", +"#vaFama0awbnaYaYaY.NaY#D#DaY#D#M#Dbl#s#D#D#s#D#D#Dbl#D.n#Daf.E.7a9a9.7a9a9a9a9a9.7a9.7a9.7a9a9a9#D.n#D.N#x#I#I.W.C#I.Caoam#U#xaw#Ia0#I#x#x#I#x#IaYaY#Dblbja9a9#L#La2bpa2bpa2#La2#Laf#Laf#La2#La2af#L#La2#La2afa2#Laf#L#Lafaj#Laf#L#L#La2#Laf#La2#L#La2#La2#La2#L#La2#La2#L#La2#L#L#Lafa9#sblaY#xb#bm#SaFambn#xaYaYaYaYaYaYaYaYaYaYaYaYawaYaY#Dbl.7a9bja9.7a9bja9#L#L#La9.7a9a9.7a9.7a9a9.7a9.7a9a9a9a9a9a9a9a9a9#D#Da9#D#Da9#Da9.N.NaYaY#x#x#xaYa0ama0am.5aF.5a##vaZan#TaR.Gazana7.wan#uaZan#uaZ", +"b#a0#xaYaYaYaY#x#DaY#D#D#M#Da9a9#D#D#D#D#Da9#D#p#Da9#D.7a9.7#L#La9a9a9.7#L#L.7a9.na9a9.7af#L#L#L#La9.7#s.N#I#x#x.C.CaCa0.W.W#xawaYawaYawaY.NaYaYaYawaY#sbl.7#D.7#L.ja2#ga2#ga2#g#La2#La2#Laf#L#L#La2af#L#L#L#Laf#Lajaf#Laf#Laf#Lajafaf#Laf#L#La2#Laf#Lafa2#La2#La2#L#L#L.3#Laf#La2#L#La9a9#D#MaY.b#yaFbgam#x.N#saYaYaYaYaYaYaYaYaYaYaYaYaYaY#Dbla9.7#L#L.7#L#L#L.7af#La9#La9#La9afafafafa9a9a9a9a9.na9a9a9.n#pa9.n.7a9.7a9.7a9.7#D#D#D#s#DblaYblaY#x#xaCa0aCa0amaOaZ#u#q.G.6#uaBana7azaZaZaZaZa#", +"a0a0a0aYblaYaY#xaYaY#Dbl#Da9a9af.7.7#Da9a9a9a9a9a9a9.n#Da9.7#L#L#La9.7af#L#Lafa9.7a9#L#Lajafa2aj#L.7.n#D.N#xbo#I#x.Waq.8aoa0#I.Nawbl#sbl#DaY#saYawaYaYbl#D#Da9a9#L#Lbpa2#L#g#La2#Laf#Laf#La2#L.3#Laf#L#Lafaf#Laf#Laf#L#Laf#L#Lafaf#L#Laf#Laf#Lafa2#La2#L#La2#Laf#L#L.3#L#L#L#L#L#L#L#L.na9a9blblbn#Hbga0#xaYaYa9blaYblaYblaYblaYaYawaYaYaYaYbl#Da9a9a9a9a9a9a9a9#L#L#L.7a9.7a9a9#La9a9a9a9af.nafa9#pa9#pa9#pa9a9#Da9#D.7#Da9bja9a9.7a9a9a9#D#Dbl#D#saYaY#x.Cbn.WaF#San.Ga4aZa#a#aZ#uanaZaBa#bma#", +"bnaYaYawaYaY#M.N#D#D#D#D#D#D#Da9a9#D.nbja9.7a9.7a9.7.7a9#La9a9a9.7a9#L#L.7af.7a9#Laf#Lafa9.7a9a9#L.7#La9a9#DaY#Ua0#UaCa0#I#x#I#I.N#s#D#D#sa9#D#Da9#D#s#D#Daw#DaYajaf#L#L#Laf#L#La2a2a2#La2#La2#L#La2a2a2a2bpaj#Lajaf#Lajaf#Lajafaja9ajafajaf#L#Lafafafafa2#L#L#La2#L#L#L.3#L.3#L#La2#L#Lafa9.na9aYbnb#b#am.C.NaWa9bj#D#Dbj#D.N.NaYaY#DawaY#DaY#D#D.7a9.7a9.7a9a9#Laf#Laf#Laf#L#Lafafaf#La9#D#D#D#L#Lafajaf#Laf#L#L#L#L#L#L.7.7.7a9a9.7a9#D#D#D#DaYaY.N#x#Ia0.Ca0aF#vaF#vaOb#aob#aoaFaBaZ.0a#.5am", +"#U#x.RaYaYaYbl#D#D#D#D#s#D#Da9#D#D.7#Da9.7a9bja9.7a9af.7a9a9.7a9af.7a9af#L#L#La9a2afaj#L#La9.7a9aj#L#La9.nblaYaY#Ia0aC.W#x#I.N.s#D#s#D.n#D#D#D#sa9a9a9#Dbl#D#D.Na9a9a9a9a9#La9#L#Laf#Laf#Laf#Laf#Laj#L.7aj#L#L.7afajafaf#Laf#Laf#Laf#L#Laf#L#Lafafafaf#Lafa2#L#L#L#La2af#L#L#L#La2a2af#L#La9bja9.Rawa0.8a0.C.Nbj#Da9a9#Da9#D#DaY#DaYbl.Nblaw#Dbl#D.7a9a9.7a9a9bjaf#Lajaf#L#Laf#Lafafafa9a9#Da9#D#Laf#Laf#L#L#Lafaj#L#L.7#L.7af.7#La9a9.7#D#D#D#D#D.NaY#x#x.C.CaoaFaFaOaOamamamamaCaF#v#v.0#vb#am", +"bnbnawaYaYaY#Dbl.n#D#D#Da9bja9bj.n#D.7a9#D.7a9a9a9.7a9a9#La9a9a9#L#L#L#L#Laf#L#La2a2a2af#La9a9a9#L#Laf.7a9#D#IaY#UbnaC#xaY.N.saY.s#D#Db.#D.n#D.7a9a9#Da9#D#D#D#Da9bja9#Da9#Da9#Da9a9a9a9a9a9a9a9#Laf#L#Lafafajaf#La9#Lajaf#Lajaf.7#Laf#L#Lajaf#Lajafaf.3#L#L#L#Laf#Laf#La2a2#La2#La2#La2af.Ea9.naY#xaCamam#x.Nbj#s.7#D#D#D#Dbj#D#Dbl#Dbl.Nbl#Dbla9a9a9a9a9a9a9a9afafafafajafafajafaf.na9a9a9#D#D#Lajaf#L#Lafa2#L#Laf#L#L#La9.7a9a9.7a9a9#Da9#D#D#D#MaY#x#x.CaCa0aFaOaFamaFaCa0a0bnaCb#aOaFaOama0", +"#IaYaYaYawaYaw#D#D#D#s#D#sa9#sa9.7a9a9a9.7a9#L.7#La9af.7a9a9.Ea9afaj#Laf#L#La2#La2a2a2#La2#La9#L#L#Laja9a9blaYaY#I#U#xaw.Naw#D#Da9#sa9#sa9.7a9.7ajaf.Ea9a9.7a9#D#D#D#D#Dbj#D#D#Da9#D#D#D#sbl#D#sa9a9a9a9a9#Da9#Dafajafaf.Eaf.7afajaf#Lajafaf#Lafafafajaf#Laf#L#L#Laf#L#L#Lafa2#La2a2af#L#La9a9a9aw#x.Vaoa0#x.Nbja9#D#D.7#D#D#D#Dbl#DaY#DblaYaY.Na9a9a9a9a9.7a9a9#La9afa9afa9af#pafa9#pa9a9a9.7a9#Laf#Laf#L#L#L#Laf#L#Laf.7a9#D.7a9.7a9.7#D#Dbj#Dbl.NaY#x#I.Ca0aqbgaFamaoambn.Cbn#U#xbna0aCama0a0", +"aYaY#IaYbl.N.N#D#s#D#D#D#D#D#Da9a9a9.7a9a9a9a9#Laf#L#Laf#L#Laf#L#Lafa2a2a2a2a2a2a2a2a2a2a2#L#Lafa2#L#La9a9#DaY#Ubn#I#xaYaw#D#s.sa9bj.n#Da9.Ea9.7#L.7#L#L.7a9.7#L#Da9#Da9#Da9#Da9#Dbl#Dbl#D#Dbl#Dbl#s#D.na9#s#D#Ma9a9.n#Laf#Lajaf#Laf#Laf#L#Lafajafafafaf#Laf#L#L#La2#L.3#L#L#Lafa2a2#L#Lafa9.na9#Dawa0bga0#x.N#s#Da9#D#D#D#D#D#D.Nbl#DaYaYaYawaYa9.na9#La9afa9afa9a9a9a9a9a9a9a9a9#pa9a9a9a9a9a9#L#Lafaj#L.3#La2afafa2af#La9a9a9afa9.7a9#D#D#D#D#DaY.N#x#xa0a0aoaFbgama0a0a0aCa0aYaY.baYbnbnaC#x", +"aYaYblbl#D#Da9.7a9a9a9a9.na9a9.7ajafaj#L#L#La2#L#L#L#L#Lafaj#Lafa2a2#L.j#La2#La2a2a2a2#La2af#L#L#L#L#L#La9#MaYaY#Ibn#MaY#D.s#D#s.7.na9.Ea9.7aj#La2aj#L#Laj#L#L.7.7a9.7.7a9.7a9.7#M#Dbl#MblblaYbl.sbl#Dbl#D#Dbl#Daf.Ea9af.Eafa9af#Lafaj#L#Laf#Lafafafafafaf#Laj#L#Laf#L#La2afa2#La2#L.3#L#L.7#Da9#DaYaCama0#Ibla9#Dbj#D#Da9#D#D.N#MaY#DblawaYaYaY#pa9a9a9#pa9a9a9afa9afa9#p.na9a9#Mbla9a9a9#La9.7afaj#Laf#L#Laf#Laf#Laf.7afa9afa9a9.7a9#D.7#D#D#D#Dblaw#x#x.WamamaOb#aOa0aC.Cbn.C#U.RaYaY.b#xbna0", +"aYaY#D#D#D#s.7.7a9.7a9.7a9a9.7a9#Laf#Laf#Laf#Lafa2a2a2a2#La2a2aja2a2.3a2a2a2a2a2aaaaa2a2a2a2a2#La2#L#La9a9#DaY#I.RaYaw#D#M#D#s#D.n.7a9.n#L.7af#La2a2a2#La2#L#L#La9a9.7a9a9.7a9a9a9#pa9a9a9.n#pblaYaY#IaY#IaYaw#x.na9af#Laf#Laj#Laf#La9afajaf#L#Lafafafaj#Laf#L#Lafa2#L.3#L#L#L#La2a2#L#Laf.na9.n#D.NbnaCaobn#D#s#D.n#D#D#D.N.NaY#DaY#Dbl.NaYaYaw#D#pa9#p.n#pa9#pa9a9.n#pa9#pa9#pa9#D#pa9afafajaf#Laf#L#Laf#L#Laj.3af.3afafa9a9a9.7a9.7a9#D#D#D#D.NaY.N#xa0ama0aob#ama0a0a0bn#Ibna0#x.bbnaY#Uamam", +"#MaY#s#D#D.7#La9#L.7.na9a9.7a9a9#L#L#L#La2#La2#La2a2a2aja2#La2afa2aja2#La2a2a2a2#gaaa2a2a2a2a2a2a2#L#La9a9blaYaYaY#MaY#M.N#D.n#D.na9.n.7#L.E#L#L.ja2a2a2#g#L#L#L#Lajaf#Lajaf#L#La9a9#pa9#pbla9.naYawaYaYaY.RaYaY.na9.na9aj.7af.n#Lafaj#Laf#Lajafafajafafaf#L#L#L#Laf#L#La2afa2af#L#La2af#L.7a9a9.7aw#xaCa0#IaYa9#D#D#D#D#D.NaY.saY#Dbl#DaYaYaYaY.na9#pa9a9#p.na9af#p#pa9a9a9#pa9#Dbl#Da9.na9#L#Laf#L#Lafajaf#Lafafafafafafafa9a9afa9a9bja9bj#D#D#D#DaY#x.Wa0av.5.pamaCa0#Ua0#x#xa0bnaYaw.R.Cb#am", +"amam#xbla9a9a9a9a9a9.7a9.7afa2#Laf#Laf#La2#La2#La2a2a2a2a2a2a2a2#Laf#Laf#La2#L.3a2a2a2a2asa2#La2#gafa9blaYawaYaYawbn#IaYawaw#D#Da9.Ea9#Lafaf#L#L#L#La2a2a2a2a2a2a2a2#La2af#L#Lafajaf#L.na9bja9#D#p#pbl#M#x#Ia0bn#I.NaY#D#Da9a9.7af.Eafa9aja9#Lafa9a9a9a9#Lafa9afajafafafaf#Lafafa2.ja2afajaf#L.na2a9aY.Cbgam#x#Ma9.n#Lajafa9.N.N#pa9bl.N#MaYaYaY#p#pa9#pa9#pa9#p#pa9#p.n#p#p.n#pa9#pa9a9#paf#pa9a9.n#pafafafafafafafa9afa9afa9a9.na9a9a9a9a9#D#D.n#paYaYa0amb#amb#a0a0a0.Ca0#I#xaw#xaY#x#xaCa0aC", +"ama0#xbla9.na9a9bja9#Da9a9ajaf#La2aj#Lafa2#La2#La2a2#La2#La2#La2af#Lafa2#Laf#L#La2a2a2asa2a2a2a2a2#La9blaYaYaYawaYaY#xawaY.N#s#Daja9#Lafajaf#Laf#L.j#La2#La2#La2#La2#La2#L#L#L#L#L#Laf.7a9#D.n#Da9.nblblaYaY#xaC#x#IaY.s#D#sa9.na9a9a9a9a9a9a9a9a9afa9afa9a9#La9afafaj#Lafaf#Lafa2#La2#Lafafaj#La2.naw.CamaC#xaY#D#D#La9a9#sbl.Na9#M#DblaYaYaY#xbla9#p#pa9#pa9#pa9#pa9#p#pa9#p#p#pa9.n#pa9a9a9af#pafa9afa9a9afa9#La9af.7afa9afafa9afa9a9.na9#Dbl#p#pblbn#U.5bg.5a0aoa0a0#Ua0#xbnaYaYaY#U#xbn#xa0", +"amaCaYaYaw#Dbl#sa9#D.7a9.7af#L#Lafaf#L#La2#La2#La2a2a2a2a2a2a2a2#L#L#Lafaja2#L.3a2a2a2#La2a2a2a2#ga9#D#MaYaY#UaY#xaw#Ibl.Naw#D#Dafafaja9#L#Laf#La2#La2a2a2a2a2a2a2.jafa2#Laf#Laf#Laf#La9a9.7#Da9a9a9#sblawaY#x#x#IaY.NaY#D#D#D#D#sbl#s#D#sa9a9.na9.na9a9.nafa9afafafafafafafajafa2#L.3#L#Laja9#Daj#DaY.Ca0aoa0aY#D#Ma9.na9#D#DaYblblblaYaYaYaYaYbl#pa9#pa9#pa9#pa9#p#Ma9bl#p#D#pa9a9#pa9#pa9#pa9#pa9#pa9#paf#pa9afa9afa9afa9afa9a9a9a9a9a9a9#Da9bla9awaYa0a0ama0b#a0a0a0#x#U#x#xaw#xaw#xbn#I#xa0", +"b#b#aCaYaYbl#Dblbja9#D.na9#Lajaf#L#L#Lafa2#La2#La2a2#La2#La2#La2afafaj#L#Laf#L#La2#La2a2a2a2#La2#La9blaYbnbn.R#IaY#U#xaYaw.N#D#s#L.Eaf#Lafaj#L#L#La2#La2#La2#La2afa2a2a2#L#L#L#Lafajaf.7.n#Da9b.afa9a9a9#DaY#I#x.NaY#saY#s#D#s#DaYaYaYblaY#DaY#Dbla9a9a9a9a9a9a9.na9a9.na9a9a9a9#La2aj#Lafa9a9a9af#Mawa0aCa0a0bn.NaYbl#D#M#DaY.NaYaYaYawaYaYawaYbl.na9#pa9#pa9#pblbla9#p#pa9#p.na9#pa9.n#pafa9af.naf#pajafafafafa9a9a9afa9af.7afaf.nafa9a9af#D#DblblaYaY#xaCa0.Ca0aobnaCbn#xawaYaY.RaYaYaY#xbn#x", +"a0bnbnbnaYaYbl#D.n#D#sa9a9#Laf#L#L.3#L#L#La2#Lafa2a2a2a2a2a2a2a2#L#Lafaf#L#La2#L#La2#L#L#La2#L#Laf.nblaY.bbn#U#x#Ubn#Ibl.NaYa9.7a9afaja9#Lafaf#La2a2aja2a2a2a2a2a2a2a2a2af#Laf#L#L#L#La9a9.7#Da9#Laja9#D#D.NaYaY#s#D#D#DaY.NaY.saY.saY.NblaY#DaY#sbl#sbla9#Da9#Da9a9.na9a9afa9ajafaf#Lafa9a9#D#sa9blaY#Ua0aob#aC#xaYaw#D#DblaY#IaYawaYaYaYaYaYaYbl#pbla9#pa9#pa9bl#M#p#D#p#M#p#pa9#pa9#pa9a9#pa9#p#pa9#p#pafafaf.nafa9a9#La9afafa9afa9a9afa9#Da9bl.NaYawbn#x#x#x#Ubna0#xbnaY#xaYawaYaw#xawaY#x#U", +"#Ubn#Uam#UaYaYbl#Da9bja9a9#L#Laf#L#Laf#Laf#La2#La2a2#La2#La2#La2af#L#L#L#Laf#La2af#L#La2#L#La2#Lafa9bl.Ra0.pa0bn#U#xawaY#M.N#s.7.na9#Lafaj#L#Lafa2a2a2a2#La2#La2a2a2a2a2#L#L#L#Laf#Laf.7a9#D.7#Dafaf#L.na9#Daw.N.n#D#D#s#Daw#DaYaYaYaYawaYaYawbla9bla9bla9.n#D#Ma9a9a9#Da9#sa9#p#Laf#La9.7.n#D#D#DaYawa0a0aob#amaCa0aYaYaY#DaY#xaYaYaYaYaYbl#Dbl#p#pa9#pa9#pa9#p#pbl#p#pa9#pa9bl#p.na9a9#pa9#pa9af#pafa9af.na9afa9a9aja9a9afa9#Laf.7afa9.7afbl#D#D#DaYaYaY#xaY#xa0bnbn#U.RawaY.baYaYblaY.R#IaYaY", +".Rbnb#a0a0#xaYbl#s#D#sa9.Eaf#L#La2#Laj#La2a2#L#La2a2a2a2a2a2a2a2#La2afa2afa2#Laf.7af#La9a9#Lafa9a9a9.R.Ra0.V#UbnaYaYaY#D#D#D#D.7afajaf.Eafaf#L#La2#La2#La2a2a2a2a2a2#La2#L.3.7#Lafaj#La9a9.n#Da9#Laj.7a9.7#D.N.Na9.n#D#DaY.NaY.sbl#Mblbl#Dbl#Dbl#D#Dbl#s#Dbl#Dbla9#Da9.nbla9a9#Dajaf.na9#D#D#D#sblawaY#x#Ub#b#aO.5a0aCaYaYawaY#x#xaYaYaY.sblbl.na9#pa9#pa9#pa9#pblbla9#M#p#Dblbl.n#p#p.na9#p.n#p.na9#pa9#pa9af#pa9afa9a9af#Laf#Lafafa9afa9a9#Da9bl#D#M.NaY.Naw#x#UbnbnaYaYaY#xaYbl#MblaYaYaYaY#I", +"#Fbn.Vaoa0bnaYblbja9#Da9a9#Lajaf#Laf#Laf#L#L.3#La2a2#La2#La2#La2af#L#L#L#Lafaj#La9#L#La9a9#L#Lafa9blaw.R#Ua0bnbn#IaYaw#D#s#Da9#s#La9#Laf#L#L#L#La2a2a2.j#L#La2#La2a2a2a2#L#Laf#L#Laf#Laf.7#D.7#s#L#L#La9.7#D.sbf.n#Da9#Daw#DaY.N#pbl#M#D#p.n#pa9#sbl#D#D#Dbl#D#D.na9#Dbl.n#Da9a9af#La9.7a9#s#DaYaY#x.baYbnaoamaFaFaoa0#IbnaYaY.R#x#xaYaYbl#Da9#pa9#pa9#pa9#pbla9#M#pa9#pa9#p#Mbl#pa9a9a9#pa9a9#pa9#paf.naf#pafafa9a9a9afa9af.7afa9#L#La9a9af#D#D#D#DaY#D#DaY.NaYbnbn#U#x.baYaYaw#paY#D#MaY#IaYaY", +"blaw#xa0ambn#xaYawblbl#D#pa9afafa2a2a2a2a2a2#La2#L#La2#La2#La2#La2a2a2afa2#La9a9a9a9a9#D#D#D#D#D#pbl#paY.Rbn#I#x#pa9a9a9a9.7.7a9afajaf.n#Laf#L#L#L#L#La2a2a2#ga2a2bpa2#L#L#L#L.7af#Laf.7a9a9a9#Da9a9#sa9#D#D#D.Na9a9a9#sbl#D#Ma9bl#Dblbl#Dblblbla9a9a9afa9a9a9a9a9a9afa9a9a9a9.nafa9a9.na9a9#D.naY.RaYbna0a0b#aobgb#bg.Va0aCaY#D#Mbl#Mbl#Dblbl#Dbl#Dbl#Dbl#Dblbla9#pbla9#p#pa9#p#p#p#p#p#pa9#pa9#p#p#p#pa9a9afa9aja9afaf#Lafaf#La9afa9#Lafa9a9af#sa9#Dbl#DaYbl.N#UbnbnbnaYaY#IaYaY#MaY#xaYaYaYaY", +"aYaYbn.Ca0a0#I#xaYaYblbl.naf#Lafaja2#La2#La2a2a2#La2#La2#La2#La2a2a2#L#L#L#L#L#Lafa9af#D#p#Dbl#D#F.nblblaYaYaYaYa9.n.7a9a9.7a9.7afafaf#L#L#L#L#La2#ga2#ga2bpa2#L#ga2a2#L#L#L#L#L#Laj#Laf.7a9bja9.7#D.7#D#D#D.Naw#D#M#D#p#D#p#D#Dbl#sbl#Dblbl#Dbla9.na9.naf#paja9afa9.na9a9afa9a9afajafa9a9a9blblaYawaY#Ua0aC.5am.V.Vb#ama0aYaY#xblaY#DaYbl#M#Dbl#Dbla9bla9bla9bl#D#p.n#pbla9bl#p#p.na9#p.na9#p.na9bl.na9afa9a9a9a9afa9#La9af.7afa9a9#Laf#Lafa9a9a9a9a9#D#DaY#saYbnbn#U#x#UaYaYaYaYaYaYawaYaYaY#x", +"aY#xbna0a0a0a0bnaYaY#Mbla9a9a9af#L#Laf#L#L#L#Lafa2#La2#La2#La2a2#La2afa2af#L.7#La9a9#D#D#D#D#DaY#pblbl#MaYaYbl.Na9a9a9.7a9#L.Eaf.naf#Laf#L#L#L#La2a2bpa2#ga2#ga2a2#L#L#L#L.7a9a9a9a9afa9a9#D#D#sa9.nbl#DaYblaYaYbl#D#D#D#M#Dbl#sblbl#Dbl#sbl#D#Ma9a9a9a9a9a9a9a9a9a9a9a9.na9a9a9.n#pa9a9#D#sbl#saYaY.RaY#xa0a0aCa0#Ua0aCbnaYaYawbl#sbl#M#Dblbl#D#pa9a9a9a9a9a9a9#p#p#D#p.n#pa9.n#p#p#pbl#pa9a9#p#pa9#p#pa9a9afa9af#Lafaf#Lafaf#La9a9afa9af#La9afa9a9bl#D#p#DaY#DbnaCbnbnaYaY#IaYaYaw#xaYaYbn#I.R", +".Raw#xa0aC.Ca0a0.baYaYblbla9a9af#Laf#L#La2afa2#L#La2#Lafa2#La2a2a2a2a2#L#L#Laf#L#D#p#Dbl#DblaYaY#pblblbl#Dbl#D#Dafa9af#L#La9#L.7afaf#Lajaf#L#L#L#L#ga2a2#La2bpa2#L#L#Laf#La9.7#Da9a9a9#D#Dbl#DaYblblaYaYaYawaYaY#xawaYaYaYaYaYaYaYaYaYaYaY.NblaYa9a9#pa9a9#pa9#p.n#Da9a9a9#Da9#D#pa9bl.na9blaYblblaYaY#IaYbnbna0#Ua0b#b#a0aYaYblblbl.Nblbl#Dbl#Da9a9afa9afa9afa9#Ma9#pa9#pbl#pbl#p#p#pa9#pa9#pa9a9bl#p.na9a9a9a9#La9af.7afa9#La9afa9a9af.7afafafa9a9a9#D#D#DblaYbnbn#Ibn#IaY.RawaYaYaYaYaYaY#x#x", +"bnbnbnbna0a0a0amaYaYaYaY#D.na9a9afa9afa9#L#L#Laf#L#L#La2#La2#L#La2#L#Laf#L#L#Laf#D#Dbl#DblaYaYaYa9.nblbl#D#D#Dblafaf#L#L#L#L#L#L.naf#Laf#L#L#L#L#ga2bpa2#ga2a2#gaf.3af.7afa9a9.n#D#Dbl#sblbl.NaYaYaYaYawaY#x#xaYaYaYaYaYawaYawaYaYawaYawaYblaYblblbl#Dbl#M#Dblbl#Dbl#D#Dbl#s#Dbl.n#pa9blawblawaYaw.RaY.RaY#U#xbn#UbnaCaOama0aYbl#Dbl#Mbl.Nblbl#Da9.na9a9a9a9a9a9a9#pbl#pa9#pa9#p#p#p#M#p#p.n#pa9.n#pa9#pa9a9afa9#Lafa9afa9#Lafafa9afafa9af#La9#La9af#Dbl#Daw.NawbnbnbnbnaYaY#xaYbn.baY.RaY#xbnbn", +"ama0bna0#Uambgb#aY.RawaYbl#Da9a9a9.7a9.7a9af.7#L#La2af#Laf#L#L#La2a2#La2#Laf#L.7#pblblaYaYblaYaYblblbl#Da9a9a9.7afajaf#L.3#L#L#L#Lafaf#L#L#L#L#L#L#ga2a2bpa2bpa2#La9#Lafa9af#D#D#Dbl#DaYaYaw#xaYaYawaYaY#xbnbnaYawaYaYaYaYbnaYaYaY.RaY.RaY.baYawbl#Mblblblbl#Mblbl#D#D#M#Dbl#D#D#pbl#MblblaYaYaY.RaYaYawbnaYbnawaYaYa0aO.Fa0#x.R#Dbl.Nbl#Mbl#sbla9a9a9a9afafafaf#p#p.na9bl.nbl#p.n#p#pa9#pa9a9#p#pbl#pa9a9a9a9a9#La9afa9a9afa9#Laf#La9afa9af#Lafa9a9#D#Dbl#DblaYbna0#Ubn#I.RawaYawaYaYaY#UbnaCbn", +".Va0bna0.V.Vb#.5bn#xaYaYaY#Da9a9a9#La9#La9#L#Laf#L#L#La2#La2afa2#La2#Laf#La9a9a9blaY#MaYaYaYaYaYbl#Dbl#Dafa9#L#Lafa2a2a2a2a2#L#Lafaj#Laf#L#L#L#La2a2bpa2#ga2a2#gafafafa9a9a9bl#pbl#DblaYaYaYaY#xaY.Rbnbn#Ua0a0a0aYaYaYaYaYaYaY#U.R.b.R.R#U.Rbn.RaYaYawblaYblaYbl.N#MaY#DaYblaYbl#sblblblawblaYaYawbnaY.RaYaw.RaY#IbnaCb#aOb#.Vbn#DblblawaYblbl#Da9a9a9a9.7a9.7a9#D#pbl#p#p#pa9#p#p#p#pbla9#pa9a9#pa9.n#pa9.na9a9afafa9a9afa9#Laf.7af#La9afa9#Lafa9a9a9bl#s#DaY#sbnbnbnbnaYaY#x.Rbnbnbnbnbn#xa0a0", +"a0.Vbn.bbna0b#b##UbnaYaY#D#Ma9a9.Ea9a9a9.7a9.7#Lafa2a2#La2af#L#La2a2#L#L#Laf.7.7blblaYblaYaYaYaY#DaYa9a9a9#La2#La2a2#La2#L#ga2#Lafafafa2#L#L#L#L#L#ga2#g#La2bpa2afafa9af#p#Da9#D#DaY#D#DaYaYaY#x.RaYaYbnbna0a0a0aYaYaY.RaY#UaYaYaYaYaYaYaYaYaYaYawblaYaYaYblaYblaYbl.NblaY#s.Nblblbl#MblaYawaYaY.Raw.RawaY.b#x.baY#xa0aob#bga0bnbl#sblaYaYbl#sbla9.n.7a9.n.7a9a9#pa9#pa9#p#D#pbl#p#p.na9#p.na9#p.n#pbl#pa9a9a9af.7a9afa9.na9a9afaf#Lafa9afa9af#La9.nbl#D#D#DblaYbnbn#UaYaYaYawaY.RaY.Rawbnbna0a0", +"aYaYaYaYaYaY.N#xaYaYawbnaYaYaYaYbl#Dafa9afa9.7#L#L#L#L#L#L#L#L#L.3a2afafa9#D#DaY.R.R#x.RaYawaYaYa9.7a9#L#L#Lafa2a2a2a2a2#g#L#L#Lafafajafafa2#L#L#L#L.7#L#L#L#L#L#L#L#Laf.7#La9a9a9.7a9#D#D#D#D#Dblbl#IaY#xaY#xaYaYaYaYawaYaYaYaYaYawaYaYawaYaYaw#Fbl#M#FblaYaYaY.R.R.R.R.R.R.R.RawaYaYaYaYaYaYawaYbl.NaYaYaYbn#Ibn.baY#Ua0aOb#.Vbg#HaY.bbla9a9.na9a9a9a9.7a9a9.Ea9#p.na9a9.n#pa9#pbl#p#pa9#p#pa9#p#pa9#pa9#pa9a9#pa9.na9afafaf#L#Laf#L#L#L#L#Lafa9a9a9#pblbl.Nbl#x.R#xaY.R#x#xaYaw.RaYaYaYaYaY#D", +"aYblaYaYaY#IaY.NblawaYaYaYaYaYaY#Dbla9a9a9a9a9#L#L#L#L#L#L#L#L#L#Laf#Lafa9#Dbl.N.R.Raw.RaYaYaYaY.7#Da9.7af#La2#La2#ga2#ga2#L#L#Lafafafaf#L#L#L#L.7#L#L#L#L.7#L.7a2a2#L#Laf#La9bja9#D.7#D#D#D#D#D#D#DaYaYaYaYaY#xaYaYaYaYaYaYaYaw#xaY#xaYaYawaYaYbl#FblaY#MaYblaw.R.b.R#MaY#FaY#FaYaYaYblaY#MaYaYblawaY.RawaYawaYbnaY#Ibnao#SaBaF.p#H#U.RaY#Ma9#Da9a9.7a9a9a9a9a9a9a9a9#pa9#pa9.na9#pa9a9#pa9#pa9#p#D#p#s#pa9a9afa9af#pafafafafaf#L#L#Lafaj#Lafaja9#pa9a9#Dbl#DblaY#UaYaYaw#x#xbnaYblaw.RaYaY#Dbl", +"blaYblaYaY#D.NaY#pblblaY.RaYaYaYbl#Dbl#Da9a9.7a9#L#L#L#L#L#Laf#Laf.nafa9#D#DaYaYbn.RbnaYaY.R#xaYa9.7a9#L#L#La2#La2a2#g#L#L#L#L.7afajafaf#Laf#L#L#L#L#L#L#L#L#L#La2#La2a2#L#L#L#L#L#La9.7#Da9bj#DblblaYaYaYaYaYaYbl#Dbl#D#Dbl#Dblbl#Mbl#MaYblaY#Mbl.nbl#pa9aYblaYblaYaYaY.RawaYaY#M#F#M#Fbl#F#F#M#p#p#p#MblaYaYaY#UbnbnaCam#SaBbm#H.p.p.RaYaYbla9.na9a9.na9a9a9a9a9#pa9a9#pa9#pa9#pbla9#pa9#pa9#pa9#p#p#pa9#pa9#pa9#pa9a9afafafaf.3afajafafafafafa9.n#pa9#p#Dbl.N.RbnaY.RaYbnaY#x.b.RaYaYblbl#Dbl", +"#DblblaY#Dbl#D#Dbl#DawaYaYawaYaYaYaYbl#Dbl#D#Da9#Da9#Da9#Da9.7a9a9#p#Dbl#DaYaYaw.R.RaYbnaYaY#xaY#D#Da9.7#L#L#L#La2#ga2#L#L#L.7afafafafafaj#L#L#L#L#L#L#La2#L#L#La2a2a2#La2#L.7#La9#L.7a9.7#D#D#D.N#Dbl.sbl#D#Dbl#D#D#D#Dbl#D#D#Da9#D#D#Da9#D.n#D#pa9#pa9a9blblblblaYblblblblblbl#p#Fbl#p#pbl#pbl#p#M#pblbl#Faw#FbnbnaCamaCaF#SaZ#Hb#bgbnaw.Raw#Da9a9a9a9a9a9.na9afa9a9#p.na9a9#p.na9#pa9#pa9#pa9#M#p#D#p.na9a9a9af#pajafafafafaf#Lafa9afa9a9afaf#paf#p.n#Dbl#DblbnaYbn#Ubn#x#U#xbn.baYblaY#DaY#D", +"blblaY#DaY#D#D#Dbl#Dbl#DblaYaYaYaYaYaYaY#M#Dbla9#D#D#D#D#D#D#D#Dbl#Dbl#DaYaYaYaYbn.R#U.RaY.R#xaY.7a9.7#Laf#La2#La2a2#L#L#L#La9.7afafafaf#Laf#L#La2#g#L#g#L#ga2a2a2a2#La2a2#La2#L#L#Laf.7a9a9#Da9#DblaYaYbl.Nbl#Da9a9a9a9a9a9a9a9.na9.na9a9.na9a9ajafa9.na9a9.na9blblbl#Dblblblbl#M#p#p#p#p#p.n#p#p#p#p#M#pblbl#MbnbnbnaCa0aF#SaZ.V.V.VbgbnaYaYaYbl#D#D#D#D#D#Dbla9#p.na9#pa9#pa9#pbla9#pa9#pa9#pa9#pa9#pa9#pa9af#pa9#pafafaf#Lafa9a9a9a9a9afa9a9afafa9#p#Dbl#saY#x.bbn#xbn#I#xbnbnbnbnawbl#Dblbl", +"a9#pa9bl#M#Dbl#Da9a9#D#D#D#D#D.Nbn#U.RaYaYaY#D#Dbl#D#Dbl#D#Dbl#DaYblaYaYaYawaYaYaY.RaYbn#xaw#xaY.7a9#D#L.7a2#Laf#L#Laf#La9a9#Da9afafajaf#L#L#L#Lbpa2a2a2#ga2a2bpa2a2a2a2a2a2#La2.3#L#L#La9.7a9.7bl.NaYaY#D#pa9#pa9a9a9afafa9a9a9afafafajafafafafafajaf#La9a9a9bj.na9#D.n#Da9#s#D#p#p#p#p.n#pbl#p#p.n#pa9bl#Mblbl#UaY#U#x#Ub#aB.l.V.V.V.VaCbnaY.R#D#Mblbl#Mblblbla9#pa9#pafa9a9#pa9#p#pa9#pa9#pa9#pbl.n#D#pa9#pa9afafafafafafafafafa9#p.na9a9a9a9afafafa9#p#DaYaY.Rbn#x#Ubnbn#xaCa0aCbnaYaYblbla9", +"#pa9#p#Dbl#Da9#Da9afa9bla9bl#DblaYaYbnaYaYaYaYaYblaYblaYblaYaYblaYaYaYaYaYaYaYaY.Rbn.R#xaY.RaYaYa9.7a9#Laf#L#L#Lafaf#Lafa9a9a9.nafafafaf#Laf#L#Laa#ga2#ga2a2#ga2aaasa2a2#La2a2#L#L#L.3#La9.7a9#DaYblaYblbla9a9ajaf#Laf#L#Lafajaf#Lafafaf#Laf#L#La2#L#L#L#L#L.7.7a9a9a9a9a9.na9a9.na9a9a9a9a9a9.na9a9.n#D#D#D#D#D#MblawawbnaC.F.t.Fb#.Vb#.Vbnaw#xaYaYaYaY.NaY#D#Da9#pa9a9#p.n#pa9.nbla9#pa9#pa9#pa9#p#p#pa9.na9afafafafafafafafafa9a9afa9af#pafafafafa9#p#Dblblaw#xbn#Ubn#x#IbnaCb#aCbnawaY#D.na9", +"#pa9#pa9a9#Dbla9a9a9af#D#Da9#D#D#xbn#xbnaYaYblaYaYaYaYaYaYaYaYaYbnaYaYaYaYaYaYaY.R.R.RbnaYaYaYaY#D.7#Da9#La2#Lafajafafa9a9a9a9#Dafafafaf#La2#L#La2a2#ga2a2#gaaa2asaaa2a2a2a2a2a2a2#L#L#La9a9.7a9#D.saY#D.n#pafaf#Lafaj#L#Laf#L#Laf#L#L#L#L#Lafaja2a2a2a2#L.E#L#La9a9a9.7a9a9a9a9a9.7a9.na9a9a9a9.E#L.7.7#D#s#D#s#Fblbl#M#xbnbg.t.F.t.V.V.VaCa0aY#DaYaYaYaY.Nblbl.na9#p.na9a9#pa9#p#pa9#pa9#pa9#pa9#p#D#pa9#p#pa9afafafaf#Lafafa9af#pa9#pa9afa9afafaf#pa9a9#D#DaYbnbn#xbn#Ua0bna0bg.Va0aYblbl#pa9" +}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/namedcolors.xpm b/tests/benchmarks/gui/image/qimagereader/images/namedcolors.xpm new file mode 100644 index 0000000..f6485d5 --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/namedcolors.xpm @@ -0,0 +1,18 @@ +/* XPM */ +static char *xman[] = { +/* width height ncolors chars_per_pixel */ +"8 8 3 1", +/* colors */ +"e g4 black c pale turquoise 4", +"f m white c light golden rod yellow g4 grey", +"g g white c lemon chiffon m black", +/* pixels */ +"eeeeeeee", +"ffffffff", +"gggggggg", +"gggggggg", +"gggggggg", +"gggggggg", +"gggggggg", +"gggggggg" +}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/negativeheight.bmp b/tests/benchmarks/gui/image/qimagereader/images/negativeheight.bmp new file mode 100644 index 0000000..875887a Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/negativeheight.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/noclearcode.bmp b/tests/benchmarks/gui/image/qimagereader/images/noclearcode.bmp new file mode 100644 index 0000000..1a5ca9c Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/noclearcode.bmp differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/noclearcode.gif b/tests/benchmarks/gui/image/qimagereader/images/noclearcode.gif new file mode 100644 index 0000000..27784d6 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/noclearcode.gif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/nontransparent.xpm b/tests/benchmarks/gui/image/qimagereader/images/nontransparent.xpm new file mode 100644 index 0000000..00c21ef --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/nontransparent.xpm @@ -0,0 +1,788 @@ +/* XPM */ +static char *dummy[]={ +"8 8 777 2", +"#R c #000000", +"fn c #000001", +".e c #000069", +".f c #00006d", +".g c #00006e", +"#d c #0042b4", +"aJ c #010101", +"g0 c #010102", +"dr c #010202", +"gd c #010203", +"#J c #0157bb", +"e. c #020202", +"du c #020304", +"fR c #030303", +"jJ c #040404", +"hf c #040608", +"fE c #040609", +"cO c #04070a", +"k# c #050505", +"gC c #050709", +"ka c #060606", +"br c #06080a", +"dY c #06090d", +"hI c #070707", +"in c #07090b", +"cL c #070a0e", +"cd c #070b0f", +"e0 c #080808", +"gZ c #080b0e", +"eu c #080b0f", +"dz c #080c10", +"hD c #090909", +"fq c #090d11", +"cH c #090e13", +"jB c #0a0a0a", +"#U c #0a0d0f", +"a4 c #0a0d10", +"g3 c #0a0d11", +"fu c #0a0f14", +"cj c #0a1016", +"kb c #0b0b0b", +"#n c #0b0d0f", +"a1 c #0b0e10", +"g8 c #0b0f13", +"f4 c #0b0f14", +"hE c #0c0c0c", +"bf c #0c0f12", +".X c #0c28a0", +"bT c #0d0d0d", +"ax c #0d1014", +"hr c #0d1217", +"dH c #0d141b", +"jy c #0e0e0e", +"aW c #0e1115", +"eH c #0e141b", +"bE c #0f0f0f", +"ar c #0f1317", +"g5 c #0f1419", +"hg c #0f151a", +"fh c #0f151c", +"dJ c #0f171f", +"gI c #101010", +".z c #101094", +"h. c #10161b", +"gm c #10161c", +"eL c #10171f", +"hK c #111111", +"at c #11161b", +"fC c #111820", +"dA c #111922", +"aj c #1163c4", +"bJ c #121212", +"#Z c #12161a", +"ba c #12171c", +"ho c #12181e", +"jK c #131313", +"iq c #13191d", +"cA c #131e2a", +"c7 c #141414", +"dR c #141e29", +"jr c #151515", +"aA c #151a1f", +"hq c #151c23", +"fl c #151e28", +"eV c #151e29", +"d4 c #161616", +"hw c #161e25", +"jk c #171717", +"bs c #171d23", +"g9 c #171f27", +"eC c #17212b", +"b9 c #172432", +"d5 c #181818", +"as c #181e24", +"bn c #181f25", +"bS c #191919", +"gr c #19232d", +"ed c #1a1a1a", +".d c #1a1a6e", +"gB c #1a242e", +"eK c #1a2531", +"dQ c #1a2633", +"hL c #1b1b1b", +"g1 c #1b242d", +"g# c #1b252f", +"eJ c #1b2734", +"d1 c #1b2937", +"bW c #1c1c1c", +"gW c #1c262f", +"ci c #1c2b3b", +"cs c #1c2c3c", +"e# c #1d1d1d", +"#3 c #1d232a", +"f8 c #1d2833", +"fI c #1d2936", +"eO c #1d2a38", +"cw c #1d2e3f", +"jR c #1e1e1e", +"a2 c #1e262e", +"eP c #1e2b39", +"dE c #1e2d3d", +"cF c #1e2f41", +"aO c #1e6ec9", +"c4 c #1f1f1f", +"gx c #1f2a36", +"c# c #1f3043", +"j2 c #202020", +"bk c #202931", +"ht c #202c36", +"eF c #202f3e", +"b7 c #203245", +"cB c #203246", +"hG c #212121", +"aE c #212932", +"bp c #212a32", +"hl c #212d38", +"cc c #213347", +".M c #214eb7", +"hF c #222222", +"#7 c #222a32", +"fw c #223040", +"eU c #223141", +"jC c #232323", +"bb c #232c35", +"ga c #23303d", +"cv c #23364a", +"cn c #23364b", +"jl c #242424", +"gj c #243240", +"cm c #24374c", +"c. c #24384d", +"bF c #252525", +"be c #252f39", +"gt c #253341", +"dU c #253649", +".Y c #256cc9", +"jG c #262626", +"h8 c #26333d", +"hb c #263440", +"gs c #263443", +"cr c #263b51", +"cW c #272727", +"aC c #27313b", +"a9 c #27313c", +"fk c #273748", +"eR c #27384b", +"cq c #273d55", +"jV c #282828", +"#5 c #28313b", +"b0 c #2877ce", +"gL c #292929", +"#Y c #29323c", +"hu c #293744", +"fK c #293a4d", +"jP c #2a2a2a", +"#w c #2a323b", +"bg c #2a3540", +"dF c #2a3f55", +"jn c #2b2b2b", +"a6 c #2b3641", +"jY c #2c2c2c", +"h5 c #2c3b47", +"hp c #2c3c4a", +"gp c #2c3c4d", +"cx c #2c445e", +"bU c #2d2d2d", +"h# c #2d3e4c", +"dS c #2d435b", +"e5 c #2e2e2e", +"cG c #2e4762", +"jF c #2f2f2f", +"aG c #2f3b48", +"gU c #2f3f4e", +"ck c #2f4966", +"j0 c #303030", +"a0 c #303d4a", +"he c #304251", +"cQ c #307ace", +"e4 c #313131", +"ew c #31465d", +"dW c #314862", +"ce c #314b68", +"jm c #323232", +"bm c #323f4d", +"k. c #333333", +"e3 c #343434", +"hi c #344757", +"eT c #344b64", +"b8 c #34506f", +"dj c #347fd1", +"bX c #353535", +"f9 c #35485c", +"ac c #363636", +"#V c #36434f", +"fv c #364c64", +"dV c #36506d", +"c2 c #373737", +"ev c #37506a", +"bI c #383838", +"bw c #384655", +"h4 c #384b5a", +"hk c #384c5d", +"ea c #393939", +"bh c #394857", +"gX c #394d5f", +"#e c #3981d2", +"e6 c #3a3a3a", +"eS c #3a546f", +"em c #3a81d2", +"#F c #3b3b3b", +"eQ c #3b5571", +"dT c #3b5776", +"cI c #3b5c7f", +"gJ c #3c3c3c", +"hX c #3c5060", +"fi c #3c546f", +"gG c #3d3d3d", +"jv c #3e3e3e", +"az c #3e4e5e", +"fL c #3e5772", +"bK c #3f3f3f", +"gD c #3f576f", +"fJ c #3f5874", +"d2 c #3f86d5", +"jx c #404040", +"#8 c #404e5d", +"bv c #405161", +"cf c #406389", +"jL c #414141", +"iG c #415561", +"im c #415663", +"gz c #415971", +"et c #415d7c", +"cz c #41658c", +"f# c #418ad7", +"jT c #424242", +"gy c #425b74", +"fs c #425d7a", +"#K c #4288d4", +"jQ c #434343", +"eX c #438cda", +"j8 c #444444", +".L c #44449a", +"eZ c #454545", +"#s c #455362", +"fx c #45617f", +"cK c #456b94", +"aP c #458cd5", +"ab c #464646", +".n c #46469f", +"aH c #46586a", +"gV c #465f74", +"d0 c #46678c", +"c9 c #474747", +"aF c #47596c", +"a3 c #475a6d", +"ex c #476687", +"jU c #484848", +"by c #485b6e", +"gq c #48627d", +"dI c #486b91", +"cC c #48709b", +"js c #494949", +"#2 c #495a6b", +"ih c #49606f", +"hm c #49637a", +"gk c #49647f", +"j7 c #4a4a4a", +"dt c #4a6e94", +"ak c #4a8dd7", +"b1 c #4a90db", +"c1 c #4b4b4b", +"bx c #4b5f72", +"fr c #4b698a", +"dG c #4b6e95", +"co c #4b75a2", +"fW c #4b91db", +"bD c #4c4c4c", +"hc c #4c687f", +"j6 c #4d4d4d", +"#Q c #4d5f71", +"ik c #4d6676", +"hH c #4e4e4e", +"#0 c #4e5f72", +"aD c #4e6277", +"b. c #4e6377", +"gN c #4e91dc", +"c0 c #4f4f4f", +"bj c #4f6378", +"dZ c #4f759e", +"cD c #4f7aa9", +"hN c #4f8dcd", +"kd c #505050", +"#S c #506275", +"#6 c #506376", +"ge c #506e8c", +"af c #515151", +"b# c #51667b", +"dk c #5195df", +"cT c #525252", +".c c #525280", +"bq c #52677d", +"iH c #526b79", +"fj c #527397", +"eW c #52769d", +"dy c #527aa5", +"hJ c #535353", +"#x c #536476", +"eG c #53789f", +"jM c #545454", +"#r c #546577", +"bz c #546a80", +"dM c #547ca8", +"fP c #5499e2", +"jp c #555555", +"iK c #556f7e", +"bM c #565656", +"fB c #56799f", +"dC c #567fab", +"gE c #569be2", +"cU c #575757", +"h7 c #57748b", +"gc c #577797", +"fN c #577ba1", +"dx c #5780ad", +"cg c #5787bb", +"i4 c #585858", +"iF c #587483", +"hy c #587792", +"g2 c #587893", +"fy c #587ca3", +"eA c #587ea7", +"jW c #595959", +"bu c #597087", +"ia c #5984b2", +"ae c #5a5a5a", +"#t c #5a6c7f", +"bd c #5a7189", +"ij c #5a7789", +"eI c #5a81ab", +"bR c #5b5b5b", +"ch c #5b8dc3", +"en c #5b9be1", +"ke c #5c5c5c", +"cP c #5c8fc5", +"j5 c #5d5d5d", +"iN c #5d7fa0", +"gl c #5d80a3", +"fp c #5d83ac", +"cl c #5d8fc6", +"b2 c #5d9de6", +"c8 c #5e5e5e", +"hh c #5e7f9c", +"hn c #5e809d", +"i3 c #5f5f5f", +"#1 c #5f758c", +"a8 c #5f7890", +"g7 c #5f819e", +"cJ c #5f93cc", +"jz c #606060", +"ct c #6094cd", +"bO c #616161", +"eN c #618cb9", +"jH c #626262", +"iW c #627c8d", +"hd c #6285a3", +"ey c #628dbb", +"dO c #6290c4", +"ca c #6297d1", +"jI c #636363", +"eM c #638fbd", +"jN c #646464", +"fH c #648db9", +"eE c #648fbe", +"cb c #649ad5", +"hA c #64a8e2", +"jw c #656565", +"#k c #65798f", +"fF c #658eba", +"fA c #658fbb", +"fa c #65a4e7", +"b3 c #65a6e8", +"jX c #666666", +"hW c #6688a3", +"gh c #668cb2", +"aI c #6696cb", +"dN c #6697cc", +"bA c #6699ce", +"cu c #669edb", +"#C c #676767", +"f3 c #678db4", +"dl c #67a6eb", +"kc c #686868", +"cS c #696969", +"dK c #699bd2", +"cN c #69a2e0", +"cy c #69a3e1", +"fX c #69a6e8", +"jD c #6a6a6a", +"av c #6a84a1", +"ds c #6a9cd3", +"dL c #6a9cd4", +"jt c #6b6b6b", +"fo c #6b97c6", +"cE c #6ba5e4", +"jS c #6c6c6c", +"aV c #6c88a4", +"ir c #6c8ea4", +"il c #6c8fa5", +"eD c #6c9bce", +"dB c #6c9ed7", +"dq c #6c9fd8", +"cM c #6ca7e7", +"cp c #6ca8e8", +"eo c #6cabed", +"i2 c #6d6d6d", +"#T c #6d869f", +"#W c #6d87a0", +"gY c #6d94b5", +"aa c #6d9bcb", +"eB c #6d9dd0", +"dw c #6da0d9", +"dD c #6da1da", +"b4 c #6dacee", +"h9 c #6dafe2", +"i6 c #6e6e6e", +"bt c #6e8aa7", +"fM c #6e9bcb", +"dP c #6ea3dc", +"b5 c #6eabee", +"jd c #707070", +"ix c #7088a2", +"hx c #7098ba", +"f7 c #7099c3", +"dv c #70a5df", +"b6 c #70adef", +"iy c #70aff1", +"dm c #70aff2", +"jE c #717171", +"#m c #7188a0", +"#u c #7189a1", +"aY c #718eac", +"gO c #71aced", +"jq c #727272", +"gb c #729cc6", +"hO c #72afee", +"ib c #72afef", +"e7 c #737373", +"#y c #738ba4", +"#A c #739eca", +".j c #747474", +"#9 c #748fab", +"hs c #749ec1", +"f6 c #749fca", +".i c #757575", +"#q c #758da6", +"a5 c #7593b1", +"bo c #7594b2", +"ii c #759bb3", +"fb c #75b3f4", +"ep c #75b4f3", +"is c #75b8e2", +"ag c #767676", +"fz c #76a6da", +"ez c #76a9e0", +"dX c #76adeb", +".h c #777777", +".m c #777794", +"iX c #77a6b3", +"dn c #77b1f4", +"gK c #787878", +"#4 c #7894b0", +"fG c #78a9dd", +"j# c #797979", +"bV c #7a7a7a", +"do c #7ab4f4", +"jA c #7b7b7b", +"io c #7ba3bc", +"dp c #7bb5f5", +".k c #7c7c7c", +"bc c #7c9cbd", +"gi c #7caad8", +"aQ c #7cb0e7", +"fY c #7cb8f9", +"iM c #7cbee2", +"j1 c #7d7d7d", +"aX c #7d9ebf", +"fm c #7db0e7", +"j4 c #7e7e7e", +".8 c #7ea5ce", +"#D c #7f7f7f", +"hv c #7facd3", +"gn c #7faedd", +"eb c #808080", +"er c #80bdf9", +"j3 c #818181", +"hz c #81afd6", +"gu c #81b0e0", +"eq c #81bbf9", +"fc c #81bbfc", +"#b c #828282", +"iE c #82aac0", +"i5 c #838383", +"ha c #83b1d9", +"es c #83bcf9", +"ad c #848484", +"go c #84b5e6", +".v c #858585", +"#p c #85a0bc", +"bN c #868686", +"hZ c #86b3d6", +"fD c #86bcf6", +"fO c #86bcf7", +"gP c #86c1ff", +"di c #878787", +"ft c #87bdf8", +"bH c #888888", +"iT c #88cfe2", +"jZ c #898989", +"#z c #89a5c3", +"g. c #89bbee", +"fg c #89c0fc", +"fd c #89c2fd", +"hP c #89c3ff", +"jb c #8a8a8a", +"#o c #8aa6c4", +"jc c #8b8b8b", +".S c #8baccf", +"iI c #8bb6ce", +"al c #8bb9e8", +"hj c #8bbde7", +"gw c #8bbef2", +"ff c #8bc3ff", +"fe c #8bc4ff", +"fZ c #8bc6ff", +"ec c #8c8c8c", +"gv c #8cbff3", +"jO c #8d8d8d", +"a# c #8dadce", +"ic c #8dc7ff", +"#H c #8e8e8e", +"a. c #8eaed0", +"#L c #8ebae8", +"hY c #8ebee3", +"g4 c #8ec1ec", +"iO c #8ecbff", +"ju c #8f8f8f", +"bi c #8fb5da", +"h6 c #8fc0e5", +"f5 c #8fc4f9", +"jf c #909090", +"bl c #90b6dc", +"i1 c #90dfe2", +"bC c #919191", +"aB c #91b5dc", +"aZ c #91b7dd", +"hV c #91c2e8", +"gf c #91c6fc", +"gg c #91c7fd", +"f0 c #91c8ff", +"i7 c #929292", +"gA c #92c8fe", +"iz c #92ccff", +"iU c #939393", +"a7 c #93b9e0", +"f2 c #93c9ff", +"gQ c #93ccff", +"e8 c #949494", +".y c #9494b0", +"h1 c #94c6ec", +"f1 c #94caff", +"j9 c #959595", +"#X c #95b7da", +"cX c #969696", +"ay c #96bbe3", +"#f c #96bde8", +"aR c #96c3ee", +"gR c #96cfff", +".J c #979797", +"hQ c #97cfff", +"fT c #989898", +"#j c #98b6d7", +"#l c #98b7d8", +"iJ c #98c7e1", +"g6 c #98cffd", +"jj c #999999", +"aS c #99c4ee", +"h3 c #99ccf4", +"gS c #99d0ff", +".l c #9a9a9a", +".b c #9a9aa4", +"aw c #9ac1ea", +"gT c #9ad1ff", +"dg c #9b9b9b", +".N c #9bbee8", +"aq c #9bc1eb", +"am c #9bc4ee", +"eg c #9c9c9c", +"au c #9cc3ed", +"ao c #9cc5ee", +"c5 c #9d9d9d", +"aT c #9dc7ef", +"hU c #9dd2fb", +"hR c #9dd3ff", +"dh c #9e9e9e", +"#v c #9ebee0", +".Z c #9ec3e8", +"#M c #9ec3ed", +"#N c #9ec5ed", +"ap c #9ec5ef", +"aU c #9ec7f0", +"h2 c #9ed4fd", +"id c #9ed6ff", +"df c #9f9f9f", +"an c #9fc5ee", +"h0 c #9fd5fe", +"aM c #a0a0a0", +"hT c #a0d6ff", +"jh c #a1a1a1", +"hS c #a1d7ff", +"ji c #a2a2a2", +"#P c #a2c7ed", +"i8 c #a3a3a3", +"#O c #a3c8ed", +"iA c #a3daff", +"j. c #a4a4a4", +"je c #a5a5a5", +"#g c #a5c8ed", +"ip c #a5dafb", +"iv c #a6a6a6", +".F c #a6bed4", +"de c #a7a7a7", +"#h c #a7c9ed", +"if c #a7ddff", +"ie c #a7deff", +"eh c #a8a8a8", +"#i c #a8caee", +"iL c #a8dbf8", +"ig c #a8deff", +"iP c #a8e0ff", +"iY c #a8e2e6", +"hC c #a9a9a9", +".0 c #a9caed", +"#B c #aaaaaa", +"fU c #ababab", +".5 c #abc9e9", +"iB c #abe3ff", +"e2 c #acacac", +".6 c #accaea", +"jo c #adadad", +".1 c #adcbed", +".7 c #adccec", +"iD c #ade2ff", +"iC c #ade3ff", +"fS c #aeaeae", +".4 c #aecded", +"db c #afafaf", +".A c #afbbe7", +".2 c #afccee", +".3 c #afceee", +"d6 c #b0b0b0", +"iQ c #b0e9ff", +"bG c #b1b1b1", +"jg c #b2b2b2", +"#E c #b3b3b3", +".O c #b3d1ed", +"gF c #b4b4b4", +"cY c #b5b5b5", +"iR c #b5ebff", +"hM c #b6b6b6", +"iS c #b6ecff", +"d9 c #b7b7b7", +".U c #b8b8b8", +".u c #b9b9b9", +"dd c #bababa", +".P c #bad4ee", +"bL c #bbbbbb", +".Q c #bbd4ef", +".R c #bbd5f0", +"e9 c #bcbcbc", +"c3 c #bdbdbd", +"f. c #bebebe", +"d8 c #bfbfbf", +".o c #bfc2e8", +"iZ c #bffdff", +"iw c #c0c0c0", +"iV c #c1c1c1", +"i0 c #c1feff", +"ei c #c2c2c2", +"ej c #c3c3c3", +"#a c #c4c4c4", +"el c #c5c5c5", +"d7 c #c6c6c6", +".r c #c6cbda", +"ek c #c7c7c7", +"aN c #c8c8c8", +"#G c #c9c9c9", +"aL c #cacaca", +"ai c #cbcbcb", +".B c #cbddf2", +"bZ c #cccccc", +".C c #cce0f3", +"dc c #cdcdcd", +"ah c #cecece", +"da c #cfcfcf", +".E c #cfe1f3", +".D c #cfe1f4", +"#I c #d0d0d0", +"cV c #d1d1d1", +"fQ c #d2d2d2", +"bB c #d3d3d3", +"#c c #d4d4d4", +"d# c #d5d5d5", +"aK c #d6d6d6", +"cZ c #d7d7d7", +"c6 c #d8d8d8", +"gH c #d9d9d9", +".W c #dadada", +"gM c #dbdbdb", +"bQ c #dcdcdc", +"e1 c #dddddd", +"cR c #dedede", +"d. c #dfdfdf", +"bP c #e0e0e0", +"i# c #e1e1e1", +"bY c #e2e2e2", +".K c #e3e3e3", +"ee c #e4e4e4", +"d3 c #e5e5e5", +"ef c #e6e6e6", +".p c #e6e9f6", +"fV c #e7e7e7", +"eY c #e8e8e8", +".a c #e9e9e9", +".q c #e9edf8", +".V c #eaeaea", +"## c #ebebeb", +"Qt c #ececec", +".w c #ededed", +".x c #eeeeee", +"#. c #efefef", +".# c #f0f0f0", +".9 c #f1f1f1", +".I c #f2f2f2", +".T c #f3f3f3", +"ja c #f4f4f4", +"i9 c #f5f5f5", +"hB c #f6f6f6", +".H c #f7f7f7", +".G c #f8f8f8", +"i. c #f9f9f9", +"kg c #fafafa", +"kf c #fbfbfb", +".t c #fcfcfc", +".s c #fdfdfd", +"it c #fefefe", +"iu c #ffffff", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt"}; diff --git a/tests/benchmarks/gui/image/qimagereader/images/pngwithcompressedtext.png b/tests/benchmarks/gui/image/qimagereader/images/pngwithcompressedtext.png new file mode 100644 index 0000000..01b2270 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/pngwithcompressedtext.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/pngwithtext.png b/tests/benchmarks/gui/image/qimagereader/images/pngwithtext.png new file mode 100644 index 0000000..5d93799 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/pngwithtext.png differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif b/tests/benchmarks/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif new file mode 100644 index 0000000..78868b0 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/rgba_lzw_littleendian.tif b/tests/benchmarks/gui/image/qimagereader/images/rgba_lzw_littleendian.tif new file mode 100644 index 0000000..107eab7 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/rgba_lzw_littleendian.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif b/tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif new file mode 100644 index 0000000..c314bae Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif b/tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif new file mode 100644 index 0000000..4f820f6 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/rgba_packbits_littleendian.tif b/tests/benchmarks/gui/image/qimagereader/images/rgba_packbits_littleendian.tif new file mode 100644 index 0000000..ddeec38 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/rgba_packbits_littleendian.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif b/tests/benchmarks/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif new file mode 100644 index 0000000..50a3024 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/runners.ppm b/tests/benchmarks/gui/image/qimagereader/images/runners.ppm new file mode 100644 index 0000000..fda1c97 Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/runners.ppm differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/task210380.jpg b/tests/benchmarks/gui/image/qimagereader/images/task210380.jpg new file mode 100644 index 0000000..fd045ea Binary files /dev/null and b/tests/benchmarks/gui/image/qimagereader/images/task210380.jpg differ diff --git a/tests/benchmarks/gui/image/qimagereader/images/teapot.ppm b/tests/benchmarks/gui/image/qimagereader/images/teapot.ppm new file mode 100644 index 0000000..b8ab85f --- /dev/null +++ b/tests/benchmarks/gui/image/qimagereader/images/teapot.ppm @@ -0,0 +1,31 @@ +P6 +256 256 +255 +\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[7 eOLjQLmSMoTMnSMlRMhPL_9 \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀnSMtVMzYN~[N~[N\N\O€\O€]O€]O€]O€]O€\O€\O}[NyYNtVM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-wXN}[N€]O„^O†_O†`O‡`Oˆ`Oˆ`OˆaO‰aO‰aO‰aO‰aO‰aO‰aOˆaOˆ`O†_Oƒ^O\N \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀaMLyYN…_O‰aP‹bPcPŽcPŽdPŽdPdPdPdPdPdPdPdPeP‘eP’eP’eP‘ePdPcP…_OpUM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀwXN…_OdP“fP•gQ–hQ˜hQ˜iQ™iQ™iQšiQšiQšjQ›jQ›jQœjQœjQœjQœjQœjQ›jQœjQ™iQ“fP‡`O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJiQL‹bP—hQkQ¡mR¤nR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¦pR¨pS©qSªqS«rS¬rS«rS©qS¤oRœjQ€]O\KK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀfOLrUMcPŸlR©qS¯tS²uTµwT·xT¸xT¹yTºyT»zT»zU¼zU¼zU¼zU»zUºyT¸xT¶wT¯tS¡mR‰aOhPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àa0 cNLqUM€\O”fQ¦pS²wVºzV¿|VÂ}VÄVÆVÇ€VÉ‚WÌ…[Õeæ w÷³‹êª…Ĉg§qT“fQ{ZNYIK9\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀO1{G#‘JkRMqUMtVN–iS¨v\·€d¹bµzZ±vU°uT®sSªqS¤nRœjQ’eP„^OrUMHh>!T4\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-V5wE"~I#†M%U+¥e7²l:°g2®b*­a(­`(©^(¥])¡^-›]1ŠS,qC$`9 R3G-\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@)J/i>!pA"tD"wF$yH&xH&tE$wE#yG%}M+ƒT4S5mE*Z7!K/B*;'\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‰aO¦oR½{UÇ€VÏ…X<(F-a: e!j@#k@$h>"dµf-¨^(¡Z'šW&–T&œN>)F-J/b; g>#nD(jB&c y< u: r9 o7 l6 +j5 +h4 +g3 +5$D,K/b; h>"wM1tK.e="a<#cA,U8&E-<(9&.!a0 b1 c1     + ++3#@)46G<:HMCIXHK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀU*´vT¿~X¸{YÃk+›W&‰N$|> u: p8 k5 +f3 +a0 _/ ]. [- I¡\*ª_(‘LkRMmSMmSMnSMnSMD,R3W5mA"|O0|P1j?"c!a: X/K%&4$+2F=;HPEJL&\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀŸlR¶xT­sTµd)ŠO$w; m6 +g3 +a0 Z- \/ T*Q(ŠHµm8kRMmSMnTMoTMpTMpUM15G15G05G04G04GpUMpTM5^9 d!Y0W+]. s=‡M$dPŸlR\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀoTM¥oRdPvE"V+K%A 99†F¤['qUMtVM99H:9H:9H:9H:9H:9H:9H:9H:9H:9H99H99H99H99H99H99H:9H;:H>;HB=HPDJ\JKmSMwXN|ZN°y[ᦆ֘uº{W¹yU¿€]Á„b­tU£nR—hQˆaO{ZNvWNtVMvXNwXNyYNzYN{ZN|ZN}[N}[N~[N~[N~[N~[N~[N~[N~[N}[N}[N{ZNzYNxXN…L$f3 +I$L&P(U*\. €J#\O›jQ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀžkR‰aOo9 L&C!:4f3 +X&pUMuWMwXNxXN<:H<:H<:H<:H<;H<;H<;H<;H=;H=;H=;H=;H>;H>;H?HG@ILBIREJ[JKcNLjQL§pR±uTºzUÃ~VÈWË‚XÖŽcäsÒŽe¼{V²vT¨pSžkR•gQŒbP†_O‚^O]O€\O€\O€\O€\O€]O]O]O]O]O]O]O]O]O]O]O€\O€\O~\N}[N|ZNxXN•T%H$G#K%Q(W+zG#nTM˜iQ\À\À\À\À\À\À\À\À\À\À\À\ÀdOLrUMuWNwXNyYN{ZN}[N{ZNwXNsVM \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àˆ`OcPnA"M&@ 8F#m6 +›W&rVMvWNyYNzYN|ZN}[N}[N>HE?IG@IIAIKBIODJSFJWHK—hQŸlR§pR°b(¾i*Én+Ù|7Û|6Ïr,Íq+Êp-Ãl+»g)±b(®sS§pS lRšiQ•gQePcPŠaPˆaO‡`O‡`O†_O†_O…_O…_O…_O…_O…_O…_O…_O„_O„^O„^Oƒ^Oƒ^O‚]O]O€\O~[N{ZN•T%F#B!Y,L&U*~I#„^O†`O\À\À\À\ÀcNLrUMzYN\O„^Oˆ`OŠbPŒcPdPeP’fP“fP“fQ“fQ”fQ‘ePcP‰aP~[N\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À’fPsVM^/ C!7 ŽQ%tVMwXNzYN|ZN}[N\N\O€\O]O]O‚]O‚]OA=HB=HB=HB>HC>HC>ID?IE?IF@IG@IIAIKBIŒcPdP’eP–gQšiQŸlR£nR¤\'´d)¿i*Æm+Îs/Ïs/Êo+Én+Ål*¾i*ºg)³c(ª_(ªqS¦oR¡mRkQ™iQ•gQ“fP‘ePŽdPcPŒbP‹bPŠbPŠaP‰aP‰aO‰aOˆaOˆ`Oˆ`O‡`O‡`O‡`O†`O†_O…_O„^Oƒ^O‚]O\O}[N›QD"?D"K%_/ kRL’fPODJSFJ†_OŠbPŽcP‘eP“fQ–gQ™iQœjQžkR lR¡mR£nR¤nR¥oR¥oR¥oR¤nR¢mRŸlRšiQ‘eP…_O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀB+‘ePI#L&90y< šPxXN{ZN}[N\N€\O]O‚]Oƒ^Oƒ^O„^O„_O…_O…_O†_O†`O‡`O‡`Oˆ`O‰aOŠaP‹bPŒbPcPŽdP‘eP“fP•gQ˜hQšiQžkR¢mR¡Z'«_(¶e)½h)Âk*Çn,Çn,Æm*Æl*Áj*ºf)¶e)²c(«_(¦]'§pR¤nR¡mRžkR›jQ™iQ–gQ”gQ“fP‘ePdPdPŽdPŽcPcPŒcPŒbP‹bP‹bP‹bPŠbPŠaP‰aP‰aO‰aOˆ`O‡`O†_O…_Oƒ^O]Oª_(@ B!I$B!N'w=‘eP`LKbNLeOLkR mR£nR¥oR§pSªqS¬rS®sS¯tS°tS°tS±uS±uS°tS¯tS­sSªrS§pS¢mRšjQŒbPjQL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‹bPpTME"5‡M$tVM{ZN}[N\O]O‚^Oƒ^O„_O…_O†_O†`O‡`Oˆ`Oˆ`O‰aO‰aPŠaPŠbP‹bPŒbPcPŽcPdPdP’eP“fP•gQ—hQ™iQ›jQkR lR¢mR¡Z'¬`(µd)ºg)ÇgÀj*Àj*¾i*¿i*»g)µd)²c(¯a(ª_(¤\'§pR¥oR¢nR mRžkRœjQšiQ˜iQ—hQ•gQ”gQ“fP’eP‘eP‘ePdPdPdPŽcPŽcPcPcPŒcPŒbP‹bP‹bPŠbPŠaP‰aOˆ`O†_O„^O\NœQ@ <G#_LKŽcPlSMnTMpUMsVM°tS²uT³vTµwT¶wT¶xT¶xT¶wTµwT´vT²uT¯tS¬sSªqS§pS¤oR¢nRžkR˜hQ‹bPeOL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀwXN\NJ%01ŽJvWN}[N\O]Oƒ^O…_O†_O†`O‡`Oˆ`O‰aO‰aPŠaPŠbP‹bPŒbPŒbPcPŽcPŽdPdPdP‘eP’eP”fQ•gQ–gQ˜hQ™iQ›jQkQŸlR¡mRžY&¦]'­`(³c(·e)Àc¸\¸\¹\º]»]¶^®a(¬`(©^'£['¢['¥oR£nR¡mR lRžkRœkQ›jQšiQ˜iQ—hQ–gQ•gQ”gQ”fQ“fP’eP’eP‘eP‘ePdPdPdPdPŽdPŽcPcPcPŒbP‹bPŠaPˆaO†`O]O˜OG#7F#uWMƒ^OwXNxXNzYN{ZN|ZN¹yT¸yT·xT´wT±uT­sS¨pS¡mRœjQ•gQdPŒbP‰aP‰aPŒbPŽcP‘ePcP|ZN\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[JKŠbP^/ 1 01|> wXN}[N]Oƒ^O…_O‡`O‡`OˆaO‰aPŠaP‹bP‹bPŒbPŒcPcPŽcPŽcPdPdPdP‘eP’eP“fP”fQ•gQ–gQ—hQ˜hQ™iQ›jQœkQžkRŸlR mRžY&¦]'­`(±b(·[ÇgÉiÉhÅfÂdÃe¿c«Uª_(§]'£[' Z'¤nR£nR¡mR mRŸlRžkRkQœjQšjQšiQ™iQ˜hQ—hQ–gQ•gQ•gQ”fQ”fQ“fP“fP’eP’eP‘eP‘ePePdPdPdPŽcPcPŒbPŠbPˆ`Oƒ^O‰D 4M&dPnSM|[N|[O|[OzZOxXNªrS¢nR˜hQŽcPƒ^OvXNiQL^KKRFJMCJJAIKBISFJ\JKnSMxYN†_O€\OaMK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀB!qUMŠaPC!/00a0 uWN}[N‚]O…_O†`Oˆ`O‰aPŠaP‹bPŒbPŒcPcPŽcPŽcPdPdPdP‘eP‘eP’eP“fP“fQ”fQ•gQ–gQ—hQ˜hQ™iQ™iQ›jQœjQkRžlRŸlRœX&¢['¨^'¬`(´ZÂdÄfÈiÆgÂd¿c¿c¼a¸_©T¥\'£[' Z'ŸY&£nR¢mR¡mR lRŸlRžkRkQœjQ›jQšjQšiQ™iQ˜hQ—hQ—hQ–hQ–gQ•gQ•gQ”gQ”fQ”fQ“fQ“fP’fP’eP‘eP‘ePdPdPŽcPŒbP‰aOƒ^Ox< :ŠaP]Oj8sVMmSMfOL^KKUGJIAIQEJ?IeZY638*  B\À\À\À\À\À,  4 .G1!\TU¡ƒrsVM{ZN`MK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[JKyYNŒbP/0ˆN$]O…_Oˆ`O‹bPŒbPcPŽcPdPdPdP‘eP‘eP’eP’fP“fP“fQ”fQ”gQ•gQ–gQ–gQ—hQ—hQ˜hQ™iQ™iQšiQ›jQœjQœkQkRžkRŸlRœO¡Z'¥\'©^'­V¼a¾bÁeÆi!Ãf¾b»a¹`·_³]²\µZ¢[' Z'ŸY&œQ¡mR¡mR mR lRŸlRŸlRžkRkRkQœkQœjQ›jQ›jQšjQšiQšiQ™iQ™iQ˜iQ˜hQ˜hQ—hQ—hQ—hQ–hQ–gQ–gQ•gQ•gQ”fQ’fPdPcPšW&dPŠaPrUM + B\À\À\À\À\À\À\À\À\À\À%7!!C*F#P) {dYœze»p€\OgPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ`LKvWNŠaPm6 + X,uWM‚]O‡`OŠbPcPŽdPdPdP‘eP’eP’fP“fP“fQ”fQ”gQ•gQ•gQ–gQ–gQ—hQ—hQ˜hQ˜iQ™iQ™iQšiQ›jQ›jQœjQœkQkQžkRžlRŸlR¢Z'¤\'§]'·_¹`¼a½bÁeÅi"Áe¼aº`·_¶_²]²\±\«Y¡Z' Z'¡Z'¡mR¡mR mR lR lRŸlRŸlRžlRžkRžkRkRkQœkQœjQœjQ›jQ›jQ›jQšjQšiQšiQšiQ™iQ™iQ™iQ˜iQ˜hQ˜hQ—hQ–gQ•gQ“fQdP†_Oq8 –gQˆ`OuWM”T%\À\À\À\À\À\À\À\À\À\À B B!!T,c5ƒF‚T3È›~Æ“qƒ^OfOL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXHK_LKsVM‡`OcP ’S%]OŠbPcPdP‘eP’eP“fP“fQ”fQ”gQ•gQ•gQ–gQ–gQ—hQ—hQ—hQ˜hQ˜iQ™iQ™iQšiQšiQ›jQ›jQœjQœjQkQkRžkRžlRŸlRŸlR¥\'¦]'¨^'­Vº`»a½bÁfÄi"Àe»a¹`·_¶_³]±\±\¤R¢Z'¢Z'£['¡mR¡mR¡mR¡mR mR lR lRŸlRŸlRŸlRžlRžkRžkRkRkRkQkQœjQœjQœjQœjQœjQ›jQ›jQ›jQ›jQšjQšiQ™iQ™iQ˜hQ–gQ‘eP§Sq8 ‰aO•gQ‡`OtVMœX&\À\À\À\À\À\À\À\À\À\À B B B l@!{A…L$›Y'½†a“fPˆaO]KK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀODJ[JKaMKqUM\OcPƒ^OvE"‚]OŠaPdP‘eP“fP”fQ•gQ•gQ–gQ–hQ—hQ—hQ˜hQ˜hQ˜iQ™iQ™iQ™iQšiQšjQ›jQ›jQœjQœjQœkQkQkRžkRžkRŸlRŸlRŸlR lR©^'©^'ª_(®W»a¼a¾cÂg Äi"¿e»a¹`·_¶_³^±\±\¤R£['£['§]'¢mR¢mR¡mR¡mR¡mR¡mR mR lR lR lR lRŸlRŸlRŸlRŸlRžlRžlRžkRžkRžkRžkRkRkRkRkRkQkQkQœjQœjQšiQ˜hQ’ePšW&M&oTMšiQ‘eP…_OtVMmSMdOL\À\À\À\À\À\À\À\À\À B B B ‘J Z'ª_(œkQ™iQ‡`OSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀTFJ\JKcNLlRMzYN‡`O’ePzZN \Nˆ`OdP“fQ•gQ–gQ—hQ˜hQ˜hQ™iQ™iQ™iQšiQšiQšiQ›jQ›jQ›jQœjQœjQœjQœkQkQkRžkRžkRžlRŸlRŸlRŸlR lR lR mR®a(­`(¬`(¶[½a½b¿dÃh!Äi"¿d»a¹`¸_¶_µ^²]³]¦S¤\'§]'«_(¢nR¢mR¢mR¢mR¢mR¢mR¢mR¡mR¡mR¡mR¡mR¡mR mR mR mR mR lR lR lR lR lR lR lR lR lRŸlRŸlR lRŸlRžkRœkQ™iQePt: kQ˜hQcP€]OtVMlSMa2 \À\À\À\À\À\À\À\À\À B B +$5 ¬`(¶e)£nRœjQƒ^OJAI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXIK^KKdNLhPLuWM‚]OŒbP”fQeP m6 +†`OŽcP“fQ—hQ˜hQ™iQšiQšjQ›jQ›jQ›jQœjQœjQœjQœkQkQkQkRžkRžkRžkRžlRŸlRŸlRŸlR lR lR lR¡mR¡mR¡mR¡mRºg)³c(²c(±b(­V¿cÂeÅi!Åi!Àd¼bº`¹`·_·_¶^¢Q§]'ª_(­`(¹f)£nR£nR£nR£nR£nR£nR£nR¢nR¢nR¢nR¢nR¢nR¢nR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢nR¢mR¢mR£nR¢mR¢mR¡mR mRkR—hQˆGa0 ŠbP mRœjQ“fQ‰aP}[NrUMmSM…L$\À\À\À\À\À\À\À\À B B #C, 8&H.Z7 §pR›jQ{ZN\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀQEJ[JK`LKdNLhQLqUM{ZN…_OŽcP–gQ—hQ +‹bP‘eP–hQšiQ›jQœjQkQkQkRžkRžkRžlRžlRŸlRŸlRŸlRŸlRŸlR lR lR lR mR¡mR¡mR¡mR¡mR¡mR¢mR¢mR¢mR¢nR£nRÀj*ºg)·e)¶d)Âd°XÅgÅhÂe¿c½b½b¾bªU­`(®a(¯a(³c(¾i*¤oR¤oR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤oR¤oR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¥oR¥oR¤nR¡mR›jQŽQ%Z- œjQ£nRŸlR—hQŽdP…_OuWMpTMnSMkRLa: \À\À\À\À\À\À\À B B&D2 @*S6#G@IPDJ˜hQmSM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ]KKbMLeOLiQLlRMvWN\OˆaO‘eP—hQœjQ•gQoTM•gQ™iQkQŸlRŸlR lR mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¢mR¢mR¢mR¢mR¢mR¢mR¢nR£nR£nR£nR£nR£nR¤nR¤nR¤nR¤nR¤nR¤nRÆl*Ãl+¾j+¹g)¸f)¶e)µd)¶e)¶e)·e)·e)¸f)¾i*Ìs0Ðs.¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦pR§pR§pR§pR§pR§pS§pS¨pS¨qS©qS©qS©qS¨pS©qS§pS¤nRŸlR‘I˜hQ§pR¥oR¡mRšiQ’ePŠaP€\OsVMpTMnTMlRM–X)\À\À\À\À\À\À\À B%C)D$;J/[8"LBITGJYIKWHK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK_LKcNLgPLjQLlRMpUMzYNƒ^O‹bP‘eP˜hQkQŸlR”fQ- —hQ›jQŸlR¢mR£nR£nR£nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤oR¤oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¦oR¦oR¦oR¦pR¦pR§pRàpßy-Ûw-Ûw-Þy.â{-ãu§pS§pS§pS§pS§pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨qS©qS©qS©qS©qS©qS©qS©qSªqSªrS«rS«rS¬rS¬rS¬rS¬rS¬sS«rSªqS¦oRšiQ™iQ©qSªqS§pR¡mRœjQ•gQcP„_O{ZNtVMpUMoTMmSMjQL_9 \À\À\À\À\À B "C(D#*A$[<)dI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JKaMKeOLhPLkRLmSMoTMuWM}[N…_O‹bP’eP˜hQžkR¢mR£nRžkR!-EkR¡mR¤nR¥oR¦pR§pR§pS§pS§pS§pS§pS§pS§pS§pR§pS§pS§pS§pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨qS¨qS¨qS©qS©qS©qS©qS©qS©qS©qS©qS©qS©qS©qSªqSªqSªqSªqSªrS«rS«rS«rS«rS«rS«rS¬rS¬rS¬rS¬sS­sS®sS®sS¯tS¯tS¯tS¯tS°tS°uS°tS®sS«rS£nR¦oR®sS­sS«rS§pR¢mRœjQ–gQdPˆaO\OyYNuWMqUMoTMnSMkRLo8 \À\À\À\À\À B'D+E$(1 J/jH1NCJUGJYIKUGJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXHK]KKbNLfOLiQLkRMmSMoTMqUMxXN\N†_OŒbP’fP˜hQkQ¡mR¥oR§pS¦pR˜hQ¢mR¥oR¨pSªqS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rSªrSªrSªrS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS¬rS¬rS¬rS¬rS¬rS¬rS¬rS¬sS¬sS­sS­sS­sS­sS­sS­sS®sS®sS®sS®sS®tS¯tS°tS°uS±uS±uT±uT²uT²uT²uT´vTµwT´vT³vT²uT¯tS¢mR¯tS±uT±uS®tS«rS§pR¢mRkQ—hQ‘ePŠaPƒ^O\N{ZNvXNqUMpTMnSMlRMP%\À\À\À\À B#C*E$.E- .!G$Y:%d<"SFJYIKZIKNCJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀPDJZIK_LKdNLgPLjQLlRMnSMpTMqUMuWMyYN€\O†`OcP’fP—hQœjQ¡mR¥oR¨qS«rS«rSªrS mR«rS­sS¯tS°tS°tS°tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS®tS®sS®sS®sS®sS®sS®sS®sS®sS®sS®tS®tS®tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS°tS°tS°tS±uS±uS±uT²uT²vT³vT³vT´vT´vT´wTµwTµwTµwT·xT·xT¸xT¸yT¸yU·xU¥\'©qS³vTµwTµwT´vT±uT®tTªrS¦oR¡mRkQ˜hQ’eP‹bP‡`Oƒ^O€\O|ZNxXNtVMpTMoTMmSMjQLh7\À\À\À B(D"-E*1F, 4#K)pL5PEJWHK[JKXHK:9H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀUGJ\JKaMLeOLhPLkRLmSMoTMpUMrVMvWNyYN|ZN]O‡`OŒcP‘eP—hQ›jQ lR¤nR§pSªqS­sS¯tS°uS¯tS­sS mR^/ ²vT³vT´vT´wTµwT´wT´vT³vT´vT´vT´vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT´vT´vT´vT´vT´wTµwTµwTµwTµwT¶wT¶wT¶xT·xT·xT·xT¸xT¸xT¸xT¹yTºyT»zU¼zU½{U½{V½|V•gQ¬rSµwT¸xT¹yU¹yU¹zV·yVµxV±vU­tT©qS¥oS mRœjQ—hQ’ePcPŠbP‡`O„_O]O}[NyYNuWMpUMoTMmSMkRL}H#\À\À &D -E(1F/!2#8 W7"iA&UGJ[JK\JKREJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀMCIXIK^KKcNLfOLiQLkRMmSMoTMqUMsVMwXNzYN}[N€\Oƒ^O‡`OŒbP‘eP–gQšjQžkR¢mR¥oR©qS¬rS¯tS±uS³vT´vTµwT´wT²uT­sS lR«_(¹yT¹yTºyTºyTºyTºyTºyT¹yT¹yT¸yT¸xT¸xT¸xT¸xT¸xT¸xT¸yT¸yT¸yT¸yT¹yT¹yT¹yT¹yT¹yT¹yT¹yTºyTºyTºyTºyTºzT»zT¼zU¼{U½{U¾{U¾|U¿|UÀ}VÁ~VÂWÀY™iQ«rSµwT¹yT¼zU½|V¿}XÁ€ZÂ]Á]¾€]»~[¶zY±wW¬tU¨qS¤nSŸlR›jQ–gQ“fPePŽcP‹bPˆ`O…_O‚]O~\NzZNvXNqUMoTMnSMlRMiQLg=!\À +!C+E'0F.4F7%8%U/lG.SFJZIK]KKZIKB=H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀREJZJK`LKdNLgPLjQLlRMnSMpTMqUMtWMxXN{ZN~[N]O„^O†`O‰aO‹bPdP•gQ™iQœkQ lR¤nR§pSªrS­sS¯tT²uT´vT¶wT·xT¹yT¹yTºyTºyT¹yT¶xT´vT¬rS¢nR—hQ¿|U¿|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ}UÀ}UÁ}UÁ}UÁ}UÁ}UÂ}UÂ~UÃ~UÃ~VÃ~VÄVÅ€WÆX®a(ŸlRªrS´vT¸yT¼zU¾|UÁ~VÃXÆ‚[Ɇ_΋dÓ‘jÔ“mÔ“nБlÊŒhĆd½_¶{[°vWªsU¦pS¢nRžkRšiQ˜hQ•gQ“fQ‘ePdPŒbP‰aO†_Oƒ^O€\O|ZNxXNsVMpTMnTMmSMjQL€C B)D&/F-3F47G6%>" Y7 kA$YIK]KK^KKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ\KKbMLeOLhPLkRLmSMnTMpTMrUMuWNyYN|ZN\N‚]O„_O‡`OŠaPŒbPŽcPeP“fP—hQ›jQžlR¢nR¥oS©qT¬sT¯uU²vU´wV¶xV¸yV¹yUºzU»zU¼{U½{U¾{U¾|U¿|U¿|U¿|U¿|U¾{U½{U¼{U¼zU»zTºyT¹yT¸xTµwT³vT´vT´vT´vT´wT´wTµwT·xT¹yTºzT¼zU½{U¾{U¿|UÀ|UÂ}UÄVÅ€WÇ‚YÉ„\͈_ÑŒdÙ”láuç£|쩂ſt명æ¦ÞŸ{Õ—sËŽl†d¹^³yZ­uW¨qU¤oSŸlRžkRœjQšiQ˜hQ–gQ”fQ‘ePdPcPŠaP‡`O„^O]O}[NyYNuWMpTMoTMmSMkRLgPL&D#.E,3F46G;'<(D"iB(VGJ]KK`LK[JKB>H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^LKcNLfOLiQLkRMmSMoTMqUMsVMvXNzYN}[N€\O‚^O…_Oˆ`OŠaPŒcPdP‘eP“fQ•gQ—hQ™iQkR mS¤oT¨rU¬tW°wY´zZ¸}\»]¾€^À^Á‚^‚^Â\Á€ZÁYÁXÁ~WÁ~WÂ~VÂ~VÂ~VÃ~VÃ~UÃ~UÄ~UÄ~UÄUÄUÅVÅVÅVÅVÆVÆ€VÆ€VÇ€WÇWÈ‚XɃZË…[͇^ЊaÓdØ’iÜ—nâtè£zî©ó¯‡ø´û¸‘üº“û¹“÷¶ñ±Œé©…à¡~Ö˜vËmÇf»€`´z[®vX©rU¥pT£oS¢nS lRžkRœkRšjQ˜iQ–hQ”fQ’ePdPcP‹bPˆ`O…_O‚]O~[NzYNvWNpTMoTMnSMkRMhQLo7 ,2F36G99HC+@ ]8 nA"\JK`ML_LKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMpTMqUMtVMwXNzZN}[N€]Oƒ^O†_OˆaO‹bPcPdP‘eP“fQ•gQ—hQ™iQ›jRžlR mS£oU§rW¬vZ²{]¹€a¿…fÅŠjËnГqÓ•sÕ–sÕ–rÕ–qÕ”oÓ’mÑjÏgÍŠcˈaɆ^È„\Ç‚[ÆYÅ€XÅ€WÅWÅWÅVÅVÅWÅ€WÆ€WÇXÈ‚YɃ[Ê…\͇_ÏŠaÒeÕ‘hÙ•mÝ™qávä¡zç¤}꧀멃몄騃奀ߠ|Ù›wÓ•rÌmƉh¿„c¸~^²yZ®vX¬tWªsV¨qU¦pT¤oS¢nS mRžlRœkR›jQ™iQ—hQ•gQ“fPePŽcP‹bPˆaO…_O‚^O\N{ZNwXNsVMoTMnSMlRMiQL~I#26G99G?IQ2P+XHK_LLfQOcNLXIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À©qSºyTÃ~VΈ`遲ޜv¾€]ªqS–LŽG|> g3 +S)?*%.—hQ—hQ‘eP‡`OuWM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMoTMqUMsVMwXNzYN}[N€\O‚^O…_O‡`OŠaPŒbPŽdP‘eP“fP•gQ—hQ˜iQšjRœkRŸlS¡nT¤pV§sX«vZ°z^¶b¼…gËmÊ’sјzØŸ€Þ¤…ã©Šè­ê¯ë°ê¯Žè¬‹å¨‡à¤‚Ûž|Ö™wÑ“qÌŽlljgÃ…bÀ‚_½\»}Zº{X¹zW¸yV·yU·xU·xU·xT·xT·xU·xU·xU·yV·yV·yW¸zW¸{X¹{Y¹|Zº}[º}[º}\º~\¹~]¹~]¸}]·|\µ{\´z[²yZ°wY®vX¬tWªsV¨rU¦pT¤oS¢nS¡mRŸlRkRœjQšiQ˜hQ–gQ”fQ’ePdPcPŠbP‡`O…_O‚]O~[NzZNvWNrUMoTMmSMlRMiQLeOLJAIJ(h>!]KKfQOgQN_LKD>I\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À™iQ°tS¸yT¼{UÂYÎŒeï­ˆô´Õ—u¶|\ Z'™LˆD |> ’eP¦oR¨qS¦oR¡mRšjQ‘eP„^OhPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀWHJ\KKaMLeOLhPLjQLlRMnSMpTMqUMtVMwXNzZN}[N€]Oƒ^O†_Oˆ`OŠbPcPdP‘eP“fQ•gQ—hQ™iQ›jRkRŸmS¢nT¤qV¨sX¬w[±{_¶€c½†hÄŒnË’tÒ™zØŸ€Þ¥…㩉ç­ê¯Žê¯Žê®ç«Šä§†ß£Ûž|Õ˜vГpËŽkljfÃ…bÀ‚_½\»}Yº{X¸zW¸yV·xU·xU·xT¶xT¶xT¶xU¶xU·xU·xU·yV·yV·zW¸zX¸{Y¹|Y¹|Z¹}[¹}[¹}\¹}\¸}\·}\¶|\µ{[³zZ²yZ°wY®vX¬tWªsV¨rU¦pT¤oS£nS¡mRŸlRžkRœjQšiQ˜hQ–gQ”fQ’ePdPŽcP‹bPˆ`O…_O‚^O\N{ZNwXNsVMoTMnSMlRMiQLfOLJ(V.]KKePNkUQcNLQEJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‚]O¡mR©qS¬rS°tS³vTµwT·xUº{WĆbÒ“qךxÊo +K«rS´vT¶wT´vT²uT®sSªqS¤nRkQ•gQˆ`OuWNY,\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^KKbNLfOLhQLkRLmSMoTMpUMrUMuWMxXN{ZN~[N]O„^O†_O‰aO‹bPcPdP‘eP“fQ•gQ—hQ™iQ›jRkRŸmS¢oT¥qV¨tX­w[±|_·d½†iÄŒnË“tÒ™zØŸ€Þ¥…㩉笌鮎ꮎ魌檉㧅ߢ€Ú{Õ—uÏ’pËjƈfÂ…b¿^½\»|Y¹{X¸zV·yV·xU·xU¶xT¶xT¶xT¶xU¶xU¶xU¶xU·yV·yV·yW¸zW¸{X¸{Y¸|Z¹|Z¹|[¹}[¸}\¸}\·|\¶|[µ{[³zZ±xY°wX®vX¬tWªsV¨rU¦pT¥oS£nS¡mRŸlRžkRœjQšjQ˜iQ—hQ”gQ’fPdPŽcP‹bP‰aO†_Oƒ^O€\O|ZNxXNtVMoTMnSMlRMjQLgPLzG#\JKcOMoXUgPMZIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À’fP”gQ•gQ—hQ™iQkQ lR¤nR§pRªqS¬sS¯tS:"r<zYN­sS¹yT¾|UÁ~WÆ„^ËŠeË‹gƈe¾‚aµz[­tV¦pS¢mRkQ–gQŠbPzYNkRL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀRFJZJK`LKcNLfPLiQLkRMmSMoTMqUMrVMvWNyYN|ZN\N]O„^O‡`O‰aO‹bPcPdP’eP”fQ–gQ—hQ™iQ›jRlR mS¢oU¥qV©tY­x\²|`¸d¾‡iÅoË“uÒ™{ÙŸ€Þ¥…㩉笌é®é®è¬‹å©ˆâ¦„Þ¡ÙœzÔ—tÏ‘oÊŒjƈe„a¿^½~[»|Y¹{X¸zV·yV·xU¶xU¶xT¶xT¶xT¶xT¶xU¶xU¶xU¶xV·yV·yW·zW·zX¸{Y¸{Y¸|Z¸|Z¸|[¸|[·|[·|[¶{[´z[³yZ±xY°wX®vW¬tWªsV¨rU¦pT¥oS£nS¡mRŸlRžkRœkRšjQ™iQ—hQ•gQ“fP‘ePŽdPŒbP‰aP†`Oƒ^O€]O}[NyYNuWNqUMnSMlSMkRLhPLcNLbNLpYVlUP`LK>;H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À›jQ‡`O{ZN©^'¨^'­`(·e)½h)Ãk*Êo+±b(£nRºyTÃ~UÇXÒdãŸwò°‰ñ°‹è©…ÝŸ}Ô˜vÈm¾„eµ}_®x[°y\®x[«tW§qT¡mRœjQ–gQ‹bP}[NlRM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ\JKaMKdNLgPLjQLlRMnSMpTMqUMsVMvXNzYN|[N\O‚]O…_O‡`O‰aPŒbPŽcPdP’eP”fQ–gQ˜hQšiQœjRžlS mS£oU¦rW©uY®x\³|`¸d¾‡jÅoÌ“uÒš{Ù €Þ¥…㩉欋è­è­Œç«Šå©‡á¥ƒÝ ~Ø›yÓ–tΑoÊŒjňe„a¿^¼~[º|Y¹{W¸zV·yV·xU¶xU¶xT¶xT¶xT¶xT¶xU¶xU¶xU¶xU¶xV·yV·yW·zX·zX¸{Y¸{Z¸{Z·|Z·|[·|[¶{[µ{[´zZ³yZ±xY¯wX®uW¬tVªsV¨rU¦pT¥oS£nS¡mR lRžkRœkR›jQ™iQ—hQ•gQ“fQ‘ePdPŒcPŠaP‡`O„^O]O~[NzYNvWNrUMnSMmSMkRLiQLeOLoXUu]XdOLKBI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À:9H\N–hQ¸}\¯uU­sT¯tT¯tS¨qS¤nR£nR¢nRŸlR›jQšiQ˜hQ—hQ–gQ”fQ’eP‘eP—hQœkR mS¥pUªtX«uY¨sW¦qU mS›jQ•gQƒB’S%jQL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀLBIXHK^KKbMLeOLhPLjRLlSMnSMpTMqUMtVMwXNzYN}[N€\O‚^O…_O‡`OŠaPŒbPŽcPeP’fP”fQ–gQ˜hQšiRœkRžlS nT£pU¦rWªuY®y]³}`¹‚e¿ˆjÅŽpÌ”vÓš{Ù Þ¤…⨉櫋笌笋櫊䨆ंܟ~ךxÒ•sÎnÉŒiŇeÁ„a¾€^¼~[º|Y¹{W¸yV·yV·xU¶xU¶xT¶wT¶wT¶wT¶xT¶xU¶xU¶xU¶xV¶yV¶yW·zW·zX·zY·{Y·{Z·{Z·{Z¶{Z¶{ZµzZ³yZ²yY±xY¯vX­uW¬tVªsU¨rU¦pT¥oS£nS¡mR lRžlRkR›jQ™iQ—hQ•gQ“fQ‘ePdPcPŠaP‡`O…_O‚]O\N{ZNwXNsVMnSMmSMkRMiQLfOL_LKhQMUGJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À (6BFP>=DKHMqjk€trwf`~kc„ndŠqesete¯Ž{w`¡v[\N†_OcP“fP˜iQœjRŸlS£oT¦qV¥qV£oTžlR™iQº^‡`OQ%hPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀQEJZIK_LKcNLfOLiQLkRLmSMoTMpUMrUMuWMxXN{ZN~[N€]Oƒ^O…_Oˆ`OŠaPŒcPŽdP‘eP“fP”gQ–hQ˜iQšjRœkRžlS¡nT£pU¦rWªuZ®y]³}a¹‚e¿ˆkÆŽpÌ”vÓš{ÙŸ€Þ¤…⨈媊櫋櫊婈⦅ߣ۞}ÖšxÑ•rÍmÈ‹ićdÁƒa¾€]¼~[º|Y¹zW¸yV·yU¶xU¶xU¶wT¶wT¶wT¶wT¶wT¶xU¶xU¶xU¶xU¶xV¶yV¶yW¶zX·zX·zY¶zY¶{Y¶{Z¶{ZµzZ´zZ³yY²xY°wX¯vX­uW«tVªsU¨rU¦pT¥oS£nS¡mS mRžlRkR›jQ™iQ˜hQ–gQ”fQ‘ePdPcP‹bPˆ`O…_O‚]O\O|ZNxXNtVMoTMmSMlRMjQLgPLbML[JK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À%5 (6$/79CEEKjgkrc_›…{‘uf±{Ÿw_ºq]Oˆ`OŽcP”fQ˜hQ›jRžlR¡nT¢oT¡nTkR˜hQŽdP¦]'ŽQ%\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀUGJ[JK`MKdNLgPLiQLkRMmSMoTMqUMrUMuWNxXN{ZN~[N]Oƒ^O†_Oˆ`OŠbPcPdP£['µd)•gQ—hQ˜iQšjRœkRžlS¡nT£pU§rWªvZ¯y]´~aºƒfÀˆkÆŽpÌ”vÓš{ØŸ€Ý¤„ᧇ䩉媊媉䨇᥄ޡ€Ú|Õ˜wДrÌmÈŠhĆdÀƒ`¾€]»}[º|Y¸zW·yV·xU¶xU¶xU¶wTµwTµwTµwTµwTµwUµwUµxUµxUµxV¶xV¶yW¶yW¶yX¶zX¶zY¶zYµzYµzY´zY´yY²yY±xY°wX®vW­uW«tVªsU¨qU¦pT¥oS£nS¢mS mRžlRkR›jQ™iQ˜hQ–gQ”fQ’ePdPcP‹bPˆaO†_Oƒ^O€\O|[NxYNtWMpUMmSMlRMjQLgPLcNLA;=\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À#*6+.8;:AHEJmgjd\]‡pe«}œxc w^»pƒ^OŠaP‘eP–gQšiQžlR mS¢nT mS›jR•gQ»h*œX&ˆM$\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀC+WHJ]KKaMLdOLgPLjQLlRMnSMoTMqUMrVMvWNyYN|ZN\N]O„^O†_OˆaO‹bPcPžY&«_(³c(•gQ—hQ™iQšjRœkRŸlS¡nT¤pV§sX«vZ¯z^´~bºƒfÀ‰kÆŽpÌ”vÒš{ØŸ€Ý£„ই㩉䩉䩈⧆ःܠØœ{Ô—vÏ“qËŽlljgÆcÀ‚`½]»}Z¹{Y¸zW·yV¶xU¶xU¶wUµwTµwTµwTµwTµwTµwTµwUµwUµxUµxVµxVµxVµyWµyWµyXµyXµyYµzY´yY´yY³yY²xY±wX°wX®vW­uV«tVªrU¨qU¦pT¥oS£nS¢mS mRžlRkR›jQ™iQ˜hQ–gQ”fQ’ePdPŽcP‹bP‰aO†_Oƒ^O€\O}[NyYNuWNqUMmSMlRMjQLhPLdNL\1\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À+.775;ICFphhŠztŠre¯}Ÿya¢vZ]OŠaP‘eP–gQšiQkRŸlS¡nTžlS™iQÌq.¯b*“S%zG#\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀMCJXHK^KKbMLeOLhPLjRLlSMnSMpTMqUMsVMvWNyYN|ZN\N‚]O„^O†`O‰aO‹bP—U&¥\'¯a(»g)Ìr/—hQ™iQ›jRkRŸmS¡nT¤pV§sX«v[¯z^´~bºƒfÀ‰kÆŽpÌ”vÒ™{מÜ£ƒà¦†â¨ˆã¨ˆã¨‡á¦…Þ£‚ÛŸ~×›yÓ–uÎ’pÊkƉgÂ…c¿‚_½]»}Z¹{X¸zW·yV¶xU¶xUµwTµwTµwTµwTµwTµwTµwTµwUµwUµwUµxUµxVµxVµxWµyWµyWµyXµyX´yX´yY³yY³xX²xX°wX¯vW®uW¬tV«sV©rU¨qT¦pT¥oS£nS¡mR mRžlRkR›jQšiQ˜hQ–gQ”fQ’ePdPŽcPŒbP‰aO†`Oƒ^O€]O}[NzYNvWNrUMmSMlRMjQLhQLeOL_LK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À,)/ZTVXON„uq‡od®}Ÿyb»s]OŠaPeP•gQšiQkRžlRŸlSœkR–hQ»g*¤\(ŽQ%`LK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À B B_LKcNLfOLiQLkRLmSMoTMpTMrUMtVMwXNzYN}[N\O‚]O„_O‡`O‰aOQ%ŸY&©^'±b(¾i*Õ{8—hQ™iQ›jRkRŸmS¡nT¤qV§sX«v[°z^µ~bºƒfÀ‰kÆŽpÌ”vÒ™{מÛ¢ƒß¥…ᧇ⧇ᦆऄݢڞ}ÖšxÒ•tÍ‘oÉŒjňfÂ…b¿_¼\º}Z¹{X·zW·yV¶xU¶xUµwTµwTµwTµwTµwTµwTµwTµwT´wU´wU´wU´xVµxVµxVµxW´xW´yW´yX´yX³xX³xX²xX±wX°wW¯vW­uW¬tV«sU©rU§qT¦pT¤oS£nS¡mR mRžlRkR›jQšiQ˜hQ–gQ”gQ’fPdPŽcPŒbP‰aP‡`O„^O]O~[N{ZNvXNrVMnSMlRMjRLhQLeOLaML+O+O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀHFLXQRTJH~pm‚la¬Ž}Ÿzc»t¤tT‰aPdP•gQšiQœjRžlRžlS›jRÖ|:´e*˜V&ˆN$\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À B B`LKdNLgPLiQLkRMmSMoTMpUMrUMtVMwXNzYN}[N€\O‚]O…_O‡`O‰aPšW&£['«_(´d)Âl,݃@Òt.™iQ›jRkRŸmS¡oU¤qV¨sX«w[°z^µbºƒgÀ‰kÆŽpÌ”uÑ™zÖ~Ú¡‚Þ¤„ॆআॅޣ‚Ü Ø{Õ™wÑ”sÌnÈŒjňfÁ„b¾_¼~\º|Z¸{X·yW¶yV¶xUµwUµwTµwTµwTµwT´wT´wT´wT´wT´wU´wU´wU´wU´wV´xV´xV´xW´xW³xW³xW³xX²xX±wX°wW¯vW®uW­uV¬tVªsU©rU§qT¦pT¤oS£nS¡mR lRžlRkR›jQšiQ˜hQ–hQ”gQ’fPdPŽcPŒbPŠaP‡`O„^O]O~[N{ZNwXNsVMoTMlRMjRLiQLfOLbML+O+O‚+O‚+O‚\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À6./fZXeVRHAIZIKiQLuWM¤tU‰aOdP–gQšjQkRžlRkR˜iQÄn/¬b,‘R%rC"\À\À\À\À\À\À\À\À\À\À\À\À"Fx"Fx!Fx!Fx B B BdNLgPLjQLlRMmSMoTMqUMrUMtWMwXNzZN}[N€\O‚^O…_O‡`O“S%X&¥\'®a(·g+Ês2Ó{9Àj*™iQ›jRkSŸmS¢oU¤qV¨sX«w[°z^µbº„gÀ‰kÆŽpË“uИyÕœ}٠ܢƒÞ¤„ߤ„Þ£ƒÝ¡ÚŸ~×›zÓ—vÏ“rËmÇ‹ićeÀƒa¾€^»~\¹|Z¸zX·yW¶xVµxUµwUµwTµwT´wT´wT´wT´wT´wT´wT´wT´wU´wU´wU´wU´wV³wV³xV³xW³xW²wW²wW±wW±wW°vW¯vW®uV¬tV«sUªsU¨rT§qT¦pT¤oS£nS¡mR lRžlRkR›jQšiQ˜hQ–gQ”gQ’fPePŽcPŒbPŠaP‡`O„_O]O~\N{ZNxXNsVMoTMlRMjRLiQLfPLbNL +O‚+O‚+P‚+P‚+P‚\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@89dWT@IIAI\JKlRMyYN„^OcP”gQ™iQkRžlRžkR™iRÍt3±d-’S%I#\À\À\À:^‘:^‘:^‘:^‘:^:^:^:^:^"Fx"Fx B B B BeOLhPLjRLlSMnSMpTMqUMrVMuWMxXN{ZN~[N€]Oƒ^O…_O“S%›W&¢['©^(¹k2½i+Ó{:•gQ—hQ™iQ›jRkSŸmT¢oU¤qV¨tY¬w[°{_µbºƒf¿ˆkÄoÊ’tÏ–xÓš|×~Ù €Û¡Û¡Û €Ùž~×›{Ô˜wДsÌoÉŒkʼngÂ…c¿‚`¼]º}[¸{Y·zX¶yVµxVµwU´wU´wT´wT´vT´vT´vT´vT³vT³vT³vT³vT³vU³vU³vU³wU²wU²wV²wV²wV±wV±vV°vV°vV¯uV®uV­tV¬tUªsU©rU¨qT§pT¥pS¤oS¢nS¡mR lRžlRkR›jQ™iQ˜hQ–gQ”gQ’fPePŽdPŒbPŠaPˆ`O…_O‚]O\N|ZNxYNtWMpTMlRMjRLiQLgPLcNL_LK+P‚+P‚+P‚,P‚,P‚,P‚,P‚,P‚Nr¤\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À]QNl\VG@IMCI_LKoTM|ZN†`OdP–gQšjQkRžlRœkR—hQºh*¤^,ŒP%X3:_‘:_‘:_‘:_‘:_‘:_‘:_‘:_‘:^‘:^‘:^‘:^‘"Fx B B B BfOLiQLkRLmSMnTMpTMqUMrVMuWNxYN{ZN~[N€]Oƒ^OŽP%—U&X&£['¬`)½n4Ãn/Àj*•gQ—hQ™iQ›jRkSŸmT¢oU¤qW¨tY«w[°z^´~b¹ƒf¿ˆjÄŒoÉ‘sΕwÒ™{Õœ}ØžÙŸ€ÚŸ€Ùž~ל|ÕšyÒ—vÏ“rËnÇ‹jĈfÁ„c¾`¼]¹}[¸{Y·zW¶xVµxU´wU´wT´wT´vT´vT³vT³vT³vT³vT³vT³vT³vT³vT²vU²vU²vU²vU²vU±vV±vV±vV°vV°vV¯uV®uV­uV¬tU«sUªrU©rT¨qT¦pT¥oS£oS¢nS¡mRŸlRžkRœkR›jQ™iQ˜hQ–gQ”gQ“fPePŽdPŒbPŠaPˆ`O…_O‚]O\N|ZNyYNuWMpUMlRMjQLiQLgPLdNL_LK,P‚,P‚,P‚,P‚,P‚Nr¤Nr¤Nr¤Nr¤Nr¥Nr¥\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀaSOD>IJAIQEJbNLrUM~[NˆaO‘eP—hQœjQžkRŸlR›jRÌs0²e,“T&ƒK$;_‘;_‘;_‘;_‘;_‘;_‘;_‘:_‘:_‘:_‘:_‘:_‘:_‘ B B B BgPLiQLkRLmSMoTMpTMqUMsVMuWNxYN{ZN~[N]O‡M$“S%™V&ŸY&¥\'±e-¹j/Ñz:”fQ•gQ—hQ™iR›jRkSŸmT¢oU¤qW¨tY«w[¯z^´~b¹ƒf¾‡jÃŒnÈrÍ”vјyÔ›|Ö~מ~Øž~×}Õ›{Ó˜xЕtÍ’qÊŽmÆŠiÇeÀ„b½_»~\¹|Z·{Y¶yWµxVµxU´wU´wT´vT³vT³vT³vT³vT³vT³vT³vT³vT²vT²vT²vT²vU²vU²vU±vU±vU±vU°vV°vV¯uV®uV®uV­tU¬sU«sUªrU¨qT§qT¦pS¥oS£nS¢nR¡mRŸlRžkRœkR›jQ™iQ˜hQ–gQ”gQ’fPePŽdPŒbPŠaPˆ`O…_O‚]O\O|ZNyYNuWMqUMlSMjQLhQLfPLdNL_LK,P‚,P‚Nr¤Nr¤Nr¤Nr¤Nr¥Nr¥Nr¥Ns¥Ns¥Ns¥Ns¥\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀdUOG@IMCITFJeOLtWM€]O‹bP“fP™iQkRŸlRkR™iQ¾j,©c/P%[JK;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘ B B B BgPLiQLkRMmSMoTMpTMqUMsVMvWNyYN{ZN~[N|H#ŽQ%•T%›W& Z'¦]'ºm5¸f*Ív5”fQ•gQ—hQ™iR›jRkSŸmT¡oU¤qW§sY«v[¯z^³~b¸‚e½‡i‹nÇqË“uÏ–xÒ™zÔ›|Öœ}Öœ|Õ›{Ô™yÑ–vÏ“sÌoÈlʼnh†e¿ƒa¼€_º~\¸|Z·zX¶yWµxV´wU´wU³vT³vT³vT³vT³vT³vT³vT²vT²vT²vT²vT²vT²vT±vT±vU±vU±vU°uU°uU°uU¯uU®uU®tU­tU¬tU«sUªrU©rT¨qT§pT¥pS¤oS£nS¢mR mRŸlRžkRœjR›jQ™iQ—hQ–gQ”fQ’fPePŽcPŒbPŠaPˆ`O…_O‚^O\O|ZNyYNuWNqUMmSMjQLhQLfPLdNL`LKNr¤Nr¤Nr¥Nr¥Nr¥Ns¥Ns¥Ns¥Ns¥Os¥Os¥Os¥Os¥Os¥Os¥\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À2#TB3REJVGJ`LKpTM}[N‰aO’ePšiQžkR lRžlR˜hQ·e)¢^.P%^8 #Gy#Gy#Gy#Gy#Gy#Gy#Gy#Gy * B B B B BjQLlRMnSMoTMpUMrUMsVMxF#‡M$ŽQ%’S%–U&šW&žY&¢['ªa+¿s;¹g+dP‘eP“fQ”gQ–hQ˜iQšjRœkSžlS nU£pV¦rX©uZ¬x]°{_´~b¸‚e¼…iÀ‰kÃŒnÆŽpÈrÊ‘sË’sË‘rÊqÉoÇmÅ‹kÈhÀ…e¾ƒb¼€`º~^¸|[¶{ZµyX´xW³wV²vU²vU²vT±uT±uT±uT±uT±uT±uT±uT±uT°uT°uT°tT°tT¯tT¯tT¯tT¯tT®tT®tT­sT­sT¬sT¬sT«rTªrT©rT©qT¨qS§pS¦pS¥oS£nS¢nR¡mR lRŸlRkRœjQ›jQ™iQ˜hQ–gQ•gQ“fP‘ePdPcP‹bP‰aO‡`O„^O‚]O\N|ZNxXNuWMqUMmSMhPLgPLeOLcNL`LKZIK,Pƒ,Pƒ,QƒOs¦Os¦Ot¦Ot¦Ot¦Ot¦Pt¦Pt¦Pt¦Pt¦Pt¦-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀvšÍvšÍv›Ív›Ív›Ív›Ív›Íw›Íw›Í=a“=a“=a“#Gy#Gy#Gy#Gy#Gy#Gy#Gy#GymYPODJUGJXIKeOLtWM‚]OcP•gQœjQ lR mRkRÈp.´g0”T&ˆN$]8 #Gy#Gy#Gy#Gy#Gy#Gy#Gy * B B B B BjQLlRMnSMoTMpUMrUMv>„L$ŒP%‘R%•T%˜V&œX& Z'¤\'°f0¹m5Äq3dP‘eP“fQ”gQ–gQ˜hQ™jR›kSlS nT¢pV¥rX¨tZ«w\¯z_³}a·dº„g¾‡jÁŠlÄŒnÆŽpÇqÈqÈpÇŽoÆmÅ‹kÉiÁ‡g¿„d½‚aº_¸}]·|[µzY´yX³xW³wV²vU²vU±uT±uT±uT±uT±uT±uT°uS°uS°tS°tS°tS¯tS¯tT¯tT¯tT®tT®tT®sT­sT­sT¬sT¬sT«rTªrTªrT©qT¨qS§pS¦pS¥oS¤oS£nS¢mR¡mRŸlRžlRkRœjQšjQ™iQ—hQ–gQ”fQ’fP‘ePdPcP‹bP‰aO†`O„^O]O~\N{ZNxXNuWMqUMiQLgPLfOLeOLbNL_LKZIK,Qƒ,Qƒ,Qƒ,Qƒ,QƒOt¦Pt¦Pt¦Pt¦Pt¦Pt¦-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àv›Ív›Ív›Ív›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Í=a“=a“=a“=a“=a“#Gz#Gz#Gz#Gz#Gz#Gz#GzgUOS=2RFJWHJ[JKlRMzYN†`OeP˜iQžkR mRŸlR™iQ¼h*°h4‘R%ˆN$^9 [JK#Gy#Gy#Gy#Gy#Gy * B B B B BjQLlRMnSMoTMpUMI#†L$‹O$Q%“S%—U&šW&X&¡Z'¦](·l5´f,Èt5dPeP’fP”fQ–gQ—hQ™iR›kRlSŸmT¢oV¤qW§tY«v[®y^±|aµc¸‚f¼…h¿ˆkÁŠlÃŒnÅnÅoÅnÅŒmÄ‹k‰iÁ‡g¿…e½ƒc»€`¹~^·|\¶{Z´yY³xW²wV²vU±vU±uT±uT±uT°uT°uT°tS°tS°tS°tS°tS¯tS¯tS¯tS¯tS®tS®tS®sS­sT­sT­sT¬sT¬rT«rTªrTªrS©qS¨qS§pS¦pS¦oS¥oS¤nS¢nR¡mR mRŸlRžkRkR›jQšiQ˜iQ—hQ•gQ”fQ’ePePdPcPŠbPˆ`O†_Oƒ^O]O~[N{ZNxXNtVMqUMhPLgPLfOLdNLbML_LKbE6,Qƒ,Qƒ,Qƒ,Qƒ-Qƒ-Qƒ-QƒPt¦-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Q„-Q„-Q„\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@d–w›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Îw›Îw›Î=a”=a”=a”=a”=a”=a”=a“#Hz#Gz#Gz#Gz#Gz#Gz#GzmYPPDJUGJYIKbMLqUM\NŠbP”fQ›jQŸlR¡mRžlRËp,µe+ \+R%ˆN$b; ]8 [7 XHKO+N1L/L/L/K/K/ eb”>b”>b”>b”>b”>b”>b”>b”=b”=b”=b”=b”=b”=b”=b”=b”YEUGJYIK_LKnSM|ZNˆ`O’ePšiQŸlR¡mR mR™iQºg*´j4šW'‘R%ŽQ%h>!g=!f=!db”>b”>b”>b”>b”>b”>b”$Hz$Hz$Hz$Hz$Hz>b”>b”>b”>b”>b”gVOS=2RFJWHK[JKeOLsVM€]OŒbP•gQœjQ lR¡mRžlRÌr/¹g*²h2–U&“S%‘R%Q%ŽQ%ŒP%£['¨]'¬`(°b(´d)¸f)»g)¾i*Áj*I#¡Z'¡Z' Z' Z'¡Z'£['¤['¥\'¦]'ª_)±d,³d)Äq3‹bPcPdP‘eP’fQ”fQ–gQ—hQ™iR›kSlSŸmU¡oV¤qW¦sY©u[¬x]¯z^±|`´~b¶€d¸‚eºƒf»„f»„f¼„f»ƒe»‚dºb¹€a·~_¶}^µ{\´zZ³yY²wX±wW°vV°uU¯uU¯tT¯tT¯tT®tS®tS®tS®sS®sS®sS®sS®sS­sS­sS­sS­sS¬sS¬rS¬rS«rS«rSªrSªqS©qS©qS¨pS§pS¦pS¦oS¥oS¤oR£nR¢nR¡mR mRŸlRžkRkRœjQšjQ™iQ˜hQ–hQ•gQ“fQ’ePdPŽcPŒcPŠbPˆ`O†_O„^O]O\N|ZNyYNuWNrUMnSMjQLdNLcNLaMK_LK[JK`D6Pt¦Pt¦Pt§Pt§Pt§Pu§Pu§Pu§Pu§Qu§Qu§Qu§Qu§Qu§Qu§-Q„-Q„-Q„-R„-R„-R„-R„-R„-R„-R„-R„-R„.R„.R„Rv¨Rv¨Rv¨~¢Ô~¢Ô~¢Ô~¢Ô\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@e—@e—@e—@e—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—xœÏxœÏxœÏxÏxÏxÏxÏyÏyÏ>b•>b”>b”$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>b”>b”>b”>b”>b”YDb”>b”>b”>b”Q@:R<2fL@WHJZJKaMKoTM|ZNˆ`O‘eP™iQŸlR¡mR¡mRœjRÇo-»i-´h0«`)§]'¨]'¬`(°b(´d)¸f)¼h)Àj*Ãk*Æm*Én+Ìp+Ïq+Òr,§]'§]'§]'¨^'ª_(«_(¬`(­`(¯b)²c)ºi.ˆ`OŠaPŒbPŽcPdP‘eP“fQ”gQ–hQ˜iRšjR›kSlTŸnU¢oV¤qW¦sY©uZ«w\­y]°{_²|`³}aµ~b¶b¶b¶b¶a¶~`µ}_µ|^´{]³z[²yZ±xY°wX¯vW¯uV®uU®tU®tT­tT­sT­sS­sS­sS­sS­sS­sS­sS­sS¬sS¬rS¬rS¬rS«rS«rS«rSªrSªqS©qS©qS¨qS¨pS§pS¦pS¦oS¥oR¤oR¤nR£nR¢mR¡mR lRŸlRžkRkRœjQšjQ™iQ˜hQ–hQ•gQ“fQ’ePdPdPcP‹bP‰aO‡`O…_O‚]O\O}[NzYNwXNtVMpTMlRMhPLcNLaMK_LK]KKbR]C5Pu§Pu§Pu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu¨Qu¨Qu¨Qv¨Qv¨Qv¨-R„-R„.R„.R„.R„Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae˜Ae˜Ae˜Ae˜yÏyÏyÏAf˜Af˜Af˜$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>b•>b•>b”>b”WD3TFJXHK[JKfOLsVM€]O‹bP”gQœjQ lR¡mR mRœkRÅm,½i,ºj/²d+±c)²c(¶e)ºf)¾h*Áj*Ål*Én+Ëo+Îq+Ñr+Ós,Õt,ƒK$ª^(ª_(«_(¬`(®a(¯a)°b)³d*¶f+¾m1‡`O‰aP‹bPcPdPeP’fQ”fQ•gQ—hR™iR›kSlTŸmT¡oV£pW¥rX§tY©v[¬w\®y]¯z^±{_²|`³}`´}`´}`´}_´|^³{^³{\²z[±yZ°xY°wX¯vW®uV®tU­tU­tT­sT­sT­sS­sS¬sS¬sS¬sS¬rS¬rS¬rS¬rS¬rS«rS«rS«rS«rSªrSªqSªqS©qS©qS¨qS¨pS§pS¦pS¦oS¥oR¤oR¤nR£nR¢mR¡mR mRŸlRžlRkRœjQ›jQšiQ˜iQ—hQ–gQ”fQ“fP‘ePdPŽcPŒbPŠaPˆ`O†_O„^O]O\N|ZNyYNvWNsVMoTMkRLgPLbML`LK^KK\JK~aR[B5Pu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu¨Qu¨Qu¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAe—Ae—Ae—Ae—Ae—Ae—Ae˜Ae˜Ae˜Ae˜Ae˜Ae˜Ae˜Af˜Af˜Af˜yÐAf˜Af˜Af˜Af˜Af˜Bf˜$H{$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>c•>c•>b•>b•O?:[E|aRZA5-QƒQu§Qu§Qu§Qu§Qu§Qu§Qu§Qu¨Qu¨Qu¨Qv¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„Rv¨Rv¨Rv©Rv©Rv©Rw©£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAe˜Ae˜Ae˜Ae˜Ae˜Ae˜Ae˜Af˜Af˜Af˜Af˜Af˜yžÐyžÐyžÐzžÐzžÐzžÐBf˜Bf˜Bf˜Bf˜Bf˜$H{$H{$H{$H{$H{$H{$H{$H{$H{$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>c•>c•>c•>c•VC^C6W@5-Q„-Q„Qu§Qu§Qu§Qu§Qu¨Qu¨Qv¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„Rv©Rw©Rw©Rw©¤Ö¤Ö¤Ö¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö¤Ö¤Ö¤Ö\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAf˜Af˜Af˜Af˜Af˜Af˜Af˜Af˜zžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐBf˜Bf˜Bf˜Bf˜$I{$I{$I{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$Hz$Hz$Hz$Hz$Hz YE\C6T>4-Q„-Q„-Q„-R„Qu¨Qu¨Qv¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„Rw©Sw©€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›Ei›\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAf˜Af˜Bf˜Bf˜Bf˜zžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÑzžÑzžÑzŸÑzŸÑzŸÑzŸÑBf˜Bf˜Bf˜$I{$I{$I{$I{$I{$I{$I{$I{$I{$I{$I{$H{$H{$H{$H{?c•?c•?c•?c•$H{$H{$H{SB;R<2zbVUGJXIK[JK[JKuWN€\OŠaP’fP™iQŸlR¡mR£nS£nS¥pTà€9Þ9Õw2Öw0Öv/Öv.Ùx/Üz0Þz0á|1ã~2æ€3è5éƒ6ë…8ë…8ºm4¼o7¾q8Äu;Ãs9Ãs8ºj0‚]O„^O†_Oˆ`OŠaPŒbPcPdP‘eP’fQ”fQ•gQ—hR™iRšjSœkSlTŸnU¡oV¢pV¤qW¦rX§sY¨tY©uYªuZ«uZ«vZ«vY«uY«uX«uX«tW«tV«sVªsUªsUªrTªrTªrTªrSªqSªqSªqSªqSªqS©qS©qS©qS©qS©qS©qS©qS©qS¨qS¨pS¨pS§pS§pR§pR¦oR¦oR¥oR¥oR¤nR£nR£nR¢mR¡mR mR lRŸlRžkRkRœjQ›jQšiQ™iQ—hQ–gQ•gQ”fQ’eP‘ePdPcPŒbPŠaPˆ`O†_O„^O‚]O\O}[NzYNwXNtVMqUMnSMiQLeOL`LK]KKmP?kN?|aSZA5P<4-R„-R„-R„-R„-R„-R„Qv¨Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×Ei›Ei›Ei›Ei›Ei›Ei›Ei›\À\À\À\À\À\À\À\À\À\À\À\ÀBf˜zžÐzžÐzžÐzžÐzžÐzžÐzžÑzžÑzžÑzŸÑzŸÑzŸÑzŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑBf™Bf™Bf™%I{$I{$I{$I{$I{$I{$I{$I{$I{$I{$I{?c–?c–?c–?c–?c–?c•?c•?c•?c•$H{$H{$H{jXP^H=}dXUGJXHKZIKkRLwXN‚]O‹bP”fQšiQžkR mR£nS¥pT¨qU¨rUç…;ç†>ì‰?è†<å‚9ê†;î‰=ðŠ=ðŠ>ôŽAø‘Dü•Hÿ˜Kù’E¿r:Àt;Àt;Át<Ãt:½n4´f,]Oƒ^O…_O‡`O‰aO‹bPŒcPŽcPdP‘eP“fQ”gQ–hQ˜iR™jR›kSœlSžmTŸnU¡oV¢pV¤qW¥rW¦rX§sX¨tX©tX©tX©tX©tXªtWªsW©sV©sV©rU©rU©rT©qT©qT©qS©qS©qS©qS©qS©qS©qS©qS©qS¨qS¨qS¨pS¨pS¨pS¨pS§pS§pS§pR¦pR¦oR¦oR¥oR¥oR¤nR¤nR£nR¢nR¢mR¡mR mR lRŸlRžkRkRœjQ›jQšiQ™iQ˜hQ–hQ•gQ”fQ’fP‘ePdPŽcPŒcP‹bP‰aO‡`O…_Oƒ^O]O~[N{ZNyYNvWNsVMpTMlRMgPLcNL†gUƒeUlO?~bT{`SW@5-R„-R„-R„-R„-R„-R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R….R…Ei›Ei›Ei›€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›\À\À\À\À\À\À\À\À\À\ÀzžÑzžÑzžÑzžÑzŸÑzŸÑzŸÑzŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÒBg™Bg™Bg™%I{%I{%I{%I{%I{%I{%I{@d–?d–?d–?d–?d–?d–?d–?d–?d–?c–?c–?c–?c–$I{$I{L=:WD`KA-R„-R„-R„.R„.R„.R„.R„Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R….R….R….R…EiœEiœEiœEiœEiœEiœ¥×¥×¥×¥×¥×¥×¥×EiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœ\À\À\À\À\À\À\À\ÀzŸÑzŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÒ{ŸÒ{ŸÒ{ŸÒ{ Ò{ Ò{ Ò{ Ò| ÒCg™Cg™%I{%I{%I{@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–?d–?d–?d–?d–?d–?d–$I{$I{dUPYEXG@-R„.R„.R„.R„Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©.R„.R„.R„.R„.R„.R„.R„.R„.R….R….R….R….R….R….S…EiœEiœEiœEjœEjœEjœEjœEjœ¥×¥×¥×EjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEiœEiœEiœ\À\À\À\À\À\À{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÒ{ŸÒ{ŸÒ{ Ò{ Ò{ Ò{ Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| ÒCg™@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–?d–$I{$I{RA;P<3zcXnVIuh™~pdNLpUMÁ”w¬zZ«vS‘eP–gQœjQžlR¡mR¤oS§pT­uV¯vW±xY¶|\¼€_ÆdƉgÈŠhÊŒiÌŽkÎlÿRñF¶k4²g1¯d-­b+ª_(¢Z'}[N€\O‚]O„^O†_Oˆ`O‰aP‹bPcPŽcPdP‘eQ’fQ”gQ•gQ—hR˜iR™jR›kSœkSlTžmT nT¡nU¡oU¢oU£pU¤pU¤pU¤pU¥pU¥pT¥pT¥pT¥pT¥pS¥pS¥oS¦oS¦oS¦oS¦oS¦oS¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¥oR¥oR¥oR¥oR¤oR¤nR¤nR£nR£nR¢nR¢mR¡mR¡mR lRŸlRŸlRžkRkRœkQœjQ›jQšiQ™iQ˜hQ—hQ•gQ”gQ“fP’ePePdPcPŒbPŠbP‰aO‡`O…_Oƒ^O]O~\N|[NzYNwXNtVMpUM—pY”oXzWBuUB…gVlP@jO@|bUx`TcMB3!.R„Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©Rv©Rw©Rw©Rw©.R„.R„.R„.R„.R….R….R….R….R….S….S….S…EjœEjœEjœEjœEjœEjœEjœEjœEjœ¦Ø¦ØEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœ\À\À\À\ÀBg™{ŸÒ{ŸÒ{ŸÒ{ Ò{ Ò{ Ò{ Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| ÒCg™Cg™Cg™Cg™|¡Ó@d—@d—@d—@d—@d—@d—@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–%I{;0/SB;R=4fODpXL‘xkš€r˜vbº“zÀ”x«{[ÃldP•gQ™iQ›jQŸlR£nR¦pS¨qTªrT¬tU°wWµ{Z¸}\¸|\¸}\¹~]»]å}+Ý~6­d.ªa+¨_)§^(¤\'zYN|ZN~\N€]Oƒ^O„_O†_Oˆ`OŠaP‹bPcPŽdPdP‘eQ“fQ”gQ•gQ—hR˜iR™jRšjSœkSlSžlTŸmT mT nT¡nT¢nT¢oT£oT£oT£oT£oT¤oS¤oS¤oS¤oS¤oS¤oS¤oS¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¤oR¤oR¤nR¤nR¤nR£nR£nR£nR¢mR¢mR¡mR¡mR lR lRŸlRžlRžkRkQœjQ›jQšjQ™iQ™iQ˜hQ—hQ•gQ”gQ“fQ’ePePdPŽcPŒbPŠbP‰aO‡`O…_Oƒ^O]O\N}[NzZNxXNuWMrUM™rZ–pY|XCxVCsTBmQAkOA~cVzaU`I>\IARv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©Rv©Rw©Rw©Rw©Sw©Sw©Sw©Sw©.R….R….R….R….R….S….S….S….S…FjœFjœFjœFjœFjœFjœFjœFjœ‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦ØFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœ\À\ÀBg™{ Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ó| ÓCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™}¡Ó@e—@e—@e—@e—@e—@e—@d—@d—@d—@d—@d—@d—@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–%I{<1/J82^I@gQFqYN‘xl™€s—vc¢{d¿”yª{\«wUÄi‘eP•gQ˜hQkQ mR¢mR¤nR¥oS§pSªrT¬tU¬tU¬tU¬tU­tU®tUÒt.ƒL&¤](¢['¡Z'žY&xYN{ZN}[N\N]Oƒ^O…_O‡`OˆaOŠaPŒbPcPdPeP‘eQ“fQ”gQ•gQ—hR˜iR™iRšjR›kSœkSlSžlSŸmSŸmS mS nS¡nS¡nS¢nS¢nS¢nS¢nS£nS£nS£nR£nR£nR£nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR£nR£nR£nR£nR£nR¢nR¢mR¢mR¡mR¡mR¡mR lR lRŸlRžlRžkRkRœkQœjQ›jQšiQ™iQ˜iQ—hQ–hQ•gQ”fQ“fP’ePePdPŽcPŒbP‹bP‰aO‡`O†_O„^O‚]O\O}[N{ZNxYNvWNsVM›s[˜rZ~ZDnYŒkYqSBkPAiOA|cVbK?\G>NB?Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©Rv©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©.S….S….S….S….S….S…FjœFjœFjœFjœFjœFjœ‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦ØFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœCg™Cg™| Ò| Ò| Ò| Ò| Ò| Ó| Ó| Ó| Ó|¡Ó|¡ÓCg™Cg™Cg™Cg™Cg™Cg™Cg™CgšCgšCgšCgšCgš}¡ÓAe—Ae—Ae—@e—@e—@e—@e—@e—@e—@e—@e—@d—@d—@d—@d—@d—@d—@d–@d–@d–@d–%I{@d–@d–<1/H72\I@ePGpYNxm˜€t–vc¡{e¾”zÁ“u‘p«wU¬uQ‘eP•gQ™iQšjQœjQžlR¡mR£nR¤nR¤oR¤oR¤oR¤oR¤oRÇgb;  Z'žY&›W&“S%vXNyYN{ZN~[N€\O‚]Oƒ^O…_O‡`O‰aOŠaPŒbPcPdPdP‘eQ“fQ”gQ•gQ–hQ˜iR™iRšjR›jR›kSœkSlSžlSžlSŸlSŸmS mS mS¡mS¡mS¡mR¡mR¢mR¢mR¢mR¢mR¢nR¢nR¢nR£nR£nR£nR£nR£nR¢nR¢nR¢mR¢mR¢mR¢mR¡mR¡mR¡mR mR lRŸlRŸlRžlRžkRkRkQœjQ›jQ›jQšiQ™iQ˜hQ—hQ–gQ•gQ”fQ“fP‘ePdPdPcPŒbP‹bP‰aO‡`O†_O„^O‚]O€\O}[N{ZNyYNvXNtVMu\„]E€[E’oZŽmZŠkYnRBjOB}cVdL@`I?XGARv¨Rv¨Rv¨Rv¨Rv©Rv©Rw©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwª.S….S….S….S…/S…FjœFjœFjœFjœ‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦ÙFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœ‚¦Ù‚¦ÙCg™Cg™| Ó| Ó|¡Ó|¡Ó|¡Ó|¡Ó|¡ÓCg™Cg™Cg™Cg™CgšCgšCgšCgšCgšCgšCgšCgšChšChšChšChšChš}¢ÔAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—@e—@e—@e—@e—@e—@e—@e—@d—%I{%I{%I{%I{%I{@d–@d–<10F61o]Vye]„oeŽxmœ‚u”udŸ{e¥}d¨|aÀ’tÁpÃl¬uQdP’eP”fQ–gQ˜iQ›jQœjQœjQœjQœjQœkQœkQkQ_9 œX&™V&•T%rUMuWMwXNzYN|ZN~[N€\O‚]O„^O…_O‡`O‰aOŠbPŒbPcPŽdPdP‘eQ’fQ”fQ•gQ–hQ—hR˜iR™iRšjR›jRœkRœkRkRlRžlRžlRŸlRŸlRŸlR lR mR mR mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR mR lR lRŸlRŸlRŸlRžkRžkRkRkQœjQ›jQ›jQšiQ™iQ˜iQ—hQ–hQ•gQ”gQ“fQ’fP‘ePdPdPcPŒbPŠbP‰aO‡`O†_O„^O‚]O€\O~[N{ZNyYNwXNtVMrUM†^F‚]F”q\o[ŒlZqTD€fX}dWeMAbK@O=6NB@Rv¨Rv©Rv©Rv©Rw©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwªSwªSxªSxªSxª/S…/S…FjœFjœFjœƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§ÙFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœƒ§Ùƒ§Ùƒ§Ùƒ§ÙCg™Cg™Cg™}¡Ó}¡Ó}¡ÓCg™CgšCgšCgšCgšCgšCgšCgšChšChšChšChšChšChšChšChšChšChšDhšDhšDhš~¢ÔAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—%I{%I{%I{%I{%I{%I{%I{%I{%I{@d—@d—E:9D61m\Vwe]lXOuaX„k_¨‹z±|¡|e¥|c§|`©z]ªyXÂnÃlÄŽkÄŽidP’eP“fP“fP“fP’fP“fP“fP“fP[7 —U&”T%P%pTMsVMuWMxXNzYN|ZN~[N€\O‚]O„^O†_O‡`O‰aOŠbPŒbPcPŽdPdP‘eP’eQ“fQ”gQ•gQ–hQ—hQ˜iR™iRšjR›jR›jRœkRœkRkRkRžkRžlRžlRŸlRŸlRŸlRŸlR lR lR lR lR lR lR lR lR lR lR lR lR lRŸlRŸlRŸlRŸlRžkRžkRkRkQœkQœjQ›jQ›jQšiQ™iQ˜iQ˜hQ—hQ–gQ•gQ”fQ“fP’eP‘ePdPŽdPcPŒbPŠbP‰aO‡`O…_O„^O‚]O€\O~[N|ZNyYNwXNuWMrUM‡`G„^G–r]|ZFxXFtVEgY~eY{cXbLA[H?REA.R„.R„Rv©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwªSxªSxªSxªSxªTxªTxªTxªƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§ÙFjFjFjFjFjFjFjFjFjFjFjƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§ÙCg™Cgš}¡Ó}¡ÓCgšCgšCgšCgšChšChšChšChšChšChšChšChšChšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš~¢ÔAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—%I|%I|%I|%I{%I{%I{%I{%I{%I{%I{%I{%I{%I{%I{@e—@e—B99B51k[Vud]iWPr_Wye] †yªŒ|²}¡|e¤|c¾’w¨{^¨z\©yZÁp«xW«wU«wU«wU«wUÃŽlÃŽlÂŽlÂŽlkD(’S%ŒP%nSMoTMqUMsVMvWNxXNzYN|ZN~[N€\O‚]O„^O†_O‡`O‰aOŠaP‹bPcPŽcPdPeP’eQ“fQ”fQ•gQ–gQ–hQ—hQ˜iQ™iR™iRšjR›jR›jRœjRœkRœkRkRkRkRžkRžkRžlRžlRŸlRŸlRŸlRŸlRŸlRŸlRŸlRŸlRŸlRžlRžkRžkRžkRkRkQkQœkQœjQ›jQ›jQšjQšiQ™iQ˜iQ˜hQ—hQ–gQ•gQ”gQ“fQ’fP‘ePePdPŽcPcP‹bPŠaPˆaO‡`O…_Oƒ^O‚]O€\O~[N|ZNyYNwXNuWMrUMŸw_œv_˜t^~\GzYGvWF†j[fZ|dYybX\I@VGB5/2.R„.R„.R„.R„Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwªSwªSxªSxªSxªSxªTxªTxªTxªTxªFkFkFkFkƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§ÚFkFkFkFkFkFkFkFkƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Ú}¡Ó}¡Ó}¡Ô}¡ÔChšChšChšChšChšChšChšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš~£ÕAe˜Ae˜Ae˜Ae˜Ae˜%J|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I{%I{%I{%I{%I{%I{@e—@e—<68?31gYVpa\bRMjYTq`Z€j`¡‡z«}²‘}¶’|¸’{º’z»’x¼’w§z^¿‘t¿‘s¿‘s¿s¿r¿r¾r¾r°h2‹O$„L$mSMnSMnTMoTMtVMvWNxXNzYN|ZN~[N€\O‚]O„^O…_O‡`OˆaOŠaP‹bPŒcPŽcPdPdP‘eP’eQ“fQ”fQ•gQ–gQ–hQ—hQ˜hQ˜iQ™iQšiQšiQšjQ›jQ›jQœjQœjQœkQœkQkQkRkRkRkRkRkRkRkRkRkQkQkQœkQœjQœjQœjQ›jQ›jQšjQšiQ™iQ™iQ˜hQ—hQ—hQ–gQ•gQ•gQ”fQ“fP’eP‘ePdPdPcPŒbP‹bP‰aPˆ`O†`O…_Oƒ^O]O€\O~[N|ZNyYNwXNtWM£z` y`w`šu_€]I|[HwXGˆl\ƒi[}eZycYr_WjZU;23.R„.R„.R„.R„.R….R….R…Sw©Sw©Sw©Sw©Sw©SwªSwªSwªSxªSxªSxªTxªTxªTxªTxª/S…/S…GkGkGkGkGkGkGkƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨ÚGkGkGkƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Ú}¢Ô}¢Ô}¢Ô}¢Ô~¢ÔDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš£ÕAf˜%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I{%I{Ae—Ae—Ae—?89H=:?YUY`QGfVLudXjeitlm{po|qp}rp~rpsqsq€tqŒr_=1+xJ)’o[~[F€\G‚^H„_I…`IkRLlRMnSMpTMrVMuWMwXNyYN{ZN}[N~\N€\O‚]Oƒ^O„_O†_O‡`Oˆ`O‰aPŠbP‹bPŒcPcPŽcPdPdPeP‘eP’eP’fP“fQ“fQ”fQ”gQ•gQ•gQ•gQ–gQ–gQ–gQ–hQ–hQ—hQ—hQ—hQ—hQ—hQ–hQ–hQ–gQ–gQ–gQ•gQ•gQ•gQ”fQ”fQ“fQ“fP’eP‘eP‘ePdPdPŽdPŽcPcPŒbP‹bPŠaP‰aO‡`O†_O…_Oƒ^O‚]O€\O~\N}[N{ZNyYNwXNuWM“iOhOŽgO‹eOžze›yd—wd”tcrbtYKjTIaOG[KFj]Y^UU?;@.R….R….S….S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…GkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkž…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©ÛGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlž…©Û…©Û…©Û…©Û…©Û…©Û£Õ£Õ£Õ£Õ£Õ£Õ£Õ£ÕDh›Dh›Dh›Dh›Di›Di›Di›Di›Di›¤Ö¤Ö¤Ö¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|Af˜Ae˜Ae˜%J|%J|%J|%I|%I|%I|%I|#-#%.()1MEAQIEUMI]SL]TM=4.1+(=.#6,&5( 1%"ŒlYn[“p\•r]]Hƒ_I…`JœwažybkRLmSMpTMrUMtVMvWNxXNzYN|ZN}[N\N€]O‚]Oƒ^O…_O†_O‡`OˆaO‰aPŠaP‹bPŒbPcPŽcPŽdPdPdPeP‘eP‘eP’eP’fP“fP“fQ“fQ”fQ”fQ”fQ”gQ”gQ•gQ•gQ•gQ•gQ•gQ”gQ”fQ”fQ”fQ”fQ“fQ“fP“fP’eP’eP‘eP‘ePdPdPdPŽcPcPŒcPŒbP‹bPŠaP‰aO‡`O†_O…_Oƒ^O‚]O]O\O}[N|ZNzYNxXNvWN¬‚gªg¨€ghPŒfPŸ|fœzf˜xe”vdscsYLiTK_NHYKFh\Z]UV=;@.R….S….S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxª/S…/S…/S…/S…GlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlž…©Û…©Û…©Û…©Û…©Û…©Û…©ÛGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlž…©Û…©Û…©Û…©Û£Õ£Õ£Õ£Õ£Õ£Õ£Ö£ÖDi›Di›Di›Di›Di›Di›¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×Ei›&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Af˜Af˜Af˜Af˜Af˜%J|%J|%J|%J|%J|%J|%I|%I|%I|, +,!.! "`E6†iYŒlZo\“q]•s^^J™va›wbycŸzd {e¤}foTMqUMsVMuWNwXNyYN{ZN|ZN~[N\O]O‚]Oƒ^O…_O†_O‡`Oˆ`O‰aOŠaP‹bPŒbPŒcPcPŽcPŽdPdPdPdPeP‘eP‘eP‘eP’eP’eP’eP’eP’fP’fP’fP“fP’fP’fP’fP’eP’eP’eP‘eP‘eP‘ePePdPdPdPŽdPŽcPcPŒcPŒbP‹bPŠaP‰aOˆ`O‡`O†_O…_Oƒ^O‚]O]O\O~[N|[N{ZNyYNwXN®ƒi¬ƒiª‚i¨i¦€hŒhR‰fQ†dQ‚bP•wfx]Oˆpdkbtd_m`]OEDG?A;:@.S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTx«Tx«Tx«Ty«/S†GlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž…ªÜ…ªÜ…ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž…ªÜ…ªÜ£Ö£Ö£Ö£Ö¤Ö¤Ö¤Ö¤Ö¤ÖEi›€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×€¥×€¥×€¥×Bg™Bg™Bg™Bg™Bg™&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Af˜Af˜%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|%I| +,YA5jPBpSD‹l[o]’q^–t`‚_Kšwbœycžze {f¡}g¤h¨i”lSrVMtWMvWNxXNyYN{ZN|[N~[N\O]O‚]Oƒ^O„_O…_O†`O‡`Oˆ`O‰aPŠaP‹bP‹bPŒbPcPcPŽcPŽcPdPdPdPdPdPdPdPdPePePePePePdPdPdPdPdPdPdPŽcPŽcPcPcPŒbP‹bP‹bPŠaP‰aOˆ`O‡`O†`O…_O„^Oƒ^O‚]O€]O\O~[N|[N{ZNyYNxXN°…j®„j¬„jªƒj¨‚j¦€jŒhSŠgS†eRƒcR|`QŒsf…oe}jcrd`k_]LCDC=@,,3(4F(4F.S….S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTxªTx«Tx«Tx«Ty«Ty«Ty«…ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžChšChš¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›Ei›€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|#5H71O;3V?4iOBoSDsVFo]{[I^Kƒ`L…bN‡dOŸ{f }g¢~h¥€j’kT•mU˜oVšqWrWwXNxXNzYN{ZN}[N~[N\O€]O‚]Oƒ^O„^O…_O…_O†`O‡`Oˆ`O‰aO‰aPŠaP‹bP‹bPŒbPŒbPŒcPcPcPcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPcPcPcPŒcPŒbP‹bP‹bP‹bPŠaP‰aP‰aOˆ`O‡`O†_O…_O„_O„^Oƒ^O]O€\O\N~[N|ZN{ZNyYN›oTšoT™oT—nT¬„lªƒl¨‚ljUŒiTŠhT†fT€cSvi‰rgnfyidqdah^^HBD?<@)+3OZkMYk(5F(5F(5F/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTxªTx«Tx«Ty«Ty«Ty«Ty«Uy«†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžDhšDhšDhšChš&K}&K}&K}&K}&K}&K}ChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|&J|&J|&J|&J|&J|Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|A99N?;L:2T>4gNBlRD‡k\‹n^z[J~^LaN…cO‡dP‰fQŠgRŒhTjU’lV•nW˜pXšrXsY¶‹q¸qºŽr¼r½r¿s©z[©z[ªz[«{[¬{[¬{ZÅ“rÅ’qÅ’qÅ’pÅ’pÅ‘o­yV­xV¬xU¬wT¬wTŠaPŠbP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bPŠaPŠaPŠaP‰aP‰aOˆaOˆ`O‡`O‡`O†_O…_O„^Oƒ^O‚^O‚]O]O€\O~\N}[N|ZNzYNpTœpU›pUšpU˜oV—oV•nV“mV‘lVkVŒjVˆhVƒfU~cUuj†qh~mfugdkaad\^E@D98?$(2minffm^blV^lMYk(5F(5F/S…TxªTxªTxªTxªTxªTxªTxªTx«Tx«Ty«Ty«Ty«Uy«Uy«†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}ChšChšChšChšChšChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|%J|Ae˜Ae˜;GY<68I=:I82Q=4XA6~fZ„j\‰m^p`|]L€`NƒcP†eQˆgS¡j£€l¦‚m©„n•oX˜qYšrZt[¶Œr¸sºs¼t½t¾‘t¨z]©{]ª{]«{\«{\¬{\¬{[Ä“sÄ“rÄ’rÄ’qÄ’pÄ‘p¬yWÄoÃnÃmÃlÂŽlÂŽkÁkˆaOˆaOˆaOˆaOˆaOˆaOˆaOˆ`Oˆ`O‡`O‡`O‡`O†`O†_O…_O…_O„_O„^Oƒ^O‚]O]O€]O\O~\N}[N|ZN¶‰l¶‰lµˆmœqV›qVšqV™pW˜pW–oW¬…nª…n§„n¤‚nŸ€n›~n€eW‘xlŠtk‚piykfodcf_`JDG@>C*,5$1MYktr~tstmolinadmX_lNZkMZkTxªTxªTxªTxªTx«Tx«Tx«Ty«Ty«Ty«Uy«Uy«Uy«†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«ÝHlŸHlŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸ†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšChšChšChšChšChšChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™&J}&J}&J}Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Af˜Af˜Af˜Af˜;GY;GY;GY1'!D:9N?;N;3]I?zdY€h[†l^‹oasc“ue€bQ„dR‡fT l¢m¦ƒn©…o«‡p®ˆq±Šr³‹sžv] w]¹u»u¼‘u¾‘u¿’v¨{^©{^ª|^«|]«|]«{\¬{\¬{[¬{[¬zZ«zZ«yY«yX«xXÂoÂnÂnÁŽmÁŽm¨uT¨uS§tS§tS§tR¦sR¦sQ…_O…_O…_O„^O„^Oƒ^Oƒ^O‚^O‚]O]O€]O¢rS¡rS¡rS¸‰k·‰l·‰l¶‰m¶‰mµ‰m´‰n³‰n›qWšqX™qX®‡o­‡o«†p¨…p¤ƒp pœp—}o{cXv`Vp]U}nishfhaba\_DAF::B$)4MYkMYkMYkŒtctq\QPPIKFDI;>H/8GMZkTxªTx«Tx«Tx«Ty«Ty«Ty«Uy«Uy«Uy«†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸHmŸHmŸImŸImŸImŸImŸImŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšDhšDhšDhšChšChšChšChšChšChšChšChšCgšCgš&K}&K}&K}&K}&J}&J}Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜;HY;HY;GY;GY;GY;GY;,#I=:H82YF?^JA|e[‚j]ˆn`Œqcte”wg—yiš|k~l €n£‚o¤ƒp¦…q­‰s°Šs›u]žv^Ÿw^¡x_£y_¤z_¥z_¦{_¿“w¿“wÀ“vÁ“vÁ“v“u“u“tª{\ª{\ªz[ªzZªyZªyY©xXÁpÀo¨wW¨vV§vV§uU¦uU¦uT¥tT½Œl¼‹k¼‹k¼‹k»‹k»‹kºŠk¢sT¢rT¢rT¡rT¡rT¡rU rU rV·Šn¶ŠnµŠnµŠo´Šo³‰o²‰p±‰p™qY®ˆq¬‡qª†r§…r¤„r ‚rœ€q€gZ{dYvaXp^WiYU`TRVNOb]aEBH<+[NL^SQWNNKFJ?AI2:HTx«Ty«Ty«Ty«Uy«Uy«Uy«Uy«Uy«‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝImŸImŸImŸImŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«ÞImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšChš&K}&K}&K}&K}&K}&K}&K}&K}&K}&K}CgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜;HY;HY;HY;HY;HY;HY;GY3("D::B41RB=YG@wcZ}g\ƒk_‡nbŒrdug}aRdT„gV‡iX‰kY¢ƒq¤„r¥…s§†t‘p^’q^Ÿw` x`¢y`£z`¤za¥{a½“x¾“x¿“w¿“wÀ“wÀ“vÀ“vÀ“vÀ“uÀ’uÀ’tÀ‘sÀ‘sÀ‘r¿r¿q¿q¾p¾Žp¾Žo½Žo¥vW¼n¼Œn»Œn»Œn»ŒnºŒnº‹m¢tV¡sV¡sV¡sV sV sWŸsWŸsXžsXµŠpµŠp´ŠpœsY›sYšrZ˜r[–r\”q\‘p]¦†t£„tŸƒsœs€h\{e[vbYo^XhZV`USXPQNJMECJRS[47A+((MYkMYkMYkMZk(5F(5F(5FOHJT=+YML_SRZQQMGJABI2:H/T†Uy«Uy«Uy«Uy«Uy«Uy«‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸˆ¬Þˆ¬Þ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}&K}&K}&K}&K}CgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™&J|&J|Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜;HY;HY;HY;HY;HY;HY>DM>DM;HY89<:+#9&B52I94ZHAxd[}g^k`†nc‹rey_R}bTeVƒgX…iYˆk[Šl\Œn]o^¥‡v§ˆvšvaœwažxa yb¢zb¤{b¤{a¼“x½“x¦|a§|a§|`§{`§{_§{_§{^§z^¾‘u¾‘t¾‘t¾s½s½r½r¥wZ¤wZ¤vY¤vY£vY£uX¢uX¢uX¢uX¹Œp¸Œp¸Œp·Œp·‹p¶‹p¶‹pµ‹qµ‹qtZ›t[šs\™s\˜s]–r]”r^’q^p^o^Šn^‡l^ƒj^h]{f\ub[n^YgZW_UTWPQOKOEEKST]JNY>=?JJIMYkMYk(5F(5F(5F(5F(5F)5G)5GK=4S<*XMLbWVYPPLGJ@AI/T†/T†Uy«Uy«Uy«‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞImŸImŸImŸIm ˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞIm Im Im Im Im Im Im Im ˆ¬Þˆ¬Þˆ¬Þˆ¬Þ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}Dh›Dh›Dh›Dh›DhšDhšDhšDhš'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}ChšChšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|&J|&J|&J|&J|Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜;HY;HY;HY;HY;HY;HYCIR>DMCIR;HYCIR.$0"8&?*G/V=+w[F{g^€kanXMs\Px_S{bU~dWfYƒhZ†j\ˆl]Šm^¢…v§ˆwªŠx­Œy¯y±Žz´zµz·‘z¹’z£{b£{b¤{b¥{b¥{a¥{a¥{`¥{`¥z_¥z_¥z^¼‘u¥y]¤y]¤x]¤x\£w\£w[¢w[¢v[¢v[¡v[¡v[¸r·r¶r¶ŒsµŒs´Œs´Œs²Œt±‹u°‹u˜t^–s_•s_“r_’r`q`p`¡…wž„v›‚v—€u“~twd]sb[l^ZeYW]TUUORLJOYYaRU^JOZ>>@!$)RXaMYk39B-3<-3<(5F)5G)5G)5G)5G)5GFDJK9*^K=YONg\\TLMIFJ:>I0T†0T†ImŸˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞIm Im In In In In In In ˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßIn In In In In ˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ß'K~'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}Di›Di›Dh›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}ChšChšChšChšChšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™&J}&J}&J}&J}&J|&J|&J|&J|&J|Bg™Bg™Bg™Bg™Bg™Bf™Bf™EM>EMCIR;HY;HYCIRCIR)6&8&@*H0I1!\B0}_JhTKjM8q[Pt]Sw`U{cW~eYg[ƒi\…k^‡m_Ÿ…v¢†w¥ˆx¨Šyª‹z­z¯Ž{±{²{³{´{žzdŸzd zc zc¡zc¸‘y¸‘y¸‘y¸‘x¸x¸x·w·w·w·wŸw_Ÿw_žw_µŽv´Žv³v²v²w±w°Œw¯Œw®Œw­‹w«‹xªŠx¨‰x¦‰x¥ˆx£‡x¡†xž…x›ƒw—v’~vŽ|t‰ys„vrh\YcXX[TUSNRIHOUXaNS^JFE>>A')+"%(4:C(5F(5F3:B3:B-3<-3<)5G)5G)5G)5G)5G)5GE:4O:*TKLbXWcZZPIKDCJIm Im Im Im ˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ßˆ¬ßˆ¬ßˆ¬ßIn In In In In In Jn Jn Jn Jn Jn ˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ß‰­ß‰­ß‰­ß‰­ß‰­ßJn ‰­ß‰­ß‰­ß‰­ßˆ­ßˆ­ßˆ­ßˆ­ß'K~'K~'K~'K~'K~'K~'K~'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšChšChšChšChšChšChšCgšCgšCgšCgš&K}&K}&J}&J}&J}&J}&J}&J}&J}&J}&J|&J|&J|Cg™Cg™Cg™Bg™Bg™Bg™EMCIRCIRCIR888DGNCJRCIRBBB(0 8&<)G0M5"X@0z^K†bFŠkUlXPp[Rs^TvaVzcX}fZg\i]™u›‚v„wŸ†x¢‡y¥‰z§Šz©‹{ªŒ{•ve–ve—we˜we°|°|±{²{²{²{²{²{±z±z±Žz±Žz±Žz°Žy™vb˜vb—vb–ub•ub•uc”tc“tc’sbscrcqc¢‡y †y…y›„x˜‚x•w’w|uˆytƒvs~sqyooslmVQTOLR[\dQU`KHHAAD:<@68; &Z`i-4<%');AJ4:C4:C4:C-4<)5G)5G)5G)5G)6G)6G@84H8-N?5YPQmccoghd`dIn In In In In In ˆ¬ßˆ¬ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßJn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ßJn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~Ei›Ei›Ei›Ei›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšChšChšChš&K}&K}&K}&K}&K}&K}&K}&K}&J}&J}&J}&J}&J}&J}&J}&J}&J}Cg™Cg™Cg™Cg™B9;>68;Z`iZ`iMZk)5G4:C-4<4:C4:C-4<;BJ)5G)6G)6G)6G)6G)6GC6-L;.leg„{{ypqhbeVYcJn Jn Jn Jn Jn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ßJn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­àJn¡Jn¡Jn¡Jn¡Jn¡Jn¡Jn¡‰­à‰­à‰­à‰­à‰­à'L~'L~'L~'L~'L~'L~'K~'K~'K~Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›'K~'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhš'K}'K}'K}'K}&K}&K}&K}&K}&K}&K}&K}&K}&K}&K}&K}&J}&J}&J}&J}&J}&J}Cg™Cg™Cg™<535=AG=?D?AD==1(B3)B2&F4'E4)gTGlXJs^OzcTzaPqfethgvjhbVTcWUdXVeYWfZXg[Yh\Zi]Zi][j^\€us€ususts~tt~tt}tt|st{stut~tt|sszrsyqrwpquoqsmpqloXTXTQWPOULLSSJEA<:=99757335./2113)+.'),)+.8:="(3@QJMPV\eT[cNZlNZlZ`iZ`iZ`iZ`iSYbY`h4;C.4=)6GCPaCPaCPaCPaCPaEQbZOGa_emhkŠƒ„nfgeaeJn¡Jn¡Jn¡Jn¡Jn¡Jn¡Š®àŠ®àŠ®àŠ®àŠ®àJo¡Jo¡Jo¡Jo¡Jo¡Jo¡Jo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Š®àŠ®áŠ®áŠ®áŠ®áŠ®áŠ®áŠ®áKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡ƒ§Úƒ§Úƒ§Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨ÚEjœEiœEiœEiœEiœ'L~'L~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K}'K}'K}'K}'K}'K}'K}Di›Di›Di›Di›Dh›Dh›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}&K}&K}&K}&K}&K}$.>=I[=I[2)>0&A2'C3(I8-^OFbRHfUJjXMq^RwcVzfYfRDfQCdN@zdTqijrjksklrklrklrklqjmpjmpjmojmojmnimmimkhliflscYm`Xg\VbYT^VRE>;A<:>98:77645:873220/0,-/)+.*,/#%( &15;5BSKKKJMP]dlU[dNZlNZlZ`iTZcZaiZaiZ`iZ`iSZbŽ”LS[V]eDPbDPbDPbDPbDPbDPbWMF^^diei®”†…rkeaeJo¡Jo¡Jo¡Jo¡Š®àŠ®àŠ®àŠ®àŠ®àŠ®àŠ®àŠ®àŠ®àKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Š¯áŠ¯áŠ¯áŠ¯áKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡ƒ¨Úƒ¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Û„¨ÛGk'L~'L~'L~'L~'L~'L~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~Ei›Ei›Ei›Ei›Ei›Di›Di›Di›Di›Di›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}&K}%/> ,>=I[=I[ ,> ,>#)2(.7#)2(.7#)2#)2#)2#)2(.7(.7(.767@D>A214$+3#%("$'###""""""&&&888888cB*}\I@!%+%!5*$:/(;0)<1*>3+@4+>1(bUKN@6OA6L=3QB8M?4_RKaTLbUMcVNcVNcVObVOaVOaUO`UO_UO^UO^TO\SOYRNWPNUOMWPKYSOWRN;63953:76755333,/2'),%(+"%(!' "&,KXi04:JMP]_b^emU[dNZlNZlT[cU[dU[dU[d[aj•ž•ž•žˆŽ—–¥W]fDPbDPbDPbDPbDPbDPb‘nSž…w—|m¨‚ƒqjKo¡Ko¡Ko¡Š®àŠ®àŠ®àŠ®áŠ®áŠ®áŠ®áŠ®áŠ®áŠ¯áŠ¯áŠ¯áKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Û„¨Û„¨Û„¨Û„¨Û„©Û„©Û„©Û„©ÛGkGkGkGkGkGk'L~'L~'L~'L~'K~'K~'K~Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Di›Di›'K}'K}'K}'K}HlžHlžHlžHlžHlžHlžHlžHlž'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}*2? ->=I[=I[ ,> ,> ,>#)2#)2#)2(.7(.7#)2#)2(.7(.7(.7(.7/28:79G@A<89',4#%(#%(######""""""8888888887'vS:‹jW;) + &3#.$-% .% .& /&!,#,#@70A71XNHXNHWNHWNHZRLYQLYQLXQLWQLWPLUOLSNLQMKOLJMJJ0//.-.,,-&(+"(!' 15;6CT37=MMMKMP^ad_enY`hNZlNZlU\dV\eŠ‘™Š™Š™–Ÿ–Ÿ–ž•ž“œ—¦Œ’›ƒ¡DQbDQbDQbDQbDQbMUc¤ƒ‘ylŸ‡|€oiKo¡Š¯áŠ¯áŠ¯áŠ¯áŠ¯áŠ¯áŠ¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯áKo¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢‹¯â‹¯â‹¯â‹¯âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Û„¨Û„¨Û„¨Û„©Û„©Û„©Û„©Û„©Û„©Û…©Û…©Û…©Û…©Û…©Û…©ÛGkžGkžGkžGkžGkžGkžGkžGkžGkž…©Û…©Ü…©Ü…©Ü…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž'K}'K}'K}'K}'K}'K}'K}'K}'K}HO\=J[=J[=J[ -> ,> ,>(.7#)2#)2(.7(.7(.7#)2(.7(.7(/7(/7)/8/28114H7,99@.05&,5$&)$$$######"""(((8888888888888884"nO9„gXˆjZE/ (-" + %' %$#" ! !$ 48>7CU:GX JJJLLLKMPagp_enNZlLPV˜Ÿ§Œ’›Œ’›Œ’›‹’š‹‘šŠ‘™‘— –Ÿ–Ÿ–Ÿ“œ“œ—¦„¢„¢DQbDQbDQbDQbNVc…uo‡rjѼ³º«§‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯áKp¢Kp¢Kp¢Kp¢Kp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢‹°â‹°â‹°â‹°âŒ°âŒ°âŒ°âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢„¨Û„¨Û„¨Û„©Û„©Û„©Û„©Û„©Û„©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©ÛGkžGkžGkžGlžGlžGlž…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž'K}'K}'K}'K}DhšDhšDhšIP\=J[=J[=J[=J[ -> ->(.7#)2#)2(.7(.7(.7#)2(.7(/7(/7)/8)/8)/803966:E?AC>A856,07%'*%')$$$######(((DDDBBB8888888880 cF1w]OcS{`QS;+57'   *      ;?E7CU;HY=I[ JJJMMMKMPacfbhq‘— ƒ¡ƒ¡‘— “œ“œ“œŒ“›Œ’›Œ’›‹‘š‘— ‘— —Ÿ™Ÿ¨”œ“œ“œ„‘¢„‘¢„‘¢„‘¢EQcHScNVd´¨§¿®¨Èµ®¯‘‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯â‹¯â‹¯â‹¯â‹¯â‹¯â‹°â‹°â‹°â‹°â‹°â‹°â‹°âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Œ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£„©Û„©Û„©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Ü…©Ü…©ÜGlžGlž…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÝHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž‡«Ý‡«ÝDhšDhšDhšDhš=J[=J[=J[=J[=J[=J[ ->(/7#)2#)2(.7(.7(.7#*2(/7)/8)/8)/8)/8)08*0903:56:88@KBB=;@348*08&(+'(*%%%$$$(((EEE(((&&&">-"bF3oXMs[Ow]Py^PqbpXMdH5R<,Q;, &%%#'-"'-&3DS_qP\nR_p>J\?K]AG@B::@66:-29'),)'%BBBFFFEEE)))))))))&&& @@@FFFACFZ\_[ajagp„¢„¢„¢ž¥­Ÿ¦®—¦–¥–ž•žŽ•Ž””œ“œ‘— —Ÿ›¡ªš ©™ ¨Ž•Ž”Ž”…‘£…‘£…‘£EQcGRcKTdPWd­¥§¿¯ª‹°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°ãŒ°ãŒ°ãŒ°ãŒ°ãLp£Lp£Lq£Lq£Lq£Lq£Lq£Lq£Lq£Œ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ãMq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£…©Û…©Û…©Û…©Û…©Û…©Û…©Ü…©Ü…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHlžHlžHlŸHlŸHlŸHlŸHlŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«ÞŸ>J\>J\=J[=J[=J[=J[FLU39B#*2(/7)/7)/8$*3$*3$*3)/8)08*09*09*19',5(-5*.6.17338@<=G@BH@BXW]UUXLPWFHKDFHKKKHHH+++%%%%%%$$$###!!!!!!777777777777777777777AAAFFFACFACF\^aeltbhqDQbDQbDQbŸ¥®¡§°¡§°¡§°¡§°—¦–Ÿ”š£”š£“™¢’™¡’˜¡‘˜ ‘— ›¡ª›¡ªš ©•ž™Ÿ¨Ž”ERcERcERcERcHScLUdRXd|njŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°ãŒ°ãŒ°ãŒ°ãŒ°ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ã±ã±ã±ã±ãMq£Mq£Mq£Mq£Mq£Mq£±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ãMq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£…©Ü…©Ü…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHlŸHlŸHlŸHlŸHlŸ‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬ÞŽŸŽŸŽŸŽŸ>J\=J[=J[FLUFLU(/7(/7*08*08%+3$*3$+3$+3*09*09*19&,5&,5'-6).6*/7-18NPURRVXUVc]^f^_[X]\XYTUZLQYKMPFHJ)))(((&&&%%%%%%$$$$$$###!!!!!!!!!777777777BBBEEEACGADGFIL\ckZ`iTZcDQbDQbDQbagpbiqcircir¢©±¢¨±¡¨°¡§°•œ¤•›¤”›£”š£“™¢’™¡’˜¡œ¢«œ¢«›¡ªš¡©•žY`hY_hERcERcERcGSdJTdNVdTYeLp¢Lp¢Œ°ãŒ°ãŒ°ãŒ°ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ãMq£Mq£±ã±ã±ã±ä±ä±ä±ä±ä±ä±ä±ä±ä±ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²äMq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÝ†ªÝ†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞŽŸŽŸŽŸŽŸŽŸŽŸŽŸFLUFLUFLU)/8+08+08&+3&+3%+4%+4%+4*19+1:&,5'-5'-6(.6FLTHMTINUKOVOQWSTXYWX`[^lbac]_f_\a_aY\aRX_,.1*,.*+-***((('''&&&%%%%%%$$$$$$$$$###!!!!!!!!!!!!!!!%%%%%%%%%%%%"""""""""KKKJJJFFFGIL]_b^dm\bkV]eDQbEQcEQcEQccirdjsdksektdjsdjscir£©²¢¨±¢¨±–œ¥•œ¤•›¤”›£”š£“™¢’™¡£¬œ¢«›¢ª[ajZ`iOU^ERcERcFRdFRdITdLUdPWeVZeLp£Lq£Lq£Lq£±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ä±ä±ä±ä±ä±ä²ä²ä²äMq£²ä²ä²ä²ä²ä²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äMr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«ÞHmŸHmŸHmŸ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞŽŸŽŸŽŸŽŸ‚Ž ‚Ž ‚Ž ‚Ž ”›£Š™ŠŽ•-18,18',3',4',4&,4%,4+1:,2:'-5DJSEKSEKTFLTFLUHMUINVKOWLPWQSYTUZWWZpjje^`offb\_h`]eaaCCG8;A27?-/2+-/.+)******)))((('''&&&&&&%%%%%%$$$$$$$$$$$$$$$$$$######???EEEEEEEEE((((((###&&&%%%HJMHJMHJMHJM_en]dlZ`i_enEQcEQcEQcEQcbhqektflufluflufluektektdksdjscjr£©²¢©±¢¨±–œ¥•œ¤•›¤”›£”š£“™¢£¬\ckQW`[ajZaiOU^FRdFRdFRdHSdKUdNVeRXeX\fLq£Mq£Mq£Mq£Mq£±ã±ã±ã±ã±ã±ä±ä±ä±ä±ä²ä²ä²ä²ä²ä²ä²ä²äŽ²äŽ²äŽ²äŽ²äŽ²äMr¤Mr¤Mr¤Mr¤Mr¤Ž²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åNr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬ÞHmŸHmŸHmŸHmŸImŸImŸImŸˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ”›£Š‘™‹•‹•PT[KOVJOV(-4(-4'-5'-5JOXEKSEKSEKTFLTFLTGMUGMUHNVIOWKPWLQXMRYPTZTV[\]a_^asljd^azporjkE@CLEBIEFEDG29A28A17@135,.1+-0+,/./1..0'),)))++++++++++++***FFFFFFACFACFEEEACFACFŠŒJLOJLOKQZ_en]clY_hU[dEQcEQcEQcEQcEQcagp[aj\bk\bkgnvgnvgmvgmvfluflueltektdksdjscjrcir¢©±—¦–œ¥•œ¤•›¤TZcSYbRYaRXaQW`[bj[ajZ`iFSdFSdGSdJTdLVePXeTZfZ]fMq£Mq£Mq£Mq£Mq£Mq£Mq£²ä²ä²ä²ä²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äNr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Ž²åŽ²åŽ²åŽ²åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³å³å³å³å³å³å³å³åNr¤Nr¤Nr¤Nr¤Nr¤³å³å†ªÜ†ªÜ†ªÝHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlŸHlŸHlŸHlŸHlŸHlŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬ÞImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ­ß‚Ž ‚Ž ‚Ž ‚Ž ‚ ‚ ‚ ‚ ‚ …Œ”’•šŒ•‘”›LPVLPWKPW‹—‹—‹˜•‹‘™FLTFLTFLUGMUGMUHMVHNVINWIOWKPXLQYMRYNSZTX`X[a[]b]^c__ccacib`JDGi__aYYPJLD@C=;AKEDTQR@?A>>A;/5>.4=-4 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef QMap QStringMap; +typedef QList QIntList; +Q_DECLARE_METATYPE(QImage) +Q_DECLARE_METATYPE(QRect) +Q_DECLARE_METATYPE(QSize) +Q_DECLARE_METATYPE(QColor) +Q_DECLARE_METATYPE(QStringMap) +Q_DECLARE_METATYPE(QIntList) +Q_DECLARE_METATYPE(QIODevice *) + +//TESTED_FILES= + +class tst_QImageReader : public QObject +{ + Q_OBJECT + +public: + tst_QImageReader(); + virtual ~tst_QImageReader(); + +public slots: + void init(); + void cleanup(); + +private slots: + void readImage_data(); + void readImage(); + + void setScaledSize_data(); + void setScaledSize(); + + void setClipRect_data(); + void setClipRect(); + + void setScaledClipRect_data(); + void setScaledClipRect(); + +private: + QList< QPair > images; // filename, format +}; + +tst_QImageReader::tst_QImageReader() +{ + images << QPair(QLatin1String("colorful.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("font.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("crash-signed-char.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("4bpp-rle.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("tst7.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("16bpp.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("negativeheight.bmp"), QByteArray("bmp")); + images << QPair(QLatin1String("marble.xpm"), QByteArray("xpm")); + images << QPair(QLatin1String("kollada.png"), QByteArray("png")); + images << QPair(QLatin1String("teapot.ppm"), QByteArray("ppm")); + images << QPair(QLatin1String("runners.ppm"), QByteArray("ppm")); + images << QPair(QLatin1String("test.ppm"), QByteArray("ppm")); + images << QPair(QLatin1String("gnus.xbm"), QByteArray("xbm")); +#if defined QTEST_HAVE_JPEG + images << QPair(QLatin1String("beavis.jpg"), QByteArray("jpeg")); + images << QPair(QLatin1String("YCbCr_cmyk.jpg"), QByteArray("jpeg")); + images << QPair(QLatin1String("YCbCr_rgb.jpg"), QByteArray("jpeg")); + images << QPair(QLatin1String("task210380.jpg"), QByteArray("jpeg")); +#endif +#if defined QTEST_HAVE_GIF + images << QPair(QLatin1String("earth.gif"), QByteArray("gif")); + images << QPair(QLatin1String("trolltech.gif"), QByteArray("gif")); +#endif +#if defined QTEST_HAVE_MNG + images << QPair(QLatin1String("ball.mng"), QByteArray("mng")); + images << QPair(QLatin1String("fire.mng"), QByteArray("mng")); +#endif +} + +tst_QImageReader::~tst_QImageReader() +{ +} + +void tst_QImageReader::init() +{ +} + +void tst_QImageReader::cleanup() +{ +} + +void tst_QImageReader::readImage_data() +{ + QTest::addColumn("fileName"); + QTest::addColumn("format"); + + for (int i = 0; i < images.size(); ++i) { + const QString file = images[i].first; + const QByteArray format = images[i].second; + QTest::newRow(qPrintable(file)) << file << format; + } +} + +void tst_QImageReader::readImage() +{ + QFETCH(QString, fileName); + QFETCH(QByteArray, format); + + QBENCHMARK { + QImageReader io("images/" + fileName, format); + QImage image = io.read(); + QVERIFY(!image.isNull()); + } +} + +void tst_QImageReader::setScaledSize_data() +{ + QTest::addColumn("fileName"); + QTest::addColumn("format"); + QTest::addColumn("newSize"); + + for (int i = 0; i < images.size(); ++i) { + const QString file = images[i].first; + const QByteArray format = images[i].second; + QSize size(200, 200); + if (file == QLatin1String("teapot")) + size = QSize(400, 400); + else if (file == QLatin1String("test.ppm")) + size = QSize(10, 10); + QTest::newRow(qPrintable(file)) << file << format << size; + } +} + +void tst_QImageReader::setScaledSize() +{ + QFETCH(QString, fileName); + QFETCH(QSize, newSize); + QFETCH(QByteArray, format); + + QBENCHMARK { + QImageReader reader("images/" + fileName, format); + reader.setScaledSize(newSize); + QImage image = reader.read(); + QCOMPARE(image.size(), newSize); + } +} + +void tst_QImageReader::setClipRect_data() +{ + QTest::addColumn("fileName"); + QTest::addColumn("format"); + QTest::addColumn("newRect"); + + for (int i = 0; i < images.size(); ++i) { + const QString file = images[i].first; + const QByteArray format = images[i].second; + QTest::newRow(qPrintable(file)) << file << format << QRect(0, 0, 50, 50); + } +} + +void tst_QImageReader::setClipRect() +{ + QFETCH(QString, fileName); + QFETCH(QRect, newRect); + QFETCH(QByteArray, format); + + QBENCHMARK { + QImageReader reader("images/" + fileName, format); + reader.setClipRect(newRect); + QImage image = reader.read(); + QCOMPARE(image.rect(), newRect); + } +} + +void tst_QImageReader::setScaledClipRect_data() +{ + setClipRect_data(); +} + +void tst_QImageReader::setScaledClipRect() +{ + QFETCH(QString, fileName); + QFETCH(QRect, newRect); + QFETCH(QByteArray, format); + + QBENCHMARK { + QImageReader reader("images/" + fileName, format); + reader.setScaledSize(QSize(300, 300)); + reader.setScaledClipRect(newRect); + QImage image = reader.read(); + QCOMPARE(image.rect(), newRect); + } +} + +QTEST_MAIN(tst_QImageReader) +#include "tst_qimagereader.moc" diff --git a/tests/benchmarks/gui/image/qpixmap/qpixmap.pro b/tests/benchmarks/gui/image/qpixmap/qpixmap.pro new file mode 100644 index 0000000..e8330bd --- /dev/null +++ b/tests/benchmarks/gui/image/qpixmap/qpixmap.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qpixmap + +SOURCES += tst_qpixmap.cpp diff --git a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp new file mode 100644 index 0000000..9ffbefb --- /dev/null +++ b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +class tst_QPixmap : public QObject +{ + Q_OBJECT + +public: + tst_QPixmap(); + +private slots: + void fill_data(); + void fill(); + + void scaled_data(); + void scaled(); + void transformed_data(); + void transformed(); + void mask_data(); + void mask(); +}; + +Q_DECLARE_METATYPE(QImage::Format) +Q_DECLARE_METATYPE(Qt::AspectRatioMode) +Q_DECLARE_METATYPE(Qt::TransformationMode) + +tst_QPixmap::tst_QPixmap() +{ +} + +void tst_QPixmap::fill_data() +{ + QTest::addColumn("opaque"); + QTest::addColumn("width"); + QTest::addColumn("height"); + + QTest::newRow("opaque 16x16") << true << 16 << 16; + QTest::newRow("!opaque 16x16") << false << 16 << 16; + QTest::newRow("opaque 587x128") << true << 587 << 128; + QTest::newRow("!opaque 587x128") << false << 587 << 128; +} + +void tst_QPixmap::fill() +{ + QFETCH(bool, opaque); + QFETCH(int, width); + QFETCH(int, height); + + const QColor color = opaque ? QColor(255, 0, 0) : QColor(255, 0, 0, 200); + QPixmap pixmap(width, height); + + QBENCHMARK { + pixmap.fill(color); + } +} + +void tst_QPixmap::scaled_data() +{ + QTest::addColumn("size"); + QTest::addColumn("scale"); + QTest::addColumn("ratioMode"); + QTest::addColumn("transformMode"); + + QTest::newRow("16x16 => 32x32") << QSize(16, 16) << QSize(32, 32) + << Qt::IgnoreAspectRatio + << Qt::FastTransformation; + QTest::newRow("100x100 => 200x200") << QSize(100, 100) << QSize(200, 200) + << Qt::IgnoreAspectRatio + << Qt::FastTransformation; + QTest::newRow("100x100 => 200x200") << QSize(100, 100) << QSize(200, 200) + << Qt::IgnoreAspectRatio + << Qt::FastTransformation; + QTest::newRow("80x80 => 200x200") << QSize(137, 137) << QSize(200, 200) + << Qt::IgnoreAspectRatio + << Qt::FastTransformation; + +} + +void tst_QPixmap::scaled() +{ + QFETCH(QSize, size); + QFETCH(QSize, scale); + QFETCH(Qt::AspectRatioMode, ratioMode); + QFETCH(Qt::TransformationMode, transformMode); + + QPixmap opaque(size); + QPixmap transparent(size); + opaque.fill(QColor(255, 0, 0)); + transparent.fill(QColor(255, 0, 0, 200)); + + QPixmap scaled1; + QPixmap scaled2; + QBENCHMARK { + scaled1 = opaque.scaled(scale, ratioMode, transformMode); + scaled2 = transparent.scaled(scale, ratioMode, transformMode); + } +} + +void tst_QPixmap::transformed_data() +{ + QTest::addColumn("size"); + QTest::addColumn("transform"); + QTest::addColumn("transformMode"); + + QTest::newRow("16x16 rotate(90)") << QSize(16, 16) + << QTransform().rotate(90) + << Qt::FastTransformation; + QTest::newRow("16x16 rotate(199)") << QSize(16, 16) + << QTransform().rotate(199) + << Qt::FastTransformation; + QTest::newRow("16x16 shear(2,1)") << QSize(16, 16) + << QTransform().shear(2, 1) + << Qt::FastTransformation; + QTest::newRow("16x16 rotate(199).shear(2,1)") << QSize(16, 16) + << QTransform().rotate(199).shear(2, 1) + << Qt::FastTransformation; + QTest::newRow("100x100 rotate(90)") << QSize(100, 100) + << QTransform().rotate(90) + << Qt::FastTransformation; + QTest::newRow("100x100 rotate(199)") << QSize(100, 100) + << QTransform().rotate(199) + << Qt::FastTransformation; + QTest::newRow("100x100 shear(2,1)") << QSize(100, 100) + << QTransform().shear(2, 1) + << Qt::FastTransformation; + QTest::newRow("100x100 shear(2,1) smooth") << QSize(100, 100) + << QTransform().shear(2, 1) + << Qt::SmoothTransformation; + QTest::newRow("100x100 rotate(199).shear(2,1)") << QSize(100, 100) + << QTransform().rotate(199).shear(2, 1) + << Qt::FastTransformation; +} + +void tst_QPixmap::transformed() +{ + QFETCH(QSize, size); + QFETCH(QTransform, transform); + QFETCH(Qt::TransformationMode, transformMode); + + QPixmap opaque(size); + QPixmap transparent(size); + opaque.fill(QColor(255, 0, 0)); + transparent.fill(QColor(255, 0, 0, 200)); + + QPixmap transformed1; + QPixmap transformed2; + QBENCHMARK { + transformed1 = opaque.transformed(transform, transformMode); + transformed2 = transparent.transformed(transform, transformMode); + } +} + +void tst_QPixmap::mask_data() +{ + QTest::addColumn("size"); + + QTest::newRow("1x1") << QSize(1, 1); + QTest::newRow("9x9") << QSize(9, 9); + QTest::newRow("16x16") << QSize(16, 16); + QTest::newRow("128x128") << QSize(128, 128); + QTest::newRow("333x333") << QSize(333, 333); + QTest::newRow("2048x128") << QSize(2048, 128); +} + +void tst_QPixmap::mask() +{ + QFETCH(QSize, size); + + QPixmap src(size); + src.fill(Qt::transparent); + { + QPainter p(&src); + p.drawLine(QPoint(0, 0), QPoint(src.width(), src.height())); + } + + QBENCHMARK { + QBitmap bitmap = src.mask(); + QVERIFY(bitmap.size() == src.size()); + } +} + +QTEST_MAIN(tst_QPixmap) + +#include "tst_qpixmap.moc" diff --git a/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro b/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro new file mode 100644 index 0000000..e0d7543 --- /dev/null +++ b/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qpixmapcache +TEMPLATE = app +# Input +SOURCES += tst_qpixmapcache.cpp diff --git a/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp new file mode 100644 index 0000000..1031ba7 --- /dev/null +++ b/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +//TESTED_FILES= + +class tst_QPixmapCache : public QObject +{ + Q_OBJECT + +public: + tst_QPixmapCache(); + virtual ~tst_QPixmapCache(); + +public slots: + void init(); + void cleanup(); + +private slots: + void insert_data(); + void insert(); + void find_data(); + void find(); + void styleUseCaseComplexKey(); + void styleUseCaseComplexKey_data(); +}; + +tst_QPixmapCache::tst_QPixmapCache() +{ +} + +tst_QPixmapCache::~tst_QPixmapCache() +{ +} + +void tst_QPixmapCache::init() +{ +} + +void tst_QPixmapCache::cleanup() +{ +} + +void tst_QPixmapCache::insert_data() +{ + QTest::addColumn("cacheType"); + QTest::newRow("QPixmapCache") << true; + QTest::newRow("QPixmapCache (int API)") << false; +} + +QList keys; + +void tst_QPixmapCache::insert() +{ + QFETCH(bool, cacheType); + QPixmap p; + if (cacheType) { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + { + QString tmp; + tmp.sprintf("my-key-%d", i); + QPixmapCache::insert(tmp, p); + } + } + } else { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + keys.append(QPixmapCache::insert(p)); + } + } +} + +void tst_QPixmapCache::find_data() +{ + QTest::addColumn("cacheType"); + QTest::newRow("QPixmapCache") << true; + QTest::newRow("QPixmapCache (int API)") << false; +} + +void tst_QPixmapCache::find() +{ + QFETCH(bool, cacheType); + QPixmap p; + if (cacheType) { + QBENCHMARK { + QString tmp; + for (int i = 0 ; i <= 10000 ; i++) + { + tmp.sprintf("my-key-%d", i); + QPixmapCache::find(tmp, p); + } + } + } else { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + QPixmapCache::find(keys.at(i), &p); + } + } + +} + +void tst_QPixmapCache::styleUseCaseComplexKey_data() +{ + QTest::addColumn("cacheType"); + QTest::newRow("QPixmapCache") << true; + QTest::newRow("QPixmapCache (int API)") << false; +} + +struct styleStruct { + QString key; + uint state; + uint direction; + uint complex; + uint palette; + int width; + int height; + bool operator==(const styleStruct &str) const + { + return str.state == state && str.direction == direction + && str.complex == complex && str.palette == palette && str.width == width + && str.height == height && str.key == key; + } +}; + +uint qHash(const styleStruct &myStruct) +{ + return qHash(myStruct.state); +} + +void tst_QPixmapCache::styleUseCaseComplexKey() +{ + QFETCH(bool, cacheType); + QPixmap p; + if (cacheType) { + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + { + QString tmp; + tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200); + QPixmapCache::insert(tmp, p); + } + + for (int i = 0 ; i <= 10000 ; i++) + { + QString tmp; + tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200); + QPixmapCache::find(tmp, p); + } + } + } else { + QHash hash; + QBENCHMARK { + for (int i = 0 ; i <= 10000 ; i++) + { + styleStruct myStruct; + myStruct.key = QString("my-progressbar-%1").arg(i); + myStruct.key = 5; + myStruct.key = 4; + myStruct.key = 3; + myStruct.palette = 358; + myStruct.width = 100; + myStruct.key = 200; + QPixmapCache::Key key = QPixmapCache::insert(p); + hash.insert(myStruct, key); + } + for (int i = 0 ; i <= 10000 ; i++) + { + styleStruct myStruct; + myStruct.key = QString("my-progressbar-%1").arg(i); + myStruct.key = 5; + myStruct.key = 4; + myStruct.key = 3; + myStruct.palette = 358; + myStruct.width = 100; + myStruct.key = 200; + QPixmapCache::Key key = hash.value(myStruct); + QPixmapCache::find(key, &p); + } + } + } + +} + + +QTEST_MAIN(tst_QPixmapCache) +#include "tst_qpixmapcache.moc" diff --git a/tests/benchmarks/gui/itemviews/itemviews.pro b/tests/benchmarks/gui/itemviews/itemviews.pro new file mode 100644 index 0000000..be0ee55 --- /dev/null +++ b/tests/benchmarks/gui/itemviews/itemviews.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qtableview diff --git a/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro b/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro new file mode 100644 index 0000000..02bc530 --- /dev/null +++ b/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qtableview + +SOURCES += tst_qtableview.cpp + diff --git a/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp b/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp new file mode 100644 index 0000000..a84d8b5 --- /dev/null +++ b/tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp @@ -0,0 +1,367 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include + +//TESTED_FILES= + +class QtTestTableModel: public QAbstractTableModel +{ + Q_OBJECT + + +public: + QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = 0) + : QAbstractTableModel(parent), + row_count(rows), + column_count(columns) {} + + int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; } + int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; } + bool isEditable(const QModelIndex &) const { return true; } + + QVariant data(const QModelIndex &idx, int role) const + { + if (!idx.isValid() || idx.row() >= row_count || idx.column() >= column_count) { + qWarning() << "Invalid modelIndex [%d,%d,%p]" << idx; + return QVariant(); + } + + if (role == Qt::DisplayRole || role == Qt::EditRole) + return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(0); + + return QVariant(); + } + + bool insertRows(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start > row_count) + return false; + + beginInsertRows(parent, start, start + count - 1); + row_count += count; + endInsertRows(); + return true; + } + + bool removeRows(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start >= row_count || row_count < count) + return false; + + beginRemoveRows(parent, start, start + count - 1); + row_count -= count; + endRemoveRows(); + return true; + } + + bool insertColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start > column_count) + return false; + + beginInsertColumns(parent, start, start + count - 1); + column_count += count; + endInsertColumns(); + return true; + } + + bool removeColumns(int start, int count, const QModelIndex &parent = QModelIndex()) + { + if (start < 0 || start >= column_count || column_count < count) + return false; + + beginRemoveColumns(parent, start, start + count - 1); + column_count -= count; + endRemoveColumns(); + return true; + } + + int row_count; + int column_count; +}; + + + + +class tst_QTableView : public QObject +{ + Q_OBJECT + +public: + tst_QTableView(); + virtual ~tst_QTableView(); + +public slots: + void init(); + void cleanup(); + +private slots: + void spanInit(); + void spanDraw(); + void spanSelectColumn(); + void spanSelectAll(); + void rowInsertion_data(); + void rowInsertion(); + void rowRemoval_data(); + void rowRemoval(); + void columnInsertion_data(); + void columnInsertion(); + void columnRemoval_data(); + void columnRemoval(); +private: + static inline void spanInit_helper(QTableView *); +}; + +tst_QTableView::tst_QTableView() +{ +} + +tst_QTableView::~tst_QTableView() +{ +} + +void tst_QTableView::init() +{ +} + +void tst_QTableView::cleanup() +{ +} + +void tst_QTableView::spanInit_helper(QTableView *view) +{ + for (int i=0; i < 40; i++) { + view->setSpan(1+i%2, 1+4*i, 1+i%3, 2); + } + + for (int i=1; i < 40; i++) { + view->setSpan(6 + i*7, 4, 4, 50); + } +} + +void tst_QTableView::spanInit() +{ + QtTestTableModel model(500, 500); + QTableView v; + v.setModel(&model); + + QBENCHMARK { + spanInit_helper(&v); + } +} + +void tst_QTableView::spanDraw() +{ + QtTestTableModel model(500, 500); + QTableView v; + v.setModel(&model); + + spanInit_helper(&v); + v.show(); + v.resize(500,500); + QTest::qWait(30); + + QImage image(500, 500, QImage::Format_ARGB32_Premultiplied); + QPainter painter(&image); + QBENCHMARK { + v.render(&painter); + } +} + +void tst_QTableView::spanSelectAll() +{ + QtTestTableModel model(500, 500); + QTableView v; + v.setModel(&model); + + spanInit_helper(&v); + v.show(); + QTest::qWait(30); + + QBENCHMARK { + v.selectAll(); + } +} + +void tst_QTableView::spanSelectColumn() +{ + QtTestTableModel model(500, 500); + QTableView v; + v.setModel(&model); + + spanInit_helper(&v); + v.show(); + QTest::qWait(30); + + QBENCHMARK { + v.selectColumn(22); + } +} + +typedef QVector SpanList; +Q_DECLARE_METATYPE(SpanList) + +void spansData() +{ + QTest::addColumn("spans"); + + QTest::newRow("Without spans") + << SpanList(); + + QTest::newRow("With spans") + << (SpanList() + << QRect(0, 1, 1, 2) + << QRect(1, 2, 1, 2) + << QRect(2, 2, 1, 5) + << QRect(2, 8, 1, 2) + << QRect(3, 4, 1, 2) + << QRect(4, 4, 1, 4) + << QRect(5, 6, 1, 3) + << QRect(6, 7, 1, 3)); +} + +void tst_QTableView::rowInsertion_data() +{ + spansData(); +} + +void tst_QTableView::rowInsertion() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + foreach (QRect span, spans) + view.setSpan(span.top(), span.left(), span.height(), span.width()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->insertRows(0, 2); + view.model()->insertRows(5, 2); + view.model()->insertRows(8, 2); + view.model()->insertRows(12, 2); + } +} + +void tst_QTableView::rowRemoval_data() +{ + spansData(); +} + +void tst_QTableView::rowRemoval() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + foreach (QRect span, spans) + view.setSpan(span.top(), span.left(), span.height(), span.width()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->removeRows(3, 3); + } +} + +void tst_QTableView::columnInsertion_data() +{ + spansData(); +} + +void tst_QTableView::columnInsertion() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + // Same set as for rowInsertion, just swapping columns and rows. + foreach (QRect span, spans) + view.setSpan(span.left(), span.top(), span.width(), span.height()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->insertColumns(0, 2); + view.model()->insertColumns(5, 2); + view.model()->insertColumns(8, 2); + view.model()->insertColumns(12, 2); + } +} + +void tst_QTableView::columnRemoval_data() +{ + spansData(); +} + +void tst_QTableView::columnRemoval() +{ + QFETCH(SpanList, spans); + + QtTestTableModel model(10, 10); + QTableView view; + view.setModel(&model); + + // Same set as for rowRemoval, just swapping columns and rows. + foreach (QRect span, spans) + view.setSpan(span.left(), span.top(), span.width(), span.height()); + view.show(); + QTest::qWait(50); + + QBENCHMARK_ONCE { + view.model()->removeColumns(3, 3); + } +} + +QTEST_MAIN(tst_QTableView) +#include "tst_qtableview.moc" diff --git a/tests/benchmarks/gui/kernel/kernel.pro b/tests/benchmarks/gui/kernel/kernel.pro new file mode 100644 index 0000000..a50aad2 --- /dev/null +++ b/tests/benchmarks/gui/kernel/kernel.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qapplication \ + qwidget diff --git a/tests/benchmarks/gui/kernel/qapplication/main.cpp b/tests/benchmarks/gui/kernel/qapplication/main.cpp new file mode 100644 index 0000000..c912497 --- /dev/null +++ b/tests/benchmarks/gui/kernel/qapplication/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include + + +class tst_qapplication : public QObject +{ + Q_OBJECT +private slots: + void ctor(); +}; + +/* + Test the performance of the QApplication constructor. + + Note: results from the second start on can be misleading, + since all global statics are already initialized. +*/ +void tst_qapplication::ctor() +{ + // simulate reasonable argc, argv + int argc = 1; + char *argv[] = { "tst_qapplication" }; + QBENCHMARK { + QApplication app(argc, argv); + } +} + +QTEST_APPLESS_MAIN(tst_qapplication) + +#include "main.moc" diff --git a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro new file mode 100644 index 0000000..f8601e4 --- /dev/null +++ b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qapplication +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro new file mode 100644 index 0000000..ff47445 --- /dev/null +++ b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro @@ -0,0 +1,4 @@ +load(qttest_p4) + +TARGET = tst_qwidget +SOURCES += tst_qwidget.cpp diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp new file mode 100644 index 0000000..f21bd44 --- /dev/null +++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp @@ -0,0 +1,332 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +class tst_QWidget : public QObject +{ + Q_OBJECT + + +private slots: + void update_data(); + void updateOpaque_data(); + void updateOpaque(); + void updateTransparent_data(); + void updateTransparent(); + void updatePartial_data(); + void updatePartial(); + void updateComplex_data(); + void updateComplex(); + + void complexToplevelResize(); +}; + +class UpdateWidget : public QWidget +{ +public: + UpdateWidget(int rows, int columns) : QWidget(0) + { + QGridLayout *layout = new QGridLayout; + for (int row = 0; row < rows; ++row) { + for (int column = 0; column < columns; ++column) { + UpdateWidget *widget = new UpdateWidget; + widget->setFixedSize(20, 20); + layout->addWidget(widget, row, column); + children.append(widget); + } + } + setLayout(layout); + } + + UpdateWidget(QWidget *parent = 0) : QWidget(parent) {} + + void paintEvent(QPaintEvent *) + { + static int color = Qt::black; + + QPainter painter(this); + painter.fillRect(rect(), Qt::GlobalColor(color)); + + if (++color > Qt::darkYellow) + color = Qt::black; + } + + QRegion updateRegion; + QList children; +}; + +void tst_QWidget::update_data() +{ + QTest::addColumn("rows"); + QTest::addColumn("columns"); + QTest::addColumn("numUpdates"); + + QTest::newRow("10x10x1") << 10 << 10 << 1; + QTest::newRow("10x10x10") << 10 << 10 << 10; + QTest::newRow("25x25x1") << 25 << 25 << 1; + QTest::newRow("25x25x10") << 25 << 25 << 10; + QTest::newRow("25x25x100") << 25 << 25 << 100; +} + +void tst_QWidget::updateOpaque_data() +{ + update_data(); +} + +void tst_QWidget::updateOpaque() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(int, numUpdates); + + UpdateWidget widget(rows, columns); + foreach (QWidget *w, widget.children) { + w->setAttribute(Qt::WA_OpaquePaintEvent); + } + + widget.show(); + QApplication::processEvents(); + + int i = 0; + const int n = widget.children.size(); + QBENCHMARK { + for (int j = 0; j < numUpdates; ++j) { + widget.children[i]->update(); + QApplication::processEvents(); + i = (i + 1) % n; + } + } +} + +void tst_QWidget::updateTransparent_data() +{ + update_data(); +} + +void tst_QWidget::updateTransparent() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(int, numUpdates); + + UpdateWidget widget(rows, columns); + widget.show(); + QApplication::processEvents(); + + int i = 0; + const int n = widget.children.size(); + QBENCHMARK { + for (int j = 0; j < numUpdates; ++j) { + widget.children[i]->update(); + QApplication::processEvents(); + i = (i + 1) % n; + } + } +} + +void tst_QWidget::updatePartial_data() +{ + update_data(); +} + +void tst_QWidget::updatePartial() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(int, numUpdates); + + UpdateWidget widget(rows, columns); + widget.show(); + QApplication::processEvents(); + + int i = 0; + const int n = widget.children.size(); + QBENCHMARK { + for (int j = 0; j < numUpdates; ++j) { + QWidget *w = widget.children[i]; + const int x = w->width() / 2; + const int y = w->height() / 2; + w->update(0, 0, x, y); + w->update(x, 0, x, y); + w->update(0, y, x, y); + w->update(x, y, x, y); + QApplication::processEvents(); + i = (i + 1) % n; + } + } +} + +void tst_QWidget::updateComplex_data() +{ + update_data(); +} + +void tst_QWidget::updateComplex() +{ + QFETCH(int, rows); + QFETCH(int, columns); + QFETCH(int, numUpdates); + + UpdateWidget widget(rows, columns); + widget.show(); + QApplication::processEvents(); + + int i = 0; + const int n = widget.children.size(); + QBENCHMARK { + for (int j = 0; j < numUpdates; ++j) { + QWidget *w = widget.children[i]; + const int x = w->width() / 2; + const int y = w->height() / 2; + w->update(QRegion(0, 0, x, y, QRegion::Ellipse)); + w->update(QRegion(x, y, x, y, QRegion::Ellipse)); + QApplication::processEvents(); + i = (i + 1) % n; + } + } +} + +class ResizeWidget : public QWidget +{ +public: + ResizeWidget(); +}; + +ResizeWidget::ResizeWidget() : QWidget(0) +{ + QBoxLayout *topLayout = new QVBoxLayout; + + QMenuBar *menubar = new QMenuBar; + QMenu* popup = menubar->addMenu("&File"); + popup->addAction("&Quit", qApp, SLOT(quit())); + topLayout->setMenuBar(menubar); + + QBoxLayout *buttons = new QHBoxLayout; + buttons->setMargin(5); + buttons->addStretch(10); + for (int i = 1; i <= 4; i++ ) { + QPushButton* button = new QPushButton; + button->setText(QString("Button %1").arg(i)); + buttons->addWidget(button); + } + topLayout->addLayout(buttons); + + buttons = new QHBoxLayout; + buttons->addStretch(10); + for (int i = 11; i <= 16; i++) { + QPushButton* button = new QPushButton; + button->setText(QString("Button %1").arg(i)); + buttons->addWidget(button); + } + topLayout->addLayout(buttons); + + QBoxLayout *buttons2 = new QHBoxLayout; + buttons2->addStretch(10); + topLayout->addLayout(buttons2); + + QPushButton *button = new QPushButton; + button->setText("Button five"); + buttons2->addWidget(button); + + button = new QPushButton; + button->setText("Button 6"); + buttons2->addWidget(button); + + QTextEdit *bigWidget = new QTextEdit; + bigWidget->setText("This widget will get all the remaining space"); + bigWidget->setFrameStyle(QFrame::Panel | QFrame::Plain); + topLayout->addWidget(bigWidget); + + const int numRows = 6; + const int labelCol = 0; + const int linedCol = 1; + const int multiCol = 2; + + QGridLayout *grid = new QGridLayout; + for (int row = 0; row < numRows; row++) { + QLineEdit *lineEdit = new QLineEdit; + grid->addWidget(lineEdit, row, linedCol); + QLabel *label = new QLabel(QString("Line &%1").arg(row + 1)); + grid->addWidget(label, row, labelCol); + } + topLayout->addLayout(grid); + + QTextEdit *multiLineEdit = new QTextEdit; + grid->addWidget(multiLineEdit, 0, labelCol + 1, multiCol, multiCol); + + grid->setColumnStretch(linedCol, 10); + grid->setColumnStretch(multiCol, 20); + + QLabel* statusBar = new QLabel; + statusBar->setText("Let's pretend this is a status bar"); + statusBar->setFrameStyle(QFrame::Panel | QFrame::Sunken); + statusBar->setFixedHeight(statusBar->sizeHint().height()); + statusBar->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + topLayout->addWidget(statusBar); + + topLayout->activate(); + setLayout(topLayout); +} + +void tst_QWidget::complexToplevelResize() +{ + ResizeWidget w; + w.show(); + + QApplication::processEvents(); + + const int minSize = 100; + const int maxSize = 800; + int size = minSize; + + QBENCHMARK { + w.resize(size, size); + size = qMax(minSize, (size + 10) % maxSize); + QApplication::processEvents(); + QApplication::processEvents(); + } +} + +QTEST_MAIN(tst_QWidget) + +#include "tst_qwidget.moc" diff --git a/tests/benchmarks/gui/math3d/math3d.pro b/tests/benchmarks/gui/math3d/math3d.pro new file mode 100644 index 0000000..c511d9a --- /dev/null +++ b/tests/benchmarks/gui/math3d/math3d.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qmatrix4x4 \ + qquaternion diff --git a/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro b/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro new file mode 100644 index 0000000..e82d9de --- /dev/null +++ b/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qmatrix4x4 + +SOURCES += tst_qmatrix4x4.cpp + diff --git a/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp new file mode 100644 index 0000000..e962198 --- /dev/null +++ b/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp @@ -0,0 +1,672 @@ +/**************************************************************************** +** +** 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 QtOpenGL 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 +#include + +class tst_QMatrix4x4 : public QObject +{ + Q_OBJECT +public: + tst_QMatrix4x4() {} + ~tst_QMatrix4x4() {} + +private slots: + void multiply_data(); + void multiply(); + + void multiplyInPlace_data(); + void multiplyInPlace(); + + void multiplyDirect_data(); + void multiplyDirect(); + + void mapVector3D_data(); + void mapVector3D(); + + void mapVector2D_data(); + void mapVector2D(); + + void mapVectorDirect_data(); + void mapVectorDirect(); + + void compareTranslate_data(); + void compareTranslate(); + + void compareTranslateAfterScale_data(); + void compareTranslateAfterScale(); + + void compareTranslateAfterRotate_data(); + void compareTranslateAfterRotate(); + + void compareScale_data(); + void compareScale(); + + void compareScaleAfterTranslate_data(); + void compareScaleAfterTranslate(); + + void compareScaleAfterRotate_data(); + void compareScaleAfterRotate(); + + void compareRotate_data(); + void compareRotate(); + + void compareRotateAfterTranslate_data(); + void compareRotateAfterTranslate(); + + void compareRotateAfterScale_data(); + void compareRotateAfterScale(); +}; + +static qreal const generalValues[16] = + {1.0f, 2.0f, 3.0f, 4.0f, + 5.0f, 6.0f, 7.0f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f, + 13.0f, 14.0f, 15.0f, 16.0f}; + +void tst_QMatrix4x4::multiply_data() +{ + QTest::addColumn("m1"); + QTest::addColumn("m2"); + + QTest::newRow("identity * identity") + << QMatrix4x4() << QMatrix4x4(); + QTest::newRow("identity * general") + << QMatrix4x4() << QMatrix4x4(generalValues); + QTest::newRow("general * identity") + << QMatrix4x4(generalValues) << QMatrix4x4(); + QTest::newRow("general * general") + << QMatrix4x4(generalValues) << QMatrix4x4(generalValues); +} + +QMatrix4x4 mresult; + +void tst_QMatrix4x4::multiply() +{ + QFETCH(QMatrix4x4, m1); + QFETCH(QMatrix4x4, m2); + + QMatrix4x4 m3; + + QBENCHMARK { + m3 = m1 * m2; + } + + // Force the result to be stored so the compiler doesn't + // optimize away the contents of the benchmark loop. + mresult = m3; +} + +void tst_QMatrix4x4::multiplyInPlace_data() +{ + multiply_data(); +} + +void tst_QMatrix4x4::multiplyInPlace() +{ + QFETCH(QMatrix4x4, m1); + QFETCH(QMatrix4x4, m2); + + QMatrix4x4 m3; + + QBENCHMARK { + m3 = m1; + m3 *= m2; + } + + // Force the result to be stored so the compiler doesn't + // optimize away the contents of the benchmark loop. + mresult = m3; +} + +// Use a direct naive multiplication algorithm. This is used +// to compare against the optimized routines to see if they are +// actually faster than the naive implementation. +void tst_QMatrix4x4::multiplyDirect_data() +{ + multiply_data(); +} +void tst_QMatrix4x4::multiplyDirect() +{ + QFETCH(QMatrix4x4, m1); + QFETCH(QMatrix4x4, m2); + + QMatrix4x4 m3; + + const qreal *m1data = m1.constData(); + const qreal *m2data = m2.constData(); + qreal *m3data = m3.data(); + + QBENCHMARK { + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + m3data[col * 4 + row] = 0.0f; + for (int j = 0; j < 4; ++j) { + m3data[col * 4 + row] += + m1data[j * 4 + row] * m2data[col * 4 + j]; + } + } + } + } +} + +QVector3D vresult; + +void tst_QMatrix4x4::mapVector3D_data() +{ + QTest::addColumn("m1"); + + QTest::newRow("identity") << QMatrix4x4(); + QTest::newRow("general") << QMatrix4x4(generalValues); + + QMatrix4x4 t1; + t1.translate(-100.5f, 64.0f, 75.25f); + QTest::newRow("translate3D") << t1; + + QMatrix4x4 t2; + t2.translate(-100.5f, 64.0f); + QTest::newRow("translate2D") << t2; + + QMatrix4x4 s1; + s1.scale(-100.5f, 64.0f, 75.25f); + QTest::newRow("scale3D") << s1; + + QMatrix4x4 s2; + s2.scale(-100.5f, 64.0f); + QTest::newRow("scale2D") << s2; +} +void tst_QMatrix4x4::mapVector3D() +{ + QFETCH(QMatrix4x4, m1); + + QVector3D v(10.5f, -2.0f, 3.0f); + QVector3D result; + + m1.optimize(); + + QBENCHMARK { + result = m1 * v; + } + + // Force the result to be stored so the compiler doesn't + // optimize away the contents of the benchmark loop. + vresult = result; +} + +QPointF vresult2; + +void tst_QMatrix4x4::mapVector2D_data() +{ + mapVector3D_data(); +} +void tst_QMatrix4x4::mapVector2D() +{ + QFETCH(QMatrix4x4, m1); + + QPointF v(10.5f, -2.0f); + QPointF result; + + m1.optimize(); + + QBENCHMARK { + result = m1 * v; + } + + // Force the result to be stored so the compiler doesn't + // optimize away the contents of the benchmark loop. + vresult2 = result; +} + +// Use a direct naive multiplication algorithm. This is used +// to compare against the optimized routines to see if they are +// actually faster than the naive implementation. +void tst_QMatrix4x4::mapVectorDirect_data() +{ + mapVector3D_data(); +} +void tst_QMatrix4x4::mapVectorDirect() +{ + QFETCH(QMatrix4x4, m1); + + const qreal *m1data = m1.constData(); + qreal v[4] = {10.5f, -2.0f, 3.0f, 1.0f}; + qreal result[4]; + + QBENCHMARK { + for (int row = 0; row < 4; ++row) { + result[row] = 0.0f; + for (int col = 0; col < 4; ++col) { + result[row] += m1data[col * 4 + row] * v[col]; + } + } + result[0] /= result[3]; + result[1] /= result[3]; + result[2] /= result[3]; + } +} + +// Compare the performance of QTransform::translate() to +// QMatrix4x4::translate(). +void tst_QMatrix4x4::compareTranslate_data() +{ + QTest::addColumn("useQTransform"); + QTest::addColumn("translation"); + + QTest::newRow("QTransform::translate(0, 0, 0)") + << true << QVector3D(0, 0, 0); + QTest::newRow("QMatrix4x4::translate(0, 0, 0)") + << false << QVector3D(0, 0, 0); + + QTest::newRow("QTransform::translate(1, 2, 0)") + << true << QVector3D(1, 2, 0); + QTest::newRow("QMatrix4x4::translate(1, 2, 0)") + << false << QVector3D(1, 2, 0); + + QTest::newRow("QTransform::translate(1, 2, 4)") + << true << QVector3D(1, 2, 4); + QTest::newRow("QMatrix4x4::translate(1, 2, 4)") + << false << QVector3D(1, 2, 4); +} +void tst_QMatrix4x4::compareTranslate() +{ + QFETCH(bool, useQTransform); + QFETCH(QVector3D, translation); + + qreal x = translation.x(); + qreal y = translation.y(); + qreal z = translation.z(); + + if (useQTransform) { + QTransform t; + QBENCHMARK { + t.translate(x, y); + } + } else if (z == 0.0f) { + QMatrix4x4 m; + QBENCHMARK { + m.translate(x, y); + } + } else { + QMatrix4x4 m; + QBENCHMARK { + m.translate(x, y, z); + } + } +} + +// Compare the performance of QTransform::translate() to +// QMatrix4x4::translate() after priming the matrix with a scale(). +void tst_QMatrix4x4::compareTranslateAfterScale_data() +{ + compareTranslate_data(); +} +void tst_QMatrix4x4::compareTranslateAfterScale() +{ + QFETCH(bool, useQTransform); + QFETCH(QVector3D, translation); + + qreal x = translation.x(); + qreal y = translation.y(); + qreal z = translation.z(); + + if (useQTransform) { + QTransform t; + t.scale(3, 4); + QBENCHMARK { + t.translate(x, y); + } + } else if (z == 0.0f) { + QMatrix4x4 m; + m.scale(3, 4); + QBENCHMARK { + m.translate(x, y); + } + } else { + QMatrix4x4 m; + m.scale(3, 4, 5); + QBENCHMARK { + m.translate(x, y, z); + } + } +} + +// Compare the performance of QTransform::translate() to +// QMatrix4x4::translate() after priming the matrix with a rotate(). +void tst_QMatrix4x4::compareTranslateAfterRotate_data() +{ + compareTranslate_data(); +} +void tst_QMatrix4x4::compareTranslateAfterRotate() +{ + QFETCH(bool, useQTransform); + QFETCH(QVector3D, translation); + + qreal x = translation.x(); + qreal y = translation.y(); + qreal z = translation.z(); + + if (useQTransform) { + QTransform t; + t.rotate(45.0f); + QBENCHMARK { + t.translate(x, y); + } + } else if (z == 0.0f) { + QMatrix4x4 m; + m.rotate(45.0f, 0, 0, 1); + QBENCHMARK { + m.translate(x, y); + } + } else { + QMatrix4x4 m; + m.rotate(45.0f, 0, 0, 1); + QBENCHMARK { + m.translate(x, y, z); + } + } +} + +// Compare the performance of QTransform::scale() to +// QMatrix4x4::scale(). +void tst_QMatrix4x4::compareScale_data() +{ + QTest::addColumn("useQTransform"); + QTest::addColumn("scale"); + + QTest::newRow("QTransform::scale(1, 1, 1)") + << true << QVector3D(1, 1, 1); + QTest::newRow("QMatrix4x4::scale(1, 1, 1)") + << false << QVector3D(1, 1, 1); + + QTest::newRow("QTransform::scale(3, 6, 1)") + << true << QVector3D(3, 6, 1); + QTest::newRow("QMatrix4x4::scale(3, 6, 1)") + << false << QVector3D(3, 6, 1); + + QTest::newRow("QTransform::scale(3, 6, 4)") + << true << QVector3D(3, 6, 4); + QTest::newRow("QMatrix4x4::scale(3, 6, 4)") + << false << QVector3D(3, 6, 4); +} +void tst_QMatrix4x4::compareScale() +{ + QFETCH(bool, useQTransform); + QFETCH(QVector3D, scale); + + qreal x = scale.x(); + qreal y = scale.y(); + qreal z = scale.z(); + + if (useQTransform) { + QTransform t; + QBENCHMARK { + t.scale(x, y); + } + } else if (z == 1.0f) { + QMatrix4x4 m; + QBENCHMARK { + m.scale(x, y); + } + } else { + QMatrix4x4 m; + QBENCHMARK { + m.scale(x, y, z); + } + } +} + +// Compare the performance of QTransform::scale() to +// QMatrix4x4::scale() after priming the matrix with a translate(). +void tst_QMatrix4x4::compareScaleAfterTranslate_data() +{ + compareScale_data(); +} +void tst_QMatrix4x4::compareScaleAfterTranslate() +{ + QFETCH(bool, useQTransform); + QFETCH(QVector3D, scale); + + qreal x = scale.x(); + qreal y = scale.y(); + qreal z = scale.z(); + + if (useQTransform) { + QTransform t; + t.translate(20, 34); + QBENCHMARK { + t.scale(x, y); + } + } else if (z == 1.0f) { + QMatrix4x4 m; + m.translate(20, 34); + QBENCHMARK { + m.scale(x, y); + } + } else { + QMatrix4x4 m; + m.translate(20, 34, 42); + QBENCHMARK { + m.scale(x, y, z); + } + } +} + +// Compare the performance of QTransform::scale() to +// QMatrix4x4::scale() after priming the matrix with a rotate(). +void tst_QMatrix4x4::compareScaleAfterRotate_data() +{ + compareScale_data(); +} +void tst_QMatrix4x4::compareScaleAfterRotate() +{ + QFETCH(bool, useQTransform); + QFETCH(QVector3D, scale); + + qreal x = scale.x(); + qreal y = scale.y(); + qreal z = scale.z(); + + if (useQTransform) { + QTransform t; + t.rotate(45.0f); + QBENCHMARK { + t.scale(x, y); + } + } else if (z == 1.0f) { + QMatrix4x4 m; + m.rotate(45.0f, 0, 0, 1); + QBENCHMARK { + m.scale(x, y); + } + } else { + QMatrix4x4 m; + m.rotate(45.0f, 0, 0, 1); + QBENCHMARK { + m.scale(x, y, z); + } + } +} + +// Compare the performance of QTransform::rotate() to +// QMatrix4x4::rotate(). +void tst_QMatrix4x4::compareRotate_data() +{ + QTest::addColumn("useQTransform"); + QTest::addColumn("angle"); + QTest::addColumn("rotation"); + QTest::addColumn("axis"); + + QTest::newRow("QTransform::rotate(0, ZAxis)") + << true << qreal(0.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); + QTest::newRow("QMatrix4x4::rotate(0, ZAxis)") + << false << qreal(0.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); + + QTest::newRow("QTransform::rotate(45, ZAxis)") + << true << qreal(45.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); + QTest::newRow("QMatrix4x4::rotate(45, ZAxis)") + << false << qreal(45.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); + + QTest::newRow("QTransform::rotate(90, ZAxis)") + << true << qreal(90.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); + QTest::newRow("QMatrix4x4::rotate(90, ZAxis)") + << false << qreal(90.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); + + QTest::newRow("QTransform::rotate(0, YAxis)") + << true << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); + QTest::newRow("QMatrix4x4::rotate(0, YAxis)") + << false << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); + + QTest::newRow("QTransform::rotate(45, YAxis)") + << true << qreal(45.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); + QTest::newRow("QMatrix4x4::rotate(45, YAxis)") + << false << qreal(45.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); + + QTest::newRow("QTransform::rotate(90, YAxis)") + << true << qreal(90.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); + QTest::newRow("QMatrix4x4::rotate(90, YAxis)") + << false << qreal(90.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); + + QTest::newRow("QTransform::rotate(0, XAxis)") + << true << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::XAxis); + QTest::newRow("QMatrix4x4::rotate(0, XAxis)") + << false << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::XAxis); + + QTest::newRow("QTransform::rotate(45, XAxis)") + << true << qreal(45.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); + QTest::newRow("QMatrix4x4::rotate(45, XAxis)") + << false << qreal(45.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); + + QTest::newRow("QTransform::rotate(90, XAxis)") + << true << qreal(90.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); + QTest::newRow("QMatrix4x4::rotate(90, XAxis)") + << false << qreal(90.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); +} +void tst_QMatrix4x4::compareRotate() +{ + QFETCH(bool, useQTransform); + QFETCH(qreal, angle); + QFETCH(QVector3D, rotation); + QFETCH(int, axis); + + qreal x = rotation.x(); + qreal y = rotation.y(); + qreal z = rotation.z(); + + if (useQTransform) { + QTransform t; + QBENCHMARK { + t.rotate(angle, Qt::Axis(axis)); + } + } else { + QMatrix4x4 m; + QBENCHMARK { + m.rotate(angle, x, y, z); + } + } +} + +// Compare the performance of QTransform::rotate() to +// QMatrix4x4::rotate() after priming the matrix with a translate(). +void tst_QMatrix4x4::compareRotateAfterTranslate_data() +{ + compareRotate_data(); +} +void tst_QMatrix4x4::compareRotateAfterTranslate() +{ + QFETCH(bool, useQTransform); + QFETCH(qreal, angle); + QFETCH(QVector3D, rotation); + QFETCH(int, axis); + + qreal x = rotation.x(); + qreal y = rotation.y(); + qreal z = rotation.z(); + + if (useQTransform) { + QTransform t; + t.translate(3, 4); + QBENCHMARK { + t.rotate(angle, Qt::Axis(axis)); + } + } else { + QMatrix4x4 m; + m.translate(3, 4, 5); + QBENCHMARK { + m.rotate(angle, x, y, z); + } + } +} + +// Compare the performance of QTransform::rotate() to +// QMatrix4x4::rotate() after priming the matrix with a scale(). +void tst_QMatrix4x4::compareRotateAfterScale_data() +{ + compareRotate_data(); +} +void tst_QMatrix4x4::compareRotateAfterScale() +{ + QFETCH(bool, useQTransform); + QFETCH(qreal, angle); + QFETCH(QVector3D, rotation); + QFETCH(int, axis); + + qreal x = rotation.x(); + qreal y = rotation.y(); + qreal z = rotation.z(); + + if (useQTransform) { + QTransform t; + t.scale(3, 4); + QBENCHMARK { + t.rotate(angle, Qt::Axis(axis)); + } + } else { + QMatrix4x4 m; + m.scale(3, 4, 5); + QBENCHMARK { + m.rotate(angle, x, y, z); + } + } +} + +QTEST_MAIN(tst_QMatrix4x4) + +#include "tst_qmatrix4x4.moc" diff --git a/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro b/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro new file mode 100644 index 0000000..cd68423 --- /dev/null +++ b/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qquaternion + +SOURCES += tst_qquaternion.cpp + diff --git a/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp new file mode 100644 index 0000000..7930092 --- /dev/null +++ b/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//TESTED_FILES= + +class tst_QQuaternion : public QObject +{ + Q_OBJECT + +public: + tst_QQuaternion(); + virtual ~tst_QQuaternion(); + +public slots: + void init(); + void cleanup(); + +private slots: + void multiply_data(); + void multiply(); +}; + +tst_QQuaternion::tst_QQuaternion() +{ +} + +tst_QQuaternion::~tst_QQuaternion() +{ +} + +void tst_QQuaternion::init() +{ +} + +void tst_QQuaternion::cleanup() +{ +} + +void tst_QQuaternion::multiply_data() +{ + QTest::addColumn("x1"); + QTest::addColumn("y1"); + QTest::addColumn("z1"); + QTest::addColumn("w1"); + QTest::addColumn("x2"); + QTest::addColumn("y2"); + QTest::addColumn("z2"); + QTest::addColumn("w2"); + + QTest::newRow("null") + << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f + << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f; + + QTest::newRow("unitvec") + << (qreal)1.0f << (qreal)0.0f << (qreal)0.0f << (qreal)1.0f + << (qreal)0.0f << (qreal)1.0f << (qreal)0.0f << (qreal)1.0f; + + QTest::newRow("complex") + << (qreal)1.0f << (qreal)2.0f << (qreal)3.0f << (qreal)7.0f + << (qreal)4.0f << (qreal)5.0f << (qreal)6.0f << (qreal)8.0f; +} + +void tst_QQuaternion::multiply() +{ + QFETCH(qreal, x1); + QFETCH(qreal, y1); + QFETCH(qreal, z1); + QFETCH(qreal, w1); + QFETCH(qreal, x2); + QFETCH(qreal, y2); + QFETCH(qreal, z2); + QFETCH(qreal, w2); + + QQuaternion q1(w1, x1, y1, z1); + QQuaternion q2(w2, x2, y2, z2); + + QBENCHMARK { + QQuaternion q3 = q1 * q2; + } +} + +QTEST_MAIN(tst_QQuaternion) +#include "tst_qquaternion.moc" diff --git a/tests/benchmarks/gui/painting/painting.pro b/tests/benchmarks/gui/painting/painting.pro new file mode 100644 index 0000000..878567d --- /dev/null +++ b/tests/benchmarks/gui/painting/painting.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qpainter \ + qregion \ + qtransform diff --git a/tests/benchmarks/gui/painting/qpainter/qpainter.pro b/tests/benchmarks/gui/painting/qpainter/qpainter.pro new file mode 100644 index 0000000..5ac8c64 --- /dev/null +++ b/tests/benchmarks/gui/painting/qpainter/qpainter.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qpainter + +SOURCES += tst_qpainter.cpp diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp new file mode 100644 index 0000000..39b2244 --- /dev/null +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -0,0 +1,1633 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +Q_DECLARE_METATYPE(QLine) +Q_DECLARE_METATYPE(QRect) +Q_DECLARE_METATYPE(QSize) +Q_DECLARE_METATYPE(QPoint) +Q_DECLARE_METATYPE(QPainterPath) +Q_DECLARE_METATYPE(QPainter::RenderHint) +Q_DECLARE_METATYPE(QPainter::CompositionMode) +Q_DECLARE_METATYPE(QImage::Format) + +enum PrimitiveType { + Primitive_Int_DiagLine, + Primitive_Int_VerLine, + Primitive_Int_HorLine, + Primitive_Int_Rect, + Primitive_Int_Ellipse, + Primitive_Int_Pie, + Primitive_Int_Arc, + Primitive_Int_Chord, + Primitive_Int_TriPoly, + Primitive_Int_RectPoly, + Primitive_Int_2RectPoly, + + Primitive_Float_DiagLine, + Primitive_Float_VerLine, + Primitive_Float_HorLine, + Primitive_Float_Rect, + Primitive_Float_Ellipse, + Primitive_Float_Pie, + Primitive_Float_Arc, + Primitive_Float_Chord, + Primitive_Float_TriPoly, + Primitive_Float_RectPoly, + Primitive_Float_2RectPoly, + + Primitive_Float_TriPath, + Primitive_Float_RectPath, + Primitive_Float_2RectPath, + Primitive_Float_EllipsePath, + Primitive_Last_Primitive + +}; + + +enum StateChanges { + ChangePen = 0x0001, + ChangeBrush = 0x0002, + ChangeClip = 0x0004, + ChangeTransform = 0x0008 +}; + + +struct PrimitiveSet { + QRect i_rect; + QLine i_line_diag; + QLine i_line_ver; + QLine i_line_hor; + QPolygon i_poly_tri; + QPolygon i_poly_2rects; + QPolygon i_poly_rect; + + QRectF f_rect; + QLineF f_line_diag; + QLineF f_line_ver; + QLineF f_line_hor; + QPolygonF f_poly_tri; + QPolygonF f_poly_2rects; + QPolygonF f_poly_rect; + + QPainterPath f_path_tri; + QPainterPath f_path_2rects; + QPainterPath f_path_rect; + QPainterPath f_path_ellipse; +}; + + +class tst_QPainter : public QObject +{ + Q_OBJECT + + public: + tst_QPainter() + { + setupBrushes(); + createPrimitives(); + m_surface = surface(); + } + +private slots: + void beginAndEnd(); + + void saveRestore_data(); + void saveRestore(); + + void drawLine_data(); + void drawLine(); + void drawLine_clipped_data(); + void drawLine_clipped(); + void drawLine_antialiased_clipped_data(); + void drawLine_antialiased_clipped(); + + void drawPixmap_data(); + void drawPixmap(); + + void drawImage_data(); + void drawImage(); + + void drawTiledPixmap_data(); + void drawTiledPixmap(); + + void compositionModes_data(); + void compositionModes(); + + void fillPrimitives_10_data() { drawPrimitives_data_helper(false); } + void fillPrimitives_100_data() { drawPrimitives_data_helper(false); } + void fillPrimitives_1000_data() { drawPrimitives_data_helper(false); } + void fillPrimitives_10(); + void fillPrimitives_100(); + void fillPrimitives_1000(); + + void strokePrimitives_10_data() { drawPrimitives_data_helper(true); } + void strokePrimitives_100_data() { drawPrimitives_data_helper(true); } + void strokePrimitives_1000_data() { drawPrimitives_data_helper(true); } + void strokePrimitives_10(); + void strokePrimitives_100(); + void strokePrimitives_1000(); + + void drawText_data(); + void drawText(); + + void clipAndFill_data(); + void clipAndFill(); + + void drawRoundedRect(); + void drawScaledRoundedRect(); + void drawTransformedRoundedRect(); + + void drawScaledAntialiasedRoundedRect_data(); + void drawTransformedAntialiasedRoundedRect_data(); + void drawAntialiasedRoundedRect(); + void drawScaledAntialiasedRoundedRect(); + void drawTransformedAntialiasedRoundedRect(); + + void drawScaledImageRoundedRect_data(); + void drawTransformedImageRoundedRect_data(); + void drawImageRoundedRect(); + void drawScaledImageRoundedRect(); + void drawTransformedImageRoundedRect(); + + void drawScaledBorderPixmapRoundedRect_data(); + void drawTransformedBorderPixmapRoundedRect_data(); + void drawBorderPixmapRoundedRect(); + void drawScaledBorderPixmapRoundedRect(); + void drawTransformedBorderPixmapRoundedRect(); + + void drawTransformedTransparentImage_data(); + void drawTransformedSemiTransparentImage_data(); + void drawTransformedFilledImage_data(); + void drawTransformedTransparentImage(); + void drawTransformedSemiTransparentImage(); + void drawTransformedFilledImage(); + +private: + void setupBrushes(); + void createPrimitives(); + + void drawPrimitives_data_helper(bool fancypens); + void fillPrimitives_helper(QPainter *painter, PrimitiveType type, PrimitiveSet *s); + + QTransform transformForAngle(qreal angle); + + QPaintDevice *surface() + { + return new QPixmap(1024, 1024); + } + + + QMap m_pens; + QMap m_brushes; + + PrimitiveSet m_primitives_10; + PrimitiveSet m_primitives_100; + PrimitiveSet m_primitives_1000; + + QPaintDevice *m_surface; + QPainter m_painter; + +}; + +void tst_QPainter::createPrimitives() +{ + for (int i=0; i<3; ++i) { + PrimitiveSet *ps; + int size; + switch (i) { + case 0: + ps = &m_primitives_10; + size = 10; + break; + case 1: + ps = &m_primitives_100; + size = 100; + break; + case 2: + ps = &m_primitives_1000; + size = 1000; + break; + } + + ps->f_rect = QRectF(0, 0, size, size); + ps->f_line_diag = QLineF(0, 0, size, size); + ps->f_line_ver = QLineF(10, 0, 10, size); + ps->f_line_hor = QLineF(0, 10, size, 10); + ps->f_poly_rect = QPolygonF() << QPointF(0, 0) + << QPointF(size, 0) + << QPointF(size, size) + << QPointF(0, size); + ps->f_poly_2rects = QPolygonF() << QPointF(0, 0) + << QPointF(size * 0.75, 0) + << QPointF(size * 0.75, size * 0.75) + << QPointF(size * 0.25, size * 0.75) + << QPointF(size * 0.25, size * 0.25) + << QPointF(size, size * 0.25) + << QPointF(size, size) + << QPointF(0, size); + ps->f_poly_tri = QPolygonF() << QPointF(size / 2.0, 0) + << QPointF(0, size) + << QPointF(size, size); + + ps->f_path_tri.addPolygon(ps->f_poly_tri); + ps->f_path_rect.addRect(ps->f_rect); + ps->f_path_2rects.addPolygon(ps->f_poly_2rects); + ps->f_path_ellipse.addEllipse(ps->f_rect); + + ps->i_rect = ps->f_rect.toRect(); + ps->i_line_diag = ps->f_line_diag.toLine(); + ps->i_line_hor = ps->f_line_hor.toLine(); + ps->i_line_ver = ps->f_line_ver.toLine(); + ps->i_poly_tri = ps->f_poly_tri.toPolygon(); + ps->i_poly_rect = ps->f_poly_rect.toPolygon(); + ps->i_poly_2rects = ps->f_poly_2rects.toPolygon(); + } +} + +void tst_QPainter::drawLine_data() +{ + QTest::addColumn("line"); + QTest::addColumn("pen"); + + QVector pens; + pens << QPen(Qt::black) + << QPen(Qt::black, 0, Qt::DashDotLine) + << QPen(Qt::black, 4) + << QPen(Qt::black, 4, Qt::DashDotLine) + << QPen(QColor(255, 0, 0, 200)) + << QPen(QColor(255, 0, 0, 200), 0, Qt::DashDotLine) + << QPen(QColor(255, 0, 0, 200), 4) + << QPen(QColor(255, 0, 0, 200), 4, Qt::DashDotLine); + + QStringList penNames; + penNames << "black-0" + << "black-0-dashdot" + << "black-4" + << "black-4-dashdot" + << "alpha-0" + << "alpha-0-dashdot" + << "alpha-4" + << "alpha-4-dashdot"; + + int i = 0; + foreach (QPen pen, pens) { + const QString s = QString(QLatin1String("%1:%2")).arg(penNames[i]); + QTest::newRow(qPrintable(s.arg("horizontal"))) + << QLine(0, 20, 100, 20) << pen; + QTest::newRow(qPrintable(s.arg("vertical:"))) + << QLine(20, 0, 20, 100) << pen; + QTest::newRow(qPrintable(s.arg("0-45:"))) + << QLine(0, 20, 100, 0) << pen; + QTest::newRow(qPrintable(s.arg("45-90:"))) + << QLine(0, 100, 20, 0) << pen; + QTest::newRow(qPrintable(s.arg("90-135:"))) + << QLine(20, 100, 0, 0) << pen; + QTest::newRow(qPrintable(s.arg("135-180:"))) + << QLine(100, 20, 0, 0) << pen; + QTest::newRow(qPrintable(s.arg("180-225:"))) + << QLine(100, 0, 0, 20) << pen; + QTest::newRow(qPrintable(s.arg("225-270:"))) + << QLine(20, 0, 0, 100) << pen; + QTest::newRow(qPrintable(s.arg("270-315:"))) + << QLine(0, 0, 20, 100) << pen; + QTest::newRow(qPrintable(s.arg("315-360:"))) + << QLine(0, 0, 100, 20) << pen; + ++i; + } +} + +void tst_QPainter::setupBrushes() +{ + // Solid brushes... + m_brushes["black-brush"] = QBrush(Qt::black); + m_brushes["white-brush"] = QBrush(Qt::white); + m_brushes["transparent-brush"] = QBrush(QColor(255, 255, 255, 0)); + m_brushes["alpha1-brush"] = QBrush(QColor(255, 255, 255, 100)); + m_brushes["alpha2-brush"] = QBrush(QColor(255, 255, 255, 200)); + + + // Patterns + m_brushes["dense1-brush"] = QBrush(Qt::Dense1Pattern); + m_brushes["dense2-brush"] = QBrush(Qt::Dense2Pattern); + m_brushes["dense3-brush"] = QBrush(Qt::Dense3Pattern); + m_brushes["dense4-brush"] = QBrush(Qt::Dense4Pattern); + m_brushes["dense5-brush"] = QBrush(Qt::Dense5Pattern); + m_brushes["dense6-brush"] = QBrush(Qt::Dense6Pattern); + m_brushes["dense7-brush"] = QBrush(Qt::Dense7Pattern); + m_brushes["hor-brush"] = QBrush(Qt::HorPattern); + m_brushes["ver-brush"] = QBrush(Qt::VerPattern); + m_brushes["cross-brush"] = QBrush(Qt::CrossPattern); + m_brushes["bdiag-brush"] = QBrush(Qt::BDiagPattern); + m_brushes["fdiag-brush"] = QBrush(Qt::FDiagPattern); + m_brushes["diagcross-brush"] = QBrush(Qt::DiagCrossPattern); + + // Gradients + QGradientStops gradient_white_black; + gradient_white_black << QPair(0, QColor(Qt::white)); + gradient_white_black << QPair(1, QColor(Qt::black)); + + QGradientStops gradient_white_black10; + for (int i=0; i<10; ++i) { + gradient_white_black10 << QPair(i/10.0, QColor(Qt::white)); + gradient_white_black10 << QPair(i/10.0+0.05, QColor(Qt::black)); + } + + QGradientStops gradient_white_alpha; + gradient_white_alpha << QPair(0, QColor(Qt::white)); + gradient_white_alpha << QPair(0, QColor(Qt::transparent)); + + QGradientStops gradient_white_alpha10; + for (int i=0; i<10; ++i) { + gradient_white_alpha10 << QPair(i/10.0, QColor(Qt::white)); + gradient_white_alpha10 << QPair(i/10.0+0.05, QColor(Qt::black)); + } + + + for (int j=0; j<4; ++j) { + QLinearGradient lg; + lg.setStart(0, 0); + + QRadialGradient rg; + QConicalGradient cg; + + QGradientStops stops; + if (j == 0) stops = gradient_white_black; + else if (j == 1) stops = gradient_white_black10; + else if (j == 2) stops = gradient_white_alpha; + else if (j == 3) stops = gradient_white_alpha10; + lg.setStops(stops); + rg.setStops(stops); + cg.setStops(stops); + + for (int i=0; i<6; ++i) { + lg.setSpread((QGradient::Spread) (i % 3)); + lg.setCoordinateMode((QGradient::CoordinateMode) (j / 3)); + + QString name = QString::fromLatin1("-%1%2") + .arg(lg.spread()) + .arg(lg.coordinateMode()); + + lg.setFinalStop(100, 0); + m_brushes["hor-lingrad-w/b-brush" + name] = QBrush(lg); + + lg.setFinalStop(0, 100); + m_brushes["ver-lingrad-w/b-brush" + name] = QBrush(lg); + + lg.setFinalStop(100, 100); + m_brushes["diag-lingrad-w/b-brush" + name] = QBrush(lg); + + rg.setRadius(100); + rg.setCenter(0, 0); + rg.setFocalPoint(50, 50); + m_brushes["radgrad-brush" + name] = QBrush(rg); + + cg.setCenter(0, 0); + cg.setAngle(40); + m_brushes["congrad-brush" + name] = QBrush(cg); + } + } + + // Set up pens... + + +// m_pens["black-pen"] = QPen(Qt::black); +// m_pens["white-pen"] = QPen(Qt::white); +// m_pens["transparent-pen"] = QPen(QColor(255, 255, 255, 0)); +// m_pens["translucent1-pen"] = QPen(QColor(255, 255, 255, 100)); +// m_pens["translucent2-pen"] = QPen(QColor(255, 255, 255, 200)); + + + +} + + +// void QPainter_Primitives::fillRect_data() { + +// QTest::addColumn("brush"); +// QTest::addColumn("size"); + +// for (QMap::const_iterator it = m_brushes.constBegin(); +// it != m_brushes.constEnd(); ++it) { +// for (int w=2; w<1025; w*=2) { +// for (int h=2; h<1025; h*=2) { +// QTest::newRow(QString("brush=%1; size=[%2,%3]").arg(it.key()).arg(w).arg(h).toAscii().data()) +// << *it << QSize(w, h); +// } +// } +// } +// } + + + + + +// void QPainter_Primitives::fillRect() +// { +// QFETCH(QBrush, brush); +// QFETCH(QSize, size); + +// QImage img(1024, 1024, QImage::Format_ARGB32_Premultiplied); +// QPainter p(&img); +// p.setPen(Qt::NoPen); +// p.setBrush(brush); +// QRect rect(QPoint(0, 0), size); +// QBENCHMARK { +// p.drawRect(rect); +// } +// } + + + + +void tst_QPainter::beginAndEnd() +{ + QPixmap pixmap(100, 100); + + QBENCHMARK { + QPainter p; + p.begin(&pixmap); + p.end(); + } +} + +void tst_QPainter::drawLine() +{ + QFETCH(QLine, line); + QFETCH(QPen, pen); + + const int offset = 5; + QPixmap pixmapUnclipped(qMin(line.x1(), line.x2()) + + 2*offset + qAbs(line.dx()), + qMin(line.y1(), line.y2()) + + 2*offset + qAbs(line.dy())); + pixmapUnclipped.fill(Qt::white); + + QPainter p(&pixmapUnclipped); + p.translate(offset, offset); + p.setPen(pen); + p.paintEngine()->syncState(); + + QBENCHMARK { + p.drawLine(line); + } + + p.end(); + +} + +void tst_QPainter::drawLine_clipped_data() +{ + drawLine_data(); +} + +void tst_QPainter::drawLine_clipped() +{ + QFETCH(QLine, line); + QFETCH(QPen, pen); + + const int offset = 5; + QPixmap pixmapClipped(qMin(line.x1(), line.x2()) + + 2*offset + qAbs(line.dx()), + qMin(line.y1(), line.y2()) + + 2*offset + qAbs(line.dy())); + + const QRect clip = QRect(line.p1(), line.p2()).normalized(); + + pixmapClipped.fill(Qt::white); + QPainter p(&pixmapClipped); + p.translate(offset, offset); + p.setClipRect(clip); + p.setPen(pen); + p.paintEngine()->syncState(); + + QBENCHMARK { + p.drawLine(line); + } + + p.end(); +} + + +void tst_QPainter::drawLine_antialiased_clipped_data() +{ + drawLine_data(); +} + + +void tst_QPainter::drawLine_antialiased_clipped() +{ + QFETCH(QLine, line); + QFETCH(QPen, pen); + + const int offset = 5; + QPixmap pixmapClipped(qMin(line.x1(), line.x2()) + + 2*offset + qAbs(line.dx()), + qMin(line.y1(), line.y2()) + + 2*offset + qAbs(line.dy())); + + const QRect clip = QRect(line.p1(), line.p2()).normalized(); + + pixmapClipped.fill(Qt::white); + QPainter p(&pixmapClipped); + p.setRenderHint(QPainter::Antialiasing); + p.translate(offset, offset); + p.setClipRect(clip); + p.setPen(pen); + p.paintEngine()->syncState(); + + QBENCHMARK { + p.drawLine(line); + } + + p.end(); +} + +void tst_QPainter::drawPixmap_data() +{ + QTest::addColumn("sourceFormat"); + QTest::addColumn("targetFormat"); + QTest::addColumn("size"); + QTest::addColumn("type"); // 0 = circle, 1 = diag line, 2 = solid rect, 3 = alpharect + + QList sizes; + sizes << QSize(1, 1) + << QSize(10, 10) + << QSize(100, 100) + << QSize(1000, 1000); + + const char *typeNames[] = { + "circle", + "line", + "solidrect", + "alpharect" + }; + + const char *formatNames[] = { + "Invalid", + "Mono", + "MonoLSB", + "Indexed8", + "RGB32", + "ARGB32", + "ARGB32_pm", + "RGB16", + "ARGB8565_pm", + "RGB666", + "ARGB6666_pm", + "RGB555", + "ARGB8555_pm", + "RGB888", + "RGB444", + "ARGB4444_pm" + }; + + for (int tar=4; tar("mode"); + QTest::addColumn("size"); + QTest::addColumn("color"); + + const int n = QPainter::RasterOp_SourceAndNotDestination; + for (int i = 0; i <= n; ++i) { + QString title("%1:%2"); + QTest::newRow(qPrintable(title.arg(i).arg("10x10:opaque"))) + << (QPainter::CompositionMode)(i) + << QSize(10, 10) << QColor(255, 0, 0); + QTest::newRow(qPrintable(title.arg(i).arg("10x10:!opaque"))) + << (QPainter::CompositionMode)(i) + << QSize(10, 10) << QColor(127, 127, 127, 127); + QTest::newRow(qPrintable(title.arg(i).arg("300x300:opaque"))) + << (QPainter::CompositionMode)(i) + << QSize(300, 300) << QColor(255, 0, 0); + QTest::newRow(qPrintable(title.arg(i).arg("300x300:!opaque"))) + << (QPainter::CompositionMode)(i) + << QSize(300, 300) << QColor(127, 127, 127, 127); + } +} + +void tst_QPainter::compositionModes() +{ + QFETCH(QPainter::CompositionMode, mode); + QFETCH(QSize, size); + QFETCH(QColor, color); + + QPixmap src(size); + src.fill(color); + + QPixmap dest(size); + if (mode < QPainter::RasterOp_SourceOrDestination) + color.setAlpha(127); // porter-duff needs an alpha channel + dest.fill(color); + + QPainter p(&dest); + p.setCompositionMode(mode); + + QBENCHMARK { + p.drawPixmap(0, 0, src); + } +} + +void tst_QPainter::drawTiledPixmap_data() +{ + QTest::addColumn("srcSize"); + QTest::addColumn("dstSize"); + QTest::addColumn("transform"); + QTest::addColumn("color"); + QTest::addColumn("renderHint"); + + QTest::newRow("10x10=>20x20") + << QSize(10, 10) << QSize(20, 20) << (QTransform()) + << QColor(Qt::black) << QPainter::RenderHint(0); + QTest::newRow("10x10=>20x20, smooth") + << QSize(10, 10) << QSize(20, 20) << (QTransform()) + << QColor(Qt::black) << QPainter::SmoothPixmapTransform; + QTest::newRow("10x10=>20x20, !opaque") + << QSize(10, 10) << QSize(20, 20) << (QTransform()) + << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); + QTest::newRow("10x10=>20x20, !opaque, smooth") + << QSize(10, 10) << QSize(20, 20) << (QTransform()) + << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; + + QTest::newRow("10x10=>20x20, rotate(30)") + << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) + << QColor(Qt::black) << QPainter::RenderHint(0); + QTest::newRow("10x10=>20x20, rotate(30), smooth") + << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) + << QColor(Qt::black) << QPainter::SmoothPixmapTransform; + QTest::newRow("10x10=>20x20, rotate(30), !opaque") + << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) + << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); + QTest::newRow("10x10=>20x20, rotate(30), !opaque, smooth") + << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) + << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; + + QTest::newRow("100x100=>200x200") + << QSize(100, 100) << QSize(200, 200) << (QTransform()) + << QColor(Qt::black) << QPainter::RenderHint(0); + QTest::newRow("100x100=>200x200, smooth") + << QSize(100, 100) << QSize(200, 200) << (QTransform()) + << QColor(Qt::black) << QPainter::SmoothPixmapTransform; + QTest::newRow("100x100=>200x200, !opaque") + << QSize(100, 100) << QSize(200, 200) << (QTransform()) + << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); + QTest::newRow("100x100=>200x200, !opaque, smooth") + << QSize(100, 100) << QSize(200, 200) << (QTransform()) + << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; + + QTest::newRow("100x100=>200x200, rotate(30)") + << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) + << QColor(Qt::black) << QPainter::RenderHint(0); + QTest::newRow("100x100=>200x200, rotate(30), smooth") + << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) + << QColor(Qt::black) << QPainter::SmoothPixmapTransform; + QTest::newRow("100x100=>200x200, rotate(30), !opaque") + << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) + << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); + QTest::newRow("100x100=>200x200, rotate(30), !opaque, smooth") + << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) + << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; +} + +void tst_QPainter::drawTiledPixmap() +{ + QFETCH(QSize, srcSize); + QFETCH(QSize, dstSize); + QFETCH(QTransform, transform); + QFETCH(QColor, color); + QFETCH(QPainter::RenderHint, renderHint); + + QPixmap src(srcSize); + src.fill(color); + + const QRect dstRect = transform.mapRect(QRect(QPoint(), dstSize)); + QPixmap dst(dstRect.right() + 5, dstRect.bottom() + 5); + QPainter p(&dst); + p.setTransform(transform); + p.setRenderHint(renderHint); + + QBENCHMARK { + p.drawTiledPixmap(QRect(QPoint(), dstSize), src); + } +} + +void tst_QPainter::fillPrimitives_helper(QPainter *p, PrimitiveType type, PrimitiveSet *s) +{ + p->paintEngine()->syncState(); + + switch (type) { + case Primitive_Int_DiagLine: QBENCHMARK { p->drawLine(s->i_line_diag); } break; + case Primitive_Int_VerLine: QBENCHMARK { p->drawLine(s->i_line_ver); } break; + case Primitive_Int_HorLine: QBENCHMARK { p->drawLine(s->i_line_hor); } break; + case Primitive_Int_Rect: QBENCHMARK { p->drawRect(s->i_rect); } break; + case Primitive_Int_Ellipse: QBENCHMARK { p->drawEllipse(s->i_rect); } break; + case Primitive_Int_Pie: QBENCHMARK { p->drawPie(s->i_rect, 45*16, 270*16); } break; + case Primitive_Int_Arc: QBENCHMARK { p->drawArc(s->i_rect, 45*16, 270*16); } break; + case Primitive_Int_Chord: QBENCHMARK { p->drawChord(s->i_rect, 45*16, 270*16); } break; + case Primitive_Int_TriPoly: QBENCHMARK { p->drawPolygon(s->i_poly_tri); } break; + case Primitive_Int_RectPoly: QBENCHMARK { p->drawPolygon(s->i_poly_rect); } break; + case Primitive_Int_2RectPoly: QBENCHMARK { p->drawPolygon(s->i_poly_2rects); } break; + + case Primitive_Float_DiagLine: QBENCHMARK { p->drawLine(s->f_line_diag); } break; + case Primitive_Float_VerLine: QBENCHMARK { p->drawLine(s->f_line_ver); } break; + case Primitive_Float_HorLine: QBENCHMARK { p->drawLine(s->f_line_hor); } break; + case Primitive_Float_Rect: QBENCHMARK { p->drawRect(s->f_rect); } break; + case Primitive_Float_Ellipse: QBENCHMARK { p->drawEllipse(s->f_rect); } break; + case Primitive_Float_Pie: QBENCHMARK { p->drawPie(s->f_rect, 45*16, 270*16); } break; + case Primitive_Float_Arc: QBENCHMARK { p->drawArc(s->f_rect, 45*16, 270*16); } break; + case Primitive_Float_Chord: QBENCHMARK { p->drawChord(s->f_rect, 45*16, 270*16); } break; + case Primitive_Float_TriPoly: QBENCHMARK { p->drawPolygon(s->f_poly_tri); } break; + case Primitive_Float_RectPoly: QBENCHMARK { p->drawPolygon(s->f_poly_rect); } break; + case Primitive_Float_2RectPoly: QBENCHMARK { p->drawPolygon(s->f_poly_2rects); } break; + + case Primitive_Float_TriPath: QBENCHMARK { p->drawPath(s->f_path_tri); } break; + case Primitive_Float_RectPath: QBENCHMARK { p->drawPath(s->f_path_rect); } break; + case Primitive_Float_2RectPath: QBENCHMARK { p->drawPath(s->f_path_2rects); } break; + case Primitive_Float_EllipsePath: QBENCHMARK { p->drawPath(s->f_path_ellipse); } break; + } +} + +void tst_QPainter::drawPrimitives_data_helper(bool fancypens) +{ + QTest::addColumn("type"); + QTest::addColumn("aa"); + QTest::addColumn("dash"); + QTest::addColumn("width"); + + const char * const names[] = { + "IDLine", + "IVLine", + "IHLine", + "IRect", + "IElli", + "IPie", + "IArc", + "IChord", + "ITriPol", + "IRectPol", + "I2RectPol", + "FDLine", + "FVLine", + "FHLine", + "FRect", + "FElli", + "FPie", + "FArc", + "FChord", + "FTriPol", + "FRectPol", + "F2RectPol", + "FTriPa", + "FRectPa", + "F2RectPa", + "FElliPa" + }; + + if (fancypens) { + for (int dash=0; dash<2; ++dash) { + for (int width=0; width<=4; width+=4) { + for (int aa=0; aa<2; ++aa) { + for (int type=0; type("text"); + + QTest::newRow("a") << QString::fromLatin1("a"); + QTest::newRow("ab") << QString::fromLatin1("ab"); + QTest::newRow("abc") << QString::fromLatin1("abc"); + QTest::newRow("abcd") << QString::fromLatin1("abcd"); + QTest::newRow("abcde") << QString::fromLatin1("abcde"); + QTest::newRow("abcdef") << QString::fromLatin1("abcdef"); + QTest::newRow("abcdefg") << QString::fromLatin1("abcdefg"); +} + +void tst_QPainter::drawText() +{ + QFETCH(QString, text); + + QPainter p(m_surface); + + QBENCHMARK { + p.drawText(QPointF(5, 5), text); + } +} + +void tst_QPainter::saveRestore_data() +{ + QTest::addColumn("change"); + + for (int i=0; i<16; ++i) { + QString change = "change="; + if (i == 0) change += " none"; + if (i & ChangePen) change += " pen"; + if (i & ChangeBrush) change += " brush"; + if (i & ChangeClip) change += " clip"; + if (i & ChangeTransform) change += " xform"; + + QTest::newRow(change.toLatin1()) << i; + } +} + +void tst_QPainter::saveRestore() +{ + QFETCH(int, change); + + QPen pen(Qt::blue); + QBrush brush(Qt::green); + QRect r(100, 100, 100, 20); + + QPainter p(m_surface); + + p.setPen(Qt::NoPen); + p.setBrush(Qt::NoBrush); + + QBENCHMARK { + p.save(); + if (change & ChangePen) { p.setPen(pen); p.setPen(Qt::NoPen); } + if (change & ChangeBrush) { p.setBrush(brush); p.setBrush(Qt::NoBrush); } + if (change & ChangeClip) p.setClipRect(r); + if (change & ChangeTransform) { p.scale(3, 5); p.scale(1/3.0, 1/5.0); } + p.drawRect(0, 0, 1, 1); + p.restore(); + }; +} + +enum ClipType { + RectClipType, + RectPathClipType, + RectRegionClipType, + RegionClipType, + PathClipType +}; + +void tst_QPainter::clipAndFill_data() +{ + QTest::addColumn("type"); + + QTest::newRow("rect") << (int) RectClipType; + QTest::newRow("rectpath") << (int) RectPathClipType; + QTest::newRow("rectregion") << (int) RectRegionClipType; + QTest::newRow("ellipseRegion") << (int) RegionClipType; + QTest::newRow("ellipsePath") << (int) PathClipType; +} + + +void tst_QPainter::clipAndFill() +{ + QFETCH(int, type); + + QRegion region; + QPainterPath path; + QRectF rect; + + switch (type) { + case RectClipType: + rect = QRectF(100, 100, 100, 100); + break; + case RectPathClipType: + path.addRect(100, 100, 100, 100); + break; + case RectRegionClipType: + region = QRegion(100, 100, 100, 100); + break; + case RegionClipType: + region = QRegion(100, 100, 100, 100, QRegion::Ellipse); + break; + case PathClipType: + path.addEllipse(100, 100, 100, 100); + break; + } + + QPainter p(m_surface); + + p.setPen(Qt::NoPen); + p.setBrush(Qt::red); + + QBENCHMARK { + if (type == RectClipType) + p.setClipRect(rect); + else if (type == RectPathClipType || type == PathClipType) + p.setClipPath(path); + else + p.setClipRegion(region); + p.drawRect(110, 110, 10, 10); + } +} + +QTransform tst_QPainter::transformForAngle(qreal angle) +{ + const qreal inv_dist_to_plane = 1. / 1024.; + + QTransform transform; + + QTransform rotTrans; + rotTrans.translate(-40, 0); + QTransform rotTrans2; + rotTrans2.translate(40, 0); + + qreal rad = angle * 2. * M_PI / 360.; + qreal c = ::cos(rad); + qreal s = ::sin(rad); + + qreal x = 0; + qreal y = 80; + qreal z = 0; + + qreal len = x * x + y * y + z * z; + if (len != 1.) { + len = ::sqrt(len); + x /= len; + y /= len; + z /= len; + } + + QTransform rot(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane, + y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane, + 0, 0, 1); + + transform *= rotTrans; + transform *= rot; + transform *= rotTrans2; + + return transform; +} + +void tst_QPainter::drawRoundedRect() +{ + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10); + } +} + +void tst_QPainter::drawScaledRoundedRect() +{ + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + p.scale(3, 3); + + QBENCHMARK { + p.drawRoundedRect(10, 10, 80, 80, 10, 10); + } +} + +void tst_QPainter::drawTransformedRoundedRect() +{ + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawRoundedRect(100, 100, 80, 80, 10, 10); + } +} + +void tst_QPainter::drawAntialiasedRoundedRect() +{ + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10); + } +} + +void tst_QPainter::drawScaledAntialiasedRoundedRect_data() +{ + QTest::addColumn("scale"); + + for (float i = 0; i < 3; i += .1) + QTest::newRow(QString(QLatin1String("scale=%1")).arg(i).toLatin1()) << i; +} + +void tst_QPainter::drawScaledAntialiasedRoundedRect() +{ + QFETCH(float, scale); + + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + p.scale(scale, scale); + + QBENCHMARK { + p.drawRoundedRect(10, 10, 80, 80, 10, 10); + } +} + +void tst_QPainter::drawTransformedAntialiasedRoundedRect_data() +{ + QTest::addColumn("transform"); + + for (float angle = 0; angle < 360; angle += 10) + QTest::newRow(QString(QLatin1String("angle=%1")).arg(angle).toLatin1()) << transformForAngle(angle); +} + +void tst_QPainter::drawTransformedAntialiasedRoundedRect() +{ + QFETCH(QTransform, transform); + + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setPen(QPen(Qt::black, 1)); + p.setBrush(Qt::red); + + QBENCHMARK { + p.setWorldTransform(transform); + p.drawRoundedRect(100, 100, 80, 80, 10, 10); + } +} + +void tst_QPainter::drawImageRoundedRect() +{ + //setup image + const int radius = 10; + QImage rectImage(81, 81, QImage::Format_ARGB32_Premultiplied); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); + + //setup surface + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.drawImage(0,0, rectImage); + } +} + +void tst_QPainter::drawScaledImageRoundedRect_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QPainter::drawScaledImageRoundedRect() +{ + QFETCH(int, imageType); + + //setup image + const int radius = 10; + QImage rectImage(81, 81, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + p.scale(3, 3); + + QBENCHMARK { + p.drawImage(0,0, rectImage); + } +} + +void tst_QPainter::drawTransformedImageRoundedRect_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QPainter::drawTransformedImageRoundedRect() +{ + QFETCH(int, imageType); + + //setup image + const int radius = 10; + QImage rectImage(81, 81, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(100,100, rectImage); + } +} + +//code from QmlGraphicsRectangle for drawing rounded rects +void tst_QPainter::drawBorderPixmapRoundedRect() +{ + //setup image + const int pw = 1; + const int radius = 10; + QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + if (pw%2) + rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); + else + rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); + QPixmap rectPixmap = QPixmap::fromImage(rectImage); + + //setup surface + QImage surface(100, 100, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + const int pw = 2; + int width = 80; + int height = 80; + + int xOffset = (rectPixmap.width()-1)/2; + int yOffset = (rectPixmap.height()-1)/2; + Q_ASSERT(rectPixmap.width() == 2*xOffset + 1); + Q_ASSERT(rectPixmap.height() == 2*yOffset + 1); + + QMargins margins(xOffset, yOffset, xOffset, yOffset); + QTileRules rules(Qt::StretchTile, Qt::StretchTile); + //NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects + qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width+pw, height+pw), margins, rectPixmap, rectPixmap.rect(), margins, rules); + } +} + +void tst_QPainter::drawScaledBorderPixmapRoundedRect_data() +{ + QTest::addColumn("scale"); + QTest::addColumn("imageType"); + + for (float i = 0; i < 3; i += .1) + QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied; + //for (float i = 0; i < 3; i += .1) + // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied; +} + +//code from QmlGraphicsRectangle for drawing rounded rects +void tst_QPainter::drawScaledBorderPixmapRoundedRect() +{ + QFETCH(float, scale); + QFETCH(int, imageType); + + //setup image + const int pw = 1; + const int radius = 10; + QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + if (pw%2) + rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); + else + rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); + + QPixmap rectPixmap = QPixmap::fromImage(rectImage); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + p.scale(scale, scale); + + QBENCHMARK { + const int pw = 2; + int width = 80; + int height = 80; + + int xOffset = (rectPixmap.width()-1)/2; + int yOffset = (rectPixmap.height()-1)/2; + Q_ASSERT(rectPixmap.width() == 2*xOffset + 1); + Q_ASSERT(rectPixmap.height() == 2*yOffset + 1); + + QMargins margins(xOffset, yOffset, xOffset, yOffset); + QTileRules rules(Qt::StretchTile, Qt::StretchTile); + qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width+pw, height+pw), margins, rectPixmap, rectPixmap.rect(), margins, rules); + } +} + +void tst_QPainter::drawTransformedBorderPixmapRoundedRect_data() +{ + QTest::addColumn("transform"); + QTest::addColumn("imageType"); + + for (float angle = 0; angle < 360; angle += 10) + QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB32_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB32_Premultiplied; + //for (float angle = 0; angle < 360; angle += 10) + // QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB8565_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB8565_Premultiplied; + +} + +//code from QmlGraphicsRectangle for drawing rounded rects +void tst_QPainter::drawTransformedBorderPixmapRoundedRect() +{ + QFETCH(QTransform, transform); + QFETCH(int, imageType); + + //setup image + const int pw = 1; + const int radius = 10; + QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType); + rectImage.fill(0); + QPainter rp(&rectImage); + rp.setRenderHint(QPainter::Antialiasing); + rp.setPen(Qt::black); + rp.setBrush(Qt::red); + if (pw%2) + rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); + else + rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); + + QPixmap rectPixmap = QPixmap::fromImage(rectImage); + + //setup surface + QImage surface(400, 400, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(transform); + const int pw = 2; + int width = 80; + int height = 80; + + int xOffset = (rectPixmap.width()-1)/2; + int yOffset = (rectPixmap.height()-1)/2; + Q_ASSERT(rectPixmap.width() == 2*xOffset + 1); + Q_ASSERT(rectPixmap.height() == 2*yOffset + 1); + + QMargins margins(xOffset, yOffset, xOffset, yOffset); + QTileRules rules(Qt::StretchTile, Qt::StretchTile); + qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width+pw, height+pw), margins, rectPixmap, rectPixmap.rect(), margins, rules); + } +} + +void tst_QPainter::drawTransformedTransparentImage_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QPainter::drawTransformedTransparentImage() +{ + QFETCH(int, imageType); + + //setup image + QImage transImage(200, 200, (QImage::Format)imageType); + transImage.fill(0); + + //setup surface + QImage surface(200, 200, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(0,0, transImage); + } +} + +void tst_QPainter::drawTransformedSemiTransparentImage_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QPainter::drawTransformedSemiTransparentImage() +{ + QFETCH(int, imageType); + + //setup image + QImage transImage(200, 200, (QImage::Format)imageType); + transImage.fill(QColor(0,0,0, 128).rgba()); + + //setup surface + QImage surface(200, 200, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(0,0, transImage); + } +} + +void tst_QPainter::drawTransformedFilledImage_data() +{ + QTest::addColumn("imageType"); + + QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; + QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; +} + +void tst_QPainter::drawTransformedFilledImage() +{ + QFETCH(int, imageType); + + //setup image + QImage filledImage(200, 200, (QImage::Format)imageType); + filledImage.fill(QColor(0,0,0).rgb()); + + //setup surface + QImage surface(200, 200, QImage::Format_RGB16); + surface.fill(QColor(255,255,255).rgb()); + QPainter p(&surface); + + QBENCHMARK { + p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); + p.drawImage(0,0, filledImage); + } +} + + +QTEST_MAIN(tst_QPainter) + +#include "tst_qpainter.moc" diff --git a/tests/benchmarks/gui/painting/qregion/main.cpp b/tests/benchmarks/gui/painting/qregion/main.cpp new file mode 100644 index 0000000..3d16e41 --- /dev/null +++ b/tests/benchmarks/gui/painting/qregion/main.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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 QRegion functions. + +#include +#include + +class tst_qregion : public QObject +{ + Q_OBJECT +private slots: + void map_data(); + void map(); +}; + + +void tst_qregion::map_data() +{ + QTest::addColumn("region"); + + { + QRegion region(0, 0, 100, 100); + QTest::newRow("single rect") << region; + } + { + QRegion region; + region = region.united(QRect(0, 0, 100, 100)); + region = region.united(QRect(120, 20, 100, 100)); + + QTest::newRow("two rects") << region; + } + { + QRegion region(0, 0, 100, 100, QRegion::Ellipse); + QTest::newRow("ellipse") << region; + } +} + +void tst_qregion::map() +{ + QFETCH(QRegion, region); + + QTransform transform; + transform.rotate(30); + QBENCHMARK { + transform.map(region); + } +} + +QTEST_MAIN(tst_qregion) + +#include "main.moc" diff --git a/tests/benchmarks/gui/painting/qregion/qregion.pro b/tests/benchmarks/gui/painting/qregion/qregion.pro new file mode 100644 index 0000000..fc67177 --- /dev/null +++ b/tests/benchmarks/gui/painting/qregion/qregion.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qregion +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/painting/qtransform/qtransform.pro b/tests/benchmarks/gui/painting/qtransform/qtransform.pro new file mode 100644 index 0000000..8d87656 --- /dev/null +++ b/tests/benchmarks/gui/painting/qtransform/qtransform.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qtransform + +SOURCES += tst_qtransform.cpp + diff --git a/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp b/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp new file mode 100644 index 0000000..b33cf58 --- /dev/null +++ b/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp @@ -0,0 +1,592 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//TESTED_FILES= + +class tst_QTransform : public QObject +{ + Q_OBJECT + +public: + tst_QTransform(); + virtual ~tst_QTransform(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void translate_data(); + void translate(); + void scale_data(); + void scale(); + void shear_data(); + void shear(); + void rotate_data(); + void rotate(); + void rotateXYZ_data(); + void rotateXYZ(); + void operatorAssign_data(); + void operatorAssign(); + void operatorEqual_data(); + void operatorEqual(); + void operatorNotEqual_data(); + void operatorNotEqual(); + void operatorMultiply_data(); + void operatorMultiply(); + void operatorPlusEqualScalar_data(); + void operatorPlusEqualScalar(); + void operatorMinusEqualScalar_data(); + void operatorMinusEqualScalar(); + void operatorMultiplyEqual_data(); + void operatorMultiplyEqual(); + void operatorMultiplyEqualScalar_data(); + void operatorMultiplyEqualScalar(); + void operatorDivideEqualScalar_data(); + void operatorDivideEqualScalar(); + void mapQPoint_data(); + void mapQPoint(); + void mapQPointF_data(); + void mapQPointF(); + void mapRect_data(); + void mapRect(); + void mapRectF_data(); + void mapRectF(); + void mapQPolygon_data(); + void mapQPolygon(); + void mapQPolygonF_data(); + void mapQPolygonF(); + void mapQRegion_data(); + void mapQRegion(); + void mapToPolygon_data(); + void mapToPolygon(); + void mapQPainterPath_data(); + void mapQPainterPath(); + void isIdentity_data(); + void isIdentity(); + void isAffine_data(); + void isAffine(); + void isInvertible_data(); + void isInvertible(); + void isRotating_data(); + void isRotating(); + void isScaling_data(); + void isScaling(); + void isTranslating_data(); + void isTranslating(); + void type_data(); + void type(); + void determinant_data(); + void determinant(); + void adjoint_data(); + void adjoint(); + void transposed_data(); + void transposed(); + void inverted_data(); + void inverted(); + +private: + QMap generateTransforms() const; +}; + +tst_QTransform::tst_QTransform() +{ +} + +tst_QTransform::~tst_QTransform() +{ +} + +void tst_QTransform::init() +{ +} + +void tst_QTransform::cleanup() +{ +} + +QMap tst_QTransform::generateTransforms() const +{ + QMap x; + x["0: identity"] = QTransform(); + x["1: translate"] = QTransform().translate(10, 10); + x["2: translate"] = QTransform().translate(-10, -10); + x["3: rotate45"] = QTransform().rotate(45); + x["4: rotate90"] = QTransform().rotate(90); + x["5: rotate180"] = QTransform().rotate(180); + x["6: shear2,2"] = QTransform().shear(2, 2); + x["7: shear-2,-2"] = QTransform().shear(-2, -2); + x["8: scaleUp2,2"] = QTransform().scale(2, 2); + x["9: scaleUp2,3"] = QTransform().scale(2, 3); + x["10: scaleDown0.5,0.5"] = QTransform().scale(0.5, 0.5); + x["11: scaleDown0.5,0.25"] = QTransform().scale(0.5, 0.25); + x["12: rotateX"] = QTransform().rotate(45, Qt::XAxis); + x["13: rotateY"] = QTransform().rotate(45, Qt::YAxis); + x["14: rotateXY"] = QTransform().rotate(45, Qt::XAxis).rotate(45, Qt::YAxis); + x["15: rotateYZ"] = QTransform().rotate(45, Qt::YAxis).rotate(45, Qt::ZAxis); + x["16: full"] = QTransform().translate(10, 10).rotate(45).shear(2, 2).scale(2, 2).rotate(45, Qt::YAxis).rotate(45, Qt::XAxis).rotate(45, Qt::ZAxis); + return x; +} + +void tst_QTransform::construct() +{ + QBENCHMARK { + QTransform x; + } +} + +#define SINGLE_DATA_IMPLEMENTATION(func) \ +void tst_QTransform::func##_data() \ +{ \ + QTest::addColumn("transform"); \ + QMap x = generateTransforms(); \ + QMapIterator it(x); \ + while (it.hasNext()) { \ + it.next(); \ + QTest::newRow(it.key()) << it.value(); \ + } \ +} + +#define DOUBLE_DATA_IMPLEMENTATION(func) \ +void tst_QTransform::func##_data() \ +{ \ + QTest::addColumn("x1"); \ + QTest::addColumn("x2"); \ + QMap x = generateTransforms(); \ + QMapIterator it(x); \ + while (it.hasNext()) { \ + it.next(); \ + const char *key1 = it.key(); \ + QTransform x1 = it.value(); \ + QMapIterator it2(x); \ + while (it2.hasNext()) { \ + it2.next(); \ + QTest::newRow(QString("%1 + %2").arg(key1).arg(it2.key()).toLatin1().constData()) \ + << x1 << it2.value(); \ + } \ + } \ +} + +SINGLE_DATA_IMPLEMENTATION(translate) + +void tst_QTransform::translate() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.translate(10, 10); + } +} + +SINGLE_DATA_IMPLEMENTATION(scale) + +void tst_QTransform::scale() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.scale(2, 2); + } +} + +SINGLE_DATA_IMPLEMENTATION(shear) + +void tst_QTransform::shear() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.shear(2, 2); + } +} + +SINGLE_DATA_IMPLEMENTATION(rotate) + +void tst_QTransform::rotate() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.rotate(45); + } +} + +SINGLE_DATA_IMPLEMENTATION(rotateXYZ) + +void tst_QTransform::rotateXYZ() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.rotate(45, Qt::XAxis); + x.rotate(45, Qt::YAxis); + x.rotate(45, Qt::ZAxis); + } +} + +DOUBLE_DATA_IMPLEMENTATION(operatorAssign) + +void tst_QTransform::operatorAssign() +{ + QFETCH(QTransform, x1); + QFETCH(QTransform, x2); + QTransform x = x1; + QBENCHMARK { + x = x2; + } +} + +DOUBLE_DATA_IMPLEMENTATION(operatorEqual) + +void tst_QTransform::operatorEqual() +{ + QFETCH(QTransform, x1); + QFETCH(QTransform, x2); + QTransform x = x1; + QBENCHMARK { + x == x2; + } +} + +DOUBLE_DATA_IMPLEMENTATION(operatorNotEqual) + +void tst_QTransform::operatorNotEqual() +{ + QFETCH(QTransform, x1); + QFETCH(QTransform, x2); + QTransform x = x1; + QBENCHMARK { + x != x2; + } +} + +DOUBLE_DATA_IMPLEMENTATION(operatorMultiply) + +void tst_QTransform::operatorMultiply() +{ + QFETCH(QTransform, x1); + QFETCH(QTransform, x2); + QTransform x = x1; + QBENCHMARK { + x * x2; + } +} + +SINGLE_DATA_IMPLEMENTATION(operatorPlusEqualScalar) + +void tst_QTransform::operatorPlusEqualScalar() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x += 3.14; + } +} + +SINGLE_DATA_IMPLEMENTATION(operatorMinusEqualScalar) + +void tst_QTransform::operatorMinusEqualScalar() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x -= 3.14; + } +} + +DOUBLE_DATA_IMPLEMENTATION(operatorMultiplyEqual) + +void tst_QTransform::operatorMultiplyEqual() +{ + QFETCH(QTransform, x1); + QFETCH(QTransform, x2); + QTransform x = x1; + QBENCHMARK { + x *= x2; + } +} + +SINGLE_DATA_IMPLEMENTATION(operatorMultiplyEqualScalar) + +void tst_QTransform::operatorMultiplyEqualScalar() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x * 3; + } +} + +SINGLE_DATA_IMPLEMENTATION(operatorDivideEqualScalar) + +void tst_QTransform::operatorDivideEqualScalar() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x /= 3; + } +} + +SINGLE_DATA_IMPLEMENTATION(mapQPoint) + +void tst_QTransform::mapQPoint() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.map(QPoint(3, 3)); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapQPointF) + +void tst_QTransform::mapQPointF() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.map(QPointF(3, 3)); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapRect) + +void tst_QTransform::mapRect() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.mapRect(QRect(0, 0, 100, 100)); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapRectF) + +void tst_QTransform::mapRectF() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.mapRect(QRectF(0, 0, 100, 100)); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapQPolygon) + +void tst_QTransform::mapQPolygon() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QPolygon poly = QPolygon(QRect(0, 0, 100, 100)); + QBENCHMARK { + x.map(poly); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapQPolygonF) + +void tst_QTransform::mapQPolygonF() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QPolygonF poly = QPolygonF(QRectF(0, 0, 100, 100)); + QBENCHMARK { + x.map(poly); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapQRegion) + +void tst_QTransform::mapQRegion() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QRegion region; + for (int i = 0; i < 10; ++i) + region += QRect(i * 10, i * 10, 100, 100); + QBENCHMARK { + x.map(region); + } +} + +SINGLE_DATA_IMPLEMENTATION(mapToPolygon) + +void tst_QTransform::mapToPolygon() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QBENCHMARK { + x.mapToPolygon(QRect(0, 0, 100, 100)); + } +} + + +SINGLE_DATA_IMPLEMENTATION(mapQPainterPath) + +void tst_QTransform::mapQPainterPath() +{ + QFETCH(QTransform, transform); + QTransform x = transform; + QPainterPath path; + for (int i = 0; i < 10; ++i) + path.addEllipse(i * 10, i * 10, 100, 100); + QBENCHMARK { + x.map(path); + } +} + +SINGLE_DATA_IMPLEMENTATION(isIdentity) + +void tst_QTransform::isIdentity() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.isIdentity(); + } +} + +SINGLE_DATA_IMPLEMENTATION(isAffine) + +void tst_QTransform::isAffine() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.isAffine(); + } +} + +SINGLE_DATA_IMPLEMENTATION(isInvertible) + +void tst_QTransform::isInvertible() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.isInvertible(); + } +} + +SINGLE_DATA_IMPLEMENTATION(isRotating) + +void tst_QTransform::isRotating() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.isRotating(); + } +} + +SINGLE_DATA_IMPLEMENTATION(isScaling) + +void tst_QTransform::isScaling() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.isScaling(); + } +} + +SINGLE_DATA_IMPLEMENTATION(isTranslating) + +void tst_QTransform::isTranslating() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.isTranslating(); + } +} + +SINGLE_DATA_IMPLEMENTATION(type) + +void tst_QTransform::type() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.type(); + } +} + +SINGLE_DATA_IMPLEMENTATION(determinant) + +void tst_QTransform::determinant() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.determinant(); + } +} + +SINGLE_DATA_IMPLEMENTATION(adjoint) + +void tst_QTransform::adjoint() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.adjoint(); + } +} + +SINGLE_DATA_IMPLEMENTATION(transposed) + +void tst_QTransform::transposed() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.transposed(); + } +} + +SINGLE_DATA_IMPLEMENTATION(inverted) + +void tst_QTransform::inverted() +{ + QFETCH(QTransform, transform); + QBENCHMARK { + transform.inverted(); + } +} + +QTEST_MAIN(tst_QTransform) +#include "tst_qtransform.moc" diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp new file mode 100644 index 0000000..226b661 --- /dev/null +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp @@ -0,0 +1,192 @@ +/**************************************************************************** +** +** 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 QRect/QRectF functions. + +#include +#include + +class tst_qstylesheetstyle : public QObject +{ + Q_OBJECT +private slots: + void empty(); + void empty_events(); + + void simple(); + void simple_events(); + + void grid_data(); + void grid(); + +private: + QWidget *buildSimpleWidgets(); + +}; + + +QWidget *tst_qstylesheetstyle::buildSimpleWidgets() +{ + QWidget *w = new QWidget(); + QGridLayout *layout = new QGridLayout(w); + w->setLayout(layout); + layout->addWidget(new QPushButton("pushButton") ,0,0); + layout->addWidget(new QComboBox() ,0,1); + layout->addWidget(new QCheckBox("checkBox") ,0,2); + layout->addWidget(new QRadioButton("radioButton") ,0,3); + layout->addWidget(new QLineEdit() ,1,0); + layout->addWidget(new QLabel("label") ,1,1); + layout->addWidget(new QSpinBox() ,1,2); + layout->addWidget(new QProgressBar() ,1,3); + return w; +} + +void tst_qstylesheetstyle::empty() +{ + QWidget *w = buildSimpleWidgets(); + w->setStyleSheet("/* */"); + int i = 0; + QBENCHMARK { + w->setStyleSheet("/*" + QString::number(i) + "*/"); + i++; // we want a different string in case we have severals iterations + } + delete w; +} + +void tst_qstylesheetstyle::empty_events() +{ + QWidget *w = buildSimpleWidgets(); + w->setStyleSheet("/* */"); + int i = 0; + QBENCHMARK { + w->setStyleSheet("/*" + QString::number(i) + "*/"); + i++; // we want a different string in case we have severals iterations + qApp->processEvents(); + } + delete w; +} + +static const char *simple_css = + " QLineEdit { background: red; } QPushButton { border: 1px solid yellow; color: pink; } \n" + " QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n" + " QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; } "; + +void tst_qstylesheetstyle::simple() +{ + QWidget *w = buildSimpleWidgets(); + w->setStyleSheet("/* */"); + int i = 0; + QBENCHMARK { + w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); + i++; // we want a different string in case we have severals iterations + } + delete w; +} + +void tst_qstylesheetstyle::simple_events() +{ + QWidget *w = buildSimpleWidgets(); + w->setStyleSheet("/* */"); + int i = 0; + QBENCHMARK { + w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); + i++; // we want a different string in case we have severals iterations + qApp->processEvents(); + } + delete w; +} + +void tst_qstylesheetstyle::grid_data() +{ + QTest::addColumn("events"); + QTest::addColumn("show"); + QTest::addColumn("N"); + for (int n = 5; n <= 25; n += 5) { + const QByteArray nString = QByteArray::number(n*n); + QTest::newRow(("simple--" + nString).constData()) << false << false << n; + QTest::newRow(("events--" + nString).constData()) << true << false << n; + QTest::newRow(("show--" + nString).constData()) << true << true << n; + } +} + + +void tst_qstylesheetstyle::grid() +{ + QFETCH(bool, events); + QFETCH(bool, show); + QFETCH(int, N); + +#ifdef Q_OS_SYMBIAN + // Symbian has limited stack (max 80k), which will run out when N >= 20 due to + // QWidget::show() using recursion among grid labels somewhere down the line. + if (show && N >= 20) + QSKIP("Grid too big for device to show", SkipSingle); +#endif + + QWidget *w = new QWidget(); + QGridLayout *layout = new QGridLayout(w); + w->setLayout(layout); + QString stylesheet; + for(int x=0; xaddWidget(label ,x,y); + label->setObjectName(QString("label%1").arg(y * N + x)); + stylesheet += QString("#label%1 { background-color: rgb(0,%2,%3); color: rgb(%2,%3,255); } ").arg(y*N+x).arg(y*255/N).arg(x*255/N); + } + + w->setStyleSheet("/* */"); + if(show) { + w->show(); + QTest::qWait(30); + } + int i = 0; + QBENCHMARK { + w->setStyleSheet(stylesheet + "/*" + QString::number(i) + "*/"); + i++; // we want a different string in case we have severals iterations + if(events) + qApp->processEvents(); + } + delete w; +} + +QTEST_MAIN(tst_qstylesheetstyle) + +#include "main.moc" diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro new file mode 100644 index 0000000..c097307 --- /dev/null +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qstylesheetstyle +DEPENDPATH += . +INCLUDEPATH += . + + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/styles/styles.pro b/tests/benchmarks/gui/styles/styles.pro new file mode 100644 index 0000000..7c1d069 --- /dev/null +++ b/tests/benchmarks/gui/styles/styles.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qstylesheetstyle diff --git a/tests/benchmarks/gui/text/qfontmetrics/main.cpp b/tests/benchmarks/gui/text/qfontmetrics/main.cpp new file mode 100644 index 0000000..d3f85ef --- /dev/null +++ b/tests/benchmarks/gui/text/qfontmetrics/main.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include + +//this test benchmarks the once-off (per font configuration) cost +//associated with using QFontMetrics +class tst_QFontMetrics : public QObject +{ + Q_OBJECT +public: + tst_QFontMetrics() {} +private slots: + void fontmetrics_create(); + void fontmetrics_create_once_loaded(); + + void fontmetrics_height(); + void fontmetrics_height_once_loaded(); + +private: + void testQFontMetrics(const QFontMetrics &fm); +}; + +void tst_QFontMetrics::testQFontMetrics( const QFontMetrics &fm ) +{ + int fontHeight = fm.height(); +} + +void tst_QFontMetrics::fontmetrics_create() +{ + QBENCHMARK { + QFont boldfont = QApplication::font(); + boldfont.setBold( true ); + boldfont.setPointSize(boldfont.pointSize() * 1.5 ); + QFontMetrics bfm( boldfont ); + } +} + +void tst_QFontMetrics::fontmetrics_create_once_loaded() +{ + QBENCHMARK { + QFont boldfont = QApplication::font(); + boldfont.setBold( true ); + boldfont.setPointSize(boldfont.pointSize() * 1.5 ); + QFontMetrics bfm( boldfont ); + } +} + +void tst_QFontMetrics::fontmetrics_height() +{ + QFont boldfont = QApplication::font(); + boldfont.setBold( true ); + boldfont.setPointSize(boldfont.pointSize() * 1.5 ); + QFontMetrics bfm( boldfont ); + + QBENCHMARK { testQFontMetrics(bfm); } +} + +void tst_QFontMetrics::fontmetrics_height_once_loaded() +{ + QFont boldfont = QApplication::font(); + boldfont.setBold( true ); + boldfont.setPointSize(boldfont.pointSize() * 1.5 ); + QFontMetrics bfm( boldfont ); + QBENCHMARK { testQFontMetrics(bfm); } +} + +QTEST_MAIN(tst_QFontMetrics) + +#include "main.moc" diff --git a/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro b/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro new file mode 100644 index 0000000..b6c7b92 --- /dev/null +++ b/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_QFontMetrics + +SOURCES += main.cpp diff --git a/tests/benchmarks/gui/text/qtext/bidi.txt b/tests/benchmarks/gui/text/qtext/bidi.txt new file mode 100644 index 0000000..7c74cb4 --- /dev/null +++ b/tests/benchmarks/gui/text/qtext/bidi.txt @@ -0,0 +1,4 @@ +chinese +欧洲,软件+互è”网 
 ç”¨ç»Ÿä¸€ç  (Unicode) èµ°é世界
将于1997å¹´ 3 月10æ—¥ï¼12日在德国 Mainz 市举行的第å届统一ç å›½é™…研讨会现在开始注册。 本次会议将汇集å„æ–¹é¢çš„专家。 涉åŠçš„领域包括: 国际互è”ç½‘å’Œç»Ÿä¸€ç  ï¼Œå›½é™…åŒ–å’Œæœ¬åœ°åŒ– ,统一ç åœ¨æ“作系统和应用软件中的实现 ,字型 ,文本格å¼ä»¥åŠå¤šæ–‡ç§è®¡ç®—等。 
当世界需è¦æ²Ÿé€šæ—¶ï¼Œè¯·ç”¨Unicodeï¼ +hebrew-bidi +×ײר×ָפּע: פּר×ָגר×ַמװ×ַרג ×ון די װעלטנעץ: ×וניק×ָד ×יבער דער ×’×ָרער װעלט פֿ×ַרשרײַבט זיך שױן ××±×£ דער צענטער ×ינטערנ×ַצי×ָנ×ַלער ×וניק×ָד-ק×ָנפֿערענץ, ×°×ָס װעט פֿ×ָרקומען ×“×¢× 10טן ביזן 12טן מ×ַרץ, 1997, ×ין מײַנץ, דײַטשל×ַנד. די ק×ָנפֿערענץ װעט צוז×ַמענברענגן ×ž×‘Ö¿×™× ×™× ×¤Ö¿×•×Ÿ װעלטנעץ, ×וניק×ָד, ××™ ×ַלװעלטלעכן ××™ סבֿיבֿהדיקן פּר×ָגר×ַמװ×ַרג, ×ַרײַנשטעלן ×וניק×ָד ×ין ×ָפּעריר-סיסטעמען ×ון ×ָנװענדונגען, שריפֿטן, טעקסט-×ױסשטעל, ×ון מערשפּר×ַכיקע ק×ָמפּיוטערײַ. diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp new file mode 100644 index 0000000..d4f3165 --- /dev/null +++ b/tests/benchmarks/gui/text/qtext/main.cpp @@ -0,0 +1,415 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + +Q_DECLARE_METATYPE(QTextDocument*) + +class tst_QText: public QObject +{ + Q_OBJECT +public: + tst_QText() { + m_lorem = QString::fromLatin1("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."); + m_shortLorem = QString::fromLatin1("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."); + } + +private slots: + void loadHtml_data(); + void loadHtml(); + + void shaping_data(); + void shaping(); + + void odfWriting_empty(); + void odfWriting_text(); + void odfWriting_images(); + + void constructControl(); + void constructDocument(); + + void layout(); + void paintLayoutToPixmap(); + void paintLayoutToPixmap_painterFill(); + + void document(); + void paintDocToPixmap(); + void paintDocToPixmap_painterFill(); + + void control(); + void paintControlToPixmap(); + void paintControlToPixmap_painterFill(); + +private: + QSize setupTextLayout(QTextLayout *layout); + + QString m_lorem; + QString m_shortLorem; +}; + +void tst_QText::loadHtml_data() +{ + QTest::addColumn("source"); + QTest::newRow("empty") << QString(); + QTest::newRow("simple") << QString::fromLatin1("Foo"); + QTest::newRow("simple2") << QString::fromLatin1("Foo"); + + QString parag = QString::fromLatin1("

%1

").arg(m_lorem); + QString header = QString::fromLatin1("test"); + QTest::newRow("long") << QString::fromLatin1("test") + parag + parag + parag + + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + + QString::fromLatin1(""); + QTest::newRow("table") << header + QLatin1String("
xx
") + + parag + QLatin1String("
xx") + + parag; +} + +void tst_QText::loadHtml() +{ + QFETCH(QString, source); + QTextDocument doc; + QBENCHMARK { + doc.setHtml(source); + } +} + +void tst_QText::shaping_data() +{ + QTest::addColumn("parag"); + QTest::newRow("empty") << QString(); + QTest::newRow("lorem") << m_lorem; + QTest::newRow("short") << QString::fromLatin1("Lorem ipsum dolor sit amet"); + +#if !defined(Q_OS_SYMBIAN) + QFile file(QString::fromLatin1(SRCDIR) + QLatin1String("/bidi.txt")); +#else + QFile file( SRCDIR "bidi.txt" ); +#endif + QVERIFY(file.open(QFile::ReadOnly)); + QByteArray data = file.readAll(); + QVERIFY(data.count() > 1000); + QStringList list = QString::fromUtf8(data.data()).split(QLatin1Char('\n'), QString::SkipEmptyParts); + QVERIFY(list.count() %2 == 0); // even amount as we have title and then content. + for (int i=0; i < list.count(); i+=2) { + QTest::newRow(list.at(i).toLatin1()) << list.at(i+1); + } +} + +void tst_QText::shaping() +{ + QFETCH(QString, parag); + + QTextLayout lay(parag); + lay.setCacheEnabled(false); + + // do one run to make sure any fonts are loaded. + lay.beginLayout(); + lay.createLine(); + lay.endLayout(); + + QBENCHMARK { + lay.beginLayout(); + lay.createLine(); + lay.endLayout(); + } +} + +void tst_QText::odfWriting_empty() +{ + QVERIFY(QTextDocumentWriter::supportedDocumentFormats().contains("ODF")); // odf compiled in + QTextDocument *doc = new QTextDocument(); + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +void tst_QText::odfWriting_text() +{ + QTextDocument *doc = new QTextDocument(); + QTextCursor cursor(doc); + QTextBlockFormat bf; + bf.setIndent(2); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + bf.setTopMargin(10); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + bf.setRightMargin(30); + cursor.insertBlock(bf); + cursor.insertText(m_lorem); + + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +void tst_QText::odfWriting_images() +{ + QTextDocument *doc = new QTextDocument(); + QTextCursor cursor(doc); + cursor.insertText(m_lorem); + QImage image(400, 200, QImage::Format_ARGB32_Premultiplied); + cursor.insertImage(image); + cursor.insertText(m_lorem); + + // write it + QBENCHMARK { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QTextDocumentWriter writer(&buffer, "ODF"); + writer.write(doc); + } + delete doc; +} + +QSize tst_QText::setupTextLayout(QTextLayout *layout) +{ + bool wrap = true; + int wrapWidth = 300; + layout->setCacheEnabled(true); + + int height = 0; + qreal widthUsed = 0; + qreal lineWidth = 0; + + //set manual width + if (wrap) + lineWidth = wrapWidth; + + layout->beginLayout(); + + while (1) { + QTextLine line = layout->createLine(); + if (!line.isValid()) + break; + + if (wrap) + line.setLineWidth(lineWidth); + } + layout->endLayout(); + + for (int i = 0; i < layout->lineCount(); ++i) { + QTextLine line = layout->lineAt(i); + widthUsed = qMax(widthUsed, line.naturalTextWidth()); + line.setPosition(QPointF(0, height)); + height += int(line.height()); + } + return QSize(qCeil(widthUsed), height); +} + +void tst_QText::constructControl() +{ + QTextControl *control = new QTextControl; + delete control; + + QBENCHMARK { + QTextControl *control = new QTextControl; + delete control; + } +} + +void tst_QText::constructDocument() +{ + QTextDocument *doc = new QTextDocument; + delete doc; + + QBENCHMARK { + QTextDocument *doc = new QTextDocument; + delete doc; + } +} + +void tst_QText::layout() +{ + QTextLayout layout(m_shortLorem); + setupTextLayout(&layout); + + QBENCHMARK { + QTextLayout layout(m_shortLorem); + setupTextLayout(&layout); + } +} + +void tst_QText::paintLayoutToPixmap() +{ + QTextLayout layout(m_shortLorem); + QSize size = setupTextLayout(&layout); + + QBENCHMARK { + QPixmap img(size); + img.fill(Qt::transparent); + QPainter p(&img); + layout.draw(&p, QPointF(0, 0)); + } +} + +void tst_QText::paintLayoutToPixmap_painterFill() +{ + QTextLayout layout(m_shortLorem); + QSize size = setupTextLayout(&layout); + + QBENCHMARK { + QPixmap img(size); + QPainter p(&img); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + layout.draw(&p, QPointF(0, 0)); + } +} + +void tst_QText::document() +{ + QTextDocument *doc = new QTextDocument; + + QBENCHMARK { + QTextDocument *doc = new QTextDocument; + doc->setHtml(m_shortLorem); + } +} + +void tst_QText::paintDocToPixmap() +{ + QTextDocument *doc = new QTextDocument; + doc->setHtml(m_shortLorem); + doc->setTextWidth(300); + QSize size = doc->size().toSize(); + + QBENCHMARK { + QPixmap img(size); + img.fill(Qt::transparent); + QPainter p(&img); + doc->drawContents(&p); + } +} + +void tst_QText::paintDocToPixmap_painterFill() +{ + QTextDocument *doc = new QTextDocument; + doc->setHtml(m_shortLorem); + doc->setTextWidth(300); + QSize size = doc->size().toSize(); + + QBENCHMARK { + QPixmap img(size); + QPainter p(&img); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + doc->drawContents(&p); + } +} + +void tst_QText::control() +{ + QTextControl *control = new QTextControl(m_shortLorem); + + QBENCHMARK { + QTextControl *control = new QTextControl; + QTextDocument *doc = control->document(); + doc->setHtml(m_shortLorem); + } +} + +void tst_QText::paintControlToPixmap() +{ + QTextControl *control = new QTextControl; + QTextDocument *doc = control->document(); + doc->setHtml(m_shortLorem); + doc->setTextWidth(300); + QSize size = doc->size().toSize(); + + QBENCHMARK { + QPixmap img(size); + img.fill(Qt::transparent); + QPainter p(&img); + control->drawContents(&p, QRectF(QPointF(0, 0), QSizeF(size))); + } +} + +void tst_QText::paintControlToPixmap_painterFill() +{ + QTextControl *control = new QTextControl; + QTextDocument *doc = control->document(); + doc->setHtml(m_shortLorem); + doc->setTextWidth(300); + QSize size = doc->size().toSize(); + + QBENCHMARK { + QPixmap img(size); + QPainter p(&img); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + control->drawContents(&p, QRectF(QPointF(0, 0), QSizeF(size))); + } +} + +QTEST_MAIN(tst_QText) + +#include "main.moc" diff --git a/tests/benchmarks/gui/text/qtext/qtext.pro b/tests/benchmarks/gui/text/qtext/qtext.pro new file mode 100644 index 0000000..9e8860f --- /dev/null +++ b/tests/benchmarks/gui/text/qtext/qtext.pro @@ -0,0 +1,14 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_QText + +SOURCES += main.cpp + +symbian* { + TARGET.CAPABILITY = ALL -TCB + addFiles.sources = bidi.txt + addFiles.path = . + DEPLOYMENT += addFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} \ No newline at end of file diff --git a/tests/benchmarks/gui/text/text.pro b/tests/benchmarks/gui/text/text.pro new file mode 100644 index 0000000..34e548b --- /dev/null +++ b/tests/benchmarks/gui/text/text.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qfontmetrics \ + qtext diff --git a/tests/benchmarks/network/access/access.pro b/tests/benchmarks/network/access/access.pro new file mode 100644 index 0000000..43357e2 --- /dev/null +++ b/tests/benchmarks/network/access/access.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qfile_vs_qnetworkaccessmanager \ + qnetworkreply diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp new file mode 100644 index 0000000..23e07db --- /dev/null +++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../auto/network-settings.h" + +class qfile_vs_qnetworkaccessmanager : public QObject +{ + Q_OBJECT + // do not use on symbian.. 100 MB is too large.. + // but.. this is a manual test anyway, so :) +protected: + void qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); + void qnamImmediateFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); + void qfileFileRead_iteration(); + static const int iterations = 10; + +private slots: + void qnamFileRead(); + void qnamImmediateFileRead(); + void qfileFileRead(); + + void initTestCase(); + void cleanupTestCase(); + +public: + qint64 size; + QTemporaryFile testFile; + + qfile_vs_qnetworkaccessmanager() : QObject(), size(0) {}; +}; + +void qfile_vs_qnetworkaccessmanager::initTestCase() +{ + testFile.open(); + QByteArray qba(1*1024*1024, 'x'); // 1 MB + for (int i = 0; i < 100; i++) { + testFile.write(qba); + testFile.flush(); + size += qba.size(); + } // 100 MB + testFile.reset(); +} + +void qfile_vs_qnetworkaccessmanager::cleanupTestCase() +{ + +} + +void qfile_vs_qnetworkaccessmanager::qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request) +{ + QNetworkReply* reply = manager.get(request); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QByteArray qba = reply->readAll(); + delete reply; +} + +void qfile_vs_qnetworkaccessmanager::qnamFileRead() +{ + QNetworkAccessManager manager; + QTime t; + QNetworkRequest request(QUrl(testFile.fileName())); + + // do 3 dry runs for cache warmup + qnamFileRead_iteration(manager, request); + qnamFileRead_iteration(manager, request); + qnamFileRead_iteration(manager, request); + + t.start(); + // 10 real runs + QBENCHMARK_ONCE { + for (int i = 0; i < iterations; i++) { + qnamFileRead_iteration(manager, request); + } + } + + qint64 elapsed = t.elapsed(); + qDebug() << endl << "Finished!"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; +} + +void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request) +{ + QNetworkReply* reply = manager.get(request); + QVERIFY(reply->isFinished()); // should be like that! + QByteArray qba = reply->readAll(); + delete reply; +} + +void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead() +{ + QNetworkAccessManager manager; + QTime t; + QNetworkRequest request(QUrl(testFile.fileName())); + + // do 3 dry runs for cache warmup + qnamImmediateFileRead_iteration(manager, request); + qnamImmediateFileRead_iteration(manager, request); + qnamImmediateFileRead_iteration(manager, request); + + t.start(); + // 10 real runs + QBENCHMARK_ONCE { + for (int i = 0; i < iterations; i++) { + qnamImmediateFileRead_iteration(manager, request); + } + } + + qint64 elapsed = t.elapsed(); + qDebug() << endl << "Finished!"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; +} + +void qfile_vs_qnetworkaccessmanager::qfileFileRead_iteration() +{ + testFile.reset(); + QByteArray qba = testFile.readAll(); +} + +void qfile_vs_qnetworkaccessmanager::qfileFileRead() +{ + QTime t; + + // do 3 dry runs for cache warmup + qfileFileRead_iteration(); + qfileFileRead_iteration(); + qfileFileRead_iteration(); + + t.start(); + // 10 real runs + QBENCHMARK_ONCE { + for (int i = 0; i < iterations; i++) { + qfileFileRead_iteration(); + } + } + + qint64 elapsed = t.elapsed(); + qDebug() << endl << "Finished!"; + qDebug() << "Bytes:" << size; + qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; +} + +QTEST_MAIN(qfile_vs_qnetworkaccessmanager) + +#include "main.moc" diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro new file mode 100644 index 0000000..99d1935 --- /dev/null +++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = qfile_vs_qnetworkaccessmanager +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro b/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro new file mode 100644 index 0000000..1e67d81 --- /dev/null +++ b/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qnetworkreply +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += tst_qnetworkreply.cpp diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp new file mode 100644 index 0000000..a92359f --- /dev/null +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -0,0 +1,656 @@ +/**************************************************************************** +** +** 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 QNetworkReply functions. + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../auto/network-settings.h" + + +class TimedSender: public QThread +{ + Q_OBJECT + qint64 totalBytes; + QSemaphore ready; + QByteArray dataToSend; + QTcpSocket *client; + int timeout; + int port; +public: + int transferRate; + TimedSender(int ms) + : totalBytes(0), timeout(ms), port(-1), transferRate(-1) + { + dataToSend = QByteArray(16*1024, '@'); + start(); + ready.acquire(); + } + + inline int serverPort() const { return port; } + +private slots: + void writeMore() + { + while (client->bytesToWrite() < 128 * 1024) { + writePacket(dataToSend); + } + } + +protected: + void run() + { + QTcpServer server; + server.listen(); + port = server.serverPort(); + ready.release(); + + server.waitForNewConnection(-1); + client = server.nextPendingConnection(); + + writeMore(); + connect(client, SIGNAL(bytesWritten(qint64)), SLOT(writeMore()), Qt::DirectConnection); + + QEventLoop eventLoop; + QTimer::singleShot(timeout, &eventLoop, SLOT(quit())); + + QTime timer; + timer.start(); + eventLoop.exec(); + disconnect(client, SIGNAL(bytesWritten(qint64)), this, 0); + + // wait for the connection to shut down + client->disconnectFromHost(); + if (!client->waitForDisconnected(10000)) + return; + + transferRate = totalBytes * 1000 / timer.elapsed(); + qDebug() << "TimedSender::run" << "receive rate:" << (transferRate / 1024) << "kB/s in" + << timer.elapsed() << "ms"; + } + + void writePacket(const QByteArray &array) + { + client->write(array); + totalBytes += array.size(); + } +}; + + +class QNetworkReplyPtr: public QSharedPointer +{ +public: + inline QNetworkReplyPtr(QNetworkReply *ptr = 0) + : QSharedPointer(ptr) + { } + + inline operator QNetworkReply *() const { return data(); } +}; + + +class DataReader: public QObject +{ + Q_OBJECT +public: + qint64 totalBytes; + QByteArray data; + QIODevice *device; + bool accumulate; + DataReader(QIODevice *dev, bool acc = true) : totalBytes(0), device(dev), accumulate(acc) + { + connect(device, SIGNAL(readyRead()), SLOT(doRead())); + } + +public slots: + void doRead() + { + QByteArray buffer; + buffer.resize(device->bytesAvailable()); + qint64 bytesRead = device->read(buffer.data(), device->bytesAvailable()); + if (bytesRead == -1) { + QTestEventLoop::instance().exitLoop(); + return; + } + buffer.truncate(bytesRead); + totalBytes += bytesRead; + + if (accumulate) + data += buffer; + } +}; + +class ThreadedDataReader: public QThread +{ + Q_OBJECT + // used to make the constructor only return after the tcp server started listening + QSemaphore ready; + QTcpSocket *client; + int timeout; + int port; +public: + qint64 transferRate; + ThreadedDataReader() + : port(-1), transferRate(-1) + { + start(); + ready.acquire(); + } + + inline int serverPort() const { return port; } + +protected: + void run() + { + QTcpServer server; + server.listen(); + port = server.serverPort(); + ready.release(); + + server.waitForNewConnection(-1); + client = server.nextPendingConnection(); + + QEventLoop eventLoop; + DataReader reader(client, false); + QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); + + QTime timer; + timer.start(); + eventLoop.exec(); + qint64 elapsed = timer.elapsed(); + + transferRate = reader.totalBytes * 1000 / elapsed; + qDebug() << "ThreadedDataReader::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; + } +}; + +class DataGenerator: public QIODevice +{ + Q_OBJECT + enum { Idle, Started, Stopped } state; +public: + DataGenerator() : state(Idle) + { open(ReadOnly); } + + virtual bool isSequential() const { return true; } + virtual qint64 bytesAvailable() const { return state == Started ? 1024*1024 : 0; } + +public slots: + void start() { state = Started; emit readyRead(); } + void stop() { state = Stopped; emit readyRead(); } + +protected: + virtual qint64 readData(char *data, qint64 maxlen) + { + if (state == Stopped) + return -1; // EOF + + // return as many bytes as are wanted + memset(data, '@', maxlen); + return maxlen; + } + virtual qint64 writeData(const char *, qint64) + { return -1; } +}; + +class ThreadedDataReaderHttpServer: public QThread +{ + Q_OBJECT + // used to make the constructor only return after the tcp server started listening + QSemaphore ready; + QTcpSocket *client; + int timeout; + int port; +public: + qint64 transferRate; + ThreadedDataReaderHttpServer() + : port(-1), transferRate(-1) + { + start(); + ready.acquire(); + } + + inline int serverPort() const { return port; } + +protected: + void run() + { + QTcpServer server; + server.listen(); + port = server.serverPort(); + ready.release(); + + QVERIFY(server.waitForNewConnection(10*1000)); + client = server.nextPendingConnection(); + + // read lines until we read the empty line seperating HTTP request from HTTP request body + do { + if (client->canReadLine()) { + QString line = client->readLine(); + if (line == "\n" || line == "\r\n") + break; // empty line + } + if (!client->waitForReadyRead(10*1000)) { + client->close(); + return; + } + } while (client->state() == QAbstractSocket::ConnectedState); + + client->write("HTTP/1.0 200 OK\r\n"); + client->write("Content-length: 0\r\n"); + client->write("\r\n"); + client->flush(); + + QCoreApplication::processEvents(); + + QEventLoop eventLoop; + DataReader reader(client, false); + QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); + + QTime timer; + timer.start(); + eventLoop.exec(); + qint64 elapsed = timer.elapsed(); + + transferRate = reader.totalBytes * 1000 / elapsed; + qDebug() << "ThreadedDataReaderHttpServer::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; + } +}; + + +class FixedSizeDataGenerator : public QIODevice +{ + Q_OBJECT + enum { Idle, Started, Stopped } state; +public: + FixedSizeDataGenerator(qint64 size) : state(Idle) + { open(ReadOnly | Unbuffered); + toBeGeneratedTotalCount = toBeGeneratedCount = size; + } + + virtual qint64 bytesAvailable() const + { + return state == Started ? toBeGeneratedCount + QIODevice::bytesAvailable() : 0; + } + + virtual bool isSequential() const{ + return false; + } + + virtual bool reset() const{ + return false; + } + + qint64 size() const { + return toBeGeneratedTotalCount; + } + +public slots: + void start() { state = Started; emit readyRead(); } + +protected: + virtual qint64 readData(char *data, qint64 maxlen) + { + memset(data, '@', maxlen); + + if (toBeGeneratedCount <= 0) { + return -1; + } + + qint64 n = qMin(maxlen, toBeGeneratedCount); + toBeGeneratedCount -= n; + + if (toBeGeneratedCount <= 0) { + // make sure this is a queued connection! + emit readChannelFinished(); + } + + return n; + } + virtual qint64 writeData(const char *, qint64) + { return -1; } + + qint64 toBeGeneratedCount; + qint64 toBeGeneratedTotalCount; +}; + +class HttpDownloadPerformanceServer : QObject { + Q_OBJECT; + qint64 dataSize; + qint64 dataSent; + QTcpServer server; + QTcpSocket *client; + bool serverSendsContentLength; + bool chunkedEncoding; + +public: + HttpDownloadPerformanceServer (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0), + client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) { + server.listen(); + connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot())); + } + + int serverPort() { + return server.serverPort(); + } + +public slots: + + void newConnectionSlot() { + client = server.nextPendingConnection(); + client->setParent(this); + connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64))); + } + + void readyReadSlot() { + client->readAll(); + client->write("HTTP/1.0 200 OK\n"); + if (serverSendsContentLength) + client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii()); + if (chunkedEncoding) + client->write(QString("Transfer-Encoding: chunked\n").toAscii()); + client->write("Connection: close\n\n"); + } + + void bytesWrittenSlot(qint64 amount) { + Q_UNUSED(amount); + if (dataSent == dataSize && client) { + // close eventually + + // chunked encoding: we have to send a last "empty" chunk + if (chunkedEncoding) + client->write(QString("0\r\n\r\n").toAscii()); + + client->disconnectFromHost(); + server.close(); + client = 0; + return; + } + + // send data + if (client && client->bytesToWrite() < 100*1024 && dataSent < dataSize) { + qint64 amount = qMin(qint64(16*1024), dataSize - dataSent); + QByteArray data(amount, '@'); + + if (chunkedEncoding) { + client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii()); + client->write(data.constData(), amount); + client->write(QString("\r\n").toAscii()); + } else { + client->write(data.constData(), amount); + } + + dataSent += amount; + } + } +}; + +class HttpDownloadPerformanceClient : QObject { + Q_OBJECT; + QIODevice *device; + public: + HttpDownloadPerformanceClient (QIODevice *dev) : device(dev){ + connect(dev, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + } + + public slots: + void readyReadSlot() { + device->readAll(); + } + +}; + + + + +class tst_qnetworkreply : public QObject +{ + Q_OBJECT + + QNetworkAccessManager manager; +private slots: + void httpLatency(); + +#ifndef QT_NO_OPENSSL + void echoPerformance_data(); + void echoPerformance(); +#endif + + void downloadPerformance(); + void uploadPerformance(); + void performanceControlRate(); + void httpUploadPerformance(); + void httpDownloadPerformance_data(); + void httpDownloadPerformance(); + +}; + +void tst_qnetworkreply::httpLatency() +{ + QNetworkAccessManager manager; + QBENCHMARK{ + QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/")); + QNetworkReply* reply = manager.get(request); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + delete reply; + } +} + +#ifndef QT_NO_OPENSSL +void tst_qnetworkreply::echoPerformance_data() +{ + QTest::addColumn("ssl"); + QTest::newRow("no_ssl") << false; + QTest::newRow("ssl") << true; +} + +void tst_qnetworkreply::echoPerformance() +{ + QFETCH(bool, ssl); + QNetworkAccessManager manager; + QNetworkRequest request(QUrl((ssl ? "https://" : "http://") + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi")); + + QByteArray data; + data.resize(1024*1024*10); // 10 MB + // init with garbage. needed so ssl cannot compress it in an efficient way. + for (int i = 0; i < data.size() / sizeof(int); i++) { + int r = qrand(); + data.data()[i*sizeof(int)] = r; + } + + QBENCHMARK{ + QNetworkReply* reply = manager.post(request, data); + connect(reply, SIGNAL(sslErrors( const QList &)), reply, SLOT(ignoreSslErrors())); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(reply->error() == QNetworkReply::NoError); + delete reply; + } +} +#endif + +void tst_qnetworkreply::downloadPerformance() +{ + // unlike the above function, this one tries to send as fast as possible + // and measures how fast it was. + TimedSender sender(5000); + QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(sender.serverPort()) + "/?bare=1"); + QNetworkReplyPtr reply = manager.get(request); + DataReader reader(reply, false); + + QTime loopTime; + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + loopTime.start(); + QTestEventLoop::instance().enterLoop(40); + int elapsedTime = loopTime.elapsed(); + sender.wait(); + + qint64 receivedBytes = reader.totalBytes; + qDebug() << "tst_QNetworkReply::downloadPerformance" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" + << elapsedTime << "ms"; +} + +void tst_qnetworkreply::uploadPerformance() +{ + ThreadedDataReader reader; + DataGenerator generator; + + + QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); + QNetworkReplyPtr reply = manager.put(request, &generator); + generator.start(); + connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTimer::singleShot(5000, &generator, SLOT(stop())); + + QTestEventLoop::instance().enterLoop(30); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(!QTestEventLoop::instance().timeout()); +} + +void tst_qnetworkreply::httpUploadPerformance() +{ +#ifdef Q_OS_SYMBIAN + // SHow some mercy for non-desktop platform/s + enum {UploadSize = 4*1024*1024}; // 4 MB +#else + enum {UploadSize = 128*1024*1024}; // 128 MB +#endif + ThreadedDataReaderHttpServer reader; + FixedSizeDataGenerator generator(UploadSize); + + QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1")); + request.setHeader(QNetworkRequest::ContentLengthHeader,UploadSize); + + QNetworkReplyPtr reply = manager.put(request, &generator); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + QTime time; + generator.start(); + time.start(); + QTestEventLoop::instance().enterLoop(40); + qint64 elapsed = time.elapsed(); + reader.exit(); + reader.wait(); + QVERIFY(reply->isFinished()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(!QTestEventLoop::instance().timeout()); + + qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " + << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; +} + + +void tst_qnetworkreply::performanceControlRate() +{ + // this is a control comparison for the other two above + // it does the same thing, but instead bypasses the QNetworkAccess system + qDebug() << "The following are the maximum transfer rates that we can get in this system" + " (bypassing QNetworkAccess)"; + + TimedSender sender(5000); + QTcpSocket sink; + sink.connectToHost("127.0.0.1", sender.serverPort()); + DataReader reader(&sink, false); + + QTime loopTime; + connect(&sink, SIGNAL(disconnected()), &QTestEventLoop::instance(), SLOT(exitLoop())); + loopTime.start(); + QTestEventLoop::instance().enterLoop(40); + int elapsedTime = loopTime.elapsed(); + sender.wait(); + + qint64 receivedBytes = reader.totalBytes; + qDebug() << "tst_QNetworkReply::performanceControlRate" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" + << elapsedTime << "ms"; +} + +void tst_qnetworkreply::httpDownloadPerformance_data() +{ + QTest::addColumn("serverSendsContentLength"); + QTest::addColumn("chunkedEncoding"); + + QTest::newRow("Server sends no Content-Length") << false << false; + QTest::newRow("Server sends Content-Length") << true << false; + QTest::newRow("Server uses chunked encoding") << false << true; + +} + +void tst_qnetworkreply::httpDownloadPerformance() +{ + QFETCH(bool, serverSendsContentLength); + QFETCH(bool, chunkedEncoding); +#ifdef Q_OS_SYMBIAN + // Show some mercy to non-desktop platform/s + enum {UploadSize = 4*1024*1024}; // 4 MB +#else + enum {UploadSize = 128*1024*1024}; // 128 MB +#endif + HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding); + + QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1")); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); + HttpDownloadPerformanceClient client(reply); + + QTime time; + time.start(); + QTestEventLoop::instance().enterLoop(40); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QVERIFY(!QTestEventLoop::instance().timeout()); + + qint64 elapsed = time.elapsed(); + qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " + << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; +} + +QTEST_MAIN(tst_qnetworkreply) + +#include "tst_qnetworkreply.moc" diff --git a/tests/benchmarks/network/kernel/kernel.pro b/tests/benchmarks/network/kernel/kernel.pro new file mode 100644 index 0000000..1ec3071 --- /dev/null +++ b/tests/benchmarks/network/kernel/kernel.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qhostinfo diff --git a/tests/benchmarks/network/kernel/qhostinfo/main.cpp b/tests/benchmarks/network/kernel/qhostinfo/main.cpp new file mode 100644 index 0000000..0ae1b7f --- /dev/null +++ b/tests/benchmarks/network/kernel/qhostinfo/main.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include + +#include +#include + +class tst_qhostinfo : public QObject +{ + Q_OBJECT +private slots: + void lookupSpeed(); +}; + +class SignalReceiver : public QObject +{ + Q_OBJECT +public: + SignalReceiver(int nrc) : receiveCount(0), neededReceiveCount(nrc) {}; + int receiveCount; + int neededReceiveCount; +public slots: + void resultsReady(const QHostInfo) { + receiveCount++; + if (receiveCount == neededReceiveCount) + QTestEventLoop::instance().exitLoop(); + } +}; + +void tst_qhostinfo::lookupSpeed() +{ + QStringList hostnameList; + hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" + << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" + << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; + // also add some duplicates: + hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com"; + const int COUNT = hostnameList.size(); + + SignalReceiver receiver(COUNT); + + QBENCHMARK { + for (int i = 0; i < hostnameList.size(); i++) + QHostInfo::lookupHost(hostnameList.at(i), &receiver, SLOT(resultsReady(const QHostInfo))); + QTestEventLoop::instance().enterLoop(20); + QVERIFY(!QTestEventLoop::instance().timeout()); + } +} + + +QTEST_MAIN(tst_qhostinfo) + +#include "main.moc" diff --git a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro new file mode 100755 index 0000000..f18d6d7 --- /dev/null +++ b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qhostinfo +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro new file mode 100644 index 0000000..4e83db2 --- /dev/null +++ b/tests/benchmarks/network/network.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = \ + access \ + kernel \ + socket diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro new file mode 100644 index 0000000..e7bf13a --- /dev/null +++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qtcpserver +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui +QT += network + +CONFIG += release + +# Input +SOURCES += tst_qtcpserver.cpp diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp new file mode 100644 index 0000000..b6b55c3 --- /dev/null +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -0,0 +1,277 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +// Just to get Q_OS_SYMBIAN +#include + +#include + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +Q_DECLARE_METATYPE(QNetworkProxy) +Q_DECLARE_METATYPE(QList) + +#include "../../auto/network-settings.h" + +//TESTED_CLASS= +//TESTED_FILES= + +class tst_QTcpServer : public QObject +{ + Q_OBJECT + +public: + tst_QTcpServer(); + virtual ~tst_QTcpServer(); + + +public slots: + void initTestCase_data(); + void init(); + void cleanup(); +private slots: + void ipv4LoopbackPerformanceTest(); + void ipv6LoopbackPerformanceTest(); + void ipv4PerformanceTest(); +}; + +tst_QTcpServer::tst_QTcpServer() +{ + Q_SET_DEFAULT_IAP +} + +tst_QTcpServer::~tst_QTcpServer() +{ +} + +void tst_QTcpServer::initTestCase_data() +{ + QTest::addColumn("setProxy"); + QTest::addColumn("proxyType"); + + QTest::newRow("WithoutProxy") << false << 0; + QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +} + +void tst_QTcpServer::init() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) { + QFETCH_GLOBAL(int, proxyType); + if (proxyType == QNetworkProxy::Socks5Proxy) { + QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); + } + } +} + +void tst_QTcpServer::cleanup() +{ + QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +} + +//---------------------------------------------------------------------------------- +void tst_QTcpServer::ipv4LoopbackPerformanceTest() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + QTcpServer server; + QVERIFY(server.listen(QHostAddress::LocalHost)); + + QVERIFY(server.isListening()); + + QTcpSocket clientA; + clientA.connectToHost(QHostAddress::LocalHost, server.serverPort()); + QVERIFY(clientA.waitForConnected(5000)); + QVERIFY(clientA.state() == QAbstractSocket::ConnectedState); + + QVERIFY(server.waitForNewConnection()); + QTcpSocket *clientB = server.nextPendingConnection(); + QVERIFY(clientB); + + QByteArray buffer(16384, '@'); + QTime stopWatch; + stopWatch.start(); + qlonglong totalWritten = 0; + while (stopWatch.elapsed() < 5000) { + QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0); + clientA.flush(); + totalWritten += buffer.size(); + while (clientB->waitForReadyRead(100)) { + if (clientB->bytesAvailable() == 16384) + break; + } + clientB->read(buffer.data(), buffer.size()); + clientB->write(buffer.data(), buffer.size()); + clientB->flush(); + totalWritten += buffer.size(); + while (clientA.waitForReadyRead(100)) { + if (clientA.bytesAvailable() == 16384) + break; + } + clientA.read(buffer.data(), buffer.size()); + } + + qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", + server.serverAddress().toString().toLatin1().constData(), + totalWritten / (1024.0 * 1024.0), + stopWatch.elapsed() / 1000.0, + (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + + delete clientB; +} + +//---------------------------------------------------------------------------------- +void tst_QTcpServer::ipv6LoopbackPerformanceTest() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + +#if defined(Q_OS_SYMBIAN) + QSKIP("Symbian: IPv6 is not yet supported", SkipAll); +#endif + QTcpServer server; + if (!server.listen(QHostAddress::LocalHostIPv6, 0)) { + QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError); + } else { + QTcpSocket clientA; + clientA.connectToHost(server.serverAddress(), server.serverPort()); + QVERIFY(clientA.waitForConnected(5000)); + + QVERIFY(server.waitForNewConnection(5000)); + QTcpSocket *clientB = server.nextPendingConnection(); + QVERIFY(clientB); + + QByteArray buffer(16384, '@'); + QTime stopWatch; + stopWatch.start(); + qlonglong totalWritten = 0; + while (stopWatch.elapsed() < 5000) { + clientA.write(buffer.data(), buffer.size()); + clientA.flush(); + totalWritten += buffer.size(); + while (clientB->waitForReadyRead(100)) { + if (clientB->bytesAvailable() == 16384) + break; + } + clientB->read(buffer.data(), buffer.size()); + clientB->write(buffer.data(), buffer.size()); + clientB->flush(); + totalWritten += buffer.size(); + while (clientA.waitForReadyRead(100)) { + if (clientA.bytesAvailable() == 16384) + break; + } + clientA.read(buffer.data(), buffer.size()); + } + + qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", + server.serverAddress().toString().toLatin1().constData(), + totalWritten / (1024.0 * 1024.0), + stopWatch.elapsed() / 1000.0, + (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + delete clientB; + } +} + +//---------------------------------------------------------------------------------- +void tst_QTcpServer::ipv4PerformanceTest() +{ + QTcpSocket probeSocket; + probeSocket.connectToHost(QtNetworkSettings::serverName(), 143); + QVERIFY(probeSocket.waitForConnected(5000)); + + QTcpServer server; + QVERIFY(server.listen(probeSocket.localAddress(), 0)); + + QTcpSocket clientA; + clientA.connectToHost(server.serverAddress(), server.serverPort()); + QVERIFY(clientA.waitForConnected(5000)); + + QVERIFY(server.waitForNewConnection(5000)); + QTcpSocket *clientB = server.nextPendingConnection(); + QVERIFY(clientB); + + QByteArray buffer(16384, '@'); + QTime stopWatch; + stopWatch.start(); + qlonglong totalWritten = 0; + while (stopWatch.elapsed() < 5000) { + qlonglong writtenA = clientA.write(buffer.data(), buffer.size()); + clientA.flush(); + totalWritten += buffer.size(); + while (clientB->waitForReadyRead(100)) { + if (clientB->bytesAvailable() == writtenA) + break; + } + clientB->read(buffer.data(), buffer.size()); + qlonglong writtenB = clientB->write(buffer.data(), buffer.size()); + clientB->flush(); + totalWritten += buffer.size(); + while (clientA.waitForReadyRead(100)) { + if (clientA.bytesAvailable() == writtenB) + break; + } + clientA.read(buffer.data(), buffer.size()); + } + + qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", + probeSocket.localAddress().toString().toLatin1().constData(), + totalWritten / (1024.0 * 1024.0), + stopWatch.elapsed() / 1000.0, + (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); + + delete clientB; +} + +QTEST_MAIN(tst_QTcpServer) +#include "tst_qtcpserver.moc" diff --git a/tests/benchmarks/network/socket/socket.pro b/tests/benchmarks/network/socket/socket.pro new file mode 100644 index 0000000..2d676a2 --- /dev/null +++ b/tests/benchmarks/network/socket/socket.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qtcpserver diff --git a/tests/benchmarks/qanimation/dummyanimation.cpp b/tests/benchmarks/qanimation/dummyanimation.cpp deleted file mode 100644 index f79cc5b..0000000 --- a/tests/benchmarks/qanimation/dummyanimation.cpp +++ /dev/null @@ -1,61 +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 test suite 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 "dummyanimation.h" -#include "dummyobject.h" - - -DummyAnimation::DummyAnimation(DummyObject *d) : m_dummy(d) -{ -} - -void DummyAnimation::updateCurrentValue(const QVariant &value) -{ - if (state() == Stopped) - return; - if (m_dummy) - m_dummy->setRect(value.toRect()); -} - -void DummyAnimation::updateState(State state) -{ - Q_UNUSED(state); -} diff --git a/tests/benchmarks/qanimation/dummyanimation.h b/tests/benchmarks/qanimation/dummyanimation.h deleted file mode 100644 index 1df76be..0000000 --- a/tests/benchmarks/qanimation/dummyanimation.h +++ /dev/null @@ -1,60 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef _DUMMYANIMATION_H__ - -class DummyObject; - -class DummyAnimation : public QVariantAnimation -{ -public: - DummyAnimation(DummyObject *d); - - void updateCurrentValue(const QVariant &value); - void updateState(State state); - -private: - DummyObject *m_dummy; -}; - -#endif diff --git a/tests/benchmarks/qanimation/dummyobject.cpp b/tests/benchmarks/qanimation/dummyobject.cpp deleted file mode 100644 index 2b66cda..0000000 --- a/tests/benchmarks/qanimation/dummyobject.cpp +++ /dev/null @@ -1,66 +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 QtGui 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 "dummyobject.h" - -DummyObject::DummyObject() -{ -} - -QRect DummyObject::rect() const -{ - return m_rect; -} - -void DummyObject::setRect(const QRect &r) -{ - m_rect = r; -} - -float DummyObject::opacity() const -{ - return m_opacity; -} - -void DummyObject::setOpacity(float o) -{ - m_opacity = o; -} diff --git a/tests/benchmarks/qanimation/dummyobject.h b/tests/benchmarks/qanimation/dummyobject.h deleted file mode 100644 index 31614fd..0000000 --- a/tests/benchmarks/qanimation/dummyobject.h +++ /dev/null @@ -1,64 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef _DUMMYOBJECT_H__ - -class DummyObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(QRect rect READ rect WRITE setRect) - Q_PROPERTY(float opacity READ opacity WRITE setOpacity) -public: - DummyObject(); - QRect rect() const; - void setRect(const QRect &r); - float opacity() const; - void setOpacity(float); - -private: - QRect m_rect; - float m_opacity; -}; - - -#endif diff --git a/tests/benchmarks/qanimation/main.cpp b/tests/benchmarks/qanimation/main.cpp deleted file mode 100644 index 8b9884e..0000000 --- a/tests/benchmarks/qanimation/main.cpp +++ /dev/null @@ -1,191 +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 test suite 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 -#include - -#include "dummyobject.h" -#include "dummyanimation.h" -#include "rectanimation.h" - -#define ITERATION_COUNT 10e3 - -class tst_qanimation : public QObject -{ - Q_OBJECT -private slots: - void itemPropertyAnimation(); - void itemPropertyAnimation_data() { data();} - void dummyAnimation(); - void dummyAnimation_data() { data();} - void dummyPropertyAnimation(); - void dummyPropertyAnimation_data() { data();} - void rectAnimation(); - void rectAnimation_data() { data();} - - void floatAnimation_data() { data(); } - void floatAnimation(); - -private: - void data(); -}; - - -void tst_qanimation::data() -{ - QTest::addColumn("started"); - QTest::newRow("NotRunning") << false; - QTest::newRow("Running") << true; -} - -void tst_qanimation::itemPropertyAnimation() -{ - QFETCH(bool, started); - QGraphicsWidget item; - - //then the property animation - { - QPropertyAnimation anim(&item, "pos"); - anim.setDuration(ITERATION_COUNT); - anim.setStartValue(QPointF(0,0)); - anim.setEndValue(QPointF(ITERATION_COUNT,ITERATION_COUNT)); - if (started) - anim.start(); - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - anim.setCurrentTime(i); - } - } - } - -} - -void tst_qanimation::dummyAnimation() -{ - QFETCH(bool, started); - DummyObject dummy; - - //first the dummy animation - { - DummyAnimation anim(&dummy); - anim.setDuration(ITERATION_COUNT); - anim.setStartValue(QRect(0, 0, 0, 0)); - anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); - if (started) - anim.start(); - QBENCHMARK { - for(int i = 0; i < anim.duration(); ++i) { - anim.setCurrentTime(i); - } - } - } -} - -void tst_qanimation::dummyPropertyAnimation() -{ - QFETCH(bool, started); - DummyObject dummy; - - //then the property animation - { - QPropertyAnimation anim(&dummy, "rect"); - anim.setDuration(ITERATION_COUNT); - anim.setStartValue(QRect(0, 0, 0, 0)); - anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); - if (started) - anim.start(); - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - anim.setCurrentTime(i); - } - } - } -} - -void tst_qanimation::rectAnimation() -{ - //this is the simplest animation you can do - QFETCH(bool, started); - DummyObject dummy; - - //then the property animation - { - RectAnimation anim(&dummy); - anim.setDuration(ITERATION_COUNT); - anim.setStartValue(QRect(0, 0, 0, 0)); - anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); - if (started) - anim.start(); - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - anim.setCurrentTime(i); - } - } - } -} - -void tst_qanimation::floatAnimation() -{ - //this is the simplest animation you can do - QFETCH(bool, started); - DummyObject dummy; - - //then the property animation - { - QPropertyAnimation anim(&dummy, "opacity"); - anim.setDuration(ITERATION_COUNT); - anim.setStartValue(0.f); - anim.setEndValue(1.f); - if (started) - anim.start(); - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - anim.setCurrentTime(i); - } - } - } -} - - - -QTEST_MAIN(tst_qanimation) - -#include "main.moc" diff --git a/tests/benchmarks/qanimation/qanimation.pro b/tests/benchmarks/qanimation/qanimation.pro deleted file mode 100644 index 55cd75e..0000000 --- a/tests/benchmarks/qanimation/qanimation.pro +++ /dev/null @@ -1,18 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qanimation -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += release -#CONFIG += debug - - -SOURCES += main.cpp \ - dummyobject.cpp \ - dummyanimation.cpp \ - rectanimation.cpp - -HEADERS += dummyobject.h \ - dummyanimation.h \ - rectanimation.h diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp deleted file mode 100644 index e6d7a7e..0000000 --- a/tests/benchmarks/qanimation/rectanimation.cpp +++ /dev/null @@ -1,94 +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 test suite 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 "rectanimation.h" -#include "dummyobject.h" - -static inline int interpolateInteger(int from, int to, qreal progress) -{ - return from + (to - from) * progress; -} - - -RectAnimation::RectAnimation(DummyObject *obj) : m_object(obj), m_dura(250) -{ -} - -void RectAnimation::setEndValue(const QRect &rect) -{ - m_end = rect; -} - -void RectAnimation::setStartValue(const QRect &rect) -{ - m_start = rect; -} - -void RectAnimation::setDuration(int d) -{ - m_dura = d; -} - -int RectAnimation::duration() const -{ - return m_dura; -} - - -void RectAnimation::updateCurrentTime(int currentTime) -{ - qreal progress = m_easing.valueForProgress( currentTime / qreal(m_dura) ); - QRect now; - now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress), - interpolateInteger(m_start.top(), m_end.top(), progress), - interpolateInteger(m_start.right(), m_end.right(), progress), - interpolateInteger(m_start.bottom(), m_end.bottom(), progress)); - - bool changed = (now != m_current); - if (changed) - m_current = now; - - if (state() == Stopped) - return; - - if (m_object) - m_object->setRect(m_current); -} diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h deleted file mode 100644 index 42b9376..0000000 --- a/tests/benchmarks/qanimation/rectanimation.h +++ /dev/null @@ -1,70 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#ifndef _RECTANIMATION_H__ - -class DummyObject; - -//this class is even simpler than the dummy -//and uses no QVariant at all -class RectAnimation : public QAbstractAnimation -{ -public: - RectAnimation(DummyObject *obj); - - void setEndValue(const QRect &rect); - void setStartValue(const QRect &rect); - - void setDuration(int d); - int duration() const; - - virtual void updateCurrentTime(int currentTime); - -private: - DummyObject *m_object; - QEasingCurve m_easing; - QRect m_start, m_end, m_current; - int m_dura; -}; - -#endif diff --git a/tests/benchmarks/qapplication/main.cpp b/tests/benchmarks/qapplication/main.cpp deleted file mode 100644 index c912497..0000000 --- a/tests/benchmarks/qapplication/main.cpp +++ /dev/null @@ -1,71 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include - -#include - - -class tst_qapplication : public QObject -{ - Q_OBJECT -private slots: - void ctor(); -}; - -/* - Test the performance of the QApplication constructor. - - Note: results from the second start on can be misleading, - since all global statics are already initialized. -*/ -void tst_qapplication::ctor() -{ - // simulate reasonable argc, argv - int argc = 1; - char *argv[] = { "tst_qapplication" }; - QBENCHMARK { - QApplication app(argc, argv); - } -} - -QTEST_APPLESS_MAIN(tst_qapplication) - -#include "main.moc" diff --git a/tests/benchmarks/qapplication/qapplication.pro b/tests/benchmarks/qapplication/qapplication.pro deleted file mode 100644 index f8601e4..0000000 --- a/tests/benchmarks/qapplication/qapplication.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qapplication -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qbytearray/main.cpp b/tests/benchmarks/qbytearray/main.cpp deleted file mode 100644 index 22d4815..0000000 --- a/tests/benchmarks/qbytearray/main.cpp +++ /dev/null @@ -1,92 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include - -#include - - -class tst_qbytearray : public QObject -{ - Q_OBJECT -private slots: - void append(); - void append_data(); -}; - - -void tst_qbytearray::append_data() -{ - QTest::addColumn("size"); - QTest::newRow("1") << int(1); - QTest::newRow("10") << int(10); - QTest::newRow("100") << int(100); - QTest::newRow("1000") << int(1000); - QTest::newRow("10000") << int(10000); - QTest::newRow("100000") << int(100000); - QTest::newRow("1000000") << int(1000000); - QTest::newRow("10000000") << int(10000000); - QTest::newRow("100000000") << int(100000000); -} - -void tst_qbytearray::append() -{ - QFETCH(int, size); - -#ifdef Q_OS_SYMBIAN - if (size > 1000000) - QSKIP("Skipped due to limited memory in many Symbian devices.", SkipSingle); -#endif - - QByteArray ba; - QBENCHMARK { - QByteArray ba2(size, 'x'); - ba.append(ba2); - ba.clear(); - } -} - - -QTEST_MAIN(tst_qbytearray) - -#include "main.moc" diff --git a/tests/benchmarks/qbytearray/qbytearray.pro b/tests/benchmarks/qbytearray/qbytearray.pro deleted file mode 100755 index a0bf021..0000000 --- a/tests/benchmarks/qbytearray/qbytearray.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qbytearray -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qdir/qdir.pro b/tests/benchmarks/qdir/qdir.pro deleted file mode 100644 index 2cdebfd..0000000 --- a/tests/benchmarks/qdir/qdir.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qdir -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += tst_qdir.cpp diff --git a/tests/benchmarks/qdir/tst_qdir.cpp b/tests/benchmarks/qdir/tst_qdir.cpp deleted file mode 100644 index aea9fd0..0000000 --- a/tests/benchmarks/qdir/tst_qdir.cpp +++ /dev/null @@ -1,198 +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 test suite 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 - -#ifdef Q_OS_WIN -# include -#else -# include -# include -# include -# include -#endif - -class Test : public QObject{ - Q_OBJECT -public slots: - void initTestCase() { - QDir testdir = QDir::tempPath(); - - const QString subfolder_name = QLatin1String("test_speed"); - QVERIFY(testdir.mkdir(subfolder_name)); - QVERIFY(testdir.cd(subfolder_name)); - - for (uint i=0; i<10000; ++i) { - QFile file(testdir.absolutePath() + "/testfile_" + QString::number(i)); - file.open(QIODevice::WriteOnly); - } - } - void cleanupTestCase() { - { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - testdir.setSorting(QDir::Unsorted); - testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); - foreach (const QString &filename, testdir.entryList()) { - testdir.remove(filename); - } - } - const QDir temp = QDir(QDir::tempPath()); - temp.rmdir(QLatin1String("test_speed")); - } -private slots: - void baseline() {} - - void sizeSpeed() { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - QBENCHMARK { - QFileInfoList fileInfoList = testdir.entryInfoList(QDir::Files, QDir::Unsorted); - foreach (const QFileInfo &fileInfo, fileInfoList) { - fileInfo.isDir(); - fileInfo.size(); - } - } - } - void sizeSpeedIterator() { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - QBENCHMARK { - QDirIterator dit(testdir.path(), QDir::Files); - while (dit.hasNext()) { - dit.fileInfo().isDir(); - dit.fileInfo().size(); - dit.next(); - } - } - } - - void sizeSpeedWithoutFilter() { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - QBENCHMARK { - QFileInfoList fileInfoList = testdir.entryInfoList(QDir::NoFilter, QDir::Unsorted); - foreach (const QFileInfo &fileInfo, fileInfoList) { - fileInfo.size(); - } - } - } - void sizeSpeedWithoutFilterIterator() { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - QBENCHMARK { - QDirIterator dit(testdir.path()); - while (dit.hasNext()) { - dit.fileInfo().isDir(); - dit.fileInfo().size(); - dit.next(); - } - } - } - - void sizeSpeedWithoutFileInfoList() { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - testdir.setSorting(QDir::Unsorted); - QBENCHMARK { - QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Unsorted); - foreach (const QString &filename, fileList) { - QFileInfo fileInfo(filename); - fileInfo.size(); - } - } - } - - void iDontWantAnyStat() { - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - testdir.setSorting(QDir::Unsorted); - testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); - QBENCHMARK { - QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Unsorted); - foreach (const QString &filename, fileList) { - - } - } - } - void iDontWantAnyStatIterator() { - QBENCHMARK { - QDirIterator dit(QDir::tempPath() + QLatin1String("/test_speed")); - while (dit.hasNext()) { - dit.next(); - } - } - } - - void sizeSpeedWithoutFilterLowLevel() { -#ifdef Q_OS_WIN - const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16(); - wchar_t appendedPath[MAX_PATH]; - wcscpy(appendedPath, dirpath); - wcscat(appendedPath, L"\\*"); - - WIN32_FIND_DATA fd; - HANDLE hSearch = FindFirstFileW(appendedPath, &fd); - QVERIFY(hSearch == INVALID_HANDLE_VALUE); - - QBENCHMARK { - do { - - } while (FindNextFile(hSearch, &fd)); - } - FindClose(hSearch); -#else - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); - DIR *dir = opendir(qPrintable(testdir.absolutePath())); - QVERIFY(dir); - - QVERIFY(!chdir(qPrintable(testdir.absolutePath()))); - QBENCHMARK { - struct dirent *item = readdir(dir); - while (item) { - char *fileName = item->d_name; - - struct stat fileStat; - QVERIFY(!stat(fileName, &fileStat)); - - item = readdir(dir); - } - } - closedir(dir); -#endif - } -}; - -QTEST_MAIN(Test) -#include "tst_qdir.moc" diff --git a/tests/benchmarks/qdiriterator/main.cpp b/tests/benchmarks/qdiriterator/main.cpp deleted file mode 100644 index afa6b7b..0000000 --- a/tests/benchmarks/qdiriterator/main.cpp +++ /dev/null @@ -1,251 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include - -#ifdef Q_OS_WIN -# include -# include -#else -# include -# include -# include -# include -# include -#endif - -#include - -#include "qfilesystemiterator.h" - -class tst_qdiriterator : public QObject -{ - Q_OBJECT -private slots: - void posix(); - void posix_data() { data(); } - void diriterator(); - void diriterator_data() { data(); } - void fsiterator(); - void fsiterator_data() { data(); } - void data(); -}; - - -void tst_qdiriterator::data() -{ -#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) - QByteArray qtdir = qPrintable(QCoreApplication::applicationDirPath()); - qtdir += "/depot"; -#else -#if defined(Q_OS_WIN) - const char *qtdir = "C:\\depot\\qt\\main"; -#else - const char *qtdir = ::getenv("QTDIR"); -#endif - if (!qtdir) { - fprintf(stderr, "QTDIR not set\n"); - exit(1); - } -#endif - - QTest::addColumn("dirpath"); - QByteArray ba = QByteArray(qtdir) + "/src/corelib"; - QByteArray ba1 = ba + "/io"; - QTest::newRow(ba) << ba; - //QTest::newRow(ba1) << ba1; -} - -#ifdef Q_OS_WIN -static int posix_helper(const wchar_t *dirpath) -{ - int count = 0; - HANDLE hSearch; - WIN32_FIND_DATA fd; - - const size_t origDirPathLength = wcslen(dirpath); - - wchar_t appendedPath[MAX_PATH]; - wcscpy(appendedPath, dirpath); - wcscat(appendedPath, L"\\*"); - hSearch = FindFirstFile(appendedPath, &fd); - appendedPath[origDirPathLength] = 0; - - if (hSearch == INVALID_HANDLE_VALUE) { - qWarning("FindFirstFile failed"); - return count; - } - - do { - if (!(fd.cFileName[0] == L'.' && fd.cFileName[1] == 0) && - !(fd.cFileName[0] == L'.' && fd.cFileName[1] == L'.' && fd.cFileName[2] == 0)) - { - if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - wcscat(appendedPath, L"\\"); - wcscat(appendedPath, fd.cFileName); - count += posix_helper(appendedPath); - appendedPath[origDirPathLength] = 0; - } - else { - ++count; - } - } - } while (FindNextFile(hSearch, &fd)); - FindClose(hSearch); - - return count; -} - -#else - -static int posix_helper(const char *dirpath) -{ - //qDebug() << "DIR" << dirpath; - DIR *dir = ::opendir(dirpath); - if (!dir) - return 0; - - dirent *entry = 0; - - int count = 0; - while ((entry = ::readdir(dir))) { - if (qstrcmp(entry->d_name, ".") == 0) - continue; - if (qstrcmp(entry->d_name, "..") == 0) - continue; - ++count; - QByteArray ba = dirpath; - ba += '/'; - ba += entry->d_name; - struct stat st; - lstat(ba.constData(), &st); - if (S_ISDIR(st.st_mode)) - count += posix_helper(ba.constData()); - } - - ::closedir(dir); - return count; -} -#endif - - -void tst_qdiriterator::posix() -{ - QFETCH(QByteArray, dirpath); - - int count = 0; - QString path(dirpath); - QBENCHMARK { -#ifdef Q_OS_WIN - count = posix_helper(path.utf16()); -#else - count = posix_helper(dirpath.constData()); -#endif - } - qDebug() << count; -} - -void tst_qdiriterator::diriterator() -{ - QFETCH(QByteArray, dirpath); - - int count = 0; - - QBENCHMARK { - int c = 0; - - QDirIterator dir(dirpath, - //QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot, - //QDir::AllEntries | QDir::Hidden, - QDir::Files, - QDirIterator::Subdirectories); - - while (dir.hasNext()) { - dir.next(); - //printf("%s\n", qPrintable(dir.fileName())); - 0 && printf("%d %s\n", - dir.fileInfo().isDir(), - //qPrintable(dir.fileInfo().absoluteFilePath()), - //qPrintable(dir.path()), - qPrintable(dir.filePath())); - ++c; - } - count = c; - } - qDebug() << count; -} - -void tst_qdiriterator::fsiterator() -{ - QFETCH(QByteArray, dirpath); - - int count = 0; - int dump = 0; - - QBENCHMARK { - int c = 0; - - dump && printf("\n\n\n\n"); - QFileSystemIterator dir(dirpath, - //QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot, - //QDir::AllEntries | QDir::Hidden, - //QDir::Files | QDir::NoDotAndDotDot, - QDir::Files, - QFileSystemIterator::Subdirectories); - - for (; !dir.atEnd(); dir.next()) { - dump && printf("%d %s\n", - dir.fileInfo().isDir(), - //qPrintable(dir.fileInfo().absoluteFilePath()), - //qPrintable(dir.path()), - qPrintable(dir.filePath()) - ); - ++c; - } - count = c; - } - qDebug() << count; -} - -QTEST_MAIN(tst_qdiriterator) - -#include "main.moc" diff --git a/tests/benchmarks/qdiriterator/qdiriterator.pro b/tests/benchmarks/qdiriterator/qdiriterator.pro deleted file mode 100755 index e06d746..0000000 --- a/tests/benchmarks/qdiriterator/qdiriterator.pro +++ /dev/null @@ -1,23 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qdiriterator -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release -CONFIG += debug - - -SOURCES += main.cpp - -SOURCES += qfilesystemiterator.cpp -HEADERS += qfilesystemiterator.h - -wince*|symbian: { - corelibdir.sources = $$QT_SOURCE_TREE/src/corelib - corelibdir.path = ./depot/src - DEPLOYMENT += corelibdir -} - diff --git a/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp deleted file mode 100644 index 267d53f..0000000 --- a/tests/benchmarks/qdiriterator/qfilesystemiterator.cpp +++ /dev/null @@ -1,678 +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 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$ -** -****************************************************************************/ - -/*! - \since 4.5 - \class QFileSystemIterator - \brief The QFileSystemIterator class provides an iterator for directory entrylists. - - You can use QFileSystemIterator to navigate entries of a directory one at a time. - It is similar to QDir::entryList() and QDir::entryInfoList(), but because - it lists entries one at a time instead of all at once, it scales better - and is more suitable for large directories. It also supports listing - directory contents recursively, and following symbolic links. Unlike - QDir::entryList(), QFileSystemIterator does not support sorting. - - The QFileSystemIterator constructor takes a QDir or a directory as - argument. After construction, the iterator is located before the first - directory entry. Here's how to iterate over all the entries sequentially: - - \snippet doc/src/snippets/code/src.corelib.io.qdiriterator.cpp 0 - - The next() function returns the path to the next directory entry and - advances the iterator. You can also call filePath() to get the current - file path without advancing the iterator. The fileName() function returns - only the name of the file, similar to how QDir::entryList() works. You can - also call fileInfo() to get a QFileInfo for the current entry. - - Unlike Qt's container iterators, QFileSystemIterator is uni-directional (i.e., - you cannot iterate directories in reverse order) and does not allow random - access. - - QFileSystemIterator works with all supported file engines, and is implemented - using QAbstractFileEngineIterator. - - \sa QDir, QDir::entryList(), QAbstractFileEngineIterator -*/ - -/*! \enum QFileSystemIterator::IteratorFlag - - This enum describes flags that you can combine to configure the behavior - of QFileSystemIterator. - - \value NoIteratorFlags The default value, representing no flags. The - iterator will return entries for the assigned path. - - \value Subdirectories List entries inside all subdirectories as well. - - \value FollowSymlinks When combined with Subdirectories, this flag - enables iterating through all subdirectories of the assigned path, - following all symbolic links. Symbolic link loops (e.g., "link" => "." or - "link" => "..") are automatically detected and ignored. -*/ - -#include "qfilesystemiterator.h" - -#include -#include -#include -#include - -#ifdef Q_OS_WIN -# include -# include -#else -# include -# include -# include -# include -#endif - -QT_BEGIN_NAMESPACE - -class QFileSystemIteratorPrivate -{ -public: - QFileSystemIteratorPrivate(const QString &path, const QStringList &nameFilters, - QDir::Filters filters, QFileSystemIterator::IteratorFlags flags); - ~QFileSystemIteratorPrivate(); - - void pushSubDirectory(const QByteArray &path); - void advance(); - bool isAcceptable() const; - bool shouldFollowDirectory(const QFileInfo &); - //bool matchesFilters(const QAbstractFileEngineIterator *it) const; - inline bool atEnd() const { return m_dirPaths.isEmpty(); } - -#ifdef Q_OS_WIN - QStack m_dirStructs; - WIN32_FIND_DATA* m_entry; - WIN32_FIND_DATA m_fileSearchResult; - bool m_bFirstSearchResult; -#else - QStack m_dirStructs; - dirent *m_entry; -#endif - - QSet visitedLinks; - QStack m_dirPaths; - QFileInfo fileInfo; - QString currentFilePath; - QFileSystemIterator::IteratorFlags iteratorFlags; - QDir::Filters filters; - QStringList nameFilters; - - enum { DontShowDir, ShowDotDotDir, ShowDotDir, ShowDir } - m_currentDirShown, m_nextDirShown; - - QFileSystemIterator *q; - -private: - bool advanceHelper(); // returns true if we know we have something suitable -}; - -/*! - \internal -*/ -QFileSystemIteratorPrivate::QFileSystemIteratorPrivate(const QString &path, - const QStringList &nameFilters, QDir::Filters filters, - QFileSystemIterator::IteratorFlags flags) - : iteratorFlags(flags) -{ - if (filters == QDir::NoFilter) - filters = QDir::AllEntries; - this->filters = filters; - this->nameFilters = nameFilters; - - fileInfo.setFile(path); - QString dir = fileInfo.isSymLink() ? fileInfo.canonicalFilePath() : path; - pushSubDirectory(dir.toLocal8Bit()); - // skip to acceptable entry - while (true) { - if (atEnd()) - return; - if (isAcceptable()) - return; - if (advanceHelper()) - return; - } -} - -/*! - \internal -*/ -QFileSystemIteratorPrivate::~QFileSystemIteratorPrivate() -{ -#ifdef Q_OS_WIN - while (!m_dirStructs.isEmpty()) - ::FindClose(m_dirStructs.pop()); -#else - while (!m_dirStructs.isEmpty()) - ::closedir(m_dirStructs.pop()); -#endif -} - -#ifdef Q_OS_WIN -static bool isDotOrDotDot(const wchar_t* name) -{ - if (name[0] == L'.' && name[1] == 0) - return true; - if (name[0] == L'.' && name[1] == L'.' && name[2] == 0) - return true; - return false; -} -#else -static bool isDotOrDotDot(const char *name) -{ - if (name[0] == '.' && name[1] == 0) - return true; - if (name[0] == '.' && name[1] == '.' && name[2] == 0) - return true; - return false; -} -#endif - -/*! - \internal -*/ -void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path) -{ -/* - if (iteratorFlags & QFileSystemIterator::FollowSymlinks) { - if (fileInfo.filePath() != path) - fileInfo.setFile(path); - if (fileInfo.isSymLink()) { - visitedLinks << fileInfo.canonicalFilePath(); - } else { - visitedLinks << fileInfo.absoluteFilePath(); - } - } -*/ - -#ifdef Q_OS_WIN - wchar_t szSearchPath[MAX_PATH]; - wcscpy(szSearchPath, QString(path).utf16()); - wcscat(szSearchPath, L"\\*"); - HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); - m_bFirstSearchResult = true; -#else - DIR *dir = ::opendir(path.constData()); - //m_entry = ::readdir(dir); - //while (m_entry && isDotOrDotDot(m_entry->d_name)) - // m_entry = ::readdir(m_dirStructs.top()); -#endif - m_dirStructs.append(dir); - m_dirPaths.append(path); - m_entry = 0; - if (filters & QDir::Dirs) - m_nextDirShown = ShowDir; - else - m_nextDirShown = DontShowDir; - m_currentDirShown = DontShowDir; -} - -/*! - \internal -*/ -bool QFileSystemIteratorPrivate::isAcceptable() const -{ - if (!m_entry) - return false; - return true; -} - -/*! - \internal -*/ - - -void QFileSystemIteratorPrivate::advance() -{ - while (true) { - if (advanceHelper()) - return; - if (atEnd()) - return; - if (isAcceptable()) - return; - } -} - -bool QFileSystemIteratorPrivate::advanceHelper() -{ - if (m_dirStructs.isEmpty()) - return true; - - //printf("ADV %d %d\n", int(m_currentDirShown), int(m_nextDirShown)); - - if ((filters & QDir::Dirs)) { - m_currentDirShown = m_nextDirShown; - if (m_nextDirShown == ShowDir) { - //printf("RESTING ON DIR %s %x\n", m_dirPaths.top().constData(), int(filters)); - m_nextDirShown = (filters & QDir::NoDotAndDotDot) ? DontShowDir : ShowDotDir; - // skip start directory itself - if (m_dirStructs.size() == 1 && m_currentDirShown == ShowDir) - return advanceHelper(); - return true; - } - if (m_nextDirShown == ShowDotDir) { - //printf("RESTING ON DOT %s %x\n", m_dirPaths.top().constData(), int(filters)); - m_nextDirShown = ShowDotDotDir; - return true; - } - if (m_nextDirShown == ShowDotDotDir) { - //printf("RESTING ON DOTDOT %s %x\n", m_dirPaths.top().constData(), int(filters)); - m_nextDirShown = DontShowDir; - return true; - } - m_currentDirShown = DontShowDir; - } - -#ifdef Q_OS_WIN - m_entry = &m_fileSearchResult; - if (m_bFirstSearchResult) { - m_bFirstSearchResult = false; - } else { - if (!FindNextFile(m_dirStructs.top(), m_entry)) - m_entry = 0; - } - - while (m_entry && isDotOrDotDot(m_entry->cFileName)) - if (!FindNextFile(m_dirStructs.top(), m_entry)) - m_entry = 0; - - if (!m_entry) { - m_dirPaths.pop(); - FindClose(m_dirStructs.pop()); - return false; - } - - if (m_entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - QByteArray ba = m_dirPaths.top(); - ba += '\\'; - ba += QString::fromWCharArray(m_entry->cFileName); - pushSubDirectory(ba); - } -#else - m_entry = ::readdir(m_dirStructs.top()); - while (m_entry && isDotOrDotDot(m_entry->d_name)) - m_entry = ::readdir(m_dirStructs.top()); - //return false; // further iteration possibly needed - //printf("READ %p %s\n", m_entry, m_entry ? m_entry->d_name : ""); - - if (!m_entry) { - m_dirPaths.pop(); - DIR *dir = m_dirStructs.pop(); - ::closedir(dir); - return false; // further iteration possibly needed - } - - const char *name = m_entry->d_name; - - QByteArray ba = m_dirPaths.top(); - ba += '/'; - ba += name; - struct stat st; - lstat(ba.constData(), &st); - - if (S_ISDIR(st.st_mode)) { - pushSubDirectory(ba); - return false; // further iteration possibly needed - } -#endif - return false; // further iteration possiblye needed -} - -/*! - \internal - */ -bool QFileSystemIteratorPrivate::shouldFollowDirectory(const QFileInfo &fileInfo) -{ - // If we're doing flat iteration, we're done. - if (!(iteratorFlags & QFileSystemIterator::Subdirectories)) - return false; - - // Never follow non-directory entries - if (!fileInfo.isDir()) - return false; - - - // Never follow . and .. - if (fileInfo.fileName() == QLatin1String(".") || fileInfo.fileName() == QLatin1String("..")) - return false; - - - // Check symlinks - if (fileInfo.isSymLink() && !(iteratorFlags & QFileSystemIterator::FollowSymlinks)) { - // Follow symlinks only if FollowSymlinks was passed - return false; - } - - // Stop link loops - if (visitedLinks.contains(fileInfo.canonicalFilePath())) - return false; - - return true; -} - - -/*! - \internal - - This convenience function implements the iterator's filtering logics and - applies then to the current directory entry. - - It returns true if the current entry matches the filters (i.e., the - current entry will be returned as part of the directory iteration); - otherwise, false is returned. -*/ -#if 0 -bool QFileSystemIteratorPrivate::matchesFilters(const QAbstractFileEngineIterator *it) const -{ - const bool filterPermissions = ((filters & QDir::PermissionMask) - && (filters & QDir::PermissionMask) != QDir::PermissionMask); - const bool skipDirs = !(filters & (QDir::Dirs | QDir::AllDirs)); - const bool skipFiles = !(filters & QDir::Files); - const bool skipSymlinks = (filters & QDir::NoSymLinks); - const bool doReadable = !filterPermissions || (filters & QDir::Readable); - const bool doWritable = !filterPermissions || (filters & QDir::Writable); - const bool doExecutable = !filterPermissions || (filters & QDir::Executable); - const bool includeHidden = (filters & QDir::Hidden); - const bool includeSystem = (filters & QDir::System); - -#ifndef QT_NO_REGEXP - // Prepare name filters - QList regexps; - bool hasNameFilters = !nameFilters.isEmpty() && !(nameFilters.contains(QLatin1String("*"))); - if (hasNameFilters) { - for (int i = 0; i < nameFilters.size(); ++i) { - regexps << QRegExp(nameFilters.at(i), - (filters & QDir::CaseSensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive, - QRegExp::Wildcard); - } - } -#endif - - QString fileName = it->currentFileName(); - if (fileName.isEmpty()) { - // invalid entry - return false; - } - - QFileInfo fi = it->currentFileInfo(); - QString filePath = it->currentFilePath(); - -#ifndef QT_NO_REGEXP - // Pass all entries through name filters, except dirs if the AllDirs - // filter is passed. - if (hasNameFilters && !((filters & QDir::AllDirs) && fi.isDir())) { - bool matched = false; - for (int i = 0; i < regexps.size(); ++i) { - if (regexps.at(i).exactMatch(fileName)) { - matched = true; - break; - } - } - if (!matched) - return false; - } -#endif - - bool dotOrDotDot = (fileName == QLatin1String(".") || fileName == QLatin1String("..")); - if ((filters & QDir::NoDotAndDotDot) && dotOrDotDot) - return false; - - bool isHidden = !dotOrDotDot && fi.isHidden(); - if (!includeHidden && isHidden) - return false; - - bool isSystem = (!fi.isFile() && !fi.isDir() && !fi.isSymLink()) - || (!fi.exists() && fi.isSymLink()); - if (!includeSystem && isSystem) - return false; - - bool alwaysShow = (filters & QDir::TypeMask) == 0 - && ((isHidden && includeHidden) - || (includeSystem && isSystem)); - - // Skip files and directories - if ((filters & QDir::AllDirs) == 0 && skipDirs && fi.isDir()) { - if (!alwaysShow) - return false; - } - - if ((skipFiles && (fi.isFile() || !fi.exists())) - || (skipSymlinks && fi.isSymLink())) { - if (!alwaysShow) - return false; - } - - if (filterPermissions - && ((doReadable && !fi.isReadable()) - || (doWritable && !fi.isWritable()) - || (doExecutable && !fi.isExecutable()))) { - return false; - } - - if (!includeSystem && !dotOrDotDot && ((fi.exists() && !fi.isFile() && !fi.isDir() && !fi.isSymLink()) - || (!fi.exists() && fi.isSymLink()))) { - return false; - } - - return true; -} -#endif - -/*! - Constructs a QFileSystemIterator that can iterate over \a dir's entrylist, using - \a dir's name filters and regular filters. You can pass options via \a - flags to decide how the directory should be iterated. - - By default, \a flags is NoIteratorFlags, which provides the same behavior - as in QDir::entryList(). - - The sorting in \a dir is ignored. - - \sa atEnd(), next(), IteratorFlags -*/ -QFileSystemIterator::QFileSystemIterator(const QDir &dir, IteratorFlags flags) - : d(new QFileSystemIteratorPrivate(dir.path(), dir.nameFilters(), dir.filter(), flags)) -{ - d->q = this; -} - -/*! - Constructs a QFileSystemIterator that can iterate over \a path, with no name - filtering and \a filters for entry filtering. You can pass options via \a - flags to decide how the directory should be iterated. - - By default, \a filters is QDir::NoFilter, and \a flags is NoIteratorFlags, - which provides the same behavior as in QDir::entryList(). - - \sa atEnd(), next(), IteratorFlags -*/ -QFileSystemIterator::QFileSystemIterator(const QString &path, QDir::Filters filters, IteratorFlags flags) - : d(new QFileSystemIteratorPrivate(path, QStringList(QLatin1String("*")), filters, flags)) -{ - d->q = this; -} - -/*! - Constructs a QFileSystemIterator that can iterate over \a path. You can pass - options via \a flags to decide how the directory should be iterated. - - By default, \a flags is NoIteratorFlags, which provides the same behavior - as in QDir::entryList(). - - \sa atEnd(), next(), IteratorFlags -*/ -QFileSystemIterator::QFileSystemIterator(const QString &path, IteratorFlags flags) - : d(new QFileSystemIteratorPrivate(path, QStringList(QLatin1String("*")), QDir::NoFilter, flags)) -{ - d->q = this; -} - -/*! - Constructs a QFileSystemIterator that can iterate over \a path, using \a - nameFilters and \a filters. You can pass options via \a flags to decide - how the directory should be iterated. - - By default, \a flags is NoIteratorFlags, which provides the same behavior - as QDir::entryList(). - - \sa atEnd(), next(), IteratorFlags -*/ -QFileSystemIterator::QFileSystemIterator(const QString &path, const QStringList &nameFilters, - QDir::Filters filters, IteratorFlags flags) - : d(new QFileSystemIteratorPrivate(path, nameFilters, filters, flags)) -{ - d->q = this; -} - -/*! - Destroys the QFileSystemIterator. -*/ -QFileSystemIterator::~QFileSystemIterator() -{ - delete d; -} - -/*! - Advances the iterator to the next entry, and returns the file path of this - new entry. If atEnd() returns true, this function does nothing, and - returns a null QString. - - You can call fileName() or filePath() to get the current entry file name - or path, or fileInfo() to get a QFileInfo for the current entry. - - \sa hasNext(), fileName(), filePath(), fileInfo() -*/ -void QFileSystemIterator::next() -{ - d->advance(); -} - -/*! - Returns true if there is at least one more entry in the directory; - otherwise, false is returned. - - \sa next(), fileName(), filePath(), fileInfo() -*/ -bool QFileSystemIterator::atEnd() const -{ - return d->atEnd(); -} - -/*! - Returns the file name for the current directory entry, without the path - prepended. If the current entry is invalid (i.e., isValid() returns - false), a null QString is returned. - - This function is provided for the convenience when iterating single - directories. For recursive iteration, you should call filePath() or - fileInfo() instead. - - \sa filePath(), fileInfo() -*/ -QString QFileSystemIterator::fileName() const -{ - if (d->atEnd() || !d->m_entry) - return QString(); - if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDir) - return QString(); - if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDir) - return QLatin1String("@"); - if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDotDir) - return QLatin1String("@@"); -#ifdef Q_OS_WIN - return QString::fromWCharArray(d->m_entry->cFileName); -#else - return QString::fromLocal8Bit(d->m_entry->d_name); -#endif -} - -/*! - Returns the full file path for the current directory entry. If the current - entry is invalid (i.e., isValid() returns false), a null QString is - returned. - - \sa fileInfo(), fileName() -*/ -QString QFileSystemIterator::filePath() const -{ - if (d->atEnd()) - return QString(); - QByteArray ba = d->m_dirPaths.top(); - if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDir) - ba += "/."; - else if (d->m_currentDirShown == QFileSystemIteratorPrivate::ShowDotDotDir) - ba += "/.."; - else if (d->m_entry) { - ba += '/'; -#ifdef Q_OS_WIN - ba += QString::fromWCharArray(d->m_entry->cFileName); -#else - ba += d->m_entry->d_name; -#endif - } - return QString::fromLocal8Bit(ba); -} - -/*! - Returns a QFileInfo for the current directory entry. If the current entry - is invalid (i.e., isValid() returns false), a null QFileInfo is returned. - - \sa filePath(), fileName() -*/ -QFileInfo QFileSystemIterator::fileInfo() const -{ - return QFileInfo(filePath()); -} - -/*! - Returns the base directory of the iterator. -*/ -QString QFileSystemIterator::path() const -{ - return QString::fromLocal8Bit(d->m_dirPaths.top()); -} - -QT_END_NAMESPACE diff --git a/tests/benchmarks/qdiriterator/qfilesystemiterator.h b/tests/benchmarks/qdiriterator/qfilesystemiterator.h deleted file mode 100644 index 4aad3a1..0000000 --- a/tests/benchmarks/qdiriterator/qfilesystemiterator.h +++ /dev/null @@ -1,99 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFILESYSTEMITERATOR_H -#define QFILESYSTEMITERATOR_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -class QFileSystemIteratorPrivate; -class //Q_CORE_EXPORT -QFileSystemIterator -{ -public: - enum IteratorFlag { - NoIteratorFlags = 0x0, - FollowSymlinks = 0x1, - Subdirectories = 0x2 - }; - Q_DECLARE_FLAGS(IteratorFlags, IteratorFlag) - - QFileSystemIterator(const QDir &dir, IteratorFlags flags = NoIteratorFlags); - QFileSystemIterator(const QString &path, - IteratorFlags flags = NoIteratorFlags); - QFileSystemIterator(const QString &path, - QDir::Filters filter, - IteratorFlags flags = NoIteratorFlags); - QFileSystemIterator(const QString &path, - const QStringList &nameFilters, - QDir::Filters filters = QDir::NoFilter, - IteratorFlags flags = NoIteratorFlags); - - virtual ~QFileSystemIterator(); - - void next(); - bool atEnd() const; - - QString fileName() const; - QString filePath() const; - QFileInfo fileInfo() const; - QString path() const; - -private: - Q_DISABLE_COPY(QFileSystemIterator) - - QFileSystemIteratorPrivate *d; - friend class QDir; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QFileSystemIterator::IteratorFlags) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/tests/benchmarks/qfile/main.cpp b/tests/benchmarks/qfile/main.cpp deleted file mode 100644 index 103b77c..0000000 --- a/tests/benchmarks/qfile/main.cpp +++ /dev/null @@ -1,675 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include - -#include - -#ifdef Q_OS_WIN -# include -# include -#endif - -#define BUFSIZE 1024*512 -#define FACTOR 1024*512 -#define TF_SIZE FACTOR*81 - -// 10 predefined (but random() seek positions -// hardcoded to be comparable over several runs -const int seekpos[] = {TF_SIZE*0.52, - TF_SIZE*0.23, - TF_SIZE*0.73, - TF_SIZE*0.77, - TF_SIZE*0.80, - TF_SIZE*0.12, - TF_SIZE*0.53, - TF_SIZE*0.21, - TF_SIZE*0.27, - TF_SIZE*0.78}; - -const int sp_size = sizeof(seekpos)/sizeof(int); - -class tst_qfile: public QObject -{ -Q_ENUMS(BenchmarkType) -Q_OBJECT -public: - enum BenchmarkType { - QFileBenchmark = 1, - QFSFileEngineBenchmark, - Win32Benchmark, - PosixBenchmark, - QFileFromPosixBenchmark - }; -private slots: - void initTestCase(); - void cleanupTestCase(); - - void open_data(); - void open(); - void seek_data(); - void seek(); - - void readSmallFiles_QFile(); - void readSmallFiles_QFSFileEngine(); - void readSmallFiles_posix(); - void readSmallFiles_Win32(); - - void readSmallFiles_QFile_data(); - void readSmallFiles_QFSFileEngine_data(); - void readSmallFiles_posix_data(); - void readSmallFiles_Win32_data(); - - void readBigFile_QFile_data(); - void readBigFile_QFSFileEngine_data(); - void readBigFile_posix_data(); - void readBigFile_Win32_data(); - - void readBigFile_QFile(); - void readBigFile_QFSFileEngine(); - void readBigFile_posix(); - void readBigFile_Win32(); - -private: - void readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b); - void readBigFile(); - void readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b); - void readSmallFiles(); - void createFile(); - void fillFile(int factor=FACTOR); - void removeFile(); - void createSmallFiles(); - void removeSmallFiles(); - QString filename; - QString tmpDirName; -}; - -Q_DECLARE_METATYPE(tst_qfile::BenchmarkType) -Q_DECLARE_METATYPE(QIODevice::OpenMode) -Q_DECLARE_METATYPE(QIODevice::OpenModeFlag) - -void tst_qfile::createFile() -{ - removeFile(); // Cleanup in case previous test case aborted before cleaning up - - QTemporaryFile tmpFile; - tmpFile.setAutoRemove(false); - if (!tmpFile.open()) - ::exit(1); - filename = tmpFile.fileName(); - tmpFile.close(); -} - -void tst_qfile::removeFile() -{ - if (!filename.isEmpty()) - QFile::remove(filename); -} - -void tst_qfile::fillFile(int factor) -{ - QFile tmpFile(filename); - tmpFile.open(QIODevice::WriteOnly); - //for (int row=0; row("testType"); - QTest::addColumn("blockSize"); - QTest::addColumn("textMode"); - QTest::addColumn("bufferedMode"); - - const int bs[] = {1024, 1024*2, 1024*8, 1024*16, 1024*32,1024*512}; - int bs_entries = sizeof(bs)/sizeof(const int); - - QString flagstring; - if (t & QIODevice::Text) flagstring += "textMode "; - if (b & QIODevice::Unbuffered) flagstring += "unbuffered "; - if (flagstring.isEmpty()) flagstring = "none"; - - for (int i=0; i("testType"); - QTest::newRow("QFile") << QFileBenchmark; - QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark; - QTest::newRow("Posix FILE*") << PosixBenchmark; -#ifdef Q_OS_WIN - QTest::newRow("Win32 API") << Win32Benchmark; -#endif -} - -void tst_qfile::seek() -{ - QFETCH(tst_qfile::BenchmarkType, testType); - int i = 0; - - createFile(); - fillFile(); - - switch (testType) { - case(QFileBenchmark): { - QFile file(filename); - file.open(QIODevice::ReadOnly); - QBENCHMARK { - i=(i+1)%sp_size; - file.seek(seekpos[i]); - } - file.close(); - } - break; - case(QFSFileEngineBenchmark): { - QFSFileEngine fse(filename); - fse.open(QIODevice::ReadOnly); - QBENCHMARK { - i=(i+1)%sp_size; - fse.seek(seekpos[i]); - } - fse.close(); - } - break; - case(PosixBenchmark): { - QByteArray data = filename.toLocal8Bit(); - const char* cfilename = data.constData(); - FILE* cfile = ::fopen(cfilename, "rb"); - QBENCHMARK { - i=(i+1)%sp_size; - ::fseek(cfile, seekpos[i], SEEK_SET); - } - ::fclose(cfile); - } - break; - case(QFileFromPosixBenchmark): { - // No gain in benchmarking this case - } - break; - case(Win32Benchmark): { -#ifdef Q_OS_WIN - HANDLE hndl; - - // ensure we don't account string conversion - wchar_t* cfilename = (wchar_t*)filename.utf16(); - - hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - Q_ASSERT(hndl); - QBENCHMARK { - i=(i+1)%sp_size; - SetFilePointer(hndl, seekpos[i], NULL, 0); - } - CloseHandle(hndl); -#else - QFAIL("Not running on a Windows plattform!"); -#endif - } - break; - } - - removeFile(); -} - -void tst_qfile::open_data() -{ - QTest::addColumn("testType"); - QTest::newRow("QFile") << QFileBenchmark; - QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark; - QTest::newRow("Posix FILE*") << PosixBenchmark; - QTest::newRow("QFile from FILE*") << QFileFromPosixBenchmark; -#ifdef Q_OS_WIN - QTest::newRow("Win32 API") << Win32Benchmark; -#endif -} - -void tst_qfile::open() -{ - QFETCH(tst_qfile::BenchmarkType, testType); - - createFile(); - - switch (testType) { - case(QFileBenchmark): { - QBENCHMARK { - QFile file( filename ); - file.open( QIODevice::ReadOnly ); - file.close(); - } - } - break; - case(QFSFileEngineBenchmark): { - QBENCHMARK { - QFSFileEngine fse(filename); - fse.open(QIODevice::ReadOnly); - fse.close(); - } - } - break; - - case(PosixBenchmark): { - // ensure we don't account toLocal8Bit() - QByteArray data = filename.toLocal8Bit(); - const char* cfilename = data.constData(); - - QBENCHMARK { - FILE* cfile = ::fopen(cfilename, "rb"); - ::fclose(cfile); - } - } - break; - case(QFileFromPosixBenchmark): { - // ensure we don't account toLocal8Bit() - QByteArray data = filename.toLocal8Bit(); - const char* cfilename = data.constData(); - FILE* cfile = ::fopen(cfilename, "rb"); - - QBENCHMARK { - QFile file; - file.open(cfile, QIODevice::ReadOnly); - file.close(); - } - ::fclose(cfile); - } - break; - case(Win32Benchmark): { -#ifdef Q_OS_WIN - HANDLE hndl; - - // ensure we don't account string conversion - wchar_t* cfilename = (wchar_t*)filename.utf16(); - - QBENCHMARK { - hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - Q_ASSERT(hndl); - CloseHandle(hndl); - } -#else - QFAIL("Not running on a non-Windows platform!"); -#endif - } - break; - } - - removeFile(); -} - - -void tst_qfile::readSmallFiles_QFile() { readSmallFiles(); } -void tst_qfile::readSmallFiles_QFSFileEngine() { readSmallFiles(); } -void tst_qfile::readSmallFiles_posix() { readSmallFiles(); } -void tst_qfile::readSmallFiles_Win32() { readSmallFiles(); } - -void tst_qfile::readSmallFiles_QFile_data() -{ - readSmallFiles_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::NotOpen); - readSmallFiles_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered); - readSmallFiles_data(QFileBenchmark, QIODevice::Text, QIODevice::NotOpen); - readSmallFiles_data(QFileBenchmark, QIODevice::Text, QIODevice::Unbuffered); - -} - -void tst_qfile::readSmallFiles_QFSFileEngine_data() -{ - readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::NotOpen); - readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered); - readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::NotOpen); - readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered); -} - -void tst_qfile::readSmallFiles_posix_data() -{ - readSmallFiles_data(PosixBenchmark, QIODevice::NotOpen, QIODevice::NotOpen); -} - -void tst_qfile::readSmallFiles_Win32_data() -{ - readSmallFiles_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen); -} - - -void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b) -{ - QTest::addColumn("testType"); - QTest::addColumn("blockSize"); - QTest::addColumn("textMode"); - QTest::addColumn("bufferedMode"); - - const int bs[] = {1024, 1024*2, 1024*8, 1024*16, 1024*32,1024*512}; - int bs_entries = sizeof(bs)/sizeof(const int); - - QString flagstring; - if (t & QIODevice::Text) flagstring += "textMode "; - if (b & QIODevice::Unbuffered) flagstring += "unbuffered "; - if (flagstring.isEmpty()) flagstring = "none"; - - for (int i=0; i fileList; - Q_FOREACH(QString file, files) { - QFile *f = new QFile(tmpDirName+ "/" + file); - f->open(QIODevice::ReadOnly|textMode|bufferedMode); - fileList.append(f); - } - - QBENCHMARK { - Q_FOREACH(QFile *file, fileList) { - while (!file->atEnd()) { - file->read(buffer, blockSize); - } - } - } - - Q_FOREACH(QFile *file, fileList) { - file->close(); - delete file; - } - } - break; - case(QFSFileEngineBenchmark): { - QList fileList; - Q_FOREACH(QString file, files) { - QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file); - fse->open(QIODevice::ReadOnly|textMode|bufferedMode); - fileList.append(fse); - } - - QBENCHMARK { - Q_FOREACH(QFSFileEngine *fse, fileList) { - while (fse->read(buffer, blockSize)); - } - } - - Q_FOREACH(QFSFileEngine *fse, fileList) { - fse->close(); - delete fse; - } - } - break; - case(PosixBenchmark): { - QList fileList; - Q_FOREACH(QString file, files) { - fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb")); - } - - QBENCHMARK { - Q_FOREACH(FILE* cfile, fileList) { - while(!feof(cfile)) - ::fread(buffer, blockSize, 1, cfile); - ::fseek(cfile, 0, SEEK_SET); - } - } - - Q_FOREACH(FILE* cfile, fileList) { - ::fclose(cfile); - } - } - break; - case(QFileFromPosixBenchmark): { - // No gain in benchmarking this case - } - break; - case(Win32Benchmark): { -#ifdef Q_OS_WIN - HANDLE hndl; - - // ensure we don't account string conversion - wchar_t* cfilename = (wchar_t*)filename.utf16(); - - hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0); - Q_ASSERT(hndl); - wchar_t* nativeBuffer = new wchar_t[BUFSIZE]; - DWORD numberOfBytesRead; - QBENCHMARK { - do { - ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL); - } while(numberOfBytesRead != 0); - } - delete nativeBuffer; - CloseHandle(hndl); -#else - QFAIL("Not running on a non-Windows platform!"); -#endif - } - break; - } - - removeSmallFiles(); - delete[] buffer; -} - -QTEST_MAIN(tst_qfile) - -#include "main.moc" diff --git a/tests/benchmarks/qfile/qfile.pro b/tests/benchmarks/qfile/qfile.pro deleted file mode 100644 index 99505c3..0000000 --- a/tests/benchmarks/qfile/qfile.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qfile -QT -= gui -win32: DEFINES+= _CRT_SECURE_NO_WARNINGS - -SOURCES += main.cpp diff --git a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp deleted file mode 100644 index 23e07db..0000000 --- a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/main.cpp +++ /dev/null @@ -1,193 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../auto/network-settings.h" - -class qfile_vs_qnetworkaccessmanager : public QObject -{ - Q_OBJECT - // do not use on symbian.. 100 MB is too large.. - // but.. this is a manual test anyway, so :) -protected: - void qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); - void qnamImmediateFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request); - void qfileFileRead_iteration(); - static const int iterations = 10; - -private slots: - void qnamFileRead(); - void qnamImmediateFileRead(); - void qfileFileRead(); - - void initTestCase(); - void cleanupTestCase(); - -public: - qint64 size; - QTemporaryFile testFile; - - qfile_vs_qnetworkaccessmanager() : QObject(), size(0) {}; -}; - -void qfile_vs_qnetworkaccessmanager::initTestCase() -{ - testFile.open(); - QByteArray qba(1*1024*1024, 'x'); // 1 MB - for (int i = 0; i < 100; i++) { - testFile.write(qba); - testFile.flush(); - size += qba.size(); - } // 100 MB - testFile.reset(); -} - -void qfile_vs_qnetworkaccessmanager::cleanupTestCase() -{ - -} - -void qfile_vs_qnetworkaccessmanager::qnamFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request) -{ - QNetworkReply* reply = manager.get(request); - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - QTestEventLoop::instance().enterLoop(10); - QVERIFY(!QTestEventLoop::instance().timeout()); - QByteArray qba = reply->readAll(); - delete reply; -} - -void qfile_vs_qnetworkaccessmanager::qnamFileRead() -{ - QNetworkAccessManager manager; - QTime t; - QNetworkRequest request(QUrl(testFile.fileName())); - - // do 3 dry runs for cache warmup - qnamFileRead_iteration(manager, request); - qnamFileRead_iteration(manager, request); - qnamFileRead_iteration(manager, request); - - t.start(); - // 10 real runs - QBENCHMARK_ONCE { - for (int i = 0; i < iterations; i++) { - qnamFileRead_iteration(manager, request); - } - } - - qint64 elapsed = t.elapsed(); - qDebug() << endl << "Finished!"; - qDebug() << "Bytes:" << size; - qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; -} - -void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead_iteration(QNetworkAccessManager &manager, QNetworkRequest &request) -{ - QNetworkReply* reply = manager.get(request); - QVERIFY(reply->isFinished()); // should be like that! - QByteArray qba = reply->readAll(); - delete reply; -} - -void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead() -{ - QNetworkAccessManager manager; - QTime t; - QNetworkRequest request(QUrl(testFile.fileName())); - - // do 3 dry runs for cache warmup - qnamImmediateFileRead_iteration(manager, request); - qnamImmediateFileRead_iteration(manager, request); - qnamImmediateFileRead_iteration(manager, request); - - t.start(); - // 10 real runs - QBENCHMARK_ONCE { - for (int i = 0; i < iterations; i++) { - qnamImmediateFileRead_iteration(manager, request); - } - } - - qint64 elapsed = t.elapsed(); - qDebug() << endl << "Finished!"; - qDebug() << "Bytes:" << size; - qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; -} - -void qfile_vs_qnetworkaccessmanager::qfileFileRead_iteration() -{ - testFile.reset(); - QByteArray qba = testFile.readAll(); -} - -void qfile_vs_qnetworkaccessmanager::qfileFileRead() -{ - QTime t; - - // do 3 dry runs for cache warmup - qfileFileRead_iteration(); - qfileFileRead_iteration(); - qfileFileRead_iteration(); - - t.start(); - // 10 real runs - QBENCHMARK_ONCE { - for (int i = 0; i < iterations; i++) { - qfileFileRead_iteration(); - } - } - - qint64 elapsed = t.elapsed(); - qDebug() << endl << "Finished!"; - qDebug() << "Bytes:" << size; - qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec"; -} - -QTEST_MAIN(qfile_vs_qnetworkaccessmanager) - -#include "main.moc" diff --git a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro deleted file mode 100644 index 99d1935..0000000 --- a/tests/benchmarks/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = qfile_vs_qnetworkaccessmanager -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui -QT += network - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qfileinfo/main.cpp b/tests/benchmarks/qfileinfo/main.cpp deleted file mode 100644 index 025787f..0000000 --- a/tests/benchmarks/qfileinfo/main.cpp +++ /dev/null @@ -1,83 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include - -#include "private/qfsfileengine_p.h" - -class qfileinfo : public QObject -{ - Q_OBJECT -private slots: - void canonicalFileNamePerformance(); - - void initTestCase(); - void cleanupTestCase(); -public: - qfileinfo() : QObject() {}; -}; - -void qfileinfo::initTestCase() -{ -} - -void qfileinfo::cleanupTestCase() -{ -} - -void qfileinfo::canonicalFileNamePerformance() -{ - QString appPath = QCoreApplication::applicationFilePath(); - QFSFileEnginePrivate::canonicalized(appPath); // warmup - QFSFileEnginePrivate::canonicalized(appPath); // more warmup - QBENCHMARK { - for (int i = 0; i < 5000; i++) { - QFSFileEnginePrivate::canonicalized(appPath); - } - } -} - -QTEST_MAIN(qfileinfo) - -#include "main.moc" diff --git a/tests/benchmarks/qfileinfo/qfileinfo.pro b/tests/benchmarks/qfileinfo/qfileinfo.pro deleted file mode 100644 index 295cb50..0000000 --- a/tests/benchmarks/qfileinfo/qfileinfo.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = qfileinfo -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qfontmetrics/main.cpp b/tests/benchmarks/qfontmetrics/main.cpp deleted file mode 100644 index d3f85ef..0000000 --- a/tests/benchmarks/qfontmetrics/main.cpp +++ /dev/null @@ -1,112 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include - -//this test benchmarks the once-off (per font configuration) cost -//associated with using QFontMetrics -class tst_QFontMetrics : public QObject -{ - Q_OBJECT -public: - tst_QFontMetrics() {} -private slots: - void fontmetrics_create(); - void fontmetrics_create_once_loaded(); - - void fontmetrics_height(); - void fontmetrics_height_once_loaded(); - -private: - void testQFontMetrics(const QFontMetrics &fm); -}; - -void tst_QFontMetrics::testQFontMetrics( const QFontMetrics &fm ) -{ - int fontHeight = fm.height(); -} - -void tst_QFontMetrics::fontmetrics_create() -{ - QBENCHMARK { - QFont boldfont = QApplication::font(); - boldfont.setBold( true ); - boldfont.setPointSize(boldfont.pointSize() * 1.5 ); - QFontMetrics bfm( boldfont ); - } -} - -void tst_QFontMetrics::fontmetrics_create_once_loaded() -{ - QBENCHMARK { - QFont boldfont = QApplication::font(); - boldfont.setBold( true ); - boldfont.setPointSize(boldfont.pointSize() * 1.5 ); - QFontMetrics bfm( boldfont ); - } -} - -void tst_QFontMetrics::fontmetrics_height() -{ - QFont boldfont = QApplication::font(); - boldfont.setBold( true ); - boldfont.setPointSize(boldfont.pointSize() * 1.5 ); - QFontMetrics bfm( boldfont ); - - QBENCHMARK { testQFontMetrics(bfm); } -} - -void tst_QFontMetrics::fontmetrics_height_once_loaded() -{ - QFont boldfont = QApplication::font(); - boldfont.setBold( true ); - boldfont.setPointSize(boldfont.pointSize() * 1.5 ); - QFontMetrics bfm( boldfont ); - QBENCHMARK { testQFontMetrics(bfm); } -} - -QTEST_MAIN(tst_QFontMetrics) - -#include "main.moc" diff --git a/tests/benchmarks/qfontmetrics/qfontmetrics.pro b/tests/benchmarks/qfontmetrics/qfontmetrics.pro deleted file mode 100644 index b6c7b92..0000000 --- a/tests/benchmarks/qfontmetrics/qfontmetrics.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_QFontMetrics - -SOURCES += main.cpp diff --git a/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro deleted file mode 100644 index 0d563b9..0000000 --- a/tests/benchmarks/qgraphicsanchorlayout/qgraphicsanchorlayout.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qgraphicsanchorlayout - -SOURCES += tst_qgraphicsanchorlayout.cpp - diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp deleted file mode 100644 index faacec4..0000000 --- a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ /dev/null @@ -1,433 +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 documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -class tst_QGraphicsAnchorLayout : public QObject -{ - Q_OBJECT -public: - tst_QGraphicsAnchorLayout() {} - ~tst_QGraphicsAnchorLayout() {} - -private slots: - void s60_hard_complex_data(); - void s60_hard_complex(); - void linearVsAnchorSizeHints_data(); - void linearVsAnchorSizeHints(); - void linearVsAnchorSetGeometry_data(); - void linearVsAnchorSetGeometry(); - void linearVsAnchorNested_data(); - void linearVsAnchorNested(); -}; - - -class RectWidget : public QGraphicsWidget -{ -public: - RectWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){} - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) - { - Q_UNUSED(option); - Q_UNUSED(widget); - painter->drawRoundRect(rect()); - painter->drawLine(rect().topLeft(), rect().bottomRight()); - painter->drawLine(rect().bottomLeft(), rect().topRight()); - } -}; - -static QGraphicsWidget *createItem(const QSizeF &minimum = QSizeF(100.0, 100.0), - const QSizeF &preferred = QSize(150.0, 100.0), - const QSizeF &maximum = QSizeF(200.0, 100.0), - const QString &name = QString()) -{ - QGraphicsWidget *w = new RectWidget; - w->setMinimumSize(minimum); - w->setPreferredSize(preferred); - w->setMaximumSize(maximum); - w->setData(0, name); - return w; -} - -static void setAnchor(QGraphicsAnchorLayout *l, - QGraphicsLayoutItem *firstItem, - Qt::AnchorPoint firstEdge, - QGraphicsLayoutItem *secondItem, - Qt::AnchorPoint secondEdge, - qreal spacing) -{ - QGraphicsAnchor *anchor = l->addAnchor(firstItem, firstEdge, secondItem, secondEdge); - anchor->setSpacing(spacing); -} - -void tst_QGraphicsAnchorLayout::s60_hard_complex_data() -{ - QTest::addColumn("whichSizeHint"); - QTest::newRow("minimumSizeHint") - << int(Qt::MinimumSize); - QTest::newRow("preferredSizeHint") - << int(Qt::PreferredSize); - QTest::newRow("maximumSizeHint") - << int(Qt::MaximumSize); - // Add it as a reference to see how much overhead the body of effectiveSizeHint takes. - QTest::newRow("noSizeHint") - << -1; -} - -void tst_QGraphicsAnchorLayout::s60_hard_complex() -{ - QFETCH(int, whichSizeHint); - - // Test for "hard" complex case, taken from wiki - // https://cwiki.nokia.com/S60QTUI/AnchorLayoutComplexCases - QSizeF min(0, 10); - QSizeF pref(50, 10); - QSizeF max(100, 10); - - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - QGraphicsWidget *e = createItem(min, pref, max, "e"); - QGraphicsWidget *f = createItem(min, pref, max, "f"); - QGraphicsWidget *g = createItem(min, pref, max, "g"); - - QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; - l->setContentsMargins(0, 0, 0, 0); - - // - setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 10); - setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 10); - setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 10); - setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 10); - setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 10); - - // - setAnchor(l, b, Qt::AnchorLeft, e, Qt::AnchorLeft, 10); - setAnchor(l, e, Qt::AnchorRight, d, Qt::AnchorLeft, 10); - - // - setAnchor(l, a, Qt::AnchorHorizontalCenter, g, Qt::AnchorLeft, 10); - setAnchor(l, g, Qt::AnchorRight, f, Qt::AnchorHorizontalCenter, 10); - setAnchor(l, c, Qt::AnchorLeft, f, Qt::AnchorLeft, 10); - setAnchor(l, f, Qt::AnchorRight, d, Qt::AnchorRight, 10); - - // - setAnchor(l, l, Qt::AnchorTop, e, Qt::AnchorTop, 0); - setAnchor(l, e, Qt::AnchorBottom, a, Qt::AnchorTop, 0); - setAnchor(l, e, Qt::AnchorBottom, b, Qt::AnchorTop, 0); - setAnchor(l, e, Qt::AnchorBottom, c, Qt::AnchorTop, 0); - setAnchor(l, e, Qt::AnchorBottom, d, Qt::AnchorTop, 0); - setAnchor(l, a, Qt::AnchorBottom, f, Qt::AnchorTop, 0); - setAnchor(l, a, Qt::AnchorBottom, b, Qt::AnchorBottom, 0); - setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorBottom, 0); - setAnchor(l, a, Qt::AnchorBottom, d, Qt::AnchorBottom, 0); - setAnchor(l, f, Qt::AnchorBottom, g, Qt::AnchorTop, 0); - setAnchor(l, g, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); - - // It won't query the size hint if it already has a size set. - // If only one of the sizes is unset it will query sizeHint only of for that hint type. - l->setMinimumSize(60,40); - l->setPreferredSize(220,40); - l->setMaximumSize(240,40); - - switch (whichSizeHint) { - case Qt::MinimumSize: - l->setMinimumSize(-1, -1); - break; - case Qt::PreferredSize: - l->setPreferredSize(-1, -1); - break; - case Qt::MaximumSize: - l->setMaximumSize(-1, -1); - break; - default: - break; - } - - QSizeF sizeHint; - // warm up instruction cache - l->invalidate(); - sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); - // ...then measure... - QBENCHMARK { - l->invalidate(); - sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); - } -} - -static QGraphicsLayout* createLayouts(int whichLayout) -{ - QSizeF min(0, 10); - QSizeF pref(50, 10); - QSizeF max(100, 10); - - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - - QGraphicsLayout *l; - if (whichLayout == 0) { - l = new QGraphicsLinearLayout; - QGraphicsLinearLayout *linear = static_cast(l); - linear->setContentsMargins(0, 0, 0, 0); - - linear->addItem(a); - linear->addItem(b); - linear->addItem(c); - linear->addItem(d); - } else { - l = new QGraphicsAnchorLayout; - QGraphicsAnchorLayout *anchor = static_cast(l); - anchor->setContentsMargins(0, 0, 0, 0); - - // Horizontal - setAnchor(anchor, anchor, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); - setAnchor(anchor, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); - setAnchor(anchor, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); - setAnchor(anchor, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); - setAnchor(anchor, d, Qt::AnchorRight, anchor, Qt::AnchorRight, 0); - - // Vertical - anchor->addAnchors(anchor, a, Qt::Vertical); - anchor->addAnchors(anchor, b, Qt::Vertical); - anchor->addAnchors(anchor, c, Qt::Vertical); - anchor->addAnchors(anchor, d, Qt::Vertical); - } - - return l; -} - -void tst_QGraphicsAnchorLayout::linearVsAnchorSizeHints_data() -{ - QTest::addColumn("whichLayout"); - QTest::addColumn("whichSizeHint"); - - QTest::newRow("QGraphicsLinearLayout::minimum") - << 0 << int(Qt::MinimumSize); - QTest::newRow("QGraphicsLinearLayout::preferred") - << 0 << int(Qt::PreferredSize); - QTest::newRow("QGraphicsLinearLayout::maximum") - << 0 << int(Qt::MaximumSize); - QTest::newRow("QGraphicsLinearLayout::noSizeHint") - << 0 << -1; - - QTest::newRow("QGraphicsAnchorLayout::minimum") - << 1 << int(Qt::MinimumSize); - QTest::newRow("QGraphicsAnchorLayout::preferred") - << 1 << int(Qt::PreferredSize); - QTest::newRow("QGraphicsAnchorLayout::maximum") - << 1 << int(Qt::MaximumSize); - QTest::newRow("QGraphicsAnchorLayout::noSizeHint") - << 1 << -1; -} - -void tst_QGraphicsAnchorLayout::linearVsAnchorSizeHints() -{ - QFETCH(int, whichSizeHint); - QFETCH(int, whichLayout); - - QGraphicsLayout *l = createLayouts(whichLayout); - - QSizeF sizeHint; - // warm up instruction cache - l->invalidate(); - sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); - // ...then measure... - - QBENCHMARK { - l->invalidate(); - sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint); - } -} - -void tst_QGraphicsAnchorLayout::linearVsAnchorSetGeometry_data() -{ - QTest::addColumn("whichLayout"); - - QTest::newRow("QGraphicsLinearLayout") - << 0; - QTest::newRow("QGraphicsAnchorLayout") - << 1; -} - -void tst_QGraphicsAnchorLayout::linearVsAnchorSetGeometry() -{ - QFETCH(int, whichLayout); - - QGraphicsLayout *l = createLayouts(whichLayout); - - QRectF sizeHint; - qreal maxWidth; - qreal increment; - // warm up instruction cache - l->invalidate(); - sizeHint.setSize(l->effectiveSizeHint(Qt::MinimumSize)); - maxWidth = l->effectiveSizeHint(Qt::MaximumSize).width(); - increment = (maxWidth - sizeHint.width()) / 100; - l->setGeometry(sizeHint); - // ...then measure... - - QBENCHMARK { - l->invalidate(); - for (qreal width = sizeHint.width(); width <= maxWidth; width += increment) { - sizeHint.setWidth(width); - l->setGeometry(sizeHint); - } - } -} - -void tst_QGraphicsAnchorLayout::linearVsAnchorNested_data() -{ - QTest::addColumn("whichLayout"); - QTest::newRow("LinearLayout") - << 0; - QTest::newRow("AnchorLayout setup with null-anchors knot") - << 1; - QTest::newRow("AnchorLayout setup easy to simplificate") - << 2; -} - -void tst_QGraphicsAnchorLayout::linearVsAnchorNested() -{ - QFETCH(int, whichLayout); - - QSizeF min(10, 10); - QSizeF pref(80, 80); - QSizeF max(150, 150); - - QGraphicsWidget *a = createItem(min, pref, max, "a"); - QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); - QGraphicsWidget *d = createItem(min, pref, max, "d"); - - QGraphicsLayout *layout; - - if (whichLayout == 0) { - QGraphicsLinearLayout *linear1 = new QGraphicsLinearLayout; - QGraphicsLinearLayout *linear2 = new QGraphicsLinearLayout(Qt::Vertical); - QGraphicsLinearLayout *linear3 = new QGraphicsLinearLayout; - - linear1->addItem(a); - linear1->addItem(linear2); - linear2->addItem(b); - linear2->addItem(linear3); - linear3->addItem(c); - linear3->addItem(d); - - layout = linear1; - } else if (whichLayout == 1) { - QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout; - - // A - anchor->addCornerAnchors(a, Qt::TopLeftCorner, anchor, Qt::TopLeftCorner); - anchor->addCornerAnchors(a, Qt::TopRightCorner, b, Qt::TopLeftCorner); - anchor->addCornerAnchors(a, Qt::BottomLeftCorner, anchor, Qt::BottomLeftCorner); - anchor->addCornerAnchors(a, Qt::BottomRightCorner, c, Qt::BottomLeftCorner); - - // B - anchor->addCornerAnchors(b, Qt::TopRightCorner, anchor, Qt::TopRightCorner); - anchor->addCornerAnchors(b, Qt::BottomLeftCorner, c, Qt::TopLeftCorner); - anchor->addCornerAnchors(b, Qt::BottomRightCorner, d, Qt::TopRightCorner); - - // C - anchor->addCornerAnchors(c, Qt::TopRightCorner, d, Qt::TopLeftCorner); - anchor->addCornerAnchors(c, Qt::BottomRightCorner, d, Qt::BottomLeftCorner); - - // D - anchor->addCornerAnchors(d, Qt::BottomRightCorner, anchor, Qt::BottomRightCorner); - - layout = anchor; - } else { - QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout; - - // A - anchor->addAnchor(a, Qt::AnchorLeft, anchor, Qt::AnchorLeft); - anchor->addAnchors(a, anchor, Qt::Vertical); - anchor->addAnchor(a, Qt::AnchorRight, b, Qt::AnchorLeft); - anchor->addAnchor(a, Qt::AnchorRight, c, Qt::AnchorLeft); - - // B - anchor->addAnchor(b, Qt::AnchorTop, anchor, Qt::AnchorTop); - anchor->addAnchor(b, Qt::AnchorRight, anchor, Qt::AnchorRight); - anchor->addAnchor(b, Qt::AnchorBottom, c, Qt::AnchorTop); - anchor->addAnchor(b, Qt::AnchorBottom, d, Qt::AnchorTop); - - // C - anchor->addAnchor(c, Qt::AnchorRight, d, Qt::AnchorLeft); - anchor->addAnchor(c, Qt::AnchorBottom, anchor, Qt::AnchorBottom); - - // D - anchor->addAnchor(d, Qt::AnchorRight, anchor, Qt::AnchorRight); - anchor->addAnchor(d, Qt::AnchorBottom, anchor, Qt::AnchorBottom); - - layout = anchor; - } - - QSizeF sizeHint; - // warm up instruction cache - layout->invalidate(); - sizeHint = layout->effectiveSizeHint(Qt::PreferredSize); - - // ...then measure... - QBENCHMARK { - // To ensure that all sizeHints caches are invalidated in - // the LinearLayout setup, we must call updateGeometry on the - // children. If we didn't, only the top level layout would be - // re-calculated. - static_cast(a)->updateGeometry(); - static_cast(b)->updateGeometry(); - static_cast(c)->updateGeometry(); - static_cast(d)->updateGeometry(); - layout->invalidate(); - sizeHint = layout->effectiveSizeHint(Qt::PreferredSize); - } -} - -QTEST_MAIN(tst_QGraphicsAnchorLayout) - -#include "tst_qgraphicsanchorlayout.moc" diff --git a/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro b/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro deleted file mode 100644 index 726bb96..0000000 --- a/tests/benchmarks/qgraphicsitem/qgraphicsitem.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qgraphicsitem - -SOURCES += tst_qgraphicsitem.cpp diff --git a/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp deleted file mode 100644 index ac51072..0000000 --- a/tests/benchmarks/qgraphicsitem/tst_qgraphicsitem.cpp +++ /dev/null @@ -1,243 +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 test suite 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 -#include -#include -#include - -//TESTED_FILES= - -class tst_QGraphicsItem : public QObject -{ - Q_OBJECT - -public: - tst_QGraphicsItem(); - virtual ~tst_QGraphicsItem(); - -public slots: - void init(); - void cleanup(); - -private slots: - void setParentItem(); - void setParentItem_deep(); - void setParentItem_deep_reversed(); - void deleteItemWithManyChildren(); - void setPos_data(); - void setPos(); - void setTransform_data(); - void setTransform(); - void rotate(); - void scale(); - void shear(); - void translate(); - void setRotation(); -}; - -tst_QGraphicsItem::tst_QGraphicsItem() -{ -} - -tst_QGraphicsItem::~tst_QGraphicsItem() -{ -} - -void tst_QGraphicsItem::init() -{ -} - -void tst_QGraphicsItem::cleanup() -{ -} - -void tst_QGraphicsItem::setParentItem() -{ - QBENCHMARK { - QGraphicsRectItem rect; - QGraphicsRectItem *childRect = new QGraphicsRectItem; - childRect->setParentItem(&rect); - } -} - -void tst_QGraphicsItem::setParentItem_deep() -{ - QBENCHMARK { - QGraphicsRectItem rect; - QGraphicsRectItem *lastRect = ▭ - for (int i = 0; i < 10; ++i) { - QGraphicsRectItem *childRect = new QGraphicsRectItem; - childRect->setParentItem(lastRect); - lastRect = childRect; - } - QGraphicsItem *first = rect.children().first(); - first->setParentItem(0); - } -} - -void tst_QGraphicsItem::setParentItem_deep_reversed() -{ - QBENCHMARK { - QGraphicsRectItem *lastRect = new QGraphicsRectItem; - for (int i = 0; i < 100; ++i) { - QGraphicsRectItem *parentRect = new QGraphicsRectItem; - lastRect->setParentItem(parentRect); - lastRect = parentRect; - } - delete lastRect; - } -} - -void tst_QGraphicsItem::deleteItemWithManyChildren() -{ - QBENCHMARK { - QGraphicsRectItem *rect = new QGraphicsRectItem; - for (int i = 0; i < 1000; ++i) - new QGraphicsRectItem(rect); - delete rect; - } -} - -void tst_QGraphicsItem::setPos_data() -{ - QTest::addColumn("pos"); - - QTest::newRow("0, 0") << QPointF(0, 0); - QTest::newRow("10, 10") << QPointF(10, 10); - QTest::newRow("-10, -10") << QPointF(-10, -10); -} - -void tst_QGraphicsItem::setPos() -{ - QFETCH(QPointF, pos); - - QGraphicsScene scene; - QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - rect->setPos(10, 10); - rect->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::setTransform_data() -{ - QTest::addColumn("transform"); - - QTest::newRow("id") << QTransform(); - QTest::newRow("rotate 45z") << QTransform().rotate(45); - QTest::newRow("scale 2x2") << QTransform().scale(2, 2); - QTest::newRow("translate 100, 100") << QTransform().translate(100, 100); - QTest::newRow("rotate 45x 45y 45z") << QTransform().rotate(45, Qt::XAxis) - .rotate(45, Qt::YAxis).rotate(45, Qt::ZAxis); -} - -void tst_QGraphicsItem::setTransform() -{ - QFETCH(QTransform, transform); - - QGraphicsScene scene; - QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->setTransform(transform); - item->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::rotate() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->rotate(45); - item->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::scale() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->scale(2, 2); - item->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::shear() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->shear(1.5, 1.5); - item->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::translate() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->translate(100, 100); - item->transform(); // prevent lazy optimizing - } -} - -void tst_QGraphicsItem::setRotation() -{ - QGraphicsScene scene; - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 100, 100)); - - QBENCHMARK { - item->setRotation(45); - item->transform(); // prevent lazy optimizing - } -} - -QTEST_MAIN(tst_QGraphicsItem) -#include "tst_qgraphicsitem.moc" diff --git a/tests/benchmarks/qgraphicsscene/qgraphicsscene.pro b/tests/benchmarks/qgraphicsscene/qgraphicsscene.pro deleted file mode 100644 index b460e2a..0000000 --- a/tests/benchmarks/qgraphicsscene/qgraphicsscene.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qgraphicsscene - -SOURCES += tst_qgraphicsscene.cpp - diff --git a/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp deleted file mode 100644 index 5bd07f9..0000000 --- a/tests/benchmarks/qgraphicsscene/tst_qgraphicsscene.cpp +++ /dev/null @@ -1,248 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -//TESTED_FILES= - -class tst_QGraphicsScene : public QObject -{ - Q_OBJECT - -public: - tst_QGraphicsScene(); - virtual ~tst_QGraphicsScene(); - -public slots: - void init(); - void cleanup(); - -private slots: - void construct(); - void addItem_data(); - void addItem(); - void itemAt_data(); - void itemAt(); - void initialShow(); -}; - -tst_QGraphicsScene::tst_QGraphicsScene() -{ -} - -tst_QGraphicsScene::~tst_QGraphicsScene() -{ -} - -void tst_QGraphicsScene::init() -{ -} - -void tst_QGraphicsScene::cleanup() -{ -} - -void tst_QGraphicsScene::construct() -{ - QBENCHMARK { - QGraphicsScene scene; - } -} - -void tst_QGraphicsScene::addItem_data() -{ - QTest::addColumn("indexMethod"); - QTest::addColumn("sceneRect"); - QTest::addColumn("numItems_X"); - QTest::addColumn("numItems_Y"); - QTest::addColumn("itemType"); - QTest::addColumn("itemRect"); - - QTest::newRow("null") << 0 << QRectF() << 0 << 0 << 0 << QRectF(); - QTest::newRow("0 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF() << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF() << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF() << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,0)") << 0 << QRectF() << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF() << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 0 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("0 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 0 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF() << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF() << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 10 x 10 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 25 x 25 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 100 x 100 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 250 x 250 QGraphicsRectItem (0,0,10,10)") << 1 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsRectItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 10 x 10 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 100, 100) << 10 << 10 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 25 x 25 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 250, 250) << 25 << 25 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 100 x 100 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 1000, 1000) << 100 << 100 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); - QTest::newRow("1 QRectF() 250 x 250 QGraphicsEllipseItem (0,0,10,10)") << 1 << QRectF(0, 0, 2500, 2500) << 250 << 250 << int(QGraphicsEllipseItem::Type) << QRectF(0, 0, 10, 10); -} - -void tst_QGraphicsScene::addItem() -{ - QFETCH(int, indexMethod); - QFETCH(QRectF, sceneRect); - QFETCH(int, numItems_X); - QFETCH(int, numItems_Y); - QFETCH(int, itemType); - QFETCH(QRectF, itemRect); - - QGraphicsScene scene; - scene.setItemIndexMethod(indexMethod ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); - if (!sceneRect.isNull()) - scene.setSceneRect(sceneRect); - - QBENCHMARK { - QGraphicsItem *item = 0; - for (int y = 0; y < numItems_Y; ++y) { - for (int x = 0; x < numItems_X; ++x) { - switch (itemType) { - case QGraphicsRectItem::Type: - item = new QGraphicsRectItem(itemRect); - break; - case QGraphicsEllipseItem::Type: - default: - item = new QGraphicsEllipseItem(itemRect); - break; - } - item->setPos(x * itemRect.width(), y * itemRect.height()); - scene.addItem(item); - } - } - scene.itemAt(0, 0); - } - //let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list - qApp->processEvents(); -} - -void tst_QGraphicsScene::itemAt_data() -{ - QTest::addColumn("bspTreeDepth"); - QTest::addColumn("sceneRect"); - QTest::addColumn("numItems_X"); - QTest::addColumn("numItems_Y"); - QTest::addColumn("itemRect"); - - QTest::newRow("null") << 0 << QRectF() << 0 << 0 << QRectF(); - QTest::newRow("NoIndex 10x10") << -1 << QRectF() << 10 << 10 << QRectF(-10, -10, 20, 20); - QTest::newRow("NoIndex 25x25") << -1 << QRectF() << 25 << 25 << QRectF(-10, -10, 20, 20); - QTest::newRow("NoIndex 100x100") << -1 << QRectF() << 100 << 100 << QRectF(-10, -10, 20, 20); - QTest::newRow("NoIndex 250x250") << -1 << QRectF() << 250 << 250 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=auto 10x10") << 0 << QRectF() << 10 << 10 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=auto 25x25") << 0 << QRectF() << 25 << 25 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=auto 100x100") << 0 << QRectF() << 100 << 100 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=auto 250x250") << 0 << QRectF() << 250 << 250 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=16 10x10") << 16 << QRectF() << 10 << 10 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=16 25x25") << 16 << QRectF() << 25 << 25 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=16 100x100") << 16 << QRectF() << 100 << 100 << QRectF(-10, -10, 20, 20); - QTest::newRow("BspTreeIndex depth=16 250x250") << 16 << QRectF() << 250 << 250 << QRectF(-10, -10, 20, 20); -} - -void tst_QGraphicsScene::itemAt() -{ - QFETCH(int, bspTreeDepth); - QFETCH(QRectF, sceneRect); - QFETCH(int, numItems_X); - QFETCH(int, numItems_Y); - QFETCH(QRectF, itemRect); - - QGraphicsScene scene; - scene.setItemIndexMethod(bspTreeDepth >= 0 ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); - if (bspTreeDepth > 0) - scene.setBspTreeDepth(bspTreeDepth); - if (!sceneRect.isNull()) - scene.setSceneRect(sceneRect); - - QGraphicsItem *item = 0; - for (int y = 0; y < numItems_Y; ++y) { - for (int x = 0; x < numItems_X; ++x) { - QGraphicsRectItem *item = new QGraphicsRectItem(itemRect); - item->setPos((x - numItems_X/2) * itemRect.width(), (y - numItems_Y/2) * itemRect.height()); - scene.addItem(item); - } - } - - scene.itemAt(0, 0); // triggers indexing - - QBENCHMARK { - scene.itemAt(0, 0); - } - - //let QGraphicsScene::_q_polishItems be called so ~QGraphicsItem doesn't spend all his time cleaning the unpolished list - qApp->processEvents(); -} - -void tst_QGraphicsScene::initialShow() -{ - QGraphicsScene scene; - - QBENCHMARK { - for (int y = 0; y < 30000; ++y) { - QGraphicsRectItem *item = new QGraphicsRectItem(0, 0, 50, 50); - item->setPos((y/2) * item->rect().width(), (y/2) * item->rect().height()); - scene.addItem(item); - } - scene.itemAt(0, 0); // triggers indexing - //This call polish the items so we bench their processing too. - qApp->processEvents(); - } -} - -QTEST_MAIN(tst_QGraphicsScene) -#include "tst_qgraphicsscene.moc" diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.cpp b/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.cpp deleted file mode 100644 index 77b86c1..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.cpp +++ /dev/null @@ -1,176 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "chip.h" - -#include - -Chip::Chip(const QColor &color, int x, int y) -{ - this->x = x; - this->y = y; - this->color = color; - setZValue((x + y) % 2); - - setFlags(ItemIsSelectable | ItemIsMovable); - setAcceptsHoverEvents(true); -} - -QRectF Chip::boundingRect() const -{ - return QRectF(0, 0, 110, 70); -} - -QPainterPath Chip::shape() const -{ - QPainterPath path; - path.addRect(14, 14, 82, 42); - return path; -} - -void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(widget); - - QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; - if (option->state & QStyle::State_MouseOver) - fillColor = fillColor.light(125); - - if (option->levelOfDetail < 0.2) { - if (option->levelOfDetail < 0.125) { - painter->fillRect(QRectF(0, 0, 110, 70), fillColor); - return; - } - - painter->setPen(QPen(Qt::black, 0)); - painter->setBrush(fillColor); - painter->drawRect(13, 13, 97, 57); - return; - } - - QPen oldPen = painter->pen(); - QPen pen = oldPen; - int width = 0; - if (option->state & QStyle::State_Selected) - width += 2; - - pen.setWidth(width); - painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100))); - - painter->drawRect(QRect(14, 14, 79, 39)); - if (option->levelOfDetail >= 1) { - painter->setPen(QPen(Qt::gray, 1)); - painter->drawLine(15, 54, 94, 54); - painter->drawLine(94, 53, 94, 15); - painter->setPen(QPen(Qt::black, 0)); - } - - // Draw text - if (option->levelOfDetail >= 2) { - QFont font("Times", 10); - font.setStyleStrategy(QFont::ForceOutline); - painter->setFont(font); - painter->save(); - painter->scale(0.1, 0.1); - painter->drawText(170, 180, QString("Model: VSC-2000 (Very Small Chip) at %1x%2").arg(x).arg(y)); - painter->drawText(170, 200, QString("Serial number: DLWR-WEER-123L-ZZ33-SDSJ")); - painter->drawText(170, 220, QString("Manufacturer: Chip Manufacturer")); - painter->restore(); - } - - // Draw lines - QVarLengthArray lines; - if (option->levelOfDetail >= 0.5) { - for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { - lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5)); - lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62)); - } - for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { - lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5)); - lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5)); - } - } - if (option->levelOfDetail >= 0.4) { - const QLineF lineData[] = { - QLineF(25, 35, 35, 35), - QLineF(35, 30, 35, 40), - QLineF(35, 30, 45, 35), - QLineF(35, 40, 45, 35), - QLineF(45, 30, 45, 40), - QLineF(45, 35, 55, 35) - }; - lines.append(lineData, 6); - } - painter->drawLines(lines.data(), lines.size()); - - // Draw red ink - if (stuff.size() > 1) { - painter->setPen(QPen(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - painter->setBrush(Qt::NoBrush); - QPainterPath path; - path.moveTo(stuff.first()); - for (int i = 1; i < stuff.size(); ++i) - path.lineTo(stuff.at(i)); - painter->drawPath(path); - } -} - -void Chip::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - QGraphicsItem::mousePressEvent(event); - update(); -} - -void Chip::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->modifiers() & Qt::ShiftModifier) { - stuff << event->pos(); - update(); - return; - } - QGraphicsItem::mouseMoveEvent(event); -} - -void Chip::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - QGraphicsItem::mouseReleaseEvent(event); - update(); -} diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.debug b/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.debug deleted file mode 100644 index 8fe1e5b..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.debug and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.h b/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.h deleted file mode 100644 index 9db23f9..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.h +++ /dev/null @@ -1,68 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CHIP_H -#define CHIP_H - -#include -#include - -class Chip : public QGraphicsItem -{ -public: - Chip(const QColor &color, int x, int y); - - QRectF boundingRect() const; - QPainterPath shape() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - -private: - int x, y; - QColor color; - QList stuff; -}; - -#endif diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.pro b/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.pro deleted file mode 100644 index 53fa23b..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/chip.pro +++ /dev/null @@ -1,19 +0,0 @@ -RESOURCES += images.qrc - -HEADERS += mainwindow.h view.h chip.h -SOURCES += main.cpp -SOURCES += mainwindow.cpp view.cpp chip.cpp - -contains(QT_CONFIG, opengl):QT += opengl - -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} - -# install -target.path = $$[QT_INSTALL_DEMOS]/chip -sources.files = $$SOURCES $$HEADERS $$RESOURCES *.png *.pro *.html *.doc images -sources.path = $$[QT_INSTALL_DEMOS]/chip -INSTALLS += target sources - diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/fileprint.png b/tests/benchmarks/qgraphicsview/benchapps/chipTest/fileprint.png deleted file mode 100644 index ba7c02d..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/fileprint.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/images.qrc b/tests/benchmarks/qgraphicsview/benchapps/chipTest/images.qrc deleted file mode 100644 index c7cdf0c..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/images.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - qt4logo.png - zoomin.png - zoomout.png - rotateleft.png - rotateright.png - fileprint.png - - diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/main.cpp b/tests/benchmarks/qgraphicsview/benchapps/chipTest/main.cpp deleted file mode 100644 index ea2f94a..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/main.cpp +++ /dev/null @@ -1,57 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mainwindow.h" - -#include - -int main(int argc, char **argv) -{ - Q_INIT_RESOURCE(images); - - QApplication app(argc, argv); - app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); - - MainWindow window; - window.show(); - - return app.exec(); -} diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.cpp b/tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.cpp deleted file mode 100644 index 452b42c..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.cpp +++ /dev/null @@ -1,87 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mainwindow.h" -#include "view.h" -#include "chip.h" - -#include - -MainWindow::MainWindow(QWidget *parent) - : QWidget(parent) -{ - populateScene(); - - View *view = new View("Top left view"); - view->view()->setScene(scene); - QHBoxLayout *layout = new QHBoxLayout; - layout->addWidget(view); - setLayout(layout); - - setWindowTitle(tr("Chip Demo")); -} - -void MainWindow::populateScene() -{ - scene = new QGraphicsScene; - - QImage image(":/qt4logo.png"); - - // Populate scene - int xx = 0; - int nitems = 0; - for (int i = -11000; i < 11000; i += 110) { - ++xx; - int yy = 0; - for (int j = -7000; j < 7000; j += 70) { - ++yy; - qreal x = (i + 11000) / 22000.0; - qreal y = (j + 7000) / 14000.0; - - QColor color(image.pixel(int(image.width() * x), int(image.height() * y))); - QGraphicsItem *item = new Chip(color, xx, yy); - item->setPos(QPointF(i, j)); - scene->addItem(item); - - ++nitems; - } - } -} diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.h b/tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.h deleted file mode 100644 index 558bbef..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/mainwindow.h +++ /dev/null @@ -1,66 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsScene) -QT_FORWARD_DECLARE_CLASS(QGraphicsView) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QSplitter) - -class MainWindow : public QWidget -{ - Q_OBJECT -public: - MainWindow(QWidget *parent = 0); - -private: - void setupMatrix(); - void populateScene(); - - QGraphicsScene *scene; -}; - -#endif diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/qt4logo.png b/tests/benchmarks/qgraphicsview/benchapps/chipTest/qt4logo.png deleted file mode 100644 index 157e86e..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/qt4logo.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateleft.png b/tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateleft.png deleted file mode 100644 index 8cfa931..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateleft.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateright.png b/tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateright.png deleted file mode 100644 index ec5e866..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/rotateright.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/qgraphicsview/benchapps/chipTest/view.cpp deleted file mode 100644 index 1028f42..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/view.cpp +++ /dev/null @@ -1,257 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "view.h" - -#include -#include "valgrind/callgrind.h" -#ifndef QT_NO_OPENGL -#include -#endif - -#include - -class CountView : public QGraphicsView -{ -protected: - void paintEvent(QPaintEvent *event) - { - static int n = 0; - if (n) - CALLGRIND_START_INSTRUMENTATION - QGraphicsView::paintEvent(event); - if (n) - CALLGRIND_STOP_INSTRUMENTATION - if (++n == 500) - qApp->quit(); - } -}; - -View::View(const QString &name, QWidget *parent) - : QFrame(parent) -{ - setFrameStyle(Sunken | StyledPanel); - graphicsView = new CountView; - graphicsView->setRenderHint(QPainter::Antialiasing, false); - graphicsView->setDragMode(QGraphicsView::RubberBandDrag); - graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); - - int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize); - QSize iconSize(size, size); - - QToolButton *zoomInIcon = new QToolButton; - zoomInIcon->setAutoRepeat(true); - zoomInIcon->setAutoRepeatInterval(33); - zoomInIcon->setAutoRepeatDelay(0); - zoomInIcon->setIcon(QPixmap(":/zoomin.png")); - zoomInIcon->setIconSize(iconSize); - QToolButton *zoomOutIcon = new QToolButton; - zoomOutIcon->setAutoRepeat(true); - zoomOutIcon->setAutoRepeatInterval(33); - zoomOutIcon->setAutoRepeatDelay(0); - zoomOutIcon->setIcon(QPixmap(":/zoomout.png")); - zoomOutIcon->setIconSize(iconSize); - zoomSlider = new QSlider; - zoomSlider->setMinimum(0); - zoomSlider->setMaximum(500); - zoomSlider->setValue(250); - zoomSlider->setTickPosition(QSlider::TicksRight); - - // Zoom slider layout - QVBoxLayout *zoomSliderLayout = new QVBoxLayout; - zoomSliderLayout->addWidget(zoomInIcon); - zoomSliderLayout->addWidget(zoomSlider); - zoomSliderLayout->addWidget(zoomOutIcon); - - QToolButton *rotateLeftIcon = new QToolButton; - rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png")); - rotateLeftIcon->setIconSize(iconSize); - QToolButton *rotateRightIcon = new QToolButton; - rotateRightIcon->setIcon(QPixmap(":/rotateright.png")); - rotateRightIcon->setIconSize(iconSize); - rotateSlider = new QSlider; - rotateSlider->setOrientation(Qt::Horizontal); - rotateSlider->setMinimum(-360); - rotateSlider->setMaximum(360); - rotateSlider->setValue(0); - rotateSlider->setTickPosition(QSlider::TicksBelow); - - // Rotate slider layout - QHBoxLayout *rotateSliderLayout = new QHBoxLayout; - rotateSliderLayout->addWidget(rotateLeftIcon); - rotateSliderLayout->addWidget(rotateSlider); - rotateSliderLayout->addWidget(rotateRightIcon); - - resetButton = new QToolButton; - resetButton->setText(tr("0")); - resetButton->setEnabled(false); - - // Label layout - QHBoxLayout *labelLayout = new QHBoxLayout; - label = new QLabel(name); - antialiasButton = new QToolButton; - antialiasButton->setText(tr("Antialiasing")); - antialiasButton->setCheckable(true); - antialiasButton->setChecked(false); - openGlButton = new QToolButton; - openGlButton->setText(tr("OpenGL")); - openGlButton->setCheckable(true); -#ifndef QT_NO_OPENGL - openGlButton->setEnabled(QGLFormat::hasOpenGL()); -#else - openGlButton->setEnabled(false); -#endif - printButton = new QToolButton; - printButton->setIcon(QIcon(QPixmap(":/fileprint.png"))); - - labelLayout->addWidget(label); - labelLayout->addStretch(); - labelLayout->addWidget(antialiasButton); - labelLayout->addWidget(openGlButton); - labelLayout->addWidget(printButton); - - QGridLayout *topLayout = new QGridLayout; - topLayout->addLayout(labelLayout, 0, 0); - topLayout->addWidget(graphicsView, 1, 0); - topLayout->addLayout(zoomSliderLayout, 1, 1); - topLayout->addLayout(rotateSliderLayout, 2, 0); - topLayout->addWidget(resetButton, 2, 1); - setLayout(topLayout); - - connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView())); - connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix())); - connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix())); - connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled())); - connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled())); - connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing())); - connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL())); - connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft())); - connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight())); - connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn())); - connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut())); - connect(printButton, SIGNAL(clicked()), this, SLOT(print())); - - setupMatrix(); - - startTimer(0); -} - -QGraphicsView *View::view() const -{ - return graphicsView; -} - -void View::resetView() -{ - zoomSlider->setValue(250); - rotateSlider->setValue(0); - setupMatrix(); - graphicsView->ensureVisible(QRectF(0, 0, 0, 0)); - - resetButton->setEnabled(false); -} - -void View::setResetButtonEnabled() -{ - resetButton->setEnabled(true); -} - -void View::setupMatrix() -{ - qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50)); - - QMatrix matrix; - matrix.scale(scale, scale); - matrix.rotate(rotateSlider->value()); - - graphicsView->setMatrix(matrix); - setResetButtonEnabled(); -} - -void View::toggleOpenGL() -{ -#ifndef QT_NO_OPENGL - graphicsView->setViewport(openGlButton->isChecked() ? new QGLWidget(QGLFormat(QGL::SampleBuffers)) : new QWidget); -#endif -} - -void View::toggleAntialiasing() -{ - graphicsView->setRenderHint(QPainter::Antialiasing, antialiasButton->isChecked()); -} - -void View::print() -{ -#ifndef QT_NO_PRINTER - QPrinter printer; - QPrintDialog dialog(&printer, this); - if (dialog.exec() == QDialog::Accepted) { - QPainter painter(&printer); - graphicsView->render(&painter); - } -#endif -} - -void View::zoomIn() -{ - zoomSlider->setValue(zoomSlider->value() + 1); -} - -void View::zoomOut() -{ - zoomSlider->setValue(zoomSlider->value() - 1); -} - -void View::rotateLeft() -{ - rotateSlider->setValue(rotateSlider->value() - 10); -} - -void View::rotateRight() -{ - rotateSlider->setValue(rotateSlider->value() + 10); -} - -void View::timerEvent(QTimerEvent *) -{ - graphicsView->horizontalScrollBar()->setValue(graphicsView->horizontalScrollBar()->value() + 1); -} - diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/view.h b/tests/benchmarks/qgraphicsview/benchapps/chipTest/view.h deleted file mode 100644 index fc5c226..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/chipTest/view.h +++ /dev/null @@ -1,86 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef VIEW_H -#define VIEW_H - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsView) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QToolButton) - -class View : public QFrame -{ - Q_OBJECT -public: - View(const QString &name, QWidget *parent = 0); - - QGraphicsView *view() const; - -private slots: - void resetView(); - void setResetButtonEnabled(); - void setupMatrix(); - void toggleOpenGL(); - void toggleAntialiasing(); - void print(); - - void zoomIn(); - void zoomOut(); - void rotateLeft(); - void rotateRight(); - - void timerEvent(QTimerEvent *); - -private: - QGraphicsView *graphicsView; - QLabel *label; - QToolButton *openGlButton; - QToolButton *antialiasButton; - QToolButton *printButton; - QToolButton *resetButton; - QSlider *zoomSlider; - QSlider *rotateSlider; -}; - -#endif diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomin.png b/tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomin.png deleted file mode 100644 index 8b0daee..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomin.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomout.png b/tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomout.png deleted file mode 100644 index 1575dd2..0000000 Binary files a/tests/benchmarks/qgraphicsview/benchapps/chipTest/zoomout.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/qgraphicsview/benchapps/moveItems/main.cpp deleted file mode 100644 index 527713f..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/moveItems/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "valgrind/callgrind.h" - -#ifdef Q_WS_X11 -extern void qt_x11_wait_for_window_manager(QWidget *); -#endif - -class View : public QGraphicsView -{ - Q_OBJECT -public: - View(QGraphicsScene *scene, QGraphicsItem *item) - : QGraphicsView(scene), _item(item) - { - } - -protected: - void paintEvent(QPaintEvent *event) - { - static int n = 0; - if (n) - CALLGRIND_START_INSTRUMENTATION - QGraphicsView::paintEvent(event); - _item->moveBy(1, 1); - if (n) - CALLGRIND_STOP_INSTRUMENTATION - if (++n == 200) - qApp->quit(); - } - -private: - QGraphicsItem *_item; -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - if (argc < 2) { - qDebug("usage: ./%s ", argv[0]); - return 1; - } - - QGraphicsScene scene(-150, -150, 300, 300); - scene.setItemIndexMethod(QGraphicsScene::NoIndex); - - QGraphicsRectItem *item = scene.addRect(-50, -50, 100, 100, QPen(Qt::NoPen), QBrush(Qt::blue)); - item->setFlag(QGraphicsItem::ItemIsMovable); - - for (int i = 0; i < atoi(argv[1]); ++i) { - QGraphicsRectItem *child = scene.addRect(-5, -5, 10, 10, QPen(Qt::NoPen), QBrush(Qt::blue)); - child->setPos(-50 + qrand() % 100, -50 + qrand() % 100); - child->setParentItem(item); - } - - View view(&scene, item); - view.resize(300, 300); - view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - - return app.exec(); -} - -#include "main.moc" diff --git a/tests/benchmarks/qgraphicsview/benchapps/moveItems/moveItems.pro b/tests/benchmarks/qgraphicsview/benchapps/moveItems/moveItems.pro deleted file mode 100644 index 28dcadc..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/moveItems/moveItems.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp deleted file mode 100644 index 7419206..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/scrolltest/main.cpp +++ /dev/null @@ -1,146 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "valgrind/callgrind.h" - -class ItemMover : public QObject -{ - Q_OBJECT -public: - ItemMover(QGraphicsItem *item) - : _item(item) - { - startTimer(0); - } - -protected: - void timerEvent(QTimerEvent *event) - { - _item->moveBy(-1, 0); - } - -private: - QGraphicsItem *_item; -}; - -class ClipItem : public QGraphicsRectItem -{ -public: - ClipItem(qreal x, qreal y, qreal w, qreal h, const QPen &pen, const QBrush &brush) - : QGraphicsRectItem(x, y, w, h) - { - setPen(pen); - setBrush(brush); - } - - QPainterPath shape() const - { - QPainterPath path; - path.addRect(rect()); - return path; - } -}; - -class CountView : public QGraphicsView -{ -protected: - void paintEvent(QPaintEvent *event) - { - static int n = 0; - if (n) - CALLGRIND_START_INSTRUMENTATION - QGraphicsView::paintEvent(event); - if (n) - CALLGRIND_STOP_INSTRUMENTATION - if (++n == 500) - qApp->quit(); - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QGraphicsScene scene; - scene.setItemIndexMethod(QGraphicsScene::NoIndex); - - ClipItem *clipItem = new ClipItem(0, 0, 100, 100, QPen(), QBrush(Qt::blue)); - clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - clipItem->setData(0, "clipItem"); - scene.addItem(clipItem); - - QGraphicsRectItem *scrollItem = scene.addRect(0, 0, 10, 10, QPen(Qt::NoPen), QBrush(Qt::NoBrush)); - scrollItem->setParentItem(clipItem); - scrollItem->setFlag(QGraphicsItem::ItemIsMovable); - scrollItem->setData(0, "scrollItem"); - - for (int y = 0; y < 25; ++y) { - for (int x = 0; x < 25; ++x) { - ClipItem *rect = new ClipItem(0, 0, 90, 20, QPen(Qt::NoPen), QBrush(Qt::green)); - rect->setParentItem(scrollItem); - rect->setPos(x * 95, y * 25); - rect->setData(0, qPrintable(QString("rect %1 %2").arg(x).arg(y))); - rect->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - - QGraphicsEllipseItem *ellipse = new QGraphicsEllipseItem(-5, -5, 10, 10); - ellipse->setPen(QPen(Qt::NoPen)); - ellipse->setBrush(QBrush(Qt::yellow)); - ellipse->setParentItem(rect); - ellipse->setData(0, qPrintable(QString("ellipse %1 %2").arg(x).arg(y))); - } - } - - scrollItem->setRect(scrollItem->childrenBoundingRect()); - -#if 0 - ItemMover mover(scrollItem); -#endif - - CountView view; - view.setScene(&scene); - view.setSceneRect(-25, -25, 150, 150); - view.resize(300, 300); - view.show(); - - return app.exec(); -} - -#include "main.moc" diff --git a/tests/benchmarks/qgraphicsview/benchapps/scrolltest/scrolltest.pro b/tests/benchmarks/qgraphicsview/benchapps/scrolltest/scrolltest.pro deleted file mode 100644 index 28dcadc..0000000 --- a/tests/benchmarks/qgraphicsview/benchapps/scrolltest/scrolltest.pro +++ /dev/null @@ -1 +0,0 @@ -SOURCES += main.cpp diff --git a/tests/benchmarks/qgraphicsview/chiptester/chip.cpp b/tests/benchmarks/qgraphicsview/chiptester/chip.cpp deleted file mode 100644 index 4c1020a..0000000 --- a/tests/benchmarks/qgraphicsview/chiptester/chip.cpp +++ /dev/null @@ -1,182 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "chip.h" - -#include - -Chip::Chip(const QColor &color, int x, int y) -{ - this->x = x; - this->y = y; - this->color = color; - setZValue((x + y) % 2); - - setFlags(ItemIsSelectable | ItemIsMovable); - setAcceptsHoverEvents(true); -} - -QRectF Chip::boundingRect() const -{ - return QRectF(0, 0, 110, 70); -} - -QPainterPath Chip::shape() const -{ - QPainterPath path; - path.addRect(14, 14, 82, 42); - return path; -} - -void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) -{ - Q_UNUSED(widget); - - QColor fillColor = (option->state & QStyle::State_Selected) ? color.dark(150) : color; - if (option->state & QStyle::State_MouseOver) - fillColor = fillColor.light(125); - - if (option->levelOfDetail < 0.2) { - if (option->levelOfDetail < 0.125) { - painter->fillRect(QRectF(0, 0, 110, 70), fillColor); - return; - } - - QBrush b = painter->brush(); - painter->setBrush(fillColor); - painter->drawRect(13, 13, 97, 57); - painter->setBrush(b); - return; - } - - QPen oldPen = painter->pen(); - QPen pen = oldPen; - int width = 0; - if (option->state & QStyle::State_Selected) - width += 2; - - pen.setWidth(width); - QBrush b = painter->brush(); - painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100))); - - painter->drawRect(QRect(14, 14, 79, 39)); - painter->setBrush(b); - - if (option->levelOfDetail >= 1) { - painter->setPen(QPen(Qt::gray, 1)); - painter->drawLine(15, 54, 94, 54); - painter->drawLine(94, 53, 94, 15); - painter->setPen(QPen(Qt::black, 0)); - } - - // Draw text - if (option->levelOfDetail >= 2) { - QFont font("Times", 10); - font.setStyleStrategy(QFont::ForceOutline); - painter->setFont(font); - painter->save(); - painter->scale(0.1, 0.1); - painter->drawText(170, 180, QString("Model: VSC-2000 (Very Small Chip) at %1x%2").arg(x).arg(y)); - painter->drawText(170, 200, QString("Serial number: DLWR-WEER-123L-ZZ33-SDSJ")); - painter->drawText(170, 220, QString("Manufacturer: Chip Manufacturer")); - painter->restore(); - } - - // Draw lines - QVarLengthArray lines; - if (option->levelOfDetail >= 0.5) { - for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { - lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5)); - lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62)); - } - for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) { - lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5)); - lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5)); - } - } - if (option->levelOfDetail >= 0.4) { - const QLineF lineData[] = { - QLineF(25, 35, 35, 35), - QLineF(35, 30, 35, 40), - QLineF(35, 30, 45, 35), - QLineF(35, 40, 45, 35), - QLineF(45, 30, 45, 40), - QLineF(45, 35, 55, 35) - }; - lines.append(lineData, 6); - } - painter->drawLines(lines.data(), lines.size()); - - // Draw red ink - if (stuff.size() > 1) { - QPen p = painter->pen(); - painter->setPen(QPen(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); - painter->setBrush(Qt::NoBrush); - QPainterPath path; - path.moveTo(stuff.first()); - for (int i = 1; i < stuff.size(); ++i) - path.lineTo(stuff.at(i)); - painter->drawPath(path); - painter->setPen(p); - } -} - -void Chip::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - QGraphicsItem::mousePressEvent(event); - update(); -} - -void Chip::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - if (event->modifiers() & Qt::ShiftModifier) { - stuff << event->pos(); - update(); - return; - } - QGraphicsItem::mouseMoveEvent(event); -} - -void Chip::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - QGraphicsItem::mouseReleaseEvent(event); - update(); -} diff --git a/tests/benchmarks/qgraphicsview/chiptester/chip.h b/tests/benchmarks/qgraphicsview/chiptester/chip.h deleted file mode 100644 index 9db23f9..0000000 --- a/tests/benchmarks/qgraphicsview/chiptester/chip.h +++ /dev/null @@ -1,68 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CHIP_H -#define CHIP_H - -#include -#include - -class Chip : public QGraphicsItem -{ -public: - Chip(const QColor &color, int x, int y); - - QRectF boundingRect() const; - QPainterPath shape() const; - void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - -private: - int x, y; - QColor color; - QList stuff; -}; - -#endif diff --git a/tests/benchmarks/qgraphicsview/chiptester/chiptester.cpp b/tests/benchmarks/qgraphicsview/chiptester/chiptester.cpp deleted file mode 100644 index 8cada67..0000000 --- a/tests/benchmarks/qgraphicsview/chiptester/chiptester.cpp +++ /dev/null @@ -1,144 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "chiptester.h" -#include "chip.h" - -#include -#ifndef QT_NO_OPENGL -#include -#endif - -ChipTester::ChipTester(QWidget *parent) - : QGraphicsView(parent), - npaints(0) -{ - resize(400, 300); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setFrameStyle(0); - setTransformationAnchor(NoAnchor); - - populateScene(); - setScene(scene); - - setWindowTitle(tr("Chip Demo")); -} - -void ChipTester::setAntialias(bool enabled) -{ - setRenderHint(QPainter::Antialiasing, enabled); -} - -void ChipTester::setOpenGL(bool enabled) -{ -#ifndef QT_NO_OPENGL - setViewport(enabled ? new QGLWidget(QGLFormat(QGL::SampleBuffers)) : 0); -#endif -} - -void ChipTester::setOperation(Operation operation) -{ - this->operation = operation; -} - -void ChipTester::runBenchmark() -{ - npaints = 0; - timerId = startTimer(0); - stopWatch.start(); - eventLoop.exec(); - killTimer(timerId); -} - -void ChipTester::paintEvent(QPaintEvent *event) -{ - QGraphicsView::paintEvent(event); - if (++npaints == 50) - eventLoop.quit(); -} - -void ChipTester::timerEvent(QTimerEvent *) -{ - switch (operation) { - case Rotate360: - rotate(1); - break; - case ZoomInOut: { - qreal s = 0.05 + (npaints / 20.0); - setTransform(QTransform().scale(s, s)); - break; - } - case Translate: { - int offset = horizontalScrollBar()->minimum() - + (npaints % (horizontalScrollBar()->maximum() - horizontalScrollBar()->minimum())); - horizontalScrollBar()->setValue(offset); - break; - } - } -} - -void ChipTester::populateScene() -{ - scene = new QGraphicsScene; - - QImage image(":/qt4logo.png"); - - // Populate scene - int xx = 0; - int nitems = 0; - for (int i = -1100; i < 1100; i += 110) { - ++xx; - int yy = 0; - for (int j = -700; j < 700; j += 70) { - ++yy; - qreal x = (i + 1100) / 2200.0; - qreal y = (j + 700) / 1400.0; - - QColor color(image.pixel(int(image.width() * x), int(image.height() * y))); - QGraphicsItem *item = new Chip(color, xx, yy); - item->setPos(QPointF(i, j)); - scene->addItem(item); - - ++nitems; - } - } -} diff --git a/tests/benchmarks/qgraphicsview/chiptester/chiptester.h b/tests/benchmarks/qgraphicsview/chiptester/chiptester.h deleted file mode 100644 index 1a73bb7..0000000 --- a/tests/benchmarks/qgraphicsview/chiptester/chiptester.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CHIPTESTER_H -#define CHIPTESTER_H - -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsScene) -QT_FORWARD_DECLARE_CLASS(QGraphicsView) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QSplitter) - -class ChipTester : public QGraphicsView -{ - Q_OBJECT -public: - enum Operation { - Rotate360, - ZoomInOut, - Translate - }; - ChipTester(QWidget *parent = 0); - - void setAntialias(bool enabled); - void setOpenGL(bool enabled); - void runBenchmark(); - void setOperation(Operation operation); - -protected: - void paintEvent(QPaintEvent *event); - void timerEvent(QTimerEvent *event); - -private: - void populateScene(); - - QGraphicsView *view; - QGraphicsScene *scene; - int npaints; - int timerId; - QEventLoop eventLoop; - QTime stopWatch; - Operation operation; -}; - -#endif diff --git a/tests/benchmarks/qgraphicsview/chiptester/chiptester.pri b/tests/benchmarks/qgraphicsview/chiptester/chiptester.pri deleted file mode 100644 index a9e0bf8..0000000 --- a/tests/benchmarks/qgraphicsview/chiptester/chiptester.pri +++ /dev/null @@ -1,12 +0,0 @@ -SOURCES += \ - chiptester/chiptester.cpp \ - chiptester/chip.cpp - -HEADERS += \ - chiptester/chiptester.h \ - chiptester/chip.h - -RESOURCES += \ - chiptester/images.qrc - -contains(QT_CONFIG, opengl) QT += opengl diff --git a/tests/benchmarks/qgraphicsview/chiptester/images.qrc b/tests/benchmarks/qgraphicsview/chiptester/images.qrc deleted file mode 100644 index 73e8620..0000000 --- a/tests/benchmarks/qgraphicsview/chiptester/images.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qt4logo.png - - diff --git a/tests/benchmarks/qgraphicsview/chiptester/qt4logo.png b/tests/benchmarks/qgraphicsview/chiptester/qt4logo.png deleted file mode 100644 index 157e86e..0000000 Binary files a/tests/benchmarks/qgraphicsview/chiptester/qt4logo.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/images/designer.png b/tests/benchmarks/qgraphicsview/images/designer.png deleted file mode 100644 index 0988fce..0000000 Binary files a/tests/benchmarks/qgraphicsview/images/designer.png and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/images/wine-big.jpeg b/tests/benchmarks/qgraphicsview/images/wine-big.jpeg deleted file mode 100644 index 9900a50..0000000 Binary files a/tests/benchmarks/qgraphicsview/images/wine-big.jpeg and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/images/wine.jpeg b/tests/benchmarks/qgraphicsview/images/wine.jpeg deleted file mode 100644 index 8fe1d3a..0000000 Binary files a/tests/benchmarks/qgraphicsview/images/wine.jpeg and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/qgraphicsview/qgraphicsview.pro deleted file mode 100644 index 927d731..0000000 --- a/tests/benchmarks/qgraphicsview/qgraphicsview.pro +++ /dev/null @@ -1,16 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qgraphicsview - -SOURCES += tst_qgraphicsview.cpp -RESOURCES += qgraphicsview.qrc - -include(chiptester/chiptester.pri) - -symbian { - qt_not_deployed { - plugins.sources = qjpeg.dll - plugins.path = imageformats - DEPLOYMENT += plugins - } -} diff --git a/tests/benchmarks/qgraphicsview/qgraphicsview.qrc b/tests/benchmarks/qgraphicsview/qgraphicsview.qrc deleted file mode 100644 index 3681648..0000000 --- a/tests/benchmarks/qgraphicsview/qgraphicsview.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - images/designer.png - images/wine.jpeg - images/wine-big.jpeg - random.data - - - diff --git a/tests/benchmarks/qgraphicsview/random.data b/tests/benchmarks/qgraphicsview/random.data deleted file mode 100644 index 190a36c..0000000 Binary files a/tests/benchmarks/qgraphicsview/random.data and /dev/null differ diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp deleted file mode 100644 index 4cb07db..0000000 --- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp +++ /dev/null @@ -1,908 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#ifdef Q_WS_X11 -QT_BEGIN_NAMESPACE -extern void qt_x11_wait_for_window_manager(QWidget *); -QT_END_NAMESPACE -#endif -#include "chiptester/chiptester.h" -//#define CALLGRIND_DEBUG -#ifdef CALLGRIND_DEBUG -#include "valgrind/callgrind.h" -#endif - -//TESTED_FILES= - -class QEventWaiter : public QEventLoop -{ -public: - QEventWaiter(QObject *receiver, QEvent::Type type) - : waiting(false), t(type) - { - receiver->installEventFilter(this); - } - - void wait() - { - waiting = true; - exec(); - } - - bool eventFilter(QObject *receiver, QEvent *event) - { - Q_UNUSED(receiver); - if (waiting && event->type() == t) { - waiting = false; - exit(); - } - return false; - } - -private: - bool waiting; - QEvent::Type t; -}; - -class tst_QGraphicsView : public QObject -{ - Q_OBJECT - -public: - tst_QGraphicsView(); - virtual ~tst_QGraphicsView(); - -public slots: - void init(); - void cleanup(); - -private slots: - void construct(); - void paintSingleItem(); - void paintDeepStackingItems(); - void paintDeepStackingItems_clipped(); - void moveSingleItem(); - void mapPointToScene_data(); - void mapPointToScene(); - void mapPointFromScene_data(); - void mapPointFromScene(); - void mapRectToScene_data(); - void mapRectToScene(); - void mapRectFromScene_data(); - void mapRectFromScene(); - void chipTester_data(); - void chipTester(); - void deepNesting_data(); - void deepNesting(); - void imageRiver_data(); - void imageRiver(); - void textRiver_data(); - void textRiver(); - void moveItemCache_data(); - void moveItemCache(); - void paintItemCache_data(); - void paintItemCache(); -}; - -tst_QGraphicsView::tst_QGraphicsView() -{ -} - -tst_QGraphicsView::~tst_QGraphicsView() -{ -} - -void tst_QGraphicsView::init() -{ -} - -void tst_QGraphicsView::cleanup() -{ -} - -void tst_QGraphicsView::construct() -{ - QBENCHMARK { - QGraphicsView view; - } -} - -void tst_QGraphicsView::paintSingleItem() -{ - QGraphicsScene scene(0, 0, 100, 100); - scene.addRect(0, 0, 10, 10); - - QGraphicsView view(&scene); - view.show(); - view.resize(100, 100); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - - QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); - QPainter painter(&image); - QBENCHMARK { - view.viewport()->render(&painter); - } -} - -#ifdef Q_OS_SYMBIAN -# define DEEP_STACKING_COUNT 85 -#else -# define DEEP_STACKING_COUNT 1000 -#endif - -void tst_QGraphicsView::paintDeepStackingItems() -{ - QGraphicsScene scene(0, 0, 100, 100); - QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); - QGraphicsRectItem *lastRect = item; - for (int i = 0; i < DEEP_STACKING_COUNT; ++i) { - QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); - rect->setPos(1, 1); - rect->setParentItem(lastRect); - lastRect = rect; - } - - QGraphicsView view(&scene); - view.show(); - view.resize(100, 100); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - - QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); - QPainter painter(&image); - QBENCHMARK { - view.viewport()->render(&painter); - } -} - -void tst_QGraphicsView::paintDeepStackingItems_clipped() -{ - QGraphicsScene scene(0, 0, 100, 100); - QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); - item->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - QGraphicsRectItem *lastRect = item; - for (int i = 0; i < DEEP_STACKING_COUNT; ++i) { - QGraphicsRectItem *rect = scene.addRect(0, 0, 10, 10); - rect->setPos(1, 1); - rect->setParentItem(lastRect); - lastRect = rect; - } - - QGraphicsView view(&scene); - view.show(); - view.resize(100, 100); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - - QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); - QPainter painter(&image); - QBENCHMARK { - view.viewport()->render(&painter); - } -} - -void tst_QGraphicsView::moveSingleItem() -{ - QGraphicsScene scene(0, 0, 100, 100); - QGraphicsRectItem *item = scene.addRect(0, 0, 10, 10); - - QGraphicsView view(&scene); - view.show(); - view.resize(100, 100); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - - QEventWaiter waiter(view.viewport(), QEvent::Paint); - int n = 1; - QBENCHMARK { - item->setPos(25 * n, 25 * n); - waiter.wait(); - n = n ? 0 : 1; - } -} - -void tst_QGraphicsView::mapPointToScene_data() -{ - QTest::addColumn("transform"); - QTest::addColumn("point"); - - QTest::newRow("null") << QTransform() << QPoint(); - QTest::newRow("identity QPoint(100, 100)") << QTransform() << QPoint(100, 100); - QTest::newRow("rotate QPoint(100, 100)") << QTransform().rotate(90) << QPoint(100, 100); - QTest::newRow("scale QPoint(100, 100)") << QTransform().scale(5, 5) << QPoint(100, 100); - QTest::newRow("translate QPoint(100, 100)") << QTransform().translate(5, 5) << QPoint(100, 100); - QTest::newRow("shear QPoint(100, 100)") << QTransform().shear(1.5, 1.5) << QPoint(100, 100); - QTest::newRow("perspect QPoint(100, 100)") << QTransform().rotate(45, Qt::XAxis) << QPoint(100, 100); -} - -void tst_QGraphicsView::mapPointToScene() -{ - QFETCH(QTransform, transform); - QFETCH(QPoint, point); - - QGraphicsView view; - view.setTransform(transform); - QBENCHMARK { - view.mapToScene(point); - } -} - -void tst_QGraphicsView::mapPointFromScene_data() -{ - QTest::addColumn("transform"); - QTest::addColumn("point"); - - QTest::newRow("null") << QTransform() << QPointF(); - QTest::newRow("identity QPointF(100, 100)") << QTransform() << QPointF(100, 100); - QTest::newRow("rotate QPointF(100, 100)") << QTransform().rotate(90) << QPointF(100, 100); - QTest::newRow("scale QPointF(100, 100)") << QTransform().scale(5, 5) << QPointF(100, 100); - QTest::newRow("translate QPointF(100, 100)") << QTransform().translate(5, 5) << QPointF(100, 100); - QTest::newRow("shear QPointF(100, 100)") << QTransform().shear(1.5, 1.5) << QPointF(100, 100); - QTest::newRow("perspect QPointF(100, 100)") << QTransform().rotate(45, Qt::XAxis) << QPointF(100, 100); -} - -void tst_QGraphicsView::mapPointFromScene() -{ - QFETCH(QTransform, transform); - QFETCH(QPointF, point); - - QGraphicsView view; - view.setTransform(transform); - QBENCHMARK { - view.mapFromScene(point); - } -} - -void tst_QGraphicsView::mapRectToScene_data() -{ - QTest::addColumn("transform"); - QTest::addColumn("rect"); - - QTest::newRow("null") << QTransform() << QRect(); - QTest::newRow("identity QRect(0, 0, 100, 100)") << QTransform() << QRect(0, 0, 100, 100); - QTest::newRow("rotate QRect(0, 0, 100, 100)") << QTransform().rotate(90) << QRect(0, 0, 100, 100); - QTest::newRow("scale QRect(0, 0, 100, 100)") << QTransform().scale(5, 5) << QRect(0, 0, 100, 100); - QTest::newRow("translate QRect(0, 0, 100, 100)") << QTransform().translate(5, 5) << QRect(0, 0, 100, 100); - QTest::newRow("shear QRect(0, 0, 100, 100)") << QTransform().shear(1.5, 1.5) << QRect(0, 0, 100, 100); - QTest::newRow("perspect QRect(0, 0, 100, 100)") << QTransform().rotate(45, Qt::XAxis) << QRect(0, 0, 100, 100); -} - -void tst_QGraphicsView::mapRectToScene() -{ - QFETCH(QTransform, transform); - QFETCH(QRect, rect); - - QGraphicsView view; - view.setTransform(transform); - QBENCHMARK { - view.mapToScene(rect); - } -} - -void tst_QGraphicsView::mapRectFromScene_data() -{ - QTest::addColumn("transform"); - QTest::addColumn("rect"); - - QTest::newRow("null") << QTransform() << QRectF(); - QTest::newRow("identity QRectF(0, 0, 100, 100)") << QTransform() << QRectF(0, 0, 100, 100); - QTest::newRow("rotate QRectF(0, 0, 100, 100)") << QTransform().rotate(90) << QRectF(0, 0, 100, 100); - QTest::newRow("scale QRectF(0, 0, 100, 100)") << QTransform().scale(5, 5) << QRectF(0, 0, 100, 100); - QTest::newRow("translate QRectF(0, 0, 100, 100)") << QTransform().translate(5, 5) << QRectF(0, 0, 100, 100); - QTest::newRow("shear QRectF(0, 0, 100, 100)") << QTransform().shear(1.5, 1.5) << QRectF(0, 0, 100, 100); - QTest::newRow("perspect QRectF(0, 0, 100, 100)") << QTransform().rotate(45, Qt::XAxis) << QRectF(0, 0, 100, 100); -} - -void tst_QGraphicsView::mapRectFromScene() -{ - QFETCH(QTransform, transform); - QFETCH(QRectF, rect); - - QGraphicsView view; - view.setTransform(transform); - QBENCHMARK { - view.mapFromScene(rect); - } -} - -void tst_QGraphicsView::chipTester_data() -{ - QTest::addColumn("antialias"); - QTest::addColumn("opengl"); - QTest::addColumn("operation"); - QTest::newRow("rotate, normal") << false << false << 0; - QTest::newRow("rotate, normal, antialias") << true << false << 0; - QTest::newRow("rotate, opengl") << false << true << 0; - QTest::newRow("rotate, opengl, antialias") << true << true << 0; - QTest::newRow("zoom, normal") << false << false << 1; - QTest::newRow("zoom, normal, antialias") << true << false << 1; - QTest::newRow("zoom, opengl") << false << true << 1; - QTest::newRow("zoom, opengl, antialias") << true << true << 1; - QTest::newRow("translate, normal") << false << false << 2; - QTest::newRow("translate, normal, antialias") << true << false << 2; - QTest::newRow("translate, opengl") << false << true << 2; - QTest::newRow("translate, opengl, antialias") << true << true << 2; -} - -void tst_QGraphicsView::chipTester() -{ - QFETCH(bool, antialias); - QFETCH(bool, opengl); - QFETCH(int, operation); - - ChipTester tester; - tester.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&tester); -#endif - tester.setAntialias(antialias); - tester.setOpenGL(opengl); - tester.setOperation(ChipTester::Operation(operation)); - QBENCHMARK { - tester.runBenchmark(); - } -} - -static void addChildHelper(QGraphicsItem *parent, int n, bool rotate) -{ - if (!n) - return; - QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 50, 50), parent); - item->setPos(10, 10); - if (rotate) - item->rotate(10); - addChildHelper(item, n - 1, rotate); -} - -void tst_QGraphicsView::deepNesting_data() -{ - QTest::addColumn("rotate"); - QTest::addColumn("sortCache"); - QTest::addColumn("bsp"); - - QTest::newRow("bsp, no transform") << false << false << true; - QTest::newRow("bsp, rotation") << true << false << true; - QTest::newRow("bsp, no transform, sort cache") << false << true << true; - QTest::newRow("bsp, rotation, sort cache") << true << true << true; - QTest::newRow("no transform") << false << false << false; - QTest::newRow("rotation") << true << false << false; - QTest::newRow("no transform, sort cache") << false << true << false; - QTest::newRow("rotation, sort cache") << true << true << false; -} - -void tst_QGraphicsView::deepNesting() -{ - QFETCH(bool, rotate); - QFETCH(bool, sortCache); - QFETCH(bool, bsp); - - QGraphicsScene scene; - for (int y = 0; y < 15; ++y) { - for (int x = 0; x < 15; ++x) { - QGraphicsItem *item1 = scene.addRect(QRectF(0, 0, 50, 50)); - if (rotate) item1->rotate(10); - item1->setPos(x * 25, y * 25); - addChildHelper(item1, 30, rotate); - } - } - scene.setItemIndexMethod(bsp ? QGraphicsScene::BspTreeIndex : QGraphicsScene::NoIndex); - scene.setSortCacheEnabled(sortCache); - - QGraphicsView view(&scene); - view.setRenderHint(QPainter::Antialiasing); - view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(250); - - QBENCHMARK { -#ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION -#endif - view.viewport()->repaint(); -#ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION -#endif - } -} - -class AnimatedPixmapItem : public QGraphicsPixmapItem -{ -public: - AnimatedPixmapItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0) - : QGraphicsPixmapItem(parent), rotateFactor(0), scaleFactor(0) - { - rotate = rot; - scale = scal; - xspeed = x; - yspeed = y; - } - -protected: - void advance(int i) - { - if (!i) - return; - int x = int(pos().x()) + pixmap().width(); - x += xspeed; - x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); - int y = int(pos().y()) + pixmap().width(); - y += yspeed; - y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); - setPos(x, y); - - int rot = rotateFactor; - int sca = scaleFactor; - if (rotate) - rotateFactor = 1 + (rot + xspeed) % 360; - if (scale) - scaleFactor = 1 + (sca + yspeed) % 50; - - if (rotate || scale) { - qreal s = 0.5 + scaleFactor / 50.0; - setTransform(QTransform().rotate(rotateFactor).scale(s, s)); - } - } - -private: - int xspeed; - int yspeed; - int rotateFactor; - int scaleFactor; - bool rotate; - bool scale; -}; - -class CountPaintEventView : public QGraphicsView -{ -public: - CountPaintEventView(QGraphicsScene *scene = 0) - : QGraphicsView(scene), count(0) - { } - - int count; - -protected: - void paintEvent(QPaintEvent *event) - { - ++count; - QGraphicsView::paintEvent(event); - }; -}; - -void tst_QGraphicsView::imageRiver_data() -{ - QTest::addColumn("direction"); - QTest::addColumn("rotation"); - QTest::addColumn("scale"); - QTest::newRow("horizontal") << 0 << false << false; - QTest::newRow("vertical") << 1 << false << false; - QTest::newRow("both") << 2 << false << false; - QTest::newRow("horizontal rot") << 0 << true << false; - QTest::newRow("horizontal scale") << 0 << false << true; - QTest::newRow("horizontal rot + scale") << 0 << true << true; -} - -void tst_QGraphicsView::imageRiver() -{ - QFETCH(int, direction); - QFETCH(bool, rotation); - QFETCH(bool, scale); - - QGraphicsScene scene(0, 0, 300, 300); - - CountPaintEventView view(&scene); - view.resize(300, 300); - view.setFrameStyle(0); - view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.show(); - - QPixmap pix(":/images/designer.png"); - QVERIFY(!pix.isNull()); - - QList items; - QFile file(":/random.data"); - QVERIFY(file.open(QIODevice::ReadOnly)); - QDataStream str(&file); - for (int i = 0; i < 100; ++i) { - AnimatedPixmapItem *item; - if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale); - if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale); - if (direction == 2) item = new AnimatedPixmapItem((i % 4) + 1, (i % 4) + 1, rotation, scale); - item->setPixmap(pix); - int rnd1, rnd2; - str >> rnd1 >> rnd2; - item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), - -pix.height() + rnd2 % (view.height() + pix.height())); - scene.addItem(item); - } - - view.count = 0; - - QBENCHMARK { -#ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION -#endif - for (int i = 0; i < 100; ++i) { - scene.advance(); - while (view.count < (i+1)) - qApp->processEvents(); - } -#ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION -#endif - } -} - -class AnimatedTextItem : public QGraphicsSimpleTextItem -{ -public: - AnimatedTextItem(int x, int y, bool rot, bool scal, QGraphicsItem *parent = 0) - : QGraphicsSimpleTextItem(parent), rotateFactor(0), scaleFactor(25) - { - setText("River of text"); - rotate = rot; - scale = scal; - xspeed = x; - yspeed = y; - } - -protected: - void advance(int i) - { - if (!i) - return; - QRect r = boundingRect().toRect(); - int x = int(pos().x()) + r.width(); - x += xspeed; - x = (x % (300 + r.width() * 2)) - r.width(); - int y = int(pos().y()) + r.width(); - y += yspeed; - y = (y % (300 + r.width() * 2)) - r.width(); - setPos(x, y); - - int rot = rotateFactor; - int sca = scaleFactor; - if (rotate) - rotateFactor = 1 + (rot + xspeed) % 360; - if (scale) - scaleFactor = 1 + (sca + yspeed) % 50; - - if (rotate || scale) { - qreal s = 0.5 + scaleFactor / 50.0; - setTransform(QTransform().rotate(rotateFactor).scale(s, s)); - } - } - -private: - int xspeed; - int yspeed; - int rotateFactor; - int scaleFactor; - bool rotate; - bool scale; -}; - -void tst_QGraphicsView::textRiver_data() -{ - QTest::addColumn("direction"); - QTest::addColumn("rotation"); - QTest::addColumn("scale"); - QTest::newRow("horizontal") << 0 << false << false; - QTest::newRow("vertical") << 1 << false << false; - QTest::newRow("both") << 2 << false << false; - QTest::newRow("horizontal rot") << 0 << true << false; - QTest::newRow("horizontal scale") << 0 << false << true; - QTest::newRow("horizontal rot + scale") << 0 << true << true; -} - -void tst_QGraphicsView::textRiver() -{ - QFETCH(int, direction); - QFETCH(bool, rotation); - QFETCH(bool, scale); - - QGraphicsScene scene(0, 0, 300, 300); - - CountPaintEventView view(&scene); - view.resize(300, 300); - view.setFrameStyle(0); - view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.show(); - - QPixmap pix(":/images/designer.png"); - QVERIFY(!pix.isNull()); - - QList items; - QFile file(":/random.data"); - QVERIFY(file.open(QIODevice::ReadOnly)); - QDataStream str(&file); - for (int i = 0; i < 100; ++i) { - AnimatedTextItem *item; - if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale); - if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale); - if (direction == 2) item = new AnimatedTextItem((i % 4) + 1, (i % 4) + 1, rotation, scale); - int rnd1, rnd2; - str >> rnd1 >> rnd2; - item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), - -pix.height() + rnd2 % (view.height() + pix.height())); - scene.addItem(item); - } - - view.count = 0; - - QBENCHMARK { -#ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION -#endif - for (int i = 0; i < 100; ++i) { - scene.advance(); - while (view.count < (i+1)) - qApp->processEvents(); - } -#ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION -#endif - } -} - -class AnimatedPixmapCacheItem : public QGraphicsPixmapItem -{ -public: - AnimatedPixmapCacheItem(int x, int y, QGraphicsItem *parent = 0) - : QGraphicsPixmapItem(parent) - { - xspeed = x; - yspeed = y; - } - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) - { - QGraphicsPixmapItem::paint(painter,option,widget); - //We just want to wait, and we don't want to process the event loop with qWait - QTest::qSleep(3); - } -protected: - void advance(int i) - { - if (!i) - return; - int x = int(pos().x()) + pixmap().width(); - x += xspeed; - x = (x % (300 + pixmap().width() * 2)) - pixmap().width(); - int y = int(pos().y()) + pixmap().width(); - y += yspeed; - y = (y % (300 + pixmap().width() * 2)) - pixmap().width(); - setPos(x, y); - } - -private: - int xspeed; - int yspeed; -}; - -void tst_QGraphicsView::moveItemCache_data() -{ - QTest::addColumn("direction"); - QTest::addColumn("rotation"); - QTest::addColumn("cacheMode"); - QTest::newRow("Horizontal movement : ItemCoordinate Cache") << 0 << false << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Horizontal movement : DeviceCoordinate Cache") << 0 << false << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Horizontal movement : No Cache") << 0 << false << (int)QGraphicsItem::NoCache; - QTest::newRow("Vertical + Horizontal movement : ItemCoordinate Cache") << 2 << false << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Vertical + Horizontal movement : DeviceCoordinate Cache") << 2 << false << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Vertical + Horizontal movement : No Cache") << 2 << false << (int)QGraphicsItem::NoCache; - QTest::newRow("Horizontal movement + Rotation : ItemCoordinate Cache") << 0 << true << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Horizontal movement + Rotation : DeviceCoordinate Cache") << 0 << true << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Horizontal movement + Rotation : No Cache") << 0 << true << (int)QGraphicsItem::NoCache; -} - -void tst_QGraphicsView::moveItemCache() -{ - QFETCH(int, direction); - QFETCH(bool, rotation); - QFETCH(int, cacheMode); - - QGraphicsScene scene(0, 0, 300, 300); - - CountPaintEventView view(&scene); - view.resize(600, 600); - view.setFrameStyle(0); - view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.show(); - - QPixmap pix(":/images/wine.jpeg"); - QVERIFY(!pix.isNull()); - - QList items; - QFile file(":/random.data"); - QVERIFY(file.open(QIODevice::ReadOnly)); - QDataStream str(&file); - for (int i = 0; i < 50; ++i) { - AnimatedPixmapCacheItem *item; - if (direction == 0) item = new AnimatedPixmapCacheItem((i % 4) + 1, 0); - if (direction == 1) item = new AnimatedPixmapCacheItem(0, (i % 4) + 1); - if (direction == 2) item = new AnimatedPixmapCacheItem((i % 4) + 1, (i % 4) + 1); - item->setPixmap(pix); - item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); - if (rotation) - item->setTransform(QTransform().rotate(45)); - int rnd1, rnd2; - str >> rnd1 >> rnd2; - item->setPos(-pix.width() + rnd1 % (view.width() + pix.width()), - -pix.height() + rnd2 % (view.height() + pix.height())); - scene.addItem(item); - } - - view.count = 0; - - QBENCHMARK { -#ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION -#endif - for (int i = 0; i < 100; ++i) { - scene.advance(); - while (view.count < (i+1)) - qApp->processEvents(); - } -#ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION -#endif - } -} - -class UpdatedPixmapCacheItem : public QGraphicsPixmapItem -{ -public: - UpdatedPixmapCacheItem(bool partial, QGraphicsItem *parent = 0) - : QGraphicsPixmapItem(parent), partial(partial) - { - } - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) - { - QGraphicsPixmapItem::paint(painter,option,widget); - } -protected: - void advance(int i) - { - if (partial) - update(QRectF(boundingRect().center().x(), boundingRect().center().x(), 30, 30)); - else - update(); - } - -private: - bool partial; -}; - -void tst_QGraphicsView::paintItemCache_data() -{ - QTest::addColumn("updatePartial"); - QTest::addColumn("rotation"); - QTest::addColumn("cacheMode"); - QTest::newRow("Partial Update : ItemCoordinate Cache") << true << false << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Partial Update : DeviceCoordinate Cache") << true << false << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Partial Update : No Cache") << true << false << (int)QGraphicsItem::NoCache; - QTest::newRow("Full Update : ItemCoordinate Cache") << false << false << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Full Update : DeviceCoordinate Cache") << false << false << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Full Update : No Cache") << false << false << (int)QGraphicsItem::NoCache; - QTest::newRow("Partial Update : ItemCoordinate Cache item rotated") << true << true << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Partial Update : DeviceCoordinate Cache item rotated") << true << true << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Partial Update : No Cache item rotated") << true << true << (int)QGraphicsItem::NoCache; - QTest::newRow("Full Update : ItemCoordinate Cache item rotated") << false << true << (int)QGraphicsItem::ItemCoordinateCache; - QTest::newRow("Full Update : DeviceCoordinate Cache item rotated") << false << true << (int)QGraphicsItem::DeviceCoordinateCache; - QTest::newRow("Full Update : No Cache item rotated") << false << true <<(int)QGraphicsItem::NoCache; -} - -void tst_QGraphicsView::paintItemCache() -{ - QFETCH(bool, updatePartial); - QFETCH(bool, rotation); - QFETCH(int, cacheMode); - - QGraphicsScene scene(0, 0, 300, 300); - - CountPaintEventView view(&scene); - view.resize(600, 600); - view.setFrameStyle(0); - view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.show(); - - QPixmap pix(":/images/wine.jpeg"); - QVERIFY(!pix.isNull()); - - QList items; - QFile file(":/random.data"); - QVERIFY(file.open(QIODevice::ReadOnly)); - QDataStream str(&file); - UpdatedPixmapCacheItem *item = new UpdatedPixmapCacheItem(updatePartial); - item->setPixmap(pix); - item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); - if (rotation) - item->setTransform(QTransform().rotate(45)); - item->setPos(-100, -100); - scene.addItem(item); - - QPixmap pix2(":/images/wine-big.jpeg"); - item = new UpdatedPixmapCacheItem(updatePartial); - item->setPixmap(pix2); - item->setCacheMode((QGraphicsItem::CacheMode)cacheMode); - if (rotation) - item->setTransform(QTransform().rotate(45)); - item->setPos(0, 0); - scene.addItem(item); - - view.count = 0; - - QBENCHMARK { -#ifdef CALLGRIND_DEBUG - CALLGRIND_START_INSTRUMENTATION -#endif - for (int i = 0; i < 50; ++i) { - scene.advance(); - while (view.count < (i+1)) - qApp->processEvents(); - } -#ifdef CALLGRIND_DEBUG - CALLGRIND_STOP_INSTRUMENTATION -#endif - } -} - -QTEST_MAIN(tst_QGraphicsView) -#include "tst_qgraphicsview.moc" diff --git a/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro deleted file mode 100644 index f1ec54e..0000000 --- a/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qgraphicswidget -TEMPLATE = app -# Input -SOURCES += tst_qgraphicswidget.cpp diff --git a/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp deleted file mode 100644 index 7db98ce..0000000 --- a/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp +++ /dev/null @@ -1,94 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -//TESTED_FILES= - -class tst_QGraphicsWidget : public QObject -{ - Q_OBJECT - -public: - tst_QGraphicsWidget(); - virtual ~tst_QGraphicsWidget(); - -public slots: - void init(); - void cleanup(); - -private slots: - void move(); -}; - -tst_QGraphicsWidget::tst_QGraphicsWidget() -{ -} - -tst_QGraphicsWidget::~tst_QGraphicsWidget() -{ -} - -void tst_QGraphicsWidget::init() -{ -} - -void tst_QGraphicsWidget::cleanup() -{ -} - -void tst_QGraphicsWidget::move() -{ - QGraphicsScene scene; - QGraphicsWidget *widget = new QGraphicsWidget(); - scene.addItem(widget); - QGraphicsView view(&scene); - view.show(); - QBENCHMARK { - widget->setPos(qrand(),qrand()); - } -} - -QTEST_MAIN(tst_QGraphicsWidget) -#include "tst_qgraphicswidget.moc" diff --git a/tests/benchmarks/qhostinfo/main.cpp b/tests/benchmarks/qhostinfo/main.cpp deleted file mode 100644 index 0ae1b7f..0000000 --- a/tests/benchmarks/qhostinfo/main.cpp +++ /dev/null @@ -1,96 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include -#include -#include - -#include -#include - -class tst_qhostinfo : public QObject -{ - Q_OBJECT -private slots: - void lookupSpeed(); -}; - -class SignalReceiver : public QObject -{ - Q_OBJECT -public: - SignalReceiver(int nrc) : receiveCount(0), neededReceiveCount(nrc) {}; - int receiveCount; - int neededReceiveCount; -public slots: - void resultsReady(const QHostInfo) { - receiveCount++; - if (receiveCount == neededReceiveCount) - QTestEventLoop::instance().exitLoop(); - } -}; - -void tst_qhostinfo::lookupSpeed() -{ - QStringList hostnameList; - hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" - << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" - << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; - // also add some duplicates: - hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com"; - const int COUNT = hostnameList.size(); - - SignalReceiver receiver(COUNT); - - QBENCHMARK { - for (int i = 0; i < hostnameList.size(); i++) - QHostInfo::lookupHost(hostnameList.at(i), &receiver, SLOT(resultsReady(const QHostInfo))); - QTestEventLoop::instance().enterLoop(20); - QVERIFY(!QTestEventLoop::instance().timeout()); - } -} - - -QTEST_MAIN(tst_qhostinfo) - -#include "main.moc" diff --git a/tests/benchmarks/qhostinfo/qhostinfo.pro b/tests/benchmarks/qhostinfo/qhostinfo.pro deleted file mode 100755 index f18d6d7..0000000 --- a/tests/benchmarks/qhostinfo/qhostinfo.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qhostinfo -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui -QT += network - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qimagereader/images/16bpp.bmp b/tests/benchmarks/qimagereader/images/16bpp.bmp deleted file mode 100644 index 74ce63e..0000000 Binary files a/tests/benchmarks/qimagereader/images/16bpp.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/4bpp-rle.bmp b/tests/benchmarks/qimagereader/images/4bpp-rle.bmp deleted file mode 100644 index ae71e67..0000000 Binary files a/tests/benchmarks/qimagereader/images/4bpp-rle.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/YCbCr_cmyk.jpg b/tests/benchmarks/qimagereader/images/YCbCr_cmyk.jpg deleted file mode 100644 index b8aa9ea..0000000 Binary files a/tests/benchmarks/qimagereader/images/YCbCr_cmyk.jpg and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/YCbCr_cmyk.png b/tests/benchmarks/qimagereader/images/YCbCr_cmyk.png deleted file mode 100644 index a24db1b..0000000 Binary files a/tests/benchmarks/qimagereader/images/YCbCr_cmyk.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/YCbCr_rgb.jpg b/tests/benchmarks/qimagereader/images/YCbCr_rgb.jpg deleted file mode 100644 index 8771224..0000000 Binary files a/tests/benchmarks/qimagereader/images/YCbCr_rgb.jpg and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/away.png b/tests/benchmarks/qimagereader/images/away.png deleted file mode 100644 index 0e21a37..0000000 Binary files a/tests/benchmarks/qimagereader/images/away.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/ball.mng b/tests/benchmarks/qimagereader/images/ball.mng deleted file mode 100644 index 8154478..0000000 Binary files a/tests/benchmarks/qimagereader/images/ball.mng and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/bat1.gif b/tests/benchmarks/qimagereader/images/bat1.gif deleted file mode 100644 index cb6f4f7..0000000 Binary files a/tests/benchmarks/qimagereader/images/bat1.gif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/bat2.gif b/tests/benchmarks/qimagereader/images/bat2.gif deleted file mode 100644 index fbbda4e..0000000 Binary files a/tests/benchmarks/qimagereader/images/bat2.gif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/beavis.jpg b/tests/benchmarks/qimagereader/images/beavis.jpg deleted file mode 100644 index d555047..0000000 Binary files a/tests/benchmarks/qimagereader/images/beavis.jpg and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/black.png b/tests/benchmarks/qimagereader/images/black.png deleted file mode 100644 index 6c94085..0000000 Binary files a/tests/benchmarks/qimagereader/images/black.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/black.xpm b/tests/benchmarks/qimagereader/images/black.xpm deleted file mode 100644 index d7925bf..0000000 --- a/tests/benchmarks/qimagereader/images/black.xpm +++ /dev/null @@ -1,65 +0,0 @@ -/* XPM */ -static char * ddd_xpm[] = { -/* $Id: ddd.xpm,v 1.5 1999/08/19 11:30:07 andreas Exp $ - * DDD Logo. Copyright (C) 1997 TU Braunschweig, Germany. - * For details on DDD, see `http://www.gnu.org/software/ddd/'. - * width height ncolors chars_per_pixel */ -" 48 48 8 1", -/* Colors */ -" c None m None g None g4 None s Background ", -". c black m black g black g4 black s Legs ", -"X c grey m white g grey g4 grey s Body ", -"- c grey m white g grey g4 grey s Border ", -"o c #000040 m black g grey25 g4 grey25 s Handle1 ", -"O c blue4 m black g grey25 g4 grey25 s Handle2 ", -"+ c white m white g white g4 white s Light ", -"* c DarkGreen m black g grey25 g4 grey25 s Eye ", -/* Pixels */ -" . . ", -" . .. ", -" . . ", -" .. . ", -" .. .. .. ", -" .. . . . ", -" . . . . .. ", -" . .X. . ", -" . *.X.* .. ", -" .. .. .XXX. .. ... ", -" . .X...XXX...X. . ", -" .. ..XXX.XXX.XXX. .. ", -" .....XXXX...XXXX. . ", -" .. ..XXXXXXXXX.. .. ", -" ...XXXXXXX..... ", -" ......... ", -" .XXXXXXX. ", -" .....XXX..... ", -" .XXXXXoOOOOOOX. ... ", -" .. ..XXXoOOO-----OOO..... ", -" .........XXoO-----..----O .. ", -" .. ..X..oO--.........--O .. ", -" . ..XXXoO--..++.......--O .. ", -" .. .XXXXO-XXX+++XXXXXXXXX-O . ", -" .. .....oO-XX+++XXXXXXXXXXX-O .. ", -" .. .XXXoO--XX++XXXXXXXXXXXX-O .. ", -" .. ..XXXoO-..+++............-O .. ", -" . .. .XXoO--..++.............-OO .. ", -" . ... ...oO--..................-O ", -".. . .XXoO-XXXXXXXXXXXXXXXXXXX-O ", -" .. .XXoO-XXXXXXXXXXXXXXXXXXX-O ", -" .. .XoO-XXXXXXXXXXXXXXXXXXX-O. ", -" . ...oO-.................-O .. ", -" . .XXoO-.................-O .. ", -" . ..XoO-.................-O .. ", -" . ...oO-XXXXXXXXXXXXXXX-OOO . ", -" .. .XoOO-XXXXXXXXXXXXX-OOOOO . ", -" .. ..XoOO---.......---OOOOOO . ", -" .. ....oOO---...----OOOOOOOO ", -" . .XX..oOO-----OOOOOOOOOOO ", -" . .....OOOOOOOOooOOOOOOOOO ", -" . .XXooooooOo oOOOOOOOOO ", -" . .XXX. ooOOOOOOO ", -" .. ... ooOOOOOO ", -" . ooOOOOOO ", -" ooOOOOOO ", -" ooOOOOOO ", -" ooOOOOOO "}; diff --git a/tests/benchmarks/qimagereader/images/colorful.bmp b/tests/benchmarks/qimagereader/images/colorful.bmp deleted file mode 100644 index 8ea6f4a..0000000 Binary files a/tests/benchmarks/qimagereader/images/colorful.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt-colors.xpm b/tests/benchmarks/qimagereader/images/corrupt-colors.xpm deleted file mode 100644 index f8d80ed..0000000 --- a/tests/benchmarks/qimagereader/images/corrupt-colors.xpm +++ /dev/null @@ -1,26 +0,0 @@ -/* XPM */ -static const char *marble_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 240 240 223 2", -/* colors */ -".. c #959595", -".# c #c5c5c5", -".a c #adadad", -".b c #dedede", -".c c #b7b7b7", -".d c #d2d2d2", -".e c #bebebe", -".f c #c9c9c9", -".g c #b8b8b8", -".h c #d6d6d6", -".i c #9e9e9e", -".j c #eaeaea", -".k c #b2b2b2", -".l c #cecece", -".m c #a5a5a5", -".n c #e4e4e4", -".o c #c4c4c4", -".p c #d9d9d9", -".q c #b1b1b1", -/* pixels */ -"aYbla9aN.N#x", diff --git a/tests/benchmarks/qimagereader/images/corrupt-data.tif b/tests/benchmarks/qimagereader/images/corrupt-data.tif deleted file mode 100644 index d63c688..0000000 Binary files a/tests/benchmarks/qimagereader/images/corrupt-data.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt-pixels.xpm b/tests/benchmarks/qimagereader/images/corrupt-pixels.xpm deleted file mode 100644 index 21031ee..0000000 --- a/tests/benchmarks/qimagereader/images/corrupt-pixels.xpm +++ /dev/null @@ -1,7 +0,0 @@ -/* XPM */ -static char * test_xpm[] = { -"256 256 1 1", -" c grey", -" ", -" ", -" "}; diff --git a/tests/benchmarks/qimagereader/images/corrupt.bmp b/tests/benchmarks/qimagereader/images/corrupt.bmp deleted file mode 100644 index 824190b..0000000 Binary files a/tests/benchmarks/qimagereader/images/corrupt.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt.gif b/tests/benchmarks/qimagereader/images/corrupt.gif deleted file mode 100644 index 0725945..0000000 Binary files a/tests/benchmarks/qimagereader/images/corrupt.gif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt.jpg b/tests/benchmarks/qimagereader/images/corrupt.jpg deleted file mode 100644 index 1959662..0000000 Binary files a/tests/benchmarks/qimagereader/images/corrupt.jpg and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt.mng b/tests/benchmarks/qimagereader/images/corrupt.mng deleted file mode 100644 index 17fd43a..0000000 Binary files a/tests/benchmarks/qimagereader/images/corrupt.mng and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt.png b/tests/benchmarks/qimagereader/images/corrupt.png deleted file mode 100644 index 9d8911c..0000000 Binary files a/tests/benchmarks/qimagereader/images/corrupt.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/corrupt.xbm b/tests/benchmarks/qimagereader/images/corrupt.xbm deleted file mode 100644 index 8510634..0000000 --- a/tests/benchmarks/qimagereader/images/corrupt.xbm +++ /dev/null @@ -1,5 +0,0 @@ -#define noname_width 271 -#define noname_height 273 -static char noname_bits[] = { - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f}; diff --git a/tests/benchmarks/qimagereader/images/crash-signed-char.bmp b/tests/benchmarks/qimagereader/images/crash-signed-char.bmp deleted file mode 100644 index b35cda6..0000000 Binary files a/tests/benchmarks/qimagereader/images/crash-signed-char.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/earth.gif b/tests/benchmarks/qimagereader/images/earth.gif deleted file mode 100644 index 2c229eb..0000000 Binary files a/tests/benchmarks/qimagereader/images/earth.gif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/fire.mng b/tests/benchmarks/qimagereader/images/fire.mng deleted file mode 100644 index c6695c8..0000000 Binary files a/tests/benchmarks/qimagereader/images/fire.mng and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/font.bmp b/tests/benchmarks/qimagereader/images/font.bmp deleted file mode 100644 index 28b8c66..0000000 Binary files a/tests/benchmarks/qimagereader/images/font.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/gnus.xbm b/tests/benchmarks/qimagereader/images/gnus.xbm deleted file mode 100644 index 58d1ac8..0000000 --- a/tests/benchmarks/qimagereader/images/gnus.xbm +++ /dev/null @@ -1,622 +0,0 @@ -#define noname_width 271 -#define noname_height 273 -static char noname_bits[] = { - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfa,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x49,0xe0,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x97,0xaa,0x8a,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x57,0x2a,0x41,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa9,0x52,0x16,0xfe,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,0x49,0x05, - 0xf9,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0x95,0xaa,0x58,0xf4,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x7f,0xa5,0x54,0x26,0xe1,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x54,0x49,0x49,0xe4,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x2a,0xa5, - 0x2a,0xd1,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0xd5,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xaf,0x52,0x95,0x54,0xc4,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab, - 0x24,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x57,0x29,0xa9,0x92,0x11,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x57,0xd5,0xfa,0xff,0xff,0xab,0xea,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97,0x4a,0x55,0x2a,0x41,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x25,0x29,0xe5,0xff,0xff,0x95,0xa4,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa7,0xa4, - 0x24,0xa5,0x14,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,0xa5,0xd4,0xff, - 0x3f,0x52,0xa9,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x29,0x55,0x55,0x55,0x41,0x7e,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xa9,0x54,0xea,0xff,0xdf,0x2a,0x55,0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x4a,0x49,0x12,0x7e,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0x55,0xa5,0x92,0xff,0x23,0xa5,0x4a,0xd6,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa5,0xa4,0x94,0xaa,0x42, - 0x7d,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0x4a,0x2a,0xa9,0xff,0xad,0x92,0x24, - 0xa9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2a, - 0x95,0x52,0x52,0x29,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x52,0x49,0x55, - 0xfe,0x91,0x54,0x55,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0x49,0x29,0x55,0x25,0x85,0x7c,0xff,0xff,0xff,0xff,0xff,0xff, - 0x4f,0x95,0xaa,0x92,0x7e,0x55,0x55,0xa9,0x4a,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2a,0x50,0x95,0xaa,0x24,0x7e,0xff,0xff, - 0xff,0xff,0xff,0xff,0x57,0x2a,0x95,0x54,0x79,0x95,0x92,0x92,0x94,0xfc,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xb9,0x62,0x29,0x49, - 0x85,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x49,0x49,0x95,0xba,0xa4,0x54, - 0xaa,0x52,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf, - 0x1a,0xf8,0xa7,0xaa,0x22,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x52, - 0x2a,0x75,0x55,0xa5,0x24,0xa5,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xbf,0x5a,0xfd,0x57,0x92,0x94,0x7e,0xff,0xff,0xff,0xff,0xff, - 0xff,0x4a,0x4a,0x55,0x49,0x89,0x92,0x94,0xaa,0x94,0xf4,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x1a,0xfc,0x2f,0x55,0x05,0x7c,0xff, - 0xff,0xff,0xff,0xff,0xff,0x55,0xa9,0x4a,0x55,0x2a,0x55,0x55,0x55,0x55,0xe5, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x4e,0xfd,0x5f, - 0x29,0xa5,0x7c,0xff,0xff,0xff,0xff,0xff,0xff,0xa4,0x54,0x52,0x4a,0x55,0xa9, - 0xa4,0x24,0xa5,0x94,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x2f,0x1d,0xfe,0x3f,0x95,0x04,0x7c,0xff,0xfd,0xff,0xff,0xff,0x3f,0x49,0xa5, - 0x54,0xa9,0xa4,0x92,0x4a,0x49,0x4a,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xaf,0x44,0xfe,0x5f,0xa9,0x52,0x7d,0xff,0xe5,0xff,0xff, - 0xff,0x5f,0x55,0x92,0x2a,0x95,0x52,0x4a,0x52,0xaa,0x52,0x4a,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97,0x16,0xff,0xbf,0x4a,0x05,0x7c, - 0xff,0xd9,0xff,0xff,0xff,0x5f,0x95,0x42,0xa5,0x52,0x95,0xaa,0xaa,0xaa,0x94, - 0x54,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x43,0xfe, - 0xbf,0x54,0x52,0x7d,0x7f,0x25,0xff,0xff,0xff,0xa7,0xa4,0x28,0x92,0x54,0x4a, - 0xa5,0x4a,0x92,0xaa,0x4a,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xab,0x12,0xfe,0x7f,0xa5,0x02,0x7c,0x7f,0x55,0xfd,0xff,0xff,0x95,0x2a, - 0x82,0x54,0xa5,0x54,0x2a,0xa9,0x2a,0xa5,0x52,0xf5,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x27,0x4b,0xff,0xff,0x4a,0x29,0x7d,0xff,0x92,0xfe, - 0xff,0xff,0x55,0x92,0x20,0xa8,0x94,0x2a,0xa5,0x94,0x52,0x29,0xa9,0xf4,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97,0x01,0xff,0x7f,0x52,0x42, - 0x7c,0xff,0x25,0xf9,0xff,0x7f,0xaa,0x02,0x8a,0x40,0x29,0x49,0x09,0x41,0x4a, - 0x55,0x25,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x57, - 0xff,0xff,0x95,0x12,0x7d,0xff,0xa9,0xfa,0xff,0x7f,0x25,0xa9,0x20,0x2a,0xa5, - 0xaa,0x42,0x92,0x54,0x92,0x54,0x95,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xaf,0x83,0xff,0xff,0xa9,0x42,0x7e,0xff,0xaa,0xf4,0xff,0xaf,0x54, - 0x01,0x82,0x80,0xaa,0x54,0x14,0x08,0xa2,0xaa,0x4a,0xd2,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xef,0xcf,0xd7,0xff,0xff,0x52,0x12,0x7f,0xff,0x4a, - 0xea,0xff,0x57,0x92,0xaa,0x28,0x24,0x29,0x25,0x81,0x82,0x08,0x49,0x52,0x55, - 0xff,0xff,0xff,0xff,0xbf,0xff,0xff,0xff,0xff,0xdf,0xef,0xe7,0xff,0xff,0x2a, - 0x05,0x7e,0xff,0x55,0xd5,0xff,0xa5,0x2a,0x00,0x8e,0x10,0x4a,0x89,0x24,0x28, - 0xa0,0xaa,0x2a,0x49,0xff,0xff,0xff,0xff,0xbf,0xff,0xff,0xff,0xff,0xe7,0xff, - 0xef,0xff,0xff,0xa5,0x50,0x7e,0xff,0x25,0xe5,0xff,0x2a,0xa5,0x52,0x7f,0x85, - 0x54,0x35,0x08,0x82,0x0a,0x55,0x95,0xaa,0xfc,0xff,0xff,0xff,0xcf,0xff,0xff, - 0xff,0xff,0xd7,0xff,0xff,0xff,0x7f,0x52,0x85,0x7e,0xff,0xab,0x94,0x1e,0x55, - 0x2a,0xc8,0xff,0x10,0x90,0x92,0xa0,0x08,0x20,0x24,0x52,0x25,0xfd,0xff,0xff, - 0xff,0xef,0xff,0xff,0xff,0xff,0xe9,0xff,0xff,0xff,0xff,0x94,0x10,0x7e,0xff, - 0x93,0xaa,0x6a,0x49,0x49,0xf2,0xff,0x85,0x52,0x09,0x0a,0xa2,0x4a,0x92,0x29, - 0xa9,0xf2,0xff,0xff,0xff,0xd3,0xff,0xff,0xff,0xff,0xeb,0xff,0xff,0xff,0x7f, - 0x55,0x25,0x7f,0xff,0x55,0x49,0x49,0x95,0x0a,0xf9,0xff,0x17,0x48,0x26,0x50, - 0x08,0x00,0xa9,0x4a,0x95,0xfa,0xff,0xff,0xff,0xeb,0xff,0xff,0xff,0xff,0xf2, - 0xff,0xff,0xff,0xff,0x92,0x80,0x7e,0xff,0xa7,0x54,0xaa,0xa4,0x52,0xfc,0xff, - 0xaf,0x42,0x89,0xfa,0xbf,0x54,0x20,0xa9,0xa4,0xd4,0xff,0xff,0xff,0xcb,0xff, - 0xff,0xff,0xff,0xf5,0xff,0xff,0xff,0xff,0x54,0x29,0x7f,0xff,0x4b,0xa5,0x92, - 0x2a,0x01,0xff,0xff,0x1f,0xa8,0x22,0xff,0xff,0x01,0xa5,0x2a,0x55,0xa9,0xff, - 0xff,0xff,0xd4,0xff,0xff,0xff,0x7f,0xfa,0xff,0xff,0xff,0x7f,0xa5,0x04,0x7f, - 0xff,0x57,0x2a,0x55,0xa9,0x54,0xfe,0xff,0x3f,0x05,0x89,0xff,0xff,0x5f,0x48, - 0x92,0x2a,0x95,0xff,0xff,0xff,0xea,0xff,0xff,0xff,0xff,0xd2,0xff,0xff,0xff, - 0x7f,0x2a,0x91,0x7f,0xff,0xa9,0x54,0x4a,0x52,0x02,0xff,0xff,0xff,0x50,0xd1, - 0xff,0xff,0x1f,0x81,0xaa,0xa4,0x52,0xfe,0xff,0x3f,0xe9,0xff,0xff,0xff,0x7f, - 0x1d,0xff,0xff,0xff,0xff,0x54,0x41,0x7f,0xff,0x93,0x92,0x52,0x95,0xc8,0xff, - 0xff,0xff,0x8b,0xc4,0xff,0xff,0x7f,0x24,0xa5,0x2a,0x49,0xf9,0xff,0x7f,0xd5, - 0xff,0xff,0xff,0xbf,0x4a,0xff,0xff,0xff,0xff,0x4a,0x14,0x7f,0xff,0x28,0xa5, - 0x94,0x2a,0xa0,0xff,0xff,0x7f,0x22,0xf0,0xff,0xff,0x7f,0x12,0x94,0xa4,0xaa, - 0xea,0xff,0xaf,0xea,0xff,0xff,0xff,0x5f,0x8e,0xff,0xff,0xff,0x7f,0xa9,0x40, - 0x7f,0xff,0x48,0x55,0x55,0x12,0xca,0xff,0xff,0xff,0x0a,0xf5,0xff,0xff,0xff, - 0x80,0x52,0x95,0x54,0xaa,0xfe,0x55,0xc4,0xff,0xff,0xff,0x5f,0xa5,0xff,0xff, - 0xff,0xff,0x94,0x14,0x7f,0xff,0x52,0x2a,0xa9,0x4a,0xe1,0xff,0xff,0xbf,0x24, - 0xf0,0xff,0xff,0xff,0x0b,0x28,0xa9,0x92,0x24,0x55,0x49,0xe5,0xd7,0xff,0xff, - 0xa7,0x8a,0xff,0xff,0xff,0x7f,0xa5,0xc0,0x7f,0xff,0x50,0x49,0x95,0x04,0xf8, - 0xff,0xff,0x5f,0x1f,0xfd,0xff,0xff,0xff,0x47,0x45,0x55,0xaa,0xaa,0x4a,0xaa, - 0xea,0xaf,0xff,0xff,0x2b,0xc3,0xff,0xff,0xff,0x7f,0x55,0x94,0x7f,0x7f,0x4a, - 0x55,0x52,0x51,0xfe,0xff,0xff,0x5f,0x4e,0xf8,0xff,0xff,0xff,0x1f,0x50,0x92, - 0x52,0x49,0xa9,0x92,0xe4,0xd3,0xff,0xff,0x4b,0xd5,0xff,0xff,0xff,0xff,0x94, - 0xc0,0x7f,0x3f,0xa0,0xa4,0xaa,0x04,0xfe,0xff,0xff,0xa7,0x1d,0xfd,0xff,0xff, - 0xff,0x9f,0x84,0xaa,0x4a,0xaa,0x24,0x55,0xf2,0x2b,0xff,0x7f,0xa9,0xc1,0xff, - 0xff,0xff,0x7f,0x4a,0x95,0x7f,0xbf,0x2a,0x95,0x24,0x50,0xff,0xff,0xff,0x97, - 0x5e,0xfe,0xff,0xff,0xff,0x3f,0x92,0x24,0x95,0x92,0xaa,0xa4,0xf2,0xcb,0xff, - 0x5f,0xd5,0xe5,0xff,0xff,0xff,0xff,0x52,0x80,0x7f,0x3f,0xa0,0x52,0x15,0x85, - 0xff,0xff,0xff,0xd7,0x38,0xfe,0xff,0xff,0xff,0xff,0x20,0xaa,0x52,0x55,0x55, - 0x55,0xf9,0x29,0xfd,0xab,0xa4,0xf0,0xff,0xff,0xff,0x7f,0x29,0xa9,0x7f,0xff, - 0x42,0x25,0x49,0xe8,0xff,0xff,0xff,0x69,0x7a,0xff,0xff,0xff,0xff,0xff,0x82, - 0x52,0xaa,0x24,0x89,0x4a,0xf8,0x55,0x2a,0x49,0x95,0xf5,0xff,0xff,0xff,0xbf, - 0x2a,0xc4,0x7f,0x7f,0x90,0x54,0x15,0xe2,0xff,0xff,0xff,0x25,0xbc,0xff,0xff, - 0xff,0xff,0xff,0x29,0x48,0x49,0xaa,0xaa,0xa4,0xfa,0x95,0x92,0x54,0x52,0xf0, - 0xff,0xff,0xff,0xbf,0x4a,0xd1,0x7f,0xff,0x05,0xaa,0x40,0xf8,0xff,0xff,0x7f, - 0xaa,0xfc,0xff,0xff,0xff,0xff,0xff,0x43,0xa9,0xaa,0x4a,0x52,0xa9,0xf8,0xa4, - 0xaa,0x52,0x95,0xfc,0xff,0xff,0xff,0x7f,0x52,0xc0,0x7f,0xff,0xa1,0x00,0x24, - 0xfa,0xff,0xff,0xff,0x0a,0xfe,0xff,0xff,0xff,0xff,0xff,0x17,0x92,0x24,0xa5, - 0x2a,0x55,0xfe,0xaa,0xa4,0x2a,0x29,0xf9,0xff,0xff,0xff,0xbf,0x2a,0xea,0x7f, - 0xff,0x05,0x92,0x90,0xfc,0xff,0xff,0xbf,0xa4,0xff,0xff,0xff,0xff,0xff,0xff, - 0x4f,0xa0,0xaa,0x54,0x49,0x25,0x7c,0x49,0x95,0xa4,0x12,0xfc,0xff,0xff,0xff, - 0x7f,0x8a,0xe0,0x7f,0xff,0xa3,0x04,0x05,0xfe,0xff,0xff,0xbf,0x06,0xff,0xff, - 0xff,0xff,0xff,0xff,0x1f,0x49,0x95,0x52,0xaa,0x12,0x7f,0x55,0x52,0x55,0x0a, - 0xfd,0xff,0xff,0xff,0x3f,0x29,0xe8,0x7f,0xff,0x0f,0x50,0x50,0xff,0xff,0xff, - 0x5f,0xca,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x04,0xa9,0x4a,0x25,0x45,0x3e, - 0xa9,0x2a,0xa9,0xa2,0xfc,0xff,0xff,0xff,0x7f,0x55,0xe1,0x7f,0xff,0x27,0x05, - 0xc4,0xff,0xff,0xff,0x9f,0x91,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x41,0x4a, - 0x29,0xa9,0x12,0x5e,0x95,0x94,0x4a,0x0a,0xfe,0xff,0xff,0xff,0xbf,0x12,0xf4, - 0x7f,0xff,0x8f,0x50,0xf1,0xff,0xff,0xff,0xa7,0xc2,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x14,0x92,0xaa,0x4a,0xa2,0xbf,0xa4,0x52,0x95,0x22,0xff,0xff,0xff, - 0xff,0x3f,0x45,0xf2,0x7f,0xff,0x3f,0x04,0xf4,0xff,0xff,0xff,0xd7,0xe8,0xff, - 0xff,0xff,0xff,0x5f,0xff,0xff,0x83,0xa8,0x94,0x54,0x09,0x2f,0x55,0x4a,0x52, - 0x49,0xff,0xff,0xff,0xff,0x5f,0x99,0xf0,0x7f,0xff,0x7f,0x51,0xfc,0xff,0xff, - 0xff,0x6b,0xf1,0xff,0xff,0xff,0xff,0x5f,0xfd,0xff,0x2b,0x2a,0xa9,0x12,0x20, - 0x5f,0xa9,0xaa,0x54,0x00,0xff,0xff,0xff,0xff,0x5f,0x15,0xf2,0x7f,0xff,0xff, - 0x8f,0xff,0xff,0xff,0xff,0x2b,0xfc,0xff,0xff,0xff,0xff,0x2f,0xfd,0xff,0x87, - 0xa0,0x4a,0xaa,0x8a,0x9f,0x4a,0x52,0x15,0xa9,0xff,0xff,0xff,0xff,0x5f,0x8a, - 0xfc,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x94,0xf8,0xff,0xff,0xff,0xff, - 0x57,0xf2,0xff,0x2f,0x82,0x52,0x05,0xd0,0x2f,0x95,0x4a,0x49,0x84,0xff,0xff, - 0xff,0xff,0xbf,0x24,0xf8,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x12,0xfd, - 0xff,0xff,0xff,0xff,0x4b,0xd5,0xff,0x9f,0x28,0x54,0x48,0xc5,0xbf,0x52,0x55, - 0x0a,0xe1,0xff,0xff,0xff,0xff,0x9f,0x4a,0xfa,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x1a,0xfe,0xff,0xff,0xff,0xff,0x57,0xa9,0xff,0x3f,0x82,0x00,0x21, - 0xf0,0x5f,0x2a,0x49,0x21,0xc4,0xff,0xff,0xff,0xff,0xaf,0x1a,0xfd,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0x3f,0x85,0xff,0xff,0xff,0xff,0xff,0x29,0xa5,0xff, - 0xff,0x24,0x52,0x88,0xfc,0xbf,0x92,0x2a,0x09,0xf1,0xff,0xff,0xff,0xff,0x9f, - 0x4c,0xfc,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x15,0xff,0xff,0xff,0x7f, - 0xff,0xa5,0x4a,0xff,0xff,0x90,0x08,0x01,0xfe,0x3f,0x55,0x52,0x24,0xf4,0xff, - 0xff,0xff,0xff,0xaf,0x02,0xfd,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xc6, - 0xff,0xff,0xff,0xbf,0xfe,0x95,0x54,0xff,0xff,0x05,0x42,0xa8,0xfe,0xbf,0xa4, - 0x2a,0x41,0xf9,0xff,0xff,0xff,0xff,0x5f,0x55,0xfc,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0x4f,0xd0,0xff,0xff,0xff,0xbf,0x7c,0xaa,0x92,0xfc,0xff,0x53,0x08, - 0x01,0xff,0x1f,0x4a,0x01,0x04,0xfc,0xff,0xff,0xff,0xff,0x27,0x05,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xc5,0xff,0xff,0xff,0x4f,0xbf,0x52,0xaa, - 0xfe,0xff,0x07,0x42,0xea,0xff,0xbf,0x50,0x54,0x51,0xff,0xff,0xff,0xff,0xff, - 0x97,0x56,0xfe,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xf0,0xff,0xff,0xff, - 0x2f,0x7f,0xa5,0x54,0xfd,0xff,0x3f,0x09,0xe0,0xff,0x1f,0x02,0x01,0x04,0xff, - 0xff,0xff,0xff,0xff,0xaf,0x02,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x4b, - 0xf5,0xff,0xff,0xff,0xab,0x9f,0x94,0x92,0xfc,0xff,0xff,0x40,0xfd,0xff,0x9f, - 0x48,0x48,0xa1,0xff,0xff,0xff,0xff,0xff,0xa7,0x56,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0x6b,0xf8,0xff,0xff,0xff,0xa4,0x5f,0xa9,0x2a,0xfd,0xff,0xff, - 0xff,0xff,0xff,0x3f,0x22,0x21,0xc4,0xff,0xff,0xff,0xff,0xff,0x2f,0x03,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0xfa,0xff,0xff,0x7f,0xd5,0x2f,0xa5, - 0xa4,0xfa,0xff,0xff,0xff,0xff,0xff,0xbf,0x08,0x08,0xf9,0xff,0xff,0xff,0xff, - 0xff,0x97,0x4a,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x94,0xfc,0xff,0xff, - 0x7f,0x69,0xac,0x2a,0x55,0xf9,0xff,0xff,0xff,0xff,0xff,0x7f,0xa2,0x22,0xf8, - 0xff,0xff,0xff,0xff,0xff,0x53,0x21,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0x15,0xfe,0xff,0xff,0x9f,0x2a,0x95,0x94,0x92,0xf4,0xff,0xff,0xff,0xff,0xff, - 0xff,0x08,0x88,0xfe,0xff,0xff,0xff,0xff,0xff,0x57,0x8b,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xa9,0xfe,0xff,0xff,0x5f,0x52,0xbc,0x52,0x55,0xf5,0xff, - 0xff,0xff,0xff,0xff,0xff,0x21,0x21,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0xa1, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x7f,0x0d,0xff,0xff,0xff,0x57,0x15,0x3f, - 0x55,0x49,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0xc8,0xff,0xff,0xff,0xff, - 0xff,0xff,0xd7,0x89,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xbf,0xd6,0xff,0xff, - 0xff,0x4b,0x45,0x3f,0x49,0xaa,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0xf9, - 0xff,0xff,0xff,0xff,0xff,0xff,0xc9,0xe2,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0x3f,0x81,0xff,0xff,0xff,0x29,0x11,0x5f,0x28,0x55,0xf5,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab,0xc8,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0x5f,0xd6,0xff,0xff,0x7f,0xaa,0xc2,0x0f,0x55,0x49,0xea, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa5, - 0xe2,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x9f,0xe1,0xff,0xff,0xbf,0x4a,0xd1, - 0x5f,0x48,0xa5,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xe9,0xe0,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x27,0xf4,0xff, - 0xff,0xbf,0x94,0xc4,0x07,0x91,0x2a,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xca,0xea,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xaf,0xf1,0xff,0xff,0x9f,0x52,0xe0,0x4b,0x44,0x52,0xe9,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6a,0xe0,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0x4b,0xfc,0xff,0xff,0xab,0x2a,0xf5,0x0f,0x51,0xa5, - 0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0x69,0xe5,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x55,0xf8,0xff,0xff,0x95,0x14, - 0xf0,0x5f,0x84,0x54,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0x75,0xf0,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x13,0xfd, - 0xff,0xff,0xa5,0x42,0xf9,0x7f,0x91,0x4a,0xf5,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xb2,0xfa,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0x54,0xfe,0xff,0x7f,0x52,0x12,0xfa,0xff,0x20,0xa5,0xe4,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x34,0xf8,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0x25,0xff,0xff,0xaf,0xaa,0x48,0xfc,0xff,0x0b, - 0x29,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xb5,0xf8,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0x52,0xff,0xff,0x2f,0x49, - 0x02,0xfe,0xff,0x43,0xaa,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x3f,0x3a,0xfa,0xff,0x7f,0xff,0xff,0xff,0xff,0x7f,0x4a, - 0xff,0xff,0xa5,0x2a,0xa9,0xff,0xff,0x17,0x25,0xe9,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x9a,0xfc,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0x2a,0xff,0x7f,0x95,0x54,0x80,0xff,0xff,0x07,0xa9,0xea,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x1d,0xfc, - 0xff,0x7f,0xff,0xff,0xff,0xff,0x3f,0xa9,0xfe,0x7f,0xa9,0x12,0xe5,0xff,0xff, - 0x5f,0x4a,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x5f,0xad,0xfe,0xff,0x7f,0xff,0xff,0xff,0xff,0x7f,0x95,0xea,0x97,0x54, - 0x4a,0xf0,0xff,0xff,0x1f,0xa8,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x5f,0x0e,0xfe,0xff,0x7f,0xff,0xff,0xff,0xff,0x5f, - 0x52,0x55,0xa9,0x92,0x02,0xfd,0xff,0xff,0x5f,0x53,0xf5,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x5e,0xfe,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xbf,0x2a,0x49,0x4a,0x55,0x49,0xfc,0xff,0xff,0x3f,0x94,0xf8, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0x0f, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x4f,0xa5,0xaa,0x92,0xa4,0x20,0xff,0xff, - 0xff,0xbf,0xa4,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x5f,0x57,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x5f,0x52,0x52,0xaa, - 0x2a,0x0a,0xff,0xff,0xff,0x7f,0x54,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x8f,0x07,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xa7,0x94,0x4a,0x55,0x4a,0xa0,0xff,0xff,0xff,0xff,0xa8,0xfa,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x57,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0x2f,0x55,0xa9,0x92,0x12,0xe9,0xff,0xff,0xff,0x7f,0x24, - 0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf, - 0x87,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x57,0xa5,0x4a,0xaa,0x44,0xf4,0xff, - 0xff,0xff,0xff,0x55,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xa7,0xab,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xab,0x94,0xa4, - 0x92,0x12,0xf9,0xff,0xff,0xff,0xff,0xa8,0xfa,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xab,0x83,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0x47,0xa9,0x2a,0x55,0x40,0xfc,0xff,0xff,0xff,0xff,0x25,0xf5,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xd7,0x97,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0x33,0x55,0xa9,0x24,0x15,0xfe,0xff,0xff,0xff,0xff, - 0x95,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xff,0xff,0xff,0xff,0xff, - 0x93,0xc3,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x57,0x25,0xa5,0x2a,0x40,0xff, - 0xff,0xff,0xff,0xff,0xa9,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe3,0xff, - 0xff,0xff,0xff,0xff,0xe7,0xd5,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x4b,0x92, - 0x54,0x92,0xd4,0xff,0xff,0xff,0xff,0xff,0x55,0xf5,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xe9,0xff,0xff,0xff,0xff,0xff,0xd5,0xc1,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0x97,0xaa,0x4a,0x05,0xe2,0xff,0xff,0xff,0xff,0xff,0x25,0xf1,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xe3,0xfd,0xff,0xff,0xff,0xff,0xd5,0xea,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0x57,0x55,0x25,0xa1,0xf0,0xff,0xff,0xff,0xff, - 0xff,0x95,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe8,0xfa,0xff,0xff,0xff, - 0xff,0xea,0xe0,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xa7,0x24,0x59,0x04,0xfa, - 0xff,0xff,0xff,0xff,0xff,0xa9,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe2, - 0xfd,0xff,0xff,0xff,0xff,0xc9,0xe9,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x4f, - 0x52,0x05,0xa1,0xfc,0xff,0xff,0xff,0xff,0xff,0xa5,0xfa,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x70,0xf9,0xff,0xff,0xff,0xff,0x74,0xe2,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0x47,0x95,0x92,0x04,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0xf8, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xe2,0xfa,0xff,0xff,0xff,0xff,0x72,0xe8, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x97,0xaa,0x20,0xd0,0xff,0xff,0xff,0xff, - 0xff,0xff,0x55,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xb8,0xfc,0xff,0xff, - 0xff,0xff,0xea,0xe2,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x07,0x04,0x82,0xc2, - 0xff,0xff,0xff,0xff,0xff,0xff,0x29,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0x71,0xfd,0xff,0xff,0xff,0x7f,0x2a,0xf8,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0x4f,0x91,0x28,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0xfc,0xff,0xff,0xff, - 0xff,0xff,0xff,0x1f,0x54,0xfe,0xff,0xff,0xff,0x7f,0x75,0xf2,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0x27,0x44,0x82,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0x29, - 0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0xb8,0xfc,0xff,0xff,0xff,0xbf,0x14, - 0xf1,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x0f,0x11,0x20,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x55,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x9a,0xfe,0xff, - 0xff,0xff,0x7f,0x5a,0xf8,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x5f,0x40,0x85, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x4f,0x2d,0xfd,0xff,0xff,0xff,0x9f,0x12,0xf9,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0x3f,0x14,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0xfe,0xff,0xff, - 0xff,0xff,0xff,0xff,0x07,0xa6,0xfe,0xff,0xff,0xff,0x5f,0x4d,0xfa,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0x40,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x09,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x4b,0xfe,0xff,0xff,0xff,0xbf, - 0x2c,0xf8,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xf5,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x43,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x57,0xff, - 0xff,0xff,0xff,0x5f,0x0a,0xfe,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x89,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xd5,0xa9,0xff,0xff,0xff,0xff,0xaf,0x5a,0xfc,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa3,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x81,0x95,0xff,0xff,0xff,0xff,0x9f,0x06,0xfd,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xc9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xca,0xa5,0xff,0xff,0xff,0xff, - 0x2f,0x95,0xfc,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0xea, - 0xff,0xff,0xff,0xff,0xaf,0x26,0xfe,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd5,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xf5,0xf4,0xff,0xff,0xff,0xff,0xaf,0x86,0xfe,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc1,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0x70,0xe5,0xff,0xff,0xff,0xff,0x4f,0x2e,0xfe, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xb2,0xfa,0xff,0xff,0xff, - 0xff,0x57,0x83,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xf3,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x78, - 0xf2,0xff,0xff,0xff,0xff,0xa7,0x22,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x5f,0x5d,0xfd,0xff,0xff,0xff,0xff,0x97,0x87,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x3c,0xfd,0xff,0xff,0xff,0xff,0x53,0xa3, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xac,0xfe,0xff,0xff, - 0xff,0xff,0x57,0x95,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f, - 0x9e,0xfe,0xff,0xff,0xff,0xff,0x97,0x81,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xa7,0x57,0xfe,0xff,0xff,0xff,0xff,0xa9,0xa5,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0xaf,0xff,0xff,0xff,0xff,0xff,0x4b, - 0x89,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab,0x93,0xff,0xff, - 0xff,0xff,0xff,0x95,0xa2,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x83,0xab,0xff,0xff,0xff,0xff,0xff,0xd3,0xc8,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xff, - 0xff,0xff,0xff,0xff,0xe9,0xa5,0xff,0xff,0xff,0xff,0xff,0xa5,0xe1,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xd5,0xff,0xff,0xff,0xff,0xff, - 0xd5,0xc8,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xea,0xea,0xff, - 0xff,0xff,0xff,0xff,0x14,0xc1,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff, - 0xff,0xe0,0xe4,0xff,0xff,0xff,0xff,0xff,0x65,0xe8,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf, - 0xff,0xff,0xff,0xff,0x3f,0x72,0xe9,0xff,0xff,0xff,0xff,0xff,0x6a,0xe1,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xbf,0xb8,0xfa,0xff,0xff,0xff,0xff, - 0xff,0x52,0xea,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd3,0xff,0xff,0xff,0xff,0x1f,0x7a,0xf5, - 0xff,0xff,0xff,0xff,0x7f,0x2a,0xe0,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xff,0xff,0xff, - 0xff,0x8f,0x58,0xfa,0xff,0xff,0xff,0xff,0x7f,0x25,0xf5,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xb5,0xff,0xff,0xdf,0xff,0x57,0x5e,0xfd,0xff,0xff,0xff,0xff,0xff,0x34,0xe0, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xca,0xff,0xff,0x8f,0xff,0x07,0xac,0xfc,0xff,0xff,0xff, - 0xff,0x7f,0x2a,0xf5,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd4,0xff,0xff,0x57,0xff,0x2b,0x2d, - 0xfd,0xff,0xff,0xff,0xff,0xff,0xb2,0xf0,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd2,0xff,0xff, - 0x07,0xff,0x43,0x4a,0xff,0xff,0xff,0xff,0xff,0xbf,0x2a,0xf8,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x3f,0xc5,0xff,0xff,0x2b,0xfe,0x08,0xab,0xfe,0xff,0xff,0xff,0xff,0x7f,0xaa, - 0xf2,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xbf,0xea,0xff,0xff,0x83,0x36,0x20,0x55,0xff,0xff,0xff, - 0xff,0xff,0x3f,0x15,0xf0,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0xc2,0xff,0xff,0x48,0x4a,0x85, - 0x49,0xff,0xff,0xff,0xff,0xff,0x7f,0x59,0xfa,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0xf5,0xff, - 0x7f,0x10,0x29,0x50,0xa5,0xff,0xff,0xff,0xff,0xff,0x3f,0x15,0xf9,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x97,0xe4,0xff,0x7f,0x05,0x95,0x42,0xd5,0xff,0xff,0xff,0xff,0xff,0x7f, - 0x35,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xab,0xea,0xff,0xbf,0xa0,0x24,0xa8,0xd4,0xff,0xff, - 0xff,0xff,0xff,0x7f,0x19,0xf9,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x27,0xe5,0xff,0x3f,0x92,0xaa, - 0x50,0xe9,0xff,0xff,0xff,0xff,0xff,0x9f,0x4a,0xfc,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa9,0xe2, - 0xff,0x9f,0xa0,0xaa,0x2a,0xf5,0xff,0xff,0xff,0xff,0xff,0x5f,0x1a,0xf9,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x95,0xf8,0xff,0x5f,0x4a,0x92,0x4a,0xf5,0xff,0xff,0xff,0xff,0xff, - 0xbf,0x4a,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0x52,0xf2,0xff,0x1f,0x20,0x49,0xa5,0xfa,0xff, - 0xff,0xff,0xff,0xff,0x5f,0x1a,0xfd,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaa,0xf8,0xff,0x47,0xa9, - 0x2a,0x29,0xf9,0xff,0xff,0xff,0xff,0xff,0xbf,0x0a,0xfc,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x49, - 0xf2,0xff,0x17,0x92,0xaa,0xaa,0xfe,0xff,0xff,0xff,0xff,0xff,0x9f,0xac,0xfe, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x9f,0x2a,0xf8,0xff,0x43,0xa8,0x24,0x25,0xff,0xff,0xff,0xff,0xff, - 0xff,0xaf,0x0a,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x94,0xfa,0xff,0x91,0x54,0xaa,0x52,0xff, - 0xff,0xff,0xff,0xff,0xff,0x2f,0x4d,0xfd,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0x45,0xfc,0xff,0x03, - 0x92,0x52,0xaa,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x06,0xfc,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf, - 0x12,0xfe,0xff,0x50,0xaa,0x2a,0x95,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0xa5, - 0xfe,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xa7,0x44,0xff,0xff,0x0a,0x25,0xa5,0xa4,0xff,0xff,0xff,0xff, - 0xff,0xff,0x97,0x06,0xfc,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x15,0xff,0xff,0x40,0xa9,0x92,0xea, - 0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x55,0xfd,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0xa1,0xff,0x7f, - 0x92,0x4a,0xaa,0xd4,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x06,0xfc,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x95,0x8a,0xff,0x3f,0x84,0x54,0xa9,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0x2f, - 0x25,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x52,0xe0,0xff,0xbf,0x50,0xa9,0x4a,0xf2,0xff,0xff,0xff, - 0xff,0xff,0xff,0xa7,0x8e,0xfe,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xa9,0xea,0xff,0x3f,0x24,0x95,0x54, - 0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x23,0xfe,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x4a,0xf0,0xff, - 0x9f,0x50,0x69,0x49,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0x8b,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xa5,0xf4,0xff,0x0f,0x2d,0x75,0xaa,0xfa,0xff,0xff,0xff,0xff,0xff,0xff, - 0xaf,0x03,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x9f,0x14,0xfa,0xff,0x2f,0xa8,0xfa,0x25,0xfd,0xff,0xff, - 0xff,0xff,0xff,0xff,0x97,0xd7,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xaa,0xfc,0xff,0x0f,0x4d,0xfd, - 0xa9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xcf,0x83,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x12,0xfc, - 0xff,0x27,0x92,0xfe,0xcb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xd7,0xd7,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x97,0x0a,0xff,0xff,0x83,0x56,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xef,0xc7,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xab,0x24,0xff,0xff,0x2b,0xaa,0xfe,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xe7,0xef,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x45,0xff,0xff,0x05,0x95, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0x82, - 0xff,0xff,0x51,0xa9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7, - 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xa9,0xe8,0xff,0xff,0x85,0xca,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0x52,0xc1,0xff,0xff,0x90,0xd5,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x4d,0xe8,0xff,0xff,0xa5, - 0xe4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x51, - 0xf2,0xff,0x7f,0x40,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x3f,0x95,0xf8,0xff,0x7f,0xa9,0xea,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0x15,0xfa,0xff,0x3f,0xa4,0xf4,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xa4,0xfc,0xff,0x7f, - 0x71,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f, - 0x15,0xfe,0xff,0x3f,0x94,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xa7,0x0a,0xff,0xff,0x1f,0x79,0xf2,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xab,0xa4,0xff,0xff,0x5f,0x8c,0xfa,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x53,0x82,0xff,0xff, - 0x1f,0x5c,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xa4,0x92,0xff,0xff,0xbf,0x56,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x9a,0xc4,0xff,0xff,0x0f,0x2e,0xfd,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa2,0xf0,0xff,0xff,0xaf,0xa7,0xfe, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x55,0xe4,0xff, - 0xff,0x0f,0x57,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xbf,0x54,0xf2,0xff,0xff,0x9f,0x4b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x9f,0x92,0xf8,0xff,0xff,0xc7,0xab,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x15,0xfe,0xff,0xff,0x97,0xd7, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xa7,0x94,0xfc, - 0xff,0xff,0xc7,0xe3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x2f,0x05,0xfe,0xff,0xff,0xcf,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x53,0xa9,0xff,0xff,0xff,0xd3,0xeb,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x05,0xff,0xff,0xff,0xe3, - 0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x54,0xc2, - 0xff,0xff,0xff,0xeb,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x95,0xc8,0xff,0xff,0xff,0xf3,0xfa,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xa5,0xd2,0xff,0xff,0xff,0xff,0xf5,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xaa,0xe0,0xff,0xff,0xff, - 0xff,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x49, - 0xf8,0xff,0xff,0xff,0xff,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x9f,0x2a,0xf5,0xff,0xff,0xff,0xff,0xfd,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x4a,0xf8,0xff,0xff,0xff,0xff,0xfc,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x14,0xfd,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x97, - 0x4a,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xab,0x04,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x95,0x52,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x53,0x85,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x54,0xa2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x4a,0xc9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xa5,0xe0,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x94,0xe4,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x5f,0x55,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xbf,0x12,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4f,0x54,0xfa,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0x0a,0xfc, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x53,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x97,0x14,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4b,0x45,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x54,0x82, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x4a,0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x52,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x55,0xe8,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x24, - 0xf1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0x55,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0x24,0xf9,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x15,0xfe,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f, - 0x49,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x2f,0x95,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x5f,0x01,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0xd5,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x57,0x81,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x97,0xd4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xaf,0xe0,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x93,0xf4,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x57,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x2b,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x89,0xfc,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0xfc, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x05,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x49,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x22,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x89, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xbf,0xe9,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff, - 0xff,0xff,0xff,0x9f,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xf9,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xfc,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff, - 0x6f,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xbf,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff, - 0xff,0x9f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff, - 0xff,0xff,0xff,0xff,0xff,0xdf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f}; diff --git a/tests/benchmarks/qimagereader/images/image.pbm b/tests/benchmarks/qimagereader/images/image.pbm deleted file mode 100644 index 67e5efa..0000000 --- a/tests/benchmarks/qimagereader/images/image.pbm +++ /dev/null @@ -1,8 +0,0 @@ -P1 -16 6 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 diff --git a/tests/benchmarks/qimagereader/images/image.pgm b/tests/benchmarks/qimagereader/images/image.pgm deleted file mode 100644 index 443bf40..0000000 --- a/tests/benchmarks/qimagereader/images/image.pgm +++ /dev/null @@ -1,10 +0,0 @@ -P2 -24 7 -15 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 -0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 -0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 -0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 -0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/tests/benchmarks/qimagereader/images/image.png b/tests/benchmarks/qimagereader/images/image.png deleted file mode 100644 index 7d4890a..0000000 Binary files a/tests/benchmarks/qimagereader/images/image.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/image.ppm b/tests/benchmarks/qimagereader/images/image.ppm deleted file mode 100644 index 2a5640e..0000000 --- a/tests/benchmarks/qimagereader/images/image.ppm +++ /dev/null @@ -1,7 +0,0 @@ -P3 -4 4 -15 - 0 0 0 0 0 0 0 0 0 15 0 15 - 0 0 0 0 15 7 0 0 0 0 0 0 - 0 0 0 0 0 0 0 15 7 0 0 0 -15 0 15 0 0 0 0 0 0 0 0 0 \ No newline at end of file diff --git a/tests/benchmarks/qimagereader/images/kollada-noext b/tests/benchmarks/qimagereader/images/kollada-noext deleted file mode 100644 index 2abd4bb..0000000 Binary files a/tests/benchmarks/qimagereader/images/kollada-noext and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/kollada.png b/tests/benchmarks/qimagereader/images/kollada.png deleted file mode 100644 index 2abd4bb..0000000 Binary files a/tests/benchmarks/qimagereader/images/kollada.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/marble.xpm b/tests/benchmarks/qimagereader/images/marble.xpm deleted file mode 100644 index 1c08049..0000000 --- a/tests/benchmarks/qimagereader/images/marble.xpm +++ /dev/null @@ -1,470 +0,0 @@ -/* XPM */ -static const char *marble_xpm[] = { -/* width height num_colors chars_per_pixel */ -" 240 240 223 2", -/* colors */ -".. c #959595", -".# c #c5c5c5", -".a c #adadad", -".b c #dedede", -".c c #b7b7b7", -".d c #d2d2d2", -".e c #bebebe", -".f c #c9c9c9", -".g c #b8b8b8", -".h c #d6d6d6", -".i c #9e9e9e", -".j c #eaeaea", -".k c #b2b2b2", -".l c #cecece", -".m c #a5a5a5", -".n c #e4e4e4", -".o c #c4c4c4", -".p c #d9d9d9", -".q c #b1b1b1", -".r c #d8d8d8", -".s c #e0e0e0", -".t c #d6d6d6", -".u c #b6b6b6", -".v c #bfbfbf", -".w c #cbcbcb", -".x c #a5a5a5", -".y c #d1d1d1", -".z c #cdcdcd", -".A c #aaaaaa", -".B c #9a9a9a", -".C c #dedede", -".D c #aeaeae", -".E c #e6e6e6", -".F c #d3d3d3", -".G c #c8c8c8", -".H c #bababa", -".I c #c4c4c4", -".J c #cccccc", -".K c #bcbcbc", -".L c #f0f0f0", -".M c #b5b5b5", -".N c #e3e3e3", -".O c #c2c2c2", -".P c #adadad", -".Q c #c9c9c9", -".R c #e1e1e1", -".S c #a2a2a2", -".T c #d1d1d1", -".U c #bebebe", -".V c #dbdbdb", -".W c #dbdbdb", -".X c #c8c8c8", -".Y c #b9b9b9", -".Z c #a8a8a8", -".0 c #d3d3d3", -".1 c #9f9f9f", -".2 c #c1c1c1", -".3 c #ebebeb", -".4 c #b4b4b4", -".5 c #d9d9d9", -".6 c #cecece", -".7 c #e8e8e8", -".8 c #d6d6d6", -".9 c #c5c5c5", -"#. c #b0b0b0", -"## c #dadada", -"#a c #c5c5c5", -"#b c #d1d1d1", -"#c c #afafaf", -"#d c #b1b1b1", -"#e c #cbcbcb", -"#f c #c1c1c1", -"#g c #eeeeee", -"#h c #9b9b9b", -"#i c #c6c6c6", -"#j c #c0c0c0", -"#k c #cbcbcb", -"#l c #bdbdbd", -"#m c #a1a1a1", -"#n c #b7b7b7", -"#o c #a7a7a7", -"#p c #e6e6e6", -"#q c #c9c9c9", -"#r c #bbbbbb", -"#s c #e2e2e2", -"#t c #b8b8b8", -"#u c #cdcdcd", -"#v c #d3d3d3", -"#w c #cfcfcf", -"#x c #e0e0e0", -"#y c #d5d5d5", -"#z c #bdbdbd", -"#A c #cecece", -"#B c #c0c0c0", -"#C c #b7b7b7", -"#D c #e5e5e5", -"#E c #c4c4c4", -"#F c #e3e3e3", -"#G c #d3d3d3", -"#H c #dddddd", -"#I c #dddddd", -"#J c #acacac", -"#K c #a3a3a3", -"#L c #eaeaea", -"#M c #e1e1e1", -"#N c #b9b9b9", -"#O c #d5d5d5", -"#P c #bababa", -"#Q c #d7d7d7", -"#R c #b5b5b5", -"#S c #d1d1d1", -"#T c #c6c6c6", -"#U c #dcdcdc", -"#V c #b4b4b4", -"#W c #c6c6c6", -"#X c #a8a8a8", -"#Y c #a0a0a0", -"#Z c #cbcbcb", -"#0 c #bfbfbf", -"#1 c #cbcbcb", -"#2 c #a4a4a4", -"#3 c #c0c0c0", -"#4 c #bbbbbb", -"#5 c #9c9c9c", -"#6 c #a2a2a2", -"#7 c #dcdcdc", -"#8 c #c3c3c3", -"#9 c #9d9d9d", -"a. c #aaaaaa", -"a# c #d5d5d5", -"aa c #eeeeee", -"ab c #b6b6b6", -"ac c #b0b0b0", -"ad c #b3b3b3", -"ae c #c9c9c9", -"af c #e9e9e9", -"ag c #bdbdbd", -"ah c #a0a0a0", -"ai c #b0b0b0", -"aj c #e8e8e8", -"ak c #cacaca", -"al c #c3c3c3", -"am c #dbdbdb", -"an c #d0d0d0", -"ao c #d8d8d8", -"ap c #c7c7c7", -"aq c #dcdcdc", -"ar c #c7c7c7", -"as c #f0f0f0", -"at c #a3a3a3", -"au c #bfbfbf", -"av c #d9d9d9", -"aw c #dfdfdf", -"ax c #d3d3d3", -"ay c #c0c0c0", -"az c #cacaca", -"aA c #b3b3b3", -"aB c #cfcfcf", -"aC c #dadada", -"aD c #b2b2b2", -"aE c #e2e2e2", -"aF c #d7d7d7", -"aG c #c4c4c4", -"aH c #b8b8b8", -"aI c #cdcdcd", -"aJ c #a6a6a6", -"aK c #d2d2d2", -"aL c #cecece", -"aM c #acacac", -"aN c #dfdfdf", -"aO c #d5d5d5", -"aP c #c9c9c9", -"aQ c #bcbcbc", -"aR c #c6c6c6", -"aS c #cdcdcd", -"aT c #bebebe", -"aU c #f2f2f2", -"aV c #b6b6b6", -"aW c #e4e4e4", -"aX c #c3c3c3", -"aY c #e2e2e2", -"aZ c #d2d2d2", -"a0 c #dddddd", -"a1 c #dcdcdc", -"a2 c #ececec", -"a3 c #eaeaea", -"a4 c #cccccc", -"a5 c #c7c7c7", -"a6 c #c2c2c2", -"a7 c #cccccc", -"a8 c #a8a8a8", -"a9 c #e7e7e7", -"b. c #e4e4e4", -"b# c #d9d9d9", -"ba c #bababa", -"bb c #cfcfcf", -"bc c #d4d4d4", -"bd c #d0d0d0", -"be c #aeaeae", -"bf c #e1e1e1", -"bg c #d7d7d7", -"bh c #cfcfcf", -"bi c #b8b8b8", -"bj c #e6e6e6", -"bk c #c5c5c5", -"bl c #e4e4e4", -"bm c #d4d4d4", -"bn c #dfdfdf", -"bo c #dedede", -"bp c #ececec", -"bq c #bababa", -"br c #bcbcbc", -"bs c #b0b0b0", -"bt c #cccccc", -"bu c #a6a6a6", -"bv c #c1c1c1", -"bw c #bcbcbc", -"bx c #ababab", -"by c #d7d7d7", -"bz c #b7b7b7", -"bA c #b2b2b2", -"bB c #b4b4b4", -"bC c #bfbfbf", -/* pixels */ -"aYbla9a9a9.7#D.N#L#La9.7a9#D#D.7#D#D#DaY#x#xa0ama0ama0am#xbnbnbnaYaYaYaYaY#DaYaYaYbn#x#x#xaY.N#Da9a9a9a9a9a9a9a9a9.7a9a9a9#Da9#D#L#L#L#L#L#La2#La2a2a2a2a2a2#ga2#ga2#ga2a2#ga2a2#L#L#L#Lafa9a9a9bl#Dbl#Da9a9a9#L#L#Laf#L#Laf#L#L#L#L#L#L#L#L#L#La2#La2a2a2#La2#L#L#Laf#L#Laf#L#Laf#L#Laf#L#Laf#Laf#Laf#Laf#Laf#L#D#DblblaYaYaCa0.t.Fb#bnbnaCbnblblblblblaYaY.RaYblblblblblblblbla9a9a9a9a9a9#pa9a9#pa9#pa9#pa9#pa9#pa9a9bl#D#D#D#pa9#pafa9a9a9a9#L#Lafa9a9a9#D#D#pbl#U.V.Vb#.8am#xbn#IaYbl.N.N#x", -"am#I#Da9a9a9bj#D#La9.7#D#Da9#D#D#p#DaYaY#xbna0amamamb#a0a0a0a0bnawaYaYaYaYaYaYaY#xbnaY.R#xaYaY.Nafa9afa9afa9afa9.7a9.7a9bja9bja9#Lafa2afa2af#L#L.3#La2#La2bpa2#La2#ga2a2#ga2a2#g#L#Laf#L#La9afa9bl#Dbl#Da9afa9#L#Laf#L#Laf#L#Laf#L#L#L#L#L#L#L.7a2#La2a2#La2#La2#Laf#L#Laf#Laf#Lafajaf#L#Laf#L#L#Lafajafajafajaf.na9#s#Daw#xbnaCb#bg.Vbnbn.RaYaY#Mbl#pblaYblaYaYaYblblbl#D#Dbl#D#paf#pafa9#pa9afbla9#pa9#pa9#pa9#pa9#p#D#p#Da9#D#pa9#pa9#Da9#Da9af#L#La9.7#D#s#D#MaYbnaCb#aOb#aC#x#UaYaY#M#DaYbf", -"aOambn.sa9bja9.7a9.7a9#Da9bj#D#D#D#DaYaY#x#xa0amaFaFbgb#aF.Va0.VaYaYaYaYaYaYaYaYbn#xaY#xaY.N#D#Da9a9a9a9a9a9a9a9a9bja9#Da9#Da9#D#L#L#L#L#L#La2#La2afa2a2a2a2#ga2#g#La2bpa2bpa2#L#L#L#L#Lafa9a9#p#DaY#D#Da9a9.7a9af#Laf#L#Laf#Laf#L.7#L#L.7#L#L#L#La2a2a2#La2#L.3#Laf#Laf#Lajaf#Laja9#Lajaf#Lajafaja9#La9#La9#La9a9a9blaYaYaYawa0b#b#.paYaYblaY.Rbla9#pblblaYblaYa9#p#D#pa9#pa9#pa9a9a9#pa9a9#pa9bl#pa9#pa9#pa9#pa9#pa9a9#D#Dbla9a9a9a9a9#pa9a9a9#L#Lafa9a9#D#D#Da9awbn.pb#bgamaCbn#xaw#D#D#D.N#x", -"amamaC#x#D#s.7.7a9#Da9#D#D#D.N.N#xaYaYaY#xbna0a0aOaFb#aOb#bg.Vambna0bnaCa0aYaYaY#U.RaYaYaY#Dbl#Da9a9#La9af.7afa9.7a9.7a9bja9bja9#L#L.3#L.3#Laf#Lafa2#L#La2#La2bpa2a2#ga2#ga2a2#g#L#L#L#Lafa9afa9.Nblbl#Da9a9afa9#Laf#L#Laf#Laf#L#L#L#L#L#L#L.7#L#La2#L#La2aja2#Laj#Lafaj#Laf#L#Laf#Lafafajafaf#Lafaj#Lafajafaj#Laja9.n#D#MaY.R#xbga0bnbn.RaYbl#Ua9#pa9#D#Dbl#D#Dbl#Dbl#Dbla9#Da9a9#pafa9af#pa9#p#pa9#pa9#pa9#pa9#pa9#p#D#pa9#Da9a9af#pafa9af.7a9#Laf#L.7a9#s#D#saYaY#Ua0aObgao#x#IaYbl#D#s#D.sbf", -"amaOama0.N.Na9a9bja9#Dbj#D#D#DaY.N#x#x#x#xbnaCa0#H.Vbgb#b#aFbgambnbn#Ubnbnbnbnbn#xaYawaYbl#Da9#Da9a9a9a9a9a9a9a9a9bja9#Da9#sa9#D#Laf#L#L#L#La2a2a2afa2#La2#ga2a2#g#L#g#La2bpa2#L#L#L#Laf#La9a9#pbl#Dbl#Da9a9.7a9#Lajaf#Lajaf#Lajafafajafafajafaf.j#L.3a2#Laf#La2af#Laf#Laf#Laf#L.n#L.n#La9#L#Lafa9afa9aja9#La9af.7afa9#Dbl#IaYawa0a0#UbnaYblblaY#pa9#pa9#D#D#D#Dafa9afa9af#pa9#pa9afa9#pa9a9a9a9#pa9#pa9#p#pa9#pa9#pa9a9#D#Dbla9a9a9a9a9a9.7a9.7af#Laja9a9#D#D#saYawbnaCb#aobn#x.Nbl#s#D#D#D.N.N", -".CamaOao.WaY#D.7#s#Da9#D#D.NaY.N#x#I#xbn#xaY#x#U#xa0a0a0bgamb#ambga0ama0am#xa0a0.RaYaY#Dbl#Dbl#Da9a9a9a9afa9afa9.7a9#D.7#Dbja9.7af#La2#La2af#L#La2a2a2a2a2#L#g#L#ga2a2#ga2#ga2#g#L#L#L#Lafa9a9a9#Dawbl#Da9a9a9.7af#Laf#Laf#L#Laf#L#Laf#L#Laf#L#Laf#L.j#La2afajaf#Lafajaf.Eafaj#Laf#Laf#Lafaja9aj#Lajaf#Laf#Lafajafajaf.n#DblaYaYaCbn#xbnaYaYaY.Rbla9#p#Da9a9.7#La9a9a9a9a9afa9afa9a9afa9afa9afa9#p#pa9#pa9a9#pa9#pa9#p#D#pa9#Da9afafafaf.7a9a9.7#L#Lafa9.n#D#s#D#D#x#Ua0aCaC#x.saY.s#D.7a9.Ebj.N", -"#xa0.8a#.8.Cbf.N#D#D.N.NaY.N.saY#x#xaY#IaYaYaYaYaYaY#x#x#xa0aCam.Vb#bg#yb#.Va0bnaYaYblaY#Da9#D#Da9afa9af.7a9a9a9.7a9bja9#s#Da9.7ajaf#Laf#L#La2#L.3#La2#La2a2#ga2a2bpa2#L#g#La2bp#L#L#Laf#La9af#paYbl#D#Da9a9a9a9#L#L#Laf#Laf#L#Lafafafafaf#Lafaf#La2#La2afajaf#Lajaf.7af#Lafa9aja9aja9#L.n#Lafafa9#L.n#L.n#La9#Laf#La9a9#Mbl#xaY#x#IaYawaYaYaYaYblbl#pa9a9.7#L.7afaf#Laf#Lafa9afa9a9a9a9a9a9a9a9a9#pa9#pa9#pa9#pa9#pa9a9#D#D#Da9af#Lafa9a9a9.7af#Laja9a9#D#D#D#M.N#I#xaCa0#UaY#D.NaY#D.n.7bj#Dbj", -"#x#xa0#vbcaq#xbf#D#D.Nbl.s.NaYbf#x#x#xaYaYaYaYaYaY#M.NaY#x#x.Ca0b#bgb#bgbg.V.p.VawaYblbl#Dbl#Dafa9a9a9a9afa9afa9.7a9#Da9#D#s#Da9af#La2#La2#Laf#La2#La2#La2bpa2bpa2#ga2#ga2#ga2a2#L#L#L#Lafa9a9a9aYaYbl#Da9afa9a9ajaf#Lajaf#Lajafafaj#Lafajafafajafa2#La2#Laf#Lafa9#Lafaja9aj#Laf#Lafajaf#Laf.7afaj#Laf#Lafajaf.Eafajaf.n#Dbl#MaY#IaY#xaY.RaY.RaY#FaYa9a9a9#L#L#Lafa9afafa9#Laf#L#La9afa9afa9afa9#pa9#pa9#pa9#pa9#pa9#p#D#p#Da9a9afa9a9.7a9#L.7.7.naf#La9.n#D#s.N.N#x#UaCbnaY#s#DaY#sa9.7b..7#DaW", -".7aw#x.CaoaB.y.5#s.N#I.Ca0a0ama0#x.N.NaY.NaY#D#Dbl#DblaYawaY#U.CbgbmaBaSaZbma0a0blaYaY#Dbla9a9#Da9af.7afa9a9a9a9bl#D#D#D#D.N#D#D.7a9a9a9a9a9#La9afafafafafaf#Lafa2#La2#L#L#L#La2a2a2af#La9a9#D#DawaY#sbla9b..7#La9a9a9a9.7a9a9a9afa9af.nafafafafafajafajafajafajafaja9a9bl#MaY#s#Da9#Da9#sa9.na9.7af.Eaf.7af#Lafafa9a9bl#M.NaY#Ibn#UaYaYaw#Da9a9.n#p#pa9a9.7.7.7.7a9.7a9.7a9a9#Lafafaf#Lafa9a9a9#pa9a9#pa9#pa9a9a9a9afa9.7af.7.7.7afa9a9a9a9a9a9#L.na9.na9.na9.n#Maw.Nawaw.N#D#D.E.7bj.7#Dbjb.#D", -".7#D.s#x.5.y#va#.NaYbf.Ca0ao#xbn.s.N.N#D#D#Da9#Dbl#Dbl#DaYaYaYbn.p.taBan#uaZ.FbgbnawaYawbl#D#D#D#D#Dbl#D#D#D#D#D#Dblblawbl.N#D#Da9a9a9.7af.7a9a9afafafajafaf#L#L#La2a2a2a2a2#La2#La2af#La9#D#D#DaYaY#D#D#Da9a9.7a9a9.7a9a9a9.7a9#Lafafafaf#Lafafaja9af#pafa9af#pajaf.na9#s#DblaYa9a9.na9a9a9#Da9aj#Lafaj#La9aja9ajaf.nbl#DaYaw#xa0#x.b#xaY#D#D#p#p#p.na9a9a9#L.7a9a9a9a9a9.7a9#Lafafafafafafa9af#p.na9#pa9a9a9afa9af.7a9#L.7#L#La9a9.7a9a9.7.na9a9a9.na9.na9.na9#D#MaYaw.N#s#D.n.7.7.n.7.E#D#D.7", -".7a9aY#xaCam#v#vaCaqa0aqama0#UaY.NaY#D#D#D#D#D#Da9#D#D#Dbl.NaY#Ibnambm#SaZa#a#b#aCa0a0#x#x#xaYbl#D#Da9#Dbl#Dbl#DblaYaYaYaYbl#D#Da9a9a9afa9afafafafafafafafaf#Laf#L#L#Laf#Laf#Laf.j#L#L.n.7a9#s#Daw#x#M#Da9#Daj.7a9.na9.7.na9a9.naf#Lafajafafajafafafajafajafafaf#pa9bl#Mbl#Daw#D.n#Da9#D.na9.na9a9af.7afafajaf#Lafa9a9#sblaY#x#IbnbnaYaYawbla9a9#p#pbl#pa9#D.7.7a9.7a9.7a9a9#L#Lafaf#Lafafa9a9a9a9#pa9.n#pa9a9a9afa9a9#L#Laf.7afa9a9a9a9.7a9a9a9.naf.na9.na9.na9#M.Nawaw#D#s#D#Daj.7aj.7#D.7b.a9", -"a9#saY.s.Ca0aF#v#v.5#vaF.8a0#x#D#D.N#D#Da9bja9.7a9a9bl#D#DaYaY.N.R#Uama#aFaOaFaFb#b#b#a0aCa0#I#xaYblaYblbl#DblaYaw.R#IaYawaY#D#Da9a9a9a9a9a9a9a9a9#p.na9af#La9.7af#Laf#Lafajaf#L#L.3#La9#D#D.NaYaYaYbl#D#D.7a9.7a9.7a9a9a9.7a9.7a9a9a9a9.na9#pa9.n#pa9#pa9#p.na9#sbl#s#Dbl#DblaYa9a9a9.Ea9a9bja9a9.na9#sa9#Da9#Da9.nblbl#D#M#x#x#U#x#UaYaY#Da9#sa9#p.na9a9.7a9a9#La9a9#La9#L#L#L#Lafafa9#La9afa9#pa9#pa9a9a9a9.7#Laf#L#L#L.7#L.7.7a9.7.na9a9.na9.7.n#D#D#s#D#M#D#Mbl.s#D.s#Da9#D.7.na9a9.n.7#D.7", -".N.N.NaY#Uaqamaoa#aB.0a#ambn#xbl#D#D#D#D#Da9.7a9a9.7a9#D#D.s.NaYaY.RaCamamaF.5b#amaob#amama0a0a0#IaYawaYaYaYaYaYbnbnbnaYaYaYbl#D.na9a9.7afa9a9a9a9af#paf.na9afa9.n.7#La9.7a9#L#Laf#La9a9#D#D.N.NaYaY#Dbl.n#D.7af.7a9.na9.na9a9.na9.na9a9#pa9.na9a9a9.na9.na9a9a9aY#MaYbl#sbl#s#D.n#Da9#Da9#sa9.n#Da9a9.7a9.na9.na9a9#DawaY#x#x#xbnbnaYawaYbla9a9a9a9#pa9#Da9a9.7a9.7af#L#L#La9#Laf#Laja9.7a9.7a9a9.n#pa9a9.7#Da9a9#L#La9#Laf.7afa9a9a9.7a9a9bja9#sa9#D#M#D#M#D#sbl#saY#saY#s#D#s.7a9.E.7#D#D#D#D", -"#I.N#I#xamaCamaFaB.Gaz#u.8am#xaY#D#D#D.7a9bja9.7.7a9.7a9#D#D#D.N#Ubna0aCama0amao.Va0amaCama0aC.Cbnbnbnbn#x#Ubn#Uam#Ua0awaYaYaw#D#pa9a9#pa9a9a9#p.na9a9a9a9a9.7a9.7a9af.7afa9a9a9aj#La9.E#D#D#saYaY#Mbl#Dbja9.7.7a9a9a9.7a9#sa9#D#p#D#pbl#sbla9#D#sblbl#Dblbl#sblawaY.N#MaYbl#Dbla9.Ea9.na9.7a9a9#D#s#D#s#D#D#D#D#D#MaYbl.Naw#x#Ibn#I.R#xaY#Da9#Da9a9a9a9.na9a9a9.7a9a9#La9#La9a9#L#Laf#La9a9#Dbj#pa9a9a9#Da9.7.7afafa9.7a9.7#L.7a9.7a9a9#sa9.na9#D#D#D#s#D.sbl#Dawbl#saY#sbj#Da9#s#D.Nbl.saY.s.N", -".Cbf.C.Cam.5aoa#.la5.G.waZ#va0.C#D#D#D.7a9a9#L#La9#L.7.7.7#D#D#D#x#x#x#x#x#xa0bnam.Va0.Va0a0#xbnaY#x#Ia0a0aCa0aCa0ambnbnaYawblbl#Dbl#M#Dblbl#D#Mbl#pa9a9#Da9a9.7a9.7a9.7a9.7a9a9#La9.n#D#D.NaY.NaYaY#D#Da9#Daja9.7a9a9a9a9.7a9.n#D#M#D#sbl#sblbl#D#M#D#M#D#M#D#M#x#xawaY#Dawa9#Ma9#Da9#Da9#sa9#s#D#D#D#D#D#s#D#sbla9blaw#x#x#xa0#UbnaYawaYbl#D.na9a9a9a9a9#Da9#pa9#La9#L#La9.7af#L#L#L.7#L.7.7.na9a9#D#s.7#D.7.7afa9#La9af.7a9.7.na9.na9a9a9#Da9#s#Dawblaw#D.sbl#sbl.s#D#D#s#D#saY.Naw#xaYbf#x#x", -"aqaoamavam.8a##v.5#Saza7.w#u#vam#Da9#D.7a9.7a9a9.7#L.7#La9bj#D#D.Cbn#xbnaYaY#x#x.pb#.Vamaobnbn#xbnbn#xbn#xbn#xa0a0b#aCa0aw.R.Nblaw#Dbl#Dbl#Dblbl#pa9#Ma9a9.nbja9a9a9#La9a9a9.7a9.na9#D#D#DaY.N.NaYaYbl#D#sa9a9#La9.Ea9.7a9a9#Da9#M#Dbl#Mbl#sbl#s#Mbl#sbl#D#MaY#sa0#I.NaYaYblbl#Da9a9.na9.Ea9a9a9#D#D#s#D#s#D#D#D#Dbl#saY#x#xaC.Ca0#x.R#xaY#D#Da9a9a9a9a9a9#p.na9a9a9a9#La9#La9a9#L#L#L.7#La9.7.7a9a9a9#Da9.7af.7a9afa9.7a9.7#L.7a9a9bja9#s.7.na9#sbl.s.saYaw#saY#saY#saY#s#D#s#D#xaY#x.W.C.C.Waq", -"amaFaOaFaOaFama0aY#x.8.0#u#uan#uam#xaY#Da9a9.7a9#Laf#L#La9#D#D.sbl#D#sbl#xaYaw#x.Rbn#Ub#.Va0b#b##Ubnbnbnbna0#xbnbnaYaYaYbnbn#UbnaYaYblaYblawblawa9.n#p#pa9#pafafa9a9a9.na9a9a9a9bl#Dbl#Dbl#sblblawaY#D#Da9.7.7#Laf#Laf.n.7#D.7#D.NaYawaY#xbn#Ua0#U#Ubn#UbnaC#UaY#xawaY#M#D.na9ajaY.N#Dbla9a9.na9.nbl#DblaYaYaw#x#MblaYawbn#Ibna0.b#U.RawaY#Mblbl.na9a9a9a9a9afa9#Dbj#D#D#D#D#D.7#Lafa9afa9.7#Da9#sa9a9a9#Da9.7.7afa9a9a9a9#D#s#D#D#Daw.N.NaY.NaY#D#sbl#saY#saY.N.na9#D#s#DaY.N.N#I#x.CamaoaFbya#", -"bgb#amam.5aCa0.C#M#xa0aFaZ#uaB.0aO#xaY#Dafa9a9a9#L#L.7af.7#D#D#D#D#DaY#D.N.N#xaY.Cbna0a0b#aFb#aF.Vbnbna0#Ubnbn#x#U#x.R#xawaYbn#x.R#I.Raw.RaY#x.R#p#p#pbl.na9a9a9a9a9a9#Da9#s#D#M#Dblbl#sblbl#DblaY#Dbla9#Da9af.7ajaf#L.7a9.n#Da9#M#DaYaYaYaYbnaCbn.paCa0bgaoaC#UaC#I#xaY#MaYblbl#Mbl#M#D.na9a9.n#D#M#D#M#DaY#DaY#M#pawaY#Ibn.Ca0aYbnaY.RaYblbl#Da9a9.na9afa9a9af#D#D#D#D#D#Da9#Daf#L.7a9.7#Da9#D#pa9.na9a9b.a9.7.7a9.7a9bja9#D#D#D#D#DaY#Daw#Daw#D#D#M.N#saY.saY#sbl#sbl.Naw.Nawbna0aCa0.8a#aF.5", -"amamaCa0a0#x#xaYblaY#Ia0bc#u#ua#amam#x#D#Da9.7a9#Laf#La9a9.7#D#Dbl#D#D#MaYaYboaYbna0a0aoamb#aOb#b#am.Va0bnbn#Ubnbn#xaYaY.R#xawaYbn#UbnaCbn#Ubn#U.RawaYblaYblawbl#D#D#D#Dbl#Dbl#Dbl#Dblbl#Dblbl#DaYaw#D#Da9bj.7#La9#Lafa9a9bja9bj#D#MblawaYaw.R#Ubn.V.8#vaB#S#waOaoa0aC#x#x.N#I.NaY.NaY#D#D#D.n#Dbl#sbl#Dbl#saYaYblawaYaYbnbnaCbn#U.baYawaY#M#Dbla9.na9a9.na9.na9#s#D#s#D#s#D#D#D.na9a9a9a9#D#D#D#pa9a9#Da9#D#L.7a9.na9#D.n#D#D#D.saY.saY.NaY.saY#sbl#s#Daw#DaY.NaY.NaY.saY.NaY#x.Wa0a0a0aOam.8a#", -"#x#x#x#xaYaY.N.N.7#D#x#xb#aZ.ya#amaObn#Da9#Da9bj#L#L#D.7#Da9.7a9a9.nbl#D#DaYaY.NaC#xa0.Vamb#aFaF#vaFbga0a0bn#xaY#Ubn#U#xaYaYaYaYbn#xa0a0a0a0aCa0bn#Ubn.baYaYaYaYbl#D#M#Dbl#D#Dbl#Dbl#s#D#D#D#D#MaY#Dbl#D#Da9.7a9ajafaj.7a9a9#sa9a9#M#DaYaYaY.b#xbgb##vaBa7.Q.z#S.5aO.8aoao.Ca0.W#x#I.Naw.NawaY#DawaYblawaYaYawaYawaYaY#U.C#U.Ca0aY#x.RaY#xblbl#D#Dbla9a9a9a9a9a9#D#D#D.NaY.N#s#Da9a9#sa9a9#M#Dbl.na9a9a9a9bja9.7a9a9a9.7#D#D#D#saY#DaY#Daw#DaY.N#M#D#s#Dbl.s.N#M.Naw.N#xaY#x#I#x#Ua0a0aCamama0am", -"aYaYbl.s#D#D#D#Da9#D#s.N.CaOa#aF.5ao#x#Dbl#Da9#Da9a9.7a9.7a9a9.7a9a9a9#Dbl.NblaY#x#xbna0a0amaFaFbmaFaFamaCbn#U#xbnbnbnaY.b#x.R#xaYbn#xbnaCa0bna0#Ubn#Ubnbn#I#xaY.NblaYaYawaYaw#Dbl#Dbl#D#M#Dbl#DaYaY#Dbl.na9.7a9#La9#La9a9bja9#D#MaYblawaY.R#x#U#S#SaB#uaz#u#vaO.8aOaOaOaOaOaOaO.Caoa0.W.C#I#x#I#x#I#x#x#I#x.NaY#x#Ubn#UbnaCbnaC#I.R#IaYawbl.sbl#M#D#Ma9#D.n#Dbl#D#D#s#D#D#D#D#D#Ma9bl#D#D#DblaYa9#p#sa9#D.n.7.7.na9#s#D#s#D.NaY.saY.saY.NaY.saY#s#D#p.s#saYaY.N#IaYaYaw#x#IaY#I#x#x#I#x#x#x#x#x", -"#D#D#D.7.7.7.7.7.7a9a9#DaY.CaO.y.5.5bnaY#D#D#D#D#D#Da9bja9a9.7a9a9a9#Da9#sbl.N#MaYaY#xawbna0aCb#aOaFbgb#b#a0a0bn#Ibnaw#xaYaYaYaY#Ubn#IaYaYaYaYbnbn.R#xaw#x.R#Ibnaw#IaY.sbl.Nbl.N#D#M#Dbl#D#M#DblawaY#M#D#D#s.7a9aj#L.na9.n#D#s#D#DaY#IbnaY#UbnaCaB#SaB#u#uaBaO.5amaoam.8.5aO.y#1#1#u.yaOamamaoamamamaC.C.C#xbn#x#Ua0aC.CaCa0#Ia0.R#x#UaYaYblaY.N#D#p#D#sbl#Dbl#D#s#D#D#D#D#s#D#Da9#p#MblblawaYaY#Ma9bl#sa9bja9.7#Da9a9.7a9#Daw#DaY.saY#Daw#DaY#D#M#D#sbl.N#saY.saY#xbo.N.N.s.N.Naw.N#D#D#D#Da9#D", -"a9.7.7af#Lajbp#L.7#L#La9#DaYa0#va#a0a0.Cbl#D#D#Dbj#D#Da9.7a9#L#L.na9a9a9a9#D#D#Dbl#DaYaY#xaYbna0b#aFb#b#aob#aoambnbnbnbn#U#x.R#xaY.RaY.R#IaYaYawblblaYblaYaYaYawbn#I#x#UaYawbl#Daw.N#D#D.NaY.NawaY#xbl#D#D#Da9.Eafaf#La9#D#D#D#D#I#x#xaCa0aCaoaO.FaO#v#u#u#uaFbgaC.Caoa0ao.5aB.z.U.Oaz.y.y#vbm.y#v#v.5amaoamao.8amaoa0aoa0#Ua0#x#U#xbnaw.N.saY#sbl#Dbl#Dbl#D#M#D#D#D#D#D#D#D#D#D.nbl#Dbl#xaYaYaY#pbla9bl#D#s.7.7.na9#Da9#s#D.NaY.NaY.Naw.Naw.Naw#D#M#D#D#Maw.Naw#x#IaYaY#s#Da9.nbj.7.7b..7.7bp#L", -"#L.7#L#Lbpbp#Lbp.7#L#L.n#D.N.C.5a#amaCaoaY#D#D.N#Da9#Da9#La9#Lafafa9a9#Da9bl#Dbl.n#D.nblawaY#x.Ra0.Vbgamb#amaFaF#Ubn#U#xbnbnaYaYawaYawaYaYblaYaY.bblaYblblblaYaYaYaYaY#I#x#I#x#I.NaYaY.sbl.sbl.NaYaw.N#M#D#sa9.7a9a9.na9.n#D#s#D#xaCa0aoaob##SaBaOaF#S#uaB#v.5aoa0aCamaoao.8#v#v#3ar.wanazaz#3#C#3aX.w.yaOam.8amaCambga0aoa0aCbn#U#x#IaYaw.NaY.NaYaY#sbl#sbl#D#M#D#D#D#D#s#D#D#DblblaY#MaY#IaYawbl.nbl.n#D#Da9#D#Da9.Ea9#D#D#Daw#D#saY.Naw.NaY.N#M#D#s#D.saYawaY#I.N.N#sa9a9.7af#L.E#L#Laj#L#L#g", -"#L#L#L#L#La2bpa2#L.j.7.7#D.Nbf#IaFaBa7an.5a0#Daf#D.7#D.7a9a9#L#L#D#Da9#D#M#D#Dbl#Dbl#Dbl#Dbl#sblaw.RbnaCb#aOaFa#bg.VambnaCbnaw#x.RaYaYaY.baYawbl#pbl.n#Da9a9#D.7#s#D#D#D#D#D#MaYaw#IawaY#x.N#I#x#IaYaY#D#Da9.na9aja9.n#D.N.N#x.CaCb##vaB#uaBaB#v#SaOaOaOaObg.8am.W.WaCaCamaOaB#u#a#faz#Sa#aBaBaz#u#u#uaz.w.wa7#u#uaB.yao.5aC.C#Ia0.pa0aCbnawaY.sbl#saYaYaY#DaYaY#D#s#D#D#D#D#D#D#s#D#sblaY#x#I#x#D#D#D#Da9.n#D#sa9#D#D#D#s#D#D#D#sbl#s#D#saY.saY#MblaY.C.W#I.N#s#Da9#sa9.7.na9.7#L#L#L#L#L#L#L#L", -"bpaj#Lbp#Lbp#Lbpa2#L#L.7#D.Nbfbf.Va#an#uaB.8bn#D#Da9#Da9.7a9ajafa9bl#Dbl#D#D#M#D#D#Dbl#D#Dbl.NblaYawbnamb#aFbm#Sb#.Vaobn#xbnaYaY.baY#MaYblaYblaY#pbl#p.n#Da9.n#D#D#D#s#D#s#D#D#saY.s#x.s#I#x#Ibn.W#I#xaw.N#s#D#D#D#D.NaY#I#x.WaCaCaCaF#SaB#v#SaOaOaOb#aOb#bgamao#x#I.CaCao.8#u.w.OaG.G#SaBaBbmaB#v#v#va#aB#u.G.Galbk#Taz.w#v#v.5bg.5bga0ao.C#IaYaY#Dbl#DawaY#D#M.NaY#D#s#D#D#s#D#D#MaYblaY#I#x#x#M#s#D#s#D#D#D#D#Dbj#s#D#D#D#s#D#D#s#D#Daw#Daw.N#M#s#x#I.Cbf.s#D#D.n.7a9.7a9.7.E.7#L.7#L.7#L#L#L", -"#Lbp#L#g#La2bpa2a2#g#La9bj#D.Nbf.RaCaOaZ.yaFa0aY#D#D#s#Da9a9a9a9#D#Da9#Dbl#D#Dbl#D#M#D#D#M#Dbl#saY#xbnaCa0aOaF#Sb#bg.VbnaCbnaY#xaYaYaY.baYblaYbl#Ma9#p#Da9a9#D.7#D#sbl#Da9#Da9#D#D#D#saY.N#I#I#Iaoao.W#xaY.Naw.N#I#I#U.WaCaoamaobnaCaO#vaF#vaOaFbgambgambg.5.8amav.WaC.CaoaF#uaza6.OazaZaB#vaF#vaFaFam.5aF#v#SaB.G.O#3bv.G.GaPaP.w#u#vaFama0.C.C#IawaYawaY.NaYaYaY#MaYaYaYblaYawblaYaw.NaY#I#x#I#D.N#M#D#D#s#D#s#D#s#D#D#s#D#Dbl#s#p#saY#s.Naw.Nblaw#I#xaY.N.N#sa9.7a9.Ea9.Ea9#L#L#L#L#L#L#L#L#L", -"#La2bp#L#Lbp#Lbp#L#L#L.7#Dbj#D.NaYbna0aoa##vam.C#D#D#D#D.7#D.7a9a9#D#Dbl#D#Dbl#Dbl#Dbl#Dbl#D#DaYaYaYawbna0b#aO.Fbgb#ama0bnbn#IaY.bblawblaYaY#MaYa9#p#sa9a9#Da9#Da9a9a9a9a9.na9a9#s#D#D.saY.NaY#x.C.C.C.W#I#x#I.WaF.8a0a0a0a0aCa0aCaCb##vaFaO#vbgaob#aoaoamaoaCam.W.Caoa0.8#v#ubkab#aan#vaZ#vaFa#aoaobga0aoamamaOa#aBaZ#u.w.w.G#3#3#a.w.y.yaOb#aCbnbn#I#xbn#UaYawbfaYbfaw#x.s#xaY.NawaYbl#x#Ibn#I#Daw#D.s#D#s#D#D#D#D#D#D#D#D#s#D#D#Dbl#saY#saY.saYaw#xaw.N#s#D#D.7.n.7a9.7a9.7#La9aj.7#L.E#L.7#L", -"bp#L#L#g#L#g#La2#g#L#L#L.7#D#DbjawaYaCamaoa#.8aF.N.s#D#D#D.n#Da9#sbl#D#D#M#D#D#M#D#M#D#Dbl#sbl#saYaY#x#UbnaCb#b#bgb#bga0aCbn#x.RaYaYaYaYawblaYbl#p.n#pa9a9.nbja9.7a9.7#sa9#D.7.na9a9#D#D#D#saY.s#x#I#I#x.C.Wa0aoaoama0.W.C.Wa0#Ibn.paO#S#v#v#S#Sbgaoaoa0aoa0avaCaqaoavao.8#v.w#T.Y#3an#va#aOamaOa0bnaoambgamaoam.pa0bgb#aoaFaO.ybk#T.GaXaz.waBbyaCa0a0bnaCa0#Ibn#I#x#x#x#x#x#xaC#x#I#x#I#x#I.C#IaY#saY#saY#D#M#D#s#D#M#D#M#D#D#D.n#M#D.s#DawaYaw#x#IaYaw#sa9.7.n.7#L.7aj.7#L#L#L#L#L#L#L#L#L#L#L", -"#L#g#L#g#g#gbp#L#L#L#L.7af.7.7.7#D.N#xaob#.8a#a##DaY#D#D#D#Da9bjbl#D#Dbl#Dbl#D#DaY#DaY#D#M#DaYaYaYawaY#x#Ibna0aCbgb#bg.VaCbn#U#xaw.Raw#FaYblaYbl#D#p#Da9#Da9a9#Dafaj#Laf#Lajaf.7a9#Da9#sa9#D.Nbl.NaY.NaYaY#I.C.Wamaoaoaobga0aoa0aCam#vaBa##SaBaBaobgaoaoaC.Waqaoav.8ao.5aOaBazaX#4alaza##vaOam.5aC.Wa0.Wa0aob#.8bnaCaCaCaC.W.WaC.y.yaB#ubkbkaX.Oazae#vaO.5ao.pbga0a0a0#Ua0aCa0ao.CaCaCa0#IaCa0#IaYaw#D.sbl#s.N#s#Dbl#D#s#D#D#sbl#D#D#saYaw.saw.NaC#xaw#D#sa9.n.7a9aja9#La9aja9#L#L#L#L#L#L#L#L#L", -"#Lbp#ga2bpa2#L#g#L#L#L#L#L#L#LafbjaYaY#xama0.5aO.N.NaY.s#D#D#Da9#Dbl#s#Dbl#Dbl#D#M#D#M#DaYblaw#D#MaY#I.R#U#x#U#Ub#b#bga0aCa0#x.R.Raw.RaYawaYblaw#p.n#pa9.na9#Da9aja9af.Eaf#Lafajafaja9#Da9#s#Daw#D#s#D#s.NaY.NaY#U#Ua0.paobgb#bgaO#vaB#u#u.y#ua5aObgaoamaoamaoavam.8.8#v#v#u.w.GaTbw.G.0#vaFaoamaoa0aoama0aqamaoamaCaqaC.W.W#I#Iaxbgaobg#va7.Oau.U#3#3a5#uaB#vaFaoaoa0amaCamaob#aoamaoaoa0aC#Ibn.sawaY.sbl#saY#s#D#s#DaY#saY#D#D#s#p#s#DawaY#Iaw.C#I.N.naf.Ea9.7aj#L#Laj#L#L#Laj#L#L#L#L#L#L#L#L", -"a2#L#g#g#g#gbp#L#L#L#L#L.7#L.7#L.N.N.s#x#xao.5b#.NaY.N#D#D#D#D#D#M#D#Dbl#D#D#sbl#D#Dbl#Dbl.sblaY.NaY#x#I#x#U#UaC.Vbgb#bgaCaC#U#I.R#x.baY.RaYblaYa9#pa9#Da9#Da9bjaf#Laf#Laf#L#La9#La9a9a9.7#Da9#D#sa9a9a9#D.NaY.Na9#paY#Ua0aoaO.yaBaBazazan#u.Gbk.daOaO.8aoavao.8.8.8bd.yaL#uazaX#0#4#TaZaOaO.5aoa0.Camaoamaoamambcby.8.C.C.W.W.W#U.rbgaO#S.yaB#uaP#3.U#3arbk#u#vaFbgbgaob#aob#bgamaOaoaoaoaC#U#IawaY.sbl.s#D#Daw#DaY#s.N#M#D#s#D#s#D#M.NawaY.s#xaC.C#Ma9aj#L.7.naf#Laf#Lafaj#Laf#L#L#L#L#L#L#L#L", -"#g#g#Lbp#Lbp#Lbpa2a2#L#L#L#L.7#L#D.N.NaYbo.C.C.W.Vbn.N#Dbjbj.E.7#D#D#D#D#s#D#D#D#D#s#D#s#D#D#D#sawawaYaw#x#U#xaCa0aCa0aC.Vamb#a0aYaw.RaY#M#p#M#pajafaj#pa9a9#Mbl.na9a9a9a9a9a9afajafaja9#D#s#D#Dbl#D#s#D#s#D.n#Dbl#saYaYaw#x#IaCaOaB#1a5.w.wbkaV.Qbt.ybcbc.8bcbcaBaB#u#uaz.waP#T.O#zbw.6aF#vaOaFambga0amamaOaoaOaoaCa0.WaC.W.C#I.WaCaoaOaoaOaobg#v#v#S#1.Q#3agaV#1aB.8aOamaoaCbg#v.8aoa0aC#x#U#Iawaw#D.s#D#s#D#s.N#saY#s#Daw#D#Mbl#saYaw#x#I#xaC#D#sbj#D#D.7#s.7.7.E#L.7#Laf#L#La2a2a2#ga2#g#g#g", -"#gasbp#g#Lbp#Lbp#L#g#L#L#L.7af.7#D.NaYbf#x#x#x#xaCbn#I.N#Dbja9.7#D#D#D#D#D#D#D#D#D#D#D#D#D#s#D#DblawaYawbn#I.WbnaCa0.pa0aoa0aoam#UbnaYaYaYblblbl#paf#p.n#pa9bl#Da9a9a9aja9af.na9.7af.7a9a9a9#D#sa9#M#D#D#D#D#D#D#D#D#M.NaY#x#x#xa0am#vaB.z#u#Ebi#nbCaX.Q.y.y.QaXbka5#u#u.w.wbkaP.O#4#4.wa##v.5a#aoamambg.5aO.5a#aoamaC.WaC.W.W#IaCaC.WaCaoaoaoao.8bg.8#v#v#u#uaPagagaXbka5aBaBaB.y.z#S.8bgaoamaC#x#IaYaw#D#sbj#D.sbl.sbl.N#saY.s#D#MaYawaY#U#x#Ibj#s#Db.#Db.#Dbj.na9#La9aj.7#L#La2#ga2a2#g#gas#g", -"#ga2#ga2#g#g.7bpa2a2#L#L#L#L.7#L#D#D.N#M.N#I#x#xa0a0#x.s.N.N#D#D#D#s#D#D#D#D#D#s#D#s#D#D#s#D#D#M#D#MblawaYaw#x#I#Ubn#Ua0.pa0.pa0aCbn#Ubnaw.Rawbl.n#p#p#pa9a9bl#Dafa9a9#pa9a9a9afajafaja9.7#D.n#D#Dbl#D#s#D.n#D#s#D#D#DaY#saYaw.N#UbnaCaOaO#vaBbkbq#Rbqag#3.U#zaVau#Tazazbkbkbv#3#E#0ab.2#uaOaF#vaFaOaOaFaObyaO.8aCaCaC.C.W.W#I.W.WaCaC.WaC.WaCaCaCaCaoao.8.8#v#vbbbbap#3.U.U.U#4a5#E#1#SaFaOaOaFaC.W#x#IaY.s#D#saY.s#xawawaY.saY.sbl.NaY.s#x#x#Ia9.7.E.7.E.7.n.7a9#L.E#L.7#L#L.7#L#L#L#L#ga2bpbp", -"#g#g#L#gbp#g#Lbp#L#g#L#L#L#Laf.7#Da9#D#DaY.N.N.sbn#Ua0.C#x.N#s#D#D#D#D#D#s#D#D#Da9a9.na9a9a9a9#Dawbl#saYawaY#U#x#U#x#Ubn#Ibna0aCa0a0#UbnbnbnaY.Rbl.n#D#p.n#pa9bla9af.nafa9afa9a9#Laf#La9a9a9bja9a9a9.na9a9.7a9.7a9a9#s#D#DaY.Naw#xaw#xaCamaoaOaB.v.O.Obqadbx.abzbi.U#3#T#3bvagag#3#4#caT.w#vaF.y#v.5#vaOa#ao.5.5aC.CaC#I#I#I#Ibo#I#Iaw#Iawaw#I#U#7.W#IaC.WaCav.W.8#v#v.y.w.G#T#3.Oag.O.w#uaB.ya#aoamaC#x#I#x.N.s#xaw#I#x#Ibfaw.Nbl.s.Naw.NaY.saY.E.7af.Eaf.7#L.E.7aj.7#La9aj#Lafajafaja2#L#ga2#g", -"#ga2#ga2#Lbp#Lbpa2a2#L#L#L#L.7#La9.7a9#D#D#DaY.NaY#xa0#U.CaYbl#D#D#D#D#D#D#D#D#Da9a9#Da9#sa9.na9#D#M#Dbl#saYawaYawaYaYawbn#Ibn#IbnaC#xbn#Ibna0bnblblbl#Dblbla9a9.na9a9a9a9.na9a9af#L#L.na9bja9#D.na9a9a9.n.7.n.7.Ea9.7a9#s#D#D#D#sblaw#IaCaobg.d.O#ia5.G#zadadadabadaVaVbq#3#3bvbqaba8.YbkaBaO#uaFaOaFao.5aoaqaC#I#I#Iaw#I.s.sawbobo.sbo.sbobo.s#M#M.s#7aw#Iaw#I#U#IaCao.8aO#v#u.Q#3biag#3aXazaZ#vaOam.C#x#I#IaY#I#x#I#I#x#I#xaw.Naw#D#s#D#s#Da9#Laj#L#Laj#Laj#L#La9#L.E#L#L.7#Laf#Laf.7#L#L#L#L", -"a2a2#L#g#L#L#L#La2bp#L#L#L#L#L#L#L.7#La9.7#Da9#D#DaYbnama0#xaY#s#D#D#s#D#D#D#D#Daj#Lafajaf#La9a9.na9#M#D#MaY#MaYbl#MawaYaYaYaw#x.RaY.b#xbnbn#Ibnaw#xawbl#D#Ma9#pafa9afa9afa9afa9aj#Laf.7a9.n#Da9ajafa9aja9#L.7#Laf#L.E#L.7.Ea9#sblawaw#xaCaCaO.8aBazbka5.Gbk.U#3biad.a.a.DaVaVaV.M#d.S.Yaz#u.0.y#vaF.8a0.W.C#I.C#Iaw.Naw.s.s.s#s#s#s#s#s#s#s#s#s#s#s#s#M#s#s#s#s.n.n#M.raC#OaO#w#u#E.vbkazbkbkbk.w.yaOamaC.C.C#I#I#I#x#I#x#I#x#Ibf.s.N#s#D.7a9.E#L.E#L.E#L#L#L#L.7aj.7af#L#L#L#Laf.nafaj#L#L#Lbp", -"#gaa#ga2#L#L#L#Lbpa2#L#L#L.7#L.7#Laf#L#L#La9.7#D#saY#xa0ama0aYaY#D#D#D#D#Da9#D#Daf.7aja9#L.n#Laj#p.n#p#Dbl#s#DaY#sbl#D#MawaYaYaY#Mblbl.baYawbnbnaYaYaYaYbl#D#pa9a9a9a9a9a9a9a9a9afafaja9a9bja9#Dafafajaf#L.Eaf.Ea2#Lafaja9a9#s#D#sawaw#IaC.WaoaoaO#uae#1#u#uaz#u.O.Ubi.D#d.D#J.D.abu#6.Y.G.w.yaZ.8aoam.W#xaw#I.saw.saw.s.s#s#sbj.Eb.#sb.b.#sb..E#s#s#s#s.s#s.E#s#s#s#s.r#U#IaCaCbd#1#SaOao.ya5bkaza5.waOamaoaC#x.WaC.W#I#x#I#x#I.Naw#D#D#s.7#L.7#Laj#L#Laj#Laj#Laja9#L.E.7.n.7.Ea9a9a9a9a9.7#Laf", -"a2#g#L#g#L#L.7#La2#g#L#L#L#L#L#L#La2#Laf#Lbja9a9#DaY.C.VaFa0#xaw#D#D#D#D#D#D#D#Dajafaf#Laf#Lafaf#p.nbl.n#Dbl#M#D#Ma9#M#DaYaw#Dawbl#MaY#Mbn.RaYawbn#xaw#x#Mbla9.naf#paja9af.nafa9aja9#La9a9a9#s#Daja9#La9#Laf.7#L#Laj.n#L.7.n.7#s#Daw#x#I.CaC.8.8#v#v#v#vaO.z#1.z.Gbk.O#zbibBbBad.x#5#9.YaPaz.y.0bgaoam#Iaw.N#s#Dawaw.s#s#D#s#s#s.E.7.E.7.E.E.E.Eb..Eb..E.E.E.E.E.s.saw#IaC.WaC#Oam.d#vao.8aFaO.8.G#3.OaB.8amaCaCaC.Wa0#I#I#I#I#x.s.N#s#D.na9.n#Laj#L#Laj#Laj#Laj.7#L.7af#L#Laf#Lafa9a9.na9a9.7.7", -"#L#L#L#L#L#L#L#L#La2bpa2#ga2bp#L#L#L#L#L.7a9.7.7.NaY#xbnao.VaF.V#xaY#Ma9.na9a9#D#La9aja9aja9aj.7.na9.na9.na9.na9#p#s#p#D.na9a9.n#p.nbla9#sbl#saYaYaYaYaYaYaYaYaY#pa9#p#pa9#pa9.nafafaja9#D#D.N.N.nafajafaja9ajafajaf.7.na9#D.n#D#Dawaw#I.W#IaCaCaobdaO#v#v.y.y.y#u.QaX.9#TbC#r#r.aatatbB.2aX.GanaC.W#Ibobf.sbf#I#s#s#s#sb.b.bj#s.7.E.E.E.7.Ea9.Eaj#Lajajajajajaj.s#s#I.s.s#I.s.WaCaCaCaCa0.W.W.W#v#vbtbkbk#uaB.0aObgaoaoamaC.C.W.n.na9.E.7.E.7#Lbjb..Ea9aj#L#La2a2.jbpaj#L.E.7bjajaf#La9#Laf#Laf", -"#L#L#L#L#L#L#L#L#L#ga2a2bpa2a2a2#L#L#L#L#L.7#L.7#DaY#Ibnb#b#aOb##xaY#D#Da9.n.7#Dafajaf#Laf#Lafafa9aja9a9.na9.na9.na9.na9#p.na9a9afa9.n#p#D#M#DblaYawaYaw#xaw#xaY#p.na9a9a9a9#p#pafaf#pa9#D#s.N#sa9a9#La9#Laf#Laf.7aja9.n.7.n#Da9.saYaw#x#I#x.W.WaCao.8.8aObc#v.y#v#ubkbvbvaXbvbC.k.Dai.UaXbv.Ga7aOaoaNboaWbo.s.Nb.#sb.#D#s#sbjb.b.a9b.a9.E.7.Ebjajaja2aj#Laj.naj#D#s.sbo#I.sbo.saCaCaC#I#I#I.W#xavaoaO.y.z#1bkbkaBaBaO.5aoaoav.Wa9#s#L.E#L#L.7.E.7#D.7.E#L#L#Laja2bpa2#L#L#L#L.7af.7afajafaj#L#L", -"a2#La2#ga2#ga2#ga2#L#ga2a2#g#L#g#L#L#L.7af.7a9.7#Daw#x#xam#SaZa#aC#xaYa9a9a9#Da9aja9#L.n#L.n#Lajafa9.naf.na9a9.na9a9.na9.na9a9.n.na9a9.na9#D#D#saY#x.R#xaYbn#x#xblblbl#Mblbl#Dbl.n#p.nbl#D#D.N.N.naf.nafaja9#L.n#L#La9.7.n#D#s#saYaw#I#I#I#U#Ia0.Wao.8aObc.8.y.y#u#ubk#3bCapbkag.kbqaX.Q.Qbka5#u#v#vamava1bob..E.na9b..E#s.7.E.E.7.E.7.E.7.E.7.naj#L.jaja2ajajaj.n#D.s#I.s#I.saY#I#U#x#I#x#x#Ibo#x#I.CaoaO#v.y#1bkbk#u#vbcam.C#I#sa9.n.7.E#L.E.7#s#s.7.n#Lajbpa2bp.jbp.j#Laj#L#Lajafajaf#La2afa2", -"#ga2#ga2a2a2#g#La2#ga2#g#L#ga2a2#L#L#L#L.7.7#La9#D#D#xaCaF.0aZana0#xaYbla9.na9#D#Laf#Laf#Laf#La9af#L.na9af.nafa9ajaf#Laf#Lajaf#Lafajaf#L#D.n#D#DawaYaY#IaY#I#x#IaYawaYaYaYawaYawbl#Mbl#D#sbl.s#Da9.na9.7afajaf#Laf.Ea9.Ea9#sa9#s.N#I#x#I#x#Ia0#I.Wao.8.8aObc.ybba5bkaXaX#3bvag#n.c.#bt#baLbcbdaBaB.y#vam.Wbfb..7#s#s#s.7.E.E.E.7#s.E.E.7.n.7.E.7aj#g.ja2.jaja2#L.E.n#s.s.s#I.s.s#x#I#I#x.s#I.Nbo#x#I#I.CaoaoamaObkaz.Q.z#v.8.Wbf.N#s.N#s#D.sa9.E#D#D.E.7#L#Laj#Laj#g#L#g#L#gbp#L#L#L#L#L#La2bpa2", -"a2bpa2bpa2bpa2a2#g#La2bpa2a2bpa2#L#L#La9#L.7a9.E.7aYaY.Cam#vaZaZaobn#xbla9a9a9#s#L.n#L.n#L.n#Lajaf#Laf.na9a9ajaf#L#Laj#Laf#L#Laj#L#L#Laj.7a9.7a9#D#Dbl.NaYaY#xaY#xaY#x#U#xbn#IbnblaY#MaY.NaY#s#D.na9aja9af.7af.E#Laja9a9b.#D#s#Daw#x#I#I#x#I.Wbn.Wa0aoao.5.8.y.QazaX#3.O#3aVai#n#8aLax#O.W.Wao.8#1aB.y.5.Ca1bo.sbo#D#sb.#D.E.7aj.7.E#D.E.7.E.7.7.ja2.j#gbp.jaj.j.7#s#s#s#s.N.s#Iawaw#D.saw.N.s.s#D.s#x.W.WaoaC.8.0.y#v#v#v.d.8ao#I#Ibf.s#Db.bj.7#Dbj#L#Laj#L#L#La2aj#gaj#ga2asasa2a2a2a2#La2a2#g", -"#ga2a2a2#ga2a2#ga2a2#ga2a2#L#ga2#L#L#L#La9.7.7a9.7.N.s#xamaF#va#.5am#x.N#D.na9.7af#Laf#Laf#Lafa9#L.n#La9.naf#Laf#Lajaf#L#Laj#Lafa2ajaf#Laf.7.7.na9.n#D.nbl#D#DawaYawaY#U#x#U#x#UaYaw.Nblaw#D#D#sa9.na9.nafajaf#Lafaj.7.na9#sa9#saY#I#I#xaC#xao.CaCavaoao#v.yaI.Qae.O#zaV.Dah#Xag#b#O.r#7#7#7.W#QaObdaB.y#vaoaqbo#Ibobf.N.Ebj.E.7.E.E.7.E.7.E.7.Ebp.j#g#g.ja2#L.j.E.7#s.nb.#s#D.saw.Naw.s#D.s#s.N.s.sbo#I.C.Wam.8bgbgamao.C.8axbcaxaoaobo.N#s#Db.#s.7.E#L#L#L#Laj#L#g#La2#gas.jasbp.j#L#g.j#g#L#g", -"a2asa2asa2aa#ga2#g#L#g#Lbpa2#L#L#L#L#L.7.7.n.7.7a9.saYaY.Wa0amam.5am#IaYbla9a9a9aja9aja9aja9ajaf#Laf#L.na9#L.n#Lajaf#L.jafa2a2.ja2a2#Laj#Laja9#L#Laf#Lafa9.n#D#DaY#xaYaYaYawaY#U#xbnawaY.Naw#D#sa9.na9af.na9.na9.Ea9.na9.E#D#s#D#I#x#I#x.WaCaoaoao.8.8.8.y#1#1.Q#T#3bq.D#m#haibkavao#7aE.sbo.W.W.s.Wbd.GazaBbc.8##avbobfbobjbjb..7.7.E.7.E.7.E.7#g.j#g.j#g.jaja2.Eaj.n#D.nb.#sb.#D#s#s#D#s#D#s#s.s.N.N#I#x.Wam.WaC#x#I#xaCa0av.8.8.8ao.W#Ibo#s#s#Dbj.7#Lajaj#L#Laj#gaj#g#gasasaU#g#g#ga2bp#ga2#g", -"a2a2#ga2a2#ga2a2a2#ga2aja2bp.ja2#L.7#L#L.7a9.7a9bj.N.N.N#xa0a0aCaF.5bnaY#D.na9.7af#Laf#Laf#Laf#L.n#L.na9.naf#Laf#Laja2#La2aja2#La2aja2#Laf#L.E#L#Lajafaj#La9#L.nblblbl#MblaYaYawbn#U#x#xaw.N.s#D.nafa9.na9a9a9.na9aj.7#sa9#sa9#s#x#I#x.Wbnavamaoao.8aObd.ybt#ubbag.O#3bA.iaJ#3bbav.h#7b.b.boa1#IaE#I#QaB#uaPaz.Gbcbcavavbobfb.bj.E.7.E.7.7.E.7#L.j#g#g#gaj#g.jajaf.E.n#s#s#D.E#D#s#s#D.s#Db.aW#sbf.Nbo.C.Wav.Cam#Mblaw#x#Iaoaqaoaqavavaoav.s.Nb.#D#s.7.E#L#Laj#g#Lbpa2asas.jaUaU#ga2bpa2#g.jbpa2", -"#ga2#g#g#ga2#g#ga2#g#g#ga2#g#Lbpa2#L#L#L#L#La9.Ea9a9#saY#I.C.Wam#x#U#x#IaY.N#D#Daj#Laj.7.7a9.7.7a9#Laf#L#L#L.n#Lafafafajafaf#Laj#L#L#Laj#Laf#Laf.jaf#Laf#Laja9#Da9.na9#Da9.n#D#DawaYawawaYaY#MaY.7.n.7.n.7.Ea9.7ajaf.Ea9#s#D#D#D#Ibn#UaCaoao.8#vao.d.d.y.z.y#1bbagaX#3aAbx.caLav#7#I.s#7b.#sb.b..sbo#Iav#QaOaKbtau.GaZaFaq#Ibf.s.7.n#L.E#L.7aja3.Ebp.jbpbpajbpa3#s#D#s#s#s#s#D#sa9.n#D#s#D#s#D#s#x#Iaw#I.N#s#s#D#saY#saYaY#I#I#I#I#U.W#IaC.8ao.C#sa9#L.7.n#L#L#L.ja2.j#gasasas.jas#g.jas#gas#gas", -"a2#ga2#ga2#g#ga2#ga2a2bp#ga2bp#Lbpa2#L#Laja9.7#La9#D#D.N#x#x.C.CbnbnbnaYaY#D#D#D#L#La9aja9.7.E#D.nafajaf.Eafafaj#Lajaf#Lafajafaf#Lafajaf#L#Laj#L#La2afaj#La9a9.na9bja9.na9#D.na9awblaYawaYawaYawa9.na9.Ea9a9.na9ajaj#L.n#D#s#s.N#U#Ibn.WamaO.8#v#OaObdbd.yaLbb.Q#8.v#3aV.abCbd.8#7#7.sb..sb..sbj#s.s.s#I.Cav.8.8#u#uaB.ybcao.Wbf#D#s#D.7.E.7.Ea3ajbpajbpajbp#L.E#s#D#s#D#s#D#s#D.n.7#s#D#s#D.s.N#x#I.NaY.s.N#s#D#s#D#M.N.s#I#x#I#x#I#x#IaCbd.8ao#s#D#s#L.7aj#L#L.j#gas#g#g.j#gas.jas#gas#g.j#g#g", -"#g#La2#ga2#ga2bpa2bpa2#L#L#L#g#La2aj#L#L.7.7a9.7.n#D#saY.s.N#x#I#x#xawaY#Ibl.N.Naf.E#La9.7#sa9#D.n#Laf#Laf#La9afaf#Lajaf#Lafaj#Laj#L#L#Lajaf#Laf.j#Laf#Laf#La9a9a9a9.n#Da9.na9#D#D#s.N#s#D#s.N#s#D.Ea9a9.Ea9.7.na9.na9#s#D.s.N#x#Ibnbn.Waobg.8.8.d.d#vbd#v.z#1bb.QaX#3aA.kaXbcao#7.s.sb.b.b.b.#s#s#D.s.N.s#x.CavaFam#v.y#u.ybyby#Ibf.s.Nb..7.E#L.7.E#L.7.E.7.E.7#s#s#D#s#D#s#D#s#D#s#D#s#D.s.N.s#x#IaYbo.s#D#saW.n.7#s#D#s.N.s.s#I#I#I.CaCax#vaO.saw#s#D.n#Lafaja2a2.j#gas#g#g#g#g#g.j#g#gas#g.j", -"#ga2#ga2#g#L#ga2#ga2#g#L#g#L#L#L#g#L#L#L#L.n#L.7#D#D#D#DaYaY.N.NawaY#xaY#x.NaY#Ma9.7a9.Ea9#D#Da9a9af.7af.Eafaj#Lajafafafaj#Lafaf#Lafaj#Laf#Laj#La2af.j#Laf#La9.7a9.7a9.7a9#Da9a9#s#Dbl.saY#saY#s#D#s#D.na9.Ea9.7a9.n#D#s.N.s#xbobna0aCa0am.8aOaO.8#vbd#vbd.yaL#1.Qbk.Obi#R#8#v.rbo.saE#sb.#sbjb..7.E.n.E#s.s#I#xbo.Wavbc.y#u.yanaoaq.Cbo.N#D.E.7.E.7#L.E.7.E.7#s#D#s#D#s#D#s#D#D#s#s#s.N#s.Naw.N#x#xaw.N#s#D#sbj.n.7.E#DaE#saYboaCaCaoaoaoao#Oao#Iawaw#s#D.n.7a9aj#g#L#g.j#ga2#g.jas#gas.j#gasas", -"a2bp.jbpa2#ga2bpa2bpa2#L#Lbp#L#L#La2#L.7#L.7a9.7#s#D#D#D#D#s.NaYaYaY.s#x.s#xaYaY#D#s#D#D#D#s#D#sa9ajaf#Laf#La9af#Lajaf#Lafajafaj#L#Lafaj#L#L#L#L#L.jafa2#Laja9a9.na9a9.na9.na9#s#D#D#s#D#s#D#s#D#sa9#sa9#Da9.n#D#s#D#D.saY#xaY#IamaCamaobgaObcbdaOax#vbd#v#v.yaL#1.Qa5#3#R.vbc.W#7#s.sb.b.bjb.bj.E.7.Ea9bj#s#Daw#s.Nbo.C.8#van#ubc#v.8a0bf.s#D#sbj.7bj.7#D.7#sbjawaY#saY#s#D#s#Daw#DaY.saY.NaY.saY.saY.N.s#D#s#D.Ea9#s#s.N.sboawao.8.d.daoaC#I#x.sawbo#M#D#Daj.7#L#L.jbpa2bpa2#g#g#g.j#gas#gas#g", -"#ga2#ga2#g#L#g.ja2#g.jbpa2aj#Lbpaj#L#Laj#Laf.7af#D#D#s#D#D#D#D#D.N.saYaY#xaY#x#IaY.N#D#D#s#D#Da9#L.na9.na9ajafajaf#Lafajaf#Laf#Lafaj#L#Lajaf#L#La2a2a2#Laf#La9a9.7a9.7#Da9bja9a9.7#sa9#D#s#D#s#D#s#D#D#s#D#s#D#sa9#s.NawaY#I.C.WaF.8b#ao.8bg#vbd.8#vbd#vbd#v.d#v#1#1.wagbi#8ao#O.saE.sb.#sb.#s.Eaf.Ea9.E.n#D#s#Db.#s.N#Iaqambca#aB.y#vaO#I.Cbf#I#s#Db.#Db.#Dbj#saYawaw#D.saY#M.N#M.N#saY.s#x.s#x.s#x.s.N#s#Db.#D#Db..N.s.N#Ibo.W.CaoaxaoaxaCaC#I#x#I#I#Iaw#s#D.n#Laj#L#Lbp#L#L#L.j#ga2#g.ja2.j#g", -"#L#g#L#g.j#ga2bp#g#L#g#L#Lbp#L#L#La2.7#L.7.Ea9.EaY#D#D#s#D#s#D#saYbl.NawaY#UbnbnawaYawbl#D#p.na9afa9.n#La9#La9#Lajaf#Lafajafajaf#L#Laf#L#L#La2.ja2#La2#L#Laf.7a9a9a9a9.na9.na9a9.7a9#s#D.n#D#s#D#s.N#sbj#D#D#s#DblaYaw#x#I.CaCamaOaF.8.8aO#vbdaO#v.d#vaO.8aObd#v.zaBa5.O#r.Q#O.Wbo.s.sb.aEbjb.bjb.a9.E.7.n#s#D#s#D#D.s.N#Ibf.W.C#v#va#aOaF.8aoam.s#D#s#D#s#D#s.saYawaYaYawblaYaw#DaYaYaYbl.N#x#xaY.saY.N#s.N#saWawaY#I#x#I#x#IaC.C.WamaCaC.W#I#I#I#x#I#I#I.s#sa9.E#L.E#Laja2bpa2a2.j#ga2#ga2#ga2", -"aj#g.ja2#g#L#ga2#ga2#ga2bpa2#L#L#Lajaf.Eaf.7a9.7aY#s#D#D#D#Da9a9.saY.saYbn#x#xa0#I#x.NaY#M#Da9.na9aja9a9.nafajafafafajaf#Laf#Lafaj#Lajafaja2#L#La2.3#L.jaf#L.na9.7.n.7a9bja9#D.n.7#sa9.n#D#s#D#s#D#s#D#D#s#D#s#DawaY#Ibn#Ia0aoa0#v#vaOaFaObd#vax.ybc.d.8.8.8.8bd.y#1a5aX.v#1ao.W#7.saE.s#sb.#Db.#s.7.E#D#s#D#sa9#s#D#s#D#s#D.s.saFaFamaO.y#v#v.5#I#Iawbf.s#x.s#xawaYawaYblaw#DblaY#Mbl#saYaw#x#I#x.Naw.N#sbj#s#D#I.WaC.WaC.Wamao.8aoao.W#IaY.NaY.N.N.s#D.saw#s#D.n.Ea9aj#Laj#Laj#ga2#gas.j#g.j#g", -"a2#ga2#ga2aj#L#L.ja2a2aj#L.E#Laj#pa9a9#pa9.n#pa9#M#Dbl#Dbl#MaYaYaYawaYaYawaY#UaYa0.p.VbnaYawa9#La9a9ajaf#L#Lafaj#L#L#Laj#Laj#L#Laf#L#L#L#L#La2#La2a2#La2#La2#L#L#L#L#L.Ea9.7#s#D#La9.E#D.na9.na9.n#s#D#saw.Naw#xaw#I#x#I#U.CaCaoao.VaoaoaO.8aO.8#Oaoaxao.haC#Oao.daO#uagbibk#vav.W#I#s.E.Eaj.Ea3aj.n#L.E.7.nb.#s.N.saY.N#I.N#IaY#I#I.C.8#v.yaBaPaBa#aFa#.5aqaqaN#xbfbf.N.NaY.Naw.NaYaY.Naw.NbfaYawaYaYaw#x#I#xa1#U#I#U#I#x#I.N.s#D#s#D#Dbj#sbj.E.7.Ea9.7.7#L.7.7.7.7.E.7#L.7#Lbpa2.jas#g#gas#gas", -"a2.ja2#L.j#L#La2a2#g#L#Laf#L.7#La9#pa9a9#pa9#pa9bl#Dbl#sbl.NblawblaYblaY#xaYaY#Ubna0b##UbnaY.n.7#s#Da9.na9.n#Laf#Lajaf#Laf#Lafaj#Lajafaj#L#L#L.j#L.j#La2af#La9a9#L.7#L#La9.7a9#Da9.Ea9.n.7.n.7#s.na9#M#Daw#x.s#xawbn#I#U.CaCaCaCaobgaCaoaOaOax#vao.hao.W.W.Wav.haoax.y#E#zagapbc.Wbo.s#s.E.Ea3.E.7aja9.Ea9b.a9.EaY.Naw.Naw.Naw.N#I#x#Ia0amaF.yaBa7#u.ya#aoaqavaq#x.C#x#I.Naw.NaYaw#x#I#I#x.s#xboaYaY#I#x#I#x#IbfblaYbl.NaY#D.N.N#Dbj#sbj.Ebj.7bja9#L.E#Laj#Laj#L.E#L#L.7aj#La3ajas#g.jas.j#g.j#g", -"a2#gas.ja2#L#Laja2#Laj#L#L#La9.7.na9a9#Da9#Da9a9#s#D#D#s#D#s#D#Dbl#sbl#D#M#DaYaYaY#Ubga0bnaY#s#D#s#Da9a9.na9ajafaj#Laj#Laj#L#Laf#L#L#Laf#L.j#L#La2a2#La2#Lafa9a9ajafaja9a9#s#D#s#Da9.n#D#sbl#s#D#M#s#D#Maw.N#I#I#I#I#x#I#IaC.CaC.paCaCaoao#O.8ao.h.W.W.W.W.W.W.W#I#Q#v.w.Obiagbk.W.r#I#sb..E.E.Eaja9.E.n.7.n#D.saY.saY.Naw.NaY.Naw.N.s#xaCaq.8aF#Sa7a7#u.yaFam.5ao.Ca0.C#x#x#x#Ibn.R#x#x#xaY#xaY#Ibn#UaC.W#xbf.sbl#s#D#sa9.Ea9.7.E.7.7#L#L#Laj#Laj#L#L#L#L#L#L#Lbpajbp#Lbpbp#Lbp#g#gas#g#gas#gas", -"a2.ja2#La2aja2#L#L#Laf#L.Ea9aja9a9a9a9.na9a9.na9#D.n#Da9#Da9a9.na9a9#sa9#D#D#D#saY#xaCa0#U#x.N#s#D#D.na9a9.n#La9#L.n#Laf#Laf#Lajafaj#Laj#Laf#L#Lafajafafaj#L.Ea9#La9a9.n#D#D#D#D#D#s.Nbl#D#s.N#M#D#M#D.saYawaw#IaY#I#U#I#x#IaC.WaC.CaC#IaCavao.W.Wav.W.Wbo#I.W.Wbo.W#Q.y.w.Uau#3bd.8bo.s#s#sbjb.a9.E.n.7b.#sbj#s.Naw.Naw.NaY.saY#s#s#D#I#x#Ia0aoaFa#aBaBaBa##va#aoa0aoa0aoa0aC.Ca0#xaCbn#I#xaw#xa0aCa0#x.Caw.N.Na9a9a9a9.7a9.Ebj#L#Laj#L.E#L.7#L#L#Laj#L#Laj#Lajbp#L#Lbpajbpaj#Las.j#g.jas#g.j#g", -"a2a2a2.ja2#Laf#Lajaf#Laja9a9.7a9a9.na9a9a9a9a9a9.7a9.7.n.7.7a9.7.7#L.7a9#s#D#D#D#D#Mbnbn#x#xaY.N.s#D#D#sa9a9#Laj#L#L#Laj#Laj#L#L#Laf#Lafaj#Laj#La2a2afajafafa9a9a9.na9#Da9#s#D#D#MaYblawaYawaYbl.s.Naw#D.saYawawawaw.s#I#I.C.W.W#U#I#I#x.WaC.W.W.W#I#Ibo#xbo#I#Ibo.Wavbc.y#u.G#3.Qbc.Wbfaw.s#sbj.n.7.n.7#s#D.s#D.saY.NaY.N#M.NaYb.#D#s#Daw#Ia0#UaFaOamam.5.8.yaB.8aO.5ao.5amam.8amaCa0a0#x.C#I#Iaoam#I#xaY#D.N#Da9.7.7.7a9.7.7.7aj#L#L#L#L#Lajbp#Lbp#L#Laj#L#L#L#Lajbpaj#L#Lbp#L.j#gas#gas#gas#g", -"a2a2.j#La2#L#L#Laf#Lafa9a9a9#D#D.7#Laf#L#Lajafaj.7aj#L#L#L#Laj.7aj#Laj#Lbj.7.7b.a9#D#D#xaCa0.W.NaYaw#D#Da9.na9af#Lafajaf#Laf#Lafaj#Laj#L#L#Laf#L.3ajaf#La9aj.7a9a9a9a9a9bl#DblaY#DaY.NawaYblawaY.NaYaw.sbl#s#Maw.N.saw#x#I#I#I.C#I#x#I#I.W#Ibo#Ibo.Wbf#Ibo#Ibfbo#Ibo.W.8#Qbc.ybkbv.Q.8#I.s.s#s#sb..nbj#s.N#sbj#saY.Naw.saY.NaY.s#D#s.Nbo.N#I#I#xaCamao.Ca0b#aobyaOaF#v#vaB.y.ya#aOaF.5aCa0aC.CaCbn#xaY#D#D#D.7#D#Laj#L#Laj#L.7#L#Laj#L#Lajbp#Laj#L#gaja2bpa2bp#g.jas#gas#gas.j#gas#g#g#g.j#g.j#g", -"a2.ja2#L.j#Lajafajafa9a9a9#Da9.n#L#L.7#L#L#L.7#Laf#L#L#Laf#Laf#L#L#L#Laj#Laj.7.7#L.n#DaY#x.W.C.C.s.NaY#s#D#Da9#s#Laj#L#Laj#Laj#Laf#Laf#Lajafaj#Laja2afajafafa9.na9#pa9#M#Dbl#DaYaYaYawaY#xaYaYaYaw.Naw#D#sbl#s#M#s#saY.s.s#x#I#I#Iawawawbo.N.s#I.s.s.sbo.N.s.s#I#I#x#Ia1.Wao#vaLbkap.yaobo.N.N.s.7#s#sbj#s#D.sbjaY.saY.Nbl.saY.N.s.N.s.N.N#I#x.sbfbf.C.WaCaqamaq.5aoa##v.0#u#u#ua##vaOaFama0#x#xaYaY#D#Da9.7#L.Eaf#Lafaj#Lbpbp#Lbpa2bp.jbpa2#L#ga2aj#g#L.jbp.j#L#g#g.j#g.j#gas#g.j#g.jas#gas#gas", -"a2#L.ja2a2#L#L#Lafafa9.na9a9a9#D.7#L#Laj.7#L#L#L#L#Laj#L#Laj#Lajbpaj#Lbp#L.7.7bj#L.7#DaY#xa0.C.WaYaw.N#D#D#D#sa9aj#L.Eafajaf#Laf#Laj#Laj#L#L#L#L.3#L#Laf.7#La9a9a9a9#p#Dblbl.NblawaYaYaYaYawaYawaY.NaY.sbl#sa9.n#D#D#saw.s#I#I#xaw#x.saY.s.s.N.s.N.s.Naw#D.s.N.sbn#I#Iboa1#b.d.8#Tap.Qbcbo#D#sbo.nb.#D#s.Nb.#D.s.Naw.Naw.NaY.Naw.Nbf.s.N.sbfaY.N.saY.sbf.C.Waqavbga#a#a#.yaZ.0anaBbm#vaOaobn#I#xblaY#Ma9a9af#La2#L#L#Lbp#Lbpaj#L#g.ja2bpa2aj#gaja2#g#L#g#L#g#L#g.j#gas#gas#g.j#gas#gas.j#g#g.j#g", -"as.j#g#La2aj#Laja9ajaf#L#L.n#Laf#Laj#L#L#La2#ga2#ga2a2a2#ga2a2#g#L#Lbpaj#Laj#Laj#D.s#DblaY.VaObm.C#IaYaw#D#s#D#Dbl#Ma9a9af.7aj#Lajaf#Laf#Lajafaj#Lajafaj#Laj#L#Lajafa9a9.7#sa9#DaYaYaYaYaY#xaY#x.N#s#D#s#D#s#Db..n#sbj.n#D.sbfbo.s.s.N.s.N.s.s.N#s#D#s#D.s.N#Ibf.s#Ibo#I.Wav.8bcbta5.U#3aB.5.W.N#x#I#x.saY.s.N.N.s#D#Ma9b..E.7.nbfaw.NaY#xaY#Ibf#D#s.N.N#x.Waqavb#ambga#aO.0.y.yaoaCa0#x#xaY.N#D.Ebj.7.7.7.7.7.7#ga2#ga2#ga2#g#ga2#ga2aj#g#g#L#g#g#L.jbp#Lajbp#L#g.jas.jas#gas.j#ga2#ga2#g.jas#g", -".ja2#Laj#L#L.7.7af#Lafajaf#Laf#Lbpa2#La2#L#L#Lbp.ja2#g#ga2#ga2#g#L#L#L#L#L#L#L#L.7#D.NaYaYaobmaZamaCbn#x.NaY.N.N#Mbla9.nafajaf.7a9#Laj#Lajaf#L#Laf#L#L#Laf#Lafaja9af.7.n#Da9bja9#xawaYaYawaYaYaw#Dbl#s#D#D#s.7.n.7b..nbj#sbj.s.saw.s#D#saw#D.s#D#s#s.s.N.sbfawbf#Ibf.sbo#Iav.8bc#uaz#3bi.G#vaq.W#I#x#I#x#x#x.s#DaY#s#D#s#D#s#Db.aY.saY.N#I#I#x#x#I#x#I.C.WaqamamaFaObm#vaBaZ#va#bna0#xaYaw#D#D#Dbj.7.7.7.7.7.7.7#g.ja2#g.j#ga2bpa2a2a2#g#La2#L#g.j#g#gajbpbp#Lbp.j#gas#g#g.j#gas#g.j#g.ja2a2#ga2", -"#L#L#L#L#L.na9.n#Lafajaf#L#L.ja2#L#Lbp#Laj#g#L#L#gbp.j#L#gaj#ga2aj#g#Lbpajbp#Laj.7#D#sblaYb#aOa7b#amaoa0aC#x.baYbl#Mbla9#D#L.na9aj#Laf#L#Laj#Laj#Lajafaj#L#Laj#Lafajaf.7a9a9#Da9#Dblblblblblblbl#D#s#D#D.n.7.E.7.E.7.7.E#s#s#D.s.N.s#Db.#D#s#D#sbj#s#D#s.N.sbfboaYbo#Ibf.Wavbcbc.wa5au.M#3.w#v.5#Ibn#I#IaY.s.N.N#saY#s#D.s#D.s.NawaYawaY#I.C#Ibn.Wa0amamao.5.8.5#uanaB.ya#aoama0awaYaY.NaY#D#D#D#L#L#Lbp#L#L#L#Laj#gbpa2bpa2.j#g.j#L.j#L.jbp#g#Las#ga2#ga2aj#L#L#g.j#g.j#ga2#g.ja2#ga2#g#Laj#Laj", -"#D.na9#sa9#Da9#Daj#L#L#Lajaf#L#L#g.ja2#g#g#g.j#ga2a2#g#ga2#ga2bp#ga2#ga2#ga2#g#g#Lb.a9aY#UambmaZaO.t#SaFb#a0a0#UblaY#s#D.na9.7.n.7aj#Lajaf#Laf#Laf#L#Lafaj#Laf#L#Laf.7af.7.n.7#D#M#D#D#D#D#D#D#s#D#Da9#sa9.Ea9aj.7.E.E.7.7b.#sbj.s#s#D#s.N#saW#s.N#s.Nb..N.Nbo.N#xbo#x#I.Wav.8.yaz#T#3#z#z.O#uaF.CaC.C#x#I.Naw#D.sbl.saY.s.Nbo#Ibn#U#x#Ua0#Ua0aCb#am.8a##va#aBan#u#u.0aFama0#xaY.NaY#D#s#D.7.7.7#Lbpaj#Lbpajbp#Lbp#L#L#L#Lbp#L#L#L#L#Lbp#L#Lajbpas.ja2.j#ga2bp#Laja2#L#La2aja2#L#L#L#Laj#L#Laj#L", -"a9a9a9a9a9.na9a9#Lafajaf#L#La2a2aj#g#ga2#L#g#L#g.j#g#g.j#g#g.j#ga2#gaj#ga2#ga2#g#L#L#L#s#xb#aOa#.t#SaZaBbmbga0bnawaYblbl#Da9.n.7#Laf#L#Laj#Laj#L#Lajaf#L#L#Laj#Lajafajaf#La9a9a9#D#D.na9a9.na9a9a9.na9.7a9.E#L.Eafaj.7.E.7.nbj#s#Db.#Dbj#sbj#sbj#sbj#D#s.N.s.N#x.W#xbo#xavambcbb.O.O#a#a.Oba#3aBamaoa0.W#x.s.N#saY#saY#I#x#I#x#IaCa0aoamaob#aoamaF#v#vaB.0aB.0#ua#a#.5ao#xaY.Nbl#sbl#Da9.7.n.7.7aj#L#L#L#L#La2#Laj#Laj#L#g#L#L#Laj#Laj#L#L#Lbp#L.j#g#L#L#Laj.7#L#Laj#Laj#Laj#Laj.7aja9#La9aja9a9", -"#Da9#s#L.n#L#L#Laj#L#L#g#L.jbpa2#ga2#g.j#gas#gas#g#g#g#g.j#g#gas.j#g#g#g#g.jas#g#gaj#L#D#xaOaZan.FbmaBaZbmaFb##UaYblawaY#s#Da9.7.n#Laj#Laf#Lafajaf#L#Lajafajaf#L.3#Laf#La9aj.7a9#Ma9a9#Da9#Da9#Da9#D#La9aj.7aj#L.E#Laj.7.Ebj.nb.#s#D#sbj#s.N#s#D.s#D#sbj.N.sbf.s.C.Wa0.Wam.8.ybb#a.O.GaPaz.M#C.faOaoaq.W#xaw#D.s#D#I.N#I#xaCamaoaFaO#vaO#S.y#S#v#v#S#va#aOaFaOaFamaoa0#xaY#D#sa9#D#Da9.7.7#L#L#La2#L#g#L#g#Lajbp#L#Lbp#Laj#Laj#L#Laf#L#Laj#Lajbp#L#Laj#L.n.7a9#sa9.n.7.nbj.nbj.na9a9a9.na9#Da9a9", -".7#L#L#L#L#Laja2#L.jbp.j#L#g#L.j#g#g#gasas.jas#g.jas.jasasas.jas#gas.jasas#gas#gasbp#L.7awam.yan.Fbm.TaZaBaFam.R#IaYawbl.N#s#D#D#Lajaf#Laj#L#L#L#Lajaf#L#L#L#Laj#L.jafajafafafaja9#Da9a9a9a9a9.n#Lajaf.E#L#Laj.7.j#Laj#L.E.7.E#D#saW#D#sbj#sbj#Db.#DaE#D.sbf#IbfaCaq.Waoao#v.y.wbkaz.w.waz#3biau#uaOamao#xboaw.N.s#x#I#xaCambgbg#uaBa7#ua7an#ubh#vaFaOama0aCa0a0a0bn#UaY#sa9af#L#sa9.7a9aj#Lbpaj#g#L.j#gaj#g#L#Laj#Laj#L#L#Lbp#L.E#L.E#L#L#L.7#L.n.7a9#D#D.N.s.Na9#s#Da9#sa9#D.n#D#D#s#D#D#s#D.7", -"aj.7aj#gaj#gas.ja2bpa2#L#gaja2bpas.jas#gas#g.jasasasasas.jasaU.j#gas#gas#gas#gas#g.ja2#LaYa0.0aZ.Fa#aBaZa#aFbn#UaYaY.N#MaY#D#D#Daj#L#Laf#Lafajafajaf#L#Lajafaj#L.3#La2af#L.Eaf.7a9a9.n.7a9.n.7a9af#Laf#Lafaj#L#L.j#g.E#L.E.7#s.Ebj#s#sbj#D.s#Db..N#s#D.s.sbf.s#Iaqa0ao.C.8#vbbaPbk#u.w.Q.w.wau#N.Q.yavam#I#x.sawaY#I#IaCaoaoaO#vaz.Gaz.GazaS#uanaoaCa0.Wa0.CaC.CawaY#Da9a9#La9aja9a9.7aj#L#L#Lbpaja2bpa2bpa2#Laj#L#L#L#L#Laj#Laj#La9#L.7.7.E.7.E#D#D.N.s.N.s.N#x.7.7.n.7a9#sa9#D#s#D#D#D#D.7#D#D", -"#g#g.j#g#g#g.j#g#g.j#g.j#g#g#g.j#g#gas#gas#gas#g.jasasasas#gasasas#gas.jas#g.jas#g#g#ga2a9.C#SbhaFbgamam.8amaCa0aYaYaY#Da9.E#Laja9#Laj#Laj#L#L#L#L#Lajaf#L#Laf#Laja2ajaf#Lafa9a9.na9a9a9a9.7a9a9af.n#Lajaf.7#L.E#Lbpaj#g.n.7#s.N.s#DaY.saY.Naw#x.saYbo#x#x#I#x#I.8amaob##v#u.G.2bkaz#ubbaP.w.G.2.u.Oa#aoav#Ibfboawbo#xaoamaBan.Gba#a#ua#ao.5#Qaq.W#x#x#x#I#x#xaY#xawaYbl#D#M#Da9a9a9a9a9.7a9a9a9#L#Lajaf#Lajaf#La9.n#D#saY.NaYaY.N#sbl#D#MaY#M#D#D.n#Da9#D#D#D.n#Laj#L#L.E#Laj#L.7aj#Laj#Laj#Laj", -"#g.j#gas.j#gas.j#ga2a2#ga2.jas#gas.j#g.jas#g.jas#g#g.j#gas#gas#g.jas#gas#gasas#g#g#La2.j.7bnaF#ub#b#amb#ama0bn.CaY#M.N#sa9.na9#Lajaf#Laf#Lafajafaj#Laf#Laj#Laj#La2afafaj#L#La9.7a9.7a9.7a9a9a9.7afafafa9#L.n#L.7ajaja2.j.7.E#D.N#Daw.Naw.N#I#x#x#I#x#I#x#IaC.CaC.5bg.8aO.0.w#T.2.G#u.ybbbb#u.GaX.e#z#SaoaC.s.W.W#I#Iaoam#v#u.G#TarazbmaoamavaN.C#x#xawaY#x#IaY.saY#Daw#D#Da9a9a9#sa9.na9a9.na9.na9a9a9#sa9#Da9#sa9a9a9#D#Mbl.NawblblaY#MaYaYaYaw#D#D#s#D#D.n#D#D.n#La9ajaf#Laf#Laj#L#L#L#L#L#L#L", -"#g#g#g#gas#g#g#ga2.j#g.j#gas#g.j#g#gasas#g.jas#g.jas#gas.jas#gasas#gas#gas#g#gasa2aj#g#La9aYa0bmbgambgama0.C#x#xawaY.N#Da9.7#L#Laf#Laj#Laj#Laf#L#Lafaj#Laf#Laf#Laja2#Lafaf#L.na9.na9a9a9.Ea9a9.7ajafajaf#L.7#L.7bp.Ebp.Eaj.7#s.Naw.Naw.Naw#x#I.N#I#x#I.C.Wa0aoamao.5ao#vaBazal#3aB#vaF.y.yaB#u.wa6#z.w.8.C.Wam.CaoamaO#v#uaz.G.GaBaFama0#xawbfa1aY.NaY.NaYaY.NaY.N#D#D#D#Da9a9a9a9.7#D.n#D.7a9a9#D#s#D#D#D#s#D#Da9.na9a9#D#Daw.N#D#s#D#D#D#s#D#D.7.7.7.7.E.7.7.7#L#Laj#L#Laj#L#L#Laj#Lajbpaj#Lbp", -"as.jas.j#g.jas.ja2#ga2as#g.j#gas.j#g#g.jas#g#gas#g.j#g#gas#gas#gas.j#gas.jasas.j#ga2#gaj#LaY#Uamb#ama0a0aCbn#Ibn.Nblaw#Da9aja9aj#Laj#L#Laf#L#Lafaj#L#Laj#L#Laj#L.3aj.3#L#L#La9.7a9a9.7a9a9.7a9a9afa9#La9aj#L.n#L.E.7aj#L.E#D.sbfaw#M.NaY.s#x#IaY.C.W.C.W.Caqaqao.5aoaF#v#uaz#T.o#vaO.8.8bcbcaB#ualbaa5#vaoa0avaoaF#vbm#uaz#u#uaZa0am#x#M.N.N.N.N#D.Naw.N#s#D#D#D#D#sa9#Da9.n#L#L.na9a9.7a9a9.7#s#D#D#Da9#Da9#D#s#Laf.7a9.n#Da9a9#L.7#L.7aj.7#L#Laj#Laj#L#L#Laj#L.j#L#La2#La2#La2ajbp#Lbpa2#L#ga2", -"#g#g#g#gas#g#gas.j#g.j#g#gas#ga2#gas.j#g#g.jas.j#gas#g.jas#gas#gas#gas#gas#gas#gaa.j#g#L#LbjaY#Ua0aCa0a0#xbn#xawbl.N#D#Da9.7#L#Laf#Lafaj#Laj#L#Laf#Laf#Lafajaf#L#La2#Lajaf#La9a9.n.7a9a9a9a9a9#Lafafajafaf.7#L.7#L.7#Laja9#saY#IaY.saY.saY#I#x.s.C#xaC#x.Caoaqamao.8a##v#u.Ga5azaOaOaoao.8#v.ya5ba#z.w#vao.Wam#vaB#uaB#uaZa#aF.5#xawaYbla9.E#D#sa9#sa9#D.7.7a9#s.7a9.7.7#L#L#L#L#L#Lajaf#L#Lajafa9.7.na9a9.7a9a9.7aj#L.7#L.E#Lajafajaf#Laf#Lajaf#L#L#L#Laj#L#L#L#La2aj#gaj#gaj#g#La2.jbp.jbp.jbp", -"as.jas#g.jas.j#ga2as#gas.j#g.j#g.j#gas#ga2#g#gas#g.jas#gas#gas.j#gas#gas#gas#gas#g#ga2bp#L.na9bla0bnbn#UaYawaYaYaYbl#Da9.n.7afaj#Laj#L#L#L#Lafaj#Laj#Laj#L#L#L#L.ja2a2a2af#L.n.7a9a9a9a9.7.n.7a9afaf#Lafaj.7af.E#Laj#L.Ea9aw#x#IaY.saY.NawbfaY#x#I#x#I.C#I.C.Wa0.8am#v.0#u.G.w#uaO#v.8#Q.8bdbb.Q.K#z#u#vaFaoaBa7a7#u#SaFaoamaCbnaYaY#Da9aja9a9bj.7a9.7a9.Ea9.7.7af.7#L#Laj#L#La2ajafaf#L#Lafafafaj#Laf#Lajaf#L#La9#L#Laj#La2a2a2#ga2.j#g.ja2a2#gaj#gaj#g#La2bp.j#g.j#ga2#ga2#g#g#g.j#g#g#ga2a2#g", -"#g#g#g.jas#g#gas.j#g.jas#gas#ga2as.j#g.j#g.jas#ga2#g#g.jas#gasasas.jas#g.jas#g.jasaa#g#Lbp.7afajbn.RaYaYaYaYaYaYbl.N#D#D.7#L#L#Laf#Lafaj#L#L#L#Laf#Laf#L#La2#L.3#La2#L#L#Lafa9a9.n.7a9.7a9a9a9.7afaf#Laf#La9aj.7.7.7aja9#saw#x#I.N#saY#I.NaY.s#I#x#I#x#I#xaC.CaoamaO.yaB.waz#uaZ.8bc.8.8#Q.y.Q.w#4#4.wa##vaB.Qaz#vaFama0#x#x.N.s.N#D#sa9.7a9.E#D.E#L.7aj.7#Laja9aj.7#L#L#La2.ja2af#Lajafajafaj#Lafafajaf#Lafajaf#L#L#La2a2.j#ga2.jas#gas#g.jas#gasa2#g.j#g.j#g#g#g#g#g.j#g.jas.ja2#gas.ja2.j#g#g", -"as.jas#g#gas.j#ga2as#g#gas.j#g.j#g#g#ga2a2#g#g.j#g.jas#gas.jas#g#gas#gasas#gasasa2#g.jbp#LajafafaYbnaYaYblaYaY#MaY#D#sa9a9.7#L#L#Laj#L#La2afa2#L#L#Laja2#Laf#L#La2.j#L.3aj#La9.7a9a9a9a9.n.7a9a9afaj#La9aj#L.7#L#D.na9#s.naw#x#Ibl.Naw.Naw.NaY#xawaYaw#x#I#xaC#I.8aO.yan.w.G.w#vb#by.8.8bc.ybb.Qay.Y.G#u#1a5.GaBamamaobn.s#Da9.7aY#Da9.7a9.7.7#Da9aj.7af.7af.7#L.7afaj#La2a2a2.j#Laf#Laf#Laf#Laf#La2#La2#La2a2a2.7.j#La2#gaa.jasas#gas.jasasas.j#g.j#gas#gas#gas.jas.j#gas#g#gas#ga2.j#ga2#ga2a2", -"a2#ga2.jas#gasas#gas.j#g#g#gas#g.ja2a2a2.ja2a2#ga2#ga2.jas#gas#gas#gas.j#gas#gas#g.j#ga2bp#L#Laj#L.naY.R#xaYaY#D#Dbl#D.7#saf.7.n#L#L#L#L#Laj#L#Laja9#La9aj#L#L#La2a2a2.j#L#Lajafa9#sa9.7a9a9a9.E#Lafafajafa9.na9aj.na9#s#D.N#IaY#s.sbl.s#D#s#D#s.N#I#x.W.Cavam.5.8aF.0azal#T.w.0.8#v.8byaKbbaIaP#aba#N.O.GazaB.5#xaw.N.NaY#D#D#s.7.n.7#L#La9.7a9#L.7af.E#L.E#L#L#L#L#La2#La2bpa2#L#Laj#La2#L#Laja2aja2#ga2.jbpa2as#gas#gas#gas#g.j#g.j#g#g.j#gas#ga2.j#g.j#g.j#g#ga2#g#ga2.j#ga2a2#g#ga2#g.j#g#g", -"#g.j#g#g#g.j#gas.j#g#gas.j#g.j#ga2a2#ga2#g.ja2a2#g.jas#g#gas#gasas.j#gas#gas.j#gasasas#g.j#g#Lbp#La9#Dbl.RaYaY#D#D#Da9#D.7a9.7#L#L#Lbp#L#Lbp#L#L#L#L#L#g#La2a2#Las.ja2a2#Laf#L.7a9.7.na9a9.7a9a9af#L#La9#Lafaja9.na9.n#D.s.s#x#I.Nbl.s#D#M#DaY.saY#I#xaC.Caqao.5bgaO#uaz.G.G#u.y#x.W.8#v#v.y.0.ybabaay.f#uaB.8a0bfaYaY.N.N#D#D#Da9.7.7af.7.7af.E.7aj.7#La9#L.n#L#L.jaf#L#gaja2#L#La2#Lafaj#La2#L#g#g#L#g#L#ga2#g#gas#gas.jas#gasasas#gas#gas#g#g.j#g#gas#ga2as#g#ga2#g#L#gbpa2bp.j#L#gajbpa2bpa2", -"a2a2#g.jas#gas#g#gas.j#g#gas#g#g.ja2a2.ja2a2a2.jas#gas#gas#g.jas#gasas#gas#gasas#g#g#ga2#g#L#La2#La9a9#DaYbl#Dbl#Da9#Da9a9.7#L#La2#g.j#g#ga2#ga2.j#ga2.j#g#g#g#ga2a2#g#La2aj#L#L.n#Da9a9.na9a9.7#Lajafajaf.7a9.naf.na9aE.N#I#Ibn.saY.Naw.NaY.saY#x#I#x.Wa0ao.5.8aoaO#u.G.Gaz#ua##IaCaCaobg#va7azaH#zaz#uaFam#x#xaw.N.N#D#D.n#D.7.E#L#L#Laj#L#L#Laf.7#L#L.E#L#L#L#L#La2#La2#L#gaja2#L#La2#L#L#La2a2#g.j#ga2#g#L.jas#g.jas#gas#gas#g#g.j#gas.j#g.j#ga2.jas.j#g.j#g.j#ga2.j#ga2#g#L#g#gaja2bp.j#L#g", -"a2#g.jas#g#g.jas.j#gasa2#g.j#g.ja2a2#ga2#La2a2#g.jas#gas.jas#gas#gas#gas#gas#gasas.j#ga2#gaj#Lbp.j#La9a9#D#Dbl#Dbl#D.7a9.7.7af.7a2a2a2a2a2a2.ja2bpaj#Lbp#Lbpa2#L.j#g#La2#L.7#L.7a9a9a9.7a9.7a9.n#Lafaf.7afafaja9.na9.n#D#s#I#x#IaY.sawaY.saYaw.N#I#x#I.C.W.5av.5bgaOaB.G.O.G.y.5aO.8bgaFaB.Gau#N#zaz.0aFa0#x.NaY.N.N#D.n#D.7.7a9#L#La9#L.7#L.7#L.E#L#L#L#Laf.7#L#La2#L.jbpa2#La2#La2#Lajafa2#L.j#L#g#L#gaja2#g#g#gasasas#gasasas.jasasas#gas#gasa2.j#g#gas#gas#g#ga2bpa2bpaja2aj#ga2#L#g#La2bpa2", -"a2#ga2#g.jas#g#g#gas.j#ga2a2as#ga2aja2.j#g.j#La2#g#g.j#gas#g.j#g.jas#g.jas#g.jas#gas#ga2#g#La2#L#L#g#La2a9a9#D#D#Da9#Da9.7a9#L.7a2.j#g.ja2aja2#L#L#g#ga2.j#L.j#g#La2#Laj#L#La9.7.na9.na9a9a9a9a9#L#Lajafaja9a9.naf.n#s#s.N#I#x#U#I#x#x#I#x#I#x#I#x#I#x.Wamao.5.8ao#v#u.Garaz#ua#.y.0#u#u#aau#3alaza#b##I#xaw#D#sa9#s.7a9.7a9aj#L#La2aj#L#Laf#La2#L#La9aj.7#L#Laja2#L#g#La2#L#g#Laj#L#La2#L#La2#L#ga2#ga2#g#g#L#gas#g#gas#gasasasas#g#g.jasas.j#g#gas#g.j#g.j#ga2.jbpa2bpa2bpa2bp.jbp.jbp.jbp.jbp", -".j#g.ja2#g.j#ga2.j#ga2.j#g.j#g.ja2#ga2a2a2a2a2#g.j#gas#g.j#gas#gas#gasas#gas#gasa2.j#gaj#g#Lbp#La2#La2#L#La9#Dblbl#Da9bja9#L.7#L#L#Laf#L#L#Laf#Laj#L#L.7#L#L#L#L#L#L#L#L#La9#L.7a9#Da9a9.7a9.Ea9#Lafaf#Lafa9.na9.na9.E#D#s#x#I#I#I#I#x#I#x#I#x#I#x#I#x.WaC.5.8.8.5aBa5#a#TaPaPbk.U#3al#3#T.G.w.0aFaC#x#x.N#D#Dbj#Dbj.7.7aj#L#L#La2#L#La2#La2aj#L.7#L#L#L#L#Laf#Lbp.j#La2bpa2aja2#La2af#L#Laja2#L#g.jbpa2bpa2#g.j#gas.jasas.j#gas#gasasas#g#gas#ga2.jas#ga2#g.j#g#L#gaja2aj#gaja2bpa2#L#L#L#g#La2", -"a2#ga2#ga2a2#g.j#ga2#ga2a2#g#g#g.j#L.j#L.j#La2a2#gas.j#gas#g.jas#g.j#g.j#g.j#gas.j#ga2a2#gaj#L#L.ja2#g.j#g#L#Dbl#Da9a9a9.7a9.7a9a9a9a9a9a9#sa9#Da9a9.na9a9a9#Laf#Laj#L.7a9.E.7a9.n.7.n#Da9a9a9a9#Lajaf.Eaf.na9.naf#Ma9.s.s#I#x#I#x#I#x#I#x#I#x#I#x#I.CaCaq.8am#vaO#u.G.Uay#3#3bv.M#C.O#u.y.5am.C#UaYaYaw.N#D.7.7.7.7aj.7#L#Laj#ga2#ga2a2.ja2a2a2ajaf.7#L.7aj.7#La2a2bpa2aja2bpa2#L#Laja2#La2#L#ga2bpa2.j#g#ga2#gas#gas#gasasas.jas#g.j#gas.j#g.j#ga2a2.ja2a2#gas.j#L#g#L#g#L#gaj#Laj#L.j#La2aj#g", -"#g.j#g.j#g.ja2a2#ga2.j#g.j#g.j#ga2a2a2a2#g.ja2#g.j#gas.j#gas#gas#gas#gas#gas#g#ga2#g.j#L#g#La2bp#La2#gas#g#La9bl#D#Da9bja9.7.n.7a9b.#D#s#D#D#D#s#p.nbl#p.na9a9a9#L.7#L#L#La9.7.7a9#Da9.na9.n.7a9#Laf#Laf#Lafa9.na9.n.E#s.N.s#x#U#I#x#x#I#x#x#I#x#I#xaC.Wa0.8.8.8.yaB#T#4beaM.Y#T.fa7#uaOa0bf.s.N#Mbl#s#D#D.s#DaW.E#L#L#Laj#L#g#ga2a2.ja2a2a2aja2.7#Laj#Laf#L#L#L#L#ga2#L#g#La2#L#La2#L#L#L#La2aj#ga2#g#g#ga2#ga2as#gas#gas#g#gas#gasas.j#g#gas#g#g.ja2#g#g.ja2.j#L#g#L.jbp.j#La2aj#L#Lbpaj#g#L#g", -"a2a2a2#La2a2.j#ga2.ja2a2a2a2#ga2#ga2#ga2a2a2#ga2asaa#ga2#ga2#L.j#La2#L#Lajafa2#L.ja2#ga2#La2#L#L#L#Laf#Laj#L#L#La9bl#Da9blaYaYaYblbl#DaYaYawaYaYblblblblblblbla9#Da9#D#sa9#Da9#D.na9.7a9.7a9a9.n#Laf.Eaf.Eaf.naf.na9#M#D#saY.saw.N#s#s#D#s#s#D#s.C#I#I.C#Iao.5#v#u.OaVadbi#3#1aBbdaO.W.C#IaYbf.N#D#s.7#L#L#Laj#L#Lbp#Lbpbpa2bpa2.j#g#g#Lbp#Lbp#L#L#L.7.7.E#L.7#La2a2a2.ja2#ga2.ja2#L.3a2a2#g#g#g#L#ga2#ga2#g#ga2#ga2#ga2.j#ga2#g#gas#gas#g.jas.ja2#g#L.j#L#g#g#L.ja2a2#L#L#L.7#L#L#L#La2#L#Laj#L", -"a2a2.j#L.j#La2a2a2a2a2a2#ga2a2a2.ja2a2.ja2#ga2a2asa2asa2.j#L#g#La2#L.jaf.3#L#La2aa#ga2a2#L#Laj#Lafaj#L#L#Lbpaj#La9#D#p#Dbl#DaYaYbl#DblaYaw#xaYaYbl#Dbl#Dbl#Dbl#Da9#sa9#D.7#D.7#D.7a9a9a9a9a9.7a9.n#Laf#Laf#La9a9.n#s#D#M#DawaY#I#s#D#s#s#D#s#D#sbf#Ibf#I#Ia0bc.y.G#zad#4aXbk#v.8bgao.C#x.N#x.N.s.7bj#L.7aj#Lbp#Lajbp.j#L#gaj#g#L#gbpa2bp#L#La2#L#L#L#Laf#La9#L#L.j#ga2#ga2a2a2a2a2#La2aj#L#g#L#ga2#g#ga2#ga2#ga2#g#ga2#g#ga2bpa2as.j#g#g.j#ga2#g#L#Laj#Laj#Laj#L#gaja2ajafaj#L.Eafaj#L#Lajaf#L#L", -"a2#La2a2a2.j#ga2.j#L.j#ga2a2#ga2#ga2#ga2#ga2a2asa2.jasa2#ga2#La2#La2#L#L#Laf.j#L.j#L.jafaj#Laf#Lafafaf.7#L#L#Lbpa9#pa9#D#Dbl.sbl#D#MblaYaYaYaYawbl#D#M#Dbl#D#Mblbja9bja9#D.n#Da9.na9.7a9.7a9.na9#Laf.Eaf.Ea9.n.n#D#M#saYaw#IaY#IaY.s#D#s#D#s#D#s#I#x#I#I.Cao.y#1#T#rbq.G#u.yaOaCamaC#xawaY.s.N.N.7aj#Lbp#Lbpa2#ga2#Lbp#L#g#L#g#L#ga2#gaja2bp#Lbp#Laj.7aj.7aja9#L#L#L#L#L#Laj#L#L#L.j#La2#ga2#g#g#L#ga2#g#g#ga2#g#ga2#g#ga2#g.j#g#gas#g.jasa2.j#gaj#L#Laj#L#Laj#La2a2a2#L#L#La9#Lajaf#Lajaf#Laj#L", -"a2.ja2.ja2a2a2#ga2a2#ga2a2#g.ja2a2a2a2a2a2.ja2a2asas#ga2a2#L.j#La2aja2a2a2#Laf#Lafa2af#Laf#Lafajaf.E#Laj#L#Lbpa2a9.na9#Da9a9#D#Dblbl#DaYaYaYaYaY#Dbl#Dbla9#D#D#Da9#Da9#Da9bja9bja9.7a9a9.na9#Da9#D.na9a9a9a9#D#sbl#saYaw.s#x#I#I.saw.saY.s.Naw.N.s.s#IaCaoao#u.G#z.UaX#uaOaOao.W#x#IaY.N.N.N#D#D#L.7#Laj#La2#ga2#gbpa2bp.jbpa2bp.ja2#g#L#Laj#L#La9.7a9.7a9.7.7a9#L#L#Laj#L#L#La2af#La2#L#L#g#L#ga2#g#ga2#ga2#g#ga2#g#ga2bpa2bpa2#g.ja2#ga2#g.ja2#Laj#Laj#Laj#L#La2.j#Lajafaj#L.E#L#Laf#L#L#Laf#L", -"a2bpa2#La2.j#ga2aja2a2a2.ja2#ga2#g.j#ga2#ga2#ga2a2aa#ga2#ga2bpa2#La2afaja2afa2#Lajafajafajafa9a9af#Laf#L#L#L#Lbpafa9a9a9a9a9#D#D#Dbl#DblawaYaYaY#D#Dbl#D#Dbl#D#Da9b.a9.7a9#Da9#Da9.na9.7#D.na9.na9a9#D.n#D#s#D#M.NawaY#I#x#I#Ia0#IaY#Iaw.Nawbo#x.s#x#I.WaF.yaz#3.a#4a5#v#vaoaC#IaYaY.saYaw#D#sbj#Laj#Lbp#L.j#g.jbpa2aj#g#L#g#L#g#g#L#g#L#g#Lbp#L.na9a9.na9a9.na9#Lajaf#L#L#L#Laj#Lafa2#L#g#L#g#g#L#ga2#g#ga2#ga2#ga2#ga2.j#ga2#g.jas#g.j#g.j#ga2aj#L#Laj#L#Laj#Laj#La2#L#Laf.7af#Laj#Lajafaj#L#L", -"a2.ja2.j#L#ga2a2a2#ga2#ga2#ga2a2a2a2a2a2a2a2.ja2as.jasa2.j#La2#La2#La2a2#La2afajafafafafaf#pa9.n#Laf#L#L#L#L#g#Lafa9a9a9a9a9a9a9a9#DblaY#DaYawaY#D#M#D#D#M#Da9#Da9#Da9bja9.7#s.7a9.7a9.na9a9.7#D#s#D#s#D#Dbl#s.N#M.Naw#I#I#IaC.W#I#xbo#xbo.N#IaYbo.W.Wa0#vaz.Y#.aVapaOaO#O#I#I#xawbl.N#D#D.7a9.E#L#L#L#gaj#g#g#ga2bp#gbpa2bp.j#La2#g.j#L#La2#Lbpa9.7#D#D#s#Da9#D#L#L#L#L#L#L#L#L#L#La2#L.j#Lbpa2#ga2#g#g#L#ga2#g#g#ga2#gbp#g#L#g#g#g#ga2a2#g.ja2aj#Laj#L#Laj#Laja2#Lajafaj#Laj.7aj#Laf#L#L#Laf#L", -"a2#La2#ga2.ja2#ga2.ja2a2a2a2#g.j#ga2#g.j#ga2#ga2#gaa#ga2#ga2aja2#L.j#La2#L.jafaf.3ajaf.n#p.n#pa9afajaf#L.7#L#L#L#L#La9a9#D.7a9#Da9a9bl#DblaYaYaY#D#D#D#D#D#D#D#Da9bja9a9.7#Da9#Da9a9a9#Da9#sa9a9#D#D#D#D#s#D#saYaw#I#x#IaC#x.WaC#I#I#x#I#x#I#I#xa1ao#Q.8.w#4.P.4#u#Sao.WaCa0bobfbl#s#D.na9#L.7#L#Lajbpa2a2#g.jasbpa2#L#g#g#L#gbp#ga2#g#Lajbp#Laja9a9#M#Dbl#D.na9.7a9.7a9.Ea9a9.7af.jaf#La2#L#L#g.j#ga2#ga2#g#L#ga2#ga2bpa2a2.j#g.j#g.j#g.ja2#g.j#Laj#Laj#L#Laj#L#Lajaf#L#Laf.7af#Laj#Lajafaj#Laj", -"a2.j#L.j#La2#L.ja2a2#ga2#g.ja2a2a2a2a2a2a2a2a2a2asa2asa2a2a2bpa2af#La2afa2#L#Lajaf#pafafa9#p.n#p.7af#L#L#Laj#Lbpaf#La9.7a9a9bja9a9#D#Dbl#DaYaYaY#D#D#D#Da9#Da9#D#sa9a9bja9a9bja9.Ea9.7a9.Ea9a9a9#s#D#s#D#Dbl.s#Daw#x#IaC.WaCaCao.Wav#Ia1#I.Ca1#I.Cav.8aO.G#dbs#BaLaB.8aC#I.WaYbf#sbl#Da9a9.n#L.E#L#L.jbp.j#gasasa2bp.j#L#ga2bpa2#g#L#g#L#g#L#L#La9#Da9bl#s#p#Da9.7a9.E.7a9.7.7.n#Laf#L#L#gaj#L#g#ga2#g#gbp.j#ga2#g#ga2#g.jbp#gbpas#ga2#ga2#g.ja2.E#Laj#L#Laja2#Laja2aj#Laj#L.E#L.Eafajaf#L#Laf#L", -"#L#L#L#L#La2bpa2#Laj#L#La2bpa2bp.L.L.jasaa#ga2#gaja2a2a2a2#La2#La2a2#L.j#La2afa2.3aj#p#Mbl#D#D.7ajaf#Laj#L#Lbp#Laj#Laf.n.7a9a9.7#pa9#p.NaYaYbl#Dbl#D#Da9#Da9.7a9a9a9a9afa9.7a9.7#Dbl#Dbl#D#D#D#D#xaYaYawaYaYaY#Ubn#I#I#I.Wao#v#vaC#I#x.W#Ibo.C.WavaoaZ.o.Yab#3.QaOaoaC.W#I#x.s.Nbl#sa9a9aj#La9#L#L#g#L#ga2#g#L.j#g#g#g#ga2bp#ga2.ja2#L#Laf#La9.7bl#DblblaYaYaYaYaj#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La2#ga2a2a2#g#La2#La2#g#La2a2#L#L.ja2.ja2.j#L#Laj#L#L#Laj#Laj#Laj.3#Lafajaf#Lajafa9.na9a9.na9.na9", -"#L#Laj#L#Laj#La2bp#L#gaj#L#L#Lajaa.jaaaaa2#ga2bp.3#L#L#La2#L.j#La2a2a2#La2#La2#L.3af#pblbl#Da9a9afaja2#La2#La2#L#Laf#L.7a9a9bja9a9#p#DblaYaw.Nbl#Dbl#Dbl#D#D.7a9a9afa9a9a9a9aj.7bl#D#D#sbl#Dbl#MaYawaY#xaY#xawaY#x#U#x#I.Cao.8aBaxav.W.C.Waoao.8aO#vaPay#daVbk.0#OaoaC.W#x#I.N.N#Dbl.na9a9#L.7aj#g.j#ga2bpa2#g#gasas#g.j#g#ga2#g#La2.ja2#Laja9a9a9a9bl#DaYawaYaY#La9.Eaf#L#Laj#L#L#Laj#L#L#L#L#Lbpa2#L#g#La2#g#L#gaja2#ga2#ga2#La2a2a2#La2a2.3#L.jaf.jaf.j#L.3#Laj.3aja2#Laj.3#Laja9af.n#L#Laf#L", -"a9ajafaf#L#L#L#L#L#L#L#L#L#L#L#Laa#ga2#g.j#gbp#La2#L.ja2#La2#La2a2#La2a2a2#L.j#L.jaf.n#pbl#sa9.Eaf#Lafaj#Laj#L#Lajaf#La9a9bja9a9#Ma9bl#DaYaYbl#DaYbl#Dbl#Da9a9a9a9#p.naf.7a9.7a9.n#Da9#D#D#s#D#DaYblaY#MaY#MaYaY#MaYaw#I#IaC.8aObgaoaoao.8ambc#v#uar.M#d#4.G.y.8bgaoaC#x#I.N.N#s#pa9a9.7ajaf#L#La2bpa2.j#g#gaj#g#g#gas#ga2#g#L#La2a2#Laf#Laf#La9a9a9a9#D#Dbl.Nbl.E#L.7#L.7af.7#La9#L.7#L#L#L#L#La2#ga2#ga2#g#La2#L#ga2#L#g#L#Laj#L#Laj#Laj#Laj#Laf#L#La2afaj#Lajaf#Lajaf#Laj#Laja9afajaf#Lajafaj", -"afaf#Lafajafajafajaf.Eaf#Laj#L#L#La2#L#L#gbpa2bp#La2#L.3#L.jafa2#La2a2#La2a2#L.3afaf#p#Mbla9a9.7afajaf#L#L#L#g#L#La9aja9a9#Da9.7#pbl#DaYaYaYbl#DaYblaY#Dbl#D#D#Dafa9afa9a9a9.7.7.7#Da9bja9#D#D#s#D#D#saYbl.NblaY#M#D.saw#I.WaOaB#vaO#v.8aOaO#v.y#3ad.Z#.#T#vav.haoaC#x#IaY.s#D#D.n#Dajaf.7#Laj#L#ga2#g#gbpa2#ga2a2as#ga2#ga2bp#La2a2a2a2a2#L#L#La9afa9#M#DblawaY#L.7af.E#Laj#L#L#Lajaf#L#L#L#L#Lbpa2#L#g#La2#gaja2#L#ga2#g#La2a2aj#L#L#L#L#Laf#L#Laj#Laj#L#Laf#Laj#L.7aj#L.Eaf.7.na9#D.n#Da9#Da9", -"a9.na9a9a9a9#pa9a9a9a9a9a9a9a9.nafaj#L#L#L#Lbp#La2aja2#La2#La2a2#La2a2a2a2a2#La2aj#p#pbla9a9#Lajaf#Lafajafaj#L#Lajaf#La9.7.nbj#Da9blaYaY#x.N#DblaYblaY#DaY#Dbl#Da9a9a9a9.7a9.7.7a9.7.E.7.7.7.7a9#D#D#D#D#s#D#s#D.sbl#s.s#xaoaO#S.yaBaB#u#u#ubk#E#.ab#4#3.G.y.8bo#U#I#x.s.N#D#s#Da9#L.7aj#L#La2bp.jbpa2#La2#g#L#g.jas#g#ga2#Laja2#L.j#La2af#L#L#La9.7a9bj#Daw.Nbl.E#L.7#La9#L.7#L.7#L.7#L#L#L#L#La2#ga2a2#ga2#L#g#La2bpa2#La2bp#L#Laf#L#Lafaj.7ajaf#Laf#L#Laj#Laja9.na9.7afa9.Ea9a9a9a9a9a9.na9a9", -"a9a9a9a9a9a9a9.n#paf#paf#p.n#p#pbl#D.na9a9#L#L#L#La2#La2#La2#La2a2a2a2#La2#La2afa9#p#M#pa9.nafa2afajaf#L#Lbp#L#L#Laf#La9a9#Da9a9#D#DaY#x#xaYaY#DblaYblaY#Dbl#Dblafa9afa9#Da9.7a9#L.7a9#Laf.7.n.7a9a9#s#D#D#D#D#D#s#D.s#x#I.8#Saz#u#u#uaZ.w.GbiaV#4.U#3ara5#vao.W#x#IaYaw#D#sa9a9#L.n#Laf#L#gaj#L#ga2#g.ja2#g.j#gas#gas#gaja2bp#La2a2a2a2#L#Laf#L#L#La9a9#Dbl.NaY.7#L.n#L.E#L#Lafaj#L#L#L#L#L#L#Lbpa2#L#g#L#ga2#ga2#ga2a2#gaja2#L#L#L#Laj.7#La9#L#L#Lajafaj#Laf#L.n.7a9.Ea9.Ea9.n#D#s#D#s#D#D#s#D", -"a9.n#pa9.n#pa9#pa9.n#p.n#p#p#p.nblblbla9.na9#Laf#Lafa2aj.3#L.j#La2#La2#La2aja2#La9.nblbl#pa9#L.j#Laf#Laja2#La2aj#L#Laja9a9.7#D#s#p#DaY#x#x#xaY#DblblaYaYbl.Nbl#D#Dbl#D#Da9#Dbj#D.7#L.7#L.7af.7#L.7.na9a9.na9a9.n.NaYbobfaoaFaBazaz.w#uaP#3#4ad#4ap.O.O.O.w#S.8.5#Uaw#x.saY#s#D.n.7#L#Laja2aj#gas#L#gbp#gbpa2bpa2#gas.j#g#g#L#La2#La2#La2#L#L#L#L.7#L.7.7.E#D#s#D.na9#L.7af#L.7#L.7#La9#L#L#L#L#La2#ga2a2#ga2#L#g#La2bpa2#ga2#ga2.7a9.7#La9.7.7a9ajaf#L#Laf.7.na9#D.Ea9.7a9.7a9b.#D#D#D#D#D#D#D#D", -".n#pa9#paf#p.n#p.n#p#p#p#p#p.n#p.b.R#Mbl#p.nafajafaja2#La2#L.3#La2a2aja2#L.3#L.ja9#pbl#Mbl.nafa2afajaf#La2#Lbp#L#Laf#La9.n#D#s#DblaYaY#xbn#xaY#DblaYblaYblaY#Dbla9bla9#D#D#D#Dbja9#La9#La9.7.7a9.7a9.7.7.7.E.7#D.N.sbf.Wam.y#uaz.Oar.Gal.Mbxadalbkbkbkbkbka7.yaF#I#IaY#s#Da9#s#Daj#Laj#L#g#L#g#g#gaja2a2a2#ga2#gas#gas#ga2#g#gaja2a2a2af#Laf#La9#Lajaf.7a9#D#s#Da9.Ea9.E#L.E#Laj#L#L#L#L#L#L#L#L#L#g#L#g#La2#ga2#ga2#ga2#L#g#La2#L#L#L.7#Laf#La9#L.E.7.7.Ea9.n.7.n.7a9.7.n.7.na9#D#D#s#D#s#D#s#D", -"#Lafaj#L.7#L#L#Lafafajafaja9#pa9aYawaYaYawblblblafafaf#Laf#L#L#L.jaaafa2#L#Lafaf.n#F#M#pa9afaj.7#Lbp#Lbpbpaj#L.Eaf#Laj#D#D.N#D.N.naYaYbna0a0bnaY#DblaY#x#xaYaYblbl#D#Da9a9.7#L#L.7.7.7.7.7.7.E.7#Dbj#D.s.N.N#DboaY#MaY.W.8aZal#P#PaT#P#.a.ad.ObkaX.G.O#Taz#SaoaC#x#x#I.N.s#D.E.7af.7#L.E#L.Eaf#Laj#g#gbp.jbpa2aj#ga2#g#L#ga2#ga2#L#L#L#L#L#L#L#L.7#L.7a9.E#Da9#D.Ea9.7a9.7a9#La9#L.7aj#L#L#L#L#L#L#L#L#L#Lbpa2#L#L#g#L#ga2a2#ga2bpa2#La2#L#Laj#L#Laf#Laj#L.7#L.7af.7.E#L.7#L.7#L#sa9.7a9.7#L.7#L", -".E.7.7#La9aj.7#Lafajafafafa9a9.nblbl#MaYblbl#Dblafajafaj#L.E#L#Laaa2a2aja2afajaf#p#p#pa9.naf.7#L#gaj#Lajbp.7#L.7ajafa9#D#D.NaY#xblaY#x#xama0a0aY#p#Dbl#xbnaYblaY#Dbl#Da9a9.7af.7.7.7.7.7.7.7.7.7#D#s#D.N.N.N.N.N#IaY.N#Iamanay.P.PaDaD#..M.O.G#u#u.w.GaP#u.ybgaCaC#x#IaY.N#s.7a9.7aja9#La9#L.E#L#L#ga2a2#ga2#ga2#g#L#ga2#ga2#g#g.7#L.7#L.7#L.7.7af#L#L#La9#Db.#Da9.7a9.Eaf.7a9.7#L#L#L#L#L#L#L#L#L#L#L#L#La2#L#L#ga2a2#g#L#g#La2#ga2#g#L#ga2#La2#L.7#L.7a9aja9#L.E#La9aja9#L.n#L.na9aj#Laja9aj.7", -"#L#Lafaj#L#Laf#Lajafaf.Eaf#sa9a9a9a9#pbl.nbl.n#p.nafa9#Laf.7#L#L#L.ja2#La2af#L.n#p#Mbla9a9aja9#Laj#Lbp#L#L#L.7.7#D#D#saYaw.N#xbf#MaYaw#xbna0a0aYblaYaY#xbn#xaYaYbl#D#D#Da9#D.7#L.7.7.7.7.7.7.7bj#s.7#D#s#D.N.sbfa0#UaoaO.yan.2.g#m.AbA#4ar#u.0#u#S#vaBaB#uaB#v.5aoamaC#x#IaY.N.na9.7.E#L.7af#L#La2#g#L#g#L#gbp#ga2#ga2#g#g#ga2#g#L#L#L#L#L#L#L#L#L.E#L.7.7a9#Da9.Ea9.7a9.7.7#L#L#L.7#L#L#L#L#L#L#L#L#L#L#Lbpa2#La2bpa2a2#ga2#ga2#L#ga2a2a2#g#La2#Laj#L#L#L#L#L#La9#L.7#L.7aj.7#La9.7#La9.7#La9#L", -"#L#L.7#L.7#L.7#Lafaf#Laf#La9a9.na9#Da9.n#Da9#D#Dafaf#Lafaja9aj#La2a2af#Laf#Laja9#p#D#p.na9.7aj#L#L#L#L#Laj.7.7b.#D#saY.NaYbf#x#x#DaYaYaY#xbna0#xaYaYaY#xaYaYaYaY#Dblbl#D#Da9.7.7a9.7.7.7.7.7a9.7af.7#D.N.s.N#x#IaF.8amaF.0#uaybe#.ba#aaz#ua##vaOaOaO#v#v.y#uaBa#b#bga0a0awaYbl#D.Ea9a9a9.E.7a9.7#Laj#L#gaja2a2a2#ga2#g#ga2#ga2#g#L#L#L#L#L#L#L#L#L#L#L#La9.Ea9.7.7.n.7.n#La9.n.7af#L#L#L#L#L#L#L#L#L#L#L#La2bp#La2#ga2#g#La2bpa2#ga2#L#g#L#ga2#g#L#L#Laf.7#L.7#L#L#Laj#L#L#Laf#L.7#L.E#L.n#L.E#L", -"#L#Laj#L#L#Laj#L#L#Laj#L.7.7a9.7a9a9a9#Da9a9.na9.naf.Eaf#L.7#La9ajaf#Lajaf#La9a9#M#pbla9a9#L#L.7aj#Laj#Lbjbj#sbjaY.N.Naw.N.Nawbf#DblaYaYaY#xbn.CbnaYaYaYaY#xaYa0bl#D#D#Da9#D.7#L.7#La9#La9#L.7.7a9#sblaYaYbnaCa0.5amaFaB#u#a#4abarazaBa#aO.5ao.5aoaoamaOaB#u#uaZaCa0bn#xaYaY#Dbla9a9.na9a9a9#La9#La2a2#L#g#g#L#g#g#ga2#ga2#g#ga2#ga2a2#ga2a2#La2#L#L#Laf.7.7.7a9a9.7a9.7.7.7#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#g#La2bpa2#ga2a2bpa2#ga2a2#g#La2#L#L.7#Laj#L#Laj.7af.7#La9#L.7ajaf.7#L#L#L.7af#L", -"#L.7af.7#La9#L.7a2#L#L.7#L.n.7.na9a9.na9a9a9a9a9afaf#Laf#Laf.E#Lafajafaf#La9.na9#D#p#sa9.n.7aj#L.7#L.7a9.Ea9#Da9.NawaY.N.NaY.N.N#D#D#D#MaY#x#xa0ama0#xbnaYaYbn.CaYaYaY#D#D#D#D#Da9a9a9a9.7#Da9#s#D.NaY#x.Ca0amamaFaB.f.Oau#aazan#v#vaFam.5aCav.CavaoaoamaOaB#uan.Ca0#xawaY.s#D#s#Dbja9bja9.7a9a9a2#La2#La2a2a2a2#ga2#ga2#g#ga2#ga2#ga2a2#ga2#ga2#L#L#L.7a9.7a9.7.Ea9.Ea9.7af.7af#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La2a2#ga2#ga2#L#ga2#g#La2bpa2a2bp#L#L#L#L.7#L.7af#L#L#L#Laj#L#L#L#Laj#L#La9aj.7#L", -"#L#L#L#Laj#L#L#Lajaf#Laja9.7.7a9.7a9a9a9a9.na9a9aja9#Laja9#L.7#Laf#Lafaja9a9#D#D.nblbla9b.#L.7.E.7.n.7.n#D#D#s#D#D#D#D#s#D#D.n#D#D#D#s#Dblawa0.Cama0a0aYaY#xa0amblaY#D.N#D#Dbj#Dbj#D#D#D#D#D#D#D.N#x#x#xbg#vbmaBbk#a#Ea7a7aZ#va#amb#ao.C.W.Cbf#IaqaoaoaoaO#SaZ#ubn#I#xaY.Na9a9.7a9a9a9a9a9a9a9a9#Lajaf#L#L#L#La2a2#g#g#ga2#ga2#ga2a2#ga2a2#ga2a2#L#L#L#L.7.Ea9.7a9.7a9#La9#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#g#L#g#La2bpa2#g#La2#ga2#ga2#ga2#L#L#Lajaf#L#L#L.E#L.7#L.7#L.7#L.7af.7aj.7af.7#L", -".E.7.n#L.7#L.7af#L#L#L.7aj.7a9.Ea9a9a9.7a9a9.7a9afafafafaja9aj.7afaja9#La9a9#s#D#p#M#D#s#D.n.E.7a9.na9#D#sa9#D#D#D#s#D#D#Da9a9.n.N#D#D#Dbl#xa0ama0ambnaYaYbnama0aYaYaY.N#D#D#Dbj#D#D#D#D#s#D#Daw.C#I.Caobm.G#faG.yaBbh.l.taFb#.5a0a0aoa0#xbo#xboaqavaoamaC#Sa7an#I#x.N.s#Dbjaj#L.n#Da9#sa9a9a9a9#Laf#L#Laf#Laf#L#ga2#ga2#ga2#g#g#ga2#ga2#ga2a2#g#L#L#La9.7a9.7.7.7.n.7.7.7#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La2#ga2a2#ga2#ga2a2#g#L#g#La2bpa2#L#L#L#L.7#L.7#L#Lafaj#L#Lafaj#L#L#L#La9#L.7aj#L", -"#L#L#L#Lajafaj#Laf#Lafaf#Lafajaf#L.jafajaf#Laja9aj#Laj#L#L#L#Laj.7.7.E#Laj#L.7.7bl.NawaY.NaY.N.s#s#D#sa9bj.Ea9.Ea9.na9.n#D#s#D#Da9.n#D#D.saY.s#x.R.Rbn#x#x#xaY.NbnaYblbl.na9.7.7#D.N.N.N.Nbfbfbfavama#aSaG#z.G.0aoa0aC#xaCbn.Wbn#I#xaY#I#x#x#I#x#Ia0avao#v.0aBa7#IaYa9.7.E.7#D#Da9a9a9a9.7a9.7afa2a2a2a2a2#g#ga2#ga2#g#ga2#g#ga2#ga2#g#ga2#g#ga2a2#g#L#L#L.7a9.7.na9a9afaj#La2a2#L#Laf#L#L#La2#L#L#La2#La2#La2#La2#L#L#L#L#L#L#La2a2a2a2#g#ga2#g#La2#La2#Lajafa2.7#L.7af.7#L.7afaj#L#Lajafafaf#L", -"#Lafajaf#L#Laf#Lajafaj#L#Laf#Laf#Laf#Lafajaf#Da9.7a9.7.7af.Eaf.7.na9a9a9.7.7.n.7awaYawaYaw.s.N#D#Da9#D.na9.7a9.7.n.7.7.7#D#D.7.7#Da9#s#D.N#x.N#x#Ua0a0bna0bn#IaYb#am#xaY.N.N.N.Nbj#D.N#I#xaqaoa0a0a#a7#fa6az.0.5bnaCbnbn#x#x#x#xaYboaYbfaw.NaY#I#x#Iao.8.5#v#u.T#I.N#sbja9bj.7bj#sa9.Ea9a9.7a9a9#L.ja2a2.j#ga2#g.j#ga2#g#ga2#ga2#g#ga2#g#ga2#g#g#ga2#L#L#La9aja9a9af.7af#L#L#L#gafa2#La2afa2#La2.3#La2#La2#La2#La2#La2a2a2a2a2#La2a2#L#g#La2bpa2bpa2#ga2#L#La2#L#L#L#L#Laj#L#L#La2a2afafaj#Lajaf", -"#L#L#L#L#L#Laj.7af#Laf#Lajaf.Eafajaf#Lafa9a9.n#D#D.n#Da9#s#D#D#D#D#s#D#s#D#D#D#sbl#s#D.s#D#s#D#s.7aj.7#L.7aj.7#L.7af.Ea9#L.7a9.7.na9#D#D#D.NaY#xa0.Vaoamama0ambna#b#amambn#x.C.Cawbf#xa0amamaF#v#vaBazaSa7a#aq.W#x#x.s#xaw#xaw#x.N.NaY#xaY#x#I.N#I#xavam.8.yana7#U#x#D.7b..7a9#Da9a9a9a9.7a9af.7a2#La2#L#ga2#g#g#ga2#ga2#g#ga2#ga2#g#ga2#g#ga2#ga2#L#L#L#L.7a9.7a9a9a9#La2#La2a2#L#Lafa2#La2#La2#L#L#La2#La2#La2#La2#L#L#L#La2#La2a2a2a2#g#ga2#g#La2bpa2a2#Laj#L#L#L#L.7#L.7#L.7af#L#Laf#Laf#L#L", -".7#L#Laj#L#La9#La9a9a9a9a9a9a9a9af#L#D.n#D.7#D.7#D#D.N.s.N.N.N.sbl.NblaYblaYawaY#M#D#Ma9#D.nbj.7#L#L#Laj#L#Laj#Laj#L#L#L.7a9.E.7a9a9a9#DaY.s.N#xaCb#a#aFa#amamam#vaFamam#xa0#xam.CaCamamaObma7aza7aZbm.tam.C.Cbfaw#xaYaY.NaY.NaY#DaY.s#xawbfaY#x#x#Iaqao.8aZ#ua7ao#xaw#Da9b..7#Da9#s.7a9af.7a9a9a2#La2#La2#ga2#ga2#g#g#ga2#g#ga2#g#ga2#ga2#ga2#ga2#g#L#L.E#L.7afa9afa9#Laf#L#ga2#La2#La2#La2#La2af#La2#La2#La2#La2#La2a2a2#La2#La2a2#La2#La2bp#g#L#ga2a2#g#La2#L#L#L#L#L#L#Lafaj#Lafaj#Laf#Laf#L", -"a9a9a9a9a9a9a9.n.7a9.n.7a9a9.n#D.na9#s#D#D#D#D#D#D#D.sblaY#saY#DaY#MaY#saYblaY#D#D#s#D.7.n.7bj.E#L#Laj#La2#La2#L#L#L#L#L.n.7a9.7a9.E#D#D.NaY.N#Iamam#v.0a#aFa#a#bmbgamaCbna0aoa0amaF#vaBa7a7.l.TaFb#b#amam#x.Nbj#x.N.s.NaY.NaY.N.N.NaY#x.N#IaY#I#x#Iaoaq.8.ybhazb#bn.N.N.7a9#D#s.7a9a9a9.7a9#La9#Lajaf#L#L#Lbp#L#ga2#ga2#ga2#g#ga2#g#ga2#g#ga2#ga2#L#L#L#L.7a9.Ea9a9a9a2#L#La2#g#La2#La2#La2#La2#La2#La2#La2#La2#La2#L#La2#La2#La2a2a2#ga2#g#ga2#ga2bpa2a2#L#L#L#L#L#L#L#L.E#L.7a9a9a9a9a9a9.7a9", -".7a9a9a9.n.7a9a9#s#Da9#Da9#D#D#D.7#D#D#DaY.Naw.Naw.NaY.NaY.NaY#s#D#D#D#D#s#D#s#D.na9a9.n.7.7.7#L#g.ja2#g.j#g.j#g.j.3aj#L.7aja9.Ea9a9a9#D.N.s#x#x.Cb#aF.yaZa#a##Sa##SaFamamaOa#aZazazaza7a7bmaFaFa0a0a0bn#IaYaY.Naw.NaYaY.N.N.Naw.NaY.Naw#x.N#x.N#x#I.Cao.5.ya7az.5aoaY.s#D.E#D#Da9.na9.7.na9a9a9#Laf#L#L#L#L#Lbpa2#g#ga2#g#ga2#ga2#ga2#g#ga2#g#ga2#g#L#L#Laf.7#La9afa9#L#L#La2a2#La2#La2#La2#La2#La2#L#L#L#La2#La2#La2#La2#La2#La2a2#L#g#L#g#L#g#La2a2bpa2#g.j#L#L#L#L.7af#L#L#La9.7a9a9.Ea9a9a9", -"a9a9a9a9a9a9.na9#D#D#s#D#s#D#s#D#D#D.saY.s#xaY#x#D#M#D.nbl.nbl#Da9.Ea9.7a9.7a9.7#Laj#Laj#Laj#Laj#gas#gas#g#gas#ga2#L#La2af.7#L.7a9#s#D#D.NaYaYboa0a0aOa#a#a#aBbh.GaPa7az#uaS#TalbaaGa7aZaFaoambnaCa0#x#I#D#DaYaw.N.N.s.N.N#D.N.N.N.N#I.NaY.saY#I.N#I.C.8.5.ya7azaOb##x.N#Da9a9#sa9a9#D.na9.7a9.7a9a9.7#L#L.7bp#L#ga2#g#ga2#g#ga2#g#ga2#ga2#ga2#ga2#L#L#L#L.7a9.7.na9.7a2af#L#ga2#La2#La2#La2#La2#La2#L.3#La2#La2a2#La2#La2#La2#La2a2a2a2a2#g#ga2#ga2bp.ja2bpa2#L#Laj#L#Laj.7#L.7.na9a9.7a9a9.7a9", -"afa9afa9.na9a9a9#s#D#D#D#D#D#D#D.saY.NaY.Naw.NaY.n#Da9a9a9a9a9#Daj.7#L#Laj#Laj#Laj#L#L#Laj.7bp.7as.jas.jas.jas.ja2.ja2#L#Laja9aja9a9#D#D.Naw.N#x#xa0am#va#a#bmaB#l#0.2.2.2#0ab.4arazaZa#aFa0.W.C#x#x.NaYaYaYblbl.N.N.N.Nbj#Dbj.NaY.NaY.N.NaY.NaY.NaY.Waqao.0#ua7aBaO.Waw#D.na9#Da9.na9a9a9a9a9af.7afa9.7#L.7.7bpa2#g#ga2#ga2#g#ga2#ga2#g#ga2#g#ga2#g#L#L#L.7.Eafa9afa9#L#L#La2#g#La2#La2#La2#La2#La2#L#L#L#La2#La2a2#La2#La2#La2a2#La2#L#g#L#g#L#g#La2#Lbpa2#La2#La9#L.7#Laf#L#La9.7.na9a9a9.na9", -"#D#Ma9#Da9bl#M#DaYaYawaYblawaYaYaYawaYaYbl#D#D#s.7af.E#L.7aj.7#L#Lajbp#Lbp#L#L#L#ga2.j#g#g.j#g.j#g#g#g#g#g#g#g#g#ga2a2aj.7a9.7.7a9.na9#M#DaY.Nawbn#UaoaF#v.8am#va6a6ba#V.Z#oab.I.TbmaFaoam.C.C#I#x.s.N.N#D#D#D#DaY#DaYbl.NaY.N.s#D#M#D#D#s#D#D#s#Daw#x.CaC.5bc.yaBaZ#vam.Nbj#Db.#D#D.7a9.7#D#D.Na9a9.7a9#L#L#L#La2a2a2#ga2#ga2a2#L#L#L#L#L#L#L#L#Laf#L.na9a9#D#Da9a9a9a9#L#L#L#La2#La2#L#L#L#L#La2#La2a2a2a2#L#La2#La2#La2#La2#La2a2a2a2a2a2a2a2#L#L#L#L#L#L#L#L#L#L#L#L#L.7a9.7af#La9.7a9bja9#D", -"bl#D#D#M#D#Dbl#D#MaYbl.saY.NblawaYaYaY#M#D#s#D#D.7#L.7#L#L#L#Laj#g#L#gaja2aj#gajas.jas#gas#g.j#gas.jas.jas.jas.ja2.j#L#Laf.E#D#Daja9a9#DaY.s#x#IaCamama##uazaz.G#.a..Z#Valarak#aaZ#Sa#ama0#U.C.CaYaY.NawaY#D#D#DaYaY.sbl.N.s.N.Na9a9a9a9#D#D#D#D#s.N.N#I.CaobybcbhaB#vaF.WaY.s.Nbl.s#D.na9#D#DaYafa9a9a9#L#L#L#L#ga2#ga2#gaaa2as#L#L#L#L#L#L#L#L#L#L#La9a9#D.7#D.na9#D#L#L#L#L#L#L#L#L#La2a2a2a2#L#La2#L#L#La2#La2#La2#La2#La2#La2a2#La2#La2#La2#L#L#L#L#L#L#L#L#Laj#L#Laja9.7.Eafaja9a9#sa9#D#D", -"#D#M#Dbl#D#M#DblaY.NaYbl.NawaYaYaY#M#D#D#D#D.7afaja9#Lajbp#Lbpbp#Lajbp#Lbpbpa2bp#g#g#g.j#g#gas#g.j#g#g#g#g#g#g#ga2a2aj.7a9#Da9#Da9a9#s#D.s#x#I.Ca0aO#uazal.Y.A.1a.aHaGaz.Ta#bma##SaFaFbgama0.C#x.s.NaY.N.N#s#D#Dblbl#Dbl#D#D#D#D#Da9#D#D.7.E.7a9#D.saY#x.Wa0.8.5#S#uaB#S.5.C#x#x.NaYbl#Da9#D#D.Na9a9.7a9#L#L#L#La2asa2aaa2#ga2a2#L#L#L#L#L#L#L#La2af#L#La9.7a9#Da9a9.7#La9#L#L#L#L.3#La2#L#L#La2#Lafa2#La2a2#La2#La2#La2#La2#La2a2a2a2a2a2a2a2a2#L#L#L#L#L#L#L#L#La2.7#L#L.7af.7a9a9a9bja9#D#D#D", -"aYaYaYawaYaYaY.saY#M.NawblaY#Daw#Dbl#D#s#D#La9.7#L#L#L#L#L#L#Lbpa2bpa2aj#ga2bpa2as.j#gas.j#g.j#g#gbp.j#L#gaja2bp.j#Laf#L.7#s.N#sbjb..N#Ibf.Waq.8#vaz#zaHbs.m.B.BauaSa#aFaFbgama0ambga#aFamam.W.CaYaY.NawaY#D#D#D#sbl#D#D#D#D.Nb.a9a9.n.7#La9.7b.#Da9.s.Nbo.C.Cava#aZaBaBaOaOb#ao#x#IaY#D.n#Da9#Da9a9a9#L#L#L#L#La2a2#ga2#ga2#ga2bpa2#ga2a2#ga2a2#La2af#L.7a9a9.7a9a9#D#L#L#L#L#Laf#L#L#La2a2a2#La2#La2#La2#La2#La2#La2#La2#La2#La2#La2#La2#La2#L#L#L#L#L#L#L#L#L#L#Laf#L#La9.7.7a9.7a9#D#D#s#D#D", -"aYboaY#x#x#I#x#x#I#xaYawaY.NaYaY#D#M#Da9.7.7aj#L#L.E#L#Lbp#L#L#Lajbp#Lbp#Lajbpaj#gas#g#gas#gas.j#L#Lbp#Laj#gbp#L#Laj.7a9.7#Dbj.N.N.sbo.Caq.8#v#u#3adbe.A#Y#9.PbranaBb#amamaYaYaYa0am#vbmaOb#.C#x.s.N.NaY.N#Da9#D#pa9.na9#Da9.7a9.7a9.7a9.7.7.7.7a9#D#D.N.N#xbo.Cb#aOaF#vbma##vbmamam#xbl#D#D#D#Da9a9.7#Laf#L#L#L#g#La2bpa2#L#ga2a2bp#Lbp#L#Lbpa2#L#L#La9a9.7a9.7a9af.7af.7#L#L#La2#La2a2#L#La2a2#La2#La2#La2#L#La2#La2#La2#La2#La2a2a2a2a2a2a2a2#L#L#L#L#L#L#Laj#Laj#L.7aja9#L.na9#D#s#D#D#D.N.N", -"#x#x#x#I#x#x#IbnaYaY#IaYaY#MaY#M#D#D#Da9.7#L#L#L#L#L#L#L#Lbp.E#Lbpa2bp.j#L#g#L#g.j#gas.j#g.j#g#g#Lbpajbp#Lbp#Laj#L#Laj.7.n.N.N.sbf.C.Caoa#.w.ObB.u#.#oa8aMabalanaBa#a#a0#xaYaYaY.Wamb##Sa#b#a0.C#xaY.NaY.s#D#D#D.nbla9a9#D.n.7a9#L#L#L#Laj#L#L.7.E.7b.a9.s.N.N.s.Camam.8aF#vaZ#uaFb##xaYaY#D#D#sa9a9a9.7#L#L#L#La2a2#ga2#ga2a2#g#L#L#L#L#L#L#L#L#La2af.7a9a9.7a9a9a9#D#L#L#L#L#La2#La2#La2#La2a2a2a2a2#La2#L.3#L#La2#La2#La2#La2a2#La2#La2#La2#L#L#L#L#L#L#L.7#L#Laf#L#L#L.7a9.7bja9#D#s#D.N.saY", -".CaC.Ca0.Ca0#x.CawaYaY.Nbl.N#D#D#Da9.E.7aj#Lbp#L#L.7#Laj#L#Lbp#Lajbpaj#Lbpaj#Lbp#gas.j#gas#gas.jbpaj.7#Lajbp#Lbp#La9a9#D.N.s.N#x.WaqaO#ubk#zaHbA#Pbsbeab#a#ua#ambm.Fa0bn#xaY.N.s.Nbnb#bmaBa#aC.Caw.NaY.NaY#D#D#D#pa9a9a9a9.7a9#Laj.7#L#L#L#L#L#Lbja9bjbj#D.7.N.Nbo.C.Ca0a##vana7an#Sa0aYawbl#D#Da9a9.7af#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#Laf#La9.n.7#Da9.7afa9#L.7a2#L#g#La2#La2#La2#L#L#La2a2#La2#La2#La2#La2#La2#La2#La2a2a2a2a2a2a2#L#L#L#L#L#Laj#Lafaj#L#L.Eaf.7#La9#s#D#DaY.NawaY#x", -".C#xa0#x.W#x#x#x#DaY#Dbl.sblaY.Na9#D#L.7#L#L#Laj#Laj#L#Lbp#L.7#Lbpa2#L#g#L#g#L#g.j#gas#g#g.j#g.jbp.7#La3#La3aj.7.7aj.7#s.N.N#Ibf.8aF.y#3ad.A.MaT.P#V#P#Tan.5.C#Ia0b#bga0#xbf#xbf.N#xa0bm.T#Sao#x#x.NaY#s.N#D#D#D#p.nafa9.na9#L.7#L#L#L#Lbpaja3#L.Ebj.E.7#sbj#sbjbf.s#xavama#aBana7aZbgbnaY#D#D.7.na9a9.7#L#L#L#L#L#L#L#Lbp#L#L#L#L#L#L#L#L#L#L#La2a2#L.7a9a9a9.7a9a9a9#L#L#L#g#La2#La2#La2#La2a2#La2#La2#La2#La2#La2#La2#La2#La2a2#La2#La2#La2a2#L#L#L#L#L.7#L.7afaj#L#L#L.7a9#LaY.Naw.Naw#x#x#I", -"aY.saY.NaY#DaY.N.na9.na9a9a9a9aja9a9a9a9.7a9.7a9#Laf#L#Laj#L#gaj#Lajbpaj#Lajbpaj#Lafaj#L#L.7.Ea3#L.Ebj#D.s.N#Db..7.7.N.N.WamamaOakaybs#Y.maDbaaHaga7#SamamaC.C.CaYamb#aFb##xaY#D.n.Nawa0#vaZaZa##xaw.N#Daf.na9#s#Da9a9a9.7af#Laf#La2#g#g#L#Lbp#L#L#L#L#L#L.7.7.7.7bj.N.Caoam#vaZaz.fanama0aY#Ma9aY#D#Da9a9.7.7#D#L#La2#La2#L#L#La2a2a2a2a2a2a2a2.7afa9a9#D.7#D.7af#L#L#L#La2#ga2a2a2a2a2#ga2#ga2a2a2a2a2a2a2a2a2#La2#La2#L#L#L#La2#La2#La2a2a2#La2#L#Lafa9a9a9bja9#D#D#DaY.s.N#x#Ibn#x#x#x#x#U#x", -"aY.Naw#D#D#s#D#Da9a9a9a9a9afa9a9a9a9.Ea9a9.na9a9afajaf#La2#L#L#Lbp.7bp.7bp.7bp.7a2a2#Laj.7.E.7.E#L.E#D.s.N.Nbjbj.N.s.N#xa0aO#u#E#V#2....#KaD.YaGa7bmaFaFaoama0.CbnaCb#aOama0.N#D#Dbl#xa0bmaB#ua##x#xaY#sa9.7a9.7#D#D.7a9a9aj#L#L.j#La2bpa2#Lbp.E#Laj#L.E#L.7b.#Db.#D.s#xa0.8a##v.6azbhaOam#xaYbl#Dbl#Da9#Da9.7.7#La2#La2a2a2a2#La2a2a2a2a2a2#La2#L#L#L#D.7a9#Da9#L.3afa2#La2bpa2bp#g#L#g#La2#L#g#La2#La2#La2#La2a2#La2#La2a2a2#La2a2a2aja2#L#La2#Lafaj#La9.E#Da9#s#D#Daw.NaY#IaYaYaYawaYawaYaYaY", -"a9a9a9a9.na9a9.na9.na9.na9.na9a9a9.7a9a9.7a9.7a9#L#L#L#L#Laj#L#Laj#Laj#Laj#Laj#L.jbp#L#L.E#L.Ea3.n#D.Nbf.Cbo.Caobf.CamaOaBaz#EaraQ#.#o.Abzay.Gana#aFaFaOamam.C.Wbna0a0b#ama0#I.N#D#M#x.CaoaZbhaBa0#IaY#Da9#s.7a9#sa9#Da9a9#Laf#L#L#ga2#g#L#Lbpbp#L#L#L#L#L.7.7.7.7#D.NaY.Cambga#a7.6#ua#b#aoa0#xbl#D#Da9.7a9#Laf#L#La2#La2a2a2a2#L#L#L#L#La2#La2.7afa9a9#D.7#D.7afaf#L#La2#L#L#ga2a2#ga2#ga2#ga2a2a2a2a2a2a2a2a2#La2#La2#L#La2#L#L#Laf#L#Lafajaf#L#Lafa9a9a9#Db.#D#DaY#DaY.N.N.N.s#D.N#D.N#D#s#D", -"aj.7aj.7.7.7.7.7#Da9#Da9a9a9a9.7a9#Da9#s#D#D.n#Da9a9.na9.7.7bj.7bp#L#L#L#L#L#L#Laj#Laj.E.Ebjb..N#MawaCaoaoama0.Cb##va7#a.Oaz#uaZaZanaz#e.6anaZaFaBaOaF.5amama0a0#xaCa0ama0a0#xaYbl.NaY#xa0#vaZ.lama0#x#Mbl#D.7#D#Dbja9.Ea9af#L#La2#L#La2bp.j#Lbp#Laj#Lbpaj.7bj.7#s#D.s#x.Wa0amamanaB.0a##va#bgamaYaY#Da9a9a9#L#L#L#Laf#L#L#L.7#La2a2#La2#L#La2#L#L#L.7a9.7a9#Da9#L.3#La2#L#L#La2bpa2#g#La2bpa2bpa2#La2#La2#La2#La2#La2#La2a2#La2.3#L#La2#Laf#L#Lafaja9a9.7#s#D#D#Da9.s.N.s.Naw#Dbj.7b..7b..7bjbj", -"#L#Laf#Lajafaj#Laf.7.7.7.7.7a9.Ea9bja9#D.7a9bja9a9.7a9.7a9.7.Ebjaj#Laj.7.E.E.7.E.7.E#D.s#xbo.C.WaCamb#a#.y.0.yaB.Gazazazbhbma#aFaFa#a#aZaBa#.5.5#SaFambgama0amam#x#xbna0a0aCa0#xaYawaY#Ia0aO.lbh#vb#bnaY#s#D#s#D#Da9#Da9.7ajaf#Laja2bp#g#L#Lbp#Lajbp#L#L#Lbj.7.7#Da9#DaY#x.CaCam.5a#aOa#a##va#a##xawaY#Da9.7#L#L.7af.7#La9#Laf#L.7af#Laf#L#Laf#Laf.7a9.7a9a9#D#Daf#L#La2#L#L#L#La2a2a2#ga2a2#ga2a2a2a2a2a2a2a2a2#La2#La2#L#L#L#L#Laf#Lafa9a9a9a9a9a9a9bj#D#D#D#D#D#D#Da9#Da9#D#s#L.7#L.7#L.E#L#L", -"#Laj#Laj#L#L#L#L.7.n#La9aja9#L.7a9#s.7#Da9#Da9bj.n#Da9.7.E#Dbj#D#D#D#Da9#Da9#Da9.N#I#x.Wam.8.5#va#aBaP.G#a.U#4.Uaza7aZa#aFaFbmb#a#b#aFa#.8ama0ama0a0a0a0a0aC.Ca0#I#x#xa0b#a0a0a0aYaY.N.N#Iambm.lbmaFaobnaYaY#Dbj#D#s.7a9a9af#L#L#La2aj#ga2bp#Lbp#L#L#Lbp#L.7.E.7#D#D#D.saY#x.C.CaC.5am#v.5a#.0#va0bn#x.N#D#D.7.7a9.7a9.7a9.7.7a9#L#L#L.7af.7#L.7#L#L.7a9a9bja9#Da2afa2#La2#L#L#L#L#g#L#g#L#g#La2#La2#La2#La2#La2a2#L#L#La2afa2af#L#L#L.7a9.Ea9.7.n.7#Da9#s#D#D.N.N.sbj#sbjb..7bj#Laj#Laj#L#L.7#L", -"bjbj.7bj.7.E.7.7.7.7a9.7a9.7a9.7#D#D#D#D#s#D#D#D#D#D#D#D#D.N.s.N.sbfbobf#Ibf#xboa0.8.5#v.yan.w.G#TabaMa8#cabalaZa#aFa#b#b#a0b#b#ama0aoa0a0#x#x.CawaYaY#Ubn#xaYaY#x#x#x.Rbna0a0amaYaY#D#DaY#UaF#GaZ#S.V#UaY.s#Dbj#s#Da9.n.7#La2af#L#La2#g#gajbp#L#Lbp#L#L#L.7bj.7a9#s#Dbl.N#x#x#x#x.C.Cam#va#a#.0aF.8a0#x#x#D#D#Da9#D.7#Da9a9.7.7#Laf#L#L#L#Laf#Laf.7a9a9.7a9#D#Daf#La2#La2#L#L#L#ga2#ga2a2#ga2bpa2a2a2a2a2a2a2a2#Lafa2#L#L#L#L#Laf#La9a9#La9a9a9a9#D.7#D#D#D#D#D.s.Nbja9.7.7a9.E#L.7.7.7.7aj.7aj", -".7a9b..7.7bjbj#D.Eaf.7#L.7af.E#L#D#D#D#D#D#D#s#D#D#s#Dbj#D.s.N.N.C#x.C.C.C.W.C.Wby#vaBaz#T#4aH#..ga8bsbr.2al#TaZaFaFb#b#ama0a0a0.Cama0#xaY#x#x#xaYbl.NaYaYaYblaYbf#x#x#xbna0a0aobn#xaw#D.sa0.t#SbmbmaOa0#U.N#D#D#D#D#Da9a9#Laf#L#L#La2#L#g#L#Lbpa2ajbp#Laj.7.7.7#Dbl#DaY.N.N#Ibf.Naw.Cao.5.5a#a##va#ama0bf#D.N.N.7#Da9#D.7a9.7a9#L.7#La9#La9#L.7#L#La9.7a9bja9#Da2af#La2#L#L#L#L#g#La2bpa2bpa2#La2a2#La2#La2#La2#L#L#Laf#L.3#Laf.7a9af.7a9a9.7a9.7#D.n#D#D#D#D#Dbjbj#Dbj#s.7.E#La9.n.7.na9.7a9.7", -"#Laj#Lafajafaj#La9#D#s#D#D#D#DaYaYaYawaYaY.NaY.N.C.C#x#IaYaY#M.namav.8.5#v.0.w.G#aau#4#4#z#3.Ga7#Z#0aM.gaTayaZa0a0a0a0#xbn#x#U#xawblawaY#D#M#D#D#D#Da9#D#sblaY#Mbl#Mblbl#DaYaYaYa0#IaY.N.NaY#Ua0.t.tbm.Fam#x.Nb.#Da9a9.7af#L#La2aj#L#L#L#L#Laj#L.7#L#L#L.7#L.7af.7.7a9.7.n#D#D.NawaYaY#x.CaCamao.0a#aB.0.taFb#.VaY#Da9a9af.7#D.N#Laf#L#L#L#L#Lafa9a9a9a9a9.7.7.7a2#La2a2a2a2a2a2a2a2a2a2a2a2a2a2#g#L#ga2a2#ga2a2a2a2a2a2#L#Laf.7#pa9a9a9#Dbj#D.N.na9a9a9b.#D#D#D#D#s#D#D#D#s#D#D.n.7#L#L#Laj#L.7", -"aja2afaj#L.7.7#L#sa9#D#D#s#D#D.N#D#D#D.N.N.N.N#DaY.N#x#xaCamb#aF#SaZanaz.Galba.4.O#aaz#uaB.0aBan#Tbz.mab.2az.5#xa0bnaYaYaYaYaYaY#DaY.NaYbl#D#D#D#D.n#D#Dbl#Dbl.Na9bl#Dbl#DawaYaYbnaYaY#D.s.N#xaCbm.Fbm.tb#aC.N.Nbl.na9a9aj#L#L#L.7#L.7#L.E#L.7#L#L#L#L#L#L#Laj#La9aj.7.7.7#D.N#D#Dbl.N#xbn.Ca0ama##va##v#vbm#vaF#x#x#Da9a9#D#D#D#L#La9#L.7af.7#L#pa9afa9.7#D#La9#La2a2#La2#La2#La2#La2#La2#La2#La2#ga2a2bpa2bpa2a2a2a2a2a2#La9afa9.na9a9#D#D#Dbja9.nbj#D#D.NaY.saY.Nbl.sblaYaY.Na9.7#Laj.7.7#L.7", -"#Laj#L#Laja9.E.7#La9.Ea9#D#D#s#Db.#D#D.Nbo.Caqaq.bbnbga#aZaS.G#q#t.HaQauaGar#a#a#vaOaF.5b#.8#vaB.2.A.1aDaka#amaYaYaYaYaYaYaY#D#D#D#D#s#D#D#D#D#D.7.7a9#D#D#D#Dbla9a9.n#D#D#D#Dblaw#xaw.N#DaYaYbnb#aF.taOb#.C#I.Na9a9.7a9a9#L.7#L#L#L#L#Laf#L#L#L.n#L#L#L#L#L#L#L#La9a9.7a9.Ebj#D#D#D.s.N#x#x.W.Ca0amamaFa##vbmaBb#bnaY#D#D#Da9bjaf#L#L#Laf#L#L#La9a9a9a9a9a9.7.7a2af#L#L#L#L#L#L#L#La2#La2#L#L#L#L#L#L#L#L#L#L#La2#L#Laf#La9.7a9a9afa9a9bj#s#D.Nbl.NblaY.NaY#xaYawaYawaYbl.sbl#M.7.E#L.7#L.Ea3.E", -".7.7.E.7.Ebj.7.7.n.7a9.7#s.N.N#DaY.N#x.Cam.5a#aZaF#SaZa7arala6ay#W#W#kbhbmaFa#.5#x#x.CaCaoamaOaB#P#obsba#uam.C.NaYaYaY#D#D#D#D#Da9#Da9#D.7#Da9a9#La9.7.7a9bl#s#Da9a9a9bla9bl#D#DaY.NaYawaYaY#IaYa0aCb#.Va0a0#U.N#D#Da9.7a9.7aj#L#L#L#Laj.7#L#L#L#L#L#L#L#L#L#L.7#L#L.E#La9.7.7.7#D#D#DaY.s#x.C.C#x#Ia0aCama#a#aZa#.8a0#xaY#Da9af.7#Da9#D.7#Da9#Dafa9afa9.7a9#La9#L#L.3#L.3#L.3#L.3#Laf#L#L#L.3#L#L#L#L#L#L#L#L#L#L#L#L#La9.7a9a9a9#D.na9bl#DaY#s#x#x#x#Ia0#I#x#xawaYblaw.NaYaYaY.7#D.7.Ebja3.7.7", -"#Db.#D#D#s.N.s.NaY.Naw.N.NaYbo#xa0b#a#bmaS#aa6.Kbaba#a.faZaFb#amb#b#ama0.C#xbf#xbobf.NaY#xao#v#u.q.qaGanamaYaY#DaY#sbl#Da9.7#L.7.7.E.7a9.E#L.7.E#L#L#La9.nbjbl#Da9a9.7a9.7#D#D#DblaY#xaYaY#IaYaY#xbna0bnbna0aCbn#sbl#Da9.7af.7a9#L#L.7#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#La9.7af.7a9aj.7#D#D.N.Nbo#x.Nbl#Ia0am.5aO.0aB.0b#.CaYbla9a9a9.7a9.7a9.7a9a9a9#pa9a9a9bj.7.7#L#L#L#L#L#L#L#L#L#L#Laf#L#L#L#L#L#L#L#L#L.7#La9#Lafa9bja9#D#D#D#Dbl#DaYaYaYaYaY.C#xama0.CaC.C.C#x#xboaYaY.NaY.N#s.N#D.N.s.NaEaW", -".N.N.s.N.Nbf#xbfaCa0a0a0a0amam.8aZbhazaGau#j.e.e.6ana#.5ambn#xaY#I#x#xbo.N.N#saW#x#Ibfaw#x.5aZ.G.q.KaBam#xaY.s#D.7#Da9.7.E#L#L#L#Laf#L#L#L#L#L#L#Laj#L#L.7#Da9#Da9.7a9#D#D#Da9#D#DawaY#IbnaYaY.Naw#xbnbnbna0bna0aY#D#D#Da9.7#L.7#L#L#L#La9#L#L#L#L#L#L#L#L#L#L#Laj#L#L#L.n.7.7.7#La9.E.7#D.N.N.N#saY.N#x.Wa0.5aF.0aZ#v.5a0aY#Da9.7#Da9bja9#D.7#Dafa9afa9.7a9#La9#La9#La9#La9#La9#La9#L.7a9af.7af.7#L.7.7#L.7af.7.7a9.7#D#D#D#D.N.saYaY#x#I#xbnbnaOaoaoamaCa0a0bn#Ibn#x#x#x#x#I#x#xaYboaY.N#xbf#x", -"#x#xa0.CaCa0aoa0aFa##v#vaZ#uaZaZarazazanbmaF.5a0.C#x#x.N#D#D#D#D#D#D.Nblbj#D.N.sbf#x#I.CbgaBaz.2baazaF#x.n.7#Dbla9.7.7#L#L#Lajbp#L#L.E#La9#L.7#L#Lbp#L#L.7#L#D.E#L#L.E.7.7.7.7#Dbj.N#xbna0#I.N#DaYawbna0bnbn.V#U#D#D#D#D#D.7a9.7#Laja9#Laj#L#L#L#L#L#L#L#L#L#L#L#La2#L#L#L#Laf.7#L#L#La9.7#s.N.N.7#D.N.N#x.CaCaq#vaZaBa#aF#xaYbl#D#D#D#D#D#D#D#Da9a9a9a9a9a9.7.7#L#La9.7a9a9#L#L#La9a9a9.7a9.7#L.7af.7af.7a9.7.7#D#D#D#D#D.N.NaY#x#x.Ca0b#ambgamaOb#aCa0.C#I#xaYa0a0#xbn#x#xbna0aCa0a0a0ao.CaCaq", -"aoa0aoaO.5.8aFaO#u#uaSazaG#3araza#a#amam.C#x.s.Nafaf#La9bjaWbfbf.N.NaY#xawaYaYaY#x.C#xaCamaB#aaT.GaF.C#D#La9#L#D.7#Laj#L#Lbpbp#Lajaf#L#La2#L.j#Lbp#L#Lbpa9.7#Da9.7#La9#La9.7a9.7#Dbl#xaCbn#xaY.s#D.N#Ubnbnbnbna0bl#D#D.7a9.7#L.7a9#L#L#L#L#L#L#L#L#L#L.7#L#L#L#L#L#Laj#L.7#L#L.7a2.7#L.7.7#D.N.Nbj#D.s.N.N#I.Ca0aFaZaBaZ#vam#xaY.7#Da9#D.7#Da9#Dafa9afa9.7a9.7a9#L#Lafa9#La9#L#La9af.7a9a9a9afa9a9#L.7.7a9#L.7af#D#D#D.N.N.NaY.s#xama0.8aF#Sa##va0a0a0#xbnaYaYawbn.WbnaCbnaCa0aCaFb#aO.5aOaF.8aF", -"aZ.ya#amaoaFaB.Taka6aGaraBaFa0#xbnaYaYaw#D#Da9#D#L.Eaf.7a9aj.7.7aja9.n.7#D#D.sbfaw.N.Wam#v.w.Ga7.C#IaY#D#s.7.n#Laja2#L#ga2#ga2#g#L#Lajafaj#L#L#Laj#L#L.na9a9.na9a9a9.na9a9#L.Ea9a9#saYaY#x.C#x#xaYbn#x#U#x#xa0aCbn#D.7#L.7a9a9#paj#L#L#L#L#L#L#L#L#L#L#L#g#L#L#L#L#L#L#L#L#L#L#Laj#Laf.Ea9.7.7a9#Da9#D#D#DaY.NawaY.pa#.0.0a#ambn.N.N#D#D#D#D#D.7a9af#L#L.7#L#L#L#L#L#La9a9.7a9#Da9a9#Da9bja9bj#D#D#D#D#D#D#D#D#D#s#D.saY#xbn.8aFaZaBaZa#aFama0aqaC#x.N#MaY#x.Ca0aFb#b#amamb#.5aFaoaOaFaOa#bmaZ.y", -"aZa#aOa##v#vaB.T#4#z#a#uaFa0aC#xaYawaYbl#Da9#Da9.7a9.7#L.7a9.7a9af.Ea9.7#s.N.N.N#D#Ia0.8a#bkaraZ#IaY.s#D#Da9.7#Lbpa2bpa2#g.j#ga2ajaf#L#L#Laja2#Laf.7#L.7a9.7#Da9afa9a9a9a9.7a9#La9#Dbl#x#x#I#x#xawaY#U#xbn#Ia0.CbgaYa9#L#L#Lafa9#Laj#Lbp#Lbp#Lbp#Lbp#L#ga2#g#La2#L#L#Laj#Lbpaj#L#L.7#La9.7.7a9.7.E#D#D#D#D.saY.N#Ua0#va##S.0aOamaY.N#D#D#Da9#D#Dafa9a9af#L#L#L.7af#Laf#La9#Da9.7a9a9.7#D#D#D#D#Da9bja9a9#D#D#s#D.N.N#x.Ca0aoaF#vaZbmbmaOa0.W.C#x.C#xbl.NawaY.CamaCamaCamamambgamb#.5aOa##Sa#.yaZ", -"#vaFaO#v.ybmaZazbaauazb#a0#x#xaYaYaY#D#sa9#D.E.7aj#L.7aja9aj#L.7aja9.n.7#D#D.sbfaY.WaCam#u#3a7aFaYaY#D#D.n.7ajafaj#gaj#g#L#g#Laj#L#Lajaf#Laf#Laj#L#L#La9a9#Da9a9.na9a9.7.n.7.7a9.na9aY#x#x#x#x#xaYaY#x.R#IbnbnaC.t.VaYa9.7aj#L#L#Lbp#L#Laj#La2#L.j#La2#g#g#g#gajbp#Lbp#L#L#L#Lbp#L#L#L.7a9.7.7.7a9#D#s#D#DaY.NaYaYa0ama#a#.yb#a0.N.N#D#Dbj#D#Da9a9a9.7a9bja9.7.7a9a9a9#D.7#D#D#D#D#Da9#Da9#D#D#Da9a9.n#D#DblaYaY.8b#.8aOaFaOaFaOb#bgama0#x#x#x.N#U#x#I#x#x#xaoama0bna0bnaoam.5amaOaFaFaF#va##vaZ", -"aOaOaF#va#a#az#faS#ubmb#a0#xaY#Dbl.n#Da9a9.7#L#L#L#L#L#L#L#Laj#L#L.Ea9a9#s.N.N.s#x.Wb##v#Ebk#va0aw#D#D#Da9#L#L#Lbpa2#L#ga2#ga2#g#Laf#L#L#Laj#Laf#L.7#L.n.7#D.na9a9a9a9a9a9.7a9#La9#sbl.NaY#xaYaYblaYaw#x#x#x.C.C.Fb#bnbl#Da9.E#L#Laj#L#Lbp#Lbp#Lbp#Lbp#L#g#L#g#L#Laj#Lbp#Lbp#L#L.7#L.n#L#L.7af.7#Da9#D#D#D.NaY.saY#Ibn.5a#a#aFambf#x.NaY#D#D#D#Da9a9a9.7a9.7.7#L#D.nbj#D#D#D#D.Na9b.bl#Daw#xaYaYaYaYaY#Ia0a0aoam#uanaBa##vb#bgb#bnbnaYaYaYaYblaw#x#x#x#Ua0.Wa0a0.W.C.Wama0ambg.5aFaFa##va#a##va#", -"b#ao#vbmaB#uaz.Gb#b#ama0#xaw.N#D#Da9a9a9.E#L#Laj#L#Laj#L#L#L#L#L.Ea9.n#D#D.N.N#x#Iao.5#u.Oazam.C#Dbl#sa9ajaf#La2.jbp.j#L#gajbpaj#Laj#Lajaf#L#Laj#L.n#La9a9a9a9#D.na9a9.Ea9.n.7a9a9#DaYaw#x.sbl#D#sblaYbl#I#x#Ua0b#bgb#bn#D#D.7#Lbj.7.7.7.7.E.7.7#L.j#La2#g#L#La2bp#L#Laj#L#Laj#L#L#L#L.7af.7.7.7a9.7#D#D#s.Nbl.NaYaY.CaCby#va#.8#xbfaY.N.s#D#Dbj#D#D#D#D#D#D#D#D#D#D#D#D.Naw.NaY#D.NaYaw#x#xa0aoamamaFaF#v.0bbanaBaZ#vaFb#am#x#xaYaYaYaY#IaY#D#D#x#x.Ca0avamama0.C#x.Ca0aoamaFa##uaZaBaZ.y#S.0.y", -".8aOa##Sazar#ua#a0am#x#x#x.N#D.7.na9#L#L#Laj#Lbp#L#Lbp#L#Laj#Laj#La9.7.n#D.sbo#x.Wao#v.f#f.ya0bf#M#D#Da9a9#L.ja2#La2bp.j#L#ga2a2#Laf#Laf#Laj#Laf#L.7aj#Da9b.bl#Da9.na9a9a9a9.7.n#D#MaYbfaYaY#Da9#D#D#Daw.NaY#x#Ib#b#bg.VaYbl#s#L.Ebj.7b..7.7.7.7#Lbp#Lbp#L.jbp#L#L#Lbp#Lbp#Lbp#L.7aj#La9.7a9#L.7a9#s#D#D#DaY.Naw.N.s.CamamaOa#a#.W#xbf#xaY#D#D#Da9#Da9#Da9bj#Dbj#D.N.Naw.N#x#xbfaYaw#x.Ca0a0aFbma#aBaZbbaZ#uaZ.0bgb#a0am#x#x#xaYblaY#MaYaY#Dbl#DaY#xaCamamaoaqaC.C.Wamao.5a#a#.yaSazaZ#uaZ.yaOaF", -".5aF#Sbhaza7aFa0a0bn#xaw.N#D.7.7af#L#L#L#La2#L.j#g#Lajbp#Lbp#Lbpaja9.n#D#s.N#I#I.WaF#uarazaF.W.Nbl#D.n#Laj#La2a2aj#g#L#g#L.jbpaj#Laj#L#Lajaf#Laj.7afa9.na9#D#D#Ma9#p#s#D#sa9.na9#DblawaYaw#Da9a9#D#D#saY.Naw#x#xaCb#.VaC.V#xaY#Dbj.nbja9bj#s.7.7aja2#L.j#Lbp#La2ajbp#L#L#L#L#L#L#L#L#L.Ea9.7.7a9#D.7#D#D#D#DaY.N.N.N#I.CaoaFa#aB.C#x#xbf#x.N.NaY#Dbl#D#D#D.N#D.NaY.saYaY.C.W.C.W.Caqa0.8a#aZaBan#u#uan#Sa#b#ama0bnaY#xaYaY.NaY.N#s#DaY#DblaY#Dbl#I#xam.8.5aOam.Cama0aoaFbmaBbha7#a#ea7an.y.yaF.8", -"bc.y.wara7b#a0aoaYaYaYbl#Da9.7.7#Laja2#L#g.j#g#ga2bpa2bp.jbpaj#Laf.Ea9#s#D#I#I.C.WaOaz#EaZb#.C.N#sbla9afafaj#L.j#L#g#L.jbpa2bpa2#Lafajaf#L#L#Laf.E.7.n#Da9#D#sbl.n#D#M#s#D#s#D#s#DawaY.NaY#Da9.n#D#D#D#DaY.NaY#I.CaCam.Vb##U#xawa9bj.7b..7bj.7bj#Laj#Lbp#La2#L#Lbp#L#Lbpaj#Lbpaj.7#L.7af.7a9.7.Ea9#D#D#s#D.N.saYb..Nbf.Wa0aF.0#ua0.W.C#Ibfaw.NaY#saY.N.N.N.N.N.N.N#xaY#I#x.W#x.C.Wam.8aZ.waz#ubha#aFaFb#ambn.bblawaY#MaY.N.s.N.N#D#D#D#DaY.saY#I#xaCam.8aFbyaoaCaoamama#a7azararaya6.G.Gaz#u#v.8", -".J.far.laobn#xaY#D#sa9#D.7a9aj#L#L#L#L#L#Lbp#Laj#g.j#ga2#L#L#Lbp.na9.7#s.N#I.Caobh#EaBaCbn.s#IaY#Ma9.n.7#L#L#L#Laj#Laj#L#Laj#L#L#L#L#L.7aja9.Ea9bl#M#D#M#DblaYblaYawaYaYawaY.NaYawaY#Mbl#D#D#D#Da9.n#D#s.Nbl.saY#x.RaY.N#xa0aFbm#IaYaY.N#s.7.E#L#L#La2#L#L#Lajbp#L#La2#L#L#L.7#La9a9a9.7#L.7.7.7#Da9#D#D#DaY.N.NaYaY#Ia0.5.8a#an.0.5bn#xbl.N#x.C#Dbl.sblaY#I#x.W.R#Ibna0aOa##vaZazararaz#ua#aFaO#x#I#x#Ibn#x#xaYaYaY#DblaY#Dbl#Dbl.NblaY.NaY#x#xaoaobnaY#xaCa#.0aOaOaOaFaFaFaFaF.l.Ta7bh.G.G#q#e", -"araza7aFam#xaYawa9#Da9a9a9#L#L#L#L#Lbp.j#L#La2#Las#ga2#gbp#Laj#L.7.7.n#D#M#xaCaFbk#iaOaC#xblaY.Na9a9a9afaja9aj#L#L#Laf#Laf#Laf#Lajafaja9#L.7a9.Ebl.n#D#M#DawaYawbn#Ubn#I#x#I#xawaYawaYaY#D#s#D#D#D.n#D#DaY.s#x.N#U#IawaY#xbna0aF#x.W#xaw.N#D.7b.afajaf#L#Lbp#L#La2#L#L.E#L.7a9.7a9a9.na9.7a9.7.7#D#s#D#D#D.Nbl.Naw.N#x.CamaF.0.y.yaF.CaYaw#x.Caq#Ibn#x#x#x#xbna0aoamaF#vana7.wazaZan#uaZaOamamamaY.RaYaYawaYaYaYaYblaY#D#Dbl#DaY#DblaY.N#xaY#I#xbnbnawaYbnam#va#ama0a0aoamamaoam.taFbmaZ.6ar.2#4", -".faBb#a0aY#xbl#Da9a9#D.E.7#L#L#L#g#ga2#g#g#g#g#g#g#g#ga2#L#L#L#L.n.7a9a9.N#Iam.8#f.Gb#bn#UaYaw.Na9.na9.7af#Laf#Lajafaj#Laj#Laj#Laf#Laf#L.na9a9#D#Mbl#M#DawaYaw#x#I#U#x#U#Ibn#I.NawblaY#s#D#D.N.sa9#s#D#M.NaY.s#xawaY#D.s#D.Nbnama0a0aC#x#xbl.NaY#La9#L.E#L#L#L#Laj#L#L#La9.7aja9a9a9a9#D.n.7a9.7#s#D#D.Naw.N.NaY#Dbl#I#xaC.5#va#aBaFa0aC.C.Caoa#ama0a0ambgaF#va##uan.w.wan.wanaZ#vaFb#ama0a0#x#xaYbfaY#xaY.Nbl.Nbl#D#D#Dbl#D#D#D#DaY#saY.N#x#x#xaYaYaYaY#Ia0bg.5bn#xbn#xbna0a0amaCb#ao.t#SaZar#a", -"aFama0aY#xaY#Da9#D#Da9a9#L#L#L#g#ga2#gbpa2bpa2bpa2#ga2#gbpajbp#L#Da9.7#saYaY.W.5#EaraFa0#U.NblaYa9a9a9ajaf.E#La2#L#L#L#Laf#Lafaj#Lafaja9#D.n#D#D#s#DblawaY#I#x#Ibnbn#I#U#x#IaY.N.Rawbl#D#D#D.s.N#D#D.saY.saY#I#x.N#s#s.7bj.N#xa0aob#amaoa0#I#xaY#D.na9.7a9bpaj#L#L#L#La9.Ea9#D#D#D#D#D#D#D#Dbj#DaY.Nbl.N.N#x#xbfaw.NaY#xama0aOa#aBa#bgama0.5a#.0aFaOaF#SaZan#ua7bhazaBbhaBa#aFb#b#aCbnbn#x#xaYaw.Nblaw#D#Dbl#D#D#s#D#p#Da9#D#D#Dbl#DaY#x#xaw#x#xaY.NaY#x#x.C.C.CawaYaw#xaw#x#Ibn#x#Ua0a0amaFbmbm", -"bn#xaYaYaY#Ma9af.7.n#L#L.7#L#ga2bp#ga2#g#ga2#ga2#ga2#L#L#L#L.7.7#s#D#s#D.N#xamaoaS.OaBam#xaYaw.N.na9a9#Laf#L#La2ajafaj#L#Laj#Lafaf.na9a9a9bl#D#Mbl#saYaw#x.b#x#x#U#Ibn#I#xawaY.saYaYbl#D#D#D.N#D#M#sblaw.N#I#x#I#D#sbj#Db..N.N.Camamb#am.pa0a0bn#D#Da9.7.7aj#Lbp#L#La9.7a9a9#s#D#MaY#D#Dbl.saY.N.N.N.s#x#xbf#I#x.NaY#I.CaCamam#vaBbm#SaF#va#a#aB#ubh#uanaBaBbmaZ.FaFb#b#a0aCbn#I#x.RaYawaYawaY.N#D#D#D#D#D#D#D#Da9#Da9#Da9#Da9a9.saYaw.Naw.N#xaY.N#x#xaY#xaC#xaYblaYaYaYaYaYaY#xaYblaY#Ua0a0.Vbn", -".NaY#D#Da9a9a9#La9.7.7#L#L#g#L#ga2bpa2bpa2bp#gbp#g#Lbpaj#L.7.Ebjbj#D#Dbl.s#xaoa##TalaBam#x.NaY#Da9a9a9af#L#L#L#L#L#Lafaj#Laf#Lajafa9a9#p.n#D#M.NblaYaYawaY#x#I#x#Ibn#U#Ibn#I.NaYawaY#sbl#saY.s.N#sbl#s.NawaY#I#x#I.N#D#s#D.N#Ibnaoa0#Ia0a0b#aoamaw.N#Da9.7#L#L#L.7.n#L.7#s#DaW#DaYaYaY#I.NaY.N.N#I#x#xbf#x.C.C.C#x#I.Ca0amama#a#a7azaza7aZaB#uan#uan.laZ#SbmaFaF.V#Ubn#UaYaYawaYaYawaY.NaY.N#D.N.n#Da9#D.n#D.7a9#Da9bj.nbja9#s#DblaY#D#x#xaYaY#x#M.N#x#I#x#x#xaY#Dbl#DaYaYaY#xaw#x#IaYaYaY.baYaY", -"#D#D#Da9a9#Lafaj#L#L#Laj#Lbp#ga2#g#ga2#g#ga2#ga2#g#L#Lbp.7.7.7#D#D#s#D.saY.C.8aB#4#zaZa0#xaYaw#Da9.na9#L#L#Laja2#Laj#L#Lafaj#L#L#p.n#pa9blblaYaYawawaYaY#I#x#x#Ibn#Ibn#I#x#U#x#IaYblaYaY.Nbl.saY#s#Daw#Dawbf#I#x#I#x.s.N.s#xa0aC.C.Ca0.CaCa0ambg#x.N.s#D.7aj.7aja9.7a9#sa9#D.s.NaYawaYaYaY.NaYaYbf#x.C#x.W.C.Caqavaqa0ao.5#va##vaS#W#aazazanbm#SaFaFa#aFaOaFbgb#aCbnbnaw#x#x.N.N#sbl#D#s.N.N.N.N.7.7.7.7.7.7a9.7.7.7a9.7a9.7.7.7aY#DawaY.NbfaY#x.NaY#x#x.C.WaY#D#M#DaY.NaY#x#x#x#x#x#xaYaY#Da9#D", -"a9.7.7.7afaj#Laf#L#L#L#La2#La2#gbpa2bp#g#L#g#L#g#Lbp#L#L.7.7.7bj.s#D.NaY.Nao#v.QaD#za#am#xaY.N#D#pa9a9ajaf#Laf#L#Lafa2#La2#Lafaja9#p.na9#MblawblawaYaY#I#x#I#x#x#Ubn#Ibnaw#x#IaYaYawaY#M.saY.N.s#D#M#D.s.Naw#x#I.W#x#I.s#x.W#Ua0.Cava0.W.Ca0a0a0#I#IaY#D.7#L#L#La9.E#D#D#D.N#D.sbnbn#x#x#x#x#I#x.C#x.W.Caqamavam.C.5.5aFbya#.y.0.Gakar#e.TaBaFaF.5aFaOamb#a0aoambn#Ua0.C.Ca1bfbf.Nbl.N#D.N.N.N.Na9aj.7af#Laf#L.Eaf#L#L#L.7.n.7.n#DaYblbfaYaY#x#x.s#xbo#x.C#x.Na9#D#DaY.N#x#IaY#xama0bn#x#D#D.7#L", -"#Laj#L#L.7#L#L#Laj#L#Lbp#g#g#g#La2a2a2a2#ga2#L#L#L#L#L#L.7a9.7a9#Da9.s#Iama##u#.bA.faFaYawaYaYbfa9a9afa9#L#L#Lajafajafafajaf#Lafafafa9a9bl#Dbl#s.RawaYaY.R#U.R#Ubn#Ubn#Ibn#U#x#x#M#D#D#Daw#D#s#DaYaw#s.n#D.s#I.Caoaoam.8.5aO##am#va#byaFbcaqav.CaFaOaFaC#x.N.saW.N#D.N.s.N#I#xbn#U#xaw.R#x#xbna0#U.Vamb#b#aFa#bmaBaZ#vaZ#v.0aB.yaFaO.5bgamamamaobn#U.C#Ua0aCbnbnawaY#MaYblaY.saY.7.n.7.na9.E.7.7#La9#Laj.7#L.7af#Lafaja9a9a9#Da9.Nbl.Naw#x.s#xaY#x#xbn#x.baYaY#Da9.na9#DaY#x#x#x#IaYaY#sbla9.na9", -".7af.7#Lajaf.7#L#Lbp.j#L#g#L#g#ga2#ga2#g#La2#L#Laj#L#L.7a9.7.n.7#sbl.NaYaoa#azbAa6a7am.RaYaYaY#xafa9a9af#Laf#L#L#Lafaj#Laf#Lafajafaja9.n#D#M#DaYaw.R.RaY.baY#UaY#Ubn#UaYbn#x#I#x#M#D#M#D.s#D#s#D.s#Dbl#s#s#MbfavaCbgaCaoaC.5ao.5#vaOaOam.8.8amavb#b#aoaC#xaw.N.N#s.s.NaYaw#xbnbnaCa0a0a0amamaoaFaFaFa#.yan#u.G.6aBaBbmaO.5b#.5b#amaoa0a0amaCa0a0aY#xbn#Ibn#Ibn#IblawaYaY#M.Nbl.N.n.7a9.7a9.7afa9.7aj.7#L#L#L#L.7#Laf#La9a9#D.7#D#s#DaYaY.NaY#x#xbn#x#x#U#xaYawaYa9a9a9bl.NaY#x#x#xaYaYbl#Da9.7a9", -"#L#L#L#L.7#L#L#L#La2#L#L#ga2#g#L#ga2a2a2#ga2#L#L#L.7#Laf.E.7.7#DawaY#I.CaoaBazbaaSa#.VbnawaYaY.N#pa9afa9a9#Laja9af#Lafafajaf#Lafa9#pa9blblbl#MaYaYaYaw.R#x#UaYbnaw#x.R#I.R#I#x#xaYaw.NaYaw.N.N.s#D.s.saw#I.CaoaoaO.F#vaOaO.8#vbc#va#aO#vaO.5.8aCaFaO#SaOaOao#I#x#MaYawbnbnaCa0b#a##va#a##vaZaZ#uazazbh.Galay.2alaFaOaFamaCa0aC.C#I#x#x#I#x#xaY#IaY#I#x#I#x#x#I#xbl#D#M#D#D#s#D#D.n.7.n.7.n.7.7.Eaf#L#L#L.7aj#L#Lajaf#La9.7a9a9.7bl#DaY.NaYaY#x#xaCa0#x#xbnawaY#D#Da9#D#DawaY#x#I#xaYaY#D#Da9a9a9", -".7#L.Eaf#L#Laj#L#L#L#g#L#g#L#g#g.ja2a2#ga2bp#L#L#Laf#L.7.7a9.7#Dblaw#x.W.5az#aalaZb#a0bnaYaY#DaY#p#Da9afa9a9#L#Laja9aja9#La9aja9.na9#sbl.n.NblaYaw.R#xawbnaY#U#U#x.R#Ibn#I#x#I#xawaYaY.saY.s.N.N.s.saw.W.Waobc.yaBaB#u#S.y.y#va#aB#u.Qaz.waBaZ.yaZaB.0aBaB#vaO.5bn.Vb#am#Sa#aB#u.wbhazazbh.waz.GarazaSaz#a#a#a#ea0a0#Ubn#x#I#x#xaY#MaYblblawbl.NblaYaYaY#U#IaYaY#D#M#D#s#D#D.n#D.7a9.7a9.7a9.7a9#L#L.7af#L.7af.7af#L#L.na9a9bja9#D#D#DawaYbfaw#xbna0#x#UaYaYaYbl.n#Dbl#DaY.N#xaY#xaYaY#D#Da9a9.7", -"#L#L#L#L.7#L#L#L#g#ga2#g#g#ga2bpa2#ga2a2#ga2#L#L.7#Laja9#La9#sa9.NaYaY.Wambk#zaraFamambnaYblaYbl#Dbla9a9.7a9.7a9a9.7a9a9.na9a9a9#Da9bl#DblawaY.N.RaYbnbnbn#Ubnbn#I#U#x#x#x#I#x#Ibl.Naw.NaYbf#I#x.s#x.WamaO.y#uazal.U#z.U#T.G.GaP#Tal#z.U#3al.Ualal#T.G#T.G#e.w.wa7#ua7a7aS.G#e#TaS.w.wanaz.wazaS#vaOa##va#aFaFam#UaY#xaYaY.NaY.s#D#D#D#s#D#D#D#s#D#saY.saY.NaY#sbl#D#M#D#D#Dbj#D.n#L.E#L.E#L#L#L.E#L#Laj#L#L#L#L#Laf#La9.7#Da9#D#D#DblbfaY.N#xaY.C#I#x#xaYaYaY#Dbl#D#D#Dblaw.NaYaYaYaY#D#pa9#La9", -"#L#L.7aj#L#L#L#L#g#L#gbpa2bpa2#ga2asa2#g#La2#L#L#L#L#La9.7.7#D#sbl.N#Ia0#vaz#z#eam.Va0bnaYaYaYaY#Dbl#D#Da9a9.7.7a9a9a9.7#Da9#sa9bl#sbl.sbl.NblawaYbn#Ubn#Ibn.C#Ubn#x#U#x#I#x#IbfaYaw.NaY.N.saYboaYaCam.y#u#aau#4aH.4#..4aHbrbw#0.2bw.2aT.2ay.YaH#4#zal.o#T#Tal.U#aar.G.Ga4aPa4a4.ya#aZ.ya#a#a#aOa0bnaCbnaCbn#I#xblaYaY.s#D#sa9#Da9.na9a9a9.na9a9#D#D#D#D#s#D#s#D#D#s#D#D.n.7.E.7.n.7#La9#La9.E#Laf#La9#L.7#L.7afaj#L#La9a9.n#D.7bl#D#DaY.NaY#x#xbn#x.R#xaYaYaY#DaY#Dbl#D#D#DaYaYaYaYaY#D#Da9a9a9", -"#L#Laf#L#L#L#L#La2#ga2#g#ga2#g#La2a2#ga2#ga2#L#L#L.E#L.7.n.7a9#D#D#I#xaoby.w#zaSa0aCa0bn#x.Rblblbl#D#D#D#D.7a9.Ea9.7a9a9.n.7a9a9#sbl#DblaYaw#x#x#xa0#xa0a0a0aCa0#I#U#x#I#x#I#xawaY#x#I.Nawbf#x#IaCbgaBaza6aT#P.uaybaay#3#aar.Gazaz.Gazaz.Gar#aa6.w#u#uaBaZaB#uazazazaS.0#S.0aFa#am.5aoa0am.Wam.C#I#x#x#I#x#I#xaw.N.N#s.N.N#Dbj#s#D#D.7.7.7#D#s.7a9.Ea9a9a9a9a9a9#s#p.na9bj#Dbjbj#Lajafaj#L#L#Laf.E#L#L#L#Laj#L#Laf#Laf.7a9bja9#D#D#DawaY#x.s#xaY#x#x#x#IaYaYawaYbl#D#D#DblaY#s#DaYaYaw#D#Daf.7af", -"#L.7#L#L#L#L#L#L#L#gbpa2bp#g#L#La2#ga2a2#g#L#L#L#L#L.7a9#L.7#D#saY#x.C.8#va7albh.Ca0a0bnaY.RblblaY#Dbla9#Da9.7.7a9a9a9a9a9#D.n#Dbl#Dblaw#DaY#x#IbnbnaCa0#Ua0aCa0.CaC#x#I#x#I#Ibf#x#I#x#I#x#Ibo.C.paOa7#aay.K.K.K#Ear.faZa7#uaBaB#vbmaBaZa7an.TaZaOaF.FaFaOb#b##SaZ#va#aOama0.W#xavam.C.W.C#xaw#x#x#Ibfbf#xbf.N.N.saYaY#D.N.E#D.7a9#D#s.7#s#D#D#sa9.7a9.7.E.7.Ea9#s#D#s#D#s#D.Ea9.Eaf.E#Lajafaj#L.7#L.n.7#La9#L.E#Laf#L.na9#D.7a9#Dbl.NaY.NaY#x#x#x#U#x.RaYaYaYaY.N#xbl#D#D#D#DblaYaYaYbl#Da9a9.7", -"#L.3a2a2a2a2asa2#ga2a2#ga2a2#ga2#ga2#ga2a2#ga2#L#L#Laj#L#L.7b..7#x#I#x#xaC#uar#e#Sa0.CaYaY#DaYaYa9#p#pa9a9a9a9a9#s#D#sbj#D#D#D#D#saYaY.Naw#x#x.Ca0aoa0a0aCbn#Ibnaw#U#U.CaCamaCaCaw#Mbn#UbnaCbgaoaZanaral.2alaPan.y.0.yaB.0a#a#a#.8aF#v.0#u.0#v.5aCam.8amaOamaoam.F.tbg#x.C.C#xaY.NaY.saY.Nawbf.N.N.N#D.s#D.N#D.Nbl#sbl#s#D#D#D.7.Ea9.7a9.7a9.7.7a9#s#D#D#Da9#D#D.na9.na9.na9a9.na9a9a9.naf#Lafaf.E#L.7#L#L#L#L#Lafaj#L#L#La9.na9bl#MblaYaY.baYaYbl#Dbl#DaYawaYaY#M#D#DaY#Dbl#D#DaYblbl#D#p#Dafa9", -"afa2#La2a2#gaa#ga2a2bpa2#L#g#L#ga2a2#g#L#g#La2#g#L#L#Lbpaj#D.7bjaY.N.N#Iao#u#aayaFa0bnaYaYblaYaY#pa9a9blbl#D#M#D#Da9#Da9#Da9#s#Dbl#D#MaY#x#x#x.Wama0a0aCa0a0amao#Uaobg.8am.8amama0bgb#.8aFa#.0aZ#ua7#uaS#uanaBa#.8aFaOamaOamaCamb#ao.5a#.0#vaF.5a0a0aC.Ca0.Wa0am#ybgaC#xbf#I.NawaY.NaY.saY.NaYaw#D.s.N.N.N.s.N.sbl#sbl#D#D#D.n#D.7a9.7.n.7.n.7.n#D#D#s#D#s#Da9#Daja9a9.nafa9aja9aja9aja9af#L.n#L.7af.Eaf.E#L.7#Laf#Lafaf#La9.7a9blblblawaYaY.baY#Mbl#DaYaYaYaYaY.NaY#Dbl#s#Dbl#D#MaYa9bl#D#Da9a9", -"afaf#La2a2a2#ga2#ga2a2#ga2a2#ga2bpa2a2#ga2#ga2#g#L#g#L#L#Lbj.Ebjaw#D.s#xaoana6abaOam#xaYaY#DaY.N#pa9#p#sbl#Dbl#D.n#D.na9.na9a9a9#sbl#DaY#I#x.Wbnb#bgb#amamao.8aFamaO.yaZ#u#u#S#vaZan.yaZaZ.6aSa4aBaZbma#aF.5ama0aCa0.CaCa0a0a0.Wbna0a0aoam.5aoa0#I#x#xbn#I#x#x#x.p.Vbn#x#I.NaYbl.N.NaY.N.NaY.N.NaYaY#DawblaY#DaYblaYblawaY.s#D#D.na9a9a9a9a9a9a9a9#D#D#Da9a9bja9a9.nafa9.Ea9a9.na9.na9.n#Lajaf#L.n#L.7#L#L#Laj#Lajaf#L#Laja9a9a9blblblaYaYaYaYaYbl#D#MblaYaYaYaYbl#saY#D#D#D.NaYblaYbl#D#p#Dafa9", -"afajaf#La2a2a2a2a2#g#L#g#L#g#La2#ga2bpa2#La2bpa2aj#Lbp#Lajbj.7#s#D#Daw.C#v.GaTaD#vb#a0bnawaYaYaYaYblaYaYaYawaYaw#D#D#D#D#D#D#s#Dbl#saYaw#xa0a0a0bgamaOamaOa#a#a#.yan#u.G.Gaz.w.w#u#uan#uan.w.6.GaFaOaFaoaobn#I#x#I#x#I#x#x#I#xaY#x#I#xbn.CaC.Ca0#x#x#IaY#xawaYaw.R.bbnawblaYaw#DaY.saY.Naw.N#M.N#D#s#DaY.N.saY.NawaYaw#Dbl#DaYaY#D#s#D#s#D#s#Db.a9#D#s#D#s#D.n#Daf#L.na9aja9aja9afa9aja9afaf.7af.7#La9aj.7a9#L.7afaj#Laf#La9a9a9.na9blblaYawaYaYblbl#Dbl.saYaYawblaY#D#Dbl#DblblaYblbl#Dbl#Da9a9", -"a9a9#L#L#L#L.jbpa2a2aja2#ga2#ga2#L#ga2#ga2#ga2#L#g#L#L#L#Lbj#s#D#saw#Iaq.y#3aH#Pa#bga0#UaYaY#xaYaYawaYaYaY#x.N#x.Naw.Naw.N.NaY.s#DblawbnaCamb#bgaFbma##S.0aB#u.yaz.w.waz.w#u.0a##SaFbma##Sa##Sa#amamaoa0#x#IaYawaYblawaYawaY#M.NaYaYawaY#I#x#x#U#x#x#xawaYaY#D#MaY#x.b#x#UaYaY#Daw#DaY#D#D#D#D#Dbl#Dbl#sblblbl#MaY.RaYaYawaY.s.Nbl#Dbl#D#Dbl#Dbl#D#s#D#D#D.7#D#Dajaf#La9.na9a9.na9.na9a9.n#Lajaf.E#L.7#La9aj.7#Lafaf#Laf#La9.Ea9a9#p.nblblaYaYaY#Dblbl.NblaYaYaY.Nbl#D#D#D#DaY#DaYblblbla9#Dafa9", -"a9afa9ajafbpa2#L#ga2bpa2#L#g#La2bpa2a2bpa2#L#ga2#L#Lbp.7aj.7#Db.bl#x.Waobb.2a6ak#vb#a0#x.RaY#xaYaYaY.R#x#x#x#I#xawaYaYaYaY#xaw#xaYaw.Ca0b#aF#vaZaZana7.waz.G.Ga7#uaBaB.0a#aFamambnbnaCa0a0aCa0a0aoa0#IaYaw.Nbl.NaY#MaYbl#DblaY#DawaY.Nblbl#xbn.Ca0#I#xaY.N#Mbl#DawaY#Ibn#Ubn#I#x#D#D#D#D#D#D#s#D#D#saY#Dbl.s#DaYblaYaYawaYaYaYblbl.nbl.nbl.nbl.n#D#D#D#s#D#D#s#D#Lafaja9#paja9aja9af.naf.naf#Laf.7aja9aj.7#Laf.7afajaf#Laja9a9a9afa9#Dbl#sbl.Nblbl#sblaYaYaYaYaY#DaYaY#Dbl#DaYblaY#MaY#Dbl#Da9a9", -"a9a9afa9#L#L#La2#ga2#La2#ga2a2#ga2#ga2a2#ga2a2bp#L.j#L#L.7#sbj#saY#Iaq.y.waXaraS#vb#a0#UaYaYawaYaYaYbn#x#U.Cbn.Caqaqavaqavaqaqaq#Ia0ao.5#vana7bh.Ga6al#aarbkaz#uaOamam.Cao#x#IaY#I#x#I#x#I#x#xawbn#xaw#D#D#D.sbfaY.N.saY.saY#D#D.Naw.N#saY.s.Cava0am.C#IaYaY#D#M.N#x.bbnaCa0a0#x#s#D#s#D#Da9#Da9blblbl#Mblblbl#MaYawblaYaYawaY.saYaYaYaYblblblbl#s#D#D#D#D#s#D#Daja9af.nafa9.na9.na9a9.na9#Lajaf.7af.7#L.n#L.E#Laf#L#Laf#La9a9.7a9a9a9a9#D#D#M#Dbl#Dblaw#DaYawaYaY#saYbl.Naw#DaYawblaYblbla9a9af", -"afa9.7a9#L#L#L#L#La2#g#La2bpa2bpa2#L#g#L#g#L#ga2#Lbp#Laj.7bj.s#D.Waoao.waX#aazaSaFa0#xaYaYaYaYaYaYaY#xa0a0.Caoa0.8.8.5ao.5amaoamaCaoam#v#ubh.G#eayaTay.Gaza7aBa#aoaC.CaC.CaYaY#Mbf#x#xaY#xawaYaY.NaYaw#D#s.N#xaNaw.Nbl.Nbl.N.N#s#x.NaY#D.NaY#xaqa0aoa0#x.NaY#MaY#x#xbnbn.Vamaoam#D#D#D#s#D#sbja9.N#M.Nbl.N#M.NblblaY.RawaYaYaYaYblawblaYawaYawaY#D#s#D#M#D#D#D#Daf#L#La9a9.naf#La9af.n#L.nafafa9aj.7aj.7#L.7#L.Eafaj#Laf#La9a9a9aja9a9.na9bl#D#D#DblblaYaYaYaYaYaY#DaY#DaYblbl#DaYaYbl#sbl#Da9a9", -".7a9a9.7a9a9.7a9#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#L#Lafa9a9#D#sbl.s.Waoan.G#Ea7aBaZ#vaFama0aCamamamb#.Va0aC.VaO.0#uaSaSazazan.Gak#a.Iay.Iar.Xar.Gazaz#uaB.yaO.5aoa0#Iaw.NaY.saY.N.N#D#s#D.N.N.N.N.s.NaY.NaY.NaY.saYa9bl#sbl#sbl.nbl#D#s#DawaY.saYawaY#x#U.CaC#xbf.N.s#I#x#Ia0aoamambf#I.N#D#DaYaY#Dbl#D#Dbl#D#Dbl#D#M#Dbl#Daw#D#M#DaYaYawaYblblaY#D.na9a9.na9.najaf.nafajaj#L#L#Laj#L.E#L.n#L.E#Lajaf#Laja9aja9.7a9#Lafafaj#L#Lajafa9a9a9bja9#D#D#sblaY#MaYaYaYaYaYaYaYawaYaYaY#xaY#UaYaYbl#Dafa9#L", -"a9bja9a9.7a9a9.7#L#L#L#L#L#L#L#L.E#L#L#L#L#L#L.7aj#L#sa9#saY.saYbo.5.w.GazaB#San.l#vbgama0#xama0ama0a0bgaFbmanazak#aar#eazaz#aa6.e.e.XaraSazbhan#S#v#vaFaoa0aC.Cawaw.Naw.Naw.Naw#Da9#s#D.s.N.s.N.NaY.s.Naw.NaY.Nbl#saYblbl#Dbl#D#D#DaY#D.NaY.N#x#Ibna0a0a0.C#I#x#x#I#xaCamaFaOamaYaYaYaY.N.Nawbl#s#Dbl#D#sbl#D#Dbl#Daw#Dbl#Dbl#D#Mblblblaw#Dawbl.na9.na9.na9a9.naf.n#L.7aj#Laj#Laja9aj.7aja9aj.7#L.Eaf.7#L.7af.7afaj#L#Laf#Laf#La9.7a9a9b.a9#D#DaYblaYaYblaYaYaw.RaYbnaY#U#xbnbna0aYaYaYbl#Da9a9", -"a9a9a9a9a9a9a9a9#L#L#L#L#L#Laf#Laf#Laf#L#Laf#Lafa9a9a9#D#D.Naw.N#x.8.w#e.lbma#az#uaZaFa0aC#x#x#x#x.WamamaF.y#ealayaG.G#eanaS#e#a.I#a.X.JanaZ#Sa#aOambga0.W#x#x.saY#saY.NaY.NaY.N#D#D#DaY.NaYaY#xawaYaYaYaYaY.saY#Dbl.N#M.Nawbl#D#M#D#MaYawaY#x#xbnaCam.8.5amamaCa0a0aob#aOaObm#v#x#I#x#xaY.N.NaY#Dbl#Dbl#D#Dbl#D#Dbl#Dbl#Dbl.sbl.N#Daw.NblaYblaYa9.n#p#sbl#Ma9bl.na9.na9.7.E.7.7.na9.na9a9.Ea9.n.7aja9.na9.Ea9.7af.7af#Laf#L#Lafa9a9a9#Da9#D#D#DblaYblaYawaYaY.R#xawaYaYaYbn.Cbn#xaYaYaY#D#D#D#D", -"a9a9a9a9a9.7a9a9a9a9a9#Laf#L#L#La9.7.na9a9a9a9a9a9a9#s#D#s#D.Nbl#I#v.G.G#uaF#van#uaZ.8a0bnbnawbnavam.5#van#ealbra6#a#e.wana7#e#e.fakaz.TaBa#a#aFa0aoa0.Wbn.s#M.N#saY.sbl.saY.saY#s.Naw.Naw.N#I.N#x#I#x#x#IaYaY#IaYawaYawaYaY#xawaYaYaY.NaY#x#x#Iamb#aFa#a#aOamamamaob#b#aF#Sbmbmaoa0#x#xawbl#D#D#Dbl#D#sbl#Dbl#sbl#D#D#sbl#D#D#D#Mbl#DawblaY#saY#Mbl#Dbl#M#D#M#M#Da9#sa9.n#D#D#sa9.Ea9b..na9.7a9.na9.n.7.7a9.7a9aj#Lafaj#Lafaj#La9.Ea9.7#D.E#D#DblaY#MaYaYaYaYaYaY.R#x.R#xbn#U#xbnbnaYaYbl#Dbl#D", -"a9a9a9a9afa9afa9af.nafaf#Lafa9a9afa9a9a9a9.na9.n#D#D#D#D#D#Daw.N#I.y.GazaZb#aOa#anaBa#aoa0aCbna0a0.5.8an.G.2.K#P#q#e.6anan.wazakazbha7aZaFam.8am#xaC.C#I#IaY#D#saY#saY.NaY.NaY.NblaYblaYaY#I#x#x#x#x#I#x#x#x#xaYaYbn#xbn#U#x.baY#x.s#x#x#I.Ca0.CbgaF#vbma#a#aOambgamb#aoaFaFaOaF#va0#x#I#x.Na9#D#s#Dbl#D#Dbl#D#Dbl#Dbl#D#Dbl#Dbl#DaYblaY#Dawbl#DaYaY#MaYawaYawaY.nbl#p#sa9#sa9#D#s#D#Da9#D.n#D.na9.na9a9.n#Da9#D#Lajaf#Laf#Laf#La9a9a9#Da9#Da9#DaYblaYaYblaYawbnawaYaYaYaYbn.Cbna0.Cbn#xaYaY#Da9", -"#pa9a9a9a9a9a9a9a9a9a9a9a9a9a9.na9a9a9a9a9a9#Da9#D#s#D#s#DaY.NaYaCaZ.6az.0aOaF#van#uan#vamamamamaOa#analba.g#P#P#a#Tan.y#uaZaza7an.laZa#bgama0.C#U.C#U#I.N#s#s#D#s.Naw.N#M.NaY.saYaw.Naw#x#x#x#U#x.baYbnaw#xawaY#Ubn#U#x#Ubn#xbn#xbn#Ia0a0a0aCa0b#.t.tbma#aFaFb#amamamam.Vb#b#.V#Sbga0#x#xbl#D#Dbl#Dbl#Dbl#s#Dbl#D#M#D#Dbl#sbl#Dblaw#DawblaY#DaYawaYaYaY#Ibn#Ibn#Mbl#s#D#D#Db.#D#sa9#s#s#s#D#s#D.n#D.na9#D#D#s#Dafafaf#L#Laf#L#La9a9.7.nbja9bj#DblawblaYaYaYaYaYaYaY#x.R#x#xbnbnbnawaYaYbl#Da9a9", -"a9a9#pa9#pa9#pa9a9a9a9a9a9a9#pa9a9.n#p.nbl.n#pa9#D#D#D#D#D.Nawbfbn#vazaS#SaF.8#vaZ.6aBa##va##v.0a7.faG#PaD#V.Kay.XazanaB.0#vbm#SbmaZ#vamama0aC#xa0.W#x#x#I.N#D#s.N#M.NaY.NaY.saYaYaYaYaYawbn#x#x#x#xbn#Ibn#x#x#xbn#xa0bna0bnaCbn#xa0#x#xbn.Ca0am.V.Vb#aOaFb#bgamaC.C.CaCa0a0aCa0a#aFbgbnaY.N#D.7#D#M#D#Dbl#Dbl#D#D#Dbl#D#Dbl#D#D#M.NblaY#DawblaYaY#Ibn#Ibn#Ubn#IaYawaYawaYawaY.s#D#s#Da9#sa9#s#D#sa9#Dbl#s#D#D#Daj#L#Lafaj#Lafaja9a9a9#Da9#D#Da9blaYblaYawaY.R#xaY#M.RaYawbna0#IaYbl#Da9a9afafa2", -"#pafa9afa9a9a9a9#pa9#pa9afa9a9a9#p#p#D#pbl#p.na9#D#D#D#DaY.NaY#Ia0#v.Gaz.0#vaF#vanaz.w#u.0#u.waP#A.f.Xa6.Ia6akaSanaZa#aFaoaFaOaF#SaFaFama0aC#x#x.Wa0.W#Ibf.N#sbj#M.N.saY#s.NaY.NaYaYaw#xaY#x#I#x.R#x#x#x#xaYbnaY.Cbnbn#xbn#x#xbn#x#I#xbn#xa0.Ca0.pb#b#aFb#aFb#.V.C.C#x.CaCa0#xa0.FaFaOa0aYbl#D#sbl#D#Dbl#Dbl#s#Dbl#D#M#Dbl#D#M.Nbl#DaYblawaY.saY#UaYbn#x#U#x#Ubnaw.Rawblaw.NawaY#s#s#s#s#D#s#D#sbl#Mbl.n#Dblbl#Dafaj#Laf#Laf#L#La9.7a9.7#s.7#DbjblaYblaYaYaYaYaYblaY#xaY#x#xbnaYbla9#p#p.naf#La2", -"#L#La9a9a9afa9af.j#L#La2af#La9a9#sa9#s#D#DaYaYblawaYaY#I#xbn.Ca0#Ubg.laz#uaBanaBa6#a.Xa6#aak#ebh#Sbm.Fa#aFb#amaoa0aCa0aoa0amb#.8b#aoa0aCa0#xaC#x#I#xaY.N#M#D#D#s#D#sa9.7a9.7.n.7#D#D#D#s#DaYaYaY#sbl#Mbl#Dbl#D#Dawbl.Naw.NaYaYawaYaYaYaw#DaYbl#DaY.RaYaYbnbna0a0#Ubnbn#x#x#x#I#xa0bgaBb#a0.s.s#L.NaY.N.saY.N.NaYbl.NblaY#I#x#x#x#Mbl#MaYaY#x.b#x#xbn.Wambgamamam#Ua0bnaCa0a0amaoaw#x#x#x#I#Iaw#Mblbl#sblbl#D#D#Da9#pa9a9a9a9#Laf.na9a9a9a9#paf#pa9a9#MaYaY#x#xbnaw.RaYbna0a0a0aY#D#pa9a9#La9#L#L", -"#L.7#Laf.7a9.7a9#Laf#Laf#La9.7#Da9a9blbl.Nbl#DaY#xaYaY#xaCa0amam.t#uazar#e#T#a#zacbaayaraS#uaZa#aFaFaFb#amaoama0a0a0aCa0a0ama0amaoa0a0a0aC#xaC#xbn#I.saY.s#D#sa9a9#sa9a9.Ea9.7a9#D#s#DaY#D#D#s.Nbl#D#D#D#D#Dbl#DaY#DaY#Dblbl#DaY#D#Dbl#DaYbl.NaY.baYaYaYa0#Ia0a0#x#UaY#x#U#x#xaYbnam.FaOa0#x.s.7aY.saY.NaY.NaY.sblawaY.N#x#Ibn#xaYawaY#xawbnaY#U#x#IaCa0aCbg.paobn#U#Ua0aCaCaCb#aCaC.C.Wa0.C.baYawawaYblaw#D.s.Nbla9#p.nafa9ajafa9#pa9#pafa9a9a9#pa9blaYaY.b#xaYaYawa0#xa0a0#UaYbla9a9a9a9#L.7#L", -"#Laf#La9.7af.7af#L#Laja9.7a9a9bj#D#D#D#MaY.NaYaY#MaY#Ua0amam.5.5aSal#PabbrayaTaTaGara7aZaZaZbm#vb#amamaCa0#x.C#x#I#x#x.CaC.CaC.5b#aob#aCamaC#xbn#I#xaY.s#D#sa9#s#Da9.Ea9.7a9.Ea9#D#D#D#D#s#D#D#D#Dbl#D#M#Dbl#sbl#DaYblaY.saY#DaY#MaY.Nbl.sbl#D#DaYaY.baYaYbn.CbnbnaYaYbn#x#x#x#xaYbnam#Sama0.N#s.NaY.Naw.Naw.NaY.NblaYaw#x#x#x#IaYaYawbl#x#I#xa0#Ia0aC.pbgb#bgb#.pa0.V.pb#.Vb#bgbm.taOaFaFao#U#x.bbn#IaYaYaY.NaYbl#Dbl#Da9a9a9a9a9a9a9a9a9a9.na9a9a9bl#DblaY#x#xaY.R#xaCama0#x#xbl#s#Daf.7af.7#L", -"#L#L.7a9.7a9a9.7af#La9a9a9#D#D#D#D#MaYaY.N#x#I#x#xaY#x#xamaO.0bbaT#PaD#VaTaRar#eaBaZbmaFaFamb#ama0aCama0.C.C#x#I#xaY#I#x#x.W.CaCaOaFaob#aoamaC.C#I.b.NaY#s#Da9.7.n.7a9.7.n.7a9.7#D#D#D#D#D#D#D#D#D#M#D#Dbl#D#Dbl#D#D#sbl#Dbl#D#D#D#D#Dbl#D#Dbl#DaYaYaYbn#x#x#x#IaYbnaY#IaY#xaY#IaYbna0aBbmao#x.NaY.saY.NaY.NaY.saYaw.NaY#x#I#x#xaw#x.N#I.C.CavaCaFaOa#aBa##vbm#Sbm.taFbmbmaZaBbh#kbhbhaZ#Sa#b#a0aCa0a0#U#xaYaw.Nbl#Mbl.n#D.n.7a9a9.na9a9#sa9#Da9a9a9.n#D#D#xaY#xawaYbnama0ambnaYblbl#Da9#Da9#L.7", -"a9a9a9afa9#La9a9.na9a9bj.n#D#D#saY.NaY#x#x#x#x#x#Ubnambga#.0#u#uaH#4#aazanaBaZbm#SaFaOb#bgamamama0.C.C.W.C#Ibf#xbf#I#x#x.C.Cao.8a#aOaOamaoa0.Wa0aY#xaw.N#D#s.7a9.7.n.7a9.7#L.7aj#D#D#s#D#D#D#s#D#D#Dbl#D#Dbl#D#Dbl#D#D#Dbl#D#Dbl#D#Dbl#D#D#D#DblaY.NaYawaY#xbn#xaYaYaYbn#x#x#x#x#U#xamaBaBaBa0.Caw#xaY#IaY#xaY#x#x#x#Ibn#xa0.Wa0.CaoamamaCamao.5azaz.G.Gar#e.G#a#eaz#ear#e#a.X#a#jaGak.faSaZ#vb#ambga0a0a0#I#x#xaw#xblaY#Da9#Da9#D#D#Da9#Da9#Da9.na9a9#D#DblaY#x.Rbna0.Cama0#x#xbl#Dbla9#D.7.7a9", -"a9.7a9.7a9.na9.7a9.7#s#D#D#D#D.N#x#x#x#I#x#x.Ca0amaOa#.yanaBan#u.6aBa#amb#a0b#amamb#amamamaoa0aoa0aCambn.C.C#x#Ia0.C.CaCamao.5aO#vaFaOb#aoa0a0.WaYaw.NaY#s#D.7.n.7a9.7.n.7a9.7a9#D#D#D#D#D#D#D#Dbl#D#Dbl#D#Dbl#D#D#Dbl#D#D#D#D#Dbl#D#D#D#Dbl#D#D#sbl#D.NaYaYaY#xaYaYaY#xaYaYaY#xaYa0a0bmaz#uaOam.C.W.C.C.C.C.W#x.W#xamamamaoam.5aoaF#v.y.0#uaB.wal.2ayal.2aya6aTa6alaR.2ayayaT#P#t.K.e.X.GaSaZaBaFb#amaoa0a0bna0aYaYawblbl#sa9bj.n.7#D.7a9bja9#Dafa9afa9bl.Naw.N#U.CaCaFaoamama0aYaY#D#D#Da9#L.7", -"a9a9.na9.7a9a9a9a9#D#D.N#s#DaY.saY#x.C.Ca0aoamao.0aZaBaZaB.0aBa#amb#a0aCaC.pa0a0aob#ama0am.C.Ca0.5b#amaCam.W.C.CaCa0ao.5amaOaF#vaF.8amamama0aqa0aYaw.Naw#D#Da9.7.n.7a9.7.7af.E#L#Da9#Da9#Da9#Da9#Da9#Da9#Da9#Da9a9a9afa9afa9afa9a9a9a9a9a9a9a9a9bl#D#Dbl.N.NaYaYaY.RawbnaY#x#I#xawa0b##Sazbha##vamaqao.Cavamao.5ao.5.8.8aF#v.0.yaZaB.waza7az.G.G#aararar.X#a.Xar#eazazaralalalayayaya6.Ial.XaSaS#va#aFaO.5aC.CaC#xbnaY.N#M#D#D#D.7a9.7.Ea9.7.7.Eaf#La9#D#D.N.NaYbnbnamamb#aoama0aYawblaY#D#D#D.7", -".7a9.7a9a9a9.Ea9bja9#s.NaYaw.NaYa0.Wa0aCamamao.5a7az.waZa#aFaFaFamamaC#xbn#xam.5amamamaoama0aoa0aOaFaoambgamaCam.8aFaOaFaOaFaF#vaFaFaOb#aoamaCamawaY.Naw#D#D.Ea9.7a9.7.n.7.7a9.7#D#D#D#D#D#D#D#D#D#Dbl#D#Mbl#D#Ma9a9a9a9a9a9a9a9.na9a9.na9a9.na9#D#D#D#DblaY.saYaYaYaY#xaY#xaY#xaYbnaObmazaZ#Sa#.8.8.8.5am.8.5.8a##va#.ybbbb.w#uazarar#a#eazaSaz#ua7aZaZaZaZ.Tbm#SbmbmaZan#uaSaz#aalaR.2.IaGaraSaZaBa#aFaoama0aC.R#IawaYbl#D#D#Da9.7.7a9.7.7a9.7af#L.na9#D#s.N.NaYaCamaoaFamama0aYaYaY#D#D#Dbj#D", -".N.N.N.N#D#D#D#DawaY.Nbf#xaqaqavamamaF#v.0#u.w#e#va#b#.5amamamaF#I#x#x#x#Ia0#x#x#x#I#x#xa0ao.5amamaoaFa#a#aBaZaZ.TaBaZ#SaFaFaF.5ao.5aoam.C.W#x#xaYaY.saY.N#s#D#Dajafaja9a9a9.7a9#Da9bja9#D.7#Da9#Dbl#Dbl#D#Dbl#D#Da9.7a9.7a9a9bja9#Da9#D#D#Dbl.Nbl#Dbl#D#D#Dbl.NaYaYaYaYaYawaYaY.Nbfa0b#bmaBana#bma#bm#u.6#T.oaR.Gararal#aalalal#Taraz.6#uan.0.0b#.8b#aob#aoambgamam.8aoamaO.8aFaBbhaz.Gar.X.X#abhazan.TaZbmbma#aCa0#xaYbfaY#s#D.s.N#D#D#sa9.7.7#s.7.7.7a9a9#D.7#DaYam.5aOa#amambf.N.N#s#D.NaYbf", -"aYaYaY.saY#s#D#D#D.s#x.Wao.8aq.5.yaB#uanaBan#uanaFaOamaob#aoamaobn#x#U.Ca0.C.C.Wbna0a0aoaF.5#va#.ya#.yaBaZaBbh#u#SaBaZaOa#.8aFbg.5aoamaobn.Cbn#x.sbl.NaY#D#Da9#Daf#L#La9.7a9a9.7#D#D#D#D#D#D#D#Dbl#Dbl#DaY#DaY#D#Da9a9.7a9#D.7a9a9a9a9#Dbl#D#D#D#D#D#D#D#D#D#D#DaYaYaYaYaYaYaYaY.N#x#xbgaFaZ#ua#bgaF#vanaz#ealalazazaz.Garaz#q#ebhananaZaZa#a#a#aCama0a0aoa0ama0aqaoamamaFaoam.8a##SaZ#uana7aSbhaBaZaZbmaOaFaOaFb#ambnbn#IaY.NaY#D#D#D#D.7.7b..7#D#Da9.7#s#D.n#D#MaY#Iama#aFaoa0#x.saY#D#Dbl.N#x", -".Nbo.N.N#xbf#xbf#x#Ia0a0aOa#aBaz.GaP.wan.ya#a#a#aCamambgama0a0a0.Wa0.C#xa0a0a0amamaoaFama#a#.0#vaSazbh#uanaBanaZa#aOaFaO.5aOaqamaoama0.C.C#Ibn#IaYaYaw#D#s#D.E.7#Laf#La9a9.7a9a9.7a9.7a9.7a9.7a9#D#D#D#D#Dbl#D#Da9.7#Da9.7a9.7#Da9.na9a9#D#Dbl#Dbl#Dbl#Dbl#D#D#p#D#D#D#D#D#D#D#D.N#DaYa0b##SaBaZamamaF#v.0#u.6.wan#u#uaSananaZaBa##vaFaFaoamamama0a0aCa0bna0#xaCa0a0.Cao.CaoamaoaF.5aOaFaFa#aFaFaF.5aoamaFamaFaob#bga0aobnbn#x#x#M#Dbl#s#Da9.7a9.s#D#D#D.N#DaY.N#Daw#xa0aoaF.5b##IaYaY#DawaYaw#x", -".N.N#Ibf#x.W.C.W.5#v.yaZ.G#z.Kba.o#e.w.0a#a##va#amamaOaFaOaFbgamama0amaoam.8.5.5a#aFaFa#aBan#ubh#a.Xar.Gbh#uaZaBaO.5aoamamaC.C.Wa0a0.W.C#I#x#x#xaY#saY#D#D.7af.7af#L#La9a9.7#D.7#Da9.7a9.7a9bja9a9a9a9a9a9a9a9afa9.7a9.7#L.7a9afa9a9a9a9a9#Da9#D#Dbl#D#D#D#p#D#D#D#D#Dbl#Dbl#Dbl.s.NaY#xa0a#aB.0amamamaFa#a#a#a#aBaZaZaZ#va#.0a#b#b#bgamambn.Cbn.Wa0.C.C.C.Wa0.C.C.C.Wa0.Ca0.Ca0aoamama0a0bn#Ubn.Wa0.Ca0.W.C#U#xb#.Vb#b#a0ama0a0aYaY#D#D#D#s#D#saYaY.s.NaYaw.NawaYaY#Ia0amamaOam.C#x#xaYaw#x#x.C", -".C.W.Caqaq.5.5.5anaP.o.Ya8#obs.g#TaS.wan.0#va##v.0bm.0a#.0a#a#.yamaoaFamaOa#aOa##va##S.0aZ#uaSaz#aaG#a.Gaz#uan#u#vaOam.8aCaq.W.C.C.Wa0#x#x#x#IaYawbl#D#sa9a9#L#Lajaf#L.na9a9.7a9.7a9#D.7#Da9.7a9a9a9af.7afa9.7a9.7af#L#Laf#La9.7afafa9.na9a9bl#Da9.na9a9a9a9a9afa9.na9a9.7a9a9a9.N#D.N#M#xaOaZaBamaOam.8am.8a#.5a##va#aoaFaFamamaoa0a0bnaC#x#x#x#x#I#xaY#xaY#xaY#I#x#x#x#I#x#I#xa0bn#I#xawbl.Nbl.Naw.NaY.NaY#xaYaCa0ao.Vbgb#b#b#awbnaYaYblblaYbl.NawblaY.NaYaYaYawaY#x#Ia0bga#aOamaC.C#xa0.Wa0am", -"aoaFa#aOa##v.y.ya4.2#4.4a8aDaTaRanananaZaBaFaFaF#v.0#v.0#v.0#v.0amb#aob#amam.5aFamaOaFa##v.0.yaZaz.wanazaz.w.w.waO#vao.5aoamaCam.Wa0#x#xaw#xaYaY#D#M#Da9a9.E#L#L#L#Laf.7a9.7#Da9.7a9#L#L#L#L.7#L#L#L#L#L#L#L#La2#La2#L#L#L#L#L#Lafajafafa9a9a9afa9a9a9a9a9afa9a9a9.7a9.7a9a9.7a9.N#D#D#DaYam#SaZaF.5aFamamamamaoaFamamb#amamaoa0a0bnaC#x#x#xaY#IaYaYaYaYaYaYaYaY#xaY#IaYaYaYaYaY.s#xaY#D#D#D.7.n#D#D#D#M#D.N.saY#xa0a0amamambgambnbn#UaY#x#xaY.saY#x.NaYaw#x#I#x#x#I#xa0a0aF#vaZ.5a#amaCa0am#v.5", -"an#uan#uan#ua7#uaz#a.Gaz.GaSaZaZ#vbybca#.5aoamb#.5b#amb#amb#amb#aCama0amamaob#amaCa0a0aoaFaFa#byaOby#v.yaZaB#u#ua##v#S#v.5ao.5aoa0#I#xaY#x#IaYaw#Dbla9#s#L#L#La9#Laf#La9#La9.7a9#L#L.7af.7af#Laf#L#L#L#L#L#L#L#Laf#Lafa2af#L.3#Lafafafafa9afa9a9#Laf#Laf#L#Laf#L#L#L#L#L#L#L#L#L.s#D#s.7#DaCa##ua#.0.5.5amama0a0amaoamaCamaCa0#xbn#x#x#x#xawbfaY.N.N.N.s.N.N.s.Nbl.Nbl.NaY.NaY.Nbl#D#D#s.7.7#D.7a9.n#p#Dbl#DblaY#x#x#xbnbnama0am.Vama0b#aCa0#x#xbn#I#x#x#xbnbn#x.Ca0a0aCam#van.wan#vbyaF#va#.yan", -"alal.Ga7bhaZaZaZa##Sa#aFb#ao.5.8aFaFamama0amamaobn#Ubn#Ua0#Ibn#Ua0a0a0aCa0amamao#x#xaCa0aoamao.5avam.8.8#v.yaB#u#SaBaB#u#S#vaO.8amaCbn#x#I#xawaYbl#sa9a9#La9.7ajafaj#La9#L.7#Da9.7#Laf#L#L#L#L.7a2#ga2a2a2a2a2a2#La2#L#La2#L#L#La2af#Laf.na9a9a9af#Laf#La9af.7af#L#L#L#L#Laj#L#L#D#D.7#s#D.CaBbhbb.y.0aOama0aoa0ama0ama0bnbn#xaYaCbnbn#x#xaYaY.Naw.NaY.NaY.NaY.NaY#DaY#M#Dbl#M#D#Da9.7a9#Dbjb..7afa9.na9bl#DaY.N#Ibf.W#xaC.Ca0amamb#b#a0ama0ama0#xbn#x#U#x#U.C#UamaCama0ao.0.w.6.wan.yan.yan.waP", -"#q.6a#aF.5aCa0a0bnbna0aCa0amb#am#U.Vbnbn#xa0.C#x#x.NaY.NaY.N.N.N#D#s.NaY.NawaY.N#M.s.N#x.C.Wamaq#UaCaCb#bgaOa##vbg#v#v#u.w#uaZ.yaO.5aoama0.RaYaw#D#D.7.n#Laj#L#L#L#La2#La2#La2#g#Laf#L#L#L#La2#La2#L#La2#La2#L#La2af#L.3#Laf#Lafajaf#La2#La2#La2#L#L#Laf#La2#L#L#L#La2#L#Laf#L#La2#La9#D#x#xaoaO.Xbha#ama0#x#x.CaC.Ca0aC.C#x#IbnaYaYawaYaYaYaYaY.N#D#D#D#D#D#D#D#D#D#D#D#D#D#D#D.7.E.7.7.7af.7.7aj#L#L.7.E.N.N.NaY.N.N.N.NaY.NaYbl#IaYbna0aoaFaOamaoamamamaFaF.5b#aOa#a#aZ#u#a.2.waP.w.w.waZan#u", -".GanaB.5a0a0#xaCbn#Ibna0a0a0amam.Va0bnbn#x#x#I.C.NaY.Naw.N#s#D#D#D#D#s#D#D#D#saY#D#DaY.saY#x.W.Cbn#Ua0aCaoamaOaFaob##v#uaB.y#vaOa#aO.5bga0#U#x.R#D#D.n.7.7#Lbp#L#La2#L#g#L#g#La2#L#L#Lafa2a2#La2#L#La2#La2#La2#Lafa2#L#La2#La2#Laf#L#Laf#Laf#L#L#Laf#L#La2#La2#La2af#Lafa2#L.3#L.j#La9#DaY#xa0#v#aa7a#b#a0bn#x.C#x#x#x#x#xbn#x#x#IaYaYaYaYaYawaY#D#D#D#D#D#D#D#D#Da9#D#D#Dbj#Da9a9#La9af.E.7a9#Laf#Laf.7a9#D.N.N.saY.Nbl#DaY#D.NaYaYaY#xa0b#.5aFbga#aFaFbma#.ybm#vaZ#SaBan.G#q.2.w#u.6#uan.y.0.0", -".6#u.0b#a0#x#xa0bnbn#x#xbn#Ibn#x.RawaY#x#I#x#xbfaYaw.N#D#D.7.7.7a9#D#Da9#Da9#D#Da9a9#D#D.N.N#x#x#I#x#Ia0ao.8am.8aCa0bg#v#vaOb#aoaFaOaFama0a0#Ubn#s#D#Da9.E#L#Lajbpa2#ga2a2aja2#gafa2#La2#La2#La2#Laf#La2#L#Laf#La2#Laf#Laf#Laf#L#Laf#L#Laf#La2afa2#La2af#La2#L.3#La2a2#L#L#L#L#La2#La9#s.N#xa0bg.Xana#aFamam.C#xbn#xbn#x#x#x#xbnaYaYaYawaYaYaYaY#Da9#Da9#Da9#Da9.7#D.7a9.7a9a9.7.7.7.7.7a9#L.7.n#L#Laja9a9#D.saY#D.N#D#D#D#D.saY#DaYaYa0a0amb#aFbm#SbmaBaB#ubha7aB#u#uazaz#Tal#q#uanaB.0a#.0a##u", -"azaBa#aobn#x#x#x#x#x#Ibn#xaY#xaYaYaYaYaY.NaY.NaY#D#D#D#D#D.7a9.7#sa9a9bja9.7#D.Ea9bj.n#D#D.NaY.N#MaYaY#Ia0aoaoam#IaCa0ao.5ao.CaCbg.5b#aoa0aC#xa0aYaY#s.7a9#Lbp#La2bpa2#L#g#L#ga2#Laf#L#La2#La2#La2#La2#La2#La2#Lafa2#Laf#L#L#L.3aj#L#La2ajaf#L#La2#L#La2#La2#La2#La2#La2a2a2afa2#La2#L#DblaY#IamazaSaBaFama0#x.C#xaY#xaY#x#U#x#xaYaYaYaYaYaYaY#D#D#D#Dbj#D#Dbj#Da9a9a9.7a9a9bja9.7afa9aja9.7af.7#Lafa9a9#D#D#D#D#D#D#D#D#D#D#D.NaY#I#xbnaoamam.5a#bma#aZaZaZaZ#uaZanaz#q#TaR.o#q#uaB.0a#.0#uaZ#u", -"an#vb#a0#x#x#xaYaYblaYaYaYaYaYaYaYaYaYblaY.N.N.sbl#D#Da9#D.7a9#L#D.7#sa9.7a9.7#Da9a9#Da9a9#s#D.Naw#Daw#xaCa0.C#x#U#xaCaoaCa0#Ibna0a0aoa0aCa0a0#UaY#M#D#Da9.7#L.7a2a2#ga2a2#ga2#g#La2#La2#La2#La2#La2#La2#Laf#L#Laf#Lafaj#Laf#L#Lafa2af#L#La2#Lafa2#Laf#La2#La2#La2#La2#L#La2#L#La2#Laj#Dbl.NaY#UaZ.TaBaFam.C.C#xaYaYaYaYaYaY#x#xawaYaYaYaYaY#Dbl#D.Ea9a9.7a9a9.7#D.7#Da9bja9.7a9a9.n.7a9a9a9.na9a9a9a9.na9a9a9#D#D#D#D#D.7#D#D#DaY#x#x#xbna0aCamaFaOa#bma#bmaBaZaZaB.6.Gal.o#e.GazanaBaZ#u#u#uan", -"#vaFama0awbnaYaYaY.NaY#D#DaY#D#M#Dbl#s#D#D#s#D#D#Dbl#D.n#Daf.E.7a9a9.7a9a9a9a9a9.7a9.7a9.7a9a9a9#D.n#D.N#x#I#I.W.C#I.Caoam#U#xaw#Ia0#I#x#x#I#x#IaYaY#Dblbja9a9#L#La2bpa2bpa2#La2#Laf#Laf#La2#La2af#L#La2#La2afa2#Laf#L#Lafaj#Laf#L#L#La2#Laf#La2#L#La2#La2#La2#L#La2#La2#L#La2#L#L#Lafa9#sblaY#xb#bm#SaFambn#xaYaYaYaYaYaYaYaYaYaYaYaYawaYaY#Dbl.7a9bja9.7a9bja9#L#L#La9.7a9a9.7a9.7a9a9.7a9.7a9a9a9a9a9a9a9a9a9#D#Da9#D#Da9#Da9.N.NaYaY#x#x#xaYa0ama0am.5aF.5a##vaZan#TaR.Gazana7.wan#uaZan#uaZ", -"b#a0#xaYaYaYaY#x#DaY#D#D#M#Da9a9#D#D#D#D#Da9#D#p#Da9#D.7a9.7#L#La9a9a9.7#L#L.7a9.na9a9.7af#L#L#L#La9.7#s.N#I#x#x.C.CaCa0.W.W#xawaYawaYawaY.NaYaYaYawaY#sbl.7#D.7#L.ja2#ga2#ga2#g#La2#La2#Laf#L#L#La2af#L#L#L#Laf#Lajaf#Laf#Laf#Lajafaf#Laf#L#La2#Laf#Lafa2#La2#La2#L#L#L.3#Laf#La2#L#La9a9#D#MaY.b#yaFbgam#x.N#saYaYaYaYaYaYaYaYaYaYaYaYaYaY#Dbla9.7#L#L.7#L#L#L.7af#La9#La9#La9afafafafa9a9a9a9a9.na9a9a9.n#pa9.n.7a9.7a9.7a9.7#D#D#D#s#DblaYblaY#x#xaCa0aCa0amaOaZ#u#q.G.6#uaBana7azaZaZaZaZa#", -"a0a0a0aYblaYaY#xaYaY#Dbl#Da9a9af.7.7#Da9a9a9a9a9a9a9.n#Da9.7#L#L#La9.7af#L#Lafa9.7a9#L#Lajafa2aj#L.7.n#D.N#xbo#I#x.Waq.8aoa0#I.Nawbl#sbl#DaY#saYawaYaYbl#D#Da9a9#L#Lbpa2#L#g#La2#Laf#Laf#La2#L.3#Laf#L#Lafaf#Laf#Laf#L#Laf#L#Lafaf#L#Laf#Laf#Lafa2#La2#L#La2#Laf#L#L.3#L#L#L#L#L#L#L#L.na9a9blblbn#Hbga0#xaYaYa9blaYblaYblaYblaYaYawaYaYaYaYbl#Da9a9a9a9a9a9a9a9#L#L#L.7a9.7a9a9#La9a9a9a9af.nafa9#pa9#pa9#pa9a9#Da9#D.7#Da9bja9a9.7a9a9a9#D#Dbl#D#saYaY#x.Cbn.WaF#San.Ga4aZa#a#aZ#uanaZaBa#bma#", -"bnaYaYawaYaY#M.N#D#D#D#D#D#D#Da9a9#D.nbja9.7a9.7a9.7.7a9#La9a9a9.7a9#L#L.7af.7a9#Laf#Lafa9.7a9a9#L.7#La9a9#DaY#Ua0#UaCa0#I#x#I#I.N#s#D#D#sa9#D#Da9#D#s#D#Daw#DaYajaf#L#L#Laf#L#La2a2a2#La2#La2#L#La2a2a2a2bpaj#Lajaf#Lajaf#Lajafaja9ajafajaf#L#Lafafafafa2#L#L#La2#L#L#L.3#L.3#L#La2#L#Lafa9.na9aYbnb#b#am.C.NaWa9bj#D#Dbj#D.N.NaYaY#DawaY#DaY#D#D.7a9.7a9.7a9a9#Laf#Laf#Laf#L#Lafafaf#La9#D#D#D#L#Lafajaf#Laf#L#L#L#L#L#L.7.7.7a9a9.7a9#D#D#D#DaYaY.N#x#Ia0.Ca0aF#vaF#vaOb#aob#aoaFaBaZ.0a#.5am", -"#U#x.RaYaYaYbl#D#D#D#D#s#D#Da9#D#D.7#Da9.7a9bja9.7a9af.7a9a9.7a9af.7a9af#L#L#La9a2afaj#L#La9.7a9aj#L#La9.nblaYaY#Ia0aC.W#x#I.N.s#D#s#D.n#D#D#D#sa9a9a9#Dbl#D#D.Na9a9a9a9a9#La9#L#Laf#Laf#Laf#Laf#Laj#L.7aj#L#L.7afajafaf#Laf#Laf#Laf#L#Laf#L#Lafafafaf#Lafa2#L#L#L#La2af#L#L#L#La2a2af#L#La9bja9.Rawa0.8a0.C.Nbj#Da9a9#Da9#D#DaY#DaYbl.Nblaw#Dbl#D.7a9a9.7a9a9bjaf#Lajaf#L#Laf#Lafafafa9a9#Da9#D#Laf#Laf#L#L#Lafaj#L#L.7#L.7af.7#La9a9.7#D#D#D#D#D.NaY#x#x.C.CaoaFaFaOaOamamamamaCaF#v#v.0#vb#am", -"bnbnawaYaYaY#Dbl.n#D#D#Da9bja9bj.n#D.7a9#D.7a9a9a9.7a9a9#La9a9a9#L#L#L#L#Laf#L#La2a2a2af#La9a9a9#L#Laf.7a9#D#IaY#UbnaC#xaY.N.saY.s#D#Db.#D.n#D.7a9a9#Da9#D#D#D#Da9bja9#Da9#Da9#Da9a9a9a9a9a9a9a9#Laf#L#Lafafajaf#La9#Lajaf#Lajaf.7#Laf#L#Lajaf#Lajafaf.3#L#L#L#Laf#Laf#La2a2#La2#La2#La2af.Ea9.naY#xaCamam#x.Nbj#s.7#D#D#D#Dbj#D#Dbl#Dbl.Nbl#Dbla9a9a9a9a9a9a9a9afafafafajafafajafaf.na9a9a9#D#D#Lajaf#L#Lafa2#L#Laf#L#L#La9.7a9a9.7a9a9#Da9#D#D#D#MaY#x#x.CaCa0aFaOaFamaFaCa0a0bnaCb#aOaFaOama0", -"#IaYaYaYawaYaw#D#D#D#s#D#sa9#sa9.7a9a9a9.7a9#L.7#La9af.7a9a9.Ea9afaj#Laf#L#La2#La2a2a2#La2#La9#L#L#Laja9a9blaYaY#I#U#xaw.Naw#D#Da9#sa9#sa9.7a9.7ajaf.Ea9a9.7a9#D#D#D#D#Dbj#D#D#Da9#D#D#D#sbl#D#sa9a9a9a9a9#Da9#Dafajafaf.Eaf.7afajaf#Lajafaf#Lafafafajaf#Laf#L#L#Laf#L#L#Lafa2#La2a2af#L#La9a9a9aw#x.Vaoa0#x.Nbja9#D#D.7#D#D#D#Dbl#DaY#DblaYaY.Na9a9a9a9a9.7a9a9#La9afa9afa9af#pafa9#pa9a9a9.7a9#Laf#Laf#L#L#L#Laf#L#Laf.7a9#D.7a9.7a9.7#D#Dbj#Dbl.NaY#x#I.Ca0aqbgaFamaoambn.Cbn#U#xbna0aCama0a0", -"aYaY#IaYbl.N.N#D#s#D#D#D#D#D#Da9a9a9.7a9a9a9a9#Laf#L#Laf#L#Laf#L#Lafa2a2a2a2a2a2a2a2a2a2a2#L#Lafa2#L#La9a9#DaY#Ubn#I#xaYaw#D#s.sa9bj.n#Da9.Ea9.7#L.7#L#L.7a9.7#L#Da9#Da9#Da9#Da9#Dbl#Dbl#D#Dbl#Dbl#s#D.na9#s#D#Ma9a9.n#Laf#Lajaf#Laf#Laf#L#Lafajafafafaf#Laf#L#L#La2#L.3#L#L#Lafa2a2#L#Lafa9.na9#Dawa0bga0#x.N#s#Da9#D#D#D#D#D#D.Nbl#DaYaYaYawaYa9.na9#La9afa9afa9a9a9a9a9a9a9a9a9#pa9a9a9a9a9a9#L#Lafaj#L.3#La2afafa2af#La9a9a9afa9.7a9#D#D#D#D#DaY.N#x#xa0a0aoaFbgama0a0a0aCa0aYaY.baYbnbnaC#x", -"aYaYblbl#D#Da9.7a9a9a9a9.na9a9.7ajafaj#L#L#La2#L#L#L#L#Lafaj#Lafa2a2#L.j#La2#La2a2a2a2#La2af#L#L#L#L#L#La9#MaYaY#Ibn#MaY#D.s#D#s.7.na9.Ea9.7aj#La2aj#L#Laj#L#L.7.7a9.7.7a9.7a9.7#M#Dbl#MblblaYbl.sbl#Dbl#D#Dbl#Daf.Ea9af.Eafa9af#Lafaj#L#Laf#Lafafafafafaf#Laj#L#Laf#L#La2afa2#La2#L.3#L#L.7#Da9#DaYaCama0#Ibla9#Dbj#D#Da9#D#D.N#MaY#DblawaYaYaY#pa9a9a9#pa9a9a9afa9afa9#p.na9a9#Mbla9a9a9#La9.7afaj#Laf#L#Laf#Laf#Laf.7afa9afa9a9.7a9#D.7#D#D#D#Dblaw#x#x.WamamaOb#aOa0aC.Cbn.C#U.RaYaY.b#xbna0", -"aYaY#D#D#D#s.7.7a9.7a9.7a9a9.7a9#Laf#Laf#Laf#Lafa2a2a2a2#La2a2aja2a2.3a2a2a2a2a2aaaaa2a2a2a2a2#La2#L#La9a9#DaY#I.RaYaw#D#M#D#s#D.n.7a9.n#L.7af#La2a2a2#La2#L#L#La9a9.7a9a9.7a9a9a9#pa9a9a9.n#pblaYaY#IaY#IaYaw#x.na9af#Laf#Laj#Laf#La9afajaf#L#Lafafafaj#Laf#L#Lafa2#L.3#L#L#L#La2a2#L#Laf.na9.n#D.NbnaCaobn#D#s#D.n#D#D#D.N.NaY#DaY#Dbl.NaYaYaw#D#pa9#p.n#pa9#pa9a9.n#pa9#pa9#pa9#D#pa9afafajaf#Laf#L#Laf#L#Laj.3af.3afafa9a9a9.7a9.7a9#D#D#D#D.NaY.N#xa0ama0aob#ama0a0a0bn#Ibna0#x.bbnaY#Uamam", -"#MaY#s#D#D.7#La9#L.7.na9a9.7a9a9#L#L#L#La2#La2#La2a2a2aja2#La2afa2aja2#La2a2a2a2#gaaa2a2a2a2a2a2a2#L#La9a9blaYaYaY#MaY#M.N#D.n#D.na9.n.7#L.E#L#L.ja2a2a2#g#L#L#L#Lajaf#Lajaf#L#La9a9#pa9#pbla9.naYawaYaYaY.RaYaY.na9.na9aj.7af.n#Lafaj#Laf#Lajafafajafafaf#L#L#L#Laf#L#La2afa2af#L#La2af#L.7a9a9.7aw#xaCa0#IaYa9#D#D#D#D#D.NaY.saY#Dbl#DaYaYaYaY.na9#pa9a9#p.na9af#p#pa9a9a9#pa9#Dbl#Da9.na9#L#Laf#L#Lafajaf#Lafafafafafafafa9a9afa9a9bja9bj#D#D#D#DaY#x.Wa0av.5.pamaCa0#Ua0#x#xa0bnaYaw.R.Cb#am", -"amam#xbla9a9a9a9a9a9.7a9.7afa2#Laf#Laf#La2#La2#La2a2a2a2a2a2a2a2#Laf#Laf#La2#L.3a2a2a2a2asa2#La2#gafa9blaYawaYaYawbn#IaYawaw#D#Da9.Ea9#Lafaf#L#L#L#La2a2a2a2a2a2a2a2#La2af#L#Lafajaf#L.na9bja9#D#p#pbl#M#x#Ia0bn#I.NaY#D#Da9a9.7af.Eafa9aja9#Lafa9a9a9a9#Lafa9afajafafafaf#Lafafa2.ja2afajaf#L.na2a9aY.Cbgam#x#Ma9.n#Lajafa9.N.N#pa9bl.N#MaYaYaY#p#pa9#pa9#pa9#p#pa9#p.n#p#p.n#pa9#pa9a9#paf#pa9a9.n#pafafafafafafafa9afa9afa9a9.na9a9a9a9a9#D#D.n#paYaYa0amb#amb#a0a0a0.Ca0#I#xaw#xaY#x#xaCa0aC", -"ama0#xbla9.na9a9bja9#Da9a9ajaf#La2aj#Lafa2#La2#La2a2#La2#La2#La2af#Lafa2#Laf#L#La2a2a2asa2a2a2a2a2#La9blaYaYaYawaYaY#xawaY.N#s#Daja9#Lafajaf#Laf#L.j#La2#La2#La2#La2#La2#L#L#L#L#L#Laf.7a9#D.n#Da9.nblblaYaY#xaC#x#IaY.s#D#sa9.na9a9a9a9a9a9a9a9a9afa9afa9a9#La9afafaj#Lafaf#Lafa2#La2#Lafafaj#La2.naw.CamaC#xaY#D#D#La9a9#sbl.Na9#M#DblaYaYaY#xbla9#p#pa9#pa9#pa9#pa9#p#pa9#p#p#pa9.n#pa9a9a9af#pafa9afa9a9afa9#La9af.7afa9afafa9afa9a9.na9#Dbl#p#pblbn#U.5bg.5a0aoa0a0#Ua0#xbnaYaYaY#U#xbn#xa0", -"amaCaYaYaw#Dbl#sa9#D.7a9.7af#L#Lafaf#L#La2#La2#La2a2a2a2a2a2a2a2#L#L#Lafaja2#L.3a2a2a2#La2a2a2a2#ga9#D#MaYaY#UaY#xaw#Ibl.Naw#D#Dafafaja9#L#Laf#La2#La2a2a2a2a2a2a2.jafa2#Laf#Laf#Laf#La9a9.7#Da9a9a9#sblawaY#x#x#IaY.NaY#D#D#D#D#sbl#s#D#sa9a9.na9.na9a9.nafa9afafafafafafafajafa2#L.3#L#Laja9#Daj#DaY.Ca0aoa0aY#D#Ma9.na9#D#DaYblblblaYaYaYaYaYbl#pa9#pa9#pa9#pa9#p#Ma9bl#p#D#pa9a9#pa9#pa9#pa9#pa9#pa9#paf#pa9afa9afa9afa9afa9a9a9a9a9a9a9#Da9bla9awaYa0a0ama0b#a0a0a0#x#U#x#xaw#xaw#xbn#I#xa0", -"b#b#aCaYaYbl#Dblbja9#D.na9#Lajaf#L#L#Lafa2#La2#La2a2#La2#La2#La2afafaj#L#Laf#L#La2#La2a2a2a2#La2#La9blaYbnbn.R#IaY#U#xaYaw.N#D#s#L.Eaf#Lafaj#L#L#La2#La2#La2#La2afa2a2a2#L#L#L#Lafajaf.7.n#Da9b.afa9a9a9#DaY#I#x.NaY#saY#s#D#s#DaYaYaYblaY#DaY#Dbla9a9a9a9a9a9a9.na9a9.na9a9a9a9#La2aj#Lafa9a9a9af#Mawa0aCa0a0bn.NaYbl#D#M#DaY.NaYaYaYawaYaYawaYbl.na9#pa9#pa9#pblbla9#p#pa9#p.na9#pa9.n#pafa9af.naf#pajafafafafa9a9a9afa9af.7afaf.nafa9a9af#D#DblblaYaY#xaCa0.Ca0aobnaCbn#xawaYaY.RaYaYaY#xbn#x", -"a0bnbnbnaYaYbl#D.n#D#sa9a9#Laf#L#L.3#L#L#La2#Lafa2a2a2a2a2a2a2a2#L#Lafaf#L#La2#L#La2#L#L#La2#L#Laf.nblaY.bbn#U#x#Ubn#Ibl.NaYa9.7a9afaja9#Lafaf#La2a2aja2a2a2a2a2a2a2a2a2af#Laf#L#L#L#La9a9.7#Da9#Laja9#D#D.NaYaY#s#D#D#DaY.NaY.saY.saY.NblaY#DaY#sbl#sbla9#Da9#Da9a9.na9a9afa9ajafaf#Lafa9a9#D#sa9blaY#Ua0aob#aC#xaYaw#D#DblaY#IaYawaYaYaYaYaYaYbl#pbla9#pa9#pa9bl#M#p#D#p#M#p#pa9#pa9#pa9a9#pa9#p#pa9#p#pafafaf.nafa9a9#La9afafa9afa9a9afa9#Da9bl.NaYawbn#x#x#x#Ubna0#xbnaY#xaYawaYaw#xawaY#x#U", -"#Ubn#Uam#UaYaYbl#Da9bja9a9#L#Laf#L#Laf#Laf#La2#La2a2#La2#La2#La2af#L#L#L#Laf#La2af#L#La2#L#La2#Lafa9bl.Ra0.pa0bn#U#xawaY#M.N#s.7.na9#Lafaj#L#Lafa2a2a2a2#La2#La2a2a2a2a2#L#L#L#Laf#Laf.7a9#D.7#Dafaf#L.na9#Daw.N.n#D#D#s#Daw#DaYaYaYaYawaYaYawbla9bla9bla9.n#D#Ma9a9a9#Da9#sa9#p#Laf#La9.7.n#D#D#DaYawa0a0aob#amaCa0aYaYaY#DaY#xaYaYaYaYaYbl#Dbl#p#pa9#pa9#pa9#p#pbl#p#pa9#pa9bl#p.na9a9#pa9#pa9af#pafa9af.na9afa9a9aja9a9afa9#Laf.7afa9.7afbl#D#D#DaYaYaY#xaY#xa0bnbn#U.RawaY.baYaYblaY.R#IaYaY", -".Rbnb#a0a0#xaYbl#s#D#sa9.Eaf#L#La2#Laj#La2a2#L#La2a2a2a2a2a2a2a2#La2afa2afa2#Laf.7af#La9a9#Lafa9a9a9.R.Ra0.V#UbnaYaYaY#D#D#D#D.7afajaf.Eafaf#L#La2#La2#La2a2a2a2a2a2#La2#L.3.7#Lafaj#La9a9.n#Da9#Laj.7a9.7#D.N.Na9.n#D#DaY.NaY.sbl#Mblbl#Dbl#Dbl#D#Dbl#s#Dbl#Dbla9#Da9.nbla9a9#Dajaf.na9#D#D#D#sblawaY#x#Ub#b#aO.5a0aCaYaYawaY#x#xaYaYaY.sblbl.na9#pa9#pa9#pa9#pblbla9#M#p#Dblbl.n#p#p.na9#p.n#p.na9#pa9#pa9af#pa9afa9a9af#Laf#Lafafa9afa9a9#Da9bl#D#M.NaY.Naw#x#UbnbnaYaYaY#xaYbl#MblaYaYaYaY#I", -"#Fbn.Vaoa0bnaYblbja9#Da9a9#Lajaf#Laf#Laf#L#L.3#La2a2#La2#La2#La2af#L#L#L#Lafaj#La9#L#La9a9#L#Lafa9blaw.R#Ua0bnbn#IaYaw#D#s#Da9#s#La9#Laf#L#L#L#La2a2a2.j#L#La2#La2a2a2a2#L#Laf#L#Laf#Laf.7#D.7#s#L#L#La9.7#D.sbf.n#Da9#Daw#DaY.N#pbl#M#D#p.n#pa9#sbl#D#D#Dbl#D#D.na9#Dbl.n#Da9a9af#La9.7a9#s#DaYaY#x.baYbnaoamaFaFaoa0#IbnaYaY.R#x#xaYaYbl#Da9#pa9#pa9#pa9#pbla9#M#pa9#pa9#p#Mbl#pa9a9a9#pa9a9#pa9#paf.naf#pafafa9a9a9afa9af.7afa9#L#La9a9af#D#D#D#DaY#D#DaY.NaYbnbn#U#x.baYaYaw#paY#D#MaY#IaYaY", -"blaw#xa0ambn#xaYawblbl#D#pa9afafa2a2a2a2a2a2#La2#L#La2#La2#La2#La2a2a2afa2#La9a9a9a9a9#D#D#D#D#D#pbl#paY.Rbn#I#x#pa9a9a9a9.7.7a9afajaf.n#Laf#L#L#L#L#La2a2a2#ga2a2bpa2#L#L#L#L.7af#Laf.7a9a9a9#Da9a9#sa9#D#D#D.Na9a9a9#sbl#D#Ma9bl#Dblbl#Dblblbla9a9a9afa9a9a9a9a9a9afa9a9a9a9.nafa9a9.na9a9#D.naY.RaYbna0a0b#aobgb#bg.Va0aCaY#D#Mbl#Mbl#Dblbl#Dbl#Dbl#Dbl#Dblbla9#pbla9#p#pa9#p#p#p#p#p#pa9#pa9#p#p#p#pa9a9afa9aja9afaf#Lafaf#La9afa9#Lafa9a9af#sa9#Dbl#DaYbl.N#UbnbnbnaYaY#IaYaY#MaY#xaYaYaYaY", -"aYaYbn.Ca0a0#I#xaYaYblbl.naf#Lafaja2#La2#La2a2a2#La2#La2#La2#La2a2a2#L#L#L#L#L#Lafa9af#D#p#Dbl#D#F.nblblaYaYaYaYa9.n.7a9a9.7a9.7afafaf#L#L#L#L#La2#ga2#ga2bpa2#L#ga2a2#L#L#L#L#L#Laj#Laf.7a9bja9.7#D.7#D#D#D.Naw#D#M#D#p#D#p#D#Dbl#sbl#Dblbl#Dbla9.na9.naf#paja9afa9.na9a9afa9a9afajafa9a9a9blblaYawaY#Ua0aC.5am.V.Vb#ama0aYaY#xblaY#DaYbl#M#Dbl#Dbla9bla9bla9bl#D#p.n#pbla9bl#p#p.na9#p.na9#p.na9bl.na9afa9a9a9a9afa9#La9af.7afa9a9#Laf#Lafa9a9a9a9a9#D#DaY#saYbnbn#U#x#UaYaYaYaYaYaYawaYaYaY#x", -"aY#xbna0a0a0a0bnaYaY#Mbla9a9a9af#L#Laf#L#L#L#Lafa2#La2#La2#La2a2#La2afa2af#L.7#La9a9#D#D#D#D#DaY#pblbl#MaYaYbl.Na9a9a9.7a9#L.Eaf.naf#Laf#L#L#L#La2a2bpa2#ga2#ga2a2#L#L#L#L.7a9a9a9a9afa9a9#D#D#sa9.nbl#DaYblaYaYbl#D#D#D#M#Dbl#sblbl#Dbl#sbl#D#Ma9a9a9a9a9a9a9a9a9a9a9a9.na9a9a9.n#pa9a9#D#sbl#saYaY.RaY#xa0a0aCa0#Ua0aCbnaYaYawbl#sbl#M#Dblbl#D#pa9a9a9a9a9a9a9#p#p#D#p.n#pa9.n#p#p#pbl#pa9a9#p#pa9#p#pa9a9afa9af#Lafaf#Lafaf#La9a9afa9af#La9afa9a9bl#D#p#DaY#DbnaCbnbnaYaY#IaYaYaw#xaYaYbn#I.R", -".Raw#xa0aC.Ca0a0.baYaYblbla9a9af#Laf#L#La2afa2#L#La2#Lafa2#La2a2a2a2a2#L#L#Laf#L#D#p#Dbl#DblaYaY#pblblbl#Dbl#D#Dafa9af#L#La9#L.7afaf#Lajaf#L#L#L#L#ga2a2#La2bpa2#L#L#Laf#La9.7#Da9a9a9#D#Dbl#DaYblblaYaYaYawaYaY#xawaYaYaYaYaYaYaYaYaYaYaY.NblaYa9a9#pa9a9#pa9#p.n#Da9a9a9#Da9#D#pa9bl.na9blaYblblaYaY#IaYbnbna0#Ua0b#b#a0aYaYblblbl.Nblbl#Dbl#Da9a9afa9afa9afa9#Ma9#pa9#pbl#pbl#p#p#pa9#pa9#pa9a9bl#p.na9a9a9a9#La9af.7afa9#La9afa9a9af.7afafafa9a9a9#D#D#DblaYbnbn#Ibn#IaY.RawaYaYaYaYaYaY#x#x", -"bnbnbnbna0a0a0amaYaYaYaY#D.na9a9afa9afa9#L#L#Laf#L#L#La2#La2#L#La2#L#Laf#L#L#Laf#D#Dbl#DblaYaYaYa9.nblbl#D#D#Dblafaf#L#L#L#L#L#L.naf#Laf#L#L#L#L#ga2bpa2#ga2a2#gaf.3af.7afa9a9.n#D#Dbl#sblbl.NaYaYaYaYawaY#x#xaYaYaYaYaYawaYawaYaYawaYawaYblaYblblbl#Dbl#M#Dblbl#Dbl#D#Dbl#s#Dbl.n#pa9blawblawaYaw.RaY.RaY#U#xbn#UbnaCaOama0aYbl#Dbl#Mbl.Nblbl#Da9.na9a9a9a9a9a9a9#pbl#pa9#pa9#p#p#p#M#p#p.n#pa9.n#pa9#pa9a9afa9#Lafa9afa9#Lafafa9afafa9af#La9#La9af#Dbl#Daw.NawbnbnbnbnaYaY#xaYbn.baY.RaY#xbnbn", -"ama0bna0#Uambgb#aY.RawaYbl#Da9a9a9.7a9.7a9af.7#L#La2af#Laf#L#L#La2a2#La2#Laf#L.7#pblblaYaYblaYaYblblbl#Da9a9a9.7afajaf#L.3#L#L#L#Lafaf#L#L#L#L#L#L#ga2a2bpa2bpa2#La9#Lafa9af#D#D#Dbl#DaYaYaw#xaYaYawaYaY#xbnbnaYawaYaYaYaYbnaYaYaY.RaY.RaY.baYawbl#Mblblblbl#Mblbl#D#D#M#Dbl#D#D#pbl#MblblaYaYaY.RaYaYawbnaYbnawaYaYa0aO.Fa0#x.R#Dbl.Nbl#Mbl#sbla9a9a9a9afafafaf#p#p.na9bl.nbl#p.n#p#pa9#pa9a9#p#pbl#pa9a9a9a9a9#La9afa9a9afa9#Laf#La9afa9af#Lafa9a9#D#Dbl#DblaYbna0#Ubn#I.RawaYawaYaYaY#UbnaCbn", -".Va0bna0.V.Vb#.5bn#xaYaYaY#Da9a9a9#La9#La9#L#Laf#L#L#La2#La2afa2#La2#Laf#La9a9a9blaY#MaYaYaYaYaYbl#Dbl#Dafa9#L#Lafa2a2a2a2a2#L#Lafaj#Laf#L#L#L#La2a2bpa2#ga2a2#gafafafa9a9a9bl#pbl#DblaYaYaYaY#xaY.Rbnbn#Ua0a0a0aYaYaYaYaYaYaY#U.R.b.R.R#U.Rbn.RaYaYawblaYblaYbl.N#MaY#DaYblaYbl#sblblblawblaYaYawbnaY.RaYaw.RaY#IbnaCb#aOb#.Vbn#DblblawaYblbl#Da9a9a9a9.7a9.7a9#D#pbl#p#p#pa9#p#p#p#pbla9#pa9a9#pa9.n#pa9.na9a9afafa9a9afa9#Laf.7af#La9afa9#Lafa9a9a9bl#s#DaY#sbnbnbnbnaYaY#x.Rbnbnbnbnbn#xa0a0", -"a0.Vbn.bbna0b#b##UbnaYaY#D#Ma9a9.Ea9a9a9.7a9.7#Lafa2a2#La2af#L#La2a2#L#L#Laf.7.7blblaYblaYaYaYaY#DaYa9a9a9#La2#La2a2#La2#L#ga2#Lafafafa2#L#L#L#L#L#ga2#g#La2bpa2afafa9af#p#Da9#D#DaY#D#DaYaYaY#x.RaYaYbnbna0a0a0aYaYaY.RaY#UaYaYaYaYaYaYaYaYaYaYawblaYaYaYblaYblaYbl.NblaY#s.Nblblbl#MblaYawaYaY.Raw.RawaY.b#x.baY#xa0aob#bga0bnbl#sblaYaYbl#sbla9.n.7a9.n.7a9a9#pa9#pa9#p#D#pbl#p#p.na9#p.na9#p.n#pbl#pa9a9a9af.7a9afa9.na9a9afaf#Lafa9afa9af#La9.nbl#D#D#DblaYbnbn#UaYaYaYawaY.RaY.Rawbnbna0a0", -"aYaYaYaYaYaY.N#xaYaYawbnaYaYaYaYbl#Dafa9afa9.7#L#L#L#L#L#L#L#L#L.3a2afafa9#D#DaY.R.R#x.RaYawaYaYa9.7a9#L#L#Lafa2a2a2a2a2#g#L#L#Lafafajafafa2#L#L#L#L.7#L#L#L#L#L#L#L#Laf.7#La9a9a9.7a9#D#D#D#D#Dblbl#IaY#xaY#xaYaYaYaYawaYaYaYaYaYawaYaYawaYaYaw#Fbl#M#FblaYaYaY.R.R.R.R.R.R.R.RawaYaYaYaYaYaYawaYbl.NaYaYaYbn#Ibn.baY#Ua0aOb#.Vbg#HaY.bbla9a9.na9a9a9a9.7a9a9.Ea9#p.na9a9.n#pa9#pbl#p#pa9#p#pa9#p#pa9#pa9#pa9a9#pa9.na9afafaf#L#Laf#L#L#L#L#Lafa9a9a9#pblbl.Nbl#x.R#xaY.R#x#xaYaw.RaYaYaYaYaY#D", -"aYblaYaYaY#IaY.NblawaYaYaYaYaYaY#Dbla9a9a9a9a9#L#L#L#L#L#L#L#L#L#Laf#Lafa9#Dbl.N.R.Raw.RaYaYaYaY.7#Da9.7af#La2#La2#ga2#ga2#L#L#Lafafafaf#L#L#L#L.7#L#L#L#L.7#L.7a2a2#L#Laf#La9bja9#D.7#D#D#D#D#D#D#DaYaYaYaYaY#xaYaYaYaYaYaYaYaw#xaY#xaYaYawaYaYbl#FblaY#MaYblaw.R.b.R#MaY#FaY#FaYaYaYblaY#MaYaYblawaY.RawaYawaYbnaY#Ibnao#SaBaF.p#H#U.RaY#Ma9#Da9a9.7a9a9a9a9a9a9a9a9#pa9#pa9.na9#pa9a9#pa9#pa9#p#D#p#s#pa9a9afa9af#pafafafafaf#L#L#Lafaj#Lafaja9#pa9a9#Dbl#DblaY#UaYaYaw#x#xbnaYblaw.RaYaY#Dbl", -"blaYblaYaY#D.NaY#pblblaY.RaYaYaYbl#Dbl#Da9a9.7a9#L#L#L#L#L#Laf#Laf.nafa9#D#DaYaYbn.RbnaYaY.R#xaYa9.7a9#L#L#La2#La2a2#g#L#L#L#L.7afajafaf#Laf#L#L#L#L#L#L#L#L#L#La2#La2a2#L#L#L#L#L#La9.7#Da9bj#DblblaYaYaYaYaYaYbl#Dbl#D#Dbl#Dblbl#Mbl#MaYblaY#Mbl.nbl#pa9aYblaYblaYaYaY.RawaYaY#M#F#M#Fbl#F#F#M#p#p#p#MblaYaYaY#UbnbnaCam#SaBbm#H.p.p.RaYaYbla9.na9a9.na9a9a9a9a9#pa9a9#pa9#pa9#pbla9#pa9#pa9#pa9#p#p#pa9#pa9#pa9#pa9a9afafafaf.3afajafafafafafa9.n#pa9#p#Dbl.N.RbnaY.RaYbnaY#x.b.RaYaYblbl#Dbl", -"#DblblaY#Dbl#D#Dbl#DawaYaYawaYaYaYaYbl#Dbl#D#Da9#Da9#Da9#Da9.7a9a9#p#Dbl#DaYaYaw.R.RaYbnaYaY#xaY#D#Da9.7#L#L#L#La2#ga2#L#L#L.7afafafafafaj#L#L#L#L#L#L#La2#L#L#La2a2a2#La2#L.7#La9#L.7a9.7#D#D#D.N#Dbl.sbl#D#Dbl#D#D#D#Dbl#D#D#Da9#D#D#Da9#D.n#D#pa9#pa9a9blblblblaYblblblblblbl#p#Fbl#p#pbl#pbl#p#M#pblbl#Faw#FbnbnaCamaCaF#SaZ#Hb#bgbnaw.Raw#Da9a9a9a9a9a9.na9afa9a9#p.na9a9#p.na9#pa9#pa9#pa9#M#p#D#p.na9a9a9af#pajafafafafaf#Lafa9afa9a9afaf#paf#p.n#Dbl#DblbnaYbn#Ubn#x#U#xbn.baYblaY#DaY#D", -"blblaY#DaY#D#D#Dbl#Dbl#DblaYaYaYaYaYaYaY#M#Dbla9#D#D#D#D#D#D#D#Dbl#Dbl#DaYaYaYaYbn.R#U.RaY.R#xaY.7a9.7#Laf#La2#La2a2#L#L#L#La9.7afafafaf#Laf#L#La2#g#L#g#L#ga2a2a2a2#La2a2#La2#L#L#Laf.7a9a9#Da9#DblaYaYbl.Nbl#Da9a9a9a9a9a9a9a9.na9.na9a9.na9a9ajafa9.na9a9.na9blblbl#Dblblblbl#M#p#p#p#p#p.n#p#p#p#p#M#pblbl#MbnbnbnaCa0aF#SaZ.V.V.VbgbnaYaYaYbl#D#D#D#D#D#Dbla9#p.na9#pa9#pa9#pbla9#pa9#pa9#pa9#pa9#pa9#pa9af#pa9#pafafaf#Lafa9a9a9a9a9afa9a9afafa9#p#Dbl#saY#x.bbn#xbn#I#xbnbnbnbnawbl#Dblbl", -"a9#pa9bl#M#Dbl#Da9a9#D#D#D#D#D.Nbn#U.RaYaYaY#D#Dbl#D#Dbl#D#Dbl#DaYblaYaYaYawaYaYaY.RaYbn#xaw#xaY.7a9#D#L.7a2#Laf#L#Laf#La9a9#Da9afafajaf#L#L#L#Lbpa2a2a2#ga2a2bpa2a2a2a2a2a2#La2.3#L#L#La9.7a9.7bl.NaYaY#D#pa9#pa9a9a9afafa9a9a9afafafajafafafafafajaf#La9a9a9bj.na9#D.n#Da9#s#D#p#p#p#p.n#pbl#p#p.n#pa9bl#Mblbl#UaY#U#x#Ub#aB.l.V.V.V.VaCbnaY.R#D#Mblbl#Mblblbla9#pa9#pafa9a9#pa9#p#pa9#pa9#pa9#pbl.n#D#pa9#pa9afafafafafafafafafa9#p.na9a9a9a9afafafa9#p#DaYaY.Rbn#x#Ubnbn#xaCa0aCbnaYaYblbla9", -"#pa9#p#Dbl#Da9#Da9afa9bla9bl#DblaYaYbnaYaYaYaYaYblaYblaYblaYaYblaYaYaYaYaYaYaYaY.Rbn.R#xaY.RaYaYa9.7a9#Laf#L#L#Lafaf#Lafa9a9a9.nafafafaf#Laf#L#Laa#ga2#ga2a2#ga2aaasa2a2#La2a2#L#L#L.3#La9.7a9#DaYblaYblbla9a9ajaf#Laf#L#Lafajaf#Lafafaf#Laf#L#La2#L#L#L#L#L.7.7a9a9a9a9a9.na9a9.na9a9a9a9a9a9.na9a9.n#D#D#D#D#D#MblawawbnaC.F.t.Fb#.Vb#.Vbnaw#xaYaYaYaY.NaY#D#Da9#pa9a9#p.n#pa9.nbla9#pa9#pa9#pa9#p#p#pa9.na9afafafafafafafafafa9a9afa9af#pafafafafa9#p#Dblblaw#xbn#Ubn#x#IbnaCb#aCbnawaY#D.na9", -"#pa9#pa9a9#Dbla9a9a9af#D#Da9#D#D#xbn#xbnaYaYblaYaYaYaYaYaYaYaYaYbnaYaYaYaYaYaYaY.R.R.RbnaYaYaYaY#D.7#Da9#La2#Lafajafafa9a9a9a9#Dafafafaf#La2#L#La2a2#ga2a2#gaaa2asaaa2a2a2a2a2a2a2#L#L#La9a9.7a9#D.saY#D.n#pafaf#Lafaj#L#Laf#L#Laf#L#L#L#L#Lafaja2a2a2a2#L.E#L#La9a9a9.7a9a9a9a9a9.7a9.na9a9a9a9.E#L.7.7#D#s#D#s#Fblbl#M#xbnbg.t.F.t.V.V.VaCa0aY#DaYaYaYaY.Nblbl.na9#p.na9a9#pa9#p#pa9#pa9#pa9#pa9#p#D#pa9#p#pa9afafafaf#Lafafa9af#pa9#pa9afa9afafaf#pa9a9#D#DaYbnbn#xbn#Ua0bna0bg.Va0aYblbl#pa9" -}; diff --git a/tests/benchmarks/qimagereader/images/namedcolors.xpm b/tests/benchmarks/qimagereader/images/namedcolors.xpm deleted file mode 100644 index f6485d5..0000000 --- a/tests/benchmarks/qimagereader/images/namedcolors.xpm +++ /dev/null @@ -1,18 +0,0 @@ -/* XPM */ -static char *xman[] = { -/* width height ncolors chars_per_pixel */ -"8 8 3 1", -/* colors */ -"e g4 black c pale turquoise 4", -"f m white c light golden rod yellow g4 grey", -"g g white c lemon chiffon m black", -/* pixels */ -"eeeeeeee", -"ffffffff", -"gggggggg", -"gggggggg", -"gggggggg", -"gggggggg", -"gggggggg", -"gggggggg" -}; diff --git a/tests/benchmarks/qimagereader/images/negativeheight.bmp b/tests/benchmarks/qimagereader/images/negativeheight.bmp deleted file mode 100644 index 875887a..0000000 Binary files a/tests/benchmarks/qimagereader/images/negativeheight.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/noclearcode.bmp b/tests/benchmarks/qimagereader/images/noclearcode.bmp deleted file mode 100644 index 1a5ca9c..0000000 Binary files a/tests/benchmarks/qimagereader/images/noclearcode.bmp and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/noclearcode.gif b/tests/benchmarks/qimagereader/images/noclearcode.gif deleted file mode 100644 index 27784d6..0000000 Binary files a/tests/benchmarks/qimagereader/images/noclearcode.gif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/nontransparent.xpm b/tests/benchmarks/qimagereader/images/nontransparent.xpm deleted file mode 100644 index 00c21ef..0000000 --- a/tests/benchmarks/qimagereader/images/nontransparent.xpm +++ /dev/null @@ -1,788 +0,0 @@ -/* XPM */ -static char *dummy[]={ -"8 8 777 2", -"#R c #000000", -"fn c #000001", -".e c #000069", -".f c #00006d", -".g c #00006e", -"#d c #0042b4", -"aJ c #010101", -"g0 c #010102", -"dr c #010202", -"gd c #010203", -"#J c #0157bb", -"e. c #020202", -"du c #020304", -"fR c #030303", -"jJ c #040404", -"hf c #040608", -"fE c #040609", -"cO c #04070a", -"k# c #050505", -"gC c #050709", -"ka c #060606", -"br c #06080a", -"dY c #06090d", -"hI c #070707", -"in c #07090b", -"cL c #070a0e", -"cd c #070b0f", -"e0 c #080808", -"gZ c #080b0e", -"eu c #080b0f", -"dz c #080c10", -"hD c #090909", -"fq c #090d11", -"cH c #090e13", -"jB c #0a0a0a", -"#U c #0a0d0f", -"a4 c #0a0d10", -"g3 c #0a0d11", -"fu c #0a0f14", -"cj c #0a1016", -"kb c #0b0b0b", -"#n c #0b0d0f", -"a1 c #0b0e10", -"g8 c #0b0f13", -"f4 c #0b0f14", -"hE c #0c0c0c", -"bf c #0c0f12", -".X c #0c28a0", -"bT c #0d0d0d", -"ax c #0d1014", -"hr c #0d1217", -"dH c #0d141b", -"jy c #0e0e0e", -"aW c #0e1115", -"eH c #0e141b", -"bE c #0f0f0f", -"ar c #0f1317", -"g5 c #0f1419", -"hg c #0f151a", -"fh c #0f151c", -"dJ c #0f171f", -"gI c #101010", -".z c #101094", -"h. c #10161b", -"gm c #10161c", -"eL c #10171f", -"hK c #111111", -"at c #11161b", -"fC c #111820", -"dA c #111922", -"aj c #1163c4", -"bJ c #121212", -"#Z c #12161a", -"ba c #12171c", -"ho c #12181e", -"jK c #131313", -"iq c #13191d", -"cA c #131e2a", -"c7 c #141414", -"dR c #141e29", -"jr c #151515", -"aA c #151a1f", -"hq c #151c23", -"fl c #151e28", -"eV c #151e29", -"d4 c #161616", -"hw c #161e25", -"jk c #171717", -"bs c #171d23", -"g9 c #171f27", -"eC c #17212b", -"b9 c #172432", -"d5 c #181818", -"as c #181e24", -"bn c #181f25", -"bS c #191919", -"gr c #19232d", -"ed c #1a1a1a", -".d c #1a1a6e", -"gB c #1a242e", -"eK c #1a2531", -"dQ c #1a2633", -"hL c #1b1b1b", -"g1 c #1b242d", -"g# c #1b252f", -"eJ c #1b2734", -"d1 c #1b2937", -"bW c #1c1c1c", -"gW c #1c262f", -"ci c #1c2b3b", -"cs c #1c2c3c", -"e# c #1d1d1d", -"#3 c #1d232a", -"f8 c #1d2833", -"fI c #1d2936", -"eO c #1d2a38", -"cw c #1d2e3f", -"jR c #1e1e1e", -"a2 c #1e262e", -"eP c #1e2b39", -"dE c #1e2d3d", -"cF c #1e2f41", -"aO c #1e6ec9", -"c4 c #1f1f1f", -"gx c #1f2a36", -"c# c #1f3043", -"j2 c #202020", -"bk c #202931", -"ht c #202c36", -"eF c #202f3e", -"b7 c #203245", -"cB c #203246", -"hG c #212121", -"aE c #212932", -"bp c #212a32", -"hl c #212d38", -"cc c #213347", -".M c #214eb7", -"hF c #222222", -"#7 c #222a32", -"fw c #223040", -"eU c #223141", -"jC c #232323", -"bb c #232c35", -"ga c #23303d", -"cv c #23364a", -"cn c #23364b", -"jl c #242424", -"gj c #243240", -"cm c #24374c", -"c. c #24384d", -"bF c #252525", -"be c #252f39", -"gt c #253341", -"dU c #253649", -".Y c #256cc9", -"jG c #262626", -"h8 c #26333d", -"hb c #263440", -"gs c #263443", -"cr c #263b51", -"cW c #272727", -"aC c #27313b", -"a9 c #27313c", -"fk c #273748", -"eR c #27384b", -"cq c #273d55", -"jV c #282828", -"#5 c #28313b", -"b0 c #2877ce", -"gL c #292929", -"#Y c #29323c", -"hu c #293744", -"fK c #293a4d", -"jP c #2a2a2a", -"#w c #2a323b", -"bg c #2a3540", -"dF c #2a3f55", -"jn c #2b2b2b", -"a6 c #2b3641", -"jY c #2c2c2c", -"h5 c #2c3b47", -"hp c #2c3c4a", -"gp c #2c3c4d", -"cx c #2c445e", -"bU c #2d2d2d", -"h# c #2d3e4c", -"dS c #2d435b", -"e5 c #2e2e2e", -"cG c #2e4762", -"jF c #2f2f2f", -"aG c #2f3b48", -"gU c #2f3f4e", -"ck c #2f4966", -"j0 c #303030", -"a0 c #303d4a", -"he c #304251", -"cQ c #307ace", -"e4 c #313131", -"ew c #31465d", -"dW c #314862", -"ce c #314b68", -"jm c #323232", -"bm c #323f4d", -"k. c #333333", -"e3 c #343434", -"hi c #344757", -"eT c #344b64", -"b8 c #34506f", -"dj c #347fd1", -"bX c #353535", -"f9 c #35485c", -"ac c #363636", -"#V c #36434f", -"fv c #364c64", -"dV c #36506d", -"c2 c #373737", -"ev c #37506a", -"bI c #383838", -"bw c #384655", -"h4 c #384b5a", -"hk c #384c5d", -"ea c #393939", -"bh c #394857", -"gX c #394d5f", -"#e c #3981d2", -"e6 c #3a3a3a", -"eS c #3a546f", -"em c #3a81d2", -"#F c #3b3b3b", -"eQ c #3b5571", -"dT c #3b5776", -"cI c #3b5c7f", -"gJ c #3c3c3c", -"hX c #3c5060", -"fi c #3c546f", -"gG c #3d3d3d", -"jv c #3e3e3e", -"az c #3e4e5e", -"fL c #3e5772", -"bK c #3f3f3f", -"gD c #3f576f", -"fJ c #3f5874", -"d2 c #3f86d5", -"jx c #404040", -"#8 c #404e5d", -"bv c #405161", -"cf c #406389", -"jL c #414141", -"iG c #415561", -"im c #415663", -"gz c #415971", -"et c #415d7c", -"cz c #41658c", -"f# c #418ad7", -"jT c #424242", -"gy c #425b74", -"fs c #425d7a", -"#K c #4288d4", -"jQ c #434343", -"eX c #438cda", -"j8 c #444444", -".L c #44449a", -"eZ c #454545", -"#s c #455362", -"fx c #45617f", -"cK c #456b94", -"aP c #458cd5", -"ab c #464646", -".n c #46469f", -"aH c #46586a", -"gV c #465f74", -"d0 c #46678c", -"c9 c #474747", -"aF c #47596c", -"a3 c #475a6d", -"ex c #476687", -"jU c #484848", -"by c #485b6e", -"gq c #48627d", -"dI c #486b91", -"cC c #48709b", -"js c #494949", -"#2 c #495a6b", -"ih c #49606f", -"hm c #49637a", -"gk c #49647f", -"j7 c #4a4a4a", -"dt c #4a6e94", -"ak c #4a8dd7", -"b1 c #4a90db", -"c1 c #4b4b4b", -"bx c #4b5f72", -"fr c #4b698a", -"dG c #4b6e95", -"co c #4b75a2", -"fW c #4b91db", -"bD c #4c4c4c", -"hc c #4c687f", -"j6 c #4d4d4d", -"#Q c #4d5f71", -"ik c #4d6676", -"hH c #4e4e4e", -"#0 c #4e5f72", -"aD c #4e6277", -"b. c #4e6377", -"gN c #4e91dc", -"c0 c #4f4f4f", -"bj c #4f6378", -"dZ c #4f759e", -"cD c #4f7aa9", -"hN c #4f8dcd", -"kd c #505050", -"#S c #506275", -"#6 c #506376", -"ge c #506e8c", -"af c #515151", -"b# c #51667b", -"dk c #5195df", -"cT c #525252", -".c c #525280", -"bq c #52677d", -"iH c #526b79", -"fj c #527397", -"eW c #52769d", -"dy c #527aa5", -"hJ c #535353", -"#x c #536476", -"eG c #53789f", -"jM c #545454", -"#r c #546577", -"bz c #546a80", -"dM c #547ca8", -"fP c #5499e2", -"jp c #555555", -"iK c #556f7e", -"bM c #565656", -"fB c #56799f", -"dC c #567fab", -"gE c #569be2", -"cU c #575757", -"h7 c #57748b", -"gc c #577797", -"fN c #577ba1", -"dx c #5780ad", -"cg c #5787bb", -"i4 c #585858", -"iF c #587483", -"hy c #587792", -"g2 c #587893", -"fy c #587ca3", -"eA c #587ea7", -"jW c #595959", -"bu c #597087", -"ia c #5984b2", -"ae c #5a5a5a", -"#t c #5a6c7f", -"bd c #5a7189", -"ij c #5a7789", -"eI c #5a81ab", -"bR c #5b5b5b", -"ch c #5b8dc3", -"en c #5b9be1", -"ke c #5c5c5c", -"cP c #5c8fc5", -"j5 c #5d5d5d", -"iN c #5d7fa0", -"gl c #5d80a3", -"fp c #5d83ac", -"cl c #5d8fc6", -"b2 c #5d9de6", -"c8 c #5e5e5e", -"hh c #5e7f9c", -"hn c #5e809d", -"i3 c #5f5f5f", -"#1 c #5f758c", -"a8 c #5f7890", -"g7 c #5f819e", -"cJ c #5f93cc", -"jz c #606060", -"ct c #6094cd", -"bO c #616161", -"eN c #618cb9", -"jH c #626262", -"iW c #627c8d", -"hd c #6285a3", -"ey c #628dbb", -"dO c #6290c4", -"ca c #6297d1", -"jI c #636363", -"eM c #638fbd", -"jN c #646464", -"fH c #648db9", -"eE c #648fbe", -"cb c #649ad5", -"hA c #64a8e2", -"jw c #656565", -"#k c #65798f", -"fF c #658eba", -"fA c #658fbb", -"fa c #65a4e7", -"b3 c #65a6e8", -"jX c #666666", -"hW c #6688a3", -"gh c #668cb2", -"aI c #6696cb", -"dN c #6697cc", -"bA c #6699ce", -"cu c #669edb", -"#C c #676767", -"f3 c #678db4", -"dl c #67a6eb", -"kc c #686868", -"cS c #696969", -"dK c #699bd2", -"cN c #69a2e0", -"cy c #69a3e1", -"fX c #69a6e8", -"jD c #6a6a6a", -"av c #6a84a1", -"ds c #6a9cd3", -"dL c #6a9cd4", -"jt c #6b6b6b", -"fo c #6b97c6", -"cE c #6ba5e4", -"jS c #6c6c6c", -"aV c #6c88a4", -"ir c #6c8ea4", -"il c #6c8fa5", -"eD c #6c9bce", -"dB c #6c9ed7", -"dq c #6c9fd8", -"cM c #6ca7e7", -"cp c #6ca8e8", -"eo c #6cabed", -"i2 c #6d6d6d", -"#T c #6d869f", -"#W c #6d87a0", -"gY c #6d94b5", -"aa c #6d9bcb", -"eB c #6d9dd0", -"dw c #6da0d9", -"dD c #6da1da", -"b4 c #6dacee", -"h9 c #6dafe2", -"i6 c #6e6e6e", -"bt c #6e8aa7", -"fM c #6e9bcb", -"dP c #6ea3dc", -"b5 c #6eabee", -"jd c #707070", -"ix c #7088a2", -"hx c #7098ba", -"f7 c #7099c3", -"dv c #70a5df", -"b6 c #70adef", -"iy c #70aff1", -"dm c #70aff2", -"jE c #717171", -"#m c #7188a0", -"#u c #7189a1", -"aY c #718eac", -"gO c #71aced", -"jq c #727272", -"gb c #729cc6", -"hO c #72afee", -"ib c #72afef", -"e7 c #737373", -"#y c #738ba4", -"#A c #739eca", -".j c #747474", -"#9 c #748fab", -"hs c #749ec1", -"f6 c #749fca", -".i c #757575", -"#q c #758da6", -"a5 c #7593b1", -"bo c #7594b2", -"ii c #759bb3", -"fb c #75b3f4", -"ep c #75b4f3", -"is c #75b8e2", -"ag c #767676", -"fz c #76a6da", -"ez c #76a9e0", -"dX c #76adeb", -".h c #777777", -".m c #777794", -"iX c #77a6b3", -"dn c #77b1f4", -"gK c #787878", -"#4 c #7894b0", -"fG c #78a9dd", -"j# c #797979", -"bV c #7a7a7a", -"do c #7ab4f4", -"jA c #7b7b7b", -"io c #7ba3bc", -"dp c #7bb5f5", -".k c #7c7c7c", -"bc c #7c9cbd", -"gi c #7caad8", -"aQ c #7cb0e7", -"fY c #7cb8f9", -"iM c #7cbee2", -"j1 c #7d7d7d", -"aX c #7d9ebf", -"fm c #7db0e7", -"j4 c #7e7e7e", -".8 c #7ea5ce", -"#D c #7f7f7f", -"hv c #7facd3", -"gn c #7faedd", -"eb c #808080", -"er c #80bdf9", -"j3 c #818181", -"hz c #81afd6", -"gu c #81b0e0", -"eq c #81bbf9", -"fc c #81bbfc", -"#b c #828282", -"iE c #82aac0", -"i5 c #838383", -"ha c #83b1d9", -"es c #83bcf9", -"ad c #848484", -"go c #84b5e6", -".v c #858585", -"#p c #85a0bc", -"bN c #868686", -"hZ c #86b3d6", -"fD c #86bcf6", -"fO c #86bcf7", -"gP c #86c1ff", -"di c #878787", -"ft c #87bdf8", -"bH c #888888", -"iT c #88cfe2", -"jZ c #898989", -"#z c #89a5c3", -"g. c #89bbee", -"fg c #89c0fc", -"fd c #89c2fd", -"hP c #89c3ff", -"jb c #8a8a8a", -"#o c #8aa6c4", -"jc c #8b8b8b", -".S c #8baccf", -"iI c #8bb6ce", -"al c #8bb9e8", -"hj c #8bbde7", -"gw c #8bbef2", -"ff c #8bc3ff", -"fe c #8bc4ff", -"fZ c #8bc6ff", -"ec c #8c8c8c", -"gv c #8cbff3", -"jO c #8d8d8d", -"a# c #8dadce", -"ic c #8dc7ff", -"#H c #8e8e8e", -"a. c #8eaed0", -"#L c #8ebae8", -"hY c #8ebee3", -"g4 c #8ec1ec", -"iO c #8ecbff", -"ju c #8f8f8f", -"bi c #8fb5da", -"h6 c #8fc0e5", -"f5 c #8fc4f9", -"jf c #909090", -"bl c #90b6dc", -"i1 c #90dfe2", -"bC c #919191", -"aB c #91b5dc", -"aZ c #91b7dd", -"hV c #91c2e8", -"gf c #91c6fc", -"gg c #91c7fd", -"f0 c #91c8ff", -"i7 c #929292", -"gA c #92c8fe", -"iz c #92ccff", -"iU c #939393", -"a7 c #93b9e0", -"f2 c #93c9ff", -"gQ c #93ccff", -"e8 c #949494", -".y c #9494b0", -"h1 c #94c6ec", -"f1 c #94caff", -"j9 c #959595", -"#X c #95b7da", -"cX c #969696", -"ay c #96bbe3", -"#f c #96bde8", -"aR c #96c3ee", -"gR c #96cfff", -".J c #979797", -"hQ c #97cfff", -"fT c #989898", -"#j c #98b6d7", -"#l c #98b7d8", -"iJ c #98c7e1", -"g6 c #98cffd", -"jj c #999999", -"aS c #99c4ee", -"h3 c #99ccf4", -"gS c #99d0ff", -".l c #9a9a9a", -".b c #9a9aa4", -"aw c #9ac1ea", -"gT c #9ad1ff", -"dg c #9b9b9b", -".N c #9bbee8", -"aq c #9bc1eb", -"am c #9bc4ee", -"eg c #9c9c9c", -"au c #9cc3ed", -"ao c #9cc5ee", -"c5 c #9d9d9d", -"aT c #9dc7ef", -"hU c #9dd2fb", -"hR c #9dd3ff", -"dh c #9e9e9e", -"#v c #9ebee0", -".Z c #9ec3e8", -"#M c #9ec3ed", -"#N c #9ec5ed", -"ap c #9ec5ef", -"aU c #9ec7f0", -"h2 c #9ed4fd", -"id c #9ed6ff", -"df c #9f9f9f", -"an c #9fc5ee", -"h0 c #9fd5fe", -"aM c #a0a0a0", -"hT c #a0d6ff", -"jh c #a1a1a1", -"hS c #a1d7ff", -"ji c #a2a2a2", -"#P c #a2c7ed", -"i8 c #a3a3a3", -"#O c #a3c8ed", -"iA c #a3daff", -"j. c #a4a4a4", -"je c #a5a5a5", -"#g c #a5c8ed", -"ip c #a5dafb", -"iv c #a6a6a6", -".F c #a6bed4", -"de c #a7a7a7", -"#h c #a7c9ed", -"if c #a7ddff", -"ie c #a7deff", -"eh c #a8a8a8", -"#i c #a8caee", -"iL c #a8dbf8", -"ig c #a8deff", -"iP c #a8e0ff", -"iY c #a8e2e6", -"hC c #a9a9a9", -".0 c #a9caed", -"#B c #aaaaaa", -"fU c #ababab", -".5 c #abc9e9", -"iB c #abe3ff", -"e2 c #acacac", -".6 c #accaea", -"jo c #adadad", -".1 c #adcbed", -".7 c #adccec", -"iD c #ade2ff", -"iC c #ade3ff", -"fS c #aeaeae", -".4 c #aecded", -"db c #afafaf", -".A c #afbbe7", -".2 c #afccee", -".3 c #afceee", -"d6 c #b0b0b0", -"iQ c #b0e9ff", -"bG c #b1b1b1", -"jg c #b2b2b2", -"#E c #b3b3b3", -".O c #b3d1ed", -"gF c #b4b4b4", -"cY c #b5b5b5", -"iR c #b5ebff", -"hM c #b6b6b6", -"iS c #b6ecff", -"d9 c #b7b7b7", -".U c #b8b8b8", -".u c #b9b9b9", -"dd c #bababa", -".P c #bad4ee", -"bL c #bbbbbb", -".Q c #bbd4ef", -".R c #bbd5f0", -"e9 c #bcbcbc", -"c3 c #bdbdbd", -"f. c #bebebe", -"d8 c #bfbfbf", -".o c #bfc2e8", -"iZ c #bffdff", -"iw c #c0c0c0", -"iV c #c1c1c1", -"i0 c #c1feff", -"ei c #c2c2c2", -"ej c #c3c3c3", -"#a c #c4c4c4", -"el c #c5c5c5", -"d7 c #c6c6c6", -".r c #c6cbda", -"ek c #c7c7c7", -"aN c #c8c8c8", -"#G c #c9c9c9", -"aL c #cacaca", -"ai c #cbcbcb", -".B c #cbddf2", -"bZ c #cccccc", -".C c #cce0f3", -"dc c #cdcdcd", -"ah c #cecece", -"da c #cfcfcf", -".E c #cfe1f3", -".D c #cfe1f4", -"#I c #d0d0d0", -"cV c #d1d1d1", -"fQ c #d2d2d2", -"bB c #d3d3d3", -"#c c #d4d4d4", -"d# c #d5d5d5", -"aK c #d6d6d6", -"cZ c #d7d7d7", -"c6 c #d8d8d8", -"gH c #d9d9d9", -".W c #dadada", -"gM c #dbdbdb", -"bQ c #dcdcdc", -"e1 c #dddddd", -"cR c #dedede", -"d. c #dfdfdf", -"bP c #e0e0e0", -"i# c #e1e1e1", -"bY c #e2e2e2", -".K c #e3e3e3", -"ee c #e4e4e4", -"d3 c #e5e5e5", -"ef c #e6e6e6", -".p c #e6e9f6", -"fV c #e7e7e7", -"eY c #e8e8e8", -".a c #e9e9e9", -".q c #e9edf8", -".V c #eaeaea", -"## c #ebebeb", -"Qt c #ececec", -".w c #ededed", -".x c #eeeeee", -"#. c #efefef", -".# c #f0f0f0", -".9 c #f1f1f1", -".I c #f2f2f2", -".T c #f3f3f3", -"ja c #f4f4f4", -"i9 c #f5f5f5", -"hB c #f6f6f6", -".H c #f7f7f7", -".G c #f8f8f8", -"i. c #f9f9f9", -"kg c #fafafa", -"kf c #fbfbfb", -".t c #fcfcfc", -".s c #fdfdfd", -"it c #fefefe", -"iu c #ffffff", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt", -"QtQtQtQtQtQtQtQt"}; diff --git a/tests/benchmarks/qimagereader/images/pngwithcompressedtext.png b/tests/benchmarks/qimagereader/images/pngwithcompressedtext.png deleted file mode 100644 index 01b2270..0000000 Binary files a/tests/benchmarks/qimagereader/images/pngwithcompressedtext.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/pngwithtext.png b/tests/benchmarks/qimagereader/images/pngwithtext.png deleted file mode 100644 index 5d93799..0000000 Binary files a/tests/benchmarks/qimagereader/images/pngwithtext.png and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/rgba_adobedeflate_littleendian.tif b/tests/benchmarks/qimagereader/images/rgba_adobedeflate_littleendian.tif deleted file mode 100644 index 78868b0..0000000 Binary files a/tests/benchmarks/qimagereader/images/rgba_adobedeflate_littleendian.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/rgba_lzw_littleendian.tif b/tests/benchmarks/qimagereader/images/rgba_lzw_littleendian.tif deleted file mode 100644 index 107eab7..0000000 Binary files a/tests/benchmarks/qimagereader/images/rgba_lzw_littleendian.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/rgba_nocompression_bigendian.tif b/tests/benchmarks/qimagereader/images/rgba_nocompression_bigendian.tif deleted file mode 100644 index c314bae..0000000 Binary files a/tests/benchmarks/qimagereader/images/rgba_nocompression_bigendian.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/rgba_nocompression_littleendian.tif b/tests/benchmarks/qimagereader/images/rgba_nocompression_littleendian.tif deleted file mode 100644 index 4f820f6..0000000 Binary files a/tests/benchmarks/qimagereader/images/rgba_nocompression_littleendian.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/rgba_packbits_littleendian.tif b/tests/benchmarks/qimagereader/images/rgba_packbits_littleendian.tif deleted file mode 100644 index ddeec38..0000000 Binary files a/tests/benchmarks/qimagereader/images/rgba_packbits_littleendian.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/rgba_zipdeflate_littleendian.tif b/tests/benchmarks/qimagereader/images/rgba_zipdeflate_littleendian.tif deleted file mode 100644 index 50a3024..0000000 Binary files a/tests/benchmarks/qimagereader/images/rgba_zipdeflate_littleendian.tif and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/runners.ppm b/tests/benchmarks/qimagereader/images/runners.ppm deleted file mode 100644 index fda1c97..0000000 Binary files a/tests/benchmarks/qimagereader/images/runners.ppm and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/task210380.jpg b/tests/benchmarks/qimagereader/images/task210380.jpg deleted file mode 100644 index fd045ea..0000000 Binary files a/tests/benchmarks/qimagereader/images/task210380.jpg and /dev/null differ diff --git a/tests/benchmarks/qimagereader/images/teapot.ppm b/tests/benchmarks/qimagereader/images/teapot.ppm deleted file mode 100644 index b8ab85f..0000000 --- a/tests/benchmarks/qimagereader/images/teapot.ppm +++ /dev/null @@ -1,31 +0,0 @@ -P6 -256 256 -255 -\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[7 eOLjQLmSMoTMnSMlRMhPL_9 \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀnSMtVMzYN~[N~[N\N\O€\O€]O€]O€]O€]O€\O€\O}[NyYNtVM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-wXN}[N€]O„^O†_O†`O‡`Oˆ`Oˆ`OˆaO‰aO‰aO‰aO‰aO‰aO‰aOˆaOˆ`O†_Oƒ^O\N \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀaMLyYN…_O‰aP‹bPcPŽcPŽdPŽdPdPdPdPdPdPdPdPeP‘eP’eP’eP‘ePdPcP…_OpUM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀwXN…_OdP“fP•gQ–hQ˜hQ˜iQ™iQ™iQšiQšiQšjQ›jQ›jQœjQœjQœjQœjQœjQ›jQœjQ™iQ“fP‡`O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJiQL‹bP—hQkQ¡mR¤nR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¦pR¨pS©qSªqS«rS¬rS«rS©qS¤oRœjQ€]O\KK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀfOLrUMcPŸlR©qS¯tS²uTµwT·xT¸xT¹yTºyT»zT»zU¼zU¼zU¼zU»zUºyT¸xT¶wT¯tS¡mR‰aOhPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àa0 cNLqUM€\O”fQ¦pS²wVºzV¿|VÂ}VÄVÆVÇ€VÉ‚WÌ…[Õeæ w÷³‹êª…Ĉg§qT“fQ{ZNYIK9\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀO1{G#‘JkRMqUMtVN–iS¨v\·€d¹bµzZ±vU°uT®sSªqS¤nRœjQ’eP„^OrUMHh>!T4\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀG-V5wE"~I#†M%U+¥e7²l:°g2®b*­a(­`(©^(¥])¡^-›]1ŠS,qC$`9 R3G-\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@)J/i>!pA"tD"wF$yH&xH&tE$wE#yG%}M+ƒT4S5mE*Z7!K/B*;'\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‰aO¦oR½{UÇ€VÏ…X<(F-a: e!j@#k@$h>"dµf-¨^(¡Z'šW&–T&œN>)F-J/b; g>#nD(jB&c y< u: r9 o7 l6 -j5 -h4 -g3 -5$D,K/b; h>"wM1tK.e="a<#cA,U8&E-<(9&.!a0 b1 c1     - -+3#@)46G<:HMCIXHK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀU*´vT¿~X¸{YÃk+›W&‰N$|> u: p8 k5 -f3 -a0 _/ ]. [- I¡\*ª_(‘LkRMmSMmSMnSMnSMD,R3W5mA"|O0|P1j?"c!a: X/K%&4$+2F=;HPEJL&\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀŸlR¶xT­sTµd)ŠO$w; m6 -g3 -a0 Z- \/ T*Q(ŠHµm8kRMmSMnTMoTMpTMpUM15G15G05G04G04GpUMpTM5^9 d!Y0W+]. s=‡M$dPŸlR\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀoTM¥oRdPvE"V+K%A 99†F¤['qUMtVM99H:9H:9H:9H:9H:9H:9H:9H:9H:9H99H99H99H99H99H99H:9H;:H>;HB=HPDJ\JKmSMwXN|ZN°y[ᦆ֘uº{W¹yU¿€]Á„b­tU£nR—hQˆaO{ZNvWNtVMvXNwXNyYNzYN{ZN|ZN}[N}[N~[N~[N~[N~[N~[N~[N~[N}[N}[N{ZNzYNxXN…L$f3 -I$L&P(U*\. €J#\O›jQ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀžkR‰aOo9 L&C!:4f3 -X&pUMuWMwXNxXN<:H<:H<:H<:H<;H<;H<;H<;H=;H=;H=;H=;H>;H>;H?HG@ILBIREJ[JKcNLjQL§pR±uTºzUÃ~VÈWË‚XÖŽcäsÒŽe¼{V²vT¨pSžkR•gQŒbP†_O‚^O]O€\O€\O€\O€\O€]O]O]O]O]O]O]O]O]O]O]O€\O€\O~\N}[N|ZNxXN•T%H$G#K%Q(W+zG#nTM˜iQ\À\À\À\À\À\À\À\À\À\À\À\ÀdOLrUMuWNwXNyYN{ZN}[N{ZNwXNsVM \À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àˆ`OcPnA"M&@ 8F#m6 -›W&rVMvWNyYNzYN|ZN}[N}[N>HE?IG@IIAIKBIODJSFJWHK—hQŸlR§pR°b(¾i*Én+Ù|7Û|6Ïr,Íq+Êp-Ãl+»g)±b(®sS§pS lRšiQ•gQePcPŠaPˆaO‡`O‡`O†_O†_O…_O…_O…_O…_O…_O…_O…_O„_O„^O„^Oƒ^Oƒ^O‚]O]O€\O~[N{ZN•T%F#B!Y,L&U*~I#„^O†`O\À\À\À\ÀcNLrUMzYN\O„^Oˆ`OŠbPŒcPdPeP’fP“fP“fQ“fQ”fQ‘ePcP‰aP~[N\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À’fPsVM^/ C!7 ŽQ%tVMwXNzYN|ZN}[N\N\O€\O]O]O‚]O‚]OA=HB=HB=HB>HC>HC>ID?IE?IF@IG@IIAIKBIŒcPdP’eP–gQšiQŸlR£nR¤\'´d)¿i*Æm+Îs/Ïs/Êo+Én+Ål*¾i*ºg)³c(ª_(ªqS¦oR¡mRkQ™iQ•gQ“fP‘ePŽdPcPŒbP‹bPŠbPŠaP‰aP‰aO‰aOˆaOˆ`Oˆ`O‡`O‡`O‡`O†`O†_O…_O„^Oƒ^O‚]O\O}[N›QD"?D"K%_/ kRL’fPODJSFJ†_OŠbPŽcP‘eP“fQ–gQ™iQœjQžkR lR¡mR£nR¤nR¥oR¥oR¥oR¤nR¢mRŸlRšiQ‘eP…_O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀB+‘ePI#L&90y< šPxXN{ZN}[N\N€\O]O‚]Oƒ^Oƒ^O„^O„_O…_O…_O†_O†`O‡`O‡`Oˆ`O‰aOŠaP‹bPŒbPcPŽdP‘eP“fP•gQ˜hQšiQžkR¢mR¡Z'«_(¶e)½h)Âk*Çn,Çn,Æm*Æl*Áj*ºf)¶e)²c(«_(¦]'§pR¤nR¡mRžkR›jQ™iQ–gQ”gQ“fP‘ePdPdPŽdPŽcPcPŒcPŒbP‹bP‹bP‹bPŠbPŠaP‰aP‰aO‰aOˆ`O‡`O†_O…_Oƒ^O]Oª_(@ B!I$B!N'w=‘eP`LKbNLeOLkR mR£nR¥oR§pSªqS¬rS®sS¯tS°tS°tS±uS±uS°tS¯tS­sSªrS§pS¢mRšjQŒbPjQL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‹bPpTME"5‡M$tVM{ZN}[N\O]O‚^Oƒ^O„_O…_O†_O†`O‡`Oˆ`Oˆ`O‰aO‰aPŠaPŠbP‹bPŒbPcPŽcPdPdP’eP“fP•gQ—hQ™iQ›jQkR lR¢mR¡Z'¬`(µd)ºg)ÇgÀj*Àj*¾i*¿i*»g)µd)²c(¯a(ª_(¤\'§pR¥oR¢nR mRžkRœjQšiQ˜iQ—hQ•gQ”gQ“fP’eP‘eP‘ePdPdPdPŽcPŽcPcPcPŒcPŒbP‹bP‹bPŠbPŠaP‰aOˆ`O†_O„^O\NœQ@ <G#_LKŽcPlSMnTMpUMsVM°tS²uT³vTµwT¶wT¶xT¶xT¶wTµwT´vT²uT¯tS¬sSªqS§pS¤oR¢nRžkR˜hQ‹bPeOL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀwXN\NJ%01ŽJvWN}[N\O]Oƒ^O…_O†_O†`O‡`Oˆ`O‰aO‰aPŠaPŠbP‹bPŒbPŒbPcPŽcPŽdPdPdP‘eP’eP”fQ•gQ–gQ˜hQ™iQ›jQkQŸlR¡mRžY&¦]'­`(³c(·e)Àc¸\¸\¹\º]»]¶^®a(¬`(©^'£['¢['¥oR£nR¡mR lRžkRœkQ›jQšiQ˜iQ—hQ–gQ•gQ”gQ”fQ“fP’eP’eP‘eP‘ePdPdPdPdPŽdPŽcPcPcPŒbP‹bPŠaPˆaO†`O]O˜OG#7F#uWMƒ^OwXNxXNzYN{ZN|ZN¹yT¸yT·xT´wT±uT­sS¨pS¡mRœjQ•gQdPŒbP‰aP‰aPŒbPŽcP‘ePcP|ZN\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[JKŠbP^/ 1 01|> wXN}[N]Oƒ^O…_O‡`O‡`OˆaO‰aPŠaP‹bP‹bPŒbPŒcPcPŽcPŽcPdPdPdP‘eP’eP“fP”fQ•gQ–gQ—hQ˜hQ™iQ›jQœkQžkRŸlR mRžY&¦]'­`(±b(·[ÇgÉiÉhÅfÂdÃe¿c«Uª_(§]'£[' Z'¤nR£nR¡mR mRŸlRžkRkQœjQšjQšiQ™iQ˜hQ—hQ–gQ•gQ•gQ”fQ”fQ“fP“fP’eP’eP‘eP‘ePePdPdPdPŽcPcPŒbPŠbPˆ`Oƒ^O‰D 4M&dPnSM|[N|[O|[OzZOxXNªrS¢nR˜hQŽcPƒ^OvXNiQL^KKRFJMCJJAIKBISFJ\JKnSMxYN†_O€\OaMK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀB!qUMŠaPC!/00a0 uWN}[N‚]O…_O†`Oˆ`O‰aPŠaP‹bPŒbPŒcPcPŽcPŽcPdPdPdP‘eP‘eP’eP“fP“fQ”fQ•gQ–gQ—hQ˜hQ™iQ™iQ›jQœjQkRžlRŸlRœX&¢['¨^'¬`(´ZÂdÄfÈiÆgÂd¿c¿c¼a¸_©T¥\'£[' Z'ŸY&£nR¢mR¡mR lRŸlRžkRkQœjQ›jQšjQšiQ™iQ˜hQ—hQ—hQ–hQ–gQ•gQ•gQ”gQ”fQ”fQ“fQ“fP’fP’eP‘eP‘ePdPdPŽcPŒbP‰aOƒ^Ox< :ŠaP]Oj8sVMmSMfOL^KKUGJIAIQEJ?IeZY638*  B\À\À\À\À\À,  4 .G1!\TU¡ƒrsVM{ZN`MK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À[JKyYNŒbP/0ˆN$]O…_Oˆ`O‹bPŒbPcPŽcPdPdPdP‘eP‘eP’eP’fP“fP“fQ”fQ”gQ•gQ–gQ–gQ—hQ—hQ˜hQ™iQ™iQšiQ›jQœjQœkQkRžkRŸlRœO¡Z'¥\'©^'­V¼a¾bÁeÆi!Ãf¾b»a¹`·_³]²\µZ¢[' Z'ŸY&œQ¡mR¡mR mR lRŸlRŸlRžkRkRkQœkQœjQ›jQ›jQšjQšiQšiQ™iQ™iQ˜iQ˜hQ˜hQ—hQ—hQ—hQ–hQ–gQ–gQ•gQ•gQ”fQ’fPdPcPšW&dPŠaPrUM - B\À\À\À\À\À\À\À\À\À\À%7!!C*F#P) {dYœze»p€\OgPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ`LKvWNŠaPm6 - X,uWM‚]O‡`OŠbPcPŽdPdPdP‘eP’eP’fP“fP“fQ”fQ”gQ•gQ•gQ–gQ–gQ—hQ—hQ˜hQ˜iQ™iQ™iQšiQ›jQ›jQœjQœkQkQžkRžlRŸlR¢Z'¤\'§]'·_¹`¼a½bÁeÅi"Áe¼aº`·_¶_²]²\±\«Y¡Z' Z'¡Z'¡mR¡mR mR lR lRŸlRŸlRžlRžkRžkRkRkQœkQœjQœjQ›jQ›jQ›jQšjQšiQšiQšiQ™iQ™iQ™iQ˜iQ˜hQ˜hQ—hQ–gQ•gQ“fQdP†_Oq8 –gQˆ`OuWM”T%\À\À\À\À\À\À\À\À\À\À B B!!T,c5ƒF‚T3È›~Æ“qƒ^OfOL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXHK_LKsVM‡`OcP ’S%]OŠbPcPdP‘eP’eP“fP“fQ”fQ”gQ•gQ•gQ–gQ–gQ—hQ—hQ—hQ˜hQ˜iQ™iQ™iQšiQšiQ›jQ›jQœjQœjQkQkRžkRžlRŸlRŸlR¥\'¦]'¨^'­Vº`»a½bÁfÄi"Àe»a¹`·_¶_³]±\±\¤R¢Z'¢Z'£['¡mR¡mR¡mR¡mR mR lR lRŸlRŸlRŸlRžlRžkRžkRkRkRkQkQœjQœjQœjQœjQœjQ›jQ›jQ›jQ›jQšjQšiQ™iQ™iQ˜hQ–gQ‘eP§Sq8 ‰aO•gQ‡`OtVMœX&\À\À\À\À\À\À\À\À\À\À B B B l@!{A…L$›Y'½†a“fPˆaO]KK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀODJ[JKaMKqUM\OcPƒ^OvE"‚]OŠaPdP‘eP“fP”fQ•gQ•gQ–gQ–hQ—hQ—hQ˜hQ˜hQ˜iQ™iQ™iQ™iQšiQšjQ›jQ›jQœjQœjQœkQkQkRžkRžkRŸlRŸlRŸlR lR©^'©^'ª_(®W»a¼a¾cÂg Äi"¿e»a¹`·_¶_³^±\±\¤R£['£['§]'¢mR¢mR¡mR¡mR¡mR¡mR mR lR lR lR lRŸlRŸlRŸlRŸlRžlRžlRžkRžkRžkRžkRkRkRkRkRkQkQkQœjQœjQšiQ˜hQ’ePšW&M&oTMšiQ‘eP…_OtVMmSMdOL\À\À\À\À\À\À\À\À\À B B B ‘J Z'ª_(œkQ™iQ‡`OSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀTFJ\JKcNLlRMzYN‡`O’ePzZN \Nˆ`OdP“fQ•gQ–gQ—hQ˜hQ˜hQ™iQ™iQ™iQšiQšiQšiQ›jQ›jQ›jQœjQœjQœjQœkQkQkRžkRžkRžlRŸlRŸlRŸlR lR lR mR®a(­`(¬`(¶[½a½b¿dÃh!Äi"¿d»a¹`¸_¶_µ^²]³]¦S¤\'§]'«_(¢nR¢mR¢mR¢mR¢mR¢mR¢mR¡mR¡mR¡mR¡mR¡mR mR mR mR mR lR lR lR lR lR lR lR lR lRŸlRŸlR lRŸlRžkRœkQ™iQePt: kQ˜hQcP€]OtVMlSMa2 \À\À\À\À\À\À\À\À\À B B -$5 ¬`(¶e)£nRœjQƒ^OJAI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXIK^KKdNLhPLuWM‚]OŒbP”fQeP m6 -†`OŽcP“fQ—hQ˜hQ™iQšiQšjQ›jQ›jQ›jQœjQœjQœjQœkQkQkQkRžkRžkRžkRžlRŸlRŸlRŸlR lR lR lR¡mR¡mR¡mR¡mRºg)³c(²c(±b(­V¿cÂeÅi!Åi!Àd¼bº`¹`·_·_¶^¢Q§]'ª_(­`(¹f)£nR£nR£nR£nR£nR£nR£nR¢nR¢nR¢nR¢nR¢nR¢nR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢mR¢nR¢mR¢mR£nR¢mR¢mR¡mR mRkR—hQˆGa0 ŠbP mRœjQ“fQ‰aP}[NrUMmSM…L$\À\À\À\À\À\À\À\À B B #C, 8&H.Z7 §pR›jQ{ZN\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀQEJ[JK`LKdNLhQLqUM{ZN…_OŽcP–gQ—hQ -‹bP‘eP–hQšiQ›jQœjQkQkQkRžkRžkRžlRžlRŸlRŸlRŸlRŸlRŸlR lR lR lR mR¡mR¡mR¡mR¡mR¡mR¢mR¢mR¢mR¢nR£nRÀj*ºg)·e)¶d)Âd°XÅgÅhÂe¿c½b½b¾bªU­`(®a(¯a(³c(¾i*¤oR¤oR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤oR¤oR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¥oR¥oR¤nR¡mR›jQŽQ%Z- œjQ£nRŸlR—hQŽdP…_OuWMpTMnSMkRLa: \À\À\À\À\À\À\À B B&D2 @*S6#G@IPDJ˜hQmSM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ]KKbMLeOLiQLlRMvWN\OˆaO‘eP—hQœjQ•gQoTM•gQ™iQkQŸlRŸlR lR mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¢mR¢mR¢mR¢mR¢mR¢mR¢nR£nR£nR£nR£nR£nR¤nR¤nR¤nR¤nR¤nR¤nRÆl*Ãl+¾j+¹g)¸f)¶e)µd)¶e)¶e)·e)·e)¸f)¾i*Ìs0Ðs.¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦pR§pR§pR§pR§pR§pS§pS¨pS¨qS©qS©qS©qS¨pS©qS§pS¤nRŸlR‘I˜hQ§pR¥oR¡mRšiQ’ePŠaP€\OsVMpTMnTMlRM–X)\À\À\À\À\À\À\À B%C)D$;J/[8"LBITGJYIKWHK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK_LKcNLgPLjQLlRMpUMzYNƒ^O‹bP‘eP˜hQkQŸlR”fQ- —hQ›jQŸlR¢mR£nR£nR£nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤oR¤oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¦oR¦oR¦oR¦oR¦oR¦pR¦pR§pRàpßy-Ûw-Ûw-Þy.â{-ãu§pS§pS§pS§pS§pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨qS©qS©qS©qS©qS©qS©qS©qSªqSªrS«rS«rS¬rS¬rS¬rS¬rS¬sS«rSªqS¦oRšiQ™iQ©qSªqS§pR¡mRœjQ•gQcP„_O{ZNtVMpUMoTMmSMjQL_9 \À\À\À\À\À B "C(D#*A$[<)dI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JKaMKeOLhPLkRLmSMoTMuWM}[N…_O‹bP’eP˜hQžkR¢mR£nRžkR!-EkR¡mR¤nR¥oR¦pR§pR§pS§pS§pS§pS§pS§pS§pS§pR§pS§pS§pS§pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨pS¨qS¨qS¨qS©qS©qS©qS©qS©qS©qS©qS©qS©qS©qS©qSªqSªqSªqSªqSªrS«rS«rS«rS«rS«rS«rS¬rS¬rS¬rS¬sS­sS®sS®sS¯tS¯tS¯tS¯tS°tS°uS°tS®sS«rS£nR¦oR®sS­sS«rS§pR¢mRœjQ–gQdPˆaO\OyYNuWMqUMoTMnSMkRLo8 \À\À\À\À\À B'D+E$(1 J/jH1NCJUGJYIKUGJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀXHK]KKbNLfOLiQLkRMmSMoTMqUMxXN\N†_OŒbP’fP˜hQkQ¡mR¥oR§pS¦pR˜hQ¢mR¥oR¨pSªqS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rSªrSªrSªrS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS«rS¬rS¬rS¬rS¬rS¬rS¬rS¬rS¬sS¬sS­sS­sS­sS­sS­sS­sS®sS®sS®sS®sS®tS¯tS°tS°uS±uS±uT±uT²uT²uT²uT´vTµwT´vT³vT²uT¯tS¢mR¯tS±uT±uS®tS«rS§pR¢mRkQ—hQ‘ePŠaPƒ^O\N{ZNvXNqUMpTMnSMlRMP%\À\À\À\À B#C*E$.E- .!G$Y:%d<"SFJYIKZIKNCJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀPDJZIK_LKdNLgPLjQLlRMnSMpTMqUMuWMyYN€\O†`OcP’fP—hQœjQ¡mR¥oR¨qS«rS«rSªrS mR«rS­sS¯tS°tS°tS°tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS®tS®sS®sS®sS®sS®sS®sS®sS®sS®sS®tS®tS®tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS¯tS°tS°tS°tS±uS±uS±uT²uT²vT³vT³vT´vT´vT´wTµwTµwTµwT·xT·xT¸xT¸yT¸yU·xU¥\'©qS³vTµwTµwT´vT±uT®tTªrS¦oR¡mRkQ˜hQ’eP‹bP‡`Oƒ^O€\O|ZNxXNtVMpTMoTMmSMjQLh7\À\À\À B(D"-E*1F, 4#K)pL5PEJWHK[JKXHK:9H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀUGJ\JKaMLeOLhPLkRLmSMoTMpUMrVMvWNyYN|ZN]O‡`OŒcP‘eP—hQ›jQ lR¤nR§pSªqS­sS¯tS°uS¯tS­sS mR^/ ²vT³vT´vT´wTµwT´wT´vT³vT´vT´vT´vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT³vT´vT´vT´vT´vT´wTµwTµwTµwTµwT¶wT¶wT¶xT·xT·xT·xT¸xT¸xT¸xT¹yTºyT»zU¼zU½{U½{V½|V•gQ¬rSµwT¸xT¹yU¹yU¹zV·yVµxV±vU­tT©qS¥oS mRœjQ—hQ’ePcPŠbP‡`O„_O]O}[NyYNuWMpUMoTMmSMkRL}H#\À\À &D -E(1F/!2#8 W7"iA&UGJ[JK\JKREJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀMCIXIK^KKcNLfOLiQLkRMmSMoTMqUMsVMwXNzYN}[N€\Oƒ^O‡`OŒbP‘eP–gQšjQžkR¢mR¥oR©qS¬rS¯tS±uS³vT´vTµwT´wT²uT­sS lR«_(¹yT¹yTºyTºyTºyTºyTºyT¹yT¹yT¸yT¸xT¸xT¸xT¸xT¸xT¸xT¸yT¸yT¸yT¸yT¹yT¹yT¹yT¹yT¹yT¹yT¹yTºyTºyTºyTºyTºzT»zT¼zU¼{U½{U¾{U¾|U¿|UÀ}VÁ~VÂWÀY™iQ«rSµwT¹yT¼zU½|V¿}XÁ€ZÂ]Á]¾€]»~[¶zY±wW¬tU¨qS¤nSŸlR›jQ–gQ“fPePŽcP‹bPˆ`O…_O‚]O~\NzZNvXNqUMoTMnSMlRMiQLg=!\À -!C+E'0F.4F7%8%U/lG.SFJZIK]KKZIKB=H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀREJZJK`LKdNLgPLjQLlRMnSMpTMqUMtWMxXN{ZN~[N]O„^O†`O‰aO‹bPdP•gQ™iQœkQ lR¤nR§pSªrS­sS¯tT²uT´vT¶wT·xT¹yT¹yTºyTºyT¹yT¶xT´vT¬rS¢nR—hQ¿|U¿|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ|UÀ}UÀ}UÁ}UÁ}UÁ}UÁ}UÂ}UÂ~UÃ~UÃ~VÃ~VÄVÅ€WÆX®a(ŸlRªrS´vT¸yT¼zU¾|UÁ~VÃXÆ‚[Ɇ_΋dÓ‘jÔ“mÔ“nБlÊŒhĆd½_¶{[°vWªsU¦pS¢nRžkRšiQ˜hQ•gQ“fQ‘ePdPŒbP‰aO†_Oƒ^O€\O|ZNxXNsVMpTMnTMmSMjQL€C B)D&/F-3F47G6%>" Y7 kA$YIK]KK^KKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ\KKbMLeOLhPLkRLmSMnTMpTMrUMuWNyYN|ZN\N‚]O„_O‡`OŠaPŒbPŽcPeP“fP—hQ›jQžlR¢nR¥oS©qT¬sT¯uU²vU´wV¶xV¸yV¹yUºzU»zU¼{U½{U¾{U¾|U¿|U¿|U¿|U¿|U¾{U½{U¼{U¼zU»zTºyT¹yT¸xTµwT³vT´vT´vT´vT´wT´wTµwT·xT¹yTºzT¼zU½{U¾{U¿|UÀ|UÂ}UÄVÅ€WÇ‚YÉ„\͈_ÑŒdÙ”láuç£|쩂ſt명æ¦ÞŸ{Õ—sËŽl†d¹^³yZ­uW¨qU¤oSŸlRžkRœjQšiQ˜hQ–gQ”fQ‘ePdPcPŠaP‡`O„^O]O}[NyYNuWMpTMoTMmSMkRLgPL&D#.E,3F46G;'<(D"iB(VGJ]KK`LK[JKB>H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^LKcNLfOLiQLkRMmSMoTMqUMsVMvXNzYN}[N€\O‚^O…_Oˆ`OŠaPŒcPdP‘eP“fQ•gQ—hQ™iQkR mS¤oT¨rU¬tW°wY´zZ¸}\»]¾€^À^Á‚^‚^Â\Á€ZÁYÁXÁ~WÁ~WÂ~VÂ~VÂ~VÃ~VÃ~UÃ~UÄ~UÄ~UÄUÄUÅVÅVÅVÅVÆVÆ€VÆ€VÇ€WÇWÈ‚XɃZË…[͇^ЊaÓdØ’iÜ—nâtè£zî©ó¯‡ø´û¸‘üº“û¹“÷¶ñ±Œé©…à¡~Ö˜vËmÇf»€`´z[®vX©rU¥pT£oS¢nS lRžkRœkRšjQ˜iQ–hQ”fQ’ePdPcP‹bPˆ`O…_O‚]O~[NzYNvWNpTMoTMnSMkRMhQLo7 ,2F36G99HC+@ ]8 nA"\JK`ML_LKSFJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMpTMqUMtVMwXNzZN}[N€]Oƒ^O†_OˆaO‹bPcPdP‘eP“fQ•gQ—hQ™iQ›jRžlR mS£oU§rW¬vZ²{]¹€a¿…fÅŠjËnГqÓ•sÕ–sÕ–rÕ–qÕ”oÓ’mÑjÏgÍŠcˈaɆ^È„\Ç‚[ÆYÅ€XÅ€WÅWÅWÅVÅVÅWÅ€WÆ€WÇXÈ‚YɃ[Ê…\͇_ÏŠaÒeÕ‘hÙ•mÝ™qávä¡zç¤}꧀멃몄騃奀ߠ|Ù›wÓ•rÌmƉh¿„c¸~^²yZ®vX¬tWªsV¨qU¦pT¤oS¢nS mRžlRœkR›jQ™iQ—hQ•gQ“fPePŽcP‹bPˆaO…_O‚^O\N{ZNwXNsVMoTMnSMlRMiQL~I#26G99G?IQ2P+XHK_LLfQOcNLXIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À©qSºyTÃ~VΈ`遲ޜv¾€]ªqS–LŽG|> g3 -S)?*%.—hQ—hQ‘eP‡`OuWM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀSFJ[JK`LKdNLgPLjQLlRMnSMoTMqUMsVMwXNzYN}[N€\O‚^O…_O‡`OŠaPŒbPŽdP‘eP“fP•gQ—hQ˜iQšjRœkRŸlS¡nT¤pV§sX«vZ°z^¶b¼…gËmÊ’sјzØŸ€Þ¤…ã©Šè­ê¯ë°ê¯Žè¬‹å¨‡à¤‚Ûž|Ö™wÑ“qÌŽlljgÃ…bÀ‚_½\»}Zº{X¹zW¸yV·yU·xU·xU·xT·xT·xU·xU·xU·yV·yV·yW¸zW¸{X¹{Y¹|Zº}[º}[º}\º~\¹~]¹~]¸}]·|\µ{\´z[²yZ°wY®vX¬tWªsV¨rU¦pT¤oS¢nS¡mRŸlRkRœjQšiQ˜hQ–gQ”fQ’ePdPcPŠbP‡`O…_O‚]O~[NzZNvWNrUMoTMmSMlRMiQLeOLJAIJ(h>!]KKfQOgQN_LKD>I\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À™iQ°tS¸yT¼{UÂYÎŒeï­ˆô´Õ—u¶|\ Z'™LˆD |> ’eP¦oR¨qS¦oR¡mRšjQ‘eP„^OhPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀWHJ\KKaMLeOLhPLjQLlRMnSMpTMqUMtVMwXNzZN}[N€]Oƒ^O†_Oˆ`OŠbPcPdP‘eP“fQ•gQ—hQ™iQ›jRkRŸmS¢nT¤qV¨sX¬w[±{_¶€c½†hÄŒnË’tÒ™zØŸ€Þ¥…㩉ç­ê¯Žê¯Žê®ç«Šä§†ß£Ûž|Õ˜vГpËŽkljfÃ…bÀ‚_½\»}Yº{X¸zW¸yV·xU·xU·xT¶xT¶xT¶xU¶xU·xU·xU·yV·yV·zW¸zX¸{Y¹|Y¹|Z¹}[¹}[¹}\¹}\¸}\·}\¶|\µ{[³zZ²yZ°wY®vX¬tWªsV¨rU¦pT¤oS£nS¡mRŸlRžkRœjQšiQ˜hQ–gQ”fQ’ePdPŽcP‹bPˆ`O…_O‚^O\N{ZNwXNsVMoTMnSMlRMiQLfOLJ(V.]KKePNkUQcNLQEJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À‚]O¡mR©qS¬rS°tS³vTµwT·xUº{WĆbÒ“qךxÊo -K«rS´vT¶wT´vT²uT®sSªqS¤nRkQ•gQˆ`OuWNY,\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀNCJYIK^KKbNLfOLhQLkRLmSMoTMpUMrUMuWMxXN{ZN~[N]O„^O†_O‰aO‹bPcPdP‘eP“fQ•gQ—hQ™iQ›jRkRŸmS¢oT¥qV¨tX­w[±|_·d½†iÄŒnË“tÒ™zØŸ€Þ¥…㩉笌鮎ꮎ魌檉㧅ߢ€Ú{Õ—uÏ’pËjƈfÂ…b¿^½\»|Y¹{X¸zV·yV·xU·xU¶xT¶xT¶xT¶xU¶xU¶xU¶xU·yV·yV·yW¸zW¸{X¸{Y¸|Z¹|Z¹|[¹}[¸}\¸}\·|\¶|[µ{[³zZ±xY°wX®vX¬tWªsV¨rU¦pT¥oS£nS¡mRŸlRžkRœjQšjQ˜iQ—hQ”gQ’fPdPŽcP‹bP‰aO†_Oƒ^O€\O|ZNxXNtVMoTMnSMlRMjQLgPLzG#\JKcOMoXUgPMZIK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À’fP”gQ•gQ—hQ™iQkQ lR¤nR§pRªqS¬sS¯tS:"r<zYN­sS¹yT¾|UÁ~WÆ„^ËŠeË‹gƈe¾‚aµz[­tV¦pS¢mRkQ–gQŠbPzYNkRL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀRFJZJK`LKcNLfPLiQLkRMmSMoTMqUMrVMvWNyYN|ZN\N]O„^O‡`O‰aO‹bPcPdP’eP”fQ–gQ—hQ™iQ›jRlR mS¢oU¥qV©tY­x\²|`¸d¾‡iÅoË“uÒ™{ÙŸ€Þ¥…㩉笌é®é®è¬‹å©ˆâ¦„Þ¡ÙœzÔ—tÏ‘oÊŒjƈe„a¿^½~[»|Y¹{X¸zV·yV·xU¶xU¶xT¶xT¶xT¶xT¶xU¶xU¶xU¶xV·yV·yW·zW·zX¸{Y¸{Y¸|Z¸|Z¸|[¸|[·|[·|[¶{[´z[³yZ±xY°wX®vW¬tWªsV¨rU¦pT¥oS£nS¡mRŸlRžkRœkRšjQ™iQ—hQ•gQ“fP‘ePŽdPŒbP‰aP†`Oƒ^O€]O}[NyYNuWNqUMnSMlSMkRLhPLcNLbNLpYVlUP`LK>;H\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À›jQ‡`O{ZN©^'¨^'­`(·e)½h)Ãk*Êo+±b(£nRºyTÃ~UÇXÒdãŸwò°‰ñ°‹è©…ÝŸ}Ô˜vÈm¾„eµ}_®x[°y\®x[«tW§qT¡mRœjQ–gQ‹bP}[NlRM\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀVGJ\JKaMKdNLgPLjQLlRMnSMpTMqUMsVMvXNzYN|[N\O‚]O…_O‡`O‰aPŒbPŽcPdP’eP”fQ–gQ˜hQšiQœjRžlS mS£oU¦rW©uY®x\³|`¸d¾‡jÅoÌ“uÒš{Ù €Þ¥…㩉欋è­è­Œç«Šå©‡á¥ƒÝ ~Ø›yÓ–tΑoÊŒjňe„a¿^¼~[º|Y¹{W¸zV·yV·xU¶xU¶xT¶xT¶xT¶xT¶xU¶xU¶xU¶xU¶xV·yV·yW·zX·zX¸{Y¸{Z¸{Z·|Z·|[·|[¶{[µ{[´zZ³yZ±xY¯wX®uW¬tVªsV¨rU¦pT¥oS£nS¡mR lRžkRœkR›jQ™iQ—hQ•gQ“fQ‘ePdPŒcPŠaP‡`O„^O]O~[NzYNvWNrUMnSMmSMkRLiQLeOLoXUu]XdOLKBI\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À:9H\N–hQ¸}\¯uU­sT¯tT¯tS¨qS¤nR£nR¢nRŸlR›jQšiQ˜hQ—hQ–gQ”fQ’eP‘eP—hQœkR mS¥pUªtX«uY¨sW¦qU mS›jQ•gQƒB’S%jQL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀLBIXHK^KKbMLeOLhPLjRLlSMnSMpTMqUMtVMwXNzYN}[N€\O‚^O…_O‡`OŠaPŒbPŽcPeP’fP”fQ–gQ˜hQšiRœkRžlS nT£pU¦rWªuY®y]³}`¹‚e¿ˆjÅŽpÌ”vÓš{Ù Þ¤…⨉櫋笌笋櫊䨆ंܟ~ךxÒ•sÎnÉŒiŇeÁ„a¾€^¼~[º|Y¹{W¸yV·yV·xU¶xU¶xT¶wT¶wT¶wT¶xT¶xU¶xU¶xU¶xV¶yV¶yW·zW·zX·zY·{Y·{Z·{Z·{Z¶{Z¶{ZµzZ³yZ²yY±xY¯vX­uW¬tVªsU¨rU¦pT¥oS£nS¡mR lRžlRkR›jQ™iQ—hQ•gQ“fQ‘ePdPcPŠaP‡`O…_O‚]O\N{ZNwXNsVMnSMmSMkRMiQLfOL_LKhQMUGJ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À (6BFP>=DKHMqjk€trwf`~kc„ndŠqesete¯Ž{w`¡v[\N†_OcP“fP˜iQœjRŸlS£oT¦qV¥qV£oTžlR™iQº^‡`OQ%hPL\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀQEJZIK_LKcNLfOLiQLkRLmSMoTMpUMrUMuWMxXN{ZN~[N€]Oƒ^O…_Oˆ`OŠaPŒcPŽdP‘eP“fP”gQ–hQ˜iQšjRœkRžlS¡nT£pU¦rWªuZ®y]³}a¹‚e¿ˆkÆŽpÌ”vÓš{ÙŸ€Þ¤…⨈媊櫋櫊婈⦅ߣ۞}ÖšxÑ•rÍmÈ‹ićdÁƒa¾€]¼~[º|Y¹zW¸yV·yU¶xU¶xU¶wT¶wT¶wT¶wT¶wT¶xU¶xU¶xU¶xU¶xV¶yV¶yW¶zX·zX·zY¶zY¶{Y¶{Z¶{ZµzZ´zZ³yY²xY°wX¯vX­uW«tVªsU¨rU¦pT¥oS£nS¡mS mRžlRkR›jQ™iQ˜hQ–gQ”fQ‘ePdPcP‹bPˆ`O…_O‚]O\O|ZNxXNtVMoTMmSMlRMjQLgPLbML[JK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À%5 (6$/79CEEKjgkrc_›…{‘uf±{Ÿw_ºq]Oˆ`OŽcP”fQ˜hQ›jRžlR¡nT¢oT¡nTkR˜hQŽdP¦]'ŽQ%\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀUGJ[JK`MKdNLgPLiQLkRMmSMoTMqUMrUMuWNxXN{ZN~[N]Oƒ^O†_Oˆ`OŠbPcPdP£['µd)•gQ—hQ˜iQšjRœkRžlS¡nT£pU§rWªvZ¯y]´~aºƒfÀˆkÆŽpÌ”vÓš{ØŸ€Ý¤„ᧇ䩉媊媉䨇᥄ޡ€Ú|Õ˜wДrÌmÈŠhĆdÀƒ`¾€]»}[º|Y¸zW·yV·xU¶xU¶xU¶wTµwTµwTµwTµwTµwUµwUµxUµxUµxV¶xV¶yW¶yW¶yX¶zX¶zY¶zYµzYµzY´zY´yY²yY±xY°wX®vW­uW«tVªsU¨qU¦pT¥oS£nS¢mS mRžlRkR›jQ™iQ˜hQ–gQ”fQ’ePdPcP‹bPˆaO†_Oƒ^O€\O|[NxYNtWMpUMmSMlRMjQLgPLcNLA;=\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À#*6+.8;:AHEJmgjd\]‡pe«}œxc w^»pƒ^OŠaP‘eP–gQšiQžlR mS¢nT mS›jR•gQ»h*œX&ˆM$\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀC+WHJ]KKaMLdOLgPLjQLlRMnSMoTMqUMrVMvWNyYN|ZN\N]O„^O†_OˆaO‹bPcPžY&«_(³c(•gQ—hQ™iQšjRœkRŸlS¡nT¤pV§sX«vZ¯z^´~bºƒfÀ‰kÆŽpÌ”vÒš{ØŸ€Ý£„ই㩉䩉䩈⧆ःܠØœ{Ô—vÏ“qËŽlljgÆcÀ‚`½]»}Z¹{Y¸zW·yV¶xU¶xU¶wUµwTµwTµwTµwTµwTµwTµwUµwUµxUµxVµxVµxVµyWµyWµyXµyXµyYµzY´yY´yY³yY²xY±wX°wX®vW­uV«tVªrU¨qU¦pT¥oS£nS¢mS mRžlRkR›jQ™iQ˜hQ–gQ”fQ’ePdPŽcP‹bP‰aO†_Oƒ^O€\O}[NyYNuWNqUMmSMlRMjQLhPLdNL\1\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À+.775;ICFphhŠztŠre¯}Ÿya¢vZ]OŠaP‘eP–gQšiQkRŸlS¡nTžlS™iQÌq.¯b*“S%zG#\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀMCJXHK^KKbMLeOLhPLjRLlSMnSMpTMqUMsVMvWNyYN|ZN\N‚]O„^O†`O‰aO‹bP—U&¥\'¯a(»g)Ìr/—hQ™iQ›jRkRŸmS¡nT¤pV§sX«v[¯z^´~bºƒfÀ‰kÆŽpÌ”vÒ™{מÜ£ƒà¦†â¨ˆã¨ˆã¨‡á¦…Þ£‚ÛŸ~×›yÓ–uÎ’pÊkƉgÂ…c¿‚_½]»}Z¹{X¸zW·yV¶xU¶xUµwTµwTµwTµwTµwTµwTµwTµwUµwUµwUµxUµxVµxVµxWµyWµyWµyXµyX´yX´yY³yY³xX²xX°wX¯vW®uW¬tV«sV©rU¨qT¦pT¥oS£nS¡mR mRžlRkR›jQšiQ˜hQ–gQ”fQ’ePdPŽcPŒbP‰aO†`Oƒ^O€]O}[NzYNvWNrUMmSMlRMjQLhQLeOL_LK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À,)/ZTVXON„uq‡od®}Ÿyb»s]OŠaPeP•gQšiQkRžlRŸlSœkR–hQ»g*¤\(ŽQ%`LK\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À B B_LKcNLfOLiQLkRLmSMoTMpTMrUMtVMwXNzYN}[N\O‚]O„_O‡`O‰aOQ%ŸY&©^'±b(¾i*Õ{8—hQ™iQ›jRkRŸmS¡nT¤qV§sX«v[°z^µ~bºƒfÀ‰kÆŽpÌ”vÒ™{מÛ¢ƒß¥…ᧇ⧇ᦆऄݢڞ}ÖšxÒ•tÍ‘oÉŒjňfÂ…b¿_¼\º}Z¹{X·zW·yV¶xU¶xUµwTµwTµwTµwTµwTµwTµwTµwT´wU´wU´wU´xVµxVµxVµxW´xW´yW´yX´yX³xX³xX²xX±wX°wW¯vW­uW¬tV«sU©rU§qT¦pT¤oS£nS¡mR mRžlRkR›jQšiQ˜hQ–gQ”gQ’fPdPŽcPŒbP‰aP‡`O„^O]O~[N{ZNvXNrVMnSMlRMjRLhQLeOLaML+O+O\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀHFLXQRTJH~pm‚la¬Ž}Ÿzc»t¤tT‰aPdP•gQšiQœjRžlRžlS›jRÖ|:´e*˜V&ˆN$\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À B B`LKdNLgPLiQLkRMmSMoTMpUMrUMtVMwXNzYN}[N€\O‚]O…_O‡`O‰aPšW&£['«_(´d)Âl,݃@Òt.™iQ›jRkRŸmS¡oU¤qV¨sX«w[°z^µbºƒgÀ‰kÆŽpÌ”uÑ™zÖ~Ú¡‚Þ¤„ॆআॅޣ‚Ü Ø{Õ™wÑ”sÌnÈŒjňfÁ„b¾_¼~\º|Z¸{X·yW¶yV¶xUµwUµwTµwTµwTµwT´wT´wT´wT´wT´wU´wU´wU´wU´wV´xV´xV´xW´xW³xW³xW³xX²xX±wX°wW¯vW®uW­uV¬tVªsU©rU§qT¦pT¤oS£nS¡mR lRžlRkR›jQšiQ˜hQ–hQ”gQ’fPdPŽcPŒbPŠaP‡`O„^O]O~[N{ZNwXNsVMoTMlRMjRLiQLfOLbML+O+O‚+O‚+O‚\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À6./fZXeVRHAIZIKiQLuWM¤tU‰aOdP–gQšjQkRžlRkR˜iQÄn/¬b,‘R%rC"\À\À\À\À\À\À\À\À\À\À\À\À"Fx"Fx!Fx!Fx B B BdNLgPLjQLlRMmSMoTMqUMrUMtWMwXNzZN}[N€\O‚^O…_O‡`O“S%X&¥\'®a(·g+Ês2Ó{9Àj*™iQ›jRkSŸmS¢oU¤qV¨sX«w[°z^µbº„gÀ‰kÆŽpË“uИyÕœ}٠ܢƒÞ¤„ߤ„Þ£ƒÝ¡ÚŸ~×›zÓ—vÏ“rËmÇ‹ićeÀƒa¾€^»~\¹|Z¸zX·yW¶xVµxUµwUµwTµwT´wT´wT´wT´wT´wT´wT´wT´wU´wU´wU´wU´wV³wV³xV³xW³xW²wW²wW±wW±wW°vW¯vW®uV¬tV«sUªsU¨rT§qT¦pT¤oS£nS¡mR lRžlRkR›jQšiQ˜hQ–gQ”gQ’fPePŽcPŒbPŠaP‡`O„_O]O~\N{ZNxXNsVMoTMlRMjRLiQLfPLbNL +O‚+O‚+P‚+P‚+P‚\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@89dWT@IIAI\JKlRMyYN„^OcP”gQ™iQkRžlRžkR™iRÍt3±d-’S%I#\À\À\À:^‘:^‘:^‘:^‘:^:^:^:^:^"Fx"Fx B B B BeOLhPLjRLlSMnSMpTMqUMrVMuWMxXN{ZN~[N€]Oƒ^O…_O“S%›W&¢['©^(¹k2½i+Ó{:•gQ—hQ™iQ›jRkSŸmT¢oU¤qV¨tY¬w[°{_µbºƒf¿ˆkÄoÊ’tÏ–xÓš|×~Ù €Û¡Û¡Û €Ùž~×›{Ô˜wДsÌoÉŒkʼngÂ…c¿‚`¼]º}[¸{Y·zX¶yVµxVµwU´wU´wT´wT´vT´vT´vT´vT³vT³vT³vT³vT³vU³vU³vU³wU²wU²wV²wV²wV±wV±vV°vV°vV¯uV®uV­tV¬tUªsU©rU¨qT§pT¥pS¤oS¢nS¡mR lRžlRkR›jQ™iQ˜hQ–gQ”gQ’fPePŽdPŒbPŠaPˆ`O…_O‚]O\N|ZNxYNtWMpTMlRMjRLiQLgPLcNL_LK+P‚+P‚+P‚,P‚,P‚,P‚,P‚,P‚Nr¤\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À]QNl\VG@IMCI_LKoTM|ZN†`OdP–gQšjQkRžlRœkR—hQºh*¤^,ŒP%X3:_‘:_‘:_‘:_‘:_‘:_‘:_‘:_‘:^‘:^‘:^‘:^‘"Fx B B B BfOLiQLkRLmSMnTMpTMqUMrVMuWNxYN{ZN~[N€]Oƒ^OŽP%—U&X&£['¬`)½n4Ãn/Àj*•gQ—hQ™iQ›jRkSŸmT¢oU¤qW¨tY«w[°z^´~b¹ƒf¿ˆjÄŒoÉ‘sΕwÒ™{Õœ}ØžÙŸ€ÚŸ€Ùž~ל|ÕšyÒ—vÏ“rËnÇ‹jĈfÁ„c¾`¼]¹}[¸{Y·zW¶xVµxU´wU´wT´wT´vT´vT³vT³vT³vT³vT³vT³vT³vT³vT²vU²vU²vU²vU²vU±vV±vV±vV°vV°vV¯uV®uV­uV¬tU«sUªrU©rT¨qT¦pT¥oS£oS¢nS¡mRŸlRžkRœkR›jQ™iQ˜hQ–gQ”gQ“fPePŽdPŒbPŠaPˆ`O…_O‚]O\N|ZNyYNuWMpUMlRMjQLiQLgPLdNL_LK,P‚,P‚,P‚,P‚,P‚Nr¤Nr¤Nr¤Nr¤Nr¥Nr¥\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀaSOD>IJAIQEJbNLrUM~[NˆaO‘eP—hQœjQžkRŸlR›jRÌs0²e,“T&ƒK$;_‘;_‘;_‘;_‘;_‘;_‘;_‘:_‘:_‘:_‘:_‘:_‘:_‘ B B B BgPLiQLkRLmSMoTMpTMqUMsVMuWNxYN{ZN~[N]O‡M$“S%™V&ŸY&¥\'±e-¹j/Ñz:”fQ•gQ—hQ™iR›jRkSŸmT¢oU¤qW¨tY«w[¯z^´~b¹ƒf¾‡jÃŒnÈrÍ”vјyÔ›|Ö~מ~Øž~×}Õ›{Ó˜xЕtÍ’qÊŽmÆŠiÇeÀ„b½_»~\¹|Z·{Y¶yWµxVµxU´wU´wT´vT³vT³vT³vT³vT³vT³vT³vT³vT²vT²vT²vT²vU²vU²vU±vU±vU±vU°vV°vV¯uV®uV®uV­tU¬sU«sUªrU¨qT§qT¦pS¥oS£nS¢nR¡mRŸlRžkRœkR›jQ™iQ˜hQ–gQ”gQ’fPePŽdPŒbPŠaPˆ`O…_O‚]O\O|ZNyYNuWMqUMlSMjQLhQLfPLdNL_LK,P‚,P‚Nr¤Nr¤Nr¤Nr¤Nr¥Nr¥Nr¥Ns¥Ns¥Ns¥Ns¥\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀdUOG@IMCITFJeOLtWM€]O‹bP“fP™iQkRŸlRkR™iQ¾j,©c/P%[JK;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘;_‘ B B B BgPLiQLkRMmSMoTMpTMqUMsVMvWNyYN{ZN~[N|H#ŽQ%•T%›W& Z'¦]'ºm5¸f*Ív5”fQ•gQ—hQ™iR›jRkSŸmT¡oU¤qW§sY«v[¯z^³~b¸‚e½‡i‹nÇqË“uÏ–xÒ™zÔ›|Öœ}Öœ|Õ›{Ô™yÑ–vÏ“sÌoÈlʼnh†e¿ƒa¼€_º~\¸|Z·zX¶yWµxV´wU´wU³vT³vT³vT³vT³vT³vT³vT²vT²vT²vT²vT²vT²vT±vT±vU±vU±vU°uU°uU°uU¯uU®uU®tU­tU¬tU«sUªrU©rT¨qT§pT¥pS¤oS£nS¢mR mRŸlRžkRœjR›jQ™iQ—hQ–gQ”fQ’fPePŽcPŒbPŠaPˆ`O…_O‚^O\O|ZNyYNuWNqUMmSMjQLhQLfPLdNL`LKNr¤Nr¤Nr¥Nr¥Nr¥Ns¥Ns¥Ns¥Ns¥Os¥Os¥Os¥Os¥Os¥Os¥\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À2#TB3REJVGJ`LKpTM}[N‰aO’ePšiQžkR lRžlR˜hQ·e)¢^.P%^8 #Gy#Gy#Gy#Gy#Gy#Gy#Gy#Gy * B B B B BjQLlRMnSMoTMpUMrUMsVMxF#‡M$ŽQ%’S%–U&šW&žY&¢['ªa+¿s;¹g+dP‘eP“fQ”gQ–hQ˜iQšjRœkSžlS nU£pV¦rX©uZ¬x]°{_´~b¸‚e¼…iÀ‰kÃŒnÆŽpÈrÊ‘sË’sË‘rÊqÉoÇmÅ‹kÈhÀ…e¾ƒb¼€`º~^¸|[¶{ZµyX´xW³wV²vU²vU²vT±uT±uT±uT±uT±uT±uT±uT±uT°uT°uT°tT°tT¯tT¯tT¯tT¯tT®tT®tT­sT­sT¬sT¬sT«rTªrT©rT©qT¨qS§pS¦pS¥oS£nS¢nR¡mR lRŸlRkRœjQ›jQ™iQ˜hQ–gQ•gQ“fP‘ePdPcP‹bP‰aO‡`O„^O‚]O\N|ZNxXNuWMqUMmSMhPLgPLeOLcNL`LKZIK,Pƒ,Pƒ,QƒOs¦Os¦Ot¦Ot¦Ot¦Ot¦Pt¦Pt¦Pt¦Pt¦Pt¦-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀvšÍvšÍv›Ív›Ív›Ív›Ív›Íw›Íw›Í=a“=a“=a“#Gy#Gy#Gy#Gy#Gy#Gy#Gy#GymYPODJUGJXIKeOLtWM‚]OcP•gQœjQ lR mRkRÈp.´g0”T&ˆN$]8 #Gy#Gy#Gy#Gy#Gy#Gy#Gy * B B B B BjQLlRMnSMoTMpUMrUMv>„L$ŒP%‘R%•T%˜V&œX& Z'¤\'°f0¹m5Äq3dP‘eP“fQ”gQ–gQ˜hQ™jR›kSlS nT¢pV¥rX¨tZ«w\¯z_³}a·dº„g¾‡jÁŠlÄŒnÆŽpÇqÈqÈpÇŽoÆmÅ‹kÉiÁ‡g¿„d½‚aº_¸}]·|[µzY´yX³xW³wV²vU²vU±uT±uT±uT±uT±uT±uT°uS°uS°tS°tS°tS¯tS¯tT¯tT¯tT®tT®tT®sT­sT­sT¬sT¬sT«rTªrTªrT©qT¨qS§pS¦pS¥oS¤oS£nS¢mR¡mRŸlRžlRkRœjQšjQ™iQ—hQ–gQ”fQ’fP‘ePdPcP‹bP‰aO†`O„^O]O~\N{ZNxXNuWMqUMiQLgPLfOLeOLbNL_LKZIK,Qƒ,Qƒ,Qƒ,Qƒ,QƒOt¦Pt¦Pt¦Pt¦Pt¦Pt¦-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\Àv›Ív›Ív›Ív›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Í=a“=a“=a“=a“=a“#Gz#Gz#Gz#Gz#Gz#Gz#GzgUOS=2RFJWHJ[JKlRMzYN†`OeP˜iQžkR mRŸlR™iQ¼h*°h4‘R%ˆN$^9 [JK#Gy#Gy#Gy#Gy#Gy * B B B B BjQLlRMnSMoTMpUMI#†L$‹O$Q%“S%—U&šW&X&¡Z'¦](·l5´f,Èt5dPeP’fP”fQ–gQ—hQ™iR›kRlSŸmT¢oV¤qW§tY«v[®y^±|aµc¸‚f¼…h¿ˆkÁŠlÃŒnÅnÅoÅnÅŒmÄ‹k‰iÁ‡g¿…e½ƒc»€`¹~^·|\¶{Z´yY³xW²wV²vU±vU±uT±uT±uT°uT°uT°tS°tS°tS°tS°tS¯tS¯tS¯tS¯tS®tS®tS®sS­sT­sT­sT¬sT¬rT«rTªrTªrS©qS¨qS§pS¦pS¦oS¥oS¤nS¢nR¡mR mRŸlRžkRkR›jQšiQ˜iQ—hQ•gQ”fQ’ePePdPcPŠbPˆ`O†_Oƒ^O]O~[N{ZNxXNtVMqUMhPLgPLfOLdNLbML_LKbE6,Qƒ,Qƒ,Qƒ,Qƒ-Qƒ-Qƒ-QƒPt¦-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Qƒ-Q„-Q„-Q„\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@d–w›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Íw›Îw›Îw›Î=a”=a”=a”=a”=a”=a”=a“#Hz#Gz#Gz#Gz#Gz#Gz#GzmYPPDJUGJYIKbMLqUM\NŠbP”fQ›jQŸlR¡mRžlRËp,µe+ \+R%ˆN$b; ]8 [7 XHKO+N1L/L/L/K/K/ eb”>b”>b”>b”>b”>b”>b”>b”=b”=b”=b”=b”=b”=b”=b”=b”YEUGJYIK_LKnSM|ZNˆ`O’ePšiQŸlR¡mR mR™iQºg*´j4šW'‘R%ŽQ%h>!g=!f=!db”>b”>b”>b”>b”>b”>b”$Hz$Hz$Hz$Hz$Hz>b”>b”>b”>b”>b”gVOS=2RFJWHK[JKeOLsVM€]OŒbP•gQœjQ lR¡mRžlRÌr/¹g*²h2–U&“S%‘R%Q%ŽQ%ŒP%£['¨]'¬`(°b(´d)¸f)»g)¾i*Áj*I#¡Z'¡Z' Z' Z'¡Z'£['¤['¥\'¦]'ª_)±d,³d)Äq3‹bPcPdP‘eP’fQ”fQ–gQ—hQ™iR›kSlSŸmU¡oV¤qW¦sY©u[¬x]¯z^±|`´~b¶€d¸‚eºƒf»„f»„f¼„f»ƒe»‚dºb¹€a·~_¶}^µ{\´zZ³yY²wX±wW°vV°uU¯uU¯tT¯tT¯tT®tS®tS®tS®sS®sS®sS®sS®sS­sS­sS­sS­sS¬sS¬rS¬rS«rS«rSªrSªqS©qS©qS¨pS§pS¦pS¦oS¥oS¤oR£nR¢nR¡mR mRŸlRžkRkRœjQšjQ™iQ˜hQ–hQ•gQ“fQ’ePdPŽcPŒcPŠbPˆ`O†_O„^O]O\N|ZNyYNuWNrUMnSMjQLdNLcNLaMK_LK[JK`D6Pt¦Pt¦Pt§Pt§Pt§Pu§Pu§Pu§Pu§Qu§Qu§Qu§Qu§Qu§Qu§-Q„-Q„-Q„-R„-R„-R„-R„-R„-R„-R„-R„-R„.R„.R„Rv¨Rv¨Rv¨~¢Ô~¢Ô~¢Ô~¢Ô\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À@e—@e—@e—@e—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—xœÏxœÏxœÏxÏxÏxÏxÏyÏyÏ>b•>b”>b”$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>b”>b”>b”>b”>b”YDb”>b”>b”>b”Q@:R<2fL@WHJZJKaMKoTM|ZNˆ`O‘eP™iQŸlR¡mR¡mRœjRÇo-»i-´h0«`)§]'¨]'¬`(°b(´d)¸f)¼h)Àj*Ãk*Æm*Én+Ìp+Ïq+Òr,§]'§]'§]'¨^'ª_(«_(¬`(­`(¯b)²c)ºi.ˆ`OŠaPŒbPŽcPdP‘eP“fQ”gQ–hQ˜iRšjR›kSlTŸnU¢oV¤qW¦sY©uZ«w\­y]°{_²|`³}aµ~b¶b¶b¶b¶a¶~`µ}_µ|^´{]³z[²yZ±xY°wX¯vW¯uV®uU®tU®tT­tT­sT­sS­sS­sS­sS­sS­sS­sS­sS¬sS¬rS¬rS¬rS«rS«rS«rSªrSªqS©qS©qS¨qS¨pS§pS¦pS¦oS¥oR¤oR¤nR£nR¢mR¡mR lRŸlRžkRkRœjQšjQ™iQ˜hQ–hQ•gQ“fQ’ePdPdPcP‹bP‰aO‡`O…_O‚]O\O}[NzYNwXNtVMpTMlRMhPLcNLaMK_LK]KKbR]C5Pu§Pu§Pu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu¨Qu¨Qu¨Qv¨Qv¨Qv¨-R„-R„.R„.R„.R„Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae˜Ae˜Ae˜Ae˜yÏyÏyÏAf˜Af˜Af˜$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>b•>b•>b”>b”WD3TFJXHK[JKfOLsVM€]O‹bP”gQœjQ lR¡mR mRœkRÅm,½i,ºj/²d+±c)²c(¶e)ºf)¾h*Áj*Ål*Én+Ëo+Îq+Ñr+Ós,Õt,ƒK$ª^(ª_(«_(¬`(®a(¯a)°b)³d*¶f+¾m1‡`O‰aP‹bPcPdPeP’fQ”fQ•gQ—hR™iR›kSlTŸmT¡oV£pW¥rX§tY©v[¬w\®y]¯z^±{_²|`³}`´}`´}`´}_´|^³{^³{\²z[±yZ°xY°wX¯vW®uV®tU­tU­tT­sT­sT­sS­sS¬sS¬sS¬sS¬rS¬rS¬rS¬rS¬rS«rS«rS«rS«rSªrSªqSªqS©qS©qS¨qS¨pS§pS¦pS¦oS¥oR¤oR¤nR£nR¢mR¡mR mRŸlRžlRkRœjQ›jQšiQ˜iQ—hQ–gQ”fQ“fP‘ePdPŽcPŒbPŠaPˆ`O†_O„^O]O\N|ZNyYNvWNsVMoTMkRLgPLbML`LK^KK\JK~aR[B5Pu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu§Qu¨Qu¨Qu¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ£Õ\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAe—Ae—Ae—Ae—Ae—Ae—Ae˜Ae˜Ae˜Ae˜Ae˜Ae˜Ae˜Af˜Af˜Af˜yÐAf˜Af˜Af˜Af˜Af˜Bf˜$H{$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>c•>c•>b•>b•O?:[E|aRZA5-QƒQu§Qu§Qu§Qu§Qu§Qu§Qu§Qu¨Qu¨Qu¨Qv¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„Rv¨Rv¨Rv©Rv©Rv©Rw©£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö£Ö\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAe˜Ae˜Ae˜Ae˜Ae˜Ae˜Ae˜Af˜Af˜Af˜Af˜Af˜yžÐyžÐyžÐzžÐzžÐzžÐBf˜Bf˜Bf˜Bf˜Bf˜$H{$H{$H{$H{$H{$H{$H{$H{$H{$Hz$Hz$Hz$Hz$Hz$Hz$Hz$Hz>c•>c•>c•>c•VC^C6W@5-Q„-Q„Qu§Qu§Qu§Qu§Qu¨Qu¨Qv¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„Rv©Rw©Rw©Rw©¤Ö¤Ö¤Ö¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö¤Ö¤Ö¤Ö\À\À\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAf˜Af˜Af˜Af˜Af˜Af˜Af˜Af˜zžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐBf˜Bf˜Bf˜Bf˜$I{$I{$I{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$H{$Hz$Hz$Hz$Hz$Hz YE\C6T>4-Q„-Q„-Q„-R„Qu¨Qu¨Qv¨Qv¨Qv¨Qv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„Rw©Sw©€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›Ei›\À\À\À\À\À\À\À\À\À\À\À\À\À\ÀAf˜Af˜Bf˜Bf˜Bf˜zžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÐzžÑzžÑzžÑzŸÑzŸÑzŸÑzŸÑBf˜Bf˜Bf˜$I{$I{$I{$I{$I{$I{$I{$I{$I{$I{$I{$H{$H{$H{$H{?c•?c•?c•?c•$H{$H{$H{SB;R<2zbVUGJXIK[JK[JKuWN€\OŠaP’fP™iQŸlR¡mR£nS£nS¥pTà€9Þ9Õw2Öw0Öv/Öv.Ùx/Üz0Þz0á|1ã~2æ€3è5éƒ6ë…8ë…8ºm4¼o7¾q8Äu;Ãs9Ãs8ºj0‚]O„^O†_Oˆ`OŠaPŒbPcPdP‘eP’fQ”fQ•gQ—hR™iRšjSœkSlTŸnU¡oV¢pV¤qW¦rX§sY¨tY©uYªuZ«uZ«vZ«vY«uY«uX«uX«tW«tV«sVªsUªsUªrTªrTªrTªrSªqSªqSªqSªqSªqS©qS©qS©qS©qS©qS©qS©qS©qS¨qS¨pS¨pS§pS§pR§pR¦oR¦oR¥oR¥oR¤nR£nR£nR¢mR¡mR mR lRŸlRžkRkRœjQ›jQšiQ™iQ—hQ–gQ•gQ”fQ’eP‘ePdPcPŒbPŠaPˆ`O†_O„^O‚]O\O}[NzYNwXNtVMqUMnSMiQLeOL`LK]KKmP?kN?|aSZA5P<4-R„-R„-R„-R„-R„-R„Qv¨Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×€¤×Ei›Ei›Ei›Ei›Ei›Ei›Ei›\À\À\À\À\À\À\À\À\À\À\À\ÀBf˜zžÐzžÐzžÐzžÐzžÐzžÐzžÑzžÑzžÑzŸÑzŸÑzŸÑzŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑBf™Bf™Bf™%I{$I{$I{$I{$I{$I{$I{$I{$I{$I{$I{?c–?c–?c–?c–?c–?c•?c•?c•?c•$H{$H{$H{jXP^H=}dXUGJXHKZIKkRLwXN‚]O‹bP”fQšiQžkR mR£nS¥pT¨qU¨rUç…;ç†>ì‰?è†<å‚9ê†;î‰=ðŠ=ðŠ>ôŽAø‘Dü•Hÿ˜Kù’E¿r:Àt;Àt;Át<Ãt:½n4´f,]Oƒ^O…_O‡`O‰aO‹bPŒcPŽcPdP‘eP“fQ”gQ–hQ˜iR™jR›kSœlSžmTŸnU¡oV¢pV¤qW¥rW¦rX§sX¨tX©tX©tX©tX©tXªtWªsW©sV©sV©rU©rU©rT©qT©qT©qS©qS©qS©qS©qS©qS©qS©qS©qS¨qS¨qS¨pS¨pS¨pS¨pS§pS§pS§pR¦pR¦oR¦oR¥oR¥oR¤nR¤nR£nR¢nR¢mR¡mR mR lRŸlRžkRkRœjQ›jQšiQ™iQ˜hQ–hQ•gQ”fQ’fP‘ePdPŽcPŒcP‹bP‰aO‡`O…_Oƒ^O]O~[N{ZNyYNvWNsVMpTMlRMgPLcNL†gUƒeUlO?~bT{`SW@5-R„-R„-R„-R„-R„-R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R….R…Ei›Ei›Ei›€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×€¥×Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›\À\À\À\À\À\À\À\À\À\ÀzžÑzžÑzžÑzžÑzŸÑzŸÑzŸÑzŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÒBg™Bg™Bg™%I{%I{%I{%I{%I{%I{%I{@d–?d–?d–?d–?d–?d–?d–?d–?d–?c–?c–?c–?c–$I{$I{L=:WD`KA-R„-R„-R„.R„.R„.R„.R„Rv¨Rv¨Rv¨Rv¨.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R„.R….R….R….R…EiœEiœEiœEiœEiœEiœ¥×¥×¥×¥×¥×¥×¥×EiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœEiœ\À\À\À\À\À\À\À\ÀzŸÑzŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÒ{ŸÒ{ŸÒ{ŸÒ{ Ò{ Ò{ Ò{ Ò| ÒCg™Cg™%I{%I{%I{@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–?d–?d–?d–?d–?d–?d–$I{$I{dUPYEXG@-R„.R„.R„.R„Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©.R„.R„.R„.R„.R„.R„.R„.R„.R….R….R….R….R….R….S…EiœEiœEiœEjœEjœEjœEjœEjœ¥×¥×¥×EjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEiœEiœEiœ\À\À\À\À\À\À{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÑ{ŸÒ{ŸÒ{ŸÒ{ Ò{ Ò{ Ò{ Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| ÒCg™@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–?d–$I{$I{RA;P<3zcXnVIuh™~pdNLpUMÁ”w¬zZ«vS‘eP–gQœjQžlR¡mR¤oS§pT­uV¯vW±xY¶|\¼€_ÆdƉgÈŠhÊŒiÌŽkÎlÿRñF¶k4²g1¯d-­b+ª_(¢Z'}[N€\O‚]O„^O†_Oˆ`O‰aP‹bPcPŽcPdP‘eQ’fQ”gQ•gQ—hR˜iR™jR›kSœkSlTžmT nT¡nU¡oU¢oU£pU¤pU¤pU¤pU¥pU¥pT¥pT¥pT¥pT¥pS¥pS¥oS¦oS¦oS¦oS¦oS¦oS¦oR¦oR¦oR¦oR¦oR¦oR¦oR¦oR¥oR¥oR¥oR¥oR¤oR¤nR¤nR£nR£nR¢nR¢mR¡mR¡mR lRŸlRŸlRžkRkRœkQœjQ›jQšiQ™iQ˜hQ—hQ•gQ”gQ“fP’ePePdPcPŒbPŠbP‰aO‡`O…_Oƒ^O]O~\N|[NzYNwXNtVMpUM—pY”oXzWBuUB…gVlP@jO@|bUx`TcMB3!.R„Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©Rv©Rw©Rw©Rw©.R„.R„.R„.R„.R….R….R….R….R….S….S….S…EjœEjœEjœEjœEjœEjœEjœEjœEjœ¦Ø¦ØEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœEjœ\À\À\À\ÀBg™{ŸÒ{ŸÒ{ŸÒ{ Ò{ Ò{ Ò{ Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| ÒCg™Cg™Cg™Cg™|¡Ó@d—@d—@d—@d—@d—@d—@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–%I{;0/SB;R=4fODpXL‘xkš€r˜vbº“zÀ”x«{[ÃldP•gQ™iQ›jQŸlR£nR¦pS¨qTªrT¬tU°wWµ{Z¸}\¸|\¸}\¹~]»]å}+Ý~6­d.ªa+¨_)§^(¤\'zYN|ZN~\N€]Oƒ^O„_O†_Oˆ`OŠaP‹bPcPŽdPdP‘eQ“fQ”gQ•gQ—hR˜iR™jRšjSœkSlSžlTŸmT mT nT¡nT¢nT¢oT£oT£oT£oT£oT¤oS¤oS¤oS¤oS¤oS¤oS¤oS¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¥oR¤oR¤oR¤nR¤nR¤nR£nR£nR£nR¢mR¢mR¡mR¡mR lR lRŸlRžlRžkRkQœjQ›jQšjQ™iQ™iQ˜hQ—hQ•gQ”gQ“fQ’ePePdPŽcPŒbPŠbP‰aO‡`O…_Oƒ^O]O\N}[NzZNxXNuWMrUM™rZ–pY|XCxVCsTBmQAkOA~cVzaU`I>\IARv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©Rv©Rw©Rw©Rw©Sw©Sw©Sw©Sw©.R….R….R….R….R….S….S….S….S…FjœFjœFjœFjœFjœFjœFjœFjœ‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦ØFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœ\À\ÀBg™{ Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ò| Ó| ÓCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™}¡Ó@e—@e—@e—@e—@e—@e—@d—@d—@d—@d—@d—@d—@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–@d–%I{<1/J82^I@gQFqYN‘xl™€s—vc¢{d¿”yª{\«wUÄi‘eP•gQ˜hQkQ mR¢mR¤nR¥oS§pSªrT¬tU¬tU¬tU¬tU­tU®tUÒt.ƒL&¤](¢['¡Z'žY&xYN{ZN}[N\N]Oƒ^O…_O‡`OˆaOŠaPŒbPcPdPeP‘eQ“fQ”gQ•gQ—hR˜iR™iRšjR›kSœkSlSžlSŸmSŸmS mS nS¡nS¡nS¢nS¢nS¢nS¢nS£nS£nS£nR£nR£nR£nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR¤nR£nR£nR£nR£nR£nR¢nR¢mR¢mR¡mR¡mR¡mR lR lRŸlRžlRžkRkRœkQœjQ›jQšiQ™iQ˜iQ—hQ–hQ•gQ”fQ“fP’ePePdPŽcPŒbP‹bP‰aO‡`O†_O„^O‚]O\O}[N{ZNxYNvWNsVM›s[˜rZ~ZDnYŒkYqSBkPAiOA|cVbK?\G>NB?Rv¨Rv¨Rv¨Rv¨Rv¨Rv©Rv©Rv©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©.S….S….S….S….S….S…FjœFjœFjœFjœFjœFjœ‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦Ø‚¦ØFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœCg™Cg™| Ò| Ò| Ò| Ò| Ò| Ó| Ó| Ó| Ó|¡Ó|¡ÓCg™Cg™Cg™Cg™Cg™Cg™Cg™CgšCgšCgšCgšCgš}¡ÓAe—Ae—Ae—@e—@e—@e—@e—@e—@e—@e—@e—@d—@d—@d—@d—@d—@d—@d–@d–@d–@d–%I{@d–@d–<1/H72\I@ePGpYNxm˜€t–vc¡{e¾”zÁ“u‘p«wU¬uQ‘eP•gQ™iQšjQœjQžlR¡mR£nR¤nR¤oR¤oR¤oR¤oR¤oRÇgb;  Z'žY&›W&“S%vXNyYN{ZN~[N€\O‚]Oƒ^O…_O‡`O‰aOŠaPŒbPcPdPdP‘eQ“fQ”gQ•gQ–hQ˜iR™iRšjR›jR›kSœkSlSžlSžlSŸlSŸmS mS mS¡mS¡mS¡mR¡mR¢mR¢mR¢mR¢mR¢nR¢nR¢nR£nR£nR£nR£nR£nR¢nR¢nR¢mR¢mR¢mR¢mR¡mR¡mR¡mR mR lRŸlRŸlRžlRžkRkRkQœjQ›jQ›jQšiQ™iQ˜hQ—hQ–gQ•gQ”fQ“fP‘ePdPdPcPŒbP‹bP‰aO‡`O†_O„^O‚]O€\O}[N{ZNyYNvXNtVMu\„]E€[E’oZŽmZŠkYnRBjOB}cVdL@`I?XGARv¨Rv¨Rv¨Rv¨Rv©Rv©Rw©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwª.S….S….S….S…/S…FjœFjœFjœFjœ‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦Ù‚¦ÙFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœ‚¦Ù‚¦ÙCg™Cg™| Ó| Ó|¡Ó|¡Ó|¡Ó|¡Ó|¡ÓCg™Cg™Cg™Cg™CgšCgšCgšCgšCgšCgšCgšCgšChšChšChšChšChš}¢ÔAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—@e—@e—@e—@e—@e—@e—@e—@d—%I{%I{%I{%I{%I{@d–@d–<10F61o]Vye]„oeŽxmœ‚u”udŸ{e¥}d¨|aÀ’tÁpÃl¬uQdP’eP”fQ–gQ˜iQ›jQœjQœjQœjQœjQœkQœkQkQ_9 œX&™V&•T%rUMuWMwXNzYN|ZN~[N€\O‚]O„^O…_O‡`O‰aOŠbPŒbPcPŽdPdP‘eQ’fQ”fQ•gQ–hQ—hR˜iR™iRšjR›jRœkRœkRkRlRžlRžlRŸlRŸlRŸlR lR mR mR mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR¡mR mR lR lRŸlRŸlRŸlRžkRžkRkRkQœjQ›jQ›jQšiQ™iQ˜iQ—hQ–hQ•gQ”gQ“fQ’fP‘ePdPdPcPŒbPŠbP‰aO‡`O†_O„^O‚]O€\O~[N{ZNyYNwXNtVMrUM†^F‚]F”q\o[ŒlZqTD€fX}dWeMAbK@O=6NB@Rv¨Rv©Rv©Rv©Rw©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwªSwªSxªSxªSxª/S…/S…FjœFjœFjœƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§ÙFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœFjœƒ§Ùƒ§Ùƒ§Ùƒ§ÙCg™Cg™Cg™}¡Ó}¡Ó}¡ÓCg™CgšCgšCgšCgšCgšCgšCgšChšChšChšChšChšChšChšChšChšChšDhšDhšDhš~¢ÔAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—%I{%I{%I{%I{%I{%I{%I{%I{%I{@d—@d—E:9D61m\Vwe]lXOuaX„k_¨‹z±|¡|e¥|c§|`©z]ªyXÂnÃlÄŽkÄŽidP’eP“fP“fP“fP’fP“fP“fP“fP[7 —U&”T%P%pTMsVMuWMxXNzYN|ZN~[N€\O‚]O„^O†_O‡`O‰aOŠbPŒbPcPŽdPdP‘eP’eQ“fQ”gQ•gQ–hQ—hQ˜iR™iRšjR›jR›jRœkRœkRkRkRžkRžlRžlRŸlRŸlRŸlRŸlR lR lR lR lR lR lR lR lR lR lR lR lR lRŸlRŸlRŸlRŸlRžkRžkRkRkQœkQœjQ›jQ›jQšiQ™iQ˜iQ˜hQ—hQ–gQ•gQ”fQ“fP’eP‘ePdPŽdPcPŒbPŠbP‰aO‡`O…_O„^O‚]O€\O~[N|ZNyYNwXNuWMrUM‡`G„^G–r]|ZFxXFtVEgY~eY{cXbLA[H?REA.R„.R„Rv©Rw©Rw©Rw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwªSxªSxªSxªSxªTxªTxªTxªƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§ÙFjFjFjFjFjFjFjFjFjFjFjƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§Ùƒ§ÙCg™Cgš}¡Ó}¡ÓCgšCgšCgšCgšChšChšChšChšChšChšChšChšChšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš~¢ÔAe—Ae—Ae—Ae—Ae—Ae—Ae—Ae—Ae—%I|%I|%I|%I{%I{%I{%I{%I{%I{%I{%I{%I{%I{%I{@e—@e—B99B51k[Vud]iWPr_Wye] †yªŒ|²}¡|e¤|c¾’w¨{^¨z\©yZÁp«xW«wU«wU«wU«wUÃŽlÃŽlÂŽlÂŽlkD(’S%ŒP%nSMoTMqUMsVMvWNxXNzYN|ZN~[N€\O‚]O„^O†_O‡`O‰aOŠaP‹bPcPŽcPdPeP’eQ“fQ”fQ•gQ–gQ–hQ—hQ˜iQ™iR™iRšjR›jR›jRœjRœkRœkRkRkRkRžkRžkRžlRžlRŸlRŸlRŸlRŸlRŸlRŸlRŸlRŸlRŸlRžlRžkRžkRžkRkRkQkQœkQœjQ›jQ›jQšjQšiQ™iQ˜iQ˜hQ—hQ–gQ•gQ”gQ“fQ’fP‘ePePdPŽcPcP‹bPŠaPˆaO‡`O…_Oƒ^O‚]O€\O~[N|ZNyYNwXNuWMrUMŸw_œv_˜t^~\GzYGvWF†j[fZ|dYybX\I@VGB5/2.R„.R„.R„.R„Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©Sw©SwªSwªSwªSxªSxªSxªSxªTxªTxªTxªTxªFkFkFkFkƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§ÚFkFkFkFkFkFkFkFkƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Úƒ§Ú}¡Ó}¡Ó}¡Ô}¡ÔChšChšChšChšChšChšChšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš~£ÕAe˜Ae˜Ae˜Ae˜Ae˜%J|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I{%I{%I{%I{%I{%I{@e—@e—<68?31gYVpa\bRMjYTq`Z€j`¡‡z«}²‘}¶’|¸’{º’z»’x¼’w§z^¿‘t¿‘s¿‘s¿s¿r¿r¾r¾r°h2‹O$„L$mSMnSMnTMoTMtVMvWNxXNzYN|ZN~[N€\O‚]O„^O…_O‡`OˆaOŠaP‹bPŒcPŽcPdPdP‘eP’eQ“fQ”fQ•gQ–gQ–hQ—hQ˜hQ˜iQ™iQšiQšiQšjQ›jQ›jQœjQœjQœkQœkQkQkRkRkRkRkRkRkRkRkRkQkQkQœkQœjQœjQœjQ›jQ›jQšjQšiQ™iQ™iQ˜hQ—hQ—hQ–gQ•gQ•gQ”fQ“fP’eP‘ePdPdPcPŒbP‹bP‰aPˆ`O†`O…_Oƒ^O]O€\O~[N|ZNyYNwXNtWM£z` y`w`šu_€]I|[HwXGˆl\ƒi[}eZycYr_WjZU;23.R„.R„.R„.R„.R….R….R…Sw©Sw©Sw©Sw©Sw©SwªSwªSwªSxªSxªSxªTxªTxªTxªTxª/S…/S…GkGkGkGkGkGkGkƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨ÚGkGkGkƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Ú}¢Ô}¢Ô}¢Ô}¢Ô~¢ÔDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš£ÕAf˜%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I|%I{%I{Ae—Ae—Ae—?89H=:?YUY`QGfVLudXjeitlm{po|qp}rp~rpsqsq€tqŒr_=1+xJ)’o[~[F€\G‚^H„_I…`IkRLlRMnSMpTMrVMuWMwXNyYN{ZN}[N~\N€\O‚]Oƒ^O„_O†_O‡`Oˆ`O‰aPŠbP‹bPŒcPcPŽcPdPdPeP‘eP’eP’fP“fQ“fQ”fQ”gQ•gQ•gQ•gQ–gQ–gQ–gQ–hQ–hQ—hQ—hQ—hQ—hQ—hQ–hQ–hQ–gQ–gQ–gQ•gQ•gQ•gQ”fQ”fQ“fQ“fP’eP‘eP‘ePdPdPŽdPŽcPcPŒbP‹bPŠaP‰aO‡`O†_O…_Oƒ^O‚]O€\O~\N}[N{ZNyYNwXNuWM“iOhOŽgO‹eOžze›yd—wd”tcrbtYKjTIaOG[KFj]Y^UU?;@.R….R….S….S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…/S…GkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkžGkž…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©ÛGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlž…©Û…©Û…©Û…©Û…©Û…©Û£Õ£Õ£Õ£Õ£Õ£Õ£Õ£ÕDh›Dh›Dh›Dh›Di›Di›Di›Di›Di›¤Ö¤Ö¤Ö¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|Af˜Ae˜Ae˜%J|%J|%J|%I|%I|%I|%I|#-#%.()1MEAQIEUMI]SL]TM=4.1+(=.#6,&5( 1%"ŒlYn[“p\•r]]Hƒ_I…`JœwažybkRLmSMpTMrUMtVMvWNxXNzYN|ZN}[N\N€]O‚]Oƒ^O…_O†_O‡`OˆaO‰aPŠaP‹bPŒbPcPŽcPŽdPdPdPeP‘eP‘eP’eP’fP“fP“fQ“fQ”fQ”fQ”fQ”gQ”gQ•gQ•gQ•gQ•gQ•gQ”gQ”fQ”fQ”fQ”fQ“fQ“fP“fP’eP’eP‘eP‘ePdPdPdPŽcPcPŒcPŒbP‹bPŠaP‰aO‡`O†_O…_Oƒ^O‚]O]O\O}[N|ZNzYNxXNvWN¬‚gªg¨€ghPŒfPŸ|fœzf˜xe”vdscsYLiTK_NHYKFh\Z]UV=;@.R….S….S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxª/S…/S…/S…/S…GlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlž…©Û…©Û…©Û…©Û…©Û…©Û…©ÛGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlžGlž…©Û…©Û…©Û…©Û£Õ£Õ£Õ£Õ£Õ£Õ£Ö£ÖDi›Di›Di›Di›Di›Di›¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×Ei›&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Af˜Af˜Af˜Af˜Af˜%J|%J|%J|%J|%J|%J|%I|%I|%I|, +,!.! "`E6†iYŒlZo\“q]•s^^J™va›wbycŸzd {e¤}foTMqUMsVMuWNwXNyYN{ZN|ZN~[N\O]O‚]Oƒ^O…_O†_O‡`Oˆ`O‰aOŠaP‹bPŒbPŒcPcPŽcPŽdPdPdPdPeP‘eP‘eP‘eP’eP’eP’eP’eP’fP’fP’fP“fP’fP’fP’fP’eP’eP’eP‘eP‘eP‘ePePdPdPdPŽdPŽcPcPŒcPŒbP‹bPŠaP‰aOˆ`O‡`O†_O…_Oƒ^O‚]O]O\O~[N|[N{ZNyYNwXN®ƒi¬ƒiª‚i¨i¦€hŒhR‰fQ†dQ‚bP•wfx]Oˆpdkbtd_m`]OEDG?A;:@.S….S….S….S….S…/S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTx«Tx«Tx«Ty«/S†GlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž…ªÜ…ªÜ…ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž…ªÜ…ªÜ£Ö£Ö£Ö£Ö¤Ö¤Ö¤Ö¤Ö¤ÖEi›€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×€¥×€¥×€¥×Bg™Bg™Bg™Bg™Bg™&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Af˜Af˜%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|%I| +,YA5jPBpSD‹l[o]’q^–t`‚_Kšwbœycžze {f¡}g¤h¨i”lSrVMtWMvWNxXNyYN{ZN|[N~[N\O]O‚]Oƒ^O„_O…_O†`O‡`Oˆ`O‰aPŠaP‹bP‹bPŒbPcPcPŽcPŽcPdPdPdPdPdPdPdPdPePePePePePdPdPdPdPdPdPdPŽcPŽcPcPcPŒbP‹bP‹bPŠaP‰aOˆ`O‡`O†`O…_O„^Oƒ^O‚]O€]O\O~[N|[N{ZNyYNxXN°…j®„j¬„jªƒj¨‚j¦€jŒhSŠgS†eRƒcR|`QŒsf…oe}jcrd`k_]LCDC=@,,3(4F(4F.S….S…/S…/S…/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTxªTx«Tx«Tx«Ty«Ty«Ty«…ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžChšChš¤Ö€¤Ö€¤Ö€¤Ö€¤ÖEi›Ei›Ei›€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤Ö€¤×€¤×€¤×€¤×Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|%I|%I|%I|#5H71O;3V?4iOBoSDsVFo]{[I^Kƒ`L…bN‡dOŸ{f }g¢~h¥€j’kT•mU˜oVšqWrWwXNxXNzYN{ZN}[N~[N\O€]O‚]Oƒ^O„^O…_O…_O†`O‡`Oˆ`O‰aO‰aPŠaP‹bP‹bPŒbPŒbPŒcPcPcPcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPŽcPcPcPcPŒcPŒbP‹bP‹bP‹bPŠaP‰aP‰aOˆ`O‡`O†_O…_O„_O„^Oƒ^O]O€\O\N~[N|ZN{ZNyYN›oTšoT™oT—nT¬„lªƒl¨‚ljUŒiTŠhT†fT€cSvi‰rgnfyidqdah^^HBD?<@)+3OZkMYk(5F(5F(5F/S…/S…/S…/S…/S…TxªTxªTxªTxªTxªTxªTx«Tx«Ty«Ty«Ty«Ty«Uy«†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžDhšDhšDhšChš&K}&K}&K}&K}&K}&K}ChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|&J|&J|&J|&J|&J|Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%J|%I|%I|A99N?;L:2T>4gNBlRD‡k\‹n^z[J~^LaN…cO‡dP‰fQŠgRŒhTjU’lV•nW˜pXšrXsY¶‹q¸qºŽr¼r½r¿s©z[©z[ªz[«{[¬{[¬{ZÅ“rÅ’qÅ’qÅ’pÅ’pÅ‘o­yV­xV¬xU¬wT¬wTŠaPŠbP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bP‹bPŠaPŠaPŠaP‰aP‰aOˆaOˆ`O‡`O‡`O†_O…_O„^Oƒ^O‚^O‚]O]O€\O~\N}[N|ZNzYNpTœpU›pUšpU˜oV—oV•nV“mV‘lVkVŒjVˆhVƒfU~cUuj†qh~mfugdkaad\^E@D98?$(2minffm^blV^lMYk(5F(5F/S…TxªTxªTxªTxªTxªTxªTxªTx«Tx«Ty«Ty«Ty«Uy«Uy«†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸHlŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}ChšChšChšChšChšChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|&J|&J|&J|%J|%J|%J|%J|%J|%J|%J|Ae˜Ae˜;GY<68I=:I82Q=4XA6~fZ„j\‰m^p`|]L€`NƒcP†eQˆgS¡j£€l¦‚m©„n•oX˜qYšrZt[¶Œr¸sºs¼t½t¾‘t¨z]©{]ª{]«{\«{\¬{\¬{[Ä“sÄ“rÄ’rÄ’qÄ’pÄ‘p¬yWÄoÃnÃmÃlÂŽlÂŽkÁkˆaOˆaOˆaOˆaOˆaOˆaOˆaOˆ`Oˆ`O‡`O‡`O‡`O†`O†_O…_O…_O„_O„^Oƒ^O‚]O]O€]O\O~\N}[N|ZN¶‰l¶‰lµˆmœqV›qVšqV™pW˜pW–oW¬…nª…n§„n¤‚nŸ€n›~n€eW‘xlŠtk‚piykfodcf_`JDG@>C*,5$1MYktr~tstmolinadmX_lNZkMZkTxªTxªTxªTxªTx«Tx«Tx«Ty«Ty«Ty«Uy«Uy«Uy«†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«ÝHlŸHlŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸ†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸHmŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšChšChšChšChšChšChšChšCgšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™&J}&J}&J}Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜&J|&J|&J|&J|&J|&J|&J|&J|&J|&J|Af˜Af˜Af˜Af˜;GY;GY;GY1'!D:9N?;N;3]I?zdY€h[†l^‹oasc“ue€bQ„dR‡fT l¢m¦ƒn©…o«‡p®ˆq±Šr³‹sžv] w]¹u»u¼‘u¾‘u¿’v¨{^©{^ª|^«|]«|]«{\¬{\¬{[¬{[¬zZ«zZ«yY«yX«xXÂoÂnÂnÁŽmÁŽm¨uT¨uS§tS§tS§tR¦sR¦sQ…_O…_O…_O„^O„^Oƒ^Oƒ^O‚^O‚]O]O€]O¢rS¡rS¡rS¸‰k·‰l·‰l¶‰m¶‰mµ‰m´‰n³‰n›qWšqX™qX®‡o­‡o«†p¨…p¤ƒp pœp—}o{cXv`Vp]U}nishfhaba\_DAF::B$)4MYkMYkMYkŒtctq\QPPIKFDI;>H/8GMZkTxªTx«Tx«Tx«Ty«Ty«Ty«Uy«Uy«Uy«†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸHmŸHmŸImŸImŸImŸImŸImŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšDhšDhšDhšChšChšChšChšChšChšChšChšCgšCgš&K}&K}&K}&K}&J}&J}Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜&J|&J|&J|&J|&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜;HY;HY;GY;GY;GY;GY;,#I=:H82YF?^JA|e[‚j]ˆn`Œqcte”wg—yiš|k~l €n£‚o¤ƒp¦…q­‰s°Šs›u]žv^Ÿw^¡x_£y_¤z_¥z_¦{_¿“w¿“wÀ“vÁ“vÁ“v“u“u“tª{\ª{\ªz[ªzZªyZªyY©xXÁpÀo¨wW¨vV§vV§uU¦uU¦uT¥tT½Œl¼‹k¼‹k¼‹k»‹k»‹kºŠk¢sT¢rT¢rT¡rT¡rT¡rU rU rV·Šn¶ŠnµŠnµŠo´Šo³‰o²‰p±‰p™qY®ˆq¬‡qª†r§…r¤„r ‚rœ€q€gZ{dYvaXp^WiYU`TRVNOb]aEBH<+[NL^SQWNNKFJ?AI2:HTx«Ty«Ty«Ty«Uy«Uy«Uy«Uy«Uy«‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝImŸImŸImŸImŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«ÞImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšChš&K}&K}&K}&K}&K}&K}&K}&K}&K}&K}CgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™Bg™Bg™Bf™Bf™Bf™&J|&J|Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜Bf˜;HY;HY;HY;HY;HY;HY;GY3("D::B41RB=YG@wcZ}g\ƒk_‡nbŒrdug}aRdT„gV‡iX‰kY¢ƒq¤„r¥…s§†t‘p^’q^Ÿw` x`¢y`£z`¤za¥{a½“x¾“x¿“w¿“wÀ“wÀ“vÀ“vÀ“vÀ“uÀ’uÀ’tÀ‘sÀ‘sÀ‘r¿r¿q¿q¾p¾Žp¾Žo½Žo¥vW¼n¼Œn»Œn»Œn»ŒnºŒnº‹m¢tV¡sV¡sV¡sV sV sWŸsWŸsXžsXµŠpµŠp´ŠpœsY›sYšrZ˜r[–r\”q\‘p]¦†t£„tŸƒsœs€h\{e[vbYo^XhZV`USXPQNJMECJRS[47A+((MYkMYkMYkMZk(5F(5F(5FOHJT=+YML_SRZQQMGJABI2:H/T†Uy«Uy«Uy«Uy«Uy«Uy«‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸˆ¬Þˆ¬Þ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhšDhš'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}&K}&K}&K}&K}CgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Bg™Bg™Bg™Bg™&J|&J|Bf™Bf™Bf™Bf™Bf˜Bf˜Bf˜Bf˜Bf˜;HY;HY;HY;HY;HY;HY>DM>DM;HY89<:+#9&B52I94ZHAxd[}g^k`†nc‹rey_R}bTeVƒgX…iYˆk[Šl\Œn]o^¥‡v§ˆvšvaœwažxa yb¢zb¤{b¤{a¼“x½“x¦|a§|a§|`§{`§{_§{_§{^§z^¾‘u¾‘t¾‘t¾s½s½r½r¥wZ¤wZ¤vY¤vY£vY£uX¢uX¢uX¢uX¹Œp¸Œp¸Œp·Œp·‹p¶‹p¶‹pµ‹qµ‹qtZ›t[šs\™s\˜s]–r]”r^’q^p^o^Šn^‡l^ƒj^h]{f\ub[n^YgZW_UTWPQOKOEEKST]JNY>=?JJIMYkMYk(5F(5F(5F(5F(5F)5G)5GK=4S<*XMLbWVYPPLGJ@AI/T†/T†Uy«Uy«Uy«‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞImŸImŸImŸIm ˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞIm Im Im Im Im Im Im Im ˆ¬Þˆ¬Þˆ¬Þˆ¬Þ'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}Dh›Dh›Dh›Dh›DhšDhšDhšDhš'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}ChšChšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™Cg™&J|&J|&J|&J|&J|Bg™Bg™Bg™Bf™Bf™Bf™Bf™Bf˜Bf˜;HY;HY;HY;HY;HY;HYCIR>DMCIR;HYCIR.$0"8&?*G/V=+w[F{g^€kanXMs\Px_S{bU~dWfYƒhZ†j\ˆl]Šm^¢…v§ˆwªŠx­Œy¯y±Žz´zµz·‘z¹’z£{b£{b¤{b¥{b¥{a¥{a¥{`¥{`¥z_¥z_¥z^¼‘u¥y]¤y]¤x]¤x\£w\£w[¢w[¢v[¢v[¡v[¡v[¸r·r¶r¶ŒsµŒs´Œs´Œs²Œt±‹u°‹u˜t^–s_•s_“r_’r`q`p`¡…wž„v›‚v—€u“~twd]sb[l^ZeYW]TUUORLJOYYaRU^JOZ>>@!$)RXaMYk39B-3<-3<(5F)5G)5G)5G)5G)5GFDJK9*^K=YONg\\TLMIFJ:>I0T†0T†ImŸˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞIm Im In In In In In In ˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßIn In In In In ˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ß'K~'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}Di›Di›Dh›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}ChšChšChšChšChšCgšCgšCgšCgšCgšCg™Cg™Cg™Cg™Cg™Cg™&J}&J}&J}&J}&J|&J|&J|&J|&J|Bg™Bg™Bg™Bg™Bg™Bf™Bf™EM>EMCIR;HY;HYCIRCIR)6&8&@*H0I1!\B0}_JhTKjM8q[Pt]Sw`U{cW~eYg[ƒi\…k^‡m_Ÿ…v¢†w¥ˆx¨Šyª‹z­z¯Ž{±{²{³{´{žzdŸzd zc zc¡zc¸‘y¸‘y¸‘y¸‘x¸x¸x·w·w·w·wŸw_Ÿw_žw_µŽv´Žv³v²v²w±w°Œw¯Œw®Œw­‹w«‹xªŠx¨‰x¦‰x¥ˆx£‡x¡†xž…x›ƒw—v’~vŽ|t‰ys„vrh\YcXX[TUSNRIHOUXaNS^JFE>>A')+"%(4:C(5F(5F3:B3:B-3<-3<)5G)5G)5G)5G)5G)5GE:4O:*TKLbXWcZZPIKDCJIm Im Im Im ˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ßˆ¬ßˆ¬ßˆ¬ßIn In In In In In Jn Jn Jn Jn Jn ˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ß‰­ß‰­ß‰­ß‰­ß‰­ßJn ‰­ß‰­ß‰­ß‰­ßˆ­ßˆ­ßˆ­ßˆ­ß'K~'K~'K~'K~'K~'K~'K~'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšChšChšChšChšChšChšCgšCgšCgšCgš&K}&K}&J}&J}&J}&J}&J}&J}&J}&J}&J|&J|&J|Cg™Cg™Cg™Bg™Bg™Bg™EMCIRCIRCIR888DGNCJRCIRBBB(0 8&<)G0M5"X@0z^K†bFŠkUlXPp[Rs^TvaVzcX}fZg\i]™u›‚v„wŸ†x¢‡y¥‰z§Šz©‹{ªŒ{•ve–ve—we˜we°|°|±{²{²{²{²{²{±z±z±Žz±Žz±Žz°Žy™vb˜vb—vb–ub•ub•uc”tc“tc’sbscrcqc¢‡y †y…y›„x˜‚x•w’w|uˆytƒvs~sqyooslmVQTOLR[\dQU`KHHAAD:<@68; &Z`i-4<%');AJ4:C4:C4:C-4<)5G)5G)5G)5G)6G)6G@84H8-N?5YPQmccoghd`dIn In In In In In ˆ¬ßˆ¬ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßˆ­ßJn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ßJn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~Ei›Ei›Ei›Ei›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhšDhšChšChšChš&K}&K}&K}&K}&K}&K}&K}&K}&J}&J}&J}&J}&J}&J}&J}&J}&J}Cg™Cg™Cg™Cg™B9;>68;Z`iZ`iMZk)5G4:C-4<4:C4:C-4<;BJ)5G)6G)6G)6G)6G)6GC6-L;.leg„{{ypqhbeVYcJn Jn Jn Jn Jn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ßJn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn Jn ‰­ß‰­ß‰­ß‰­ß‰­ß‰­ß‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­à‰­àJn¡Jn¡Jn¡Jn¡Jn¡Jn¡Jn¡‰­à‰­à‰­à‰­à‰­à'L~'L~'L~'L~'L~'L~'K~'K~'K~Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›'K~'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}DhšDhšDhšDhšDhš'K}'K}'K}'K}&K}&K}&K}&K}&K}&K}&K}&K}&K}&K}&K}&J}&J}&J}&J}&J}&J}Cg™Cg™Cg™<535=AG=?D?AD==1(B3)B2&F4'E4)gTGlXJs^OzcTzaPqfethgvjhbVTcWUdXVeYWfZXg[Yh\Zi]Zi][j^\€us€ususts~tt~tt}tt|st{stut~tt|sszrsyqrwpquoqsmpqloXTXTQWPOULLSSJEA<:=99757335./2113)+.'),)+.8:="(3@QJMPV\eT[cNZlNZlZ`iZ`iZ`iZ`iSYbY`h4;C.4=)6GCPaCPaCPaCPaCPaEQbZOGa_emhkŠƒ„nfgeaeJn¡Jn¡Jn¡Jn¡Jn¡Jn¡Š®àŠ®àŠ®àŠ®àŠ®àJo¡Jo¡Jo¡Jo¡Jo¡Jo¡Jo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Š®àŠ®áŠ®áŠ®áŠ®áŠ®áŠ®áŠ®áKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡ƒ§Úƒ§Úƒ§Úƒ¨Úƒ¨Úƒ¨Úƒ¨Úƒ¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨ÚEjœEiœEiœEiœEiœ'L~'L~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K}'K}'K}'K}'K}'K}'K}Di›Di›Di›Di›Dh›Dh›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}&K}&K}&K}&K}&K}$.>=I[=I[2)>0&A2'C3(I8-^OFbRHfUJjXMq^RwcVzfYfRDfQCdN@zdTqijrjksklrklrklrklqjmpjmpjmojmojmnimmimkhliflscYm`Xg\VbYT^VRE>;A<:>98:77645:873220/0,-/)+.*,/#%( &15;5BSKKKJMP]dlU[dNZlNZlZ`iTZcZaiZaiZ`iZ`iSZbŽ”LS[V]eDPbDPbDPbDPbDPbDPbWMF^^diei®”†…rkeaeJo¡Jo¡Jo¡Jo¡Š®àŠ®àŠ®àŠ®àŠ®àŠ®àŠ®àŠ®àŠ®àKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Š¯áŠ¯áŠ¯áŠ¯áKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡ƒ¨Úƒ¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Û„¨ÛGk'L~'L~'L~'L~'L~'L~'K~'K~'K~'K~'K~'K~'K~'K~'K~'K~Ei›Ei›Ei›Ei›Ei›Di›Di›Di›Di›Di›'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}&K}&K}&K}&K}%/> ,>=I[=I[ ,> ,>#)2(.7#)2(.7#)2#)2#)2#)2(.7(.7(.767@D>A214$+3#%("$'###""""""&&&888888cB*}\I@!%+%!5*$:/(;0)<1*>3+@4+>1(bUKN@6OA6L=3QB8M?4_RKaTLbUMcVNcVNcVObVOaVOaUO`UO_UO^UO^TO\SOYRNWPNUOMWPKYSOWRN;63953:76755333,/2'),%(+"%(!' "&,KXi04:JMP]_b^emU[dNZlNZlT[cU[dU[dU[d[aj•ž•ž•žˆŽ—–¥W]fDPbDPbDPbDPbDPbDPb‘nSž…w—|m¨‚ƒqjKo¡Ko¡Ko¡Š®àŠ®àŠ®àŠ®áŠ®áŠ®áŠ®áŠ®áŠ®áŠ¯áŠ¯áŠ¯áKo¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¡Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Û„¨Û„¨Û„¨Û„¨Û„©Û„©Û„©Û„©ÛGkGkGkGkGkGk'L~'L~'L~'L~'K~'K~'K~Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Ei›Di›Di›'K}'K}'K}'K}HlžHlžHlžHlžHlžHlžHlžHlž'K}'K}'K}'K}'K}'K}'K}'K}'K}'K}&K}*2? ->=I[=I[ ,> ,> ,>#)2#)2#)2(.7(.7#)2#)2(.7(.7(.7(.7/28:79G@A<89',4#%(#%(######""""""8888888887'vS:‹jW;) - &3#.$-% .% .& /&!,#,#@70A71XNHXNHWNHWNHZRLYQLYQLXQLWQLWPLUOLSNLQMKOLJMJJ0//.-.,,-&(+"(!' 15;6CT37=MMMKMP^ad_enY`hNZlNZlU\dV\eŠ‘™Š™Š™–Ÿ–Ÿ–ž•ž“œ—¦Œ’›ƒ¡DQbDQbDQbDQbDQbMUc¤ƒ‘ylŸ‡|€oiKo¡Š¯áŠ¯áŠ¯áŠ¯áŠ¯áŠ¯áŠ¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯áKo¢Ko¢Ko¢Ko¢Ko¢Ko¢Ko¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢Kp¢‹¯â‹¯â‹¯â‹¯âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢„¨Ú„¨Ú„¨Ú„¨Ú„¨Ú„¨Û„¨Û„¨Û„¨Û„©Û„©Û„©Û„©Û„©Û„©Û…©Û…©Û…©Û…©Û…©Û…©ÛGkžGkžGkžGkžGkžGkžGkžGkžGkž…©Û…©Ü…©Ü…©Ü…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž'K}'K}'K}'K}'K}'K}'K}'K}'K}HO\=J[=J[=J[ -> ,> ,>(.7#)2#)2(.7(.7(.7#)2(.7(.7(/7(/7)/8/28114H7,99@.05&,5$&)$$$######"""(((8888888888888884"nO9„gXˆjZE/ (-" - %' %$#" ! !$ 48>7CU:GX JJJLLLKMPagp_enNZlLPV˜Ÿ§Œ’›Œ’›Œ’›‹’š‹‘šŠ‘™‘— –Ÿ–Ÿ–Ÿ“œ“œ—¦„¢„¢DQbDQbDQbDQbNVc…uo‡rjѼ³º«§‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯áKp¢Kp¢Kp¢Kp¢Kp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢‹°â‹°â‹°â‹°âŒ°âŒ°âŒ°âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢„¨Û„¨Û„¨Û„©Û„©Û„©Û„©Û„©Û„©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©ÛGkžGkžGkžGlžGlžGlž…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž'K}'K}'K}'K}DhšDhšDhšIP\=J[=J[=J[=J[ -> ->(.7#)2#)2(.7(.7(.7#)2(.7(/7(/7)/8)/8)/803966:E?AC>A856,07%'*%')$$$######(((DDDBBB8888888880 cF1w]OcS{`QS;+57'   *      ;?E7CU;HY=I[ JJJMMMKMPacfbhq‘— ƒ¡ƒ¡‘— “œ“œ“œŒ“›Œ’›Œ’›‹‘š‘— ‘— —Ÿ™Ÿ¨”œ“œ“œ„‘¢„‘¢„‘¢„‘¢EQcHScNVd´¨§¿®¨Èµ®¯‘‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯á‹¯â‹¯â‹¯â‹¯â‹¯â‹¯â‹°â‹°â‹°â‹°â‹°â‹°â‹°âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Œ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âLp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp¢Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£Lp£„©Û„©Û„©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Û…©Ü…©Ü…©ÜGlžGlž…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÝHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž‡«Ý‡«ÝDhšDhšDhšDhš=J[=J[=J[=J[=J[=J[ ->(/7#)2#)2(.7(.7(.7#*2(/7)/8)/8)/8)/8)08*0903:56:88@KBB=;@348*08&(+'(*%%%$$$(((EEE(((&&&">-"bF3oXMs[Ow]Py^PqbpXMdH5R<,Q;, &%%#'-"'-&3DS_qP\nR_p>J\?K]AG@B::@66:-29'),)'%BBBFFFEEE)))))))))&&& @@@FFFACFZ\_[ajagp„¢„¢„¢ž¥­Ÿ¦®—¦–¥–ž•žŽ•Ž””œ“œ‘— —Ÿ›¡ªš ©™ ¨Ž•Ž”Ž”…‘£…‘£…‘£EQcGRcKTdPWd­¥§¿¯ª‹°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°ãŒ°ãŒ°ãŒ°ãŒ°ãLp£Lp£Lq£Lq£Lq£Lq£Lq£Lq£Lq£Œ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ãMq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£…©Û…©Û…©Û…©Û…©Û…©Û…©Ü…©Ü…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHlžHlžHlŸHlŸHlŸHlŸHlŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«ÞŸ>J\>J\=J[=J[=J[=J[FLU39B#*2(/7)/7)/8$*3$*3$*3)/8)08*09*09*19',5(-5*.6.17338@<=G@BH@BXW]UUXLPWFHKDFHKKKHHH+++%%%%%%$$$###!!!!!!777777777777777777777AAAFFFACFACF\^aeltbhqDQbDQbDQbŸ¥®¡§°¡§°¡§°¡§°—¦–Ÿ”š£”š£“™¢’™¡’˜¡‘˜ ‘— ›¡ª›¡ªš ©•ž™Ÿ¨Ž”ERcERcERcERcHScLUdRXd|njŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°âŒ°ãŒ°ãŒ°ãŒ°ãŒ°ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ã±ã±ã±ã±ãMq£Mq£Mq£Mq£Mq£Mq£±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ãMq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£Mq£…©Ü…©Ü…©Ü…©Ü…©Ü…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÜ†ªÜ†ªÜ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†ªÝ†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHlŸHlŸHlŸHlŸHlŸ‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬ÞŽŸŽŸŽŸŽŸ>J\=J[=J[FLUFLU(/7(/7*08*08%+3$*3$+3$+3*09*09*19&,5&,5'-6).6*/7-18NPURRVXUVc]^f^_[X]\XYTUZLQYKMPFHJ)))(((&&&%%%%%%$$$$$$###!!!!!!!!!777777777BBBEEEACGADGFIL\ckZ`iTZcDQbDQbDQbagpbiqcircir¢©±¢¨±¡¨°¡§°•œ¤•›¤”›£”š£“™¢’™¡’˜¡œ¢«œ¢«›¡ªš¡©•žY`hY_hERcERcERcGSdJTdNVdTYeLp¢Lp¢Œ°ãŒ°ãŒ°ãŒ°ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ãŒ±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ãMq£Mq£±ã±ã±ã±ä±ä±ä±ä±ä±ä±ä±ä±ä±ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²ä²äMq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤Mq¤…ªÜ…ªÜ…ªÜ…ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†ªÝ†ªÝ†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«ÝHmŸ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞŽŸŽŸŽŸŽŸŽŸŽŸŽŸFLUFLUFLU)/8+08+08&+3&+3%+4%+4%+4*19+1:&,5'-5'-6(.6FLTHMTINUKOVOQWSTXYWX`[^lbac]_f_\a_aY\aRX_,.1*,.*+-***((('''&&&%%%%%%$$$$$$$$$###!!!!!!!!!!!!!!!%%%%%%%%%%%%"""""""""KKKJJJFFFGIL]_b^dm\bkV]eDQbEQcEQcEQccirdjsdksektdjsdjscir£©²¢¨±¢¨±–œ¥•œ¤•›¤”›£”š£“™¢’™¡£¬œ¢«›¢ª[ajZ`iOU^ERcERcFRdFRdITdLUdPWeVZeLp£Lq£Lq£Lq£±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ã±ä±ä±ä±ä±ä±ä²ä²ä²äMq£²ä²ä²ä²ä²ä²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äMr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤Mr¤†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž†«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«ÞHmŸHmŸHmŸ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ÞŽŸŽŸŽŸŽŸ‚Ž ‚Ž ‚Ž ‚Ž ”›£Š™ŠŽ•-18,18',3',4',4&,4%,4+1:,2:'-5DJSEKSEKTFLTFLUHMUINVKOWLPWQSYTUZWWZpjje^`offb\_h`]eaaCCG8;A27?-/2+-/.+)******)))((('''&&&&&&%%%%%%$$$$$$$$$$$$$$$$$$######???EEEEEEEEE((((((###&&&%%%HJMHJMHJMHJM_en]dlZ`i_enEQcEQcEQcEQcbhqektflufluflufluektektdksdjscjr£©²¢©±¢¨±–œ¥•œ¤•›¤”›£”š£“™¢£¬\ckQW`[ajZaiOU^FRdFRdFRdHSdKUdNVeRXeX\fLq£Mq£Mq£Mq£Mq£±ã±ã±ã±ã±ã±ä±ä±ä±ä±ä²ä²ä²ä²ä²ä²ä²ä²äŽ²äŽ²äŽ²äŽ²äŽ²äMr¤Mr¤Mr¤Mr¤Mr¤Ž²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åŽ²åNr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤†ªÜ†ªÜ†ªÜ†ªÜ†ªÜ†ªÜHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlž‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬ÞHmŸHmŸHmŸHmŸImŸImŸImŸˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ‚Ž ”›£Š‘™‹•‹•PT[KOVJOV(-4(-4'-5'-5JOXEKSEKSEKTFLTFLTGMUGMUHNVIOWKPWLQXMRYPTZTV[\]a_^asljd^azporjkE@CLEBIEFEDG29A28A17@135,.1+-0+,/./1..0'),)))++++++++++++***FFFFFFACFACFEEEACFACFŠŒJLOJLOKQZ_en]clY_hU[dEQcEQcEQcEQcEQcagp[aj\bk\bkgnvgnvgmvgmvfluflueltektdksdjscjrcir¢©±—¦–œ¥•œ¤•›¤TZcSYbRYaRXaQW`[bj[ajZ`iFSdFSdGSdJTdLVePXeTZfZ]fMq£Mq£Mq£Mq£Mq£Mq£Mq£²ä²ä²ä²ä²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äŽ²äNr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Nr¤Ž²åŽ²åŽ²åŽ²åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³åŽ³å³å³å³å³å³å³å³åNr¤Nr¤Nr¤Nr¤Nr¤³å³å†ªÜ†ªÜ†ªÝHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlžHlŸHlŸHlŸHlŸHlŸHlŸ‡«Ý‡«Ý‡«Ý‡«Ý‡«Ý‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡«Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬Þ‡¬ÞImŸImŸImŸImŸImŸImŸImŸImŸImŸImŸˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬Þˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ¬ßˆ­ß‚Ž ‚Ž ‚Ž ‚Ž ‚ ‚ ‚ ‚ ‚ …Œ”’•šŒ•‘”›LPVLPWKPW‹—‹—‹˜•‹‘™FLTFLTFLUGMUGMUHMVHNVINWIOWKPXLQYMRYNSZTX`X[a[]b]^c__ccacib`JDGi__aYYPJLD@C=;AKEDTQR@?A>>A;/5>.4=-4 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef QMap QStringMap; -typedef QList QIntList; -Q_DECLARE_METATYPE(QImage) -Q_DECLARE_METATYPE(QRect) -Q_DECLARE_METATYPE(QSize) -Q_DECLARE_METATYPE(QColor) -Q_DECLARE_METATYPE(QStringMap) -Q_DECLARE_METATYPE(QIntList) -Q_DECLARE_METATYPE(QIODevice *) - -//TESTED_FILES= - -class tst_QImageReader : public QObject -{ - Q_OBJECT - -public: - tst_QImageReader(); - virtual ~tst_QImageReader(); - -public slots: - void init(); - void cleanup(); - -private slots: - void readImage_data(); - void readImage(); - - void setScaledSize_data(); - void setScaledSize(); - - void setClipRect_data(); - void setClipRect(); - - void setScaledClipRect_data(); - void setScaledClipRect(); - -private: - QList< QPair > images; // filename, format -}; - -tst_QImageReader::tst_QImageReader() -{ - images << QPair(QLatin1String("colorful.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("font.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("crash-signed-char.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("4bpp-rle.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("tst7.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("16bpp.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("negativeheight.bmp"), QByteArray("bmp")); - images << QPair(QLatin1String("marble.xpm"), QByteArray("xpm")); - images << QPair(QLatin1String("kollada.png"), QByteArray("png")); - images << QPair(QLatin1String("teapot.ppm"), QByteArray("ppm")); - images << QPair(QLatin1String("runners.ppm"), QByteArray("ppm")); - images << QPair(QLatin1String("test.ppm"), QByteArray("ppm")); - images << QPair(QLatin1String("gnus.xbm"), QByteArray("xbm")); -#if defined QTEST_HAVE_JPEG - images << QPair(QLatin1String("beavis.jpg"), QByteArray("jpeg")); - images << QPair(QLatin1String("YCbCr_cmyk.jpg"), QByteArray("jpeg")); - images << QPair(QLatin1String("YCbCr_rgb.jpg"), QByteArray("jpeg")); - images << QPair(QLatin1String("task210380.jpg"), QByteArray("jpeg")); -#endif -#if defined QTEST_HAVE_GIF - images << QPair(QLatin1String("earth.gif"), QByteArray("gif")); - images << QPair(QLatin1String("trolltech.gif"), QByteArray("gif")); -#endif -#if defined QTEST_HAVE_MNG - images << QPair(QLatin1String("ball.mng"), QByteArray("mng")); - images << QPair(QLatin1String("fire.mng"), QByteArray("mng")); -#endif -} - -tst_QImageReader::~tst_QImageReader() -{ -} - -void tst_QImageReader::init() -{ -} - -void tst_QImageReader::cleanup() -{ -} - -void tst_QImageReader::readImage_data() -{ - QTest::addColumn("fileName"); - QTest::addColumn("format"); - - for (int i = 0; i < images.size(); ++i) { - const QString file = images[i].first; - const QByteArray format = images[i].second; - QTest::newRow(qPrintable(file)) << file << format; - } -} - -void tst_QImageReader::readImage() -{ - QFETCH(QString, fileName); - QFETCH(QByteArray, format); - - QBENCHMARK { - QImageReader io("images/" + fileName, format); - QImage image = io.read(); - QVERIFY(!image.isNull()); - } -} - -void tst_QImageReader::setScaledSize_data() -{ - QTest::addColumn("fileName"); - QTest::addColumn("format"); - QTest::addColumn("newSize"); - - for (int i = 0; i < images.size(); ++i) { - const QString file = images[i].first; - const QByteArray format = images[i].second; - QSize size(200, 200); - if (file == QLatin1String("teapot")) - size = QSize(400, 400); - else if (file == QLatin1String("test.ppm")) - size = QSize(10, 10); - QTest::newRow(qPrintable(file)) << file << format << size; - } -} - -void tst_QImageReader::setScaledSize() -{ - QFETCH(QString, fileName); - QFETCH(QSize, newSize); - QFETCH(QByteArray, format); - - QBENCHMARK { - QImageReader reader("images/" + fileName, format); - reader.setScaledSize(newSize); - QImage image = reader.read(); - QCOMPARE(image.size(), newSize); - } -} - -void tst_QImageReader::setClipRect_data() -{ - QTest::addColumn("fileName"); - QTest::addColumn("format"); - QTest::addColumn("newRect"); - - for (int i = 0; i < images.size(); ++i) { - const QString file = images[i].first; - const QByteArray format = images[i].second; - QTest::newRow(qPrintable(file)) << file << format << QRect(0, 0, 50, 50); - } -} - -void tst_QImageReader::setClipRect() -{ - QFETCH(QString, fileName); - QFETCH(QRect, newRect); - QFETCH(QByteArray, format); - - QBENCHMARK { - QImageReader reader("images/" + fileName, format); - reader.setClipRect(newRect); - QImage image = reader.read(); - QCOMPARE(image.rect(), newRect); - } -} - -void tst_QImageReader::setScaledClipRect_data() -{ - setClipRect_data(); -} - -void tst_QImageReader::setScaledClipRect() -{ - QFETCH(QString, fileName); - QFETCH(QRect, newRect); - QFETCH(QByteArray, format); - - QBENCHMARK { - QImageReader reader("images/" + fileName, format); - reader.setScaledSize(QSize(300, 300)); - reader.setScaledClipRect(newRect); - QImage image = reader.read(); - QCOMPARE(image.rect(), newRect); - } -} - -QTEST_MAIN(tst_QImageReader) -#include "tst_qimagereader.moc" diff --git a/tests/benchmarks/qiodevice/main.cpp b/tests/benchmarks/qiodevice/main.cpp deleted file mode 100644 index 4af697c..0000000 --- a/tests/benchmarks/qiodevice/main.cpp +++ /dev/null @@ -1,107 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include - -#include - - -class tst_qiodevice : public QObject -{ - Q_OBJECT -private slots: - void read_old(); - void read_old_data() { read_data(); } - //void read_new(); - //void read_new_data() { read_data(); } -private: - void read_data(); -}; - - -void tst_qiodevice::read_data() -{ - QTest::addColumn("size"); - QTest::newRow("10k") << qint64(10 * 1024); - QTest::newRow("100k") << qint64(100 * 1024); - QTest::newRow("1000k") << qint64(1000 * 1024); - QTest::newRow("10000k") << qint64(10000 * 1024); -#ifndef Q_OS_SYMBIAN // Symbian devices don't (yet) have enough available RAM to run these - QTest::newRow("100000k") << qint64(100000 * 1024); - QTest::newRow("1000000k") << qint64(1000000 * 1024); -#endif -} - -void tst_qiodevice::read_old() -{ - QFETCH(qint64, size); - - QString name = "tmp" + QString::number(size); - - { - QFile file(name); - file.open(QIODevice::WriteOnly); - file.seek(size); - file.write("x", 1); - file.close(); - } - - QBENCHMARK { - QFile file(name); - file.open(QIODevice::ReadOnly); - QByteArray ba; - qint64 s = size - 1024; - file.seek(512); - ba = file.read(s); // crash happens during this read / assignment operation - } - - { - QFile file(name); - file.remove(); - } -} - - -QTEST_MAIN(tst_qiodevice) - -#include "main.moc" diff --git a/tests/benchmarks/qiodevice/qiodevice.pro b/tests/benchmarks/qiodevice/qiodevice.pro deleted file mode 100755 index 749a4d6..0000000 --- a/tests/benchmarks/qiodevice/qiodevice.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qiodevice -TARGET.EPOCHEAPSIZE = 0x100000 0x2000000 -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qmatrix4x4/qmatrix4x4.pro b/tests/benchmarks/qmatrix4x4/qmatrix4x4.pro deleted file mode 100644 index e82d9de..0000000 --- a/tests/benchmarks/qmatrix4x4/qmatrix4x4.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qmatrix4x4 - -SOURCES += tst_qmatrix4x4.cpp - diff --git a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp deleted file mode 100644 index e962198..0000000 --- a/tests/benchmarks/qmatrix4x4/tst_qmatrix4x4.cpp +++ /dev/null @@ -1,672 +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 QtOpenGL 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 -#include - -class tst_QMatrix4x4 : public QObject -{ - Q_OBJECT -public: - tst_QMatrix4x4() {} - ~tst_QMatrix4x4() {} - -private slots: - void multiply_data(); - void multiply(); - - void multiplyInPlace_data(); - void multiplyInPlace(); - - void multiplyDirect_data(); - void multiplyDirect(); - - void mapVector3D_data(); - void mapVector3D(); - - void mapVector2D_data(); - void mapVector2D(); - - void mapVectorDirect_data(); - void mapVectorDirect(); - - void compareTranslate_data(); - void compareTranslate(); - - void compareTranslateAfterScale_data(); - void compareTranslateAfterScale(); - - void compareTranslateAfterRotate_data(); - void compareTranslateAfterRotate(); - - void compareScale_data(); - void compareScale(); - - void compareScaleAfterTranslate_data(); - void compareScaleAfterTranslate(); - - void compareScaleAfterRotate_data(); - void compareScaleAfterRotate(); - - void compareRotate_data(); - void compareRotate(); - - void compareRotateAfterTranslate_data(); - void compareRotateAfterTranslate(); - - void compareRotateAfterScale_data(); - void compareRotateAfterScale(); -}; - -static qreal const generalValues[16] = - {1.0f, 2.0f, 3.0f, 4.0f, - 5.0f, 6.0f, 7.0f, 8.0f, - 9.0f, 10.0f, 11.0f, 12.0f, - 13.0f, 14.0f, 15.0f, 16.0f}; - -void tst_QMatrix4x4::multiply_data() -{ - QTest::addColumn("m1"); - QTest::addColumn("m2"); - - QTest::newRow("identity * identity") - << QMatrix4x4() << QMatrix4x4(); - QTest::newRow("identity * general") - << QMatrix4x4() << QMatrix4x4(generalValues); - QTest::newRow("general * identity") - << QMatrix4x4(generalValues) << QMatrix4x4(); - QTest::newRow("general * general") - << QMatrix4x4(generalValues) << QMatrix4x4(generalValues); -} - -QMatrix4x4 mresult; - -void tst_QMatrix4x4::multiply() -{ - QFETCH(QMatrix4x4, m1); - QFETCH(QMatrix4x4, m2); - - QMatrix4x4 m3; - - QBENCHMARK { - m3 = m1 * m2; - } - - // Force the result to be stored so the compiler doesn't - // optimize away the contents of the benchmark loop. - mresult = m3; -} - -void tst_QMatrix4x4::multiplyInPlace_data() -{ - multiply_data(); -} - -void tst_QMatrix4x4::multiplyInPlace() -{ - QFETCH(QMatrix4x4, m1); - QFETCH(QMatrix4x4, m2); - - QMatrix4x4 m3; - - QBENCHMARK { - m3 = m1; - m3 *= m2; - } - - // Force the result to be stored so the compiler doesn't - // optimize away the contents of the benchmark loop. - mresult = m3; -} - -// Use a direct naive multiplication algorithm. This is used -// to compare against the optimized routines to see if they are -// actually faster than the naive implementation. -void tst_QMatrix4x4::multiplyDirect_data() -{ - multiply_data(); -} -void tst_QMatrix4x4::multiplyDirect() -{ - QFETCH(QMatrix4x4, m1); - QFETCH(QMatrix4x4, m2); - - QMatrix4x4 m3; - - const qreal *m1data = m1.constData(); - const qreal *m2data = m2.constData(); - qreal *m3data = m3.data(); - - QBENCHMARK { - for (int row = 0; row < 4; ++row) { - for (int col = 0; col < 4; ++col) { - m3data[col * 4 + row] = 0.0f; - for (int j = 0; j < 4; ++j) { - m3data[col * 4 + row] += - m1data[j * 4 + row] * m2data[col * 4 + j]; - } - } - } - } -} - -QVector3D vresult; - -void tst_QMatrix4x4::mapVector3D_data() -{ - QTest::addColumn("m1"); - - QTest::newRow("identity") << QMatrix4x4(); - QTest::newRow("general") << QMatrix4x4(generalValues); - - QMatrix4x4 t1; - t1.translate(-100.5f, 64.0f, 75.25f); - QTest::newRow("translate3D") << t1; - - QMatrix4x4 t2; - t2.translate(-100.5f, 64.0f); - QTest::newRow("translate2D") << t2; - - QMatrix4x4 s1; - s1.scale(-100.5f, 64.0f, 75.25f); - QTest::newRow("scale3D") << s1; - - QMatrix4x4 s2; - s2.scale(-100.5f, 64.0f); - QTest::newRow("scale2D") << s2; -} -void tst_QMatrix4x4::mapVector3D() -{ - QFETCH(QMatrix4x4, m1); - - QVector3D v(10.5f, -2.0f, 3.0f); - QVector3D result; - - m1.optimize(); - - QBENCHMARK { - result = m1 * v; - } - - // Force the result to be stored so the compiler doesn't - // optimize away the contents of the benchmark loop. - vresult = result; -} - -QPointF vresult2; - -void tst_QMatrix4x4::mapVector2D_data() -{ - mapVector3D_data(); -} -void tst_QMatrix4x4::mapVector2D() -{ - QFETCH(QMatrix4x4, m1); - - QPointF v(10.5f, -2.0f); - QPointF result; - - m1.optimize(); - - QBENCHMARK { - result = m1 * v; - } - - // Force the result to be stored so the compiler doesn't - // optimize away the contents of the benchmark loop. - vresult2 = result; -} - -// Use a direct naive multiplication algorithm. This is used -// to compare against the optimized routines to see if they are -// actually faster than the naive implementation. -void tst_QMatrix4x4::mapVectorDirect_data() -{ - mapVector3D_data(); -} -void tst_QMatrix4x4::mapVectorDirect() -{ - QFETCH(QMatrix4x4, m1); - - const qreal *m1data = m1.constData(); - qreal v[4] = {10.5f, -2.0f, 3.0f, 1.0f}; - qreal result[4]; - - QBENCHMARK { - for (int row = 0; row < 4; ++row) { - result[row] = 0.0f; - for (int col = 0; col < 4; ++col) { - result[row] += m1data[col * 4 + row] * v[col]; - } - } - result[0] /= result[3]; - result[1] /= result[3]; - result[2] /= result[3]; - } -} - -// Compare the performance of QTransform::translate() to -// QMatrix4x4::translate(). -void tst_QMatrix4x4::compareTranslate_data() -{ - QTest::addColumn("useQTransform"); - QTest::addColumn("translation"); - - QTest::newRow("QTransform::translate(0, 0, 0)") - << true << QVector3D(0, 0, 0); - QTest::newRow("QMatrix4x4::translate(0, 0, 0)") - << false << QVector3D(0, 0, 0); - - QTest::newRow("QTransform::translate(1, 2, 0)") - << true << QVector3D(1, 2, 0); - QTest::newRow("QMatrix4x4::translate(1, 2, 0)") - << false << QVector3D(1, 2, 0); - - QTest::newRow("QTransform::translate(1, 2, 4)") - << true << QVector3D(1, 2, 4); - QTest::newRow("QMatrix4x4::translate(1, 2, 4)") - << false << QVector3D(1, 2, 4); -} -void tst_QMatrix4x4::compareTranslate() -{ - QFETCH(bool, useQTransform); - QFETCH(QVector3D, translation); - - qreal x = translation.x(); - qreal y = translation.y(); - qreal z = translation.z(); - - if (useQTransform) { - QTransform t; - QBENCHMARK { - t.translate(x, y); - } - } else if (z == 0.0f) { - QMatrix4x4 m; - QBENCHMARK { - m.translate(x, y); - } - } else { - QMatrix4x4 m; - QBENCHMARK { - m.translate(x, y, z); - } - } -} - -// Compare the performance of QTransform::translate() to -// QMatrix4x4::translate() after priming the matrix with a scale(). -void tst_QMatrix4x4::compareTranslateAfterScale_data() -{ - compareTranslate_data(); -} -void tst_QMatrix4x4::compareTranslateAfterScale() -{ - QFETCH(bool, useQTransform); - QFETCH(QVector3D, translation); - - qreal x = translation.x(); - qreal y = translation.y(); - qreal z = translation.z(); - - if (useQTransform) { - QTransform t; - t.scale(3, 4); - QBENCHMARK { - t.translate(x, y); - } - } else if (z == 0.0f) { - QMatrix4x4 m; - m.scale(3, 4); - QBENCHMARK { - m.translate(x, y); - } - } else { - QMatrix4x4 m; - m.scale(3, 4, 5); - QBENCHMARK { - m.translate(x, y, z); - } - } -} - -// Compare the performance of QTransform::translate() to -// QMatrix4x4::translate() after priming the matrix with a rotate(). -void tst_QMatrix4x4::compareTranslateAfterRotate_data() -{ - compareTranslate_data(); -} -void tst_QMatrix4x4::compareTranslateAfterRotate() -{ - QFETCH(bool, useQTransform); - QFETCH(QVector3D, translation); - - qreal x = translation.x(); - qreal y = translation.y(); - qreal z = translation.z(); - - if (useQTransform) { - QTransform t; - t.rotate(45.0f); - QBENCHMARK { - t.translate(x, y); - } - } else if (z == 0.0f) { - QMatrix4x4 m; - m.rotate(45.0f, 0, 0, 1); - QBENCHMARK { - m.translate(x, y); - } - } else { - QMatrix4x4 m; - m.rotate(45.0f, 0, 0, 1); - QBENCHMARK { - m.translate(x, y, z); - } - } -} - -// Compare the performance of QTransform::scale() to -// QMatrix4x4::scale(). -void tst_QMatrix4x4::compareScale_data() -{ - QTest::addColumn("useQTransform"); - QTest::addColumn("scale"); - - QTest::newRow("QTransform::scale(1, 1, 1)") - << true << QVector3D(1, 1, 1); - QTest::newRow("QMatrix4x4::scale(1, 1, 1)") - << false << QVector3D(1, 1, 1); - - QTest::newRow("QTransform::scale(3, 6, 1)") - << true << QVector3D(3, 6, 1); - QTest::newRow("QMatrix4x4::scale(3, 6, 1)") - << false << QVector3D(3, 6, 1); - - QTest::newRow("QTransform::scale(3, 6, 4)") - << true << QVector3D(3, 6, 4); - QTest::newRow("QMatrix4x4::scale(3, 6, 4)") - << false << QVector3D(3, 6, 4); -} -void tst_QMatrix4x4::compareScale() -{ - QFETCH(bool, useQTransform); - QFETCH(QVector3D, scale); - - qreal x = scale.x(); - qreal y = scale.y(); - qreal z = scale.z(); - - if (useQTransform) { - QTransform t; - QBENCHMARK { - t.scale(x, y); - } - } else if (z == 1.0f) { - QMatrix4x4 m; - QBENCHMARK { - m.scale(x, y); - } - } else { - QMatrix4x4 m; - QBENCHMARK { - m.scale(x, y, z); - } - } -} - -// Compare the performance of QTransform::scale() to -// QMatrix4x4::scale() after priming the matrix with a translate(). -void tst_QMatrix4x4::compareScaleAfterTranslate_data() -{ - compareScale_data(); -} -void tst_QMatrix4x4::compareScaleAfterTranslate() -{ - QFETCH(bool, useQTransform); - QFETCH(QVector3D, scale); - - qreal x = scale.x(); - qreal y = scale.y(); - qreal z = scale.z(); - - if (useQTransform) { - QTransform t; - t.translate(20, 34); - QBENCHMARK { - t.scale(x, y); - } - } else if (z == 1.0f) { - QMatrix4x4 m; - m.translate(20, 34); - QBENCHMARK { - m.scale(x, y); - } - } else { - QMatrix4x4 m; - m.translate(20, 34, 42); - QBENCHMARK { - m.scale(x, y, z); - } - } -} - -// Compare the performance of QTransform::scale() to -// QMatrix4x4::scale() after priming the matrix with a rotate(). -void tst_QMatrix4x4::compareScaleAfterRotate_data() -{ - compareScale_data(); -} -void tst_QMatrix4x4::compareScaleAfterRotate() -{ - QFETCH(bool, useQTransform); - QFETCH(QVector3D, scale); - - qreal x = scale.x(); - qreal y = scale.y(); - qreal z = scale.z(); - - if (useQTransform) { - QTransform t; - t.rotate(45.0f); - QBENCHMARK { - t.scale(x, y); - } - } else if (z == 1.0f) { - QMatrix4x4 m; - m.rotate(45.0f, 0, 0, 1); - QBENCHMARK { - m.scale(x, y); - } - } else { - QMatrix4x4 m; - m.rotate(45.0f, 0, 0, 1); - QBENCHMARK { - m.scale(x, y, z); - } - } -} - -// Compare the performance of QTransform::rotate() to -// QMatrix4x4::rotate(). -void tst_QMatrix4x4::compareRotate_data() -{ - QTest::addColumn("useQTransform"); - QTest::addColumn("angle"); - QTest::addColumn("rotation"); - QTest::addColumn("axis"); - - QTest::newRow("QTransform::rotate(0, ZAxis)") - << true << qreal(0.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); - QTest::newRow("QMatrix4x4::rotate(0, ZAxis)") - << false << qreal(0.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); - - QTest::newRow("QTransform::rotate(45, ZAxis)") - << true << qreal(45.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); - QTest::newRow("QMatrix4x4::rotate(45, ZAxis)") - << false << qreal(45.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); - - QTest::newRow("QTransform::rotate(90, ZAxis)") - << true << qreal(90.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); - QTest::newRow("QMatrix4x4::rotate(90, ZAxis)") - << false << qreal(90.0f) << QVector3D(0, 0, 1) << int(Qt::ZAxis); - - QTest::newRow("QTransform::rotate(0, YAxis)") - << true << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); - QTest::newRow("QMatrix4x4::rotate(0, YAxis)") - << false << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); - - QTest::newRow("QTransform::rotate(45, YAxis)") - << true << qreal(45.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); - QTest::newRow("QMatrix4x4::rotate(45, YAxis)") - << false << qreal(45.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); - - QTest::newRow("QTransform::rotate(90, YAxis)") - << true << qreal(90.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); - QTest::newRow("QMatrix4x4::rotate(90, YAxis)") - << false << qreal(90.0f) << QVector3D(0, 1, 0) << int(Qt::YAxis); - - QTest::newRow("QTransform::rotate(0, XAxis)") - << true << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::XAxis); - QTest::newRow("QMatrix4x4::rotate(0, XAxis)") - << false << qreal(0.0f) << QVector3D(0, 1, 0) << int(Qt::XAxis); - - QTest::newRow("QTransform::rotate(45, XAxis)") - << true << qreal(45.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); - QTest::newRow("QMatrix4x4::rotate(45, XAxis)") - << false << qreal(45.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); - - QTest::newRow("QTransform::rotate(90, XAxis)") - << true << qreal(90.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); - QTest::newRow("QMatrix4x4::rotate(90, XAxis)") - << false << qreal(90.0f) << QVector3D(1, 0, 0) << int(Qt::XAxis); -} -void tst_QMatrix4x4::compareRotate() -{ - QFETCH(bool, useQTransform); - QFETCH(qreal, angle); - QFETCH(QVector3D, rotation); - QFETCH(int, axis); - - qreal x = rotation.x(); - qreal y = rotation.y(); - qreal z = rotation.z(); - - if (useQTransform) { - QTransform t; - QBENCHMARK { - t.rotate(angle, Qt::Axis(axis)); - } - } else { - QMatrix4x4 m; - QBENCHMARK { - m.rotate(angle, x, y, z); - } - } -} - -// Compare the performance of QTransform::rotate() to -// QMatrix4x4::rotate() after priming the matrix with a translate(). -void tst_QMatrix4x4::compareRotateAfterTranslate_data() -{ - compareRotate_data(); -} -void tst_QMatrix4x4::compareRotateAfterTranslate() -{ - QFETCH(bool, useQTransform); - QFETCH(qreal, angle); - QFETCH(QVector3D, rotation); - QFETCH(int, axis); - - qreal x = rotation.x(); - qreal y = rotation.y(); - qreal z = rotation.z(); - - if (useQTransform) { - QTransform t; - t.translate(3, 4); - QBENCHMARK { - t.rotate(angle, Qt::Axis(axis)); - } - } else { - QMatrix4x4 m; - m.translate(3, 4, 5); - QBENCHMARK { - m.rotate(angle, x, y, z); - } - } -} - -// Compare the performance of QTransform::rotate() to -// QMatrix4x4::rotate() after priming the matrix with a scale(). -void tst_QMatrix4x4::compareRotateAfterScale_data() -{ - compareRotate_data(); -} -void tst_QMatrix4x4::compareRotateAfterScale() -{ - QFETCH(bool, useQTransform); - QFETCH(qreal, angle); - QFETCH(QVector3D, rotation); - QFETCH(int, axis); - - qreal x = rotation.x(); - qreal y = rotation.y(); - qreal z = rotation.z(); - - if (useQTransform) { - QTransform t; - t.scale(3, 4); - QBENCHMARK { - t.rotate(angle, Qt::Axis(axis)); - } - } else { - QMatrix4x4 m; - m.scale(3, 4, 5); - QBENCHMARK { - m.rotate(angle, x, y, z); - } - } -} - -QTEST_MAIN(tst_QMatrix4x4) - -#include "tst_qmatrix4x4.moc" diff --git a/tests/benchmarks/qmetaobject/main.cpp b/tests/benchmarks/qmetaobject/main.cpp deleted file mode 100644 index c375a16..0000000 --- a/tests/benchmarks/qmetaobject/main.cpp +++ /dev/null @@ -1,159 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include - -class tst_qmetaobject: public QObject -{ -Q_OBJECT -private slots: - void initTestCase(); - void cleanupTestCase(); - - void indexOfProperty_data(); - void indexOfProperty(); - void indexOfMethod_data(); - void indexOfMethod(); - void indexOfSignal_data(); - void indexOfSignal(); - void indexOfSlot_data(); - void indexOfSlot(); -}; - -void tst_qmetaobject::initTestCase() -{ -} - -void tst_qmetaobject::cleanupTestCase() -{ -} - -void tst_qmetaobject::indexOfProperty_data() -{ - QTest::addColumn("name"); - const QMetaObject *mo = &QTreeView::staticMetaObject; - for (int i = 0; i < mo->propertyCount(); ++i) { - QMetaProperty prop = mo->property(i); - QTest::newRow(prop.name()) << QByteArray(prop.name()); - } -} - -void tst_qmetaobject::indexOfProperty() -{ - QFETCH(QByteArray, name); - const char *p = name.constData(); - const QMetaObject *mo = &QTreeView::staticMetaObject; - QBENCHMARK { - (void)mo->indexOfProperty(p); - } -} - -void tst_qmetaobject::indexOfMethod_data() -{ - QTest::addColumn("method"); - const QMetaObject *mo = &QTreeView::staticMetaObject; - for (int i = 0; i < mo->methodCount(); ++i) { - QMetaMethod method = mo->method(i); - QByteArray sig = method.signature(); - QTest::newRow(sig) << sig; - } -} - -void tst_qmetaobject::indexOfMethod() -{ - QFETCH(QByteArray, method); - const char *p = method.constData(); - const QMetaObject *mo = &QTreeView::staticMetaObject; - QBENCHMARK { - (void)mo->indexOfMethod(p); - } -} - -void tst_qmetaobject::indexOfSignal_data() -{ - QTest::addColumn("signal"); - const QMetaObject *mo = &QTreeView::staticMetaObject; - for (int i = 0; i < mo->methodCount(); ++i) { - QMetaMethod method = mo->method(i); - if (method.methodType() != QMetaMethod::Signal) - continue; - QByteArray sig = method.signature(); - QTest::newRow(sig) << sig; - } -} - -void tst_qmetaobject::indexOfSignal() -{ - QFETCH(QByteArray, signal); - const char *p = signal.constData(); - const QMetaObject *mo = &QTreeView::staticMetaObject; - QBENCHMARK { - (void)mo->indexOfSignal(p); - } -} - -void tst_qmetaobject::indexOfSlot_data() -{ - QTest::addColumn("slot"); - const QMetaObject *mo = &QTreeView::staticMetaObject; - for (int i = 0; i < mo->methodCount(); ++i) { - QMetaMethod method = mo->method(i); - if (method.methodType() != QMetaMethod::Slot) - continue; - QByteArray sig = method.signature(); - QTest::newRow(sig) << sig; - } -} - -void tst_qmetaobject::indexOfSlot() -{ - QFETCH(QByteArray, slot); - const char *p = slot.constData(); - const QMetaObject *mo = &QTreeView::staticMetaObject; - QBENCHMARK { - (void)mo->indexOfSlot(p); - } -} - -QTEST_MAIN(tst_qmetaobject) - -#include "main.moc" diff --git a/tests/benchmarks/qmetaobject/qmetaobject.pro b/tests/benchmarks/qmetaobject/qmetaobject.pro deleted file mode 100644 index 78300f6..0000000 --- a/tests/benchmarks/qmetaobject/qmetaobject.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qmetaobject - -SOURCES += main.cpp diff --git a/tests/benchmarks/qnetworkreply/qnetworkreply.pro b/tests/benchmarks/qnetworkreply/qnetworkreply.pro deleted file mode 100644 index 1e67d81..0000000 --- a/tests/benchmarks/qnetworkreply/qnetworkreply.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qnetworkreply -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui -QT += network - -CONFIG += release - -# Input -SOURCES += tst_qnetworkreply.cpp diff --git a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp deleted file mode 100644 index a92359f..0000000 --- a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp +++ /dev/null @@ -1,656 +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 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 QNetworkReply functions. - -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../auto/network-settings.h" - - -class TimedSender: public QThread -{ - Q_OBJECT - qint64 totalBytes; - QSemaphore ready; - QByteArray dataToSend; - QTcpSocket *client; - int timeout; - int port; -public: - int transferRate; - TimedSender(int ms) - : totalBytes(0), timeout(ms), port(-1), transferRate(-1) - { - dataToSend = QByteArray(16*1024, '@'); - start(); - ready.acquire(); - } - - inline int serverPort() const { return port; } - -private slots: - void writeMore() - { - while (client->bytesToWrite() < 128 * 1024) { - writePacket(dataToSend); - } - } - -protected: - void run() - { - QTcpServer server; - server.listen(); - port = server.serverPort(); - ready.release(); - - server.waitForNewConnection(-1); - client = server.nextPendingConnection(); - - writeMore(); - connect(client, SIGNAL(bytesWritten(qint64)), SLOT(writeMore()), Qt::DirectConnection); - - QEventLoop eventLoop; - QTimer::singleShot(timeout, &eventLoop, SLOT(quit())); - - QTime timer; - timer.start(); - eventLoop.exec(); - disconnect(client, SIGNAL(bytesWritten(qint64)), this, 0); - - // wait for the connection to shut down - client->disconnectFromHost(); - if (!client->waitForDisconnected(10000)) - return; - - transferRate = totalBytes * 1000 / timer.elapsed(); - qDebug() << "TimedSender::run" << "receive rate:" << (transferRate / 1024) << "kB/s in" - << timer.elapsed() << "ms"; - } - - void writePacket(const QByteArray &array) - { - client->write(array); - totalBytes += array.size(); - } -}; - - -class QNetworkReplyPtr: public QSharedPointer -{ -public: - inline QNetworkReplyPtr(QNetworkReply *ptr = 0) - : QSharedPointer(ptr) - { } - - inline operator QNetworkReply *() const { return data(); } -}; - - -class DataReader: public QObject -{ - Q_OBJECT -public: - qint64 totalBytes; - QByteArray data; - QIODevice *device; - bool accumulate; - DataReader(QIODevice *dev, bool acc = true) : totalBytes(0), device(dev), accumulate(acc) - { - connect(device, SIGNAL(readyRead()), SLOT(doRead())); - } - -public slots: - void doRead() - { - QByteArray buffer; - buffer.resize(device->bytesAvailable()); - qint64 bytesRead = device->read(buffer.data(), device->bytesAvailable()); - if (bytesRead == -1) { - QTestEventLoop::instance().exitLoop(); - return; - } - buffer.truncate(bytesRead); - totalBytes += bytesRead; - - if (accumulate) - data += buffer; - } -}; - -class ThreadedDataReader: public QThread -{ - Q_OBJECT - // used to make the constructor only return after the tcp server started listening - QSemaphore ready; - QTcpSocket *client; - int timeout; - int port; -public: - qint64 transferRate; - ThreadedDataReader() - : port(-1), transferRate(-1) - { - start(); - ready.acquire(); - } - - inline int serverPort() const { return port; } - -protected: - void run() - { - QTcpServer server; - server.listen(); - port = server.serverPort(); - ready.release(); - - server.waitForNewConnection(-1); - client = server.nextPendingConnection(); - - QEventLoop eventLoop; - DataReader reader(client, false); - QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); - - QTime timer; - timer.start(); - eventLoop.exec(); - qint64 elapsed = timer.elapsed(); - - transferRate = reader.totalBytes * 1000 / elapsed; - qDebug() << "ThreadedDataReader::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; - } -}; - -class DataGenerator: public QIODevice -{ - Q_OBJECT - enum { Idle, Started, Stopped } state; -public: - DataGenerator() : state(Idle) - { open(ReadOnly); } - - virtual bool isSequential() const { return true; } - virtual qint64 bytesAvailable() const { return state == Started ? 1024*1024 : 0; } - -public slots: - void start() { state = Started; emit readyRead(); } - void stop() { state = Stopped; emit readyRead(); } - -protected: - virtual qint64 readData(char *data, qint64 maxlen) - { - if (state == Stopped) - return -1; // EOF - - // return as many bytes as are wanted - memset(data, '@', maxlen); - return maxlen; - } - virtual qint64 writeData(const char *, qint64) - { return -1; } -}; - -class ThreadedDataReaderHttpServer: public QThread -{ - Q_OBJECT - // used to make the constructor only return after the tcp server started listening - QSemaphore ready; - QTcpSocket *client; - int timeout; - int port; -public: - qint64 transferRate; - ThreadedDataReaderHttpServer() - : port(-1), transferRate(-1) - { - start(); - ready.acquire(); - } - - inline int serverPort() const { return port; } - -protected: - void run() - { - QTcpServer server; - server.listen(); - port = server.serverPort(); - ready.release(); - - QVERIFY(server.waitForNewConnection(10*1000)); - client = server.nextPendingConnection(); - - // read lines until we read the empty line seperating HTTP request from HTTP request body - do { - if (client->canReadLine()) { - QString line = client->readLine(); - if (line == "\n" || line == "\r\n") - break; // empty line - } - if (!client->waitForReadyRead(10*1000)) { - client->close(); - return; - } - } while (client->state() == QAbstractSocket::ConnectedState); - - client->write("HTTP/1.0 200 OK\r\n"); - client->write("Content-length: 0\r\n"); - client->write("\r\n"); - client->flush(); - - QCoreApplication::processEvents(); - - QEventLoop eventLoop; - DataReader reader(client, false); - QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); - - QTime timer; - timer.start(); - eventLoop.exec(); - qint64 elapsed = timer.elapsed(); - - transferRate = reader.totalBytes * 1000 / elapsed; - qDebug() << "ThreadedDataReaderHttpServer::run" << "send rate:" << (transferRate / 1024) << "kB/s in" << elapsed << "msec"; - } -}; - - -class FixedSizeDataGenerator : public QIODevice -{ - Q_OBJECT - enum { Idle, Started, Stopped } state; -public: - FixedSizeDataGenerator(qint64 size) : state(Idle) - { open(ReadOnly | Unbuffered); - toBeGeneratedTotalCount = toBeGeneratedCount = size; - } - - virtual qint64 bytesAvailable() const - { - return state == Started ? toBeGeneratedCount + QIODevice::bytesAvailable() : 0; - } - - virtual bool isSequential() const{ - return false; - } - - virtual bool reset() const{ - return false; - } - - qint64 size() const { - return toBeGeneratedTotalCount; - } - -public slots: - void start() { state = Started; emit readyRead(); } - -protected: - virtual qint64 readData(char *data, qint64 maxlen) - { - memset(data, '@', maxlen); - - if (toBeGeneratedCount <= 0) { - return -1; - } - - qint64 n = qMin(maxlen, toBeGeneratedCount); - toBeGeneratedCount -= n; - - if (toBeGeneratedCount <= 0) { - // make sure this is a queued connection! - emit readChannelFinished(); - } - - return n; - } - virtual qint64 writeData(const char *, qint64) - { return -1; } - - qint64 toBeGeneratedCount; - qint64 toBeGeneratedTotalCount; -}; - -class HttpDownloadPerformanceServer : QObject { - Q_OBJECT; - qint64 dataSize; - qint64 dataSent; - QTcpServer server; - QTcpSocket *client; - bool serverSendsContentLength; - bool chunkedEncoding; - -public: - HttpDownloadPerformanceServer (qint64 ds, bool sscl, bool ce) : dataSize(ds), dataSent(0), - client(0), serverSendsContentLength(sscl), chunkedEncoding(ce) { - server.listen(); - connect(&server, SIGNAL(newConnection()), this, SLOT(newConnectionSlot())); - } - - int serverPort() { - return server.serverPort(); - } - -public slots: - - void newConnectionSlot() { - client = server.nextPendingConnection(); - client->setParent(this); - connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); - connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot(qint64))); - } - - void readyReadSlot() { - client->readAll(); - client->write("HTTP/1.0 200 OK\n"); - if (serverSendsContentLength) - client->write(QString("Content-Length: " + QString::number(dataSize) + "\n").toAscii()); - if (chunkedEncoding) - client->write(QString("Transfer-Encoding: chunked\n").toAscii()); - client->write("Connection: close\n\n"); - } - - void bytesWrittenSlot(qint64 amount) { - Q_UNUSED(amount); - if (dataSent == dataSize && client) { - // close eventually - - // chunked encoding: we have to send a last "empty" chunk - if (chunkedEncoding) - client->write(QString("0\r\n\r\n").toAscii()); - - client->disconnectFromHost(); - server.close(); - client = 0; - return; - } - - // send data - if (client && client->bytesToWrite() < 100*1024 && dataSent < dataSize) { - qint64 amount = qMin(qint64(16*1024), dataSize - dataSent); - QByteArray data(amount, '@'); - - if (chunkedEncoding) { - client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toAscii()); - client->write(data.constData(), amount); - client->write(QString("\r\n").toAscii()); - } else { - client->write(data.constData(), amount); - } - - dataSent += amount; - } - } -}; - -class HttpDownloadPerformanceClient : QObject { - Q_OBJECT; - QIODevice *device; - public: - HttpDownloadPerformanceClient (QIODevice *dev) : device(dev){ - connect(dev, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); - } - - public slots: - void readyReadSlot() { - device->readAll(); - } - -}; - - - - -class tst_qnetworkreply : public QObject -{ - Q_OBJECT - - QNetworkAccessManager manager; -private slots: - void httpLatency(); - -#ifndef QT_NO_OPENSSL - void echoPerformance_data(); - void echoPerformance(); -#endif - - void downloadPerformance(); - void uploadPerformance(); - void performanceControlRate(); - void httpUploadPerformance(); - void httpDownloadPerformance_data(); - void httpDownloadPerformance(); - -}; - -void tst_qnetworkreply::httpLatency() -{ - QNetworkAccessManager manager; - QBENCHMARK{ - QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/")); - QNetworkReply* reply = manager.get(request); - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - QTestEventLoop::instance().enterLoop(5); - QVERIFY(!QTestEventLoop::instance().timeout()); - delete reply; - } -} - -#ifndef QT_NO_OPENSSL -void tst_qnetworkreply::echoPerformance_data() -{ - QTest::addColumn("ssl"); - QTest::newRow("no_ssl") << false; - QTest::newRow("ssl") << true; -} - -void tst_qnetworkreply::echoPerformance() -{ - QFETCH(bool, ssl); - QNetworkAccessManager manager; - QNetworkRequest request(QUrl((ssl ? "https://" : "http://") + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi")); - - QByteArray data; - data.resize(1024*1024*10); // 10 MB - // init with garbage. needed so ssl cannot compress it in an efficient way. - for (int i = 0; i < data.size() / sizeof(int); i++) { - int r = qrand(); - data.data()[i*sizeof(int)] = r; - } - - QBENCHMARK{ - QNetworkReply* reply = manager.post(request, data); - connect(reply, SIGNAL(sslErrors( const QList &)), reply, SLOT(ignoreSslErrors())); - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - QTestEventLoop::instance().enterLoop(5); - QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(reply->error() == QNetworkReply::NoError); - delete reply; - } -} -#endif - -void tst_qnetworkreply::downloadPerformance() -{ - // unlike the above function, this one tries to send as fast as possible - // and measures how fast it was. - TimedSender sender(5000); - QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(sender.serverPort()) + "/?bare=1"); - QNetworkReplyPtr reply = manager.get(request); - DataReader reader(reply, false); - - QTime loopTime; - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - loopTime.start(); - QTestEventLoop::instance().enterLoop(40); - int elapsedTime = loopTime.elapsed(); - sender.wait(); - - qint64 receivedBytes = reader.totalBytes; - qDebug() << "tst_QNetworkReply::downloadPerformance" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" - << elapsedTime << "ms"; -} - -void tst_qnetworkreply::uploadPerformance() -{ - ThreadedDataReader reader; - DataGenerator generator; - - - QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1"); - QNetworkReplyPtr reply = manager.put(request, &generator); - generator.start(); - connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTimer::singleShot(5000, &generator, SLOT(stop())); - - QTestEventLoop::instance().enterLoop(30); - QCOMPARE(reply->error(), QNetworkReply::NoError); - QVERIFY(!QTestEventLoop::instance().timeout()); -} - -void tst_qnetworkreply::httpUploadPerformance() -{ -#ifdef Q_OS_SYMBIAN - // SHow some mercy for non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else - enum {UploadSize = 128*1024*1024}; // 128 MB -#endif - ThreadedDataReaderHttpServer reader; - FixedSizeDataGenerator generator(UploadSize); - - QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1")); - request.setHeader(QNetworkRequest::ContentLengthHeader,UploadSize); - - QNetworkReplyPtr reply = manager.put(request, &generator); - - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - - QTime time; - generator.start(); - time.start(); - QTestEventLoop::instance().enterLoop(40); - qint64 elapsed = time.elapsed(); - reader.exit(); - reader.wait(); - QVERIFY(reply->isFinished()); - QCOMPARE(reply->error(), QNetworkReply::NoError); - QVERIFY(!QTestEventLoop::instance().timeout()); - - qDebug() << "tst_QNetworkReply::httpUploadPerformance" << elapsed << "msec, " - << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; -} - - -void tst_qnetworkreply::performanceControlRate() -{ - // this is a control comparison for the other two above - // it does the same thing, but instead bypasses the QNetworkAccess system - qDebug() << "The following are the maximum transfer rates that we can get in this system" - " (bypassing QNetworkAccess)"; - - TimedSender sender(5000); - QTcpSocket sink; - sink.connectToHost("127.0.0.1", sender.serverPort()); - DataReader reader(&sink, false); - - QTime loopTime; - connect(&sink, SIGNAL(disconnected()), &QTestEventLoop::instance(), SLOT(exitLoop())); - loopTime.start(); - QTestEventLoop::instance().enterLoop(40); - int elapsedTime = loopTime.elapsed(); - sender.wait(); - - qint64 receivedBytes = reader.totalBytes; - qDebug() << "tst_QNetworkReply::performanceControlRate" << "receive rate:" << (receivedBytes * 1000 / elapsedTime / 1024) << "kB/s and" - << elapsedTime << "ms"; -} - -void tst_qnetworkreply::httpDownloadPerformance_data() -{ - QTest::addColumn("serverSendsContentLength"); - QTest::addColumn("chunkedEncoding"); - - QTest::newRow("Server sends no Content-Length") << false << false; - QTest::newRow("Server sends Content-Length") << true << false; - QTest::newRow("Server uses chunked encoding") << false << true; - -} - -void tst_qnetworkreply::httpDownloadPerformance() -{ - QFETCH(bool, serverSendsContentLength); - QFETCH(bool, chunkedEncoding); -#ifdef Q_OS_SYMBIAN - // Show some mercy to non-desktop platform/s - enum {UploadSize = 4*1024*1024}; // 4 MB -#else - enum {UploadSize = 128*1024*1024}; // 128 MB -#endif - HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding); - - QNetworkRequest request(QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/?bare=1")); - QNetworkReplyPtr reply = manager.get(request); - - connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); - HttpDownloadPerformanceClient client(reply); - - QTime time; - time.start(); - QTestEventLoop::instance().enterLoop(40); - QCOMPARE(reply->error(), QNetworkReply::NoError); - QVERIFY(!QTestEventLoop::instance().timeout()); - - qint64 elapsed = time.elapsed(); - qDebug() << "tst_QNetworkReply::httpDownloadPerformance" << elapsed << "msec, " - << ((UploadSize/1024.0)/(elapsed/1000.0)) << " kB/sec"; -} - -QTEST_MAIN(tst_qnetworkreply) - -#include "tst_qnetworkreply.moc" diff --git a/tests/benchmarks/qobject/main.cpp b/tests/benchmarks/qobject/main.cpp deleted file mode 100644 index 7f24ebd..0000000 --- a/tests/benchmarks/qobject/main.cpp +++ /dev/null @@ -1,180 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include "object.h" -#include -#include - -enum { - CreationDeletionBenckmarkConstant = 34567, - SignalsAndSlotsBenchmarkConstant = 456789 -}; - -class QObjectBenchmark : public QObject -{ -Q_OBJECT -private slots: - void signal_slot_benchmark(); - void signal_slot_benchmark_data(); - void qproperty_benchmark_data(); - void qproperty_benchmark(); - void dynamic_property_benchmark(); - void connect_disconnect_benchmark_data(); - void connect_disconnect_benchmark(); -}; - -void QObjectBenchmark::signal_slot_benchmark_data() -{ - QTest::addColumn("type"); - QTest::newRow("simple function") << 0; - QTest::newRow("single signal/slot") << 1; - QTest::newRow("multi signal/slot") << 2; -} - -void QObjectBenchmark::signal_slot_benchmark() -{ - QFETCH(int, type); - - Object singleObject; - Object multiObject; - singleObject.setObjectName("single"); - multiObject.setObjectName("multi"); - - singleObject.connect(&singleObject, SIGNAL(signal0()), SLOT(slot0())); - - multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(slot0())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal1())); - multiObject.connect(&multiObject, SIGNAL(signal1()), SLOT(slot1())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal2())); - multiObject.connect(&multiObject, SIGNAL(signal2()), SLOT(slot2())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal3())); - multiObject.connect(&multiObject, SIGNAL(signal3()), SLOT(slot3())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal4())); - multiObject.connect(&multiObject, SIGNAL(signal4()), SLOT(slot4())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal5())); - multiObject.connect(&multiObject, SIGNAL(signal5()), SLOT(slot5())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal6())); - multiObject.connect(&multiObject, SIGNAL(signal6()), SLOT(slot6())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal7())); - multiObject.connect(&multiObject, SIGNAL(signal7()), SLOT(slot7())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal8())); - multiObject.connect(&multiObject, SIGNAL(signal8()), SLOT(slot8())); - // multiObject.connect(&multiObject, SIGNAL(signal0()), SLOT(signal9())); - multiObject.connect(&multiObject, SIGNAL(signal9()), SLOT(slot9())); - - if (type == 0) { - QBENCHMARK { - singleObject.slot0(); - } - } else if (type == 1) { - QBENCHMARK { - singleObject.emitSignal0(); - } - } else { - QBENCHMARK { - multiObject.emitSignal0(); - } - } -} - -void QObjectBenchmark::qproperty_benchmark_data() -{ - QTest::addColumn("name"); - const QMetaObject *mo = &QTreeView::staticMetaObject; - for (int i = 0; i < mo->propertyCount(); ++i) { - QMetaProperty prop = mo->property(i); - QTest::newRow(prop.name()) << QByteArray(prop.name()); - } -} - -void QObjectBenchmark::qproperty_benchmark() -{ - QFETCH(QByteArray, name); - const char *p = name.constData(); - QTreeView obj; - QVariant v = obj.property(p); - QBENCHMARK { - obj.setProperty(p, v); - (void)obj.property(p); - } -} - -void QObjectBenchmark::dynamic_property_benchmark() -{ - QTreeView obj; - QBENCHMARK { - obj.setProperty("myProperty", 123); - (void)obj.property("myProperty"); - obj.setProperty("myOtherProperty", 123); - (void)obj.property("myOtherProperty"); - } -} - -void QObjectBenchmark::connect_disconnect_benchmark_data() -{ - QTest::addColumn("signal"); - const QMetaObject *mo = &QTreeView::staticMetaObject; - for (int i = 0; i < mo->methodCount(); ++i) { - QMetaMethod method = mo->method(i); - if (method.methodType() != QMetaMethod::Signal) - continue; - QByteArray sig = method.signature(); - QTest::newRow(sig) << sig; - } -} - -void QObjectBenchmark::connect_disconnect_benchmark() -{ - QFETCH(QByteArray, signal); - signal.prepend('2'); - const char *p = signal.constData(); - QTreeView obj; - QBENCHMARK { - QObject::connect(&obj, p, &obj, p); - QObject::disconnect(&obj, p, &obj, p); - } -} - -QTEST_MAIN(QObjectBenchmark) - -#include "main.moc" diff --git a/tests/benchmarks/qobject/object.cpp b/tests/benchmarks/qobject/object.cpp deleted file mode 100644 index d775a32..0000000 --- a/tests/benchmarks/qobject/object.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "object.h" - -void Object::emitSignal0() -{ emit signal0(); } - -void Object::slot0() -{ } -void Object::slot1() -{ } -void Object::slot2() -{ } -void Object::slot3() -{ } -void Object::slot4() -{ } -void Object::slot5() -{ } -void Object::slot6() -{ } -void Object::slot7() -{ } -void Object::slot8() -{ } -void Object::slot9() -{ } diff --git a/tests/benchmarks/qobject/object.h b/tests/benchmarks/qobject/object.h deleted file mode 100644 index 7e4933f..0000000 --- a/tests/benchmarks/qobject/object.h +++ /dev/null @@ -1,75 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef OBJECT_H -#define OBJECT_H - -#include - -class Object : public QObject -{ - Q_OBJECT -public: - void emitSignal0(); -signals: - void signal0(); - void signal1(); - void signal2(); - void signal3(); - void signal4(); - void signal5(); - void signal6(); - void signal7(); - void signal8(); - void signal9(); -public slots: - void slot0(); - void slot1(); - void slot2(); - void slot3(); - void slot4(); - void slot5(); - void slot6(); - void slot7(); - void slot8(); - void slot9(); -}; - -#endif // OBJECT_H diff --git a/tests/benchmarks/qobject/qobject.pro b/tests/benchmarks/qobject/qobject.pro deleted file mode 100644 index 2855de4..0000000 --- a/tests/benchmarks/qobject/qobject.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qobject -DEPENDPATH += . -INCLUDEPATH += . - -# Input -HEADERS += object.h -SOURCES += main.cpp object.cpp diff --git a/tests/benchmarks/qpainter/qpainter.pro b/tests/benchmarks/qpainter/qpainter.pro deleted file mode 100644 index 5ac8c64..0000000 --- a/tests/benchmarks/qpainter/qpainter.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qpainter - -SOURCES += tst_qpainter.cpp diff --git a/tests/benchmarks/qpainter/tst_qpainter.cpp b/tests/benchmarks/qpainter/tst_qpainter.cpp deleted file mode 100644 index 39b2244..0000000 --- a/tests/benchmarks/qpainter/tst_qpainter.cpp +++ /dev/null @@ -1,1633 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -Q_DECLARE_METATYPE(QLine) -Q_DECLARE_METATYPE(QRect) -Q_DECLARE_METATYPE(QSize) -Q_DECLARE_METATYPE(QPoint) -Q_DECLARE_METATYPE(QPainterPath) -Q_DECLARE_METATYPE(QPainter::RenderHint) -Q_DECLARE_METATYPE(QPainter::CompositionMode) -Q_DECLARE_METATYPE(QImage::Format) - -enum PrimitiveType { - Primitive_Int_DiagLine, - Primitive_Int_VerLine, - Primitive_Int_HorLine, - Primitive_Int_Rect, - Primitive_Int_Ellipse, - Primitive_Int_Pie, - Primitive_Int_Arc, - Primitive_Int_Chord, - Primitive_Int_TriPoly, - Primitive_Int_RectPoly, - Primitive_Int_2RectPoly, - - Primitive_Float_DiagLine, - Primitive_Float_VerLine, - Primitive_Float_HorLine, - Primitive_Float_Rect, - Primitive_Float_Ellipse, - Primitive_Float_Pie, - Primitive_Float_Arc, - Primitive_Float_Chord, - Primitive_Float_TriPoly, - Primitive_Float_RectPoly, - Primitive_Float_2RectPoly, - - Primitive_Float_TriPath, - Primitive_Float_RectPath, - Primitive_Float_2RectPath, - Primitive_Float_EllipsePath, - Primitive_Last_Primitive - -}; - - -enum StateChanges { - ChangePen = 0x0001, - ChangeBrush = 0x0002, - ChangeClip = 0x0004, - ChangeTransform = 0x0008 -}; - - -struct PrimitiveSet { - QRect i_rect; - QLine i_line_diag; - QLine i_line_ver; - QLine i_line_hor; - QPolygon i_poly_tri; - QPolygon i_poly_2rects; - QPolygon i_poly_rect; - - QRectF f_rect; - QLineF f_line_diag; - QLineF f_line_ver; - QLineF f_line_hor; - QPolygonF f_poly_tri; - QPolygonF f_poly_2rects; - QPolygonF f_poly_rect; - - QPainterPath f_path_tri; - QPainterPath f_path_2rects; - QPainterPath f_path_rect; - QPainterPath f_path_ellipse; -}; - - -class tst_QPainter : public QObject -{ - Q_OBJECT - - public: - tst_QPainter() - { - setupBrushes(); - createPrimitives(); - m_surface = surface(); - } - -private slots: - void beginAndEnd(); - - void saveRestore_data(); - void saveRestore(); - - void drawLine_data(); - void drawLine(); - void drawLine_clipped_data(); - void drawLine_clipped(); - void drawLine_antialiased_clipped_data(); - void drawLine_antialiased_clipped(); - - void drawPixmap_data(); - void drawPixmap(); - - void drawImage_data(); - void drawImage(); - - void drawTiledPixmap_data(); - void drawTiledPixmap(); - - void compositionModes_data(); - void compositionModes(); - - void fillPrimitives_10_data() { drawPrimitives_data_helper(false); } - void fillPrimitives_100_data() { drawPrimitives_data_helper(false); } - void fillPrimitives_1000_data() { drawPrimitives_data_helper(false); } - void fillPrimitives_10(); - void fillPrimitives_100(); - void fillPrimitives_1000(); - - void strokePrimitives_10_data() { drawPrimitives_data_helper(true); } - void strokePrimitives_100_data() { drawPrimitives_data_helper(true); } - void strokePrimitives_1000_data() { drawPrimitives_data_helper(true); } - void strokePrimitives_10(); - void strokePrimitives_100(); - void strokePrimitives_1000(); - - void drawText_data(); - void drawText(); - - void clipAndFill_data(); - void clipAndFill(); - - void drawRoundedRect(); - void drawScaledRoundedRect(); - void drawTransformedRoundedRect(); - - void drawScaledAntialiasedRoundedRect_data(); - void drawTransformedAntialiasedRoundedRect_data(); - void drawAntialiasedRoundedRect(); - void drawScaledAntialiasedRoundedRect(); - void drawTransformedAntialiasedRoundedRect(); - - void drawScaledImageRoundedRect_data(); - void drawTransformedImageRoundedRect_data(); - void drawImageRoundedRect(); - void drawScaledImageRoundedRect(); - void drawTransformedImageRoundedRect(); - - void drawScaledBorderPixmapRoundedRect_data(); - void drawTransformedBorderPixmapRoundedRect_data(); - void drawBorderPixmapRoundedRect(); - void drawScaledBorderPixmapRoundedRect(); - void drawTransformedBorderPixmapRoundedRect(); - - void drawTransformedTransparentImage_data(); - void drawTransformedSemiTransparentImage_data(); - void drawTransformedFilledImage_data(); - void drawTransformedTransparentImage(); - void drawTransformedSemiTransparentImage(); - void drawTransformedFilledImage(); - -private: - void setupBrushes(); - void createPrimitives(); - - void drawPrimitives_data_helper(bool fancypens); - void fillPrimitives_helper(QPainter *painter, PrimitiveType type, PrimitiveSet *s); - - QTransform transformForAngle(qreal angle); - - QPaintDevice *surface() - { - return new QPixmap(1024, 1024); - } - - - QMap m_pens; - QMap m_brushes; - - PrimitiveSet m_primitives_10; - PrimitiveSet m_primitives_100; - PrimitiveSet m_primitives_1000; - - QPaintDevice *m_surface; - QPainter m_painter; - -}; - -void tst_QPainter::createPrimitives() -{ - for (int i=0; i<3; ++i) { - PrimitiveSet *ps; - int size; - switch (i) { - case 0: - ps = &m_primitives_10; - size = 10; - break; - case 1: - ps = &m_primitives_100; - size = 100; - break; - case 2: - ps = &m_primitives_1000; - size = 1000; - break; - } - - ps->f_rect = QRectF(0, 0, size, size); - ps->f_line_diag = QLineF(0, 0, size, size); - ps->f_line_ver = QLineF(10, 0, 10, size); - ps->f_line_hor = QLineF(0, 10, size, 10); - ps->f_poly_rect = QPolygonF() << QPointF(0, 0) - << QPointF(size, 0) - << QPointF(size, size) - << QPointF(0, size); - ps->f_poly_2rects = QPolygonF() << QPointF(0, 0) - << QPointF(size * 0.75, 0) - << QPointF(size * 0.75, size * 0.75) - << QPointF(size * 0.25, size * 0.75) - << QPointF(size * 0.25, size * 0.25) - << QPointF(size, size * 0.25) - << QPointF(size, size) - << QPointF(0, size); - ps->f_poly_tri = QPolygonF() << QPointF(size / 2.0, 0) - << QPointF(0, size) - << QPointF(size, size); - - ps->f_path_tri.addPolygon(ps->f_poly_tri); - ps->f_path_rect.addRect(ps->f_rect); - ps->f_path_2rects.addPolygon(ps->f_poly_2rects); - ps->f_path_ellipse.addEllipse(ps->f_rect); - - ps->i_rect = ps->f_rect.toRect(); - ps->i_line_diag = ps->f_line_diag.toLine(); - ps->i_line_hor = ps->f_line_hor.toLine(); - ps->i_line_ver = ps->f_line_ver.toLine(); - ps->i_poly_tri = ps->f_poly_tri.toPolygon(); - ps->i_poly_rect = ps->f_poly_rect.toPolygon(); - ps->i_poly_2rects = ps->f_poly_2rects.toPolygon(); - } -} - -void tst_QPainter::drawLine_data() -{ - QTest::addColumn("line"); - QTest::addColumn("pen"); - - QVector pens; - pens << QPen(Qt::black) - << QPen(Qt::black, 0, Qt::DashDotLine) - << QPen(Qt::black, 4) - << QPen(Qt::black, 4, Qt::DashDotLine) - << QPen(QColor(255, 0, 0, 200)) - << QPen(QColor(255, 0, 0, 200), 0, Qt::DashDotLine) - << QPen(QColor(255, 0, 0, 200), 4) - << QPen(QColor(255, 0, 0, 200), 4, Qt::DashDotLine); - - QStringList penNames; - penNames << "black-0" - << "black-0-dashdot" - << "black-4" - << "black-4-dashdot" - << "alpha-0" - << "alpha-0-dashdot" - << "alpha-4" - << "alpha-4-dashdot"; - - int i = 0; - foreach (QPen pen, pens) { - const QString s = QString(QLatin1String("%1:%2")).arg(penNames[i]); - QTest::newRow(qPrintable(s.arg("horizontal"))) - << QLine(0, 20, 100, 20) << pen; - QTest::newRow(qPrintable(s.arg("vertical:"))) - << QLine(20, 0, 20, 100) << pen; - QTest::newRow(qPrintable(s.arg("0-45:"))) - << QLine(0, 20, 100, 0) << pen; - QTest::newRow(qPrintable(s.arg("45-90:"))) - << QLine(0, 100, 20, 0) << pen; - QTest::newRow(qPrintable(s.arg("90-135:"))) - << QLine(20, 100, 0, 0) << pen; - QTest::newRow(qPrintable(s.arg("135-180:"))) - << QLine(100, 20, 0, 0) << pen; - QTest::newRow(qPrintable(s.arg("180-225:"))) - << QLine(100, 0, 0, 20) << pen; - QTest::newRow(qPrintable(s.arg("225-270:"))) - << QLine(20, 0, 0, 100) << pen; - QTest::newRow(qPrintable(s.arg("270-315:"))) - << QLine(0, 0, 20, 100) << pen; - QTest::newRow(qPrintable(s.arg("315-360:"))) - << QLine(0, 0, 100, 20) << pen; - ++i; - } -} - -void tst_QPainter::setupBrushes() -{ - // Solid brushes... - m_brushes["black-brush"] = QBrush(Qt::black); - m_brushes["white-brush"] = QBrush(Qt::white); - m_brushes["transparent-brush"] = QBrush(QColor(255, 255, 255, 0)); - m_brushes["alpha1-brush"] = QBrush(QColor(255, 255, 255, 100)); - m_brushes["alpha2-brush"] = QBrush(QColor(255, 255, 255, 200)); - - - // Patterns - m_brushes["dense1-brush"] = QBrush(Qt::Dense1Pattern); - m_brushes["dense2-brush"] = QBrush(Qt::Dense2Pattern); - m_brushes["dense3-brush"] = QBrush(Qt::Dense3Pattern); - m_brushes["dense4-brush"] = QBrush(Qt::Dense4Pattern); - m_brushes["dense5-brush"] = QBrush(Qt::Dense5Pattern); - m_brushes["dense6-brush"] = QBrush(Qt::Dense6Pattern); - m_brushes["dense7-brush"] = QBrush(Qt::Dense7Pattern); - m_brushes["hor-brush"] = QBrush(Qt::HorPattern); - m_brushes["ver-brush"] = QBrush(Qt::VerPattern); - m_brushes["cross-brush"] = QBrush(Qt::CrossPattern); - m_brushes["bdiag-brush"] = QBrush(Qt::BDiagPattern); - m_brushes["fdiag-brush"] = QBrush(Qt::FDiagPattern); - m_brushes["diagcross-brush"] = QBrush(Qt::DiagCrossPattern); - - // Gradients - QGradientStops gradient_white_black; - gradient_white_black << QPair(0, QColor(Qt::white)); - gradient_white_black << QPair(1, QColor(Qt::black)); - - QGradientStops gradient_white_black10; - for (int i=0; i<10; ++i) { - gradient_white_black10 << QPair(i/10.0, QColor(Qt::white)); - gradient_white_black10 << QPair(i/10.0+0.05, QColor(Qt::black)); - } - - QGradientStops gradient_white_alpha; - gradient_white_alpha << QPair(0, QColor(Qt::white)); - gradient_white_alpha << QPair(0, QColor(Qt::transparent)); - - QGradientStops gradient_white_alpha10; - for (int i=0; i<10; ++i) { - gradient_white_alpha10 << QPair(i/10.0, QColor(Qt::white)); - gradient_white_alpha10 << QPair(i/10.0+0.05, QColor(Qt::black)); - } - - - for (int j=0; j<4; ++j) { - QLinearGradient lg; - lg.setStart(0, 0); - - QRadialGradient rg; - QConicalGradient cg; - - QGradientStops stops; - if (j == 0) stops = gradient_white_black; - else if (j == 1) stops = gradient_white_black10; - else if (j == 2) stops = gradient_white_alpha; - else if (j == 3) stops = gradient_white_alpha10; - lg.setStops(stops); - rg.setStops(stops); - cg.setStops(stops); - - for (int i=0; i<6; ++i) { - lg.setSpread((QGradient::Spread) (i % 3)); - lg.setCoordinateMode((QGradient::CoordinateMode) (j / 3)); - - QString name = QString::fromLatin1("-%1%2") - .arg(lg.spread()) - .arg(lg.coordinateMode()); - - lg.setFinalStop(100, 0); - m_brushes["hor-lingrad-w/b-brush" + name] = QBrush(lg); - - lg.setFinalStop(0, 100); - m_brushes["ver-lingrad-w/b-brush" + name] = QBrush(lg); - - lg.setFinalStop(100, 100); - m_brushes["diag-lingrad-w/b-brush" + name] = QBrush(lg); - - rg.setRadius(100); - rg.setCenter(0, 0); - rg.setFocalPoint(50, 50); - m_brushes["radgrad-brush" + name] = QBrush(rg); - - cg.setCenter(0, 0); - cg.setAngle(40); - m_brushes["congrad-brush" + name] = QBrush(cg); - } - } - - // Set up pens... - - -// m_pens["black-pen"] = QPen(Qt::black); -// m_pens["white-pen"] = QPen(Qt::white); -// m_pens["transparent-pen"] = QPen(QColor(255, 255, 255, 0)); -// m_pens["translucent1-pen"] = QPen(QColor(255, 255, 255, 100)); -// m_pens["translucent2-pen"] = QPen(QColor(255, 255, 255, 200)); - - - -} - - -// void QPainter_Primitives::fillRect_data() { - -// QTest::addColumn("brush"); -// QTest::addColumn("size"); - -// for (QMap::const_iterator it = m_brushes.constBegin(); -// it != m_brushes.constEnd(); ++it) { -// for (int w=2; w<1025; w*=2) { -// for (int h=2; h<1025; h*=2) { -// QTest::newRow(QString("brush=%1; size=[%2,%3]").arg(it.key()).arg(w).arg(h).toAscii().data()) -// << *it << QSize(w, h); -// } -// } -// } -// } - - - - - -// void QPainter_Primitives::fillRect() -// { -// QFETCH(QBrush, brush); -// QFETCH(QSize, size); - -// QImage img(1024, 1024, QImage::Format_ARGB32_Premultiplied); -// QPainter p(&img); -// p.setPen(Qt::NoPen); -// p.setBrush(brush); -// QRect rect(QPoint(0, 0), size); -// QBENCHMARK { -// p.drawRect(rect); -// } -// } - - - - -void tst_QPainter::beginAndEnd() -{ - QPixmap pixmap(100, 100); - - QBENCHMARK { - QPainter p; - p.begin(&pixmap); - p.end(); - } -} - -void tst_QPainter::drawLine() -{ - QFETCH(QLine, line); - QFETCH(QPen, pen); - - const int offset = 5; - QPixmap pixmapUnclipped(qMin(line.x1(), line.x2()) - + 2*offset + qAbs(line.dx()), - qMin(line.y1(), line.y2()) - + 2*offset + qAbs(line.dy())); - pixmapUnclipped.fill(Qt::white); - - QPainter p(&pixmapUnclipped); - p.translate(offset, offset); - p.setPen(pen); - p.paintEngine()->syncState(); - - QBENCHMARK { - p.drawLine(line); - } - - p.end(); - -} - -void tst_QPainter::drawLine_clipped_data() -{ - drawLine_data(); -} - -void tst_QPainter::drawLine_clipped() -{ - QFETCH(QLine, line); - QFETCH(QPen, pen); - - const int offset = 5; - QPixmap pixmapClipped(qMin(line.x1(), line.x2()) - + 2*offset + qAbs(line.dx()), - qMin(line.y1(), line.y2()) - + 2*offset + qAbs(line.dy())); - - const QRect clip = QRect(line.p1(), line.p2()).normalized(); - - pixmapClipped.fill(Qt::white); - QPainter p(&pixmapClipped); - p.translate(offset, offset); - p.setClipRect(clip); - p.setPen(pen); - p.paintEngine()->syncState(); - - QBENCHMARK { - p.drawLine(line); - } - - p.end(); -} - - -void tst_QPainter::drawLine_antialiased_clipped_data() -{ - drawLine_data(); -} - - -void tst_QPainter::drawLine_antialiased_clipped() -{ - QFETCH(QLine, line); - QFETCH(QPen, pen); - - const int offset = 5; - QPixmap pixmapClipped(qMin(line.x1(), line.x2()) - + 2*offset + qAbs(line.dx()), - qMin(line.y1(), line.y2()) - + 2*offset + qAbs(line.dy())); - - const QRect clip = QRect(line.p1(), line.p2()).normalized(); - - pixmapClipped.fill(Qt::white); - QPainter p(&pixmapClipped); - p.setRenderHint(QPainter::Antialiasing); - p.translate(offset, offset); - p.setClipRect(clip); - p.setPen(pen); - p.paintEngine()->syncState(); - - QBENCHMARK { - p.drawLine(line); - } - - p.end(); -} - -void tst_QPainter::drawPixmap_data() -{ - QTest::addColumn("sourceFormat"); - QTest::addColumn("targetFormat"); - QTest::addColumn("size"); - QTest::addColumn("type"); // 0 = circle, 1 = diag line, 2 = solid rect, 3 = alpharect - - QList sizes; - sizes << QSize(1, 1) - << QSize(10, 10) - << QSize(100, 100) - << QSize(1000, 1000); - - const char *typeNames[] = { - "circle", - "line", - "solidrect", - "alpharect" - }; - - const char *formatNames[] = { - "Invalid", - "Mono", - "MonoLSB", - "Indexed8", - "RGB32", - "ARGB32", - "ARGB32_pm", - "RGB16", - "ARGB8565_pm", - "RGB666", - "ARGB6666_pm", - "RGB555", - "ARGB8555_pm", - "RGB888", - "RGB444", - "ARGB4444_pm" - }; - - for (int tar=4; tar("mode"); - QTest::addColumn("size"); - QTest::addColumn("color"); - - const int n = QPainter::RasterOp_SourceAndNotDestination; - for (int i = 0; i <= n; ++i) { - QString title("%1:%2"); - QTest::newRow(qPrintable(title.arg(i).arg("10x10:opaque"))) - << (QPainter::CompositionMode)(i) - << QSize(10, 10) << QColor(255, 0, 0); - QTest::newRow(qPrintable(title.arg(i).arg("10x10:!opaque"))) - << (QPainter::CompositionMode)(i) - << QSize(10, 10) << QColor(127, 127, 127, 127); - QTest::newRow(qPrintable(title.arg(i).arg("300x300:opaque"))) - << (QPainter::CompositionMode)(i) - << QSize(300, 300) << QColor(255, 0, 0); - QTest::newRow(qPrintable(title.arg(i).arg("300x300:!opaque"))) - << (QPainter::CompositionMode)(i) - << QSize(300, 300) << QColor(127, 127, 127, 127); - } -} - -void tst_QPainter::compositionModes() -{ - QFETCH(QPainter::CompositionMode, mode); - QFETCH(QSize, size); - QFETCH(QColor, color); - - QPixmap src(size); - src.fill(color); - - QPixmap dest(size); - if (mode < QPainter::RasterOp_SourceOrDestination) - color.setAlpha(127); // porter-duff needs an alpha channel - dest.fill(color); - - QPainter p(&dest); - p.setCompositionMode(mode); - - QBENCHMARK { - p.drawPixmap(0, 0, src); - } -} - -void tst_QPainter::drawTiledPixmap_data() -{ - QTest::addColumn("srcSize"); - QTest::addColumn("dstSize"); - QTest::addColumn("transform"); - QTest::addColumn("color"); - QTest::addColumn("renderHint"); - - QTest::newRow("10x10=>20x20") - << QSize(10, 10) << QSize(20, 20) << (QTransform()) - << QColor(Qt::black) << QPainter::RenderHint(0); - QTest::newRow("10x10=>20x20, smooth") - << QSize(10, 10) << QSize(20, 20) << (QTransform()) - << QColor(Qt::black) << QPainter::SmoothPixmapTransform; - QTest::newRow("10x10=>20x20, !opaque") - << QSize(10, 10) << QSize(20, 20) << (QTransform()) - << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); - QTest::newRow("10x10=>20x20, !opaque, smooth") - << QSize(10, 10) << QSize(20, 20) << (QTransform()) - << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; - - QTest::newRow("10x10=>20x20, rotate(30)") - << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) - << QColor(Qt::black) << QPainter::RenderHint(0); - QTest::newRow("10x10=>20x20, rotate(30), smooth") - << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) - << QColor(Qt::black) << QPainter::SmoothPixmapTransform; - QTest::newRow("10x10=>20x20, rotate(30), !opaque") - << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) - << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); - QTest::newRow("10x10=>20x20, rotate(30), !opaque, smooth") - << QSize(10, 10) << QSize(20, 20) << (QTransform().rotate(30)) - << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; - - QTest::newRow("100x100=>200x200") - << QSize(100, 100) << QSize(200, 200) << (QTransform()) - << QColor(Qt::black) << QPainter::RenderHint(0); - QTest::newRow("100x100=>200x200, smooth") - << QSize(100, 100) << QSize(200, 200) << (QTransform()) - << QColor(Qt::black) << QPainter::SmoothPixmapTransform; - QTest::newRow("100x100=>200x200, !opaque") - << QSize(100, 100) << QSize(200, 200) << (QTransform()) - << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); - QTest::newRow("100x100=>200x200, !opaque, smooth") - << QSize(100, 100) << QSize(200, 200) << (QTransform()) - << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; - - QTest::newRow("100x100=>200x200, rotate(30)") - << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) - << QColor(Qt::black) << QPainter::RenderHint(0); - QTest::newRow("100x100=>200x200, rotate(30), smooth") - << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) - << QColor(Qt::black) << QPainter::SmoothPixmapTransform; - QTest::newRow("100x100=>200x200, rotate(30), !opaque") - << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) - << QColor(127, 127, 127, 127) << QPainter::RenderHint(0); - QTest::newRow("100x100=>200x200, rotate(30), !opaque, smooth") - << QSize(100, 100) << QSize(200, 200) << (QTransform().rotate(30)) - << QColor(127, 127, 127, 127) << QPainter::SmoothPixmapTransform; -} - -void tst_QPainter::drawTiledPixmap() -{ - QFETCH(QSize, srcSize); - QFETCH(QSize, dstSize); - QFETCH(QTransform, transform); - QFETCH(QColor, color); - QFETCH(QPainter::RenderHint, renderHint); - - QPixmap src(srcSize); - src.fill(color); - - const QRect dstRect = transform.mapRect(QRect(QPoint(), dstSize)); - QPixmap dst(dstRect.right() + 5, dstRect.bottom() + 5); - QPainter p(&dst); - p.setTransform(transform); - p.setRenderHint(renderHint); - - QBENCHMARK { - p.drawTiledPixmap(QRect(QPoint(), dstSize), src); - } -} - -void tst_QPainter::fillPrimitives_helper(QPainter *p, PrimitiveType type, PrimitiveSet *s) -{ - p->paintEngine()->syncState(); - - switch (type) { - case Primitive_Int_DiagLine: QBENCHMARK { p->drawLine(s->i_line_diag); } break; - case Primitive_Int_VerLine: QBENCHMARK { p->drawLine(s->i_line_ver); } break; - case Primitive_Int_HorLine: QBENCHMARK { p->drawLine(s->i_line_hor); } break; - case Primitive_Int_Rect: QBENCHMARK { p->drawRect(s->i_rect); } break; - case Primitive_Int_Ellipse: QBENCHMARK { p->drawEllipse(s->i_rect); } break; - case Primitive_Int_Pie: QBENCHMARK { p->drawPie(s->i_rect, 45*16, 270*16); } break; - case Primitive_Int_Arc: QBENCHMARK { p->drawArc(s->i_rect, 45*16, 270*16); } break; - case Primitive_Int_Chord: QBENCHMARK { p->drawChord(s->i_rect, 45*16, 270*16); } break; - case Primitive_Int_TriPoly: QBENCHMARK { p->drawPolygon(s->i_poly_tri); } break; - case Primitive_Int_RectPoly: QBENCHMARK { p->drawPolygon(s->i_poly_rect); } break; - case Primitive_Int_2RectPoly: QBENCHMARK { p->drawPolygon(s->i_poly_2rects); } break; - - case Primitive_Float_DiagLine: QBENCHMARK { p->drawLine(s->f_line_diag); } break; - case Primitive_Float_VerLine: QBENCHMARK { p->drawLine(s->f_line_ver); } break; - case Primitive_Float_HorLine: QBENCHMARK { p->drawLine(s->f_line_hor); } break; - case Primitive_Float_Rect: QBENCHMARK { p->drawRect(s->f_rect); } break; - case Primitive_Float_Ellipse: QBENCHMARK { p->drawEllipse(s->f_rect); } break; - case Primitive_Float_Pie: QBENCHMARK { p->drawPie(s->f_rect, 45*16, 270*16); } break; - case Primitive_Float_Arc: QBENCHMARK { p->drawArc(s->f_rect, 45*16, 270*16); } break; - case Primitive_Float_Chord: QBENCHMARK { p->drawChord(s->f_rect, 45*16, 270*16); } break; - case Primitive_Float_TriPoly: QBENCHMARK { p->drawPolygon(s->f_poly_tri); } break; - case Primitive_Float_RectPoly: QBENCHMARK { p->drawPolygon(s->f_poly_rect); } break; - case Primitive_Float_2RectPoly: QBENCHMARK { p->drawPolygon(s->f_poly_2rects); } break; - - case Primitive_Float_TriPath: QBENCHMARK { p->drawPath(s->f_path_tri); } break; - case Primitive_Float_RectPath: QBENCHMARK { p->drawPath(s->f_path_rect); } break; - case Primitive_Float_2RectPath: QBENCHMARK { p->drawPath(s->f_path_2rects); } break; - case Primitive_Float_EllipsePath: QBENCHMARK { p->drawPath(s->f_path_ellipse); } break; - } -} - -void tst_QPainter::drawPrimitives_data_helper(bool fancypens) -{ - QTest::addColumn("type"); - QTest::addColumn("aa"); - QTest::addColumn("dash"); - QTest::addColumn("width"); - - const char * const names[] = { - "IDLine", - "IVLine", - "IHLine", - "IRect", - "IElli", - "IPie", - "IArc", - "IChord", - "ITriPol", - "IRectPol", - "I2RectPol", - "FDLine", - "FVLine", - "FHLine", - "FRect", - "FElli", - "FPie", - "FArc", - "FChord", - "FTriPol", - "FRectPol", - "F2RectPol", - "FTriPa", - "FRectPa", - "F2RectPa", - "FElliPa" - }; - - if (fancypens) { - for (int dash=0; dash<2; ++dash) { - for (int width=0; width<=4; width+=4) { - for (int aa=0; aa<2; ++aa) { - for (int type=0; type("text"); - - QTest::newRow("a") << QString::fromLatin1("a"); - QTest::newRow("ab") << QString::fromLatin1("ab"); - QTest::newRow("abc") << QString::fromLatin1("abc"); - QTest::newRow("abcd") << QString::fromLatin1("abcd"); - QTest::newRow("abcde") << QString::fromLatin1("abcde"); - QTest::newRow("abcdef") << QString::fromLatin1("abcdef"); - QTest::newRow("abcdefg") << QString::fromLatin1("abcdefg"); -} - -void tst_QPainter::drawText() -{ - QFETCH(QString, text); - - QPainter p(m_surface); - - QBENCHMARK { - p.drawText(QPointF(5, 5), text); - } -} - -void tst_QPainter::saveRestore_data() -{ - QTest::addColumn("change"); - - for (int i=0; i<16; ++i) { - QString change = "change="; - if (i == 0) change += " none"; - if (i & ChangePen) change += " pen"; - if (i & ChangeBrush) change += " brush"; - if (i & ChangeClip) change += " clip"; - if (i & ChangeTransform) change += " xform"; - - QTest::newRow(change.toLatin1()) << i; - } -} - -void tst_QPainter::saveRestore() -{ - QFETCH(int, change); - - QPen pen(Qt::blue); - QBrush brush(Qt::green); - QRect r(100, 100, 100, 20); - - QPainter p(m_surface); - - p.setPen(Qt::NoPen); - p.setBrush(Qt::NoBrush); - - QBENCHMARK { - p.save(); - if (change & ChangePen) { p.setPen(pen); p.setPen(Qt::NoPen); } - if (change & ChangeBrush) { p.setBrush(brush); p.setBrush(Qt::NoBrush); } - if (change & ChangeClip) p.setClipRect(r); - if (change & ChangeTransform) { p.scale(3, 5); p.scale(1/3.0, 1/5.0); } - p.drawRect(0, 0, 1, 1); - p.restore(); - }; -} - -enum ClipType { - RectClipType, - RectPathClipType, - RectRegionClipType, - RegionClipType, - PathClipType -}; - -void tst_QPainter::clipAndFill_data() -{ - QTest::addColumn("type"); - - QTest::newRow("rect") << (int) RectClipType; - QTest::newRow("rectpath") << (int) RectPathClipType; - QTest::newRow("rectregion") << (int) RectRegionClipType; - QTest::newRow("ellipseRegion") << (int) RegionClipType; - QTest::newRow("ellipsePath") << (int) PathClipType; -} - - -void tst_QPainter::clipAndFill() -{ - QFETCH(int, type); - - QRegion region; - QPainterPath path; - QRectF rect; - - switch (type) { - case RectClipType: - rect = QRectF(100, 100, 100, 100); - break; - case RectPathClipType: - path.addRect(100, 100, 100, 100); - break; - case RectRegionClipType: - region = QRegion(100, 100, 100, 100); - break; - case RegionClipType: - region = QRegion(100, 100, 100, 100, QRegion::Ellipse); - break; - case PathClipType: - path.addEllipse(100, 100, 100, 100); - break; - } - - QPainter p(m_surface); - - p.setPen(Qt::NoPen); - p.setBrush(Qt::red); - - QBENCHMARK { - if (type == RectClipType) - p.setClipRect(rect); - else if (type == RectPathClipType || type == PathClipType) - p.setClipPath(path); - else - p.setClipRegion(region); - p.drawRect(110, 110, 10, 10); - } -} - -QTransform tst_QPainter::transformForAngle(qreal angle) -{ - const qreal inv_dist_to_plane = 1. / 1024.; - - QTransform transform; - - QTransform rotTrans; - rotTrans.translate(-40, 0); - QTransform rotTrans2; - rotTrans2.translate(40, 0); - - qreal rad = angle * 2. * M_PI / 360.; - qreal c = ::cos(rad); - qreal s = ::sin(rad); - - qreal x = 0; - qreal y = 80; - qreal z = 0; - - qreal len = x * x + y * y + z * z; - if (len != 1.) { - len = ::sqrt(len); - x /= len; - y /= len; - z /= len; - } - - QTransform rot(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane, - y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane, - 0, 0, 1); - - transform *= rotTrans; - transform *= rot; - transform *= rotTrans2; - - return transform; -} - -void tst_QPainter::drawRoundedRect() -{ - QImage surface(100, 100, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - p.setPen(QPen(Qt::black, 1)); - p.setBrush(Qt::red); - - QBENCHMARK { - p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10); - } -} - -void tst_QPainter::drawScaledRoundedRect() -{ - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - p.setPen(QPen(Qt::black, 1)); - p.setBrush(Qt::red); - p.scale(3, 3); - - QBENCHMARK { - p.drawRoundedRect(10, 10, 80, 80, 10, 10); - } -} - -void tst_QPainter::drawTransformedRoundedRect() -{ - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - p.setPen(QPen(Qt::black, 1)); - p.setBrush(Qt::red); - - QBENCHMARK { - p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); - p.drawRoundedRect(100, 100, 80, 80, 10, 10); - } -} - -void tst_QPainter::drawAntialiasedRoundedRect() -{ - QImage surface(100, 100, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - p.setRenderHint(QPainter::Antialiasing, true); - p.setPen(QPen(Qt::black, 1)); - p.setBrush(Qt::red); - - QBENCHMARK { - p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10); - } -} - -void tst_QPainter::drawScaledAntialiasedRoundedRect_data() -{ - QTest::addColumn("scale"); - - for (float i = 0; i < 3; i += .1) - QTest::newRow(QString(QLatin1String("scale=%1")).arg(i).toLatin1()) << i; -} - -void tst_QPainter::drawScaledAntialiasedRoundedRect() -{ - QFETCH(float, scale); - - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - p.setRenderHint(QPainter::Antialiasing, true); - p.setPen(QPen(Qt::black, 1)); - p.setBrush(Qt::red); - p.scale(scale, scale); - - QBENCHMARK { - p.drawRoundedRect(10, 10, 80, 80, 10, 10); - } -} - -void tst_QPainter::drawTransformedAntialiasedRoundedRect_data() -{ - QTest::addColumn("transform"); - - for (float angle = 0; angle < 360; angle += 10) - QTest::newRow(QString(QLatin1String("angle=%1")).arg(angle).toLatin1()) << transformForAngle(angle); -} - -void tst_QPainter::drawTransformedAntialiasedRoundedRect() -{ - QFETCH(QTransform, transform); - - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - p.setRenderHint(QPainter::Antialiasing, true); - p.setPen(QPen(Qt::black, 1)); - p.setBrush(Qt::red); - - QBENCHMARK { - p.setWorldTransform(transform); - p.drawRoundedRect(100, 100, 80, 80, 10, 10); - } -} - -void tst_QPainter::drawImageRoundedRect() -{ - //setup image - const int radius = 10; - QImage rectImage(81, 81, QImage::Format_ARGB32_Premultiplied); - rectImage.fill(0); - QPainter rp(&rectImage); - rp.setRenderHint(QPainter::Antialiasing); - rp.setPen(Qt::black); - rp.setBrush(Qt::red); - rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); - - //setup surface - QImage surface(100, 100, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - p.drawImage(0,0, rectImage); - } -} - -void tst_QPainter::drawScaledImageRoundedRect_data() -{ - QTest::addColumn("imageType"); - - QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; - QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; -} - -void tst_QPainter::drawScaledImageRoundedRect() -{ - QFETCH(int, imageType); - - //setup image - const int radius = 10; - QImage rectImage(81, 81, (QImage::Format)imageType); - rectImage.fill(0); - QPainter rp(&rectImage); - rp.setRenderHint(QPainter::Antialiasing); - rp.setPen(Qt::black); - rp.setBrush(Qt::red); - rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); - - //setup surface - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - p.scale(3, 3); - - QBENCHMARK { - p.drawImage(0,0, rectImage); - } -} - -void tst_QPainter::drawTransformedImageRoundedRect_data() -{ - QTest::addColumn("imageType"); - - QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; - QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; -} - -void tst_QPainter::drawTransformedImageRoundedRect() -{ - QFETCH(int, imageType); - - //setup image - const int radius = 10; - QImage rectImage(81, 81, (QImage::Format)imageType); - rectImage.fill(0); - QPainter rp(&rectImage); - rp.setRenderHint(QPainter::Antialiasing); - rp.setPen(Qt::black); - rp.setBrush(Qt::red); - rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius); - - //setup surface - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); - p.drawImage(100,100, rectImage); - } -} - -//code from QmlGraphicsRectangle for drawing rounded rects -void tst_QPainter::drawBorderPixmapRoundedRect() -{ - //setup image - const int pw = 1; - const int radius = 10; - QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied); - rectImage.fill(0); - QPainter rp(&rectImage); - rp.setRenderHint(QPainter::Antialiasing); - rp.setPen(Qt::black); - rp.setBrush(Qt::red); - if (pw%2) - rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); - else - rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); - QPixmap rectPixmap = QPixmap::fromImage(rectImage); - - //setup surface - QImage surface(100, 100, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - const int pw = 2; - int width = 80; - int height = 80; - - int xOffset = (rectPixmap.width()-1)/2; - int yOffset = (rectPixmap.height()-1)/2; - Q_ASSERT(rectPixmap.width() == 2*xOffset + 1); - Q_ASSERT(rectPixmap.height() == 2*yOffset + 1); - - QMargins margins(xOffset, yOffset, xOffset, yOffset); - QTileRules rules(Qt::StretchTile, Qt::StretchTile); - //NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects - qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width+pw, height+pw), margins, rectPixmap, rectPixmap.rect(), margins, rules); - } -} - -void tst_QPainter::drawScaledBorderPixmapRoundedRect_data() -{ - QTest::addColumn("scale"); - QTest::addColumn("imageType"); - - for (float i = 0; i < 3; i += .1) - QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied; - //for (float i = 0; i < 3; i += .1) - // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied; -} - -//code from QmlGraphicsRectangle for drawing rounded rects -void tst_QPainter::drawScaledBorderPixmapRoundedRect() -{ - QFETCH(float, scale); - QFETCH(int, imageType); - - //setup image - const int pw = 1; - const int radius = 10; - QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType); - rectImage.fill(0); - QPainter rp(&rectImage); - rp.setRenderHint(QPainter::Antialiasing); - rp.setPen(Qt::black); - rp.setBrush(Qt::red); - if (pw%2) - rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); - else - rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); - - QPixmap rectPixmap = QPixmap::fromImage(rectImage); - - //setup surface - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - p.scale(scale, scale); - - QBENCHMARK { - const int pw = 2; - int width = 80; - int height = 80; - - int xOffset = (rectPixmap.width()-1)/2; - int yOffset = (rectPixmap.height()-1)/2; - Q_ASSERT(rectPixmap.width() == 2*xOffset + 1); - Q_ASSERT(rectPixmap.height() == 2*yOffset + 1); - - QMargins margins(xOffset, yOffset, xOffset, yOffset); - QTileRules rules(Qt::StretchTile, Qt::StretchTile); - qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width+pw, height+pw), margins, rectPixmap, rectPixmap.rect(), margins, rules); - } -} - -void tst_QPainter::drawTransformedBorderPixmapRoundedRect_data() -{ - QTest::addColumn("transform"); - QTest::addColumn("imageType"); - - for (float angle = 0; angle < 360; angle += 10) - QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB32_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB32_Premultiplied; - //for (float angle = 0; angle < 360; angle += 10) - // QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB8565_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB8565_Premultiplied; - -} - -//code from QmlGraphicsRectangle for drawing rounded rects -void tst_QPainter::drawTransformedBorderPixmapRoundedRect() -{ - QFETCH(QTransform, transform); - QFETCH(int, imageType); - - //setup image - const int pw = 1; - const int radius = 10; - QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType); - rectImage.fill(0); - QPainter rp(&rectImage); - rp.setRenderHint(QPainter::Antialiasing); - rp.setPen(Qt::black); - rp.setBrush(Qt::red); - if (pw%2) - rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius); - else - rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius); - - QPixmap rectPixmap = QPixmap::fromImage(rectImage); - - //setup surface - QImage surface(400, 400, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - p.setWorldTransform(transform); - const int pw = 2; - int width = 80; - int height = 80; - - int xOffset = (rectPixmap.width()-1)/2; - int yOffset = (rectPixmap.height()-1)/2; - Q_ASSERT(rectPixmap.width() == 2*xOffset + 1); - Q_ASSERT(rectPixmap.height() == 2*yOffset + 1); - - QMargins margins(xOffset, yOffset, xOffset, yOffset); - QTileRules rules(Qt::StretchTile, Qt::StretchTile); - qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width+pw, height+pw), margins, rectPixmap, rectPixmap.rect(), margins, rules); - } -} - -void tst_QPainter::drawTransformedTransparentImage_data() -{ - QTest::addColumn("imageType"); - - QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; - QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; -} - -void tst_QPainter::drawTransformedTransparentImage() -{ - QFETCH(int, imageType); - - //setup image - QImage transImage(200, 200, (QImage::Format)imageType); - transImage.fill(0); - - //setup surface - QImage surface(200, 200, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); - p.drawImage(0,0, transImage); - } -} - -void tst_QPainter::drawTransformedSemiTransparentImage_data() -{ - QTest::addColumn("imageType"); - - QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; - QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; -} - -void tst_QPainter::drawTransformedSemiTransparentImage() -{ - QFETCH(int, imageType); - - //setup image - QImage transImage(200, 200, (QImage::Format)imageType); - transImage.fill(QColor(0,0,0, 128).rgba()); - - //setup surface - QImage surface(200, 200, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); - p.drawImage(0,0, transImage); - } -} - -void tst_QPainter::drawTransformedFilledImage_data() -{ - QTest::addColumn("imageType"); - - QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied; - QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied; -} - -void tst_QPainter::drawTransformedFilledImage() -{ - QFETCH(int, imageType); - - //setup image - QImage filledImage(200, 200, (QImage::Format)imageType); - filledImage.fill(QColor(0,0,0).rgb()); - - //setup surface - QImage surface(200, 200, QImage::Format_RGB16); - surface.fill(QColor(255,255,255).rgb()); - QPainter p(&surface); - - QBENCHMARK { - p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953)); - p.drawImage(0,0, filledImage); - } -} - - -QTEST_MAIN(tst_QPainter) - -#include "tst_qpainter.moc" diff --git a/tests/benchmarks/qpixmap/qpixmap.pro b/tests/benchmarks/qpixmap/qpixmap.pro deleted file mode 100644 index e8330bd..0000000 --- a/tests/benchmarks/qpixmap/qpixmap.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qpixmap - -SOURCES += tst_qpixmap.cpp diff --git a/tests/benchmarks/qpixmap/tst_qpixmap.cpp b/tests/benchmarks/qpixmap/tst_qpixmap.cpp deleted file mode 100644 index 9ffbefb..0000000 --- a/tests/benchmarks/qpixmap/tst_qpixmap.cpp +++ /dev/null @@ -1,227 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -class tst_QPixmap : public QObject -{ - Q_OBJECT - -public: - tst_QPixmap(); - -private slots: - void fill_data(); - void fill(); - - void scaled_data(); - void scaled(); - void transformed_data(); - void transformed(); - void mask_data(); - void mask(); -}; - -Q_DECLARE_METATYPE(QImage::Format) -Q_DECLARE_METATYPE(Qt::AspectRatioMode) -Q_DECLARE_METATYPE(Qt::TransformationMode) - -tst_QPixmap::tst_QPixmap() -{ -} - -void tst_QPixmap::fill_data() -{ - QTest::addColumn("opaque"); - QTest::addColumn("width"); - QTest::addColumn("height"); - - QTest::newRow("opaque 16x16") << true << 16 << 16; - QTest::newRow("!opaque 16x16") << false << 16 << 16; - QTest::newRow("opaque 587x128") << true << 587 << 128; - QTest::newRow("!opaque 587x128") << false << 587 << 128; -} - -void tst_QPixmap::fill() -{ - QFETCH(bool, opaque); - QFETCH(int, width); - QFETCH(int, height); - - const QColor color = opaque ? QColor(255, 0, 0) : QColor(255, 0, 0, 200); - QPixmap pixmap(width, height); - - QBENCHMARK { - pixmap.fill(color); - } -} - -void tst_QPixmap::scaled_data() -{ - QTest::addColumn("size"); - QTest::addColumn("scale"); - QTest::addColumn("ratioMode"); - QTest::addColumn("transformMode"); - - QTest::newRow("16x16 => 32x32") << QSize(16, 16) << QSize(32, 32) - << Qt::IgnoreAspectRatio - << Qt::FastTransformation; - QTest::newRow("100x100 => 200x200") << QSize(100, 100) << QSize(200, 200) - << Qt::IgnoreAspectRatio - << Qt::FastTransformation; - QTest::newRow("100x100 => 200x200") << QSize(100, 100) << QSize(200, 200) - << Qt::IgnoreAspectRatio - << Qt::FastTransformation; - QTest::newRow("80x80 => 200x200") << QSize(137, 137) << QSize(200, 200) - << Qt::IgnoreAspectRatio - << Qt::FastTransformation; - -} - -void tst_QPixmap::scaled() -{ - QFETCH(QSize, size); - QFETCH(QSize, scale); - QFETCH(Qt::AspectRatioMode, ratioMode); - QFETCH(Qt::TransformationMode, transformMode); - - QPixmap opaque(size); - QPixmap transparent(size); - opaque.fill(QColor(255, 0, 0)); - transparent.fill(QColor(255, 0, 0, 200)); - - QPixmap scaled1; - QPixmap scaled2; - QBENCHMARK { - scaled1 = opaque.scaled(scale, ratioMode, transformMode); - scaled2 = transparent.scaled(scale, ratioMode, transformMode); - } -} - -void tst_QPixmap::transformed_data() -{ - QTest::addColumn("size"); - QTest::addColumn("transform"); - QTest::addColumn("transformMode"); - - QTest::newRow("16x16 rotate(90)") << QSize(16, 16) - << QTransform().rotate(90) - << Qt::FastTransformation; - QTest::newRow("16x16 rotate(199)") << QSize(16, 16) - << QTransform().rotate(199) - << Qt::FastTransformation; - QTest::newRow("16x16 shear(2,1)") << QSize(16, 16) - << QTransform().shear(2, 1) - << Qt::FastTransformation; - QTest::newRow("16x16 rotate(199).shear(2,1)") << QSize(16, 16) - << QTransform().rotate(199).shear(2, 1) - << Qt::FastTransformation; - QTest::newRow("100x100 rotate(90)") << QSize(100, 100) - << QTransform().rotate(90) - << Qt::FastTransformation; - QTest::newRow("100x100 rotate(199)") << QSize(100, 100) - << QTransform().rotate(199) - << Qt::FastTransformation; - QTest::newRow("100x100 shear(2,1)") << QSize(100, 100) - << QTransform().shear(2, 1) - << Qt::FastTransformation; - QTest::newRow("100x100 shear(2,1) smooth") << QSize(100, 100) - << QTransform().shear(2, 1) - << Qt::SmoothTransformation; - QTest::newRow("100x100 rotate(199).shear(2,1)") << QSize(100, 100) - << QTransform().rotate(199).shear(2, 1) - << Qt::FastTransformation; -} - -void tst_QPixmap::transformed() -{ - QFETCH(QSize, size); - QFETCH(QTransform, transform); - QFETCH(Qt::TransformationMode, transformMode); - - QPixmap opaque(size); - QPixmap transparent(size); - opaque.fill(QColor(255, 0, 0)); - transparent.fill(QColor(255, 0, 0, 200)); - - QPixmap transformed1; - QPixmap transformed2; - QBENCHMARK { - transformed1 = opaque.transformed(transform, transformMode); - transformed2 = transparent.transformed(transform, transformMode); - } -} - -void tst_QPixmap::mask_data() -{ - QTest::addColumn("size"); - - QTest::newRow("1x1") << QSize(1, 1); - QTest::newRow("9x9") << QSize(9, 9); - QTest::newRow("16x16") << QSize(16, 16); - QTest::newRow("128x128") << QSize(128, 128); - QTest::newRow("333x333") << QSize(333, 333); - QTest::newRow("2048x128") << QSize(2048, 128); -} - -void tst_QPixmap::mask() -{ - QFETCH(QSize, size); - - QPixmap src(size); - src.fill(Qt::transparent); - { - QPainter p(&src); - p.drawLine(QPoint(0, 0), QPoint(src.width(), src.height())); - } - - QBENCHMARK { - QBitmap bitmap = src.mask(); - QVERIFY(bitmap.size() == src.size()); - } -} - -QTEST_MAIN(tst_QPixmap) - -#include "tst_qpixmap.moc" diff --git a/tests/benchmarks/qpixmapcache/qpixmapcache.pro b/tests/benchmarks/qpixmapcache/qpixmapcache.pro deleted file mode 100644 index e0d7543..0000000 --- a/tests/benchmarks/qpixmapcache/qpixmapcache.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qpixmapcache -TEMPLATE = app -# Input -SOURCES += tst_qpixmapcache.cpp diff --git a/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp deleted file mode 100644 index 1031ba7..0000000 --- a/tests/benchmarks/qpixmapcache/tst_qpixmapcache.cpp +++ /dev/null @@ -1,226 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -//TESTED_FILES= - -class tst_QPixmapCache : public QObject -{ - Q_OBJECT - -public: - tst_QPixmapCache(); - virtual ~tst_QPixmapCache(); - -public slots: - void init(); - void cleanup(); - -private slots: - void insert_data(); - void insert(); - void find_data(); - void find(); - void styleUseCaseComplexKey(); - void styleUseCaseComplexKey_data(); -}; - -tst_QPixmapCache::tst_QPixmapCache() -{ -} - -tst_QPixmapCache::~tst_QPixmapCache() -{ -} - -void tst_QPixmapCache::init() -{ -} - -void tst_QPixmapCache::cleanup() -{ -} - -void tst_QPixmapCache::insert_data() -{ - QTest::addColumn("cacheType"); - QTest::newRow("QPixmapCache") << true; - QTest::newRow("QPixmapCache (int API)") << false; -} - -QList keys; - -void tst_QPixmapCache::insert() -{ - QFETCH(bool, cacheType); - QPixmap p; - if (cacheType) { - QBENCHMARK { - for (int i = 0 ; i <= 10000 ; i++) - { - QString tmp; - tmp.sprintf("my-key-%d", i); - QPixmapCache::insert(tmp, p); - } - } - } else { - QBENCHMARK { - for (int i = 0 ; i <= 10000 ; i++) - keys.append(QPixmapCache::insert(p)); - } - } -} - -void tst_QPixmapCache::find_data() -{ - QTest::addColumn("cacheType"); - QTest::newRow("QPixmapCache") << true; - QTest::newRow("QPixmapCache (int API)") << false; -} - -void tst_QPixmapCache::find() -{ - QFETCH(bool, cacheType); - QPixmap p; - if (cacheType) { - QBENCHMARK { - QString tmp; - for (int i = 0 ; i <= 10000 ; i++) - { - tmp.sprintf("my-key-%d", i); - QPixmapCache::find(tmp, p); - } - } - } else { - QBENCHMARK { - for (int i = 0 ; i <= 10000 ; i++) - QPixmapCache::find(keys.at(i), &p); - } - } - -} - -void tst_QPixmapCache::styleUseCaseComplexKey_data() -{ - QTest::addColumn("cacheType"); - QTest::newRow("QPixmapCache") << true; - QTest::newRow("QPixmapCache (int API)") << false; -} - -struct styleStruct { - QString key; - uint state; - uint direction; - uint complex; - uint palette; - int width; - int height; - bool operator==(const styleStruct &str) const - { - return str.state == state && str.direction == direction - && str.complex == complex && str.palette == palette && str.width == width - && str.height == height && str.key == key; - } -}; - -uint qHash(const styleStruct &myStruct) -{ - return qHash(myStruct.state); -} - -void tst_QPixmapCache::styleUseCaseComplexKey() -{ - QFETCH(bool, cacheType); - QPixmap p; - if (cacheType) { - QBENCHMARK { - for (int i = 0 ; i <= 10000 ; i++) - { - QString tmp; - tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200); - QPixmapCache::insert(tmp, p); - } - - for (int i = 0 ; i <= 10000 ; i++) - { - QString tmp; - tmp.sprintf("%s-%d-%d-%d-%d-%d-%d", QString("my-progressbar-%1").arg(i).toLatin1().constData(), 5, 3, 0, 358, 100, 200); - QPixmapCache::find(tmp, p); - } - } - } else { - QHash hash; - QBENCHMARK { - for (int i = 0 ; i <= 10000 ; i++) - { - styleStruct myStruct; - myStruct.key = QString("my-progressbar-%1").arg(i); - myStruct.key = 5; - myStruct.key = 4; - myStruct.key = 3; - myStruct.palette = 358; - myStruct.width = 100; - myStruct.key = 200; - QPixmapCache::Key key = QPixmapCache::insert(p); - hash.insert(myStruct, key); - } - for (int i = 0 ; i <= 10000 ; i++) - { - styleStruct myStruct; - myStruct.key = QString("my-progressbar-%1").arg(i); - myStruct.key = 5; - myStruct.key = 4; - myStruct.key = 3; - myStruct.palette = 358; - myStruct.width = 100; - myStruct.key = 200; - QPixmapCache::Key key = hash.value(myStruct); - QPixmapCache::find(key, &p); - } - } - } - -} - - -QTEST_MAIN(tst_QPixmapCache) -#include "tst_qpixmapcache.moc" diff --git a/tests/benchmarks/qquaternion/qquaternion.pro b/tests/benchmarks/qquaternion/qquaternion.pro deleted file mode 100644 index cd68423..0000000 --- a/tests/benchmarks/qquaternion/qquaternion.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qquaternion - -SOURCES += tst_qquaternion.cpp - diff --git a/tests/benchmarks/qquaternion/tst_qquaternion.cpp b/tests/benchmarks/qquaternion/tst_qquaternion.cpp deleted file mode 100644 index 7930092..0000000 --- a/tests/benchmarks/qquaternion/tst_qquaternion.cpp +++ /dev/null @@ -1,124 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//TESTED_FILES= - -class tst_QQuaternion : public QObject -{ - Q_OBJECT - -public: - tst_QQuaternion(); - virtual ~tst_QQuaternion(); - -public slots: - void init(); - void cleanup(); - -private slots: - void multiply_data(); - void multiply(); -}; - -tst_QQuaternion::tst_QQuaternion() -{ -} - -tst_QQuaternion::~tst_QQuaternion() -{ -} - -void tst_QQuaternion::init() -{ -} - -void tst_QQuaternion::cleanup() -{ -} - -void tst_QQuaternion::multiply_data() -{ - QTest::addColumn("x1"); - QTest::addColumn("y1"); - QTest::addColumn("z1"); - QTest::addColumn("w1"); - QTest::addColumn("x2"); - QTest::addColumn("y2"); - QTest::addColumn("z2"); - QTest::addColumn("w2"); - - QTest::newRow("null") - << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f - << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f; - - QTest::newRow("unitvec") - << (qreal)1.0f << (qreal)0.0f << (qreal)0.0f << (qreal)1.0f - << (qreal)0.0f << (qreal)1.0f << (qreal)0.0f << (qreal)1.0f; - - QTest::newRow("complex") - << (qreal)1.0f << (qreal)2.0f << (qreal)3.0f << (qreal)7.0f - << (qreal)4.0f << (qreal)5.0f << (qreal)6.0f << (qreal)8.0f; -} - -void tst_QQuaternion::multiply() -{ - QFETCH(qreal, x1); - QFETCH(qreal, y1); - QFETCH(qreal, z1); - QFETCH(qreal, w1); - QFETCH(qreal, x2); - QFETCH(qreal, y2); - QFETCH(qreal, z2); - QFETCH(qreal, w2); - - QQuaternion q1(w1, x1, y1, z1); - QQuaternion q2(w2, x2, y2, z2); - - QBENCHMARK { - QQuaternion q3 = q1 * q2; - } -} - -QTEST_MAIN(tst_QQuaternion) -#include "tst_qquaternion.moc" diff --git a/tests/benchmarks/qrect/main.cpp b/tests/benchmarks/qrect/main.cpp deleted file mode 100644 index e293bfa..0000000 --- a/tests/benchmarks/qrect/main.cpp +++ /dev/null @@ -1,329 +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 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 QRect/QRectF functions. - -#include -#include - -class tst_qrect : public QObject -{ - Q_OBJECT -private slots: - // QRect functions: - void contains_point_data(); - void contains_point(); - void contains_rect_data(); - void contains_rect(); - void intersects_data(); - void intersects(); - void intersected_data(); - void intersected(); - void united_data(); - void united(); - - // QRectF functions: - void contains_point_f_data(); - void contains_point_f(); - void contains_rect_f_data(); - void contains_rect_f(); - void intersects_f_data(); - void intersects_f(); - void intersected_f_data(); - void intersected_f(); - void united_f_data(); - void united_f(); -}; - -struct RectRectCombination -{ - QString tag; - qreal x1, y1, w1, h1, x2, y2, w2, h2; - RectRectCombination( - const QString &tag, - const qreal x1, const qreal y1, const qreal w1, const qreal h1, - const qreal x2, const qreal y2, const qreal w2, const qreal h2) - : tag(tag), x1(x1), y1(y1), w1(w1), h1(h1), x2(x2), y2(y2), w2(w2), h2(h2) {} -}; - -static QList createRectRectCombinations() -{ - QList result; - result << RectRectCombination("null", 0, 0, 0, 0, 0, 0, 0, 0); - result << RectRectCombination("null1", 0, 0, 0, 0, 0, 0, 10, 10); - result << RectRectCombination("null2", 0, 0, 10, 10, 0, 0, 0, 0); - - result << RectRectCombination("miss", 0, 0, 10, 10, 11, 11, 10, 10); - result << RectRectCombination("intersect", 0, 0, 10, 10, 5, 5, 10, 10); - result << RectRectCombination("contain1", 0, 0, 10, 10, 1, 1, 8, 8); - result << RectRectCombination("contain2", 1, 1, 8, 8, 0, 0, 10, 10); - - result << RectRectCombination("miss_flip1", 9, 9, -10, -10, 11, 11, 10, 10); - result << RectRectCombination("intersect_flip1", 9, 9, -10, -10, 5, 5, 10, 10); - result << RectRectCombination("contain1_flip1", 9, 9, -10, -10, 1, 1, 8, 8); - result << RectRectCombination("contain2_flip1", 8, 8, -8, -8, 0, 0, 10, 10); - - result << RectRectCombination("miss_flip2", 0, 0, 10, 10, 20, 20, -10, -10); - result << RectRectCombination("intersect_flip2", 0, 0, 10, 10, 14, 14, -10, -10); - result << RectRectCombination("contain1_flip2", 0, 0, 10, 10, 8, 8, -8, -8); - result << RectRectCombination("contain2_flip2", 1, 1, 8, 8, 9, 9, -10, -10); - - return result; -} - -static void addRectRectData(bool includeProperArg = false) -{ - QTest::addColumn("rf1"); - QTest::addColumn("rf2"); - if (includeProperArg) - QTest::addColumn("proper"); - for (int i = 0; i < (includeProperArg ? 2 : 1); ++i) { - QList combinations = createRectRectCombinations(); - foreach (RectRectCombination c, combinations) { - QTestData &testData = QTest::newRow(c.tag.toLatin1().data()); - QRectF r1(c.x1, c.y1, c.w1, c.h1); - QRectF r2(c.x2, c.y2, c.w2, c.h2); - testData << r1 << r2; - if (includeProperArg) - testData << (i == 0); - } - } -} - -struct RectPointCombination -{ - QString tag; - qreal x, y, w, h, px, py; - RectPointCombination( - const QString &tag, - const qreal x, const qreal y, const qreal w, const qreal h, const qreal px, const qreal py) - : tag(tag), x(x), y(y), w(w), h(h), px(px), py(py) {} -}; - -static QList createRectPointCombinations() -{ - QList result; - result << RectPointCombination("null", 0, 0, 0, 0, 0, 0); - - result << RectPointCombination("miss", 0, 0, 10, 10, -1, -1); - result << RectPointCombination("contain", 0, 0, 10, 10, 0, 0); - result << RectPointCombination("contain_proper", 0, 0, 10, 10, 1, 1); - - result << RectPointCombination("miss_flip", 9, 9, -10, -10, -1, -1); - result << RectPointCombination("contain_flip", 9, 9, -10, -10, 0, 0); - result << RectPointCombination("contain_flip_proper", 9, 9, -10, -10, 1, 1); - - return result; -} - -static void addRectPointData(bool includeProperArg = false) -{ - QTest::addColumn("rf"); - QTest::addColumn("pf"); - if (includeProperArg) - QTest::addColumn("proper"); - for (int i = 0; i < (includeProperArg ? 2 : 1); ++i) { - QList combinations = createRectPointCombinations(); - foreach (RectPointCombination c, combinations) { - QTestData &testData = QTest::newRow(c.tag.toLatin1().data()); - QRectF r(c.x, c.y, c.w, c.h); - QPointF p(c.px, c.py); - testData << r << p; - if (includeProperArg) - testData << (i == 0); - } - } -} - -void tst_qrect::contains_point_data() -{ - addRectPointData(true); -} - -void tst_qrect::contains_point() -{ - QFETCH(QRectF, rf); - QFETCH(QPointF, pf); - QFETCH(bool, proper); - QRect r(rf.toRect()); - QPoint p(pf.toPoint()); - QBENCHMARK { - r.contains(p, proper); - } -} - -void tst_qrect::contains_rect_data() -{ - addRectRectData(true); -} - -void tst_qrect::contains_rect() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QFETCH(bool, proper); - QRect r1(rf1.toRect()); - QRect r2(rf2.toRect()); - QBENCHMARK { - r1.contains(r2, proper); - } -} - -void tst_qrect::intersects_data() -{ - addRectRectData(); -} - -void tst_qrect::intersects() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QRect r1(rf1.toRect()); - QRect r2(rf2.toRect()); - QBENCHMARK { - r1.intersects(r2); - } -} - -void tst_qrect::intersected_data() -{ - addRectRectData(); -} - -void tst_qrect::intersected() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QRect r1(rf1.toRect()); - QRect r2(rf2.toRect()); - QBENCHMARK { - r1.intersected(r2); - } -} - -void tst_qrect::united_data() -{ - addRectRectData(); -} - -void tst_qrect::united() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QRect r1(rf1.toRect()); - QRect r2(rf2.toRect()); - QBENCHMARK { - r1.united(r2); - } -} - -void tst_qrect::contains_point_f_data() -{ - addRectPointData(); -} - -void tst_qrect::contains_point_f() -{ - QFETCH(QRectF, rf); - QFETCH(QPointF, pf); - QBENCHMARK { - rf.contains(pf); - } -} - -void tst_qrect::contains_rect_f_data() -{ - addRectRectData(); -} - -void tst_qrect::contains_rect_f() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QBENCHMARK { - rf1.contains(rf2); - } -} - -void tst_qrect::intersects_f_data() -{ - addRectRectData(); -} - -void tst_qrect::intersects_f() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QBENCHMARK { - rf1.intersects(rf2); - } -} - -void tst_qrect::intersected_f_data() -{ - addRectRectData(); -} - -void tst_qrect::intersected_f() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QBENCHMARK { - rf1.intersected(rf2); - } -} - -void tst_qrect::united_f_data() -{ - addRectRectData(); -} - -void tst_qrect::united_f() -{ - QFETCH(QRectF, rf1); - QFETCH(QRectF, rf2); - QBENCHMARK { - rf1.united(rf2); - } -} - -QTEST_MAIN(tst_qrect) - -#include "main.moc" diff --git a/tests/benchmarks/qrect/qrect.pro b/tests/benchmarks/qrect/qrect.pro deleted file mode 100644 index 6e35119..0000000 --- a/tests/benchmarks/qrect/qrect.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qrect -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qregexp/main.cpp b/tests/benchmarks/qregexp/main.cpp deleted file mode 100644 index ab9ed71..0000000 --- a/tests/benchmarks/qregexp/main.cpp +++ /dev/null @@ -1,290 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include - -#include - - -class tst_qregexp : public QObject -{ - Q_OBJECT -private slots: - void escape_old(); - void escape_old_data() { escape_data(); } - void escape_new1(); - void escape_new1_data() { escape_data(); } - void escape_new2(); - void escape_new2_data() { escape_data(); } - void escape_new3(); - void escape_new3_data() { escape_data(); } - void escape_new4(); - void escape_new4_data() { escape_data(); } -private: - void escape_data(); -}; - - -static void verify(const QString "ed, const QString &expected) -{ - if (quoted != expected) - qDebug() << "ERROR:" << quoted << expected; -} - -void tst_qregexp::escape_data() -{ - QTest::addColumn("pattern"); - QTest::addColumn("expected"); - - QTest::newRow("escape 0") << "Hello world" << "Hello world"; - QTest::newRow("escape 1") << "(Hello world)" << "\\(Hello world\\)"; - { - QString s; - for (int i = 0; i < 10; ++i) - s += "(escape)"; - QTest::newRow("escape 10") << s << QRegExp::escape(s); - } - { - QString s; - for (int i = 0; i < 100; ++i) - s += "(escape)"; - QTest::newRow("escape 100") << s << QRegExp::escape(s); - } -} - -void tst_qregexp::escape_old() -{ - QFETCH(QString, pattern); - QFETCH(QString, expected); - - QBENCHMARK { - static const char meta[] = "$()*+.?[\\]^{|}"; - QString quoted = pattern; - int i = 0; - - while (i < quoted.length()) { - if (strchr(meta, quoted.at(i).toLatin1()) != 0) - quoted.insert(i++, QLatin1Char('\\')); - ++i; - } - - verify(quoted, expected); - } -} - -void tst_qregexp::escape_new1() -{ - QFETCH(QString, pattern); - QFETCH(QString, expected); - - QBENCHMARK { - QString quoted; - const int count = pattern.count(); - quoted.reserve(count * 2); - const QLatin1Char backslash('\\'); - for (int i = 0; i < count; i++) { - switch (pattern.at(i).toLatin1()) { - case '$': - case '(': - case ')': - case '*': - case '+': - case '.': - case '?': - case '[': - case '\\': - case ']': - case '^': - case '{': - case '|': - case '}': - quoted.append(backslash); - } - quoted.append(pattern.at(i)); - } - verify(quoted, expected); - } -} - -void tst_qregexp::escape_new2() -{ - QFETCH(QString, pattern); - QFETCH(QString, expected); - - QBENCHMARK { - int count = pattern.count(); - const QLatin1Char backslash('\\'); - QString quoted(count * 2, backslash); - const QChar *patternData = pattern.data(); - QChar *quotedData = quoted.data(); - int escaped = 0; - for ( ; --count >= 0; ++patternData) { - const QChar c = *patternData; - switch (c.unicode()) { - case '$': - case '(': - case ')': - case '*': - case '+': - case '.': - case '?': - case '[': - case '\\': - case ']': - case '^': - case '{': - case '|': - case '}': - ++escaped; - ++quotedData; - } - *quotedData = c; - ++quotedData; - } - quoted.resize(pattern.size() + escaped); - - verify(quoted, expected); - } -} - -void tst_qregexp::escape_new3() -{ - QFETCH(QString, pattern); - QFETCH(QString, expected); - - QBENCHMARK { - QString quoted; - const int count = pattern.count(); - quoted.reserve(count * 2); - const QLatin1Char backslash('\\'); - for (int i = 0; i < count; i++) { - switch (pattern.at(i).toLatin1()) { - case '$': - case '(': - case ')': - case '*': - case '+': - case '.': - case '?': - case '[': - case '\\': - case ']': - case '^': - case '{': - case '|': - case '}': - quoted += backslash; - } - quoted += pattern.at(i); - } - - verify(quoted, expected); - } -} - - -static inline bool needsEscaping(int c) -{ - switch (c) { - case '$': - case '(': - case ')': - case '*': - case '+': - case '.': - case '?': - case '[': - case '\\': - case ']': - case '^': - case '{': - case '|': - case '}': - return true; - } - return false; -} - -void tst_qregexp::escape_new4() -{ - QFETCH(QString, pattern); - QFETCH(QString, expected); - - QBENCHMARK { - const int n = pattern.size(); - const QChar *patternData = pattern.data(); - // try to prevent copy if no escape is needed - int i = 0; - for (int i = 0; i != n; ++i) { - const QChar c = patternData[i]; - if (needsEscaping(c.unicode())) - break; - } - if (i == n) { - verify(pattern, expected); - // no escaping needed, "return pattern" should be done here. - return; - } - const QLatin1Char backslash('\\'); - QString quoted(n * 2, backslash); - QChar *quotedData = quoted.data(); - for (int j = 0; j != i; ++j) - *quotedData++ = *patternData++; - int escaped = 0; - for (; i != n; ++i) { - const QChar c = *patternData; - if (needsEscaping(c.unicode())) { - ++escaped; - ++quotedData; - } - *quotedData = c; - ++quotedData; - ++patternData; - } - quoted.resize(n + escaped); - verify(quoted, expected); - // "return quoted" - } -} -QTEST_MAIN(tst_qregexp) - -#include "main.moc" diff --git a/tests/benchmarks/qregexp/qregexp.pro b/tests/benchmarks/qregexp/qregexp.pro deleted file mode 100644 index 83d723c..0000000 --- a/tests/benchmarks/qregexp/qregexp.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qregexp -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qregion/main.cpp b/tests/benchmarks/qregion/main.cpp deleted file mode 100644 index 3d16e41..0000000 --- a/tests/benchmarks/qregion/main.cpp +++ /dev/null @@ -1,89 +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 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 QRegion functions. - -#include -#include - -class tst_qregion : public QObject -{ - Q_OBJECT -private slots: - void map_data(); - void map(); -}; - - -void tst_qregion::map_data() -{ - QTest::addColumn("region"); - - { - QRegion region(0, 0, 100, 100); - QTest::newRow("single rect") << region; - } - { - QRegion region; - region = region.united(QRect(0, 0, 100, 100)); - region = region.united(QRect(120, 20, 100, 100)); - - QTest::newRow("two rects") << region; - } - { - QRegion region(0, 0, 100, 100, QRegion::Ellipse); - QTest::newRow("ellipse") << region; - } -} - -void tst_qregion::map() -{ - QFETCH(QRegion, region); - - QTransform transform; - transform.rotate(30); - QBENCHMARK { - transform.map(region); - } -} - -QTEST_MAIN(tst_qregion) - -#include "main.moc" diff --git a/tests/benchmarks/qregion/qregion.pro b/tests/benchmarks/qregion/qregion.pro deleted file mode 100644 index fc67177..0000000 --- a/tests/benchmarks/qregion/qregion.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qregion -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qscriptclass/qscriptclass.pro b/tests/benchmarks/qscriptclass/qscriptclass.pro deleted file mode 100644 index f0ffeb7..0000000 --- a/tests/benchmarks/qscriptclass/qscriptclass.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qscriptclass - -SOURCES += tst_qscriptclass.cpp - -QT += script diff --git a/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp b/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp deleted file mode 100644 index 7985028..0000000 --- a/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp +++ /dev/null @@ -1,511 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -Q_DECLARE_METATYPE(QScriptContext*) -Q_DECLARE_METATYPE(QScriptValue) -Q_DECLARE_METATYPE(QScriptValueList) - -//TESTED_FILES= - -class TestClass : public QScriptClass -{ -public: - struct CustomProperty { - QueryFlags qflags; - uint id; - QScriptValue::PropertyFlags pflags; - QScriptValue value; - - CustomProperty(QueryFlags qf, uint i, QScriptValue::PropertyFlags pf, - const QScriptValue &val) - : qflags(qf), id(i), pflags(pf), value(val) { } - }; - - enum CallableMode { - NotCallable, - CallableReturnsSum, - CallableReturnsArgument, - CallableReturnsInvalidVariant - }; - - TestClass(QScriptEngine *engine); - ~TestClass(); - - void addCustomProperty(const QScriptString &name, QueryFlags qflags, - uint id, QScriptValue::PropertyFlags pflags, - const QScriptValue &value); - void removeCustomProperty(const QScriptString &name); - - QueryFlags queryProperty(const QScriptValue &object, - const QScriptString &name, - QueryFlags flags, uint *id); - - QScriptValue property(const QScriptValue &object, - const QScriptString &name, uint id); - - void setProperty(QScriptValue &object, const QScriptString &name, - uint id, const QScriptValue &value); - - QScriptValue::PropertyFlags propertyFlags( - const QScriptValue &object, const QScriptString &name, uint id); - - QScriptClassPropertyIterator *newIterator(const QScriptValue &object); - - QScriptValue prototype() const; - - QString name() const; - - bool supportsExtension(Extension extension) const; - QVariant extension(Extension extension, - const QVariant &argument = QVariant()); - - void setIterationEnabled(bool enable); - bool isIterationEnabled() const; - - void setCallableMode(CallableMode mode); - CallableMode callableMode() const; - - void setHasInstance(bool hasInstance); - bool hasInstance() const; - -private: - inline CustomProperty *findCustomProperty(const QScriptString &name); - - QHash customProperties; - - QScriptValue m_prototype; - bool m_iterationEnabled; - CallableMode m_callableMode; - bool m_hasInstance; -}; - -class TestClassPropertyIterator : public QScriptClassPropertyIterator -{ -public: - TestClassPropertyIterator(const QHash &props, - const QScriptValue &object); - ~TestClassPropertyIterator(); - - bool hasNext() const; - void next(); - - bool hasPrevious() const; - void previous(); - - void toFront(); - void toBack(); - - QScriptString name() const; - uint id() const; - QScriptValue::PropertyFlags flags() const; - -private: - int m_index; - int m_last; - QHash m_props; -}; - -TestClass::TestClass(QScriptEngine *engine) - : QScriptClass(engine), m_iterationEnabled(true), - m_callableMode(NotCallable), m_hasInstance(false) -{ - m_prototype = engine->newObject(); -} - -TestClass::~TestClass() -{ - qDeleteAll(customProperties); -} - -TestClass::CustomProperty* TestClass::findCustomProperty(const QScriptString &name) -{ - QHash::const_iterator it; - it = customProperties.constFind(name); - if (it == customProperties.constEnd()) - return 0; - return it.value(); - -} - -void TestClass::addCustomProperty(const QScriptString &name, QueryFlags qflags, - uint id, QScriptValue::PropertyFlags pflags, - const QScriptValue &value) -{ - customProperties.insert(name, new CustomProperty(qflags, id, pflags, value)); -} - -void TestClass::removeCustomProperty(const QScriptString &name) -{ - CustomProperty *prop = customProperties.take(name); - if (prop) - delete prop; -} - -QScriptClass::QueryFlags TestClass::queryProperty(const QScriptValue &/*object*/, - const QScriptString &name, - QueryFlags flags, uint *id) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return 0; - *id = prop->id; - return prop->qflags & flags; -} - -QScriptValue TestClass::property(const QScriptValue &/*object*/, - const QScriptString &name, uint /*id*/) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return QScriptValue(); - return prop->value; -} - -void TestClass::setProperty(QScriptValue &/*object*/, const QScriptString &name, - uint /*id*/, const QScriptValue &value) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return; - prop->value = value; -} - -QScriptValue::PropertyFlags TestClass::propertyFlags( - const QScriptValue &/*object*/, const QScriptString &name, uint /*id*/) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return 0; - return prop->pflags; -} - -QScriptClassPropertyIterator *TestClass::newIterator(const QScriptValue &object) -{ - if (!m_iterationEnabled) - return 0; - return new TestClassPropertyIterator(customProperties, object); -} - -QScriptValue TestClass::prototype() const -{ - return m_prototype; -} - -QString TestClass::name() const -{ - return QLatin1String("TestClass"); -} - -bool TestClass::supportsExtension(Extension extension) const -{ - if (extension == Callable) - return (m_callableMode != NotCallable); - if (extension == HasInstance) - return m_hasInstance; - return false; -} - -QVariant TestClass::extension(Extension extension, - const QVariant &argument) -{ - if (extension == Callable) { - Q_ASSERT(m_callableMode != NotCallable); - QScriptContext *ctx = qvariant_cast(argument); - if (m_callableMode == CallableReturnsSum) { - qsreal sum = 0; - for (int i = 0; i < ctx->argumentCount(); ++i) - sum += ctx->argument(i).toNumber(); - QScriptValueIterator it(ctx->thisObject()); - while (it.hasNext()) { - it.next(); - sum += it.value().toNumber(); - } - return sum; - } else if (m_callableMode == CallableReturnsArgument) { - return qVariantFromValue(ctx->argument(0)); - } else if (m_callableMode == CallableReturnsInvalidVariant) { - return QVariant(); - } - } else if (extension == HasInstance) { - Q_ASSERT(m_hasInstance); - QScriptValueList args = qvariant_cast(argument); - QScriptValue obj = args.at(0); - QScriptValue value = args.at(1); - return value.property("foo").equals(obj.property("foo")); - } - return QVariant(); -} - -void TestClass::setIterationEnabled(bool enable) -{ - m_iterationEnabled = enable; -} - -bool TestClass::isIterationEnabled() const -{ - return m_iterationEnabled; -} - -void TestClass::setCallableMode(CallableMode mode) -{ - m_callableMode = mode; -} - -TestClass::CallableMode TestClass::callableMode() const -{ - return m_callableMode; -} - -void TestClass::setHasInstance(bool hasInstance) -{ - m_hasInstance = hasInstance; -} - -bool TestClass::hasInstance() const -{ - return m_hasInstance; -} - -TestClassPropertyIterator::TestClassPropertyIterator(const QHash &props, - const QScriptValue &object) - : QScriptClassPropertyIterator(object) -{ - m_props = props; - toFront(); -} - -TestClassPropertyIterator::~TestClassPropertyIterator() -{ -} - -bool TestClassPropertyIterator::hasNext() const -{ - return m_index < m_props.size(); -} - -void TestClassPropertyIterator::next() -{ - m_last = m_index; - ++m_index; -} - -bool TestClassPropertyIterator::hasPrevious() const -{ - return m_index > 0; -} - -void TestClassPropertyIterator::previous() -{ - --m_index; - m_last = m_index; -} - -void TestClassPropertyIterator::toFront() -{ - m_index = 0; - m_last = -1; -} - -void TestClassPropertyIterator::toBack() -{ - m_index = m_props.size(); - m_last = -1; -} - -QScriptString TestClassPropertyIterator::name() const -{ - return m_props.keys().value(m_last); -} - -uint TestClassPropertyIterator::id() const -{ - QScriptString key = m_props.keys().value(m_last); - if (!key.isValid()) - return 0; - TestClass::CustomProperty *prop = m_props.value(key); - return prop->id; -} - -QScriptValue::PropertyFlags TestClassPropertyIterator::flags() const -{ - QScriptString key = m_props.keys().value(m_last); - if (!key.isValid()) - return 0; - TestClass::CustomProperty *prop = m_props.value(key); - return prop->pflags; -} - -class tst_QScriptClass : public QObject -{ - Q_OBJECT - -public: - tst_QScriptClass(); - virtual ~tst_QScriptClass(); - -public slots: - void init(); - void cleanup(); - -private slots: - void noSuchProperty(); - void property(); - void setProperty(); - void propertyFlags(); - void call(); - void hasInstance(); - void iterate(); -}; - -tst_QScriptClass::tst_QScriptClass() -{ -} - -tst_QScriptClass::~tst_QScriptClass() -{ -} - -void tst_QScriptClass::init() -{ -} - -void tst_QScriptClass::cleanup() -{ -} - -void tst_QScriptClass::noSuchProperty() -{ - QScriptEngine eng; - TestClass cls(&eng); - QScriptValue obj = eng.newObject(&cls); - QString propertyName = QString::fromLatin1("foo"); - QBENCHMARK { - (void)obj.property(propertyName); - } -} - -void tst_QScriptClass::property() -{ - QScriptEngine eng; - TestClass cls(&eng); - QScriptString foo = eng.toStringHandle("foo"); - cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); - QScriptValue obj = eng.newObject(&cls); - QBENCHMARK { - (void)obj.property(foo); - } -} - -void tst_QScriptClass::setProperty() -{ - QScriptEngine eng; - TestClass cls(&eng); - QScriptString foo = eng.toStringHandle("foo"); - cls.addCustomProperty(foo, QScriptClass::HandlesWriteAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); - QScriptValue obj = eng.newObject(&cls); - QScriptValue value(456); - QBENCHMARK { - obj.setProperty(foo, value); - } -} - -void tst_QScriptClass::propertyFlags() -{ - QScriptEngine eng; - TestClass cls(&eng); - QScriptString foo = eng.toStringHandle("foo"); - cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, QScriptValue::ReadOnly, /*value=*/123); - QScriptValue obj = eng.newObject(&cls); - QBENCHMARK { - (void)obj.propertyFlags(foo); - } -} - -void tst_QScriptClass::call() -{ - QScriptEngine eng; - TestClass cls(&eng); - cls.setCallableMode(TestClass::CallableReturnsArgument); - QScriptValue obj = eng.newObject(&cls); - QScriptValue thisObject; - QScriptValueList args; - args.append(123); - QBENCHMARK { - (void)obj.call(thisObject, args); - } -} - -void tst_QScriptClass::hasInstance() -{ - QScriptEngine eng; - TestClass cls(&eng); - cls.setHasInstance(true); - QScriptValue obj = eng.newObject(&cls); - obj.setProperty("foo", 123); - QScriptValue plain = eng.newObject(); - plain.setProperty("foo", obj.property("foo")); - QBENCHMARK { - (void)plain.instanceOf(obj); - } -} - -void tst_QScriptClass::iterate() -{ - QScriptEngine eng; - TestClass cls(&eng); - cls.setIterationEnabled(true); - cls.addCustomProperty(eng.toStringHandle("foo"), QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); - cls.addCustomProperty(eng.toStringHandle("bar"), QScriptClass::HandlesReadAccess, /*id=*/2, /*attributes=*/0, /*value=*/456); - QScriptValue obj = eng.newObject(&cls); - QBENCHMARK { - QScriptValueIterator it(obj); - while (it.hasNext()) { - it.next(); - (void)it.scriptName(); - } - } -} - -QTEST_MAIN(tst_QScriptClass) -#include "tst_qscriptclass.moc" diff --git a/tests/benchmarks/qscriptengine/qscriptengine.pro b/tests/benchmarks/qscriptengine/qscriptengine.pro deleted file mode 100644 index df6dbb3..0000000 --- a/tests/benchmarks/qscriptengine/qscriptengine.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qscriptengine - -SOURCES += tst_qscriptengine.cpp - -QT += script - -symbian* { - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB - TARGET.EPOCSTACKSIZE = 0x14000 -} diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp deleted file mode 100644 index 6c6f0b1..0000000 --- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp +++ /dev/null @@ -1,289 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//TESTED_FILES= - -class tst_QScriptEngine : public QObject -{ - Q_OBJECT - -public: - tst_QScriptEngine(); - virtual ~tst_QScriptEngine(); - -public slots: - void init(); - void cleanup(); - -private slots: - void constructor(); - void evaluate_data(); - void evaluate(); - void evaluateProgram_data(); - void evaluateProgram(); - void connectAndDisconnect(); - void newObject(); - void newQObject(); - void newFunction(); - void newVariant(); - void collectGarbage(); - void pushAndPopContext(); - void toStringHandle(); - void castValueToQreal(); - void nativeCall(); - void translation_data(); - void translation(); -}; - -tst_QScriptEngine::tst_QScriptEngine() -{ -} - -tst_QScriptEngine::~tst_QScriptEngine() -{ -} - -void tst_QScriptEngine::init() -{ -} - -void tst_QScriptEngine::cleanup() -{ -} - -void tst_QScriptEngine::constructor() -{ - QBENCHMARK { - QScriptEngine engine; - (void)engine.parent(); - } -} - -void tst_QScriptEngine::evaluate_data() -{ - QTest::addColumn("code"); - QTest::newRow("empty script") << QString::fromLatin1(""); - QTest::newRow("number literal") << QString::fromLatin1("123"); - QTest::newRow("string literal") << QString::fromLatin1("'ciao'"); - QTest::newRow("regexp literal") << QString::fromLatin1("/foo/gim"); - QTest::newRow("null literal") << QString::fromLatin1("null"); - QTest::newRow("undefined literal") << QString::fromLatin1("undefined"); - QTest::newRow("null literal") << QString::fromLatin1("null"); - QTest::newRow("empty object literal") << QString::fromLatin1("{}"); - QTest::newRow("this") << QString::fromLatin1("this"); - QTest::newRow("object literal with one property") << QString::fromLatin1("{ foo: 123 }"); - QTest::newRow("object literal with two properties") << QString::fromLatin1("{ foo: 123, bar: 456 }"); - QTest::newRow("object literal with many properties") << QString::fromLatin1("{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10 }"); - QTest::newRow("empty array literal") << QString::fromLatin1("[]"); - QTest::newRow("array literal with one element") << QString::fromLatin1("[1]"); - QTest::newRow("array literal with two elements") << QString::fromLatin1("[1,2]"); - QTest::newRow("array literal with many elements") << QString::fromLatin1("[1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]"); - QTest::newRow("empty function definition") << QString::fromLatin1("function foo() { }"); - QTest::newRow("function definition") << QString::fromLatin1("function foo() { return 123; }"); - QTest::newRow("for loop with empty body (1000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000; ++i) {}"); - QTest::newRow("for loop with empty body (10000 iterations)") << QString::fromLatin1("for (i = 0; i < 10000; ++i) {}"); - QTest::newRow("for loop with empty body (100000 iterations)") << QString::fromLatin1("for (i = 0; i < 100000; ++i) {}"); - QTest::newRow("for loop with empty body (1000000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000000; ++i) {}"); - QTest::newRow("for loop (1000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000; ++i) { j += i; }; j"); - QTest::newRow("for loop (10000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 10000; ++i) { j += i; }; j"); - QTest::newRow("for loop (100000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 100000; ++i) { j += i; }; j"); - QTest::newRow("for loop (1000000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000000; ++i) { j += i; }; j"); - QTest::newRow("assignments") << QString::fromLatin1("a = 1; b = 2; c = 3; d = 4"); - QTest::newRow("while loop (1000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000) { ++i; }; i"); - QTest::newRow("while loop (10000 iterations)") << QString::fromLatin1("i = 0; while (i < 10000) { ++i; }; i"); - QTest::newRow("while loop (100000 iterations)") << QString::fromLatin1("i = 0; while (i < 100000) { ++i; }; i"); - QTest::newRow("while loop (1000000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000000) { ++i; }; i"); - QTest::newRow("function expression") << QString::fromLatin1("(function(a, b, c){ return a + b + c; })(1, 2, 3)"); -} - -void tst_QScriptEngine::evaluate() -{ - QFETCH(QString, code); - QScriptEngine engine; - - QBENCHMARK { - (void)engine.evaluate(code); - } -} - -void tst_QScriptEngine::connectAndDisconnect() -{ - QScriptEngine engine; - QScriptValue fun = engine.evaluate("(function() { })"); - QBENCHMARK { - qScriptConnect(&engine, SIGNAL(destroyed()), QScriptValue(), fun); - qScriptDisconnect(&engine, SIGNAL(destroyed()), QScriptValue(), fun); - } -} - -void tst_QScriptEngine::evaluateProgram_data() -{ - evaluate_data(); -} - -void tst_QScriptEngine::evaluateProgram() -{ - QFETCH(QString, code); - QScriptEngine engine; - QScriptProgram program(code); - - QBENCHMARK { - (void)engine.evaluate(program); - } -} - -void tst_QScriptEngine::newObject() -{ - QScriptEngine engine; - QBENCHMARK { - (void)engine.newObject(); - } -} - -void tst_QScriptEngine::newQObject() -{ - QScriptEngine engine; - QBENCHMARK { - (void)engine.newQObject(QCoreApplication::instance()); - } -} - -static QScriptValue testFunction(QScriptContext *, QScriptEngine *) -{ - return 0; -} - -void tst_QScriptEngine::newFunction() -{ - QScriptEngine engine; - QBENCHMARK { - (void)engine.newFunction(testFunction); - } -} - -void tst_QScriptEngine::newVariant() -{ - QScriptEngine engine; - QVariant var(123); - QBENCHMARK { - (void)engine.newVariant(var); - } -} - -void tst_QScriptEngine::collectGarbage() -{ - QScriptEngine engine; - QBENCHMARK { - engine.collectGarbage(); - } -} - -void tst_QScriptEngine::pushAndPopContext() -{ - QScriptEngine engine; - QBENCHMARK { - (void)engine.pushContext(); - engine.popContext(); - } -} - -void tst_QScriptEngine::toStringHandle() -{ - QScriptEngine engine; - QString str = QString::fromLatin1("foobarbaz"); - QBENCHMARK { - (void)engine.toStringHandle(str); - } -} - -void tst_QScriptEngine::castValueToQreal() -{ - QScriptEngine engine; - QScriptValue val(123); - QBENCHMARK { - (void)qscriptvalue_cast(val); - } -} - -static QScriptValue native_function(QScriptContext *, QScriptEngine *) -{ - return 42; -} - -void tst_QScriptEngine::nativeCall() -{ - QScriptEngine eng; - eng.globalObject().setProperty("fun", eng.newFunction(native_function)); - QBENCHMARK{ -#if !defined(Q_OS_SYMBIAN) - eng.evaluate("var w = 0; for (i = 0; i < 100000; ++i) {\n" - " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }"); -#else - eng.evaluate("var w = 0; for (i = 0; i < 25000; ++i) {\n" - " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }"); -#endif - } -} - -void tst_QScriptEngine::translation_data() -{ - QTest::addColumn("text"); - QTest::newRow("no translation") << "\"hello world\""; - QTest::newRow("qsTr") << "qsTr(\"hello world\")"; - QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")"; -} - -void tst_QScriptEngine::translation() -{ - QFETCH(QString, text); - QScriptEngine engine; - engine.installTranslatorFunctions(); - - QBENCHMARK { - (void)engine.evaluate(text); - } -} - -QTEST_MAIN(tst_QScriptEngine) -#include "tst_qscriptengine.moc" diff --git a/tests/benchmarks/qscriptvalue/qscriptvalue.pro b/tests/benchmarks/qscriptvalue/qscriptvalue.pro deleted file mode 100644 index 04ea324..0000000 --- a/tests/benchmarks/qscriptvalue/qscriptvalue.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qscriptvalue - -SOURCES += tst_qscriptvalue.cpp - -QT += script diff --git a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp deleted file mode 100644 index 3bfc21c..0000000 --- a/tests/benchmarks/qscriptvalue/tst_qscriptvalue.cpp +++ /dev/null @@ -1,205 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//TESTED_FILES= - -class tst_QScriptValue : public QObject -{ - Q_OBJECT - -public: - tst_QScriptValue(); - virtual ~tst_QScriptValue(); - -public slots: - void init(); - void cleanup(); - -private slots: - void numberConstructor(); - void stringConstructor(); - void call_data(); - void call(); - void construct_data(); - void construct(); - void toString_data(); - void toString(); - void toQObject(); - void property(); - void setProperty(); - void propertyFlags(); -}; - -tst_QScriptValue::tst_QScriptValue() -{ -} - -tst_QScriptValue::~tst_QScriptValue() -{ -} - -void tst_QScriptValue::init() -{ -} - -void tst_QScriptValue::cleanup() -{ -} - -void tst_QScriptValue::numberConstructor() -{ - QBENCHMARK { - (void)QScriptValue(123); - } -} - -void tst_QScriptValue::stringConstructor() -{ - QString str = QString::fromLatin1("ciao"); - QBENCHMARK { - (void)QScriptValue(str); - } -} - -void tst_QScriptValue::call_data() -{ - QTest::addColumn("code"); - QTest::newRow("empty function") << QString::fromLatin1("(function(){})"); - QTest::newRow("function returning number") << QString::fromLatin1("(function(){ return 123; })"); - QTest::newRow("closure") << QString::fromLatin1("(function(a, b){ return function() { return a + b; }; })(1, 2)"); -} - -void tst_QScriptValue::call() -{ - QFETCH(QString, code); - QScriptEngine engine; - QScriptValue fun = engine.evaluate(code); - QVERIFY(fun.isFunction()); - QBENCHMARK { - (void)fun.call(); - } -} - -void tst_QScriptValue::construct_data() -{ - QTest::addColumn("code"); - QTest::newRow("empty function") << QString::fromLatin1("(function(){})"); - QTest::newRow("simple constructor") << QString::fromLatin1("(function(){ this.x = 10; this.y = 20; })"); -} - -void tst_QScriptValue::construct() -{ - QFETCH(QString, code); - QScriptEngine engine; - QScriptValue fun = engine.evaluate(code); - QVERIFY(fun.isFunction()); - QBENCHMARK { - (void)fun.construct(); - } -} - -void tst_QScriptValue::toString_data() -{ - QTest::addColumn("code"); - QTest::newRow("number") << QString::fromLatin1("123"); - QTest::newRow("string") << QString::fromLatin1("'ciao'"); - QTest::newRow("null") << QString::fromLatin1("null"); - QTest::newRow("undefined") << QString::fromLatin1("undefined"); - QTest::newRow("function") << QString::fromLatin1("(function foo(a, b, c) { return a + b + c; })"); -} - -void tst_QScriptValue::toString() -{ - QFETCH(QString, code); - QScriptEngine engine; - QScriptValue val = engine.evaluate(code); - QBENCHMARK { - (void)val.toString(); - } -} - -void tst_QScriptValue::toQObject() -{ - QScriptEngine engine; - QScriptValue obj = engine.newQObject(QCoreApplication::instance()); - QBENCHMARK { - (void)obj.toQObject(); - } -} - -void tst_QScriptValue::property() -{ - QScriptEngine engine; - QScriptValue obj = engine.newObject(); - QString propertyName = QString::fromLatin1("foo"); - obj.setProperty(propertyName, 123); - QBENCHMARK { - (void)obj.property(propertyName); - } -} - -void tst_QScriptValue::setProperty() -{ - QScriptEngine engine; - QScriptValue obj = engine.newObject(); - QString propertyName = QString::fromLatin1("foo"); - QScriptValue val(123); - QBENCHMARK { - obj.setProperty(propertyName, val); - } -} - -void tst_QScriptValue::propertyFlags() -{ - QScriptEngine engine; - QScriptValue obj = engine.newObject(); - QString propertyName = QString::fromLatin1("foo"); - obj.setProperty(propertyName, 123, QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly); - QBENCHMARK { - (void)obj.propertyFlags(propertyName); - } -} - -QTEST_MAIN(tst_QScriptValue) -#include "tst_qscriptvalue.moc" diff --git a/tests/benchmarks/qstring/main.cpp b/tests/benchmarks/qstring/main.cpp deleted file mode 100644 index 12826eb..0000000 --- a/tests/benchmarks/qstring/main.cpp +++ /dev/null @@ -1,147 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include - -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -// Application private dir is default serach path for files, so SRCDIR can be set to empty -#define SRCDIR "" -#endif - -class tst_QString: public QObject -{ - Q_OBJECT -private slots: - void equals() const; - void equals_data() const; - void fromUtf8() const; -}; - -void tst_QString::equals() const -{ - QFETCH(QString, a); - QFETCH(QString, b); - - QBENCHMARK { - a == b; - } -} - -void tst_QString::equals_data() const -{ - static const struct { - ushort data[80]; - int dummy; // just to ensure 4-byte alignment - } data = { - { - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, // 16 - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, // 32 - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, // 48 - 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, // 64 - 64, 64, 64, 64, 96, 96, 96, 96, - 64, 64, 96, 96, 96, 96, 96, 96 // 80 - }, 0 - }; - const QChar *ptr = reinterpret_cast(data.data); - - QTest::addColumn("a"); - QTest::addColumn("b"); - QString base = QString::fromRawData(ptr, 64); - - QTest::newRow("different-length") << base << QString::fromRawData(ptr, 4); - QTest::newRow("same-string") << base << base; - QTest::newRow("same-data") << base << QString::fromRawData(ptr, 64); - - // try to avoid crossing a cache line (that is, at ptr[64]) - QTest::newRow("aligned-aligned-4n") - << QString::fromRawData(ptr, 60) << QString::fromRawData(ptr + 2, 60); - QTest::newRow("aligned-unaligned-4n") - << QString::fromRawData(ptr, 60) << QString::fromRawData(ptr + 1, 60); - QTest::newRow("unaligned-unaligned-4n") - << QString::fromRawData(ptr + 1, 60) << QString::fromRawData(ptr + 3, 60); - - QTest::newRow("aligned-aligned-4n+1") - << QString::fromRawData(ptr, 61) << QString::fromRawData(ptr + 2, 61); - QTest::newRow("aligned-unaligned-4n+1") - << QString::fromRawData(ptr, 61) << QString::fromRawData(ptr + 1, 61); - QTest::newRow("unaligned-unaligned-4n+1") - << QString::fromRawData(ptr + 1, 61) << QString::fromRawData(ptr + 3, 61); - - QTest::newRow("aligned-aligned-4n-1") - << QString::fromRawData(ptr, 59) << QString::fromRawData(ptr + 2, 59); - QTest::newRow("aligned-unaligned-4n-1") - << QString::fromRawData(ptr, 59) << QString::fromRawData(ptr + 1, 59); - QTest::newRow("unaligned-unaligned-4n-1") - << QString::fromRawData(ptr + 1, 59) << QString::fromRawData(ptr + 3, 59); - - QTest::newRow("aligned-aligned-2n") - << QString::fromRawData(ptr, 58) << QString::fromRawData(ptr + 2, 58); - QTest::newRow("aligned-unaligned-2n") - << QString::fromRawData(ptr, 58) << QString::fromRawData(ptr + 1, 58); - QTest::newRow("unaligned-unaligned-2n") - << QString::fromRawData(ptr + 1, 58) << QString::fromRawData(ptr + 3, 58); -} - -void tst_QString::fromUtf8() const -{ - QFile file(SRCDIR "utf-8.txt"); - if (!file.open(QFile::ReadOnly)) { - qFatal("Cannot open input file"); - return; - } - QByteArray data = file.readAll(); - const char *d = data.constData(); - int size = data.size(); - - QBENCHMARK { - QString::fromUtf8(d, size); - } -} - -QTEST_MAIN(tst_QString) - -#include "main.moc" diff --git a/tests/benchmarks/qstring/qstring.pro b/tests/benchmarks/qstring/qstring.pro deleted file mode 100644 index 2e7c86a..0000000 --- a/tests/benchmarks/qstring/qstring.pro +++ /dev/null @@ -1,16 +0,0 @@ -load(qttest_p4) -TARGET = tst_qstring -QT -= gui -SOURCES += main.cpp - -wince*:{ - DEFINES += SRCDIR=\\\"\\\" -} else:symbian* { - addFiles.sources = utf-8.txt - addFiles.path = . - DEPLOYMENT += addFiles - TARGET.EPOCHEAPSIZE="0x100 0x1000000" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - diff --git a/tests/benchmarks/qstring/utf-8.txt b/tests/benchmarks/qstring/utf-8.txt deleted file mode 100644 index a8a58de..0000000 --- a/tests/benchmarks/qstring/utf-8.txt +++ /dev/null @@ -1,72 +0,0 @@ -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français -SprÃ¥k: Norsk -Γλώσσα: Ελληνικά -Язык: РуÑÑкий -언어 : 한국어 -言語: 日本語 -Langage : Français diff --git a/tests/benchmarks/qstringbuilder/main.cpp b/tests/benchmarks/qstringbuilder/main.cpp deleted file mode 100644 index 9bd146f..0000000 --- a/tests/benchmarks/qstringbuilder/main.cpp +++ /dev/null @@ -1,464 +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 test suite 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$ -** -****************************************************************************/ - -// Select one of the scenarios below -#define SCENARIO 1 - -#if SCENARIO == 1 -// this is the "no harm done" version. Only operator% is active, -// with NO_CAST * defined -#define P % -#undef QT_USE_FAST_OPERATOR_PLUS -#undef QT_USE_FAST_CONCATENATION -#define QT_NO_CAST_FROM_ASCII -#define QT_NO_CAST_TO_ASCII -#endif - - -#if SCENARIO == 2 -// this is the "full" version. Operator+ is replaced by a QStringBuilder -// based version -// with NO_CAST * defined -#define P + -#define QT_USE_FAST_OPERATOR_PLUS -#define QT_USE_FAST_CONCATENATION -#define QT_NO_CAST_FROM_ASCII -#define QT_NO_CAST_TO_ASCII -#endif - -#if SCENARIO == 3 -// this is the "no harm done" version. Only operator% is active, -// with NO_CAST * _not_ defined -#define P % -#undef QT_USE_FAST_OPERATOR_PLUS -#undef QT_USE_FAST_CONCATENATION -#undef QT_NO_CAST_FROM_ASCII -#undef QT_NO_CAST_TO_ASCII -#endif - -#if SCENARIO == 4 -// this is the "full" version. Operator+ is replaced by a QStringBuilder -// based version -// with NO_CAST * _not_ defined -#define P + -#define QT_USE_FAST_OPERATOR_PLUS -#define QT_USE_FAST_CONCATENATION -#undef QT_NO_CAST_FROM_ASCII -#undef QT_NO_CAST_TO_ASCII -#endif - - -#include -#include -#include -#include - -#include - -#include - -#define COMPARE(a, b) QCOMPARE(a, b) -//#define COMPARE(a, b) - -#define SEP(s) qDebug() << "\n\n-------- " s " ---------"; - -#define LITERAL "some string literal" - -class tst_qstringbuilder : public QObject -{ - Q_OBJECT - -public: - tst_qstringbuilder() - : l1literal(LITERAL), - l1string(LITERAL), - ba(LITERAL), - string(l1string), - stdstring(LITERAL), - stringref(&string, 2, 10), - achar('c'), - r2(QLatin1String(LITERAL LITERAL)), - r3(QLatin1String(LITERAL LITERAL LITERAL)), - r4(QLatin1String(LITERAL LITERAL LITERAL LITERAL)), - r5(QLatin1String(LITERAL LITERAL LITERAL LITERAL LITERAL)) - {} - - -public: - enum { N = 10000 }; - - int run_traditional() - { - int s = 0; - for (int i = 0; i < N; ++i) { -#if 0 - s += QString(l1string + l1string).size(); - s += QString(l1string + l1string + l1string).size(); - s += QString(l1string + l1string + l1string + l1string).size(); - s += QString(l1string + l1string + l1string + l1string + l1string).size(); -#endif - s += QString(achar + l1string + achar).size(); - } - return s; - } - - int run_builder() - { - int s = 0; - for (int i = 0; i < N; ++i) { -#if 0 - s += QString(l1literal P l1literal).size(); - s += QString(l1literal P l1literal P l1literal).size(); - s += QString(l1literal P l1literal P l1literal P l1literal).size(); - s += QString(l1literal P l1literal P l1literal P l1literal P l1literal).size(); -#endif - s += QString(achar % l1literal % achar).size(); - } - return s; - } - -private slots: - - void separator_0() { - qDebug() << "\nIn each block the QStringBuilder based result appear first " - "(with a 'b_' prefix), QStringBased second ('q_' prefix), std::string " - "last ('s_' prefix)\n"; - } - - void separator_1() { SEP("literal + literal (builder first)"); } - - void b_2_l1literal() { - QBENCHMARK { r = l1literal P l1literal; } - COMPARE(r, r2); - } - #ifndef QT_NO_CAST_FROM_ASCII - void b_l1literal_LITERAL() { - QBENCHMARK { r = l1literal P LITERAL; } - COMPARE(r, r2); - } - #endif - void q_2_l1string() { - QBENCHMARK { r = l1string + l1string; } - COMPARE(r, r2); - } - - - void separator_2() { SEP("2 strings"); } - - void b_2_string() { - QBENCHMARK { r = string P string; } - COMPARE(r, r2); - } - void q_2_string() { - QBENCHMARK { r = string + string; } - COMPARE(r, r2); - } - void s_2_string() { - QBENCHMARK { stdr = stdstring + stdstring; } - COMPARE(stdr, stdstring + stdstring); - } - - - void separator_2c() { SEP("2 string refs"); } - - void b_2_stringref() { - QBENCHMARK { r = stringref % stringref; } - COMPARE(r, QString(stringref.toString() + stringref.toString())); - } - void q_2_stringref() { - QBENCHMARK { r = stringref.toString() + stringref.toString(); } - COMPARE(r, QString(stringref % stringref)); - } - - - void separator_2b() { SEP("3 strings"); } - - void b_3_string() { - QBENCHMARK { r = string P string P string; } - COMPARE(r, r3); - } - void q_3_string() { - QBENCHMARK { r = string + string + string; } - COMPARE(r, r3); - } - void s_3_string() { - QBENCHMARK { stdr = stdstring + stdstring + stdstring; } - COMPARE(stdr, stdstring + stdstring + stdstring); - } - - void separator_2e() { SEP("4 strings"); } - - void b_4_string() { - QBENCHMARK { r = string P string P string P string; } - COMPARE(r, r4); - } - void q_4_string() { - QBENCHMARK { r = string + string + string + string; } - COMPARE(r, r4); - } - void s_4_string() { - QBENCHMARK { stdr = stdstring + stdstring + stdstring + stdstring; } - COMPARE(stdr, stdstring + stdstring + stdstring + stdstring); - } - - - - void separator_2a() { SEP("string + literal (builder first)"); } - - void b_string_l1literal() { - QBENCHMARK { r = string % l1literal; } - COMPARE(r, r2); - } - #ifndef QT_NO_CAST_FROM_ASCII - void b_string_LITERAL() { - QBENCHMARK { r = string P LITERAL; } - COMPARE(r, r2); - } - void b_LITERAL_string() { - QBENCHMARK { r = LITERAL P string; } - COMPARE(r, r2); - } - #endif - void b_string_l1string() { - QBENCHMARK { r = string P l1string; } - COMPARE(r, r2); - } - void q_string_l1literal() { - QBENCHMARK { r = string + l1string; } - COMPARE(r, r2); - } - void q_string_l1string() { - QBENCHMARK { r = string + l1string; } - COMPARE(r, r2); - } - void s_LITERAL_string() { - QBENCHMARK { stdr = LITERAL + stdstring; } - COMPARE(stdr, stdstring + stdstring); - } - - - void separator_3() { SEP("3 literals"); } - - void b_3_l1literal() { - QBENCHMARK { r = l1literal P l1literal P l1literal; } - COMPARE(r, r3); - } - void q_3_l1string() { - QBENCHMARK { r = l1string + l1string + l1string; } - COMPARE(r, r3); - } - void s_3_l1string() { - QBENCHMARK { stdr = stdstring + LITERAL + LITERAL; } - COMPARE(stdr, stdstring + stdstring + stdstring); - } - - - void separator_4() { SEP("4 literals"); } - - void b_4_l1literal() { - QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal; } - COMPARE(r, r4); - } - void q_4_l1string() { - QBENCHMARK { r = l1string + l1string + l1string + l1string; } - COMPARE(r, r4); - } - - - void separator_5() { SEP("5 literals"); } - - void b_5_l1literal() { - QBENCHMARK { r = l1literal P l1literal P l1literal P l1literal P l1literal; } - COMPARE(r, r5); - } - - void q_5_l1string() { - QBENCHMARK { r = l1string + l1string + l1string + l1string + l1string; } - COMPARE(r, r5); - } - - - void separator_6() { SEP("4 chars"); } - - void b_string_4_char() { - QBENCHMARK { r = string + achar + achar + achar + achar; } - COMPARE(r, QString(string P achar P achar P achar P achar)); - } - - void q_string_4_char() { - QBENCHMARK { r = string + achar + achar + achar + achar; } - COMPARE(r, QString(string P achar P achar P achar P achar)); - } - - void s_string_4_char() { - QBENCHMARK { stdr = stdstring + 'c' + 'c' + 'c' + 'c'; } - COMPARE(stdr, stdstring + 'c' + 'c' + 'c' + 'c'); - } - - - void separator_7() { SEP("char + string + char"); } - - void b_char_string_char() { - QBENCHMARK { r = achar + string + achar; } - COMPARE(r, QString(achar P string P achar)); - } - - void q_char_string_char() { - QBENCHMARK { r = achar + string + achar; } - COMPARE(r, QString(achar P string P achar)); - } - - void s_char_string_char() { - QBENCHMARK { stdr = 'c' + stdstring + 'c'; } - COMPARE(stdr, 'c' + stdstring + 'c'); - } - - - void separator_8() { SEP("string.arg"); } - - void b_string_arg() { - const QString pattern = l1string + QString::fromLatin1("%1") + l1string; - QBENCHMARK { r = l1literal P string P l1literal; } - COMPARE(r, r3); - } - - void q_string_arg() { - const QString pattern = l1string + QLatin1String("%1") + l1string; - QBENCHMARK { r = pattern.arg(string); } - COMPARE(r, r3); - } - - void q_bytearray_arg() { - QByteArray result; - QBENCHMARK { result = ba + ba + ba; } - } - - - void separator_9() { SEP("QString::reserve()"); } - - void b_reserve() { - QBENCHMARK { - r.clear(); - r = string P string P string P string; - } - COMPARE(r, r4); - } - void b_reserve_lit() { - QBENCHMARK { - r.clear(); - r = string P l1literal P string P string; - } - COMPARE(r, r4); - } - void s_reserve() { - QBENCHMARK { - r.clear(); - r.reserve(string.size() + string.size() + string.size() + string.size()); - r += string; - r += string; - r += string; - r += string; - } - COMPARE(r, r4); - } - void s_reserve_lit() { - QBENCHMARK { - r.clear(); - //r.reserve(string.size() + qstrlen(l1string.latin1()) - // + string.size() + string.size()); - r.reserve(1024); - r += string; - r += l1string; - r += string; - r += string; - } - COMPARE(r, r4); - } - -private: - const QLatin1Literal l1literal; - const QLatin1String l1string; - const QByteArray ba; - const QString string; - const std::string stdstring; - const QStringRef stringref; - const QLatin1Char achar; - const QString r2, r3, r4, r5; - - // short cuts for results - QString r; - std::string stdr; -}; - - -//void operator%(QString, int) {} - -int main(int argc, char *argv[]) -{ - //qDebug() << (QString("xx") * QLatin1String("y")).toString(); - //42 % 3; // Sanity test, should always work. - //QString("x") % 2; // Sanity test, should only compile when the - // operator%(QString, int) is visible. - - if (argc == 2 && (QLatin1String(argv[1]) == QLatin1String("--run-builder") - || QLatin1String(argv[1]) == QLatin1String("-b"))) { - tst_qstringbuilder test; - return test.run_builder(); - } - - if (argc == 2 && (QLatin1String(argv[1]) == QLatin1String("--run-traditional") - || QLatin1String(argv[1]) == QLatin1String("-t"))) { - tst_qstringbuilder test; - return test.run_traditional(); - } - - if (argc == 1) { - QCoreApplication app(argc, argv); - QStringList args = app.arguments(); - tst_qstringbuilder test; - return QTest::qExec(&test, argc, argv); - } - - qDebug() << "Usage: " << argv[0] << " [--run-builder|-r|--run-traditional|-t]"; -} - - -#include "main.moc" diff --git a/tests/benchmarks/qstringbuilder/qstringbuilder.pro b/tests/benchmarks/qstringbuilder/qstringbuilder.pro deleted file mode 100644 index 79171b4..0000000 --- a/tests/benchmarks/qstringbuilder/qstringbuilder.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qstringbuilder - -QMAKE_CXXFLAGS += -g -QMAKE_CFLAGS += -g - -QT -= gui - -CONFIG += release - -SOURCES += main.cpp diff --git a/tests/benchmarks/qstringlist/.gitignore b/tests/benchmarks/qstringlist/.gitignore deleted file mode 100644 index 3e0cdc9..0000000 --- a/tests/benchmarks/qstringlist/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tst_qstringlist diff --git a/tests/benchmarks/qstringlist/main.cpp b/tests/benchmarks/qstringlist/main.cpp deleted file mode 100644 index 3fac598..0000000 --- a/tests/benchmarks/qstringlist/main.cpp +++ /dev/null @@ -1,193 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include -#include - -class tst_QStringList: public QObject -{ - Q_OBJECT - -private slots: - void join() const; - void join_data() const; - - void split() const; - void split_data() const; - - void split_std() const; - void split_std_data() const { return split_data(); } - - void split_stdw() const; - void split_stdw_data() const { return split_data(); } - - void split_ba() const; - void split_ba_data() const { return split_data(); } - -private: - static QStringList populateList(const int count, const QString &unit); - static QString populateString(const int count, const QString &unit); -}; - -QStringList tst_QStringList::populateList(const int count, const QString &unit) -{ - QStringList retval; - - for (int i = 0; i < count; ++i) - retval.append(unit); - - return retval; -} - -QString tst_QStringList::populateString(const int count, const QString &unit) -{ - QString retval; - - for (int i = 0; i < count; ++i) { - retval.append(unit); - retval.append(QLatin1Char(':')); - } - - return retval; -} - -void tst_QStringList::join() const -{ - QFETCH(QStringList, input); - QFETCH(QString, separator); - - QBENCHMARK { - input.join(separator); - } -} - -void tst_QStringList::join_data() const -{ - QTest::addColumn("input"); - QTest::addColumn("separator"); - - QTest::newRow("") - << populateList(100, QLatin1String("unit")) - << QString(); - - QTest::newRow("") - << populateList(1000, QLatin1String("unit")) - << QString(); - - QTest::newRow("") - << populateList(10000, QLatin1String("unit")) - << QString(); - - QTest::newRow("") - << populateList(100000, QLatin1String("unit")) - << QString(); -} - -void tst_QStringList::split() const -{ - QFETCH(QString, input); - const QChar splitChar = ':'; - - QBENCHMARK { - input.split(splitChar); - } -} - -void tst_QStringList::split_data() const -{ - QTest::addColumn("input"); - QString unit = QLatin1String("unit"); - QTest::newRow("") << populateString(10, unit); - QTest::newRow("") << populateString(100, unit); - QTest::newRow("") << populateString(1000, unit); - QTest::newRow("") << populateString(10000, unit); -} - -void tst_QStringList::split_std() const -{ - QFETCH(QString, input); - const char split_char = ':'; - std::string stdinput = input.toStdString(); - - QBENCHMARK { - std::istringstream split(stdinput); - std::vector token; - for (std::string each; - std::getline(split, each, split_char); - token.push_back(each)) - ; - } -} - -void tst_QStringList::split_stdw() const -{ - QFETCH(QString, input); - const wchar_t split_char = ':'; - std::wstring stdinput = input.toStdWString(); - - QBENCHMARK { - std::wistringstream split(stdinput); - std::vector token; - for (std::wstring each; - std::getline(split, each, split_char); - token.push_back(each)) - ; - } -} - -void tst_QStringList::split_ba() const -{ - QFETCH(QString, input); - const char splitChar = ':'; - QByteArray ba = input.toLatin1(); - - QBENCHMARK { - ba.split(splitChar); - } -} - -QTEST_MAIN(tst_QStringList) - -#include "main.moc" diff --git a/tests/benchmarks/qstringlist/qstringlist.pro b/tests/benchmarks/qstringlist/qstringlist.pro deleted file mode 100644 index 11cceb0..0000000 --- a/tests/benchmarks/qstringlist/qstringlist.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TARGET = tst_qstringlist -QT -= gui -SOURCES += main.cpp - -symbian: LIBS += -llibpthread diff --git a/tests/benchmarks/qstylesheetstyle/main.cpp b/tests/benchmarks/qstylesheetstyle/main.cpp deleted file mode 100644 index 226b661..0000000 --- a/tests/benchmarks/qstylesheetstyle/main.cpp +++ /dev/null @@ -1,192 +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 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 QRect/QRectF functions. - -#include -#include - -class tst_qstylesheetstyle : public QObject -{ - Q_OBJECT -private slots: - void empty(); - void empty_events(); - - void simple(); - void simple_events(); - - void grid_data(); - void grid(); - -private: - QWidget *buildSimpleWidgets(); - -}; - - -QWidget *tst_qstylesheetstyle::buildSimpleWidgets() -{ - QWidget *w = new QWidget(); - QGridLayout *layout = new QGridLayout(w); - w->setLayout(layout); - layout->addWidget(new QPushButton("pushButton") ,0,0); - layout->addWidget(new QComboBox() ,0,1); - layout->addWidget(new QCheckBox("checkBox") ,0,2); - layout->addWidget(new QRadioButton("radioButton") ,0,3); - layout->addWidget(new QLineEdit() ,1,0); - layout->addWidget(new QLabel("label") ,1,1); - layout->addWidget(new QSpinBox() ,1,2); - layout->addWidget(new QProgressBar() ,1,3); - return w; -} - -void tst_qstylesheetstyle::empty() -{ - QWidget *w = buildSimpleWidgets(); - w->setStyleSheet("/* */"); - int i = 0; - QBENCHMARK { - w->setStyleSheet("/*" + QString::number(i) + "*/"); - i++; // we want a different string in case we have severals iterations - } - delete w; -} - -void tst_qstylesheetstyle::empty_events() -{ - QWidget *w = buildSimpleWidgets(); - w->setStyleSheet("/* */"); - int i = 0; - QBENCHMARK { - w->setStyleSheet("/*" + QString::number(i) + "*/"); - i++; // we want a different string in case we have severals iterations - qApp->processEvents(); - } - delete w; -} - -static const char *simple_css = - " QLineEdit { background: red; } QPushButton { border: 1px solid yellow; color: pink; } \n" - " QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n" - " QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; } "; - -void tst_qstylesheetstyle::simple() -{ - QWidget *w = buildSimpleWidgets(); - w->setStyleSheet("/* */"); - int i = 0; - QBENCHMARK { - w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); - i++; // we want a different string in case we have severals iterations - } - delete w; -} - -void tst_qstylesheetstyle::simple_events() -{ - QWidget *w = buildSimpleWidgets(); - w->setStyleSheet("/* */"); - int i = 0; - QBENCHMARK { - w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); - i++; // we want a different string in case we have severals iterations - qApp->processEvents(); - } - delete w; -} - -void tst_qstylesheetstyle::grid_data() -{ - QTest::addColumn("events"); - QTest::addColumn("show"); - QTest::addColumn("N"); - for (int n = 5; n <= 25; n += 5) { - const QByteArray nString = QByteArray::number(n*n); - QTest::newRow(("simple--" + nString).constData()) << false << false << n; - QTest::newRow(("events--" + nString).constData()) << true << false << n; - QTest::newRow(("show--" + nString).constData()) << true << true << n; - } -} - - -void tst_qstylesheetstyle::grid() -{ - QFETCH(bool, events); - QFETCH(bool, show); - QFETCH(int, N); - -#ifdef Q_OS_SYMBIAN - // Symbian has limited stack (max 80k), which will run out when N >= 20 due to - // QWidget::show() using recursion among grid labels somewhere down the line. - if (show && N >= 20) - QSKIP("Grid too big for device to show", SkipSingle); -#endif - - QWidget *w = new QWidget(); - QGridLayout *layout = new QGridLayout(w); - w->setLayout(layout); - QString stylesheet; - for(int x=0; xaddWidget(label ,x,y); - label->setObjectName(QString("label%1").arg(y * N + x)); - stylesheet += QString("#label%1 { background-color: rgb(0,%2,%3); color: rgb(%2,%3,255); } ").arg(y*N+x).arg(y*255/N).arg(x*255/N); - } - - w->setStyleSheet("/* */"); - if(show) { - w->show(); - QTest::qWait(30); - } - int i = 0; - QBENCHMARK { - w->setStyleSheet(stylesheet + "/*" + QString::number(i) + "*/"); - i++; // we want a different string in case we have severals iterations - if(events) - qApp->processEvents(); - } - delete w; -} - -QTEST_MAIN(tst_qstylesheetstyle) - -#include "main.moc" diff --git a/tests/benchmarks/qstylesheetstyle/qstylesheetstyle.pro b/tests/benchmarks/qstylesheetstyle/qstylesheetstyle.pro deleted file mode 100644 index c097307..0000000 --- a/tests/benchmarks/qstylesheetstyle/qstylesheetstyle.pro +++ /dev/null @@ -1,11 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qstylesheetstyle -DEPENDPATH += . -INCLUDEPATH += . - - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qsvgrenderer/data/tiger.svg b/tests/benchmarks/qsvgrenderer/data/tiger.svg deleted file mode 100644 index 983e570..0000000 --- a/tests/benchmarks/qsvgrenderer/data/tiger.svg +++ /dev/null @@ -1,730 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/benchmarks/qsvgrenderer/qsvgrenderer.pro b/tests/benchmarks/qsvgrenderer/qsvgrenderer.pro deleted file mode 100644 index 8222a09..0000000 --- a/tests/benchmarks/qsvgrenderer/qsvgrenderer.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qsvgrenderer - -SOURCES += tst_qsvgrenderer.cpp -RESOURCES += qsvgrenderer.qrc - -QT += svg - diff --git a/tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc b/tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc deleted file mode 100644 index bdf4a31..0000000 --- a/tests/benchmarks/qsvgrenderer/qsvgrenderer.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - data/tiger.svg - - - diff --git a/tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp deleted file mode 100644 index 895ffe0..0000000 --- a/tests/benchmarks/qsvgrenderer/tst_qsvgrenderer.cpp +++ /dev/null @@ -1,103 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include -#include - -//TESTED_FILES= - -class tst_QSvgRenderer : public QObject -{ - Q_OBJECT - -public: - tst_QSvgRenderer(); - virtual ~tst_QSvgRenderer(); - -public slots: - void init(); - void cleanup(); - -private slots: - void construct(); - void load(); -}; - -tst_QSvgRenderer::tst_QSvgRenderer() -{ -} - -tst_QSvgRenderer::~tst_QSvgRenderer() -{ -} - -void tst_QSvgRenderer::init() -{ -} - -void tst_QSvgRenderer::cleanup() -{ -} - -void tst_QSvgRenderer::construct() -{ - QBENCHMARK { - QSvgRenderer renderer; - } -} - -void tst_QSvgRenderer::load() -{ - QFile file(":/data/tiger.svg"); - if (!file.open(QFile::ReadOnly)) - QFAIL("Can not open tiger.svg"); - QByteArray data = file.readAll(); - QSvgRenderer renderer; - - QBENCHMARK { - renderer.load(data); - } -} - -QTEST_MAIN(tst_QSvgRenderer) -#include "tst_qsvgrenderer.moc" diff --git a/tests/benchmarks/qtableview/qtableview.pro b/tests/benchmarks/qtableview/qtableview.pro deleted file mode 100644 index 02bc530..0000000 --- a/tests/benchmarks/qtableview/qtableview.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qtableview - -SOURCES += tst_qtableview.cpp - diff --git a/tests/benchmarks/qtableview/tst_qtableview.cpp b/tests/benchmarks/qtableview/tst_qtableview.cpp deleted file mode 100644 index a84d8b5..0000000 --- a/tests/benchmarks/qtableview/tst_qtableview.cpp +++ /dev/null @@ -1,367 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -//TESTED_FILES= - -class QtTestTableModel: public QAbstractTableModel -{ - Q_OBJECT - - -public: - QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = 0) - : QAbstractTableModel(parent), - row_count(rows), - column_count(columns) {} - - int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; } - int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; } - bool isEditable(const QModelIndex &) const { return true; } - - QVariant data(const QModelIndex &idx, int role) const - { - if (!idx.isValid() || idx.row() >= row_count || idx.column() >= column_count) { - qWarning() << "Invalid modelIndex [%d,%d,%p]" << idx; - return QVariant(); - } - - if (role == Qt::DisplayRole || role == Qt::EditRole) - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(0); - - return QVariant(); - } - - bool insertRows(int start, int count, const QModelIndex &parent = QModelIndex()) - { - if (start < 0 || start > row_count) - return false; - - beginInsertRows(parent, start, start + count - 1); - row_count += count; - endInsertRows(); - return true; - } - - bool removeRows(int start, int count, const QModelIndex &parent = QModelIndex()) - { - if (start < 0 || start >= row_count || row_count < count) - return false; - - beginRemoveRows(parent, start, start + count - 1); - row_count -= count; - endRemoveRows(); - return true; - } - - bool insertColumns(int start, int count, const QModelIndex &parent = QModelIndex()) - { - if (start < 0 || start > column_count) - return false; - - beginInsertColumns(parent, start, start + count - 1); - column_count += count; - endInsertColumns(); - return true; - } - - bool removeColumns(int start, int count, const QModelIndex &parent = QModelIndex()) - { - if (start < 0 || start >= column_count || column_count < count) - return false; - - beginRemoveColumns(parent, start, start + count - 1); - column_count -= count; - endRemoveColumns(); - return true; - } - - int row_count; - int column_count; -}; - - - - -class tst_QTableView : public QObject -{ - Q_OBJECT - -public: - tst_QTableView(); - virtual ~tst_QTableView(); - -public slots: - void init(); - void cleanup(); - -private slots: - void spanInit(); - void spanDraw(); - void spanSelectColumn(); - void spanSelectAll(); - void rowInsertion_data(); - void rowInsertion(); - void rowRemoval_data(); - void rowRemoval(); - void columnInsertion_data(); - void columnInsertion(); - void columnRemoval_data(); - void columnRemoval(); -private: - static inline void spanInit_helper(QTableView *); -}; - -tst_QTableView::tst_QTableView() -{ -} - -tst_QTableView::~tst_QTableView() -{ -} - -void tst_QTableView::init() -{ -} - -void tst_QTableView::cleanup() -{ -} - -void tst_QTableView::spanInit_helper(QTableView *view) -{ - for (int i=0; i < 40; i++) { - view->setSpan(1+i%2, 1+4*i, 1+i%3, 2); - } - - for (int i=1; i < 40; i++) { - view->setSpan(6 + i*7, 4, 4, 50); - } -} - -void tst_QTableView::spanInit() -{ - QtTestTableModel model(500, 500); - QTableView v; - v.setModel(&model); - - QBENCHMARK { - spanInit_helper(&v); - } -} - -void tst_QTableView::spanDraw() -{ - QtTestTableModel model(500, 500); - QTableView v; - v.setModel(&model); - - spanInit_helper(&v); - v.show(); - v.resize(500,500); - QTest::qWait(30); - - QImage image(500, 500, QImage::Format_ARGB32_Premultiplied); - QPainter painter(&image); - QBENCHMARK { - v.render(&painter); - } -} - -void tst_QTableView::spanSelectAll() -{ - QtTestTableModel model(500, 500); - QTableView v; - v.setModel(&model); - - spanInit_helper(&v); - v.show(); - QTest::qWait(30); - - QBENCHMARK { - v.selectAll(); - } -} - -void tst_QTableView::spanSelectColumn() -{ - QtTestTableModel model(500, 500); - QTableView v; - v.setModel(&model); - - spanInit_helper(&v); - v.show(); - QTest::qWait(30); - - QBENCHMARK { - v.selectColumn(22); - } -} - -typedef QVector SpanList; -Q_DECLARE_METATYPE(SpanList) - -void spansData() -{ - QTest::addColumn("spans"); - - QTest::newRow("Without spans") - << SpanList(); - - QTest::newRow("With spans") - << (SpanList() - << QRect(0, 1, 1, 2) - << QRect(1, 2, 1, 2) - << QRect(2, 2, 1, 5) - << QRect(2, 8, 1, 2) - << QRect(3, 4, 1, 2) - << QRect(4, 4, 1, 4) - << QRect(5, 6, 1, 3) - << QRect(6, 7, 1, 3)); -} - -void tst_QTableView::rowInsertion_data() -{ - spansData(); -} - -void tst_QTableView::rowInsertion() -{ - QFETCH(SpanList, spans); - - QtTestTableModel model(10, 10); - QTableView view; - view.setModel(&model); - - foreach (QRect span, spans) - view.setSpan(span.top(), span.left(), span.height(), span.width()); - view.show(); - QTest::qWait(50); - - QBENCHMARK_ONCE { - view.model()->insertRows(0, 2); - view.model()->insertRows(5, 2); - view.model()->insertRows(8, 2); - view.model()->insertRows(12, 2); - } -} - -void tst_QTableView::rowRemoval_data() -{ - spansData(); -} - -void tst_QTableView::rowRemoval() -{ - QFETCH(SpanList, spans); - - QtTestTableModel model(10, 10); - QTableView view; - view.setModel(&model); - - foreach (QRect span, spans) - view.setSpan(span.top(), span.left(), span.height(), span.width()); - view.show(); - QTest::qWait(50); - - QBENCHMARK_ONCE { - view.model()->removeRows(3, 3); - } -} - -void tst_QTableView::columnInsertion_data() -{ - spansData(); -} - -void tst_QTableView::columnInsertion() -{ - QFETCH(SpanList, spans); - - QtTestTableModel model(10, 10); - QTableView view; - view.setModel(&model); - - // Same set as for rowInsertion, just swapping columns and rows. - foreach (QRect span, spans) - view.setSpan(span.left(), span.top(), span.width(), span.height()); - view.show(); - QTest::qWait(50); - - QBENCHMARK_ONCE { - view.model()->insertColumns(0, 2); - view.model()->insertColumns(5, 2); - view.model()->insertColumns(8, 2); - view.model()->insertColumns(12, 2); - } -} - -void tst_QTableView::columnRemoval_data() -{ - spansData(); -} - -void tst_QTableView::columnRemoval() -{ - QFETCH(SpanList, spans); - - QtTestTableModel model(10, 10); - QTableView view; - view.setModel(&model); - - // Same set as for rowRemoval, just swapping columns and rows. - foreach (QRect span, spans) - view.setSpan(span.left(), span.top(), span.width(), span.height()); - view.show(); - QTest::qWait(50); - - QBENCHMARK_ONCE { - view.model()->removeColumns(3, 3); - } -} - -QTEST_MAIN(tst_QTableView) -#include "tst_qtableview.moc" diff --git a/tests/benchmarks/qtcpserver/qtcpserver.pro b/tests/benchmarks/qtcpserver/qtcpserver.pro deleted file mode 100644 index e7bf13a..0000000 --- a/tests/benchmarks/qtcpserver/qtcpserver.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qtcpserver -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui -QT += network - -CONFIG += release - -# Input -SOURCES += tst_qtcpserver.cpp diff --git a/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp deleted file mode 100644 index b6b55c3..0000000 --- a/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp +++ /dev/null @@ -1,277 +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 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$ -** -****************************************************************************/ - -// Just to get Q_OS_SYMBIAN -#include - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -Q_DECLARE_METATYPE(QNetworkProxy) -Q_DECLARE_METATYPE(QList) - -#include "../../auto/network-settings.h" - -//TESTED_CLASS= -//TESTED_FILES= - -class tst_QTcpServer : public QObject -{ - Q_OBJECT - -public: - tst_QTcpServer(); - virtual ~tst_QTcpServer(); - - -public slots: - void initTestCase_data(); - void init(); - void cleanup(); -private slots: - void ipv4LoopbackPerformanceTest(); - void ipv6LoopbackPerformanceTest(); - void ipv4PerformanceTest(); -}; - -tst_QTcpServer::tst_QTcpServer() -{ - Q_SET_DEFAULT_IAP -} - -tst_QTcpServer::~tst_QTcpServer() -{ -} - -void tst_QTcpServer::initTestCase_data() -{ - QTest::addColumn("setProxy"); - QTest::addColumn("proxyType"); - - QTest::newRow("WithoutProxy") << false << 0; - QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); -} - -void tst_QTcpServer::init() -{ - QFETCH_GLOBAL(bool, setProxy); - if (setProxy) { - QFETCH_GLOBAL(int, proxyType); - if (proxyType == QNetworkProxy::Socks5Proxy) { - QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); - } - } -} - -void tst_QTcpServer::cleanup() -{ - QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); -} - -//---------------------------------------------------------------------------------- -void tst_QTcpServer::ipv4LoopbackPerformanceTest() -{ - QFETCH_GLOBAL(bool, setProxy); - if (setProxy) - return; - - QTcpServer server; - QVERIFY(server.listen(QHostAddress::LocalHost)); - - QVERIFY(server.isListening()); - - QTcpSocket clientA; - clientA.connectToHost(QHostAddress::LocalHost, server.serverPort()); - QVERIFY(clientA.waitForConnected(5000)); - QVERIFY(clientA.state() == QAbstractSocket::ConnectedState); - - QVERIFY(server.waitForNewConnection()); - QTcpSocket *clientB = server.nextPendingConnection(); - QVERIFY(clientB); - - QByteArray buffer(16384, '@'); - QTime stopWatch; - stopWatch.start(); - qlonglong totalWritten = 0; - while (stopWatch.elapsed() < 5000) { - QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0); - clientA.flush(); - totalWritten += buffer.size(); - while (clientB->waitForReadyRead(100)) { - if (clientB->bytesAvailable() == 16384) - break; - } - clientB->read(buffer.data(), buffer.size()); - clientB->write(buffer.data(), buffer.size()); - clientB->flush(); - totalWritten += buffer.size(); - while (clientA.waitForReadyRead(100)) { - if (clientA.bytesAvailable() == 16384) - break; - } - clientA.read(buffer.data(), buffer.size()); - } - - qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", - server.serverAddress().toString().toLatin1().constData(), - totalWritten / (1024.0 * 1024.0), - stopWatch.elapsed() / 1000.0, - (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); - - delete clientB; -} - -//---------------------------------------------------------------------------------- -void tst_QTcpServer::ipv6LoopbackPerformanceTest() -{ - QFETCH_GLOBAL(bool, setProxy); - if (setProxy) - return; - -#if defined(Q_OS_SYMBIAN) - QSKIP("Symbian: IPv6 is not yet supported", SkipAll); -#endif - QTcpServer server; - if (!server.listen(QHostAddress::LocalHostIPv6, 0)) { - QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError); - } else { - QTcpSocket clientA; - clientA.connectToHost(server.serverAddress(), server.serverPort()); - QVERIFY(clientA.waitForConnected(5000)); - - QVERIFY(server.waitForNewConnection(5000)); - QTcpSocket *clientB = server.nextPendingConnection(); - QVERIFY(clientB); - - QByteArray buffer(16384, '@'); - QTime stopWatch; - stopWatch.start(); - qlonglong totalWritten = 0; - while (stopWatch.elapsed() < 5000) { - clientA.write(buffer.data(), buffer.size()); - clientA.flush(); - totalWritten += buffer.size(); - while (clientB->waitForReadyRead(100)) { - if (clientB->bytesAvailable() == 16384) - break; - } - clientB->read(buffer.data(), buffer.size()); - clientB->write(buffer.data(), buffer.size()); - clientB->flush(); - totalWritten += buffer.size(); - while (clientA.waitForReadyRead(100)) { - if (clientA.bytesAvailable() == 16384) - break; - } - clientA.read(buffer.data(), buffer.size()); - } - - qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", - server.serverAddress().toString().toLatin1().constData(), - totalWritten / (1024.0 * 1024.0), - stopWatch.elapsed() / 1000.0, - (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); - delete clientB; - } -} - -//---------------------------------------------------------------------------------- -void tst_QTcpServer::ipv4PerformanceTest() -{ - QTcpSocket probeSocket; - probeSocket.connectToHost(QtNetworkSettings::serverName(), 143); - QVERIFY(probeSocket.waitForConnected(5000)); - - QTcpServer server; - QVERIFY(server.listen(probeSocket.localAddress(), 0)); - - QTcpSocket clientA; - clientA.connectToHost(server.serverAddress(), server.serverPort()); - QVERIFY(clientA.waitForConnected(5000)); - - QVERIFY(server.waitForNewConnection(5000)); - QTcpSocket *clientB = server.nextPendingConnection(); - QVERIFY(clientB); - - QByteArray buffer(16384, '@'); - QTime stopWatch; - stopWatch.start(); - qlonglong totalWritten = 0; - while (stopWatch.elapsed() < 5000) { - qlonglong writtenA = clientA.write(buffer.data(), buffer.size()); - clientA.flush(); - totalWritten += buffer.size(); - while (clientB->waitForReadyRead(100)) { - if (clientB->bytesAvailable() == writtenA) - break; - } - clientB->read(buffer.data(), buffer.size()); - qlonglong writtenB = clientB->write(buffer.data(), buffer.size()); - clientB->flush(); - totalWritten += buffer.size(); - while (clientA.waitForReadyRead(100)) { - if (clientA.bytesAvailable() == writtenB) - break; - } - clientA.read(buffer.data(), buffer.size()); - } - - qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s", - probeSocket.localAddress().toString().toLatin1().constData(), - totalWritten / (1024.0 * 1024.0), - stopWatch.elapsed() / 1000.0, - (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024)); - - delete clientB; -} - -QTEST_MAIN(tst_QTcpServer) -#include "tst_qtcpserver.moc" diff --git a/tests/benchmarks/qtemporaryfile/main.cpp b/tests/benchmarks/qtemporaryfile/main.cpp deleted file mode 100644 index 8b71189..0000000 --- a/tests/benchmarks/qtemporaryfile/main.cpp +++ /dev/null @@ -1,103 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include -#include - - -class tst_qtemporaryfile : public QObject -{ - Q_OBJECT -private slots: - void openclose_data(); - void openclose(); - void readwrite_data() { openclose_data(); } - void readwrite(); - -private: -}; - -void tst_qtemporaryfile::openclose_data() -{ - QTest::addColumn("amount"); - QTest::newRow("100") << qint64(100); - QTest::newRow("1000") << qint64(1000); - QTest::newRow("10000") << qint64(10000); -} - -void tst_qtemporaryfile::openclose() -{ - QFETCH(qint64, amount); - - QBENCHMARK { - for (qint64 i = 0; i < amount; ++i) { - QTemporaryFile file; - file.open(); - file.close(); - } - } -} - -void tst_qtemporaryfile::readwrite() -{ - QFETCH(qint64, amount); - - const int dataSize = 4096; - QByteArray data; - data.fill('a', dataSize); - QBENCHMARK { - for (qint64 i = 0; i < amount; ++i) { - QTemporaryFile file; - file.open(); - file.write(data); - file.seek(0); - file.read(dataSize); - file.close(); - } - } -} - -QTEST_MAIN(tst_qtemporaryfile) - -#include "main.moc" diff --git a/tests/benchmarks/qtemporaryfile/qtemporaryfile.pro b/tests/benchmarks/qtemporaryfile/qtemporaryfile.pro deleted file mode 100644 index c1b04f4..0000000 --- a/tests/benchmarks/qtemporaryfile/qtemporaryfile.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qtemporaryfile -DEPENDPATH += . -INCLUDEPATH += . - -QT -= gui - -CONFIG += release - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qtext/bidi.txt b/tests/benchmarks/qtext/bidi.txt deleted file mode 100644 index 7c74cb4..0000000 --- a/tests/benchmarks/qtext/bidi.txt +++ /dev/null @@ -1,4 +0,0 @@ -chinese -欧洲,软件+互è”网 
 ç”¨ç»Ÿä¸€ç  (Unicode) èµ°é世界
将于1997å¹´ 3 月10æ—¥ï¼12日在德国 Mainz 市举行的第å届统一ç å›½é™…研讨会现在开始注册。 本次会议将汇集å„æ–¹é¢çš„专家。 涉åŠçš„领域包括: 国际互è”ç½‘å’Œç»Ÿä¸€ç  ï¼Œå›½é™…åŒ–å’Œæœ¬åœ°åŒ– ,统一ç åœ¨æ“作系统和应用软件中的实现 ,字型 ,文本格å¼ä»¥åŠå¤šæ–‡ç§è®¡ç®—等。 
当世界需è¦æ²Ÿé€šæ—¶ï¼Œè¯·ç”¨Unicodeï¼ -hebrew-bidi -×ײר×ָפּע: פּר×ָגר×ַמװ×ַרג ×ון די װעלטנעץ: ×וניק×ָד ×יבער דער ×’×ָרער װעלט פֿ×ַרשרײַבט זיך שױן ××±×£ דער צענטער ×ינטערנ×ַצי×ָנ×ַלער ×וניק×ָד-ק×ָנפֿערענץ, ×°×ָס װעט פֿ×ָרקומען ×“×¢× 10טן ביזן 12טן מ×ַרץ, 1997, ×ין מײַנץ, דײַטשל×ַנד. די ק×ָנפֿערענץ װעט צוז×ַמענברענגן ×ž×‘Ö¿×™× ×™× ×¤Ö¿×•×Ÿ װעלטנעץ, ×וניק×ָד, ××™ ×ַלװעלטלעכן ××™ סבֿיבֿהדיקן פּר×ָגר×ַמװ×ַרג, ×ַרײַנשטעלן ×וניק×ָד ×ין ×ָפּעריר-סיסטעמען ×ון ×ָנװענדונגען, שריפֿטן, טעקסט-×ױסשטעל, ×ון מערשפּר×ַכיקע ק×ָמפּיוטערײַ. diff --git a/tests/benchmarks/qtext/main.cpp b/tests/benchmarks/qtext/main.cpp deleted file mode 100644 index d4f3165..0000000 --- a/tests/benchmarks/qtext/main.cpp +++ /dev/null @@ -1,415 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -// Application private dir is default serach path for files, so SRCDIR can be set to empty -#define SRCDIR "" -#endif - -Q_DECLARE_METATYPE(QTextDocument*) - -class tst_QText: public QObject -{ - Q_OBJECT -public: - tst_QText() { - m_lorem = QString::fromLatin1("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."); - m_shortLorem = QString::fromLatin1("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."); - } - -private slots: - void loadHtml_data(); - void loadHtml(); - - void shaping_data(); - void shaping(); - - void odfWriting_empty(); - void odfWriting_text(); - void odfWriting_images(); - - void constructControl(); - void constructDocument(); - - void layout(); - void paintLayoutToPixmap(); - void paintLayoutToPixmap_painterFill(); - - void document(); - void paintDocToPixmap(); - void paintDocToPixmap_painterFill(); - - void control(); - void paintControlToPixmap(); - void paintControlToPixmap_painterFill(); - -private: - QSize setupTextLayout(QTextLayout *layout); - - QString m_lorem; - QString m_shortLorem; -}; - -void tst_QText::loadHtml_data() -{ - QTest::addColumn("source"); - QTest::newRow("empty") << QString(); - QTest::newRow("simple") << QString::fromLatin1("Foo"); - QTest::newRow("simple2") << QString::fromLatin1("Foo"); - - QString parag = QString::fromLatin1("

%1

").arg(m_lorem); - QString header = QString::fromLatin1("test"); - QTest::newRow("long") << QString::fromLatin1("test") + parag + parag + parag - + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag + parag - + QString::fromLatin1(""); - QTest::newRow("table") << header + QLatin1String("
xx
") - + parag + QLatin1String("
xx") - + parag; -} - -void tst_QText::loadHtml() -{ - QFETCH(QString, source); - QTextDocument doc; - QBENCHMARK { - doc.setHtml(source); - } -} - -void tst_QText::shaping_data() -{ - QTest::addColumn("parag"); - QTest::newRow("empty") << QString(); - QTest::newRow("lorem") << m_lorem; - QTest::newRow("short") << QString::fromLatin1("Lorem ipsum dolor sit amet"); - -#if !defined(Q_OS_SYMBIAN) - QFile file(QString::fromLatin1(SRCDIR) + QLatin1String("/bidi.txt")); -#else - QFile file( SRCDIR "bidi.txt" ); -#endif - QVERIFY(file.open(QFile::ReadOnly)); - QByteArray data = file.readAll(); - QVERIFY(data.count() > 1000); - QStringList list = QString::fromUtf8(data.data()).split(QLatin1Char('\n'), QString::SkipEmptyParts); - QVERIFY(list.count() %2 == 0); // even amount as we have title and then content. - for (int i=0; i < list.count(); i+=2) { - QTest::newRow(list.at(i).toLatin1()) << list.at(i+1); - } -} - -void tst_QText::shaping() -{ - QFETCH(QString, parag); - - QTextLayout lay(parag); - lay.setCacheEnabled(false); - - // do one run to make sure any fonts are loaded. - lay.beginLayout(); - lay.createLine(); - lay.endLayout(); - - QBENCHMARK { - lay.beginLayout(); - lay.createLine(); - lay.endLayout(); - } -} - -void tst_QText::odfWriting_empty() -{ - QVERIFY(QTextDocumentWriter::supportedDocumentFormats().contains("ODF")); // odf compiled in - QTextDocument *doc = new QTextDocument(); - // write it - QBENCHMARK { - QBuffer buffer; - buffer.open(QIODevice::WriteOnly); - QTextDocumentWriter writer(&buffer, "ODF"); - writer.write(doc); - } - delete doc; -} - -void tst_QText::odfWriting_text() -{ - QTextDocument *doc = new QTextDocument(); - QTextCursor cursor(doc); - QTextBlockFormat bf; - bf.setIndent(2); - cursor.insertBlock(bf); - cursor.insertText(m_lorem); - bf.setTopMargin(10); - cursor.insertBlock(bf); - cursor.insertText(m_lorem); - bf.setRightMargin(30); - cursor.insertBlock(bf); - cursor.insertText(m_lorem); - - // write it - QBENCHMARK { - QBuffer buffer; - buffer.open(QIODevice::WriteOnly); - QTextDocumentWriter writer(&buffer, "ODF"); - writer.write(doc); - } - delete doc; -} - -void tst_QText::odfWriting_images() -{ - QTextDocument *doc = new QTextDocument(); - QTextCursor cursor(doc); - cursor.insertText(m_lorem); - QImage image(400, 200, QImage::Format_ARGB32_Premultiplied); - cursor.insertImage(image); - cursor.insertText(m_lorem); - - // write it - QBENCHMARK { - QBuffer buffer; - buffer.open(QIODevice::WriteOnly); - QTextDocumentWriter writer(&buffer, "ODF"); - writer.write(doc); - } - delete doc; -} - -QSize tst_QText::setupTextLayout(QTextLayout *layout) -{ - bool wrap = true; - int wrapWidth = 300; - layout->setCacheEnabled(true); - - int height = 0; - qreal widthUsed = 0; - qreal lineWidth = 0; - - //set manual width - if (wrap) - lineWidth = wrapWidth; - - layout->beginLayout(); - - while (1) { - QTextLine line = layout->createLine(); - if (!line.isValid()) - break; - - if (wrap) - line.setLineWidth(lineWidth); - } - layout->endLayout(); - - for (int i = 0; i < layout->lineCount(); ++i) { - QTextLine line = layout->lineAt(i); - widthUsed = qMax(widthUsed, line.naturalTextWidth()); - line.setPosition(QPointF(0, height)); - height += int(line.height()); - } - return QSize(qCeil(widthUsed), height); -} - -void tst_QText::constructControl() -{ - QTextControl *control = new QTextControl; - delete control; - - QBENCHMARK { - QTextControl *control = new QTextControl; - delete control; - } -} - -void tst_QText::constructDocument() -{ - QTextDocument *doc = new QTextDocument; - delete doc; - - QBENCHMARK { - QTextDocument *doc = new QTextDocument; - delete doc; - } -} - -void tst_QText::layout() -{ - QTextLayout layout(m_shortLorem); - setupTextLayout(&layout); - - QBENCHMARK { - QTextLayout layout(m_shortLorem); - setupTextLayout(&layout); - } -} - -void tst_QText::paintLayoutToPixmap() -{ - QTextLayout layout(m_shortLorem); - QSize size = setupTextLayout(&layout); - - QBENCHMARK { - QPixmap img(size); - img.fill(Qt::transparent); - QPainter p(&img); - layout.draw(&p, QPointF(0, 0)); - } -} - -void tst_QText::paintLayoutToPixmap_painterFill() -{ - QTextLayout layout(m_shortLorem); - QSize size = setupTextLayout(&layout); - - QBENCHMARK { - QPixmap img(size); - QPainter p(&img); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); - p.setCompositionMode(QPainter::CompositionMode_SourceOver); - layout.draw(&p, QPointF(0, 0)); - } -} - -void tst_QText::document() -{ - QTextDocument *doc = new QTextDocument; - - QBENCHMARK { - QTextDocument *doc = new QTextDocument; - doc->setHtml(m_shortLorem); - } -} - -void tst_QText::paintDocToPixmap() -{ - QTextDocument *doc = new QTextDocument; - doc->setHtml(m_shortLorem); - doc->setTextWidth(300); - QSize size = doc->size().toSize(); - - QBENCHMARK { - QPixmap img(size); - img.fill(Qt::transparent); - QPainter p(&img); - doc->drawContents(&p); - } -} - -void tst_QText::paintDocToPixmap_painterFill() -{ - QTextDocument *doc = new QTextDocument; - doc->setHtml(m_shortLorem); - doc->setTextWidth(300); - QSize size = doc->size().toSize(); - - QBENCHMARK { - QPixmap img(size); - QPainter p(&img); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); - p.setCompositionMode(QPainter::CompositionMode_SourceOver); - doc->drawContents(&p); - } -} - -void tst_QText::control() -{ - QTextControl *control = new QTextControl(m_shortLorem); - - QBENCHMARK { - QTextControl *control = new QTextControl; - QTextDocument *doc = control->document(); - doc->setHtml(m_shortLorem); - } -} - -void tst_QText::paintControlToPixmap() -{ - QTextControl *control = new QTextControl; - QTextDocument *doc = control->document(); - doc->setHtml(m_shortLorem); - doc->setTextWidth(300); - QSize size = doc->size().toSize(); - - QBENCHMARK { - QPixmap img(size); - img.fill(Qt::transparent); - QPainter p(&img); - control->drawContents(&p, QRectF(QPointF(0, 0), QSizeF(size))); - } -} - -void tst_QText::paintControlToPixmap_painterFill() -{ - QTextControl *control = new QTextControl; - QTextDocument *doc = control->document(); - doc->setHtml(m_shortLorem); - doc->setTextWidth(300); - QSize size = doc->size().toSize(); - - QBENCHMARK { - QPixmap img(size); - QPainter p(&img); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(0, 0, img.width(), img.height(), Qt::transparent); - p.setCompositionMode(QPainter::CompositionMode_SourceOver); - control->drawContents(&p, QRectF(QPointF(0, 0), QSizeF(size))); - } -} - -QTEST_MAIN(tst_QText) - -#include "main.moc" diff --git a/tests/benchmarks/qtext/qtext.pro b/tests/benchmarks/qtext/qtext.pro deleted file mode 100644 index 9e8860f..0000000 --- a/tests/benchmarks/qtext/qtext.pro +++ /dev/null @@ -1,14 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_QText - -SOURCES += main.cpp - -symbian* { - TARGET.CAPABILITY = ALL -TCB - addFiles.sources = bidi.txt - addFiles.path = . - DEPLOYMENT += addFiles -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} \ No newline at end of file diff --git a/tests/benchmarks/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/qthreadstorage/qthreadstorage.pro deleted file mode 100644 index f9c1978..0000000 --- a/tests/benchmarks/qthreadstorage/qthreadstorage.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qthreadstorage - -SOURCES += tst_qthreadstorage.cpp - diff --git a/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp b/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp deleted file mode 100644 index faae4d7..0000000 --- a/tests/benchmarks/qthreadstorage/tst_qthreadstorage.cpp +++ /dev/null @@ -1,124 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//TESTED_FILES= - -QThreadStorage dummy[8]; - -QThreadStorage tls1; - -class tst_QThreadStorage : public QObject -{ - Q_OBJECT - -public: - tst_QThreadStorage(); - virtual ~tst_QThreadStorage(); - -public slots: - void init(); - void cleanup(); - -private slots: - void construct(); - void get(); - void set(); -}; - -tst_QThreadStorage::tst_QThreadStorage() -{ -} - -tst_QThreadStorage::~tst_QThreadStorage() -{ -} - -void tst_QThreadStorage::init() -{ - dummy[1].setLocalData(new int(5)); - dummy[2].setLocalData(new int(4)); - dummy[3].setLocalData(new int(3)); - tls1.setLocalData(new QString()); -} - -void tst_QThreadStorage::cleanup() -{ -} - -void tst_QThreadStorage::construct() -{ - QBENCHMARK { - QThreadStorage ts; - } -} - - -void tst_QThreadStorage::get() -{ - QThreadStorage ts; - ts.setLocalData(new int(45)); - - int count = 0; - QBENCHMARK { - int *i = ts.localData(); - count += *i; - } - ts.setLocalData(0); -} - -void tst_QThreadStorage::set() -{ - QThreadStorage ts; - - int count = 0; - QBENCHMARK { - ts.setLocalData(new int(count)); - count++; - } - ts.setLocalData(0); -} - - -QTEST_MAIN(tst_QThreadStorage) -#include "tst_qthreadstorage.moc" diff --git a/tests/benchmarks/qtransform/qtransform.pro b/tests/benchmarks/qtransform/qtransform.pro deleted file mode 100644 index 8d87656..0000000 --- a/tests/benchmarks/qtransform/qtransform.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qtransform - -SOURCES += tst_qtransform.cpp - diff --git a/tests/benchmarks/qtransform/tst_qtransform.cpp b/tests/benchmarks/qtransform/tst_qtransform.cpp deleted file mode 100644 index b33cf58..0000000 --- a/tests/benchmarks/qtransform/tst_qtransform.cpp +++ /dev/null @@ -1,592 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -//TESTED_FILES= - -class tst_QTransform : public QObject -{ - Q_OBJECT - -public: - tst_QTransform(); - virtual ~tst_QTransform(); - -public slots: - void init(); - void cleanup(); - -private slots: - void construct(); - void translate_data(); - void translate(); - void scale_data(); - void scale(); - void shear_data(); - void shear(); - void rotate_data(); - void rotate(); - void rotateXYZ_data(); - void rotateXYZ(); - void operatorAssign_data(); - void operatorAssign(); - void operatorEqual_data(); - void operatorEqual(); - void operatorNotEqual_data(); - void operatorNotEqual(); - void operatorMultiply_data(); - void operatorMultiply(); - void operatorPlusEqualScalar_data(); - void operatorPlusEqualScalar(); - void operatorMinusEqualScalar_data(); - void operatorMinusEqualScalar(); - void operatorMultiplyEqual_data(); - void operatorMultiplyEqual(); - void operatorMultiplyEqualScalar_data(); - void operatorMultiplyEqualScalar(); - void operatorDivideEqualScalar_data(); - void operatorDivideEqualScalar(); - void mapQPoint_data(); - void mapQPoint(); - void mapQPointF_data(); - void mapQPointF(); - void mapRect_data(); - void mapRect(); - void mapRectF_data(); - void mapRectF(); - void mapQPolygon_data(); - void mapQPolygon(); - void mapQPolygonF_data(); - void mapQPolygonF(); - void mapQRegion_data(); - void mapQRegion(); - void mapToPolygon_data(); - void mapToPolygon(); - void mapQPainterPath_data(); - void mapQPainterPath(); - void isIdentity_data(); - void isIdentity(); - void isAffine_data(); - void isAffine(); - void isInvertible_data(); - void isInvertible(); - void isRotating_data(); - void isRotating(); - void isScaling_data(); - void isScaling(); - void isTranslating_data(); - void isTranslating(); - void type_data(); - void type(); - void determinant_data(); - void determinant(); - void adjoint_data(); - void adjoint(); - void transposed_data(); - void transposed(); - void inverted_data(); - void inverted(); - -private: - QMap generateTransforms() const; -}; - -tst_QTransform::tst_QTransform() -{ -} - -tst_QTransform::~tst_QTransform() -{ -} - -void tst_QTransform::init() -{ -} - -void tst_QTransform::cleanup() -{ -} - -QMap tst_QTransform::generateTransforms() const -{ - QMap x; - x["0: identity"] = QTransform(); - x["1: translate"] = QTransform().translate(10, 10); - x["2: translate"] = QTransform().translate(-10, -10); - x["3: rotate45"] = QTransform().rotate(45); - x["4: rotate90"] = QTransform().rotate(90); - x["5: rotate180"] = QTransform().rotate(180); - x["6: shear2,2"] = QTransform().shear(2, 2); - x["7: shear-2,-2"] = QTransform().shear(-2, -2); - x["8: scaleUp2,2"] = QTransform().scale(2, 2); - x["9: scaleUp2,3"] = QTransform().scale(2, 3); - x["10: scaleDown0.5,0.5"] = QTransform().scale(0.5, 0.5); - x["11: scaleDown0.5,0.25"] = QTransform().scale(0.5, 0.25); - x["12: rotateX"] = QTransform().rotate(45, Qt::XAxis); - x["13: rotateY"] = QTransform().rotate(45, Qt::YAxis); - x["14: rotateXY"] = QTransform().rotate(45, Qt::XAxis).rotate(45, Qt::YAxis); - x["15: rotateYZ"] = QTransform().rotate(45, Qt::YAxis).rotate(45, Qt::ZAxis); - x["16: full"] = QTransform().translate(10, 10).rotate(45).shear(2, 2).scale(2, 2).rotate(45, Qt::YAxis).rotate(45, Qt::XAxis).rotate(45, Qt::ZAxis); - return x; -} - -void tst_QTransform::construct() -{ - QBENCHMARK { - QTransform x; - } -} - -#define SINGLE_DATA_IMPLEMENTATION(func) \ -void tst_QTransform::func##_data() \ -{ \ - QTest::addColumn("transform"); \ - QMap x = generateTransforms(); \ - QMapIterator it(x); \ - while (it.hasNext()) { \ - it.next(); \ - QTest::newRow(it.key()) << it.value(); \ - } \ -} - -#define DOUBLE_DATA_IMPLEMENTATION(func) \ -void tst_QTransform::func##_data() \ -{ \ - QTest::addColumn("x1"); \ - QTest::addColumn("x2"); \ - QMap x = generateTransforms(); \ - QMapIterator it(x); \ - while (it.hasNext()) { \ - it.next(); \ - const char *key1 = it.key(); \ - QTransform x1 = it.value(); \ - QMapIterator it2(x); \ - while (it2.hasNext()) { \ - it2.next(); \ - QTest::newRow(QString("%1 + %2").arg(key1).arg(it2.key()).toLatin1().constData()) \ - << x1 << it2.value(); \ - } \ - } \ -} - -SINGLE_DATA_IMPLEMENTATION(translate) - -void tst_QTransform::translate() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.translate(10, 10); - } -} - -SINGLE_DATA_IMPLEMENTATION(scale) - -void tst_QTransform::scale() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.scale(2, 2); - } -} - -SINGLE_DATA_IMPLEMENTATION(shear) - -void tst_QTransform::shear() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.shear(2, 2); - } -} - -SINGLE_DATA_IMPLEMENTATION(rotate) - -void tst_QTransform::rotate() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.rotate(45); - } -} - -SINGLE_DATA_IMPLEMENTATION(rotateXYZ) - -void tst_QTransform::rotateXYZ() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.rotate(45, Qt::XAxis); - x.rotate(45, Qt::YAxis); - x.rotate(45, Qt::ZAxis); - } -} - -DOUBLE_DATA_IMPLEMENTATION(operatorAssign) - -void tst_QTransform::operatorAssign() -{ - QFETCH(QTransform, x1); - QFETCH(QTransform, x2); - QTransform x = x1; - QBENCHMARK { - x = x2; - } -} - -DOUBLE_DATA_IMPLEMENTATION(operatorEqual) - -void tst_QTransform::operatorEqual() -{ - QFETCH(QTransform, x1); - QFETCH(QTransform, x2); - QTransform x = x1; - QBENCHMARK { - x == x2; - } -} - -DOUBLE_DATA_IMPLEMENTATION(operatorNotEqual) - -void tst_QTransform::operatorNotEqual() -{ - QFETCH(QTransform, x1); - QFETCH(QTransform, x2); - QTransform x = x1; - QBENCHMARK { - x != x2; - } -} - -DOUBLE_DATA_IMPLEMENTATION(operatorMultiply) - -void tst_QTransform::operatorMultiply() -{ - QFETCH(QTransform, x1); - QFETCH(QTransform, x2); - QTransform x = x1; - QBENCHMARK { - x * x2; - } -} - -SINGLE_DATA_IMPLEMENTATION(operatorPlusEqualScalar) - -void tst_QTransform::operatorPlusEqualScalar() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x += 3.14; - } -} - -SINGLE_DATA_IMPLEMENTATION(operatorMinusEqualScalar) - -void tst_QTransform::operatorMinusEqualScalar() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x -= 3.14; - } -} - -DOUBLE_DATA_IMPLEMENTATION(operatorMultiplyEqual) - -void tst_QTransform::operatorMultiplyEqual() -{ - QFETCH(QTransform, x1); - QFETCH(QTransform, x2); - QTransform x = x1; - QBENCHMARK { - x *= x2; - } -} - -SINGLE_DATA_IMPLEMENTATION(operatorMultiplyEqualScalar) - -void tst_QTransform::operatorMultiplyEqualScalar() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x * 3; - } -} - -SINGLE_DATA_IMPLEMENTATION(operatorDivideEqualScalar) - -void tst_QTransform::operatorDivideEqualScalar() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x /= 3; - } -} - -SINGLE_DATA_IMPLEMENTATION(mapQPoint) - -void tst_QTransform::mapQPoint() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.map(QPoint(3, 3)); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapQPointF) - -void tst_QTransform::mapQPointF() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.map(QPointF(3, 3)); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapRect) - -void tst_QTransform::mapRect() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.mapRect(QRect(0, 0, 100, 100)); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapRectF) - -void tst_QTransform::mapRectF() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.mapRect(QRectF(0, 0, 100, 100)); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapQPolygon) - -void tst_QTransform::mapQPolygon() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QPolygon poly = QPolygon(QRect(0, 0, 100, 100)); - QBENCHMARK { - x.map(poly); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapQPolygonF) - -void tst_QTransform::mapQPolygonF() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QPolygonF poly = QPolygonF(QRectF(0, 0, 100, 100)); - QBENCHMARK { - x.map(poly); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapQRegion) - -void tst_QTransform::mapQRegion() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QRegion region; - for (int i = 0; i < 10; ++i) - region += QRect(i * 10, i * 10, 100, 100); - QBENCHMARK { - x.map(region); - } -} - -SINGLE_DATA_IMPLEMENTATION(mapToPolygon) - -void tst_QTransform::mapToPolygon() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QBENCHMARK { - x.mapToPolygon(QRect(0, 0, 100, 100)); - } -} - - -SINGLE_DATA_IMPLEMENTATION(mapQPainterPath) - -void tst_QTransform::mapQPainterPath() -{ - QFETCH(QTransform, transform); - QTransform x = transform; - QPainterPath path; - for (int i = 0; i < 10; ++i) - path.addEllipse(i * 10, i * 10, 100, 100); - QBENCHMARK { - x.map(path); - } -} - -SINGLE_DATA_IMPLEMENTATION(isIdentity) - -void tst_QTransform::isIdentity() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.isIdentity(); - } -} - -SINGLE_DATA_IMPLEMENTATION(isAffine) - -void tst_QTransform::isAffine() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.isAffine(); - } -} - -SINGLE_DATA_IMPLEMENTATION(isInvertible) - -void tst_QTransform::isInvertible() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.isInvertible(); - } -} - -SINGLE_DATA_IMPLEMENTATION(isRotating) - -void tst_QTransform::isRotating() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.isRotating(); - } -} - -SINGLE_DATA_IMPLEMENTATION(isScaling) - -void tst_QTransform::isScaling() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.isScaling(); - } -} - -SINGLE_DATA_IMPLEMENTATION(isTranslating) - -void tst_QTransform::isTranslating() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.isTranslating(); - } -} - -SINGLE_DATA_IMPLEMENTATION(type) - -void tst_QTransform::type() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.type(); - } -} - -SINGLE_DATA_IMPLEMENTATION(determinant) - -void tst_QTransform::determinant() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.determinant(); - } -} - -SINGLE_DATA_IMPLEMENTATION(adjoint) - -void tst_QTransform::adjoint() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.adjoint(); - } -} - -SINGLE_DATA_IMPLEMENTATION(transposed) - -void tst_QTransform::transposed() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.transposed(); - } -} - -SINGLE_DATA_IMPLEMENTATION(inverted) - -void tst_QTransform::inverted() -{ - QFETCH(QTransform, transform); - QBENCHMARK { - transform.inverted(); - } -} - -QTEST_MAIN(tst_QTransform) -#include "tst_qtransform.moc" diff --git a/tests/benchmarks/qvariant/qvariant.pro b/tests/benchmarks/qvariant/qvariant.pro deleted file mode 100644 index 63b5442..0000000 --- a/tests/benchmarks/qvariant/qvariant.pro +++ /dev/null @@ -1,11 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qvariant -DEPENDPATH += . -INCLUDEPATH += . - -CONFIG += release -#CONFIG += debug - - -SOURCES += tst_qvariant.cpp diff --git a/tests/benchmarks/qvariant/tst_qvariant.cpp b/tests/benchmarks/qvariant/tst_qvariant.cpp deleted file mode 100644 index 82dc7dd..0000000 --- a/tests/benchmarks/qvariant/tst_qvariant.cpp +++ /dev/null @@ -1,180 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#define ITERATION_COUNT 1e5 - -class tst_qvariant : public QObject -{ - Q_OBJECT -private slots: - void testBound(); - - void doubleVariantCreation(); - void floatVariantCreation(); - void rectVariantCreation(); - void stringVariantCreation(); - void pixmapVariantCreation(); - - void doubleVariantSetValue(); - void floatVariantSetValue(); - void rectVariantSetValue(); - void stringVariantSetValue(); - - void doubleVariantAssignment(); - void floatVariantAssignment(); - void rectVariantAssignment(); - void stringVariantAssignment(); -}; - -void tst_qvariant::testBound() -{ - qreal d = qreal(.5); - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - d = qBound(0, d, 1); - } - } -} - -template -static void variantCreation(T val) -{ - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - QVariant v(val); - } - } -} - -void tst_qvariant::doubleVariantCreation() -{ - variantCreation(0.0); -} - -void tst_qvariant::floatVariantCreation() -{ - variantCreation(0.0f); -} - -void tst_qvariant::rectVariantCreation() -{ - variantCreation(QRect(1, 2, 3, 4)); -} - -void tst_qvariant::stringVariantCreation() -{ - variantCreation(QString()); -} - -void tst_qvariant::pixmapVariantCreation() -{ - variantCreation(QPixmap()); -} - -template -static void variantSetValue(T d) -{ - QVariant v; - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - qVariantSetValue(v, d); - } - } -} - -void tst_qvariant::doubleVariantSetValue() -{ - variantSetValue(0.0); -} - -void tst_qvariant::floatVariantSetValue() -{ - variantSetValue(0.0f); -} - -void tst_qvariant::rectVariantSetValue() -{ - variantSetValue(QRect()); -} - -void tst_qvariant::stringVariantSetValue() -{ - variantSetValue(QString()); -} - -template -static void variantAssignment(T d) -{ - QVariant v; - QBENCHMARK { - for(int i = 0; i < ITERATION_COUNT; ++i) { - v = d; - } - } -} - -void tst_qvariant::doubleVariantAssignment() -{ - variantAssignment(0.0); -} - -void tst_qvariant::floatVariantAssignment() -{ - variantAssignment(0.0f); -} - -void tst_qvariant::rectVariantAssignment() -{ - variantAssignment(QRect()); -} - -void tst_qvariant::stringVariantAssignment() -{ - variantAssignment(QString()); -} - -QTEST_MAIN(tst_qvariant) - -#include "tst_qvariant.moc" diff --git a/tests/benchmarks/qwidget/qwidget.pro b/tests/benchmarks/qwidget/qwidget.pro deleted file mode 100644 index ff47445..0000000 --- a/tests/benchmarks/qwidget/qwidget.pro +++ /dev/null @@ -1,4 +0,0 @@ -load(qttest_p4) - -TARGET = tst_qwidget -SOURCES += tst_qwidget.cpp diff --git a/tests/benchmarks/qwidget/tst_qwidget.cpp b/tests/benchmarks/qwidget/tst_qwidget.cpp deleted file mode 100644 index f21bd44..0000000 --- a/tests/benchmarks/qwidget/tst_qwidget.cpp +++ /dev/null @@ -1,332 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class tst_QWidget : public QObject -{ - Q_OBJECT - - -private slots: - void update_data(); - void updateOpaque_data(); - void updateOpaque(); - void updateTransparent_data(); - void updateTransparent(); - void updatePartial_data(); - void updatePartial(); - void updateComplex_data(); - void updateComplex(); - - void complexToplevelResize(); -}; - -class UpdateWidget : public QWidget -{ -public: - UpdateWidget(int rows, int columns) : QWidget(0) - { - QGridLayout *layout = new QGridLayout; - for (int row = 0; row < rows; ++row) { - for (int column = 0; column < columns; ++column) { - UpdateWidget *widget = new UpdateWidget; - widget->setFixedSize(20, 20); - layout->addWidget(widget, row, column); - children.append(widget); - } - } - setLayout(layout); - } - - UpdateWidget(QWidget *parent = 0) : QWidget(parent) {} - - void paintEvent(QPaintEvent *) - { - static int color = Qt::black; - - QPainter painter(this); - painter.fillRect(rect(), Qt::GlobalColor(color)); - - if (++color > Qt::darkYellow) - color = Qt::black; - } - - QRegion updateRegion; - QList children; -}; - -void tst_QWidget::update_data() -{ - QTest::addColumn("rows"); - QTest::addColumn("columns"); - QTest::addColumn("numUpdates"); - - QTest::newRow("10x10x1") << 10 << 10 << 1; - QTest::newRow("10x10x10") << 10 << 10 << 10; - QTest::newRow("25x25x1") << 25 << 25 << 1; - QTest::newRow("25x25x10") << 25 << 25 << 10; - QTest::newRow("25x25x100") << 25 << 25 << 100; -} - -void tst_QWidget::updateOpaque_data() -{ - update_data(); -} - -void tst_QWidget::updateOpaque() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(int, numUpdates); - - UpdateWidget widget(rows, columns); - foreach (QWidget *w, widget.children) { - w->setAttribute(Qt::WA_OpaquePaintEvent); - } - - widget.show(); - QApplication::processEvents(); - - int i = 0; - const int n = widget.children.size(); - QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - widget.children[i]->update(); - QApplication::processEvents(); - i = (i + 1) % n; - } - } -} - -void tst_QWidget::updateTransparent_data() -{ - update_data(); -} - -void tst_QWidget::updateTransparent() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(int, numUpdates); - - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); - - int i = 0; - const int n = widget.children.size(); - QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - widget.children[i]->update(); - QApplication::processEvents(); - i = (i + 1) % n; - } - } -} - -void tst_QWidget::updatePartial_data() -{ - update_data(); -} - -void tst_QWidget::updatePartial() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(int, numUpdates); - - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); - - int i = 0; - const int n = widget.children.size(); - QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - QWidget *w = widget.children[i]; - const int x = w->width() / 2; - const int y = w->height() / 2; - w->update(0, 0, x, y); - w->update(x, 0, x, y); - w->update(0, y, x, y); - w->update(x, y, x, y); - QApplication::processEvents(); - i = (i + 1) % n; - } - } -} - -void tst_QWidget::updateComplex_data() -{ - update_data(); -} - -void tst_QWidget::updateComplex() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(int, numUpdates); - - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); - - int i = 0; - const int n = widget.children.size(); - QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - QWidget *w = widget.children[i]; - const int x = w->width() / 2; - const int y = w->height() / 2; - w->update(QRegion(0, 0, x, y, QRegion::Ellipse)); - w->update(QRegion(x, y, x, y, QRegion::Ellipse)); - QApplication::processEvents(); - i = (i + 1) % n; - } - } -} - -class ResizeWidget : public QWidget -{ -public: - ResizeWidget(); -}; - -ResizeWidget::ResizeWidget() : QWidget(0) -{ - QBoxLayout *topLayout = new QVBoxLayout; - - QMenuBar *menubar = new QMenuBar; - QMenu* popup = menubar->addMenu("&File"); - popup->addAction("&Quit", qApp, SLOT(quit())); - topLayout->setMenuBar(menubar); - - QBoxLayout *buttons = new QHBoxLayout; - buttons->setMargin(5); - buttons->addStretch(10); - for (int i = 1; i <= 4; i++ ) { - QPushButton* button = new QPushButton; - button->setText(QString("Button %1").arg(i)); - buttons->addWidget(button); - } - topLayout->addLayout(buttons); - - buttons = new QHBoxLayout; - buttons->addStretch(10); - for (int i = 11; i <= 16; i++) { - QPushButton* button = new QPushButton; - button->setText(QString("Button %1").arg(i)); - buttons->addWidget(button); - } - topLayout->addLayout(buttons); - - QBoxLayout *buttons2 = new QHBoxLayout; - buttons2->addStretch(10); - topLayout->addLayout(buttons2); - - QPushButton *button = new QPushButton; - button->setText("Button five"); - buttons2->addWidget(button); - - button = new QPushButton; - button->setText("Button 6"); - buttons2->addWidget(button); - - QTextEdit *bigWidget = new QTextEdit; - bigWidget->setText("This widget will get all the remaining space"); - bigWidget->setFrameStyle(QFrame::Panel | QFrame::Plain); - topLayout->addWidget(bigWidget); - - const int numRows = 6; - const int labelCol = 0; - const int linedCol = 1; - const int multiCol = 2; - - QGridLayout *grid = new QGridLayout; - for (int row = 0; row < numRows; row++) { - QLineEdit *lineEdit = new QLineEdit; - grid->addWidget(lineEdit, row, linedCol); - QLabel *label = new QLabel(QString("Line &%1").arg(row + 1)); - grid->addWidget(label, row, labelCol); - } - topLayout->addLayout(grid); - - QTextEdit *multiLineEdit = new QTextEdit; - grid->addWidget(multiLineEdit, 0, labelCol + 1, multiCol, multiCol); - - grid->setColumnStretch(linedCol, 10); - grid->setColumnStretch(multiCol, 20); - - QLabel* statusBar = new QLabel; - statusBar->setText("Let's pretend this is a status bar"); - statusBar->setFrameStyle(QFrame::Panel | QFrame::Sunken); - statusBar->setFixedHeight(statusBar->sizeHint().height()); - statusBar->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); - topLayout->addWidget(statusBar); - - topLayout->activate(); - setLayout(topLayout); -} - -void tst_QWidget::complexToplevelResize() -{ - ResizeWidget w; - w.show(); - - QApplication::processEvents(); - - const int minSize = 100; - const int maxSize = 800; - int size = minSize; - - QBENCHMARK { - w.resize(size, size); - size = qMax(minSize, (size + 10) % maxSize); - QApplication::processEvents(); - QApplication::processEvents(); - } -} - -QTEST_MAIN(tst_QWidget) - -#include "tst_qwidget.moc" diff --git a/tests/benchmarks/script/qscriptclass/qscriptclass.pro b/tests/benchmarks/script/qscriptclass/qscriptclass.pro new file mode 100644 index 0000000..f0ffeb7 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass/qscriptclass.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qscriptclass + +SOURCES += tst_qscriptclass.cpp + +QT += script diff --git a/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp b/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp new file mode 100644 index 0000000..7985028 --- /dev/null +++ b/tests/benchmarks/script/qscriptclass/tst_qscriptclass.cpp @@ -0,0 +1,511 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +Q_DECLARE_METATYPE(QScriptContext*) +Q_DECLARE_METATYPE(QScriptValue) +Q_DECLARE_METATYPE(QScriptValueList) + +//TESTED_FILES= + +class TestClass : public QScriptClass +{ +public: + struct CustomProperty { + QueryFlags qflags; + uint id; + QScriptValue::PropertyFlags pflags; + QScriptValue value; + + CustomProperty(QueryFlags qf, uint i, QScriptValue::PropertyFlags pf, + const QScriptValue &val) + : qflags(qf), id(i), pflags(pf), value(val) { } + }; + + enum CallableMode { + NotCallable, + CallableReturnsSum, + CallableReturnsArgument, + CallableReturnsInvalidVariant + }; + + TestClass(QScriptEngine *engine); + ~TestClass(); + + void addCustomProperty(const QScriptString &name, QueryFlags qflags, + uint id, QScriptValue::PropertyFlags pflags, + const QScriptValue &value); + void removeCustomProperty(const QScriptString &name); + + QueryFlags queryProperty(const QScriptValue &object, + const QScriptString &name, + QueryFlags flags, uint *id); + + QScriptValue property(const QScriptValue &object, + const QScriptString &name, uint id); + + void setProperty(QScriptValue &object, const QScriptString &name, + uint id, const QScriptValue &value); + + QScriptValue::PropertyFlags propertyFlags( + const QScriptValue &object, const QScriptString &name, uint id); + + QScriptClassPropertyIterator *newIterator(const QScriptValue &object); + + QScriptValue prototype() const; + + QString name() const; + + bool supportsExtension(Extension extension) const; + QVariant extension(Extension extension, + const QVariant &argument = QVariant()); + + void setIterationEnabled(bool enable); + bool isIterationEnabled() const; + + void setCallableMode(CallableMode mode); + CallableMode callableMode() const; + + void setHasInstance(bool hasInstance); + bool hasInstance() const; + +private: + inline CustomProperty *findCustomProperty(const QScriptString &name); + + QHash customProperties; + + QScriptValue m_prototype; + bool m_iterationEnabled; + CallableMode m_callableMode; + bool m_hasInstance; +}; + +class TestClassPropertyIterator : public QScriptClassPropertyIterator +{ +public: + TestClassPropertyIterator(const QHash &props, + const QScriptValue &object); + ~TestClassPropertyIterator(); + + bool hasNext() const; + void next(); + + bool hasPrevious() const; + void previous(); + + void toFront(); + void toBack(); + + QScriptString name() const; + uint id() const; + QScriptValue::PropertyFlags flags() const; + +private: + int m_index; + int m_last; + QHash m_props; +}; + +TestClass::TestClass(QScriptEngine *engine) + : QScriptClass(engine), m_iterationEnabled(true), + m_callableMode(NotCallable), m_hasInstance(false) +{ + m_prototype = engine->newObject(); +} + +TestClass::~TestClass() +{ + qDeleteAll(customProperties); +} + +TestClass::CustomProperty* TestClass::findCustomProperty(const QScriptString &name) +{ + QHash::const_iterator it; + it = customProperties.constFind(name); + if (it == customProperties.constEnd()) + return 0; + return it.value(); + +} + +void TestClass::addCustomProperty(const QScriptString &name, QueryFlags qflags, + uint id, QScriptValue::PropertyFlags pflags, + const QScriptValue &value) +{ + customProperties.insert(name, new CustomProperty(qflags, id, pflags, value)); +} + +void TestClass::removeCustomProperty(const QScriptString &name) +{ + CustomProperty *prop = customProperties.take(name); + if (prop) + delete prop; +} + +QScriptClass::QueryFlags TestClass::queryProperty(const QScriptValue &/*object*/, + const QScriptString &name, + QueryFlags flags, uint *id) +{ + CustomProperty *prop = findCustomProperty(name); + if (!prop) + return 0; + *id = prop->id; + return prop->qflags & flags; +} + +QScriptValue TestClass::property(const QScriptValue &/*object*/, + const QScriptString &name, uint /*id*/) +{ + CustomProperty *prop = findCustomProperty(name); + if (!prop) + return QScriptValue(); + return prop->value; +} + +void TestClass::setProperty(QScriptValue &/*object*/, const QScriptString &name, + uint /*id*/, const QScriptValue &value) +{ + CustomProperty *prop = findCustomProperty(name); + if (!prop) + return; + prop->value = value; +} + +QScriptValue::PropertyFlags TestClass::propertyFlags( + const QScriptValue &/*object*/, const QScriptString &name, uint /*id*/) +{ + CustomProperty *prop = findCustomProperty(name); + if (!prop) + return 0; + return prop->pflags; +} + +QScriptClassPropertyIterator *TestClass::newIterator(const QScriptValue &object) +{ + if (!m_iterationEnabled) + return 0; + return new TestClassPropertyIterator(customProperties, object); +} + +QScriptValue TestClass::prototype() const +{ + return m_prototype; +} + +QString TestClass::name() const +{ + return QLatin1String("TestClass"); +} + +bool TestClass::supportsExtension(Extension extension) const +{ + if (extension == Callable) + return (m_callableMode != NotCallable); + if (extension == HasInstance) + return m_hasInstance; + return false; +} + +QVariant TestClass::extension(Extension extension, + const QVariant &argument) +{ + if (extension == Callable) { + Q_ASSERT(m_callableMode != NotCallable); + QScriptContext *ctx = qvariant_cast(argument); + if (m_callableMode == CallableReturnsSum) { + qsreal sum = 0; + for (int i = 0; i < ctx->argumentCount(); ++i) + sum += ctx->argument(i).toNumber(); + QScriptValueIterator it(ctx->thisObject()); + while (it.hasNext()) { + it.next(); + sum += it.value().toNumber(); + } + return sum; + } else if (m_callableMode == CallableReturnsArgument) { + return qVariantFromValue(ctx->argument(0)); + } else if (m_callableMode == CallableReturnsInvalidVariant) { + return QVariant(); + } + } else if (extension == HasInstance) { + Q_ASSERT(m_hasInstance); + QScriptValueList args = qvariant_cast(argument); + QScriptValue obj = args.at(0); + QScriptValue value = args.at(1); + return value.property("foo").equals(obj.property("foo")); + } + return QVariant(); +} + +void TestClass::setIterationEnabled(bool enable) +{ + m_iterationEnabled = enable; +} + +bool TestClass::isIterationEnabled() const +{ + return m_iterationEnabled; +} + +void TestClass::setCallableMode(CallableMode mode) +{ + m_callableMode = mode; +} + +TestClass::CallableMode TestClass::callableMode() const +{ + return m_callableMode; +} + +void TestClass::setHasInstance(bool hasInstance) +{ + m_hasInstance = hasInstance; +} + +bool TestClass::hasInstance() const +{ + return m_hasInstance; +} + +TestClassPropertyIterator::TestClassPropertyIterator(const QHash &props, + const QScriptValue &object) + : QScriptClassPropertyIterator(object) +{ + m_props = props; + toFront(); +} + +TestClassPropertyIterator::~TestClassPropertyIterator() +{ +} + +bool TestClassPropertyIterator::hasNext() const +{ + return m_index < m_props.size(); +} + +void TestClassPropertyIterator::next() +{ + m_last = m_index; + ++m_index; +} + +bool TestClassPropertyIterator::hasPrevious() const +{ + return m_index > 0; +} + +void TestClassPropertyIterator::previous() +{ + --m_index; + m_last = m_index; +} + +void TestClassPropertyIterator::toFront() +{ + m_index = 0; + m_last = -1; +} + +void TestClassPropertyIterator::toBack() +{ + m_index = m_props.size(); + m_last = -1; +} + +QScriptString TestClassPropertyIterator::name() const +{ + return m_props.keys().value(m_last); +} + +uint TestClassPropertyIterator::id() const +{ + QScriptString key = m_props.keys().value(m_last); + if (!key.isValid()) + return 0; + TestClass::CustomProperty *prop = m_props.value(key); + return prop->id; +} + +QScriptValue::PropertyFlags TestClassPropertyIterator::flags() const +{ + QScriptString key = m_props.keys().value(m_last); + if (!key.isValid()) + return 0; + TestClass::CustomProperty *prop = m_props.value(key); + return prop->pflags; +} + +class tst_QScriptClass : public QObject +{ + Q_OBJECT + +public: + tst_QScriptClass(); + virtual ~tst_QScriptClass(); + +public slots: + void init(); + void cleanup(); + +private slots: + void noSuchProperty(); + void property(); + void setProperty(); + void propertyFlags(); + void call(); + void hasInstance(); + void iterate(); +}; + +tst_QScriptClass::tst_QScriptClass() +{ +} + +tst_QScriptClass::~tst_QScriptClass() +{ +} + +void tst_QScriptClass::init() +{ +} + +void tst_QScriptClass::cleanup() +{ +} + +void tst_QScriptClass::noSuchProperty() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptValue obj = eng.newObject(&cls); + QString propertyName = QString::fromLatin1("foo"); + QBENCHMARK { + (void)obj.property(propertyName); + } +} + +void tst_QScriptClass::property() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptString foo = eng.toStringHandle("foo"); + cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); + QScriptValue obj = eng.newObject(&cls); + QBENCHMARK { + (void)obj.property(foo); + } +} + +void tst_QScriptClass::setProperty() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptString foo = eng.toStringHandle("foo"); + cls.addCustomProperty(foo, QScriptClass::HandlesWriteAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); + QScriptValue obj = eng.newObject(&cls); + QScriptValue value(456); + QBENCHMARK { + obj.setProperty(foo, value); + } +} + +void tst_QScriptClass::propertyFlags() +{ + QScriptEngine eng; + TestClass cls(&eng); + QScriptString foo = eng.toStringHandle("foo"); + cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, QScriptValue::ReadOnly, /*value=*/123); + QScriptValue obj = eng.newObject(&cls); + QBENCHMARK { + (void)obj.propertyFlags(foo); + } +} + +void tst_QScriptClass::call() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.setCallableMode(TestClass::CallableReturnsArgument); + QScriptValue obj = eng.newObject(&cls); + QScriptValue thisObject; + QScriptValueList args; + args.append(123); + QBENCHMARK { + (void)obj.call(thisObject, args); + } +} + +void tst_QScriptClass::hasInstance() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.setHasInstance(true); + QScriptValue obj = eng.newObject(&cls); + obj.setProperty("foo", 123); + QScriptValue plain = eng.newObject(); + plain.setProperty("foo", obj.property("foo")); + QBENCHMARK { + (void)plain.instanceOf(obj); + } +} + +void tst_QScriptClass::iterate() +{ + QScriptEngine eng; + TestClass cls(&eng); + cls.setIterationEnabled(true); + cls.addCustomProperty(eng.toStringHandle("foo"), QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); + cls.addCustomProperty(eng.toStringHandle("bar"), QScriptClass::HandlesReadAccess, /*id=*/2, /*attributes=*/0, /*value=*/456); + QScriptValue obj = eng.newObject(&cls); + QBENCHMARK { + QScriptValueIterator it(obj); + while (it.hasNext()) { + it.next(); + (void)it.scriptName(); + } + } +} + +QTEST_MAIN(tst_QScriptClass) +#include "tst_qscriptclass.moc" diff --git a/tests/benchmarks/script/qscriptengine/qscriptengine.pro b/tests/benchmarks/script/qscriptengine/qscriptengine.pro new file mode 100644 index 0000000..df6dbb3 --- /dev/null +++ b/tests/benchmarks/script/qscriptengine/qscriptengine.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qscriptengine + +SOURCES += tst_qscriptengine.cpp + +QT += script + +symbian* { + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 // Min 128kB, Max 32MB + TARGET.EPOCSTACKSIZE = 0x14000 +} diff --git a/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp new file mode 100644 index 0000000..6c6f0b1 --- /dev/null +++ b/tests/benchmarks/script/qscriptengine/tst_qscriptengine.cpp @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//TESTED_FILES= + +class tst_QScriptEngine : public QObject +{ + Q_OBJECT + +public: + tst_QScriptEngine(); + virtual ~tst_QScriptEngine(); + +public slots: + void init(); + void cleanup(); + +private slots: + void constructor(); + void evaluate_data(); + void evaluate(); + void evaluateProgram_data(); + void evaluateProgram(); + void connectAndDisconnect(); + void newObject(); + void newQObject(); + void newFunction(); + void newVariant(); + void collectGarbage(); + void pushAndPopContext(); + void toStringHandle(); + void castValueToQreal(); + void nativeCall(); + void translation_data(); + void translation(); +}; + +tst_QScriptEngine::tst_QScriptEngine() +{ +} + +tst_QScriptEngine::~tst_QScriptEngine() +{ +} + +void tst_QScriptEngine::init() +{ +} + +void tst_QScriptEngine::cleanup() +{ +} + +void tst_QScriptEngine::constructor() +{ + QBENCHMARK { + QScriptEngine engine; + (void)engine.parent(); + } +} + +void tst_QScriptEngine::evaluate_data() +{ + QTest::addColumn("code"); + QTest::newRow("empty script") << QString::fromLatin1(""); + QTest::newRow("number literal") << QString::fromLatin1("123"); + QTest::newRow("string literal") << QString::fromLatin1("'ciao'"); + QTest::newRow("regexp literal") << QString::fromLatin1("/foo/gim"); + QTest::newRow("null literal") << QString::fromLatin1("null"); + QTest::newRow("undefined literal") << QString::fromLatin1("undefined"); + QTest::newRow("null literal") << QString::fromLatin1("null"); + QTest::newRow("empty object literal") << QString::fromLatin1("{}"); + QTest::newRow("this") << QString::fromLatin1("this"); + QTest::newRow("object literal with one property") << QString::fromLatin1("{ foo: 123 }"); + QTest::newRow("object literal with two properties") << QString::fromLatin1("{ foo: 123, bar: 456 }"); + QTest::newRow("object literal with many properties") << QString::fromLatin1("{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10 }"); + QTest::newRow("empty array literal") << QString::fromLatin1("[]"); + QTest::newRow("array literal with one element") << QString::fromLatin1("[1]"); + QTest::newRow("array literal with two elements") << QString::fromLatin1("[1,2]"); + QTest::newRow("array literal with many elements") << QString::fromLatin1("[1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1]"); + QTest::newRow("empty function definition") << QString::fromLatin1("function foo() { }"); + QTest::newRow("function definition") << QString::fromLatin1("function foo() { return 123; }"); + QTest::newRow("for loop with empty body (1000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000; ++i) {}"); + QTest::newRow("for loop with empty body (10000 iterations)") << QString::fromLatin1("for (i = 0; i < 10000; ++i) {}"); + QTest::newRow("for loop with empty body (100000 iterations)") << QString::fromLatin1("for (i = 0; i < 100000; ++i) {}"); + QTest::newRow("for loop with empty body (1000000 iterations)") << QString::fromLatin1("for (i = 0; i < 1000000; ++i) {}"); + QTest::newRow("for loop (1000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000; ++i) { j += i; }; j"); + QTest::newRow("for loop (10000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 10000; ++i) { j += i; }; j"); + QTest::newRow("for loop (100000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 100000; ++i) { j += i; }; j"); + QTest::newRow("for loop (1000000 iterations)") << QString::fromLatin1("j = 0; for (i = 0; i < 1000000; ++i) { j += i; }; j"); + QTest::newRow("assignments") << QString::fromLatin1("a = 1; b = 2; c = 3; d = 4"); + QTest::newRow("while loop (1000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000) { ++i; }; i"); + QTest::newRow("while loop (10000 iterations)") << QString::fromLatin1("i = 0; while (i < 10000) { ++i; }; i"); + QTest::newRow("while loop (100000 iterations)") << QString::fromLatin1("i = 0; while (i < 100000) { ++i; }; i"); + QTest::newRow("while loop (1000000 iterations)") << QString::fromLatin1("i = 0; while (i < 1000000) { ++i; }; i"); + QTest::newRow("function expression") << QString::fromLatin1("(function(a, b, c){ return a + b + c; })(1, 2, 3)"); +} + +void tst_QScriptEngine::evaluate() +{ + QFETCH(QString, code); + QScriptEngine engine; + + QBENCHMARK { + (void)engine.evaluate(code); + } +} + +void tst_QScriptEngine::connectAndDisconnect() +{ + QScriptEngine engine; + QScriptValue fun = engine.evaluate("(function() { })"); + QBENCHMARK { + qScriptConnect(&engine, SIGNAL(destroyed()), QScriptValue(), fun); + qScriptDisconnect(&engine, SIGNAL(destroyed()), QScriptValue(), fun); + } +} + +void tst_QScriptEngine::evaluateProgram_data() +{ + evaluate_data(); +} + +void tst_QScriptEngine::evaluateProgram() +{ + QFETCH(QString, code); + QScriptEngine engine; + QScriptProgram program(code); + + QBENCHMARK { + (void)engine.evaluate(program); + } +} + +void tst_QScriptEngine::newObject() +{ + QScriptEngine engine; + QBENCHMARK { + (void)engine.newObject(); + } +} + +void tst_QScriptEngine::newQObject() +{ + QScriptEngine engine; + QBENCHMARK { + (void)engine.newQObject(QCoreApplication::instance()); + } +} + +static QScriptValue testFunction(QScriptContext *, QScriptEngine *) +{ + return 0; +} + +void tst_QScriptEngine::newFunction() +{ + QScriptEngine engine; + QBENCHMARK { + (void)engine.newFunction(testFunction); + } +} + +void tst_QScriptEngine::newVariant() +{ + QScriptEngine engine; + QVariant var(123); + QBENCHMARK { + (void)engine.newVariant(var); + } +} + +void tst_QScriptEngine::collectGarbage() +{ + QScriptEngine engine; + QBENCHMARK { + engine.collectGarbage(); + } +} + +void tst_QScriptEngine::pushAndPopContext() +{ + QScriptEngine engine; + QBENCHMARK { + (void)engine.pushContext(); + engine.popContext(); + } +} + +void tst_QScriptEngine::toStringHandle() +{ + QScriptEngine engine; + QString str = QString::fromLatin1("foobarbaz"); + QBENCHMARK { + (void)engine.toStringHandle(str); + } +} + +void tst_QScriptEngine::castValueToQreal() +{ + QScriptEngine engine; + QScriptValue val(123); + QBENCHMARK { + (void)qscriptvalue_cast(val); + } +} + +static QScriptValue native_function(QScriptContext *, QScriptEngine *) +{ + return 42; +} + +void tst_QScriptEngine::nativeCall() +{ + QScriptEngine eng; + eng.globalObject().setProperty("fun", eng.newFunction(native_function)); + QBENCHMARK{ +#if !defined(Q_OS_SYMBIAN) + eng.evaluate("var w = 0; for (i = 0; i < 100000; ++i) {\n" + " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }"); +#else + eng.evaluate("var w = 0; for (i = 0; i < 25000; ++i) {\n" + " w += fun() + fun(); w -= fun(); fun(); w -= fun(); }"); +#endif + } +} + +void tst_QScriptEngine::translation_data() +{ + QTest::addColumn("text"); + QTest::newRow("no translation") << "\"hello world\""; + QTest::newRow("qsTr") << "qsTr(\"hello world\")"; + QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")"; +} + +void tst_QScriptEngine::translation() +{ + QFETCH(QString, text); + QScriptEngine engine; + engine.installTranslatorFunctions(); + + QBENCHMARK { + (void)engine.evaluate(text); + } +} + +QTEST_MAIN(tst_QScriptEngine) +#include "tst_qscriptengine.moc" diff --git a/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro b/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro new file mode 100644 index 0000000..04ea324 --- /dev/null +++ b/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qscriptvalue + +SOURCES += tst_qscriptvalue.cpp + +QT += script diff --git a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp new file mode 100644 index 0000000..3bfc21c --- /dev/null +++ b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +//TESTED_FILES= + +class tst_QScriptValue : public QObject +{ + Q_OBJECT + +public: + tst_QScriptValue(); + virtual ~tst_QScriptValue(); + +public slots: + void init(); + void cleanup(); + +private slots: + void numberConstructor(); + void stringConstructor(); + void call_data(); + void call(); + void construct_data(); + void construct(); + void toString_data(); + void toString(); + void toQObject(); + void property(); + void setProperty(); + void propertyFlags(); +}; + +tst_QScriptValue::tst_QScriptValue() +{ +} + +tst_QScriptValue::~tst_QScriptValue() +{ +} + +void tst_QScriptValue::init() +{ +} + +void tst_QScriptValue::cleanup() +{ +} + +void tst_QScriptValue::numberConstructor() +{ + QBENCHMARK { + (void)QScriptValue(123); + } +} + +void tst_QScriptValue::stringConstructor() +{ + QString str = QString::fromLatin1("ciao"); + QBENCHMARK { + (void)QScriptValue(str); + } +} + +void tst_QScriptValue::call_data() +{ + QTest::addColumn("code"); + QTest::newRow("empty function") << QString::fromLatin1("(function(){})"); + QTest::newRow("function returning number") << QString::fromLatin1("(function(){ return 123; })"); + QTest::newRow("closure") << QString::fromLatin1("(function(a, b){ return function() { return a + b; }; })(1, 2)"); +} + +void tst_QScriptValue::call() +{ + QFETCH(QString, code); + QScriptEngine engine; + QScriptValue fun = engine.evaluate(code); + QVERIFY(fun.isFunction()); + QBENCHMARK { + (void)fun.call(); + } +} + +void tst_QScriptValue::construct_data() +{ + QTest::addColumn("code"); + QTest::newRow("empty function") << QString::fromLatin1("(function(){})"); + QTest::newRow("simple constructor") << QString::fromLatin1("(function(){ this.x = 10; this.y = 20; })"); +} + +void tst_QScriptValue::construct() +{ + QFETCH(QString, code); + QScriptEngine engine; + QScriptValue fun = engine.evaluate(code); + QVERIFY(fun.isFunction()); + QBENCHMARK { + (void)fun.construct(); + } +} + +void tst_QScriptValue::toString_data() +{ + QTest::addColumn("code"); + QTest::newRow("number") << QString::fromLatin1("123"); + QTest::newRow("string") << QString::fromLatin1("'ciao'"); + QTest::newRow("null") << QString::fromLatin1("null"); + QTest::newRow("undefined") << QString::fromLatin1("undefined"); + QTest::newRow("function") << QString::fromLatin1("(function foo(a, b, c) { return a + b + c; })"); +} + +void tst_QScriptValue::toString() +{ + QFETCH(QString, code); + QScriptEngine engine; + QScriptValue val = engine.evaluate(code); + QBENCHMARK { + (void)val.toString(); + } +} + +void tst_QScriptValue::toQObject() +{ + QScriptEngine engine; + QScriptValue obj = engine.newQObject(QCoreApplication::instance()); + QBENCHMARK { + (void)obj.toQObject(); + } +} + +void tst_QScriptValue::property() +{ + QScriptEngine engine; + QScriptValue obj = engine.newObject(); + QString propertyName = QString::fromLatin1("foo"); + obj.setProperty(propertyName, 123); + QBENCHMARK { + (void)obj.property(propertyName); + } +} + +void tst_QScriptValue::setProperty() +{ + QScriptEngine engine; + QScriptValue obj = engine.newObject(); + QString propertyName = QString::fromLatin1("foo"); + QScriptValue val(123); + QBENCHMARK { + obj.setProperty(propertyName, val); + } +} + +void tst_QScriptValue::propertyFlags() +{ + QScriptEngine engine; + QScriptValue obj = engine.newObject(); + QString propertyName = QString::fromLatin1("foo"); + obj.setProperty(propertyName, 123, QScriptValue::SkipInEnumeration | QScriptValue::ReadOnly); + QBENCHMARK { + (void)obj.propertyFlags(propertyName); + } +} + +QTEST_MAIN(tst_QScriptValue) +#include "tst_qscriptvalue.moc" diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro new file mode 100644 index 0000000..8d689b6 --- /dev/null +++ b/tests/benchmarks/script/script.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qscriptclass \ + qscriptengine \ + qscriptvalue diff --git a/tests/benchmarks/svg/qsvgrenderer/data/tiger.svg b/tests/benchmarks/svg/qsvgrenderer/data/tiger.svg new file mode 100644 index 0000000..983e570 --- /dev/null +++ b/tests/benchmarks/svg/qsvgrenderer/data/tiger.svg @@ -0,0 +1,730 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro b/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro new file mode 100644 index 0000000..8222a09 --- /dev/null +++ b/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qsvgrenderer + +SOURCES += tst_qsvgrenderer.cpp +RESOURCES += qsvgrenderer.qrc + +QT += svg + diff --git a/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.qrc b/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.qrc new file mode 100644 index 0000000..bdf4a31 --- /dev/null +++ b/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.qrc @@ -0,0 +1,6 @@ + + + data/tiger.svg + + + diff --git a/tests/benchmarks/svg/qsvgrenderer/tst_qsvgrenderer.cpp b/tests/benchmarks/svg/qsvgrenderer/tst_qsvgrenderer.cpp new file mode 100644 index 0000000..895ffe0 --- /dev/null +++ b/tests/benchmarks/svg/qsvgrenderer/tst_qsvgrenderer.cpp @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +//TESTED_FILES= + +class tst_QSvgRenderer : public QObject +{ + Q_OBJECT + +public: + tst_QSvgRenderer(); + virtual ~tst_QSvgRenderer(); + +public slots: + void init(); + void cleanup(); + +private slots: + void construct(); + void load(); +}; + +tst_QSvgRenderer::tst_QSvgRenderer() +{ +} + +tst_QSvgRenderer::~tst_QSvgRenderer() +{ +} + +void tst_QSvgRenderer::init() +{ +} + +void tst_QSvgRenderer::cleanup() +{ +} + +void tst_QSvgRenderer::construct() +{ + QBENCHMARK { + QSvgRenderer renderer; + } +} + +void tst_QSvgRenderer::load() +{ + QFile file(":/data/tiger.svg"); + if (!file.open(QFile::ReadOnly)) + QFAIL("Can not open tiger.svg"); + QByteArray data = file.readAll(); + QSvgRenderer renderer; + + QBENCHMARK { + renderer.load(data); + } +} + +QTEST_MAIN(tst_QSvgRenderer) +#include "tst_qsvgrenderer.moc" diff --git a/tests/benchmarks/svg/svg.pro b/tests/benchmarks/svg/svg.pro new file mode 100644 index 0000000..cdc2ca5 --- /dev/null +++ b/tests/benchmarks/svg/svg.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qsvgrenderer diff --git a/tests/tests.pro b/tests/tests.pro index 7fbc8a9..75ca120 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs -SUBDIRS = auto +SUBDIRS = auto \ + benchmarks -- cgit v0.12 From 379fedb59934fae63618f50ea327369c17a214db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 8 Feb 2010 14:40:49 +0100 Subject: Delete benchmark examples (qtestlib-simple and qtwidgets). These have no real value anymore now that we have plenty of other benchmarks. They served as examples on how to use the QBENCHMARK macro. --- tests/benchmarks/qtestlib-simple/main.cpp | 117 -- .../benchmarks/qtestlib-simple/qtestlib-simple.pro | 8 - tests/benchmarks/qtwidgets/advanced.ui | 319 ------ tests/benchmarks/qtwidgets/icons/big.png | Bin 1323 -> 0 bytes tests/benchmarks/qtwidgets/icons/folder.png | Bin 4069 -> 0 bytes tests/benchmarks/qtwidgets/icons/icon.bmp | Bin 246 -> 0 bytes tests/benchmarks/qtwidgets/icons/icon.png | Bin 344 -> 0 bytes tests/benchmarks/qtwidgets/mainwindow.cpp | 313 ----- tests/benchmarks/qtwidgets/mainwindow.h | 80 -- tests/benchmarks/qtwidgets/qtstyles.qrc | 8 - tests/benchmarks/qtwidgets/qtwidgets.pro | 9 - tests/benchmarks/qtwidgets/standard.ui | 1207 -------------------- tests/benchmarks/qtwidgets/system.ui | 658 ----------- tests/benchmarks/qtwidgets/tst_qtwidgets.cpp | 67 -- 14 files changed, 2786 deletions(-) delete mode 100644 tests/benchmarks/qtestlib-simple/main.cpp delete mode 100644 tests/benchmarks/qtestlib-simple/qtestlib-simple.pro delete mode 100644 tests/benchmarks/qtwidgets/advanced.ui delete mode 100644 tests/benchmarks/qtwidgets/icons/big.png delete mode 100644 tests/benchmarks/qtwidgets/icons/folder.png delete mode 100644 tests/benchmarks/qtwidgets/icons/icon.bmp delete mode 100644 tests/benchmarks/qtwidgets/icons/icon.png delete mode 100644 tests/benchmarks/qtwidgets/mainwindow.cpp delete mode 100644 tests/benchmarks/qtwidgets/mainwindow.h delete mode 100644 tests/benchmarks/qtwidgets/qtstyles.qrc delete mode 100644 tests/benchmarks/qtwidgets/qtwidgets.pro delete mode 100644 tests/benchmarks/qtwidgets/standard.ui delete mode 100644 tests/benchmarks/qtwidgets/system.ui delete mode 100644 tests/benchmarks/qtwidgets/tst_qtwidgets.cpp diff --git a/tests/benchmarks/qtestlib-simple/main.cpp b/tests/benchmarks/qtestlib-simple/main.cpp deleted file mode 100644 index a8dabe9..0000000 --- a/tests/benchmarks/qtestlib-simple/main.cpp +++ /dev/null @@ -1,117 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include - -#include - - -class tst_QHash : public QObject -{ - Q_OBJECT -private slots: - void foo1_data(); - void foo1(); - void foo2_data(); - void foo2(); - void foo3(); -}; - -void tst_QHash::foo1_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::newRow("tag1.1") << 16 << 17; - QTest::newRow("tag2.1") << 18 << 19; -} - -void tst_QHash::foo1() -{ - QFETCH(int, x); - QFETCH(int, y); - Q_UNUSED(x); - Q_UNUSED(y); - - QHash testHash; - - QBENCHMARK { - testHash.insertMulti(1, 1); - } -} - -void tst_QHash::foo2_data() -{ - QTest::addColumn("x"); - QTest::addColumn("y"); - QTest::newRow("tag1.1") << 16 << 17; - QTest::newRow("tag2.1") << 18 << 19; -} - -void tst_QHash::foo2() -{ - QFETCH(int, x); - QFETCH(int, y); - Q_UNUSED(x); - Q_UNUSED(y); - - QHash testHash; - - QBENCHMARK { - testHash.insertMulti(1, 1); - } - - QBENCHMARK { - testHash.insertMulti(1, 1); - } -} - -void tst_QHash::foo3() -{ - QHash testHash; - - QBENCHMARK { - testHash.insertMulti(1, 1); - } -} - - -QTEST_MAIN(tst_QHash) -#include "main.moc" diff --git a/tests/benchmarks/qtestlib-simple/qtestlib-simple.pro b/tests/benchmarks/qtestlib-simple/qtestlib-simple.pro deleted file mode 100644 index 7c49883..0000000 --- a/tests/benchmarks/qtestlib-simple/qtestlib-simple.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qtestlib-simple -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += main.cpp diff --git a/tests/benchmarks/qtwidgets/advanced.ui b/tests/benchmarks/qtwidgets/advanced.ui deleted file mode 100644 index ce27374..0000000 --- a/tests/benchmarks/qtwidgets/advanced.ui +++ /dev/null @@ -1,319 +0,0 @@ - - - - - Advanced - - - Advanced - - - - 0 - 0 - 400 - 300 - - - - - - - - 9 - - - 6 - - - - - - - - 1 - - - 6 - - - - - pushButton - - - - 1 - 1 - 80 - 23 - - - - - - - - - - - pushButton_2 - - - - 87 - 1 - 80 - 23 - - - - Text - - - - - - - checkBox - - - - 173 - 6 - 23 - 13 - - - - - - - - - - - - - - radioButton - - - - 202 - 6 - 22 - 12 - - - - - - - - - - - - - - checkBox_2 - - - - 230 - 3 - 44 - 18 - - - - Text - - - - - - - radioButton_2 - - - - 280 - 3 - 43 - 18 - - - - Text - - - - - - - - - - - - 1 - - - 6 - - - - - listWidget - - - - 1 - 1 - 186 - 91 - - - - - - - - listWidget_3 - - - - 193 - 96 - 188 - 60 - - - - - - - - treeWidget_2 - - - - 1 - 96 - 186 - 60 - - - - - - - - - - - 1 - - - 6 - - - - - listWidget_2 - - - - 1 - 1 - 186 - 43 - - - - - - - - treeWidget - - - - 1 - 48 - 186 - 43 - - - - - - - - - - - - tabWidget - - - - 9 - 201 - 382 - 90 - - - - - 0 - 90 - - - - QTabWidget::North - - - QTabWidget::Rounded - - - - widget - - - - 0 - 0 - 380 - 63 - - - - Tab Page 1 - - - - - widget - - - - 0 - 0 - 459 - 66 - - - - Tab Page 2 - - - - - - - - - diff --git a/tests/benchmarks/qtwidgets/icons/big.png b/tests/benchmarks/qtwidgets/icons/big.png deleted file mode 100644 index 6032804..0000000 Binary files a/tests/benchmarks/qtwidgets/icons/big.png and /dev/null differ diff --git a/tests/benchmarks/qtwidgets/icons/folder.png b/tests/benchmarks/qtwidgets/icons/folder.png deleted file mode 100644 index 981a25d..0000000 Binary files a/tests/benchmarks/qtwidgets/icons/folder.png and /dev/null differ diff --git a/tests/benchmarks/qtwidgets/icons/icon.bmp b/tests/benchmarks/qtwidgets/icons/icon.bmp deleted file mode 100644 index 196de6a..0000000 Binary files a/tests/benchmarks/qtwidgets/icons/icon.bmp and /dev/null differ diff --git a/tests/benchmarks/qtwidgets/icons/icon.png b/tests/benchmarks/qtwidgets/icons/icon.png deleted file mode 100644 index 8f9c562..0000000 Binary files a/tests/benchmarks/qtwidgets/icons/icon.png and /dev/null differ diff --git a/tests/benchmarks/qtwidgets/mainwindow.cpp b/tests/benchmarks/qtwidgets/mainwindow.cpp deleted file mode 100644 index bb19567..0000000 --- a/tests/benchmarks/qtwidgets/mainwindow.cpp +++ /dev/null @@ -1,313 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "mainwindow.h" -#include -#include - -StyleWidget::StyleWidget(QWidget *parent, Qt::WFlags f) - : QWidget(parent, f) -{ - QHBoxLayout *hbox = new QHBoxLayout(this); - QSplitter *spl = new QSplitter(this); - - // standard widgets - QWidget *leftWidget = new QWidget(this); - m_staWidget.setupUi(leftWidget); - - // advanced/system widgets - QGroupBox *rightWidget = new QGroupBox("Advanced", this); - QVBoxLayout *vbox = new QVBoxLayout(rightWidget); - QWidget *adv = new QWidget(rightWidget); - m_advWidget.setupUi(adv); - QWidget *sys = new QWidget(rightWidget); - m_sysWidget.setupUi(sys); - vbox->addWidget(adv); - vbox->addWidget(sys); - - spl->addWidget(leftWidget); - spl->addWidget(rightWidget); - - hbox->setMargin(4); - hbox->addWidget(spl); - - m_small1 = QIcon(":/icons/icon.bmp"); - m_small2 = QIcon(":/icons/icon.png"); - m_big = QIcon(":/icons/big.png"); - - addComboBoxItems(); - addTreeItems(); - addTreeListItems(); - addListItems(); - addTextEdit(); - setupOtherWidgets(); - setupButtons(); - - foreach(QWidget *w, qFindChildren(parentWidget())) - w->setWhatsThis(w->metaObject()->className()); -} - -StyleWidget::~StyleWidget() -{ - -} - -void StyleWidget::addTextEdit() -{ - m_staWidget.textEdit->setPlainText( - "Some Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text"); - m_staWidget.textEdit_2->setPlainText( - "Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text"); - m_staWidget.textEdit_3->setPlainText( - "Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text, Some Text" \ - "Some Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\nSome Text\n"); -} - -void StyleWidget::addComboBoxItems() -{ - m_staWidget.comboBox->addItem("Item 1"); - m_staWidget.comboBox->addItem("Item 2"); - m_staWidget.comboBox->addItem("Item 3"); - m_staWidget.comboBox->addItem("Item 4"); - m_staWidget.comboBox->addItem("Item 5"); -} - -void StyleWidget::addListItems() -{ - m_staWidget.listWidget->addItem("Item 1"); - m_staWidget.listWidget->addItem("Item 2"); - m_staWidget.listWidget->addItem("Item 3"); - m_staWidget.listWidget->addItem("Item 4"); - m_staWidget.listWidget->addItem("Item 5"); - - QListWidgetItem *tmp = new QListWidgetItem("Item 1", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 2", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 3", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 4", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - tmp = new QListWidgetItem("Item 5", m_staWidget.listWidget_2); - tmp->setCheckState(Qt::Checked); - - tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget_3); - tmp->setCheckState(Qt::Checked); - tmp->setIcon(m_small1); - - m_advWidget.listWidget->setViewMode(QListView::IconMode); - QIcon folder(":/icons/folder.png"); - tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget); - tmp->setIcon(folder); - tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget); - tmp->setIcon(folder); - - tmp = new QListWidgetItem("Item 1", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 2", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 3", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 4", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); - tmp = new QListWidgetItem("Item 5", m_advWidget.listWidget_2); - tmp->setIcon(m_small1); -} - -void StyleWidget::setupOtherWidgets() -{ - m_sysWidget.tableWidget->setRowCount(100); - m_sysWidget.tableWidget->setColumnCount(100); -} - -void StyleWidget::addTreeItems() -{ - //standard tree - m_staWidget.treeWidget_2->setColumnCount(1); - m_staWidget.treeWidget_2->header()->hide(); - - QTreeWidgetItem *tmp; - QTreeWidgetItem *subtmp; - QTreeWidgetItem *root1 = new QTreeWidgetItem(m_staWidget.treeWidget_2); - root1->setText(0, "Root 1"); - QTreeWidgetItem *root2 = new QTreeWidgetItem(m_staWidget.treeWidget_2); - root2->setText(0, "Root 2"); - - for (int i=1; i<=10; ++i) - { - tmp = new QTreeWidgetItem(root1); - tmp->setText(0, QString("Item %1").arg(i)); - for (int j=1; j<=5; ++j) - { - subtmp = new QTreeWidgetItem(tmp); - subtmp->setText(0, QString("Sub Item %1").arg(j)); - } - } - - // standard checked tree - m_staWidget.treeWidget_4->setColumnCount(1); - m_staWidget.treeWidget_4->header()->hide(); - - root1 = new QTreeWidgetItem(m_staWidget.treeWidget_4); - root1->setText(0, "Root 1"); - root1->setCheckState(0, Qt::Checked); - root2 = new QTreeWidgetItem(m_staWidget.treeWidget_4); - root2->setText(0, "Root 2"); - root2->setCheckState(0, Qt::Checked); - - for (int i=1; i<=10; ++i) - { - tmp = new QTreeWidgetItem(root1); - tmp->setText(0, QString("Item %1").arg(i)); - tmp->setCheckState(0, Qt::Checked); - for (int j=1; j<=5; ++j) - { - subtmp = new QTreeWidgetItem(tmp); - subtmp->setText(0, QString("Sub Item %1").arg(j)); - subtmp->setCheckState(0, Qt::Checked); - } - } - - // advanced (images) tree - m_advWidget.treeWidget_2->setColumnCount(1); - m_advWidget.treeWidget_2->header()->hide(); - - root1 = new QTreeWidgetItem(m_advWidget.treeWidget_2); - root1->setText(0, "Root 1"); - root1->setIcon(0, m_small1); - root2 = new QTreeWidgetItem(m_advWidget.treeWidget_2); - root2->setText(0, "Root 2"); - root2->setIcon(0, m_small1); - - for (int i=1; i<=10; ++i) - { - tmp = new QTreeWidgetItem(root1); - tmp->setText(0, QString("Item %1").arg(i)); - tmp->setIcon(0, m_small2); - for (int j=1; j<=5; ++j) - { - subtmp = new QTreeWidgetItem(tmp); - subtmp->setText(0, QString("Sub Item %1").arg(j)); - tmp->setIcon(0, m_small1); - } - } - -} - -void StyleWidget::addTreeListItems() -{ - //standard list - QTreeWidgetItem *tmp; - m_staWidget.treeWidget->setColumnCount(3); - m_staWidget.treeWidget->headerItem()->setText(0, "Col1"); - m_staWidget.treeWidget->headerItem()->setText(1, "Col2"); - m_staWidget.treeWidget->headerItem()->setText(2, "Col3"); - - for (int i=1; i<10; ++i) - { - tmp = new QTreeWidgetItem(m_staWidget.treeWidget); - tmp->setText(0, QString("Item%1").arg(i)); - tmp->setText(1, QString("Item%11").arg(i)); - tmp->setText(2, QString("Item%12").arg(i)); - } - - //standard checked list - m_staWidget.treeWidget_3->setColumnCount(3); - m_staWidget.treeWidget_3->headerItem()->setText(0, "Col1"); - m_staWidget.treeWidget_3->headerItem()->setText(1, "Col2"); - m_staWidget.treeWidget_3->headerItem()->setText(2, "Col3"); - - for (int i=1; i<10; ++i) - { - tmp = new QTreeWidgetItem(m_staWidget.treeWidget_3); - tmp->setText(0, QString("Item%1").arg(i)); - tmp->setCheckState(0, Qt::Checked); - tmp->setText(1, QString("Item%11").arg(i)); - tmp->setText(2, QString("Item%12").arg(i)); - } - - //with images - m_advWidget.treeWidget->setColumnCount(2); - m_advWidget.treeWidget->headerItem()->setText(0, "Col1"); - m_advWidget.treeWidget->headerItem()->setIcon(0, m_small2); - m_advWidget.treeWidget->headerItem()->setText(1, "Col2"); - m_advWidget.treeWidget->headerItem()->setIcon(1, m_small2); - - for (int i=1; i<10; ++i) - { - tmp = new QTreeWidgetItem(m_advWidget.treeWidget); - tmp->setText(0, QString("Item%1").arg(i)); - tmp->setIcon(0, m_small1); - tmp->setText(1, QString("Item%11").arg(i)); - } -} - -void StyleWidget::setupButtons() -{ - m_advWidget.pushButton->setIcon(m_small1); - m_advWidget.pushButton_2->setIcon(m_small1); - m_advWidget.checkBox->setIcon(m_small2); - m_advWidget.checkBox_2->setIcon(m_small2); - m_advWidget.radioButton->setIcon(m_small2); - m_advWidget.radioButton_2->setIcon(m_small2); - - // tab page images - m_advWidget.tabWidget->setTabIcon(0, m_small2); - m_advWidget.tabWidget->setTabIcon(1, m_small2); -} diff --git a/tests/benchmarks/qtwidgets/mainwindow.h b/tests/benchmarks/qtwidgets/mainwindow.h deleted file mode 100644 index 8a4521a..0000000 --- a/tests/benchmarks/qtwidgets/mainwindow.h +++ /dev/null @@ -1,80 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include -#include -#include "ui_standard.h" -#include "ui_advanced.h" -#include "ui_system.h" - -class StyleWidget : public QWidget -{ - Q_OBJECT - -public: - StyleWidget(QWidget *parent = 0, Qt::WFlags f = 0); - ~StyleWidget(); - -public slots: - void onWhatsThis() { QWhatsThis::enterWhatsThisMode(); } - -private: - void addComboBoxItems(); - void addListItems(); - void addTextEdit(); - void setupOtherWidgets(); - void setupButtons(); - void addTreeItems(); - void addTreeListItems(); - - Ui::Standard m_staWidget; - Ui::Advanced m_advWidget; - Ui::System m_sysWidget; - - QIcon m_small1; - QIcon m_small2; - QIcon m_big; -}; - -#endif //MAINWINDOW_H - diff --git a/tests/benchmarks/qtwidgets/qtstyles.qrc b/tests/benchmarks/qtwidgets/qtstyles.qrc deleted file mode 100644 index 772891d..0000000 --- a/tests/benchmarks/qtwidgets/qtstyles.qrc +++ /dev/null @@ -1,8 +0,0 @@ - - - ./icons/icon.png - ./icons/icon.bmp - ./icons/big.png - ./icons/folder.png - - diff --git a/tests/benchmarks/qtwidgets/qtwidgets.pro b/tests/benchmarks/qtwidgets/qtwidgets.pro deleted file mode 100644 index ad5e7ac..0000000 --- a/tests/benchmarks/qtwidgets/qtwidgets.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) - -SOURCES += tst_qtwidgets.cpp mainwindow.cpp -HEADERS += mainwindow.h -QT += network -RESOURCES = qtstyles.qrc -FORMS += advanced.ui system.ui standard.ui - - diff --git a/tests/benchmarks/qtwidgets/standard.ui b/tests/benchmarks/qtwidgets/standard.ui deleted file mode 100644 index 9764a66..0000000 --- a/tests/benchmarks/qtwidgets/standard.ui +++ /dev/null @@ -1,1207 +0,0 @@ - - - - - Standard - - - Standard - - - - 0 - 0 - 400 - 300 - - - - - - - - 0 - - - 0 - - - - - groupBox - - - - 0 - 0 - 400 - 300 - - - - Standard - - - - - - - 9 - - - 6 - - - - - - - - 1 - - - 6 - - - - - - - - 1 - - - 6 - - - - - - - - 1 - - - 6 - - - - - checkBox - - - - 1 - 1 - 114 - 3 - - - - Enabled &CheckBox - - - - - - - checkBox_2 - - - false - - - - 121 - 1 - 116 - 3 - - - - Disabled Check&Box - - - - - - - - - - - 243 - 1 - 80 - 3 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 1 - - - 6 - - - - - comboBox - - - - 1 - 1 - 41 - 3 - - - - - - - - comboBox_2 - - - - 48 - 1 - 41 - 3 - - - - - - - - comboBox_3 - - - false - - - - 95 - 1 - 41 - 3 - - - - - - - - - - - - - 1 - - - 6 - - - - - pushButton - - - - 1 - 1 - 80 - 3 - - - - &Enabled - - - - - - - pushButton_2 - - - false - - - - 87 - 1 - 80 - 3 - - - - Di&sabled - - - - - - - - - - - 173 - 1 - 150 - 3 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 1 - - - 6 - - - - - label - - - - 1 - 1 - 99 - 3 - - - - QFrame::NoFrame - - - QFrame::Plain - - - Label with some text. - - - Qt::AutoText - - - - - - - label_2 - - - false - - - - 106 - 1 - 139 - 3 - - - - QFrame::NoFrame - - - QFrame::Plain - - - Disabled label with some text. - - - Qt::AutoText - - - - - - - - - - - 251 - 1 - 72 - 3 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 1 - - - 6 - - - - - lineEdit - - - - 1 - 1 - 135 - 3 - - - - Enabled - - - QLineEdit::Normal - - - - - - - lineEdit_2 - - - false - - - - 142 - 1 - 134 - 3 - - - - Disabled - - - QLineEdit::Normal - - - - - - - spinBox - - - - 282 - 1 - 41 - 3 - - - - QAbstractSpinBox::UpDownArrows - - - - - - - - - - - - 1 - - - 6 - - - - - radioButton - - - - 1 - 1 - 123 - 3 - - - - Enabled RadioButton - - - - - - - radioButton_2 - - - false - - - - 130 - 1 - 125 - 3 - - - - Disabled RadioButton - - - - - - - - - - - 261 - 1 - 62 - 3 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 1 - - - 6 - - - - - horizontalScrollBar - - - - 1 - 1 - 90 - 3 - - - - - 0 - 0 - 0 - 0 - - - - - 90 - 0 - - - - Qt::Horizontal - - - - - - - horizontalScrollBar_2 - - - - 97 - 1 - 30 - 3 - - - - Qt::Horizontal - - - - - - - - - - - verticalScrollBar - - - - 333 - 1 - 17 - 37 - - - - - 0 - 1 - 0 - 0 - - - - Qt::Vertical - - - - - - - slider - - - - 356 - 1 - 21 - 37 - - - - - 0 - 1 - 0 - 0 - - - - Qt::Vertical - - - QSlider::TicksBelow - - - 0 - - - - - - - - - - - - 1 - - - 6 - - - - - slider_2 - - - - 1 - 6 - 90 - 16 - - - - Qt::Horizontal - - - QSlider::NoTicks - - - - - - - slider_3 - - - - 97 - 3 - 89 - 21 - - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - slider_4 - - - - 192 - 3 - 90 - 21 - - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - slider_5 - - - - 288 - 1 - 89 - 26 - - - - Qt::Horizontal - - - QSlider::TicksBothSides - - - - - - - - - - - - 1 - - - 6 - - - - - textEdit - - - - 1 - 1 - 89 - 37 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - - - - - textEdit_2 - - - - 96 - 1 - 90 - 37 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOn - - - - - - - textEdit_3 - - - - 192 - 1 - 89 - 100 - - - - - 0 - 100 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOn - - - - - - - textEdit_4 - - - - 287 - 1 - 90 - 37 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAsNeeded - - - - - - - - - groupBox_2 - - - - 11 - 132 - 378 - 39 - - - - GroupBox - - - - - - - 9 - - - 6 - - - - - progressBar - - - - 11 - 20 - 356 - 8 - - - - 50 - - - false - - - - - - - - - - - - - 1 - - - 6 - - - - - listWidget - - - - 1 - 1 - 107 - 37 - - - - - - - - listWidget_2 - - - - 114 - 1 - 107 - 37 - - - - - - - - tabWidget - - - - 227 - 1 - 150 - 37 - - - - - 150 - 0 - - - - QTabWidget::North - - - QTabWidget::Rounded - - - - - - - - 0 - 0 - 148 - 10 - - - - Tab Page 1 - - - - - - - - - 0 - 0 - 116 - 56 - - - - Tab Page 2 - - - - - widget - - - - 0 - 0 - 116 - 56 - - - - Tab Page 3 - - - - - widget - - - - 0 - 0 - 146 - 36 - - - - Tab Page 4 - - - - - - - - - - tabWidget_2 - - - - 11 - 214 - 378 - 90 - - - - - 0 - 90 - - - - QTabWidget::North - - - QTabWidget::Rounded - - - - widget - - - - 0 - 0 - 376 - 63 - - - - Tab Page 1 - - - - - widget - - - - 0 - 0 - 424 - 66 - - - - Tab Page 2 - - - - - - - - - - - 1 - - - 6 - - - - - treeWidget_2 - - - - 192 - 1 - 185 - 18 - - - - - - - - treeWidget_3 - - - - 1 - 20 - 185 - 18 - - - - - - - - treeWidget - - - - 1 - 1 - 185 - 18 - - - - - - - - treeWidget_4 - - - - 192 - 20 - 185 - 18 - - - - - - - - - - - - - - diff --git a/tests/benchmarks/qtwidgets/system.ui b/tests/benchmarks/qtwidgets/system.ui deleted file mode 100644 index a641e0e..0000000 --- a/tests/benchmarks/qtwidgets/system.ui +++ /dev/null @@ -1,658 +0,0 @@ - - - - - System - - - System - - - - 0 - 0 - 400 - 604 - - - - - - - - 9 - - - 6 - - - - - - - - 1 - - - 6 - - - - - toolButton - - - - 340 - 138 - 15 - 19 - - - - ... - - - - - - - horizontalLine - - - - 1 - 146 - 333 - 3 - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - verticalLine - - - - 361 - 1 - 3 - 131 - - - - QFrame::VLine - - - QFrame::Sunken - - - - - - - - - - 1 - - - 6 - - - - - dateTimeEdit_2 - - - false - - - - 1 - 108 - 113 - 20 - - - - QAbstractSpinBox::UpDownArrows - - - - - - - dateTimeEdit - - - - 1 - 41 - 113 - 20 - - - - QAbstractSpinBox::UpDownArrows - - - - - - - dial - - - - 120 - 1 - 114 - 100 - - - - Qt::Horizontal - - - - - - - lcdNumber - - - - 120 - 107 - 114 - 23 - - - - QFrame::Box - - - QFrame::Raised - - - QLCDNumber::Dec - - - QLCDNumber::Outline - - - - - - - lcdNumber_2 - - - false - - - - 240 - 107 - 113 - 23 - - - - QFrame::Box - - - QFrame::Raised - - - QLCDNumber::Dec - - - QLCDNumber::Outline - - - - - - - dial_2 - - - false - - - - 240 - 1 - 113 - 100 - - - - Qt::Horizontal - - - - - - - - - - - - - - 1 - - - 6 - - - - - tableWidget - - - - 1 - 1 - 256 - 193 - - - - - - - - toolBox - - - - 263 - 1 - 118 - 193 - - - - QFrame::Box - - - QFrame::Plain - - - 0 - - - - widget - - - - 0 - 0 - 98 - 119 - - - - Tool Page 1 - - - - - widget - - - - 0 - 0 - 115 - 56 - - - - Tool Page 2 - - - - - - - - - - tabWidget - - - - 9 - 375 - 382 - 220 - - - - QTabWidget::Rounded - - - - widget - - - - 0 - 0 - 378 - 196 - - - - Tab Page 1 - - - - - - - 9 - - - 6 - - - - - - - - 1 - - - 6 - - - - - comboBox_3 - - - - 1 - 1 - 332 - 20 - - - - - - - - - - - 1 - - - 6 - - - - - pushButton_5 - - - - 1 - 1 - 80 - 23 - - - - &Enabled - - - - - - - pushButton_6 - - - - 87 - 1 - 80 - 23 - - - - Di&sabled - - - - - - - - - - - 173 - 1 - 158 - 23 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 1 - - - 6 - - - - - radioButton_3 - - - - 1 - 2 - 123 - 18 - - - - Enabled RadioButton - - - - - - - radioButton_4 - - - - 130 - 2 - 125 - 18 - - - - Disabled RadioButton - - - - - - - - - - - 261 - 1 - 70 - 20 - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - progressBar - - - - 1 - 86 - 332 - 22 - - - - 24 - - - - - - - horizontalScrollBar - - - - 1 - 114 - 332 - 17 - - - - Qt::Horizontal - - - - - - - - - verticalScrollBar - - - - 349 - 9 - 17 - 132 - - - - - 0 - 1 - 0 - 0 - - - - Qt::Vertical - - - - - - - - - - - 9 - 147 - 334 - 40 - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - widget - - - - 0 - 0 - 377 - 187 - - - - Tab Page 2 - - - - - - - - - diff --git a/tests/benchmarks/qtwidgets/tst_qtwidgets.cpp b/tests/benchmarks/qtwidgets/tst_qtwidgets.cpp deleted file mode 100644 index 8d2a31b..0000000 --- a/tests/benchmarks/qtwidgets/tst_qtwidgets.cpp +++ /dev/null @@ -1,67 +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 test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "mainwindow.h" - -class tst_QtWidgets: public QObject -{ - Q_OBJECT - -private slots: - void snapshot(); -}; - -void tst_QtWidgets::snapshot() -{ - QBENCHMARK { - StyleWidget widget(0, Qt::X11BypassWindowManagerHint); - widget.show(); - QApplication::processEvents(); - } -} - -QTEST_MAIN(tst_QtWidgets) - -#include "tst_qtwidgets.moc" -- cgit v0.12 From c624935a958783d3314fe6c2f6845e6b51a97f95 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Mon, 8 Feb 2010 16:08:04 +0100 Subject: Add a pixmap modification hook to blur pixmap filter cache We probably want to kick out filtered pixmaps from the cache when the source pixmap is modified as well as just destroyed. Reviewed-By: Samuel --- src/opengl/qglpixmapfilter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 37bb7c0..d5a11d9 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -394,6 +394,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe static bool hookAdded = false; if (!hookAdded) { QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed); + QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed); hookAdded = true; } -- cgit v0.12 From 49b01a107262a8edca92b12a65b54f63017d9d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 8 Feb 2010 16:33:49 +0100 Subject: Compile fix for network benchmarks. --- tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp | 2 +- tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp | 2 +- tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp index 23e07db..26308e9 100644 --- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp +++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp @@ -46,7 +46,7 @@ #include #include #include -#include "../../auto/network-settings.h" +#include "../../../../auto/network-settings.h" class qfile_vs_qnetworkaccessmanager : public QObject { diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index a92359f..f173ed1 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -48,7 +48,7 @@ #include #include #include -#include "../../auto/network-settings.h" +#include "../../../../auto/network-settings.h" class TimedSender: public QThread diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index b6b55c3..022bf3d 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -58,7 +58,7 @@ Q_DECLARE_METATYPE(QNetworkProxy) Q_DECLARE_METATYPE(QList) -#include "../../auto/network-settings.h" +#include "../../../../auto/network-settings.h" //TESTED_CLASS= //TESTED_FILES= -- cgit v0.12 From 8ce0a7dfac6955ab3b5bf6cd0ee4abe63f753618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 8 Feb 2010 16:34:30 +0100 Subject: Updated the docs for QPainter::begin/endNativePainting() Task-number: QTBUG-7661 Reviewed-by: Kim --- src/gui/painting/qpainter.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index bf12c6b..3bcaf8c 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1986,12 +1986,25 @@ QPaintEngine *QPainter::paintEngine() const endNativePainting(). Note that only the states the underlying paint engine changes will be reset - to their respective default states. If, for example, the OpenGL polygon - mode is changed by the user inside a beginNativePaint()/endNativePainting() - block, it will not be reset to the default state by endNativePainting(). + to their respective default states. The states we reset may change from + release to release. The following states are currently reset in the OpenGL + 2 engine: - Here is an example that shows intermixing of painter commands - and raw OpenGL commands: + \list + \i blending is disabled + \i the depth, stencil and scissor tests are disabled + \i the active texture unit is reset to 0 + \i the depth mask, depth function and the clear depth are reset to their + default values + \i the stencil mask, stencil operation and stencil function are reset to + their default values + \i the current color is reset to solid white + \endlist + + If, for example, the OpenGL polygon mode is changed by the user inside a + beginNativePaint()/endNativePainting() block, it will not be reset to the + default state by endNativePainting(). Here is an example that shows + intermixing of painter commands and raw OpenGL commands: \snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 21 -- cgit v0.12 From de5ce297da04d1246711d28095d6cd1f52cfc97b Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Mon, 8 Feb 2010 15:35:08 +0100 Subject: Make generate uid3 (symbian) work on 64 bit host platform. On a 64 bit system the old code used to make; UID "0xEffffffff9d8cb14". Which doesn't get accepted by the symbian tool chain ;) The patch makes this normal size hex uid3 again. Reviewed-by: Miikka Heikkinen --- qmake/generators/symbian/initprojectdeploy_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index f3e3c3a..5fbff58 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -207,7 +207,7 @@ QString generate_uid(const QString& target) return tmp; } - unsigned long hash = 5381; + quint32 hash = 5381; int c; for (int i = 0; i < target.size(); ++i) { -- cgit v0.12 From 1042478921b5b3e7a4e9713d9f7778bd10654463 Mon Sep 17 00:00:00 2001 From: Thomas Sondergaard Date: Mon, 8 Feb 2010 17:19:54 +0100 Subject: Handle Shift+Tab correctly on X11. This fixes incorrect handling of Shift+Tab keysyms. Most typically Shift+Tab generates Shift+ISO_Left_Tab, but VNC clients generate Shift+Tab in accordance with the RFB specification. Merge-request: 458 Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qkeymapper_x11.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index 70574e7..4e6c847 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -360,6 +360,13 @@ QList QKeyMapperPrivate::possibleKeysXKB(QKeyEvent *event) if (code && code < 0xfffe) code = QChar(code).toUpper().unicode(); + + if (code == Qt::Key_Tab && (baseModifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab + code = Qt::Key_Backtab; + text = QString(); + } + if (code == baseCode) continue; @@ -448,6 +455,13 @@ QList QKeyMapperPrivate::possibleKeysCore(QKeyEvent *event) if (code && code < 0xfffe) code = QChar(code).toUpper().unicode(); + + if (code == Qt::Key_Tab && (baseModifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab + code = Qt::Key_Backtab; + text = QString(); + } + if (code == baseCode) continue; -- cgit v0.12 From 96ce91dedc2aea60377d9008b806ebbe8cc53169 Mon Sep 17 00:00:00 2001 From: Constantin Makshin Date: Mon, 8 Feb 2010 19:11:47 +0100 Subject: Added QMake directory to INCPATH so the compiler can find required headers Reviewed-by: Benjamin Poulain --- qmake/qmake.pro | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 560aee9..00dcbce 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -17,9 +17,15 @@ VPATH += $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/kernel \ $$QT_SOURCE_TREE/src/corelib/codecs \ $$QT_SOURCE_TREE/src/corelib/plugin \ - $$QT_SOURCE_TREE/src/corelib/xml \ - $$QT_SOURCE_TREE/src/corelib/io -INCPATH += generators generators/unix generators/win32 generators/mac generators/symbian \ - $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore + $$QT_SOURCE_TREE/src/corelib/xml \ + $$QT_SOURCE_TREE/src/corelib/io +INCPATH += generators \ + generators/unix \ + generators/win32 \ + generators/mac \ + generators/symbian \ + $$QT_SOURCE_TREE/include \ + $$QT_SOURCE_TREE/include/QtCore \ + $$QT_SOURCE_TREE/qmake include(qmake.pri) -- cgit v0.12 From 21abc34acdfa4a675b9c9ff5294726faf0d4c00e Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 9 Feb 2010 12:06:28 +1000 Subject: Add networkAccess property to QNAM. Enables network access via QNAM to be enabled/disabled. --- src/network/access/qnetworkaccessmanager.cpp | 84 ++++++++++++++++++++++++++++ src/network/access/qnetworkaccessmanager.h | 8 +++ src/network/access/qnetworkaccessmanager_p.h | 4 +- 3 files changed, 95 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 8df580d..7f36570 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -57,6 +57,7 @@ #include "QtCore/qbuffer.h" #include "QtCore/qurl.h" #include "QtCore/qvector.h" +#include "QtCore/qcoreapplication.h" #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qnetworkconfigmanager.h" @@ -162,6 +163,29 @@ static void ensureInitialized() */ /*! + \property QNetworkAccessManager::networkAccess + \brief wheather network access is enabled or disabled through this network access manager. + \since 4.7 + + Network access is enabled by default. + + When network access is disabled the network access manager will not process any new network + requests, all such requests will fail with an error. Requests with URLs with the file:// scheme + will still be processed. + + This property can be used to enable and disable network access for all clients of a single + network access manager instance. +*/ + +/*! + \fn void QNetworkAccessManager::networkAccessChanged(bool enabled) + + This signal is emitted when the value of the \l networkAccess property changes. If \a enabled + is true new requests that access the network will be processed; otherwise new network requests + that require network access will fail with an error. +*/ + +/*! \fn void QNetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) This signal is emitted whenever a proxy requests authentication @@ -719,6 +743,63 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const } } +void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) +{ + Q_D(QNetworkAccessManager); + + if (d->networkAccessEnabled != enabled) { + d->networkAccessEnabled = enabled; + emit networkAccessChanged(enabled); + } +} + +bool QNetworkAccessManager::networkAccessEnabled() const +{ + Q_D(const QNetworkAccessManager); + + return d->networkAccessEnabled; +} + +class QDisabledNetworkReply : public QNetworkReply +{ + Q_OBJECT + +public: + QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, + const QNetworkAccessManager::Operation op); + ~QDisabledNetworkReply(); + + void abort() { } +protected: + qint64 readData(char *, qint64) { return 0; } +}; + +QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, + const QNetworkRequest &req, + QNetworkAccessManager::Operation op) +: QNetworkReply(parent) +{ + setRequest(req); + setUrl(req.url()); + setOperation(op); + + qRegisterMetaType("QNetworkReply::NetworkError"); + + QString msg = QCoreApplication::translate("QNetworkAccessManager", + "Network access is disabled."); + setError(UnknownNetworkError, msg); + + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, UnknownNetworkError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); +} + +QDisabledNetworkReply::~QDisabledNetworkReply() +{ +} + +#include "qnetworkaccessmanager.moc" + /*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and @@ -748,6 +829,9 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } + if (!d->networkAccessEnabled) + return new QDisabledNetworkReply(this, req, op); + QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && outgoingData && !outgoingData->isSequential()) { diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 14aaf78..371f729 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -69,6 +69,9 @@ class QNetworkAccessManagerPrivate; class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject { Q_OBJECT + + Q_PROPERTY(bool networkAccess READ networkAccessEnabled WRITE setNetworkAccessEnabled NOTIFY networkAccessChanged) + public: enum Operation { HeadOperation = 1, @@ -108,6 +111,9 @@ public: QNetworkConfiguration configuration() const; QNetworkConfiguration activeConfiguration() const; + void setNetworkAccessEnabled(bool enabled); + bool networkAccessEnabled() const; + Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); @@ -118,6 +124,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif + void networkAccessChanged(bool enabled); + void debugMessage(const QString &message); protected: diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index e916158..eae08e8 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,7 +76,8 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0) + session(0), + networkAccessEnabled(true) { } ~QNetworkAccessManagerPrivate(); @@ -130,6 +131,7 @@ public: bool cookieJarCreated; QNetworkSession *session; + bool networkAccessEnabled; // this cache can be used by individual backends to cache e.g. their TCP connections to a server // and use the connections for multiple requests. -- cgit v0.12 From 72f3caa5d7821b93a4e807fb61c5cda9f2c6f393 Mon Sep 17 00:00:00 2001 From: Bill King Date: Tue, 9 Feb 2010 13:14:50 +1000 Subject: (sqlite) Allow shared cache mode This modification is needed to allow performance optimisations necessary for QML. Reviewed-by: Warwick Allison --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 47 +++++++++++----------------- src/sql/kernel/qsqldatabase.cpp | 1 + tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 20 ++++++++++++ 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 9fff552..d3be304 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -500,32 +500,6 @@ bool QSQLiteDriver::hasFeature(DriverFeature f) const return false; } -static int qGetSqliteTimeout(QString opts) -{ - enum { DefaultTimeout = 5000 }; - - opts.remove(QLatin1Char(' ')); - foreach(QString option, opts.split(QLatin1Char(';'))) { - if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { - bool ok; - int nt = option.mid(21).toInt(&ok); - if (ok) - return nt; - } - } - return DefaultTimeout; -} - -static int qGetSqliteOpenMode(QString opts) -{ - opts.remove(QLatin1Char(' ')); - foreach(QString option, opts.split(QLatin1Char(';'))) { - if (option == QLatin1String("QSQLITE_OPEN_READONLY")) - return SQLITE_OPEN_READONLY; - } - return SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; -} - /* SQLite dbs have no user name, passwords, hosts or ports. just file names. @@ -537,9 +511,26 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c if (db.isEmpty()) return false; + bool sharedCache = false; + int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000; + QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); + foreach(const QString &option, opts) { + if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { + bool ok; + int nt = option.mid(21).toInt(&ok); + if (ok) + timeOut = nt; + } + if (option == QLatin1String("QSQLITE_OPEN_READONLY")) + openMode = SQLITE_OPEN_READONLY; + if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) + sharedCache = true; + } + + sqlite3_enable_shared_cache(sharedCache); - if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, qGetSqliteOpenMode(conOpts), NULL) == SQLITE_OK) { - sqlite3_busy_timeout(d->access, qGetSqliteTimeout(conOpts)); + if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { + sqlite3_busy_timeout(d->access, timeOut); setOpen(true); setOpenError(false); return true; diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 031261d..1416ee3 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -1267,6 +1267,7 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const \list \i QSQLITE_BUSY_TIMEOUT \i QSQLITE_OPEN_READONLY + \i QSQLITE_ENABLE_SHARED_CACHE \endlist \i diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 5b61da2..fe084fa 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -202,6 +202,8 @@ private slots: void sqlStatementUseIsNull_189093_data() { generic_data(); } void sqlStatementUseIsNull_189093(); + void sqlite_enable_cache_mode_data() { generic_data("QSQLITE"); } + void sqlite_enable_cache_mode(); private: void createTestTables(QSqlDatabase db); @@ -2485,5 +2487,23 @@ void tst_QSqlDatabase::oci_tables() QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper())); } +void tst_QSqlDatabase::sqlite_enable_cache_mode() +{ + QFETCH(QString, dbName); + if(dbName.endsWith(":memory:")) + QSKIP( "cache mode is meaningless for :memory: databases", SkipSingle ); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + db.close(); + db.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE"); + QVERIFY_SQL(db, open()); + QSqlDatabase db2 = QSqlDatabase::cloneDatabase(db, dbName+":cachemodeconn2"); + db2.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE"); + QVERIFY_SQL(db2, open()); + QSqlQuery q(db), q2(db2); + QVERIFY_SQL(q, exec("select * from "+qTableName("qtest"))); + QVERIFY_SQL(q2, exec("select * from "+qTableName("qtest"))); +} + QTEST_MAIN(tst_QSqlDatabase) #include "tst_qsqldatabase.moc" -- cgit v0.12 From b37ac454832a23c17418f5ebca8928b63fe02289 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 8 Feb 2010 18:19:19 +0200 Subject: Streamlined smart installer package creation in Symbian - Added make target for creating smart installer packages - Application sis is automatically generated if missing when "make installer_sis" is invoked - No need to specify installer pkg UID if self signing is enough - Related docs fixed - Fixed smartinstaller.sis name to be correct Task-number: QTBUG-8026 Reviewed-by: axis --- bin/createpackage.pl | 16 ++++++++---- doc/src/deployment/deployment.qdoc | 17 +++---------- doc/src/getting-started/installation.qdoc | 2 +- doc/src/platforms/symbian-introduction.qdoc | 4 +++ doc/src/snippets/code/doc_src_deployment.qdoc | 17 +++---------- qmake/generators/symbian/symmake.cpp | 35 +++++++++++++++++++++++++-- 6 files changed, 56 insertions(+), 35 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 460df31..6d4614e 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -95,10 +95,10 @@ Example with certfile: # This is comment line, also the empty lines are ignored rd.cer;rd-key.pem .\\cert\\mycert.cer;.\\cert\\mykey.key;yourpassword - X:\\QtS60\\selfsigned.cer;X:\\QtS60\\selfsigned.key + X:\\QtS60\\s60installs\\selfsigned.cer;X:\\QtS60\\s60installs\\selfsigned.key If no certificate and key files are provided, either a RnD certificate or -a self-signed certificate from Qt installation root directory is used. +a self-signed certificate from QtDir\\src\\s60installs directory is used. ============================================================================================== ENDUSAGESTRING @@ -149,8 +149,10 @@ $pkgoutputbasename = lc($pkgoutputbasename); # Store output file names to variables my $pkgoutput = lc($pkgoutputbasename.".pkg"); -my $unsigned_sis_name = $pkgoutputbasename."_unsigned.sis"; -my $signed_sis_name = $pkgoutputbasename.".sis"; +my $sisoutputbasename = lc($pkgoutputbasename); +$sisoutputbasename =~ s/_$targetplatform//g; +my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis"; +my $signed_sis_name = $sisoutputbasename.".sis"; # Store some utility variables my $scriptpath = dirname(__FILE__); @@ -263,7 +265,11 @@ system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphra # Check if creating signed SIS Succeeded stat($signed_sis_name); if( -e _ ) { - print ("\nSuccessfully created $signed_sis_name using certificate: $certtext!\n"); + my $targetInsert = ""; + if ($targetplatform ne "-") { + $targetInsert = "for $targetplatform "; + } + print ("\nSuccessfully created $signed_sis_name ${targetInsert}using certificate: $certtext!\n"); # Sign with additional certificates & keys for my $row ( @certificates ) { diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 575a6dc..41babd9 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -1573,28 +1573,17 @@ By default \c .pkg file generated by \c qmake adds support for all S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices. - As a last step we will instruct qmake to generate smart installer \c .pkg file by defining - the UID of the installation package. The UID needs to be different than the application UID, - and should be reserved via normal Symbian mechanisms. You can use a random UID starting with - \c 0xE for testing purposes: - - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 58 - Now we are ready to compile the application and create the application deployment file. Run \c qmake to create Symbian specific makefiles, resources (\.rss) and deployment packaging files (\c .pkg). And do build to create the application binaries and resources. - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 59 + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 58 If everything compiled and linked without any errors, we are now ready to create - an application package (\c wiggly.sis): - - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 60 + an application installation package (\c wiggly_installer.sis): - Now you can create the smart installer package for the application: - - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 61 + \snippet doc/src/snippets/code/doc_src_deployment.qdoc 59 If all binaries and dependencies were found, you should now have a self signed \c wiggly_installer.sis ready to be installed on a device. The smart installer diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index b679250..abdfcd2 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -677,7 +677,7 @@ If you are using pre-built binaries, follow the instructions given in the \snippet doc/src/snippets/code/doc_src_installation.qdoc 30 - This will create a self-signed \c fluidlauncher_armv5_urel.sis and + This will create a self-signed \c fluidlauncher.sis and install it to your device. To run the demos on the emulator simply navigate to the directory of the demo diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 427f45a..94075f5 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -127,6 +127,10 @@ \row \o \c run \o Run the application on the emulator. \row \o \c runonphone \o Run the application on a device. \row \o \c sis \o Create signed \c .sis file for project. + \row \o \c installer_sis \o Create signed smart installer \c .sis file for project. + Smart installer will attempt to download + missing dependencies in addition to + just installing the application. \endtable The following lines perform a debug build for the emulator diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc index 9c00681..3b0cda1 100644 --- a/doc/src/snippets/code/doc_src_deployment.qdoc +++ b/doc/src/snippets/code/doc_src_deployment.qdoc @@ -475,19 +475,10 @@ default_deployment.pkg_prerules += supported_platforms //! [57] //! [58] -DEPLOYMENT.installer_header = 0xE2345678 -//! [58] - -//! [59] qmake make release-gcce -//! [59] - -//! [60] -make sis -ren wiggly_release-gcce.sis wiggly.sis -//! [60] +//! [58] -//! [61] -createpackage wiggly_installer.pkg -//! [61] \ No newline at end of file +//! [59] +make installer_sis +//! [59] \ No newline at end of file diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 6c44f0b..3ee3b3a 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -87,7 +87,9 @@ #define MMP_END_RESOURCE "END" #define SIS_TARGET "sis" +#define INSTALLER_SIS_TARGET "installer_sis" #define OK_SIS_TARGET "ok_sis" +#define OK_INSTALLER_SIS_TARGET "ok_installer_sis" #define FAIL_SIS_NOPKG_TARGET "fail_sis_nopkg" #define FAIL_SIS_NOCACHE_TARGET "fail_sis_nocache" @@ -295,6 +297,9 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme QTextStream t(&pkgFile); QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); + if (installerSisHeader.isEmpty()) + installerSisHeader = "0xA000D7CE"; // Use default self-signable UID if not defined + QString wrapperStreamBuffer; QTextStream tw(&wrapperStreamBuffer); @@ -517,7 +522,7 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); - bootStrapPath.append("/bootstrap.sis"); + bootStrapPath.append("/smartinstaller.sis"); QFileInfo fi(fileInfo(bootStrapPath)); twf << "@\"" << fi.absoluteFilePath() << "\",(0x2002CCCD)" << endl; } @@ -1901,8 +1906,34 @@ void SymbianMakefileGenerator::writeSisTargets(QTextStream &t) t << pkgcommand << endl; t << endl; + QString sisName = fixedTarget; + sisName += ".sis"; + + t << sisName << ":" << endl; + t << "\t$(MAKE) -s -f $(MAKEFILE) " SIS_TARGET << endl << endl; + + t << INSTALLER_SIS_TARGET ": " << sisName << endl; + siscommand = QString("\t$(if $(wildcard %1_installer.%2)," \ + "$(MAKE) -s -f $(MAKEFILE) %3," \ + "$(MAKE) -s -f $(MAKEFILE) %4)") + .arg(fixedTarget) + .arg("pkg") + .arg(OK_INSTALLER_SIS_TARGET) + .arg(FAIL_SIS_NOPKG_TARGET); + t << siscommand << endl; + t << endl; + + t << OK_INSTALLER_SIS_TARGET ": " << endl; + + pkgcommand = QString("\tcreatepackage.bat $(QT_SIS_OPTIONS) %1_installer.%2 - " \ + "$(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)") + .arg(fixedTarget) + .arg("pkg"); + t << pkgcommand << endl; + t << endl; + t << FAIL_SIS_NOPKG_TARGET ":" << endl; - t << "\t$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)" << endl; + t << "\t$(error PKG file does not exist, '" SIS_TARGET "' and '" INSTALLER_SIS_TARGET "' target are only supported for executables or projects with DEPLOYMENT statement)" << endl; t << endl; t << FAIL_SIS_NOCACHE_TARGET ":" << endl; -- cgit v0.12 From 94630819258edef96c434add7bbd4b1b425ea71a Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 09:58:22 +0100 Subject: QNAM HTTP: Fix issue with some servers The call to eatWhitespace() must only be done before reading the status, not while reading it. (We can be in ReadingStatusState for multiple loop iterations) Task-number: QTBUG-7673 Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 70a301d..5bd972c 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -305,9 +305,12 @@ void QHttpNetworkConnectionChannel::_q_receiveReply() while (socket->bytesAvailable()) { QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState; switch (state) { - case QHttpNetworkReplyPrivate::NothingDoneState: - case QHttpNetworkReplyPrivate::ReadingStatusState: { + case QHttpNetworkReplyPrivate::NothingDoneState: { + // only eat whitespace on the first call eatWhitespace(); + state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; + } + case QHttpNetworkReplyPrivate::ReadingStatusState: { qint64 statusBytes = reply->d_func()->readStatus(socket); if (statusBytes == -1 && reconnectAttempts <= 0) { // too many errors reading/receiving/parsing the status, close the socket and emit error -- cgit v0.12 From 1bb05bf5230ac41c47ce09fcc1e85e26db150322 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 9 Feb 2010 10:30:06 +0100 Subject: Stabilize QLineEdit test on X11 --- tests/auto/qlineedit/tst_qlineedit.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 69e7699..ca84b38 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3455,10 +3455,8 @@ void tst_QLineEdit::task210502_caseInsensitiveInlineCompletion() completer.setCompletionMode(QCompleter::InlineCompletion); lineEdit.setCompleter(&completer); lineEdit.show(); -#ifdef Q_WS_X11 - // to be safe and avoid failing setFocus with window managers - qt_x11_wait_for_window_manager(&lineEdit); -#endif + QTest::qWaitForWindowShown(&lineEdit); + QApplication::setActiveWindow(&lineEdit); lineEdit.setFocus(); QTRY_VERIFY(lineEdit.hasFocus()); QTest::keyPress(&lineEdit, 'a'); @@ -3651,10 +3649,11 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() le.addAction(&action); le.show(); - QApplication::setActiveWindow(&le); QTest::qWaitForWindowShown(&le); + QApplication::setActiveWindow(&le); le.setFocus(); QTRY_VERIFY(le.hasFocus()); + QTest::keyClick(0, Qt::Key_P); QCOMPARE(spy.count(), 1); } -- cgit v0.12 From 1f28c7c3391cef8760836b61146e556adf217596 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 9 Feb 2010 10:28:08 +0100 Subject: Improve the benchmark of QScriptClass The benchmarks has been stabilised and modified so the number are more representative of QSCriptClass and not other part of Qt: -the "iteration numbmer" has been introduced to ensure a minimal number of call, indpendant of QTestLib. -the subclasses of QScriptClass have been rewritten to have less impact on the results --- tests/benchmarks/qscriptclass/tst_qscriptclass.cpp | 536 ++++++--------------- 1 file changed, 155 insertions(+), 381 deletions(-) diff --git a/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp b/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp index 7985028..6ab78b1 100644 --- a/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp +++ b/tests/benchmarks/qscriptclass/tst_qscriptclass.cpp @@ -46,348 +46,15 @@ Q_DECLARE_METATYPE(QScriptContext*) Q_DECLARE_METATYPE(QScriptValue) Q_DECLARE_METATYPE(QScriptValueList) -//TESTED_FILES= - -class TestClass : public QScriptClass -{ -public: - struct CustomProperty { - QueryFlags qflags; - uint id; - QScriptValue::PropertyFlags pflags; - QScriptValue value; - - CustomProperty(QueryFlags qf, uint i, QScriptValue::PropertyFlags pf, - const QScriptValue &val) - : qflags(qf), id(i), pflags(pf), value(val) { } - }; - - enum CallableMode { - NotCallable, - CallableReturnsSum, - CallableReturnsArgument, - CallableReturnsInvalidVariant - }; - - TestClass(QScriptEngine *engine); - ~TestClass(); - - void addCustomProperty(const QScriptString &name, QueryFlags qflags, - uint id, QScriptValue::PropertyFlags pflags, - const QScriptValue &value); - void removeCustomProperty(const QScriptString &name); - - QueryFlags queryProperty(const QScriptValue &object, - const QScriptString &name, - QueryFlags flags, uint *id); - - QScriptValue property(const QScriptValue &object, - const QScriptString &name, uint id); - - void setProperty(QScriptValue &object, const QScriptString &name, - uint id, const QScriptValue &value); - - QScriptValue::PropertyFlags propertyFlags( - const QScriptValue &object, const QScriptString &name, uint id); - - QScriptClassPropertyIterator *newIterator(const QScriptValue &object); - - QScriptValue prototype() const; - - QString name() const; - - bool supportsExtension(Extension extension) const; - QVariant extension(Extension extension, - const QVariant &argument = QVariant()); - - void setIterationEnabled(bool enable); - bool isIterationEnabled() const; - - void setCallableMode(CallableMode mode); - CallableMode callableMode() const; - - void setHasInstance(bool hasInstance); - bool hasInstance() const; - -private: - inline CustomProperty *findCustomProperty(const QScriptString &name); - - QHash customProperties; - - QScriptValue m_prototype; - bool m_iterationEnabled; - CallableMode m_callableMode; - bool m_hasInstance; -}; - -class TestClassPropertyIterator : public QScriptClassPropertyIterator -{ -public: - TestClassPropertyIterator(const QHash &props, - const QScriptValue &object); - ~TestClassPropertyIterator(); - - bool hasNext() const; - void next(); - - bool hasPrevious() const; - void previous(); - - void toFront(); - void toBack(); - - QScriptString name() const; - uint id() const; - QScriptValue::PropertyFlags flags() const; - -private: - int m_index; - int m_last; - QHash m_props; -}; - -TestClass::TestClass(QScriptEngine *engine) - : QScriptClass(engine), m_iterationEnabled(true), - m_callableMode(NotCallable), m_hasInstance(false) -{ - m_prototype = engine->newObject(); -} - -TestClass::~TestClass() -{ - qDeleteAll(customProperties); -} - -TestClass::CustomProperty* TestClass::findCustomProperty(const QScriptString &name) -{ - QHash::const_iterator it; - it = customProperties.constFind(name); - if (it == customProperties.constEnd()) - return 0; - return it.value(); - -} - -void TestClass::addCustomProperty(const QScriptString &name, QueryFlags qflags, - uint id, QScriptValue::PropertyFlags pflags, - const QScriptValue &value) -{ - customProperties.insert(name, new CustomProperty(qflags, id, pflags, value)); -} - -void TestClass::removeCustomProperty(const QScriptString &name) -{ - CustomProperty *prop = customProperties.take(name); - if (prop) - delete prop; -} - -QScriptClass::QueryFlags TestClass::queryProperty(const QScriptValue &/*object*/, - const QScriptString &name, - QueryFlags flags, uint *id) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return 0; - *id = prop->id; - return prop->qflags & flags; -} - -QScriptValue TestClass::property(const QScriptValue &/*object*/, - const QScriptString &name, uint /*id*/) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return QScriptValue(); - return prop->value; -} - -void TestClass::setProperty(QScriptValue &/*object*/, const QScriptString &name, - uint /*id*/, const QScriptValue &value) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return; - prop->value = value; -} - -QScriptValue::PropertyFlags TestClass::propertyFlags( - const QScriptValue &/*object*/, const QScriptString &name, uint /*id*/) -{ - CustomProperty *prop = findCustomProperty(name); - if (!prop) - return 0; - return prop->pflags; -} - -QScriptClassPropertyIterator *TestClass::newIterator(const QScriptValue &object) -{ - if (!m_iterationEnabled) - return 0; - return new TestClassPropertyIterator(customProperties, object); -} - -QScriptValue TestClass::prototype() const -{ - return m_prototype; -} - -QString TestClass::name() const -{ - return QLatin1String("TestClass"); -} - -bool TestClass::supportsExtension(Extension extension) const -{ - if (extension == Callable) - return (m_callableMode != NotCallable); - if (extension == HasInstance) - return m_hasInstance; - return false; -} - -QVariant TestClass::extension(Extension extension, - const QVariant &argument) -{ - if (extension == Callable) { - Q_ASSERT(m_callableMode != NotCallable); - QScriptContext *ctx = qvariant_cast(argument); - if (m_callableMode == CallableReturnsSum) { - qsreal sum = 0; - for (int i = 0; i < ctx->argumentCount(); ++i) - sum += ctx->argument(i).toNumber(); - QScriptValueIterator it(ctx->thisObject()); - while (it.hasNext()) { - it.next(); - sum += it.value().toNumber(); - } - return sum; - } else if (m_callableMode == CallableReturnsArgument) { - return qVariantFromValue(ctx->argument(0)); - } else if (m_callableMode == CallableReturnsInvalidVariant) { - return QVariant(); - } - } else if (extension == HasInstance) { - Q_ASSERT(m_hasInstance); - QScriptValueList args = qvariant_cast(argument); - QScriptValue obj = args.at(0); - QScriptValue value = args.at(1); - return value.property("foo").equals(obj.property("foo")); - } - return QVariant(); -} - -void TestClass::setIterationEnabled(bool enable) -{ - m_iterationEnabled = enable; -} - -bool TestClass::isIterationEnabled() const -{ - return m_iterationEnabled; -} - -void TestClass::setCallableMode(CallableMode mode) -{ - m_callableMode = mode; -} - -TestClass::CallableMode TestClass::callableMode() const -{ - return m_callableMode; -} - -void TestClass::setHasInstance(bool hasInstance) -{ - m_hasInstance = hasInstance; -} - -bool TestClass::hasInstance() const -{ - return m_hasInstance; -} - -TestClassPropertyIterator::TestClassPropertyIterator(const QHash &props, - const QScriptValue &object) - : QScriptClassPropertyIterator(object) -{ - m_props = props; - toFront(); -} - -TestClassPropertyIterator::~TestClassPropertyIterator() -{ -} - -bool TestClassPropertyIterator::hasNext() const -{ - return m_index < m_props.size(); -} - -void TestClassPropertyIterator::next() -{ - m_last = m_index; - ++m_index; -} - -bool TestClassPropertyIterator::hasPrevious() const -{ - return m_index > 0; -} - -void TestClassPropertyIterator::previous() -{ - --m_index; - m_last = m_index; -} - -void TestClassPropertyIterator::toFront() -{ - m_index = 0; - m_last = -1; -} - -void TestClassPropertyIterator::toBack() -{ - m_index = m_props.size(); - m_last = -1; -} - -QScriptString TestClassPropertyIterator::name() const -{ - return m_props.keys().value(m_last); -} - -uint TestClassPropertyIterator::id() const -{ - QScriptString key = m_props.keys().value(m_last); - if (!key.isValid()) - return 0; - TestClass::CustomProperty *prop = m_props.value(key); - return prop->id; -} - -QScriptValue::PropertyFlags TestClassPropertyIterator::flags() const -{ - QScriptString key = m_props.keys().value(m_last); - if (!key.isValid()) - return 0; - TestClass::CustomProperty *prop = m_props.value(key); - return prop->pflags; -} +// We want reliable numbers so we don't want to rely too much +// on the number of iterations done by testlib. +// this also make the results of valgrind more interesting +const int iterationNumber = 5000; class tst_QScriptClass : public QObject { Q_OBJECT -public: - tst_QScriptClass(); - virtual ~tst_QScriptClass(); - -public slots: - void init(); - void cleanup(); - private slots: void noSuchProperty(); void property(); @@ -398,111 +65,218 @@ private slots: void iterate(); }; -tst_QScriptClass::tst_QScriptClass() -{ -} - -tst_QScriptClass::~tst_QScriptClass() -{ -} - -void tst_QScriptClass::init() -{ -} - -void tst_QScriptClass::cleanup() -{ -} - +// Test the overhead of checking for an inexisting property of a QScriptClass void tst_QScriptClass::noSuchProperty() { QScriptEngine eng; - TestClass cls(&eng); + QScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); QString propertyName = QString::fromLatin1("foo"); QBENCHMARK { - (void)obj.property(propertyName); + for (int i = 0; i < iterationNumber; ++i) + (void)obj.property(propertyName); } + Q_ASSERT(!obj.property(propertyName).isValid()); } + +class FooScriptClass : public QScriptClass +{ +public: + FooScriptClass(QScriptEngine *engine) + : QScriptClass(engine) + { + foo = engine->toStringHandle("foo"); + } + + QueryFlags queryProperty(const QScriptValue &, + const QScriptString &, + QueryFlags flags, + uint *id) + { + *id = 1; + return flags; + } + + QScriptValue property(const QScriptValue &, + const QScriptString &, + uint) + { + return QScriptValue(engine(), 35); + } + + void setProperty(QScriptValue &, const QScriptString &, + uint, const QScriptValue &) + {} + + QScriptValue::PropertyFlags propertyFlags(const QScriptValue &, const QScriptString &, uint) + { + return QScriptValue::Undeletable; + } +private: + QScriptString foo; +}; + +// Test the overhead of getting a value of QScriptClass accross the Javascript engine void tst_QScriptClass::property() { QScriptEngine eng; - TestClass cls(&eng); - QScriptString foo = eng.toStringHandle("foo"); - cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); + FooScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); + QScriptString foo = eng.toStringHandle("foo"); QBENCHMARK { - (void)obj.property(foo); + for (int i = 0; i < iterationNumber; ++i) + (void)obj.property(foo); } } +// Test the overhead of setting a value on QScriptClass accross the Javascript engine void tst_QScriptClass::setProperty() { QScriptEngine eng; - TestClass cls(&eng); - QScriptString foo = eng.toStringHandle("foo"); - cls.addCustomProperty(foo, QScriptClass::HandlesWriteAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); + FooScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); QScriptValue value(456); + QScriptString foo = eng.toStringHandle("foo"); QBENCHMARK { - obj.setProperty(foo, value); + for (int i = 0; i < iterationNumber; ++i) + obj.setProperty(foo, value); } } +// Test the time taken to get the propeties flags accross the engine void tst_QScriptClass::propertyFlags() { QScriptEngine eng; - TestClass cls(&eng); - QScriptString foo = eng.toStringHandle("foo"); - cls.addCustomProperty(foo, QScriptClass::HandlesReadAccess, /*id=*/1, QScriptValue::ReadOnly, /*value=*/123); + FooScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); + QScriptString foo = eng.toStringHandle("foo"); QBENCHMARK { - (void)obj.propertyFlags(foo); + for (int i = 0; i < iterationNumber; ++i) + (void)obj.propertyFlags(foo); } } + + +class ExtensionScriptClass : public QScriptClass +{ +public: + ExtensionScriptClass(QScriptEngine *engine) + : QScriptClass(engine) + { + } + + bool supportsExtension(Extension) const + { + return true; + } + + QVariant extension(Extension, const QVariant &argument = QVariant()) + { + Q_UNUSED(argument); + return QVariant(); + } +}; + +// Check the overhead of the extension "call" void tst_QScriptClass::call() { QScriptEngine eng; - TestClass cls(&eng); - cls.setCallableMode(TestClass::CallableReturnsArgument); + ExtensionScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); QScriptValue thisObject; QScriptValueList args; args.append(123); QBENCHMARK { - (void)obj.call(thisObject, args); + for (int i = 0; i < iterationNumber; ++i) + (void)obj.call(thisObject, args); } } +// Check the overhead of the extension "instanceOf" void tst_QScriptClass::hasInstance() { QScriptEngine eng; - TestClass cls(&eng); - cls.setHasInstance(true); + ExtensionScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); obj.setProperty("foo", 123); QScriptValue plain = eng.newObject(); plain.setProperty("foo", obj.property("foo")); QBENCHMARK { - (void)plain.instanceOf(obj); + for (int i = 0; i < iterationNumber; ++i) + (void)plain.instanceOf(obj); } } + + +static const int iteratorValuesNumber = 100; +class TestClassPropertyIterator : public QScriptClassPropertyIterator +{ +public: + TestClassPropertyIterator(const QScriptValue &object, QVector names) + : QScriptClassPropertyIterator(object) + , m_index(0) + , names(names) + { + } + + bool hasNext() const + { + return m_index < iteratorValuesNumber - 1; + } + void next() { ++m_index; } + + bool hasPrevious() const { return m_index > 0; } + void previous() { --m_index; } + + void toFront() { m_index = 0; } + void toBack() { m_index = iteratorValuesNumber - 1; } + + QScriptString name() const { return names[m_index]; } + uint id() const { return m_index; } + QScriptValue::PropertyFlags flags() const { return 0; } + +private: + int m_index; + QVector names; +}; + + +class IteratorScriptClass : public QScriptClass +{ +public: + IteratorScriptClass(QScriptEngine *engine) + : QScriptClass(engine) + { + for (int i = 0; i < iteratorValuesNumber; ++i) + names.append(engine->toStringHandle(QString("property%1").arg(i))); + } + + QScriptClassPropertyIterator *newIterator(const QScriptValue &object) + { + return new TestClassPropertyIterator(object, names); + } +private: + QVector names; + friend class TestClassPropertyIterator; +}; + +// Measure the performance of the interface to iterate over QScriptClassPropertyIterator void tst_QScriptClass::iterate() { QScriptEngine eng; - TestClass cls(&eng); - cls.setIterationEnabled(true); - cls.addCustomProperty(eng.toStringHandle("foo"), QScriptClass::HandlesReadAccess, /*id=*/1, /*attributes=*/0, /*value=*/123); - cls.addCustomProperty(eng.toStringHandle("bar"), QScriptClass::HandlesReadAccess, /*id=*/2, /*attributes=*/0, /*value=*/456); + IteratorScriptClass cls(&eng); QScriptValue obj = eng.newObject(&cls); + int iterationNumberIterate = iterationNumber / iteratorValuesNumber; QBENCHMARK { - QScriptValueIterator it(obj); - while (it.hasNext()) { - it.next(); - (void)it.scriptName(); + for (int i = 0; i < iterationNumberIterate; ++i) { + QScriptValueIterator it(obj); + while (it.hasNext()) { + it.next(); + (void)it.scriptName(); + } } } } -- cgit v0.12 From a3d3d2b746f515e197a40a9f87e767d68e25cb1a Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Tue, 9 Feb 2010 10:58:48 +0100 Subject: Fix Float Conversion in xmlpatterns On Maemo5 devices there is an automatic conversion to Float. So qtToXDMType() needs a special case. Reviewed By: Peter Hartmann --- src/xmlpatterns/data/qatomicvalue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp index 6858e27..c4f3578 100644 --- a/src/xmlpatterns/data/qatomicvalue.cpp +++ b/src/xmlpatterns/data/qatomicvalue.cpp @@ -226,6 +226,8 @@ ItemType::Ptr AtomicValue::qtToXDMType(const QXmlItem &item) /* Fallthrough. */ case QVariant::Time: return BuiltinTypes::xsDateTime; + case QMetaType::Float: + return BuiltinTypes::xsFloat; case QVariant::Double: return BuiltinTypes::xsDouble; default: -- cgit v0.12 From 709238ecfefdea82ec192267a4a33180078dbad8 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Tue, 9 Feb 2010 11:58:08 +0100 Subject: Setting some parameters to reliably run on Tb9.2, Tb 9.2 ATM is more memory sensitive. Reviewed-by: TrustMe --- .../benchmarks/qgraphicsview/tst_qgraphicsview.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp index 4cb07db..10e00a6 100644 --- a/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/qgraphicsview/tst_qgraphicsview.cpp @@ -555,7 +555,11 @@ void tst_QGraphicsView::imageRiver() QFile file(":/random.data"); QVERIFY(file.open(QIODevice::ReadOnly)); QDataStream str(&file); +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 50; ++i) { +#else for (int i = 0; i < 100; ++i) { +#endif AnimatedPixmapItem *item; if (direction == 0) item = new AnimatedPixmapItem((i % 4) + 1, 0, rotation, scale); if (direction == 1) item = new AnimatedPixmapItem(0, (i % 4) + 1, rotation, scale); @@ -574,7 +578,11 @@ void tst_QGraphicsView::imageRiver() #ifdef CALLGRIND_DEBUG CALLGRIND_START_INSTRUMENTATION #endif +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 50; ++i) { +#else for (int i = 0; i < 100; ++i) { +#endif scene.advance(); while (view.count < (i+1)) qApp->processEvents(); @@ -669,7 +677,11 @@ void tst_QGraphicsView::textRiver() QFile file(":/random.data"); QVERIFY(file.open(QIODevice::ReadOnly)); QDataStream str(&file); +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 50; ++i) { +#else for (int i = 0; i < 100; ++i) { +#endif AnimatedTextItem *item; if (direction == 0) item = new AnimatedTextItem((i % 4) + 1, 0, rotation, scale); if (direction == 1) item = new AnimatedTextItem(0, (i % 4) + 1, rotation, scale); @@ -687,7 +699,11 @@ void tst_QGraphicsView::textRiver() #ifdef CALLGRIND_DEBUG CALLGRIND_START_INSTRUMENTATION #endif +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 50; ++i) { +#else for (int i = 0; i < 100; ++i) { +#endif scene.advance(); while (view.count < (i+1)) qApp->processEvents(); @@ -771,7 +787,11 @@ void tst_QGraphicsView::moveItemCache() QFile file(":/random.data"); QVERIFY(file.open(QIODevice::ReadOnly)); QDataStream str(&file); +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 5; ++i) { +#else for (int i = 0; i < 50; ++i) { +#endif AnimatedPixmapCacheItem *item; if (direction == 0) item = new AnimatedPixmapCacheItem((i % 4) + 1, 0); if (direction == 1) item = new AnimatedPixmapCacheItem(0, (i % 4) + 1); @@ -793,7 +813,11 @@ void tst_QGraphicsView::moveItemCache() #ifdef CALLGRIND_DEBUG CALLGRIND_START_INSTRUMENTATION #endif +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 50; ++i) { +#else for (int i = 0; i < 100; ++i) { +#endif scene.advance(); while (view.count < (i+1)) qApp->processEvents(); @@ -893,7 +917,11 @@ void tst_QGraphicsView::paintItemCache() #ifdef CALLGRIND_DEBUG CALLGRIND_START_INSTRUMENTATION #endif +#if defined(Q_OS_SYMBIAN) + for (int i = 0; i < 5; ++i) { +#else for (int i = 0; i < 50; ++i) { +#endif scene.advance(); while (view.count < (i+1)) qApp->processEvents(); -- cgit v0.12 From 16f89107f9c8019b05d5ccee1b6deccfdff6f98e Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Tue, 9 Feb 2010 11:57:58 +0100 Subject: fix a few mistakes in German translation Merge-request: 2302 Reviewed-by: Oswald Buddenhagen --- translations/qt_de.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translations/qt_de.ts b/translations/qt_de.ts index 8cbf402..6447451 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -7572,7 +7572,7 @@ Bitte wählen Sie einen anderen Dateinamen. Play movie in full-screen mode Media controller element - FIlm im Vollbildmodus abspielen + Film im Vollbildmodus abspielen @@ -8245,7 +8245,7 @@ Bitte wählen Sie einen anderen Dateinamen. Warning in %1, at line %2, column %3: %4 - Fehler in %1, bei Zeile %2, Spalte %3: %4 + Warnung in %1, bei Zeile %2, Spalte %3: %4 @@ -9466,7 +9466,7 @@ Bitte wählen Sie einen anderen Dateinamen. %1 is not allowed to derive from %2 by list as the latter defines it as final. - %1 darf nicht durch Listen von %2 abgeleitet werden, da sie letzterer sie als final deklariert. + %1 darf nicht durch Listen von %2 abgeleitet werden, da letzterer sie als final deklariert. @@ -9917,7 +9917,7 @@ Bitte wählen Sie einen anderen Dateinamen. Complex type %1 cannot be derived by extension from %2 as the latter contains %3 element in its content model. - Der komplexe Typ % kann nicht durch Erweiterung von %2 abgeleitet werden, da letzterer ein '%3'-Element in seinem Inhaltsmodell hat. + Der komplexe Typ %1 kann nicht durch Erweiterung von %2 abgeleitet werden, da letzterer ein '%3'-Element in seinem Inhaltsmodell hat. -- cgit v0.12 From 9be25c3847bb90eb2a6cf9cd6d357e83b7ad89a2 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 9 Feb 2010 13:13:31 +0100 Subject: doc: Updated deployment OS X requirements for 4.6 Beginning with Qt 4.6, OS X 103 (Panther) is no longer supported. --- doc/src/deployment/deployment.qdoc | 84 +++++++++++++---------------------- doc/src/platforms/platform-notes.qdoc | 3 ++ 2 files changed, 33 insertions(+), 54 deletions(-) diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 575a6dc..9557365 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -963,14 +963,14 @@ \title Deploying an Application on Mac OS X - Starting with version 4.5, Qt now includes a \l {macdeploy}{deployment tool} - that automates the prodecures described in this document. - - This documentation will describe how to create a bundle, and how - to make sure that the application will find the resources it needs - at run-time. We will demonstrate the procedures in terms of - deploying the \l {tools/plugandpaint}{Plug & Paint} application - that is provided in Qt's examples directory. + Beginning with Qt 4.5, a \l {macdeploy}{deployment tool} is + included that automates the prodecures described here. + + This document describes how to create a bundle and how to make + sure that the application will find the resources it needs at + run-time. We demonstrate the procedures in terms of deploying the + \l {tools/plugandpaint}{Plug & Paint} application that is provided + in Qt's examples directory. \tableofcontents @@ -1380,63 +1380,38 @@ \section2 Mac OS X Version Dependencies - Qt 4.2 has been designed to be built and deployed on Mac OS X 10.3 - up until the current version as of this writing, Mac OS X 10.4 and - all their minor releases. Qt achieves this by using "weak - linking." This means that Qt tests if a function added in newer - versions of Mac OS X is available on the computer it is running on - before it uses it. This results in getting access to newer - features when running on newer versions of OS X while still - remaining compatible on older versions. + From Qt 4.6, Mac OS X 10.3 (Panther) is no longer supported. Qt + 4.6 applications can be built and deployed on Mac OS X 10.4 + (Tiger) and higher. This is achieved using \e{weak linking}. In + \e{weak linking}, Qt tests whether a function added in a newer + version of Mac OS X is available on the computer it is running + on. This allows Qt to use newer features, when it runs on a newer + version of OS X, while remaining compatible on the older versions. For more information about cross development issues on Mac OS X, see \l {http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/index.html}{Apple's Developer Website}. - Since the linker is set to be compatible with all OS X version, you have to - change the \c MACOSX_DEPLOYMENT_TARGET environment variable to get weak - linking to work for your application. You can add: + Since the linker is set to be compatible with all OS X versions, + you must change the \c MACOSX_DEPLOYMENT_TARGET environment + variable to get \e{weak linking} to work for your application. You + can add: \snippet doc/src/snippets/code/doc_src_deployment.qdoc 51 - to your .pro file and qmake will take care of this for you. - - However, there is a bit of a wrinkle to keep in mind when your are - deploying. Mac OS X 10.4 ("Tiger") ships GCC 4.0 as its default - compiler. This is also the GCC compiler we use for building the - binary Qt package. If you use GCC 4.0 to build your application, - it will link against a dynamic libstdc++ that is only available on - Mac OS X 10.4 and Mac OS X 10.3.9. The application will refuse to - run on older versions of the operating system. + to your .pro file, and qmake will take care of this for you. For more information about C++ runtime environment, see \l {http://developer.apple.com/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/index.html}{Apple's Developer Website} - If you want to deploy to versions of Mac OS X earlier than 10.3.9, - you must build with GCC 3.3 which is the default on Mac OS X - 10.3. GCC 3.3 is also available on the Mac OS X 10.4 "Xcode Tools" - CD and as a download for earlier versions of Mac OS X from Apple - (\l {https://connect.apple.com/}{connect.apple.com}). You can use - Apple's \c gcc_select(1) command line tool to switch the default - complier on your system. - \section3 Deploying Phonon Applications on Mac OS X \list - \o If you build your Phonon application on Tiger, it will work on - Tiger, Leopard and Panther. - \o If you build your application on Leopard, it will \bold not work - on Panther unless you rename the libraries with the following command - after you have built your application: - - \snippet doc/src/snippets/code/doc_src_deployment.qdoc 51a - This command must be invoked in the directory where - \c{libphonon_qt7.dylib} is located, usually in - \c{yourapp.app/Contents/plugins/phonon_backend/}. - \o The \l {macdeploy}{deployment tool} will perform this step for you. + \o If you build your Qt 4.6 Phonon application on OS X 10.4 + (Tiger), it will run on OS X 10.4 and higher. - \o If you are using Leopard, but would like to build your application + \o If you are using Leopard but would like to build your application against Tiger, you can use: \snippet doc/src/snippets/code/doc_src_deployment.qdoc 51b @@ -1444,12 +1419,13 @@ \section2 Architecture Dependencies - The Qt for Mac OS X libraries, tools, and examples can be built "universal" - (i.e. they run natively on both Intel and PowerPC machines). This - is accomplished by passing \c -universal on the \c configure line - of the source package, and requires that you use GCC 4.0.x. On - PowerPC hardware you will need to pass the universal SDK as a - command line argument to the Qt configure command. For example: + The Qt for Mac OS X libraries, tools, and examples can be built + "universal" (i.e. they run natively on both Intel and PowerPC + machines). This is accomplished by passing \c -universal on the + \c configure line of the source package, and requires that you use + GCC 4.0.x. On PowerPC hardware you will need to pass the universal + SDK as a command line argument to the Qt configure command. For + example: \snippet doc/src/snippets/code/doc_src_deployment.qdoc 52 diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index e08bf1a..f513181 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -293,6 +293,9 @@ \section1 General Information + Qt 4.6 applications can only be deployed on Mac OS X 10.4 (Tiger) + and higher. + Qt 4.4 and Qt 4.5 development is only supported on Mac OS X 10.4 and up. Applications built against these version of Qt can be deployed on Mac OS X 10.3, but cannot be developed on that version of the operating system due -- cgit v0.12 From 4519080aacc480acea59758e4ca4efeed599aaec Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 11:06:44 +0100 Subject: demo browser: Fix the way warnings were (not) displayed Reviewed-by: TrustMe --- demos/browser/browser.pro | 2 -- demos/browser/networkaccessmanager.cpp | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro index a42aa60..f038c61 100644 --- a/demos/browser/browser.pro +++ b/demos/browser/browser.pro @@ -6,8 +6,6 @@ CONFIG += qt warn_on contains(QT_BUILD_PARTS, tools):!embedded: CONFIG += uitools else: DEFINES += QT_NO_UITOOLS -release:DEFINES+=QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT - FORMS += \ addbookmarkdialog.ui \ bookmarks.ui \ diff --git a/demos/browser/networkaccessmanager.cpp b/demos/browser/networkaccessmanager.cpp index b0b00a2..70a9305 100644 --- a/demos/browser/networkaccessmanager.cpp +++ b/demos/browser/networkaccessmanager.cpp @@ -112,8 +112,9 @@ void NetworkAccessManager::requestFinished(QNetworkReply *reply) double pctCached = (double(requestFinishedFromCacheCount) * 100.0/ double(requestFinishedCount)); double pctPipelined = (double(requestFinishedPipelinedCount) * 100.0/ double(requestFinishedCount)); double pctSecure = (double(requestFinishedSecureCount) * 100.0/ double(requestFinishedCount)); +#ifdef QT_DEBUG qDebug("STATS [%lli requests total] [%3.2f%% from cache] [%3.2f%% pipelined] [%3.2f%% SSL/TLS]", requestFinishedCount, pctCached, pctPipelined, pctSecure); - +#endif } void NetworkAccessManager::loadSettings() -- cgit v0.12 From 74d3ef60ac8dfa12c90442062307e0c4b2600d03 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 11:29:24 +0100 Subject: Demo browser: Better handleUnsupportedContent implementation Do warnings instead of downloads for sub resources. Show error message for main resources. Reviewed-by: Tor Arne --- demos/browser/webview.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/demos/browser/webview.cpp b/demos/browser/webview.cpp index 1a7e38a..2f9b3e6 100644 --- a/demos/browser/webview.cpp +++ b/demos/browser/webview.cpp @@ -143,11 +143,19 @@ QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QS void WebPage::handleUnsupportedContent(QNetworkReply *reply) { - if (reply->error() == QNetworkReply::NoError) { - BrowserApplication::downloadManager()->handleUnsupportedContent(reply); + QString errorString = reply->errorString(); + + if (m_loadingUrl != reply->url()) { + // sub resource of this page + qWarning() << "Resource" << reply->url().toEncoded() << "has unknown Content-Type, will be ignored."; + reply->deleteLater(); return; } + if (reply->error() == QNetworkReply::NoError && !reply->header(QNetworkRequest::ContentTypeHeader).isValid()) { + errorString = "Unknown Content-Type"; + } + QFile file(QLatin1String(":/notfound.html")); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); @@ -156,7 +164,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) QString title = tr("Error loading page: %1").arg(reply->url().toString()); QString html = QString(QLatin1String(file.readAll())) .arg(title) - .arg(reply->errorString()) + .arg(errorString) .arg(reply->url().toString()); QBuffer imageBuffer; -- cgit v0.12 From c034670d71247954eb918dfc84536ace02c33304 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 12:56:55 +0100 Subject: QNAM HTTP: Improve parseStatus() of HTTP reply Just read() instead us using peek() and bytesAvailable() Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkreply.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index a5223d1..b411467 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -425,11 +425,19 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) { qint64 bytes = 0; char c; + qint64 haveRead = 0; + + do { + haveRead = socket->read(&c, 1); + if (haveRead == -1) + return -1; // unexpected EOF + else if (haveRead == 0) + break; // read more later + + bytes++; - while (socket->bytesAvailable()) { // allow both CRLF & LF (only) line endings - if (socket->peek(&c, 1) == 1 && c == '\n') { - bytes += socket->read(&c, 1); // read the "n" + if (c == '\n') { // remove the CR at the end if (fragment.endsWith('\r')) { fragment.truncate(fragment.length()-1); @@ -442,11 +450,6 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) } break; } else { - c = 0; - int haveRead = socket->read(&c, 1); - if (haveRead == -1) - return -1; - bytes += haveRead; fragment.append(c); } @@ -456,8 +459,7 @@ qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) fragment.clear(); return -1; } - - } + } while (haveRead == 1); return bytes; } -- cgit v0.12 From 1263253f298b4cb3f0679cc67b010766b58a4fd9 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 9 Feb 2010 13:21:44 +0200 Subject: Add QSKIP to functionEntryAndExit_builtin. The function fails on Mac and Windows, but it will be fixed in next JSC update. Lets skip it for now. Reviewed-by: Kent Hansen --- tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp index 8e26696..ac9ca46 100644 --- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp +++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp @@ -832,6 +832,7 @@ void tst_QScriptEngineAgent::functionEntryAndExit_builtin_data() /** check behaiviour of built-in function */ void tst_QScriptEngineAgent::functionEntryAndExit_builtin() { + QSKIP("The test fails on platforms others than Linux. The issue will be fixed with next JSC update", SkipAll); QFETCH(QString, script); QFETCH(QString, result); QScriptEngine eng; -- cgit v0.12 From f38f61df31b708e1f4e50c5fdcc30099f9a1fe8f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 9 Feb 2010 12:46:41 +0100 Subject: =?UTF-8?q?Fix=20warnings=20~QX11PixmapData():=20QPixmap=20objects?= =?UTF-8?q?=20must=20be=20destroyed..=20Reviewed-by:=20Trond=20Kjern=C3=A5?= =?UTF-8?q?sen=20=20Task-number:=20QTBUG-8046?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/designer/src/lib/shared/actionrepository.cpp | 21 ++++++++++----------- tools/designer/src/lib/shared/actionrepository_p.h | 9 +++++++-- tools/designer/src/lib/shared/iconloader.cpp | 3 +-- tools/designer/src/lib/shared/qdesigner_menu.cpp | 11 +++++------ tools/designer/src/lib/shared/qdesigner_menu_p.h | 2 ++ 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/tools/designer/src/lib/shared/actionrepository.cpp b/tools/designer/src/lib/shared/actionrepository.cpp index e3ff2c1..1076ff4 100644 --- a/tools/designer/src/lib/shared/actionrepository.cpp +++ b/tools/designer/src/lib/shared/actionrepository.cpp @@ -77,18 +77,12 @@ static inline QAction *actionOfItem(const QStandardItem* item) return qvariant_cast(item->data(qdesigner_internal::ActionModel::ActionRole)); } -static QIcon fixActionIcon(const QIcon &icon) -{ - if (icon.isNull()) - return qdesigner_internal::emptyIcon(); - return icon; -} - namespace qdesigner_internal { // ----------- ActionModel ActionModel::ActionModel(QWidget *parent ) : QStandardItemModel(parent), + m_emptyIcon(emptyIcon()), m_core(0) { QStringList headers; @@ -127,7 +121,7 @@ void ActionModel::update(int row) for (int i = 0; i < NumColumns; i++) list += item(row, i); - setItems(m_core, actionOfItem(list.front()), list); + setItems(m_core, actionOfItem(list.front()), m_emptyIcon, list); } void ActionModel::remove(int row) @@ -150,7 +144,7 @@ QModelIndex ActionModel::addAction(QAction *action) item->setFlags(flags); items.push_back(item); } - setItems(m_core, action, items); + setItems(m_core, action, m_emptyIcon, items); appendRow(items); return indexFromItem(items.front()); } @@ -185,7 +179,9 @@ PropertySheetKeySequenceValue ActionModel::actionShortCut(const QDesignerPropert return qvariant_cast(sheet->property(index)); } -void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, QStandardItemList &sl) +void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, + const QIcon &defaultIcon, + QStandardItemList &sl) { // Tooltip, mostly for icon view mode @@ -200,7 +196,10 @@ void ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action, QStandardItem *item = sl[NameColumn]; item->setText(action->objectName()); - item->setIcon(fixActionIcon(action->icon())); + QIcon icon = action->icon(); + if (icon.isNull()) + icon = defaultIcon; + item->setIcon(icon); item->setToolTip(firstTooltip); item->setWhatsThis(firstTooltip); // Used diff --git a/tools/designer/src/lib/shared/actionrepository_p.h b/tools/designer/src/lib/shared/actionrepository_p.h index 65adc5d..6e17e7b 100644 --- a/tools/designer/src/lib/shared/actionrepository_p.h +++ b/tools/designer/src/lib/shared/actionrepository_p.h @@ -59,6 +59,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -110,10 +111,14 @@ signals: void resourceImageDropped(const QString &path, QAction *action); private: + typedef QList QStandardItemList; + void initializeHeaders(); + static void setItems(QDesignerFormEditorInterface *core, QAction *a, + const QIcon &defaultIcon, + QStandardItemList &sl); - typedef QList QStandardItemList; - static void setItems(QDesignerFormEditorInterface *core, QAction *a, QStandardItemList &sl); + const QIcon m_emptyIcon; QDesignerFormEditorInterface *m_core; }; diff --git a/tools/designer/src/lib/shared/iconloader.cpp b/tools/designer/src/lib/shared/iconloader.cpp index df0bb7e..ed312b8 100644 --- a/tools/designer/src/lib/shared/iconloader.cpp +++ b/tools/designer/src/lib/shared/iconloader.cpp @@ -70,8 +70,7 @@ QDESIGNER_SHARED_EXPORT QIcon createIconSet(const QString &name) QDESIGNER_SHARED_EXPORT QIcon emptyIcon() { - static const QIcon empty_icon(QLatin1String(":/trolltech/formeditor/images/emptyicon.png")); - return empty_icon; + return QIcon(QLatin1String(":/trolltech/formeditor/images/emptyicon.png")); } } // namespace qdesigner_internal diff --git a/tools/designer/src/lib/shared/qdesigner_menu.cpp b/tools/designer/src/lib/shared/qdesigner_menu.cpp index c83abad..ba512e4 100644 --- a/tools/designer/src/lib/shared/qdesigner_menu.cpp +++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp @@ -88,6 +88,7 @@ static inline void extendClickableArea(QRect *subMenuRect, Qt::LayoutDirection d QDesignerMenu::QDesignerMenu(QWidget *parent) : QMenu(parent), + m_subMenuPixmap(QPixmap(QLatin1String(":/trolltech/formeditor/images/submenu.png"))), m_currentIndex(0), m_addItem(new SpecialMenuAction(this)), m_addSeparator(new SpecialMenuAction(this)), @@ -550,11 +551,10 @@ void QDesignerMenu::deleteAction(QAction *a) QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const { - static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png")); const QRect g = actionGeometry(action); - const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - pm.width() - 2) : 2; - const int y = g.top() + (g.height() - pm.height())/2 + 1; - return QRect(x, y, pm.width(), pm.height()); + const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - m_subMenuPixmap.width() - 2) : 2; + const int y = g.top() + (g.height() - m_subMenuPixmap.height())/2 + 1; + return QRect(x, y, m_subMenuPixmap.width(), m_subMenuPixmap.height()); } bool QDesignerMenu::hasSubMenuPixmap(QAction *action) const @@ -591,8 +591,7 @@ void QDesignerMenu::paintEvent(QPaintEvent *event) p.fillRect(g, lg); } else if (hasSubMenuPixmap(a)) { - static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png")); - p.drawPixmap(subMenuPixmapRect(a).topLeft(), pm); + p.drawPixmap(subMenuPixmapRect(a).topLeft(), m_subMenuPixmap); } } diff --git a/tools/designer/src/lib/shared/qdesigner_menu_p.h b/tools/designer/src/lib/shared/qdesigner_menu_p.h index 9c9a311..ae1e0e7 100644 --- a/tools/designer/src/lib/shared/qdesigner_menu_p.h +++ b/tools/designer/src/lib/shared/qdesigner_menu_p.h @@ -57,6 +57,7 @@ #include #include +#include #include QT_BEGIN_NAMESPACE @@ -183,6 +184,7 @@ protected: private: bool hideSubMenuOnCursorKey(); bool showSubMenuOnCursorKey(); + const QPixmap m_subMenuPixmap; QPoint m_startPosition; int m_currentIndex; -- cgit v0.12 From 884a36d300bbe9068d912550a4aeb581f8ce8b37 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 9 Feb 2010 11:58:12 +0100 Subject: Fixed warnings and crash when painting graphics effects outside scene. The problem was that when an item had a QGraphicsEffect on itself and that item was outside of the sceneRect, the cached pixmap of the item was just an empty pixmap (when using DeviceCoordinates mode). Therefore the effect filter was trying to paint into an unformatted and empty image. Now, paint() for all pixmap filters just return immediatly when the pixmap is empty. Task-number: QTBUG-5358 Reviewed-by: sroedal --- src/gui/image/qpixmapfilter.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 37a6a18..7cf942c 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -422,6 +422,9 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if(d->kernelWidth<=0 || d->kernelHeight <= 0) return; + if (src.isNull()) + return; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapConvolutionFilter *convolutionFilter = static_cast(filter); @@ -902,6 +905,9 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap if (!painter->isActive()) return; + if (src.isNull()) + return; + QRectF srcRect = rect; if (srcRect.isNull()) srcRect = src.rect(); @@ -1082,6 +1088,10 @@ void QPixmapColorizeFilter::setStrength(qreal strength) void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { Q_D(const QPixmapColorizeFilter); + + if (src.isNull()) + return; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapColorizeFilter *colorizeFilter = static_cast(filter); @@ -1312,6 +1322,10 @@ void QPixmapDropShadowFilter::draw(QPainter *p, const QRectF &src) const { Q_D(const QPixmapDropShadowFilter); + + if (px.isNull()) + return; + QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ? static_cast(p->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapDropShadowFilter *dropShadowFilter = static_cast(filter); -- cgit v0.12 From 997490b36b28bca877409de97a506c969840bc43 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 9 Feb 2010 13:05:09 +0100 Subject: QListView: fix crash when hiding many of the lasts item in a QListView Since 6c1388ee5a3c4796d hidden items are not taken in account when counting the scrollbar position, and so the vector may be smaller. Reviewed-by: Gabriel Task-number: QTBUG-7929 --- src/gui/itemviews/qlistview.cpp | 2 +- tests/auto/qlistview/tst_qlistview.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 19b1e8c..b2def39 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -2160,7 +2160,7 @@ void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) } else { if (flowPositions.isEmpty()) return; - const int max = flowPositions.count() - 1; + const int max = scrollValueMap.count() - 1; if (vertical && flow() == QListView::TopToBottom && dy != 0) { int currentValue = qBound(0, verticalValue, max); int previousValue = qBound(0, currentValue + dy, max); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 7109213..1e6d36a 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1834,6 +1834,23 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() QVERIFY(index.isValid()); QCOMPARE(index.row(), 2 * i + 1); } + + //QTBUG-7929 should not crash + view.show(); + QTest::qWaitForWindowShown(&view); + QScrollBar *bar = view.flow() == QListView::TopToBottom + ? view.verticalScrollBar() : view.horizontalScrollBar(); + + int nbVisibleItem = rowCount / 2 - bar->maximum(); + + bar->setValue(bar->maximum()); + QApplication::processEvents(); + for (int i = rowCount; i > rowCount / 2; i--) { + view.setRowHidden(i, true); + } + QApplication::processEvents(); + QCOMPARE(bar->value(), bar->maximum()); + QCOMPARE(bar->maximum(), rowCount/4 - nbVisibleItem); } void tst_QListView::taskQTBUG_633_changeModelData() -- cgit v0.12 From 3b56735e8d90cb760bf56fc07fbd87e48ca08619 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 9 Feb 2010 13:38:18 +0100 Subject: Speed up QListView test (from 31s to 7s) --- tests/auto/qlistview/tst_qlistview.cpp | 67 ++++++++++++++++------------------ 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 1e6d36a..2c31d8b 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -606,9 +606,8 @@ void tst_QListView::indexAt() view2.setWrapping(true); // We really want to make sure it is shown, because the layout won't be known until it is shown view2.show(); - for (int i = 0; i < 5 && !view2.m_shown; ++i) { - QTest::qWait(500); - } + QTest::qWaitForWindowShown(&view2); + QTRY_VERIFY(view2.m_shown); QVERIFY(view2.m_index.isValid()); QVERIFY(view2.m_index.row() != 0); @@ -760,7 +759,8 @@ void tst_QListView::hideFirstRow() view.setUniformItemSizes(true); view.setRowHidden(0,true); view.show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(&view); + QTest::qWait(10); } void tst_QListView::batchedMode() @@ -778,10 +778,9 @@ void tst_QListView::batchedMode() view.setBatchSize(2); view.resize(200,400); view.show(); + QTest::qWaitForWindowShown(&view); -#if !defined(Q_OS_WINCE) - QTest::qWait(100); -#else +#if defined(Q_OS_WINCE) QTest::qWait(2000); #endif QBitArray ba; @@ -1203,9 +1202,9 @@ void tst_QListView::scrollTo() //we click the item QPoint p = lv.visualRect(index).center(); QTest::mouseClick(lv.viewport(), Qt::LeftButton, Qt::NoModifier, p); - //let's wait 1 second because the scrolling is delayed - QTest::qWait(1000); - QCOMPARE(lv.visualRect(index).y(),0); + //let's wait because the scrolling is delayed + QTest::qWait(QApplication::doubleClickInterval() + 150); + QTRY_COMPARE(lv.visualRect(index).y(),0); //we scroll down. As the item is to tall for the view, it will disappear QTest::keyClick(lv.viewport(), Qt::Key_Down, Qt::NoModifier); @@ -1222,9 +1221,9 @@ void tst_QListView::scrollTo() //we click the item p = lv.visualRect(index).center(); QTest::mouseClick(lv.viewport(), Qt::LeftButton, Qt::NoModifier, p); - //let's wait 1 second because the scrolling is delayed - QTest::qWait(1000); - QCOMPARE(lv.visualRect(index).x(),0); + //let's wait because the scrolling is delayed + QTest::qWait(QApplication::doubleClickInterval() + 150); + QTRY_COMPARE(lv.visualRect(index).x(),0); //we scroll right. As the item is too wide for the view, it will disappear QTest::keyClick(lv.viewport(), Qt::Key_Right, Qt::NoModifier); @@ -1243,9 +1242,9 @@ void tst_QListView::scrollTo() //we click the item p = lv.visualRect(index).center(); QTest::mouseClick(lv.viewport(), Qt::LeftButton, Qt::NoModifier, p); - //let's wait 1 second because the scrolling is delayed - QTest::qWait(1000); - QCOMPARE(lv.visualRect(index).y(),0); + //let's wait because the scrolling is delayed + QTest::qWait(QApplication::doubleClickInterval() + 150); + QTRY_COMPARE(lv.visualRect(index).y(),0); //we scroll down. As the item is too tall for the view, it will partially disappear QTest::keyClick(lv.viewport(), Qt::Key_Down, Qt::NoModifier); @@ -1277,7 +1276,7 @@ void tst_QListView::scrollBarRanges() for (int h = 30; h <= 210; ++h) { lv.resize(250, h); - QTest::qWait(100); // wait for the layout to be done + QApplication::processEvents(); // wait for the layout to be done int visibleRowCount = lv.viewport()->size().height() / rowHeight; int invisibleRowCount = rowCount - visibleRowCount; QCOMPARE(lv.verticalScrollBar()->maximum(), invisibleRowCount); @@ -1366,7 +1365,7 @@ void tst_QListView::scrollBarAsNeeded() model.setStringList(list); QApplication::processEvents(); - QTest::qWait(100); + QTest::qWait(50); QStringList replacement; for (i = 0; i < itemCount; ++i) { @@ -1375,10 +1374,9 @@ void tst_QListView::scrollBarAsNeeded() model.setStringList(replacement); QApplication::processEvents(); - QTest::qWait(100); - QCOMPARE(lv.horizontalScrollBar()->isVisible(), horizontalScrollBarVisible); - QCOMPARE(lv.verticalScrollBar()->isVisible(), verticalScrollBarVisible); + QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), horizontalScrollBarVisible); + QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), verticalScrollBarVisible); } } @@ -1433,10 +1431,9 @@ void tst_QListView::wordWrap() lv.setFixedSize(150, 150); lv.show(); QApplication::processEvents(); - QTest::qWait(100); - QCOMPARE(lv.horizontalScrollBar()->isVisible(), false); - QCOMPARE(lv.verticalScrollBar()->isVisible(), true); + QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), false); + QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true); } #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) @@ -1557,7 +1554,8 @@ void tst_QListView::task248430_crashWith0SizedItem() QStringListModel model(QStringList() << QLatin1String("item1") << QString()); view.setModel(&model); view.show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(&view); + QTest::qWait(20); } void tst_QListView::task250446_scrollChanged() @@ -1569,21 +1567,21 @@ void tst_QListView::task250446_scrollChanged() QVERIFY(index.isValid()); view.setCurrentIndex(index); view.show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(&view); const int scrollValue = view.verticalScrollBar()->maximum(); view.verticalScrollBar()->setValue(scrollValue); QCOMPARE(view.verticalScrollBar()->value(), scrollValue); QCOMPARE(view.currentIndex(), index); view.showMinimized(); - QTest::qWait(100); - QCOMPARE(view.verticalScrollBar()->value(), scrollValue); - QCOMPARE(view.currentIndex(), index); + QTest::qWait(50); + QTRY_COMPARE(view.verticalScrollBar()->value(), scrollValue); + QTRY_COMPARE(view.currentIndex(), index); view.showNormal(); - QTest::qWait(100); - QCOMPARE(view.verticalScrollBar()->value(), scrollValue); - QCOMPARE(view.currentIndex(), index); + QTest::qWait(50); + QTRY_COMPARE(view.verticalScrollBar()->value(), scrollValue); + QTRY_COMPARE(view.currentIndex(), index); } void tst_QListView::task196118_visualRegionForSelection() @@ -1699,7 +1697,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() view.setViewMode(QListView::IconMode); view.setModel(&model); view.show(); - QTest::qWait(30); + QTest::qWaitForWindowShown(&view); // Verfify that item sizes are non-uniform QVERIFY(view.sizeHintForIndex(model.index(0, 0)).height() > view.sizeHintForIndex(model.index(1, 0)).height()); @@ -1729,7 +1727,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() view.setViewMode(QListView::IconMode); view.setModel(&model); view.show(); - QTest::qWait(30); + QTest::qWaitForWindowShown(&view); // Verfify that item sizes are non-uniform QVERIFY(view.sizeHintForIndex(model.index(0, 0)).width() > view.sizeHintForIndex(model.index(1, 0)).width()); @@ -1789,7 +1787,6 @@ void tst_QListView::task262152_setModelColumnNavigate() view.show(); QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTest::qWait(30); QTRY_COMPARE(static_cast(&view), QApplication::activeWindow()); QTest::keyClick(&view, Qt::Key_Down); QTest::qWait(30); -- cgit v0.12 From 057532393ad96cd90a616cb7eccf762ddd0ff4dd Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 13:30:24 +0100 Subject: QNAM HTTP: Improve readHeader() of the HTTP reply Just read() instead us using peek() and bytesAvailable() Also don't use the obfuscated line ending checking code. Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkreply.cpp | 36 ++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index b411467..c56a3a3 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -505,17 +505,31 @@ qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) qint64 bytes = 0; char c = 0; bool allHeaders = false; - while (!allHeaders && socket->bytesAvailable()) { - if (socket->peek(&c, 1) == 1 && c == '\n') { - // check for possible header endings. As per HTTP rfc, - // the header endings will be marked by CRLFCRLF. But - // we will allow CRLFLF, LFLF & CRLFCRLF - if (fragment.endsWith("\n\r") || fragment.endsWith('\n')) - allHeaders = true; + qint64 haveRead = 0; + do { + haveRead = socket->read(&c, 1); + if (haveRead == 0) { + // read more later + break; + } else if (haveRead == -1) { + // connection broke down + return -1; + } else { + fragment.append(c); + bytes++; + + if (c == '\n') { + // check for possible header endings. As per HTTP rfc, + // the header endings will be marked by CRLFCRLF. But + // we will allow CRLFCRLF, CRLFLF, LFLF + if (fragment.endsWith("\r\n\r\n") + || fragment.endsWith("\r\n\n") + || fragment.endsWith("\n\n")) + allHeaders = true; + } } - bytes += socket->read(&c, 1); - fragment.append(c); - } + } while (!allHeaders && haveRead > 0); + // we received all headers now parse them if (allHeaders) { parseHeader(fragment); @@ -565,7 +579,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) } while (i < header.count() && (header.at(i) == ' ' || header.at(i) == '\t')); if (i == -1) break; // something is wrong - + qDebug() << "added header" << field << value; fields.append(qMakePair(field, value)); } } -- cgit v0.12 From 7177a8d02bdec25b1c64dd65c7c7f5803809a244 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Tue, 9 Feb 2010 13:54:33 +0100 Subject: QNetworkCookie(Jar): fix includes we need to include the module preefix in public headers Reviewed-by: Denis Dzyubenko --- src/network/access/qnetworkcookie.h | 2 +- src/network/access/qnetworkcookiejar.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index f34396f..3cc4cee 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -114,7 +114,7 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug, const QNetworkCookie &); QT_END_NAMESPACE // ### Qt5 remove this include -#include "qnetworkcookiejar.h" +#include Q_DECLARE_METATYPE(QNetworkCookie) Q_DECLARE_METATYPE(QList) diff --git a/src/network/access/qnetworkcookiejar.h b/src/network/access/qnetworkcookiejar.h index 813bf3e..8086f38 100644 --- a/src/network/access/qnetworkcookiejar.h +++ b/src/network/access/qnetworkcookiejar.h @@ -46,7 +46,7 @@ #include // ### Qt5 remove this include -#include "qnetworkcookie.h" +#include QT_BEGIN_HEADER -- cgit v0.12 From 9d8af1a5a11571d3f514e4ad73a0712ea5d89b0e Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 9 Feb 2010 11:40:39 +0100 Subject: Skip test that crashes on win32-g++ --- tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index 147896e..9514cd6 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -245,6 +245,10 @@ tst_Suite::tst_Suite() addTestExclusion("string-case", "V8-specific behavior? (Doesn't pass on SpiderMonkey either)"); +#ifdef Q_CC_MINGW + addTestExclusion("date$", "QTBUG-7698: Date.prototype.setMonth() crashes on win32-g++"); +#endif + #ifdef Q_OS_WINCE addTestExclusion("deep-recursion", "Demands too much memory on WinCE"); addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on WinCE"); -- cgit v0.12 From 416155f9078d9d055f72b383f7cce113cdc42645 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 9 Feb 2010 12:29:03 +0100 Subject: Add platform-specific expected failures for JS test suite --- .../qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 53 ++++++++++++++++++++++ .../qscriptv8testsuite/tst_qscriptv8testsuite.cpp | 10 ++++ 2 files changed, 63 insertions(+) diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index b2a85d7..ffcb56e 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -686,6 +686,59 @@ tst_Suite::tst_Suite() addExpectedFailure("ecma/Expressions/11.4.7-02.js", "-(-2147483648) == 2147483648", willFixInNextReleaseMessage); addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "- -\"0x80000000\"", willFixInNextReleaseMessage); +#ifdef Q_OS_WIN + addExpectedFailure("ecma_3/Expressions/11.7.3-01.js", "11.7.3 - >>> should evaluate operands in order: order", "QTBUG-8056"); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.7.3 >>>", "QTBUG-8056"); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 >>>=", "QTBUG-8056"); +#endif + +#ifdef Q_OS_SOLARIS + addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.5.2.js", "Number.POSITIVE_INFINITY / -0", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.5.2.js", "Number.NEGATIVE_INFINITY / -0", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.5.2.js", "1 / -0", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Expressions/11.5.2.js", "-1 / -0", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.10.js", "Math.log(-0.0000001)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.10.js", "Math.log(-1)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.11.js", "Infinity/Math.max(-0,-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.12.js", "Infinity/Math.min(0,-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.12.js", "Infinity/Math.min(-0,-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-Infinity, -1)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -1)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -0.5)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -1000)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-0, 1)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-0, 3)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-0, -2)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0.49)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0.5)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.17.js", "Infinity/Math.sqrt(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.18.js", "Infinity/Math.tan(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(1.00000001)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(11.00000001)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(1.000001)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(-1.000001)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.3.js", "Infinity/Math.asin(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.4.js", "Infinity/Math.atan(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(0, -0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Infinity/Math.atan2(-0, 1)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-0,\t-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-0,\t-1)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil('-0')", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-Number.MIN_VALUE)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-0.9)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.9.js", "Infinity/Math.floor(-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "var z = 0; print(1/-z)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "1/-1e-2000", willFixInNextReleaseMessage); +#endif + static const char klass[] = "tst_QScriptJsTestSuite"; QVector *data = qt_meta_data_tst_Suite(); diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index 9514cd6..a3dfd6c 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -236,6 +236,16 @@ tst_Suite::tst_Suite() addExpectedFailure("global-const-var-conflicts", "false", "true", willFixInNextReleaseMessage); addExpectedFailure("string-lastindexof", "0", "-1", "test is wrong?"); +#ifndef Q_OS_LINUX + addExpectedFailure("to-precision", "1.235e+27", "1.234e+27", "QTBUG-8053: toPrecision(4) gives wrong result on Mac"); +#endif + +#ifdef Q_OS_SOLARIS + addExpectedFailure("math-min-max", "Infinity", "-Infinity", willFixInNextReleaseMessage); + addExpectedFailure("negate-zero", "false", "true", willFixInNextReleaseMessage); + addExpectedFailure("str-to-num", "Infinity", "-Infinity", willFixInNextReleaseMessage); +#endif + addTestExclusion("debug-*", "not applicable"); addTestExclusion("mirror-*", "not applicable"); -- cgit v0.12 From 79a7572bf2aa42ca246cb7efd53e3dac2cd426bc Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 14:09:24 +0100 Subject: QNAM HTTP: Reserve bytes for HTTP parsing Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkreply.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index c56a3a3..6615410 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -423,6 +423,11 @@ int QHttpNetworkReplyPrivate::gunzipBodyPartially(QByteArray &compressed, QByteA qint64 QHttpNetworkReplyPrivate::readStatus(QAbstractSocket *socket) { + if (fragment.isEmpty()) { + // reserve bytes for the status line. This is better than always append() which reallocs the byte array + fragment.reserve(32); + } + qint64 bytes = 0; char c; qint64 haveRead = 0; @@ -502,6 +507,13 @@ bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) qint64 QHttpNetworkReplyPrivate::readHeader(QAbstractSocket *socket) { + if (fragment.isEmpty()) { + // according to http://dev.opera.com/articles/view/mama-http-headers/ the average size of the header + // block is 381 bytes. + // reserve bytes. This is better than always append() which reallocs the byte array. + fragment.reserve(512); + } + qint64 bytes = 0; char c = 0; bool allHeaders = false; -- cgit v0.12 From 169dd653a730342d90b39a0744d2c82d318d8d07 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Feb 2010 14:37:46 +0100 Subject: QNAM HTTP: Forgot to remove a qDebug() Reviewed-by: TrustMe --- src/network/access/qhttpnetworkreply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 6615410..512c045 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -591,7 +591,7 @@ void QHttpNetworkReplyPrivate::parseHeader(const QByteArray &header) } while (i < header.count() && (header.at(i) == ' ' || header.at(i) == '\t')); if (i == -1) break; // something is wrong - qDebug() << "added header" << field << value; + fields.append(qMakePair(field, value)); } } -- cgit v0.12 From 0a9c7a44c6a9ca134c7a23a33a9285787a7a6d19 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 9 Feb 2010 16:05:50 +0100 Subject: Fix tst_QAbstractItemView::task250754_fontChange and tst_QAbstractItemView::QTBUG6407_extendedSelection for Symbian & 5800 We should consider the difference between Point and Pixel for font size. And also the margin and some other settings in style for views. Reviewed-by: TrustMe --- tests/auto/qabstractitemview/tst_qabstractitemview.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 504ceac..ea86c16 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -1213,14 +1213,14 @@ void tst_QAbstractItemView::task250754_fontChange() tree.setModel(m); w.show(); - w.resize(150,150); + w.resize(150,240); QTest::qWait(30); QFont font = tree.font(); - font.setPointSize(5); + font.setPixelSize(10); tree.setFont(font); QTRY_VERIFY(!tree.verticalScrollBar()->isVisible()); - font.setPointSize(45); + font.setPixelSize(60); tree.setFont(font); //now with the huge items, the scrollbar must be visible QTRY_VERIFY(tree.verticalScrollBar()->isVisible()); @@ -1444,7 +1444,10 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection() for(int i = 0; i < 50; ++i) view.addItem(QString::number(i)); - view.resize(200,200); + QFont font = view.font(); + font.setPixelSize(10); + view.setFont(font); + view.resize(200,240); view.show(); QApplication::setActiveWindow(&view); -- cgit v0.12 From 43f76aaa733f66895fd672a9243e950d410ef918 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Tue, 9 Feb 2010 15:38:44 +0100 Subject: Add mingw-specific expected failures for JS test suite --- tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index ffcb56e..41df98c 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -683,8 +683,10 @@ tst_Suite::tst_Suite() addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 7", willFixInNextReleaseMessage); addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 26", willFixInNextReleaseMessage); +#ifndef Q_CC_MINGW addExpectedFailure("ecma/Expressions/11.4.7-02.js", "-(-2147483648) == 2147483648", willFixInNextReleaseMessage); addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "- -\"0x80000000\"", willFixInNextReleaseMessage); +#endif #ifdef Q_OS_WIN addExpectedFailure("ecma_3/Expressions/11.7.3-01.js", "11.7.3 - >>> should evaluate operands in order: order", "QTBUG-8056"); @@ -692,6 +694,15 @@ tst_Suite::tst_Suite() addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 >>>=", "QTBUG-8056"); #endif +#ifdef Q_CC_MINGW + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,-0)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(Infinity, Infinity)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(Infinity, -Infinity)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-Infinity, Infinity)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-Infinity, -Infinity)", willFixInNextReleaseMessage); +#endif + #ifdef Q_OS_SOLARIS addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage); addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage); -- cgit v0.12 From dadfdfaa320aa5951d8512428d59e762b0da79f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 9 Feb 2010 16:10:40 +0100 Subject: Fixed some global QIcon/QPixmap instances that leaked handles on X11. Never ever create global cache objects that deletes QPixmaps when destructed! Task-number: QTBUG-8046 Reviewed-by: Friedemann Kleint --- src/gui/image/qicon.cpp | 17 +++++++++----- src/qt3support/dialogs/q3filedialog.cpp | 40 ++++++++++++++++++++------------- src/qt3support/itemviews/q3iconview.cpp | 13 ++++++++--- src/qt3support/itemviews/q3listview.cpp | 3 --- 4 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index ac1d303..bf6eb8d 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -104,6 +104,15 @@ QT_BEGIN_NAMESPACE static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1); +static void qt_cleanup_icon_cache(); +typedef QCache IconCache; +Q_GLOBAL_STATIC_WITH_INITIALIZER(IconCache, qtIconCache, qAddPostRoutine(qt_cleanup_icon_cache)) + +static void qt_cleanup_icon_cache() +{ + qtIconCache()->clear(); +} + QIconPrivate::QIconPrivate() : engine(0), ref(1), serialNum(serialNumCounter.fetchAndAddRelaxed(1)), @@ -963,15 +972,13 @@ QString QIcon::themeName() */ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) { - static QCache iconCache; - QIcon icon; - if (iconCache.contains(name)) { - icon = *iconCache.object(name); + if (qtIconCache()->contains(name)) { + icon = *qtIconCache()->object(name); } else { QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name)); - iconCache.insert(name, cachedIcon); + qtIconCache()->insert(name, cachedIcon); icon = *cachedIcon; } diff --git a/src/qt3support/dialogs/q3filedialog.cpp b/src/qt3support/dialogs/q3filedialog.cpp index 9b8e4d3..35f7890 100644 --- a/src/qt3support/dialogs/q3filedialog.cpp +++ b/src/qt3support/dialogs/q3filedialog.cpp @@ -475,9 +475,17 @@ static int sortFilesBy = (int)QDir::Name; static bool sortAscending = true; static bool detailViewMode = false; -static Q3CleanupHandler qfd_cleanup_pixmap; static Q3CleanupHandler qfd_cleanup_string; +static void qt_cleanup_fd_pixmaps(); +typedef QList FDPixmaps; +Q_GLOBAL_STATIC_WITH_INITIALIZER(FDPixmaps, qfd_pixmaps, qAddPostRoutine(qt_cleanup_fd_pixmaps)) + +static void qt_cleanup_fd_pixmaps() +{ + qDeleteAll(*qfd_pixmaps()); +} + static QString toRootIfNotExists( const QString &path ) { if ( !path.isEmpty() ) @@ -533,37 +541,37 @@ static void makeVariables() { qfd_cleanup_string.add(&workingDirectory); openFolderIcon = new QPixmap((const char **)open_xpm); - qfd_cleanup_pixmap.add(&openFolderIcon); + qfd_pixmaps()->append(openFolderIcon); symLinkDirIcon = new QPixmap((const char **)link_dir_xpm); - qfd_cleanup_pixmap.add(&symLinkDirIcon); + qfd_pixmaps()->append(symLinkDirIcon); symLinkFileIcon = new QPixmap((const char **)link_file_xpm); - qfd_cleanup_pixmap.add(&symLinkFileIcon); + qfd_pixmaps()->append(symLinkFileIcon); fileIcon = new QPixmap((const char **)file_xpm); - qfd_cleanup_pixmap.add(&fileIcon); + qfd_pixmaps()->append(fileIcon); closedFolderIcon = new QPixmap((const char **)closed_xpm); - qfd_cleanup_pixmap.add(&closedFolderIcon); + qfd_pixmaps()->append(closedFolderIcon); detailViewIcon = new QPixmap((const char **)detailedview_xpm); - qfd_cleanup_pixmap.add(&detailViewIcon); + qfd_pixmaps()->append(detailViewIcon); multiColumnListViewIcon = new QPixmap((const char **)mclistview_xpm); - qfd_cleanup_pixmap.add(&multiColumnListViewIcon); + qfd_pixmaps()->append(multiColumnListViewIcon); cdToParentIcon = new QPixmap((const char **)cdtoparent_xpm); - qfd_cleanup_pixmap.add(&cdToParentIcon); + qfd_pixmaps()->append(cdToParentIcon); newFolderIcon = new QPixmap((const char **)newfolder_xpm); - qfd_cleanup_pixmap.add(&newFolderIcon); + qfd_pixmaps()->append(newFolderIcon); previewInfoViewIcon = new QPixmap((const char **)previewinfoview_xpm); - qfd_cleanup_pixmap.add(&previewInfoViewIcon); + qfd_pixmaps()->append(previewInfoViewIcon); previewContentsViewIcon = new QPixmap((const char **)previewcontentsview_xpm); - qfd_cleanup_pixmap.add(&previewContentsViewIcon); + qfd_pixmaps()->append(previewContentsViewIcon); startCopyIcon = new QPixmap((const char **)start_xpm); - qfd_cleanup_pixmap.add(&startCopyIcon); + qfd_pixmaps()->append(startCopyIcon); endCopyIcon = new QPixmap((const char **)end_xpm); - qfd_cleanup_pixmap.add(&endCopyIcon); + qfd_pixmaps()->append(endCopyIcon); goBackIcon = new QPixmap((const char **)back_xpm); - qfd_cleanup_pixmap.add(&goBackIcon); + qfd_pixmaps()->append(goBackIcon); fifteenTransparentPixels = new QPixmap(closedFolderIcon->width(), 1); - qfd_cleanup_pixmap.add(&fifteenTransparentPixels); + qfd_pixmaps()->append(fifteenTransparentPixels); QBitmap m(fifteenTransparentPixels->width(), 1); m.fill(Qt::color0); fifteenTransparentPixels->setMask(m); diff --git a/src/qt3support/itemviews/q3iconview.cpp b/src/qt3support/itemviews/q3iconview.cpp index 67c956e..683e3d6 100644 --- a/src/qt3support/itemviews/q3iconview.cpp +++ b/src/qt3support/itemviews/q3iconview.cpp @@ -132,14 +132,21 @@ static QPixmap *qiv_selection = 0; #endif static bool optimize_layout = false; -static Q3CleanupHandler qiv_cleanup_pixmap; +static void qt_cleanup_iv_pixmaps(); +typedef QList IVPixmaps; +Q_GLOBAL_STATIC_WITH_INITIALIZER(IVPixmaps, qiv_pixmaps, qAddPostRoutine(qt_cleanup_iv_pixmaps)) + +static void qt_cleanup_iv_pixmaps() +{ + qDeleteAll(*qiv_pixmaps()); +} static QPixmap *get_qiv_buffer_pixmap(const QSize &s) { if (!qiv_buffer_pixmap) { qiv_buffer_pixmap = new QPixmap(s); - qiv_cleanup_pixmap.add(&qiv_buffer_pixmap); + qiv_pixmaps()->append(qiv_buffer_pixmap); return qiv_buffer_pixmap; } @@ -2580,7 +2587,7 @@ Q3IconView::Q3IconView(QWidget *parent, const char *name, Qt::WindowFlags f) { if (!unknown_icon) { unknown_icon = new QPixmap((const char **)unknown_xpm); - qiv_cleanup_pixmap.add(&unknown_icon); + qiv_pixmaps()->append(unknown_icon); } d = new Q3IconViewPrivate; diff --git a/src/qt3support/itemviews/q3listview.cpp b/src/qt3support/itemviews/q3listview.cpp index 2c15ad0..12dad84 100644 --- a/src/qt3support/itemviews/q3listview.cpp +++ b/src/qt3support/itemviews/q3listview.cpp @@ -70,9 +70,6 @@ QT_BEGIN_NAMESPACE const int Unsorted = 16383; -static Q3CleanupHandler qlv_cleanup_bitmap; - - struct Q3ListViewPrivate { // classes that are here to avoid polluting the global name space -- cgit v0.12 From 33aa8f4a035c1ce9231b40844e6e0793205d12aa Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 9 Feb 2010 11:37:18 +0000 Subject: Added qwidget test case which displays a native child widget As of commit bc82db, show()ing a native child widget causes a panic on Symbian. The panic code (WSERV-10) indicates that Activate() is being called on an already-active graphics context. This test case reproduces the defect. Task-number: QTBUG-7960 --- tests/auto/qwidget/tst_qwidget.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 03eddee..b59017b 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -250,6 +250,7 @@ private slots: #else void persistentWinId(); #endif + void showNativeChild(); void qobject_castInDestroyedSlot(); void showHideEvent_data(); @@ -4586,6 +4587,16 @@ void tst_QWidget::persistentWinId() } #endif // Q_OS_SYMBIAN +void tst_QWidget::showNativeChild() +{ + QWidget topLevel; + topLevel.setGeometry(0, 0, 100, 100); + QWidget child(&topLevel); + child.winId(); + topLevel.show(); + QTest::qWaitForWindowShown(&topLevel); +} + class ShowHideEventWidget : public QWidget { public: -- cgit v0.12 From 46df42af1a25fd06247bb96d9e0bf24bf19defe8 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Tue, 9 Feb 2010 09:41:29 +0000 Subject: Fixed defect in handling of expose events for Symbian Commit bc82db did not correctly handle native child widgets. Consider the case when we have a top-level widget A with a native child widget B. When QSymbianControl::Draw() is called on the control corresponding to B, the following occurs: 1. The inExpose flag is set in B's QWExtra structure. 2. The call to syncBackingStore() results in a call to QWidgetBackingStore::flush(), passing default parameters. 3. Because no target widget was passed to flush(), this function selects the top-level widget (A) as the target for the flush operation, passing A as the first argument of QS60WindowSurface::flush(). 4. QS60WindowSurface::flush() checks the inExpose flag from A's QWExtra structure, finds it to be false, and proceeds to call DrawNow() on A's control. Because QSymbianControl::Draw() uses the default graphics context, this context is shared between controls. This means that the DrawNow() call in step 4 causes a WSERV-10 panic (Activate() called on an already-active) graphics context. This patch moves the inExpose flag from B's QWExtra into A's QTLWExtra, with the result that the call to DrawNow() in step 4 is suppressed. Task-number: QTBUG-7960 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 11 +++++++---- src/gui/kernel/qwidget_p.h | 3 ++- src/gui/kernel/qwidget_s60.cpp | 2 +- src/gui/painting/qwindowsurface_s60.cpp | 11 +++++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 4a137ee..bf3ad71 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -809,12 +809,15 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const void QSymbianControl::Draw(const TRect& controlRect) const { // Set flag to avoid calling DrawNow in window surface - QWExtra *extra = qwidget->d_func()->extraData(); - if (extra && !extra->inExpose) { - extra->inExpose = true; + QWidget *window = qwidget->window(); + Q_ASSERT(window); + QTLWExtra *topExtra = window->d_func()->maybeTopData(); + Q_ASSERT(topExtra); + if (!topExtra->inExpose) { + topExtra->inExpose = true; QRect exposeRect = qt_TRect2QRect(controlRect); qwidget->d_func()->syncBackingStore(exposeRect); - extra->inExpose = false; + topExtra->inExpose = false; } QWindowSurface *surface = qwidget->windowSurface(); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index b1eb3c3..4b62074 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -173,6 +173,8 @@ struct QTLWExtra { #ifndef QT_NO_QWS_MANAGER QWSManager *qwsManager; #endif +#elif defined(Q_OS_SYMBIAN) + uint inExpose : 1; // Prevents drawing recursion #endif }; @@ -229,7 +231,6 @@ struct QWExtra { #endif #elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian uint activated : 1; // RWindowBase::Activated has been called - uint inExpose : 1; // Prevents drawing recursion /** * Defines the behaviour of QSymbianControl::Draw. diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index a844430..ebd289c 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -878,6 +878,7 @@ void QWidgetPrivate::registerDropSite(bool /* on */) void QWidgetPrivate::createTLSysExtra() { extra->topextra->backingStore = 0; + extra->topextra->inExpose = 0; } void QWidgetPrivate::deleteTLSysExtra() @@ -891,7 +892,6 @@ void QWidgetPrivate::createSysExtra() extra->activated = 0; extra->nativePaintMode = QWExtra::Default; extra->receiveNativePaintEvents = 0; - extra->inExpose = 0; } void QWidgetPrivate::deleteSysExtra() diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index b41dc2c..6cbf3d9 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -145,12 +145,15 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget) void QS60WindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &) { - QWExtra *extra = widget->d_func()->extraData(); - if (extra && !extra->inExpose) { - extra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again + QWidget *window = widget->window(); + Q_ASSERT(window); + QTLWExtra *topExtra = window->d_func()->maybeTopData(); + Q_ASSERT(topExtra); + if (!topExtra->inExpose) { + topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again TRect tr = qt_QRect2TRect(region.boundingRect()); widget->winId()->DrawNow(tr); - extra->inExpose = false; + topExtra->inExpose = false; } } -- cgit v0.12 From 500f28f04a08e37525e3d1deb5cfe6e908c66b15 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 9 Feb 2010 14:52:16 +0100 Subject: Refactor comp_func_solid_Clear() and comp_func_solid_Source() Put the common code together with a #define. Remove the check for the length from comp_func_Clear_impl and move it to qt_memfill() --- src/gui/painting/qdrawhelper.cpp | 36 +++++++++++++++------------------- src/gui/painting/qdrawhelper_mmx_p.h | 38 +++++++++++++++--------------------- src/gui/painting/qdrawhelper_p.h | 3 +++ 3 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 660a2a8..7a3da20 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1267,32 +1267,28 @@ static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint); result = 0 d = d * cia */ +#define comp_func_Clear_impl(dest, length, const_alpha)\ +{\ + if (const_alpha == 255) {\ + QT_MEMFILL_UINT(dest, length, 0);\ + } else {\ + int ialpha = 255 - const_alpha;\ + PRELOAD_INIT(dest)\ + for (int i = 0; i < length; ++i) {\ + PRELOAD_COND(dest)\ + dest[i] = BYTE_MUL(dest[i], ialpha);\ + }\ + }\ +} + static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha) { - if (const_alpha == 255) { - QT_MEMFILL_UINT(dest, length, 0); - } else { - int ialpha = 255 - const_alpha; - PRELOAD_INIT(dest) - for (int i = 0; i < length; ++i) { - PRELOAD_COND(dest) - dest[i] = BYTE_MUL(dest[i], ialpha); - } - } + comp_func_Clear_impl(dest, length, const_alpha); } static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) { - if (const_alpha == 255) { - QT_MEMFILL_UINT(dest, length, 0); - } else { - int ialpha = 255 - const_alpha; - PRELOAD_INIT(dest) - for (int i = 0; i < length; ++i) { - PRELOAD_COND(dest) - dest[i] = BYTE_MUL(dest[i], ialpha); - } - } + comp_func_Clear_impl(dest, length, const_alpha); } /* diff --git a/src/gui/painting/qdrawhelper_mmx_p.h b/src/gui/painting/qdrawhelper_mmx_p.h index 8482262..f8bc480 100644 --- a/src/gui/painting/qdrawhelper_mmx_p.h +++ b/src/gui/painting/qdrawhelper_mmx_p.h @@ -146,36 +146,30 @@ struct QMMXCommonIntrinsics result = 0 d = d * cia */ +#define comp_func_Clear_impl(dest, length, const_alpha)\ +{\ + if (const_alpha == 255) {\ + qt_memfill(static_cast(dest), quint32(0), length);\ + } else {\ + C_FF; C_80; C_00;\ + m64 ia = MM::negate(MM::load_alpha(const_alpha));\ + for (int i = 0; i < length; ++i) {\ + dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia));\ + }\ + MM::end();\ + }\ +} + template static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha) { - if (!length) - return; - - if (const_alpha == 255) { - qt_memfill(static_cast(dest), quint32(0), length); - } else { - C_FF; C_80; C_00; - m64 ia = MM::negate(MM::load_alpha(const_alpha)); - for (int i = 0; i < length; ++i) { - dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia)); - } - } - MM::end(); + comp_func_Clear_impl(dest, length, const_alpha); } template static void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha) { - if (const_alpha == 255) { - qt_memfill(static_cast(dest), quint32(0), length); - } else { - C_FF; C_80; C_00; - m64 ia = MM::negate(MM::load_alpha(const_alpha)); - for (int i = 0; i < length; ++i) - dest[i] = MM::store(MM::byte_mul(MM::load(dest[i]), ia)); - } - MM::end(); + comp_func_Clear_impl(dest, length, const_alpha); } /* diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 6c47aac..cb0db4f 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1549,6 +1549,9 @@ template<> inline void qt_memfill(quint8 *dest, quint8 color, int count) template inline void qt_memfill(T *dest, T value, int count) { + if (!count) + return; + int n = (count + 7) / 8; switch (count & 0x07) { -- cgit v0.12 From d9354e6e6863bc1f82b9581726c43f3bd76bc44b Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 9 Feb 2010 16:58:56 +0100 Subject: Skip the transparent pixels when doing the sourceOver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Blending fully transparent pixels take a non-negligible time when webkit use transparent layer. We can avoid that be skipping those pixels since they have no impact on the final result. Reviewed-by: Samuel Rødal --- src/gui/painting/qdrawhelper_mmx_p.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qdrawhelper_mmx_p.h b/src/gui/painting/qdrawhelper_mmx_p.h index f8bc480..59b3804 100644 --- a/src/gui/painting/qdrawhelper_mmx_p.h +++ b/src/gui/painting/qdrawhelper_mmx_p.h @@ -240,7 +240,10 @@ static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int le C_FF; C_80; C_00; if (const_alpha == 255) { for (int i = 0; i < length; ++i) { - if ((0xff000000 & src[i]) == 0xff000000) { + const uint alphaMaskedSource = 0xff000000 & src[i]; + if (alphaMaskedSource == 0) + continue; + if (alphaMaskedSource == 0xff000000) { dest[i] = src[i]; } else { m64 s = MM::load(src[i]); @@ -251,6 +254,8 @@ static void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int le } else { m64 ca = MM::load_alpha(const_alpha); for (int i = 0; i < length; ++i) { + if ((0xff000000 & src[i]) == 0) + continue; m64 s = MM::byte_mul(MM::load(src[i]), ca); m64 ia = MM::negate(MM::alpha(s)); dest[i] = MM::store(MM::add(s, MM::byte_mul(MM::load(dest[i]), ia))); -- cgit v0.12 From cf6a427a94b615dcb7ab1e594b27a593dcc73c62 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 10 Feb 2010 04:38:49 +1000 Subject: Tidy the changes file. Reviewed-by: Trust Me --- dist/changes-4.6.2 | 274 +++++++++++++++++++---------------------------------- 1 file changed, 97 insertions(+), 177 deletions(-) diff --git a/dist/changes-4.6.2 b/dist/changes-4.6.2 index aaaaacc..657aafc 100644 --- a/dist/changes-4.6.2 +++ b/dist/changes-4.6.2 @@ -16,22 +16,6 @@ Qt Bug Tracker: http://bugreports.qt.nokia.com Task Tracker: http://qt.nokia.com/developer/task-tracker Merge Request: http://qt.gitorious.org -**************************************************************************** -* General * -**************************************************************************** - -New features ------------- - - - SomeClass, SomeOtherClass - * New classes for foo, bar and baz - -Optimizations -------------- - - - Optimized foo in QSomeClass - * See list of Important Behavior Changes below - **************************************************************************** * Library * @@ -42,98 +26,88 @@ QtCore - QAtomicPointer * [QTBUG-7356] Fixed a compilation failure when using the Intel - compiler on IA-64 - + compiler on IA-64 - QFile * Fixed double-buffering issue when opening files in buffered mode. - * [QTBUG-7285] QFile::remove would fail if an unrelated operation on the - same instance had been previously failed. This manisfested itself in - QTemporaryFile failing to auto-remove files and QFile::copy leaving + * [QTBUG-7285] QFile::remove would() fail if an unrelated operation on the + same instance had been previously failed. This manifested itself in + QTemporaryFile failing to auto-remove files and QFile::copy() leaving temporary files behind in certain situations. - - QFSFileEngine - * Fix typo that made realpath() not being used - + * Fix typo that made realpath() not be used. - QIODevice - * Optimized readAll() - + * Optimized readAll(). - QReadWriteLock - * [MR 426] Fixed documentation - + * [MR 426] Fixed documentation. - QXmlStreamWriter - * [QTBUG-6893] Fixed adding extra Byte Order Marks when writing to a xml file. + * [QTBUG-6893] Fixed adding extra Byte Order Marks when writing to a + .xml file. QtGui ----- + - QApplication + * [QTBUG-6098] Added a flag to avoid construction of application panes. + * [QTBUG-7029] Fixed a crash when re-creating QApplication object due + to a dangling gesture manager pointer. - QAbstractScrollArea - * [QTBUG-1760] Reverted horizontal scrolling with mouse wheel when vertical scrollbar is hidden - + * [QTBUG-1760] Reverted horizontal scrolling with mouse wheel when vertical + scrollbar is hidden - QBmpHandler - * [QTBUG-7530] Fixed an infinite loop that could occur when reading invalid BMP images. - + * [QTBUG-7530] Fixed an infinite loop that could occur when reading invalid + BMP images. - QGraphicsEffect * [QTBUG-6901] Fixed performance problem when translating items with graphics effects. - - QImage * [QTBUG-7231] Avoid an unnecessary copy in QImage::scaled(). - - - QPDFEngine - * [QTBUG-7249] Fixed the encoding of the Tile and Creator tags in the PDF engine. - - - QApplication - * [QTBUG-6098] Added a flag to avoid construction of application panes. - QInputContext - * [QTBUG-7439] Avoided the loss of preedit text when losing focus on Symbian. - - * [QT-2629] Implemented event filter functions for Symbian. - * [QTBUG-7029] Fixed a crash when re-creating QApplication object due to a - dangling gesture manager pointer. - * [QTBUG-7198] Setting a style sheet could break the checkbox position in item views. - * [QTBUG-7253] Fixed wrong stroke clipping with the raster engine when using a QPen - with a style other than SolidLine. - - - * [MR 2077] Integrated merge request 2077 + * [QTBUG-7439] Avoided the loss of preedit text when losing focus on + Symbian. + - QPDFEngine + * [QTBUG-7249] Fixed the encoding of the Tile and Creator tags in the PDF + engine. + - [QT-2629] Implemented event filter functions for Symbian. + - [QTBUG-7198] Setting a style sheet could break the checkbox position in + item views. + - [QTBUG-7253] Fixed wrong stroke clipping with the raster engine when using + a QPen with a style other than SolidLine. QtDBus ------ - QDBusConnection - * [QT-2307] Fixed sending of D-Bus method calls with QDBus::BlockWithGui + * [QT-2307] Fixed sending of D-Bus method calls with QDBus::BlockWithGui. QtNetwork --------- - QNetworkAccessManager * Optimizations - * HTTP: Get rid of QAbstractSocket warnings that were sometimes displayed - * HTTP: setReadBufferSize() of the QNetworkReply finally is working on all layers - * [QTBUG-7713] HTTP: Fix bug related to re-sending a request + * HTTP: Get rid of QAbstractSocket warnings that were sometimes displayed. + * HTTP: setReadBufferSize() of the QNetworkReply finally is working on all + layers. + * [QTBUG-7713] HTTP: Fix bug related to re-sending a request. * [QTBUG-7060] Fixed an issue with parsing of HTTP headers like - "private, max-age=300" - + "private, max-age=300". - QSslCertificate - * [QTBUG-6466] Fix issuerInfo() and subjectInfo() - + * [QTBUG-6466] Fix issuerInfo() and subjectInfo(). - QTcpSocket - * [QTBUG-7344] Fix performance degredation with write() on Windows - * [QTBUG-7316,QTBUG-7317] Also handle unknown errors from socket engine + * [QTBUG-7344] Fix performance degredation with write() on Windows. + * [QTBUG-7316,QTBUG-7317] Handle unknown errors from socket engine. QtOpenGL -------- - [QTBUG-7490] Better support for user-generated binary shaders. - - - QGLWidget - * [QTBUG-7213] Fixed QGLWidget::renderPixmap() on Windows. - - QGLPixelBuffer - * [QTBUG-7476] Fixed a crash under X11 when drawing QPixmaps to QGLPixelBuffers. - + * [QTBUG-7476] Fixed a crash under X11 when drawing QPixmaps to + QGLPixelBuffers. - QGL2PaintEngineEx * [QTBUG-7203] Reset the GL stencil mask, op and function in resetGLState(). + - QGLWidget + * [QTBUG-7213] Fixed QGLWidget::renderPixmap() on Windows. + QtOpenVG -------- @@ -141,137 +115,89 @@ QtOpenVG - [QTBUG-7791] Optimize single-rect IntersectClip in OpenVG using the scissor. - [QTBUG-7864] Use OpenVG scissor on 90/180/270 rotations and simple clips. -QtScript --------- - - - foo - * bar - -QtSql ------ - - - foo - * bar - -QtXml ------ - - - foo - * bar - QtMultimedia ------------ - QAudioInput - * [QTBUG-7044]: QAudioInput stopped working correctly after suspend()/resume() on linux. - -Qt Plugins ----------- - - - foo - * bar + * [QTBUG-7044]: QAudioInput stopped working correctly after + suspend()/resume() on linux. Examples -------- - QtMultimedia - * [MR 418] Fixed the example for QAudioOutput - + * [MR 418] Fixed the example for QAudioOutput. - WebKit - * [MR 2235] Added the framecapture example to the default build - -Third party components ----------------------- - - - Updated foo to version 2.3.9. - - - Updated bar to the latest version from baz.org. + * [MR 2235] Added the framecapture example to the default build. **************************************************************************** * Platform Specific Changes * **************************************************************************** -Qt for Unix (X11 and Mac OS X) ------------------------------- - - - - Qt for Linux/X11 ---------------- - * Fix a bug where QPixmap::serialNumber was not set on a transformed pixmap - in Qt/X11. - - * Fixed a crash when an input method tries to create a widget after the - application is destroyed. - - - [QTBUG-6952] Fixed a problem using NoButtons in spinbox with QGtkStyle - - [QTBUG-7504] Fixed missing focus rect on check- and radiobutton with - some GTK+ themes. - - [QTBUG-6522] Fixed missing menu separator in some GTK+ themes. - -Qt for Windows --------------- + - Fix a bug where QPixmap::serialNumber was not set on a transformed pixmap + in Qt/X11. + - Fixed a crash when an input method tries to create a widget after the + application is destroyed. + - [QTBUG-6952] Fixed a problem using NoButtons in spinbox with QGtkStyle. + - [QTBUG-7504] Fixed missing focus rect on check- and radiobutton with + some GTK+ themes. + - [QTBUG-6522] Fixed missing menu separator in some GTK+ themes. Qt for Mac OS X --------------- - [QTBUG-7832]: Restored missing margins around non-unified toolbars. - - [QTBUG-7312]: Menubar and dock disappear after hiding a fullscreen widget on Cocoa. - - [QTBUG-7481]: Re-added the Close button in QPrintPreviewDialog for Mac/Carbon. - - [QTBUG-7522]: Drawing fake buttons using QMacStyle+QStyleOptionViewItemV4 lead to crash. - - [QTBUG-7625]: Calling showFullScreen() then showNormal() on a widget results in top menu hiding. - - [QTBUG-7086]: QFileDialog now correctly responds to fileMode & acceptMode changes. - - [QTBUG-7162]: Fixed a crash in Designer when previewing a QMainWindow with native toolbar. - - [QTBUG-7305]: Fixed a crash when deleting QMainWindow with native toolbar on Cocoa. - - [QTBUG-6882]: Fixed a text layout issue with QHeaderView in right-to-left mode. - - -Qt for Embedded Linux ---------------------- - - - + - [QTBUG-7312]: Menubar and dock disappear after hiding a fullscreen widget + on Cocoa. + - [QTBUG-7481]: Re-added the Close button in QPrintPreviewDialog for + Mac/Carbon. + - [QTBUG-7522]: Drawing fake buttons using QMacStyle+QStyleOptionViewItemV4 + lead to crash. + - [QTBUG-7625]: Calling showFullScreen() then showNormal() on a widget results + in top menu hiding. + - [QTBUG-7086]: QFileDialog now correctly responds to fileMode & acceptMode + changes. + - [QTBUG-7162]: Fixed a crash in Designer when previewing a QMainWindow with + native toolbar. + - [QTBUG-7305]: Fixed a crash when deleting QMainWindow with native toolbar + on Cocoa. + - [QTBUG-6882]: Fixed a text layout issue with QHeaderView in right-to-left + mode. DirectFB -------- - * Fix a bug where QPixmap::serialNumber was not set on a transformed pixmap - in DirectFB. - * Reimplement QPixmapData::scroll for QDirectFBPixmapData which optimizes - QPixmap::scroll - * Fix a rendering issue for semi-transparent top level windows in DirectFB. - * Make it possible to fall back to the raster engine for stretch blits in - DirectFB using QT_NO_DIRECTFB_STRETCHBLIT - - - -Qt for Windows CE ------------------ - - + - Fix a bug where QPixmap::serialNumber was not set on a transformed pixmap + in DirectFB. + - Reimplement QPixmapData::scroll for QDirectFBPixmapData which optimizes + QPixmap::scroll. + - Fix a rendering issue for semi-transparent top level windows in DirectFB. + - Make it possible to fall back to the raster engine for stretch blits in + DirectFB using QT_NO_DIRECTFB_STRETCHBLIT. Qt for Symbian -------------- - * [QTBUG-6556] Improve the DEF file handling scheme, to allow simple enable/ - disable of DEF file usage (for use _during development only_ to decouple - the need to update the DEF files at the precise point that symbols are - removed, therefore allowing builds by CI systems to succeed even if symbols - have been removed. This does not remove the need to update the DEF files - before release. NOTE: Builds generated using this flag are not binary - compatible with previous versions of Qt.) - -- QProcess - * [QTBUG-7667] Fixed no-timeout case for QProcess::waitForFinished. - -- qmake - * [QTBUG-7695] Added support for ifdeffing for manufacturer in generated - pkg files. - * [QTBUG-7908] Smart installer package generation support - -- Patch_capabilities script + - [QTBUG-6556] Improve the DEF file handling scheme, to allow simple enable/ + disable of DEF file usage (for use _during development only_ to decouple + the need to update the DEF files at the precise point that symbols are + removed, therefore allowing builds by CI systems to succeed even if symbols + have been removed. This does not remove the need to update the DEF files + before release. NOTE: Builds generated using this flag are not binary + compatible with previous versions of Qt.) + - QProcess + * [QTBUG-7667] Fixed no-timeout case for QProcess::waitForFinished. + - qmake + * [QTBUG-7695] Added support for ifdeffing for manufacturer in generated + pkg files. + * [QTBUG-7908] Smart installer package generation support. + - Patch_capabilities script * Added support for embedded sis name/uid patching. - -- Qt deployment - * [QTBUG-7518] Backup and restore support for Qt libs + - Qt deployment + * [QTBUG-7518] Backup and restore support for Qt libs. **************************************************************************** @@ -279,28 +205,22 @@ Qt for Symbian **************************************************************************** - Designer - * [QTBUG-6965] Enabled editing seconds of QDateTime-type properties + * [QTBUG-6965] Enabled editing seconds of QDateTime-type properties. * [QTBUG-6757] Fixed bug where selection handles would be affected by a style sheet set on the main form. - uic3 * [QTBUG-7404] Added option to preserve layout names set by Qt 3 Designer. - - qdoc3 - * bar - - - Linguist - * baz - **************************************************************************** * Important Behavior Changes * **************************************************************************** - QNetworkAccessManager cache - * QNetworkAccessManager will no longer return expired pages, as - stated in the documentation - * The behaviour of PreferCache and PreferNetwork modes now match - the documentation more closely + * QNetworkAccessManager will no longer return expired pages, as + stated in the documentation + * The behaviour of PreferCache and PreferNetwork modes now match + the documentation more closely - QUrl * QUrl will now accept hostnames ending in dot and will not treat -- cgit v0.12 From 3208a33a18d7eb666f0f47eff02ce4b21e248c10 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 9 Feb 2010 11:45:01 +0100 Subject: Catch up TRK library to creator f2b3e9f2dfbc580389b9b683a3e46e5a8422f55b This is the last SHA before trk directory is renamed. Note the \\.\ is prepended to windows com ports inside the library now, so main.cpp no longer has this windows specific code. commit f2b3e9f2dfbc580389b9b683a3e46e5a8422f55b Author: Friedemann Kleint Date: Fri Feb 5 12:24:46 2010 +0100 S60/Trk: Change trkutils to be a library of its own. To be able to share TrkDevices between Debugger and Qt4ProjectManager. commit 61c3a260b59433abf8c3ef481ec536af88f8026c Author: Sarika Kamisetty Date: Thu Feb 4 09:57:54 2010 +0100 Fix to App TRK connection with 'high COM port' does not work Merge-request: 111 Reviewed-by: hjk commit 2fd8b2d7ffa2ac032bfe3a17efe7d152c4cef14d Author: Friedemann Kleint Date: Mon Feb 1 12:43:56 2010 +0100 Fix some code scanning issues. QString: Use QChar where appropriate. commit 805b0a9cc165ef6cd596bd8f5e59f650cd0eebb2 Author: hjk Date: Mon Feb 1 11:45:44 2010 +0100 debugger: trk log output cosmetic commit 75b42f18d886b59dbf3380dd12f39f40005ef08b Merge: 4320314 a6ca348 Author: Oswald Buddenhagen Date: Fri Jan 29 22:49:55 2010 +0100 Merge remote branch 'origin/1.3' Trailing whitespace removal re-applied manually. commit a6ca348636dd92ab1445cff2286b3293163f5cea Author: Oswald Buddenhagen Date: Fri Jan 29 21:33:57 2010 +0100 remove trailing whitespace doing it in 1.3 as well to avoid possible later conflicts commit 4ec51219ed5c2150e164473b9c5326b6c68d096a Author: Friedemann Kleint Date: Thu Jan 28 17:04:05 2010 +0100 Trk: Fix source code scanning tool issues. showing up in Qt. --- tools/runonphone/main.cpp | 4 - tools/runonphone/trk/bluetoothlistener.cpp | 2 +- tools/runonphone/trk/bluetoothlistener.h | 4 +- tools/runonphone/trk/bluetoothlistener_gui.cpp | 6 +- tools/runonphone/trk/bluetoothlistener_gui.h | 8 +- tools/runonphone/trk/callback.h | 2 +- tools/runonphone/trk/communicationstarter.h | 8 +- tools/runonphone/trk/launcher.cpp | 25 +++--- tools/runonphone/trk/launcher.h | 2 +- tools/runonphone/trk/symbianutils_global.h | 55 +++++++++++++ tools/runonphone/trk/trk.pri | 4 +- tools/runonphone/trk/trkdevice.cpp | 18 +++-- tools/runonphone/trk/trkdevice.h | 3 +- tools/runonphone/trk/trkutils.cpp | 105 ++++++++++++------------- tools/runonphone/trk/trkutils.h | 45 +++++------ tools/runonphone/trk/trkutils_p.h | 62 +++++++++++++++ 16 files changed, 233 insertions(+), 120 deletions(-) create mode 100644 tools/runonphone/trk/symbianutils_global.h create mode 100644 tools/runonphone/trk/trkutils_p.h diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index a77e713..1a5cdee 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -174,11 +174,7 @@ int main(int argc, char *argv[]) } if(loglevel > 0) outstream << "Connecting to target via " << serialPortName << endl; -#ifdef Q_OS_WIN - launcher->setTrkServerName(QString("\\\\.\\") + serialPortName); -#else launcher->setTrkServerName(serialPortName); -#endif launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile); launcher->setCommandLineArgs(cmdLine); diff --git a/tools/runonphone/trk/bluetoothlistener.cpp b/tools/runonphone/trk/bluetoothlistener.cpp index 8d45fb5..df04288 100644 --- a/tools/runonphone/trk/bluetoothlistener.cpp +++ b/tools/runonphone/trk/bluetoothlistener.cpp @@ -184,7 +184,7 @@ bool BluetoothListener::start(const QString &device, QString *errorMessage) return true; } -void BluetoothListener::slotStdOutput() +void BluetoothListener::slotStdOutput() { emitMessage(QString::fromLocal8Bit(d->process.readAllStandardOutput())); } diff --git a/tools/runonphone/trk/bluetoothlistener.h b/tools/runonphone/trk/bluetoothlistener.h index 027f286..36894e7 100644 --- a/tools/runonphone/trk/bluetoothlistener.h +++ b/tools/runonphone/trk/bluetoothlistener.h @@ -42,6 +42,8 @@ #ifndef BLUETOOTHLISTENER_H #define BLUETOOTHLISTENER_H +#include "symbianutils_global.h" + #include #include @@ -53,7 +55,7 @@ struct BluetoothListenerPrivate; * The rfcomm command is used. It process can be started in the background * while connection attempts (TrkDevice::open()) are made in the foreground. */ -class BluetoothListener : public QObject +class SYMBIANUTILS_EXPORT BluetoothListener : public QObject { Q_OBJECT Q_DISABLE_COPY(BluetoothListener) diff --git a/tools/runonphone/trk/bluetoothlistener_gui.cpp b/tools/runonphone/trk/bluetoothlistener_gui.cpp index 6ffdaef..5994eb5 100644 --- a/tools/runonphone/trk/bluetoothlistener_gui.cpp +++ b/tools/runonphone/trk/bluetoothlistener_gui.cpp @@ -50,7 +50,7 @@ namespace trk { -PromptStartCommunicationResult +SYMBIANUTILS_EXPORT PromptStartCommunicationResult promptStartCommunication(BaseCommunicationStarter &starter, const QString &msgBoxTitle, const QString &msgBoxText, @@ -88,7 +88,7 @@ PromptStartCommunicationResult return PromptStartCommunicationConnected; } -PromptStartCommunicationResult +SYMBIANUTILS_EXPORT PromptStartCommunicationResult promptStartSerial(BaseCommunicationStarter &starter, QWidget *msgBoxParent, QString *errorMessage) @@ -98,7 +98,7 @@ PromptStartCommunicationResult return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage); } -PromptStartCommunicationResult +SYMBIANUTILS_EXPORT PromptStartCommunicationResult promptStartBluetooth(BaseCommunicationStarter &starter, QWidget *msgBoxParent, QString *errorMessage) diff --git a/tools/runonphone/trk/bluetoothlistener_gui.h b/tools/runonphone/trk/bluetoothlistener_gui.h index d673ffe..10e7145 100644 --- a/tools/runonphone/trk/bluetoothlistener_gui.h +++ b/tools/runonphone/trk/bluetoothlistener_gui.h @@ -42,6 +42,8 @@ #ifndef BLUETOOTHLISTENER_GUI_H #define BLUETOOTHLISTENER_GUI_H +#include "symbianutils_global.h" + #include QT_BEGIN_NAMESPACE @@ -62,7 +64,7 @@ enum PromptStartCommunicationResult { PromptStartCommunicationError }; -PromptStartCommunicationResult +SYMBIANUTILS_EXPORT PromptStartCommunicationResult promptStartCommunication(BaseCommunicationStarter &starter, const QString &msgBoxTitle, const QString &msgBoxText, @@ -71,14 +73,14 @@ PromptStartCommunicationResult // Convenience to start a serial connection (messages prompting // to launch Trk). -PromptStartCommunicationResult +SYMBIANUTILS_EXPORT PromptStartCommunicationResult promptStartSerial(BaseCommunicationStarter &starter, QWidget *msgBoxParent, QString *errorMessage); // Convenience to start blue tooth connection (messages // prompting to connect). -PromptStartCommunicationResult +SYMBIANUTILS_EXPORT PromptStartCommunicationResult promptStartBluetooth(BaseCommunicationStarter &starter, QWidget *msgBoxParent, QString *errorMessage); diff --git a/tools/runonphone/trk/callback.h b/tools/runonphone/trk/callback.h index edc2c74..3996d73 100644 --- a/tools/runonphone/trk/callback.h +++ b/tools/runonphone/trk/callback.h @@ -42,7 +42,7 @@ #ifndef DEBUGGER_CALLBACK_H #define DEBUGGER_CALLBACK_H -#include +#include "symbianutils_global.h" namespace trk { namespace Internal { diff --git a/tools/runonphone/trk/communicationstarter.h b/tools/runonphone/trk/communicationstarter.h index 34cf398..2d7dc50 100644 --- a/tools/runonphone/trk/communicationstarter.h +++ b/tools/runonphone/trk/communicationstarter.h @@ -42,6 +42,8 @@ #ifndef COMMUNICATIONSTARTER_H #define COMMUNICATIONSTARTER_H +#include "symbianutils_global.h" + #include #include @@ -60,7 +62,7 @@ struct BaseCommunicationStarterPrivate; * The base class can be used as is to prompt the user to launch App TRK for a * serial communication as this requires no further resource setup. */ -class BaseCommunicationStarter : public QObject { +class SYMBIANUTILS_EXPORT BaseCommunicationStarter : public QObject { Q_OBJECT Q_DISABLE_COPY(BaseCommunicationStarter) public: @@ -117,7 +119,7 @@ private: * implement as a factory function that creates and sets up the * listener (mode, message connection, etc). */ -class AbstractBluetoothStarter : public BaseCommunicationStarter { +class SYMBIANUTILS_EXPORT AbstractBluetoothStarter : public BaseCommunicationStarter { Q_OBJECT Q_DISABLE_COPY(AbstractBluetoothStarter) public: @@ -134,7 +136,7 @@ protected: /* ConsoleBluetoothStarter: Convenience class for console processes. Creates a * listener in "Listen" mode with the messages redirected to standard output. */ -class ConsoleBluetoothStarter : public AbstractBluetoothStarter { +class SYMBIANUTILS_EXPORT ConsoleBluetoothStarter : public AbstractBluetoothStarter { Q_OBJECT Q_DISABLE_COPY(ConsoleBluetoothStarter) public: diff --git a/tools/runonphone/trk/launcher.cpp b/tools/runonphone/trk/launcher.cpp index 1796fc5..4f91545 100644 --- a/tools/runonphone/trk/launcher.cpp +++ b/tools/runonphone/trk/launcher.cpp @@ -41,6 +41,7 @@ #include "launcher.h" #include "trkutils.h" +#include "trkutils_p.h" #include "trkdevice.h" #include "bluetoothlistener.h" @@ -595,17 +596,19 @@ void Launcher::handleSupportMask(const TrkResult &result) return; const char *data = result.data.data() + 1; - QByteArray str; + QString str = QLatin1String("SUPPORTED: "); for (int i = 0; i < 32; ++i) { //str.append(" [" + formatByte(data[i]) + "]: "); - for (int j = 0; j < 8; ++j) - if (data[i] & (1 << j)) - str.append(QByteArray::number(i * 8 + j, 16) + " "); + for (int j = 0; j < 8; ++j) { + if (data[i] & (1 << j)) { + str.append(QString::number(i * 8 + j, 16)); + str.append(QLatin1Char(' ')); + } + } } - logMessage("SUPPORTED: " + str); + logMessage(str); } - void Launcher::cleanUp() { // @@ -614,9 +617,7 @@ void Launcher::cleanUp() // Sub Cmd: Delete Process //ProcessID: 0x0000071F (1823) // [41 24 00 00 00 00 07 1F] - QByteArray ba; - appendByte(&ba, 0x00); - appendByte(&ba, 0x00); + QByteArray ba(2, char(0)); appendInt(&ba, d->m_session.pid); d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(), ba, "Delete process"); @@ -669,7 +670,7 @@ void Launcher::copyFileToRemote() { emit copyingStarted(); QByteArray ba; - appendByte(&ba, 0x10); + ba.append(char(10)); appendString(&ba, d->m_copyState.destinationFileName.toLocal8Bit(), TargetByteOrder, false); d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba); } @@ -678,7 +679,7 @@ void Launcher::installRemotePackageSilently() { emit installingStarted(); QByteArray ba; - appendByte(&ba, 'C'); + ba.append('C'); appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false); d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba); } @@ -705,7 +706,7 @@ QByteArray Launcher::startProcessMessage(const QString &executable, // It's not started yet QByteArray ba; appendShort(&ba, 0, TargetByteOrder); // create new process - appendByte(&ba, 0); // options - currently unused + ba.append(char(0)); // options - currently unused if(arguments.isEmpty()) { appendString(&ba, executable.toLocal8Bit(), TargetByteOrder); return ba; diff --git a/tools/runonphone/trk/launcher.h b/tools/runonphone/trk/launcher.h index 8dc6ebe..2b23fd8 100644 --- a/tools/runonphone/trk/launcher.h +++ b/tools/runonphone/trk/launcher.h @@ -56,7 +56,7 @@ struct LauncherPrivate; typedef QSharedPointer TrkDevicePtr; -class Launcher : public QObject +class SYMBIANUTILS_EXPORT Launcher : public QObject { Q_OBJECT Q_DISABLE_COPY(Launcher) diff --git a/tools/runonphone/trk/symbianutils_global.h b/tools/runonphone/trk/symbianutils_global.h new file mode 100644 index 0000000..a6ffbe7 --- /dev/null +++ b/tools/runonphone/trk/symbianutils_global.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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 tools applications 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 SYMBIANUTILS_GLOBAL_H +#define SYMBIANUTILS_GLOBAL_H + +#include + +#if defined(SYMBIANUTILS_BUILD_LIB) +# define SYMBIANUTILS_EXPORT Q_DECL_EXPORT +#elif defined(SYMBIANUTILS_BUILD_STATIC_LIB) || defined(SYMBIANUTILS_INCLUDE_PRI) +# define SYMBIANUTILS_EXPORT +#else +# define SYMBIANUTILS_EXPORT Q_DECL_IMPORT +#endif + +#endif // SYMBIANUTILS_GLOBAL_H diff --git a/tools/runonphone/trk/trk.pri b/tools/runonphone/trk/trk.pri index 2ce17c0..a54df76 100644 --- a/tools/runonphone/trk/trk.pri +++ b/tools/runonphone/trk/trk.pri @@ -1,8 +1,10 @@ INCLUDEPATH *= $$PWD # Input -HEADERS += $$PWD/callback.h \ +HEADERS += $$PWD/symbianutils_global.h \ + $$PWD/callback.h \ $$PWD/trkutils.h \ + $$PWD/trkutils_p.h \ $$PWD/trkdevice.h \ $$PWD/launcher.h \ $$PWD/bluetoothlistener.h \ diff --git a/tools/runonphone/trk/trkdevice.cpp b/tools/runonphone/trk/trkdevice.cpp index fe3261b..d587135 100644 --- a/tools/runonphone/trk/trkdevice.cpp +++ b/tools/runonphone/trk/trkdevice.cpp @@ -41,6 +41,7 @@ #include "trkdevice.h" #include "trkutils.h" +#include "trkutils_p.h" #include #include @@ -516,7 +517,7 @@ static inline bool overlappedSyncWrite(HANDLE file, bool WriterThread::write(const QByteArray &data, QString *errorMessage) { if (verboseTrk) - qDebug() << "Write raw data: " << data.toHex(); + qDebug() << "Write raw data: " << stringFromArray(data).toLatin1(); QMutexLocker locker(&m_context->mutex); #ifdef Q_OS_WIN DWORD charsWritten; @@ -856,8 +857,8 @@ void UnixReaderThread::terminate() { // Trigger select() by writing to the pipe char c = 0; - int written = write(m_terminatePipeFileDescriptors[1], &c, 1); - // FIXME: Use result. + const int written = write(m_terminatePipeFileDescriptors[1], &c, 1); + Q_UNUSED(written) wait(); } @@ -919,7 +920,7 @@ bool TrkDevice::open(const QString &port, QString *errorMessage) qDebug() << "Opening" << port << "is open: " << isOpen() << " serialFrame=" << serialFrame(); close(); #ifdef Q_OS_WIN - d->deviceContext->device = CreateFile(port.toStdWString().c_str(), + d->deviceContext->device = CreateFile(QString("\\\\.\\").append(port).toStdWString().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, @@ -1061,8 +1062,13 @@ void TrkDevice::sendTrkMessage(byte code, TrkCallback callback, const QByteArray &data, const QVariant &cookie) { if (!d->writerThread.isNull()) { - if (d->verbose > 1) - qDebug() << "Sending " << code << data.toHex(); + if (d->verbose > 1) { + QByteArray msg = "Sending: "; + msg += QByteArray::number(code, 16); + msg += ": "; + msg += stringFromArray(data).toLatin1(); + qDebug("%s", msg.data()); + } d->writerThread->queueTrkMessage(code, callback, data, cookie); } } diff --git a/tools/runonphone/trk/trkdevice.h b/tools/runonphone/trk/trkdevice.h index e04f791..21a3cc1 100644 --- a/tools/runonphone/trk/trkdevice.h +++ b/tools/runonphone/trk/trkdevice.h @@ -42,6 +42,7 @@ #ifndef TRKDEVICE_H #define TRKDEVICE_H +#include "symbianutils_global.h" #include "callback.h" #include @@ -74,7 +75,7 @@ enum { TRK_WRITE_QUEUE_NOOP_CODE = 0x7f }; typedef trk::Callback TrkCallback; -class TrkDevice : public QObject +class SYMBIANUTILS_EXPORT TrkDevice : public QObject { Q_OBJECT Q_PROPERTY(bool serialFrame READ serialFrame WRITE setSerialFrame) diff --git a/tools/runonphone/trk/trkutils.cpp b/tools/runonphone/trk/trkutils.cpp index 3a96053..5cce950 100644 --- a/tools/runonphone/trk/trkutils.cpp +++ b/tools/runonphone/trk/trkutils.cpp @@ -86,7 +86,7 @@ void Session::reset() trkAppVersion.reset(); } -QString formatCpu(int major, int minor) +static QString formatCpu(int major, int minor) { //: CPU description of an S60 device //: %1 major verison, %2 minor version @@ -144,13 +144,44 @@ QString Session::deviceDescription(unsigned verbose) const } +QByteArray decode7d(const QByteArray &ba) +{ + QByteArray res; + res.reserve(ba.size()); + for (int i = 0; i < ba.size(); ++i) { + byte c = byte(ba.at(i)); + if (c == 0x7d) { + ++i; + c = 0x20 ^ byte(ba.at(i)); + } + res.append(c); + } + return res; +} + +QByteArray encode7d(const QByteArray &ba) +{ + QByteArray res; + res.reserve(ba.size() + 2); + for (int i = 0; i < ba.size(); ++i) { + byte c = byte(ba.at(i)); + if (c == 0x7e || c == 0x7d) { + res.append(0x7d); + res.append(0x20 ^ c); + } else { + res.append(c); + } + } + return res; +} + // FIXME: Use the QByteArray based version below? -QString stringFromByte(byte c) +static inline QString stringFromByte(byte c) { - return QString("%1 ").arg(c, 2, 16, QChar('0')); + return QString::fromLatin1("%1").arg(c, 2, 16, QChar('0')); } -QString stringFromArray(const QByteArray &ba, int maxLen) +SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen) { QString str; QString ascii; @@ -170,7 +201,7 @@ QString stringFromArray(const QByteArray &ba, int maxLen) return str + " " + ascii; } -QByteArray hexNumber(uint n, int digits) +SYMBIANUTILS_EXPORT QByteArray hexNumber(uint n, int digits) { QByteArray ba = QByteArray::number(n, 16); if (digits == 0 || ba.size() == digits) @@ -178,7 +209,7 @@ QByteArray hexNumber(uint n, int digits) return QByteArray(digits - ba.size(), '0') + ba; } -QByteArray hexxNumber(uint n, int digits) +SYMBIANUTILS_EXPORT QByteArray hexxNumber(uint n, int digits) { return "0x" + hexNumber(n, digits); } @@ -200,9 +231,13 @@ void TrkResult::clear() QString TrkResult::toString() const { - QString res = stringFromByte(code) + "[" + stringFromByte(token); - res.chop(1); - return res + "] " + stringFromArray(data); + QString res = stringFromByte(code); + res += QLatin1String(" ["); + res += stringFromByte(token); + res += QLatin1Char(']'); + res += QLatin1Char(' '); + res += stringFromArray(data); + return res; } QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame) @@ -303,12 +338,12 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt return true; } -ushort extractShort(const char *data) +SYMBIANUTILS_EXPORT ushort extractShort(const char *data) { return byte(data[0]) * 256 + byte(data[1]); } -uint extractInt(const char *data) +SYMBIANUTILS_EXPORT uint extractInt(const char *data) { uint res = byte(data[0]); res *= 256; res += byte(data[1]); @@ -317,7 +352,7 @@ uint extractInt(const char *data) return res; } -QString quoteUnprintableLatin1(const QByteArray &ba) +SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba) { QString res; char buf[10]; @@ -333,49 +368,7 @@ QString quoteUnprintableLatin1(const QByteArray &ba) return res; } -QByteArray decode7d(const QByteArray &ba) -{ - QByteArray res; - res.reserve(ba.size()); - for (int i = 0; i < ba.size(); ++i) { - byte c = byte(ba.at(i)); - if (c == 0x7d) { - ++i; - c = 0x20 ^ byte(ba.at(i)); - } - res.append(c); - } - //if (res != ba) - // logMessage("DECODED: " << stringFromArray(ba) - // << " -> " << stringFromArray(res)); - return res; -} - -QByteArray encode7d(const QByteArray &ba) -{ - QByteArray res; - res.reserve(ba.size() + 2); - for (int i = 0; i < ba.size(); ++i) { - byte c = byte(ba.at(i)); - if (c == 0x7e || c == 0x7d) { - res.append(0x7d); - res.append(0x20 ^ c); - } else { - res.append(c); - } - } - //if (res != ba) - // logMessage("ENCODED: " << stringFromArray(ba) - // << " -> " << stringFromArray(res)); - return res; -} - -void appendByte(QByteArray *ba, byte b) -{ - ba->append(b); -} - -void appendShort(QByteArray *ba, ushort s, Endianness endian) +SYMBIANUTILS_EXPORT void appendShort(QByteArray *ba, ushort s, Endianness endian) { if (endian == BigEndian) { ba->append(s / 256); @@ -386,7 +379,7 @@ void appendShort(QByteArray *ba, ushort s, Endianness endian) } } -void appendInt(QByteArray *ba, uint i, Endianness endian) +SYMBIANUTILS_EXPORT void appendInt(QByteArray *ba, uint i, Endianness endian) { const uchar b3 = i % 256; i /= 256; const uchar b2 = i % 256; i /= 256; diff --git a/tools/runonphone/trk/trkutils.h b/tools/runonphone/trk/trkutils.h index 328dd2b..3a485c7 100644 --- a/tools/runonphone/trk/trkutils.h +++ b/tools/runonphone/trk/trkutils.h @@ -42,19 +42,20 @@ #ifndef DEBUGGER_TRK_UTILS #define DEBUGGER_TRK_UTILS +#include "symbianutils_global.h" #include #include #include #include -typedef unsigned char byte; - QT_BEGIN_NAMESPACE class QDateTime; QT_END_NAMESPACE namespace trk { +typedef unsigned char byte; + enum Command { TrkPing = 0x00, TrkConnect = 0x01, @@ -85,17 +86,14 @@ enum Command { TrkNotifyProcessorReset = 0xa7 }; -QByteArray decode7d(const QByteArray &ba); -QByteArray encode7d(const QByteArray &ba); - inline byte extractByte(const char *data) { return *data; } -ushort extractShort(const char *data); -uint extractInt(const char *data); +SYMBIANUTILS_EXPORT ushort extractShort(const char *data); +SYMBIANUTILS_EXPORT uint extractInt(const char *data); -QString quoteUnprintableLatin1(const QByteArray &ba); +SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba); // produces "xx xx xx " -QString stringFromArray(const QByteArray &ba, int maxLen = - 1); +SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen = - 1); enum Endianness { @@ -104,13 +102,11 @@ enum Endianness TargetByteOrder = BigEndian, }; -void appendByte(QByteArray *ba, byte b); -void appendShort(QByteArray *ba, ushort s, Endianness = TargetByteOrder); -void appendInt(QByteArray *ba, uint i, Endianness = TargetByteOrder); -void appendString(QByteArray *ba, const QByteArray &str, Endianness = TargetByteOrder, bool appendNullTerminator = true); -void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness = TargetByteOrder); +SYMBIANUTILS_EXPORT void appendShort(QByteArray *ba, ushort s, Endianness = TargetByteOrder); +SYMBIANUTILS_EXPORT void appendInt(QByteArray *ba, uint i, Endianness = TargetByteOrder); +SYMBIANUTILS_EXPORT void appendString(QByteArray *ba, const QByteArray &str, Endianness = TargetByteOrder, bool appendNullTerminator = true); -struct Library +struct SYMBIANUTILS_EXPORT Library { Library() {} @@ -119,7 +115,7 @@ struct Library uint dataseg; }; -struct TrkAppVersion +struct SYMBIANUTILS_EXPORT TrkAppVersion { TrkAppVersion(); void reset(); @@ -130,7 +126,7 @@ struct TrkAppVersion int protocolMinor; }; -struct Session +struct SYMBIANUTILS_EXPORT Session { Session(); void reset(); @@ -163,7 +159,7 @@ struct Session QStringList modules; }; -struct TrkResult +struct SYMBIANUTILS_EXPORT TrkResult { TrkResult(); void clear(); @@ -179,15 +175,10 @@ struct TrkResult bool isDebugOutput; }; -// returns a QByteArray containing optionally -// the serial frame [0x01 0x90 ] and 0x7e encoded7d(ba) 0x7e -QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame); -ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame); -bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0); -QByteArray errorMessage(byte code); -QByteArray hexNumber(uint n, int digits = 0); -QByteArray hexxNumber(uint n, int digits = 0); // prepends '0x', too -uint swapEndian(uint in); +SYMBIANUTILS_EXPORT QByteArray errorMessage(byte code); +SYMBIANUTILS_EXPORT QByteArray hexNumber(uint n, int digits = 0); +SYMBIANUTILS_EXPORT QByteArray hexxNumber(uint n, int digits = 0); // prepends '0x', too +SYMBIANUTILS_EXPORT uint swapEndian(uint in); } // namespace trk diff --git a/tools/runonphone/trk/trkutils_p.h b/tools/runonphone/trk/trkutils_p.h new file mode 100644 index 0000000..12b0109 --- /dev/null +++ b/tools/runonphone/trk/trkutils_p.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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 tools applications 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 DEBUGGER_TRK_PRIVATE_UTILS +#define DEBUGGER_TRK_PRIVATE_UTILS + +#include "trkutils.h" +#include "symbianutils_global.h" + +QT_BEGIN_NAMESPACE +class QDateTime; +QT_END_NAMESPACE + +namespace trk { + +void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness = TargetByteOrder); +// returns a QByteArray containing optionally +// the serial frame [0x01 0x90 ] and 0x7e encoded7d(ba) 0x7e +QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame); +bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0); + +} // namespace trk + +#endif // DEBUGGER_TRK_PRIVATE_UTILS -- cgit v0.12 From 9965d0e0484882d905c1f8a3bdf19f6eecd30226 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 9 Feb 2010 11:50:08 +0100 Subject: rename trk -> symbianutils commit 9c2676167a3aaeb99024a22343c3d998f191a75f Author: Friedemann Kleint Date: Fri Feb 5 12:32:32 2010 +0100 src/shared: Rename trk to symbianutils --- tools/runonphone/runonphone.pro | 4 +- .../runonphone/symbianutils/bluetoothlistener.cpp | 224 ++++ tools/runonphone/symbianutils/bluetoothlistener.h | 103 ++ .../symbianutils/bluetoothlistener_gui.cpp | 111 ++ .../symbianutils/bluetoothlistener_gui.h | 89 ++ tools/runonphone/symbianutils/callback.h | 160 +++ .../symbianutils/communicationstarter.cpp | 260 +++++ .../runonphone/symbianutils/communicationstarter.h | 162 +++ tools/runonphone/symbianutils/launcher.cpp | 741 +++++++++++++ tools/runonphone/symbianutils/launcher.h | 179 ++++ tools/runonphone/symbianutils/symbianutils.pri | 25 + .../runonphone/symbianutils/symbianutils_global.h | 55 + tools/runonphone/symbianutils/trkdevice.cpp | 1105 ++++++++++++++++++++ tools/runonphone/symbianutils/trkdevice.h | 134 +++ tools/runonphone/symbianutils/trkutils.cpp | 479 +++++++++ tools/runonphone/symbianutils/trkutils.h | 185 ++++ tools/runonphone/symbianutils/trkutils_p.h | 62 ++ tools/runonphone/trk/bluetoothlistener.cpp | 224 ---- tools/runonphone/trk/bluetoothlistener.h | 103 -- tools/runonphone/trk/bluetoothlistener_gui.cpp | 111 -- tools/runonphone/trk/bluetoothlistener_gui.h | 89 -- tools/runonphone/trk/callback.h | 160 --- tools/runonphone/trk/communicationstarter.cpp | 260 ----- tools/runonphone/trk/communicationstarter.h | 162 --- tools/runonphone/trk/launcher.cpp | 741 ------------- tools/runonphone/trk/launcher.h | 179 ---- tools/runonphone/trk/symbianutils_global.h | 55 - tools/runonphone/trk/trk.pri | 25 - tools/runonphone/trk/trkdevice.cpp | 1105 -------------------- tools/runonphone/trk/trkdevice.h | 134 --- tools/runonphone/trk/trkutils.cpp | 479 --------- tools/runonphone/trk/trkutils.h | 185 ---- tools/runonphone/trk/trkutils_p.h | 62 -- 33 files changed, 4077 insertions(+), 4075 deletions(-) create mode 100644 tools/runonphone/symbianutils/bluetoothlistener.cpp create mode 100644 tools/runonphone/symbianutils/bluetoothlistener.h create mode 100644 tools/runonphone/symbianutils/bluetoothlistener_gui.cpp create mode 100644 tools/runonphone/symbianutils/bluetoothlistener_gui.h create mode 100644 tools/runonphone/symbianutils/callback.h create mode 100644 tools/runonphone/symbianutils/communicationstarter.cpp create mode 100644 tools/runonphone/symbianutils/communicationstarter.h create mode 100644 tools/runonphone/symbianutils/launcher.cpp create mode 100644 tools/runonphone/symbianutils/launcher.h create mode 100644 tools/runonphone/symbianutils/symbianutils.pri create mode 100644 tools/runonphone/symbianutils/symbianutils_global.h create mode 100644 tools/runonphone/symbianutils/trkdevice.cpp create mode 100644 tools/runonphone/symbianutils/trkdevice.h create mode 100644 tools/runonphone/symbianutils/trkutils.cpp create mode 100644 tools/runonphone/symbianutils/trkutils.h create mode 100644 tools/runonphone/symbianutils/trkutils_p.h delete mode 100644 tools/runonphone/trk/bluetoothlistener.cpp delete mode 100644 tools/runonphone/trk/bluetoothlistener.h delete mode 100644 tools/runonphone/trk/bluetoothlistener_gui.cpp delete mode 100644 tools/runonphone/trk/bluetoothlistener_gui.h delete mode 100644 tools/runonphone/trk/callback.h delete mode 100644 tools/runonphone/trk/communicationstarter.cpp delete mode 100644 tools/runonphone/trk/communicationstarter.h delete mode 100644 tools/runonphone/trk/launcher.cpp delete mode 100644 tools/runonphone/trk/launcher.h delete mode 100644 tools/runonphone/trk/symbianutils_global.h delete mode 100644 tools/runonphone/trk/trk.pri delete mode 100644 tools/runonphone/trk/trkdevice.cpp delete mode 100644 tools/runonphone/trk/trkdevice.h delete mode 100644 tools/runonphone/trk/trkutils.cpp delete mode 100644 tools/runonphone/trk/trkutils.h delete mode 100644 tools/runonphone/trk/trkutils_p.h diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro index 2c1be98..7bed3e5 100644 --- a/tools/runonphone/runonphone.pro +++ b/tools/runonphone/runonphone.pro @@ -4,7 +4,7 @@ QT -= gui CONFIG += console CONFIG -= app_bundle -include(trk/trk.pri) +include(symbianutils/symbianutils.pri) SOURCES += main.cpp \ trksignalhandler.cpp @@ -12,6 +12,8 @@ SOURCES += main.cpp \ HEADERS += trksignalhandler.h \ serenum.h +DEFINES += SYMBIANUTILS_INCLUDE_PRI + windows { SOURCES += serenum_win.cpp LIBS += -lsetupapi \ diff --git a/tools/runonphone/symbianutils/bluetoothlistener.cpp b/tools/runonphone/symbianutils/bluetoothlistener.cpp new file mode 100644 index 0000000..df04288 --- /dev/null +++ b/tools/runonphone/symbianutils/bluetoothlistener.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** 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 tools applications 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 "bluetoothlistener.h" +#include "trkdevice.h" + +#include + +#ifdef Q_OS_UNIX +# include +# include +#else +# include +#endif + +// Process id helpers. +#ifdef Q_OS_WIN +inline DWORD processId(const QProcess &p) +{ + if (const Q_PID processInfoStruct = p.pid()) + return processInfoStruct->dwProcessId; + return 0; +} +#else +inline Q_PID processId(const QProcess &p) +{ + return p.pid(); +} +#endif + + +enum { debug = 0 }; + +namespace trk { + +struct BluetoothListenerPrivate { + BluetoothListenerPrivate(); + QString device; + QProcess process; +#ifdef Q_OS_WIN + DWORD pid; +#else + Q_PID pid; +#endif + bool printConsoleMessages; + BluetoothListener::Mode mode; +}; + +BluetoothListenerPrivate::BluetoothListenerPrivate() : + pid(0), + printConsoleMessages(false), + mode(BluetoothListener::Listen) +{ +} + +BluetoothListener::BluetoothListener(QObject *parent) : + QObject(parent), + d(new BluetoothListenerPrivate) +{ + d->process.setProcessChannelMode(QProcess::MergedChannels); + + connect(&d->process, SIGNAL(readyReadStandardError()), + this, SLOT(slotStdError())); + connect(&d->process, SIGNAL(readyReadStandardOutput()), + this, SLOT(slotStdOutput())); + connect(&d->process, SIGNAL(finished(int, QProcess::ExitStatus)), + this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); + connect(&d->process, SIGNAL(error(QProcess::ProcessError)), + this, SLOT(slotProcessError(QProcess::ProcessError))); +} + +BluetoothListener::~BluetoothListener() +{ + const int trc = terminateProcess(); + if (debug) + qDebug() << "~BluetoothListener: terminated" << trc; + delete d; +} + +BluetoothListener::Mode BluetoothListener::mode() const +{ + return d->mode; +} + +void BluetoothListener::setMode(Mode m) +{ + d->mode = m; +} + +bool BluetoothListener::printConsoleMessages() const +{ + return d->printConsoleMessages; +} + +void BluetoothListener::setPrintConsoleMessages(bool p) +{ + d->printConsoleMessages = p; +} + +int BluetoothListener::terminateProcess() +{ + enum { TimeOutMS = 200 }; + if (debug) + qDebug() << "terminateProcess" << d->process.pid() << d->process.state(); + if (d->process.state() == QProcess::NotRunning) + return -1; + emitMessage(tr("%1: Stopping listener %2...").arg(d->device).arg(processId(d->process))); + // When listening, the process should terminate by itself after closing the connection + if (mode() == Listen && d->process.waitForFinished(TimeOutMS)) + return 0; +#ifdef Q_OS_UNIX + kill(d->process.pid(), SIGHUP); // Listens for SIGHUP + if (d->process.waitForFinished(TimeOutMS)) + return 1; +#endif + d->process.terminate(); + if (d->process.waitForFinished(TimeOutMS)) + return 2; + d->process.kill(); + return 3; +} + +bool BluetoothListener::start(const QString &device, QString *errorMessage) +{ + if (d->process.state() != QProcess::NotRunning) { + *errorMessage = QLatin1String("Internal error: Still running."); + return false; + } + d->device = device; + const QString binary = QLatin1String("rfcomm"); + QStringList arguments; + arguments << QLatin1String("-r") + << (d->mode == Listen ? QLatin1String("listen") : QLatin1String("watch")) + << device << QString(QLatin1Char('1')); + if (debug) + qDebug() << binary << arguments; + emitMessage(tr("%1: Starting Bluetooth listener %2...").arg(device, binary)); + d->pid = 0; + d->process.start(binary, arguments); + if (!d->process.waitForStarted()) { + *errorMessage = tr("Unable to run '%1': %2").arg(binary, d->process.errorString()); + return false; + } + d->pid = processId(d->process); // Forgets it after crash/termination + emitMessage(tr("%1: Bluetooth listener running (%2).").arg(device).arg(processId(d->process))); + return true; +} + +void BluetoothListener::slotStdOutput() +{ + emitMessage(QString::fromLocal8Bit(d->process.readAllStandardOutput())); +} + +void BluetoothListener::emitMessage(const QString &m) +{ + if (d->printConsoleMessages || debug) + qDebug("%s\n", qPrintable(m)); + emit message(m); +} + +void BluetoothListener::slotStdError() +{ + emitMessage(QString::fromLocal8Bit(d->process.readAllStandardError())); +} + +void BluetoothListener::slotProcessFinished(int ex, QProcess::ExitStatus state) +{ + switch (state) { + case QProcess::NormalExit: + emitMessage(tr("%1: Process %2 terminated with exit code %3.") + .arg(d->device).arg(d->pid).arg(ex)); + break; + case QProcess::CrashExit: + emitMessage(tr("%1: Process %2 crashed.").arg(d->device).arg(d->pid)); + break; + } + emit terminated(); +} + +void BluetoothListener::slotProcessError(QProcess::ProcessError error) +{ + emitMessage(tr("%1: Process error %2: %3") + .arg(d->device).arg(error).arg(d->process.errorString())); +} + +} // namespace trk diff --git a/tools/runonphone/symbianutils/bluetoothlistener.h b/tools/runonphone/symbianutils/bluetoothlistener.h new file mode 100644 index 0000000..36894e7 --- /dev/null +++ b/tools/runonphone/symbianutils/bluetoothlistener.h @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** 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 tools applications 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 BLUETOOTHLISTENER_H +#define BLUETOOTHLISTENER_H + +#include "symbianutils_global.h" + +#include +#include + +namespace trk { +struct BluetoothListenerPrivate; + +/* BluetoothListener: Starts a helper process watching connections on a + * Bluetooth device, Linux only: + * The rfcomm command is used. It process can be started in the background + * while connection attempts (TrkDevice::open()) are made in the foreground. */ + +class SYMBIANUTILS_EXPORT BluetoothListener : public QObject +{ + Q_OBJECT + Q_DISABLE_COPY(BluetoothListener) +public: + // The Mode property must be set before calling start(). + enum Mode { + Listen, /* Terminate after client closed (read: Trk app + * on the phone terminated or disconnected).*/ + Watch // Keep running, watch for next connection from client + }; + + explicit BluetoothListener(QObject *parent = 0); + virtual ~BluetoothListener(); + + Mode mode() const; + void setMode(Mode m); + + bool start(const QString &device, QString *errorMessage); + + // Print messages on the console. + bool printConsoleMessages() const; + void setPrintConsoleMessages(bool p); + +signals: + void terminated(); + void message(const QString &); + +public slots: + void emitMessage(const QString &m); // accessed by starter + +private slots: + void slotStdOutput(); + void slotStdError(); + void slotProcessFinished(int, QProcess::ExitStatus); + void slotProcessError(QProcess::ProcessError error); + +private: + int terminateProcess(); + + BluetoothListenerPrivate *d; +}; + +} // namespace trk + +#endif // BLUETOOTHLISTENER_H diff --git a/tools/runonphone/symbianutils/bluetoothlistener_gui.cpp b/tools/runonphone/symbianutils/bluetoothlistener_gui.cpp new file mode 100644 index 0000000..5994eb5 --- /dev/null +++ b/tools/runonphone/symbianutils/bluetoothlistener_gui.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications 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 "bluetoothlistener_gui.h" +#include "bluetoothlistener.h" +#include "communicationstarter.h" + +#include +#include +#include +#include + +namespace trk { + +SYMBIANUTILS_EXPORT PromptStartCommunicationResult + promptStartCommunication(BaseCommunicationStarter &starter, + const QString &msgBoxTitle, + const QString &msgBoxText, + QWidget *msgBoxParent, + QString *errorMessage) +{ + errorMessage->clear(); + // Initial connection attempt. + switch (starter.start()) { + case BaseCommunicationStarter::Started: + break; + case BaseCommunicationStarter::ConnectionSucceeded: + return PromptStartCommunicationConnected; + case BaseCommunicationStarter::StartError: + *errorMessage = starter.errorString(); + return PromptStartCommunicationError; + } + // Run the starter with the event loop of a message box, have the box + // closed by the signals of the starter. + QMessageBox messageBox(QMessageBox::Information, msgBoxTitle, msgBoxText, QMessageBox::Cancel, msgBoxParent); + QObject::connect(&starter, SIGNAL(connected()), &messageBox, SLOT(close())); + QObject::connect(&starter, SIGNAL(timeout()), &messageBox, SLOT(close())); + messageBox.exec(); + // Only starter.state() is reliable here to obtain the state. + switch (starter.state()) { + case AbstractBluetoothStarter::Running: + *errorMessage = QCoreApplication::translate("trk::promptStartCommunication", "Connection on %1 canceled.").arg(starter.device()); + return PromptStartCommunicationCanceled; + case AbstractBluetoothStarter::TimedOut: + *errorMessage = starter.errorString(); + return PromptStartCommunicationError; + case AbstractBluetoothStarter::Connected: + break; + } + return PromptStartCommunicationConnected; +} + +SYMBIANUTILS_EXPORT PromptStartCommunicationResult + promptStartSerial(BaseCommunicationStarter &starter, + QWidget *msgBoxParent, + QString *errorMessage) +{ + const QString title = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for App TRK"); + const QString message = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for App TRK to start on %1...").arg(starter.device()); + return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage); +} + +SYMBIANUTILS_EXPORT PromptStartCommunicationResult + promptStartBluetooth(BaseCommunicationStarter &starter, + QWidget *msgBoxParent, + QString *errorMessage) +{ + const QString title = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for Bluetooth Connection"); + const QString message = QCoreApplication::translate("trk::promptStartCommunication", "Connecting to %1...").arg(starter.device()); + return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage); +} + +} // namespace trk diff --git a/tools/runonphone/symbianutils/bluetoothlistener_gui.h b/tools/runonphone/symbianutils/bluetoothlistener_gui.h new file mode 100644 index 0000000..10e7145 --- /dev/null +++ b/tools/runonphone/symbianutils/bluetoothlistener_gui.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** 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 tools applications 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 BLUETOOTHLISTENER_GUI_H +#define BLUETOOTHLISTENER_GUI_H + +#include "symbianutils_global.h" + +#include + +QT_BEGIN_NAMESPACE +class QWidget; +QT_END_NAMESPACE + +namespace trk { +class BaseCommunicationStarter; + +/* promptStartCommunication(): Convenience functions that + * prompt the user to start a communication (launching or + * connecting TRK) using a modal message box in which they can cancel. + * Pass in the starter with device and parameters set up. */ + +enum PromptStartCommunicationResult { + PromptStartCommunicationConnected, + PromptStartCommunicationCanceled, + PromptStartCommunicationError +}; + +SYMBIANUTILS_EXPORT PromptStartCommunicationResult + promptStartCommunication(BaseCommunicationStarter &starter, + const QString &msgBoxTitle, + const QString &msgBoxText, + QWidget *msgBoxParent, + QString *errorMessage); + +// Convenience to start a serial connection (messages prompting +// to launch Trk). +SYMBIANUTILS_EXPORT PromptStartCommunicationResult + promptStartSerial(BaseCommunicationStarter &starter, + QWidget *msgBoxParent, + QString *errorMessage); + +// Convenience to start blue tooth connection (messages +// prompting to connect). +SYMBIANUTILS_EXPORT PromptStartCommunicationResult + promptStartBluetooth(BaseCommunicationStarter &starter, + QWidget *msgBoxParent, + QString *errorMessage); +} // namespace trk + +#endif // BLUETOOTHLISTENER_GUI_H diff --git a/tools/runonphone/symbianutils/callback.h b/tools/runonphone/symbianutils/callback.h new file mode 100644 index 0000000..3996d73 --- /dev/null +++ b/tools/runonphone/symbianutils/callback.h @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** 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 tools applications 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 DEBUGGER_CALLBACK_H +#define DEBUGGER_CALLBACK_H + +#include "symbianutils_global.h" + +namespace trk { +namespace Internal { + +/* Helper class for the 1-argument functor: + * Cloneable base class for the implementation which is + * invokeable with the argument. */ +template +class CallbackImplBase +{ + Q_DISABLE_COPY(CallbackImplBase) +public: + CallbackImplBase() {} + virtual CallbackImplBase *clone() const = 0; + virtual void invoke(Argument a) = 0; + virtual ~CallbackImplBase() {} +}; + +/* Helper class for the 1-argument functor: Implementation for + * a class instance with a member function pointer. */ +template +class CallbackMemberPtrImpl : public CallbackImplBase +{ +public: + typedef void (Class::*MemberFuncPtr)(Argument); + + CallbackMemberPtrImpl(Class *instance, + MemberFuncPtr memberFunc) : + m_instance(instance), + m_memberFunc(memberFunc) {} + + virtual CallbackImplBase *clone() const + { + return new CallbackMemberPtrImpl(m_instance, m_memberFunc); + } + + virtual void invoke(Argument a) + { (m_instance->*m_memberFunc)(a); } +private: + Class *m_instance; + MemberFuncPtr m_memberFunc; +}; + +} // namespace Internal + +/* Default-constructible, copyable 1-argument functor providing an + * operator()(Argument) that invokes a member function of a class: + * \code +class Foo { +public: + void print(const std::string &); +}; +... +Foo foo; +Callback f1(&foo, &Foo::print); +f1("test"); +\endcode */ + +template +class Callback +{ +public: + Callback() : m_impl(0) {} + + template + Callback(Class *instance, void (Class::*memberFunc)(Argument)) : + m_impl(new Internal::CallbackMemberPtrImpl(instance, memberFunc)) + {} + + ~Callback() + { + clean(); + } + + Callback(const Callback &rhs) : + m_impl(0) + { + if (rhs.m_impl) + m_impl = rhs.m_impl->clone(); + } + + Callback &operator=(const Callback &rhs) + { + if (this != &rhs) { + clean(); + if (rhs.m_impl) + m_impl = rhs.m_impl->clone(); + } + return *this; + } + + bool isNull() const { return m_impl == 0; } + operator bool() const { return !isNull(); } + + void operator()(Argument a) + { + if (m_impl) + m_impl->invoke(a); + } + +private: + void clean() + { + if (m_impl) { + delete m_impl; + m_impl = 0; + } + } + + Internal::CallbackImplBase *m_impl; +}; + +} // namespace trk + +#endif // DEBUGGER_CALLBACK_H diff --git a/tools/runonphone/symbianutils/communicationstarter.cpp b/tools/runonphone/symbianutils/communicationstarter.cpp new file mode 100644 index 0000000..e5e556e --- /dev/null +++ b/tools/runonphone/symbianutils/communicationstarter.cpp @@ -0,0 +1,260 @@ +/**************************************************************************** +** +** 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 tools applications 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 "communicationstarter.h" +#include "bluetoothlistener.h" +#include "trkdevice.h" + +#include +#include + +namespace trk { + +// --------------- AbstractBluetoothStarter +struct BaseCommunicationStarterPrivate { + explicit BaseCommunicationStarterPrivate(const BaseCommunicationStarter::TrkDevicePtr &d); + + const BaseCommunicationStarter::TrkDevicePtr trkDevice; + BluetoothListener *listener; + QTimer *timer; + int intervalMS; + int attempts; + int n; + QString device; + QString errorString; + BaseCommunicationStarter::State state; +}; + +BaseCommunicationStarterPrivate::BaseCommunicationStarterPrivate(const BaseCommunicationStarter::TrkDevicePtr &d) : + trkDevice(d), + listener(0), + timer(0), + intervalMS(1000), + attempts(-1), + n(0), + device(QLatin1String("/dev/rfcomm0")), + state(BaseCommunicationStarter::TimedOut) +{ +} + +BaseCommunicationStarter::BaseCommunicationStarter(const TrkDevicePtr &trkDevice, QObject *parent) : + QObject(parent), + d(new BaseCommunicationStarterPrivate(trkDevice)) +{ +} + +BaseCommunicationStarter::~BaseCommunicationStarter() +{ + stopTimer(); + delete d; +} + +void BaseCommunicationStarter::stopTimer() +{ + if (d->timer && d->timer->isActive()) + d->timer->stop(); +} + +bool BaseCommunicationStarter::initializeStartupResources(QString *errorMessage) +{ + errorMessage->clear(); + return true; +} + +BaseCommunicationStarter::StartResult BaseCommunicationStarter::start() +{ + if (state() == Running) { + d->errorString = QLatin1String("Internal error, attempt to re-start BaseCommunicationStarter.\n"); + return StartError; + } + // Before we instantiate timers, and such, try to open the device, + // which should succeed if another listener is already running in + // 'Watch' mode + if (d->trkDevice->open(d->device , &(d->errorString))) + return ConnectionSucceeded; + // Pull up resources for next attempt + d->n = 0; + if (!initializeStartupResources(&(d->errorString))) + return StartError; + // Start timer + if (!d->timer) { + d->timer = new QTimer; + connect(d->timer, SIGNAL(timeout()), this, SLOT(slotTimer())); + } + d->timer->setInterval(d->intervalMS); + d->timer->setSingleShot(false); + d->timer->start(); + d->state = Running; + return Started; +} + +BaseCommunicationStarter::State BaseCommunicationStarter::state() const +{ + return d->state; +} + +int BaseCommunicationStarter::intervalMS() const +{ + return d->intervalMS; +} + +void BaseCommunicationStarter::setIntervalMS(int i) +{ + d->intervalMS = i; + if (d->timer) + d->timer->setInterval(i); +} + +int BaseCommunicationStarter::attempts() const +{ + return d->attempts; +} + +void BaseCommunicationStarter::setAttempts(int a) +{ + d->attempts = a; +} + +QString BaseCommunicationStarter::device() const +{ + return d->device; +} + +void BaseCommunicationStarter::setDevice(const QString &dv) +{ + d->device = dv; +} + +QString BaseCommunicationStarter::errorString() const +{ + return d->errorString; +} + +void BaseCommunicationStarter::slotTimer() +{ + ++d->n; + // Check for timeout + if (d->attempts >= 0 && d->n >= d->attempts) { + stopTimer(); + d->errorString = tr("%1: timed out after %n attempts using an interval of %2ms.", 0, d->n) + .arg(d->device).arg(d->intervalMS); + d->state = TimedOut; + emit timeout(); + } else { + // Attempt n to connect? + if (d->trkDevice->open(d->device , &(d->errorString))) { + stopTimer(); + const QString msg = tr("%1: Connection attempt %2 succeeded.").arg(d->device).arg(d->n); + emit message(msg); + d->state = Connected; + emit connected(); + } else { + const QString msg = tr("%1: Connection attempt %2 failed: %3 (retrying)...") + .arg(d->device).arg(d->n).arg(d->errorString); + emit message(msg); + } + } +} + +// --------------- AbstractBluetoothStarter + +AbstractBluetoothStarter::AbstractBluetoothStarter(const TrkDevicePtr &trkDevice, QObject *parent) : + BaseCommunicationStarter(trkDevice, parent) +{ +} + +bool AbstractBluetoothStarter::initializeStartupResources(QString *errorMessage) +{ + // Create the listener and forward messages to it. + BluetoothListener *listener = createListener(); + connect(this, SIGNAL(message(QString)), listener, SLOT(emitMessage(QString))); + return listener->start(device(), errorMessage); +} + +// -------- ConsoleBluetoothStarter +ConsoleBluetoothStarter::ConsoleBluetoothStarter(const TrkDevicePtr &trkDevice, + QObject *listenerParent, + QObject *parent) : +AbstractBluetoothStarter(trkDevice, parent), +m_listenerParent(listenerParent) +{ +} + +BluetoothListener *ConsoleBluetoothStarter::createListener() +{ + BluetoothListener *rc = new BluetoothListener(m_listenerParent); + rc->setMode(BluetoothListener::Listen); + rc->setPrintConsoleMessages(true); + return rc; +} + +bool ConsoleBluetoothStarter::startBluetooth(const TrkDevicePtr &trkDevice, + QObject *listenerParent, + const QString &device, + int attempts, + QString *errorMessage) +{ + // Set up a console starter to print to stdout. + ConsoleBluetoothStarter starter(trkDevice, listenerParent); + starter.setDevice(device); + starter.setAttempts(attempts); + switch (starter.start()) { + case Started: + break; + case ConnectionSucceeded: + return true; + case StartError: + *errorMessage = starter.errorString(); + return false; + } + // Run the starter with an event loop. @ToDo: Implement + // some asynchronous keypress read to cancel. + QEventLoop eventLoop; + connect(&starter, SIGNAL(connected()), &eventLoop, SLOT(quit())); + connect(&starter, SIGNAL(timeout()), &eventLoop, SLOT(quit())); + eventLoop.exec(QEventLoop::ExcludeUserInputEvents); + if (starter.state() != AbstractBluetoothStarter::Connected) { + *errorMessage = starter.errorString(); + return false; + } + return true; +} +} // namespace trk diff --git a/tools/runonphone/symbianutils/communicationstarter.h b/tools/runonphone/symbianutils/communicationstarter.h new file mode 100644 index 0000000..2d7dc50 --- /dev/null +++ b/tools/runonphone/symbianutils/communicationstarter.h @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** 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 tools applications 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 COMMUNICATIONSTARTER_H +#define COMMUNICATIONSTARTER_H + +#include "symbianutils_global.h" + +#include +#include + +namespace trk { +class TrkDevice; +class BluetoothListener; +struct BaseCommunicationStarterPrivate; + +/* BaseCommunicationStarter: A QObject that repeatedly tries to open a + * trk device until a connection succeeds or a timeout occurs (emitting + * signals), allowing to do something else in the foreground (local event loop + * [say QMessageBox] or some asynchronous operation). If the initial + * connection attempt in start() fails, the + * virtual initializeStartupResources() is called to initialize resources + * required to pull up the communication (namely Bluetooth listeners). + * The base class can be used as is to prompt the user to launch App TRK for a + * serial communication as this requires no further resource setup. */ + +class SYMBIANUTILS_EXPORT BaseCommunicationStarter : public QObject { + Q_OBJECT + Q_DISABLE_COPY(BaseCommunicationStarter) +public: + typedef QSharedPointer TrkDevicePtr; + + enum State { Running, Connected, TimedOut }; + + explicit BaseCommunicationStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0); + virtual ~BaseCommunicationStarter(); + + int intervalMS() const; + void setIntervalMS(int i); + + int attempts() const; + void setAttempts(int a); + + QString device() const; + void setDevice(const QString &); + + State state() const; + QString errorString() const; + + enum StartResult { + Started, // Starter is now running. + ConnectionSucceeded, /* Initial connection attempt succeeded, + * no need to keep running. */ + StartError // Error occurred during start. + }; + + StartResult start(); + +signals: + void connected(); + void timeout(); + void message(const QString &); + +private slots: + void slotTimer(); + +protected: + virtual bool initializeStartupResources(QString *errorMessage); + +private: + inline void stopTimer(); + + BaseCommunicationStarterPrivate *d; +}; + +/* AbstractBluetoothStarter: Repeatedly tries to open a trk Bluetooth + * device. Note that in case a Listener is already running mode, the + * connection will succeed immediately. + * initializeStartupResources() is implemented to fire up the listener. + * Introduces a new virtual createListener() that derived classes must + * implement as a factory function that creates and sets up the + * listener (mode, message connection, etc). */ + +class SYMBIANUTILS_EXPORT AbstractBluetoothStarter : public BaseCommunicationStarter { + Q_OBJECT + Q_DISABLE_COPY(AbstractBluetoothStarter) +public: + +protected: + explicit AbstractBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0); + + // Implemented to fire up the listener. + virtual bool initializeStartupResources(QString *errorMessage); + // New virtual: Overwrite to create and parametrize the listener. + virtual BluetoothListener *createListener() = 0; +}; + +/* ConsoleBluetoothStarter: Convenience class for console processes. Creates a + * listener in "Listen" mode with the messages redirected to standard output. */ + +class SYMBIANUTILS_EXPORT ConsoleBluetoothStarter : public AbstractBluetoothStarter { + Q_OBJECT + Q_DISABLE_COPY(ConsoleBluetoothStarter) +public: + static bool startBluetooth(const TrkDevicePtr& trkDevice, + QObject *listenerParent, + const QString &device, + int attempts, + QString *errorMessage); + +protected: + virtual BluetoothListener *createListener(); + +private: + explicit ConsoleBluetoothStarter(const TrkDevicePtr& trkDevice, + QObject *listenerParent, + QObject *parent = 0); + + QObject *m_listenerParent; +}; + +} // namespace trk + +#endif // COMMUNICATIONSTARTER_H diff --git a/tools/runonphone/symbianutils/launcher.cpp b/tools/runonphone/symbianutils/launcher.cpp new file mode 100644 index 0000000..4f91545 --- /dev/null +++ b/tools/runonphone/symbianutils/launcher.cpp @@ -0,0 +1,741 @@ +/**************************************************************************** +** +** 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 tools applications 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 "launcher.h" +#include "trkutils.h" +#include "trkutils_p.h" +#include "trkdevice.h" +#include "bluetoothlistener.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace trk { + +struct LauncherPrivate { + struct CopyState { + QString sourceFileName; + QString destinationFileName; + uint copyFileHandle; + QScopedPointer data; + int position; + }; + + explicit LauncherPrivate(const TrkDevicePtr &d); + + TrkDevicePtr m_device; + QString m_trkServerName; + QByteArray m_trkReadBuffer; + Launcher::State m_state; + + void logMessage(const QString &msg); + // Debuggee state + Session m_session; // global-ish data (process id, target information) + + CopyState m_copyState; + QString m_fileName; + QStringList m_commandLineArgs; + QString m_installFileName; + int m_verbose; + Launcher::Actions m_startupActions; + bool m_closeDevice; +}; + +LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) : + m_device(d), + m_state(Launcher::Disconnected), + m_verbose(0), + m_closeDevice(true) +{ + if (m_device.isNull()) + m_device = TrkDevicePtr(new TrkDevice); +} + +Launcher::Launcher(Actions startupActions, + const TrkDevicePtr &dev, + QObject *parent) : + QObject(parent), + d(new LauncherPrivate(dev)) +{ + d->m_startupActions = startupActions; + connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult))); + connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close())); +} + +Launcher::~Launcher() +{ + logMessage("Shutting down.\n"); + delete d; +} + +Launcher::State Launcher::state() const +{ + return d->m_state; +} + +void Launcher::setState(State s) +{ + if (s != d->m_state) { + d->m_state = s; + emit stateChanged(s); + } +} + +void Launcher::addStartupActions(trk::Launcher::Actions startupActions) +{ + d->m_startupActions = Actions(d->m_startupActions | startupActions); +} + +void Launcher::setTrkServerName(const QString &name) +{ + d->m_trkServerName = name; +} + +QString Launcher::trkServerName() const +{ + return d->m_trkServerName; +} + +TrkDevicePtr Launcher::trkDevice() const +{ + return d->m_device; +} + +void Launcher::setFileName(const QString &name) +{ + d->m_fileName = name; +} + +void Launcher::setCopyFileName(const QString &srcName, const QString &dstName) +{ + d->m_copyState.sourceFileName = srcName; + d->m_copyState.destinationFileName = dstName; +} + +void Launcher::setInstallFileName(const QString &name) +{ + d->m_installFileName = name; +} + +void Launcher::setCommandLineArgs(const QStringList &args) +{ + d->m_commandLineArgs = args; +} + +void Launcher::setSerialFrame(bool b) +{ + d->m_device->setSerialFrame(b); +} + +bool Launcher::serialFrame() const +{ + return d->m_device->serialFrame(); +} + + +bool Launcher::closeDevice() const +{ + return d->m_closeDevice; +} + +void Launcher::setCloseDevice(bool c) +{ + d->m_closeDevice = c; +} + +bool Launcher::startServer(QString *errorMessage) +{ + errorMessage->clear(); + if (d->m_verbose) { + const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Arguments=%3 Package=%4 Remote Package=%5 Install file=%6") + .arg(d->m_trkServerName, d->m_fileName, + d->m_commandLineArgs.join(QString(QLatin1Char(' '))), + d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName); + logMessage(msg); + } + if (d->m_startupActions & ActionCopy) { + if (d->m_copyState.sourceFileName.isEmpty()) { + qWarning("No local filename given for copying package."); + return false; + } else if (d->m_copyState.destinationFileName.isEmpty()) { + qWarning("No remote filename given for copying package."); + return false; + } + } + if (d->m_startupActions & ActionInstall && d->m_installFileName.isEmpty()) { + qWarning("No package name given for installing."); + return false; + } + if (d->m_startupActions & ActionRun && d->m_fileName.isEmpty()) { + qWarning("No remote executable given for running."); + return false; + } + if (!d->m_device->isOpen() && !d->m_device->open(d->m_trkServerName, errorMessage)) + return false; + if (d->m_closeDevice) { + connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close())); + } else { + disconnect(this, SIGNAL(finished()), d->m_device.data(), 0); + } + setState(Connecting); + // Set up the temporary 'waiting' state if we do not get immediate connection + QTimer::singleShot(1000, this, SLOT(slotWaitingForTrk())); + d->m_device->sendTrkInitialPing(); + d->m_device->sendTrkMessage(TrkDisconnect); // Disconnect, as trk might be still connected + d->m_device->sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask)); + d->m_device->sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType)); + d->m_device->sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion)); + if (d->m_startupActions != ActionPingOnly) + d->m_device->sendTrkMessage(TrkConnect, TrkCallback(this, &Launcher::handleConnect)); + return true; +} + +void Launcher::slotWaitingForTrk() +{ + // Set temporary state if we are still in connected state + if (state() == Connecting) + setState(WaitingForTrk); +} + +void Launcher::handleConnect(const TrkResult &result) +{ + if (result.errorCode()) { + emit canNotConnect(result.errorString()); + return; + } + setState(Connected); + if (d->m_startupActions & ActionCopy) + copyFileToRemote(); + else if (d->m_startupActions & ActionInstall) + installRemotePackageSilently(); + else if (d->m_startupActions & ActionRun) + startInferiorIfNeeded(); +} + +void Launcher::setVerbose(int v) +{ + d->m_verbose = v; + d->m_device->setVerbose(v); +} + +void Launcher::logMessage(const QString &msg) +{ + if (d->m_verbose) + qDebug() << "LAUNCHER: " << qPrintable(msg); +} + +void Launcher::terminate() +{ + switch (state()) { + case DeviceDescriptionReceived: + case Connected: + if (d->m_session.pid) { + QByteArray ba; + appendShort(&ba, 0x0000, TargetByteOrder); + appendInt(&ba, d->m_session.pid, TargetByteOrder); + d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(this, &Launcher::handleRemoteProcessKilled), ba); + return; + } + if (d->m_copyState.copyFileHandle) + closeRemoteFile(true); + disconnectTrk(); + break; + case Disconnected: + break; + case Connecting: + case WaitingForTrk: + setState(Disconnected); + emit finished(); + break; + } +} + +void Launcher::handleRemoteProcessKilled(const TrkResult &result) +{ + Q_UNUSED(result) + disconnectTrk(); +} + +QString Launcher::msgStopped(uint pid, uint tid, uint address, const QString &why) +{ + return QString::fromLatin1("Process %1, thread %2 stopped at 0x%3: %4"). + arg(pid).arg(tid).arg(address, 0, 16). + arg(why.isEmpty() ? QString::fromLatin1("") : why); +} + +bool Launcher::parseNotifyStopped(const QByteArray &dataBA, + uint *pid, uint *tid, uint *address, + QString *why /* = 0 */) +{ + if (why) + why->clear(); + *address = *pid = *tid = 0; + if (dataBA.size() < 12) + return false; + const char *data = dataBA.data(); + *address = extractInt(data); + *pid = extractInt(data + 4); + *tid = extractInt(data + 8); + if (why && dataBA.size() >= 14) { + const unsigned short len = extractShort(data + 12); + if (len > 0) + *why = QString::fromLatin1(data + 14, len); + } + return true; +} + +void Launcher::handleResult(const TrkResult &result) +{ + QByteArray prefix = "READ BUF: "; + QByteArray str = result.toString().toUtf8(); + if (result.isDebugOutput) { // handle application output + logMessage("APPLICATION OUTPUT: " + result.data); + emit applicationOutputReceived(result.data); + return; + } + switch (result.code) { + case TrkNotifyAck: + break; + case TrkNotifyNak: { // NAK + logMessage(prefix + "NAK: " + str); + //logMessage(prefix << "TOKEN: " << result.token); + logMessage(prefix + "ERROR: " + errorMessage(result.data.at(0))); + break; + } + case TrkNotifyStopped: { // Notified Stopped + QString reason; + uint pc; + uint pid; + uint tid; + parseNotifyStopped(result.data, &pid, &tid, &pc, &reason); + logMessage(prefix + msgStopped(pid, tid, pc, reason)); + emit(processStopped(pc, pid, tid, reason)); + d->m_device->sendTrkAck(result.token); + break; + } + case TrkNotifyException: { // Notify Exception (obsolete) + logMessage(prefix + "NOTE: EXCEPTION " + str); + d->m_device->sendTrkAck(result.token); + break; + } + case TrkNotifyInternalError: { // + logMessage(prefix + "NOTE: INTERNAL ERROR: " + str); + d->m_device->sendTrkAck(result.token); + break; + } + + // target->host OS notification + case TrkNotifyCreated: { // Notify Created + /* + const char *data = result.data.data(); + byte error = result.data.at(0); + byte type = result.data.at(1); // type: 1 byte; for dll item, this value is 2. + uint pid = extractInt(data + 2); // ProcessID: 4 bytes; + uint tid = extractInt(data + 6); //threadID: 4 bytes + uint codeseg = extractInt(data + 10); //code address: 4 bytes; code base address for the library + uint dataseg = extractInt(data + 14); //data address: 4 bytes; data base address for the library + uint len = extractShort(data + 18); //length: 2 bytes; length of the library name string to follow + QByteArray name = result.data.mid(20, len); // name: library name + + logMessage(prefix + "NOTE: LIBRARY LOAD: " + str); + logMessage(prefix + "TOKEN: " + result.token); + logMessage(prefix + "ERROR: " + int(error)); + logMessage(prefix + "TYPE: " + int(type)); + logMessage(prefix + "PID: " + pid); + logMessage(prefix + "TID: " + tid); + logMessage(prefix + "CODE: " + codeseg); + logMessage(prefix + "DATA: " + dataseg); + logMessage(prefix + "LEN: " + len); + logMessage(prefix + "NAME: " + name); + */ + + if (result.data.size() < 10) + break; + QByteArray ba; + ba.append(result.data.mid(2, 8)); + d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE"); + //d->m_device->sendTrkAck(result.token) + break; + } + case TrkNotifyDeleted: { // NotifyDeleted + const ushort itemType = (unsigned char)result.data.at(1); + const ushort len = result.data.size() > 12 ? extractShort(result.data.data() + 10) : ushort(0); + const QString name = len ? QString::fromAscii(result.data.mid(12, len)) : QString(); + logMessage(QString::fromLatin1("%1 %2 UNLOAD: %3"). + arg(QString::fromAscii(prefix)).arg(itemType ? QLatin1String("LIB") : QLatin1String("PROCESS")). + arg(name)); + d->m_device->sendTrkAck(result.token); + if (itemType == 0 // process + && result.data.size() >= 10 + && d->m_session.pid == extractInt(result.data.data() + 6)) { + disconnectTrk(); + } + break; + } + case TrkNotifyProcessorStarted: { // NotifyProcessorStarted + logMessage(prefix + "NOTE: PROCESSOR STARTED: " + str); + d->m_device->sendTrkAck(result.token); + break; + } + case TrkNotifyProcessorStandBy: { // NotifyProcessorStandby + logMessage(prefix + "NOTE: PROCESSOR STANDBY: " + str); + d->m_device->sendTrkAck(result.token); + break; + } + case TrkNotifyProcessorReset: { // NotifyProcessorReset + logMessage(prefix + "NOTE: PROCESSOR RESET: " + str); + d->m_device->sendTrkAck(result.token); + break; + } + default: { + logMessage(prefix + "INVALID: " + str); + break; + } + } +} + +QString Launcher::deviceDescription(unsigned verbose) const +{ + return d->m_session.deviceDescription(verbose); +} + +void Launcher::handleTrkVersion(const TrkResult &result) +{ + if (result.errorCode() || result.data.size() < 5) { + if (d->m_startupActions == ActionPingOnly) { + setState(Disconnected); + emit finished(); + } + return; + } + d->m_session.trkAppVersion.trkMajor = result.data.at(1); + d->m_session.trkAppVersion.trkMinor = result.data.at(2); + d->m_session.trkAppVersion.protocolMajor = result.data.at(3); + d->m_session.trkAppVersion.protocolMinor = result.data.at(4); + setState(DeviceDescriptionReceived); + // Ping mode: Log & Terminate + if (d->m_startupActions == ActionPingOnly) { + qWarning("%s", qPrintable(deviceDescription())); + setState(Disconnected); + emit finished(); + } +} + +void Launcher::handleFileCreation(const TrkResult &result) +{ + if (result.errorCode() || result.data.size() < 6) { + emit canNotCreateFile(d->m_copyState.destinationFileName, result.errorString()); + disconnectTrk(); + return; + } + const char *data = result.data.data(); + d->m_copyState.copyFileHandle = extractInt(data + 2); + QFile file(d->m_copyState.sourceFileName); + file.open(QIODevice::ReadOnly); + d->m_copyState.data.reset(new QByteArray(file.readAll())); + d->m_copyState.position = 0; + file.close(); + continueCopying(); +} + +void Launcher::handleCopy(const TrkResult &result) +{ + if (result.errorCode() || result.data.size() < 4) { + closeRemoteFile(true); + emit canNotWriteFile(d->m_copyState.destinationFileName, result.errorString()); + disconnectTrk(); + } else { + continueCopying(extractShort(result.data.data() + 2)); + } +} + +void Launcher::continueCopying(uint lastCopiedBlockSize) +{ + int size = d->m_copyState.data->length(); + d->m_copyState.position += lastCopiedBlockSize; + if (size == 0) + emit copyProgress(100); + else { + int percent = qMin((d->m_copyState.position*100)/size, 100); + emit copyProgress(percent); + } + if (d->m_copyState.position < size) { + QByteArray ba; + appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); + appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, 2048), TargetByteOrder, false); + d->m_device->sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba); + } else { + closeRemoteFile(); + } +} + +void Launcher::closeRemoteFile(bool failed) +{ + QByteArray ba; + appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); + appendDateTime(&ba, QDateTime::currentDateTime(), TargetByteOrder); + d->m_device->sendTrkMessage(TrkCloseFile, + failed ? TrkCallback() : TrkCallback(this, &Launcher::handleFileCopied), + ba); + d->m_copyState.data.reset(); + d->m_copyState.copyFileHandle = 0; + d->m_copyState.position = 0; +} + +void Launcher::handleFileCopied(const TrkResult &result) +{ + if (result.errorCode()) + emit canNotCloseFile(d->m_copyState.destinationFileName, result.errorString()); + if (d->m_startupActions & ActionInstall) + installRemotePackageSilently(); + else if (d->m_startupActions & ActionRun) + startInferiorIfNeeded(); + else + disconnectTrk(); +} + +void Launcher::handleCpuType(const TrkResult &result) +{ + logMessage("HANDLE CPU TYPE: " + result.toString()); + if(result.errorCode() || result.data.size() < 7) + return; + //---TRK------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 + // [80 03 00 04 00 00 04 00 00 00] + d->m_session.cpuMajor = result.data.at(1); + d->m_session.cpuMinor = result.data.at(2); + d->m_session.bigEndian = result.data.at(3); + d->m_session.defaultTypeSize = result.data.at(4); + d->m_session.fpTypeSize = result.data.at(5); + d->m_session.extended1TypeSize = result.data.at(6); + //d->m_session.extended2TypeSize = result.data[6]; +} + +void Launcher::handleCreateProcess(const TrkResult &result) +{ + if (result.errorCode()) { + emit canNotRun(result.errorString()); + disconnectTrk(); + return; + } + // 40 00 00] + //logMessage(" RESULT: " + result.toString()); + // [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00] + const char *data = result.data.data(); + d->m_session.pid = extractInt(data + 1); + d->m_session.tid = extractInt(data + 5); + d->m_session.codeseg = extractInt(data + 9); + d->m_session.dataseg = extractInt(data + 13); + if (d->m_verbose) { + const QString msg = QString::fromLatin1("Process id: %1 Thread id: %2 code: 0x%3 data: 0x%4"). + arg(d->m_session.pid).arg(d->m_session.tid).arg(d->m_session.codeseg, 0, 16). + arg(d->m_session.dataseg, 0 ,16); + logMessage(msg); + } + emit applicationRunning(d->m_session.pid); + QByteArray ba; + appendInt(&ba, d->m_session.pid); + appendInt(&ba, d->m_session.tid); + d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE"); +} + +void Launcher::handleWaitForFinished(const TrkResult &result) +{ + logMessage(" FINISHED: " + stringFromArray(result.data)); + setState(Disconnected); + emit finished(); +} + +void Launcher::handleSupportMask(const TrkResult &result) +{ + if (result.errorCode() || result.data.size() < 32) + return; + const char *data = result.data.data() + 1; + + QString str = QLatin1String("SUPPORTED: "); + for (int i = 0; i < 32; ++i) { + //str.append(" [" + formatByte(data[i]) + "]: "); + for (int j = 0; j < 8; ++j) { + if (data[i] & (1 << j)) { + str.append(QString::number(i * 8 + j, 16)); + str.append(QLatin1Char(' ')); + } + } + } + logMessage(str); +} + +void Launcher::cleanUp() +{ + // + //---IDE------------------------------------------------------ + // Command: 0x41 Delete Item + // Sub Cmd: Delete Process + //ProcessID: 0x0000071F (1823) + // [41 24 00 00 00 00 07 1F] + QByteArray ba(2, char(0)); + appendInt(&ba, d->m_session.pid); + d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(), ba, "Delete process"); + + //---TRK------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 + // [80 24 00] + + //---IDE------------------------------------------------------ + // Command: 0x1C Clear Break + // [1C 25 00 00 00 0A 78 6A 43 40] + + //---TRK------------------------------------------------------ + // Command: 0xA1 Notify Deleted + // [A1 09 00 00 00 00 00 00 00 00 07 1F] + //---IDE------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 + // [80 09 00] + + //---TRK------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 + // [80 25 00] + + //---IDE------------------------------------------------------ + // Command: 0x1C Clear Break + // [1C 26 00 00 00 0B 78 6A 43 70] + //---TRK------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 + // [80 26 00] + + + //---IDE------------------------------------------------------ + // Command: 0x02 Disconnect + // [02 27] +// sendTrkMessage(0x02, TrkCallback(this, &Launcher::handleDisconnect)); + //---TRK------------------------------------------------------ + // Command: 0x80 Acknowledge + // Error: 0x00 +} + +void Launcher::disconnectTrk() +{ + d->m_device->sendTrkMessage(TrkDisconnect, TrkCallback(this, &Launcher::handleWaitForFinished)); +} + +void Launcher::copyFileToRemote() +{ + emit copyingStarted(); + QByteArray ba; + ba.append(char(10)); + appendString(&ba, d->m_copyState.destinationFileName.toLocal8Bit(), TargetByteOrder, false); + d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba); +} + +void Launcher::installRemotePackageSilently() +{ + emit installingStarted(); + QByteArray ba; + ba.append('C'); + appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false); + d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba); +} + +void Launcher::handleInstallPackageFinished(const TrkResult &result) +{ + if (result.errorCode()) { + emit canNotInstall(d->m_installFileName, result.errorString()); + disconnectTrk(); + return; + } else { + emit installingFinished(); + } + if (d->m_startupActions & ActionRun) { + startInferiorIfNeeded(); + } else { + disconnectTrk(); + } +} + +QByteArray Launcher::startProcessMessage(const QString &executable, + const QStringList &arguments) +{ + // It's not started yet + QByteArray ba; + appendShort(&ba, 0, TargetByteOrder); // create new process + ba.append(char(0)); // options - currently unused + if(arguments.isEmpty()) { + appendString(&ba, executable.toLocal8Bit(), TargetByteOrder); + return ba; + } + // Append full command line as one string (leading length information). + QByteArray commandLineBa; + commandLineBa.append(executable.toLocal8Bit()); + commandLineBa.append('\0'); + commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit()); + appendString(&ba, commandLineBa, TargetByteOrder); + return ba; +} + +void Launcher::startInferiorIfNeeded() +{ + emit startingApplication(); + if (d->m_session.pid != 0) { + logMessage("Process already 'started'"); + return; + } + d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), + startProcessMessage(d->m_fileName, d->m_commandLineArgs)); // Create Item +} + +void Launcher::resumeProcess(uint pid, uint tid) +{ + QByteArray ba; + appendInt(&ba, pid, BigEndian); + appendInt(&ba, tid, BigEndian); + d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE"); +} +} // namespace trk diff --git a/tools/runonphone/symbianutils/launcher.h b/tools/runonphone/symbianutils/launcher.h new file mode 100644 index 0000000..2b23fd8 --- /dev/null +++ b/tools/runonphone/symbianutils/launcher.h @@ -0,0 +1,179 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications 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 LAUNCHER_H +#define LAUNCHER_H + +#include "trkdevice.h" + +#include +#include +#include + +namespace trk { + +struct TrkResult; +struct TrkMessage; +struct LauncherPrivate; + +typedef QSharedPointer TrkDevicePtr; + +class SYMBIANUTILS_EXPORT Launcher : public QObject +{ + Q_OBJECT + Q_DISABLE_COPY(Launcher) +public: + typedef void (Launcher::*TrkCallBack)(const TrkResult &); + + enum Actions { + ActionPingOnly = 0x0, + ActionCopy = 0x1, + ActionInstall = 0x2, + ActionCopyInstall = ActionCopy | ActionInstall, + ActionRun = 0x4, + ActionCopyRun = ActionCopy | ActionRun, + ActionInstallRun = ActionInstall | ActionRun, + ActionCopyInstallRun = ActionCopy | ActionInstall | ActionRun + }; + + enum State { Disconnected, Connecting, Connected, + WaitingForTrk, // This occurs only if the initial ping times out after + // a reasonable timeout, indicating that Trk is not + // running. Note that this will never happen with + // Bluetooth as communication immediately starts + // after connecting. + DeviceDescriptionReceived }; + + explicit Launcher(trk::Launcher::Actions startupActions = trk::Launcher::ActionPingOnly, + const TrkDevicePtr &trkDevice = TrkDevicePtr(), + QObject *parent = 0); + ~Launcher(); + + State state() const; + + void addStartupActions(trk::Launcher::Actions startupActions); + void setTrkServerName(const QString &name); + QString trkServerName() const; + void setFileName(const QString &name); + void setCopyFileName(const QString &srcName, const QString &dstName); + void setInstallFileName(const QString &name); + void setCommandLineArgs(const QStringList &args); + bool startServer(QString *errorMessage); + void setVerbose(int v); + void setSerialFrame(bool b); + bool serialFrame() const; + // Close device or leave it open + bool closeDevice() const; + void setCloseDevice(bool c); + + TrkDevicePtr trkDevice() const; + + // becomes valid after successful execution of ActionPingOnly + QString deviceDescription(unsigned verbose = 0u) const; + + static QByteArray startProcessMessage(const QString &executable, + const QStringList &arguments); + // Parse a TrkNotifyStopped message + static bool parseNotifyStopped(const QByteArray &a, + uint *pid, uint *tid, uint *address, + QString *why = 0); + // Helper message + static QString msgStopped(uint pid, uint tid, uint address, const QString &why); + +signals: + void copyingStarted(); + void canNotConnect(const QString &errorMessage); + void canNotCreateFile(const QString &filename, const QString &errorMessage); + void canNotWriteFile(const QString &filename, const QString &errorMessage); + void canNotCloseFile(const QString &filename, const QString &errorMessage); + void installingStarted(); + void canNotInstall(const QString &packageFilename, const QString &errorMessage); + void installingFinished(); + void startingApplication(); + void applicationRunning(uint pid); + void canNotRun(const QString &errorMessage); + void finished(); + void applicationOutputReceived(const QString &output); + void copyProgress(int percent); + void stateChanged(int); + void processStopped(uint pc, uint pid, uint tid, const QString& reason); + +public slots: + void terminate(); + void resumeProcess(uint pid, uint tid); + +private slots: + void handleResult(const trk::TrkResult &data); + void slotWaitingForTrk(); + +private: + // kill process and breakpoints + void cleanUp(); + void disconnectTrk(); + + void handleRemoteProcessKilled(const TrkResult &result); + void handleConnect(const TrkResult &result); + void handleFileCreation(const TrkResult &result); + void handleCopy(const TrkResult &result); + void continueCopying(uint lastCopiedBlockSize = 0); + void closeRemoteFile(bool failed = false); + void handleFileCopied(const TrkResult &result); + void handleInstallPackageFinished(const TrkResult &result); + void handleCpuType(const TrkResult &result); + void handleCreateProcess(const TrkResult &result); + void handleWaitForFinished(const TrkResult &result); + void handleStop(const TrkResult &result); + void handleSupportMask(const TrkResult &result); + void handleTrkVersion(const TrkResult &result); + + void copyFileToRemote(); + void installRemotePackageSilently(); + void startInferiorIfNeeded(); + + void logMessage(const QString &msg); + void setState(State s); + + LauncherPrivate *d; +}; + +} // namespace Trk + +#endif // LAUNCHER_H diff --git a/tools/runonphone/symbianutils/symbianutils.pri b/tools/runonphone/symbianutils/symbianutils.pri new file mode 100644 index 0000000..a54df76 --- /dev/null +++ b/tools/runonphone/symbianutils/symbianutils.pri @@ -0,0 +1,25 @@ +INCLUDEPATH *= $$PWD + +# Input +HEADERS += $$PWD/symbianutils_global.h \ + $$PWD/callback.h \ + $$PWD/trkutils.h \ + $$PWD/trkutils_p.h \ + $$PWD/trkdevice.h \ + $$PWD/launcher.h \ + $$PWD/bluetoothlistener.h \ + $$PWD/communicationstarter.h + +SOURCES += $$PWD/trkutils.cpp \ + $$PWD/trkdevice.cpp \ + $$PWD/launcher.cpp \ + $$PWD/bluetoothlistener.cpp \ + $$PWD/communicationstarter.cpp + +# Tests/trklauncher is a console application +contains(QT, gui) { + HEADERS += $$PWD/bluetoothlistener_gui.h + SOURCES += $$PWD/bluetoothlistener_gui.cpp +} else { + message(Trk: Console ...) +} diff --git a/tools/runonphone/symbianutils/symbianutils_global.h b/tools/runonphone/symbianutils/symbianutils_global.h new file mode 100644 index 0000000..a6ffbe7 --- /dev/null +++ b/tools/runonphone/symbianutils/symbianutils_global.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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 tools applications 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 SYMBIANUTILS_GLOBAL_H +#define SYMBIANUTILS_GLOBAL_H + +#include + +#if defined(SYMBIANUTILS_BUILD_LIB) +# define SYMBIANUTILS_EXPORT Q_DECL_EXPORT +#elif defined(SYMBIANUTILS_BUILD_STATIC_LIB) || defined(SYMBIANUTILS_INCLUDE_PRI) +# define SYMBIANUTILS_EXPORT +#else +# define SYMBIANUTILS_EXPORT Q_DECL_IMPORT +#endif + +#endif // SYMBIANUTILS_GLOBAL_H diff --git a/tools/runonphone/symbianutils/trkdevice.cpp b/tools/runonphone/symbianutils/trkdevice.cpp new file mode 100644 index 0000000..d587135 --- /dev/null +++ b/tools/runonphone/symbianutils/trkdevice.cpp @@ -0,0 +1,1105 @@ +/**************************************************************************** +** +** 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 tools applications 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 "trkdevice.h" +#include "trkutils.h" +#include "trkutils_p.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_WIN +# include +#else +# include + +# include +# include +# include +# include +# include +# include +# include +/* Required headers for select() according to POSIX.1-2001 */ +# include +/* Required headers for select() according to earlier standards: + #include + #include + #include +*/ +#endif + +#ifdef Q_OS_WIN + +// Format windows error from GetLastError() value: +// TODO: Use the one provided by the utils lib. +QString winErrorMessage(unsigned long error) +{ + QString rc = QString::fromLatin1("#%1: ").arg(error); + ushort *lpMsgBuf; + + const int len = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL); + if (len) { + rc = QString::fromUtf16(lpMsgBuf, len); + LocalFree(lpMsgBuf); + } else { + rc += QString::fromLatin1(""); + } + return rc; +} + +#endif + +enum { verboseTrk = 0 }; + +namespace trk { + +/////////////////////////////////////////////////////////////////////// +// +// TrkMessage +// +/////////////////////////////////////////////////////////////////////// + +/* A message to be send to TRK, triggering a callback on receipt + * of the answer. */ +struct TrkMessage +{ + explicit TrkMessage(byte code = 0u, byte token = 0u, + TrkCallback callback = TrkCallback()); + + byte code; + byte token; + QByteArray data; + QVariant cookie; + TrkCallback callback; +}; + +TrkMessage::TrkMessage(byte c, byte t, TrkCallback cb) : + code(c), + token(t), + callback(cb) +{ +} + +QDebug operator<<(QDebug d, const TrkMessage &msg) +{ + return d << "Message: Code: " << msg.code + << " Token: " << msg.token << " " << msg.data.toHex(); +} + +} // namespace trk + +Q_DECLARE_METATYPE(trk::TrkMessage) +Q_DECLARE_METATYPE(trk::TrkResult) + +namespace trk { + +/////////////////////////////////////////////////////////////////////// +// +// TrkWriteQueue: Mixin class that manages a write queue of Trk messages. +// pendingMessage()/notifyWriteResult() should be called from a worked/timer +// that writes the messages. The class does not take precautions for multithreading. +// A no-op message is simply taken off the queue. The calling class +// can use the helper invokeNoopMessage() to trigger its callback. +// +/////////////////////////////////////////////////////////////////////// + +class TrkWriteQueue +{ + Q_DISABLE_COPY(TrkWriteQueue) +public: + explicit TrkWriteQueue(); + + // Enqueue messages. + void queueTrkMessage(byte code, TrkCallback callback, + const QByteArray &data, const QVariant &cookie); + void queueTrkInitialPing(); + + // Call this from the device read notification with the results. + void slotHandleResult(const TrkResult &result, QMutex *mutex = 0); + + // pendingMessage() can be called periodically in a timer to retrieve + // the pending messages to be sent. + enum PendingMessageResult { + NoMessage, // No message in queue. + PendingMessage, /* There is a queued message. The calling class + * can write it out and use notifyWriteResult() + * to notify about the result. */ + NoopMessageDequeued // A no-op message has been dequeued. see invokeNoopMessage(). + }; + + PendingMessageResult pendingMessage(TrkMessage *message); + // Notify the queue about the success of the write operation + // after taking the pendingMessage off. + enum WriteResult { + WriteOk, + WriteFailedDiscard, // Discard failed message + WriteFailedKeep, // Keep failed message + }; + void notifyWriteResult(WriteResult ok); + + // Helper function that invokes the callback of a no-op message + static void invokeNoopMessage(trk::TrkMessage); + +private: + typedef QMap TokenMessageMap; + + byte nextTrkWriteToken(); + + byte m_trkWriteToken; + QQueue m_trkWriteQueue; + TokenMessageMap m_writtenTrkMessages; + bool m_trkWriteBusy; +}; + +TrkWriteQueue::TrkWriteQueue() : + m_trkWriteToken(0), + m_trkWriteBusy(false) +{ +} + +byte TrkWriteQueue::nextTrkWriteToken() +{ + ++m_trkWriteToken; + if (m_trkWriteToken == 0) + ++m_trkWriteToken; + if (verboseTrk) + qDebug() << "Write token: " << m_trkWriteToken; + return m_trkWriteToken; +} + +void TrkWriteQueue::queueTrkMessage(byte code, TrkCallback callback, + const QByteArray &data, const QVariant &cookie) +{ + const byte token = code == TRK_WRITE_QUEUE_NOOP_CODE ? + byte(0) : nextTrkWriteToken(); + TrkMessage msg(code, token, callback); + msg.data = data; + msg.cookie = cookie; + m_trkWriteQueue.append(msg); +} + +TrkWriteQueue::PendingMessageResult TrkWriteQueue::pendingMessage(TrkMessage *message) +{ + // Invoked from timer, try to flush out message queue + if (m_trkWriteBusy || m_trkWriteQueue.isEmpty()) + return NoMessage; + // Handle the noop message, just invoke CB in slot (ower thread) + if (m_trkWriteQueue.front().code == TRK_WRITE_QUEUE_NOOP_CODE) { + *message = m_trkWriteQueue.dequeue(); + return NoopMessageDequeued; + } + // Insert into map fir answers (as reading threads might get an + // answer before notifyWriteResult(true)) is called. + *message = m_trkWriteQueue.front(); + m_writtenTrkMessages.insert(message->token, *message); + m_trkWriteBusy = true; + return PendingMessage; +} + +void TrkWriteQueue::invokeNoopMessage(trk::TrkMessage noopMessage) +{ + TrkResult result; + result.code = noopMessage.code; + result.token = noopMessage.token; + result.data = noopMessage.data; + result.cookie = noopMessage.cookie; + noopMessage.callback(result); +} + +void TrkWriteQueue::notifyWriteResult(WriteResult wr) +{ + // On success, dequeue message and await result + const byte token = m_trkWriteQueue.front().token; + switch (wr) { + case WriteOk: + m_trkWriteQueue.dequeue(); + break; + case WriteFailedKeep: + case WriteFailedDiscard: + m_writtenTrkMessages.remove(token); + m_trkWriteBusy = false; + if (wr == WriteFailedDiscard) + m_trkWriteQueue.dequeue(); + break; + } +} + +void TrkWriteQueue::slotHandleResult(const TrkResult &result, QMutex *mutex) +{ + // Find which request the message belongs to and invoke callback + // if ACK or on NAK if desired. + if (mutex) + mutex->lock(); + m_trkWriteBusy = false; + const TokenMessageMap::iterator it = m_writtenTrkMessages.find(result.token); + if (it == m_writtenTrkMessages.end()) { + if (mutex) + mutex->unlock(); + return; + } + TrkCallback callback = it.value().callback; + const QVariant cookie = it.value().cookie; + m_writtenTrkMessages.erase(it); + if (mutex) + mutex->unlock(); + // Invoke callback + if (callback) { + TrkResult result1 = result; + result1.cookie = cookie; + callback(result1); + } +} + +void TrkWriteQueue::queueTrkInitialPing() +{ + // Ping, reset sequence count + m_trkWriteToken = 0; + m_trkWriteQueue.append(TrkMessage(TrkPing, 0)); +} + +/////////////////////////////////////////////////////////////////////// +// +// DeviceContext to be shared between threads +// +/////////////////////////////////////////////////////////////////////// + +struct DeviceContext { + DeviceContext(); +#ifdef Q_OS_WIN + HANDLE device; + OVERLAPPED readOverlapped; + OVERLAPPED writeOverlapped; +#else + QFile file; +#endif + bool serialFrame; + QMutex mutex; +}; + +DeviceContext::DeviceContext() : +#ifdef Q_OS_WIN + device(INVALID_HANDLE_VALUE), +#endif + serialFrame(true) +{ +} + +/////////////////////////////////////////////////////////////////////// +// +// TrkWriterThread: A thread operating a TrkWriteQueue. +// with exception of the handling of the TRK_WRITE_QUEUE_NOOP_CODE +// synchronization message. The invocation of the callback is then +// done by the thread owning the TrkWriteQueue, while pendingMessage() is called +// from another thread. This happens via a Qt::BlockingQueuedConnection. + +/////////////////////////////////////////////////////////////////////// + +class WriterThread : public QThread +{ + Q_OBJECT + Q_DISABLE_COPY(WriterThread) +public: + explicit WriterThread(const QSharedPointer &context); + + // Enqueue messages. + void queueTrkMessage(byte code, TrkCallback callback, + const QByteArray &data, const QVariant &cookie); + void queueTrkInitialPing(); + + // Call this from the device read notification with the results. + void slotHandleResult(const TrkResult &result); + + virtual void run(); + +signals: + void error(const QString &); + void internalNoopMessageDequeued(const trk::TrkMessage&); + +public slots: + bool trkWriteRawMessage(const TrkMessage &msg); + void terminate(); + void tryWrite(); + +private slots: + void invokeNoopMessage(const trk::TrkMessage &); + +private: + bool write(const QByteArray &data, QString *errorMessage); + inline int writePendingMessage(); + + const QSharedPointer m_context; + QMutex m_dataMutex; + QMutex m_waitMutex; + QWaitCondition m_waitCondition; + TrkWriteQueue m_queue; + bool m_terminate; +}; + +WriterThread::WriterThread(const QSharedPointer &context) : + m_context(context), + m_terminate(false) +{ + static const int trkMessageMetaId = qRegisterMetaType(); + Q_UNUSED(trkMessageMetaId) + connect(this, SIGNAL(internalNoopMessageDequeued(trk::TrkMessage)), + this, SLOT(invokeNoopMessage(trk::TrkMessage)), Qt::BlockingQueuedConnection); +} + +void WriterThread::run() +{ + while (writePendingMessage() == 0) ; +} + +int WriterThread::writePendingMessage() +{ + enum { MaxAttempts = 100, RetryIntervalMS = 200 }; + + // Wait. Use a timeout in case something is already queued before we + // start up or some weird hanging exit condition + m_waitMutex.lock(); + m_waitCondition.wait(&m_waitMutex, 100); + m_waitMutex.unlock(); + if (m_terminate) + return 1; + + // Send off message + m_dataMutex.lock(); + TrkMessage message; + const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message); + m_dataMutex.unlock(); + + switch (pr) { + case TrkWriteQueue::NoMessage: + break; + case TrkWriteQueue::PendingMessage: { + //qDebug() << "Write pending message " << message; + // Untested: try to re-send a few times + bool success = false; + for (int r = 0; !success && (r < MaxAttempts); r++) { + success = trkWriteRawMessage(message); + if (!success) { + emit error(QString::fromLatin1("Write failure, attempt %1 of %2.").arg(r).arg(int(MaxAttempts))); + if (m_terminate) + return 1; + QThread::msleep(RetryIntervalMS); + } + } + // Notify queue. If still failed, give up. + m_dataMutex.lock(); + m_queue.notifyWriteResult(success ? TrkWriteQueue::WriteOk : TrkWriteQueue::WriteFailedDiscard); + m_dataMutex.unlock(); + } + break; + case TrkWriteQueue::NoopMessageDequeued: + // Sync with thread that owns us via a blocking signal + if (verboseTrk) + qDebug() << "Noop message dequeued" << message; + emit internalNoopMessageDequeued(message); + break; + } // switch + return 0; +} + +void WriterThread::invokeNoopMessage(const trk::TrkMessage &msg) +{ + TrkWriteQueue::invokeNoopMessage(msg); +} + +void WriterThread::terminate() +{ + m_terminate = true; + m_waitCondition.wakeAll(); + wait(); + m_terminate = false; +} + +#ifdef Q_OS_WIN + +static inline QString msgTerminated(int size) +{ + return QString::fromLatin1("Terminated with %1 bytes pending.").arg(size); +} + +// Interruptible synchronous write function. +static inline bool overlappedSyncWrite(HANDLE file, + const bool &terminateFlag, + const char *data, + DWORD size, DWORD *charsWritten, + OVERLAPPED *overlapped, + QString *errorMessage) +{ + if (WriteFile(file, data, size, charsWritten, overlapped)) + return true; + const DWORD writeError = GetLastError(); + if (writeError != ERROR_IO_PENDING) { + *errorMessage = QString::fromLatin1("WriteFile failed: %1").arg(winErrorMessage(writeError)); + return false; + } + // Wait for written or thread terminated + const DWORD timeoutMS = 200; + const unsigned maxAttempts = 20; + DWORD wr = WaitForSingleObject(overlapped->hEvent, timeoutMS); + for (unsigned n = 0; wr == WAIT_TIMEOUT && n < maxAttempts && !terminateFlag; + wr = WaitForSingleObject(overlapped->hEvent, timeoutMS), n++); + if (terminateFlag) { + *errorMessage = msgTerminated(size); + return false; + } + switch (wr) { + case WAIT_OBJECT_0: + break; + case WAIT_TIMEOUT: + *errorMessage = QString::fromLatin1("Write timed out."); + return false; + default: + *errorMessage = QString::fromLatin1("Error while waiting for WriteFile results: %1").arg(winErrorMessage(GetLastError())); + return false; + } + if (!GetOverlappedResult(file, overlapped, charsWritten, TRUE)) { + *errorMessage = QString::fromLatin1("Error writing %1 bytes: %2").arg(size).arg(winErrorMessage(GetLastError())); + return false; + } + return true; +} +#endif + +bool WriterThread::write(const QByteArray &data, QString *errorMessage) +{ + if (verboseTrk) + qDebug() << "Write raw data: " << stringFromArray(data).toLatin1(); + QMutexLocker locker(&m_context->mutex); +#ifdef Q_OS_WIN + DWORD charsWritten; + if (!overlappedSyncWrite(m_context->device, m_terminate, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped, errorMessage)) { + return false; + } + FlushFileBuffers(m_context->device); + return true; +#else + if (m_context->file.write(data) == -1 || !m_context->file.flush()) { + *errorMessage = QString::fromLatin1("Cannot write: %1").arg(m_context->file.errorString()); + return false; + } + return true; +#endif +} + +bool WriterThread::trkWriteRawMessage(const TrkMessage &msg) +{ + const QByteArray ba = frameMessage(msg.code, msg.token, msg.data, m_context->serialFrame); + QString errorMessage; + const bool rc = write(ba, &errorMessage); + if (!rc) { + qWarning("%s\n", qPrintable(errorMessage)); + emit error(errorMessage); + } + return rc; +} + +void WriterThread::tryWrite() +{ + m_waitCondition.wakeAll(); +} + +void WriterThread::queueTrkMessage(byte code, TrkCallback callback, + const QByteArray &data, const QVariant &cookie) +{ + m_dataMutex.lock(); + m_queue.queueTrkMessage(code, callback, data, cookie); + m_dataMutex.unlock(); + tryWrite(); +} + +void WriterThread::queueTrkInitialPing() +{ + m_dataMutex.lock(); + m_queue.queueTrkInitialPing(); + m_dataMutex.unlock(); + tryWrite(); +} + +// Call this from the device read notification with the results. +void WriterThread::slotHandleResult(const TrkResult &result) +{ + m_queue.slotHandleResult(result, &m_dataMutex); + tryWrite(); // Have messages been enqueued in-between? +} + + +/////////////////////////////////////////////////////////////////////// +// +// ReaderThreadBase: Base class for a thread that reads data from +// the device, decodes the messages and emit signals for the messages. +// A Qt::BlockingQueuedConnection should be used for the message signal +// to ensure messages are processed in the correct sequence. +// +/////////////////////////////////////////////////////////////////////// + +class ReaderThreadBase : public QThread +{ + Q_OBJECT + Q_DISABLE_COPY(ReaderThreadBase) +public: + +signals: + void messageReceived(const trk::TrkResult &result, const QByteArray &rawData); + +protected: + explicit ReaderThreadBase(const QSharedPointer &context); + void processData(const QByteArray &a); + void processData(char c); + + const QSharedPointer m_context; + +private: + void readMessages(); + + QByteArray m_trkReadBuffer; +}; + +ReaderThreadBase::ReaderThreadBase(const QSharedPointer &context) : + m_context(context) +{ + static const int trkResultMetaId = qRegisterMetaType(); + Q_UNUSED(trkResultMetaId) +} + +void ReaderThreadBase::processData(const QByteArray &a) +{ + m_trkReadBuffer += a; + readMessages(); +} + +void ReaderThreadBase::processData(char c) +{ + m_trkReadBuffer += c; + if (m_trkReadBuffer.size() > 1) + readMessages(); +} + +void ReaderThreadBase::readMessages() +{ + TrkResult r; + QByteArray rawData; + while (extractResult(&m_trkReadBuffer, m_context->serialFrame, &r, &rawData)) { + emit messageReceived(r, rawData); + } +} + +#ifdef Q_OS_WIN +/////////////////////////////////////////////////////////////////////// +// +// WinReaderThread: A thread reading from the device using Windows API. +// Waits on an overlapped I/O handle and an event that tells the thread to +// terminate. +// +/////////////////////////////////////////////////////////////////////// + +class WinReaderThread : public ReaderThreadBase +{ + Q_OBJECT + Q_DISABLE_COPY(WinReaderThread) +public: + explicit WinReaderThread(const QSharedPointer &context); + ~WinReaderThread(); + + virtual void run(); + +signals: + void error(const QString &); + +public slots: + void terminate(); + +private: + enum Handles { FileHandle, TerminateEventHandle, HandleCount }; + + inline int tryRead(); + + HANDLE m_handles[HandleCount]; +}; + +WinReaderThread::WinReaderThread(const QSharedPointer &context) : + ReaderThreadBase(context) +{ + m_handles[FileHandle] = NULL; + m_handles[TerminateEventHandle] = CreateEvent(NULL, FALSE, FALSE, NULL); +} + +WinReaderThread::~WinReaderThread() +{ + CloseHandle(m_handles[TerminateEventHandle]); +} + +// Return 0 to continue or error code +int WinReaderThread::tryRead() +{ + enum { BufSize = 1024 }; + char buffer[BufSize]; + // Check if there are already bytes waiting. If not, wait for first byte + COMSTAT comStat; + if (!ClearCommError(m_context->device, NULL, &comStat)){ + emit error(QString::fromLatin1("ClearCommError failed: %1").arg(winErrorMessage(GetLastError()))); + return -7; + } + const DWORD bytesToRead = qMax(DWORD(1), qMin(comStat.cbInQue, DWORD(BufSize))); + // Trigger read + DWORD bytesRead = 0; + if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped)) { + if (bytesRead == 1) { + processData(buffer[0]); + } else { + processData(QByteArray(buffer, bytesRead)); + } + return 0; + } + const DWORD readError = GetLastError(); + if (readError != ERROR_IO_PENDING) { + emit error(QString::fromLatin1("Read error: %1").arg(winErrorMessage(readError))); + return -1; + } + // Wait for either termination or data + const DWORD wr = WaitForMultipleObjects(HandleCount, m_handles, false, INFINITE); + if (wr == WAIT_FAILED) { + emit error(QString::fromLatin1("Wait failed: %1").arg(winErrorMessage(GetLastError()))); + return -2; + } + if (wr - WAIT_OBJECT_0 == TerminateEventHandle) { + return 1; // Terminate + } + // Check data + if (!GetOverlappedResult(m_context->device, &m_context->readOverlapped, &bytesRead, true)) { + emit error(QString::fromLatin1("GetOverlappedResult failed: %1").arg(winErrorMessage(GetLastError()))); + return -3; + } + if (bytesRead == 1) { + processData(buffer[0]); + } else { + processData(QByteArray(buffer, bytesRead)); + } + return 0; +} + +void WinReaderThread::run() +{ + m_handles[FileHandle] = m_context->readOverlapped.hEvent; + while ( tryRead() == 0) ; +} + +void WinReaderThread::terminate() +{ + SetEvent(m_handles[TerminateEventHandle]); + wait(); +} + +typedef WinReaderThread ReaderThread; + +#else + +/////////////////////////////////////////////////////////////////////// +// +// UnixReaderThread: A thread reading from the device. +// Uses select() to wait and a special ioctl() to find out the number +// of bytes queued. For clean termination, the self-pipe trick is used. +// The class maintains a pipe, on whose read end the select waits besides +// the device file handle. To terminate, a byte is written to the pipe. +// +/////////////////////////////////////////////////////////////////////// + +static inline QString msgUnixCallFailedErrno(const char *func, int errorNumber) +{ + return QString::fromLatin1("Call to %1() failed: %2").arg(QLatin1String(func), QString::fromLocal8Bit(strerror(errorNumber))); +} + +class UnixReaderThread : public ReaderThreadBase { + Q_OBJECT + Q_DISABLE_COPY(UnixReaderThread) +public: + explicit UnixReaderThread(const QSharedPointer &context); + ~UnixReaderThread(); + + virtual void run(); + +signals: + void error(const QString &); + +public slots: + void terminate(); + +private: + inline int tryRead(); + + int m_terminatePipeFileDescriptors[2]; +}; + +UnixReaderThread::UnixReaderThread(const QSharedPointer &context) : + ReaderThreadBase(context) +{ + m_terminatePipeFileDescriptors[0] = m_terminatePipeFileDescriptors[1] = -1; + // Set up pipes for termination. Should not fail + if (pipe(m_terminatePipeFileDescriptors) < 0) + qWarning("%s\n", qPrintable(msgUnixCallFailedErrno("pipe", errno))); +} + +UnixReaderThread::~UnixReaderThread() +{ + close(m_terminatePipeFileDescriptors[0]); + close(m_terminatePipeFileDescriptors[1]); +} + +int UnixReaderThread::tryRead() +{ + fd_set readSet, tempReadSet, tempExceptionSet; + struct timeval timeOut; + const int fileDescriptor = m_context->file.handle(); + FD_ZERO(&readSet); + FD_SET(fileDescriptor, &readSet); + FD_SET(m_terminatePipeFileDescriptors[0], &readSet); + const int maxFileDescriptor = qMax(m_terminatePipeFileDescriptors[0], fileDescriptor); + int result = 0; + do { + memcpy(&tempReadSet, &readSet, sizeof(fd_set)); + memcpy(&tempExceptionSet, &readSet, sizeof(fd_set)); + timeOut.tv_sec = 1; + timeOut.tv_usec = 0; + result = select(maxFileDescriptor + 1, &tempReadSet, NULL, &tempExceptionSet, &timeOut); + } while ( result < 0 && errno == EINTR ); + // Timeout? + if (result == 0) + return 0; + // Something wrong? + if (result < 0) { + emit error(msgUnixCallFailedErrno("select", errno)); + return -1; + } + // Did the exception set trigger on the device? + if (FD_ISSET(fileDescriptor,&tempExceptionSet)) { + emit error(QLatin1String("An Exception occurred on the device.")); + return -2; + } + // Check termination pipe. + if (FD_ISSET(m_terminatePipeFileDescriptors[0], &tempReadSet) + || FD_ISSET(m_terminatePipeFileDescriptors[0], &tempExceptionSet)) + return 1; + + // determine number of pending bytes and read + int numBytes; + if (ioctl(fileDescriptor, FIONREAD, &numBytes) < 0) { + emit error(msgUnixCallFailedErrno("ioctl", errno)); + return -1; + } + m_context->mutex.lock(); + const QByteArray data = m_context->file.read(numBytes); + m_context->mutex.unlock(); + processData(data); + return 0; +} + +void UnixReaderThread::run() +{ + // Read loop + while (tryRead() == 0) + ; +} + +void UnixReaderThread::terminate() +{ + // Trigger select() by writing to the pipe + char c = 0; + const int written = write(m_terminatePipeFileDescriptors[1], &c, 1); + Q_UNUSED(written) + wait(); +} + +typedef UnixReaderThread ReaderThread; + +#endif + +/////////////////////////////////////////////////////////////////////// +// +// TrkDevicePrivate +// +/////////////////////////////////////////////////////////////////////// + +struct TrkDevicePrivate +{ + TrkDevicePrivate(); + + QSharedPointer deviceContext; + QSharedPointer writerThread; + QSharedPointer readerThread; + + QByteArray trkReadBuffer; + int verbose; + QString errorString; +}; + +/////////////////////////////////////////////////////////////////////// +// +// TrkDevice +// +/////////////////////////////////////////////////////////////////////// + +TrkDevicePrivate::TrkDevicePrivate() : + deviceContext(new DeviceContext), + verbose(0) +{ +} + +/////////////////////////////////////////////////////////////////////// +// +// TrkDevice +// +/////////////////////////////////////////////////////////////////////// + +TrkDevice::TrkDevice(QObject *parent) : + QObject(parent), + d(new TrkDevicePrivate) +{} + +TrkDevice::~TrkDevice() +{ + close(); + delete d; +} + +bool TrkDevice::open(const QString &port, QString *errorMessage) +{ + if (d->verbose) + qDebug() << "Opening" << port << "is open: " << isOpen() << " serialFrame=" << serialFrame(); + close(); +#ifdef Q_OS_WIN + d->deviceContext->device = CreateFile(QString("\\\\.\\").append(port).toStdWString().c_str(), + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING|FILE_FLAG_OVERLAPPED, + NULL); + + if (INVALID_HANDLE_VALUE == d->deviceContext->device) { + *errorMessage = QString::fromLatin1("Could not open device '%1': %2").arg(port, winErrorMessage(GetLastError())); + return false; + } + memset(&d->deviceContext->readOverlapped, 0, sizeof(OVERLAPPED)); + d->deviceContext->readOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + memset(&d->deviceContext->writeOverlapped, 0, sizeof(OVERLAPPED)); + d->deviceContext->writeOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + if (d->deviceContext->readOverlapped.hEvent == NULL || d->deviceContext->writeOverlapped.hEvent == NULL) { + *errorMessage = QString::fromLatin1("Failed to create events: %1").arg(winErrorMessage(GetLastError())); + return false; + } +#else + d->deviceContext->file.setFileName(port); + if (!d->deviceContext->file.open(QIODevice::ReadWrite|QIODevice::Unbuffered)) { + *errorMessage = QString::fromLatin1("Cannot open %1: %2").arg(port, d->deviceContext->file.errorString()); + return false; + } + + struct termios termInfo; + if (tcgetattr(d->deviceContext->file.handle(), &termInfo) < 0) { + *errorMessage = QString::fromLatin1("Unable to retrieve terminal settings: %1 %2").arg(errno).arg(QString::fromAscii(strerror(errno))); + return false; + } + // Turn off terminal echo as not get messages back, among other things + termInfo.c_cflag |= CREAD|CLOCAL; + termInfo.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); + termInfo.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); + termInfo.c_oflag &= (~OPOST); + termInfo.c_cc[VMIN] = 0; + termInfo.c_cc[VINTR] = _POSIX_VDISABLE; + termInfo.c_cc[VQUIT] = _POSIX_VDISABLE; + termInfo.c_cc[VSTART] = _POSIX_VDISABLE; + termInfo.c_cc[VSTOP] = _POSIX_VDISABLE; + termInfo.c_cc[VSUSP] = _POSIX_VDISABLE; + if (tcsetattr(d->deviceContext->file.handle(), TCSAFLUSH, &termInfo) < 0) { + *errorMessage = QString::fromLatin1("Unable to apply terminal settings: %1 %2").arg(errno).arg(QString::fromAscii(strerror(errno))); + return false; + } +#endif + d->readerThread = QSharedPointer(new ReaderThread(d->deviceContext)); + connect(d->readerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)), + Qt::QueuedConnection); + connect(d->readerThread.data(), SIGNAL(messageReceived(trk::TrkResult,QByteArray)), + this, SLOT(slotMessageReceived(trk::TrkResult,QByteArray)), + Qt::QueuedConnection); + d->readerThread->start(); + + d->writerThread = QSharedPointer(new WriterThread(d->deviceContext)); + connect(d->writerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)), + Qt::QueuedConnection); + d->writerThread->start(); + + if (d->verbose) + qDebug() << "Opened" << port; + return true; +} + +void TrkDevice::close() +{ + if (!isOpen()) + return; + if (d->readerThread) + d->readerThread->terminate(); + if (d->writerThread) + d->writerThread->terminate(); +#ifdef Q_OS_WIN + CloseHandle(d->deviceContext->device); + d->deviceContext->device = INVALID_HANDLE_VALUE; + CloseHandle(d->deviceContext->readOverlapped.hEvent); + CloseHandle(d->deviceContext->writeOverlapped.hEvent); + d->deviceContext->readOverlapped.hEvent = d->deviceContext->writeOverlapped.hEvent = NULL; +#else + d->deviceContext->file.close(); +#endif + if (d->verbose) + emitLogMessage("Close"); +} + +bool TrkDevice::isOpen() const +{ +#ifdef Q_OS_WIN + return d->deviceContext->device != INVALID_HANDLE_VALUE; +#else + return d->deviceContext->file.isOpen(); +#endif +} + +QString TrkDevice::errorString() const +{ + return d->errorString; +} + +bool TrkDevice::serialFrame() const +{ + return d->deviceContext->serialFrame; +} + +void TrkDevice::setSerialFrame(bool f) +{ + d->deviceContext->serialFrame = f; +} + +int TrkDevice::verbose() const +{ + return d->verbose; +} + +void TrkDevice::setVerbose(int b) +{ + d->verbose = b; +} + +void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData) +{ + d->writerThread->slotHandleResult(result); + if (d->verbose > 1) + qDebug() << "Received: " << result.toString(); + emit messageReceived(result); + if (!rawData.isEmpty()) + emit rawDataReceived(rawData); +} + +void TrkDevice::emitError(const QString &s) +{ + d->errorString = s; + qWarning("%s\n", qPrintable(s)); + emit error(s); +} + +void TrkDevice::sendTrkMessage(byte code, TrkCallback callback, + const QByteArray &data, const QVariant &cookie) +{ + if (!d->writerThread.isNull()) { + if (d->verbose > 1) { + QByteArray msg = "Sending: "; + msg += QByteArray::number(code, 16); + msg += ": "; + msg += stringFromArray(data).toLatin1(); + qDebug("%s", msg.data()); + } + d->writerThread->queueTrkMessage(code, callback, data, cookie); + } +} + +void TrkDevice::sendTrkInitialPing() +{ + if (!d->writerThread.isNull()) + d->writerThread->queueTrkInitialPing(); +} + +bool TrkDevice::sendTrkAck(byte token) +{ + if (d->writerThread.isNull()) + return false; + // The acknowledgement must not be queued! + TrkMessage msg(0x80, token); + msg.token = token; + msg.data.append('\0'); + if (verboseTrk) + qDebug() << "Write synchroneous message: " << msg; + return d->writerThread->trkWriteRawMessage(msg); + // 01 90 00 07 7e 80 01 00 7d 5e 7e +} + +void TrkDevice::emitLogMessage(const QString &msg) +{ + if (d->verbose) + qDebug("%s\n", qPrintable(msg)); + emit logMessage(msg); +} + +} // namespace trk + +#include "trkdevice.moc" diff --git a/tools/runonphone/symbianutils/trkdevice.h b/tools/runonphone/symbianutils/trkdevice.h new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/tools/runonphone/symbianutils/trkdevice.h @@ -0,0 +1,134 @@ +/**************************************************************************** +** +** 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 tools applications 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 TRKDEVICE_H +#define TRKDEVICE_H + +#include "symbianutils_global.h" +#include "callback.h" + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QIODevice; +QT_END_NAMESPACE + +namespace trk { + +struct TrkResult; +struct TrkMessage; +struct TrkDevicePrivate; + +/* TrkDevice: Implements a Windows COM or Linux device for + * Trk communications. Provides synchronous write and asynchronous + * read operation. + * The serialFrames property specifies whether packets are encapsulated in + * "0x90 " frames, which is currently the case for serial ports. + * Contains a write message queue allowing + * for queueing messages with a notification callback. If the message receives + * an ACK, the callback is invoked. + * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronisation. + * The respective message will not be sent, the callback is just invoked. */ + +enum { TRK_WRITE_QUEUE_NOOP_CODE = 0x7f }; + +typedef trk::Callback TrkCallback; + +class SYMBIANUTILS_EXPORT TrkDevice : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool serialFrame READ serialFrame WRITE setSerialFrame) + Q_PROPERTY(bool verbose READ verbose WRITE setVerbose) +public: + explicit TrkDevice(QObject *parent = 0); + virtual ~TrkDevice(); + + bool open(const QString &port, QString *errorMessage); + bool isOpen() const; + + QString errorString() const; + + bool serialFrame() const; + void setSerialFrame(bool f); + + int verbose() const; + void setVerbose(int b); + + // Enqueue a message with a notification callback. + void sendTrkMessage(unsigned char code, + TrkCallback callBack = TrkCallback(), + const QByteArray &data = QByteArray(), + const QVariant &cookie = QVariant()); + + // Enqeue an initial ping + void sendTrkInitialPing(); + + // Send an Ack synchronously, bypassing the queue + bool sendTrkAck(unsigned char token); + +signals: + void messageReceived(const trk::TrkResult &result); + // Emitted with the contents of messages enclosed in 07e, not for log output + void rawDataReceived(const QByteArray &data); + void error(const QString &msg); + void logMessage(const QString &msg); + +private slots: + void slotMessageReceived(const trk::TrkResult &result, const QByteArray &a); + +protected slots: + void emitError(const QString &msg); + void emitLogMessage(const QString &msg); + +public slots: + void close(); + +private: + void readMessages(); + TrkDevicePrivate *d; +}; + +} // namespace trk + +#endif // TRKDEVICE_H diff --git a/tools/runonphone/symbianutils/trkutils.cpp b/tools/runonphone/symbianutils/trkutils.cpp new file mode 100644 index 0000000..5cce950 --- /dev/null +++ b/tools/runonphone/symbianutils/trkutils.cpp @@ -0,0 +1,479 @@ +/**************************************************************************** +** +** 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 tools applications 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 "trkutils.h" +#include + +#include +#include +#include +#include +#include + +#define logMessage(s) do { qDebug() << "TRKCLIENT: " << s; } while (0) + +namespace trk { + +TrkAppVersion::TrkAppVersion() +{ + reset(); +} + +void TrkAppVersion::reset() +{ + trkMajor = trkMinor= protocolMajor = protocolMinor = 0; +} + +Session::Session() +{ + reset(); +} + +void Session::reset() +{ + cpuMajor = 0; + cpuMinor = 0; + bigEndian = 0; + defaultTypeSize = 0; + fpTypeSize = 0; + extended1TypeSize = 0; + extended2TypeSize = 0; + pid = 0; + tid = 0; + codeseg = 0; + dataseg = 0; + + currentThread = 0; + libraries.clear(); + trkAppVersion.reset(); +} + +static QString formatCpu(int major, int minor) +{ + //: CPU description of an S60 device + //: %1 major verison, %2 minor version + //: %3 real name of major verison, %4 real name of minor version + const QString str = QCoreApplication::translate("trk::Session", "CPU: v%1.%2%3%4"); + QString majorStr; + QString minorStr; + switch (major) { + case 0x04: + majorStr = " ARM"; + break; + } + switch (minor) { + case 0x00: + minorStr = " 920T"; + break; + } + return str.arg(major).arg(minor).arg(majorStr).arg(minorStr); + } + +QString formatTrkVersion(const TrkAppVersion &version) +{ + QString str = QCoreApplication::translate("trk::Session", + "App TRK: v%1.%2 TRK protocol: v%3.%4"); + str = str.arg(version.trkMajor).arg(version.trkMinor); + return str.arg(version.protocolMajor).arg(version.protocolMinor); +} + +QString Session::deviceDescription(unsigned verbose) const +{ + if (!cpuMajor) + return QString(); + + //: s60description + //: description of an S60 device + //: %1 CPU description, %2 endianness + //: %3 default type size (if any), %4 float size (if any) + //: %5 TRK version + QString msg = QCoreApplication::translate("trk::Session", "%1, %2%3%4, %5"); + QString endianness = bigEndian + ? QCoreApplication::translate("trk::Session", "big endian") + : QCoreApplication::translate("trk::Session", "little endian"); + msg = msg.arg(formatCpu(cpuMajor, cpuMinor)).arg(endianness); + //: The separator in a list of strings + QString defaultTypeSizeStr; + QString fpTypeSizeStr; + if (verbose && defaultTypeSize) + //: will be inserted into s60description + defaultTypeSizeStr = QCoreApplication::translate("trk::Session", ", type size: %1").arg(defaultTypeSize); + if (verbose && fpTypeSize) + //: will be inserted into s60description + fpTypeSizeStr = QCoreApplication::translate("trk::Session", ", float size: %1").arg(fpTypeSize); + msg = msg.arg(defaultTypeSizeStr).arg(fpTypeSizeStr); + return msg.arg(formatTrkVersion(trkAppVersion)); +} + + +QByteArray decode7d(const QByteArray &ba) +{ + QByteArray res; + res.reserve(ba.size()); + for (int i = 0; i < ba.size(); ++i) { + byte c = byte(ba.at(i)); + if (c == 0x7d) { + ++i; + c = 0x20 ^ byte(ba.at(i)); + } + res.append(c); + } + return res; +} + +QByteArray encode7d(const QByteArray &ba) +{ + QByteArray res; + res.reserve(ba.size() + 2); + for (int i = 0; i < ba.size(); ++i) { + byte c = byte(ba.at(i)); + if (c == 0x7e || c == 0x7d) { + res.append(0x7d); + res.append(0x20 ^ c); + } else { + res.append(c); + } + } + return res; +} + +// FIXME: Use the QByteArray based version below? +static inline QString stringFromByte(byte c) +{ + return QString::fromLatin1("%1").arg(c, 2, 16, QChar('0')); +} + +SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen) +{ + QString str; + QString ascii; + const int size = maxLen == -1 ? ba.size() : qMin(ba.size(), maxLen); + for (int i = 0; i < size; ++i) { + //if (i == 5 || i == ba.size() - 2) + // str += " "; + int c = byte(ba.at(i)); + str += QString("%1 ").arg(c, 2, 16, QChar('0')); + if (i >= 8 && i < ba.size() - 2) + ascii += QChar(c).isPrint() ? QChar(c) : QChar('.'); + } + if (size != ba.size()) { + str += "..."; + ascii += "..."; + } + return str + " " + ascii; +} + +SYMBIANUTILS_EXPORT QByteArray hexNumber(uint n, int digits) +{ + QByteArray ba = QByteArray::number(n, 16); + if (digits == 0 || ba.size() == digits) + return ba; + return QByteArray(digits - ba.size(), '0') + ba; +} + +SYMBIANUTILS_EXPORT QByteArray hexxNumber(uint n, int digits) +{ + return "0x" + hexNumber(n, digits); +} + +TrkResult::TrkResult() : + code(0), + token(0), + isDebugOutput(false) +{ +} + +void TrkResult::clear() +{ + code = token= 0; + isDebugOutput = false; + data.clear(); + cookie = QVariant(); +} + +QString TrkResult::toString() const +{ + QString res = stringFromByte(code); + res += QLatin1String(" ["); + res += stringFromByte(token); + res += QLatin1Char(']'); + res += QLatin1Char(' '); + res += stringFromArray(data); + return res; +} + +QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame) +{ + byte s = command + token; + for (int i = 0; i != data.size(); ++i) + s += data.at(i); + byte checksum = 255 - (s & 0xff); + //int x = s + ~s; + //logMessage("check: " << s << checksum << x; + + QByteArray response; + response.reserve(data.size() + 3); + response.append(char(command)); + response.append(char(token)); + response.append(data); + response.append(char(checksum)); + + QByteArray encodedData = encode7d(response); + + QByteArray ba; + ba.reserve(encodedData.size() + 6); + if (serialFrame) { + ba.append(char(0x01)); + ba.append(char(0x90)); + const ushort encodedSize = encodedData.size() + 2; // 2 x 0x7e + appendShort(&ba, encodedSize, BigEndian); + } + ba.append(char(0x7e)); + ba.append(encodedData); + ba.append(char(0x7e)); + + return ba; +} + +/* returns 0 if array doesn't represent a result, +otherwise returns the length of the result data */ +ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame) +{ + if (serialFrame) { + // Serial protocol with length info + if (buffer.length() < 4) + return 0; + if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90) + return 0; + const ushort len = extractShort(buffer.data() + 2); + return (buffer.size() >= len + 4) ? len : ushort(0); + } + // Frameless protocol without length info + const char delimiter = char(0x7e); + const int firstDelimiterPos = buffer.indexOf(delimiter); + // Regular message delimited by 0x7e..0x7e + if (firstDelimiterPos == 0) { + const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1); + return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0; + } + // Some ASCII log message up to first delimiter or all + return firstDelimiterPos != -1 ? firstDelimiterPos : buffer.size(); +} + +bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByteArray *rawData) +{ + result->clear(); + if(rawData) + rawData->clear(); + const ushort len = isValidTrkResult(*buffer, serialFrame); + if (!len) + return false; + // handle receiving application output, which is not a regular command + const int delimiterPos = serialFrame ? 4 : 0; + if (buffer->at(delimiterPos) != 0x7e) { + result->isDebugOutput = true; + result->data = buffer->mid(delimiterPos, len); + result->data.replace("\r\n", "\n"); + *buffer->remove(0, delimiterPos + len); + return true; + } + // FIXME: what happens if the length contains 0xfe? + // Assume for now that it passes unencoded! + const QByteArray data = decode7d(buffer->mid(delimiterPos + 1, len - 2)); + if(rawData) + *rawData = data; + *buffer->remove(0, delimiterPos + len); + + byte sum = 0; + for (int i = 0; i < data.size(); ++i) // 3 = 2 * 0xfe + sum + sum += byte(data.at(i)); + if (sum != 0xff) + logMessage("*** CHECKSUM ERROR: " << byte(sum)); + + result->code = data.at(0); + result->token = data.at(1); + result->data = data.mid(2, data.size() - 3); + //logMessage(" REST BUF: " << stringFromArray(*buffer)); + //logMessage(" CURR DATA: " << stringFromArray(data)); + //QByteArray prefix = "READ BUF: "; + //logMessage((prefix + "HEADER: " + stringFromArray(header).toLatin1()).data()); + return true; +} + +SYMBIANUTILS_EXPORT ushort extractShort(const char *data) +{ + return byte(data[0]) * 256 + byte(data[1]); +} + +SYMBIANUTILS_EXPORT uint extractInt(const char *data) +{ + uint res = byte(data[0]); + res *= 256; res += byte(data[1]); + res *= 256; res += byte(data[2]); + res *= 256; res += byte(data[3]); + return res; +} + +SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba) +{ + QString res; + char buf[10]; + for (int i = 0, n = ba.size(); i != n; ++i) { + const byte c = ba.at(i); + if (isprint(c)) { + res += c; + } else { + qsnprintf(buf, sizeof(buf) - 1, "\\%x", int(c)); + res += buf; + } + } + return res; +} + +SYMBIANUTILS_EXPORT void appendShort(QByteArray *ba, ushort s, Endianness endian) +{ + if (endian == BigEndian) { + ba->append(s / 256); + ba->append(s % 256); + } else { + ba->append(s % 256); + ba->append(s / 256); + } +} + +SYMBIANUTILS_EXPORT void appendInt(QByteArray *ba, uint i, Endianness endian) +{ + const uchar b3 = i % 256; i /= 256; + const uchar b2 = i % 256; i /= 256; + const uchar b1 = i % 256; i /= 256; + const uchar b0 = i; + ba->reserve(ba->size() + 4); + if (endian == BigEndian) { + ba->append(b0); + ba->append(b1); + ba->append(b2); + ba->append(b3); + } else { + ba->append(b3); + ba->append(b2); + ba->append(b1); + ba->append(b0); + } +} + +void appendString(QByteArray *ba, const QByteArray &str, Endianness endian, bool appendNullTerminator) +{ + const int fullSize = str.size() + (appendNullTerminator ? 1 : 0); + appendShort(ba, fullSize, endian); // count the terminating \0 + ba->append(str); + if (appendNullTerminator) + ba->append('\0'); +} + +void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness endian) +{ + // convert the QDateTime to UTC and append its representation to QByteArray + // format is the same as in FAT file system + dateTime = dateTime.toUTC(); + const QTime utcTime = dateTime.time(); + const QDate utcDate = dateTime.date(); + uint fatDateTime = (utcTime.hour() << 11 | utcTime.minute() << 5 | utcTime.second()/2) << 16; + fatDateTime |= (utcDate.year()-1980) << 9 | utcDate.month() << 5 | utcDate.day(); + appendInt(ba, fatDateTime, endian); +} + +QByteArray errorMessage(byte code) +{ + switch (code) { + case 0x00: return "No error"; + case 0x01: return "Generic error in CWDS message"; + case 0x02: return "Unexpected packet size in send msg"; + case 0x03: return "Internal error occurred in CWDS"; + case 0x04: return "Escape followed by frame flag"; + case 0x05: return "Bad FCS in packet"; + case 0x06: return "Packet too long"; + case 0x07: return "Sequence ID not expected (gap in sequence)"; + + case 0x10: return "Command not supported"; + case 0x11: return "Command param out of range"; + case 0x12: return "An option was not supported"; + case 0x13: return "Read/write to invalid memory"; + case 0x14: return "Read/write invalid registers"; + case 0x15: return "Exception occurred in CWDS"; + case 0x16: return "Targeted system or thread is running"; + case 0x17: return "Breakpoint resources (HW or SW) exhausted"; + case 0x18: return "Requested breakpoint conflicts with existing one"; + + case 0x20: return "General OS-related error"; + case 0x21: return "Request specified invalid process"; + case 0x22: return "Request specified invalid thread"; + } + return "Unknown error"; +} + +uint swapEndian(uint in) +{ + return (in>>24) | ((in<<8) & 0x00FF0000) | ((in>>8) & 0x0000FF00) | (in<<24); +} + +int TrkResult::errorCode() const +{ + // NAK means always error, else data sized 1 with a non-null element + const bool isNAK = code == 0xff; + if (data.size() != 1 && !isNAK) + return 0; + if (const int errorCode = data.at(0)) + return errorCode; + return isNAK ? 0xff : 0; +} + +QString TrkResult::errorString() const +{ + // NAK means always error, else data sized 1 with a non-null element + if (code == 0xff) + return "NAK"; + if (data.size() < 1) + return "Unknown error packet"; + return errorMessage(data.at(0)); +} + +} // namespace trk + diff --git a/tools/runonphone/symbianutils/trkutils.h b/tools/runonphone/symbianutils/trkutils.h new file mode 100644 index 0000000..3a485c7 --- /dev/null +++ b/tools/runonphone/symbianutils/trkutils.h @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** 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 tools applications 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 DEBUGGER_TRK_UTILS +#define DEBUGGER_TRK_UTILS + +#include "symbianutils_global.h" +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QDateTime; +QT_END_NAMESPACE + +namespace trk { + +typedef unsigned char byte; + +enum Command { + TrkPing = 0x00, + TrkConnect = 0x01, + TrkDisconnect = 0x02, + TrkVersions = 0x04, + TrkSupported = 0x05, + TrkCpuType = 0x06, + TrkHostVersions = 0x09, + TrkContinue = 0x18, + TrkCreateItem = 0x40, + TrkDeleteItem = 0x41, + + TrkWriteFile = 0x48, + TrkOpenFile = 0x4a, + TrkCloseFile = 0x4b, + TrkInstallFile = 0x4d, + TrkInstallFile2 = 0x4e, + + TrkNotifyAck = 0x80, + TrkNotifyNak = 0xff, + TrkNotifyStopped = 0x90, + TrkNotifyException = 0x91, + TrkNotifyInternalError = 0x92, + TrkNotifyCreated = 0xa0, + TrkNotifyDeleted = 0xa1, + TrkNotifyProcessorStarted = 0xa2, + TrkNotifyProcessorStandBy = 0xa6, + TrkNotifyProcessorReset = 0xa7 +}; + +inline byte extractByte(const char *data) { return *data; } +SYMBIANUTILS_EXPORT ushort extractShort(const char *data); +SYMBIANUTILS_EXPORT uint extractInt(const char *data); + +SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba); + +// produces "xx xx xx " +SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen = - 1); + +enum Endianness +{ + LittleEndian, + BigEndian, + TargetByteOrder = BigEndian, +}; + +SYMBIANUTILS_EXPORT void appendShort(QByteArray *ba, ushort s, Endianness = TargetByteOrder); +SYMBIANUTILS_EXPORT void appendInt(QByteArray *ba, uint i, Endianness = TargetByteOrder); +SYMBIANUTILS_EXPORT void appendString(QByteArray *ba, const QByteArray &str, Endianness = TargetByteOrder, bool appendNullTerminator = true); + +struct SYMBIANUTILS_EXPORT Library +{ + Library() {} + + QByteArray name; + uint codeseg; + uint dataseg; +}; + +struct SYMBIANUTILS_EXPORT TrkAppVersion +{ + TrkAppVersion(); + void reset(); + + int trkMajor; + int trkMinor; + int protocolMajor; + int protocolMinor; +}; + +struct SYMBIANUTILS_EXPORT Session +{ + Session(); + void reset(); + QString deviceDescription(unsigned verbose) const; + + // Trk feedback + byte cpuMajor; + byte cpuMinor; + byte bigEndian; + byte defaultTypeSize; + byte fpTypeSize; + byte extended1TypeSize; + byte extended2TypeSize; + TrkAppVersion trkAppVersion; + uint pid; + uint tid; + uint codeseg; + uint dataseg; + QHash addressToBP; + + typedef QList Libraries; + Libraries libraries; + + typedef uint Thread; + typedef QList Threads; + Threads threads; + + // Gdb request + uint currentThread; + QStringList modules; +}; + +struct SYMBIANUTILS_EXPORT TrkResult +{ + TrkResult(); + void clear(); + QString toString() const; + // 0 for no error. + int errorCode() const; + QString errorString() const; + + byte code; + byte token; + QByteArray data; + QVariant cookie; + bool isDebugOutput; +}; + +SYMBIANUTILS_EXPORT QByteArray errorMessage(byte code); +SYMBIANUTILS_EXPORT QByteArray hexNumber(uint n, int digits = 0); +SYMBIANUTILS_EXPORT QByteArray hexxNumber(uint n, int digits = 0); // prepends '0x', too +SYMBIANUTILS_EXPORT uint swapEndian(uint in); + +} // namespace trk + +#endif // DEBUGGER_TRK_UTILS diff --git a/tools/runonphone/symbianutils/trkutils_p.h b/tools/runonphone/symbianutils/trkutils_p.h new file mode 100644 index 0000000..12b0109 --- /dev/null +++ b/tools/runonphone/symbianutils/trkutils_p.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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 tools applications 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 DEBUGGER_TRK_PRIVATE_UTILS +#define DEBUGGER_TRK_PRIVATE_UTILS + +#include "trkutils.h" +#include "symbianutils_global.h" + +QT_BEGIN_NAMESPACE +class QDateTime; +QT_END_NAMESPACE + +namespace trk { + +void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness = TargetByteOrder); +// returns a QByteArray containing optionally +// the serial frame [0x01 0x90 ] and 0x7e encoded7d(ba) 0x7e +QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame); +bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0); + +} // namespace trk + +#endif // DEBUGGER_TRK_PRIVATE_UTILS diff --git a/tools/runonphone/trk/bluetoothlistener.cpp b/tools/runonphone/trk/bluetoothlistener.cpp deleted file mode 100644 index df04288..0000000 --- a/tools/runonphone/trk/bluetoothlistener.cpp +++ /dev/null @@ -1,224 +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 tools applications 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 "bluetoothlistener.h" -#include "trkdevice.h" - -#include - -#ifdef Q_OS_UNIX -# include -# include -#else -# include -#endif - -// Process id helpers. -#ifdef Q_OS_WIN -inline DWORD processId(const QProcess &p) -{ - if (const Q_PID processInfoStruct = p.pid()) - return processInfoStruct->dwProcessId; - return 0; -} -#else -inline Q_PID processId(const QProcess &p) -{ - return p.pid(); -} -#endif - - -enum { debug = 0 }; - -namespace trk { - -struct BluetoothListenerPrivate { - BluetoothListenerPrivate(); - QString device; - QProcess process; -#ifdef Q_OS_WIN - DWORD pid; -#else - Q_PID pid; -#endif - bool printConsoleMessages; - BluetoothListener::Mode mode; -}; - -BluetoothListenerPrivate::BluetoothListenerPrivate() : - pid(0), - printConsoleMessages(false), - mode(BluetoothListener::Listen) -{ -} - -BluetoothListener::BluetoothListener(QObject *parent) : - QObject(parent), - d(new BluetoothListenerPrivate) -{ - d->process.setProcessChannelMode(QProcess::MergedChannels); - - connect(&d->process, SIGNAL(readyReadStandardError()), - this, SLOT(slotStdError())); - connect(&d->process, SIGNAL(readyReadStandardOutput()), - this, SLOT(slotStdOutput())); - connect(&d->process, SIGNAL(finished(int, QProcess::ExitStatus)), - this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); - connect(&d->process, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(slotProcessError(QProcess::ProcessError))); -} - -BluetoothListener::~BluetoothListener() -{ - const int trc = terminateProcess(); - if (debug) - qDebug() << "~BluetoothListener: terminated" << trc; - delete d; -} - -BluetoothListener::Mode BluetoothListener::mode() const -{ - return d->mode; -} - -void BluetoothListener::setMode(Mode m) -{ - d->mode = m; -} - -bool BluetoothListener::printConsoleMessages() const -{ - return d->printConsoleMessages; -} - -void BluetoothListener::setPrintConsoleMessages(bool p) -{ - d->printConsoleMessages = p; -} - -int BluetoothListener::terminateProcess() -{ - enum { TimeOutMS = 200 }; - if (debug) - qDebug() << "terminateProcess" << d->process.pid() << d->process.state(); - if (d->process.state() == QProcess::NotRunning) - return -1; - emitMessage(tr("%1: Stopping listener %2...").arg(d->device).arg(processId(d->process))); - // When listening, the process should terminate by itself after closing the connection - if (mode() == Listen && d->process.waitForFinished(TimeOutMS)) - return 0; -#ifdef Q_OS_UNIX - kill(d->process.pid(), SIGHUP); // Listens for SIGHUP - if (d->process.waitForFinished(TimeOutMS)) - return 1; -#endif - d->process.terminate(); - if (d->process.waitForFinished(TimeOutMS)) - return 2; - d->process.kill(); - return 3; -} - -bool BluetoothListener::start(const QString &device, QString *errorMessage) -{ - if (d->process.state() != QProcess::NotRunning) { - *errorMessage = QLatin1String("Internal error: Still running."); - return false; - } - d->device = device; - const QString binary = QLatin1String("rfcomm"); - QStringList arguments; - arguments << QLatin1String("-r") - << (d->mode == Listen ? QLatin1String("listen") : QLatin1String("watch")) - << device << QString(QLatin1Char('1')); - if (debug) - qDebug() << binary << arguments; - emitMessage(tr("%1: Starting Bluetooth listener %2...").arg(device, binary)); - d->pid = 0; - d->process.start(binary, arguments); - if (!d->process.waitForStarted()) { - *errorMessage = tr("Unable to run '%1': %2").arg(binary, d->process.errorString()); - return false; - } - d->pid = processId(d->process); // Forgets it after crash/termination - emitMessage(tr("%1: Bluetooth listener running (%2).").arg(device).arg(processId(d->process))); - return true; -} - -void BluetoothListener::slotStdOutput() -{ - emitMessage(QString::fromLocal8Bit(d->process.readAllStandardOutput())); -} - -void BluetoothListener::emitMessage(const QString &m) -{ - if (d->printConsoleMessages || debug) - qDebug("%s\n", qPrintable(m)); - emit message(m); -} - -void BluetoothListener::slotStdError() -{ - emitMessage(QString::fromLocal8Bit(d->process.readAllStandardError())); -} - -void BluetoothListener::slotProcessFinished(int ex, QProcess::ExitStatus state) -{ - switch (state) { - case QProcess::NormalExit: - emitMessage(tr("%1: Process %2 terminated with exit code %3.") - .arg(d->device).arg(d->pid).arg(ex)); - break; - case QProcess::CrashExit: - emitMessage(tr("%1: Process %2 crashed.").arg(d->device).arg(d->pid)); - break; - } - emit terminated(); -} - -void BluetoothListener::slotProcessError(QProcess::ProcessError error) -{ - emitMessage(tr("%1: Process error %2: %3") - .arg(d->device).arg(error).arg(d->process.errorString())); -} - -} // namespace trk diff --git a/tools/runonphone/trk/bluetoothlistener.h b/tools/runonphone/trk/bluetoothlistener.h deleted file mode 100644 index 36894e7..0000000 --- a/tools/runonphone/trk/bluetoothlistener.h +++ /dev/null @@ -1,103 +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 tools applications 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 BLUETOOTHLISTENER_H -#define BLUETOOTHLISTENER_H - -#include "symbianutils_global.h" - -#include -#include - -namespace trk { -struct BluetoothListenerPrivate; - -/* BluetoothListener: Starts a helper process watching connections on a - * Bluetooth device, Linux only: - * The rfcomm command is used. It process can be started in the background - * while connection attempts (TrkDevice::open()) are made in the foreground. */ - -class SYMBIANUTILS_EXPORT BluetoothListener : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(BluetoothListener) -public: - // The Mode property must be set before calling start(). - enum Mode { - Listen, /* Terminate after client closed (read: Trk app - * on the phone terminated or disconnected).*/ - Watch // Keep running, watch for next connection from client - }; - - explicit BluetoothListener(QObject *parent = 0); - virtual ~BluetoothListener(); - - Mode mode() const; - void setMode(Mode m); - - bool start(const QString &device, QString *errorMessage); - - // Print messages on the console. - bool printConsoleMessages() const; - void setPrintConsoleMessages(bool p); - -signals: - void terminated(); - void message(const QString &); - -public slots: - void emitMessage(const QString &m); // accessed by starter - -private slots: - void slotStdOutput(); - void slotStdError(); - void slotProcessFinished(int, QProcess::ExitStatus); - void slotProcessError(QProcess::ProcessError error); - -private: - int terminateProcess(); - - BluetoothListenerPrivate *d; -}; - -} // namespace trk - -#endif // BLUETOOTHLISTENER_H diff --git a/tools/runonphone/trk/bluetoothlistener_gui.cpp b/tools/runonphone/trk/bluetoothlistener_gui.cpp deleted file mode 100644 index 5994eb5..0000000 --- a/tools/runonphone/trk/bluetoothlistener_gui.cpp +++ /dev/null @@ -1,111 +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 tools applications 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 "bluetoothlistener_gui.h" -#include "bluetoothlistener.h" -#include "communicationstarter.h" - -#include -#include -#include -#include - -namespace trk { - -SYMBIANUTILS_EXPORT PromptStartCommunicationResult - promptStartCommunication(BaseCommunicationStarter &starter, - const QString &msgBoxTitle, - const QString &msgBoxText, - QWidget *msgBoxParent, - QString *errorMessage) -{ - errorMessage->clear(); - // Initial connection attempt. - switch (starter.start()) { - case BaseCommunicationStarter::Started: - break; - case BaseCommunicationStarter::ConnectionSucceeded: - return PromptStartCommunicationConnected; - case BaseCommunicationStarter::StartError: - *errorMessage = starter.errorString(); - return PromptStartCommunicationError; - } - // Run the starter with the event loop of a message box, have the box - // closed by the signals of the starter. - QMessageBox messageBox(QMessageBox::Information, msgBoxTitle, msgBoxText, QMessageBox::Cancel, msgBoxParent); - QObject::connect(&starter, SIGNAL(connected()), &messageBox, SLOT(close())); - QObject::connect(&starter, SIGNAL(timeout()), &messageBox, SLOT(close())); - messageBox.exec(); - // Only starter.state() is reliable here to obtain the state. - switch (starter.state()) { - case AbstractBluetoothStarter::Running: - *errorMessage = QCoreApplication::translate("trk::promptStartCommunication", "Connection on %1 canceled.").arg(starter.device()); - return PromptStartCommunicationCanceled; - case AbstractBluetoothStarter::TimedOut: - *errorMessage = starter.errorString(); - return PromptStartCommunicationError; - case AbstractBluetoothStarter::Connected: - break; - } - return PromptStartCommunicationConnected; -} - -SYMBIANUTILS_EXPORT PromptStartCommunicationResult - promptStartSerial(BaseCommunicationStarter &starter, - QWidget *msgBoxParent, - QString *errorMessage) -{ - const QString title = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for App TRK"); - const QString message = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for App TRK to start on %1...").arg(starter.device()); - return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage); -} - -SYMBIANUTILS_EXPORT PromptStartCommunicationResult - promptStartBluetooth(BaseCommunicationStarter &starter, - QWidget *msgBoxParent, - QString *errorMessage) -{ - const QString title = QCoreApplication::translate("trk::promptStartCommunication", "Waiting for Bluetooth Connection"); - const QString message = QCoreApplication::translate("trk::promptStartCommunication", "Connecting to %1...").arg(starter.device()); - return promptStartCommunication(starter, title, message, msgBoxParent, errorMessage); -} - -} // namespace trk diff --git a/tools/runonphone/trk/bluetoothlistener_gui.h b/tools/runonphone/trk/bluetoothlistener_gui.h deleted file mode 100644 index 10e7145..0000000 --- a/tools/runonphone/trk/bluetoothlistener_gui.h +++ /dev/null @@ -1,89 +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 tools applications 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 BLUETOOTHLISTENER_GUI_H -#define BLUETOOTHLISTENER_GUI_H - -#include "symbianutils_global.h" - -#include - -QT_BEGIN_NAMESPACE -class QWidget; -QT_END_NAMESPACE - -namespace trk { -class BaseCommunicationStarter; - -/* promptStartCommunication(): Convenience functions that - * prompt the user to start a communication (launching or - * connecting TRK) using a modal message box in which they can cancel. - * Pass in the starter with device and parameters set up. */ - -enum PromptStartCommunicationResult { - PromptStartCommunicationConnected, - PromptStartCommunicationCanceled, - PromptStartCommunicationError -}; - -SYMBIANUTILS_EXPORT PromptStartCommunicationResult - promptStartCommunication(BaseCommunicationStarter &starter, - const QString &msgBoxTitle, - const QString &msgBoxText, - QWidget *msgBoxParent, - QString *errorMessage); - -// Convenience to start a serial connection (messages prompting -// to launch Trk). -SYMBIANUTILS_EXPORT PromptStartCommunicationResult - promptStartSerial(BaseCommunicationStarter &starter, - QWidget *msgBoxParent, - QString *errorMessage); - -// Convenience to start blue tooth connection (messages -// prompting to connect). -SYMBIANUTILS_EXPORT PromptStartCommunicationResult - promptStartBluetooth(BaseCommunicationStarter &starter, - QWidget *msgBoxParent, - QString *errorMessage); -} // namespace trk - -#endif // BLUETOOTHLISTENER_GUI_H diff --git a/tools/runonphone/trk/callback.h b/tools/runonphone/trk/callback.h deleted file mode 100644 index 3996d73..0000000 --- a/tools/runonphone/trk/callback.h +++ /dev/null @@ -1,160 +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 tools applications 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 DEBUGGER_CALLBACK_H -#define DEBUGGER_CALLBACK_H - -#include "symbianutils_global.h" - -namespace trk { -namespace Internal { - -/* Helper class for the 1-argument functor: - * Cloneable base class for the implementation which is - * invokeable with the argument. */ -template -class CallbackImplBase -{ - Q_DISABLE_COPY(CallbackImplBase) -public: - CallbackImplBase() {} - virtual CallbackImplBase *clone() const = 0; - virtual void invoke(Argument a) = 0; - virtual ~CallbackImplBase() {} -}; - -/* Helper class for the 1-argument functor: Implementation for - * a class instance with a member function pointer. */ -template -class CallbackMemberPtrImpl : public CallbackImplBase -{ -public: - typedef void (Class::*MemberFuncPtr)(Argument); - - CallbackMemberPtrImpl(Class *instance, - MemberFuncPtr memberFunc) : - m_instance(instance), - m_memberFunc(memberFunc) {} - - virtual CallbackImplBase *clone() const - { - return new CallbackMemberPtrImpl(m_instance, m_memberFunc); - } - - virtual void invoke(Argument a) - { (m_instance->*m_memberFunc)(a); } -private: - Class *m_instance; - MemberFuncPtr m_memberFunc; -}; - -} // namespace Internal - -/* Default-constructible, copyable 1-argument functor providing an - * operator()(Argument) that invokes a member function of a class: - * \code -class Foo { -public: - void print(const std::string &); -}; -... -Foo foo; -Callback f1(&foo, &Foo::print); -f1("test"); -\endcode */ - -template -class Callback -{ -public: - Callback() : m_impl(0) {} - - template - Callback(Class *instance, void (Class::*memberFunc)(Argument)) : - m_impl(new Internal::CallbackMemberPtrImpl(instance, memberFunc)) - {} - - ~Callback() - { - clean(); - } - - Callback(const Callback &rhs) : - m_impl(0) - { - if (rhs.m_impl) - m_impl = rhs.m_impl->clone(); - } - - Callback &operator=(const Callback &rhs) - { - if (this != &rhs) { - clean(); - if (rhs.m_impl) - m_impl = rhs.m_impl->clone(); - } - return *this; - } - - bool isNull() const { return m_impl == 0; } - operator bool() const { return !isNull(); } - - void operator()(Argument a) - { - if (m_impl) - m_impl->invoke(a); - } - -private: - void clean() - { - if (m_impl) { - delete m_impl; - m_impl = 0; - } - } - - Internal::CallbackImplBase *m_impl; -}; - -} // namespace trk - -#endif // DEBUGGER_CALLBACK_H diff --git a/tools/runonphone/trk/communicationstarter.cpp b/tools/runonphone/trk/communicationstarter.cpp deleted file mode 100644 index e5e556e..0000000 --- a/tools/runonphone/trk/communicationstarter.cpp +++ /dev/null @@ -1,260 +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 tools applications 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 "communicationstarter.h" -#include "bluetoothlistener.h" -#include "trkdevice.h" - -#include -#include - -namespace trk { - -// --------------- AbstractBluetoothStarter -struct BaseCommunicationStarterPrivate { - explicit BaseCommunicationStarterPrivate(const BaseCommunicationStarter::TrkDevicePtr &d); - - const BaseCommunicationStarter::TrkDevicePtr trkDevice; - BluetoothListener *listener; - QTimer *timer; - int intervalMS; - int attempts; - int n; - QString device; - QString errorString; - BaseCommunicationStarter::State state; -}; - -BaseCommunicationStarterPrivate::BaseCommunicationStarterPrivate(const BaseCommunicationStarter::TrkDevicePtr &d) : - trkDevice(d), - listener(0), - timer(0), - intervalMS(1000), - attempts(-1), - n(0), - device(QLatin1String("/dev/rfcomm0")), - state(BaseCommunicationStarter::TimedOut) -{ -} - -BaseCommunicationStarter::BaseCommunicationStarter(const TrkDevicePtr &trkDevice, QObject *parent) : - QObject(parent), - d(new BaseCommunicationStarterPrivate(trkDevice)) -{ -} - -BaseCommunicationStarter::~BaseCommunicationStarter() -{ - stopTimer(); - delete d; -} - -void BaseCommunicationStarter::stopTimer() -{ - if (d->timer && d->timer->isActive()) - d->timer->stop(); -} - -bool BaseCommunicationStarter::initializeStartupResources(QString *errorMessage) -{ - errorMessage->clear(); - return true; -} - -BaseCommunicationStarter::StartResult BaseCommunicationStarter::start() -{ - if (state() == Running) { - d->errorString = QLatin1String("Internal error, attempt to re-start BaseCommunicationStarter.\n"); - return StartError; - } - // Before we instantiate timers, and such, try to open the device, - // which should succeed if another listener is already running in - // 'Watch' mode - if (d->trkDevice->open(d->device , &(d->errorString))) - return ConnectionSucceeded; - // Pull up resources for next attempt - d->n = 0; - if (!initializeStartupResources(&(d->errorString))) - return StartError; - // Start timer - if (!d->timer) { - d->timer = new QTimer; - connect(d->timer, SIGNAL(timeout()), this, SLOT(slotTimer())); - } - d->timer->setInterval(d->intervalMS); - d->timer->setSingleShot(false); - d->timer->start(); - d->state = Running; - return Started; -} - -BaseCommunicationStarter::State BaseCommunicationStarter::state() const -{ - return d->state; -} - -int BaseCommunicationStarter::intervalMS() const -{ - return d->intervalMS; -} - -void BaseCommunicationStarter::setIntervalMS(int i) -{ - d->intervalMS = i; - if (d->timer) - d->timer->setInterval(i); -} - -int BaseCommunicationStarter::attempts() const -{ - return d->attempts; -} - -void BaseCommunicationStarter::setAttempts(int a) -{ - d->attempts = a; -} - -QString BaseCommunicationStarter::device() const -{ - return d->device; -} - -void BaseCommunicationStarter::setDevice(const QString &dv) -{ - d->device = dv; -} - -QString BaseCommunicationStarter::errorString() const -{ - return d->errorString; -} - -void BaseCommunicationStarter::slotTimer() -{ - ++d->n; - // Check for timeout - if (d->attempts >= 0 && d->n >= d->attempts) { - stopTimer(); - d->errorString = tr("%1: timed out after %n attempts using an interval of %2ms.", 0, d->n) - .arg(d->device).arg(d->intervalMS); - d->state = TimedOut; - emit timeout(); - } else { - // Attempt n to connect? - if (d->trkDevice->open(d->device , &(d->errorString))) { - stopTimer(); - const QString msg = tr("%1: Connection attempt %2 succeeded.").arg(d->device).arg(d->n); - emit message(msg); - d->state = Connected; - emit connected(); - } else { - const QString msg = tr("%1: Connection attempt %2 failed: %3 (retrying)...") - .arg(d->device).arg(d->n).arg(d->errorString); - emit message(msg); - } - } -} - -// --------------- AbstractBluetoothStarter - -AbstractBluetoothStarter::AbstractBluetoothStarter(const TrkDevicePtr &trkDevice, QObject *parent) : - BaseCommunicationStarter(trkDevice, parent) -{ -} - -bool AbstractBluetoothStarter::initializeStartupResources(QString *errorMessage) -{ - // Create the listener and forward messages to it. - BluetoothListener *listener = createListener(); - connect(this, SIGNAL(message(QString)), listener, SLOT(emitMessage(QString))); - return listener->start(device(), errorMessage); -} - -// -------- ConsoleBluetoothStarter -ConsoleBluetoothStarter::ConsoleBluetoothStarter(const TrkDevicePtr &trkDevice, - QObject *listenerParent, - QObject *parent) : -AbstractBluetoothStarter(trkDevice, parent), -m_listenerParent(listenerParent) -{ -} - -BluetoothListener *ConsoleBluetoothStarter::createListener() -{ - BluetoothListener *rc = new BluetoothListener(m_listenerParent); - rc->setMode(BluetoothListener::Listen); - rc->setPrintConsoleMessages(true); - return rc; -} - -bool ConsoleBluetoothStarter::startBluetooth(const TrkDevicePtr &trkDevice, - QObject *listenerParent, - const QString &device, - int attempts, - QString *errorMessage) -{ - // Set up a console starter to print to stdout. - ConsoleBluetoothStarter starter(trkDevice, listenerParent); - starter.setDevice(device); - starter.setAttempts(attempts); - switch (starter.start()) { - case Started: - break; - case ConnectionSucceeded: - return true; - case StartError: - *errorMessage = starter.errorString(); - return false; - } - // Run the starter with an event loop. @ToDo: Implement - // some asynchronous keypress read to cancel. - QEventLoop eventLoop; - connect(&starter, SIGNAL(connected()), &eventLoop, SLOT(quit())); - connect(&starter, SIGNAL(timeout()), &eventLoop, SLOT(quit())); - eventLoop.exec(QEventLoop::ExcludeUserInputEvents); - if (starter.state() != AbstractBluetoothStarter::Connected) { - *errorMessage = starter.errorString(); - return false; - } - return true; -} -} // namespace trk diff --git a/tools/runonphone/trk/communicationstarter.h b/tools/runonphone/trk/communicationstarter.h deleted file mode 100644 index 2d7dc50..0000000 --- a/tools/runonphone/trk/communicationstarter.h +++ /dev/null @@ -1,162 +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 tools applications 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 COMMUNICATIONSTARTER_H -#define COMMUNICATIONSTARTER_H - -#include "symbianutils_global.h" - -#include -#include - -namespace trk { -class TrkDevice; -class BluetoothListener; -struct BaseCommunicationStarterPrivate; - -/* BaseCommunicationStarter: A QObject that repeatedly tries to open a - * trk device until a connection succeeds or a timeout occurs (emitting - * signals), allowing to do something else in the foreground (local event loop - * [say QMessageBox] or some asynchronous operation). If the initial - * connection attempt in start() fails, the - * virtual initializeStartupResources() is called to initialize resources - * required to pull up the communication (namely Bluetooth listeners). - * The base class can be used as is to prompt the user to launch App TRK for a - * serial communication as this requires no further resource setup. */ - -class SYMBIANUTILS_EXPORT BaseCommunicationStarter : public QObject { - Q_OBJECT - Q_DISABLE_COPY(BaseCommunicationStarter) -public: - typedef QSharedPointer TrkDevicePtr; - - enum State { Running, Connected, TimedOut }; - - explicit BaseCommunicationStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0); - virtual ~BaseCommunicationStarter(); - - int intervalMS() const; - void setIntervalMS(int i); - - int attempts() const; - void setAttempts(int a); - - QString device() const; - void setDevice(const QString &); - - State state() const; - QString errorString() const; - - enum StartResult { - Started, // Starter is now running. - ConnectionSucceeded, /* Initial connection attempt succeeded, - * no need to keep running. */ - StartError // Error occurred during start. - }; - - StartResult start(); - -signals: - void connected(); - void timeout(); - void message(const QString &); - -private slots: - void slotTimer(); - -protected: - virtual bool initializeStartupResources(QString *errorMessage); - -private: - inline void stopTimer(); - - BaseCommunicationStarterPrivate *d; -}; - -/* AbstractBluetoothStarter: Repeatedly tries to open a trk Bluetooth - * device. Note that in case a Listener is already running mode, the - * connection will succeed immediately. - * initializeStartupResources() is implemented to fire up the listener. - * Introduces a new virtual createListener() that derived classes must - * implement as a factory function that creates and sets up the - * listener (mode, message connection, etc). */ - -class SYMBIANUTILS_EXPORT AbstractBluetoothStarter : public BaseCommunicationStarter { - Q_OBJECT - Q_DISABLE_COPY(AbstractBluetoothStarter) -public: - -protected: - explicit AbstractBluetoothStarter(const TrkDevicePtr& trkDevice, QObject *parent = 0); - - // Implemented to fire up the listener. - virtual bool initializeStartupResources(QString *errorMessage); - // New virtual: Overwrite to create and parametrize the listener. - virtual BluetoothListener *createListener() = 0; -}; - -/* ConsoleBluetoothStarter: Convenience class for console processes. Creates a - * listener in "Listen" mode with the messages redirected to standard output. */ - -class SYMBIANUTILS_EXPORT ConsoleBluetoothStarter : public AbstractBluetoothStarter { - Q_OBJECT - Q_DISABLE_COPY(ConsoleBluetoothStarter) -public: - static bool startBluetooth(const TrkDevicePtr& trkDevice, - QObject *listenerParent, - const QString &device, - int attempts, - QString *errorMessage); - -protected: - virtual BluetoothListener *createListener(); - -private: - explicit ConsoleBluetoothStarter(const TrkDevicePtr& trkDevice, - QObject *listenerParent, - QObject *parent = 0); - - QObject *m_listenerParent; -}; - -} // namespace trk - -#endif // COMMUNICATIONSTARTER_H diff --git a/tools/runonphone/trk/launcher.cpp b/tools/runonphone/trk/launcher.cpp deleted file mode 100644 index 4f91545..0000000 --- a/tools/runonphone/trk/launcher.cpp +++ /dev/null @@ -1,741 +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 tools applications 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 "launcher.h" -#include "trkutils.h" -#include "trkutils_p.h" -#include "trkdevice.h" -#include "bluetoothlistener.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace trk { - -struct LauncherPrivate { - struct CopyState { - QString sourceFileName; - QString destinationFileName; - uint copyFileHandle; - QScopedPointer data; - int position; - }; - - explicit LauncherPrivate(const TrkDevicePtr &d); - - TrkDevicePtr m_device; - QString m_trkServerName; - QByteArray m_trkReadBuffer; - Launcher::State m_state; - - void logMessage(const QString &msg); - // Debuggee state - Session m_session; // global-ish data (process id, target information) - - CopyState m_copyState; - QString m_fileName; - QStringList m_commandLineArgs; - QString m_installFileName; - int m_verbose; - Launcher::Actions m_startupActions; - bool m_closeDevice; -}; - -LauncherPrivate::LauncherPrivate(const TrkDevicePtr &d) : - m_device(d), - m_state(Launcher::Disconnected), - m_verbose(0), - m_closeDevice(true) -{ - if (m_device.isNull()) - m_device = TrkDevicePtr(new TrkDevice); -} - -Launcher::Launcher(Actions startupActions, - const TrkDevicePtr &dev, - QObject *parent) : - QObject(parent), - d(new LauncherPrivate(dev)) -{ - d->m_startupActions = startupActions; - connect(d->m_device.data(), SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult))); - connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close())); -} - -Launcher::~Launcher() -{ - logMessage("Shutting down.\n"); - delete d; -} - -Launcher::State Launcher::state() const -{ - return d->m_state; -} - -void Launcher::setState(State s) -{ - if (s != d->m_state) { - d->m_state = s; - emit stateChanged(s); - } -} - -void Launcher::addStartupActions(trk::Launcher::Actions startupActions) -{ - d->m_startupActions = Actions(d->m_startupActions | startupActions); -} - -void Launcher::setTrkServerName(const QString &name) -{ - d->m_trkServerName = name; -} - -QString Launcher::trkServerName() const -{ - return d->m_trkServerName; -} - -TrkDevicePtr Launcher::trkDevice() const -{ - return d->m_device; -} - -void Launcher::setFileName(const QString &name) -{ - d->m_fileName = name; -} - -void Launcher::setCopyFileName(const QString &srcName, const QString &dstName) -{ - d->m_copyState.sourceFileName = srcName; - d->m_copyState.destinationFileName = dstName; -} - -void Launcher::setInstallFileName(const QString &name) -{ - d->m_installFileName = name; -} - -void Launcher::setCommandLineArgs(const QStringList &args) -{ - d->m_commandLineArgs = args; -} - -void Launcher::setSerialFrame(bool b) -{ - d->m_device->setSerialFrame(b); -} - -bool Launcher::serialFrame() const -{ - return d->m_device->serialFrame(); -} - - -bool Launcher::closeDevice() const -{ - return d->m_closeDevice; -} - -void Launcher::setCloseDevice(bool c) -{ - d->m_closeDevice = c; -} - -bool Launcher::startServer(QString *errorMessage) -{ - errorMessage->clear(); - if (d->m_verbose) { - const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Arguments=%3 Package=%4 Remote Package=%5 Install file=%6") - .arg(d->m_trkServerName, d->m_fileName, - d->m_commandLineArgs.join(QString(QLatin1Char(' '))), - d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName); - logMessage(msg); - } - if (d->m_startupActions & ActionCopy) { - if (d->m_copyState.sourceFileName.isEmpty()) { - qWarning("No local filename given for copying package."); - return false; - } else if (d->m_copyState.destinationFileName.isEmpty()) { - qWarning("No remote filename given for copying package."); - return false; - } - } - if (d->m_startupActions & ActionInstall && d->m_installFileName.isEmpty()) { - qWarning("No package name given for installing."); - return false; - } - if (d->m_startupActions & ActionRun && d->m_fileName.isEmpty()) { - qWarning("No remote executable given for running."); - return false; - } - if (!d->m_device->isOpen() && !d->m_device->open(d->m_trkServerName, errorMessage)) - return false; - if (d->m_closeDevice) { - connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close())); - } else { - disconnect(this, SIGNAL(finished()), d->m_device.data(), 0); - } - setState(Connecting); - // Set up the temporary 'waiting' state if we do not get immediate connection - QTimer::singleShot(1000, this, SLOT(slotWaitingForTrk())); - d->m_device->sendTrkInitialPing(); - d->m_device->sendTrkMessage(TrkDisconnect); // Disconnect, as trk might be still connected - d->m_device->sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask)); - d->m_device->sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType)); - d->m_device->sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion)); - if (d->m_startupActions != ActionPingOnly) - d->m_device->sendTrkMessage(TrkConnect, TrkCallback(this, &Launcher::handleConnect)); - return true; -} - -void Launcher::slotWaitingForTrk() -{ - // Set temporary state if we are still in connected state - if (state() == Connecting) - setState(WaitingForTrk); -} - -void Launcher::handleConnect(const TrkResult &result) -{ - if (result.errorCode()) { - emit canNotConnect(result.errorString()); - return; - } - setState(Connected); - if (d->m_startupActions & ActionCopy) - copyFileToRemote(); - else if (d->m_startupActions & ActionInstall) - installRemotePackageSilently(); - else if (d->m_startupActions & ActionRun) - startInferiorIfNeeded(); -} - -void Launcher::setVerbose(int v) -{ - d->m_verbose = v; - d->m_device->setVerbose(v); -} - -void Launcher::logMessage(const QString &msg) -{ - if (d->m_verbose) - qDebug() << "LAUNCHER: " << qPrintable(msg); -} - -void Launcher::terminate() -{ - switch (state()) { - case DeviceDescriptionReceived: - case Connected: - if (d->m_session.pid) { - QByteArray ba; - appendShort(&ba, 0x0000, TargetByteOrder); - appendInt(&ba, d->m_session.pid, TargetByteOrder); - d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(this, &Launcher::handleRemoteProcessKilled), ba); - return; - } - if (d->m_copyState.copyFileHandle) - closeRemoteFile(true); - disconnectTrk(); - break; - case Disconnected: - break; - case Connecting: - case WaitingForTrk: - setState(Disconnected); - emit finished(); - break; - } -} - -void Launcher::handleRemoteProcessKilled(const TrkResult &result) -{ - Q_UNUSED(result) - disconnectTrk(); -} - -QString Launcher::msgStopped(uint pid, uint tid, uint address, const QString &why) -{ - return QString::fromLatin1("Process %1, thread %2 stopped at 0x%3: %4"). - arg(pid).arg(tid).arg(address, 0, 16). - arg(why.isEmpty() ? QString::fromLatin1("") : why); -} - -bool Launcher::parseNotifyStopped(const QByteArray &dataBA, - uint *pid, uint *tid, uint *address, - QString *why /* = 0 */) -{ - if (why) - why->clear(); - *address = *pid = *tid = 0; - if (dataBA.size() < 12) - return false; - const char *data = dataBA.data(); - *address = extractInt(data); - *pid = extractInt(data + 4); - *tid = extractInt(data + 8); - if (why && dataBA.size() >= 14) { - const unsigned short len = extractShort(data + 12); - if (len > 0) - *why = QString::fromLatin1(data + 14, len); - } - return true; -} - -void Launcher::handleResult(const TrkResult &result) -{ - QByteArray prefix = "READ BUF: "; - QByteArray str = result.toString().toUtf8(); - if (result.isDebugOutput) { // handle application output - logMessage("APPLICATION OUTPUT: " + result.data); - emit applicationOutputReceived(result.data); - return; - } - switch (result.code) { - case TrkNotifyAck: - break; - case TrkNotifyNak: { // NAK - logMessage(prefix + "NAK: " + str); - //logMessage(prefix << "TOKEN: " << result.token); - logMessage(prefix + "ERROR: " + errorMessage(result.data.at(0))); - break; - } - case TrkNotifyStopped: { // Notified Stopped - QString reason; - uint pc; - uint pid; - uint tid; - parseNotifyStopped(result.data, &pid, &tid, &pc, &reason); - logMessage(prefix + msgStopped(pid, tid, pc, reason)); - emit(processStopped(pc, pid, tid, reason)); - d->m_device->sendTrkAck(result.token); - break; - } - case TrkNotifyException: { // Notify Exception (obsolete) - logMessage(prefix + "NOTE: EXCEPTION " + str); - d->m_device->sendTrkAck(result.token); - break; - } - case TrkNotifyInternalError: { // - logMessage(prefix + "NOTE: INTERNAL ERROR: " + str); - d->m_device->sendTrkAck(result.token); - break; - } - - // target->host OS notification - case TrkNotifyCreated: { // Notify Created - /* - const char *data = result.data.data(); - byte error = result.data.at(0); - byte type = result.data.at(1); // type: 1 byte; for dll item, this value is 2. - uint pid = extractInt(data + 2); // ProcessID: 4 bytes; - uint tid = extractInt(data + 6); //threadID: 4 bytes - uint codeseg = extractInt(data + 10); //code address: 4 bytes; code base address for the library - uint dataseg = extractInt(data + 14); //data address: 4 bytes; data base address for the library - uint len = extractShort(data + 18); //length: 2 bytes; length of the library name string to follow - QByteArray name = result.data.mid(20, len); // name: library name - - logMessage(prefix + "NOTE: LIBRARY LOAD: " + str); - logMessage(prefix + "TOKEN: " + result.token); - logMessage(prefix + "ERROR: " + int(error)); - logMessage(prefix + "TYPE: " + int(type)); - logMessage(prefix + "PID: " + pid); - logMessage(prefix + "TID: " + tid); - logMessage(prefix + "CODE: " + codeseg); - logMessage(prefix + "DATA: " + dataseg); - logMessage(prefix + "LEN: " + len); - logMessage(prefix + "NAME: " + name); - */ - - if (result.data.size() < 10) - break; - QByteArray ba; - ba.append(result.data.mid(2, 8)); - d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE"); - //d->m_device->sendTrkAck(result.token) - break; - } - case TrkNotifyDeleted: { // NotifyDeleted - const ushort itemType = (unsigned char)result.data.at(1); - const ushort len = result.data.size() > 12 ? extractShort(result.data.data() + 10) : ushort(0); - const QString name = len ? QString::fromAscii(result.data.mid(12, len)) : QString(); - logMessage(QString::fromLatin1("%1 %2 UNLOAD: %3"). - arg(QString::fromAscii(prefix)).arg(itemType ? QLatin1String("LIB") : QLatin1String("PROCESS")). - arg(name)); - d->m_device->sendTrkAck(result.token); - if (itemType == 0 // process - && result.data.size() >= 10 - && d->m_session.pid == extractInt(result.data.data() + 6)) { - disconnectTrk(); - } - break; - } - case TrkNotifyProcessorStarted: { // NotifyProcessorStarted - logMessage(prefix + "NOTE: PROCESSOR STARTED: " + str); - d->m_device->sendTrkAck(result.token); - break; - } - case TrkNotifyProcessorStandBy: { // NotifyProcessorStandby - logMessage(prefix + "NOTE: PROCESSOR STANDBY: " + str); - d->m_device->sendTrkAck(result.token); - break; - } - case TrkNotifyProcessorReset: { // NotifyProcessorReset - logMessage(prefix + "NOTE: PROCESSOR RESET: " + str); - d->m_device->sendTrkAck(result.token); - break; - } - default: { - logMessage(prefix + "INVALID: " + str); - break; - } - } -} - -QString Launcher::deviceDescription(unsigned verbose) const -{ - return d->m_session.deviceDescription(verbose); -} - -void Launcher::handleTrkVersion(const TrkResult &result) -{ - if (result.errorCode() || result.data.size() < 5) { - if (d->m_startupActions == ActionPingOnly) { - setState(Disconnected); - emit finished(); - } - return; - } - d->m_session.trkAppVersion.trkMajor = result.data.at(1); - d->m_session.trkAppVersion.trkMinor = result.data.at(2); - d->m_session.trkAppVersion.protocolMajor = result.data.at(3); - d->m_session.trkAppVersion.protocolMinor = result.data.at(4); - setState(DeviceDescriptionReceived); - // Ping mode: Log & Terminate - if (d->m_startupActions == ActionPingOnly) { - qWarning("%s", qPrintable(deviceDescription())); - setState(Disconnected); - emit finished(); - } -} - -void Launcher::handleFileCreation(const TrkResult &result) -{ - if (result.errorCode() || result.data.size() < 6) { - emit canNotCreateFile(d->m_copyState.destinationFileName, result.errorString()); - disconnectTrk(); - return; - } - const char *data = result.data.data(); - d->m_copyState.copyFileHandle = extractInt(data + 2); - QFile file(d->m_copyState.sourceFileName); - file.open(QIODevice::ReadOnly); - d->m_copyState.data.reset(new QByteArray(file.readAll())); - d->m_copyState.position = 0; - file.close(); - continueCopying(); -} - -void Launcher::handleCopy(const TrkResult &result) -{ - if (result.errorCode() || result.data.size() < 4) { - closeRemoteFile(true); - emit canNotWriteFile(d->m_copyState.destinationFileName, result.errorString()); - disconnectTrk(); - } else { - continueCopying(extractShort(result.data.data() + 2)); - } -} - -void Launcher::continueCopying(uint lastCopiedBlockSize) -{ - int size = d->m_copyState.data->length(); - d->m_copyState.position += lastCopiedBlockSize; - if (size == 0) - emit copyProgress(100); - else { - int percent = qMin((d->m_copyState.position*100)/size, 100); - emit copyProgress(percent); - } - if (d->m_copyState.position < size) { - QByteArray ba; - appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); - appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, 2048), TargetByteOrder, false); - d->m_device->sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba); - } else { - closeRemoteFile(); - } -} - -void Launcher::closeRemoteFile(bool failed) -{ - QByteArray ba; - appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); - appendDateTime(&ba, QDateTime::currentDateTime(), TargetByteOrder); - d->m_device->sendTrkMessage(TrkCloseFile, - failed ? TrkCallback() : TrkCallback(this, &Launcher::handleFileCopied), - ba); - d->m_copyState.data.reset(); - d->m_copyState.copyFileHandle = 0; - d->m_copyState.position = 0; -} - -void Launcher::handleFileCopied(const TrkResult &result) -{ - if (result.errorCode()) - emit canNotCloseFile(d->m_copyState.destinationFileName, result.errorString()); - if (d->m_startupActions & ActionInstall) - installRemotePackageSilently(); - else if (d->m_startupActions & ActionRun) - startInferiorIfNeeded(); - else - disconnectTrk(); -} - -void Launcher::handleCpuType(const TrkResult &result) -{ - logMessage("HANDLE CPU TYPE: " + result.toString()); - if(result.errorCode() || result.data.size() < 7) - return; - //---TRK------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 - // [80 03 00 04 00 00 04 00 00 00] - d->m_session.cpuMajor = result.data.at(1); - d->m_session.cpuMinor = result.data.at(2); - d->m_session.bigEndian = result.data.at(3); - d->m_session.defaultTypeSize = result.data.at(4); - d->m_session.fpTypeSize = result.data.at(5); - d->m_session.extended1TypeSize = result.data.at(6); - //d->m_session.extended2TypeSize = result.data[6]; -} - -void Launcher::handleCreateProcess(const TrkResult &result) -{ - if (result.errorCode()) { - emit canNotRun(result.errorString()); - disconnectTrk(); - return; - } - // 40 00 00] - //logMessage(" RESULT: " + result.toString()); - // [80 08 00 00 00 01 B5 00 00 01 B6 78 67 40 00 00 40 00 00] - const char *data = result.data.data(); - d->m_session.pid = extractInt(data + 1); - d->m_session.tid = extractInt(data + 5); - d->m_session.codeseg = extractInt(data + 9); - d->m_session.dataseg = extractInt(data + 13); - if (d->m_verbose) { - const QString msg = QString::fromLatin1("Process id: %1 Thread id: %2 code: 0x%3 data: 0x%4"). - arg(d->m_session.pid).arg(d->m_session.tid).arg(d->m_session.codeseg, 0, 16). - arg(d->m_session.dataseg, 0 ,16); - logMessage(msg); - } - emit applicationRunning(d->m_session.pid); - QByteArray ba; - appendInt(&ba, d->m_session.pid); - appendInt(&ba, d->m_session.tid); - d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE"); -} - -void Launcher::handleWaitForFinished(const TrkResult &result) -{ - logMessage(" FINISHED: " + stringFromArray(result.data)); - setState(Disconnected); - emit finished(); -} - -void Launcher::handleSupportMask(const TrkResult &result) -{ - if (result.errorCode() || result.data.size() < 32) - return; - const char *data = result.data.data() + 1; - - QString str = QLatin1String("SUPPORTED: "); - for (int i = 0; i < 32; ++i) { - //str.append(" [" + formatByte(data[i]) + "]: "); - for (int j = 0; j < 8; ++j) { - if (data[i] & (1 << j)) { - str.append(QString::number(i * 8 + j, 16)); - str.append(QLatin1Char(' ')); - } - } - } - logMessage(str); -} - -void Launcher::cleanUp() -{ - // - //---IDE------------------------------------------------------ - // Command: 0x41 Delete Item - // Sub Cmd: Delete Process - //ProcessID: 0x0000071F (1823) - // [41 24 00 00 00 00 07 1F] - QByteArray ba(2, char(0)); - appendInt(&ba, d->m_session.pid); - d->m_device->sendTrkMessage(TrkDeleteItem, TrkCallback(), ba, "Delete process"); - - //---TRK------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 - // [80 24 00] - - //---IDE------------------------------------------------------ - // Command: 0x1C Clear Break - // [1C 25 00 00 00 0A 78 6A 43 40] - - //---TRK------------------------------------------------------ - // Command: 0xA1 Notify Deleted - // [A1 09 00 00 00 00 00 00 00 00 07 1F] - //---IDE------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 - // [80 09 00] - - //---TRK------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 - // [80 25 00] - - //---IDE------------------------------------------------------ - // Command: 0x1C Clear Break - // [1C 26 00 00 00 0B 78 6A 43 70] - //---TRK------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 - // [80 26 00] - - - //---IDE------------------------------------------------------ - // Command: 0x02 Disconnect - // [02 27] -// sendTrkMessage(0x02, TrkCallback(this, &Launcher::handleDisconnect)); - //---TRK------------------------------------------------------ - // Command: 0x80 Acknowledge - // Error: 0x00 -} - -void Launcher::disconnectTrk() -{ - d->m_device->sendTrkMessage(TrkDisconnect, TrkCallback(this, &Launcher::handleWaitForFinished)); -} - -void Launcher::copyFileToRemote() -{ - emit copyingStarted(); - QByteArray ba; - ba.append(char(10)); - appendString(&ba, d->m_copyState.destinationFileName.toLocal8Bit(), TargetByteOrder, false); - d->m_device->sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba); -} - -void Launcher::installRemotePackageSilently() -{ - emit installingStarted(); - QByteArray ba; - ba.append('C'); - appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false); - d->m_device->sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba); -} - -void Launcher::handleInstallPackageFinished(const TrkResult &result) -{ - if (result.errorCode()) { - emit canNotInstall(d->m_installFileName, result.errorString()); - disconnectTrk(); - return; - } else { - emit installingFinished(); - } - if (d->m_startupActions & ActionRun) { - startInferiorIfNeeded(); - } else { - disconnectTrk(); - } -} - -QByteArray Launcher::startProcessMessage(const QString &executable, - const QStringList &arguments) -{ - // It's not started yet - QByteArray ba; - appendShort(&ba, 0, TargetByteOrder); // create new process - ba.append(char(0)); // options - currently unused - if(arguments.isEmpty()) { - appendString(&ba, executable.toLocal8Bit(), TargetByteOrder); - return ba; - } - // Append full command line as one string (leading length information). - QByteArray commandLineBa; - commandLineBa.append(executable.toLocal8Bit()); - commandLineBa.append('\0'); - commandLineBa.append(arguments.join(QString(QLatin1Char(' '))).toLocal8Bit()); - appendString(&ba, commandLineBa, TargetByteOrder); - return ba; -} - -void Launcher::startInferiorIfNeeded() -{ - emit startingApplication(); - if (d->m_session.pid != 0) { - logMessage("Process already 'started'"); - return; - } - d->m_device->sendTrkMessage(TrkCreateItem, TrkCallback(this, &Launcher::handleCreateProcess), - startProcessMessage(d->m_fileName, d->m_commandLineArgs)); // Create Item -} - -void Launcher::resumeProcess(uint pid, uint tid) -{ - QByteArray ba; - appendInt(&ba, pid, BigEndian); - appendInt(&ba, tid, BigEndian); - d->m_device->sendTrkMessage(TrkContinue, TrkCallback(), ba, "CONTINUE"); -} -} // namespace trk diff --git a/tools/runonphone/trk/launcher.h b/tools/runonphone/trk/launcher.h deleted file mode 100644 index 2b23fd8..0000000 --- a/tools/runonphone/trk/launcher.h +++ /dev/null @@ -1,179 +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 tools applications 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 LAUNCHER_H -#define LAUNCHER_H - -#include "trkdevice.h" - -#include -#include -#include - -namespace trk { - -struct TrkResult; -struct TrkMessage; -struct LauncherPrivate; - -typedef QSharedPointer TrkDevicePtr; - -class SYMBIANUTILS_EXPORT Launcher : public QObject -{ - Q_OBJECT - Q_DISABLE_COPY(Launcher) -public: - typedef void (Launcher::*TrkCallBack)(const TrkResult &); - - enum Actions { - ActionPingOnly = 0x0, - ActionCopy = 0x1, - ActionInstall = 0x2, - ActionCopyInstall = ActionCopy | ActionInstall, - ActionRun = 0x4, - ActionCopyRun = ActionCopy | ActionRun, - ActionInstallRun = ActionInstall | ActionRun, - ActionCopyInstallRun = ActionCopy | ActionInstall | ActionRun - }; - - enum State { Disconnected, Connecting, Connected, - WaitingForTrk, // This occurs only if the initial ping times out after - // a reasonable timeout, indicating that Trk is not - // running. Note that this will never happen with - // Bluetooth as communication immediately starts - // after connecting. - DeviceDescriptionReceived }; - - explicit Launcher(trk::Launcher::Actions startupActions = trk::Launcher::ActionPingOnly, - const TrkDevicePtr &trkDevice = TrkDevicePtr(), - QObject *parent = 0); - ~Launcher(); - - State state() const; - - void addStartupActions(trk::Launcher::Actions startupActions); - void setTrkServerName(const QString &name); - QString trkServerName() const; - void setFileName(const QString &name); - void setCopyFileName(const QString &srcName, const QString &dstName); - void setInstallFileName(const QString &name); - void setCommandLineArgs(const QStringList &args); - bool startServer(QString *errorMessage); - void setVerbose(int v); - void setSerialFrame(bool b); - bool serialFrame() const; - // Close device or leave it open - bool closeDevice() const; - void setCloseDevice(bool c); - - TrkDevicePtr trkDevice() const; - - // becomes valid after successful execution of ActionPingOnly - QString deviceDescription(unsigned verbose = 0u) const; - - static QByteArray startProcessMessage(const QString &executable, - const QStringList &arguments); - // Parse a TrkNotifyStopped message - static bool parseNotifyStopped(const QByteArray &a, - uint *pid, uint *tid, uint *address, - QString *why = 0); - // Helper message - static QString msgStopped(uint pid, uint tid, uint address, const QString &why); - -signals: - void copyingStarted(); - void canNotConnect(const QString &errorMessage); - void canNotCreateFile(const QString &filename, const QString &errorMessage); - void canNotWriteFile(const QString &filename, const QString &errorMessage); - void canNotCloseFile(const QString &filename, const QString &errorMessage); - void installingStarted(); - void canNotInstall(const QString &packageFilename, const QString &errorMessage); - void installingFinished(); - void startingApplication(); - void applicationRunning(uint pid); - void canNotRun(const QString &errorMessage); - void finished(); - void applicationOutputReceived(const QString &output); - void copyProgress(int percent); - void stateChanged(int); - void processStopped(uint pc, uint pid, uint tid, const QString& reason); - -public slots: - void terminate(); - void resumeProcess(uint pid, uint tid); - -private slots: - void handleResult(const trk::TrkResult &data); - void slotWaitingForTrk(); - -private: - // kill process and breakpoints - void cleanUp(); - void disconnectTrk(); - - void handleRemoteProcessKilled(const TrkResult &result); - void handleConnect(const TrkResult &result); - void handleFileCreation(const TrkResult &result); - void handleCopy(const TrkResult &result); - void continueCopying(uint lastCopiedBlockSize = 0); - void closeRemoteFile(bool failed = false); - void handleFileCopied(const TrkResult &result); - void handleInstallPackageFinished(const TrkResult &result); - void handleCpuType(const TrkResult &result); - void handleCreateProcess(const TrkResult &result); - void handleWaitForFinished(const TrkResult &result); - void handleStop(const TrkResult &result); - void handleSupportMask(const TrkResult &result); - void handleTrkVersion(const TrkResult &result); - - void copyFileToRemote(); - void installRemotePackageSilently(); - void startInferiorIfNeeded(); - - void logMessage(const QString &msg); - void setState(State s); - - LauncherPrivate *d; -}; - -} // namespace Trk - -#endif // LAUNCHER_H diff --git a/tools/runonphone/trk/symbianutils_global.h b/tools/runonphone/trk/symbianutils_global.h deleted file mode 100644 index a6ffbe7..0000000 --- a/tools/runonphone/trk/symbianutils_global.h +++ /dev/null @@ -1,55 +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 tools applications 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 SYMBIANUTILS_GLOBAL_H -#define SYMBIANUTILS_GLOBAL_H - -#include - -#if defined(SYMBIANUTILS_BUILD_LIB) -# define SYMBIANUTILS_EXPORT Q_DECL_EXPORT -#elif defined(SYMBIANUTILS_BUILD_STATIC_LIB) || defined(SYMBIANUTILS_INCLUDE_PRI) -# define SYMBIANUTILS_EXPORT -#else -# define SYMBIANUTILS_EXPORT Q_DECL_IMPORT -#endif - -#endif // SYMBIANUTILS_GLOBAL_H diff --git a/tools/runonphone/trk/trk.pri b/tools/runonphone/trk/trk.pri deleted file mode 100644 index a54df76..0000000 --- a/tools/runonphone/trk/trk.pri +++ /dev/null @@ -1,25 +0,0 @@ -INCLUDEPATH *= $$PWD - -# Input -HEADERS += $$PWD/symbianutils_global.h \ - $$PWD/callback.h \ - $$PWD/trkutils.h \ - $$PWD/trkutils_p.h \ - $$PWD/trkdevice.h \ - $$PWD/launcher.h \ - $$PWD/bluetoothlistener.h \ - $$PWD/communicationstarter.h - -SOURCES += $$PWD/trkutils.cpp \ - $$PWD/trkdevice.cpp \ - $$PWD/launcher.cpp \ - $$PWD/bluetoothlistener.cpp \ - $$PWD/communicationstarter.cpp - -# Tests/trklauncher is a console application -contains(QT, gui) { - HEADERS += $$PWD/bluetoothlistener_gui.h - SOURCES += $$PWD/bluetoothlistener_gui.cpp -} else { - message(Trk: Console ...) -} diff --git a/tools/runonphone/trk/trkdevice.cpp b/tools/runonphone/trk/trkdevice.cpp deleted file mode 100644 index d587135..0000000 --- a/tools/runonphone/trk/trkdevice.cpp +++ /dev/null @@ -1,1105 +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 tools applications 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 "trkdevice.h" -#include "trkutils.h" -#include "trkutils_p.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef Q_OS_WIN -# include -#else -# include - -# include -# include -# include -# include -# include -# include -# include -/* Required headers for select() according to POSIX.1-2001 */ -# include -/* Required headers for select() according to earlier standards: - #include - #include - #include -*/ -#endif - -#ifdef Q_OS_WIN - -// Format windows error from GetLastError() value: -// TODO: Use the one provided by the utils lib. -QString winErrorMessage(unsigned long error) -{ - QString rc = QString::fromLatin1("#%1: ").arg(error); - ushort *lpMsgBuf; - - const int len = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL); - if (len) { - rc = QString::fromUtf16(lpMsgBuf, len); - LocalFree(lpMsgBuf); - } else { - rc += QString::fromLatin1(""); - } - return rc; -} - -#endif - -enum { verboseTrk = 0 }; - -namespace trk { - -/////////////////////////////////////////////////////////////////////// -// -// TrkMessage -// -/////////////////////////////////////////////////////////////////////// - -/* A message to be send to TRK, triggering a callback on receipt - * of the answer. */ -struct TrkMessage -{ - explicit TrkMessage(byte code = 0u, byte token = 0u, - TrkCallback callback = TrkCallback()); - - byte code; - byte token; - QByteArray data; - QVariant cookie; - TrkCallback callback; -}; - -TrkMessage::TrkMessage(byte c, byte t, TrkCallback cb) : - code(c), - token(t), - callback(cb) -{ -} - -QDebug operator<<(QDebug d, const TrkMessage &msg) -{ - return d << "Message: Code: " << msg.code - << " Token: " << msg.token << " " << msg.data.toHex(); -} - -} // namespace trk - -Q_DECLARE_METATYPE(trk::TrkMessage) -Q_DECLARE_METATYPE(trk::TrkResult) - -namespace trk { - -/////////////////////////////////////////////////////////////////////// -// -// TrkWriteQueue: Mixin class that manages a write queue of Trk messages. -// pendingMessage()/notifyWriteResult() should be called from a worked/timer -// that writes the messages. The class does not take precautions for multithreading. -// A no-op message is simply taken off the queue. The calling class -// can use the helper invokeNoopMessage() to trigger its callback. -// -/////////////////////////////////////////////////////////////////////// - -class TrkWriteQueue -{ - Q_DISABLE_COPY(TrkWriteQueue) -public: - explicit TrkWriteQueue(); - - // Enqueue messages. - void queueTrkMessage(byte code, TrkCallback callback, - const QByteArray &data, const QVariant &cookie); - void queueTrkInitialPing(); - - // Call this from the device read notification with the results. - void slotHandleResult(const TrkResult &result, QMutex *mutex = 0); - - // pendingMessage() can be called periodically in a timer to retrieve - // the pending messages to be sent. - enum PendingMessageResult { - NoMessage, // No message in queue. - PendingMessage, /* There is a queued message. The calling class - * can write it out and use notifyWriteResult() - * to notify about the result. */ - NoopMessageDequeued // A no-op message has been dequeued. see invokeNoopMessage(). - }; - - PendingMessageResult pendingMessage(TrkMessage *message); - // Notify the queue about the success of the write operation - // after taking the pendingMessage off. - enum WriteResult { - WriteOk, - WriteFailedDiscard, // Discard failed message - WriteFailedKeep, // Keep failed message - }; - void notifyWriteResult(WriteResult ok); - - // Helper function that invokes the callback of a no-op message - static void invokeNoopMessage(trk::TrkMessage); - -private: - typedef QMap TokenMessageMap; - - byte nextTrkWriteToken(); - - byte m_trkWriteToken; - QQueue m_trkWriteQueue; - TokenMessageMap m_writtenTrkMessages; - bool m_trkWriteBusy; -}; - -TrkWriteQueue::TrkWriteQueue() : - m_trkWriteToken(0), - m_trkWriteBusy(false) -{ -} - -byte TrkWriteQueue::nextTrkWriteToken() -{ - ++m_trkWriteToken; - if (m_trkWriteToken == 0) - ++m_trkWriteToken; - if (verboseTrk) - qDebug() << "Write token: " << m_trkWriteToken; - return m_trkWriteToken; -} - -void TrkWriteQueue::queueTrkMessage(byte code, TrkCallback callback, - const QByteArray &data, const QVariant &cookie) -{ - const byte token = code == TRK_WRITE_QUEUE_NOOP_CODE ? - byte(0) : nextTrkWriteToken(); - TrkMessage msg(code, token, callback); - msg.data = data; - msg.cookie = cookie; - m_trkWriteQueue.append(msg); -} - -TrkWriteQueue::PendingMessageResult TrkWriteQueue::pendingMessage(TrkMessage *message) -{ - // Invoked from timer, try to flush out message queue - if (m_trkWriteBusy || m_trkWriteQueue.isEmpty()) - return NoMessage; - // Handle the noop message, just invoke CB in slot (ower thread) - if (m_trkWriteQueue.front().code == TRK_WRITE_QUEUE_NOOP_CODE) { - *message = m_trkWriteQueue.dequeue(); - return NoopMessageDequeued; - } - // Insert into map fir answers (as reading threads might get an - // answer before notifyWriteResult(true)) is called. - *message = m_trkWriteQueue.front(); - m_writtenTrkMessages.insert(message->token, *message); - m_trkWriteBusy = true; - return PendingMessage; -} - -void TrkWriteQueue::invokeNoopMessage(trk::TrkMessage noopMessage) -{ - TrkResult result; - result.code = noopMessage.code; - result.token = noopMessage.token; - result.data = noopMessage.data; - result.cookie = noopMessage.cookie; - noopMessage.callback(result); -} - -void TrkWriteQueue::notifyWriteResult(WriteResult wr) -{ - // On success, dequeue message and await result - const byte token = m_trkWriteQueue.front().token; - switch (wr) { - case WriteOk: - m_trkWriteQueue.dequeue(); - break; - case WriteFailedKeep: - case WriteFailedDiscard: - m_writtenTrkMessages.remove(token); - m_trkWriteBusy = false; - if (wr == WriteFailedDiscard) - m_trkWriteQueue.dequeue(); - break; - } -} - -void TrkWriteQueue::slotHandleResult(const TrkResult &result, QMutex *mutex) -{ - // Find which request the message belongs to and invoke callback - // if ACK or on NAK if desired. - if (mutex) - mutex->lock(); - m_trkWriteBusy = false; - const TokenMessageMap::iterator it = m_writtenTrkMessages.find(result.token); - if (it == m_writtenTrkMessages.end()) { - if (mutex) - mutex->unlock(); - return; - } - TrkCallback callback = it.value().callback; - const QVariant cookie = it.value().cookie; - m_writtenTrkMessages.erase(it); - if (mutex) - mutex->unlock(); - // Invoke callback - if (callback) { - TrkResult result1 = result; - result1.cookie = cookie; - callback(result1); - } -} - -void TrkWriteQueue::queueTrkInitialPing() -{ - // Ping, reset sequence count - m_trkWriteToken = 0; - m_trkWriteQueue.append(TrkMessage(TrkPing, 0)); -} - -/////////////////////////////////////////////////////////////////////// -// -// DeviceContext to be shared between threads -// -/////////////////////////////////////////////////////////////////////// - -struct DeviceContext { - DeviceContext(); -#ifdef Q_OS_WIN - HANDLE device; - OVERLAPPED readOverlapped; - OVERLAPPED writeOverlapped; -#else - QFile file; -#endif - bool serialFrame; - QMutex mutex; -}; - -DeviceContext::DeviceContext() : -#ifdef Q_OS_WIN - device(INVALID_HANDLE_VALUE), -#endif - serialFrame(true) -{ -} - -/////////////////////////////////////////////////////////////////////// -// -// TrkWriterThread: A thread operating a TrkWriteQueue. -// with exception of the handling of the TRK_WRITE_QUEUE_NOOP_CODE -// synchronization message. The invocation of the callback is then -// done by the thread owning the TrkWriteQueue, while pendingMessage() is called -// from another thread. This happens via a Qt::BlockingQueuedConnection. - -/////////////////////////////////////////////////////////////////////// - -class WriterThread : public QThread -{ - Q_OBJECT - Q_DISABLE_COPY(WriterThread) -public: - explicit WriterThread(const QSharedPointer &context); - - // Enqueue messages. - void queueTrkMessage(byte code, TrkCallback callback, - const QByteArray &data, const QVariant &cookie); - void queueTrkInitialPing(); - - // Call this from the device read notification with the results. - void slotHandleResult(const TrkResult &result); - - virtual void run(); - -signals: - void error(const QString &); - void internalNoopMessageDequeued(const trk::TrkMessage&); - -public slots: - bool trkWriteRawMessage(const TrkMessage &msg); - void terminate(); - void tryWrite(); - -private slots: - void invokeNoopMessage(const trk::TrkMessage &); - -private: - bool write(const QByteArray &data, QString *errorMessage); - inline int writePendingMessage(); - - const QSharedPointer m_context; - QMutex m_dataMutex; - QMutex m_waitMutex; - QWaitCondition m_waitCondition; - TrkWriteQueue m_queue; - bool m_terminate; -}; - -WriterThread::WriterThread(const QSharedPointer &context) : - m_context(context), - m_terminate(false) -{ - static const int trkMessageMetaId = qRegisterMetaType(); - Q_UNUSED(trkMessageMetaId) - connect(this, SIGNAL(internalNoopMessageDequeued(trk::TrkMessage)), - this, SLOT(invokeNoopMessage(trk::TrkMessage)), Qt::BlockingQueuedConnection); -} - -void WriterThread::run() -{ - while (writePendingMessage() == 0) ; -} - -int WriterThread::writePendingMessage() -{ - enum { MaxAttempts = 100, RetryIntervalMS = 200 }; - - // Wait. Use a timeout in case something is already queued before we - // start up or some weird hanging exit condition - m_waitMutex.lock(); - m_waitCondition.wait(&m_waitMutex, 100); - m_waitMutex.unlock(); - if (m_terminate) - return 1; - - // Send off message - m_dataMutex.lock(); - TrkMessage message; - const TrkWriteQueue::PendingMessageResult pr = m_queue.pendingMessage(&message); - m_dataMutex.unlock(); - - switch (pr) { - case TrkWriteQueue::NoMessage: - break; - case TrkWriteQueue::PendingMessage: { - //qDebug() << "Write pending message " << message; - // Untested: try to re-send a few times - bool success = false; - for (int r = 0; !success && (r < MaxAttempts); r++) { - success = trkWriteRawMessage(message); - if (!success) { - emit error(QString::fromLatin1("Write failure, attempt %1 of %2.").arg(r).arg(int(MaxAttempts))); - if (m_terminate) - return 1; - QThread::msleep(RetryIntervalMS); - } - } - // Notify queue. If still failed, give up. - m_dataMutex.lock(); - m_queue.notifyWriteResult(success ? TrkWriteQueue::WriteOk : TrkWriteQueue::WriteFailedDiscard); - m_dataMutex.unlock(); - } - break; - case TrkWriteQueue::NoopMessageDequeued: - // Sync with thread that owns us via a blocking signal - if (verboseTrk) - qDebug() << "Noop message dequeued" << message; - emit internalNoopMessageDequeued(message); - break; - } // switch - return 0; -} - -void WriterThread::invokeNoopMessage(const trk::TrkMessage &msg) -{ - TrkWriteQueue::invokeNoopMessage(msg); -} - -void WriterThread::terminate() -{ - m_terminate = true; - m_waitCondition.wakeAll(); - wait(); - m_terminate = false; -} - -#ifdef Q_OS_WIN - -static inline QString msgTerminated(int size) -{ - return QString::fromLatin1("Terminated with %1 bytes pending.").arg(size); -} - -// Interruptible synchronous write function. -static inline bool overlappedSyncWrite(HANDLE file, - const bool &terminateFlag, - const char *data, - DWORD size, DWORD *charsWritten, - OVERLAPPED *overlapped, - QString *errorMessage) -{ - if (WriteFile(file, data, size, charsWritten, overlapped)) - return true; - const DWORD writeError = GetLastError(); - if (writeError != ERROR_IO_PENDING) { - *errorMessage = QString::fromLatin1("WriteFile failed: %1").arg(winErrorMessage(writeError)); - return false; - } - // Wait for written or thread terminated - const DWORD timeoutMS = 200; - const unsigned maxAttempts = 20; - DWORD wr = WaitForSingleObject(overlapped->hEvent, timeoutMS); - for (unsigned n = 0; wr == WAIT_TIMEOUT && n < maxAttempts && !terminateFlag; - wr = WaitForSingleObject(overlapped->hEvent, timeoutMS), n++); - if (terminateFlag) { - *errorMessage = msgTerminated(size); - return false; - } - switch (wr) { - case WAIT_OBJECT_0: - break; - case WAIT_TIMEOUT: - *errorMessage = QString::fromLatin1("Write timed out."); - return false; - default: - *errorMessage = QString::fromLatin1("Error while waiting for WriteFile results: %1").arg(winErrorMessage(GetLastError())); - return false; - } - if (!GetOverlappedResult(file, overlapped, charsWritten, TRUE)) { - *errorMessage = QString::fromLatin1("Error writing %1 bytes: %2").arg(size).arg(winErrorMessage(GetLastError())); - return false; - } - return true; -} -#endif - -bool WriterThread::write(const QByteArray &data, QString *errorMessage) -{ - if (verboseTrk) - qDebug() << "Write raw data: " << stringFromArray(data).toLatin1(); - QMutexLocker locker(&m_context->mutex); -#ifdef Q_OS_WIN - DWORD charsWritten; - if (!overlappedSyncWrite(m_context->device, m_terminate, data.data(), data.size(), &charsWritten, &m_context->writeOverlapped, errorMessage)) { - return false; - } - FlushFileBuffers(m_context->device); - return true; -#else - if (m_context->file.write(data) == -1 || !m_context->file.flush()) { - *errorMessage = QString::fromLatin1("Cannot write: %1").arg(m_context->file.errorString()); - return false; - } - return true; -#endif -} - -bool WriterThread::trkWriteRawMessage(const TrkMessage &msg) -{ - const QByteArray ba = frameMessage(msg.code, msg.token, msg.data, m_context->serialFrame); - QString errorMessage; - const bool rc = write(ba, &errorMessage); - if (!rc) { - qWarning("%s\n", qPrintable(errorMessage)); - emit error(errorMessage); - } - return rc; -} - -void WriterThread::tryWrite() -{ - m_waitCondition.wakeAll(); -} - -void WriterThread::queueTrkMessage(byte code, TrkCallback callback, - const QByteArray &data, const QVariant &cookie) -{ - m_dataMutex.lock(); - m_queue.queueTrkMessage(code, callback, data, cookie); - m_dataMutex.unlock(); - tryWrite(); -} - -void WriterThread::queueTrkInitialPing() -{ - m_dataMutex.lock(); - m_queue.queueTrkInitialPing(); - m_dataMutex.unlock(); - tryWrite(); -} - -// Call this from the device read notification with the results. -void WriterThread::slotHandleResult(const TrkResult &result) -{ - m_queue.slotHandleResult(result, &m_dataMutex); - tryWrite(); // Have messages been enqueued in-between? -} - - -/////////////////////////////////////////////////////////////////////// -// -// ReaderThreadBase: Base class for a thread that reads data from -// the device, decodes the messages and emit signals for the messages. -// A Qt::BlockingQueuedConnection should be used for the message signal -// to ensure messages are processed in the correct sequence. -// -/////////////////////////////////////////////////////////////////////// - -class ReaderThreadBase : public QThread -{ - Q_OBJECT - Q_DISABLE_COPY(ReaderThreadBase) -public: - -signals: - void messageReceived(const trk::TrkResult &result, const QByteArray &rawData); - -protected: - explicit ReaderThreadBase(const QSharedPointer &context); - void processData(const QByteArray &a); - void processData(char c); - - const QSharedPointer m_context; - -private: - void readMessages(); - - QByteArray m_trkReadBuffer; -}; - -ReaderThreadBase::ReaderThreadBase(const QSharedPointer &context) : - m_context(context) -{ - static const int trkResultMetaId = qRegisterMetaType(); - Q_UNUSED(trkResultMetaId) -} - -void ReaderThreadBase::processData(const QByteArray &a) -{ - m_trkReadBuffer += a; - readMessages(); -} - -void ReaderThreadBase::processData(char c) -{ - m_trkReadBuffer += c; - if (m_trkReadBuffer.size() > 1) - readMessages(); -} - -void ReaderThreadBase::readMessages() -{ - TrkResult r; - QByteArray rawData; - while (extractResult(&m_trkReadBuffer, m_context->serialFrame, &r, &rawData)) { - emit messageReceived(r, rawData); - } -} - -#ifdef Q_OS_WIN -/////////////////////////////////////////////////////////////////////// -// -// WinReaderThread: A thread reading from the device using Windows API. -// Waits on an overlapped I/O handle and an event that tells the thread to -// terminate. -// -/////////////////////////////////////////////////////////////////////// - -class WinReaderThread : public ReaderThreadBase -{ - Q_OBJECT - Q_DISABLE_COPY(WinReaderThread) -public: - explicit WinReaderThread(const QSharedPointer &context); - ~WinReaderThread(); - - virtual void run(); - -signals: - void error(const QString &); - -public slots: - void terminate(); - -private: - enum Handles { FileHandle, TerminateEventHandle, HandleCount }; - - inline int tryRead(); - - HANDLE m_handles[HandleCount]; -}; - -WinReaderThread::WinReaderThread(const QSharedPointer &context) : - ReaderThreadBase(context) -{ - m_handles[FileHandle] = NULL; - m_handles[TerminateEventHandle] = CreateEvent(NULL, FALSE, FALSE, NULL); -} - -WinReaderThread::~WinReaderThread() -{ - CloseHandle(m_handles[TerminateEventHandle]); -} - -// Return 0 to continue or error code -int WinReaderThread::tryRead() -{ - enum { BufSize = 1024 }; - char buffer[BufSize]; - // Check if there are already bytes waiting. If not, wait for first byte - COMSTAT comStat; - if (!ClearCommError(m_context->device, NULL, &comStat)){ - emit error(QString::fromLatin1("ClearCommError failed: %1").arg(winErrorMessage(GetLastError()))); - return -7; - } - const DWORD bytesToRead = qMax(DWORD(1), qMin(comStat.cbInQue, DWORD(BufSize))); - // Trigger read - DWORD bytesRead = 0; - if (ReadFile(m_context->device, &buffer, bytesToRead, &bytesRead, &m_context->readOverlapped)) { - if (bytesRead == 1) { - processData(buffer[0]); - } else { - processData(QByteArray(buffer, bytesRead)); - } - return 0; - } - const DWORD readError = GetLastError(); - if (readError != ERROR_IO_PENDING) { - emit error(QString::fromLatin1("Read error: %1").arg(winErrorMessage(readError))); - return -1; - } - // Wait for either termination or data - const DWORD wr = WaitForMultipleObjects(HandleCount, m_handles, false, INFINITE); - if (wr == WAIT_FAILED) { - emit error(QString::fromLatin1("Wait failed: %1").arg(winErrorMessage(GetLastError()))); - return -2; - } - if (wr - WAIT_OBJECT_0 == TerminateEventHandle) { - return 1; // Terminate - } - // Check data - if (!GetOverlappedResult(m_context->device, &m_context->readOverlapped, &bytesRead, true)) { - emit error(QString::fromLatin1("GetOverlappedResult failed: %1").arg(winErrorMessage(GetLastError()))); - return -3; - } - if (bytesRead == 1) { - processData(buffer[0]); - } else { - processData(QByteArray(buffer, bytesRead)); - } - return 0; -} - -void WinReaderThread::run() -{ - m_handles[FileHandle] = m_context->readOverlapped.hEvent; - while ( tryRead() == 0) ; -} - -void WinReaderThread::terminate() -{ - SetEvent(m_handles[TerminateEventHandle]); - wait(); -} - -typedef WinReaderThread ReaderThread; - -#else - -/////////////////////////////////////////////////////////////////////// -// -// UnixReaderThread: A thread reading from the device. -// Uses select() to wait and a special ioctl() to find out the number -// of bytes queued. For clean termination, the self-pipe trick is used. -// The class maintains a pipe, on whose read end the select waits besides -// the device file handle. To terminate, a byte is written to the pipe. -// -/////////////////////////////////////////////////////////////////////// - -static inline QString msgUnixCallFailedErrno(const char *func, int errorNumber) -{ - return QString::fromLatin1("Call to %1() failed: %2").arg(QLatin1String(func), QString::fromLocal8Bit(strerror(errorNumber))); -} - -class UnixReaderThread : public ReaderThreadBase { - Q_OBJECT - Q_DISABLE_COPY(UnixReaderThread) -public: - explicit UnixReaderThread(const QSharedPointer &context); - ~UnixReaderThread(); - - virtual void run(); - -signals: - void error(const QString &); - -public slots: - void terminate(); - -private: - inline int tryRead(); - - int m_terminatePipeFileDescriptors[2]; -}; - -UnixReaderThread::UnixReaderThread(const QSharedPointer &context) : - ReaderThreadBase(context) -{ - m_terminatePipeFileDescriptors[0] = m_terminatePipeFileDescriptors[1] = -1; - // Set up pipes for termination. Should not fail - if (pipe(m_terminatePipeFileDescriptors) < 0) - qWarning("%s\n", qPrintable(msgUnixCallFailedErrno("pipe", errno))); -} - -UnixReaderThread::~UnixReaderThread() -{ - close(m_terminatePipeFileDescriptors[0]); - close(m_terminatePipeFileDescriptors[1]); -} - -int UnixReaderThread::tryRead() -{ - fd_set readSet, tempReadSet, tempExceptionSet; - struct timeval timeOut; - const int fileDescriptor = m_context->file.handle(); - FD_ZERO(&readSet); - FD_SET(fileDescriptor, &readSet); - FD_SET(m_terminatePipeFileDescriptors[0], &readSet); - const int maxFileDescriptor = qMax(m_terminatePipeFileDescriptors[0], fileDescriptor); - int result = 0; - do { - memcpy(&tempReadSet, &readSet, sizeof(fd_set)); - memcpy(&tempExceptionSet, &readSet, sizeof(fd_set)); - timeOut.tv_sec = 1; - timeOut.tv_usec = 0; - result = select(maxFileDescriptor + 1, &tempReadSet, NULL, &tempExceptionSet, &timeOut); - } while ( result < 0 && errno == EINTR ); - // Timeout? - if (result == 0) - return 0; - // Something wrong? - if (result < 0) { - emit error(msgUnixCallFailedErrno("select", errno)); - return -1; - } - // Did the exception set trigger on the device? - if (FD_ISSET(fileDescriptor,&tempExceptionSet)) { - emit error(QLatin1String("An Exception occurred on the device.")); - return -2; - } - // Check termination pipe. - if (FD_ISSET(m_terminatePipeFileDescriptors[0], &tempReadSet) - || FD_ISSET(m_terminatePipeFileDescriptors[0], &tempExceptionSet)) - return 1; - - // determine number of pending bytes and read - int numBytes; - if (ioctl(fileDescriptor, FIONREAD, &numBytes) < 0) { - emit error(msgUnixCallFailedErrno("ioctl", errno)); - return -1; - } - m_context->mutex.lock(); - const QByteArray data = m_context->file.read(numBytes); - m_context->mutex.unlock(); - processData(data); - return 0; -} - -void UnixReaderThread::run() -{ - // Read loop - while (tryRead() == 0) - ; -} - -void UnixReaderThread::terminate() -{ - // Trigger select() by writing to the pipe - char c = 0; - const int written = write(m_terminatePipeFileDescriptors[1], &c, 1); - Q_UNUSED(written) - wait(); -} - -typedef UnixReaderThread ReaderThread; - -#endif - -/////////////////////////////////////////////////////////////////////// -// -// TrkDevicePrivate -// -/////////////////////////////////////////////////////////////////////// - -struct TrkDevicePrivate -{ - TrkDevicePrivate(); - - QSharedPointer deviceContext; - QSharedPointer writerThread; - QSharedPointer readerThread; - - QByteArray trkReadBuffer; - int verbose; - QString errorString; -}; - -/////////////////////////////////////////////////////////////////////// -// -// TrkDevice -// -/////////////////////////////////////////////////////////////////////// - -TrkDevicePrivate::TrkDevicePrivate() : - deviceContext(new DeviceContext), - verbose(0) -{ -} - -/////////////////////////////////////////////////////////////////////// -// -// TrkDevice -// -/////////////////////////////////////////////////////////////////////// - -TrkDevice::TrkDevice(QObject *parent) : - QObject(parent), - d(new TrkDevicePrivate) -{} - -TrkDevice::~TrkDevice() -{ - close(); - delete d; -} - -bool TrkDevice::open(const QString &port, QString *errorMessage) -{ - if (d->verbose) - qDebug() << "Opening" << port << "is open: " << isOpen() << " serialFrame=" << serialFrame(); - close(); -#ifdef Q_OS_WIN - d->deviceContext->device = CreateFile(QString("\\\\.\\").append(port).toStdWString().c_str(), - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING|FILE_FLAG_OVERLAPPED, - NULL); - - if (INVALID_HANDLE_VALUE == d->deviceContext->device) { - *errorMessage = QString::fromLatin1("Could not open device '%1': %2").arg(port, winErrorMessage(GetLastError())); - return false; - } - memset(&d->deviceContext->readOverlapped, 0, sizeof(OVERLAPPED)); - d->deviceContext->readOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - memset(&d->deviceContext->writeOverlapped, 0, sizeof(OVERLAPPED)); - d->deviceContext->writeOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (d->deviceContext->readOverlapped.hEvent == NULL || d->deviceContext->writeOverlapped.hEvent == NULL) { - *errorMessage = QString::fromLatin1("Failed to create events: %1").arg(winErrorMessage(GetLastError())); - return false; - } -#else - d->deviceContext->file.setFileName(port); - if (!d->deviceContext->file.open(QIODevice::ReadWrite|QIODevice::Unbuffered)) { - *errorMessage = QString::fromLatin1("Cannot open %1: %2").arg(port, d->deviceContext->file.errorString()); - return false; - } - - struct termios termInfo; - if (tcgetattr(d->deviceContext->file.handle(), &termInfo) < 0) { - *errorMessage = QString::fromLatin1("Unable to retrieve terminal settings: %1 %2").arg(errno).arg(QString::fromAscii(strerror(errno))); - return false; - } - // Turn off terminal echo as not get messages back, among other things - termInfo.c_cflag |= CREAD|CLOCAL; - termInfo.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); - termInfo.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); - termInfo.c_oflag &= (~OPOST); - termInfo.c_cc[VMIN] = 0; - termInfo.c_cc[VINTR] = _POSIX_VDISABLE; - termInfo.c_cc[VQUIT] = _POSIX_VDISABLE; - termInfo.c_cc[VSTART] = _POSIX_VDISABLE; - termInfo.c_cc[VSTOP] = _POSIX_VDISABLE; - termInfo.c_cc[VSUSP] = _POSIX_VDISABLE; - if (tcsetattr(d->deviceContext->file.handle(), TCSAFLUSH, &termInfo) < 0) { - *errorMessage = QString::fromLatin1("Unable to apply terminal settings: %1 %2").arg(errno).arg(QString::fromAscii(strerror(errno))); - return false; - } -#endif - d->readerThread = QSharedPointer(new ReaderThread(d->deviceContext)); - connect(d->readerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)), - Qt::QueuedConnection); - connect(d->readerThread.data(), SIGNAL(messageReceived(trk::TrkResult,QByteArray)), - this, SLOT(slotMessageReceived(trk::TrkResult,QByteArray)), - Qt::QueuedConnection); - d->readerThread->start(); - - d->writerThread = QSharedPointer(new WriterThread(d->deviceContext)); - connect(d->writerThread.data(), SIGNAL(error(QString)), this, SLOT(emitError(QString)), - Qt::QueuedConnection); - d->writerThread->start(); - - if (d->verbose) - qDebug() << "Opened" << port; - return true; -} - -void TrkDevice::close() -{ - if (!isOpen()) - return; - if (d->readerThread) - d->readerThread->terminate(); - if (d->writerThread) - d->writerThread->terminate(); -#ifdef Q_OS_WIN - CloseHandle(d->deviceContext->device); - d->deviceContext->device = INVALID_HANDLE_VALUE; - CloseHandle(d->deviceContext->readOverlapped.hEvent); - CloseHandle(d->deviceContext->writeOverlapped.hEvent); - d->deviceContext->readOverlapped.hEvent = d->deviceContext->writeOverlapped.hEvent = NULL; -#else - d->deviceContext->file.close(); -#endif - if (d->verbose) - emitLogMessage("Close"); -} - -bool TrkDevice::isOpen() const -{ -#ifdef Q_OS_WIN - return d->deviceContext->device != INVALID_HANDLE_VALUE; -#else - return d->deviceContext->file.isOpen(); -#endif -} - -QString TrkDevice::errorString() const -{ - return d->errorString; -} - -bool TrkDevice::serialFrame() const -{ - return d->deviceContext->serialFrame; -} - -void TrkDevice::setSerialFrame(bool f) -{ - d->deviceContext->serialFrame = f; -} - -int TrkDevice::verbose() const -{ - return d->verbose; -} - -void TrkDevice::setVerbose(int b) -{ - d->verbose = b; -} - -void TrkDevice::slotMessageReceived(const trk::TrkResult &result, const QByteArray &rawData) -{ - d->writerThread->slotHandleResult(result); - if (d->verbose > 1) - qDebug() << "Received: " << result.toString(); - emit messageReceived(result); - if (!rawData.isEmpty()) - emit rawDataReceived(rawData); -} - -void TrkDevice::emitError(const QString &s) -{ - d->errorString = s; - qWarning("%s\n", qPrintable(s)); - emit error(s); -} - -void TrkDevice::sendTrkMessage(byte code, TrkCallback callback, - const QByteArray &data, const QVariant &cookie) -{ - if (!d->writerThread.isNull()) { - if (d->verbose > 1) { - QByteArray msg = "Sending: "; - msg += QByteArray::number(code, 16); - msg += ": "; - msg += stringFromArray(data).toLatin1(); - qDebug("%s", msg.data()); - } - d->writerThread->queueTrkMessage(code, callback, data, cookie); - } -} - -void TrkDevice::sendTrkInitialPing() -{ - if (!d->writerThread.isNull()) - d->writerThread->queueTrkInitialPing(); -} - -bool TrkDevice::sendTrkAck(byte token) -{ - if (d->writerThread.isNull()) - return false; - // The acknowledgement must not be queued! - TrkMessage msg(0x80, token); - msg.token = token; - msg.data.append('\0'); - if (verboseTrk) - qDebug() << "Write synchroneous message: " << msg; - return d->writerThread->trkWriteRawMessage(msg); - // 01 90 00 07 7e 80 01 00 7d 5e 7e -} - -void TrkDevice::emitLogMessage(const QString &msg) -{ - if (d->verbose) - qDebug("%s\n", qPrintable(msg)); - emit logMessage(msg); -} - -} // namespace trk - -#include "trkdevice.moc" diff --git a/tools/runonphone/trk/trkdevice.h b/tools/runonphone/trk/trkdevice.h deleted file mode 100644 index 21a3cc1..0000000 --- a/tools/runonphone/trk/trkdevice.h +++ /dev/null @@ -1,134 +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 tools applications 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 TRKDEVICE_H -#define TRKDEVICE_H - -#include "symbianutils_global.h" -#include "callback.h" - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QIODevice; -QT_END_NAMESPACE - -namespace trk { - -struct TrkResult; -struct TrkMessage; -struct TrkDevicePrivate; - -/* TrkDevice: Implements a Windows COM or Linux device for - * Trk communications. Provides synchronous write and asynchronous - * read operation. - * The serialFrames property specifies whether packets are encapsulated in - * "0x90 " frames, which is currently the case for serial ports. - * Contains a write message queue allowing - * for queueing messages with a notification callback. If the message receives - * an ACK, the callback is invoked. - * The special message TRK_WRITE_QUEUE_NOOP_CODE code can be used for synchronisation. - * The respective message will not be sent, the callback is just invoked. */ - -enum { TRK_WRITE_QUEUE_NOOP_CODE = 0x7f }; - -typedef trk::Callback TrkCallback; - -class SYMBIANUTILS_EXPORT TrkDevice : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool serialFrame READ serialFrame WRITE setSerialFrame) - Q_PROPERTY(bool verbose READ verbose WRITE setVerbose) -public: - explicit TrkDevice(QObject *parent = 0); - virtual ~TrkDevice(); - - bool open(const QString &port, QString *errorMessage); - bool isOpen() const; - - QString errorString() const; - - bool serialFrame() const; - void setSerialFrame(bool f); - - int verbose() const; - void setVerbose(int b); - - // Enqueue a message with a notification callback. - void sendTrkMessage(unsigned char code, - TrkCallback callBack = TrkCallback(), - const QByteArray &data = QByteArray(), - const QVariant &cookie = QVariant()); - - // Enqeue an initial ping - void sendTrkInitialPing(); - - // Send an Ack synchronously, bypassing the queue - bool sendTrkAck(unsigned char token); - -signals: - void messageReceived(const trk::TrkResult &result); - // Emitted with the contents of messages enclosed in 07e, not for log output - void rawDataReceived(const QByteArray &data); - void error(const QString &msg); - void logMessage(const QString &msg); - -private slots: - void slotMessageReceived(const trk::TrkResult &result, const QByteArray &a); - -protected slots: - void emitError(const QString &msg); - void emitLogMessage(const QString &msg); - -public slots: - void close(); - -private: - void readMessages(); - TrkDevicePrivate *d; -}; - -} // namespace trk - -#endif // TRKDEVICE_H diff --git a/tools/runonphone/trk/trkutils.cpp b/tools/runonphone/trk/trkutils.cpp deleted file mode 100644 index 5cce950..0000000 --- a/tools/runonphone/trk/trkutils.cpp +++ /dev/null @@ -1,479 +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 tools applications 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 "trkutils.h" -#include - -#include -#include -#include -#include -#include - -#define logMessage(s) do { qDebug() << "TRKCLIENT: " << s; } while (0) - -namespace trk { - -TrkAppVersion::TrkAppVersion() -{ - reset(); -} - -void TrkAppVersion::reset() -{ - trkMajor = trkMinor= protocolMajor = protocolMinor = 0; -} - -Session::Session() -{ - reset(); -} - -void Session::reset() -{ - cpuMajor = 0; - cpuMinor = 0; - bigEndian = 0; - defaultTypeSize = 0; - fpTypeSize = 0; - extended1TypeSize = 0; - extended2TypeSize = 0; - pid = 0; - tid = 0; - codeseg = 0; - dataseg = 0; - - currentThread = 0; - libraries.clear(); - trkAppVersion.reset(); -} - -static QString formatCpu(int major, int minor) -{ - //: CPU description of an S60 device - //: %1 major verison, %2 minor version - //: %3 real name of major verison, %4 real name of minor version - const QString str = QCoreApplication::translate("trk::Session", "CPU: v%1.%2%3%4"); - QString majorStr; - QString minorStr; - switch (major) { - case 0x04: - majorStr = " ARM"; - break; - } - switch (minor) { - case 0x00: - minorStr = " 920T"; - break; - } - return str.arg(major).arg(minor).arg(majorStr).arg(minorStr); - } - -QString formatTrkVersion(const TrkAppVersion &version) -{ - QString str = QCoreApplication::translate("trk::Session", - "App TRK: v%1.%2 TRK protocol: v%3.%4"); - str = str.arg(version.trkMajor).arg(version.trkMinor); - return str.arg(version.protocolMajor).arg(version.protocolMinor); -} - -QString Session::deviceDescription(unsigned verbose) const -{ - if (!cpuMajor) - return QString(); - - //: s60description - //: description of an S60 device - //: %1 CPU description, %2 endianness - //: %3 default type size (if any), %4 float size (if any) - //: %5 TRK version - QString msg = QCoreApplication::translate("trk::Session", "%1, %2%3%4, %5"); - QString endianness = bigEndian - ? QCoreApplication::translate("trk::Session", "big endian") - : QCoreApplication::translate("trk::Session", "little endian"); - msg = msg.arg(formatCpu(cpuMajor, cpuMinor)).arg(endianness); - //: The separator in a list of strings - QString defaultTypeSizeStr; - QString fpTypeSizeStr; - if (verbose && defaultTypeSize) - //: will be inserted into s60description - defaultTypeSizeStr = QCoreApplication::translate("trk::Session", ", type size: %1").arg(defaultTypeSize); - if (verbose && fpTypeSize) - //: will be inserted into s60description - fpTypeSizeStr = QCoreApplication::translate("trk::Session", ", float size: %1").arg(fpTypeSize); - msg = msg.arg(defaultTypeSizeStr).arg(fpTypeSizeStr); - return msg.arg(formatTrkVersion(trkAppVersion)); -} - - -QByteArray decode7d(const QByteArray &ba) -{ - QByteArray res; - res.reserve(ba.size()); - for (int i = 0; i < ba.size(); ++i) { - byte c = byte(ba.at(i)); - if (c == 0x7d) { - ++i; - c = 0x20 ^ byte(ba.at(i)); - } - res.append(c); - } - return res; -} - -QByteArray encode7d(const QByteArray &ba) -{ - QByteArray res; - res.reserve(ba.size() + 2); - for (int i = 0; i < ba.size(); ++i) { - byte c = byte(ba.at(i)); - if (c == 0x7e || c == 0x7d) { - res.append(0x7d); - res.append(0x20 ^ c); - } else { - res.append(c); - } - } - return res; -} - -// FIXME: Use the QByteArray based version below? -static inline QString stringFromByte(byte c) -{ - return QString::fromLatin1("%1").arg(c, 2, 16, QChar('0')); -} - -SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen) -{ - QString str; - QString ascii; - const int size = maxLen == -1 ? ba.size() : qMin(ba.size(), maxLen); - for (int i = 0; i < size; ++i) { - //if (i == 5 || i == ba.size() - 2) - // str += " "; - int c = byte(ba.at(i)); - str += QString("%1 ").arg(c, 2, 16, QChar('0')); - if (i >= 8 && i < ba.size() - 2) - ascii += QChar(c).isPrint() ? QChar(c) : QChar('.'); - } - if (size != ba.size()) { - str += "..."; - ascii += "..."; - } - return str + " " + ascii; -} - -SYMBIANUTILS_EXPORT QByteArray hexNumber(uint n, int digits) -{ - QByteArray ba = QByteArray::number(n, 16); - if (digits == 0 || ba.size() == digits) - return ba; - return QByteArray(digits - ba.size(), '0') + ba; -} - -SYMBIANUTILS_EXPORT QByteArray hexxNumber(uint n, int digits) -{ - return "0x" + hexNumber(n, digits); -} - -TrkResult::TrkResult() : - code(0), - token(0), - isDebugOutput(false) -{ -} - -void TrkResult::clear() -{ - code = token= 0; - isDebugOutput = false; - data.clear(); - cookie = QVariant(); -} - -QString TrkResult::toString() const -{ - QString res = stringFromByte(code); - res += QLatin1String(" ["); - res += stringFromByte(token); - res += QLatin1Char(']'); - res += QLatin1Char(' '); - res += stringFromArray(data); - return res; -} - -QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame) -{ - byte s = command + token; - for (int i = 0; i != data.size(); ++i) - s += data.at(i); - byte checksum = 255 - (s & 0xff); - //int x = s + ~s; - //logMessage("check: " << s << checksum << x; - - QByteArray response; - response.reserve(data.size() + 3); - response.append(char(command)); - response.append(char(token)); - response.append(data); - response.append(char(checksum)); - - QByteArray encodedData = encode7d(response); - - QByteArray ba; - ba.reserve(encodedData.size() + 6); - if (serialFrame) { - ba.append(char(0x01)); - ba.append(char(0x90)); - const ushort encodedSize = encodedData.size() + 2; // 2 x 0x7e - appendShort(&ba, encodedSize, BigEndian); - } - ba.append(char(0x7e)); - ba.append(encodedData); - ba.append(char(0x7e)); - - return ba; -} - -/* returns 0 if array doesn't represent a result, -otherwise returns the length of the result data */ -ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame) -{ - if (serialFrame) { - // Serial protocol with length info - if (buffer.length() < 4) - return 0; - if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90) - return 0; - const ushort len = extractShort(buffer.data() + 2); - return (buffer.size() >= len + 4) ? len : ushort(0); - } - // Frameless protocol without length info - const char delimiter = char(0x7e); - const int firstDelimiterPos = buffer.indexOf(delimiter); - // Regular message delimited by 0x7e..0x7e - if (firstDelimiterPos == 0) { - const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1); - return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0; - } - // Some ASCII log message up to first delimiter or all - return firstDelimiterPos != -1 ? firstDelimiterPos : buffer.size(); -} - -bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByteArray *rawData) -{ - result->clear(); - if(rawData) - rawData->clear(); - const ushort len = isValidTrkResult(*buffer, serialFrame); - if (!len) - return false; - // handle receiving application output, which is not a regular command - const int delimiterPos = serialFrame ? 4 : 0; - if (buffer->at(delimiterPos) != 0x7e) { - result->isDebugOutput = true; - result->data = buffer->mid(delimiterPos, len); - result->data.replace("\r\n", "\n"); - *buffer->remove(0, delimiterPos + len); - return true; - } - // FIXME: what happens if the length contains 0xfe? - // Assume for now that it passes unencoded! - const QByteArray data = decode7d(buffer->mid(delimiterPos + 1, len - 2)); - if(rawData) - *rawData = data; - *buffer->remove(0, delimiterPos + len); - - byte sum = 0; - for (int i = 0; i < data.size(); ++i) // 3 = 2 * 0xfe + sum - sum += byte(data.at(i)); - if (sum != 0xff) - logMessage("*** CHECKSUM ERROR: " << byte(sum)); - - result->code = data.at(0); - result->token = data.at(1); - result->data = data.mid(2, data.size() - 3); - //logMessage(" REST BUF: " << stringFromArray(*buffer)); - //logMessage(" CURR DATA: " << stringFromArray(data)); - //QByteArray prefix = "READ BUF: "; - //logMessage((prefix + "HEADER: " + stringFromArray(header).toLatin1()).data()); - return true; -} - -SYMBIANUTILS_EXPORT ushort extractShort(const char *data) -{ - return byte(data[0]) * 256 + byte(data[1]); -} - -SYMBIANUTILS_EXPORT uint extractInt(const char *data) -{ - uint res = byte(data[0]); - res *= 256; res += byte(data[1]); - res *= 256; res += byte(data[2]); - res *= 256; res += byte(data[3]); - return res; -} - -SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba) -{ - QString res; - char buf[10]; - for (int i = 0, n = ba.size(); i != n; ++i) { - const byte c = ba.at(i); - if (isprint(c)) { - res += c; - } else { - qsnprintf(buf, sizeof(buf) - 1, "\\%x", int(c)); - res += buf; - } - } - return res; -} - -SYMBIANUTILS_EXPORT void appendShort(QByteArray *ba, ushort s, Endianness endian) -{ - if (endian == BigEndian) { - ba->append(s / 256); - ba->append(s % 256); - } else { - ba->append(s % 256); - ba->append(s / 256); - } -} - -SYMBIANUTILS_EXPORT void appendInt(QByteArray *ba, uint i, Endianness endian) -{ - const uchar b3 = i % 256; i /= 256; - const uchar b2 = i % 256; i /= 256; - const uchar b1 = i % 256; i /= 256; - const uchar b0 = i; - ba->reserve(ba->size() + 4); - if (endian == BigEndian) { - ba->append(b0); - ba->append(b1); - ba->append(b2); - ba->append(b3); - } else { - ba->append(b3); - ba->append(b2); - ba->append(b1); - ba->append(b0); - } -} - -void appendString(QByteArray *ba, const QByteArray &str, Endianness endian, bool appendNullTerminator) -{ - const int fullSize = str.size() + (appendNullTerminator ? 1 : 0); - appendShort(ba, fullSize, endian); // count the terminating \0 - ba->append(str); - if (appendNullTerminator) - ba->append('\0'); -} - -void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness endian) -{ - // convert the QDateTime to UTC and append its representation to QByteArray - // format is the same as in FAT file system - dateTime = dateTime.toUTC(); - const QTime utcTime = dateTime.time(); - const QDate utcDate = dateTime.date(); - uint fatDateTime = (utcTime.hour() << 11 | utcTime.minute() << 5 | utcTime.second()/2) << 16; - fatDateTime |= (utcDate.year()-1980) << 9 | utcDate.month() << 5 | utcDate.day(); - appendInt(ba, fatDateTime, endian); -} - -QByteArray errorMessage(byte code) -{ - switch (code) { - case 0x00: return "No error"; - case 0x01: return "Generic error in CWDS message"; - case 0x02: return "Unexpected packet size in send msg"; - case 0x03: return "Internal error occurred in CWDS"; - case 0x04: return "Escape followed by frame flag"; - case 0x05: return "Bad FCS in packet"; - case 0x06: return "Packet too long"; - case 0x07: return "Sequence ID not expected (gap in sequence)"; - - case 0x10: return "Command not supported"; - case 0x11: return "Command param out of range"; - case 0x12: return "An option was not supported"; - case 0x13: return "Read/write to invalid memory"; - case 0x14: return "Read/write invalid registers"; - case 0x15: return "Exception occurred in CWDS"; - case 0x16: return "Targeted system or thread is running"; - case 0x17: return "Breakpoint resources (HW or SW) exhausted"; - case 0x18: return "Requested breakpoint conflicts with existing one"; - - case 0x20: return "General OS-related error"; - case 0x21: return "Request specified invalid process"; - case 0x22: return "Request specified invalid thread"; - } - return "Unknown error"; -} - -uint swapEndian(uint in) -{ - return (in>>24) | ((in<<8) & 0x00FF0000) | ((in>>8) & 0x0000FF00) | (in<<24); -} - -int TrkResult::errorCode() const -{ - // NAK means always error, else data sized 1 with a non-null element - const bool isNAK = code == 0xff; - if (data.size() != 1 && !isNAK) - return 0; - if (const int errorCode = data.at(0)) - return errorCode; - return isNAK ? 0xff : 0; -} - -QString TrkResult::errorString() const -{ - // NAK means always error, else data sized 1 with a non-null element - if (code == 0xff) - return "NAK"; - if (data.size() < 1) - return "Unknown error packet"; - return errorMessage(data.at(0)); -} - -} // namespace trk - diff --git a/tools/runonphone/trk/trkutils.h b/tools/runonphone/trk/trkutils.h deleted file mode 100644 index 3a485c7..0000000 --- a/tools/runonphone/trk/trkutils.h +++ /dev/null @@ -1,185 +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 tools applications 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 DEBUGGER_TRK_UTILS -#define DEBUGGER_TRK_UTILS - -#include "symbianutils_global.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE -class QDateTime; -QT_END_NAMESPACE - -namespace trk { - -typedef unsigned char byte; - -enum Command { - TrkPing = 0x00, - TrkConnect = 0x01, - TrkDisconnect = 0x02, - TrkVersions = 0x04, - TrkSupported = 0x05, - TrkCpuType = 0x06, - TrkHostVersions = 0x09, - TrkContinue = 0x18, - TrkCreateItem = 0x40, - TrkDeleteItem = 0x41, - - TrkWriteFile = 0x48, - TrkOpenFile = 0x4a, - TrkCloseFile = 0x4b, - TrkInstallFile = 0x4d, - TrkInstallFile2 = 0x4e, - - TrkNotifyAck = 0x80, - TrkNotifyNak = 0xff, - TrkNotifyStopped = 0x90, - TrkNotifyException = 0x91, - TrkNotifyInternalError = 0x92, - TrkNotifyCreated = 0xa0, - TrkNotifyDeleted = 0xa1, - TrkNotifyProcessorStarted = 0xa2, - TrkNotifyProcessorStandBy = 0xa6, - TrkNotifyProcessorReset = 0xa7 -}; - -inline byte extractByte(const char *data) { return *data; } -SYMBIANUTILS_EXPORT ushort extractShort(const char *data); -SYMBIANUTILS_EXPORT uint extractInt(const char *data); - -SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba); - -// produces "xx xx xx " -SYMBIANUTILS_EXPORT QString stringFromArray(const QByteArray &ba, int maxLen = - 1); - -enum Endianness -{ - LittleEndian, - BigEndian, - TargetByteOrder = BigEndian, -}; - -SYMBIANUTILS_EXPORT void appendShort(QByteArray *ba, ushort s, Endianness = TargetByteOrder); -SYMBIANUTILS_EXPORT void appendInt(QByteArray *ba, uint i, Endianness = TargetByteOrder); -SYMBIANUTILS_EXPORT void appendString(QByteArray *ba, const QByteArray &str, Endianness = TargetByteOrder, bool appendNullTerminator = true); - -struct SYMBIANUTILS_EXPORT Library -{ - Library() {} - - QByteArray name; - uint codeseg; - uint dataseg; -}; - -struct SYMBIANUTILS_EXPORT TrkAppVersion -{ - TrkAppVersion(); - void reset(); - - int trkMajor; - int trkMinor; - int protocolMajor; - int protocolMinor; -}; - -struct SYMBIANUTILS_EXPORT Session -{ - Session(); - void reset(); - QString deviceDescription(unsigned verbose) const; - - // Trk feedback - byte cpuMajor; - byte cpuMinor; - byte bigEndian; - byte defaultTypeSize; - byte fpTypeSize; - byte extended1TypeSize; - byte extended2TypeSize; - TrkAppVersion trkAppVersion; - uint pid; - uint tid; - uint codeseg; - uint dataseg; - QHash addressToBP; - - typedef QList Libraries; - Libraries libraries; - - typedef uint Thread; - typedef QList Threads; - Threads threads; - - // Gdb request - uint currentThread; - QStringList modules; -}; - -struct SYMBIANUTILS_EXPORT TrkResult -{ - TrkResult(); - void clear(); - QString toString() const; - // 0 for no error. - int errorCode() const; - QString errorString() const; - - byte code; - byte token; - QByteArray data; - QVariant cookie; - bool isDebugOutput; -}; - -SYMBIANUTILS_EXPORT QByteArray errorMessage(byte code); -SYMBIANUTILS_EXPORT QByteArray hexNumber(uint n, int digits = 0); -SYMBIANUTILS_EXPORT QByteArray hexxNumber(uint n, int digits = 0); // prepends '0x', too -SYMBIANUTILS_EXPORT uint swapEndian(uint in); - -} // namespace trk - -#endif // DEBUGGER_TRK_UTILS diff --git a/tools/runonphone/trk/trkutils_p.h b/tools/runonphone/trk/trkutils_p.h deleted file mode 100644 index 12b0109..0000000 --- a/tools/runonphone/trk/trkutils_p.h +++ /dev/null @@ -1,62 +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 tools applications 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 DEBUGGER_TRK_PRIVATE_UTILS -#define DEBUGGER_TRK_PRIVATE_UTILS - -#include "trkutils.h" -#include "symbianutils_global.h" - -QT_BEGIN_NAMESPACE -class QDateTime; -QT_END_NAMESPACE - -namespace trk { - -void appendDateTime(QByteArray *ba, QDateTime dateTime, Endianness = TargetByteOrder); -// returns a QByteArray containing optionally -// the serial frame [0x01 0x90 ] and 0x7e encoded7d(ba) 0x7e -QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool serialFrame); -bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *r, QByteArray *rawData = 0); - -} // namespace trk - -#endif // DEBUGGER_TRK_PRIVATE_UTILS -- cgit v0.12 From 39709d61fbd4a17edf5f141877d312d3872ccce0 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 9 Feb 2010 11:56:37 +0100 Subject: Catch up symbianutils to creator 3efdb87682a5785bac7b90f9f9a8bb819a1cb053 commit 3efdb87682a5785bac7b90f9f9a8bb819a1cb053 Author: Friedemann Kleint Date: Mon Feb 8 14:10:51 2010 +0100 S60/Trk: Make the port a property of TrkDevice. Associate the port with the device instead of passing it to open for better handling. commit 76872c6ed8a1477f1914266d6917ee4aad6ff7e9 Author: Friedemann Kleint Date: Fri Feb 5 17:34:02 2010 +0100 S60: Move serialdevicelister.cpp to symbianutils/symbiandevicemanager.cpp --- .../symbianutils/communicationstarter.cpp | 21 +- .../runonphone/symbianutils/communicationstarter.h | 2 - tools/runonphone/symbianutils/launcher.cpp | 9 +- .../symbianutils/symbiandevicemanager.cpp | 331 +++++++++++++++++++++ .../runonphone/symbianutils/symbiandevicemanager.h | 145 +++++++++ tools/runonphone/symbianutils/symbianutils.pri | 6 +- tools/runonphone/symbianutils/trkdevice.cpp | 31 +- tools/runonphone/symbianutils/trkdevice.h | 6 +- tools/runonphone/symbianutils/trkutils.cpp | 1 + 9 files changed, 520 insertions(+), 32 deletions(-) create mode 100644 tools/runonphone/symbianutils/symbiandevicemanager.cpp create mode 100644 tools/runonphone/symbianutils/symbiandevicemanager.h diff --git a/tools/runonphone/symbianutils/communicationstarter.cpp b/tools/runonphone/symbianutils/communicationstarter.cpp index e5e556e..cdee49f 100644 --- a/tools/runonphone/symbianutils/communicationstarter.cpp +++ b/tools/runonphone/symbianutils/communicationstarter.cpp @@ -58,7 +58,6 @@ struct BaseCommunicationStarterPrivate { int intervalMS; int attempts; int n; - QString device; QString errorString; BaseCommunicationStarter::State state; }; @@ -70,7 +69,6 @@ BaseCommunicationStarterPrivate::BaseCommunicationStarterPrivate(const BaseCommu intervalMS(1000), attempts(-1), n(0), - device(QLatin1String("/dev/rfcomm0")), state(BaseCommunicationStarter::TimedOut) { } @@ -108,7 +106,7 @@ BaseCommunicationStarter::StartResult BaseCommunicationStarter::start() // Before we instantiate timers, and such, try to open the device, // which should succeed if another listener is already running in // 'Watch' mode - if (d->trkDevice->open(d->device , &(d->errorString))) + if (d->trkDevice->open(&(d->errorString))) return ConnectionSucceeded; // Pull up resources for next attempt d->n = 0; @@ -155,12 +153,7 @@ void BaseCommunicationStarter::setAttempts(int a) QString BaseCommunicationStarter::device() const { - return d->device; -} - -void BaseCommunicationStarter::setDevice(const QString &dv) -{ - d->device = dv; + return d->trkDevice->port(); } QString BaseCommunicationStarter::errorString() const @@ -175,20 +168,20 @@ void BaseCommunicationStarter::slotTimer() if (d->attempts >= 0 && d->n >= d->attempts) { stopTimer(); d->errorString = tr("%1: timed out after %n attempts using an interval of %2ms.", 0, d->n) - .arg(d->device).arg(d->intervalMS); + .arg(d->trkDevice->port()).arg(d->intervalMS); d->state = TimedOut; emit timeout(); } else { // Attempt n to connect? - if (d->trkDevice->open(d->device , &(d->errorString))) { + if (d->trkDevice->open(&(d->errorString))) { stopTimer(); - const QString msg = tr("%1: Connection attempt %2 succeeded.").arg(d->device).arg(d->n); + const QString msg = tr("%1: Connection attempt %2 succeeded.").arg(d->trkDevice->port()).arg(d->n); emit message(msg); d->state = Connected; emit connected(); } else { const QString msg = tr("%1: Connection attempt %2 failed: %3 (retrying)...") - .arg(d->device).arg(d->n).arg(d->errorString); + .arg(d->trkDevice->port()).arg(d->n).arg(d->errorString); emit message(msg); } } @@ -228,13 +221,11 @@ BluetoothListener *ConsoleBluetoothStarter::createListener() bool ConsoleBluetoothStarter::startBluetooth(const TrkDevicePtr &trkDevice, QObject *listenerParent, - const QString &device, int attempts, QString *errorMessage) { // Set up a console starter to print to stdout. ConsoleBluetoothStarter starter(trkDevice, listenerParent); - starter.setDevice(device); starter.setAttempts(attempts); switch (starter.start()) { case Started: diff --git a/tools/runonphone/symbianutils/communicationstarter.h b/tools/runonphone/symbianutils/communicationstarter.h index 2d7dc50..0a060ee 100644 --- a/tools/runonphone/symbianutils/communicationstarter.h +++ b/tools/runonphone/symbianutils/communicationstarter.h @@ -80,7 +80,6 @@ public: void setAttempts(int a); QString device() const; - void setDevice(const QString &); State state() const; QString errorString() const; @@ -142,7 +141,6 @@ class SYMBIANUTILS_EXPORT ConsoleBluetoothStarter : public AbstractBluetoothStar public: static bool startBluetooth(const TrkDevicePtr& trkDevice, QObject *listenerParent, - const QString &device, int attempts, QString *errorMessage); diff --git a/tools/runonphone/symbianutils/launcher.cpp b/tools/runonphone/symbianutils/launcher.cpp index 4f91545..408829b 100644 --- a/tools/runonphone/symbianutils/launcher.cpp +++ b/tools/runonphone/symbianutils/launcher.cpp @@ -67,7 +67,6 @@ struct LauncherPrivate { explicit LauncherPrivate(const TrkDevicePtr &d); TrkDevicePtr m_device; - QString m_trkServerName; QByteArray m_trkReadBuffer; Launcher::State m_state; @@ -131,12 +130,12 @@ void Launcher::addStartupActions(trk::Launcher::Actions startupActions) void Launcher::setTrkServerName(const QString &name) { - d->m_trkServerName = name; + d->m_device->setPort(name); } QString Launcher::trkServerName() const { - return d->m_trkServerName; + return d->m_device->port(); } TrkDevicePtr Launcher::trkDevice() const @@ -191,7 +190,7 @@ bool Launcher::startServer(QString *errorMessage) errorMessage->clear(); if (d->m_verbose) { const QString msg = QString::fromLatin1("Port=%1 Executable=%2 Arguments=%3 Package=%4 Remote Package=%5 Install file=%6") - .arg(d->m_trkServerName, d->m_fileName, + .arg(trkServerName(), d->m_fileName, d->m_commandLineArgs.join(QString(QLatin1Char(' '))), d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName); logMessage(msg); @@ -213,7 +212,7 @@ bool Launcher::startServer(QString *errorMessage) qWarning("No remote executable given for running."); return false; } - if (!d->m_device->isOpen() && !d->m_device->open(d->m_trkServerName, errorMessage)) + if (!d->m_device->isOpen() && !d->m_device->open(errorMessage)) return false; if (d->m_closeDevice) { connect(this, SIGNAL(finished()), d->m_device.data(), SLOT(close())); diff --git a/tools/runonphone/symbianutils/symbiandevicemanager.cpp b/tools/runonphone/symbianutils/symbiandevicemanager.cpp new file mode 100644 index 0000000..f663816 --- /dev/null +++ b/tools/runonphone/symbianutils/symbiandevicemanager.cpp @@ -0,0 +1,331 @@ +/**************************************************************************** +** +** 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 tools applications 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 "symbiandevicemanager.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace SymbianUtils { + +enum { debug = 0 }; + +static const char REGKEY_CURRENT_CONTROL_SET[] = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet"; +static const char USBSER[] = "Services/usbser/Enum"; + +const char *SymbianDeviceManager::linuxBlueToothDeviceRootC = "/dev/rfcomm"; + +// ------------- SymbianDevice +class SymbianDeviceData : public QSharedData { +public: + SymbianDeviceData() : type(SerialPortCommunication) {} + + QString portName; + QString friendlyName; + QString deviceDesc; + QString manufacturer; + DeviceCommunicationType type; +}; + +SymbianDevice::SymbianDevice(SymbianDeviceData *data) : + m_data(data) +{ + +} + +SymbianDevice::SymbianDevice() : + m_data(new SymbianDeviceData) +{ +} +SymbianDevice::SymbianDevice(const SymbianDevice &rhs) : + m_data(rhs.m_data) +{ +} + +SymbianDevice &SymbianDevice::operator=(const SymbianDevice &rhs) +{ + if (this != &rhs) + m_data = rhs.m_data; + return *this; +} + +SymbianDevice::~SymbianDevice() +{ +} + +QString SymbianDevice::portName() const +{ + return m_data->portName; +} + +QString SymbianDevice::friendlyName() const +{ + return m_data->friendlyName; +} + +QString SymbianDevice::deviceDesc() const +{ + return m_data->deviceDesc; +} + +QString SymbianDevice::manufacturer() const +{ + return m_data->manufacturer; +} + +DeviceCommunicationType SymbianDevice::type() const +{ + return m_data->type; +} + +bool SymbianDevice::isNull() const +{ + return !m_data->portName.isEmpty(); +} + +QString SymbianDevice::toString() const +{ + QString rc; + QTextStream str(&rc); + format(str); + return rc; +} + +void SymbianDevice::format(QTextStream &str) const +{ + str << (m_data->type == BlueToothCommunication ? "Bluetooth: " : "Serial: ") + << m_data->portName; + if (!m_data->friendlyName.isEmpty()) { + str << " (" << m_data->friendlyName; + if (!m_data->deviceDesc.isEmpty()) + str << " / " << m_data->deviceDesc; + str << ')'; + } + if (!m_data->manufacturer.isEmpty()) + str << " [" << m_data->manufacturer << ']'; +} + +// Compare by port and friendly name +int SymbianDevice::compare(const SymbianDevice &rhs) const +{ + if (const int prc = m_data->portName.compare(rhs.m_data->portName)) + return prc; + if (const int frc = m_data->friendlyName.compare(rhs.m_data->friendlyName)) + return frc; + return 0; +} + +QDebug operator<<(QDebug d, const SymbianDevice &cd) +{ + d.nospace() << cd.toString(); + return d; +} + +// ------------- SymbianDeviceManagerPrivate +struct SymbianDeviceManagerPrivate { + SymbianDeviceManagerPrivate() : m_initialized(false) {} + + bool m_initialized; + SymbianDeviceManager::SymbianDeviceList m_devices; +}; + +SymbianDeviceManager::SymbianDeviceManager(QObject *parent) : + QObject(parent), + d(new SymbianDeviceManagerPrivate) +{ +} + +SymbianDeviceManager::~SymbianDeviceManager() +{ + delete d; +} + +SymbianDeviceManager::SymbianDeviceList SymbianDeviceManager::devices() const +{ + if (!d->m_initialized) + const_cast(this)->update(false); + return d->m_devices; +} + +QString SymbianDeviceManager::toString() const +{ + QString rc; + QTextStream str(&rc); + const int count = d->m_devices.size(); + for (int i = 0; i < count; i++) { + str << '#' << i << ' '; + d->m_devices.at(i).format(str); + str << '\n'; + } + return rc; +} + +QString SymbianDeviceManager::friendlyNameForPort(const QString &port) const +{ + foreach (const SymbianDevice &device, d->m_devices) { + if (device.portName() == port) + return device.friendlyName(); + } + return QString(); +} + +void SymbianDeviceManager::update() +{ + update(true); +} + +void SymbianDeviceManager::update(bool emitSignals) +{ + typedef SymbianDeviceList::iterator SymbianDeviceListIterator; + + if (debug) + qDebug(">SerialDeviceLister::update(%d)\n%s", int(emitSignals), + qPrintable(toString())); + + d->m_initialized = true; + // Get ordered new list + SymbianDeviceList newDevices = serialPorts() + blueToothDevices(); + if (newDevices.size() > 1) + qStableSort(newDevices.begin(), newDevices.end()); + if (d->m_devices == newDevices) // Happy, nothing changed. + return; + // Merge the lists and emit the respective added/removed signals, assuming + // no one can plug a different device on the same port at the speed of lightning + if (!d->m_devices.isEmpty()) { + // Find deleted devices + for (SymbianDeviceListIterator oldIt = d->m_devices.begin(); oldIt != d->m_devices.end(); ) { + if (newDevices.contains(*oldIt)) { + ++oldIt; + } else { + const SymbianDevice toBeDeleted = *oldIt; + oldIt = d->m_devices.erase(oldIt); + if (emitSignals) + emit deviceRemoved(toBeDeleted); + } + } + } + if (!newDevices.isEmpty()) { + // Find new devices and insert in order + foreach(const SymbianDevice &newDevice, newDevices) { + if (!d->m_devices.contains(newDevice)) { + d->m_devices.append(newDevice); + if (emitSignals) + emit deviceAdded(newDevice); + } + } + if (d->m_devices.size() > 1) + qStableSort(d->m_devices.begin(), d->m_devices.end()); + } + if (emitSignals) + emit updated(); + + if (debug) + qDebug(" 1) + qDebug() << "SerialDeviceLister::serialPorts(): Checking " << i << count + << REGKEY_CURRENT_CONTROL_SET << usbSerialRootKey << driverRootKey; + QScopedPointer device(new SymbianDeviceData); + device->type = SerialPortCommunication; + device->friendlyName = registry.value(driverRootKey + QLatin1String("FriendlyName")).toString(); + device->portName = registry.value(driverRootKey + QLatin1String("Device Parameters/PortName")).toString(); + device->deviceDesc = registry.value(driverRootKey + QLatin1String("DeviceDesc")).toString(); + device->manufacturer = registry.value(driverRootKey + QLatin1String("Mfg")).toString(); + rc.append(SymbianDevice(device.take())); + } + } +#endif + return rc; +} + +SymbianDeviceManager::SymbianDeviceList SymbianDeviceManager::blueToothDevices() const +{ + SymbianDeviceList rc; +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + // Bluetooth devices are created on connection. List the existing ones + // or at least the first one. + const QString prefix = QLatin1String(linuxBlueToothDeviceRootC); + const QString friendlyFormat = QLatin1String("Bluetooth device (%1)"); + for (int d = 0; d < 4; d++) { + QScopedPointer device(new SymbianDeviceData); + device->type = BlueToothCommunication; + device->portName = prefix + QString::number(d); + if (d == 0 || QFileInfo(device->portName).exists()) { + device->friendlyName = friendlyFormat.arg(device->portName); + rc.push_back(SymbianDevice(device.take())); + } + } +#endif + return rc; +} + +Q_GLOBAL_STATIC(SymbianDeviceManager, symbianDeviceManager) + +SymbianDeviceManager *SymbianDeviceManager::instance() +{ + return symbianDeviceManager(); +} + +QDebug operator<<(QDebug d, const SymbianDeviceManager &sdm) +{ + d.nospace() << sdm.toString(); + return d; +} + +} // namespace SymbianUtilsInternal diff --git a/tools/runonphone/symbianutils/symbiandevicemanager.h b/tools/runonphone/symbianutils/symbiandevicemanager.h new file mode 100644 index 0000000..dcf131a --- /dev/null +++ b/tools/runonphone/symbianutils/symbiandevicemanager.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** 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 tools applications 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 SYMBIANDEVICEMANAGER_H +#define SYMBIANDEVICEMANAGER_H + +#include "symbianutils_global.h" + +#include +#include + +QT_BEGIN_NAMESPACE +class QDebug; +class QTextStream; +QT_END_NAMESPACE + +namespace SymbianUtils { + +struct SymbianDeviceManagerPrivate; +class SymbianDeviceData; + +enum DeviceCommunicationType { + SerialPortCommunication = 0, + BlueToothCommunication = 1 +}; + +// SymbianDevice, explicitly shared. +class SYMBIANUTILS_EXPORT SymbianDevice { + explicit SymbianDevice(SymbianDeviceData *data); + friend class SymbianDeviceManager; +public: + SymbianDevice(); + SymbianDevice(const SymbianDevice &rhs); + SymbianDevice &operator=(const SymbianDevice &rhs); + ~SymbianDevice(); + int compare(const SymbianDevice &rhs) const; + + DeviceCommunicationType type() const; + bool isNull() const; + QString portName() const; + QString friendlyName() const; + + // Windows only. + QString deviceDesc() const; + QString manufacturer() const; + + void format(QTextStream &str) const; + QString toString() const; + +private: + QExplicitlySharedDataPointer m_data; +}; + +QDebug operator<<(QDebug d, const SymbianDevice &); + +inline bool operator==(const SymbianDevice &d1, const SymbianDevice &d2) + { return d1.compare(d2) == 0; } +inline bool operator!=(const SymbianDevice &d1, const SymbianDevice &d2) + { return d1.compare(d2) != 0; } +inline bool operator<(const SymbianDevice &d1, const SymbianDevice &d2) + { return d1.compare(d2) < 0; } + +/* SymbianDeviceManager: Singleton that maintains a list of Symbian devices. + * and emits change signals. + * On Windows, the update slot must be connected to a signal + * emitted from an event handler listening for WM_DEVICECHANGE. */ +class SYMBIANUTILS_EXPORT SymbianDeviceManager : public QObject +{ + Q_OBJECT +public: + typedef QList SymbianDeviceList; + + static const char *linuxBlueToothDeviceRootC; + + // Do not use this constructor, it is just public for Q_GLOBAL_STATIC + explicit SymbianDeviceManager(QObject *parent = 0); + virtual ~SymbianDeviceManager(); + + // Singleton access. + static SymbianDeviceManager *instance(); + + SymbianDeviceList devices() const; + QString toString() const; + + QString friendlyNameForPort(const QString &port) const; + +public slots: + void update(); + +signals: + void deviceRemoved(const SymbianDevice &d); + void deviceAdded(const SymbianDevice &d); + void updated(); + +private: + void update(bool emitSignals); + SymbianDeviceList serialPorts() const; + SymbianDeviceList blueToothDevices() const; + + SymbianDeviceManagerPrivate *d; +}; + +QDebug operator<<(QDebug d, const SymbianDeviceManager &); + +} // namespace SymbianUtils + +#endif // SYMBIANDEVICEMANAGER_H diff --git a/tools/runonphone/symbianutils/symbianutils.pri b/tools/runonphone/symbianutils/symbianutils.pri index a54df76..6309517 100644 --- a/tools/runonphone/symbianutils/symbianutils.pri +++ b/tools/runonphone/symbianutils/symbianutils.pri @@ -8,13 +8,15 @@ HEADERS += $$PWD/symbianutils_global.h \ $$PWD/trkdevice.h \ $$PWD/launcher.h \ $$PWD/bluetoothlistener.h \ - $$PWD/communicationstarter.h + $$PWD/communicationstarter.h \ + $$PWD/symbiandevicemanager.h SOURCES += $$PWD/trkutils.cpp \ $$PWD/trkdevice.cpp \ $$PWD/launcher.cpp \ $$PWD/bluetoothlistener.cpp \ - $$PWD/communicationstarter.cpp + $$PWD/communicationstarter.cpp \ + $$PWD/symbiandevicemanager.cpp # Tests/trklauncher is a console application contains(QT, gui) { diff --git a/tools/runonphone/symbianutils/trkdevice.cpp b/tools/runonphone/symbianutils/trkdevice.cpp index d587135..b327ab3 100644 --- a/tools/runonphone/symbianutils/trkdevice.cpp +++ b/tools/runonphone/symbianutils/trkdevice.cpp @@ -883,6 +883,7 @@ struct TrkDevicePrivate QByteArray trkReadBuffer; int verbose; QString errorString; + QString port; }; /////////////////////////////////////////////////////////////////////// @@ -914,13 +915,19 @@ TrkDevice::~TrkDevice() delete d; } -bool TrkDevice::open(const QString &port, QString *errorMessage) +bool TrkDevice::open(QString *errorMessage) { if (d->verbose) - qDebug() << "Opening" << port << "is open: " << isOpen() << " serialFrame=" << serialFrame(); + qDebug() << "Opening" << port() << "is open: " << isOpen() << " serialFrame=" << serialFrame(); + if (d->port.isEmpty()) { + *errorMessage = QLatin1String("Internal error: No port set on TrkDevice"); + return false; + } + close(); #ifdef Q_OS_WIN - d->deviceContext->device = CreateFile(QString("\\\\.\\").append(port).toStdWString().c_str(), + const QString fullPort = QLatin1String("\\\\.\\") + d->port; + d->deviceContext->device = CreateFile(reinterpret_cast(fullPort.utf16()), GENERIC_READ | GENERIC_WRITE, 0, NULL, @@ -929,7 +936,7 @@ bool TrkDevice::open(const QString &port, QString *errorMessage) NULL); if (INVALID_HANDLE_VALUE == d->deviceContext->device) { - *errorMessage = QString::fromLatin1("Could not open device '%1': %2").arg(port, winErrorMessage(GetLastError())); + *errorMessage = QString::fromLatin1("Could not open device '%1': %2").arg(port(), winErrorMessage(GetLastError())); return false; } memset(&d->deviceContext->readOverlapped, 0, sizeof(OVERLAPPED)); @@ -941,9 +948,9 @@ bool TrkDevice::open(const QString &port, QString *errorMessage) return false; } #else - d->deviceContext->file.setFileName(port); + d->deviceContext->file.setFileName(d->port); if (!d->deviceContext->file.open(QIODevice::ReadWrite|QIODevice::Unbuffered)) { - *errorMessage = QString::fromLatin1("Cannot open %1: %2").arg(port, d->deviceContext->file.errorString()); + *errorMessage = QString::fromLatin1("Cannot open %1: %2").arg(d->port, d->deviceContext->file.errorString()); return false; } @@ -982,7 +989,7 @@ bool TrkDevice::open(const QString &port, QString *errorMessage) d->writerThread->start(); if (d->verbose) - qDebug() << "Opened" << port; + qDebug() << "Opened" << d->port; return true; } @@ -1016,6 +1023,16 @@ bool TrkDevice::isOpen() const #endif } +QString TrkDevice::port() const +{ + return d->port; +} + +void TrkDevice::setPort(const QString &p) +{ + d->port = p; +} + QString TrkDevice::errorString() const { return d->errorString; diff --git a/tools/runonphone/symbianutils/trkdevice.h b/tools/runonphone/symbianutils/trkdevice.h index 21a3cc1..78012fd 100644 --- a/tools/runonphone/symbianutils/trkdevice.h +++ b/tools/runonphone/symbianutils/trkdevice.h @@ -80,13 +80,17 @@ class SYMBIANUTILS_EXPORT TrkDevice : public QObject Q_OBJECT Q_PROPERTY(bool serialFrame READ serialFrame WRITE setSerialFrame) Q_PROPERTY(bool verbose READ verbose WRITE setVerbose) + Q_PROPERTY(QString port READ port WRITE setPort) public: explicit TrkDevice(QObject *parent = 0); virtual ~TrkDevice(); - bool open(const QString &port, QString *errorMessage); + bool open(QString *errorMessage); bool isOpen() const; + QString port() const; + void setPort(const QString &p); + QString errorString() const; bool serialFrame() const; diff --git a/tools/runonphone/symbianutils/trkutils.cpp b/tools/runonphone/symbianutils/trkutils.cpp index 5cce950..9b43c96 100644 --- a/tools/runonphone/symbianutils/trkutils.cpp +++ b/tools/runonphone/symbianutils/trkutils.cpp @@ -143,6 +143,7 @@ QString Session::deviceDescription(unsigned verbose) const return msg.arg(formatTrkVersion(trkAppVersion)); } +// -------------- QByteArray decode7d(const QByteArray &ba) { -- cgit v0.12 From b0c972dfd208411086b53ee2c2b0594ade3e2d10 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 9 Feb 2010 20:04:09 +0100 Subject: Add the download URI for smart installer package to documentation Task-number: QTBUG-8068 Reviewed-by: David Boddie --- doc/src/deployment/deployment.qdoc | 7 ++++++- doc/src/platforms/symbian-introduction.qdoc | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc index 41babd9..43f5d33 100644 --- a/doc/src/deployment/deployment.qdoc +++ b/doc/src/deployment/deployment.qdoc @@ -1581,7 +1581,12 @@ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 58 If everything compiled and linked without any errors, we are now ready to create - an application installation package (\c wiggly_installer.sis): + an application installation package (\c wiggly_installer.sis). + + If you haven't done so already, download the latest release of the Smart Installer + from \l{http://get.qt.nokia.com/nokiasmartinstaller/}, and install it on top of the Qt package + + Then use this command to create the installer sis package: \snippet doc/src/snippets/code/doc_src_deployment.qdoc 59 diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 94075f5..5cebee3 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -127,7 +127,8 @@ \row \o \c run \o Run the application on the emulator. \row \o \c runonphone \o Run the application on a device. \row \o \c sis \o Create signed \c .sis file for project. - \row \o \c installer_sis \o Create signed smart installer \c .sis file for project. + \row \o \c installer_sis \o Create signed \l{Smart Installer}{smart installer} + \c .sis file for project. Smart installer will attempt to download missing dependencies in addition to just installing the application. @@ -141,6 +142,14 @@ To work on your project in Carbide, simply import the \c .pro file by right clicking on the project explorer and executing "Import...". + \section2 Smart Installer + + The Smart Installer makes sure that deployed applications have all the Qt dependencies + they need to run on a device. + + Download the latest release of the Smart Installer from \l{http://get.qt.nokia.com/nokiasmartinstaller/}, + and install it on top of the Qt package. + \section1 Installing your own applications To install your own applications on hardware, you need a signed \c .sis file. -- cgit v0.12 From 4935ec52fc07d4aaa7ae594cfe9986e25ca62dcb Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 10 Feb 2010 10:50:59 +1000 Subject: (ODBC) Use wchar_t instead of assuming 2 bytes. On some platforms, especially iODBC, wchar_t is a 32bit value, not 16 Task-number: QTBUG-6928 --- src/sql/drivers/odbc/qsql_odbc.cpp | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 2049a76..4d3663e 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -144,6 +144,7 @@ public: QSqlRecord rInf; QVector fieldCache; + QVector paramCache; int fieldCacheIdx; int disconnectCount; bool hasSQLFetchScroll; @@ -202,7 +203,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode *nativeCode = nativeCode_; QString tmpstore; #ifdef UNICODE - tmpstore = QString((const QChar*)description_.data(), msgLen); + tmpstore = QString::fromWCharArray((const wchar_t*)description_, msgLen); #else tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen); #endif @@ -332,7 +333,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni } else { colSize++; // make sure there is room for more than the 0 termination if (unicode) { - colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call + colSize *= sizeof(wchar_t); // a tiny bit faster, since it saves a SQLGetData() call } } QVarLengthArray buf(colSize); @@ -353,9 +354,9 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // contain the number of bytes returned - it contains the // total number of bytes that CAN be fetched // colSize-1: remove 0 termination when there is more data to fetch - int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator; + int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-sizeof(wchar_t) : colSize-1) : lengthIndicator; if (unicode) { - fieldVal += QString((const QChar*) buf.constData(), rSize / 2); + fieldVal += QString::fromWCharArray((wchar_t*)buf.constData(), rSize / sizeof(wchar_t)); } else { fieldVal += QString::fromAscii(buf.constData(), rSize); } @@ -551,7 +552,7 @@ static QSqlField qMakeFieldInfo(const QODBCPrivate* p, int i ) } #ifdef UNICODE - QString qColName((const QChar*)colName, colNameLen); + QString qColName = QString::fromWCharArray((const wchar_t*)colName, colNameLen); #else QString qColName = QString::fromLocal8Bit((const char*)colName); #endif @@ -1270,9 +1271,12 @@ bool QODBCResult::exec() // bind parameters - only positional binding allowed QVector& values = boundValues(); + QVector wcharstorage; + int i; SQLRETURN r; for (i = 0; i < values.count(); ++i) { + wcharstorage.append(NULL); if (bindValueType(i) & QSql::Out) values[i].detach(); const QVariant &val = values.at(i); @@ -1435,13 +1439,14 @@ bool QODBCResult::exec() #ifndef Q_ODBC_VERSION_2 if (d->unicode) { QString str = val.toString(); - str.utf16(); + int strSize = str.length() * sizeof(wchar_t); if (*ind != SQL_NULL_DATA) - *ind = str.length() * sizeof(QChar); - int strSize = str.length() * sizeof(QChar); + *ind = strSize; if (bindValueType(i) & QSql::Out) { - QByteArray ba((char*)str.constData(), str.capacity() * sizeof(QChar)); + wchar_t *temp=new wchar_t[str.capacity()*sizeof(wchar_t)]; + str.toWCharArray(temp); + QByteArray ba((char*)temp, str.capacity() * sizeof(wchar_t)); r = SQLBindParameter(d->hStmt, i + 1, qParamType[(QFlag)(bindValueType(i)) & QSql::InOut], @@ -1453,9 +1458,13 @@ bool QODBCResult::exec() ba.size(), ind); tmpStorage.append(ba); + wcharstorage.replace(i,temp); break; } + wchar_t *temp=new wchar_t[(1+str.length())*sizeof(wchar_t)]; + str.toWCharArray(temp); + temp[str.length()]=0; r = SQLBindParameter(d->hStmt, i + 1, qParamType[(QFlag)(bindValueType(i)) & QSql::InOut], @@ -1463,9 +1472,10 @@ bool QODBCResult::exec() strSize > 254 ? SQL_WLONGVARCHAR : SQL_WVARCHAR, strSize, 0, - (void *)str.constData(), + (void *)temp, strSize, ind); + wcharstorage.replace(i,temp); break; } else @@ -1515,6 +1525,13 @@ bool QODBCResult::exec() } } r = SQLExecute(d->hStmt); + + for(int i=0;i Date: Wed, 10 Feb 2010 15:08:29 +1000 Subject: Convert Maemo6 backend into plugin. --- src/network/bearer/bearer.pri | 52 +- src/network/bearer/qnetworkconfigmanager_maemo.cpp | 759 ------------- src/network/bearer/qnetworkconfigmanager_maemo_p.h | 141 --- src/network/bearer/qnetworkconfiguration.cpp | 2 +- src/network/bearer/qnetworkconfiguration_maemo_p.h | 122 -- src/network/bearer/qnetworkconfiguration_p.h | 2 +- src/network/bearer/qnetworksession.cpp | 5 - src/network/bearer/qnetworksession_maemo.cpp | 1164 -------------------- src/network/bearer/qnetworksession_maemo_p.h | 170 --- src/network/bearer/qnetworksession_p.h | 8 +- src/plugins/bearer/bearer.pro | 1 + src/plugins/bearer/icd/icd.pro | 22 + src/plugins/bearer/icd/main.cpp | 84 ++ src/plugins/bearer/icd/monitor.cpp | 116 ++ src/plugins/bearer/icd/monitor.h | 116 ++ src/plugins/bearer/icd/qicdengine.cpp | 416 +++++++ src/plugins/bearer/icd/qicdengine.h | 122 ++ src/plugins/bearer/icd/qnetworksession_impl.cpp | 1105 +++++++++++++++++++ src/plugins/bearer/icd/qnetworksession_impl.h | 147 +++ 19 files changed, 2148 insertions(+), 2406 deletions(-) delete mode 100644 src/network/bearer/qnetworkconfigmanager_maemo.cpp delete mode 100644 src/network/bearer/qnetworkconfigmanager_maemo_p.h delete mode 100644 src/network/bearer/qnetworkconfiguration_maemo_p.h delete mode 100644 src/network/bearer/qnetworksession_maemo.cpp delete mode 100644 src/network/bearer/qnetworksession_maemo_p.h create mode 100644 src/plugins/bearer/icd/icd.pro create mode 100644 src/plugins/bearer/icd/main.cpp create mode 100644 src/plugins/bearer/icd/monitor.cpp create mode 100644 src/plugins/bearer/icd/monitor.h create mode 100644 src/plugins/bearer/icd/qicdengine.cpp create mode 100644 src/plugins/bearer/icd/qicdengine.h create mode 100644 src/plugins/bearer/icd/qnetworksession_impl.cpp create mode 100644 src/plugins/bearer/icd/qnetworksession_impl.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index 7dc9195..c03c615 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -1,50 +1,18 @@ # Qt network bearer management module -#DEFINES += BEARER_MANAGEMENT_DEBUG - HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworksession.h \ - bearer/qnetworkconfigmanager.h + bearer/qnetworkconfigmanager.h \ + bearer/qnetworkconfigmanager_p.h \ + bearer/qnetworkconfiguration_p.h \ + bearer/qnetworksession_p.h \ + bearer/qbearerengine_p.h \ + bearer/qbearerplugin.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ - bearer/qnetworkconfiguration.cpp - -maemo { - CONFIG += link_pkgconfig - - exists(../debug) { - message("Enabling debug messages.") - DEFINES += BEARER_MANAGEMENT_DEBUG - } - - HEADERS += bearer/qnetworksession_maemo_p.h \ - bearer/qnetworkconfigmanager_maemo_p.h \ - bearer/qnetworkconfiguration_maemo_p.h - - SOURCES += bearer/qnetworkconfigmanager_maemo.cpp \ - bearer/qnetworksession_maemo.cpp - - documentation.path = $$QT_MOBILITY_PREFIX/doc - documentation.files = doc/html - - PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - - CONFIG += create_pc create_prl - QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet - pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig - pkgconfig.files = QtBearer.pc - - INSTALLS += pkgconfig documentation -} else { - HEADERS += bearer/qnetworkconfigmanager_p.h \ - bearer/qnetworkconfiguration_p.h \ - bearer/qnetworksession_p.h \ - bearer/qbearerengine_p.h \ - bearer/qbearerplugin.h - - SOURCES += bearer/qnetworkconfigmanager_p.cpp \ - bearer/qbearerengine.cpp \ - bearer/qbearerplugin.cpp -} + bearer/qnetworkconfiguration.cpp \ + bearer/qnetworkconfigmanager_p.cpp \ + bearer/qbearerengine.cpp \ + bearer/qbearerplugin.cpp diff --git a/src/network/bearer/qnetworkconfigmanager_maemo.cpp b/src/network/bearer/qnetworkconfigmanager_maemo.cpp deleted file mode 100644 index 96da30d..0000000 --- a/src/network/bearer/qnetworkconfigmanager_maemo.cpp +++ /dev/null @@ -1,759 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qnetworkconfigmanager_maemo_p.h" - -#include -#include - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#define IAP "/system/osso/connectivity/IAP" -static int iap_prefix_len; -static void notify_iap(GConfClient *client, guint id, - GConfEntry *entry, gpointer user_data); - - -/* The IapAddTimer is a helper class that makes sure we update - * the configuration only after all gconf additions to certain - * iap are finished (after a certain timeout) - */ -class _IapAddTimer : public QObject -{ - Q_OBJECT - -public: - _IapAddTimer() {} - ~_IapAddTimer() - { - if (timer.isActive()) { - QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); - timer.stop(); - } - } - - void add(QString& iap_id, QNetworkConfigurationManagerPrivate *d); - - QString iap_id; - QTimer timer; - QNetworkConfigurationManagerPrivate *d; - -public Q_SLOTS: - void timeout(); -}; - - -void _IapAddTimer::add(QString& id, QNetworkConfigurationManagerPrivate *d_ptr) -{ - iap_id = id; - d = d_ptr; - - if (timer.isActive()) { - QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); - timer.stop(); - } - timer.setSingleShot(true); - QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); - timer.start(1500); -} - - -void _IapAddTimer::timeout() -{ - d->addConfiguration(iap_id); -} - - -class IapAddTimer { - QHash timers; - -public: - IapAddTimer() {} - ~IapAddTimer() {} - - void add(QString& iap_id, QNetworkConfigurationManagerPrivate *d); - void del(QString& iap_id); - void removeAll(); -}; - - -void IapAddTimer::removeAll() -{ - QHashIterator i(timers); - while (i.hasNext()) { - i.next(); - _IapAddTimer *t = i.value(); - delete t; - } - timers.clear(); -} - - -void IapAddTimer::add(QString& iap_id, QNetworkConfigurationManagerPrivate *d) -{ - if (timers.contains(iap_id)) { - _IapAddTimer *iap = timers.value(iap_id); - iap->add(iap_id, d); - } else { - _IapAddTimer *iap = new _IapAddTimer; - iap->add(iap_id, d); - timers.insert(iap_id, iap); - } -} - -void IapAddTimer::del(QString& iap_id) -{ - if (timers.contains(iap_id)) { - _IapAddTimer *iap = timers.take(iap_id); - delete iap; - } -} - - -class IapMonitor -{ -public: - IapMonitor() : first_call(true) { } - friend void notify_iap(GConfClient *, guint, - GConfEntry *entry, gpointer user_data); - - void setup(QNetworkConfigurationManagerPrivate *d); - void cleanup(); - -private: - bool first_call; - - void iapAdded(const char *key, GConfEntry *entry); - void iapDeleted(const char *key, GConfEntry *entry); - - Maemo::IAPMonitor *iap; - QNetworkConfigurationManagerPrivate *d; - IapAddTimer timers; -}; - -Q_GLOBAL_STATIC(IapMonitor, iapMonitor); - - -/* Notify func that is called when IAP is added or deleted */ -static void notify_iap(GConfClient *, guint, - GConfEntry *entry, gpointer user_data) -{ - const char *key = gconf_entry_get_key(entry); - if (key && g_str_has_prefix(key, IAP)) { - IapMonitor *ptr = (IapMonitor *)user_data; - if (gconf_entry_get_value(entry)) { - ptr->iapAdded(key, entry); - } else { - ptr->iapDeleted(key, entry); - } - } -} - - -void IapMonitor::setup(QNetworkConfigurationManagerPrivate *d_ptr) -{ - if (first_call) { - d = d_ptr; - iap_prefix_len = strlen(IAP); - iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this); - first_call = false; - } -} - - -void IapMonitor::cleanup() -{ - if (!first_call) { - delete iap; - timers.removeAll(); - first_call = true; - } -} - - -void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/) -{ - //qDebug("Notify called for added element: %s=%s", gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry))); - - /* We cannot know when the IAP is fully added to gconf, so a timer is - * installed instead. When the timer expires we hope that IAP is added ok. - */ - QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0); - timers.add(iap_id, d); -} - - -void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/) -{ - //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry)); - - /* We are only interested in IAP deletions so we skip the config entries - */ - if (strstr(key + iap_prefix_len + 1, "/")) { - //qDebug("Deleting IAP config %s", key+iap_prefix_len); - return; - } - - QString iap_id = key + iap_prefix_len + 1; - d->deleteConfiguration(iap_id); -} - - - -void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities() -{ - capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces; - capFlags |= QNetworkConfigurationManager::DataStatistics; - capFlags |= QNetworkConfigurationManager::ForcedRoaming; -} - - -static inline QString network_attrs_to_security(uint network_attrs) -{ - uint cap = 0; - nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */ - if (cap & WLANCOND_OPEN) - return "NONE"; - else if (cap & WLANCOND_WEP) - return "WEP"; - else if (cap & WLANCOND_WPA_PSK) - return "WPA_PSK"; - else if (cap & WLANCOND_WPA_EAP) - return "WPA_EAP"; - return ""; -} - - -struct SSIDInfo { - QString iap_id; - QString wlan_security; -}; - - -void QNetworkConfigurationManagerPrivate::configurationChanged(QNetworkConfigurationPrivate *ptr) -{ - QNetworkConfiguration item; - item.d = ptr; - emit configurationChanged(item); -} - -void QNetworkConfigurationManagerPrivate::deleteConfiguration(QString& iap_id) -{ - /* Called when IAPs are deleted in gconf, in this case we do not scan - * or read all the IAPs from gconf because it might take too much power - * (multiple applications would need to scan and read all IAPs from gconf) - */ - if (accessPointConfigurations.contains(iap_id)) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(iap_id); - if (priv.data()) { - priv->isValid = false; -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "was removed from storage."; -#endif - - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - configChanged(priv.data(), false); - } else - qWarning("Configuration not found for IAP %s", iap_id.toAscii().data()); - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data()); -#endif - } -} - - -uint32_t QNetworkConfigurationManagerPrivate::getNetworkAttrs(bool is_iap_id, - QString& iap_id, - QString& iap_type, - QString security_method) -{ - guint network_attr = 0; - dbus_uint32_t cap = 0; - - if (iap_type == "WLAN_INFRA") - cap |= WLANCOND_INFRA; - else if (iap_type == "WLAN_ADHOC") - cap |= WLANCOND_ADHOC; - - if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) { - Maemo::IAPConf saved_ap(iap_id); - security_method = saved_ap.value("wlan_security").toString(); - } - - if (!security_method.isEmpty()) { - if (security_method == "WEP") - cap |= WLANCOND_WEP; - else if (security_method == "WPA_PSK") - cap |= WLANCOND_WPA_PSK; - else if (security_method == "WPA_EAP") - cap |= WLANCOND_WPA_EAP; - else if (security_method == "NONE") - cap |= WLANCOND_OPEN; - - if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) { - Maemo::IAPConf saved_iap(iap_id); - bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool(); - if (wpa2_only) { - cap |= WLANCOND_WPA2; - } - } - } - - cap2nwattr(cap, &network_attr); - if (is_iap_id) - network_attr |= ICD_NW_ATTR_IAPNAME; - - return (uint32_t)network_attr; -} - - -void QNetworkConfigurationManagerPrivate::addConfiguration(QString& iap_id) -{ - if (!accessPointConfigurations.contains(iap_id)) { - Maemo::IAPConf saved_iap(iap_id); - QString iap_type = saved_iap.value("type").toString(); - if (!iap_type.isEmpty()) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = saved_iap.value("name").toString(); - if (cpPriv->name.isEmpty()) - cpPriv->name = iap_id; - cpPriv->isValid = true; - cpPriv->id = iap_id; - cpPriv->iap_type = iap_type; - cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); - cpPriv->service_id = saved_iap.value("service_id").toString(); - cpPriv->service_type = saved_iap.value("service_type").toString(); - if (iap_type.startsWith("WLAN")) { - QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; - } - } - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Defined; - - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(iap_id, ptr); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, name: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data()); -#endif - - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - configChanged(ptr.data(), true); - } else { - qWarning("IAP %s does not have \"type\" field defined, skipping this IAP.", iap_id.toAscii().data()); - } - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "already in gconf."; -#endif - - /* Check if the data in gconf changed and update configuration - * accordingly - */ - QExplicitlySharedDataPointer ptr = accessPointConfigurations.take(iap_id); - if (ptr.data()) { - Maemo::IAPConf changed_iap(iap_id); - QString iap_type = changed_iap.value("type").toString(); - bool update_needed = false; /* if IAP type or ssid changed, we need to change the state */ - - ptr->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); - ptr->service_id = changed_iap.value("service_id").toString(); - ptr->service_type = changed_iap.value("service_type").toString(); - - if (!iap_type.isEmpty()) { - ptr->name = changed_iap.value("name").toString(); - if (ptr->name.isEmpty()) - ptr->name = iap_id; - ptr->isValid = true; - if (ptr->iap_type != iap_type) { - ptr->iap_type = iap_type; - update_needed = true; - } - if (iap_type.startsWith("WLAN")) { - QByteArray ssid = changed_iap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; - } - if (ptr->network_id != ssid) { - ptr->network_id = ssid; - update_needed = true; - } - } - } - accessPointConfigurations.insert(iap_id, ptr); - if (update_needed) { - ptr->type = QNetworkConfiguration::InternetAccessPoint; - if (ptr->state != QNetworkConfiguration::Defined) { - ptr->state = QNetworkConfiguration::Defined; - configurationChanged(ptr.data()); - } - } - } else { - qWarning("Cannot find IAP %s from current configuration although it should be there.", iap_id.toAscii().data()); - } - } -} - - -void QNetworkConfigurationManagerPrivate::updateConfigurations() -{ - /* Contains known network id (like ssid) from storage */ - QMultiHash knownConfigs; - - /* All the scanned access points */ - QList scanned; - - /* Turn on IAP monitoring */ - iapMonitor()->setup(this); - - if (firstUpdate) { - /* We create a default configuration which is a pseudo config */ - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - cpPriv->name = "UserChoice"; - cpPriv->state = QNetworkConfiguration::Discovered; - cpPriv->isValid = true; - cpPriv->id = OSSO_IAP_ANY; - cpPriv->type = QNetworkConfiguration::UserChoice; - cpPriv->purpose = QNetworkConfiguration::UnknownPurpose; - cpPriv->roamingSupported = false; - cpPriv->manager = this; - QExplicitlySharedDataPointer ptr(cpPriv); - userChoiceConfigurations.insert(cpPriv->id, ptr); - } - - /* We return currently configured IAPs in the first run and do the WLAN - * scan in subsequent runs. - */ - QList all_iaps; - Maemo::IAPConf::getAll(all_iaps); - - foreach (QString escaped_iap_id, all_iaps) { - QByteArray ssid; - - /* The key that is returned by getAll() needs to be unescaped */ - gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1); - QString iap_id = QString((char *)unescaped_id); - g_free(unescaped_id); - - Maemo::IAPConf saved_ap(iap_id); - bool is_temporary = saved_ap.value("temporary").toBool(); - if (is_temporary) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "is temporary, skipping it."; -#endif - continue; - } - - QString iap_type = saved_ap.value("type").toString(); - if (iap_type.startsWith("WLAN")) { - ssid = saved_ap.value("wlan_ssid").toByteArray(); - if (ssid.isEmpty()) { - qWarning() << "Cannot get ssid for" << iap_id; - continue; - } - - QString security_method = saved_ap.value("wlan_security").toString(); - SSIDInfo *info = new SSIDInfo; - info->iap_id = iap_id; - info->wlan_security = security_method; - knownConfigs.insert(ssid, info); - } else if (iap_type.isEmpty()) { - qWarning() << "IAP" << iap_id << "network type is not set! Skipping it"; - continue; - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "network type is" << iap_type; -#endif - ssid.clear(); - } - - if (!accessPointConfigurations.contains(iap_id)) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - //cpPriv->name = iap_info.value().toString(); - cpPriv->name = saved_ap.value("name").toString(); - if (cpPriv->name.isEmpty()) - if (!ssid.isEmpty() && ssid.size() > 0) - cpPriv->name = ssid.data(); - else - cpPriv->name = iap_id; - cpPriv->isValid = true; - cpPriv->id = iap_id; - cpPriv->network_id = ssid; - cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); - cpPriv->iap_type = iap_type; - cpPriv->service_id = saved_ap.value("service_id").toString(); - cpPriv->service_type = saved_ap.value("service_type").toString(); - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Defined; - cpPriv->manager = this; - - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(iap_id, ptr); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, name: %s, ssid: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); -#endif - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, ssid: %s, already exists in the known list", iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); -#endif - } - } - - if (!firstUpdate) { - QStringList scannedNetworkTypes; - QStringList networkTypesToScan; - QString error; - Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT); - - scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE, - networkTypesToScan, - scanned, - error); - if (!error.isEmpty()) { - qWarning() << "Network scanning failed" << error; - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - if (!scanned.isEmpty()) - qDebug() << "Scan returned" << scanned.size() << "networks"; - else - qDebug() << "Scan returned nothing."; -#endif - } - } - - - /* This is skipped in the first update as scanned size is zero */ - if (!scanned.isEmpty()) - for (int i=0; i priv = accessPointConfigurations.take(iapid); - if (priv.data()) { - priv->state = QNetworkConfiguration::Discovered; /* Defined is set automagically */ - priv->network_attrs = ap.scan.network_attrs; - priv->service_id = ap.scan.service_id; - priv->service_type = ap.scan.service_type; - priv->service_attrs = ap.scan.service_attrs; - - configurationChanged(priv.data()); - accessPointConfigurations.insert(iapid, priv); -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("IAP: %s, ssid: %s, discovered", iapid.toAscii().data(), priv->network_id.data()); -#endif - - if (!ap.scan.network_type.startsWith("WLAN")) - continue; // not a wlan AP - - /* Remove scanned AP from known configurations so that we can - * emit configurationRemoved signal later - */ - QList known_iaps = knownConfigs.values(priv->network_id); - rescan_list: - if (!known_iaps.isEmpty()) { - for (int k=0; kiap_id << "security" << iap->wlan_security << "scan" << network_attrs_to_security(ap.scan.network_attrs); -#endif - - if (iap->wlan_security == - network_attrs_to_security(ap.scan.network_attrs)) { - /* Remove IAP from the list */ - knownConfigs.remove(priv->network_id, iap); -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Removed IAP" << iap->iap_id << "from unknown config"; -#endif - known_iaps.removeAt(k); - delete iap; - goto rescan_list; - } - } - } - } else { - qWarning() << "IAP" << iapid << "is missing in configuration."; - } - - } else { - /* Non saved access point data */ - QByteArray scanned_ssid = ap.scan.network_id; - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QString hrs = scanned_ssid.data(); - - cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name; - cpPriv->isValid = true; - cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved - cpPriv->network_id = scanned_ssid; - cpPriv->iap_type = ap.scan.network_type; - cpPriv->network_attrs = ap.scan.network_attrs; - cpPriv->service_id = ap.scan.service_id; - cpPriv->service_type = ap.scan.service_type; - cpPriv->service_attrs = ap.scan.service_attrs; - cpPriv->manager = this; - - cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->state = QNetworkConfiguration::Undefined; - - QExplicitlySharedDataPointer ptr(cpPriv); - accessPointConfigurations.insert(cpPriv->id, ptr); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan."; -#endif - - QNetworkConfiguration item; - item.d = ptr; - emit configurationAdded(item); - } - } - - - /* Remove non existing iaps since last update */ - if (!firstUpdate) { - QHashIterator i(knownConfigs); - while (i.hasNext()) { - i.next(); - SSIDInfo *iap = i.value(); - QString iap_id = iap->iap_id; - //qDebug() << i.key() << ": " << iap_id; - - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(iap_id); - if (priv.data()) { - priv->isValid = false; -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "was removed as it was not found in scan."; -#endif - - QNetworkConfiguration item; - item.d = priv; - emit configurationRemoved(item); - configChanged(priv.data(), false); - - //if we would have SNAP support we would have to remove the references - //from existing ServiceNetworks to the removed access point configuration - } - } - } - - - QMutableHashIterator i(knownConfigs); - while (i.hasNext()) { - i.next(); - SSIDInfo *iap = i.value(); - delete iap; - i.remove(); - } - - if (!firstUpdate) - emit configurationUpdateComplete(); - - if (firstUpdate) - firstUpdate = false; -} - - -QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() -{ - /* Here we just return [ANY] request to icd and let the icd decide which - * IAP to connect. - */ - QNetworkConfiguration item; - if (userChoiceConfigurations.contains(OSSO_IAP_ANY)) - item.d = userChoiceConfigurations.value(OSSO_IAP_ANY); - return item; -} - - -void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() -{ - QTimer::singleShot(0, this, SLOT(updateConfigurations())); -} - - -void QNetworkConfigurationManagerPrivate::cleanup() -{ - iapMonitor()->cleanup(); -} - - -void QNetworkConfigurationManagerPrivate::configChanged(QNetworkConfigurationPrivate *ptr, bool added) -{ - if (added) { - if (ptr && ptr->state == QNetworkConfiguration::Active) { - onlineConfigurations++; - if (!firstUpdate && onlineConfigurations == 1) - emit onlineStateChanged(true); - } - } else { - if (ptr && ptr->state == QNetworkConfiguration::Active) { - onlineConfigurations--; - if (!firstUpdate && onlineConfigurations == 0) - emit onlineStateChanged(false); - if (onlineConfigurations < 0) - onlineConfigurations = 0; - } - } -} - - -#include "qnetworkconfigmanager_maemo.moc" -#include "moc_qnetworkconfigmanager_maemo_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfigmanager_maemo_p.h b/src/network/bearer/qnetworkconfigmanager_maemo_p.h deleted file mode 100644 index 5cc99c2..0000000 --- a/src/network/bearer/qnetworkconfigmanager_maemo_p.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONMANAGERPRIVATE_H -#define QNETWORKCONFIGURATIONMANAGERPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - - -class QNetworkConfigurationManagerPrivate : public QObject -{ - Q_OBJECT -public: - QNetworkConfigurationManagerPrivate() - : QObject(0), capFlags(0), firstUpdate(true), onlineConfigurations(0) - { - registerPlatformCapabilities(); - updateConfigurations(); - } - - virtual ~QNetworkConfigurationManagerPrivate() - { - QList configIdents = snapConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = snapConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = accessPointConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = accessPointConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - configIdents = userChoiceConfigurations.keys(); - foreach(const QString oldIface, configIdents) { - QExplicitlySharedDataPointer priv = userChoiceConfigurations.take(oldIface); - priv->isValid = false; - priv->id.clear(); - } - - cleanup(); - } - - QNetworkConfiguration defaultConfiguration(); - - QNetworkConfigurationManager::Capabilities capFlags; - void registerPlatformCapabilities(); - - void performAsyncConfigurationUpdate(); - - //this table contains an up to date list of all configs at any time. - //it must be updated if configurations change, are added/removed or - //the members of ServiceNetworks change - QHash > accessPointConfigurations; - QHash > snapConfigurations; - QHash > userChoiceConfigurations; - bool firstUpdate; - int onlineConfigurations; - friend class IapMonitor; - void cleanup(); - void deleteConfiguration(QString &iap_id); - void addConfiguration(QString &iap_id); - void configurationChanged(QNetworkConfigurationPrivate *ptr); - uint32_t getNetworkAttrs(bool is_iap_id, QString& iap_id, - QString& iap_type, QString security_method); - void configChanged(QNetworkConfigurationPrivate *ptr, bool added); - friend class QNetworkSessionPrivate; - -public slots: - void updateConfigurations(); - -Q_SIGNALS: - void configurationAdded(const QNetworkConfiguration& config); - void configurationRemoved(const QNetworkConfiguration& config); - void configurationUpdateComplete(); - void configurationChanged(const QNetworkConfiguration& config); - void onlineStateChanged(bool isOnline); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 1585be1..cf10677 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h deleted file mode 100644 index 3b43312..0000000 --- a/src/network/bearer/qnetworkconfiguration_maemo_p.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKCONFIGURATIONPRIVATE_H -#define QNETWORKCONFIGURATIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QNetworkConfigurationPrivate : public QSharedData -{ -public: - QNetworkConfigurationPrivate () - : isValid(false), type(QNetworkConfiguration::Invalid), - roamingSupported(false), purpose(QNetworkConfiguration::UnknownPurpose), - network_attrs(0), service_attrs(0), manager(0) - { - } - - ~QNetworkConfigurationPrivate() - { - //release pointers to member configurations - serviceNetworkMembers.clear(); - } - - QString name; - bool isValid; - QString id; - QNetworkConfiguration::StateFlags state; - QNetworkConfiguration::Type type; - bool roamingSupported; - QNetworkConfiguration::Purpose purpose; - - QList > serviceNetworkMembers; - QNetworkInterface serviceInterface; - - /* In Maemo the id field (defined above) is the IAP id (which typically is UUID) */ - QByteArray network_id; /* typically WLAN ssid or similar */ - QString iap_type; /* is this one WLAN or GPRS */ - QString bearerName() const - { - if (iap_type == "WLAN_INFRA" || - iap_type == "WLAN_ADHOC") - return QString("WLAN"); - else if (iap_type == "GPRS") - return QString("HSPA"); - - //return whatever it is - //this may have to be split up later on - return iap_type; - } - - uint32_t network_attrs; /* network attributes for this IAP, this is the value returned by icd and passed to it when connecting */ - - QString service_type; - QString service_id; - uint32_t service_attrs; - - QNetworkConfigurationManagerPrivate *manager; - -private: - - // disallow detaching - QNetworkConfigurationPrivate &operator=(const QNetworkConfigurationPrivate &other); - QNetworkConfigurationPrivate(const QNetworkConfigurationPrivate &other); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKCONFIGURATIONPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 40aea8b..6b40946 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index ba50ed6..f9bb9ea 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -45,12 +45,7 @@ #include "qnetworksession.h" #include "qbearerengine_p.h" #include "qnetworkconfigmanager_p.h" - -#if Q_WS_MAEMO_6 -#include "qnetworksession_maemo_p.h" -#else #include "qnetworksession_p.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp deleted file mode 100644 index 6fb4453..0000000 --- a/src/network/bearer/qnetworksession_maemo.cpp +++ /dev/null @@ -1,1164 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qnetworksession_maemo_p.h" -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -static QHash properties; - -static QString get_network_interface(); -static DBusConnection *dbus_connection; -static DBusHandlerResult signal_handler(DBusConnection *connection, - DBusMessage *message, - void *user_data); - -#define ICD_DBUS_MATCH "type='signal'," \ - "interface='" ICD_DBUS_INTERFACE "'," \ - "path='" ICD_DBUS_PATH "'" - - -static inline DBusConnection *get_dbus_conn(DBusError *error) -{ - DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, error); -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Listening to bus" << dbus_bus_get_unique_name(conn); -#endif - - return conn; -} - - -/* Helper class that monitors the Icd status messages and - * can change the IAP status accordingly. This is a singleton. - */ -class IcdListener : public QObject -{ - Q_OBJECT - -public: - IcdListener() : first_call(true) { } - friend DBusHandlerResult signal_handler(DBusConnection *connection, - DBusMessage *message, - void *user_data); - void setup(QNetworkSessionPrivate *d); - void cleanup(); - void cleanupSession(QNetworkSessionPrivate *ptr); - - enum IapConnectionStatus { - /* The IAP was connected */ - CONNECTED = 0, - /* The IAP was disconnected */ - DISCONNECTED, - /* The IAP is disconnecting */ - DISCONNECTING, - /* The IAP has a network address, but is not yet fully connected */ - NETWORK_UP - }; - -private: - void icdSignalReceived(QString&, QString&, QString&); - bool first_call; - QHash sessions; -}; - -Q_GLOBAL_STATIC(IcdListener, icdListener); - - -static DBusHandlerResult signal_handler(DBusConnection *, - DBusMessage *message, - void *user_data) -{ - if (dbus_message_is_signal(message, - ICD_DBUS_INTERFACE, - ICD_STATUS_CHANGED_SIG)) { - - IcdListener *icd = (IcdListener *)user_data; - DBusError error; - dbus_error_init(&error); - - char *iap_id = 0; - char *network_type = 0; - char *state = 0; - - if (dbus_message_get_args(message, &error, - DBUS_TYPE_STRING, &iap_id, - DBUS_TYPE_STRING, &network_type, - DBUS_TYPE_STRING, &state, - DBUS_TYPE_INVALID) == FALSE) { - qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message); - } else { - QString _iap_id(iap_id); - QString _network_type(network_type); - QString _state(state); - - icd->icdSignalReceived(_iap_id, _network_type, _state); - } - - dbus_error_free(&error); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - - -void IcdListener::setup(QNetworkSessionPrivate *d) -{ - if (first_call) { - // We use the old Icd dbus interface like in ConIC - DBusError error; - dbus_error_init(&error); - - dbus_connection = get_dbus_conn(&error); - if (dbus_error_is_set(&error)) { - qWarning() << "Cannot get dbus connection."; - dbus_error_free(&error); - return; - } - - static struct DBusObjectPathVTable icd_vtable; - icd_vtable.message_function = signal_handler; - - dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error); - if (dbus_error_is_set(&error)) { - qWarning() << "Cannot add match" << ICD_DBUS_MATCH; - dbus_error_free(&error); - return; - } - - if (dbus_connection_register_object_path(dbus_connection, - ICD_DBUS_PATH, - &icd_vtable, - (void*)this) == FALSE) { - qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH; - dbus_error_free(&error); - return; - } - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Listening" << ICD_STATUS_CHANGED_SIG << "signal from" << ICD_DBUS_SERVICE; -#endif - first_call = false; - dbus_error_free(&error); - } - - QString id = d->activeConfig.identifier(); - if (!sessions.contains(id)) { - QNetworkSessionPrivate *ptr = d; - sessions.insert(id, ptr); - } -} - - -void IcdListener::icdSignalReceived(QString& iap_id, -#ifdef BEARER_MANAGEMENT_DEBUG - QString& network_type, -#else - QString&, -#endif - QString& state) -{ - if (iap_id == OSSO_IAP_SCAN) // icd sends scan status signals which we will ignore - return; - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Status received:" << iap_id << "type" << network_type << "state" << state; -#endif - - if (!sessions.contains(iap_id)) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "No session for IAP" << iap_id; -#endif - return; - } - - QNetworkSessionPrivate *session = sessions.value(iap_id); - QNetworkConfiguration ap_conf = session->manager.configurationFromIdentifier(iap_id); - if (!ap_conf.isValid()) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Unknown IAP" << iap_id; -#endif - return; - } - - IapConnectionStatus status; - - if (state == "IDLE") { - status = DISCONNECTED; - } else if (state == "CONNECTED") { - status = CONNECTED; - } else if (state == "NETWORKUP") { - status = NETWORK_UP; - } else { - //qDebug() << "Unknown state" << state; - return; - } - - if (status == DISCONNECTED) { - if (ap_conf.state() == QNetworkConfiguration::Active) { - /* The IAP was just disconnected by Icd */ - session->updateState(QNetworkSession::Disconnected); - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Got a network disconnect when in state" << ap_conf.state(); -#endif - } - } else if (status == CONNECTED) { - /* The IAP was just connected by Icd */ - session->updateState(QNetworkSession::Connected); - session->updateIdentifier(iap_id); - - if (session->publicConfig.identifier() == OSSO_IAP_ANY) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "connected when connecting to" << OSSO_IAP_ANY; -#endif - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "IAP" << iap_id << "connected"; -#endif - } - } - - return; -} - - -void IcdListener::cleanup() -{ - if (!first_call) { - dbus_bus_remove_match(dbus_connection, ICD_DBUS_MATCH, NULL); - dbus_connection_unref(dbus_connection); - } -} - - -void IcdListener::cleanupSession(QNetworkSessionPrivate *ptr) -{ - if (ptr->publicConfig.type() == QNetworkConfiguration::UserChoice) - (void)sessions.take(ptr->activeConfig.identifier()); - else - (void)sessions.take(ptr->publicConfig.identifier()); -} - - -void QNetworkSessionPrivate::cleanupSession(void) -{ - icdListener()->cleanupSession(this); -} - - -void QNetworkSessionPrivate::updateState(QNetworkSession::State newState) -{ - if( newState != state) { - state = newState; - - if (state == QNetworkSession::Disconnected) { - isOpen = false; - currentNetworkInterface.clear(); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - activeConfig.d->state = QNetworkConfiguration::Defined; - publicConfig.d->state = QNetworkConfiguration::Defined; - - } else if (state == QNetworkSession::Connected) { - isOpen = true; - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - activeConfig.d->state = QNetworkConfiguration::Active; - activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; - } - publicConfig.d->state = QNetworkConfiguration::Active; - } - - emit q->stateChanged(newState); - } -} - - -void QNetworkSessionPrivate::updateIdentifier(QString &newId) -{ - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - activeConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - activeConfig.d->id = newId; - } else { - publicConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - if (publicConfig.d->id != newId) { - qWarning() << "Your config id changed from" << publicConfig.d->id << "to" << newId; - publicConfig.d->id = newId; - } - } -} - - -quint64 QNetworkSessionPrivate::getStatistics(bool sent) const -{ - /* This could be also implemented by using the Maemo::Icd::statistics() - * that gets the statistics data for a specific IAP. Change if - * necessary. - */ - Maemo::Icd icd; - QList stats_results; - quint64 counter_rx = 0, counter_tx = 0; - - if (!icd.statistics(stats_results)) { - return 0; - } - - foreach (Maemo::IcdStatisticsResult res, stats_results) { - if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) { - /* network_id is the IAP UUID */ - if (QString(res.params.network_id.data()) == activeConfig.identifier()) { - counter_tx = res.bytes_sent; - counter_rx = res.bytes_received; - } - } else { - /* We probably will never get to this branch */ - QNetworkConfigurationPrivate *d = activeConfig.d.data(); - if (res.params.network_id == d->network_id) { - counter_tx = res.bytes_sent; - counter_rx = res.bytes_received; - } - } - } - - if (sent) - return counter_tx; - else - return counter_rx; -} - - -quint64 QNetworkSessionPrivate::bytesWritten() const -{ - return getStatistics(true); -} - -quint64 QNetworkSessionPrivate::bytesReceived() const -{ - return getStatistics(false); -} - -quint64 QNetworkSessionPrivate::activeTime() const -{ - if (startTime.isNull()) { - return 0; - } - return startTime.secsTo(QDateTime::currentDateTime()); -} - - -QNetworkConfiguration& QNetworkSessionPrivate::copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy) -{ - if (deepCopy) { - QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); - QExplicitlySharedDataPointer ptr(cpPriv); - toConfig.d = ptr; - } - - toConfig.d->name = fromConfig.d->name; - toConfig.d->isValid = fromConfig.d->isValid; - // Note that we do not copy id field here as the publicConfig does - // not contain a valid IAP id. - toConfig.d->state = fromConfig.d->state; - toConfig.d->type = fromConfig.d->type; - toConfig.d->roamingSupported = fromConfig.d->roamingSupported; - toConfig.d->purpose = fromConfig.d->purpose; - toConfig.d->network_id = fromConfig.d->network_id; - toConfig.d->iap_type = fromConfig.d->iap_type; - toConfig.d->network_attrs = fromConfig.d->network_attrs; - toConfig.d->service_type = fromConfig.d->service_type; - toConfig.d->service_id = fromConfig.d->service_id; - toConfig.d->service_attrs = fromConfig.d->service_attrs; - toConfig.d->manager = fromConfig.d->manager; - - return toConfig; -} - - -/* This is called by QNetworkSession constructor and it updates the current - * state of the configuration. - */ -void QNetworkSessionPrivate::syncStateWithInterface() -{ - /* Start to listen Icd status messages. */ - icdListener()->setup(this); - - /* Initially we are not active although the configuration might be in - * connected state. - */ - isOpen = false; - opened = false; - - QObject::connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); - - if (publicConfig.d.data()) { - QNetworkConfigurationManagerPrivate* mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager; - if (mgr) { - QObject::connect(mgr, SIGNAL(configurationChanged(QNetworkConfiguration)), - this, SLOT(configurationChanged(QNetworkConfiguration))); - } else { - qWarning()<<"Manager object not set when trying to connect configurationChanged signal. Your configuration object is not correctly setup, did you remember to call manager.updateConfigurations() before creating session object?"; - state = QNetworkSession::Invalid; - lastError = QNetworkSession::UnknownSessionError; - return; - } - } - - state = QNetworkSession::Invalid; - lastError = QNetworkSession::UnknownSessionError; - - switch (publicConfig.type()) { - case QNetworkConfiguration::InternetAccessPoint: - activeConfig = publicConfig; - break; - case QNetworkConfiguration::ServiceNetwork: - serviceConfig = publicConfig; - break; - case QNetworkConfiguration::UserChoice: - // active config will contain correct data after open() has succeeded - copyConfig(publicConfig, activeConfig); - - /* We create new configuration that holds the actual configuration - * returned by icd. This way publicConfig still contains the - * original user specified configuration. - * - * Note that the new activeConfig configuration is not inserted - * to configurationManager as manager class will get the newly - * connected configuration from gconf when the IAP is saved. - * This configuration manager update is done by IapMonitor class. - * If the ANY connection fails in open(), then the configuration - * data is not saved to gconf and will not be added to - * configuration manager IAP list. - */ -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug()<<"New configuration created for" << publicConfig.identifier(); -#endif - break; - default: - /* Invalid configuration, no point continuing */ - return; - } - - if (!activeConfig.isValid()) - return; - - /* Get the initial state from icd */ - Maemo::Icd icd; - QList state_results; - - /* Update the active config from first connection, this is ok as icd - * supports only one connection anyway. - */ - if (icd.state(state_results) && !state_results.isEmpty()) { - - /* If we did not get full state back, then we are not - * connected and can skip the next part. - */ - if (!(state_results.first().params.network_attrs == 0 && - state_results.first().params.network_id.isEmpty())) { - - /* If we try to connect to specific IAP and we get results back - * that tell the icd is actually connected to another IAP, - * then do not update current state etc. - */ - if (publicConfig.type() == QNetworkConfiguration::UserChoice || - publicConfig.d->id == state_results.first().params.network_id) { - - switch (state_results.first().state) { - case ICD_STATE_DISCONNECTED: - state = QNetworkSession::Disconnected; - if (activeConfig.d.data()) - activeConfig.d->isValid = true; - break; - case ICD_STATE_CONNECTING: - state = QNetworkSession::Connecting; - if (activeConfig.d.data()) - activeConfig.d->isValid = true; - break; - case ICD_STATE_CONNECTED: - { - if (!state_results.first().error.isEmpty()) - break; - - const QString id = state_results.first().params.network_id; - - QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; - if (mgr->accessPointConfigurations.contains(id)) { - //we don't want the copied data if the config is already known by the manager - //just reuse it so that existing references to the old data get the same update - QExplicitlySharedDataPointer priv = mgr->accessPointConfigurations.value(activeConfig.d->id); - activeConfig.d = priv; - } - - - state = QNetworkSession::Connected; - activeConfig.d->network_id = state_results.first().params.network_id; - activeConfig.d->id = activeConfig.d->network_id; - activeConfig.d->network_attrs = state_results.first().params.network_attrs; - activeConfig.d->iap_type = state_results.first().params.network_type; - activeConfig.d->service_type = state_results.first().params.service_type; - activeConfig.d->service_id = state_results.first().params.service_id; - activeConfig.d->service_attrs = state_results.first().params.service_attrs; - activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint; - activeConfig.d->state = QNetworkConfiguration::Active; - activeConfig.d->isValid = true; - currentNetworkInterface = get_network_interface(); - - Maemo::IAPConf iap_name(activeConfig.d->id); - QString name_value = iap_name.value("name").toString(); - if (!name_value.isEmpty()) - activeConfig.d->name = name_value; - else - activeConfig.d->name = activeConfig.d->id; - - - // Add the new active configuration to manager or update the old config - mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; - if (!(mgr->accessPointConfigurations.contains(activeConfig.d->id))) { - QExplicitlySharedDataPointer ptr = activeConfig.d; - mgr->accessPointConfigurations.insert(activeConfig.d->id, ptr); - - QNetworkConfiguration item; - item.d = ptr; - emit mgr->configurationAdded(item); - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"New configuration"<id<<"added to manager in sync"; -#endif - - } else { - mgr->configurationChanged((QNetworkConfigurationPrivate*)(activeConfig.d.data())); -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"Existing configuration"<id<<"updated in manager in sync"; -#endif - } - - } - break; - - case ICD_STATE_DISCONNECTING: - state = QNetworkSession::Closing; - if (activeConfig.d.data()) - activeConfig.d->isValid = true; - break; - default: - break; - } - } - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "status_req tells icd is not connected"; -#endif - } - } else { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "status_req did not return any results from icd"; -#endif - } - - networkConfigurationsChanged(); -} - - -void QNetworkSessionPrivate::networkConfigurationsChanged() -{ - if (serviceConfig.isValid()) - updateStateFromServiceNetwork(); - else - updateStateFromActiveConfig(); -} - - -void QNetworkSessionPrivate::updateStateFromServiceNetwork() -{ - QNetworkSession::State oldState = state; - - foreach (const QNetworkConfiguration &config, serviceConfig.children()) { - if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) - continue; - - if (activeConfig != config) { - activeConfig = config; - emit q->newConfigurationActivated(); - } - - state = QNetworkSession::Connected; - if (state != oldState) - emit q->stateChanged(state); - - return; - } - - if (serviceConfig.children().isEmpty()) - state = QNetworkSession::NotAvailable; - else - state = QNetworkSession::Disconnected; - - if (state != oldState) - emit q->stateChanged(state); -} - - -void QNetworkSessionPrivate::clearConfiguration(QNetworkConfiguration &config) -{ - config.d->network_id.clear(); - config.d->iap_type.clear(); - config.d->network_attrs = 0; - config.d->service_type.clear(); - config.d->service_id.clear(); - config.d->service_attrs = 0; -} - - -void QNetworkSessionPrivate::updateStateFromActiveConfig() -{ - QNetworkSession::State oldState = state; - - bool newActive = false; - - if (!activeConfig.d.data()) - return; - - if (!activeConfig.isValid()) { - state = QNetworkSession::Invalid; - clearConfiguration(activeConfig); - } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Connected; - newActive = opened; - } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { - state = QNetworkSession::Disconnected; - } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { - state = QNetworkSession::NotAvailable; - } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { - state = QNetworkSession::NotAvailable; - clearConfiguration(activeConfig); - } - - bool oldActive = isOpen; - isOpen = newActive; - - if (!oldActive && isOpen) - emit quitPendingWaitsForOpened(); - - if (oldActive && !isOpen) - emit q->closed(); - - if (oldState != state) { - emit q->stateChanged(state); - - if (state == QNetworkSession::Disconnected) { -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"session aborted error emitted for"<error(lastError); - } - } - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"oldState ="<ifa_next) { - family = ifa->ifa_addr->sa_family; - if (family != AF_INET) { - continue; /* Currently only IPv4 is supported by icd dbus interface */ - } - if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) { - iface = QString(ifa->ifa_name); - break; - } - } - - freeifaddrs(ifaddr); - return iface; -} - - -void QNetworkSessionPrivate::open() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (!isOpen) { - - if (publicConfig.type() == QNetworkConfiguration::UserChoice) { - /* Caller is trying to connect to default IAP. - * At this time we will not know the IAP details so we just - * connect and update the active config when the IAP is - * connected. - */ - opened = true; - state = QNetworkSession::Connecting; - emit q->stateChanged(state); - QTimer::singleShot(0, this, SLOT(do_open())); - return; - } - - /* User is connecting to one specific IAP. If that IAP is not - * in discovered state we cannot continue. - */ - if ((activeConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - lastError =QNetworkSession::InvalidConfigurationError; - emit q->error(lastError); - return; - } - opened = true; - - if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) { - state = QNetworkSession::Connecting; - emit q->stateChanged(state); - - QTimer::singleShot(0, this, SLOT(do_open())); - return; - } - - isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; - if (isOpen) - emit quitPendingWaitsForOpened(); - } else { - /* We seem to be active so inform caller */ - emit quitPendingWaitsForOpened(); - } -} - - -void QNetworkSessionPrivate::do_open() -{ - icd_connection_flags flags = connectFlags; - bool st; - QString result; - QString iap = publicConfig.identifier(); - - if (state == QNetworkSession::Connected) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "Already connected to" << activeConfig.identifier(); -#endif - emit q->stateChanged(QNetworkSession::Connected); - emit quitPendingWaitsForOpened(); - return; - } - - Maemo::IcdConnectResult connect_result; - Maemo::Icd icd(ICD_LONG_CONNECT_TIMEOUT); - QNetworkConfiguration config; - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - config = activeConfig; - else - config = publicConfig; - - if (iap == OSSO_IAP_ANY) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connecting to default IAP" << iap; -#endif - st = icd.connect(flags, connect_result); - - } else { - - QList params; - Maemo::ConnectParams param; - param.connect.service_type = config.d->service_type; - param.connect.service_attrs = config.d->service_attrs; - param.connect.service_id = config.d->service_id; - param.connect.network_type = config.d->iap_type; - param.connect.network_attrs = config.d->network_attrs; - if (config.d->network_attrs & ICD_NW_ATTR_IAPNAME) - param.connect.network_id = QByteArray(iap.toLatin1()); - else - param.connect.network_id = config.d->network_id; - params.append(param); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", - param.connect.network_id.data(), - param.connect.network_type.toAscii().constData(), - param.connect.network_attrs, - param.connect.service_type.toAscii().constData(), - param.connect.service_attrs, - param.connect.service_id.toAscii().constData()); -#endif - st = icd.connect(flags, params, connect_result); - } - - if (st) { - result = connect_result.connect.network_id.data(); - QString connected_iap = result; - - if (connected_iap.isEmpty()) { -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connect to"<< iap << "failed, result is empty"; -#endif - updateState(QNetworkSession::Disconnected); - emit quitPendingWaitsForOpened(); - emit q->error(QNetworkSession::InvalidConfigurationError); - if (publicConfig.type() == QNetworkConfiguration::UserChoice) - cleanupAnyConfiguration(); - return; - } - - /* If the user tried to connect to some specific connection (foo) - * and we were already connected to some other connection (bar), - * then we cannot activate this session although icd has a valid - * connection to somewhere. - */ - if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && - (connected_iap != config.identifier())) { - updateState(QNetworkSession::Disconnected); - emit quitPendingWaitsForOpened(); - emit q->error(QNetworkSession::InvalidConfigurationError); - return; - } - - - /* Did we connect to non saved IAP? */ - if (!(config.d->network_attrs & ICD_NW_ATTR_IAPNAME)) { - /* Because the connection succeeded, the IAP is now known. - */ - config.d->network_attrs |= ICD_NW_ATTR_IAPNAME; - config.d->id = connected_iap; - } - - /* User might have changed the IAP name when a new IAP was saved */ - Maemo::IAPConf iap_name(config.d->id); - QString name = iap_name.value("name").toString(); - if (!name.isEmpty()) - config.d->name = name; - - config.d->iap_type = connect_result.connect.network_type; - - config.d->isValid = true; - config.d->state = QNetworkConfiguration::Active; - config.d->type = QNetworkConfiguration::InternetAccessPoint; - - startTime = QDateTime::currentDateTime(); - updateState(QNetworkSession::Connected); - - currentNetworkInterface = get_network_interface(); - -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "connected to" << result << config.d->name << "at" << currentNetworkInterface; -#endif - - /* We first check if the configuration already exists in the manager - * and if it is not found there, we then insert it. Note that this - * is only done for user choice config only because it can be missing - * from config manager list. - */ - - if (publicConfig.d->type == QNetworkConfiguration::UserChoice) { - -#ifdef BEARER_MANAGEMENT_DEBUG -#if 0 - QList configs; - QNetworkConfigurationManagerPrivate *conPriv = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; - QList cpsIdents = conPriv->accessPointConfigurations.keys(); - foreach( QString ii, cpsIdents) { - QExplicitlySharedDataPointer p = - conPriv->accessPointConfigurations.value(ii); - QNetworkConfiguration pt; - pt.d = conPriv->accessPointConfigurations.value(ii); - configs << pt; - } - - int all = configs.count(); - qDebug() << "All configurations:" << all; - foreach(QNetworkConfiguration p, configs) { - qDebug() << p.name() <<": isvalid->" <"<< p.type() << - " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << - " purpose->" << p.purpose() << " state->" << p.state(); - } -#endif -#endif - - QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager; - if (!mgr->accessPointConfigurations.contains(result)) { - QExplicitlySharedDataPointer ptr = config.d; - mgr->accessPointConfigurations.insert(result, ptr); - - QNetworkConfiguration item; - item.d = ptr; - emit mgr->configurationAdded(item); - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"New configuration"< priv = mgr->accessPointConfigurations.value(result); - QNetworkConfiguration reference; - reference.d = priv; - copyConfig(config, reference, false); - config = reference; - activeConfig = reference; - mgr->configurationChanged((QNetworkConfigurationPrivate*)(config.d.data())); - -#ifdef BEARER_MANAGEMENT_DEBUG - //qDebug()<<"Existing configuration"<error(QNetworkSession::UnknownSessionError); - } -} - - -void QNetworkSessionPrivate::cleanupAnyConfiguration() -{ -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug()<<"Removing configuration created for" << activeConfig.d->id; -#endif - activeConfig = publicConfig; -} - - -void QNetworkSessionPrivate::close() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else if (isOpen) { - opened = false; - isOpen = false; - emit q->closed(); - } -} - - -void QNetworkSessionPrivate::stop() -{ - if (serviceConfig.isValid()) { - lastError = QNetworkSession::OperationNotSupportedError; - emit q->error(lastError); - } else { - if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - state = QNetworkSession::Closing; - emit q->stateChanged(state); - - Maemo::Icd icd; -#ifdef BEARER_MANAGEMENT_DEBUG - qDebug() << "stopping session" << publicConfig.identifier(); -#endif - icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); - startTime = QDateTime(); - - /* Note that the state will go disconnected in - * updateStateFromActiveConfig() which gets called after - * configurationChanged is emitted (below). - */ - - activeConfig.d->state = QNetworkConfiguration::Discovered; - QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager; - mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data()); - - opened = false; - isOpen = false; - - } else { - opened = false; - isOpen = false; - emit q->closed(); - } - } -} - - -void QNetworkSessionPrivate::migrate() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -void QNetworkSessionPrivate::accept() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -void QNetworkSessionPrivate::ignore() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -void QNetworkSessionPrivate::reject() -{ - qWarning("This platform does not support roaming (%s).", __FUNCTION__); -} - - -QNetworkInterface QNetworkSessionPrivate::currentInterface() const -{ - if (!publicConfig.isValid() || state != QNetworkSession::Connected) - return QNetworkInterface(); - - if (currentNetworkInterface.isEmpty()) - return QNetworkInterface(); - - return QNetworkInterface::interfaceFromName(currentNetworkInterface); -} - - -void QNetworkSessionPrivate::setSessionProperty(const QString& key, const QVariant& value) -{ - if (value.isValid()) { - properties.insert(key, value); - - if (key == "ConnectInBackground") { - bool v = value.toBool(); - if (v) - connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT; - else - connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; - } - } else { - properties.remove(key); - - /* Set default value when property is removed */ - if (key == "ConnectInBackground") - connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; - } -} - - -QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const -{ - return properties.value(key); -} - - -QString QNetworkSessionPrivate::errorString() const -{ - QString errorStr; - switch(q->error()) { - case QNetworkSession::RoamingError: - errorStr = QObject::tr("Roaming error"); - break; - case QNetworkSession::SessionAbortedError: - errorStr = QObject::tr("Session aborted by user or system"); - break; - default: - case QNetworkSession::UnknownSessionError: - errorStr = QObject::tr("Unidentified Error"); - break; - } - return errorStr; -} - - -QNetworkSession::SessionError QNetworkSessionPrivate::error() const -{ - return QNetworkSession::UnknownSessionError; -} - -#include "qnetworksession_maemo.moc" -#include "moc_qnetworksession_maemo_p.cpp" - -QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h deleted file mode 100644 index ff294f6..0000000 --- a/src/network/bearer/qnetworksession_maemo_p.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** 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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSESSIONPRIVATE_H -#define QNETWORKSESSIONPRIVATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// -#include "qnetworkconfigmanager_maemo_p.h" -#include "qnetworksession.h" - -#include -#include -#include - -#ifdef Q_WS_MAEMO_6 -#include -#endif - -QT_BEGIN_NAMESPACE - -class QNetworkSessionPrivate : public QObject -{ - Q_OBJECT -public: - QNetworkSessionPrivate() : - tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), -#ifdef Q_WS_MAEMO_6 - connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) -#else - connectFlags(0) -#endif - { - } - - ~QNetworkSessionPrivate() - { - cleanupSession(); - } - - //called by QNetworkSession constructor and ensures - //that the state is immediately updated (w/o actually opening - //a session). Also this function should take care of - //notification hooks to discover future state changes. - void syncStateWithInterface(); - - QNetworkInterface currentInterface() const; - QVariant sessionProperty(const QString& key) const; - void setSessionProperty(const QString& key, const QVariant& value); - - void open(); - void close(); - void stop(); - void migrate(); - void accept(); - void ignore(); - void reject(); - - QString errorString() const; //must return translated string - QNetworkSession::SessionError error() const; - - quint64 bytesWritten() const; - quint64 bytesReceived() const; - quint64 activeTime() const; - -private: - void updateStateFromServiceNetwork(); - void updateStateFromActiveConfig(); - -Q_SIGNALS: - //releases any pending waitForOpened() calls - void quitPendingWaitsForOpened(); - -private Q_SLOTS: - void do_open(); - void networkConfigurationsChanged(); - void configurationChanged(const QNetworkConfiguration &config); - -private: - QNetworkConfigurationManager manager; - - quint64 tx_data; - quint64 rx_data; - quint64 m_activeTime; - - // The config set on QNetworkSession. - QNetworkConfiguration publicConfig; - - // If publicConfig is a ServiceNetwork this is a copy of publicConfig. - // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual - // ServiceNetwork configuration. - QNetworkConfiguration serviceConfig; - - // This is the actual active configuration currently in use by the session. - // Either a copy of publicConfig or one of serviceConfig.children(). - QNetworkConfiguration activeConfig; - - QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); - void clearConfiguration(QNetworkConfiguration &config); - void cleanupAnyConfiguration(); - - QNetworkSession::State state; - bool isOpen; - bool opened; - icd_connection_flags connectFlags; - - QNetworkSession::SessionError lastError; - - QNetworkSession* q; - friend class QNetworkSession; - - QDateTime startTime; - QString currentNetworkInterface; - friend class IcdListener; - void updateState(QNetworkSession::State); - void updateIdentifier(QString &newId); - quint64 getStatistics(bool sent) const; - void cleanupSession(void); -}; - -QT_END_NAMESPACE - -#endif //QNETWORKSESSIONPRIVATE_H - diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a6bb7cb..76691b3 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -109,6 +109,12 @@ protected: return config.d; } + inline void setPrivateConfiguration(QNetworkConfiguration &config, + QNetworkConfigurationPrivatePointer ptr) const + { + config.d = ptr; + } + Q_SIGNALS: //releases any pending waitForOpened() calls void quitPendingWaitsForOpened(); diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 7347735..95c9851 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -5,5 +5,6 @@ win32:SUBDIRS += nla win32:!wince*:SUBDIRS += nativewifi macx:SUBDIRS += corewlan symbian:SUBDIRS += symbian +maemo6:contains(QT_CONFIG, dbus):SUBDIRS += icd isEmpty(SUBDIRS):SUBDIRS += generic diff --git a/src/plugins/bearer/icd/icd.pro b/src/plugins/bearer/icd/icd.pro new file mode 100644 index 0000000..5eaf5af --- /dev/null +++ b/src/plugins/bearer/icd/icd.pro @@ -0,0 +1,22 @@ +TARGET = qicdbearer +include(../../qpluginbase.pri) + +QT += network dbus + +CONFIG += link_pkgconfig +PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet + +HEADERS += qicdengine.h \ + monitor.h \ + qnetworksession_impl.h + +SOURCES += main.cpp \ + qicdengine.cpp \ + monitor.cpp \ + qnetworksession_impl.cpp + +#DEFINES += BEARER_MANAGEMENT_DEBUG + +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer +target.path += $$[QT_INSTALL_PLUGINS]/bearer +INSTALLS += target diff --git a/src/plugins/bearer/icd/main.cpp b/src/plugins/bearer/icd/main.cpp new file mode 100644 index 0000000..8984d2c --- /dev/null +++ b/src/plugins/bearer/icd/main.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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 plugins 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 "qicdengine.h" + +#include + +#include + +QT_BEGIN_NAMESPACE + +class QIcdEnginePlugin : public QBearerEnginePlugin +{ +public: + QIcdEnginePlugin(); + ~QIcdEnginePlugin(); + + QStringList keys() const; + QBearerEngine *create(const QString &key) const; +}; + +QIcdEnginePlugin::QIcdEnginePlugin() +{ +} + +QIcdEnginePlugin::~QIcdEnginePlugin() +{ +} + +QStringList QIcdEnginePlugin::keys() const +{ + return QStringList() << QLatin1String("icd"); +} + +QBearerEngine *QIcdEnginePlugin::create(const QString &key) const +{ + if (key == QLatin1String("icd")) + return new QIcdEngine; + else + return 0; +} + +Q_EXPORT_STATIC_PLUGIN(QIcdEnginePlugin) +Q_EXPORT_PLUGIN2(qicdbearer, QIcdEnginePlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/icd/monitor.cpp b/src/plugins/bearer/icd/monitor.cpp new file mode 100644 index 0000000..0ff45d2 --- /dev/null +++ b/src/plugins/bearer/icd/monitor.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** 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 plugins 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 "monitor.h" +#include "qicdengine.h" + +#include +#include +#include +#include + +#define IAP "/system/osso/connectivity/IAP" + +static int iap_prefix_len; + +/* Notify func that is called when IAP is added or deleted */ +void notify_iap(GConfClient *, guint, GConfEntry *entry, gpointer user_data) +{ + const char *key = gconf_entry_get_key(entry); + if (key && g_str_has_prefix(key, IAP)) { + IapMonitor *ptr = (IapMonitor *)user_data; + if (gconf_entry_get_value(entry)) { + ptr->iapAdded(key, entry); + } else { + ptr->iapDeleted(key, entry); + } + } +} + + +void IapMonitor::setup(QIcdEngine *d_ptr) +{ + if (first_call) { + d = d_ptr; + iap_prefix_len = strlen(IAP); + iap = new Maemo::IAPMonitor(notify_iap, (gpointer)this); + first_call = false; + } +} + + +void IapMonitor::cleanup() +{ + if (!first_call) { + delete iap; + timers.removeAll(); + first_call = true; + } +} + + +void IapMonitor::iapAdded(const char *key, GConfEntry * /*entry*/) +{ + //qDebug("Notify called for added element: %s=%s", + // gconf_entry_get_key(entry), gconf_value_to_string(gconf_entry_get_value(entry))); + + /* We cannot know when the IAP is fully added to gconf, so a timer is + * installed instead. When the timer expires we hope that IAP is added ok. + */ + QString iap_id = QString(key + iap_prefix_len + 1).section('/',0,0); + timers.add(iap_id, d); +} + + +void IapMonitor::iapDeleted(const char *key, GConfEntry * /*entry*/) +{ + //qDebug("Notify called for deleted element: %s", gconf_entry_get_key(entry)); + + /* We are only interested in IAP deletions so we skip the config entries + */ + if (strstr(key + iap_prefix_len + 1, "/")) { + //qDebug("Deleting IAP config %s", key+iap_prefix_len); + return; + } + + QString iap_id = key + iap_prefix_len + 1; + d->deleteConfiguration(iap_id); +} diff --git a/src/plugins/bearer/icd/monitor.h b/src/plugins/bearer/icd/monitor.h new file mode 100644 index 0000000..82b0f36 --- /dev/null +++ b/src/plugins/bearer/icd/monitor.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** 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 plugins 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 MONITOR_H +#define MONITOR_H + +#include +#include + +#include +#include + +#include + +class QIcdEngine; + +/* The IapAddTimer is a helper class that makes sure we update + * the configuration only after all gconf additions to certain + * iap are finished (after a certain timeout) + */ +class _IapAddTimer : public QObject +{ + Q_OBJECT + +public: + _IapAddTimer() {} + ~_IapAddTimer() + { + if (timer.isActive()) { + QObject::disconnect(&timer, SIGNAL(timeout()), this, SLOT(timeout())); + timer.stop(); + } + } + + void add(QString& iap_id, QIcdEngine *d); + + QString iap_id; + QTimer timer; + QIcdEngine *d; + +public Q_SLOTS: + void timeout(); +}; + +class IapAddTimer { + QHash timers; + +public: + IapAddTimer() {} + ~IapAddTimer() {} + + void add(QString& iap_id, QIcdEngine *d); + void del(QString& iap_id); + void removeAll(); +}; + +class IapMonitor +{ +public: + IapMonitor() : first_call(true) { } + friend void notify_iap(GConfClient *, guint, + GConfEntry *entry, gpointer user_data); + + void setup(QIcdEngine *d); + void cleanup(); + +private: + bool first_call; + + void iapAdded(const char *key, GConfEntry *entry); + void iapDeleted(const char *key, GConfEntry *entry); + + Maemo::IAPMonitor *iap; + QIcdEngine *d; + IapAddTimer timers; +}; + +#endif // MONITOR_H diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp new file mode 100644 index 0000000..3233eda --- /dev/null +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -0,0 +1,416 @@ +/**************************************************************************** +** +** 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 plugins 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 "qicdengine.h" +#include "monitor.h" +#include "qnetworksession_impl.h" + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +IcdNetworkConfigurationPrivate::IcdNetworkConfigurationPrivate() +: network_attrs(0), service_attrs(0) +{ +} + +IcdNetworkConfigurationPrivate::~IcdNetworkConfigurationPrivate() +{ +} + +QString IcdNetworkConfigurationPrivate::bearerName() const +{ + if (iap_type == QLatin1String("WLAN_INFRA") || + iap_type == QLatin1String("WLAN_ADHOC")) { + return QLatin1String("WLAN"); + } else if (iap_type == QLatin1String("GPRS")) { + return QLatin1String("HSPA"); + } else { + return iap_type; + } +} + +static inline QString network_attrs_to_security(uint network_attrs) +{ + uint cap = 0; + nwattr2cap(network_attrs, &cap); /* from libicd-network-wlan-dev.h */ + if (cap & WLANCOND_OPEN) + return "NONE"; + else if (cap & WLANCOND_WEP) + return "WEP"; + else if (cap & WLANCOND_WPA_PSK) + return "WPA_PSK"; + else if (cap & WLANCOND_WPA_EAP) + return "WPA_EAP"; + return ""; +} + +QIcdEngine::QIcdEngine(QObject *parent) +: QBearerEngine(parent), iapMonitor(new IapMonitor) +{ + /* Turn on IAP monitoring */ + iapMonitor->setup(this); + + doRequestUpdate(); +} + +QIcdEngine::~QIcdEngine() +{ +} + +bool QIcdEngine::hasIdentifier(const QString &id) +{ + return accessPointConfigurations.contains(id) || + snapConfigurations.contains(id) || + userChoiceConfigurations.contains(id); +} + +void QIcdEngine::requestUpdate() +{ + QTimer::singleShot(0, this, SLOT(doRequestUpdate())); +} + +static uint32_t getNetworkAttrs(bool is_iap_id, + QString& iap_id, + QString& iap_type, + QString security_method) +{ + guint network_attr = 0; + dbus_uint32_t cap = 0; + + if (iap_type == "WLAN_INFRA") + cap |= WLANCOND_INFRA; + else if (iap_type == "WLAN_ADHOC") + cap |= WLANCOND_ADHOC; + + if (security_method.isEmpty() && (cap & (WLANCOND_INFRA | WLANCOND_ADHOC))) { + Maemo::IAPConf saved_ap(iap_id); + security_method = saved_ap.value("wlan_security").toString(); + } + + if (!security_method.isEmpty()) { + if (security_method == "WEP") + cap |= WLANCOND_WEP; + else if (security_method == "WPA_PSK") + cap |= WLANCOND_WPA_PSK; + else if (security_method == "WPA_EAP") + cap |= WLANCOND_WPA_EAP; + else if (security_method == "NONE") + cap |= WLANCOND_OPEN; + + if (cap & (WLANCOND_WPA_PSK | WLANCOND_WPA_EAP)) { + Maemo::IAPConf saved_iap(iap_id); + bool wpa2_only = saved_iap.value("EAP_wpa2_only_mode").toBool(); + if (wpa2_only) { + cap |= WLANCOND_WPA2; + } + } + } + + cap2nwattr(cap, &network_attr); + if (is_iap_id) + network_attr |= ICD_NW_ATTR_IAPNAME; + + return (uint32_t)network_attr; +} + +void QIcdEngine::doRequestUpdate() +{ + QStringList previous = accessPointConfigurations.keys(); + + /* All the scanned access points */ + QList scanned; + + /* We create a default configuration which is a pseudo config */ + if (!userChoiceConfigurations.contains(OSSO_IAP_ANY)) { + QNetworkConfigurationPrivatePointer ptr(new IcdNetworkConfigurationPrivate); + + ptr->name = QLatin1String("UserChoice"); + ptr->state = QNetworkConfiguration::Discovered; + ptr->isValid = true; + ptr->id = OSSO_IAP_ANY; + ptr->type = QNetworkConfiguration::UserChoice; + ptr->purpose = QNetworkConfiguration::UnknownPurpose; + ptr->roamingSupported = false; + + userChoiceConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + + /* We return currently configured IAPs in the first run and do the WLAN + * scan in subsequent runs. + */ + QList all_iaps; + Maemo::IAPConf::getAll(all_iaps); + + foreach (QString escaped_iap_id, all_iaps) { + QByteArray ssid; + + /* The key that is returned by getAll() needs to be unescaped */ + gchar *unescaped_id = gconf_unescape_key(escaped_iap_id.toUtf8().data(), -1); + QString iap_id = QString((char *)unescaped_id); + g_free(unescaped_id); + + previous.removeAll(iap_id); + + Maemo::IAPConf saved_ap(iap_id); + bool is_temporary = saved_ap.value("temporary").toBool(); + if (is_temporary) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "is temporary, skipping it."; +#endif + continue; + } + + QString iap_type = saved_ap.value("type").toString(); + if (iap_type.startsWith("WLAN")) { + ssid = saved_ap.value("wlan_ssid").toByteArray(); + if (ssid.isEmpty()) { + qWarning() << "Cannot get ssid for" << iap_id; + continue; + } + + QString security_method = saved_ap.value("wlan_security").toString(); + } else if (iap_type.isEmpty()) { + qWarning() << "IAP" << iap_id << "network type is not set! Skipping it"; + continue; + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "network type is" << iap_type; +#endif + ssid.clear(); + } + + if (!accessPointConfigurations.contains(iap_id)) { + IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate; + + cpPriv->name = saved_ap.value("name").toString(); + if (cpPriv->name.isEmpty()) + if (!ssid.isEmpty() && ssid.size() > 0) + cpPriv->name = ssid.data(); + else + cpPriv->name = iap_id; + cpPriv->isValid = true; + cpPriv->id = iap_id; + cpPriv->network_id = ssid; + cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); + cpPriv->iap_type = iap_type; + cpPriv->service_id = saved_ap.value("service_id").toString(); + cpPriv->service_type = saved_ap.value("service_type").toString(); + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Defined; + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(iap_id, ptr); + emit configurationAdded(ptr); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, name: %s, ssid: %s, added to known list", + iap_id.toAscii().data(), ptr->name.toAscii().data(), + !ssid.isEmpty() ? ssid.data() : "-"); +#endif + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, ssid: %s, already exists in the known list", + iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-"); +#endif + } + } + + if (sender()) { + QStringList scannedNetworkTypes; + QStringList networkTypesToScan; + QString error; + Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT); + + scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE, + networkTypesToScan, + scanned, + error); + if (!error.isEmpty()) { + qWarning() << "Network scanning failed" << error; + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + if (!scanned.isEmpty()) + qDebug() << "Scan returned" << scanned.size() << "networks"; + else + qDebug() << "Scan returned nothing."; +#endif + } + } + + /* This is skipped in the first update as scanned size is zero */ + if (!scanned.isEmpty()) { + for (int i=0; iisValid) { + ptr->isValid = true; + changed = true; + } + + if (ptr->state != QNetworkConfiguration::Discovered) { + ptr->state = QNetworkConfiguration::Discovered; + changed = true; + } + + toIcdConfig(ptr)->network_attrs = ap.scan.network_attrs; + toIcdConfig(ptr)->service_id = ap.scan.service_id; + toIcdConfig(ptr)->service_type = ap.scan.service_type; + toIcdConfig(ptr)->service_attrs = ap.scan.service_attrs; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, ssid: %s, discovered", + iapid.toAscii().data(), scanned_ssid.data()); +#endif + + if (changed) + emit configurationChanged(ptr); + + if (!ap.scan.network_type.startsWith("WLAN")) + continue; // not a wlan AP + } + } else { + IcdNetworkConfigurationPrivate *cpPriv = new IcdNetworkConfigurationPrivate; + + QString hrs = scanned_ssid.data(); + + cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name; + cpPriv->isValid = true; + // Note: id is now ssid, it should be set to IAP id if the IAP is saved + cpPriv->id = scanned_ssid.data(); + cpPriv->network_id = scanned_ssid; + cpPriv->iap_type = ap.scan.network_type; + if (cpPriv->iap_type.isEmpty()) + cpPriv->iap_type = QLatin1String("WLAN"); + cpPriv->network_attrs = ap.scan.network_attrs; + cpPriv->service_id = ap.scan.service_id; + cpPriv->service_type = ap.scan.service_type; + cpPriv->service_attrs = ap.scan.service_attrs; + + cpPriv->type = QNetworkConfiguration::InternetAccessPoint; + cpPriv->state = QNetworkConfiguration::Undefined; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan."; +#endif + + previous.removeAll(cpPriv->id); + + QNetworkConfigurationPrivatePointer ptr(cpPriv); + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + } + } + + while (!previous.isEmpty()) { + QNetworkConfigurationPrivatePointer ptr = + accessPointConfigurations.take(previous.takeFirst()); + + emit configurationRemoved(ptr); + } + + if (sender()) + emit updateCompleted(); +} + +void QIcdEngine::deleteConfiguration(const QString &iap_id) +{ + /* Called when IAPs are deleted in gconf, in this case we do not scan + * or read all the IAPs from gconf because it might take too much power + * (multiple applications would need to scan and read all IAPs from gconf) + */ + if (accessPointConfigurations.contains(iap_id)) { + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(iap_id); + + if (ptr) { + ptr->isValid = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "was removed from storage."; +#endif + + emit configurationRemoved(ptr); + } else { + qWarning("Configuration not found for IAP %s", iap_id.toAscii().data()); + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("IAP: %s, already missing from the known list", iap_id.toAscii().data()); +#endif + } +} + +QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const +{ + return QNetworkConfigurationManager::CanStartAndStopInterfaces | + QNetworkConfigurationManager::DataStatistics | + QNetworkConfigurationManager::ForcedRoaming; +} + +QNetworkSessionPrivate *QIcdEngine::createSessionBackend() +{ + return new QNetworkSessionPrivateImpl(this); +} + +QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() +{ + // Here we just return [ANY] request to icd and let the icd decide which IAP to connect. + return userChoiceConfigurations.value(OSSO_IAP_ANY); +} + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h new file mode 100644 index 0000000..30b5711 --- /dev/null +++ b/src/plugins/bearer/icd/qicdengine.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** 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 plugins 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 QICDENGINE_H +#define QICDENGINE_H + +#include + +QT_BEGIN_NAMESPACE + +class QNetworkConfigurationPrivate; +class IapMonitor; + +class IcdNetworkConfigurationPrivate : public QNetworkConfigurationPrivate +{ +public: + IcdNetworkConfigurationPrivate(); + ~IcdNetworkConfigurationPrivate(); + + QString bearerName() const; + + // In Maemo the id field (defined in QNetworkConfigurationPrivate) + // is the IAP id (which typically is UUID) + QByteArray network_id; // typically WLAN ssid or similar + QString iap_type; // is this one WLAN or GPRS + + // Network attributes for this IAP, this is the value returned by icd and + // passed to it when connecting. + uint32_t network_attrs; + + QString service_type; + QString service_id; + uint32_t service_attrs; +}; + +inline IcdNetworkConfigurationPrivate *toIcdConfig(QNetworkConfigurationPrivatePointer ptr) +{ + return static_cast(ptr.data()); +} + +class QIcdEngine : public QBearerEngine +{ + Q_OBJECT + + friend class QNetworkSessionPrivateImpl; + +public: + QIcdEngine(QObject *parent = 0); + ~QIcdEngine(); + + bool hasIdentifier(const QString &id); + + void requestUpdate(); + + QNetworkConfigurationManager::Capabilities capabilities() const; + + QNetworkSessionPrivate *createSessionBackend(); + + QNetworkConfigurationPrivatePointer defaultConfiguration(); + + void deleteConfiguration(const QString &iap_id); + +private: + inline void addSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) + { + accessPointConfigurations.insert(ptr->id, ptr); + emit configurationAdded(ptr); + } + + inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) + { + emit configurationChanged(ptr); + } + +private Q_SLOTS: + void doRequestUpdate(); + +private: + IapMonitor *iapMonitor; +}; + +QT_END_NAMESPACE + +#endif // QICDENGINE_H diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp new file mode 100644 index 0000000..6cc4a1d --- /dev/null +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -0,0 +1,1105 @@ +/**************************************************************************** +** +** 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 plugins 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 "qnetworksession_impl.h" +#include "qicdengine.h" + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static QHash properties; + +static QString get_network_interface(); +static DBusConnection *dbus_connection; +static DBusHandlerResult signal_handler(DBusConnection *connection, + DBusMessage *message, + void *user_data); + +#define ICD_DBUS_MATCH "type='signal'," \ + "interface='" ICD_DBUS_INTERFACE "'," \ + "path='" ICD_DBUS_PATH "'" + + +static inline DBusConnection *get_dbus_conn(DBusError *error) +{ + DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, error); +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Listening to bus" << dbus_bus_get_unique_name(conn); +#endif + + return conn; +} + + +/* Helper class that monitors the Icd status messages and + * can change the IAP status accordingly. This is a singleton. + */ +class IcdListener : public QObject +{ + Q_OBJECT + +public: + IcdListener() : first_call(true) { } + friend DBusHandlerResult signal_handler(DBusConnection *connection, + DBusMessage *message, + void *user_data); + void setup(QNetworkSessionPrivateImpl *d); + void cleanup(); + void cleanupSession(QNetworkSessionPrivateImpl *ptr); + + enum IapConnectionStatus { + /* The IAP was connected */ + CONNECTED = 0, + /* The IAP was disconnected */ + DISCONNECTED, + /* The IAP is disconnecting */ + DISCONNECTING, + /* The IAP has a network address, but is not yet fully connected */ + NETWORK_UP + }; + +private: + void icdSignalReceived(QString&, QString&, QString&); + bool first_call; + QHash sessions; +}; + +Q_GLOBAL_STATIC(IcdListener, icdListener); + + +static DBusHandlerResult signal_handler(DBusConnection *, + DBusMessage *message, + void *user_data) +{ + if (dbus_message_is_signal(message, + ICD_DBUS_INTERFACE, + ICD_STATUS_CHANGED_SIG)) { + + IcdListener *icd = (IcdListener *)user_data; + DBusError error; + dbus_error_init(&error); + + char *iap_id = 0; + char *network_type = 0; + char *state = 0; + + if (dbus_message_get_args(message, &error, + DBUS_TYPE_STRING, &iap_id, + DBUS_TYPE_STRING, &network_type, + DBUS_TYPE_STRING, &state, + DBUS_TYPE_INVALID) == FALSE) { + qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message); + } else { + QString _iap_id(iap_id); + QString _network_type(network_type); + QString _state(state); + + icd->icdSignalReceived(_iap_id, _network_type, _state); + } + + dbus_error_free(&error); + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + + +void IcdListener::setup(QNetworkSessionPrivateImpl *d) +{ + if (first_call) { + // We use the old Icd dbus interface like in ConIC + DBusError error; + dbus_error_init(&error); + + dbus_connection = get_dbus_conn(&error); + if (dbus_error_is_set(&error)) { + qWarning() << "Cannot get dbus connection."; + dbus_error_free(&error); + return; + } + + static struct DBusObjectPathVTable icd_vtable; + icd_vtable.message_function = signal_handler; + + dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error); + if (dbus_error_is_set(&error)) { + qWarning() << "Cannot add match" << ICD_DBUS_MATCH; + dbus_error_free(&error); + return; + } + + if (dbus_connection_register_object_path(dbus_connection, + ICD_DBUS_PATH, + &icd_vtable, + (void*)this) == FALSE) { + qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH; + dbus_error_free(&error); + return; + } + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Listening" << ICD_STATUS_CHANGED_SIG << "signal from" << ICD_DBUS_SERVICE; +#endif + first_call = false; + dbus_error_free(&error); + } + + QString id = d->activeConfig.identifier(); + if (!sessions.contains(id)) { + QNetworkSessionPrivateImpl *ptr = d; + sessions.insert(id, ptr); + } +} + + +void IcdListener::icdSignalReceived(QString& iap_id, +#ifdef BEARER_MANAGEMENT_DEBUG + QString& network_type, +#else + QString&, +#endif + QString& state) +{ + if (iap_id == OSSO_IAP_SCAN) // icd sends scan status signals which we will ignore + return; + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Status received:" << iap_id << "type" << network_type << "state" << state; +#endif + + if (!sessions.contains(iap_id)) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "No session for IAP" << iap_id; +#endif + return; + } + + QNetworkSessionPrivateImpl *session = sessions.value(iap_id); + QNetworkConfiguration ap_conf = + QNetworkConfigurationManager().configurationFromIdentifier(iap_id); + if (!ap_conf.isValid()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Unknown IAP" << iap_id; +#endif + return; + } + + IapConnectionStatus status; + + if (state == "IDLE") { + status = DISCONNECTED; + } else if (state == "CONNECTED") { + status = CONNECTED; + } else if (state == "NETWORKUP") { + status = NETWORK_UP; + } else { + //qDebug() << "Unknown state" << state; + return; + } + + if (status == DISCONNECTED) { + if (ap_conf.state() == QNetworkConfiguration::Active) { + /* The IAP was just disconnected by Icd */ + session->updateState(QNetworkSession::Disconnected); + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Got a network disconnect when in state" << ap_conf.state(); +#endif + } + } else if (status == CONNECTED) { + /* The IAP was just connected by Icd */ + session->updateState(QNetworkSession::Connected); + session->updateIdentifier(iap_id); + + if (session->publicConfig.identifier() == OSSO_IAP_ANY) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "connected when connecting to" << OSSO_IAP_ANY; +#endif + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "IAP" << iap_id << "connected"; +#endif + } + } + + return; +} + + +void IcdListener::cleanup() +{ + if (!first_call) { + dbus_bus_remove_match(dbus_connection, ICD_DBUS_MATCH, NULL); + dbus_connection_unref(dbus_connection); + } +} + + +void IcdListener::cleanupSession(QNetworkSessionPrivateImpl *ptr) +{ + if (ptr->publicConfig.type() == QNetworkConfiguration::UserChoice) + (void)sessions.take(ptr->activeConfig.identifier()); + else + (void)sessions.take(ptr->publicConfig.identifier()); +} + + +void QNetworkSessionPrivateImpl::cleanupSession(void) +{ + icdListener()->cleanupSession(this); +} + + +void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState) +{ + if (newState == state) + return; + + state = newState; + + if (state == QNetworkSession::Disconnected) { + isOpen = false; + currentNetworkInterface.clear(); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + privateConfiguration(activeConfig)->state = QNetworkConfiguration::Defined; + privateConfiguration(publicConfig)->state = QNetworkConfiguration::Defined; + + } else if (state == QNetworkSession::Connected) { + isOpen = true; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + privateConfiguration(activeConfig)->state = QNetworkConfiguration::Active; + privateConfiguration(activeConfig)->type = QNetworkConfiguration::InternetAccessPoint; + } + privateConfiguration(publicConfig)->state = QNetworkConfiguration::Active; + } + + emit stateChanged(newState); +} + + +void QNetworkSessionPrivateImpl::updateIdentifier(QString &newId) +{ + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + toIcdConfig(privateConfiguration(activeConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME; + privateConfiguration(activeConfig)->id = newId; + } else { + toIcdConfig(privateConfiguration(publicConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME; + if (privateConfiguration(publicConfig)->id != newId) { + qWarning() << "Your config id changed from" << privateConfiguration(publicConfig)->id + << "to" << newId; + privateConfiguration(publicConfig)->id = newId; + } + } +} + + +quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const +{ + /* This could be also implemented by using the Maemo::Icd::statistics() + * that gets the statistics data for a specific IAP. Change if + * necessary. + */ + Maemo::Icd icd; + QList stats_results; + quint64 counter_rx = 0, counter_tx = 0; + + if (!icd.statistics(stats_results)) { + return 0; + } + + foreach (Maemo::IcdStatisticsResult res, stats_results) { + if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) { + /* network_id is the IAP UUID */ + if (QString(res.params.network_id.data()) == activeConfig.identifier()) { + counter_tx = res.bytes_sent; + counter_rx = res.bytes_received; + } + } else { + /* We probably will never get to this branch */ + if (res.params.network_id == toIcdConfig(privateConfiguration(activeConfig))->network_id) { + counter_tx = res.bytes_sent; + counter_rx = res.bytes_received; + } + } + } + + if (sent) + return counter_tx; + else + return counter_rx; +} + + +quint64 QNetworkSessionPrivateImpl::bytesWritten() const +{ + return getStatistics(true); +} + +quint64 QNetworkSessionPrivateImpl::bytesReceived() const +{ + return getStatistics(false); +} + +quint64 QNetworkSessionPrivateImpl::activeTime() const +{ + if (startTime.isNull()) { + return 0; + } + return startTime.secsTo(QDateTime::currentDateTime()); +} + + +QNetworkConfiguration& QNetworkSessionPrivateImpl::copyConfig(QNetworkConfiguration &fromConfig, + QNetworkConfiguration &toConfig, + bool deepCopy) +{ + IcdNetworkConfigurationPrivate *cpPriv; + if (deepCopy) { + cpPriv = new IcdNetworkConfigurationPrivate; + setPrivateConfiguration(toConfig, QNetworkConfigurationPrivatePointer(cpPriv)); + } else { + cpPriv = toIcdConfig(privateConfiguration(toConfig)); + } + + cpPriv->name = privateConfiguration(fromConfig)->name; + cpPriv->isValid = privateConfiguration(fromConfig)->isValid; + // Note that we do not copy id field here as the publicConfig does + // not contain a valid IAP id. + cpPriv->state = privateConfiguration(fromConfig)->state; + cpPriv->type = privateConfiguration(fromConfig)->type; + cpPriv->roamingSupported = privateConfiguration(fromConfig)->roamingSupported; + cpPriv->purpose = privateConfiguration(fromConfig)->purpose; + cpPriv->network_id = toIcdConfig(privateConfiguration(fromConfig))->network_id; + cpPriv->iap_type = toIcdConfig(privateConfiguration(fromConfig))->iap_type; + cpPriv->network_attrs = toIcdConfig(privateConfiguration(fromConfig))->network_attrs; + cpPriv->service_type = toIcdConfig(privateConfiguration(fromConfig))->service_type; + cpPriv->service_id = toIcdConfig(privateConfiguration(fromConfig))->service_id; + cpPriv->service_attrs = toIcdConfig(privateConfiguration(fromConfig))->service_attrs; + + return toConfig; +} + + +/* This is called by QNetworkSession constructor and it updates the current + * state of the configuration. + */ +void QNetworkSessionPrivateImpl::syncStateWithInterface() +{ + /* Start to listen Icd status messages. */ + icdListener()->setup(this); + + /* Initially we are not active although the configuration might be in + * connected state. + */ + isOpen = false; + opened = false; + + connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged())); + + connect(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)), + this, SLOT(configurationChanged(QNetworkConfiguration))); + + state = QNetworkSession::Invalid; + lastError = QNetworkSession::UnknownSessionError; + + switch (publicConfig.type()) { + case QNetworkConfiguration::InternetAccessPoint: + activeConfig = publicConfig; + break; + case QNetworkConfiguration::ServiceNetwork: + serviceConfig = publicConfig; + break; + case QNetworkConfiguration::UserChoice: + // active config will contain correct data after open() has succeeded + copyConfig(publicConfig, activeConfig); + + /* We create new configuration that holds the actual configuration + * returned by icd. This way publicConfig still contains the + * original user specified configuration. + * + * Note that the new activeConfig configuration is not inserted + * to configurationManager as manager class will get the newly + * connected configuration from gconf when the IAP is saved. + * This configuration manager update is done by IapMonitor class. + * If the ANY connection fails in open(), then the configuration + * data is not saved to gconf and will not be added to + * configuration manager IAP list. + */ +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug()<<"New configuration created for" << publicConfig.identifier(); +#endif + break; + default: + /* Invalid configuration, no point continuing */ + return; + } + + if (!activeConfig.isValid()) + return; + + /* Get the initial state from icd */ + Maemo::Icd icd; + QList state_results; + + /* Update the active config from first connection, this is ok as icd + * supports only one connection anyway. + */ + if (icd.state(state_results) && !state_results.isEmpty()) { + + /* If we did not get full state back, then we are not + * connected and can skip the next part. + */ + if (!(state_results.first().params.network_attrs == 0 && + state_results.first().params.network_id.isEmpty())) { + + /* If we try to connect to specific IAP and we get results back + * that tell the icd is actually connected to another IAP, + * then do not update current state etc. + */ + if (publicConfig.type() == QNetworkConfiguration::UserChoice || + privateConfiguration(publicConfig)->id == state_results.first().params.network_id) { + + switch (state_results.first().state) { + case ICD_STATE_DISCONNECTED: + state = QNetworkSession::Disconnected; + if (privateConfiguration(activeConfig)) + privateConfiguration(activeConfig)->isValid = true; + break; + case ICD_STATE_CONNECTING: + state = QNetworkSession::Connecting; + if (privateConfiguration(activeConfig)) + privateConfiguration(activeConfig)->isValid = true; + break; + case ICD_STATE_CONNECTED: + { + if (!state_results.first().error.isEmpty()) + break; + + const QString id = state_results.first().params.network_id; + + QNetworkConfiguration config = manager.configurationFromIdentifier(id); + if (config.isValid()) { + //we don't want the copied data if the config is already known by the manager + //just reuse it so that existing references to the old data get the same update + setPrivateConfiguration(activeConfig, privateConfiguration(config)); + } + + QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig); + + state = QNetworkSession::Connected; + toIcdConfig(ptr)->network_id = state_results.first().params.network_id; + ptr->id = toIcdConfig(ptr)->network_id; + toIcdConfig(ptr)->network_attrs = state_results.first().params.network_attrs; + toIcdConfig(ptr)->iap_type = state_results.first().params.network_type; + toIcdConfig(ptr)->service_type = state_results.first().params.service_type; + toIcdConfig(ptr)->service_id = state_results.first().params.service_id; + toIcdConfig(ptr)->service_attrs = state_results.first().params.service_attrs; + ptr->type = QNetworkConfiguration::InternetAccessPoint; + ptr->state = QNetworkConfiguration::Active; + ptr->isValid = true; + currentNetworkInterface = get_network_interface(); + + Maemo::IAPConf iap_name(privateConfiguration(activeConfig)->id); + QString name_value = iap_name.value("name").toString(); + if (!name_value.isEmpty()) + privateConfiguration(activeConfig)->name = name_value; + else + privateConfiguration(activeConfig)->name = privateConfiguration(activeConfig)->id; + + + // Add the new active configuration to manager or update the old config + if (!(engine->accessPointConfigurations.contains(privateConfiguration(activeConfig)->id))) + engine->addSessionConfiguration(privateConfiguration(activeConfig)); + else + engine->changedSessionConfiguration(privateConfiguration(activeConfig)); + } + break; + + case ICD_STATE_DISCONNECTING: + state = QNetworkSession::Closing; + if (privateConfiguration(activeConfig)) + privateConfiguration(activeConfig)->isValid = true; + break; + default: + break; + } + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "status_req tells icd is not connected"; +#endif + } + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "status_req did not return any results from icd"; +#endif + } + + networkConfigurationsChanged(); +} + + +void QNetworkSessionPrivateImpl::networkConfigurationsChanged() +{ + if (serviceConfig.isValid()) + updateStateFromServiceNetwork(); + else + updateStateFromActiveConfig(); +} + + +void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() +{ + QNetworkSession::State oldState = state; + + foreach (const QNetworkConfiguration &config, serviceConfig.children()) { + if ((config.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) + continue; + + if (activeConfig != config) { + activeConfig = config; + emit newConfigurationActivated(); + } + + state = QNetworkSession::Connected; + if (state != oldState) + emit stateChanged(state); + + return; + } + + if (serviceConfig.children().isEmpty()) + state = QNetworkSession::NotAvailable; + else + state = QNetworkSession::Disconnected; + + if (state != oldState) + emit stateChanged(state); +} + + +void QNetworkSessionPrivateImpl::clearConfiguration(QNetworkConfiguration &config) +{ + toIcdConfig(privateConfiguration(config))->network_id.clear(); + toIcdConfig(privateConfiguration(config))->iap_type.clear(); + toIcdConfig(privateConfiguration(config))->network_attrs = 0; + toIcdConfig(privateConfiguration(config))->service_type.clear(); + toIcdConfig(privateConfiguration(config))->service_id.clear(); + toIcdConfig(privateConfiguration(config))->service_attrs = 0; +} + + +void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() +{ + QNetworkSession::State oldState = state; + + bool newActive = false; + + if (!privateConfiguration(activeConfig)) + return; + + if (!activeConfig.isValid()) { + state = QNetworkSession::Invalid; + clearConfiguration(activeConfig); + } else if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Connected; + newActive = opened; + } else if ((activeConfig.state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { + state = QNetworkSession::Disconnected; + } else if ((activeConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined) { + state = QNetworkSession::NotAvailable; + } else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) { + state = QNetworkSession::NotAvailable; + //clearConfiguration(activeConfig); + } + + bool oldActive = isOpen; + isOpen = newActive; + + if (!oldActive && isOpen) + emit quitPendingWaitsForOpened(); + + if (oldActive && !isOpen) + emit closed(); + + if (oldState != state) { + emit stateChanged(state); + + if (state == QNetworkSession::Disconnected) { +#ifdef BEARER_MANAGEMENT_DEBUG + //qDebug()<<"session aborted error emitted for"<ifa_next) { + family = ifa->ifa_addr->sa_family; + if (family != AF_INET) { + continue; /* Currently only IPv4 is supported by icd dbus interface */ + } + if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) { + iface = QString(ifa->ifa_name); + break; + } + } + + freeifaddrs(ifaddr); + return iface; +} + + +void QNetworkSessionPrivateImpl::open() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (!isOpen) { + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + /* Caller is trying to connect to default IAP. + * At this time we will not know the IAP details so we just + * connect and update the active config when the IAP is + * connected. + */ + opened = true; + state = QNetworkSession::Connecting; + emit stateChanged(state); + QTimer::singleShot(0, this, SLOT(do_open())); + return; + } + + /* User is connecting to one specific IAP. If that IAP is not + * in discovered state we cannot continue. + */ + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != + QNetworkConfiguration::Discovered) { + lastError =QNetworkSession::InvalidConfigurationError; + emit QNetworkSessionPrivate::error(lastError); + return; + } + opened = true; + + if ((activeConfig.state() & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) { + state = QNetworkSession::Connecting; + emit stateChanged(state); + + QTimer::singleShot(0, this, SLOT(do_open())); + return; + } + + isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active; + if (isOpen) + emit quitPendingWaitsForOpened(); + } else { + /* We seem to be active so inform caller */ + emit quitPendingWaitsForOpened(); + } +} + + +void QNetworkSessionPrivateImpl::do_open() +{ + icd_connection_flags flags = connectFlags; + bool st; + QString result; + QString iap = publicConfig.identifier(); + + if (state == QNetworkSession::Connected) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "Already connected to" << activeConfig.identifier(); +#endif + emit stateChanged(QNetworkSession::Connected); + emit quitPendingWaitsForOpened(); + return; + } + + Maemo::IcdConnectResult connect_result; + Maemo::Icd icd(ICD_LONG_CONNECT_TIMEOUT); + QNetworkConfiguration config; + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + config = activeConfig; + else + config = publicConfig; + + if (iap == OSSO_IAP_ANY) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connecting to default IAP" << iap; +#endif + st = icd.connect(flags, connect_result); + + } else { + + QList params; + Maemo::ConnectParams param; + param.connect.service_type = toIcdConfig(privateConfiguration(config))->service_type; + param.connect.service_attrs = toIcdConfig(privateConfiguration(config))->service_attrs; + param.connect.service_id = toIcdConfig(privateConfiguration(config))->service_id; + param.connect.network_type = toIcdConfig(privateConfiguration(config))->iap_type; + param.connect.network_attrs = toIcdConfig(privateConfiguration(config))->network_attrs; + if (toIcdConfig(privateConfiguration(config))->network_attrs & ICD_NW_ATTR_IAPNAME) + param.connect.network_id = QByteArray(iap.toLatin1()); + else + param.connect.network_id = toIcdConfig(privateConfiguration(config))->network_id; + params.append(param); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s", + param.connect.network_id.data(), + param.connect.network_type.toAscii().constData(), + param.connect.network_attrs, + param.connect.service_type.toAscii().constData(), + param.connect.service_attrs, + param.connect.service_id.toAscii().constData()); +#endif + st = icd.connect(flags, params, connect_result); + } + + if (st) { + result = connect_result.connect.network_id.data(); + QString connected_iap = result; + + if (connected_iap.isEmpty()) { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connect to"<< iap << "failed, result is empty"; +#endif + updateState(QNetworkSession::Disconnected); + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + cleanupAnyConfiguration(); + return; + } + + /* If the user tried to connect to some specific connection (foo) + * and we were already connected to some other connection (bar), + * then we cannot activate this session although icd has a valid + * connection to somewhere. + */ + if ((publicConfig.type() != QNetworkConfiguration::UserChoice) && + (connected_iap != config.identifier())) { + updateState(QNetworkSession::Disconnected); + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(QNetworkSession::InvalidConfigurationError); + return; + } + + + /* Did we connect to non saved IAP? */ + if (!(toIcdConfig(privateConfiguration(config))->network_attrs & ICD_NW_ATTR_IAPNAME)) { + /* Because the connection succeeded, the IAP is now known. + */ + toIcdConfig(privateConfiguration(config))->network_attrs |= ICD_NW_ATTR_IAPNAME; + privateConfiguration(config)->id = connected_iap; + } + + /* User might have changed the IAP name when a new IAP was saved */ + Maemo::IAPConf iap_name(privateConfiguration(config)->id); + QString name = iap_name.value("name").toString(); + if (!name.isEmpty()) + privateConfiguration(config)->name = name; + + toIcdConfig(privateConfiguration(config))->iap_type = connect_result.connect.network_type; + + privateConfiguration(config)->isValid = true; + privateConfiguration(config)->state = QNetworkConfiguration::Active; + privateConfiguration(config)->type = QNetworkConfiguration::InternetAccessPoint; + + startTime = QDateTime::currentDateTime(); + updateState(QNetworkSession::Connected); + + currentNetworkInterface = get_network_interface(); + +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connected to" << result << config.name() << "at" << currentNetworkInterface; +#endif + + /* We first check if the configuration already exists in the manager + * and if it is not found there, we then insert it. Note that this + * is only done for user choice config only because it can be missing + * from config manager list. + */ + + if (publicConfig.type() == QNetworkConfiguration::UserChoice) { + if (!engine->accessPointConfigurations.contains(result)) { + engine->addSessionConfiguration(privateConfiguration(config)); + } else { + QNetworkConfigurationPrivatePointer priv = + engine->accessPointConfigurations.value(result); + QNetworkConfiguration reference; + setPrivateConfiguration(reference, priv); + copyConfig(config, reference, false); + config = reference; + activeConfig = reference; + engine->changedSessionConfiguration(privateConfiguration(config)); + } + } + + emit quitPendingWaitsForOpened(); + + } else { +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "connect to"<< iap << "failed, status:" << connect_result.status; +#endif + updateState(QNetworkSession::Disconnected); + if (publicConfig.type() == QNetworkConfiguration::UserChoice) + cleanupAnyConfiguration(); + emit quitPendingWaitsForOpened(); + emit QNetworkSessionPrivate::error(QNetworkSession::UnknownSessionError); + } +} + + +void QNetworkSessionPrivateImpl::cleanupAnyConfiguration() +{ +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug()<<"Removing configuration created for" << activeConfig.identifier(); +#endif + activeConfig = publicConfig; +} + + +void QNetworkSessionPrivateImpl::close() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else if (isOpen) { + opened = false; + isOpen = false; + emit closed(); + } +} + + +void QNetworkSessionPrivateImpl::stop() +{ + if (serviceConfig.isValid()) { + lastError = QNetworkSession::OperationNotSupportedError; + emit QNetworkSessionPrivate::error(lastError); + } else { + if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { + state = QNetworkSession::Closing; + emit stateChanged(state); + + Maemo::Icd icd; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug() << "stopping session" << publicConfig.identifier(); +#endif + icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT); + startTime = QDateTime(); + + /* Note that the state will go disconnected in + * updateStateFromActiveConfig() which gets called after + * configurationChanged is emitted (below). + */ + + privateConfiguration(activeConfig)->state = QNetworkConfiguration::Discovered; + engine->changedSessionConfiguration(privateConfiguration(activeConfig)); + + opened = false; + isOpen = false; + + } else { + opened = false; + isOpen = false; + emit closed(); + } + } +} + + +void QNetworkSessionPrivateImpl::migrate() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivateImpl::accept() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivateImpl::ignore() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +void QNetworkSessionPrivateImpl::reject() +{ + qWarning("This platform does not support roaming (%s).", __FUNCTION__); +} + + +QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const +{ + if (!publicConfig.isValid() || state != QNetworkSession::Connected) + return QNetworkInterface(); + + if (currentNetworkInterface.isEmpty()) + return QNetworkInterface(); + + return QNetworkInterface::interfaceFromName(currentNetworkInterface); +} + + +void QNetworkSessionPrivateImpl::setSessionProperty(const QString& key, const QVariant& value) +{ + if (value.isValid()) { + properties.insert(key, value); + + if (key == "ConnectInBackground") { + bool v = value.toBool(); + if (v) + connectFlags = ICD_CONNECTION_FLAG_APPLICATION_EVENT; + else + connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; + } + } else { + properties.remove(key); + + /* Set default value when property is removed */ + if (key == "ConnectInBackground") + connectFlags = ICD_CONNECTION_FLAG_USER_EVENT; + } +} + + +QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& key) const +{ + return properties.value(key); +} + + +QString QNetworkSessionPrivateImpl::errorString() const +{ + QString errorStr; + switch(q->error()) { + case QNetworkSession::RoamingError: + errorStr = QObject::tr("Roaming error"); + break; + case QNetworkSession::SessionAbortedError: + errorStr = QObject::tr("Session aborted by user or system"); + break; + default: + case QNetworkSession::UnknownSessionError: + errorStr = QObject::tr("Unidentified Error"); + break; + } + return errorStr; +} + + +QNetworkSession::SessionError QNetworkSessionPrivateImpl::error() const +{ + return QNetworkSession::UnknownSessionError; +} + +#include "qnetworksession_impl.moc" + +QT_END_NAMESPACE diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h new file mode 100644 index 0000000..22e41b3 --- /dev/null +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** 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 QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNETWORKSESSION_IMPL_H +#define QNETWORKSESSION_IMPL_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +//#include "qnetworkconfigmanager_maemo_p.h" +//#include "qnetworksession.h" + +//#include +//#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QIcdEngine; + +class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate +{ + Q_OBJECT + +public: + QNetworkSessionPrivateImpl(QIcdEngine *engine) + : engine(engine), connectFlags(ICD_CONNECTION_FLAG_USER_EVENT) + { + } + + ~QNetworkSessionPrivateImpl() + { + cleanupSession(); + } + + //called by QNetworkSession constructor and ensures + //that the state is immediately updated (w/o actually opening + //a session). Also this function should take care of + //notification hooks to discover future state changes. + void syncStateWithInterface(); + + QNetworkInterface currentInterface() const; + QVariant sessionProperty(const QString& key) const; + void setSessionProperty(const QString& key, const QVariant& value); + + void open(); + void close(); + void stop(); + + void migrate(); + void accept(); + void ignore(); + void reject(); + + QString errorString() const; //must return translated string + QNetworkSession::SessionError error() const; + + quint64 bytesWritten() const; + quint64 bytesReceived() const; + quint64 activeTime() const; + +private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +private Q_SLOTS: + void do_open(); + void networkConfigurationsChanged(); + void configurationChanged(const QNetworkConfiguration &config); + +private: + QNetworkConfigurationManager manager; + QIcdEngine *engine; + + QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true); + void clearConfiguration(QNetworkConfiguration &config); + void cleanupAnyConfiguration(); + + bool opened; + icd_connection_flags connectFlags; + + QNetworkSession::SessionError lastError; + + QDateTime startTime; + QString currentNetworkInterface; + friend class IcdListener; + void updateState(QNetworkSession::State); + void updateIdentifier(QString &newId); + quint64 getStatistics(bool sent) const; + void cleanupSession(void); +}; + +QT_END_NAMESPACE + +#endif //QNETWORKSESSIONPRIVATE_H + -- cgit v0.12 From 52e46af04738af62ad0da0daa161de707ff855e0 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 9 Feb 2010 18:12:12 +0100 Subject: Cannot drag actions in Designer on Mac OS X/Cocoa. QMimeData sub classes reimplementing the formats() might not expose the temporary "application/x-qt-mime-type-name" mimetype used by DnD. So make sure that the NSDragPboard PasteBoard will contain this dummy mime type. Task-number: QTBUG-7981 Reviewed-by: mortens --- src/gui/kernel/qclipboard_mac.cpp | 12 ++++++++++++ src/gui/kernel/qcocoaview_mac.mm | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp index f3a971d..49a6cc8 100644 --- a/src/gui/kernel/qclipboard_mac.cpp +++ b/src/gui/kernel/qclipboard_mac.cpp @@ -388,6 +388,18 @@ QMacPasteboard::setMimeData(QMimeData *mime_src) clear_helper(); QStringList formats = mime_src->formats(); +#ifdef QT_MAC_USE_COCOA + // QMimeData sub classes reimplementing the formats() might not expose the + // temporary "application/x-qt-mime-type-name" mimetype. So check the existence + // of this mime type while doing drag and drop. + QString dummyMimeType(QLatin1String("application/x-qt-mime-type-name")); + if (!formats.contains(dummyMimeType)) { + QByteArray dummyType = mime_src->data(dummyMimeType); + if (!dummyType.isEmpty()) { + formats.append(dummyMimeType); + } + } +#endif for(int f = 0; f < formats.size(); ++f) { QString mimeType = formats.at(f); for (QList::Iterator it = availableConverters.begin(); it != availableConverters.end(); ++it) { diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 2c35be2..756cf92 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1404,7 +1404,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) // setup the data QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND); - dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray()); + dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy")); dragBoard.setMimeData(dragPrivate()->data); // create the image -- cgit v0.12 From 3930b896eba50eb657c88923b2922a2fba0d6385 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 10 Feb 2010 10:27:32 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 36fe058a9001e6d47f0fd41c6304cdfdf3a735ed ) Changes in WebKit/qt since the last update: * Missing fileSystemPath() method in Qt KURL implementation --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 12 ++++++++++++ src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 4348cbc..2b39e81 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - da5d96a26e80162027bc95ce7e5725fe4b277ff7 + 36fe058a9001e6d47f0fd41c6304cdfdf3a735ed diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 1f6f290..61c2227 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2010-01-14 Diego Gonzalez + + Reviewed by Kenneth Christiansen. + + [Qt] Missing fileSystemPath() method in Qt KURL implementation + https://bugs.webkit.org/show_bug.cgi?id=33614 + + No new tests. + + * platform/qt/KURLQt.cpp: + (WebCore::KURL::fileSystemPath): + 2010-02-01 Andreas Kling Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp index 0763fe0..1f62006 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp @@ -95,8 +95,10 @@ KURL::operator QUrl() const String KURL::fileSystemPath() const { - notImplemented(); - return String(); + if (!isValid() || !protocolIs("file")) + return String(); + + return String(path()); } } -- cgit v0.12 From 8c8aabdfac1518f9d62097ea5c80cea3d50131a3 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 9 Feb 2010 16:32:10 +0200 Subject: Fix an unhandled exception in QScriptValue's test generator. $QT_END_LICENSE was interpreted as a template key by Template() object, causing substitute() call to throw a KeyError exception. The bug was introduced in 9962e2d96a212c518054220167eb6f61e1052bcc. Reviewed-by: TrustMe --- tests/auto/qscriptvalue/testgen/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qscriptvalue/testgen/gen.py b/tests/auto/qscriptvalue/testgen/gen.py index 7161e6b..b3c81b9 100755 --- a/tests/auto/qscriptvalue/testgen/gen.py +++ b/tests/auto/qscriptvalue/testgen/gen.py @@ -231,7 +231,7 @@ if __name__ == '__main__': row_esc = escape(row) out.append(qsvTempl.substitute(expr = row, expr_esc = row_esc)) - result = mainTempl.substitute(dump= "".join(out) \ + result = mainTempl.safe_substitute(dump= "".join(out) \ , values = (11 * ' ' + '<< ').join(qsv) \ , count = len(qsv) \ , dataTags = (11 * ' ' + '<< ').join(map(lambda w: '"' + escape(w.replace('\n','')) + '"\n', qsv))) -- cgit v0.12 From e6f401fb1a25f133bd3476ff327b2ba45fd741b7 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 9 Feb 2010 16:39:03 +0200 Subject: Add new test values to QScriptValue test generator. Two new values were added; results from QScriptEngine::nullValue() and QScriptEngine::undefinedValue(). Reviewed-by: Kent Hansen --- tests/auto/qscriptvalue/testgen/data.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/qscriptvalue/testgen/data.txt b/tests/auto/qscriptvalue/testgen/data.txt index 8e7026e..a041c9b 100644 --- a/tests/auto/qscriptvalue/testgen/data.txt +++ b/tests/auto/qscriptvalue/testgen/data.txt @@ -114,3 +114,7 @@ engine->evaluate("/foo/") engine->evaluate("new Object()") engine->evaluate("new Array()") engine->evaluate("new Error()") + +#other +engine->nullValue() +engine->undefinedValue() \ No newline at end of file -- cgit v0.12 From caf93a2b6d3df012055ab70ad4bba1bb7b29141d Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 9 Feb 2010 16:47:51 +0200 Subject: Apply newly generated test values. Apply test results for values created directly from QScriptEngine (results of nullValue() and undefinedValue()) Reviewed-by: Kent Hansen --- .../qscriptvalue/tst_qscriptvalue_generated.cpp | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp index 1d105b4..4e621b3 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue_generated.cpp @@ -152,6 +152,8 @@ void tst_QScriptValue::initScriptValues() DEFINE_TEST_VALUE(engine->evaluate("new Object()")); DEFINE_TEST_VALUE(engine->evaluate("new Array()")); DEFINE_TEST_VALUE(engine->evaluate("new Error()")); + DEFINE_TEST_VALUE(engine->nullValue()); + DEFINE_TEST_VALUE(engine->undefinedValue()); } @@ -267,6 +269,8 @@ void tst_QScriptValue::isValid_makeData(const char* expr) << "engine->evaluate(\"new Object()\")" << "engine->evaluate(\"new Array()\")" << "engine->evaluate(\"new Error()\")" + << "engine->nullValue()" + << "engine->undefinedValue()" ; } newRow(expr) << isValid.contains(expr); @@ -453,6 +457,7 @@ void tst_QScriptValue::isNull_makeData(const char* expr) isNull << "QScriptValue(QScriptValue::NullValue)" << "QScriptValue(0, QScriptValue::NullValue)" << "QScriptValue(engine, QScriptValue::NullValue)" + << "engine->nullValue()" ; } newRow(expr) << isNull.contains(expr); @@ -535,6 +540,7 @@ void tst_QScriptValue::isUndefined_makeData(const char* expr) << "QScriptValue(0, QScriptValue::UndefinedValue)" << "QScriptValue(engine, QScriptValue::UndefinedValue)" << "engine->evaluate(\"{}\")" + << "engine->undefinedValue()" ; } newRow(expr) << isUndefined.contains(expr); @@ -810,6 +816,8 @@ void tst_QScriptValue::toString_makeData(const char* expr) toString.insert("engine->evaluate(\"new Object()\")", "[object Object]"); toString.insert("engine->evaluate(\"new Array()\")", ""); toString.insert("engine->evaluate(\"new Error()\")", "Error: Unknown error"); + toString.insert("engine->nullValue()", "null"); + toString.insert("engine->undefinedValue()", "undefined"); } newRow(expr) << toString.value(expr); } @@ -936,6 +944,8 @@ void tst_QScriptValue::toNumber_makeData(const char* expr) toNumber.insert("engine->evaluate(\"new Object()\")", qQNaN()); toNumber.insert("engine->evaluate(\"new Array()\")", 0); toNumber.insert("engine->evaluate(\"new Error()\")", qQNaN()); + toNumber.insert("engine->nullValue()", 0); + toNumber.insert("engine->undefinedValue()", qQNaN()); } newRow(expr) << toNumber.value(expr); } @@ -1070,6 +1080,8 @@ void tst_QScriptValue::toBool_makeData(const char* expr) toBool.insert("engine->evaluate(\"new Object()\")", true); toBool.insert("engine->evaluate(\"new Array()\")", true); toBool.insert("engine->evaluate(\"new Error()\")", true); + toBool.insert("engine->nullValue()", false); + toBool.insert("engine->undefinedValue()", false); } newRow(expr) << toBool.value(expr); } @@ -1196,6 +1208,8 @@ void tst_QScriptValue::toBoolean_makeData(const char* expr) toBoolean.insert("engine->evaluate(\"new Object()\")", true); toBoolean.insert("engine->evaluate(\"new Array()\")", true); toBoolean.insert("engine->evaluate(\"new Error()\")", true); + toBoolean.insert("engine->nullValue()", false); + toBoolean.insert("engine->undefinedValue()", false); } newRow(expr) << toBoolean.value(expr); } @@ -1322,6 +1336,8 @@ void tst_QScriptValue::toInteger_makeData(const char* expr) toInteger.insert("engine->evaluate(\"new Object()\")", 0); toInteger.insert("engine->evaluate(\"new Array()\")", 0); toInteger.insert("engine->evaluate(\"new Error()\")", 0); + toInteger.insert("engine->nullValue()", 0); + toInteger.insert("engine->undefinedValue()", 0); } newRow(expr) << toInteger.value(expr); } @@ -1452,6 +1468,8 @@ void tst_QScriptValue::toInt32_makeData(const char* expr) toInt32.insert("engine->evaluate(\"new Object()\")", 0); toInt32.insert("engine->evaluate(\"new Array()\")", 0); toInt32.insert("engine->evaluate(\"new Error()\")", 0); + toInt32.insert("engine->nullValue()", 0); + toInt32.insert("engine->undefinedValue()", 0); } newRow(expr) << toInt32.value(expr); } @@ -1578,6 +1596,8 @@ void tst_QScriptValue::toUInt32_makeData(const char* expr) toUInt32.insert("engine->evaluate(\"new Object()\")", 0); toUInt32.insert("engine->evaluate(\"new Array()\")", 0); toUInt32.insert("engine->evaluate(\"new Error()\")", 0); + toUInt32.insert("engine->nullValue()", 0); + toUInt32.insert("engine->undefinedValue()", 0); } newRow(expr) << toUInt32.value(expr); } @@ -1704,6 +1724,8 @@ void tst_QScriptValue::toUInt16_makeData(const char* expr) toUInt16.insert("engine->evaluate(\"new Object()\")", 0); toUInt16.insert("engine->evaluate(\"new Array()\")", 0); toUInt16.insert("engine->evaluate(\"new Error()\")", 0); + toUInt16.insert("engine->nullValue()", 0); + toUInt16.insert("engine->undefinedValue()", 0); } newRow(expr) << toUInt16.value(expr); } @@ -1736,6 +1758,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->nullValue()"); + equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); @@ -1743,6 +1767,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()"); + equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(true) <=> QScriptValue(true)"); equals.insert("QScriptValue(true) <=> QScriptValue(0, true)"); equals.insert("QScriptValue(true) <=> QScriptValue(engine, true)"); @@ -1937,6 +1963,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->nullValue()"); + equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); @@ -1944,6 +1972,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()"); + equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(0, true) <=> QScriptValue(true)"); equals.insert("QScriptValue(0, true) <=> QScriptValue(0, true)"); equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, true)"); @@ -2138,6 +2168,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->nullValue()"); + equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); @@ -2145,6 +2177,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()"); + equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(engine, true) <=> QScriptValue(true)"); equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, true)"); equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, true)"); @@ -2355,6 +2389,8 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::NullValue)"); equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")"); + equals.insert("engine->evaluate(\"{}\") <=> engine->nullValue()"); + equals.insert("engine->evaluate(\"{}\") <=> engine->undefinedValue()"); equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")"); equals.insert("engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")"); equals.insert("engine->evaluate(\"Array.prototype\") <=> QScriptValue(false)"); @@ -2401,6 +2437,24 @@ void tst_QScriptValue::equals_makeData(const char *expr) equals.insert("engine->evaluate(\"new Array()\") <=> QScriptValue(engine, QString())"); equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")"); equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")"); + equals.insert("engine->nullValue() <=> QScriptValue(QScriptValue::UndefinedValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)"); + equals.insert("engine->nullValue() <=> engine->evaluate(\"{}\")"); + equals.insert("engine->nullValue() <=> engine->nullValue()"); + equals.insert("engine->nullValue() <=> engine->undefinedValue()"); + equals.insert("engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(QScriptValue::NullValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(0, QScriptValue::NullValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::NullValue)"); + equals.insert("engine->undefinedValue() <=> engine->evaluate(\"{}\")"); + equals.insert("engine->undefinedValue() <=> engine->nullValue()"); + equals.insert("engine->undefinedValue() <=> engine->undefinedValue()"); } QHash::const_iterator it; for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { @@ -2435,9 +2489,11 @@ void tst_QScriptValue::strictlyEquals_makeData(const char *expr) equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); equals.insert("QScriptValue(QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); + equals.insert("QScriptValue(QScriptValue::NullValue) <=> engine->nullValue()"); equals.insert("QScriptValue(true) <=> QScriptValue(true)"); equals.insert("QScriptValue(true) <=> QScriptValue(0, true)"); equals.insert("QScriptValue(true) <=> QScriptValue(engine, true)"); @@ -2530,9 +2586,11 @@ void tst_QScriptValue::strictlyEquals_makeData(const char *expr) equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(0, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); + equals.insert("QScriptValue(0, QScriptValue::NullValue) <=> engine->nullValue()"); equals.insert("QScriptValue(0, true) <=> QScriptValue(true)"); equals.insert("QScriptValue(0, true) <=> QScriptValue(0, true)"); equals.insert("QScriptValue(0, true) <=> QScriptValue(engine, true)"); @@ -2625,9 +2683,11 @@ void tst_QScriptValue::strictlyEquals_makeData(const char *expr) equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(0, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->evaluate(\"{}\")"); + equals.insert("QScriptValue(engine, QScriptValue::UndefinedValue) <=> engine->undefinedValue()"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(QScriptValue::NullValue)"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(0, QScriptValue::NullValue)"); equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> QScriptValue(engine, QScriptValue::NullValue)"); + equals.insert("QScriptValue(engine, QScriptValue::NullValue) <=> engine->nullValue()"); equals.insert("QScriptValue(engine, true) <=> QScriptValue(true)"); equals.insert("QScriptValue(engine, true) <=> QScriptValue(0, true)"); equals.insert("QScriptValue(engine, true) <=> QScriptValue(engine, true)"); @@ -2721,6 +2781,7 @@ void tst_QScriptValue::strictlyEquals_makeData(const char *expr) equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(0, QScriptValue::UndefinedValue)"); equals.insert("engine->evaluate(\"{}\") <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); equals.insert("engine->evaluate(\"{}\") <=> engine->evaluate(\"{}\")"); + equals.insert("engine->evaluate(\"{}\") <=> engine->undefinedValue()"); equals.insert("engine->evaluate(\"Object.prototype\") <=> engine->evaluate(\"Object.prototype\")"); equals.insert("engine->evaluate(\"Date.prototype\") <=> engine->evaluate(\"Date.prototype\")"); equals.insert("engine->evaluate(\"Array.prototype\") <=> engine->evaluate(\"Array.prototype\")"); @@ -2737,6 +2798,15 @@ void tst_QScriptValue::strictlyEquals_makeData(const char *expr) equals.insert("engine->evaluate(\"new Object()\") <=> engine->evaluate(\"new Object()\")"); equals.insert("engine->evaluate(\"new Array()\") <=> engine->evaluate(\"new Array()\")"); equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Error()\")"); + equals.insert("engine->nullValue() <=> QScriptValue(QScriptValue::NullValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, QScriptValue::NullValue)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, QScriptValue::NullValue)"); + equals.insert("engine->nullValue() <=> engine->nullValue()"); + equals.insert("engine->undefinedValue() <=> QScriptValue(QScriptValue::UndefinedValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(0, QScriptValue::UndefinedValue)"); + equals.insert("engine->undefinedValue() <=> QScriptValue(engine, QScriptValue::UndefinedValue)"); + equals.insert("engine->undefinedValue() <=> engine->evaluate(\"{}\")"); + equals.insert("engine->undefinedValue() <=> engine->undefinedValue()"); } QHash::const_iterator it; for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { @@ -3090,6 +3160,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"[]\")"); equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"Array.prototype\")"); equals.insert("QScriptValue(-6.37e-8) <=> engine->evaluate(\"new Array()\")"); + equals.insert("QScriptValue(-6.37e-8) <=> engine->nullValue()"); equals.insert("QScriptValue(0x43211234) <=> QScriptValue(qInf())"); equals.insert("QScriptValue(0x43211234) <=> QScriptValue(\"Infinity\")"); equals.insert("QScriptValue(0x43211234) <=> QScriptValue(0, qInf())"); @@ -3180,6 +3251,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"[]\")"); equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"Array.prototype\")"); equals.insert("QScriptValue(-qInf()) <=> engine->evaluate(\"new Array()\")"); + equals.insert("QScriptValue(-qInf()) <=> engine->nullValue()"); equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(\"ciao\")"); equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); equals.insert("QScriptValue(\"NaN\") <=> QScriptValue(0, \"ciao\")"); @@ -3291,6 +3363,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"/foo/\")"); equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"new Object()\")"); equals.insert("QScriptValue(\"-Infinity\") <=> engine->evaluate(\"new Error()\")"); + equals.insert("QScriptValue(\"-Infinity\") <=> engine->nullValue()"); equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Function.prototype\")"); equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Object\")"); equals.insert("QScriptValue(\"ciao\") <=> engine->evaluate(\"Array\")"); @@ -3903,6 +3976,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"[]\")"); equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"Array.prototype\")"); equals.insert("QScriptValue(0, -6.37e-8) <=> engine->evaluate(\"new Array()\")"); + equals.insert("QScriptValue(0, -6.37e-8) <=> engine->nullValue()"); equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(qInf())"); equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(\"Infinity\")"); equals.insert("QScriptValue(0, 0x43211234) <=> QScriptValue(0, qInf())"); @@ -3993,6 +4067,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"[]\")"); equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"Array.prototype\")"); equals.insert("QScriptValue(0, -qInf()) <=> engine->evaluate(\"new Array()\")"); + equals.insert("QScriptValue(0, -qInf()) <=> engine->nullValue()"); equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(\"ciao\")"); equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); equals.insert("QScriptValue(0, \"NaN\") <=> QScriptValue(0, \"ciao\")"); @@ -4104,6 +4179,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"/foo/\")"); equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"new Object()\")"); equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->evaluate(\"new Error()\")"); + equals.insert("QScriptValue(0, \"-Infinity\") <=> engine->nullValue()"); equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Function.prototype\")"); equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Object\")"); equals.insert("QScriptValue(0, \"ciao\") <=> engine->evaluate(\"Array\")"); @@ -4717,6 +4793,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"[]\")"); equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"Array.prototype\")"); equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->evaluate(\"new Array()\")"); + equals.insert("QScriptValue(engine, -6.37e-8) <=> engine->nullValue()"); equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(qInf())"); equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(\"Infinity\")"); equals.insert("QScriptValue(engine, 0x43211234) <=> QScriptValue(0, qInf())"); @@ -4807,6 +4884,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"[]\")"); equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"Array.prototype\")"); equals.insert("QScriptValue(engine, -qInf()) <=> engine->evaluate(\"new Array()\")"); + equals.insert("QScriptValue(engine, -qInf()) <=> engine->nullValue()"); equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(\"ciao\")"); equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(QString::fromLatin1(\"ciao\"))"); equals.insert("QScriptValue(engine, \"NaN\") <=> QScriptValue(0, \"ciao\")"); @@ -4918,6 +4996,7 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"/foo/\")"); equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"new Object()\")"); equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->evaluate(\"new Error()\")"); + equals.insert("QScriptValue(engine, \"-Infinity\") <=> engine->nullValue()"); equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Function.prototype\")"); equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Object\")"); equals.insert("QScriptValue(engine, \"ciao\") <=> engine->evaluate(\"Array\")"); @@ -5533,6 +5612,42 @@ void tst_QScriptValue::lessThan_makeData(const char *expr) equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { return 'ciao'; })\")"); equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"(function() { throw new Error('foo'); })\")"); equals.insert("engine->evaluate(\"new Error()\") <=> engine->evaluate(\"new Object()\")"); + equals.insert("engine->nullValue() <=> QScriptValue(true)"); + equals.insert("engine->nullValue() <=> QScriptValue(int(122))"); + equals.insert("engine->nullValue() <=> QScriptValue(uint(124))"); + equals.insert("engine->nullValue() <=> QScriptValue(123.0)"); + equals.insert("engine->nullValue() <=> QScriptValue(6.37e-8)"); + equals.insert("engine->nullValue() <=> QScriptValue(0x43211234)"); + equals.insert("engine->nullValue() <=> QScriptValue(0x10000)"); + equals.insert("engine->nullValue() <=> QScriptValue(0x10001)"); + equals.insert("engine->nullValue() <=> QScriptValue(qInf())"); + equals.insert("engine->nullValue() <=> QScriptValue(\"Infinity\")"); + equals.insert("engine->nullValue() <=> QScriptValue(QString(\"123\"))"); + equals.insert("engine->nullValue() <=> QScriptValue(QString(\"12.4\"))"); + equals.insert("engine->nullValue() <=> QScriptValue(0, true)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, int(122))"); + equals.insert("engine->nullValue() <=> QScriptValue(0, uint(124))"); + equals.insert("engine->nullValue() <=> QScriptValue(0, 123.0)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, 6.37e-8)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, 0x43211234)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, 0x10000)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, 0x10001)"); + equals.insert("engine->nullValue() <=> QScriptValue(0, qInf())"); + equals.insert("engine->nullValue() <=> QScriptValue(0, \"Infinity\")"); + equals.insert("engine->nullValue() <=> QScriptValue(0, QString(\"123\"))"); + equals.insert("engine->nullValue() <=> QScriptValue(0, QString(\"12.3\"))"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, true)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, int(122))"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, uint(124))"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, 123.0)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, 6.37e-8)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, 0x43211234)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, 0x10000)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, 0x10001)"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, qInf())"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, \"Infinity\")"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, QString(\"123\"))"); + equals.insert("engine->nullValue() <=> QScriptValue(engine, QString(\"1.23\"))"); } QHash::const_iterator it; for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { @@ -5718,6 +5833,8 @@ void tst_QScriptValue::qscriptvalue_castQString_makeData(const char* expr) value.insert("engine->evaluate(\"new Object()\")", "[object Object]"); value.insert("engine->evaluate(\"new Array()\")", ""); value.insert("engine->evaluate(\"new Error()\")", "Error: Unknown error"); + value.insert("engine->nullValue()", ""); + value.insert("engine->undefinedValue()", ""); } newRow(expr) << value.value(expr); } @@ -5844,6 +5961,8 @@ void tst_QScriptValue::qscriptvalue_castqsreal_makeData(const char* expr) value.insert("engine->evaluate(\"new Object()\")", qQNaN()); value.insert("engine->evaluate(\"new Array()\")", 0); value.insert("engine->evaluate(\"new Error()\")", qQNaN()); + value.insert("engine->nullValue()", 0); + value.insert("engine->undefinedValue()", qQNaN()); } newRow(expr) << value.value(expr); } @@ -5978,6 +6097,8 @@ void tst_QScriptValue::qscriptvalue_castbool_makeData(const char* expr) value.insert("engine->evaluate(\"new Object()\")", true); value.insert("engine->evaluate(\"new Array()\")", true); value.insert("engine->evaluate(\"new Error()\")", true); + value.insert("engine->nullValue()", false); + value.insert("engine->undefinedValue()", false); } newRow(expr) << value.value(expr); } @@ -6104,6 +6225,8 @@ void tst_QScriptValue::qscriptvalue_castqint32_makeData(const char* expr) value.insert("engine->evaluate(\"new Object()\")", 0); value.insert("engine->evaluate(\"new Array()\")", 0); value.insert("engine->evaluate(\"new Error()\")", 0); + value.insert("engine->nullValue()", 0); + value.insert("engine->undefinedValue()", 0); } newRow(expr) << value.value(expr); } @@ -6230,6 +6353,8 @@ void tst_QScriptValue::qscriptvalue_castquint32_makeData(const char* expr) value.insert("engine->evaluate(\"new Object()\")", 0); value.insert("engine->evaluate(\"new Array()\")", 0); value.insert("engine->evaluate(\"new Error()\")", 0); + value.insert("engine->nullValue()", 0); + value.insert("engine->undefinedValue()", 0); } newRow(expr) << value.value(expr); } @@ -6356,6 +6481,8 @@ void tst_QScriptValue::qscriptvalue_castquint16_makeData(const char* expr) value.insert("engine->evaluate(\"new Object()\")", 0); value.insert("engine->evaluate(\"new Array()\")", 0); value.insert("engine->evaluate(\"new Error()\")", 0); + value.insert("engine->nullValue()", 0); + value.insert("engine->undefinedValue()", 0); } newRow(expr) << value.value(expr); } -- cgit v0.12 From 37ffa8f59c5dc1f4a1174a07e0a6df6e266d40c0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 10 Feb 2010 10:05:41 +0100 Subject: Stabilize QListView test on Mac --- tests/auto/qlistview/tst_qlistview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 2c31d8b..d2181f8 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -779,6 +779,7 @@ void tst_QListView::batchedMode() view.resize(200,400); view.show(); QTest::qWaitForWindowShown(&view); + QTest::qWait(100); #if defined(Q_OS_WINCE) QTest::qWait(2000); @@ -1846,6 +1847,7 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() view.setRowHidden(i, true); } QApplication::processEvents(); + QTest::qWait(50); QCOMPARE(bar->value(), bar->maximum()); QCOMPARE(bar->maximum(), rowCount/4 - nbVisibleItem); } -- cgit v0.12 From 31ba9218c63b6c0177fabae3ff33cc5f3c2df8d5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 10 Feb 2010 11:05:59 +0100 Subject: Fix warnings ~QX11PixmapData(): QPixmap objects must be destroyed.. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in the property browser solution. Reviewed-by: Trond KjernÃ¥sen Task-number: QTBUG-8046 --- .../qtpropertybrowser/qtpropertybrowserutils.cpp | 16 +++-- .../qtpropertybrowser/qtpropertybrowserutils_p.h | 1 + .../shared/qtpropertybrowser/qtpropertymanager.cpp | 82 +++++++++++++--------- 3 files changed, 61 insertions(+), 38 deletions(-) diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp index b84de11..0b14292 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp @@ -93,15 +93,23 @@ QtCursorDatabase::QtCursorDatabase() QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-busy.png"))); } +void QtCursorDatabase::clear() +{ + m_cursorNames.clear(); + m_cursorIcons.clear(); + m_valueToCursorShape.clear(); + m_cursorShapeToValue.clear(); +} + void QtCursorDatabase::appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon) { if (m_cursorShapeToValue.contains(shape)) return; - int value = m_cursorNames.count(); + const int value = m_cursorNames.count(); m_cursorNames.append(name); - m_cursorIcons[value] = icon; - m_valueToCursorShape[value] = shape; - m_cursorShapeToValue[shape] = value; + m_cursorIcons.insert(value, icon); + m_valueToCursorShape.insert(value, shape); + m_cursorShapeToValue.insert(shape, value); } QStringList QtCursorDatabase::cursorShapeNames() const diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h index b60fb94..baa7a4a 100644 --- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h +++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h @@ -68,6 +68,7 @@ class QtCursorDatabase { public: QtCursorDatabase(); + void clear(); QStringList cursorShapeNames() const; QMap cursorShapeIcons() const; diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp index 67ab2fb..d9ff10a 100644 --- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp +++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp @@ -1391,16 +1391,54 @@ void QtStringPropertyManager::uninitializeProperty(QtProperty *property) } // QtBoolPropertyManager +// Return an icon containing a check box indicator +static QIcon drawCheckBox(bool value) +{ + QStyleOptionButton opt; + opt.state |= value ? QStyle::State_On : QStyle::State_Off; + opt.state |= QStyle::State_Enabled; + const QStyle *style = QApplication::style(); + // Figure out size of an indicator and make sure it is not scaled down in a list view item + // by making the pixmap as big as a list view icon and centering the indicator in it. + // (if it is smaller, it can't be helped) + const int indicatorWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &opt); + const int indicatorHeight = style->pixelMetric(QStyle::PM_IndicatorHeight, &opt); + const int listViewIconSize = indicatorWidth; + const int pixmapWidth = indicatorWidth; + const int pixmapHeight = qMax(indicatorHeight, listViewIconSize); + + opt.rect = QRect(0, 0, indicatorWidth, indicatorHeight); + QPixmap pixmap = QPixmap(pixmapWidth, pixmapHeight); + pixmap.fill(Qt::transparent); + { + // Center? + const int xoff = (pixmapWidth > indicatorWidth) ? (pixmapWidth - indicatorWidth) / 2 : 0; + const int yoff = (pixmapHeight > indicatorHeight) ? (pixmapHeight - indicatorHeight) / 2 : 0; + QPainter painter(&pixmap); + painter.translate(xoff, yoff); + style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &opt, &painter); + } + return QIcon(pixmap); +} class QtBoolPropertyManagerPrivate { QtBoolPropertyManager *q_ptr; Q_DECLARE_PUBLIC(QtBoolPropertyManager) public: + QtBoolPropertyManagerPrivate(); QMap m_values; + const QIcon m_checkedIcon; + const QIcon m_uncheckedIcon; }; +QtBoolPropertyManagerPrivate::QtBoolPropertyManagerPrivate() : + m_checkedIcon(drawCheckBox(true)), + m_uncheckedIcon(drawCheckBox(false)) +{ +} + /*! \class QtBoolPropertyManager \internal @@ -1471,36 +1509,6 @@ QString QtBoolPropertyManager::valueText(const QtProperty *property) const return it.value() ? trueText : falseText; } -// Return an icon containing a check box indicator -static QIcon drawCheckBox(bool value) -{ - QStyleOptionButton opt; - opt.state |= value ? QStyle::State_On : QStyle::State_Off; - opt.state |= QStyle::State_Enabled; - const QStyle *style = QApplication::style(); - // Figure out size of an indicator and make sure it is not scaled down in a list view item - // by making the pixmap as big as a list view icon and centering the indicator in it. - // (if it is smaller, it can't be helped) - const int indicatorWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &opt); - const int indicatorHeight = style->pixelMetric(QStyle::PM_IndicatorHeight, &opt); - const int listViewIconSize = indicatorWidth; - const int pixmapWidth = indicatorWidth; - const int pixmapHeight = qMax(indicatorHeight, listViewIconSize); - - opt.rect = QRect(0, 0, indicatorWidth, indicatorHeight); - QPixmap pixmap = QPixmap(pixmapWidth, pixmapHeight); - pixmap.fill(Qt::transparent); - { - // Center? - const int xoff = (pixmapWidth > indicatorWidth) ? (pixmapWidth - indicatorWidth) / 2 : 0; - const int yoff = (pixmapHeight > indicatorHeight) ? (pixmapHeight - indicatorHeight) / 2 : 0; - QPainter painter(&pixmap); - painter.translate(xoff, yoff); - style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &opt, &painter); - } - return QIcon(pixmap); -} - /*! \reimp */ @@ -1510,9 +1518,7 @@ QIcon QtBoolPropertyManager::valueIcon(const QtProperty *property) const if (it == d_ptr->m_values.constEnd()) return QIcon(); - static const QIcon checkedIcon = drawCheckBox(true); - static const QIcon uncheckedIcon = drawCheckBox(false); - return it.value() ? checkedIcon : uncheckedIcon; + return it.value() ? d_ptr->m_checkedIcon : d_ptr->m_uncheckedIcon; } /*! @@ -6287,7 +6293,15 @@ void QtColorPropertyManager::uninitializeProperty(QtProperty *property) // QtCursorPropertyManager -Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase) +// Make sure icons are removed as soon as QApplication is destroyed, otherwise, +// handles are leaked on X11. +static void clearCursorDatabase(); +Q_GLOBAL_STATIC_WITH_INITIALIZER(QtCursorDatabase, cursorDatabase, qAddPostRoutine(clearCursorDatabase)) + +static void clearCursorDatabase() +{ + cursorDatabase()->clear(); +} class QtCursorPropertyManagerPrivate { -- cgit v0.12 From de88b9663c01691c64e2677444aab5c1b806c4c2 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 10 Feb 2010 12:12:00 +0200 Subject: Removed dependency to moc.exe from Symbian builds Having dependency to moc.exe makes no sense since we cannot build it anyway when building with Symbian toolchain. Task-number: QTBUG-7836 Reviewed-by: Janne Koskinen --- mkspecs/features/moc.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 42ce1bc..e4b7dae 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -97,7 +97,7 @@ equals(MOC_DIR, .) { } #auto depend on moc -unix:!no_mocdepend { +unix:!symbian:!no_mocdepend { moc_source.depends += $$first(QMAKE_MOC) moc_header.depends += $$first(QMAKE_MOC) !contains(TARGET, moc) { #auto build moc -- cgit v0.12 From d7f8be6ec47bc8c241df95f7d13547a60362677b Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Wed, 10 Feb 2010 11:24:27 +0100 Subject: Make compile Reviewed-By: Alessandro Portale --- src/gui/text/qfontengine_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 9dd4af7..3ea084b 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -44,7 +44,7 @@ #include "qglobal.h" #include #include "qimage.h" -#include "qt_s60_p.h" +#include #include #include -- cgit v0.12 From 72b510e78973e47c31ae60070cb74b41f291b1ec Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 10 Feb 2010 12:18:39 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( ffae5e11181a3961193fa21ea405851cad714d4b ) Changes in WebKit/qt since the last update: * https://bugs.webkit.org/show_bug.cgi?id=34170 -- [Qt] Javascript undefined > 0 returns true on Symbian --- src/3rdparty/webkit/JavaScriptCore/ChangeLog | 13 +++++++++++++ src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp | 4 ++++ src/3rdparty/webkit/VERSION | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index b943840..6446773 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,16 @@ +2010-02-09 Janne Koskinen + + Reviewed by Laszlo Gombos. + + [Qt] use nanval() for Symbian as nonInlineNaN + https://bugs.webkit.org/show_bug.cgi?id=34170 + + numeric_limits::quiet_NaN is broken in Symbian + causing NaN to be evaluated as a number. + + * runtime/JSValue.cpp: + (JSC::nonInlineNaN): + 2010-01-07 Norbert Leser Reviewed by NOBODY (OOPS!). diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp index 699c1cd..502312c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp @@ -174,7 +174,11 @@ uint32_t toUInt32SlowCase(double d, bool& ok) NEVER_INLINE double nonInlineNaN() { +#if OS(SYMBIAN) + return nanval(); +#else return std::numeric_limits::quiet_NaN(); +#endif } } // namespace JSC diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 2b39e81..cc0e04f 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 36fe058a9001e6d47f0fd41c6304cdfdf3a735ed + ffae5e11181a3961193fa21ea405851cad714d4b -- cgit v0.12 From 64233a38fe5a1755a6426caf55eaf8abbd4187ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 10 Feb 2010 12:48:55 +0100 Subject: Clarify QFont::rawName() docs. Task-number: related to QTBUG-8038 Reviewed-by: Kim --- src/gui/text/qfont.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index bbd35f1..dd9e69e 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -629,8 +629,9 @@ QFontEngineData::~QFontEngineData() Returns the name of the font within the underlying window system. - Only on X11 when Qt was built without FontConfig support the XLFD (X Logical Font Description) - is returned; otherwise an empty string. + On X11, this function will return an empty string if Qt is built with + FontConfig support; otherwise the XLFD (X Logical Font Description) is + returned. Using the return value of this function is usually \e not \e portable. -- cgit v0.12 From 709a3a4b96f4cc483e63958494adbc5efdf6c57d Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 10 Feb 2010 14:08:17 +0200 Subject: License update as requested by legal for file relicensed from S60. Rev-By: TrustMe --- src/3rdparty/s60/eiksoftkeyimage.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/3rdparty/s60/eiksoftkeyimage.h b/src/3rdparty/s60/eiksoftkeyimage.h index 84f6108a..a658421 100644 --- a/src/3rdparty/s60/eiksoftkeyimage.h +++ b/src/3rdparty/s60/eiksoftkeyimage.h @@ -39,23 +39,6 @@ ** ****************************************************************************/ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Changes cba button's label to image. -* -*/ - #ifndef EIKSOFTKEYIMAGE_H #define EIKSOFTKEYIMAGE_H -- cgit v0.12 From f04f014835e9fd4c41e9113e8036ba71ff884ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 10 Feb 2010 13:11:01 +0100 Subject: Prevented assert when using drop shadow effect in the GL 2 engine. The GL 2 pixmap filter uses Indexed8 images in the drop shadow case. Reviewed-by: Tom Cooksey --- src/gui/image/qpixmapfilter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 7cf942c..2792e45 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -713,7 +713,8 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp radius *= qreal(0.5); Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied - || img.format() == QImage::Format_RGB32); + || img.format() == QImage::Format_RGB32 + || img.format() == QImage::Format_Indexed8); // choose the alpha such that pixels at radius distance from a fully // saturated pixel will have an alpha component of no greater than -- cgit v0.12 From 0d1e1f26cd9c29e960117e23c57a84055f1cc9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 10 Feb 2010 13:26:21 +0100 Subject: Fixed drawing pixmaps onto bitmaps on X11 w/o Xrender support. Task-number: QTBUG-8032 Reviewed-by: Kim --- src/gui/painting/qpaintengine_x11.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 147491e..da48fcb 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -1989,6 +1989,9 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect } XFillRectangle(d->dpy, d->hd, d->gc, x, y, sw, sh); restore_clip = true; + } else if (mono_dst && !mono_src) { + QBitmap bitmap(pixmap); + XCopyArea(d->dpy, bitmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y); } else { XCopyArea(d->dpy, pixmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y); } -- cgit v0.12 From e950fad2ab8b0c93da176ce2f07a4d45a3185cb4 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Wed, 10 Feb 2010 14:00:57 +0100 Subject: Take into account the solaris-cc-64-stlport mkspec Reviewed-by: Simon Hausmann --- src/corelib/arch/sparc/arch.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/arch/sparc/arch.pri b/src/corelib/arch/sparc/arch.pri index 3113dd3..9bb3a88 100644 --- a/src/corelib/arch/sparc/arch.pri +++ b/src/corelib/arch/sparc/arch.pri @@ -1,7 +1,7 @@ # # SPARC architecture # -*-64 { +*-64* { SOURCES += $$QT_ARCH_CPP/qatomic64.s } else { -- cgit v0.12 From 0d27306664188a61571d31a38fec1d9040aae5f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 10 Feb 2010 14:19:08 +0100 Subject: Fixed drawing QPixmaps on QGLWidgets on different X11 screens. Don't try to use the texture_from_pixmap extension when drawing a pixmap from one X11 screen onto a different X11 screen in the GL 2 engine. For that to work, the pixmap will have to be re-created on the new screen, which is exactly what the default bind method does (via QImage conversion). Task-number: QTBUG-8054 Reviewed-by: Kim --- src/opengl/qgl.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index fce9fdb..0a89412 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -104,6 +104,10 @@ QT_BEGIN_NAMESPACE QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; #endif +#ifdef Q_WS_X11 +extern const QX11Info *qt_x11Info(const QPaintDevice *pd); +#endif + struct QGLThreadContext { QGLContext *context; }; @@ -2350,7 +2354,10 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, #if defined(Q_WS_X11) // Try to use texture_from_pixmap - if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType) { + const QX11Info *xinfo = qt_x11Info(paintDevice); + if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType + && xinfo && xinfo->screen() == pixmap.x11Info().screen()) + { texture = bindTextureFromNativePixmap(pd, key, options); if (texture) { texture->options |= QGLContext::MemoryManagedBindOption; -- cgit v0.12 From 358bbd707bb5e0ce255559e45f8dedb9e9243a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 10 Feb 2010 14:37:58 +0100 Subject: Fixed usage of QGLPixelBuffer with share widgets on other X11 screens. When trying to share the internal pbo context with a widget context, the pbo context needs to be created on the same X11 screen as the widget context. Task-number: QTBUG-8047 Reviewed-by: Kim --- src/opengl/qglpixelbuffer_x11.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/opengl/qglpixelbuffer_x11.cpp b/src/opengl/qglpixelbuffer_x11.cpp index 5b34cbb..32a42a2 100644 --- a/src/opengl/qglpixelbuffer_x11.cpp +++ b/src/opengl/qglpixelbuffer_x11.cpp @@ -181,7 +181,11 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge qt_format_to_attrib_list(f, attribs); - GLXFBConfig *configs = glXChooseFBConfig(X11->display, X11->defaultScreen, attribs, &num_configs); + int screen = X11->defaultScreen; + if (shareWidget) + screen = shareWidget->x11Info().screen(); + + GLXFBConfig *configs = glXChooseFBConfig(X11->display, screen, attribs, &num_configs); if (configs && num_configs) { int res; glXGetFBConfigAttrib(X11->display, configs[0], GLX_LEVEL, &res); -- cgit v0.12 From 5ab191af20bf2b1fed2b8886ac247c2953087c14 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 9 Feb 2010 12:33:52 +0100 Subject: Fixed compilation with QT_NO_WHEELEVENT Reviewed-by: Prasanth --- src/gui/kernel/qapplication_mac.mm | 6 ++++++ src/gui/kernel/qapplication_p.h | 2 ++ src/gui/kernel/qapplication_x11.cpp | 8 ++++++++ src/gui/kernel/qcocoaview_mac.mm | 3 +++ src/gui/util/qsystemtrayicon_p.h | 2 ++ src/gui/util/qsystemtrayicon_x11.cpp | 2 ++ src/gui/widgets/qabstractslider.cpp | 6 +++++- src/gui/widgets/qabstractspinbox.h | 2 ++ src/gui/widgets/qcombobox.h | 2 ++ src/gui/widgets/qmenu.h | 2 ++ src/gui/widgets/qscrollbar.cpp | 2 ++ 11 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index e8b821af..54a4901 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -2143,6 +2143,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event } if (wheel_deltaX || wheel_deltaY) { +#ifndef QT_NO_WHEELEVENT if (wheel_deltaX) { QWheelEvent qwe(plocal, p, wheel_deltaX, buttons, modifiers, Qt::Horizontal); QApplication::sendSpontaneousEvent(widget, &qwe); @@ -2165,6 +2166,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event handled_event = false; } } +#endif // QT_NO_WHEELEVENT } else { #ifdef QMAC_SPEAK_TO_ME const int speak_keys = Qt::AltModifier | Qt::ShiftModifier; @@ -2717,6 +2719,7 @@ int QApplication::keyboardInputInterval() return QApplicationPrivate::keyboard_input_time; } +#ifndef QT_NO_WHEELEVENT void QApplication::setWheelScrollLines(int n) { QApplicationPrivate::wheel_scroll_lines = n; @@ -2726,6 +2729,7 @@ int QApplication::wheelScrollLines() { return QApplicationPrivate::wheel_scroll_lines; } +#endif void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) { @@ -2888,9 +2892,11 @@ bool QApplicationPrivate::qt_mac_apply_settings() QApplication::cursorFlashTime()).toInt(); QApplication::setCursorFlashTime(num); +#ifndef QT_NO_WHEELEVENT num = settings.value(QLatin1String("wheelScrollLines"), QApplication::wheelScrollLines()).toInt(); QApplication::setWheelScrollLines(num); +#endif QString colorspec = settings.value(QLatin1String("colorSpec"), QVariant(QLatin1String("default"))).toString(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 9c001ab..b3ec732 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -427,7 +427,9 @@ public: static int cursor_flash_time; static int mouse_double_click_time; static int keyboard_input_time; +#ifndef QT_NO_WHEELEVENT static int wheel_scroll_lines; +#endif static bool animate_ui; static bool animate_menu; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 2a1f655..afd927b 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -944,10 +944,12 @@ bool QApplicationPrivate::x11_apply_settings() QApplication::cursorFlashTime()).toInt(); QApplication::setCursorFlashTime(num); +#ifndef QT_NO_WHEELEVENT num = settings.value(QLatin1String("wheelScrollLines"), QApplication::wheelScrollLines()).toInt(); QApplication::setWheelScrollLines(num); +#endif QString colorspec = settings.value(QLatin1String("colorSpec"), QVariant(QLatin1String("default"))).toString(); @@ -4401,8 +4403,10 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta, QWidget* popup = qApp->activePopupWidget(); if (popup && window() != popup) popup->close(); +#ifndef QT_NO_WHEELEVENT QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient); if (QApplication::sendSpontaneousEvent(widget, &e)) +#endif return true; } @@ -4413,8 +4417,10 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta, QWidget* popup = qApp->activePopupWidget(); if (popup && widget != popup) popup->hide(); +#ifndef QT_NO_WHEELEVENT QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient); if (QApplication::sendSpontaneousEvent(widget, &e)) +#endif return true; } return false; @@ -5313,6 +5319,7 @@ int QApplication::keyboardInputInterval() return QApplicationPrivate::keyboard_input_time; } +#ifndef QT_NO_WHEELEVENT void QApplication::setWheelScrollLines(int n) { QApplicationPrivate::wheel_scroll_lines = n; @@ -5322,6 +5329,7 @@ int QApplication::wheelScrollLines() { return QApplicationPrivate::wheel_scroll_lines; } +#endif void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) { diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 756cf92..ad64a91 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -828,6 +828,7 @@ extern "C" { deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120); } +#ifndef QT_NO_WHEELEVENT if (deltaX != 0) { QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal); qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); @@ -868,6 +869,8 @@ extern "C" { wheelOK = qwe2.isAccepted(); } } +#endif //QT_NO_WHEELEVENT + if (!wheelOK) { return [super scrollWheel:theEvent]; } diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/gui/util/qsystemtrayicon_p.h index b881f68..e8bf197 100644 --- a/src/gui/util/qsystemtrayicon_p.h +++ b/src/gui/util/qsystemtrayicon_p.h @@ -164,7 +164,9 @@ protected: bool x11Event(XEvent *event); void mousePressEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *event); +#endif bool event(QEvent *e); private: diff --git a/src/gui/util/qsystemtrayicon_x11.cpp b/src/gui/util/qsystemtrayicon_x11.cpp index a645050..82b4325 100644 --- a/src/gui/util/qsystemtrayicon_x11.cpp +++ b/src/gui/util/qsystemtrayicon_x11.cpp @@ -308,10 +308,12 @@ void QSystemTrayIconSys::mouseDoubleClickEvent(QMouseEvent *ev) emit q->activated(QSystemTrayIcon::DoubleClick); } +#ifndef QT_NO_WHEELEVENT void QSystemTrayIconSys::wheelEvent(QWheelEvent *e) { QApplication::sendEvent(q, e); } +#endif bool QSystemTrayIconSys::event(QEvent *e) { diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 73c17db..4bd7b5a 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -705,7 +705,11 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb // Calculate how many lines to scroll. Depending on what delta is (and // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. - qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * effectiveSingleStep(); + qreal stepsToScrollF = +#ifndef QT_NO_WHEELEVENT + QApplication::wheelScrollLines() * +#endif + offset * effectiveSingleStep(); // Check if wheel changed direction since last event: if (offset_accumulated != 0 && (offset / offset_accumulated) < 0) offset_accumulated = 0; diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h index 059943a..6c062c0 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/gui/widgets/qabstractspinbox.h @@ -137,7 +137,9 @@ protected: void resizeEvent(QResizeEvent *event); void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *event); +#endif void focusInEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event); void contextMenuEvent(QContextMenuEvent *event); diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index f332d31..9b19a66 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -245,7 +245,9 @@ protected: void mouseReleaseEvent(QMouseEvent *e); void keyPressEvent(QKeyEvent *e); void keyReleaseEvent(QKeyEvent *e); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *e); +#endif void contextMenuEvent(QContextMenuEvent *e); void inputMethodEvent(QInputMethodEvent *); QVariant inputMethodQuery(Qt::InputMethodQuery) const; diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 5a6a5c7..47dff2b 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -162,7 +162,9 @@ protected: void mouseReleaseEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *); void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); +#endif void enterEvent(QEvent *); void leaveEvent(QEvent *); void hideEvent(QHideEvent *); diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 3eed3a9..4eff260 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -521,6 +521,7 @@ bool QScrollBar::event(QEvent *event) if (const QHoverEvent *he = static_cast(event)) d_func()->updateHoverControl(he->pos()); break; +#ifndef QT_NO_WHEELEVENT case QEvent::Wheel: { // override wheel event without adding virtual function override QWheelEvent *ev = static_cast(event); @@ -537,6 +538,7 @@ bool QScrollBar::event(QEvent *event) event->accept(); return true; } +#endif default: break; } -- cgit v0.12 From 620dd47c3b790b99f76793f4b4e6f22e3984558e Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Wed, 10 Feb 2010 17:26:24 +0100 Subject: Blinking cursors are 2 pixels wide on Mac OS X/Cocoa. Blinking cursors drawn in positions other than zero, can become 2 pixel wide. This is caused by a rendering bug in the paint engine used by Cocoa. If a fillRect() is called in a nox pixel boundary this engine draws them 2 pixels wide instead of one. So make sure this is always on a pixel boundary. Task-number: QTBUG-8100 Reviewed-by: Trond --- src/gui/text/qtextlayout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 26c7c1e..af91603 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1331,7 +1331,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition QTextLine l(line, d); const QScriptLine &sl = d->lines[line]; - const qreal x = position.x() + l.cursorToX(cursorPosition); + qreal x = position.x() + l.cursorToX(cursorPosition); int itm = d->findItem(cursorPosition - 1); QFixed base = sl.base(); @@ -1350,6 +1350,10 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); +#if defined(QT_MAC_USE_COCOA) + // Always draw the cursor aligned to pixel boundary. + x = qRound(x); +#endif p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush()); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); -- cgit v0.12 From 1407f3c1815addf6b9cac7503d38b670bbeab895 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 10 Feb 2010 17:39:59 +0100 Subject: Fix the WebKit build It's PLATFORM(SYMBIAN) in 4.x, not OS() like in the trunk Reviewed-by: Trust me --- src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp index 502312c..bafb85b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp @@ -174,7 +174,7 @@ uint32_t toUInt32SlowCase(double d, bool& ok) NEVER_INLINE double nonInlineNaN() { -#if OS(SYMBIAN) +#if PLATFORM(SYMBIAN) return nanval(); #else return std::numeric_limits::quiet_NaN(); -- cgit v0.12 From 24239b56ab563a30facde3a5217536e7276f9bb8 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 14 Dec 2009 10:23:39 -0800 Subject: Export a function to get dfb-surface from a pixmap This function is only exported when DirectFB is built as part of libQtGui. Reviewed-by: Jervey Kong --- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index f27440e..ba50329 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -593,6 +593,17 @@ void QDirectFBPixmapData::invalidate() imageFormat = QImage::Format_Invalid; } +#ifndef QT_DIRECTFB_PLUGIN +Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap) +{ + const QPixmapData *data = pixmap.pixmapData(); + if (!data || data->classId() != QPixmapData::DirectFBClass) + return 0; + const QDirectFBPixmapData *dfbData = static_cast(data); + return dfbData->directFBSurface(); +} +#endif + QT_END_NAMESPACE #endif // QT_NO_QWS_DIRECTFB -- cgit v0.12 From 5f885bc5a294cd831f79b5570cb41f3cae2b8b19 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 08:52:32 +1000 Subject: Fix networkAccessEnabled implementation. Move QDisabledNetworkReply to more appropriate source files. Return -1 from QDisabledNetworkReply::readData(). Always allow local access (via QNetworkAccessFileBackend). --- src/network/access/qnetworkaccessmanager.cpp | 47 +++------------------------- src/network/access/qnetworkreplyimpl.cpp | 24 ++++++++++++++ src/network/access/qnetworkreplyimpl_p.h | 14 +++++++++ 3 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 7f36570..07a8b1d 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -57,7 +57,6 @@ #include "QtCore/qbuffer.h" #include "QtCore/qurl.h" #include "QtCore/qvector.h" -#include "QtCore/qcoreapplication.h" #include "QtNetwork/qauthenticator.h" #include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qnetworkconfigmanager.h" @@ -760,46 +759,6 @@ bool QNetworkAccessManager::networkAccessEnabled() const return d->networkAccessEnabled; } -class QDisabledNetworkReply : public QNetworkReply -{ - Q_OBJECT - -public: - QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, - const QNetworkAccessManager::Operation op); - ~QDisabledNetworkReply(); - - void abort() { } -protected: - qint64 readData(char *, qint64) { return 0; } -}; - -QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, - const QNetworkRequest &req, - QNetworkAccessManager::Operation op) -: QNetworkReply(parent) -{ - setRequest(req); - setUrl(req.url()); - setOperation(op); - - qRegisterMetaType("QNetworkReply::NetworkError"); - - QString msg = QCoreApplication::translate("QNetworkAccessManager", - "Network access is disabled."); - setError(UnknownNetworkError, msg); - - QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, UnknownNetworkError)); - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); -} - -QDisabledNetworkReply::~QDisabledNetworkReply() -{ -} - -#include "qnetworkaccessmanager.moc" - /*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and @@ -829,8 +788,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } - if (!d->networkAccessEnabled) + // Return a disabled network reply if network access is disabled. + // Except if the scheme is empty or file://. + if (!d->networkAccessEnabled && !(req.url().scheme() == QLatin1String("file") || + req.url().scheme().isEmpty())) { return new QDisabledNetworkReply(this, req, op); + } QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 9721e32..3cf21f0 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -856,6 +856,30 @@ bool QNetworkReplyImplPrivate::migrateBackend() return true; } +QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, + const QNetworkRequest &req, + QNetworkAccessManager::Operation op) +: QNetworkReply(parent) +{ + setRequest(req); + setUrl(req.url()); + setOperation(op); + + qRegisterMetaType("QNetworkReply::NetworkError"); + + QString msg = QCoreApplication::translate("QNetworkAccessManager", + "Network access is disabled."); + setError(UnknownNetworkError, msg); + + QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection, + Q_ARG(QNetworkReply::NetworkError, UnknownNetworkError)); + QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); +} + +QDisabledNetworkReply::~QDisabledNetworkReply() +{ +} + QT_END_NAMESPACE #include "moc_qnetworkreplyimpl_p.cpp" diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 89b976f..639361e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -193,6 +193,20 @@ public: Q_DECLARE_PUBLIC(QNetworkReplyImpl) }; +class QDisabledNetworkReply : public QNetworkReply +{ + Q_OBJECT + +public: + QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, + const QNetworkAccessManager::Operation op); + ~QDisabledNetworkReply(); + + void abort() { } +protected: + qint64 readData(char *, qint64) { return -1; } +}; + QT_END_NAMESPACE #endif -- cgit v0.12 From d7cf6d018f39607ff7315b7851665e72fc488e62 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 09:23:55 +1000 Subject: Connect signals between QNAM and QNetworkReplyImpl. Instead of iterating over children, when network session state changes. --- src/network/access/qnetworkaccessmanager.cpp | 36 ++++------------------------ src/network/access/qnetworkaccessmanager.h | 2 ++ src/network/access/qnetworkreplyimpl.cpp | 20 ++++++++++++++++ src/network/access/qnetworkreplyimpl_p.h | 2 ++ 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 07a8b1d..e57702b 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -811,6 +811,8 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // first step: create the reply QUrl url = request.url(); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); + if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) + connect(this, SIGNAL(networkSessionOnline()), reply, SLOT(_q_networkSessionOnline())); QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; @@ -1131,12 +1133,7 @@ void QNetworkAccessManagerPrivate::_q_sessionOpened() { Q_Q(QNetworkAccessManager); - // start waiting children - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *reply = qobject_cast(child); - if (reply && reply->d_func()->state == QNetworkReplyImplPrivate::WaitingForSession) - QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); - } + emit q->networkSessionOnline(); } void QNetworkAccessManagerPrivate::_q_sessionClosed() @@ -1183,37 +1180,14 @@ void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() qDebug() << "Accepting new configuration."; session->accept(); - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *reply = qobject_cast(child); - if (!reply) - continue; - - switch (reply->d_func()->state) { - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: - case QNetworkReplyImplPrivate::Reconnecting: - // Migrate existing downloads to new configuration. - reply->d_func()->migrateBackend(); - break; - case QNetworkReplyImplPrivate::WaitingForSession: - // Start waiting requests. - QMetaObject::invokeMethod(reply, "_q_startOperation", Qt::QueuedConnection); - break; - default: - qDebug() << "How do we handle replies in state" << reply->d_func()->state; - } - } + emit q->networkSessionOnline(); } void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { Q_Q(QNetworkAccessManager); - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *replyImpl = qobject_cast(child); - if (replyImpl) - replyImpl->migrateBackend(); - } + emit q->networkSessionOnline(); session->migrate(); } diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 371f729..f934b22 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -124,6 +124,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList &errors); #endif + void networkSessionOnline(); + void networkAccessChanged(bool enabled); void debugMessage(const QString &message); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 3cf21f0..a7948c2 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -226,6 +226,26 @@ void QNetworkReplyImplPrivate::_q_bufferOutgoingData() } } +void QNetworkReplyImplPrivate::_q_networkSessionOnline() +{ + Q_Q(QNetworkReplyImpl); + + switch (state) { + case QNetworkReplyImplPrivate::Buffering: + case QNetworkReplyImplPrivate::Working: + case QNetworkReplyImplPrivate::Reconnecting: + // Migrate existing downloads to new network connection. + migrateBackend(); + break; + case QNetworkReplyImplPrivate::WaitingForSession: + // Start waiting requests. + QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); + break; + default: + qDebug() << "How do we handle replies in state" << state; + } +} + void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *data) { diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 639361e..9941fa7 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -100,6 +100,7 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionOnline()) }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -132,6 +133,7 @@ public: void _q_copyReadChannelFinished(); void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); + void _q_networkSessionOnline(); void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); -- cgit v0.12 From 024b86bce25511aeb4b0f935e36ec43c52c802ca Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 09:51:30 +1000 Subject: Remove functions used for testing. --- src/network/access/qnetworkreply.h | 2 -- src/network/access/qnetworkreplyimpl.cpp | 7 ------- src/network/access/qnetworkreplyimpl_p.h | 2 -- 3 files changed, 11 deletions(-) diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 0f1fe8a..b39557a 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -138,8 +138,6 @@ public: void ignoreSslErrors(const QList &errors); #endif - virtual void migrateBackend() { qWarning("Your backend doesn't support migration!"); } // Testing - public Q_SLOTS: virtual void ignoreSslErrors(); diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index a7948c2..b9206be 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -805,13 +805,6 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } -void QNetworkReplyImpl::migrateBackend() -{ - Q_D(QNetworkReplyImpl); - - d->migrateBackend(); -} - bool QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 9941fa7..7f1ee80 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -92,8 +92,6 @@ public: Q_INVOKABLE virtual void ignoreSslErrorsImplementation(const QList &errors); #endif - void migrateBackend(); - Q_DECLARE_PRIVATE(QNetworkReplyImpl) Q_PRIVATE_SLOT(d_func(), void _q_startOperation()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadyRead()) -- cgit v0.12 From 70fc1c298b957b54d498b518ddf786694d3001cc Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 09:54:14 +1000 Subject: Clarify TemporaryNetworkFailureError docs. --- src/network/access/qnetworkreply.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index e299b5b..dd5cace 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -127,7 +127,8 @@ QNetworkReplyPrivate::QNetworkReplyPrivate() \value TemporaryNetworkFailureError the connection was broken due to disconnection from the network, however the system has initiated - roaming to another access point. The request should be resubmitted. + roaming to another access point. The request should be resubmitted + and will be processed as soon as the connection is re-established. \value ProxyConnectionRefusedError the connection to the proxy server was refused (the proxy server is not accepting requests) -- cgit v0.12 From 47b96ccf100da33910cbc534035c00aa4b2b533d Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 10:15:03 +1000 Subject: Don't try to migrate finished or aborted requests. --- src/network/access/qnetworkreplyimpl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index b9206be..f4e8264 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -573,7 +573,11 @@ void QNetworkReplyImplPrivate::finished() qDebug() << "Download hasn't finished"; if (migrateBackend()) { - return; + // either we are migrating or the request is finished/aborted + if (state == Reconnecting) { + resumeNotificationHandling(); + return; // exit early if we are migrating. + } } else { qDebug() << "Could not migrate backend, application needs to send another requeset."; error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); @@ -812,7 +816,7 @@ bool QNetworkReplyImplPrivate::migrateBackend() if (state == QNetworkReplyImplPrivate::Finished || state == QNetworkReplyImplPrivate::Aborted) { qDebug() << "Network reply is already finished/aborted."; - return false; + return true; } if (!qobject_cast(backend)) { -- cgit v0.12 From 20cffd52ab81d01ca0a45058dfa894df9ce26c5a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 10:27:32 +1000 Subject: Move check for range header support to before deleting backend. --- src/network/access/qnetworkreplyimpl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index f4e8264..70bf238 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -829,6 +829,12 @@ bool QNetworkReplyImplPrivate::migrateBackend() return false; } + RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); + if (it == rawHeaders.constEnd() || it->second == "none") { + qDebug() << "Range header not supported by server/resource."; + return false; + } + qDebug() << "Need to check for only cacheable content."; // stop both upload and download @@ -844,12 +850,6 @@ bool QNetworkReplyImplPrivate::migrateBackend() backend = 0; } - RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); - if (it == rawHeaders.constEnd() || it->second == "none") { - qDebug() << "Range header not supported by server/resource."; - return false; - } - cookedHeaders.clear(); rawHeaders.clear(); -- cgit v0.12 From 84ef315a9ff6014056d7b6313cf9b1f8bdf06cdc Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 11 Feb 2010 10:29:13 +1000 Subject: Revert "(ODBC) Use wchar_t instead of assuming 2 bytes." This reverts commit 4935ec52fc07d4aaa7ae594cfe9986e25ca62dcb. --- src/sql/drivers/odbc/qsql_odbc.cpp | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 4d3663e..2049a76 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -144,7 +144,6 @@ public: QSqlRecord rInf; QVector fieldCache; - QVector paramCache; int fieldCacheIdx; int disconnectCount; bool hasSQLFetchScroll; @@ -203,7 +202,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode *nativeCode = nativeCode_; QString tmpstore; #ifdef UNICODE - tmpstore = QString::fromWCharArray((const wchar_t*)description_, msgLen); + tmpstore = QString((const QChar*)description_.data(), msgLen); #else tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen); #endif @@ -333,7 +332,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni } else { colSize++; // make sure there is room for more than the 0 termination if (unicode) { - colSize *= sizeof(wchar_t); // a tiny bit faster, since it saves a SQLGetData() call + colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call } } QVarLengthArray buf(colSize); @@ -354,9 +353,9 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // contain the number of bytes returned - it contains the // total number of bytes that CAN be fetched // colSize-1: remove 0 termination when there is more data to fetch - int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-sizeof(wchar_t) : colSize-1) : lengthIndicator; + int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator; if (unicode) { - fieldVal += QString::fromWCharArray((wchar_t*)buf.constData(), rSize / sizeof(wchar_t)); + fieldVal += QString((const QChar*) buf.constData(), rSize / 2); } else { fieldVal += QString::fromAscii(buf.constData(), rSize); } @@ -552,7 +551,7 @@ static QSqlField qMakeFieldInfo(const QODBCPrivate* p, int i ) } #ifdef UNICODE - QString qColName = QString::fromWCharArray((const wchar_t*)colName, colNameLen); + QString qColName((const QChar*)colName, colNameLen); #else QString qColName = QString::fromLocal8Bit((const char*)colName); #endif @@ -1271,12 +1270,9 @@ bool QODBCResult::exec() // bind parameters - only positional binding allowed QVector& values = boundValues(); - QVector wcharstorage; - int i; SQLRETURN r; for (i = 0; i < values.count(); ++i) { - wcharstorage.append(NULL); if (bindValueType(i) & QSql::Out) values[i].detach(); const QVariant &val = values.at(i); @@ -1439,14 +1435,13 @@ bool QODBCResult::exec() #ifndef Q_ODBC_VERSION_2 if (d->unicode) { QString str = val.toString(); - int strSize = str.length() * sizeof(wchar_t); + str.utf16(); if (*ind != SQL_NULL_DATA) - *ind = strSize; + *ind = str.length() * sizeof(QChar); + int strSize = str.length() * sizeof(QChar); if (bindValueType(i) & QSql::Out) { - wchar_t *temp=new wchar_t[str.capacity()*sizeof(wchar_t)]; - str.toWCharArray(temp); - QByteArray ba((char*)temp, str.capacity() * sizeof(wchar_t)); + QByteArray ba((char*)str.constData(), str.capacity() * sizeof(QChar)); r = SQLBindParameter(d->hStmt, i + 1, qParamType[(QFlag)(bindValueType(i)) & QSql::InOut], @@ -1458,13 +1453,9 @@ bool QODBCResult::exec() ba.size(), ind); tmpStorage.append(ba); - wcharstorage.replace(i,temp); break; } - wchar_t *temp=new wchar_t[(1+str.length())*sizeof(wchar_t)]; - str.toWCharArray(temp); - temp[str.length()]=0; r = SQLBindParameter(d->hStmt, i + 1, qParamType[(QFlag)(bindValueType(i)) & QSql::InOut], @@ -1472,10 +1463,9 @@ bool QODBCResult::exec() strSize > 254 ? SQL_WLONGVARCHAR : SQL_WVARCHAR, strSize, 0, - (void *)temp, + (void *)str.constData(), strSize, ind); - wcharstorage.replace(i,temp); break; } else @@ -1525,13 +1515,6 @@ bool QODBCResult::exec() } } r = SQLExecute(d->hStmt); - - for(int i=0;i Date: Thu, 11 Feb 2010 10:32:29 +1000 Subject: Add comments to private state enums. --- src/network/access/qnetworkreplyimpl_p.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 7f1ee80..ec413cc 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -111,13 +111,13 @@ public: }; enum State { - Idle, - Buffering, - Working, - Finished, - Aborted, - WaitingForSession, - Reconnecting + Idle, // The reply is idle. + Buffering, // The reply is buffering outgoing data. + Working, // The reply is uploading/downloading data. + Finished, // The reply has finished. + Aborted, // The reply has been aborted. + WaitingForSession, // The reply is waiting for the session to open before connecting. + Reconnecting // The reply will reconnect to once roaming has completed. }; typedef QQueue NotificationQueue; -- cgit v0.12 From 02df547ddf8aabb680511135f98a5188438de6d4 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 11:02:47 +1000 Subject: Rename and remove unused private slots. --- src/network/access/qnetworkaccessbackend.cpp | 5 +- src/network/access/qnetworkaccessmanager.cpp | 86 ++++++---------------------- src/network/access/qnetworkaccessmanager.h | 8 +-- src/network/access/qnetworkaccessmanager_p.h | 13 ++--- src/network/access/qnetworkreplyimpl.cpp | 4 +- 5 files changed, 31 insertions(+), 85 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 0bfeb3b..1d23cdc 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -349,7 +349,7 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { - if (!manager->session) { + if (!manager->networkSession) { open(); return true; } @@ -364,7 +364,8 @@ bool QNetworkAccessBackend::start() return true; } - if (manager->session->isOpen() && manager->session->state() == QNetworkSession::Connected) { + if (manager->networkSession->isOpen() && + manager->networkSession->state() == QNetworkSession::Connected) { open(); return true; } diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e57702b..3324e09 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -715,8 +715,8 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const { Q_D(const QNetworkAccessManager); - if (d->session) - return d->session->configuration(); + if (d->networkSession) + return d->networkSession->configuration(); else return QNetworkConfiguration(); } @@ -732,11 +732,11 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const { Q_D(const QNetworkAccessManager); - if (d->session) { + if (d->networkSession) { QNetworkConfigurationManager manager; return manager.configurationFromIdentifier( - d->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + d->networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); } else { return QNetworkConfiguration(); } @@ -1107,89 +1107,41 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co { Q_Q(QNetworkAccessManager); - if (session) - delete session; + if (networkSession) + delete networkSession; if (!config.isValid()) { - session = 0; + networkSession = 0; return; } - session = new QNetworkSession(config, q); - - QObject::connect(session, SIGNAL(opened()), q, SLOT(_q_sessionOpened())); - QObject::connect(session, SIGNAL(closed()), q, SLOT(_q_sessionClosed())); - QObject::connect(session, SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_sessionStateChanged(QNetworkSession::State))); - QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), - q, SLOT(_q_sessionError(QNetworkSession::SessionError))); - QObject::connect(session, SIGNAL(newConfigurationActivated()), - q, SLOT(_q_sessionNewConfigurationActivated())); - QObject::connect(session, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), - q, SLOT(_q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); -} - -void QNetworkAccessManagerPrivate::_q_sessionOpened() -{ - Q_Q(QNetworkAccessManager); - - emit q->networkSessionOnline(); -} - -void QNetworkAccessManagerPrivate::_q_sessionClosed() -{ - Q_Q(QNetworkAccessManager); - - emit q->debugMessage(QLatin1String("Session Closed")); -} + networkSession = new QNetworkSession(config, q); -void QNetworkAccessManagerPrivate::_q_sessionError(QNetworkSession::SessionError error) -{ - Q_Q(QNetworkAccessManager); - - emit q->debugMessage(QString::fromLatin1("Session error %1").arg(error)); -} - -void QNetworkAccessManagerPrivate::_q_sessionStateChanged(QNetworkSession::State state) -{ - qDebug() << "session state changed to" << state; + QObject::connect(networkSession, SIGNAL(opened()), q, SIGNAL(networkSessionOnline())); + QObject::connect(networkSession, SIGNAL(newConfigurationActivated()), + q, SLOT(_q_networkSessionNewConfigurationActivated())); + QObject::connect(networkSession, + SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool)), + q, + SLOT(_q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool))); } -void QNetworkAccessManagerPrivate::_q_sessionNewConfigurationActivated() +void QNetworkAccessManagerPrivate::_q_networkSessionNewConfigurationActivated() { Q_Q(QNetworkAccessManager); -#if 0 - foreach (QObject *child, q->children()) { - QNetworkReplyImpl *reply = qobject_cast(child); - if (reply) { - switch (reply->d_func()->state) { - case QNetworkReplyImplPrivate::Buffering: - case QNetworkReplyImplPrivate::Working: - emit q->debugMessage(QString::fromLatin1("Unexpected reply for %1") - .arg(reply->url().toString())); - break; - default: - qDebug() << "Testing new interface for" << reply->url(); - ; - } - } - } -#endif - - qDebug() << "Accepting new configuration."; - session->accept(); + networkSession->accept(); emit q->networkSessionOnline(); } -void QNetworkAccessManagerPrivate::_q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) +void QNetworkAccessManagerPrivate::_q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &, bool) { Q_Q(QNetworkAccessManager); emit q->networkSessionOnline(); - session->migrate(); + networkSession->migrate(); } QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index f934b22..a0aa2d8 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -139,12 +139,8 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList)) - Q_PRIVATE_SLOT(d_func(), void _q_sessionOpened()) - Q_PRIVATE_SLOT(d_func(), void _q_sessionClosed()) - Q_PRIVATE_SLOT(d_func(), void _q_sessionError(QNetworkSession::SessionError)) - Q_PRIVATE_SLOT(d_func(), void _q_sessionStateChanged(QNetworkSession::State)) - Q_PRIVATE_SLOT(d_func(), void _q_sessionNewConfigurationActivated()) - Q_PRIVATE_SLOT(d_func(), void _q_sessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) + Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index eae08e8..0ac49db 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -76,7 +76,7 @@ public: proxyFactory(0), #endif cookieJarCreated(false), - session(0), + networkSession(0), networkAccessEnabled(true) { } ~QNetworkAccessManagerPrivate(); @@ -110,12 +110,9 @@ public: void createSession(const QNetworkConfiguration &config); - void _q_sessionOpened(); - void _q_sessionClosed(); - void _q_sessionError(QNetworkSession::SessionError error); - void _q_sessionStateChanged(QNetworkSession::State state); - void _q_sessionNewConfigurationActivated(); - void _q_sessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + void _q_networkSessionNewConfigurationActivated(); + void _q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &config, + bool isSeamless); // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -130,7 +127,7 @@ public: bool cookieJarCreated; - QNetworkSession *session; + QNetworkSession *networkSession; bool networkAccessEnabled; // this cache can be used by individual backends to cache e.g. their TCP connections to a server diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 70bf238..afa7307 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -89,7 +89,7 @@ void QNetworkReplyImplPrivate::_q_startOperation() // state changes. state = WaitingForSession; - QNetworkSession *session = manager->d_func()->session; + QNetworkSession *session = manager->d_func()->networkSession; if (session) { if (!session->isOpen()) @@ -559,7 +559,7 @@ void QNetworkReplyImplPrivate::finished() QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); if (preMigrationDownloaded != Q_INT64_C(-1)) totalSize = totalSize.toLongLong() + preMigrationDownloaded; - QNetworkSession *session = manager->d_func()->session; + QNetworkSession *session = manager->d_func()->networkSession; if (session && session->state() == QNetworkSession::Roaming && state == Working && errorCode != QNetworkReply::OperationCanceledError) { // only content with a known size will fail with a temporary network failure error -- cgit v0.12 From 12b70a4c52f57255da9586a0f92324557d400c8e Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 11:12:15 +1000 Subject: Remove debug. --- src/network/access/qnetworkaccessmanager.h | 2 -- src/network/access/qnetworkaccessmanager_p.h | 6 ------ 2 files changed, 8 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index a0aa2d8..6fdb678 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -128,8 +128,6 @@ Q_SIGNALS: void networkAccessChanged(bool enabled); - void debugMessage(const QString &message); - protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 0ac49db..568894c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -102,12 +102,6 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); - void sendDebugMessage(const QString &message) - { - Q_Q(QNetworkAccessManager); - emit q->debugMessage(message); - } - void createSession(const QNetworkConfiguration &config); void _q_networkSessionNewConfigurationActivated(); -- cgit v0.12 From c2b9767dfc0fb2f26ff52bdded36c76c0a23f938 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 12:42:42 +1000 Subject: Fix after reworking to use signals/slots. --- src/network/access/qnetworkaccessmanager.cpp | 2 -- src/network/access/qnetworkreplyimpl.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 3324e09..9c1e268 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1139,8 +1139,6 @@ void QNetworkAccessManagerPrivate::_q_networkSessionPreferredConfigurationChange { Q_Q(QNetworkAccessManager); - emit q->networkSessionOnline(); - networkSession->migrate(); } diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index afa7307..81d4d0d 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -574,7 +574,7 @@ void QNetworkReplyImplPrivate::finished() if (migrateBackend()) { // either we are migrating or the request is finished/aborted - if (state == Reconnecting) { + if (state == Reconnecting || state == WaitingForSession) { resumeNotificationHandling(); return; // exit early if we are migrating. } -- cgit v0.12 From f16733d41b8377a703c594b069cc592466e03a11 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 13:38:15 +1000 Subject: We don't need to migrate cached replies. --- src/network/access/qnetworkreplyimpl.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 81d4d0d..7f12fb8 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -829,6 +829,11 @@ bool QNetworkReplyImplPrivate::migrateBackend() return false; } + if (copyDevice) { + qDebug() << "Request is serviced from cache, not migrating."; + return true; + } + RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); if (it == rawHeaders.constEnd() || it->second == "none") { qDebug() << "Range header not supported by server/resource."; @@ -837,12 +842,6 @@ bool QNetworkReplyImplPrivate::migrateBackend() qDebug() << "Need to check for only cacheable content."; - // stop both upload and download - if (outgoingData) - outgoingData->disconnect(q); - if (copyDevice) - copyDevice->disconnect(q); - state = QNetworkReplyImplPrivate::Reconnecting; if (backend) { -- cgit v0.12 From 0f99aa42829c1d1b29dfbd8945cc96b0d21b3939 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 13:49:52 +1000 Subject: Update copyright year to 2010. --- src/network/bearer/qbearerengine.cpp | 2 +- src/network/bearer/qbearerplugin.cpp | 2 +- src/network/bearer/qnetworkconfigmanager.h | 2 +- src/network/bearer/qnetworkconfiguration.h | 2 +- src/network/bearer/qnetworksession.h | 2 +- src/plugins/bearer/corewlan/main.cpp | 2 +- src/plugins/bearer/generic/main.cpp | 2 +- src/plugins/bearer/icd/qnetworksession_impl.h | 4 ++-- src/plugins/bearer/nativewifi/main.cpp | 2 +- src/plugins/bearer/nativewifi/platformdefs.h | 2 +- src/plugins/bearer/networkmanager/main.cpp | 2 +- src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp | 2 +- src/plugins/bearer/networkmanager/qnetworkmanagerservice.h | 2 +- src/plugins/bearer/networkmanager/qnmdbushelper.cpp | 2 +- src/plugins/bearer/networkmanager/qnmdbushelper.h | 2 +- src/plugins/bearer/nla/main.cpp | 2 +- src/plugins/bearer/platformdefs_win.h | 2 +- src/plugins/bearer/symbian/main.cpp | 2 +- src/plugins/bearer/symbian/qnetworksession_impl.cpp | 2 +- src/plugins/bearer/symbian/qnetworksession_impl.h | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index 4d56047..bd2ca6c 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 7b81b13..2ee90d4 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index b7ab72b..83c4939 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dede2b1..8d45cf6 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 6138166..06d5eb7 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index ce0611e..010976a 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index a7df023..8ba9f40 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h index 22e41b3..b7461dc 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.h +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtNetwork module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 64ed73d..6bb2a2b 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/nativewifi/platformdefs.h b/src/plugins/bearer/nativewifi/platformdefs.h index 38fbae4..57ae852 100644 --- a/src/plugins/bearer/nativewifi/platformdefs.h +++ b/src/plugins/bearer/nativewifi/platformdefs.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index b561415..6725252 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 3843f27..9d603b5 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index dbed01e..81903ec 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp index f93a63d..d5e20f3 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.h b/src/plugins/bearer/networkmanager/qnmdbushelper.h index 410b69f..862290c 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.h +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp index 541d2c5..54269a4 100644 --- a/src/plugins/bearer/nla/main.cpp +++ b/src/plugins/bearer/nla/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index f2f44a1..37d099c 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 22d654a..37eddee 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 619fd9f..7762fb5 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index 2e75d96..30f51e1 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -- cgit v0.12 From 0f90f7bdef4b8f821b00e039038fb83a01bc217b Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:07:05 +1000 Subject: Remove debug. --- src/network/access/qnetworkreplyimpl.cpp | 49 ++++++++-------------- .../bearer/nativewifi/qnativewifiengine.cpp | 2 +- .../networkmanager/qnetworkmanagerengine.cpp | 10 +---- .../networkmanager/qnetworkmanagerservice.cpp | 1 - src/plugins/bearer/nla/qnlaengine.cpp | 4 +- src/plugins/bearer/qnetworksession_impl.cpp | 2 - src/plugins/bearer/symbian/symbianengine.cpp | 1 - 7 files changed, 21 insertions(+), 48 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 7f12fb8..7f66b25 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -242,7 +242,7 @@ void QNetworkReplyImplPrivate::_q_networkSessionOnline() QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); break; default: - qDebug() << "How do we handle replies in state" << state; + ; } } @@ -503,8 +503,6 @@ void QNetworkReplyImplPrivate::appendDownstreamData(QByteDataBuffer &data) int index = it->second.lastIndexOf('/'); if (index != -1) totalSize = it->second.mid(index + 1).toLongLong() - preMigrationDownloaded; - } else { - qDebug() << "Could not find Content-Length or Content-Range header"; } } @@ -564,14 +562,7 @@ void QNetworkReplyImplPrivate::finished() state == Working && errorCode != QNetworkReply::OperationCanceledError) { // only content with a known size will fail with a temporary network failure error if (!totalSize.isNull()) { - qDebug() << "Connection broke during download."; - qDebug() << "Don't worry, we've already started roaming :)"; - - if (bytesDownloaded == totalSize) { - qDebug() << "Luckily download has already finished."; - } else { - qDebug() << "Download hasn't finished"; - + if (bytesDownloaded != totalSize) { if (migrateBackend()) { // either we are migrating or the request is finished/aborted if (state == Reconnecting || state == WaitingForSession) { @@ -579,8 +570,8 @@ void QNetworkReplyImplPrivate::finished() return; // exit early if we are migrating. } } else { - qDebug() << "Could not migrate backend, application needs to send another requeset."; - error(QNetworkReply::TemporaryNetworkFailureError, q->tr("Temporary network failure.")); + error(QNetworkReply::TemporaryNetworkFailureError, + q->tr("Temporary network failure.")); } } } @@ -809,38 +800,34 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } +/* + Migrates the backend of the QNetworkReply to a new network connection if required. Returns + true if the reply is migrated or it is not required; otherwise returns false. +*/ bool QNetworkReplyImplPrivate::migrateBackend() { Q_Q(QNetworkReplyImpl); - if (state == QNetworkReplyImplPrivate::Finished || - state == QNetworkReplyImplPrivate::Aborted) { - qDebug() << "Network reply is already finished/aborted."; + // Network reply is already finished or aborted, don't need to migrate. + if (state == Finished || state == Aborted) return true; - } - if (!qobject_cast(backend)) { - qDebug() << "Resume only support by http backend, not migrating."; + // Resume only supported by http backend, not migrating. + if (!qobject_cast(backend)) return false; - } - if (outgoingData) { - qDebug() << "Request has outgoing data, not migrating."; + // Request has outgoing data, not migrating. + if (outgoingData) return false; - } - if (copyDevice) { - qDebug() << "Request is serviced from cache, not migrating."; + // Request is serviced from the cache, don't need to migrate. + if (copyDevice) return true; - } + // Range header is not supported by server/resource, can't migrate. RawHeadersList::ConstIterator it = findRawHeader("Accept-Ranges"); - if (it == rawHeaders.constEnd() || it->second == "none") { - qDebug() << "Range header not supported by server/resource."; + if (it == rawHeaders.constEnd() || it->second == "none") return false; - } - - qDebug() << "Need to check for only cacheable content."; state = QNetworkReplyImplPrivate::Reconnecting; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index d88534b..e4ab0aa 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -72,7 +72,7 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d) QMetaObject::invokeMethod(d, "scanComplete", Qt::QueuedConnection); break; default: - qDebug() << "wlan unknown notification"; + ; } } diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 51afe3e..3f3e1bd 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -134,9 +134,6 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) if (devices.isEmpty()) continue; - if (devices.count() > 1) - qDebug() << "multiple network interfaces for" << id; - QNetworkManagerInterfaceDevice device(devices.at(0).path()); return device.interface().name(); } @@ -328,8 +325,6 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, const QMap &properties) { - qDebug() << Q_FUNC_INFO << path; - qDebug() << properties; } void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) @@ -428,7 +423,6 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) const QString service = connection->connectionInterface()->service(); const QString settingsPath = connection->connectionInterface()->path(); - qDebug() << "Should parse connection directly into existing configuration"; QNetworkConfigurationPrivate *cpPriv = parseConnection(service, settingsPath, settings); // Check if connection is active. @@ -457,9 +451,7 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings) void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher) { QDBusPendingReply reply = *watcher; - if (reply.isError()) { - qDebug() << "error connecting NM connection"; - } else { + if (!reply.isError()) { QDBusObjectPath result = reply.value(); QNetworkManagerConnectionActive activeConnection(result.path()); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 9d603b5..f7fedbf 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -723,7 +723,6 @@ bool QNetworkManagerSettingsConnection::setConnections() allOk = true; } else { QDBusError error = dbusConnection.lastError(); - qDebug() << error.name() << error.message() << error.type(); } if (nmDBusHelper) diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index fbfac17..2001c0b 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -480,10 +480,8 @@ void QNlaThread::fetchConfigurations() if (error == WSA_E_NO_MORE) break; - if (error == WSAEFAULT) { - qDebug() << "buffer not big enough" << bufferLength; + if (error == WSAEFAULT) break; - } qWarning("WSALookupServiceNext error %d", WSAGetLastError()); break; diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index de1c91a..3fe844a 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -316,7 +316,6 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() } state = QNetworkSession::Connected; - qDebug() << oldState << "->" << state; if (state != oldState) emit stateChanged(state); @@ -328,7 +327,6 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() else state = QNetworkSession::Disconnected; - qDebug() << oldState << "->" << state; if (state != oldState) emit stateChanged(state); } diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 2d0b5ee..e25eda4 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -663,7 +663,6 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn startCommsDatabaseNotifications(); - qDebug() << Q_FUNC_INFO << "updateCompleted()"; emit updateCompleted(); } -- cgit v0.12 From b8f21f8cd5b1dd900313675e0c8ffe976a5beded Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:26:37 +1000 Subject: Fix documentation. --- src/network/access/qnetworkaccessmanager.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 9c1e268..7dc9203 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -163,7 +163,9 @@ static void ensureInitialized() /*! \property QNetworkAccessManager::networkAccess - \brief wheather network access is enabled or disabled through this network access manager. + \brief states whether network access is enabled or disabled through this network access + manager. + \since 4.7 Network access is enabled by default. @@ -742,6 +744,12 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const } } +/*! + \since 4.7 + + Enables network access via this QNetworkAccessManager if \a enabled is true; otherwise disables + access. +*/ void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) { Q_D(QNetworkAccessManager); @@ -752,6 +760,12 @@ void QNetworkAccessManager::setNetworkAccessEnabled(bool enabled) } } +/*! + \since 4.7 + + Returns true if network access via this QNetworkAccessManager is enabled; otherwise returns + false. +*/ bool QNetworkAccessManager::networkAccessEnabled() const { Q_D(const QNetworkAccessManager); -- cgit v0.12 From b8c971b3841858f70c6355a704617a869db8a694 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:35:54 +1000 Subject: Tag new classes as since 4.7. --- src/network/bearer/qnetworkconfigmanager.cpp | 2 ++ src/network/bearer/qnetworkconfiguration.cpp | 2 ++ src/network/bearer/qnetworksession.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index d46048b..8673f52 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -61,6 +61,8 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() \brief The QNetworkConfigurationManager class manages the network configurations provided by the system. + \since 4.7 + \inmodule QtNetwork \ingroup bearer diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index cf10677..9246645 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE \brief The QNetworkConfiguration class provides an abstraction of one or more access point configurations. + \since 4.7 + \inmodule QtNetwork \ingroup bearer diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index f9bb9ea..3e77354 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE \brief The QNetworkSession class provides control over the system's access points and enables session management for cases when multiple clients access the same access point. + \since 4.7 + \inmodule QtNetwork \ingroup bearer -- cgit v0.12 From 3591386484957cc4c93aece442f673246700b3b2 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 14:54:21 +1000 Subject: Document networkSessionOnline() signal and mark as internal. --- src/network/access/qnetworkaccessmanager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 7dc9203..9a351dc 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -187,6 +187,18 @@ static void ensureInitialized() */ /*! + \fn void QNetworkAccessManager::networkSessionOnline() + + \since 4.7 + + \internal + + This signal is emitted when the status of the network session changes into a usable state. + It is used to signal QNetworkReply's to start or migrate their network operation once the + network session has been opened / roamed. +*/ + +/*! \fn void QNetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) This signal is emitted whenever a proxy requests authentication -- cgit v0.12 From b5fe99c0105a9791e34a8b959822430497a4aeb9 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 15:06:45 +1000 Subject: Fix public includes. --- src/network/bearer/bearer.pri | 2 +- src/network/bearer/qbearerplugin.cpp | 2 +- src/network/bearer/qbearerplugin.h | 82 -------------------------- src/network/bearer/qbearerplugin_p.h | 82 ++++++++++++++++++++++++++ src/network/bearer/qnetworkconfigmanager.h | 2 +- src/network/bearer/qnetworkconfigmanager_p.cpp | 2 +- src/network/bearer/qnetworksession.h | 3 +- src/plugins/bearer/corewlan/main.cpp | 2 +- src/plugins/bearer/generic/main.cpp | 2 +- src/plugins/bearer/icd/main.cpp | 2 +- src/plugins/bearer/nativewifi/main.cpp | 2 +- src/plugins/bearer/networkmanager/main.cpp | 2 +- src/plugins/bearer/nla/main.cpp | 2 +- src/plugins/bearer/symbian/main.cpp | 2 +- 14 files changed, 94 insertions(+), 95 deletions(-) delete mode 100644 src/network/bearer/qbearerplugin.h create mode 100644 src/network/bearer/qbearerplugin_p.h diff --git a/src/network/bearer/bearer.pri b/src/network/bearer/bearer.pri index c03c615..44e97fd 100644 --- a/src/network/bearer/bearer.pri +++ b/src/network/bearer/bearer.pri @@ -7,7 +7,7 @@ HEADERS += bearer/qnetworkconfiguration.h \ bearer/qnetworkconfiguration_p.h \ bearer/qnetworksession_p.h \ bearer/qbearerengine_p.h \ - bearer/qbearerplugin.h + bearer/qbearerplugin_p.h SOURCES += bearer/qnetworksession.cpp \ bearer/qnetworkconfigmanager.cpp \ diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 2ee90d4..4509fd0 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qbearerplugin.h" +#include "qbearerplugin_p.h" #include diff --git a/src/network/bearer/qbearerplugin.h b/src/network/bearer/qbearerplugin.h deleted file mode 100644 index 1958188..0000000 --- a/src/network/bearer/qbearerplugin.h +++ /dev/null @@ -1,82 +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 QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QBEARERPLUGIN_H -#define QBEARERPLUGIN_H - -#include "qbearerengine_p.h" - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) - -struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface -{ - virtual QBearerEngine *create(const QString &key = QString()) const = 0; -}; - -#define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface" -Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid) - -class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface -{ - Q_OBJECT - Q_INTERFACES(QBearerEngineFactoryInterface:QFactoryInterface) - -public: - explicit QBearerEnginePlugin(QObject *parent = 0); - virtual ~QBearerEnginePlugin(); - - virtual QStringList keys() const = 0; - virtual QBearerEngine *create(const QString &key = QString()) const = 0; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif - diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h new file mode 100644 index 0000000..1958188 --- /dev/null +++ b/src/network/bearer/qbearerplugin_p.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBEARERPLUGIN_H +#define QBEARERPLUGIN_H + +#include "qbearerengine_p.h" + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Network) + +struct Q_NETWORK_EXPORT QBearerEngineFactoryInterface : public QFactoryInterface +{ + virtual QBearerEngine *create(const QString &key = QString()) const = 0; +}; + +#define QBearerEngineFactoryInterface_iid "com.trolltech.Qt.QBearerEngineFactoryInterface" +Q_DECLARE_INTERFACE(QBearerEngineFactoryInterface, QBearerEngineFactoryInterface_iid) + +class Q_NETWORK_EXPORT QBearerEnginePlugin : public QObject, public QBearerEngineFactoryInterface +{ + Q_OBJECT + Q_INTERFACES(QBearerEngineFactoryInterface:QFactoryInterface) + +public: + explicit QBearerEnginePlugin(QObject *parent = 0); + virtual ~QBearerEnginePlugin(); + + virtual QStringList keys() const = 0; + virtual QBearerEngine *create(const QString &key = QString()) const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif + diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 83c4939..a34e456 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -43,7 +43,7 @@ #define QNETWORKCONFIGURATIONMANAGER_H #include -#include "qnetworkconfiguration.h" +#include QT_BEGIN_HEADER diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index a624376..66d5982 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qnetworkconfigmanager_p.h" -#include "qbearerplugin.h" +#include "qbearerplugin_p.h" #include diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 06d5eb7..3c8d913 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -47,8 +47,7 @@ #include #include #include -#include "qnetworkconfiguration.h" - +#include QT_BEGIN_HEADER diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index 010976a..5be8c0e 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -41,7 +41,7 @@ #include "qcorewlanengine.h" -#include +#include #include diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index 8ba9f40..ba85d93 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -41,7 +41,7 @@ #include "qgenericengine.h" -#include +#include #include diff --git a/src/plugins/bearer/icd/main.cpp b/src/plugins/bearer/icd/main.cpp index 8984d2c..b131ccb 100644 --- a/src/plugins/bearer/icd/main.cpp +++ b/src/plugins/bearer/icd/main.cpp @@ -41,7 +41,7 @@ #include "qicdengine.h" -#include +#include #include diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index 6bb2a2b..d77462e 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index 6725252..f62b847 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -41,7 +41,7 @@ #include "qnetworkmanagerengine.h" -#include +#include #include diff --git a/src/plugins/bearer/nla/main.cpp b/src/plugins/bearer/nla/main.cpp index 54269a4..479a933 100644 --- a/src/plugins/bearer/nla/main.cpp +++ b/src/plugins/bearer/nla/main.cpp @@ -41,7 +41,7 @@ #include "qnlaengine.h" -#include +#include #include diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 37eddee..0321451 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -41,7 +41,7 @@ #include "symbianengine.h" -#include +#include #include -- cgit v0.12 From 34450eb48e56677395601bf155a6a05752b326ad Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 16:27:44 +1000 Subject: Use provided typedef for QNetworkConfigurationPrivatePointer. --- src/network/bearer/qnetworkconfigmanager.cpp | 6 ++---- src/network/bearer/qnetworkconfigmanager_p.cpp | 10 +++++----- src/network/bearer/qnetworkconfiguration.cpp | 5 ++--- src/plugins/bearer/generic/qgenericengine.cpp | 5 ++--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 8673f52..8ca2537 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -239,8 +239,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe //find all InternetAccessPoints foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - engine->accessPointConfigurations.value(ii); + QNetworkConfigurationPrivatePointer p = engine->accessPointConfigurations.value(ii); if ((p->state & filter) == filter) { QNetworkConfiguration pt; pt.d = engine->accessPointConfigurations.value(ii); @@ -251,8 +250,7 @@ QList QNetworkConfigurationManager::allConfigurations(QNe //find all service networks cpsIdents = engine->snapConfigurations.keys(); foreach (const QString &ii, cpsIdents) { - QExplicitlySharedDataPointer p = - engine->snapConfigurations.value(ii); + QNetworkConfigurationPrivatePointer p = engine->snapConfigurations.value(ii); if ((p->state & filter) == filter) { QNetworkConfiguration pt; pt.d = engine->snapConfigurations.value(ii); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 66d5982..01a85a5 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -121,7 +121,7 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() serviceNetwork->state = QNetworkConfiguration::Defined; serviceNetwork->type = QNetworkConfiguration::ServiceNetwork; - QExplicitlySharedDataPointer ptr(serviceNetwork); + QNetworkConfigurationPrivatePointer ptr(serviceNetwork); generic->snapConfigurations.insert(serviceNetwork->id, ptr); @@ -132,17 +132,17 @@ void QNetworkConfigurationManagerPrivate::updateInternetServiceConfiguration() } } - QExplicitlySharedDataPointer ptr = + QNetworkConfigurationPrivatePointer ptr = generic->snapConfigurations.value(QLatin1String("Internet Service Network")); - QList > serviceNetworkMembers; + QList serviceNetworkMembers; - QHash >::const_iterator i = + QHash::const_iterator i = generic->accessPointConfigurations.constBegin(); QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined; while (i != generic->accessPointConfigurations.constEnd()) { - QExplicitlySharedDataPointer child = i.value(); + QNetworkConfigurationPrivatePointer child = i.value(); if (child.data()->internet && ((child.data()->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined)) { diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 9246645..8c11d9c 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -326,10 +326,9 @@ QList QNetworkConfiguration::children() const if (type() != QNetworkConfiguration::ServiceNetwork || !isValid() ) return results; - QMutableListIterator > iter(d->serviceNetworkMembers); - QExplicitlySharedDataPointer p(0); + QMutableListIterator iter(d->serviceNetworkMembers); while(iter.hasNext()) { - p = iter.next(); + QNetworkConfigurationPrivatePointer p = iter.next(); //if we have an invalid member get rid of it -> was deleted earlier on if (!p->isValid) iter.remove(); diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index c6ab4df..dba2c08 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -224,8 +224,7 @@ void QGenericEngine::doRequestUpdate() state |= QNetworkConfiguration::Active; if (accessPointConfigurations.contains(id)) { - QExplicitlySharedDataPointer ptr = - accessPointConfigurations.value(id); + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id); bool changed = false; @@ -269,7 +268,7 @@ void QGenericEngine::doRequestUpdate() } while (!previous.isEmpty()) { - QExplicitlySharedDataPointer ptr = + QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst()); configurationInterface.remove(ptr->id); -- cgit v0.12 From f11b682818e0d6fbd9cc75ee59b51bc6d6723c19 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 11 Feb 2010 17:01:44 +1000 Subject: Add 'We mean it.' header. --- src/network/bearer/qbearerplugin_p.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h index 1958188..36709c2 100644 --- a/src/network/bearer/qbearerplugin_p.h +++ b/src/network/bearer/qbearerplugin_p.h @@ -39,8 +39,19 @@ ** ****************************************************************************/ -#ifndef QBEARERPLUGIN_H -#define QBEARERPLUGIN_H +#ifndef QBEARERPLUGIN_P_H +#define QBEARERPLUGIN_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// #include "qbearerengine_p.h" -- cgit v0.12