summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/audio/audio.pro6
-rw-r--r--src/plugins/audio/symbian/main.cpp121
-rw-r--r--src/plugins/audio/symbian/symbian.pro31
-rw-r--r--src/plugins/audio/symbian/symbianaudio.h76
-rw-r--r--src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp191
-rw-r--r--src/plugins/audio/symbian/symbianaudiodeviceinfo.h94
-rw-r--r--src/plugins/audio/symbian/symbianaudioinput.cpp595
-rw-r--r--src/plugins/audio/symbian/symbianaudioinput.h177
-rw-r--r--src/plugins/audio/symbian/symbianaudiooutput.cpp697
-rw-r--r--src/plugins/audio/symbian/symbianaudiooutput.h199
-rw-r--r--src/plugins/audio/symbian/symbianaudioutils.cpp395
-rw-r--r--src/plugins/audio/symbian/symbianaudioutils.h125
-rw-r--r--src/plugins/bearer/bearer.pro2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h13
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm386
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp20
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h2
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp25
-rw-r--r--src/plugins/bearer/icd/qicdengine.h2
-rw-r--r--src/plugins/bearer/icd/qnetworksession_impl.cpp221
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp23
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp60
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h2
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp14
-rw-r--r--src/plugins/bearer/nla/qnlaengine.h2
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.cpp198
-rw-r--r--src/plugins/bearer/symbian/qnetworksession_impl.h2
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp56
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp4
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp29
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h1
-rw-r--r--src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp3
-rw-r--r--src/plugins/graphicssystems/trace/trace.pro1
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp6
-rw-r--r--src/plugins/imageformats/tiff/tiff.pro2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp61
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp12
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h4
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp10
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp6
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movievideowidget.mm14
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.h6
-rw-r--r--src/plugins/mediaservices/qt7/qt7movieviewoutput.mm8
-rw-r--r--src/plugins/plugins.pro3
-rw-r--r--src/plugins/s60/3_2/3_2.pro7
-rw-r--r--src/plugins/s60/5_0/5_0.pro7
-rw-r--r--src/plugins/s60/s60pluginbase.pri2
-rw-r--r--src/plugins/s60/src/qdesktopservices_3_2.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite/sqlite.pro2
-rw-r--r--src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zipbin3155605 -> 3119273 bytes
57 files changed, 927 insertions, 3024 deletions
diff --git a/src/plugins/audio/audio.pro b/src/plugins/audio/audio.pro
index 5f75a8d..b7a775b 100644
--- a/src/plugins/audio/audio.pro
+++ b/src/plugins/audio/audio.pro
@@ -1,9 +1,3 @@
TEMPLATE = subdirs
SUBDIRS =
-contains(QT_CONFIG, audio-backend) {
- symbian {
- SUBDIRS += symbian
- }
-}
-
diff --git a/src/plugins/audio/symbian/main.cpp b/src/plugins/audio/symbian/main.cpp
deleted file mode 100644
index 536a8ec..0000000
--- a/src/plugins/audio/symbian/main.cpp
+++ /dev/null
@@ -1,121 +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 QtMultimedia 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 <QtMultimedia/qaudioengineplugin.h>
-#include <QtMultimedia/qaudioengine.h>
-
-#include <qstringlist.h>
-#include <qiodevice.h>
-#include <qbytearray.h>
-#include <qdebug.h>
-
-#include "symbianaudiodeviceinfo.h"
-#include "symbianaudioinput.h"
-#include "symbianaudiooutput.h"
-
-QT_BEGIN_NAMESPACE
-
-class SymbianAudioPlugin : public QAudioEnginePlugin
-{
-public:
- SymbianAudioPlugin(QObject *parent = 0);
- ~SymbianAudioPlugin();
-
- QStringList keys() const;
-
- QList<QByteArray> availableDevices(QAudio::Mode) const;
- QAbstractAudioInput* createInput(const QByteArray& device,
- const QAudioFormat& format = QAudioFormat());
- QAbstractAudioOutput* createOutput(const QByteArray& device,
- const QAudioFormat& format = QAudioFormat());
- QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device,
- QAudio::Mode mode);
-};
-
-SymbianAudioPlugin::SymbianAudioPlugin(QObject *parent)
- : QAudioEnginePlugin(parent)
-{
-
-}
-
-SymbianAudioPlugin::~SymbianAudioPlugin()
-{
-
-}
-
-QStringList SymbianAudioPlugin::keys() const
-{
- QStringList keys(QLatin1String("default"));
- keys << QLatin1String("default");
- return keys;
-}
-
-QList<QByteArray> SymbianAudioPlugin::availableDevices(QAudio::Mode mode) const
-{
- Q_UNUSED(mode)
- QList<QByteArray> devices;
- devices.append("default");
- return devices;
-}
-
-QAbstractAudioInput* SymbianAudioPlugin::createInput(
- const QByteArray &device, const QAudioFormat &format)
-{
- return new SymbianAudioInput(device, format);
-}
-
-QAbstractAudioOutput* SymbianAudioPlugin::createOutput(
- const QByteArray &device, const QAudioFormat &format)
-{
- return new SymbianAudioOutput(device, format);
-}
-
-QAbstractAudioDeviceInfo* SymbianAudioPlugin::createDeviceInfo(
- const QByteArray& device, QAudio::Mode mode)
-{
- return new SymbianAudioDeviceInfo(device, mode);
-}
-
-Q_EXPORT_STATIC_PLUGIN(SymbianAudioPlugin)
-Q_EXPORT_PLUGIN2(qaudio, SymbianAudioPlugin)
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/audio/symbian/symbian.pro b/src/plugins/audio/symbian/symbian.pro
deleted file mode 100644
index 7355daa..0000000
--- a/src/plugins/audio/symbian/symbian.pro
+++ /dev/null
@@ -1,31 +0,0 @@
-QT += multimedia
-TARGET = qaudio
-
-# Paths to DevSound headers
-INCLUDEPATH += /epoc32/include/mmf/common
-INCLUDEPATH += /epoc32/include/mmf/server
-
-HEADERS += \
- symbianaudio.h \
- symbianaudiodeviceinfo.h \
- symbianaudioinput.h \
- symbianaudiooutput.h \
- symbianaudioutils.h
-
-SOURCES += \
- main.cpp \
- symbianaudiodeviceinfo.cpp \
- symbianaudioinput.cpp \
- symbianaudiooutput.cpp \
- symbianaudioutils.cpp
-
-LIBS += -lmmfdevsound
-
-QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/audio
-target.path = $$[QT_INSTALL_PLUGINS]/audio
-INSTALLS += target
-
-include(../../qpluginbase.pri)
-
-TARGET.UID3 = 0x2001E630
-
diff --git a/src/plugins/audio/symbian/symbianaudio.h b/src/plugins/audio/symbian/symbianaudio.h
deleted file mode 100644
index 3fc0419..0000000
--- a/src/plugins/audio/symbian/symbianaudio.h
+++ /dev/null
@@ -1,76 +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 QtMultimedia 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 SYMBIANAUDIO_H
-#define SYMBIANAUDIO_H
-
-#include <QtCore/qnamespace.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace SymbianAudio {
-
-/**
- * Default values used by audio input and output classes, when underlying
- * DevSound instance has not yet been created.
- */
-
-const int DefaultBufferSize = 4096; // bytes
-const int DefaultNotifyInterval = 1000; // ms
-
-/**
- * Enumeration used to track state of internal DevSound instances.
- * Values are translated to the corresponding QAudio::State values by
- * SymbianAudio::Utils::stateNativeToQt.
- */
-enum State {
- ClosedState
- , InitializingState
- , ActiveState
- , IdleState
- , SuspendedState
-};
-
-} // namespace SymbianAudio
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp b/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp
deleted file mode 100644
index 9701dad..0000000
--- a/src/plugins/audio/symbian/symbianaudiodeviceinfo.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 QtMultimedia 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 "symbianaudiodeviceinfo.h"
-#include "symbianaudioutils.h"
-
-QT_BEGIN_NAMESPACE
-
-SymbianAudioDeviceInfo::SymbianAudioDeviceInfo(QByteArray device,
- QAudio::Mode mode)
- : m_deviceName(device)
- , m_mode(mode)
- , m_updated(false)
-{
- QT_TRAP_THROWING(m_devsound.reset(CMMFDevSound::NewL()));
-}
-
-SymbianAudioDeviceInfo::~SymbianAudioDeviceInfo()
-{
-
-}
-
-QAudioFormat SymbianAudioDeviceInfo::preferredFormat() const
-{
- QAudioFormat format;
- switch (m_mode) {
- case QAudio::AudioOutput:
- format.setFrequency(44100);
- format.setChannels(2);
- format.setSampleSize(16);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setCodec(QLatin1String("audio/pcm"));
- break;
-
- case QAudio::AudioInput:
- format.setFrequency(8000);
- format.setChannels(1);
- format.setSampleSize(16);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setCodec(QLatin1String("audio/pcm"));
- break;
-
- default:
- Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
- }
-
- if (!isFormatSupported(format)) {
- if (m_frequencies.size())
- format.setFrequency(m_frequencies[0]);
- if (m_channels.size())
- format.setChannels(m_channels[0]);
- if (m_sampleSizes.size())
- format.setSampleSize(m_sampleSizes[0]);
- if (m_byteOrders.size())
- format.setByteOrder(m_byteOrders[0]);
- if (m_sampleTypes.size())
- format.setSampleType(m_sampleTypes[0]);
- }
-
- return format;
-}
-
-bool SymbianAudioDeviceInfo::isFormatSupported(
- const QAudioFormat &format) const
-{
- getSupportedFormats();
- const bool supported =
- m_codecs.contains(format.codec())
- && m_frequencies.contains(format.frequency())
- && m_channels.contains(format.channels())
- && m_sampleSizes.contains(format.sampleSize())
- && m_byteOrders.contains(format.byteOrder())
- && m_sampleTypes.contains(format.sampleType());
-
- return supported;
-}
-
-QAudioFormat SymbianAudioDeviceInfo::nearestFormat(const QAudioFormat &format) const
-{
- if (isFormatSupported(format))
- return format;
- else
- return preferredFormat();
-}
-
-QString SymbianAudioDeviceInfo::deviceName() const
-{
- return m_deviceName;
-}
-
-QStringList SymbianAudioDeviceInfo::codecList()
-{
- getSupportedFormats();
- return m_codecs;
-}
-
-QList<int> SymbianAudioDeviceInfo::frequencyList()
-{
- getSupportedFormats();
- return m_frequencies;
-}
-
-QList<int> SymbianAudioDeviceInfo::channelsList()
-{
- getSupportedFormats();
- return m_channels;
-}
-
-QList<int> SymbianAudioDeviceInfo::sampleSizeList()
-{
- getSupportedFormats();
- return m_sampleSizes;
-}
-
-QList<QAudioFormat::Endian> SymbianAudioDeviceInfo::byteOrderList()
-{
- getSupportedFormats();
- return m_byteOrders;
-}
-
-QList<QAudioFormat::SampleType> SymbianAudioDeviceInfo::sampleTypeList()
-{
- getSupportedFormats();
- return m_sampleTypes;
-}
-
-QList<QByteArray> SymbianAudioDeviceInfo::deviceList(QAudio::Mode mode)
-{
- Q_UNUSED(mode)
- QList<QByteArray> devices;
- devices.append("default");
- return devices;
-}
-
-void SymbianAudioDeviceInfo::getSupportedFormats() const
-{
- if (!m_updated) {
- QScopedPointer<SymbianAudio::DevSoundCapabilities> caps(
- new SymbianAudio::DevSoundCapabilities(*m_devsound, m_mode));
-
- SymbianAudio::Utils::capabilitiesNativeToQt(*caps,
- m_frequencies, m_channels, m_sampleSizes,
- m_byteOrders, m_sampleTypes);
-
- m_codecs.append(QLatin1String("audio/pcm"));
-
- m_updated = true;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audio/symbian/symbianaudiodeviceinfo.h b/src/plugins/audio/symbian/symbianaudiodeviceinfo.h
deleted file mode 100644
index 250804d..0000000
--- a/src/plugins/audio/symbian/symbianaudiodeviceinfo.h
+++ /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 QtMultimedia 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 SYMBIANAUDIODEVICEINFO_H
-#define SYMBIANAUDIODEVICEINFO_H
-
-#include <QtMultimedia/qaudioengine.h>
-#include <sounddevice.h>
-
-QT_BEGIN_NAMESPACE
-
-class SymbianAudioDeviceInfo
- : public QAbstractAudioDeviceInfo
-{
- Q_OBJECT
-
-public:
- SymbianAudioDeviceInfo(QByteArray device, QAudio::Mode mode);
- ~SymbianAudioDeviceInfo();
-
- // QAbstractAudioDeviceInfo
- QAudioFormat preferredFormat() const;
- bool isFormatSupported(const QAudioFormat &format) const;
- QAudioFormat nearestFormat(const QAudioFormat &format) const;
- QString deviceName() const;
- QStringList codecList();
- QList<int> frequencyList();
- QList<int> channelsList();
- QList<int> sampleSizeList();
- QList<QAudioFormat::Endian> byteOrderList();
- QList<QAudioFormat::SampleType> sampleTypeList();
- QList<QByteArray> deviceList(QAudio::Mode);
-
-private:
- void getSupportedFormats() const;
-
-private:
- QScopedPointer<CMMFDevSound> m_devsound;
-
- QString m_deviceName;
- QAudio::Mode m_mode;
-
- // Mutable to allow lazy initialization when called from const-qualified
- // public functions (isFormatSupported, nearestFormat)
- mutable bool m_updated;
- mutable QStringList m_codecs;
- mutable QList<int> m_frequencies;
- mutable QList<int> m_channels;
- mutable QList<int> m_sampleSizes;
- mutable QList<QAudioFormat::Endian> m_byteOrders;
- mutable QList<QAudioFormat::SampleType> m_sampleTypes;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audio/symbian/symbianaudioinput.cpp b/src/plugins/audio/symbian/symbianaudioinput.cpp
deleted file mode 100644
index 8200925..0000000
--- a/src/plugins/audio/symbian/symbianaudioinput.cpp
+++ /dev/null
@@ -1,595 +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 QtMultimedia 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 "symbianaudioinput.h"
-#include "symbianaudioutils.h"
-
-QT_BEGIN_NAMESPACE
-
-//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-const int PushInterval = 50; // ms
-
-
-//-----------------------------------------------------------------------------
-// Private class
-//-----------------------------------------------------------------------------
-
-SymbianAudioInputPrivate::SymbianAudioInputPrivate(
- SymbianAudioInput *audioDevice)
- : m_audioDevice(audioDevice)
-{
-
-}
-
-SymbianAudioInputPrivate::~SymbianAudioInputPrivate()
-{
-
-}
-
-qint64 SymbianAudioInputPrivate::readData(char *data, qint64 len)
-{
- qint64 totalRead = 0;
-
- if (m_audioDevice->state() == QAudio::ActiveState ||
- m_audioDevice->state() == QAudio::IdleState) {
-
- while (totalRead < len) {
- const qint64 read = m_audioDevice->read(data + totalRead,
- len - totalRead);
- if (read > 0)
- totalRead += read;
- else
- break;
- }
- }
-
- return totalRead;
-}
-
-qint64 SymbianAudioInputPrivate::writeData(const char *data, qint64 len)
-{
- Q_UNUSED(data)
- Q_UNUSED(len)
- return 0;
-}
-
-void SymbianAudioInputPrivate::dataReady()
-{
- emit readyRead();
-}
-
-
-//-----------------------------------------------------------------------------
-// Public functions
-//-----------------------------------------------------------------------------
-
-SymbianAudioInput::SymbianAudioInput(const QByteArray &device,
- const QAudioFormat &format)
- : m_device(device)
- , m_format(format)
- , m_clientBufferSize(SymbianAudio::DefaultBufferSize)
- , m_notifyInterval(SymbianAudio::DefaultNotifyInterval)
- , m_notifyTimer(new QTimer(this))
- , m_error(QAudio::NoError)
- , m_internalState(SymbianAudio::ClosedState)
- , m_externalState(QAudio::StoppedState)
- , m_pullMode(false)
- , m_sink(0)
- , m_pullTimer(new QTimer(this))
- , m_devSoundBuffer(0)
- , m_devSoundBufferSize(0)
- , m_totalBytesReady(0)
- , m_devSoundBufferPos(0)
- , m_totalSamplesRecorded(0)
-{
- connect(m_notifyTimer.data(), SIGNAL(timeout()), this, SIGNAL(notify()));
-
- SymbianAudio::Utils::formatQtToNative(m_format, m_nativeFourCC,
- m_nativeFormat);
-
- m_pullTimer->setInterval(PushInterval);
- connect(m_pullTimer.data(), SIGNAL(timeout()), this, SLOT(pullData()));
-}
-
-SymbianAudioInput::~SymbianAudioInput()
-{
- close();
-}
-
-QIODevice* SymbianAudioInput::start(QIODevice *device)
-{
- stop();
-
- open();
- if (SymbianAudio::ClosedState != m_internalState) {
- if (device) {
- m_pullMode = true;
- m_sink = device;
- } else {
- m_sink = new SymbianAudioInputPrivate(this);
- m_sink->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
- }
-
- m_elapsed.restart();
- }
-
- return m_sink;
-}
-
-void SymbianAudioInput::stop()
-{
- close();
-}
-
-void SymbianAudioInput::reset()
-{
- m_totalSamplesRecorded += getSamplesRecorded();
- m_devSound->Stop();
- startRecording();
-}
-
-void SymbianAudioInput::suspend()
-{
- if (SymbianAudio::ActiveState == m_internalState
- || SymbianAudio::IdleState == m_internalState) {
- m_notifyTimer->stop();
- m_pullTimer->stop();
- m_devSound->Pause();
- const qint64 samplesRecorded = getSamplesRecorded();
- m_totalSamplesRecorded += samplesRecorded;
-
- if (m_devSoundBuffer) {
- m_devSoundBufferQ.append(m_devSoundBuffer);
- m_devSoundBuffer = 0;
- }
-
- setState(SymbianAudio::SuspendedState);
- }
-}
-
-void SymbianAudioInput::resume()
-{
- if (SymbianAudio::SuspendedState == m_internalState)
- startDataTransfer();
-}
-
-int SymbianAudioInput::bytesReady() const
-{
- Q_ASSERT(m_devSoundBufferPos <= m_totalBytesReady);
- return m_totalBytesReady - m_devSoundBufferPos;
-}
-
-int SymbianAudioInput::periodSize() const
-{
- return bufferSize();
-}
-
-void SymbianAudioInput::setBufferSize(int value)
-{
- // Note that DevSound does not allow its client to specify the buffer size.
- // This functionality is available via custom interfaces, but since these
- // cannot be guaranteed to work across all DevSound implementations, we
- // do not use them here.
- // In order to comply with the expected bevahiour of QAudioInput, we store
- // the value and return it from bufferSize(), but the underlying DevSound
- // buffer size remains unchanged.
- if (value > 0)
- m_clientBufferSize = value;
-}
-
-int SymbianAudioInput::bufferSize() const
-{
- return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize;
-}
-
-void SymbianAudioInput::setNotifyInterval(int ms)
-{
- if (ms > 0) {
- const int oldNotifyInterval = m_notifyInterval;
- m_notifyInterval = ms;
- if (m_notifyTimer->isActive() && ms != oldNotifyInterval)
- m_notifyTimer->start(m_notifyInterval);
- }
-}
-
-int SymbianAudioInput::notifyInterval() const
-{
- return m_notifyInterval;
-}
-
-qint64 SymbianAudioInput::processedUSecs() const
-{
- int samplesPlayed = 0;
- if (m_devSound && SymbianAudio::SuspendedState != m_internalState)
- samplesPlayed = getSamplesRecorded();
-
- // Protect against division by zero
- Q_ASSERT_X(m_format.frequency() > 0, Q_FUNC_INFO, "Invalid frequency");
-
- const qint64 result = qint64(1000000) *
- (samplesPlayed + m_totalSamplesRecorded)
- / m_format.frequency();
-
- return result;
-}
-
-qint64 SymbianAudioInput::elapsedUSecs() const
-{
- const qint64 result = (QAudio::StoppedState == state()) ?
- 0 : m_elapsed.elapsed() * 1000;
- return result;
-}
-
-QAudio::Error SymbianAudioInput::error() const
-{
- return m_error;
-}
-
-QAudio::State SymbianAudioInput::state() const
-{
- return m_externalState;
-}
-
-QAudioFormat SymbianAudioInput::format() const
-{
- return m_format;
-}
-
-//-----------------------------------------------------------------------------
-// MDevSoundObserver implementation
-//-----------------------------------------------------------------------------
-
-void SymbianAudioInput::InitializeComplete(TInt aError)
-{
- Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState,
- Q_FUNC_INFO, "Invalid state");
-
- if (KErrNone == aError)
- startRecording();
-}
-
-void SymbianAudioInput::ToneFinished(TInt aError)
-{
- Q_UNUSED(aError)
- // This class doesn't use DevSound's tone playback functions, so should
- // never receive this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioInput::BufferToBeFilled(CMMFBuffer *aBuffer)
-{
- Q_UNUSED(aBuffer)
- // This class doesn't use DevSound in play mode, so should never receive
- // this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioInput::PlayError(TInt aError)
-{
- Q_UNUSED(aError)
- // This class doesn't use DevSound in play mode, so should never receive
- // this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioInput::BufferToBeEmptied(CMMFBuffer *aBuffer)
-{
- // Following receipt of this callback, DevSound should not provide another
- // buffer until we have returned the current one.
- Q_ASSERT_X(!m_devSoundBuffer, Q_FUNC_INFO, "Buffer already held");
-
- CMMFDataBuffer *const buffer = static_cast<CMMFDataBuffer*>(aBuffer);
-
- if (!m_devSoundBufferSize)
- m_devSoundBufferSize = buffer->Data().MaxLength();
-
- m_totalBytesReady += buffer->Data().Length();
-
- if (SymbianAudio::SuspendedState == m_internalState) {
- m_devSoundBufferQ.append(buffer);
- } else {
- // Will be returned to DevSound by bufferEmptied().
- m_devSoundBuffer = buffer;
- m_devSoundBufferPos = 0;
-
- if (bytesReady() && !m_pullMode)
- pushData();
- }
-}
-
-void SymbianAudioInput::RecordError(TInt aError)
-{
- Q_UNUSED(aError)
- setError(QAudio::IOError);
-}
-
-void SymbianAudioInput::ConvertError(TInt aError)
-{
- Q_UNUSED(aError)
- // This class doesn't use DevSound's format conversion functions, so
- // should never receive this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioInput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg)
-{
- Q_UNUSED(aMessageType)
- Q_UNUSED(aMsg)
- // Ignore this callback.
-}
-
-//-----------------------------------------------------------------------------
-// Private functions
-//-----------------------------------------------------------------------------
-
-void SymbianAudioInput::open()
-{
- Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState,
- Q_FUNC_INFO, "DevSound already opened");
-
- QT_TRAP_THROWING( m_devSound.reset(CMMFDevSound::NewL()) )
-
- QScopedPointer<SymbianAudio::DevSoundCapabilities> caps(
- new SymbianAudio::DevSoundCapabilities(*m_devSound, QAudio::AudioInput));
-
- int err = SymbianAudio::Utils::isFormatSupported(m_format, *caps) ?
- KErrNone : KErrNotSupported;
-
- if (KErrNone == err) {
- setState(SymbianAudio::InitializingState);
- TRAP(err, m_devSound->InitializeL(*this, m_nativeFourCC,
- EMMFStateRecording));
- }
-
- if (KErrNone != err) {
- setError(QAudio::OpenError);
- m_devSound.reset();
- }
-}
-
-void SymbianAudioInput::startRecording()
-{
- const int samplesRecorded = m_devSound->SamplesRecorded();
- Q_ASSERT(samplesRecorded == 0);
-
- TRAPD(err, startDevSoundL());
- if (KErrNone == err) {
- startDataTransfer();
- } else {
- setError(QAudio::OpenError);
- close();
- }
-}
-
-void SymbianAudioInput::startDevSoundL()
-{
- TMMFCapabilities nativeFormat = m_devSound->Config();
- m_nativeFormat.iBufferSize = nativeFormat.iBufferSize;
- m_devSound->SetConfigL(m_nativeFormat);
- m_devSound->RecordInitL();
-}
-
-void SymbianAudioInput::startDataTransfer()
-{
- m_notifyTimer->start(m_notifyInterval);
-
- if (m_pullMode)
- m_pullTimer->start();
-
- if (bytesReady()) {
- setState(SymbianAudio::ActiveState);
- if (!m_pullMode)
- pushData();
- } else {
- if (SymbianAudio::SuspendedState == m_internalState)
- setState(SymbianAudio::ActiveState);
- else
- setState(SymbianAudio::IdleState);
- }
-}
-
-CMMFDataBuffer* SymbianAudioInput::currentBuffer() const
-{
- CMMFDataBuffer *result = m_devSoundBuffer;
- if (!result && !m_devSoundBufferQ.empty())
- result = m_devSoundBufferQ.front();
- return result;
-}
-
-void SymbianAudioInput::pushData()
-{
- Q_ASSERT_X(bytesReady(), Q_FUNC_INFO, "No data available");
- Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO, "pushData called when in pull mode");
- qobject_cast<SymbianAudioInputPrivate *>(m_sink)->dataReady();
-}
-
-qint64 SymbianAudioInput::read(char *data, qint64 len)
-{
- // SymbianAudioInputPrivate is ready to read data
-
- Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO,
- "read called when in pull mode");
-
- qint64 bytesRead = 0;
-
- CMMFDataBuffer *buffer = 0;
- while ((buffer = currentBuffer()) && (bytesRead < len)) {
- if (SymbianAudio::IdleState == m_internalState)
- setState(SymbianAudio::ActiveState);
-
- TDesC8 &inputBuffer = buffer->Data();
-
- const qint64 inputBytes = bytesReady();
- const qint64 outputBytes = len - bytesRead;
- const qint64 copyBytes = outputBytes < inputBytes ?
- outputBytes : inputBytes;
-
- memcpy(data, inputBuffer.Ptr() + m_devSoundBufferPos, copyBytes);
-
- m_devSoundBufferPos += copyBytes;
- data += copyBytes;
- bytesRead += copyBytes;
-
- if (!bytesReady())
- bufferEmptied();
- }
-
- return bytesRead;
-}
-
-void SymbianAudioInput::pullData()
-{
- Q_ASSERT_X(m_pullMode, Q_FUNC_INFO,
- "pullData called when in push mode");
-
- CMMFDataBuffer *buffer = 0;
- while (buffer = currentBuffer()) {
- if (SymbianAudio::IdleState == m_internalState)
- setState(SymbianAudio::ActiveState);
-
- TDesC8 &inputBuffer = buffer->Data();
-
- const qint64 inputBytes = bytesReady();
- const qint64 bytesPushed = m_sink->write(
- (char*)inputBuffer.Ptr() + m_devSoundBufferPos, inputBytes);
-
- m_devSoundBufferPos += bytesPushed;
-
- if (!bytesReady())
- bufferEmptied();
-
- if (!bytesPushed)
- break;
- }
-}
-
-void SymbianAudioInput::bufferEmptied()
-{
- m_devSoundBufferPos = 0;
-
- if (m_devSoundBuffer) {
- m_totalBytesReady -= m_devSoundBuffer->Data().Length();
- m_devSoundBuffer = 0;
- m_devSound->RecordData();
- } else {
- Q_ASSERT(!m_devSoundBufferQ.empty());
- m_totalBytesReady -= m_devSoundBufferQ.front()->Data().Length();
- m_devSoundBufferQ.erase(m_devSoundBufferQ.begin());
-
- // If the queue has been emptied, resume transfer from the hardware
- if (m_devSoundBufferQ.empty())
- m_devSound->RecordInitL();
- }
-
- Q_ASSERT(m_totalBytesReady >= 0);
-}
-
-void SymbianAudioInput::close()
-{
- m_notifyTimer->stop();
- m_pullTimer->stop();
-
- m_error = QAudio::NoError;
-
- if (m_devSound)
- m_devSound->Stop();
- m_devSound.reset();
- m_devSoundBuffer = 0;
- m_devSoundBufferSize = 0;
- m_totalBytesReady = 0;
-
- if (!m_pullMode) // m_sink is owned
- delete m_sink;
- m_pullMode = false;
- m_sink = 0;
-
- m_devSoundBufferQ.clear();
- m_devSoundBufferPos = 0;
- m_totalSamplesRecorded = 0;
-
- setState(SymbianAudio::ClosedState);
-}
-
-qint64 SymbianAudioInput::getSamplesRecorded() const
-{
- qint64 result = 0;
- if (m_devSound)
- result = qint64(m_devSound->SamplesRecorded());
- return result;
-}
-
-void SymbianAudioInput::setError(QAudio::Error error)
-{
- m_error = error;
-
- // Although no state transition actually occurs here, a stateChanged event
- // must be emitted to inform the client that the call to start() was
- // unsuccessful.
- if (QAudio::OpenError == error)
- emit stateChanged(QAudio::StoppedState);
-
- // Close the DevSound instance. This causes a transition to StoppedState.
- // This must be done asynchronously in case the current function was called
- // from a DevSound event handler, in which case deleting the DevSound
- // instance may cause an exception.
- QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
-}
-
-void SymbianAudioInput::setState(SymbianAudio::State newInternalState)
-{
- const QAudio::State oldExternalState = m_externalState;
- m_internalState = newInternalState;
- m_externalState = SymbianAudio::Utils::stateNativeToQt(
- m_internalState, initializingState());
-
- if (m_externalState != oldExternalState)
- emit stateChanged(m_externalState);
-}
-
-QAudio::State SymbianAudioInput::initializingState() const
-{
- return QAudio::IdleState;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audio/symbian/symbianaudioinput.h b/src/plugins/audio/symbian/symbianaudioinput.h
deleted file mode 100644
index 34b7d38..0000000
--- a/src/plugins/audio/symbian/symbianaudioinput.h
+++ /dev/null
@@ -1,177 +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 QtMultimedia 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 SYMBIANAUDIOINPUT_H
-#define SYMBIANAUDIOINPUT_H
-
-#include <QtMultimedia/qaudioengine.h>
-#include <QTime>
-#include <QTimer>
-#include <sounddevice.h>
-#include "symbianaudio.h"
-
-QT_BEGIN_NAMESPACE
-
-class SymbianAudioInput;
-
-class SymbianAudioInputPrivate : public QIODevice
-{
- friend class SymbianAudioInput;
- Q_OBJECT
-public:
- SymbianAudioInputPrivate(SymbianAudioInput *audio);
- ~SymbianAudioInputPrivate();
-
- qint64 readData(char *data, qint64 len);
- qint64 writeData(const char *data, qint64 len);
-
- void dataReady();
-
-private:
- SymbianAudioInput *const m_audioDevice;
-};
-
-class SymbianAudioInput
- : public QAbstractAudioInput
- , public MDevSoundObserver
-{
- friend class SymbianAudioInputPrivate;
- Q_OBJECT
-public:
- SymbianAudioInput(const QByteArray &device,
- const QAudioFormat &audioFormat);
- ~SymbianAudioInput();
-
- // QAbstractAudioInput
- QIODevice* start(QIODevice *device = 0);
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesReady() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
- QAudioFormat format() const;
-
- // MDevSoundObserver
- void InitializeComplete(TInt aError);
- void ToneFinished(TInt aError);
- void BufferToBeFilled(CMMFBuffer *aBuffer);
- void PlayError(TInt aError);
- void BufferToBeEmptied(CMMFBuffer *aBuffer);
- void RecordError(TInt aError);
- void ConvertError(TInt aError);
- void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg);
-
-private slots:
- void pullData();
-
-private:
- void open();
- void startRecording();
- void startDevSoundL();
- void startDataTransfer();
- CMMFDataBuffer* currentBuffer() const;
- void pushData();
- qint64 read(char *data, qint64 len);
- void bufferEmptied();
- Q_INVOKABLE void close();
-
- qint64 getSamplesRecorded() const;
-
- void setError(QAudio::Error error);
- void setState(SymbianAudio::State state);
-
- QAudio::State initializingState() const;
-
-private:
- const QByteArray m_device;
- const QAudioFormat m_format;
-
- int m_clientBufferSize;
- int m_notifyInterval;
- QScopedPointer<QTimer> m_notifyTimer;
- QTime m_elapsed;
- QAudio::Error m_error;
-
- SymbianAudio::State m_internalState;
- QAudio::State m_externalState;
-
- bool m_pullMode;
- QIODevice *m_sink;
-
- QScopedPointer<QTimer> m_pullTimer;
-
- QScopedPointer<CMMFDevSound> m_devSound;
- TUint32 m_nativeFourCC;
- TMMFCapabilities m_nativeFormat;
-
- // Latest buffer provided by DevSound, to be empied of data.
- CMMFDataBuffer *m_devSoundBuffer;
-
- int m_devSoundBufferSize;
-
- // Total amount of data in buffers provided by DevSound
- int m_totalBytesReady;
-
- // Queue of buffers returned after call to CMMFDevSound::Pause().
- QList<CMMFDataBuffer *> m_devSoundBufferQ;
-
- // Current read position within m_devSoundBuffer
- qint64 m_devSoundBufferPos;
-
- // Samples recorded up to the last call to suspend(). It is necessary
- // to cache this because suspend() is implemented using
- // CMMFDevSound::Stop(), which resets DevSound's SamplesRecorded() counter.
- quint32 m_totalSamplesRecorded;
-
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audio/symbian/symbianaudiooutput.cpp b/src/plugins/audio/symbian/symbianaudiooutput.cpp
deleted file mode 100644
index 385e169..0000000
--- a/src/plugins/audio/symbian/symbianaudiooutput.cpp
+++ /dev/null
@@ -1,697 +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 QtMultimedia 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 "symbianaudiooutput.h"
-#include "symbianaudioutils.h"
-
-QT_BEGIN_NAMESPACE
-
-//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-const int UnderflowTimerInterval = 50; // ms
-
-
-//-----------------------------------------------------------------------------
-// Private class
-//-----------------------------------------------------------------------------
-
-SymbianAudioOutputPrivate::SymbianAudioOutputPrivate(
- SymbianAudioOutput *audioDevice)
- : m_audioDevice(audioDevice)
-{
-
-}
-
-SymbianAudioOutputPrivate::~SymbianAudioOutputPrivate()
-{
-
-}
-
-qint64 SymbianAudioOutputPrivate::readData(char *data, qint64 len)
-{
- Q_UNUSED(data)
- Q_UNUSED(len)
- return 0;
-}
-
-qint64 SymbianAudioOutputPrivate::writeData(const char *data, qint64 len)
-{
- qint64 totalWritten = 0;
-
- if (m_audioDevice->state() == QAudio::ActiveState ||
- m_audioDevice->state() == QAudio::IdleState) {
-
- while (totalWritten < len) {
- const qint64 written = m_audioDevice->pushData(data + totalWritten,
- len - totalWritten);
- if (written > 0)
- totalWritten += written;
- else
- break;
- }
- }
-
- return totalWritten;
-}
-
-
-//-----------------------------------------------------------------------------
-// Public functions
-//-----------------------------------------------------------------------------
-
-SymbianAudioOutput::SymbianAudioOutput(const QByteArray &device,
- const QAudioFormat &format)
- : m_device(device)
- , m_format(format)
- , m_clientBufferSize(SymbianAudio::DefaultBufferSize)
- , m_notifyInterval(SymbianAudio::DefaultNotifyInterval)
- , m_notifyTimer(new QTimer(this))
- , m_error(QAudio::NoError)
- , m_internalState(SymbianAudio::ClosedState)
- , m_externalState(QAudio::StoppedState)
- , m_pullMode(false)
- , m_source(0)
- , m_devSoundBuffer(0)
- , m_devSoundBufferSize(0)
- , m_bytesWritten(0)
- , m_pushDataReady(false)
- , m_bytesPadding(0)
- , m_underflow(false)
- , m_lastBuffer(false)
- , m_underflowTimer(new QTimer(this))
- , m_samplesPlayed(0)
- , m_totalSamplesPlayed(0)
-{
- connect(m_notifyTimer.data(), SIGNAL(timeout()), this, SIGNAL(notify()));
-
- SymbianAudio::Utils::formatQtToNative(m_format, m_nativeFourCC,
- m_nativeFormat);
-
- m_underflowTimer->setInterval(UnderflowTimerInterval);
- connect(m_underflowTimer.data(), SIGNAL(timeout()), this,
- SLOT(underflowTimerExpired()));
-}
-
-SymbianAudioOutput::~SymbianAudioOutput()
-{
- close();
-}
-
-QIODevice* SymbianAudioOutput::start(QIODevice *device)
-{
- stop();
-
- // We have to set these before the call to open() because of the
- // logic in initializingState()
- if (device) {
- m_pullMode = true;
- m_source = device;
- }
-
- open();
-
- if (SymbianAudio::ClosedState != m_internalState) {
- if (device) {
- connect(m_source, SIGNAL(readyRead()), this, SLOT(dataReady()));
- } else {
- m_source = new SymbianAudioOutputPrivate(this);
- m_source->open(QIODevice::WriteOnly | QIODevice::Unbuffered);
- }
-
- m_elapsed.restart();
- }
-
- return m_source;
-}
-
-void SymbianAudioOutput::stop()
-{
- close();
-}
-
-void SymbianAudioOutput::reset()
-{
- m_totalSamplesPlayed += getSamplesPlayed();
- m_devSound->Stop();
- m_bytesPadding = 0;
- startPlayback();
-}
-
-void SymbianAudioOutput::suspend()
-{
- if (SymbianAudio::ActiveState == m_internalState
- || SymbianAudio::IdleState == m_internalState) {
- m_notifyTimer->stop();
- m_underflowTimer->stop();
-
- const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples(
- m_format, m_bytesWritten);
- m_bytesWritten = 0;
-
- const qint64 samplesPlayed = getSamplesPlayed();
-
- // CMMFDevSound::Pause() is not guaranteed to work correctly in all
- // implementations, for play-mode DevSound sessions. We therefore
- // have to implement suspend() by calling CMMFDevSound::Stop().
- // Because this causes buffered data to be dropped, we replace the
- // lost data with silence following a call to resume(), in order to
- // ensure that processedUSecs() returns the correct value.
- m_devSound->Stop();
- m_totalSamplesPlayed += samplesPlayed;
-
- // Calculate the amount of data dropped
- const qint64 paddingSamples = samplesWritten - samplesPlayed;
- m_bytesPadding = SymbianAudio::Utils::samplesToBytes(m_format,
- paddingSamples);
-
- setState(SymbianAudio::SuspendedState);
- }
-}
-
-void SymbianAudioOutput::resume()
-{
- if (SymbianAudio::SuspendedState == m_internalState)
- startPlayback();
-}
-
-int SymbianAudioOutput::bytesFree() const
-{
- int result = 0;
- if (m_devSoundBuffer) {
- const TDes8 &outputBuffer = m_devSoundBuffer->Data();
- result = outputBuffer.MaxLength() - outputBuffer.Length();
- }
- return result;
-}
-
-int SymbianAudioOutput::periodSize() const
-{
- return bufferSize();
-}
-
-void SymbianAudioOutput::setBufferSize(int value)
-{
- // Note that DevSound does not allow its client to specify the buffer size.
- // This functionality is available via custom interfaces, but since these
- // cannot be guaranteed to work across all DevSound implementations, we
- // do not use them here.
- // In order to comply with the expected bevahiour of QAudioOutput, we store
- // the value and return it from bufferSize(), but the underlying DevSound
- // buffer size remains unchanged.
- if (value > 0)
- m_clientBufferSize = value;
-}
-
-int SymbianAudioOutput::bufferSize() const
-{
- return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize;
-}
-
-void SymbianAudioOutput::setNotifyInterval(int ms)
-{
- if (ms > 0) {
- const int oldNotifyInterval = m_notifyInterval;
- m_notifyInterval = ms;
- if (m_notifyTimer->isActive() && ms != oldNotifyInterval)
- m_notifyTimer->start(m_notifyInterval);
- }
-}
-
-int SymbianAudioOutput::notifyInterval() const
-{
- return m_notifyInterval;
-}
-
-qint64 SymbianAudioOutput::processedUSecs() const
-{
- int samplesPlayed = 0;
- if (m_devSound && SymbianAudio::SuspendedState != m_internalState)
- samplesPlayed = getSamplesPlayed();
-
- // Protect against division by zero
- Q_ASSERT_X(m_format.frequency() > 0, Q_FUNC_INFO, "Invalid frequency");
-
- const qint64 result = qint64(1000000) *
- (samplesPlayed + m_totalSamplesPlayed)
- / m_format.frequency();
-
- return result;
-}
-
-qint64 SymbianAudioOutput::elapsedUSecs() const
-{
- const qint64 result = (QAudio::StoppedState == state()) ?
- 0 : m_elapsed.elapsed() * 1000;
- return result;
-}
-
-QAudio::Error SymbianAudioOutput::error() const
-{
- return m_error;
-}
-
-QAudio::State SymbianAudioOutput::state() const
-{
- return m_externalState;
-}
-
-QAudioFormat SymbianAudioOutput::format() const
-{
- return m_format;
-}
-
-//-----------------------------------------------------------------------------
-// MDevSoundObserver implementation
-//-----------------------------------------------------------------------------
-
-void SymbianAudioOutput::InitializeComplete(TInt aError)
-{
- Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState,
- Q_FUNC_INFO, "Invalid state");
-
- if (KErrNone == aError)
- startPlayback();
-}
-
-void SymbianAudioOutput::ToneFinished(TInt aError)
-{
- Q_UNUSED(aError)
- // This class doesn't use DevSound's tone playback functions, so should
- // never receive this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioOutput::BufferToBeFilled(CMMFBuffer *aBuffer)
-{
- // Following receipt of this callback, DevSound should not provide another
- // buffer until we have returned the current one.
- Q_ASSERT_X(!m_devSoundBuffer, Q_FUNC_INFO, "Buffer already held");
-
- // Will be returned to DevSound by bufferFilled().
- m_devSoundBuffer = static_cast<CMMFDataBuffer*>(aBuffer);
-
- if (!m_devSoundBufferSize)
- m_devSoundBufferSize = m_devSoundBuffer->Data().MaxLength();
-
- writePaddingData();
-
- if (m_pullMode && isDataReady() && !m_bytesPadding)
- pullData();
-}
-
-void SymbianAudioOutput::PlayError(TInt aError)
-{
- switch (aError) {
- case KErrUnderflow:
- m_underflow = true;
- if (m_pullMode && !m_lastBuffer)
- setError(QAudio::UnderrunError);
- else
- setState(SymbianAudio::IdleState);
- break;
- default:
- setError(QAudio::IOError);
- break;
- }
-}
-
-void SymbianAudioOutput::BufferToBeEmptied(CMMFBuffer *aBuffer)
-{
- Q_UNUSED(aBuffer)
- // This class doesn't use DevSound in record mode, so should never receive
- // this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioOutput::RecordError(TInt aError)
-{
- Q_UNUSED(aError)
- // This class doesn't use DevSound in record mode, so should never receive
- // this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioOutput::ConvertError(TInt aError)
-{
- Q_UNUSED(aError)
- // This class doesn't use DevSound's format conversion functions, so
- // should never receive this callback.
- Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
-}
-
-void SymbianAudioOutput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg)
-{
- Q_UNUSED(aMessageType)
- Q_UNUSED(aMsg)
- // Ignore this callback.
-}
-
-//-----------------------------------------------------------------------------
-// Private functions
-//-----------------------------------------------------------------------------
-
-void SymbianAudioOutput::dataReady()
-{
- // Client-provided QIODevice has data ready to read.
-
- Q_ASSERT_X(m_source->bytesAvailable(), Q_FUNC_INFO,
- "readyRead signal received, but no data available");
-
- if (!m_bytesPadding)
- pullData();
-}
-
-void SymbianAudioOutput::underflowTimerExpired()
-{
- const TInt samplesPlayed = getSamplesPlayed();
- if (m_samplesPlayed && (samplesPlayed == m_samplesPlayed)) {
- setError(QAudio::UnderrunError);
- } else {
- m_samplesPlayed = samplesPlayed;
- m_underflowTimer->start();
- }
-}
-
-void SymbianAudioOutput::open()
-{
- Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState,
- Q_FUNC_INFO, "DevSound already opened");
-
- QT_TRAP_THROWING( m_devSound.reset(CMMFDevSound::NewL()) )
-
- QScopedPointer<SymbianAudio::DevSoundCapabilities> caps(
- new SymbianAudio::DevSoundCapabilities(*m_devSound,
- QAudio::AudioOutput));
-
- int err = SymbianAudio::Utils::isFormatSupported(m_format, *caps) ?
- KErrNone : KErrNotSupported;
-
- if (KErrNone == err) {
- setState(SymbianAudio::InitializingState);
- TRAP(err, m_devSound->InitializeL(*this, m_nativeFourCC,
- EMMFStatePlaying));
- }
-
- if (KErrNone != err) {
- setError(QAudio::OpenError);
- m_devSound.reset();
- }
-}
-
-void SymbianAudioOutput::startPlayback()
-{
- TRAPD(err, startDevSoundL());
- if (KErrNone == err) {
- if (isDataReady())
- setState(SymbianAudio::ActiveState);
- else
- setState(SymbianAudio::IdleState);
-
- m_notifyTimer->start(m_notifyInterval);
- m_underflow = false;
-
- Q_ASSERT(m_devSound->SamplesPlayed() == 0);
-
- writePaddingData();
-
- if (m_pullMode && m_source->bytesAvailable() && !m_bytesPadding)
- dataReady();
- } else {
- setError(QAudio::OpenError);
- close();
- }
-}
-
-void SymbianAudioOutput::startDevSoundL()
-{
- TMMFCapabilities nativeFormat = m_devSound->Config();
- m_nativeFormat.iBufferSize = nativeFormat.iBufferSize;
- m_devSound->SetConfigL(m_nativeFormat);
- m_devSound->PlayInitL();
-}
-
-void SymbianAudioOutput::writePaddingData()
-{
- // See comments in suspend()
-
- while (m_devSoundBuffer && m_bytesPadding) {
- if (SymbianAudio::IdleState == m_internalState)
- setState(SymbianAudio::ActiveState);
-
- TDes8 &outputBuffer = m_devSoundBuffer->Data();
- const qint64 outputBytes = bytesFree();
- const qint64 paddingBytes = outputBytes < m_bytesPadding ?
- outputBytes : m_bytesPadding;
- unsigned char *ptr = const_cast<unsigned char*>(outputBuffer.Ptr());
- Mem::FillZ(ptr, paddingBytes);
- outputBuffer.SetLength(outputBuffer.Length() + paddingBytes);
- m_bytesPadding -= paddingBytes;
-
- if (m_pullMode && m_source->atEnd())
- lastBufferFilled();
- if (paddingBytes == outputBytes)
- bufferFilled();
- }
-}
-
-qint64 SymbianAudioOutput::pushData(const char *data, qint64 len)
-{
- // Data has been written to SymbianAudioOutputPrivate
-
- Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO,
- "pushData called when in pull mode");
-
- const unsigned char *const inputPtr =
- reinterpret_cast<const unsigned char*>(data);
- qint64 bytesWritten = 0;
-
- if (SymbianAudio::IdleState == m_internalState)
- setState(SymbianAudio::ActiveState);
-
- while (m_devSoundBuffer && (bytesWritten < len)) {
- // writePaddingData() is called from BufferToBeFilled(), so we should
- // never have any padding data left at this point.
- Q_ASSERT_X(0 == m_bytesPadding, Q_FUNC_INFO,
- "Padding bytes remaining in pushData");
-
- TDes8 &outputBuffer = m_devSoundBuffer->Data();
-
- const qint64 outputBytes = bytesFree();
- const qint64 inputBytes = len - bytesWritten;
- const qint64 copyBytes = outputBytes < inputBytes ?
- outputBytes : inputBytes;
-
- outputBuffer.Append(inputPtr + bytesWritten, copyBytes);
- bytesWritten += copyBytes;
-
- bufferFilled();
- }
-
- m_pushDataReady = (bytesWritten < len);
-
- // If DevSound is still initializing (m_internalState == InitializingState),
- // we cannot transition m_internalState to ActiveState, but we must emit
- // an (external) state change from IdleState to ActiveState. The following
- // call triggers this signal.
- setState(m_internalState);
-
- return bytesWritten;
-}
-
-void SymbianAudioOutput::pullData()
-{
- Q_ASSERT_X(m_pullMode, Q_FUNC_INFO,
- "pullData called when in push mode");
-
- if (m_bytesPadding)
- m_bytesPadding = 1;
-
- // writePaddingData() is called by BufferToBeFilled() before pullData(),
- // so we should never have any padding data left at this point.
- Q_ASSERT_X(0 == m_bytesPadding, Q_FUNC_INFO,
- "Padding bytes remaining in pullData");
-
- qint64 inputBytes = m_source->bytesAvailable();
- while (m_devSoundBuffer && inputBytes) {
- if (SymbianAudio::IdleState == m_internalState)
- setState(SymbianAudio::ActiveState);
-
- TDes8 &outputBuffer = m_devSoundBuffer->Data();
-
- const qint64 outputBytes = bytesFree();
- const qint64 copyBytes = outputBytes < inputBytes ?
- outputBytes : inputBytes;
-
- char *outputPtr = (char*)(outputBuffer.Ptr() + outputBuffer.Length());
- const qint64 bytesCopied = m_source->read(outputPtr, copyBytes);
- Q_ASSERT(bytesCopied == copyBytes);
- outputBuffer.SetLength(outputBuffer.Length() + bytesCopied);
- inputBytes -= bytesCopied;
-
- if (m_source->atEnd())
- lastBufferFilled();
- else if (copyBytes == outputBytes)
- bufferFilled();
- }
-}
-
-void SymbianAudioOutput::bufferFilled()
-{
- Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to return");
-
- const TDes8 &outputBuffer = m_devSoundBuffer->Data();
- m_bytesWritten += outputBuffer.Length();
-
- m_devSoundBuffer = 0;
-
- m_samplesPlayed = getSamplesPlayed();
- m_underflowTimer->start();
-
- if (QAudio::UnderrunError == m_error)
- m_error = QAudio::NoError;
-
- m_devSound->PlayData();
-}
-
-void SymbianAudioOutput::lastBufferFilled()
-{
- Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to fill");
- Q_ASSERT_X(!m_lastBuffer, Q_FUNC_INFO, "Last buffer already sent");
- m_lastBuffer = true;
- m_devSoundBuffer->SetLastBuffer(ETrue);
- bufferFilled();
-}
-
-void SymbianAudioOutput::close()
-{
- m_notifyTimer->stop();
- m_underflowTimer->stop();
-
- m_error = QAudio::NoError;
-
- if (m_devSound)
- m_devSound->Stop();
- m_devSound.reset();
- m_devSoundBuffer = 0;
- m_devSoundBufferSize = 0;
-
- if (!m_pullMode) // m_source is owned
- delete m_source;
- m_pullMode = false;
- m_source = 0;
-
- m_bytesWritten = 0;
- m_pushDataReady = false;
- m_bytesPadding = 0;
- m_underflow = false;
- m_lastBuffer = false;
- m_samplesPlayed = 0;
- m_totalSamplesPlayed = 0;
-
- setState(SymbianAudio::ClosedState);
-}
-
-qint64 SymbianAudioOutput::getSamplesPlayed() const
-{
- qint64 result = 0;
- if (m_devSound) {
- const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples(
- m_format, m_bytesWritten);
-
- if (m_underflow) {
- result = samplesWritten;
- } else {
- // This is necessary because some DevSound implementations report
- // that they have played more data than has actually been provided to them
- // by the client.
- const qint64 devSoundSamplesPlayed(m_devSound->SamplesPlayed());
- result = qMin(devSoundSamplesPlayed, samplesWritten);
- }
- }
- return result;
-}
-
-void SymbianAudioOutput::setError(QAudio::Error error)
-{
- m_error = error;
-
- // Although no state transition actually occurs here, a stateChanged event
- // must be emitted to inform the client that the call to start() was
- // unsuccessful.
- if (QAudio::OpenError == error)
- emit stateChanged(QAudio::StoppedState);
-
- if (QAudio::UnderrunError == error)
- setState(SymbianAudio::IdleState);
- else
- // Close the DevSound instance. This causes a transition to
- // StoppedState. This must be done asynchronously in case the
- // current function was called from a DevSound event handler, in which
- // case deleting the DevSound instance may cause an exception.
- QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
-}
-
-void SymbianAudioOutput::setState(SymbianAudio::State newInternalState)
-{
- const QAudio::State oldExternalState = m_externalState;
- m_internalState = newInternalState;
- m_externalState = SymbianAudio::Utils::stateNativeToQt(
- m_internalState, initializingState());
-
- if (m_externalState != oldExternalState)
- emit stateChanged(m_externalState);
-}
-
-bool SymbianAudioOutput::isDataReady() const
-{
- return (m_source && m_source->bytesAvailable())
- || m_bytesPadding
- || m_pushDataReady;
-}
-
-QAudio::State SymbianAudioOutput::initializingState() const
-{
- return isDataReady() ? QAudio::ActiveState : QAudio::IdleState;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/audio/symbian/symbianaudiooutput.h b/src/plugins/audio/symbian/symbianaudiooutput.h
deleted file mode 100644
index 8994e46..0000000
--- a/src/plugins/audio/symbian/symbianaudiooutput.h
+++ /dev/null
@@ -1,199 +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 QtMultimedia 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 SYMBIANAUDIOOUTPUT_H
-#define SYMBIANAUDIOOUTPUT_H
-
-#include <QtMultimedia/qaudioengine.h>
-#include <QTime>
-#include <QTimer>
-#include <sounddevice.h>
-#include "symbianaudio.h"
-
-QT_BEGIN_NAMESPACE
-
-class SymbianAudioOutput;
-
-class SymbianAudioOutputPrivate : public QIODevice
-{
- friend class SymbianAudioOutput;
- Q_OBJECT
-public:
- SymbianAudioOutputPrivate(SymbianAudioOutput *audio);
- ~SymbianAudioOutputPrivate();
-
- qint64 readData(char *data, qint64 len);
- qint64 writeData(const char *data, qint64 len);
-
-private:
- SymbianAudioOutput *const m_audioDevice;
-};
-
-class SymbianAudioOutput
- : public QAbstractAudioOutput
- , public MDevSoundObserver
-{
- friend class SymbianAudioOutputPrivate;
- Q_OBJECT
-public:
- SymbianAudioOutput(const QByteArray &device,
- const QAudioFormat &audioFormat);
- ~SymbianAudioOutput();
-
- // QAbstractAudioOutput
- QIODevice* start(QIODevice *device = 0);
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesFree() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
- QAudioFormat format() const;
-
- // MDevSoundObserver
- void InitializeComplete(TInt aError);
- void ToneFinished(TInt aError);
- void BufferToBeFilled(CMMFBuffer *aBuffer);
- void PlayError(TInt aError);
- void BufferToBeEmptied(CMMFBuffer *aBuffer);
- void RecordError(TInt aError);
- void ConvertError(TInt aError);
- void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg);
-
-private slots:
- void dataReady();
- void underflowTimerExpired();
-
-private:
- void open();
- void startPlayback();
- void startDevSoundL();
- void writePaddingData();
- qint64 pushData(const char *data, qint64 len);
- void pullData();
- void bufferFilled();
- void lastBufferFilled();
- Q_INVOKABLE void close();
-
- qint64 getSamplesPlayed() const;
-
- void setError(QAudio::Error error);
- void setState(SymbianAudio::State state);
-
- bool isDataReady() const;
- QAudio::State initializingState() const;
-
-private:
- const QByteArray m_device;
- const QAudioFormat m_format;
-
- int m_clientBufferSize;
- int m_notifyInterval;
- QScopedPointer<QTimer> m_notifyTimer;
- QTime m_elapsed;
- QAudio::Error m_error;
-
- SymbianAudio::State m_internalState;
- QAudio::State m_externalState;
-
- bool m_pullMode;
- QIODevice *m_source;
-
- QScopedPointer<CMMFDevSound> m_devSound;
- TUint32 m_nativeFourCC;
- TMMFCapabilities m_nativeFormat;
-
- // Buffer provided by DevSound, to be filled with data.
- CMMFDataBuffer *m_devSoundBuffer;
-
- int m_devSoundBufferSize;
-
- // Number of bytes transferred from QIODevice to QAudioOutput. It is
- // necessary to count this because data is dropped when suspend() is
- // called. The difference between the position reported by DevSound and
- // this value allows us to calculate m_bytesPadding;
- quint32 m_bytesWritten;
-
- // True if client has provided data while the audio subsystem was not
- // ready to consume it.
- bool m_pushDataReady;
-
- // Number of zero bytes which will be written when client calls resume().
- quint32 m_bytesPadding;
-
- // True if PlayError(KErrUnderflow) has been called.
- bool m_underflow;
-
- // True if a buffer marked with the "last buffer" flag has been provided
- // to DevSound.
- bool m_lastBuffer;
-
- // Some DevSound implementations ignore all underflow errors raised by the
- // audio driver, unless the last buffer flag has been set by the client.
- // In push-mode playback, this flag will never be set, so the underflow
- // error will never be reported. In order to work around this, a timer
- // is used, which gets reset every time the client provides more data. If
- // the timer expires, an underflow error is raised by this object.
- QScopedPointer<QTimer> m_underflowTimer;
-
- // Result of previous call to CMMFDevSound::SamplesPlayed(). This value is
- // used to determine whether, when m_underflowTimer expires, an
- // underflow error has actually occurred.
- quint32 m_samplesPlayed;
-
- // Samples played up to the last call to suspend(). It is necessary
- // to cache this because suspend() is implemented using
- // CMMFDevSound::Stop(), which resets DevSound's SamplesPlayed() counter.
- quint32 m_totalSamplesPlayed;
-
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/audio/symbian/symbianaudioutils.cpp b/src/plugins/audio/symbian/symbianaudioutils.cpp
deleted file mode 100644
index f04c198..0000000
--- a/src/plugins/audio/symbian/symbianaudioutils.cpp
+++ /dev/null
@@ -1,395 +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 QtMultimedia 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 "symbianaudioutils.h"
-#include <mmffourcc.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace SymbianAudio {
-
-DevSoundCapabilities::DevSoundCapabilities(CMMFDevSound &devsound,
- QAudio::Mode mode)
-{
- QT_TRAP_THROWING(constructL(devsound, mode));
-}
-
-DevSoundCapabilities::~DevSoundCapabilities()
-{
- m_fourCC.Close();
-}
-
-void DevSoundCapabilities::constructL(CMMFDevSound &devsound,
- QAudio::Mode mode)
-{
- m_caps = devsound.Capabilities();
-
- TMMFPrioritySettings settings;
-
- switch (mode) {
- case QAudio::AudioOutput:
- settings.iState = EMMFStatePlaying;
- devsound.GetSupportedInputDataTypesL(m_fourCC, settings);
- break;
-
- case QAudio::AudioInput:
- settings.iState = EMMFStateRecording;
- devsound.GetSupportedInputDataTypesL(m_fourCC, settings);
- break;
-
- default:
- Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
- }
-}
-
-namespace Utils {
-
-//-----------------------------------------------------------------------------
-// Static data
-//-----------------------------------------------------------------------------
-
-// Sample rate / frequency
-
-typedef TMMFSampleRate SampleRateNative;
-typedef int SampleRateQt;
-
-const int SampleRateCount = 12;
-
-const SampleRateNative SampleRateListNative[SampleRateCount] = {
- EMMFSampleRate8000Hz
- , EMMFSampleRate11025Hz
- , EMMFSampleRate12000Hz
- , EMMFSampleRate16000Hz
- , EMMFSampleRate22050Hz
- , EMMFSampleRate24000Hz
- , EMMFSampleRate32000Hz
- , EMMFSampleRate44100Hz
- , EMMFSampleRate48000Hz
- , EMMFSampleRate64000Hz
- , EMMFSampleRate88200Hz
- , EMMFSampleRate96000Hz
-};
-
-const SampleRateQt SampleRateListQt[SampleRateCount] = {
- 8000
- , 11025
- , 12000
- , 16000
- , 22050
- , 24000
- , 32000
- , 44100
- , 48000
- , 64000
- , 88200
- , 96000
-};
-
-// Channels
-
-typedef TMMFMonoStereo ChannelsNative;
-typedef int ChannelsQt;
-
-const int ChannelsCount = 2;
-
-const ChannelsNative ChannelsListNative[ChannelsCount] = {
- EMMFMono
- , EMMFStereo
-};
-
-const ChannelsQt ChannelsListQt[ChannelsCount] = {
- 1
- , 2
-};
-
-// Encoding
-
-const int EncodingCount = 6;
-
-const TUint32 EncodingFourCC[EncodingCount] = {
- KMMFFourCCCodePCM8 // 0
- , KMMFFourCCCodePCMU8 // 1
- , KMMFFourCCCodePCM16 // 2
- , KMMFFourCCCodePCMU16 // 3
- , KMMFFourCCCodePCM16B // 4
- , KMMFFourCCCodePCMU16B // 5
-};
-
-// The characterised DevSound API specification states that the iEncoding
-// field in TMMFCapabilities is ignored, and that the FourCC should be used
-// to specify the PCM encoding.
-// See "SGL.GT0287.102 Multimedia DevSound Baseline Compatibility.doc" in the
-// mm_info/mm_docs repository.
-const TMMFSoundEncoding EncodingNative[EncodingCount] = {
- EMMFSoundEncoding16BitPCM // 0
- , EMMFSoundEncoding16BitPCM // 1
- , EMMFSoundEncoding16BitPCM // 2
- , EMMFSoundEncoding16BitPCM // 3
- , EMMFSoundEncoding16BitPCM // 4
- , EMMFSoundEncoding16BitPCM // 5
-};
-
-
-const int EncodingSampleSize[EncodingCount] = {
- 8 // 0
- , 8 // 1
- , 16 // 2
- , 16 // 3
- , 16 // 4
- , 16 // 5
-};
-
-const QAudioFormat::Endian EncodingByteOrder[EncodingCount] = {
- QAudioFormat::LittleEndian // 0
- , QAudioFormat::LittleEndian // 1
- , QAudioFormat::LittleEndian // 2
- , QAudioFormat::LittleEndian // 3
- , QAudioFormat::BigEndian // 4
- , QAudioFormat::BigEndian // 5
-};
-
-const QAudioFormat::SampleType EncodingSampleType[EncodingCount] = {
- QAudioFormat::SignedInt // 0
- , QAudioFormat::UnSignedInt // 1
- , QAudioFormat::SignedInt // 2
- , QAudioFormat::UnSignedInt // 3
- , QAudioFormat::SignedInt // 4
- , QAudioFormat::UnSignedInt // 5
-};
-
-
-//-----------------------------------------------------------------------------
-// Private functions
-//-----------------------------------------------------------------------------
-
-// Helper functions for implementing parameter conversions
-
-template<typename Input>
-bool findValue(const Input *inputArray, int length, Input input, int &index) {
- bool result = false;
- for (int i=0; !result && i<length; ++i)
- if (inputArray[i] == input) {
- index = i;
- result = true;
- }
- return result;
-}
-
-template<typename Input, typename Output>
-bool convertValue(const Input *inputArray, const Output *outputArray,
- int length, Input input, Output &output) {
- int index;
- const bool result = findValue<Input>(inputArray, length, input, index);
- if (result)
- output = outputArray[index];
- return result;
-}
-
-/**
- * Macro which is used to generate the implementation of the conversion
- * functions. The implementation is just a wrapper around the templated
- * convertValue function, e.g.
- *
- * CONVERSION_FUNCTION_IMPL(SampleRate, Qt, Native)
- *
- * expands to
- *
- * bool SampleRateQtToNative(int input, TMMFSampleRate &output) {
- * return convertValue<SampleRateQt, SampleRateNative>
- * (SampleRateListQt, SampleRateListNative, SampleRateCount,
- * input, output);
- * }
- */
-#define CONVERSION_FUNCTION_IMPL(FieldLc, Field, Input, Output) \
-bool FieldLc##Input##To##Output(Field##Input input, Field##Output &output) { \
- return convertValue<Field##Input, Field##Output>(Field##List##Input, \
- Field##List##Output, Field##Count, input, output); \
-}
-
-//-----------------------------------------------------------------------------
-// Local helper functions
-//-----------------------------------------------------------------------------
-
-CONVERSION_FUNCTION_IMPL(sampleRate, SampleRate, Qt, Native)
-CONVERSION_FUNCTION_IMPL(sampleRate, SampleRate, Native, Qt)
-CONVERSION_FUNCTION_IMPL(channels, Channels, Qt, Native)
-CONVERSION_FUNCTION_IMPL(channels, Channels, Native, Qt)
-
-bool sampleInfoQtToNative(int inputSampleSize,
- QAudioFormat::Endian inputByteOrder,
- QAudioFormat::SampleType inputSampleType,
- TUint32 &outputFourCC,
- TMMFSoundEncoding &outputEncoding) {
-
- bool found = false;
-
- for (int i=0; i<EncodingCount && !found; ++i) {
- if ( EncodingSampleSize[i] == inputSampleSize
- && EncodingByteOrder[i] == inputByteOrder
- && EncodingSampleType[i] == inputSampleType) {
- outputFourCC = EncodingFourCC[i];
- outputEncoding = EncodingNative[i]; // EMMFSoundEncoding16BitPCM
- found = true;
- }
- }
-
- return found;
-}
-
-//-----------------------------------------------------------------------------
-// Public functions
-//-----------------------------------------------------------------------------
-
-void capabilitiesNativeToQt(const DevSoundCapabilities &caps,
- QList<int> &frequencies,
- QList<int> &channels,
- QList<int> &sampleSizes,
- QList<QAudioFormat::Endian> &byteOrders,
- QList<QAudioFormat::SampleType> &sampleTypes) {
-
- frequencies.clear();
- sampleSizes.clear();
- byteOrders.clear();
- sampleTypes.clear();
- channels.clear();
-
- for (int i=0; i<SampleRateCount; ++i)
- if (caps.caps().iRate & SampleRateListNative[i])
- frequencies += SampleRateListQt[i];
-
- for (int i=0; i<ChannelsCount; ++i)
- if (caps.caps().iChannels & ChannelsListNative[i])
- channels += ChannelsListQt[i];
-
- for (int i=0; i<EncodingCount; ++i) {
- if (caps.fourCC().Find(EncodingFourCC[i]) != KErrNotFound) {
- sampleSizes += EncodingSampleSize[i];
- byteOrders += EncodingByteOrder[i];
- sampleTypes += EncodingSampleType[i];
- }
- }
-
-}
-
-bool isFormatSupported(const QAudioFormat &formatQt,
- const DevSoundCapabilities &caps) {
- TMMFCapabilities formatNative;
- TUint32 fourCC;
-
- bool result = false;
- if (formatQt.codec() == "audio/pcm" &&
- formatQtToNative(formatQt, fourCC, formatNative)) {
- result =
- (formatNative.iRate & caps.caps().iRate)
- && (formatNative.iChannels & caps.caps().iChannels)
- && (caps.fourCC().Find(fourCC) != KErrNotFound);
- }
- return result;
-}
-
-bool formatQtToNative(const QAudioFormat &inputFormat,
- TUint32 &outputFourCC,
- TMMFCapabilities &outputFormat) {
-
- bool result = false;
-
- // Need to use temporary variables because TMMFCapabilities fields are all
- // TInt, rather than MMF enumerated types.
- TMMFSampleRate outputSampleRate;
- TMMFMonoStereo outputChannels;
- TMMFSoundEncoding outputEncoding;
-
- if (inputFormat.codec() == "audio/pcm") {
- result =
- sampleRateQtToNative(inputFormat.frequency(), outputSampleRate)
- && channelsQtToNative(inputFormat.channels(), outputChannels)
- && sampleInfoQtToNative(inputFormat.sampleSize(),
- inputFormat.byteOrder(),
- inputFormat.sampleType(),
- outputFourCC,
- outputEncoding);
- }
-
- if (result) {
- outputFormat.iRate = outputSampleRate;
- outputFormat.iChannels = outputChannels;
- outputFormat.iEncoding = outputEncoding;
- }
-
- return result;
-}
-
-QAudio::State stateNativeToQt(State nativeState,
- QAudio::State initializingState)
-{
- switch (nativeState) {
- case ClosedState:
- return QAudio::StoppedState;
- case InitializingState:
- return initializingState;
- case ActiveState:
- return QAudio::ActiveState;
- case IdleState:
- return QAudio::IdleState;
- case SuspendedState:
- return QAudio::SuspendedState;
- default:
- Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid state");
- return QAudio::StoppedState; // suppress compiler warning
- }
-}
-
-qint64 bytesToSamples(const QAudioFormat &format, qint64 length)
-{
- return length / ((format.sampleSize() / 8) * format.channels());
-}
-
-qint64 samplesToBytes(const QAudioFormat &format, qint64 samples)
-{
- return samples * (format.sampleSize() / 8) * format.channels();
-}
-
-} // namespace Utils
-} // namespace SymbianAudio
-
-QT_END_NAMESPACE
-
-
diff --git a/src/plugins/audio/symbian/symbianaudioutils.h b/src/plugins/audio/symbian/symbianaudioutils.h
deleted file mode 100644
index 53274e0..0000000
--- a/src/plugins/audio/symbian/symbianaudioutils.h
+++ /dev/null
@@ -1,125 +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 QtMultimedia 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 SYMBIANAUDIOUTILS_H
-#define SYMBIANAUDIOUTILS_H
-
-#include <QtCore/qnamespace.h>
-#include <QtMultimedia/qaudioformat.h>
-#include <QtMultimedia/qaudio.h>
-#include <sounddevice.h>
-#include "symbianaudio.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace SymbianAudio {
-
-/*
- * Helper class for querying DevSound codec / format support
- */
-class DevSoundCapabilities {
-public:
- DevSoundCapabilities(CMMFDevSound &devsound, QAudio::Mode mode);
- ~DevSoundCapabilities();
-
- const RArray<TFourCC>& fourCC() const { return m_fourCC; }
- const TMMFCapabilities& caps() const { return m_caps; }
-
-private:
- void constructL(CMMFDevSound &devsound, QAudio::Mode mode);
-
-private:
- RArray<TFourCC> m_fourCC;
- TMMFCapabilities m_caps;
-};
-
-namespace Utils {
-
-/**
- * Convert native audio capabilities to QAudio lists.
- */
-void capabilitiesNativeToQt(const DevSoundCapabilities &caps,
- QList<int> &frequencies,
- QList<int> &channels,
- QList<int> &sampleSizes,
- QList<QAudioFormat::Endian> &byteOrders,
- QList<QAudioFormat::SampleType> &sampleTypes);
-
-/**
- * Check whether format is supported.
- */
-bool isFormatSupported(const QAudioFormat &format,
- const DevSoundCapabilities &caps);
-
-/**
- * Convert QAudioFormat to native format types.
- *
- * Note that, despite the name, DevSound uses TMMFCapabilities to specify
- * single formats as well as capabilities.
- *
- * Note that this function does not modify outputFormat.iBufferSize.
- */
-bool formatQtToNative(const QAudioFormat &inputFormat,
- TUint32 &outputFourCC,
- TMMFCapabilities &outputFormat);
-
-/**
- * Convert internal states to QAudio states.
- */
-QAudio::State stateNativeToQt(State nativeState,
- QAudio::State initializingState);
-
-/**
- * Convert data length to number of samples.
- */
-qint64 bytesToSamples(const QAudioFormat &format, qint64 length);
-
-/**
- * Convert number of samples to data length.
- */
-qint64 samplesToBytes(const QAudioFormat &format, qint64 samples);
-
-} // namespace Utils
-} // namespace SymbianAudio
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index a67c8f6..00be80e 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-!maemo:contains(QT_CONFIG, dbus):contains(QT_CONFIG, networkmanager) {
+!maemo6:contains(QT_CONFIG, dbus) {
SUBDIRS += networkmanager generic
}
#win32:SUBDIRS += nla
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index cbaa9d6..76574a8 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -68,7 +68,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
@@ -90,14 +90,21 @@ private:
QMap<QString, QString> configurationInterface;
QStringList scanForSsids(const QString &interfaceName);
- bool isKnownSsid(const QString &interfaceName, const QString &ssid);
+ bool isKnownSsid(const QString &ssid);
QList<QNetworkConfigurationPrivate *> foundConfigurations;
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
- void startNetworkChangeLoop();
+ bool hasWifi;
+
+protected:
+ QMap<QString, QMap<QString,QString> > userProfiles;
+ void startNetworkChangeLoop();
+ void getUserConfigurations();
+ QString getNetworkNameFromSsid(const QString &ssid);
+ QString getSsidFromNetworkName(const QString &name);
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index cb278d9..60c6fbd 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -50,13 +50,11 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
-
-#if defined(MAC_SDK_10_6) //not much functionality without this
+#include <QDir>
#include <CoreWLAN/CoreWLAN.h>
#include <CoreWLAN/CWInterface.h>
#include <CoreWLAN/CWNetwork.h>
#include <CoreWLAN/CWNetwork.h>
-#endif
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSKeyValueObserving.h>
@@ -69,16 +67,14 @@
QMap <QString, QString> networkInterfaces;
-#ifdef MAC_SDK_10_6
@interface QNSListener : NSObject
{
NSNotificationCenter *center;
CWInterface *currentInterface;
QCoreWlanEngine *engine;
- NSAutoreleasePool *autoreleasepool;
NSLock *locker;
}
-- (void)notificationHandler:(NSNotification *)notification;
+- (void)notificationHandler;//:(NSNotification *)notification;
- (void)remove;
- (void)setEngine:(QCoreWlanEngine *)coreEngine;
- (void)dealloc;
@@ -91,7 +87,7 @@ QMap <QString, QString> networkInterfaces;
- (id) init
{
[locker lock];
- autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QMacCocoaAutoReleasePool pool;
center = [NSNotificationCenter defaultCenter];
currentInterface = [CWInterface interface];
// [center addObserver:self selector:@selector(notificationHandler:) name:kCWLinkDidChangeNotification object:nil];
@@ -102,7 +98,6 @@ QMap <QString, QString> networkInterfaces;
-(void)dealloc
{
- [autoreleasepool release];
[super dealloc];
}
@@ -121,7 +116,7 @@ QMap <QString, QString> networkInterfaces;
[locker unlock];
}
-- (void)notificationHandler:(NSNotification *)notification
+- (void)notificationHandler//:(NSNotification *)notification
{
engine->requestUpdate();
}
@@ -129,14 +124,12 @@ QMap <QString, QString> networkInterfaces;
QNSListener *listener = 0;
-#endif
-
QT_BEGIN_NAMESPACE
static QString qGetInterfaceType(const QString &interfaceString)
{
- return networkInterfaces.value(interfaceString, QLatin1String("Unknown"));
+ return networkInterfaces.value(interfaceString, QLatin1String("WLAN"));
}
void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info)
@@ -157,22 +150,23 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
{
startNetworkChangeLoop();
-#if defined(MAC_SDK_10_6)
- if(!listener) {
+ QMacCocoaAutoReleasePool pool;
+ if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
listener = [[QNSListener alloc] init];
listener.engine = this;
+ hasWifi = true;
+ } else {
+ hasWifi = false;
}
-#endif
+ requestUpdate();
}
QCoreWlanEngine::~QCoreWlanEngine()
{
while (!foundConfigurations.isEmpty())
delete foundConfigurations.takeFirst();
-#if defined(MAC_SDK_10_6)
[listener remove];
[listener release];
-#endif
}
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
@@ -192,73 +186,88 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id)
void QCoreWlanEngine::connectToId(const QString &id)
{
QMutexLocker locker(&mutex);
-
- NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ QMacCocoaAutoReleasePool pool;
QString interfaceString = getInterfaceFromId(id);
if(networkInterfaces.value(interfaceString) == "WLAN") {
-#if defined(MAC_SDK_10_6)
CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)];
- CWConfiguration *userConfig = [ wifiInterface configuration];
- NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile
-
- NSEnumerator *enumerator = [remNets objectEnumerator];
- CWWirelessProfile *wProfile;
- NSUInteger index=0;
- NSDictionary *parametersDict;
- NSArray* apArray;
-
- CW8021XProfile *user8021XProfile;
- NSError *err;
- NSMutableDictionary *params;
+ if([wifiInterface power]) {
+ NSError *err = nil;
+ NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
+
+ NSString *wantedSsid = 0;
+ bool okToProceed = true;
+ if(getNetworkNameFromSsid(id) != id) {
+ NSArray *array = [CW8021XProfile allUser8021XProfiles];
+ for (NSUInteger i=0; i<[array count]; ++i) {
+ const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName])));
+ const QString idCheck2 = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
+
+ if(id == idCheck
+ || id == idCheck2) {
+ QString thisName = getSsidFromNetworkName(id);
+ if(thisName.isEmpty()) {
+ wantedSsid = qt_mac_QStringToNSString(id);
+ } else {
+ wantedSsid = qt_mac_QStringToNSString(thisName);
+ }
+ okToProceed = false;
+ [params setValue: [array objectAtIndex:i] forKey:kCWAssocKey8021XProfile];
+ break;
+ }
+ }
+ }
- while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile
+ if(okToProceed) {
+ NSUInteger index = 0;
- if(id == QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([wProfile ssid])))) {
- user8021XProfile = nil;
- user8021XProfile = [ wProfile user8021XProfile];
+ CWConfiguration *userConfig = [ wifiInterface configuration];
+ NSSet *remNets = [userConfig rememberedNetworks];
+ NSEnumerator *enumerator = [remNets objectEnumerator];
+ CWWirelessProfile *wProfile;
- err = nil;
- params = [NSMutableDictionary dictionaryWithCapacity:0];
+ while ((wProfile = [enumerator nextObject])) {
+ const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([wProfile ssid])));
- if(user8021XProfile) {
- [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile];
- } else {
- [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase];
+ if(id == idCheck) {
+ wantedSsid = [wProfile ssid];
+ [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase];
+ break;
+ }
+ index++;
}
+ }
- 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];
- if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) {
+ NSDictionary *parametersDict = nil;
+ NSArray *apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]];
- bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
+ if(!err) {
+ for(uint row=0; row < [apArray count]; row++ ) {
+ CWNetwork *apNetwork = [apArray objectAtIndex:row];
+ if([[apNetwork ssid] compare:wantedSsid] == NSOrderedSame) {
+ bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
- if(!result) {
- emit connectionError(id, ConnectError);
- } else {
- [autoreleasepool release];
- return;
- }
+ if(!result) {
+ emit connectionError(id, ConnectError);
+ } else {
+ return;
}
}
}
+ } else {
+ qDebug() <<"ERROR"<< qt_mac_NSStringToQString([err localizedDescription ]);
}
- index++;
- }
+ emit connectionError(id, InterfaceLookupError);
+ } else {
+ // not wifi
+ }
+ locker.unlock();
emit connectionError(id, InterfaceLookupError);
-#endif
- } else {
- // not wifi
+ locker.relock();
}
emit connectionError(id, OperationNotSupported);
- [autoreleasepool release];
}
void QCoreWlanEngine::disconnectFromId(const QString &id)
@@ -268,25 +277,27 @@ 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];
+ QMacCocoaAutoReleasePool pool;
CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceString)];
[wifiInterface disassociate];
if([[wifiInterface interfaceState]intValue] != kCWInterfaceStateInactive) {
+ locker.unlock();
emit connectionError(id, DisconnectionError);
+ locker.relock();
}
- [autoreleasepool release];
return;
#endif
} else {
}
+
+ locker.unlock();
emit connectionError(id, OperationNotSupported);
}
void QCoreWlanEngine::requestUpdate()
{
- QMutexLocker locker(&mutex);
-
+ getUserConfigurations();
doRequestUpdate();
}
@@ -340,6 +351,8 @@ void QCoreWlanEngine::doRequestUpdate()
bool changed = false;
+ ptr->mutex.lock();
+
if (!ptr->isValid) {
ptr->isValid = true;
changed = true;
@@ -360,8 +373,13 @@ void QCoreWlanEngine::doRequestUpdate()
changed = true;
}
- if (changed)
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ }
}
}
@@ -369,9 +387,13 @@ void QCoreWlanEngine::doRequestUpdate()
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(previous.takeFirst());
configurationInterface.remove(ptr->id);
+
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
+ locker.unlock();
emit updateCompleted();
}
@@ -381,16 +403,20 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
QStringList found;
-#if defined(MAC_SDK_10_6)
- QMacCocoaAutoReleasePool pool;
+ if(!hasWifi) {
+ return found;
+ }
+ QMacCocoaAutoReleasePool pool;
CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
+ QStringList addedConfigs;
+
if([currentInterface power]) {
NSError *err = nil;
NSDictionary *parametersDict = nil;
NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
-
CWNetwork *apNetwork;
+
if (!err) {
for(uint row=0; row < [apArray count]; row++ ) {
@@ -402,15 +428,18 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
found.append(id);
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
-
- if ([currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- if (networkSsid == qt_mac_NSStringToQString([currentInterface ssid]))
+ bool known = isKnownSsid(networkSsid);
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( networkSsid == qt_mac_NSStringToQString( [currentInterface ssid])) {
state = QNetworkConfiguration::Active;
- } else {
- if (isKnownSsid(interfaceName, networkSsid))
+ }
+ }
+ if(state == QNetworkConfiguration::Undefined) {
+ if(known) {
state = QNetworkConfiguration::Discovered;
- else
- state = QNetworkConfiguration::Defined;
+ } else {
+ state = QNetworkConfiguration::Undefined;
+ }
}
if (accessPointConfigurations.contains(id)) {
@@ -418,6 +447,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
bool changed = false;
+ ptr->mutex.lock();
+
if (!ptr->isValid) {
ptr->isValid = true;
changed = true;
@@ -438,11 +469,18 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
changed = true;
}
- if (changed)
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ }
+ addedConfigs << networkSsid;
} else {
QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
+ found.append(id);
ptr->name = networkSsid;
ptr->isValid = true;
ptr->id = id;
@@ -450,17 +488,60 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
ptr->type = QNetworkConfiguration::InternetAccessPoint;
ptr->bearer = QLatin1String("WLAN");
- accessPointConfigurations.insert(id, ptr);
- configurationInterface.insert(id, interfaceName);
+ accessPointConfigurations.insert(ptr->id, ptr);
+ configurationInterface.insert(ptr->id, interfaceName);
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
+ addedConfigs << networkSsid;
}
}
}
}
-#else
- Q_UNUSED(interfaceName);
-#endif
+
+ // add known configurations that are not around.
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QString networkName = i.key();
+ if(!addedConfigs.contains(networkName)) {
+ QString interfaceName;
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ interfaceName = ij.value();
+ }
+ QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
+ const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkName));
+ found.append(id);
+
+ ptr->name = networkName;
+ ptr->isValid = true;
+ ptr->id = id;
+ ptr->bearer = QLatin1String("WLAN");
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ QString ssid = getSsidFromNetworkName(networkName);
+
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( ssid == qt_mac_NSStringToQString([currentInterface ssid])) {
+ ptr->state = QNetworkConfiguration::Active;
+ }
+ }
+
+ if(!ptr->state) {
+ if( addedConfigs.contains(ssid)) {
+ ptr->state = QNetworkConfiguration::Discovered;
+ }
+ }
+
+ if(!ptr->state) {
+ ptr->state = QNetworkConfiguration::Defined;
+ }
+ accessPointConfigurations.insert(ptr->id, ptr);
+ configurationInterface.insert(ptr->id, interfaceName);
+ }
+ }
return found;
}
@@ -468,32 +549,27 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
{
QMutexLocker locker(&mutex);
-#if defined(MAC_SDK_10_6)
- CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)];
- if([defaultInterface power])
- return true;
-#else
- Q_UNUSED(wifiDeviceName);
-#endif
+ if(hasWifi) {
+ QMacCocoaAutoReleasePool pool;
+ CWInterface *defaultInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(wifiDeviceName)];
+ if([defaultInterface power])
+ return true;
+ }
return false;
}
-bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &ssid)
+bool QCoreWlanEngine::isKnownSsid(const QString &ssid)
{
QMutexLocker locker(&mutex);
-#if defined(MAC_SDK_10_6)
- CWInterface *wifiInterface = [CWInterface interfaceWithName: qt_mac_QStringToNSString(interfaceName)];
- CWConfiguration *userConfig = [wifiInterface configuration];
- NSSet *remNets = [userConfig rememberedNetworks];
- for (CWWirelessProfile *wProfile in remNets) {
- if(ssid == qt_mac_NSStringToQString([wProfile ssid]))
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ if(map.keys().contains(ssid)) {
return true;
+ }
}
-#else
- Q_UNUSED(interfaceName);
- Q_UNUSED(ssid);
-#endif
return false;
}
@@ -508,7 +584,6 @@ bool QCoreWlanEngine::getWifiInterfaces()
for(uint row=0; row < [wifiInterfaces count]; row++ ) {
networkInterfaces.insert( qt_mac_NSStringToQString([wifiInterfaces objectAtIndex:row]),"WLAN");
}
-
return true;
}
@@ -612,4 +687,109 @@ bool QCoreWlanEngine::requiresPolling() const
return true;
}
+QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
+{
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") +i.key()));
+ if(name == i.key() || name == idCheck) {
+ return ij.key();
+ }
+ }
+ }
+ return QString();
+}
+
+QString QCoreWlanEngine::getNetworkNameFromSsid(const QString &ssid)
+{
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ if(ij.key() == ssid) {
+ return i.key();
+ }
+
+ }
+ return map.key(ssid);
+ }
+ return QString();
+}
+
+
+void QCoreWlanEngine::getUserConfigurations()
+{
+ QMacCocoaAutoReleasePool pool;
+ userProfiles.clear();
+
+ NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
+ for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
+
+// add user configured system networks
+ SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
+ CFDictionaryRef airportPlist = (const __CFDictionary*)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", [wifiInterface name]]);
+ CFRelease(dynRef);
+
+ NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+
+ NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
+ for(NSString *ssidkey in thisSsidarray) {
+ QString thisSsid = qt_mac_NSStringToQString(ssidkey);
+ if(!userProfiles.contains(thisSsid)) {
+ QMap <QString,QString> map;
+ map.insert(thisSsid, qt_mac_NSStringToQString([wifiInterface name]));
+ userProfiles.insert(thisSsid, map);
+ }
+ }
+ CFRelease(airportPlist);
+
+ // 802.1X user profiles
+ QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
+ NSDictionary* eapDict = [[NSMutableDictionary alloc] initWithContentsOfFile:qt_mac_QStringToNSString(userProfilePath)];
+ NSString *profileStr= @"Profiles";
+ NSString *nameStr = @"UserDefinedName";
+ NSString *networkSsidStr = @"Wireless Network";
+ for (id profileKey in eapDict) {
+ if ([profileStr isEqualToString:profileKey]) {
+ NSDictionary *itemDict = [eapDict objectForKey:profileKey];
+ for (id itemKey in itemDict) {
+
+ NSInteger dictSize = [itemKey count];
+ id objects[dictSize];
+ id keys[dictSize];
+
+ [itemKey getObjects:objects andKeys:keys];
+ QString networkName;
+ QString ssid;
+ for(int i = 0; i < dictSize; i++) {
+ if([nameStr isEqualToString:keys[i]]) {
+ networkName = qt_mac_NSStringToQString(objects[i]);
+ }
+ if([networkSsidStr isEqualToString:keys[i]]) {
+ ssid = qt_mac_NSStringToQString(objects[i]);
+ }
+ if(!userProfiles.contains(networkName)
+ && !ssid.isEmpty()) {
+ QMap<QString,QString> map;
+ map.insert(ssid, qt_mac_NSStringToQString([wifiInterface name]));
+ userProfiles.insert(networkName, map);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index a9e78b2..dfc74f2 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -50,6 +50,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
+#include <QtCore/private/qcoreapplication_p.h>
#ifdef Q_OS_WIN
#include "../platformdefs_win.h"
@@ -174,8 +175,6 @@ void QGenericEngine::disconnectFromId(const QString &id)
void QGenericEngine::requestUpdate()
{
- QMutexLocker locker(&mutex);
-
doRequestUpdate();
}
@@ -231,6 +230,8 @@ void QGenericEngine::doRequestUpdate()
bool changed = false;
+ ptr->mutex.lock();
+
if (!ptr->isValid) {
ptr->isValid = true;
changed = true;
@@ -251,8 +252,13 @@ void QGenericEngine::doRequestUpdate()
changed = true;
}
- if (changed)
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ }
} else {
QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
@@ -266,7 +272,9 @@ void QGenericEngine::doRequestUpdate()
accessPointConfigurations.insert(id, ptr);
configurationInterface.insert(id, interface.name());
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
}
}
@@ -275,9 +283,13 @@ void QGenericEngine::doRequestUpdate()
accessPointConfigurations.take(previous.takeFirst());
configurationInterface.remove(ptr->id);
+
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
+ locker.unlock();
emit updateCompleted();
}
@@ -290,6 +302,8 @@ QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id)
if (!ptr)
return QNetworkSession::Invalid;
+ QMutexLocker configLocker(&ptr->mutex);
+
if (!ptr->isValid) {
return QNetworkSession::Invalid;
} else if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index a1b9167..616a3fd 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -68,7 +68,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index 5e506ef..5e9dc0a 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -180,7 +180,10 @@ void QIcdEngine::doRequestUpdate()
ptr->roamingSupported = false;
userChoiceConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
}
/* We return currently configured IAPs in the first run and do the WLAN
@@ -241,7 +244,10 @@ void QIcdEngine::doRequestUpdate()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(iap_id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("IAP: %s, name: %s, ssid: %s, added to known list",
@@ -299,6 +305,8 @@ void QIcdEngine::doRequestUpdate()
bool changed = false;
+ ptr->mutex.lock();
+
if (!ptr->isValid) {
ptr->isValid = true;
changed = true;
@@ -319,8 +327,13 @@ void QIcdEngine::doRequestUpdate()
iapid.toAscii().data(), scanned_ssid.data());
#endif
- if (changed)
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ }
if (!ap.scan.network_type.startsWith("WLAN"))
continue; // not a wlan AP
@@ -354,7 +367,10 @@ void QIcdEngine::doRequestUpdate()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
}
}
}
@@ -363,11 +379,15 @@ void QIcdEngine::doRequestUpdate()
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(previous.takeFirst());
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
- if (sender())
+ if (sender()) {
+ locker.unlock();
emit updateCompleted();
+ }
}
void QIcdEngine::deleteConfiguration(const QString &iap_id)
@@ -384,6 +404,7 @@ void QIcdEngine::deleteConfiguration(const QString &iap_id)
qDebug() << "IAP" << iap_id << "was removed from storage.";
#endif
+ locker.unlock();
emit configurationRemoved(ptr);
} else {
#ifdef BEARER_MANAGEMENT_DEBUG
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
index 6ebe40d..50cda62 100644
--- a/src/plugins/bearer/icd/qicdengine.h
+++ b/src/plugins/bearer/icd/qicdengine.h
@@ -86,7 +86,7 @@ public:
bool hasIdentifier(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp
index bb81408..a2ae65c 100644
--- a/src/plugins/bearer/icd/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp
@@ -312,19 +312,42 @@ void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState)
state = newState;
if (state == QNetworkSession::Disconnected) {
- isOpen = false;
+ isOpen = false;
currentNetworkInterface.clear();
- if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- privateConfiguration(activeConfig)->state = QNetworkConfiguration::Defined;
- privateConfiguration(publicConfig)->state = QNetworkConfiguration::Defined;
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(activeConfig));
+
+ icdConfig->mutex.lock();
+ icdConfig->state = QNetworkConfiguration::Defined;
+ icdConfig->mutex.unlock();
+ }
+
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(publicConfig));
+
+ icdConfig->mutex.lock();
+ icdConfig->state = QNetworkConfiguration::Defined;
+ icdConfig->mutex.unlock();
} else if (state == QNetworkSession::Connected) {
- isOpen = true;
+ isOpen = true;
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- privateConfiguration(activeConfig)->state = QNetworkConfiguration::Active;
- privateConfiguration(activeConfig)->type = QNetworkConfiguration::InternetAccessPoint;
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(activeConfig));
+
+ icdConfig->mutex.lock();
+ icdConfig->state = QNetworkConfiguration::Active;
+ icdConfig->type = QNetworkConfiguration::InternetAccessPoint;
+ icdConfig->mutex.unlock();
}
- privateConfiguration(publicConfig)->state = QNetworkConfiguration::Active;
+
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(publicConfig));
+
+ icdConfig->mutex.lock();
+ icdConfig->state = QNetworkConfiguration::Active;
+ icdConfig->mutex.unlock();
}
emit stateChanged(newState);
@@ -334,13 +357,22 @@ void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState)
void QNetworkSessionPrivateImpl::updateIdentifier(QString &newId)
{
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- toIcdConfig(privateConfiguration(activeConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME;
- privateConfiguration(activeConfig)->id = newId;
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(activeConfig));
+
+ icdConfig->mutex.lock();
+ icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
+ icdConfig->id = newId;
+ icdConfig->mutex.unlock();
} else {
- toIcdConfig(privateConfiguration(publicConfig))->network_attrs |= ICD_NW_ATTR_IAPNAME;
- if (privateConfiguration(publicConfig)->id != newId) {
- privateConfiguration(publicConfig)->id = newId;
- }
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(publicConfig));
+
+ icdConfig->mutex.lock();
+ icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
+ if (icdConfig->id != newId)
+ icdConfig->id = newId;
+ icdConfig->mutex.unlock();
}
}
@@ -368,10 +400,15 @@ quint64 QNetworkSessionPrivateImpl::getStatistics(bool sent) const
}
} 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;
+ IcdNetworkConfigurationPrivate *icdConfig =
+ toIcdConfig(privateConfiguration(activeConfig));
+
+ icdConfig->mutex.lock();
+ if (res.params.network_id == icdConfig->network_id) {
+ counter_tx = res.bytes_sent;
+ counter_rx = res.bytes_received;
}
+ icdConfig->mutex.unlock();
}
}
@@ -413,20 +450,25 @@ QNetworkConfiguration& QNetworkSessionPrivateImpl::copyConfig(QNetworkConfigurat
cpPriv = toIcdConfig(privateConfiguration(toConfig));
}
- cpPriv->name = privateConfiguration(fromConfig)->name;
- cpPriv->isValid = privateConfiguration(fromConfig)->isValid;
+ IcdNetworkConfigurationPrivate *fromPriv = toIcdConfig(privateConfiguration(fromConfig));
+
+ QMutexLocker toLocker(&cpPriv->mutex);
+ QMutexLocker fromLocker(&fromPriv->mutex);
+
+ cpPriv->name = fromPriv->name;
+ cpPriv->isValid = fromPriv->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;
+ cpPriv->state = fromPriv->state;
+ cpPriv->type = fromPriv->type;
+ cpPriv->roamingSupported = fromPriv->roamingSupported;
+ cpPriv->purpose = fromPriv->purpose;
+ cpPriv->network_id = fromPriv->network_id;
+ cpPriv->iap_type = fromPriv->iap_type;
+ cpPriv->network_attrs = fromPriv->network_attrs;
+ cpPriv->service_type = fromPriv->service_type;
+ cpPriv->service_id = fromPriv->service_id;
+ cpPriv->service_attrs = fromPriv->service_attrs;
return toConfig;
}
@@ -511,18 +553,30 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
* then do not update current state etc.
*/
if (publicConfig.type() == QNetworkConfiguration::UserChoice ||
- privateConfiguration(publicConfig)->id == state_results.first().params.network_id) {
+ publicConfig.identifier() == 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;
+ {
+ QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig);
+ if (ptr) {
+ ptr->mutex.lock();
+ ptr->isValid = true;
+ ptr->mutex.unlock();
+ }
+ }
break;
case ICD_STATE_CONNECTING:
state = QNetworkSession::Connecting;
- if (privateConfiguration(activeConfig))
- privateConfiguration(activeConfig)->isValid = true;
+ {
+ QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig);
+ if (ptr) {
+ ptr->mutex.lock();
+ ptr->isValid = true;
+ ptr->mutex.unlock();
+ }
+ }
break;
case ICD_STATE_CONNECTED:
{
@@ -540,6 +594,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig);
+ QMutexLocker configLocker(&ptr->mutex);
+
state = QNetworkSession::Connected;
toIcdConfig(ptr)->network_id = state_results.first().params.network_id;
ptr->id = toIcdConfig(ptr)->network_id;
@@ -553,26 +609,35 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
ptr->isValid = true;
currentNetworkInterface = get_network_interface();
- Maemo::IAPConf iap_name(privateConfiguration(activeConfig)->id);
+ Maemo::IAPConf iap_name(ptr->id);
QString name_value = iap_name.value("name").toString();
if (!name_value.isEmpty())
- privateConfiguration(activeConfig)->name = name_value;
+ ptr->name = name_value;
else
- privateConfiguration(activeConfig)->name = privateConfiguration(activeConfig)->id;
+ ptr->name = ptr->id;
// Add the new active configuration to manager or update the old config
- if (!engine->hasIdentifier(privateConfiguration(activeConfig)->id))
- engine->addSessionConfiguration(privateConfiguration(activeConfig));
- else
- engine->changedSessionConfiguration(privateConfiguration(activeConfig));
- }
+ if (!engine->hasIdentifier(ptr->id)) {
+ configLocker.unlock();
+ engine->addSessionConfiguration(ptr);
+ } else {
+ configLocker.unlock();
+ engine->changedSessionConfiguration(ptr);
+ }
+ }
break;
case ICD_STATE_DISCONNECTING:
state = QNetworkSession::Closing;
- if (privateConfiguration(activeConfig))
- privateConfiguration(activeConfig)->isValid = true;
+ {
+ QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig);
+ if (ptr) {
+ ptr->mutex.lock();
+ ptr->isValid = true;
+ ptr->mutex.unlock();
+ }
+ }
break;
default:
break;
@@ -634,12 +699,16 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork()
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;
+ IcdNetworkConfigurationPrivate *icdConfig = toIcdConfig(privateConfiguration(config));
+
+ QMutexLocker locker(&icdConfig->mutex);
+
+ icdConfig->network_id.clear();
+ icdConfig->iap_type.clear();
+ icdConfig->network_attrs = 0;
+ icdConfig->service_type.clear();
+ icdConfig->service_id.clear();
+ icdConfig->service_attrs = 0;
}
@@ -649,8 +718,8 @@ void QNetworkSessionPrivateImpl::updateStateFromActiveConfig()
bool newActive = false;
- if (!privateConfiguration(activeConfig))
- return;
+ if (!activeConfig.isValid())
+ return;
if (!activeConfig.isValid()) {
state = QNetworkSession::Invalid;
@@ -837,16 +906,21 @@ void QNetworkSessionPrivateImpl::do_open()
QList<Maemo::ConnectParams> 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)
+
+ IcdNetworkConfigurationPrivate *icdConfig = toIcdConfig(privateConfiguration(config));
+
+ icdConfig->mutex.lock();
+ param.connect.service_type = icdConfig->service_type;
+ param.connect.service_attrs = icdConfig->service_attrs;
+ param.connect.service_id = icdConfig->service_id;
+ param.connect.network_type = icdConfig->iap_type;
+ param.connect.network_attrs = icdConfig->network_attrs;
+ if (icdConfig->network_attrs & ICD_NW_ATTR_IAPNAME)
param.connect.network_id = QByteArray(iap.toLatin1());
else
- param.connect.network_id = toIcdConfig(privateConfiguration(config))->network_id;
+ param.connect.network_id = icdConfig->network_id;
params.append(param);
+ icdConfig->mutex.unlock();
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("connecting to %s/%s/0x%x/%s/0x%x/%s",
@@ -887,26 +961,30 @@ void QNetworkSessionPrivateImpl::do_open()
return;
}
+ IcdNetworkConfigurationPrivate *icdConfig = toIcdConfig(privateConfiguration(config));
/* Did we connect to non saved IAP? */
- if (!(toIcdConfig(privateConfiguration(config))->network_attrs & ICD_NW_ATTR_IAPNAME)) {
+ icdConfig->mutex.lock();
+ if (!(icdConfig->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;
+ icdConfig->network_attrs |= ICD_NW_ATTR_IAPNAME;
+ icdConfig->id = connected_iap;
}
/* User might have changed the IAP name when a new IAP was saved */
- Maemo::IAPConf iap_name(privateConfiguration(config)->id);
+ Maemo::IAPConf iap_name(icdConfig->id);
QString name = iap_name.value("name").toString();
if (!name.isEmpty())
- privateConfiguration(config)->name = name;
+ icdConfig->name = name;
+
+ icdConfig->iap_type = connect_result.connect.network_type;
- toIcdConfig(privateConfiguration(config))->iap_type = connect_result.connect.network_type;
+ icdConfig->isValid = true;
+ icdConfig->state = QNetworkConfiguration::Active;
+ icdConfig->type = QNetworkConfiguration::InternetAccessPoint;
- privateConfiguration(config)->isValid = true;
- privateConfiguration(config)->state = QNetworkConfiguration::Active;
- privateConfiguration(config)->type = QNetworkConfiguration::InternetAccessPoint;
+ icdConfig->mutex.unlock();
startTime = QDateTime::currentDateTime();
updateState(QNetworkSession::Connected);
@@ -995,8 +1073,11 @@ void QNetworkSessionPrivateImpl::stop()
* configurationChanged is emitted (below).
*/
- privateConfiguration(activeConfig)->state = QNetworkConfiguration::Discovered;
- engine->changedSessionConfiguration(privateConfiguration(activeConfig));
+ QNetworkConfigurationPrivatePointer ptr = privateConfiguration(activeConfig);
+ ptr->mutex.lock();
+ ptr->state = QNetworkConfiguration::Discovered;
+ ptr->mutex.unlock();
+ engine->changedSessionConfiguration(ptr);
opened = false;
isOpen = false;
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index b6522ad..6c74159 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -185,6 +185,8 @@ void QNativeWifiEngine::scanComplete()
bool changed = false;
+ ptr->mutex.lock();
+
if (!ptr->isValid) {
ptr->isValid = true;
changed = true;
@@ -200,8 +202,13 @@ void QNativeWifiEngine::scanComplete()
changed = true;
}
- if (changed)
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ }
} else {
QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
@@ -214,7 +221,9 @@ void QNativeWifiEngine::scanComplete()
accessPointConfigurations.insert(id, ptr);
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
}
}
@@ -227,9 +236,12 @@ void QNativeWifiEngine::scanComplete()
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(previous.takeFirst());
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
+ locker.unlock();
emit updateCompleted();
}
@@ -358,6 +370,7 @@ void QNativeWifiEngine::connectToId(const QString &id)
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("%s: WlanEnumInterfaces failed with error %ld\n", __FUNCTION__, result);
#endif
+ locker.unlock();
emit connectionError(id, InterfaceLookupError);
return;
}
@@ -405,7 +418,9 @@ void QNativeWifiEngine::connectToId(const QString &id)
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("%s: WlanConnect failed with error %ld\n", __FUNCTION__, result);
#endif
+ locker.unlock();
emit connectionError(id, ConnectError);
+ locker.relock();
break;
}
@@ -415,8 +430,10 @@ void QNativeWifiEngine::connectToId(const QString &id)
local_WlanFreeMemory(interfaceList);
- if (profile.isEmpty())
+ if (profile.isEmpty()) {
+ locker.unlock();
emit connectionError(id, InterfaceLookupError);
+ }
}
void QNativeWifiEngine::disconnectFromId(const QString &id)
@@ -426,6 +443,7 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
QString interface = getInterfaceFromId(id);
if (interface.isEmpty()) {
+ locker.unlock();
emit connectionError(id, InterfaceLookupError);
return;
}
@@ -446,6 +464,7 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("%s: WlanDisconnect failed with error %ld\n", __FUNCTION__, result);
#endif
+ locker.unlock();
emit connectionError(id, DisconnectionError);
return;
}
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index 56489b6..2005b2b 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -78,7 +78,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 0fa8f3c..d7e315a 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -297,10 +297,17 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr) {
+ ptr->mutex.lock();
if (activeConnection->state() == 2 &&
ptr->state != QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Active;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ } else {
+ ptr->mutex.unlock();
}
}
}
@@ -313,9 +320,16 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(identifiers.takeFirst());
+ ptr->mutex.lock();
if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Discovered;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ } else {
+ ptr->mutex.unlock();
}
}
}
@@ -339,10 +353,17 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr) {
+ ptr->mutex.lock();
if (activeConnection->state() == 2 &&
ptr->state != QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Active;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ } else {
+ ptr->mutex.unlock();
}
}
}
@@ -424,6 +445,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
}
@@ -444,7 +467,8 @@ void QNetworkManagerEngine::removeConnection(const QString &path)
connection->connectionInterface()->path()));
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
- ptr->isValid = false;
+
+ locker.unlock();
emit configurationRemoved(ptr);
}
@@ -476,11 +500,16 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(cpPriv->id);
+ ptr->mutex.lock();
+
ptr->isValid = cpPriv->isValid;
ptr->name = cpPriv->name;
ptr->id = cpPriv->id;
ptr->state = cpPriv->state;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
delete cpPriv;
}
@@ -500,10 +529,17 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr) {
+ ptr->mutex.lock();
if (activeConnection.state() == 2 &&
ptr->state != QNetworkConfiguration::Active) {
ptr->state = QNetworkConfiguration::Active;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ } else {
+ ptr->mutex.unlock();
}
}
}
@@ -543,7 +579,11 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(connectionId);
+ ptr->mutex.lock();
ptr->state = QNetworkConfiguration::Discovered;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
return;
}
@@ -562,6 +602,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec
ptr->bearer = QLatin1String("WLAN");
accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
}
@@ -592,7 +634,11 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path,
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(connectionId);
+ ptr->mutex.lock();
ptr->state = QNetworkConfiguration::Defined;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
return;
}
@@ -601,8 +647,11 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path,
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(QString::number(qHash(objectPath.path())));
- if (ptr)
+ if (ptr) {
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
+ }
}
delete accessPoint;
@@ -633,7 +682,11 @@ void QNetworkManagerEngine::updateAccessPoint(const QMap<QString, QVariant> &map
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.value(connectionId);
+ ptr->mutex.lock();
ptr->state = QNetworkConfiguration::Discovered;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
return;
}
@@ -687,7 +740,10 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
QString::number(qHash(accessPoints.at(i)->connectionInterface()->path()));
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(accessPointId);
+
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
break;
}
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index ca1f857..05a1429 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -80,7 +80,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index 334eb14..9ab9924 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -522,6 +522,8 @@ void QNlaEngine::networksChanged()
bool changed = false;
+ ptr->mutex.lock();
+
if (ptr->isValid != cpPriv->isValid) {
ptr->isValid = cpPriv->isValid;
changed = true;
@@ -537,8 +539,13 @@ void QNlaEngine::networksChanged()
changed = true;
}
- if (changed)
+ ptr->mutex.unlock();
+
+ if (changed) {
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+ }
delete cpPriv;
} else {
@@ -546,7 +553,9 @@ void QNlaEngine::networksChanged()
accessPointConfigurations.insert(ptr->id, ptr);
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
}
}
@@ -554,9 +563,12 @@ void QNlaEngine::networksChanged()
QNetworkConfigurationPrivatePointer ptr =
accessPointConfigurations.take(previous.takeFirst());
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
+ locker.unlock();
emit updateCompleted();
}
diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h
index 14c5201..1d49464 100644
--- a/src/plugins/bearer/nla/qnlaengine.h
+++ b/src/plugins/bearer/nla/qnlaengine.h
@@ -90,7 +90,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
index bec562d..0737942 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp
@@ -100,7 +100,7 @@ QNetworkSessionPrivateImpl::~QNetworkSessionPrivateImpl()
void QNetworkSessionPrivateImpl::syncStateWithInterface()
{
- if (!privateConfiguration(publicConfig))
+ if (!publicConfig.isValid())
return;
// Start monitoring changes in IAP states
@@ -143,9 +143,8 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface()
// There were no open connections to used IAP or SNAP
if (iError == QNetworkSession::InvalidConfigurationError) {
newState(QNetworkSession::Invalid);
- }
- else if ((privateConfiguration(publicConfig)->state & QNetworkConfiguration::Discovered) ==
- QNetworkConfiguration::Discovered) {
+ } else if ((publicConfig.state() & QNetworkConfiguration::Discovered) ==
+ QNetworkConfiguration::Discovered) {
newState(QNetworkSession::Disconnected);
} else {
newState(QNetworkSession::NotAvailable);
@@ -293,10 +292,15 @@ void QNetworkSessionPrivateImpl::open()
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) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (connInfo().iIapId == symbianConfig->numericId) {
if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) {
activeConfig = publicConfig;
- activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId);
+ activeInterface = interface(symbianConfig->numericId);
connected = ETrue;
startTime = QDateTime::currentDateTime();
if (iDynamicSetdefaultif) {
@@ -320,7 +324,12 @@ void QNetworkSessionPrivateImpl::open()
if (!connected) {
TCommDbConnPref pref;
pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
- pref.SetIapId(toSymbianConfig(privateConfiguration(publicConfig))->numericId);
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ pref.SetIapId(symbianConfig->numericId);
+ symbianConfig->mutex.unlock();
iConnection.Start(pref, iStatus);
if (!IsActive()) {
SetActive();
@@ -328,7 +337,12 @@ void QNetworkSessionPrivateImpl::open()
newState(QNetworkSession::Connecting);
}
} else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
- TConnSnapPref snapPref(toSymbianConfig(privateConfiguration(publicConfig))->numericId);
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ TConnSnapPref snapPref(symbianConfig->numericId);
+ symbianConfig->mutex.unlock();
iConnection.Start(snapPref, iStatus);
if (!IsActive()) {
SetActive();
@@ -387,7 +401,13 @@ void QNetworkSessionPrivateImpl::close(bool allowSignals)
return;
}
- TUint activeIap = toSymbianConfig(privateConfiguration(activeConfig))->numericId;
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(activeConfig));
+
+ symbianConfig->mutex.lock();
+ TUint activeIap = symbianConfig->numericId;
+ symbianConfig->mutex.unlock();
+
isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
@@ -501,7 +521,13 @@ void QNetworkSessionPrivateImpl::PreferredCarrierAvailable(TAccessPointInfo aOld
iALRUpgradingConnection = aIsUpgrade;
QList<QNetworkConfiguration> configs = publicConfig.children();
for (int i=0; i < configs.count(); i++) {
- if (toSymbianConfig(privateConfiguration(configs[i]))->numericId == aNewAPInfo.AccessPoint()) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(configs[i]));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (symbianConfig->numericId == aNewAPInfo.AccessPoint()) {
+ configLocker.unlock();
emit preferredConfigurationChanged(configs[i], aIsSeamless);
}
}
@@ -625,13 +651,24 @@ quint64 QNetworkSessionPrivateImpl::transferredData(TUint dataType) const
if (config.type() == QNetworkConfiguration::ServiceNetwork) {
QList<QNetworkConfiguration> configs = config.children();
for (int i=0; i < configs.count(); i++) {
- if (toSymbianConfig(privateConfiguration(configs[i]))->numericId == apId) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(configs[i]));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (symbianConfig->numericId == apId) {
configFound = true;
break;
}
}
- } else if (toSymbianConfig(privateConfiguration(config))->numericId == apId) {
- configFound = true;
+ } else {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(config));
+
+ symbianConfig->mutex.lock();
+ if (symbianConfig->numericId == apId)
+ configFound = true;
+ symbianConfig->mutex.unlock();
}
if (configFound) {
TUint tData;
@@ -668,9 +705,12 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
// Try to search IAP from the used SNAP using IAP Id
QList<QNetworkConfiguration> children = publicConfig.children();
for (int i=0; i < children.count(); i++) {
- if (toSymbianConfig(privateConfiguration(children[i]))->numericId == iapId) {
+ SymbianNetworkConfigurationPrivate *childConfig =
+ toSymbianConfig(privateConfiguration(children[i]));
+
+ QMutexLocker childLocker(&childConfig->mutex);
+ if (childConfig->numericId == iapId)
return children[i];
- }
}
// Given IAP Id was not found from the used SNAP
@@ -682,10 +722,21 @@ QNetworkConfiguration QNetworkSessionPrivateImpl::activeConfiguration(TUint32 ia
// <=> 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)) {
+ QNetworkConfiguration pt = QNetworkConfigurationManager()
+ .configurationFromIdentifier(QString::number(qHash(iapId)));
+
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(pt));
+ if (symbianConfig) {
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
for (int i=0; i < children.count(); i++) {
- if (toSymbianConfig(privateConfiguration(children[i]))->mappingName == toSymbianConfig(privateConfiguration(pt))->mappingName) {
+ SymbianNetworkConfigurationPrivate *childConfig =
+ toSymbianConfig(privateConfiguration(children[i]));
+
+ QMutexLocker childLocker(&childConfig->mutex);
+
+ if (childConfig->mappingName == symbianConfig->mappingName) {
return children[i];
}
}
@@ -776,13 +827,21 @@ void QNetworkSessionPrivateImpl::RunL()
iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this);
}
#endif
+
isOpen = true;
activeConfig = newActiveConfig;
- activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId);
+
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(activeConfig));
+
+ symbianConfig->mutex.lock();
+ activeInterface = interface(symbianConfig->numericId);
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- serviceConfig = QNetworkConfigurationManager().configurationFromIdentifier(toSymbianConfig(privateConfiguration(activeConfig))->serviceNetworkPtr->id);
+ serviceConfig = QNetworkConfigurationManager()
+ .configurationFromIdentifier(symbianConfig->serviceNetworkPtr->id);
}
-
+ symbianConfig->mutex.unlock();
+
startTime = QDateTime::currentDateTime();
newState(QNetworkSession::Connected);
@@ -830,7 +889,14 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork &&
newState == QNetworkSession::Connected) {
activeConfig = activeConfiguration(accessPointId);
- activeInterface = interface(toSymbianConfig(privateConfiguration(activeConfig))->numericId);
+
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(activeConfig));
+
+ symbianConfig->mutex.lock();
+ activeInterface = interface(symbianConfig->numericId);
+ symbianConfig->mutex.unlock();
+
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
if (iDynamicSetdefaultif) {
// Use name of the IAP to set default IAP
@@ -880,13 +946,25 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
retVal = true;
} else {
if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- if (toSymbianConfig(privateConfiguration(publicConfig))->numericId == accessPointId) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+ if (symbianConfig->numericId == accessPointId) {
+ configLocker.unlock();
+
state = newState;
emit stateChanged(state);
retVal = true;
}
} else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) {
- if (toSymbianConfig(privateConfiguration(activeConfig))->numericId == accessPointId) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(activeConfig));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+ if (symbianConfig->numericId == accessPointId) {
+ configLocker.unlock();
+
state = newState;
emit stateChanged(state);
retVal = true;
@@ -894,11 +972,17 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
} else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
for (int i = 0; i < subConfigurations.count(); i++) {
- if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId == accessPointId) {
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(subConfigurations[i]));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (symbianConfig->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;
+ symbianConfig->state = QNetworkConfiguration::Active;
+ configLocker.unlock();
state = newState;
emit stateChanged(state);
@@ -907,11 +991,14 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint
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;
+ symbianConfig->state = QNetworkConfiguration::Defined;
}
QNetworkConfiguration config = bestConfigFromSNAP(publicConfig);
if ((config.state() == QNetworkConfiguration::Defined) ||
(config.state() == QNetworkConfiguration::Discovered)) {
+
+ configLocker.unlock();
+
state = newState;
emit stateChanged(state);
retVal = true;
@@ -1033,15 +1120,24 @@ void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent)
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
for (int i = 0; i < subConfigurations.count(); i++ ) {
- if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId == connectionId) {
- apId = toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId;
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(subConfigurations[i]));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (symbianConfig->connectionId == connectionId) {
+ apId = symbianConfig->numericId;
break;
}
}
} else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- if (toSymbianConfig(privateConfiguration(publicConfig))->connectionId == connectionId) {
- apId = toSymbianConfig(privateConfiguration(publicConfig))->numericId;
- }
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ if (symbianConfig->connectionId == connectionId)
+ apId = symbianConfig->numericId;
+ symbianConfig->mutex.unlock();
}
if (apId > 0) {
@@ -1064,15 +1160,24 @@ void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent)
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
for (int i = 0; i < subConfigurations.count(); i++ ) {
- if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->numericId == apId) {
- toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId = connectionId;
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(subConfigurations[i]));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (symbianConfig->numericId == apId) {
+ symbianConfig->connectionId = connectionId;
break;
}
}
} else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- if (toSymbianConfig(privateConfiguration(publicConfig))->numericId == apId) {
- toSymbianConfig(privateConfiguration(publicConfig))->connectionId = connectionId;
- }
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ if (symbianConfig->numericId == apId)
+ symbianConfig->connectionId = connectionId;
+ symbianConfig->mutex.unlock();
}
}
}
@@ -1087,15 +1192,24 @@ void QNetworkSessionPrivateImpl::EventL(const CConnMonEventBase& aEvent)
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
QList<QNetworkConfiguration> subConfigurations = publicConfig.children();
for (int i = 0; i < subConfigurations.count(); i++ ) {
- if (toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId == connectionId) {
- toSymbianConfig(privateConfiguration(subConfigurations[i]))->connectionId = 0;
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(subConfigurations[i]));
+
+ QMutexLocker configLocker(&symbianConfig->mutex);
+
+ if (symbianConfig->connectionId == connectionId) {
+ symbianConfig->connectionId = 0;
break;
}
}
} else if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- if (toSymbianConfig(privateConfiguration(publicConfig))->connectionId == connectionId) {
- toSymbianConfig(privateConfiguration(publicConfig))->connectionId = 0;
- }
+ SymbianNetworkConfigurationPrivate *symbianConfig =
+ toSymbianConfig(privateConfiguration(publicConfig));
+
+ symbianConfig->mutex.lock();
+ if (symbianConfig->connectionId == connectionId)
+ symbianConfig->connectionId = 0;
+ symbianConfig->mutex.unlock();
}
}
break;
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h
index 30f51e1..98d4222 100644
--- a/src/plugins/bearer/symbian/qnetworksession_impl.h
+++ b/src/plugins/bearer/symbian/qnetworksession_impl.h
@@ -58,7 +58,7 @@
#include <QDateTime>
#include <e32base.h>
-#include <CommDbConnPref.h>
+#include <commdbconnpref.h>
#include <es_sock.h>
#include <rconnmon.h>
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index 88a563c..980892a 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -75,6 +75,8 @@ SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate()
QString SymbianNetworkConfigurationPrivate::bearerName() const
{
+ QMutexLocker locker(&mutex);
+
switch (bearer) {
case BearerEthernet:
return QLatin1String("Ethernet");
@@ -250,7 +252,10 @@ void SymbianEngine::updateConfigurationsL()
if (error == KErrNone) {
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
}
}
CleanupStack::PopAndDestroy(&connectionMethod);
@@ -288,7 +293,10 @@ void SymbianEngine::updateConfigurationsL()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
snapConfigurations.insert(ident, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
CleanupStack::Pop(cpPriv);
}
@@ -309,7 +317,11 @@ void SymbianEngine::updateConfigurationsL()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
toSymbianConfig(ptr)->serviceNetworkPtr = privSNAP;
accessPointConfigurations.insert(ptr->id, ptr);
+
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
+
privSNAP->serviceNetworkMembers.append(ptr);
}
} else {
@@ -358,7 +370,9 @@ void SymbianEngine::updateConfigurationsL()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
accessPointConfigurations.insert(ident, ptr);
+ locker.unlock();
emit configurationAdded(ptr);
+ locker.relock();
} else {
delete cpPriv;
}
@@ -372,7 +386,10 @@ void SymbianEngine::updateConfigurationsL()
foreach (const QString &oldIface, knownConfigs) {
//remove non existing IAP
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface);
+
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
// Remove non existing IAP from SNAPs
foreach (const QString &iface, snapConfigurations.keys()) {
@@ -391,7 +408,10 @@ void SymbianEngine::updateConfigurationsL()
foreach (const QString &oldIface, knownSnapConfigs) {
//remove non existing SNAPs
QNetworkConfigurationPrivatePointer ptr = snapConfigurations.take(oldIface);
+
+ locker.unlock();
emit configurationRemoved(ptr);
+ locker.relock();
}
}
@@ -596,7 +616,7 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL()
}
#endif
- if (!ptr->isValid) {
+ if (!ptr || !ptr->isValid) {
QString iface = QString::number(qHash(KUserChoiceIAPId));
ptr = userChoiceConfigurations.value(iface);
}
@@ -651,7 +671,9 @@ void SymbianEngine::updateActiveAccessPoints()
if (iOnline != online) {
iOnline = online;
+ locker.unlock();
emit this->onlineStateChanged(iOnline);
+ locker.relock();
}
}
@@ -704,7 +726,9 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
if (!iFirstUpdate) {
startCommsDatabaseNotifications();
+ locker.unlock();
emit updateCompleted();
+ locker.relock();
}
}
@@ -746,10 +770,18 @@ bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePoint
{
QMutexLocker locker(&mutex);
+ ptr->mutex.lock();
if (newState != ptr->state) {
ptr->state = newState;
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+
return true;
+ } else {
+ ptr->mutex.unlock();
}
return false;
}
@@ -763,10 +795,18 @@ bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivate
{
QMutexLocker locker(&mutex);
+ ptr->mutex.lock();
if ((newState | ptr->state) != ptr->state) {
ptr->state = (ptr->state | newState);
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+
return true;
+ } else {
+ ptr->mutex.unlock();
}
return false;
}
@@ -781,10 +821,18 @@ bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivate
{
QMutexLocker locker(&mutex);
+ ptr->mutex.lock();
if ((newState & ptr->state) != ptr->state) {
ptr->state = (newState & ptr->state);
+ ptr->mutex.unlock();
+
+ locker.unlock();
emit configurationChanged(ptr);
+ locker.relock();
+
return true;
+ } else {
+ ptr->mutex.unlock();
}
return false;
}
@@ -893,7 +941,10 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
if (!iOnline) {
iOnline = true;
+
+ locker.unlock();
emit this->onlineStateChanged(iOnline);
+ locker.relock();
}
}
}
@@ -923,7 +974,10 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
}
if (iOnline != online) {
iOnline = online;
+
+ locker.unlock();
emit this->onlineStateChanged(iOnline);
+ locker.relock();
}
}
break;
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index ee6d070..e6af908 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -109,7 +109,7 @@ public:
bool hasIdentifier(const QString &id);
- void requestUpdate();
+ Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 54f4a8a..e4a0135 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -216,12 +216,12 @@ static void initRasterFallbacksMasks(int *warningMask, int *disableMask)
int idx = warning.indexOf(name);
if (idx != -1) {
*warningMask |= operations[i].operation;
- warning.remove(warning.begin() + idx);
+ warning.erase(warning.begin() + idx);
}
idx = disable.indexOf(name);
if (idx != -1) {
*disableMask |= operations[i].operation;
- disable.remove(disable.begin() + idx);
+ disable.erase(disable.begin() + idx);
}
}
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index b5ac67d..4219f6f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -174,6 +174,8 @@ bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img)
bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format,
Qt::ImageConversionFlags flags)
{
+ if (!QFile::exists(filename))
+ return false;
if (flags == Qt::AutoColor) {
if (filename.startsWith(QLatin1Char(':'))) { // resource
QFile file(filename);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index a8bdb65..51969fc 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -61,6 +61,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
+ , flushPending(false)
{
#ifdef QT_NO_DIRECTFB_WM
mode = Offscreen;
@@ -80,6 +81,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
#endif
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
+ , flushPending(false)
{
SurfaceFlags flags = 0;
if (!widget || widget->window()->windowOpacity() == 0xff)
@@ -299,28 +301,19 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state)
}
}
-static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
-{
- const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() };
- surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy);
- const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy };
- surface->Flip(surface, &region, DSFLIP_BLIT);
-}
-
bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
{
- if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.isEmpty())
+ if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1)
return false;
- dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
- if (region.rectCount() == 1) {
- scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
+ if (flushPending) {
+ dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT);
} else {
- const QVector<QRect> rects = region.rects();
- const int n = rects.size();
- for (int i=0; i<n; ++i) {
- scrollSurface(dfbSurface, rects.at(i), dx, dy);
- }
+ flushPending = true;
}
+ dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
+ const QRect r = region.boundingRect();
+ const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() };
+ dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy);
return true;
}
@@ -384,6 +377,7 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion &region,
timer.restart();
}
#endif
+ flushPending = false;
}
void QDirectFBWindowSurface::beginPaint(const QRegion &)
@@ -391,6 +385,7 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &)
if (!engine) {
engine = new QDirectFBPaintEngine(this);
}
+ flushPending = true;
}
void QDirectFBWindowSurface::endPaint(const QRegion &)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index a6138f6..4370a8f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -114,6 +114,7 @@ private:
DFBSurfaceFlipFlags flipFlags;
bool boundingRectFlip;
+ bool flushPending;
#ifdef QT_DIRECTFB_TIMING
int frames;
QTime timer;
diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
index e78fec1..f5ad70c 100644
--- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
+++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp
@@ -2163,6 +2163,9 @@ bool QVNCScreen::connect(const QString &displaySpec)
if (QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive)) {
const int id = getDisplayId(dspec);
QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
+ if (s->pixelFormat() == QImage::Format_Indexed8
+ || s->pixelFormat() == QImage::Format_Invalid && s->depth() == 8)
+ qFatal("QVNCScreen: unsupported screen format");
setScreen(s);
} else { // create virtual screen
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
diff --git a/src/plugins/graphicssystems/trace/trace.pro b/src/plugins/graphicssystems/trace/trace.pro
index d548a6c..07472e2 100644
--- a/src/plugins/graphicssystems/trace/trace.pro
+++ b/src/plugins/graphicssystems/trace/trace.pro
@@ -4,6 +4,7 @@ include(../../qpluginbase.pri)
QT += network
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems
+symbian:TARGET.UID3 = 0x2002130E
SOURCES = main.cpp qgraphicssystem_trace.cpp
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 0f0d6f6..abe3ffe 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -766,7 +766,11 @@ bool QJpegHandler::canRead(QIODevice *device)
return false;
}
- return device->peek(2) == "\xFF\xD8";
+ char buffer[2];
+ if (device->peek(buffer, 2) != 2)
+ return false;
+
+ return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8;
}
bool QJpegHandler::read(QImage *image)
diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
index 85f618f..3cb64ad 100644
--- a/src/plugins/imageformats/tiff/tiff.pro
+++ b/src/plugins/imageformats/tiff/tiff.pro
@@ -58,7 +58,7 @@ contains(QT_CONFIG, system-tiff) {
../../../3rdparty/libtiff/libtiff/tif_wince.c \
../../../3rdparty/libtiff/libtiff/tif_win32.c
}
- symbian*: {
+ symbian: {
SOURCES += ../../../3rdparty/libtiff/port/lfind.c
}
}
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
index bb7bac3..67d07e1 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
@@ -87,7 +87,7 @@ DirectShowPlayerControl::DirectShowPlayerControl(DirectShowPlayerService *servic
, m_muteVolume(-1)
, m_position(0)
, m_duration(0)
- , m_playbackRate(0)
+ , m_playbackRate(1.0)
, m_seekable(false)
{
}
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
index 317fa5c..d54d188 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
@@ -274,7 +274,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
}
if (SUCCEEDED(hr)) {
- m_executedTasks = SetSource;
+ m_executedTasks |= SetSource;
m_pendingTasks |= Render;
if (m_audioOutput)
@@ -282,7 +282,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
if (m_videoOutput)
m_pendingTasks |= SetVideoOutput;
- if (m_rate != 1.0)
+ if (m_rate != 1.0 && m_rate != 0.0)
m_pendingTasks |= SetRate;
m_source = source;
@@ -319,7 +319,7 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
source->setDevice(m_stream);
if (SUCCEEDED(m_graph->AddFilter(source, L"Source"))) {
- m_executedTasks = SetSource;
+ m_executedTasks |= SetSource;
m_pendingTasks |= Render;
if (m_audioOutput)
@@ -327,7 +327,7 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
if (m_videoOutput)
m_pendingTasks |= SetVideoOutput;
- if (m_rate != 1.0)
+ if (m_rate != 1.0 && m_rate != 0.0)
m_pendingTasks |= SetRate;
m_source = source;
@@ -346,7 +346,10 @@ void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
void DirectShowPlayerService::doRender(QMutexLocker *locker)
{
- m_pendingTasks |= m_executedTasks & (Play | Pause);
+ if (m_executedTasks & Pause)
+ m_pendingTasks |= Pause;
+ else if (m_executedTasks & Play && m_rate != 0.0)
+ m_pendingTasks |= Play;
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
@@ -624,8 +627,13 @@ void DirectShowPlayerService::play()
{
QMutexLocker locker(&m_mutex);
- m_pendingTasks &= ~Pause;
- m_pendingTasks |= Play;
+ if (m_rate != 0.0) {
+ m_pendingTasks &= ~Pause;
+ m_pendingTasks |= Play;
+ } else {
+ m_pendingTasks |= Pause;
+ m_executedTasks |= Play;
+ }
if (m_executedTasks & Render) {
if (m_executedTasks & Stop) {
@@ -650,6 +658,7 @@ void DirectShowPlayerService::doPlay(QMutexLocker *locker)
if (SUCCEEDED(hr)) {
m_executedTasks |= Play;
+ m_executedTasks &= ~Pause;
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
} else {
@@ -704,6 +713,9 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
m_executedTasks |= Pause;
+ if (m_rate != 0.0)
+ m_executedTasks &= ~Play;
+
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
} else {
m_error = QMediaPlayer::ResourceError;
@@ -764,9 +776,27 @@ void DirectShowPlayerService::setRate(qreal rate)
{
QMutexLocker locker(&m_mutex);
- m_rate = rate;
+ if (m_rate == rate)
+ return;
+
+ if (rate == 0.0) {
+ if (m_pendingTasks & Play) {
+ m_executedTasks |= Play;
+ m_pendingTasks &= ~(Play | SetRate);
+
+ if (!((m_executingTask | m_executedTasks) & Pause))
+ m_pendingTasks |= Pause;
+ } else if ((m_executingTask | m_executedTasks) & Play) {
+ m_pendingTasks |= Pause;
+ }
+ } else {
+ m_pendingTasks |= SetRate;
+
+ if (m_rate == 0.0 && (m_executedTasks & Play) && !(m_executingTask & Play))
+ m_pendingTasks |= Play;
+ }
- m_pendingTasks |= SetRate;
+ m_rate = rate;
if (m_executedTasks & FinalizeLoad)
::SetEvent(m_taskHandle);
@@ -800,8 +830,9 @@ void DirectShowPlayerService::doSetRate(QMutexLocker *locker)
seeking->Release();
} else if (m_rate != 1.0) {
- m_rate = 1.0;
+ m_rate = 1.0;
}
+
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(RateChange)));
}
@@ -1344,16 +1375,16 @@ void DirectShowPlayerService::run()
m_executingTask = Stop;
doStop(&locker);
- } else if (m_pendingTasks & SetRate) {
- m_pendingTasks ^= SetRate;
- m_executingTask = SetRate;
-
- doSetRate(&locker);
} else if (m_pendingTasks & Pause) {
m_pendingTasks ^= Pause;
m_executingTask = Pause;
doPause(&locker);
+ } else if (m_pendingTasks & SetRate) {
+ m_pendingTasks ^= SetRate;
+ m_executingTask = SetRate;
+
+ doSetRate(&locker);
} else if (m_pendingTasks & Seek) {
m_pendingTasks ^= Seek;
m_executingTask = Seek;
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
index b1ddd98..4b9aeb8 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
@@ -162,30 +162,30 @@ QSize Vmr9VideoWindowControl::nativeSize() const
return size;
}
-QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
+Qt::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
{
- QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio;
+ Qt::AspectRatioMode mode = Qt::KeepAspectRatio;
if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
m_filter, IID_IVMRWindowlessControl9)) {
DWORD arMode;
if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None)
- mode = QVideoWidget::IgnoreAspectRatio;
+ mode = Qt::IgnoreAspectRatio;
control->Release();
}
return mode;
}
-void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
m_filter, IID_IVMRWindowlessControl9)) {
switch (mode) {
- case QVideoWidget::IgnoreAspectRatio:
+ case Qt::IgnoreAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_None);
break;
- case QVideoWidget::KeepAspectRatio:
+ case Qt::KeepAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_LetterBox);
break;
default:
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
index a0aca95..bf4fb42 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.h
@@ -75,8 +75,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
index 846a24a..427d514 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp
@@ -52,7 +52,7 @@ QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent)
: QVideoWindowControl(parent)
, m_surface(new QX11VideoSurface)
, m_videoSink(reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface)))
- , m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ , m_aspectRatioMode(Qt::KeepAspectRatio)
, m_fullScreen(false)
{
if (m_videoSink) {
@@ -94,12 +94,12 @@ void QGstreamerVideoOverlay::setDisplayRect(const QRect &rect)
setScaledDisplayRect();
}
-QVideoWidget::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
+Qt::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QGstreamerVideoOverlay::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QGstreamerVideoOverlay::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
@@ -193,7 +193,7 @@ void QGstreamerVideoOverlay::surfaceFormatChanged()
void QGstreamerVideoOverlay::setScaledDisplayRect()
{
switch (m_aspectRatioMode) {
- case QVideoWidget::KeepAspectRatio:
+ case Qt::KeepAspectRatio:
{
QSize size = m_surface->surfaceFormat().viewport().size();
@@ -205,7 +205,7 @@ void QGstreamerVideoOverlay::setScaledDisplayRect()
m_surface->setDisplayRect(rect);
}
break;
- case QVideoWidget::IgnoreAspectRatio:
+ case Qt::IgnoreAspectRatio:
m_surface->setDisplayRect(m_displayRect);
break;
};
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
index 9566949..1188074 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.h
@@ -73,8 +73,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
void repaint();
@@ -102,7 +102,7 @@ private:
QX11VideoSurface *m_surface;
GstElement *m_videoSink;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
QRect m_displayRect;
bool m_fullScreen;
};
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
index 8307aa5..763f7f1 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.cpp
@@ -233,17 +233,17 @@ QWidget *QGstreamerVideoWidgetControl::videoWidget()
return m_widget;
}
-QVideoWidget::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
+Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QGstreamerVideoWidgetControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (m_videoSink) {
g_object_set(G_OBJECT(m_videoSink),
"force-aspect-ratio",
- (mode == QVideoWidget::KeepAspectRatio),
+ (mode == Qt::KeepAspectRatio),
(const char*)NULL);
}
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
index 6a4c0f3..28b48af 100644
--- a/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
+++ b/src/plugins/mediaservices/gstreamer/qgstreamervideowidget.h
@@ -67,8 +67,8 @@ public:
QWidget *videoWidget();
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
bool isFullScreen() const;
void setFullScreen(bool fullScreen);
@@ -99,7 +99,7 @@ private:
GstElement *m_videoSink;
QGstreamerVideoWidget *m_widget;
WId m_windowId;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
bool m_fullScreen;
};
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.h b/src/plugins/mediaservices/qt7/qt7movievideowidget.h
index 558c3d7..7908efd 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.h
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.h
@@ -83,8 +83,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
@@ -118,7 +118,7 @@ private:
bool m_fullscreen;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
int m_brightness;
int m_contrast;
int m_hue;
diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
index 00ceffc..197c26e 100644
--- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
+++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm
@@ -66,7 +66,7 @@ public:
: QGLWidget(format, parent),
m_texRef(0),
m_nativeSize(640,480),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio)
+ m_aspectRatioMode(Qt::KeepAspectRatio)
{
setAutoFillBackground(false);
}
@@ -145,7 +145,7 @@ public:
m_nativeSize = size;
}
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+ void setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (m_aspectRatioMode != mode) {
m_aspectRatioMode = mode;
@@ -158,7 +158,7 @@ private:
{
QRect displayRect = rect();
- if (m_aspectRatioMode == QVideoWidget::KeepAspectRatio) {
+ if (m_aspectRatioMode == Qt::KeepAspectRatio) {
QSize size = m_nativeSize;
size.scale(displayRect.size(), Qt::KeepAspectRatio);
@@ -170,7 +170,7 @@ private:
CVOpenGLTextureRef m_texRef;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
};
QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
@@ -178,7 +178,7 @@ QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
m_movie(0),
m_videoWidget(0),
m_fullscreen(false),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio),
+ m_aspectRatioMode(Qt::KeepAspectRatio),
m_brightness(0),
m_contrast(0),
m_hue(0),
@@ -324,12 +324,12 @@ QSize QT7MovieVideoWidget::nativeSize() const
return m_nativeSize;
}
-QVideoWidget::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
+Qt::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QT7MovieVideoWidget::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QT7MovieVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
m_videoWidget->setAspectRatioMode(mode);
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
index 3ac409e..49049ad 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h
@@ -80,8 +80,8 @@ public:
QSize nativeSize() const;
- QVideoWidget::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(QVideoWidget::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const;
+ void setAspectRatioMode(Qt::AspectRatioMode mode);
int brightness() const;
void setBrightness(int brightness);
@@ -106,7 +106,7 @@ private:
QRect m_displayRect;
bool m_fullscreen;
QSize m_nativeSize;
- QVideoWidget::AspectRatioMode m_aspectRatioMode;
+ Qt::AspectRatioMode m_aspectRatioMode;
int m_brightness;
int m_contrast;
int m_hue;
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
index d5f4f95..8e4dd9b 100644
--- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
+++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm
@@ -157,7 +157,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent)
m_layouted(false),
m_winId(0),
m_fullscreen(false),
- m_aspectRatioMode(QVideoWidget::KeepAspectRatio),
+ m_aspectRatioMode(Qt::KeepAspectRatio),
m_brightness(0),
m_contrast(0),
m_hue(0),
@@ -254,7 +254,7 @@ void QT7MovieViewOutput::setDisplayRect(const QRect &rect)
if (m_movieView) {
AutoReleasePool pool;
- [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == QVideoWidget::KeepAspectRatio ? YES : NO)];
+ [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == Qt::KeepAspectRatio ? YES : NO)];
[(QTMovieView*)m_movieView setFrame:NSMakeRect(m_displayRect.x(),
m_displayRect.y(),
m_displayRect.width(),
@@ -283,12 +283,12 @@ QSize QT7MovieViewOutput::nativeSize() const
return m_nativeSize;
}
-QVideoWidget::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
+Qt::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
{
return m_aspectRatioMode;
}
-void QT7MovieViewOutput::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
+void QT7MovieViewOutput::setAspectRatioMode(Qt::AspectRatioMode mode)
{
m_aspectRatioMode = mode;
setDisplayRect(m_displayRect);
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 730fdc5..42fbf9e 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS *= accessible imageformats sqldrivers iconengines script bearer
+SUBDIRS *= imageformats sqldrivers iconengines script bearer
unix:!symbian {
contains(QT_CONFIG,iconv)|contains(QT_CONFIG,gnu-libiconv):SUBDIRS *= codecs
} else {
@@ -9,6 +9,7 @@ unix:!symbian {
!embedded:SUBDIRS *= graphicssystems
embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers
!win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods
+!symbian:SUBDIRS += accessible
symbian:SUBDIRS += s60
contains(QT_CONFIG, phonon): SUBDIRS *= phonon
contains(QT_CONFIG, multimedia): SUBDIRS *= audio mediaservices
diff --git a/src/plugins/s60/3_2/3_2.pro b/src/plugins/s60/3_2/3_2.pro
index 4b28eb9..7700677 100644
--- a/src/plugins/s60/3_2/3_2.pro
+++ b/src/plugins/s60/3_2/3_2.pro
@@ -10,7 +10,12 @@ contains(S60_VERSION, 3.1) {
SOURCES += ../src/qlocale_3_2.cpp \
../src/qdesktopservices_3_2.cpp \
../src/qcoreapplication_3_2.cpp
- LIBS += -ldirectorylocalizer -lefsrv
+ contains(CONFIG, is_using_gnupoc) {
+ LIBS += -ldirectorylocalizer
+ } else {
+ LIBS += -lDirectoryLocalizer
+ }
+ LIBS += -lefsrv
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
}
diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro
index 4cdce12..164dfaa 100644
--- a/src/plugins/s60/5_0/5_0.pro
+++ b/src/plugins/s60/5_0/5_0.pro
@@ -10,7 +10,12 @@ contains(S60_VERSION, 3.1) {
SOURCES += ../src/qlocale_3_2.cpp \
../src/qdesktopservices_3_2.cpp \
../src/qcoreapplication_3_2.cpp
- LIBS += -ldirectorylocalizer -lefsrv
+ contains(CONFIG, is_using_gnupoc) {
+ LIBS += -ldirectorylocalizer
+ } else {
+ LIBS += -lDirectoryLocalizer
+ }
+ LIBS += -lefsrv
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
}
diff --git a/src/plugins/s60/s60pluginbase.pri b/src/plugins/s60/s60pluginbase.pri
index c1aa4ef..1a6f4a2 100644
--- a/src/plugins/s60/s60pluginbase.pri
+++ b/src/plugins/s60/s60pluginbase.pri
@@ -4,6 +4,8 @@ include(../qpluginbase.pri)
CONFIG -= plugin
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60
+
MMP_RULES += NOEXPORTLIBRARY
defBlock = \
diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp
index a2f30f2..b4ca9a3 100644
--- a/src/plugins/s60/src/qdesktopservices_3_2.cpp
+++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp
@@ -45,7 +45,7 @@
#ifdef Q_WS_S60
#include <e32base.h> // CBase -> Required by cdirectorylocalizer.h
-#include <cdirectorylocalizer.h> // CDirectoryLocalizer
+#include <CDirectoryLocalizer.h> // CDirectoryLocalizer
EXPORT_C QString localizedDirectoryName(QString& rawPath)
{
diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro
index c609a9e..fb31233 100644
--- a/src/plugins/sqldrivers/sqlite/sqlite.pro
+++ b/src/plugins/sqldrivers/sqlite/sqlite.pro
@@ -14,4 +14,6 @@ SOURCES = smain.cpp \
QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
}
+wince*: DEFINES += HAVE_LOCALTIME_S=0
+
include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip b/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip
index 923cca4..df78644 100644
--- a/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip
+++ b/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip
Binary files differ