diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2009-12-03 05:00:24 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-01-04 00:54:57 (GMT) |
commit | f7eb78d6b7cc0e07275ab64bec2743c5b2c0705f (patch) | |
tree | 1d71d597fe6dd54e8b7f68e41e74e90b8ef678a9 | |
parent | 0bcb2788e1eb225e0e3babb4ca113bcb5769dfc2 (diff) | |
download | Qt-f7eb78d6b7cc0e07275ab64bec2743c5b2c0705f.zip Qt-f7eb78d6b7cc0e07275ab64bec2743c5b2c0705f.tar.gz Qt-f7eb78d6b7cc0e07275ab64bec2743c5b2c0705f.tar.bz2 |
Convert CoreWlan engine into a plugin.
-rw-r--r-- | src/network/bearer/bearer.pri | 13 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 23 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.h | 2 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession_p.cpp | 13 | ||||
-rw-r--r-- | src/plugins/bearer/bearer.pro | 1 | ||||
-rw-r--r-- | src/plugins/bearer/corewlan/corewlan.pro | 21 | ||||
-rw-r--r-- | src/plugins/bearer/corewlan/main.cpp | 88 | ||||
-rw-r--r-- | src/plugins/bearer/corewlan/qcorewlanengine.h (renamed from src/network/bearer/qcorewlanengine_mac_p.h) | 16 | ||||
-rw-r--r-- | src/plugins/bearer/corewlan/qcorewlanengine.mm (renamed from src/network/bearer/qcorewlanengine_mac.mm) | 10 |
9 files changed, 129 insertions, 58 deletions
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/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 <QtCore/private/qfactoryloader_p.h> @@ -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<QBearerEnginePlugin *>(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 <QtCore/qstringlist.h> #include <QtCore/qdebug.h> #include <QtCore/qmutex.h> #include <QtNetwork/qnetworkinterface.h> -#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 <QtNetwork/qbearerplugin.h> + +#include <QtCore/qdebug.h> + +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/network/bearer/qcorewlanengine_mac_p.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index d6454ca..7ccfeea 100644 --- a/src/network/bearer/qcorewlanengine_mac_p.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.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 @@ -42,18 +42,8 @@ #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 <QtNetwork/private/qnetworksessionengine_p.h> + #include <QMap> #include <QTimer> diff --git a/src/network/bearer/qcorewlanengine_mac.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 2455f86..9dea217 100644 --- a/src/network/bearer/qcorewlanengine_mac.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -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 @@ -39,8 +39,9 @@ ** ****************************************************************************/ -#include "qcorewlanengine_mac_p.h" -#include "qnetworkconfiguration_p.h" +#include "qcorewlanengine.h" + +#include <QtNetwork/private/qnetworkconfiguration_p.h> #include <QtCore/qthread.h> #include <QtCore/qmutex.h> @@ -455,7 +456,4 @@ bool QCoreWlanEngine::getAllScInterfaces() return true; } -#include "moc_qcorewlanengine_mac_p.cpp" - QT_END_NAMESPACE - |