summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJonas Rabbe <jonas.rabbe@nokia.com>2011-08-31 13:09:47 +1000
committerJonas Rabbe <jonas.rabbe@nokia.com>2011-08-31 13:09:47 +1000
commit6781063df647fcba3dd5ca6fdff8631579acb495 (patch)
treef505a6cadb9e8edd341b0105f47e051a6a597b5c /src/plugins
parent3bf236cc23c2e67e1b5cbc01e05e61263528fc10 (diff)
parent8e954ee2462e827e88bbc27b1512d1e1422357fc (diff)
Merge branch 'radio' into 'master'
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/fakeradio/fakeradio.pro23
-rw-r--r--src/plugins/fakeradio/fakeradioservice.cpp71
-rw-r--r--src/plugins/fakeradio/fakeradioservice.h67
-rw-r--r--src/plugins/fakeradio/fakeradioserviceplugin.cpp84
-rw-r--r--src/plugins/fakeradio/fakeradioserviceplugin.h63
-rw-r--r--src/plugins/fakeradio/fakeradiotunercontrol.cpp335
-rw-r--r--src/plugins/fakeradio/fakeradiotunercontrol.h123
-rw-r--r--src/plugins/plugins.pro7
8 files changed, 772 insertions, 1 deletions
diff --git a/src/plugins/fakeradio/fakeradio.pro b/src/plugins/fakeradio/fakeradio.pro
new file mode 100644
index 000000000..f6a495aac
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradio.pro
@@ -0,0 +1,23 @@
+load(qt_module)
+
+TARGET = qtmedia_fakeradio
+QT += multimediakit-private
+PLUGIN_TYPE = mediaservice
+
+load(qt_plugin)
+DESTDIR = $$QT.multimediakit.plugins/$${PLUGIN_TYPE}
+
+HEADERS += \
+ fakeradioserviceplugin.h \
+ fakeradioservice.h \
+ fakeradiotunercontrol.h
+
+SOURCES += \
+ fakeradioserviceplugin.cpp \
+ fakeradioservice.cpp \
+ fakeradiotunercontrol.cpp
+
+
+target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
+INSTALLS += target
+
diff --git a/src/plugins/fakeradio/fakeradioservice.cpp b/src/plugins/fakeradio/fakeradioservice.cpp
new file mode 100644
index 000000000..6ddf4426b
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradioservice.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qvariant.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qfile.h>
+#include <QtGui/qwidget.h>
+
+#include "fakeradioservice.h"
+#include "fakeradiotunercontrol.h"
+
+FakeRadioService::FakeRadioService(QObject *parent):
+ QMediaService(parent)
+{
+ m_control = new FakeRadioTunerControl(this);
+}
+
+FakeRadioService::~FakeRadioService()
+{
+}
+
+QMediaControl *FakeRadioService::requestControl(const char* name)
+{
+ if (qstrcmp(name,QRadioTunerControl_iid) == 0)
+ return m_control;
+
+ return 0;
+}
+
+
+void FakeRadioService::releaseControl(QMediaControl *)
+{
+}
diff --git a/src/plugins/fakeradio/fakeradioservice.h b/src/plugins/fakeradio/fakeradioservice.h
new file mode 100644
index 000000000..6b55d5380
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradioservice.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FAKERADIOSERVICE_H
+#define FAKERADIOSERVICE_H
+
+#include <QtCore/qobject.h>
+
+#include <qmediaservice.h>
+QT_USE_NAMESPACE
+
+class FakeRadioTunerControl;
+
+class FakeRadioService : public QMediaService
+{
+ Q_OBJECT
+
+public:
+ FakeRadioService(QObject *parent = 0);
+ ~FakeRadioService();
+
+ QMediaControl *requestControl(const char* name);
+ void releaseControl(QMediaControl *);
+
+private:
+ FakeRadioTunerControl *m_control;
+};
+
+#endif // FAKERADIOSERVICE_H
diff --git a/src/plugins/fakeradio/fakeradioserviceplugin.cpp b/src/plugins/fakeradio/fakeradioserviceplugin.cpp
new file mode 100644
index 000000000..805941022
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradioserviceplugin.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qstring.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qdir.h>
+
+#include "fakeradioserviceplugin.h"
+#include "fakeradioservice.h"
+
+#include <qmediaserviceprovider.h>
+
+
+QStringList FakeRadioServicePlugin::keys() const
+{
+ return QStringList() <<
+ QLatin1String(Q_MEDIASERVICE_RADIO);
+}
+
+QMediaService* FakeRadioServicePlugin::create(QString const& key)
+{
+ if (key == QLatin1String(Q_MEDIASERVICE_RADIO))
+ return new FakeRadioService;
+
+ return 0;
+}
+
+void FakeRadioServicePlugin::release(QMediaService *service)
+{
+ delete service;
+}
+
+QList<QByteArray> FakeRadioServicePlugin::devices(const QByteArray &service) const
+{
+ return QList<QByteArray>();
+}
+
+QString FakeRadioServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
+{
+ return QString();
+}
+
+
+Q_EXPORT_PLUGIN2(qtmedia_fakeradio, FakeRadioServicePlugin);
+
diff --git a/src/plugins/fakeradio/fakeradioserviceplugin.h b/src/plugins/fakeradio/fakeradioserviceplugin.h
new file mode 100644
index 000000000..50b912838
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradioserviceplugin.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef FAKERADIOSERVICEPLUGIN_H
+#define FAKERADIOSERVICEPLUGIN_H
+
+#include <qmediaserviceproviderplugin.h>
+
+QT_USE_NAMESPACE
+
+class FakeRadioServicePlugin : public QMediaServiceProviderPlugin, public QMediaServiceSupportedDevicesInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
+public:
+ QStringList keys() const;
+ QMediaService* create(QString const& key);
+ void release(QMediaService *service);
+
+ QList<QByteArray> devices(const QByteArray &service) const;
+ QString deviceDescription(const QByteArray &service, const QByteArray &device);
+};
+
+#endif // FAKERADIOSERVICEPLUGIN_H
diff --git a/src/plugins/fakeradio/fakeradiotunercontrol.cpp b/src/plugins/fakeradio/fakeradiotunercontrol.cpp
new file mode 100644
index 000000000..4686692af
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradiotunercontrol.cpp
@@ -0,0 +1,335 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "fakeradiotunercontrol.h"
+#include "fakeradioservice.h"
+
+#include <QtCore/qdebug.h>
+
+FakeRadioTunerControl::FakeRadioTunerControl(QObject *parent)
+ :QRadioTunerControl(parent)
+{
+ m_state = QRadioTuner::StoppedState;
+ m_freqMin = 520000;
+ m_freqMax = 108000000;
+ m_currentBand = QRadioTuner::FM;
+ m_currentFreq = 0;
+ m_stereo = true;
+ m_stereoMode = QRadioTuner::Auto;
+ m_signalStrength = 0;
+ m_volume = 50;
+ m_muted = false;
+
+ m_searching = false;
+ m_forward = true;
+ m_searchTimer = new QTimer(this);
+ m_searchTimer->setSingleShot(true);
+ connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(searchEnded()));
+
+ QTimer::singleShot(300, this, SLOT(delayedInit()));
+
+ qsrand(QTime::currentTime().msec());
+}
+
+FakeRadioTunerControl::~FakeRadioTunerControl()
+{
+ m_searchTimer->stop();
+}
+
+bool FakeRadioTunerControl::isAvailable() const
+{
+ return true;
+}
+
+QtMultimediaKit::AvailabilityError FakeRadioTunerControl::availabilityError() const
+{
+ return QtMultimediaKit::NoError;
+}
+
+QRadioTuner::State FakeRadioTunerControl::state() const
+{
+ return m_state;
+}
+
+QRadioTuner::Band FakeRadioTunerControl::band() const
+{
+ return m_currentBand;
+}
+
+bool FakeRadioTunerControl::isBandSupported(QRadioTuner::Band b) const
+{
+ switch (b) {
+ case QRadioTuner::FM:
+ if (m_freqMin <= 87500000 && m_freqMax >= 108000000)
+ return true;
+ break;
+ case QRadioTuner::LW:
+ if (m_freqMin <= 148500 && m_freqMax >= 283500)
+ return true;
+ case QRadioTuner::AM:
+ if (m_freqMin <= 520000 && m_freqMax >= 1610000)
+ return true;
+ default:
+ if (m_freqMin <= 1711000 && m_freqMax >= 30000000)
+ return true;
+ }
+
+ return false;
+}
+
+void FakeRadioTunerControl::setBand(QRadioTuner::Band b)
+{
+ if (isBandSupported(b)) {
+ m_currentBand = b;
+ emit bandChanged(m_currentBand);
+
+ int f = m_currentFreq;
+ QPair<int, int> fRange = frequencyRange(m_currentBand);
+
+ if (f < fRange.first)
+ f = fRange.first;
+ if (f > fRange.second)
+ f = fRange.second;
+
+ if (f != m_currentFreq) {
+ m_currentFreq = f;
+ emit frequencyChanged(m_currentFreq);
+ }
+ }
+}
+
+int FakeRadioTunerControl::frequency() const
+{
+ return m_currentFreq;
+}
+
+int FakeRadioTunerControl::frequencyStep(QRadioTuner::Band b) const
+{
+ int step = 0;
+
+ if (b == QRadioTuner::FM)
+ step = 100000; // 100kHz steps
+ else if (b == QRadioTuner::LW)
+ step = 1000; // 1kHz steps
+ else if (b == QRadioTuner::AM)
+ step = 1000; // 1kHz steps
+ else if (b == QRadioTuner::SW)
+ step = 500; // 500Hz steps
+
+ return step;
+}
+
+QPair<int,int> FakeRadioTunerControl::frequencyRange(QRadioTuner::Band b) const
+{
+ if (b == QRadioTuner::FM)
+ return qMakePair<int,int>(87500000,108000000);
+ else if (b == QRadioTuner::LW)
+ return qMakePair<int,int>(148500,283500);
+ else if (b == QRadioTuner::AM)
+ return qMakePair<int,int>(520000,1710000);
+ else if (b == QRadioTuner::SW)
+ return qMakePair<int,int>(1711111,30000000);
+
+ return qMakePair<int,int>(0,0);
+}
+
+void FakeRadioTunerControl::setFrequency(int frequency)
+{
+ qint64 f = frequency;
+ QPair<int, int> fRange = frequencyRange(m_currentBand);
+
+ if (frequency < fRange.first)
+ f = fRange.first;
+ if (frequency > fRange.second)
+ f = fRange.second;
+
+ m_currentFreq = f;
+ emit frequencyChanged(m_currentFreq);
+}
+
+bool FakeRadioTunerControl::isStereo() const
+{
+ return m_stereo;
+}
+
+QRadioTuner::StereoMode FakeRadioTunerControl::stereoMode() const
+{
+ return m_stereoMode;
+}
+
+void FakeRadioTunerControl::setStereoMode(QRadioTuner::StereoMode mode)
+{
+ bool stereo = true;
+
+ if (mode == QRadioTuner::ForceMono)
+ stereo = false;
+ else
+ stereo = true;
+
+ m_stereo = stereo;
+ m_stereoMode = mode;
+
+ emit stereoStatusChanged(stereo);
+}
+
+int FakeRadioTunerControl::signalStrength() const
+{
+ return m_signalStrength;
+}
+
+int FakeRadioTunerControl::volume() const
+{
+ return m_volume;
+}
+
+void FakeRadioTunerControl::setVolume(int volume)
+{
+ int v = volume;
+
+ if (v < 0)
+ v = 0;
+ if (100 > v)
+ v = 100;
+
+ m_volume = v;
+}
+
+bool FakeRadioTunerControl::isMuted() const
+{
+ return m_muted;
+}
+
+void FakeRadioTunerControl::setMuted(bool muted)
+{
+ if (muted != m_muted) {
+ m_muted = muted;
+ emit mutedChanged(m_muted);
+ }
+}
+
+bool FakeRadioTunerControl::isSearching() const
+{
+ return m_searching;
+}
+
+void FakeRadioTunerControl::cancelSearch()
+{
+ m_searching = false;
+ m_searchTimer->stop();
+ emit searchingChanged(m_searching);
+}
+
+void FakeRadioTunerControl::searchForward()
+{
+ m_forward = true;
+ performSearch();
+}
+
+void FakeRadioTunerControl::searchBackward()
+{
+ m_forward = false;
+ performSearch();
+}
+
+void FakeRadioTunerControl::start()
+{
+ if (isAvailable() && m_state != QRadioTuner::ActiveState) {
+ m_state = QRadioTuner::ActiveState;
+ emit stateChanged(m_state);
+ }
+}
+
+void FakeRadioTunerControl::stop()
+{
+ if (m_state != QRadioTuner::StoppedState) {
+ m_state = QRadioTuner::StoppedState;
+ emit stateChanged(m_state);
+ }
+}
+
+QRadioTuner::Error FakeRadioTunerControl::error() const
+{
+ return QRadioTuner::NoError;
+}
+
+QString FakeRadioTunerControl::errorString() const
+{
+ return QString();
+}
+
+void FakeRadioTunerControl::delayedInit()
+{
+ m_signalStrength = 50;
+ emit signalStrengthChanged(m_signalStrength);
+}
+
+void FakeRadioTunerControl::performSearch()
+{
+ m_searching = true;
+ m_searchTimer->start(qrand() % 1000);
+ emit searchingChanged(m_searching);
+}
+
+void FakeRadioTunerControl::searchEnded()
+{
+ int minFreq, maxFreq, newFreq;
+ QPair<int, int> fRange = frequencyRange(m_currentBand);
+
+ if (m_forward) {
+ minFreq = m_currentFreq;
+ maxFreq = fRange.second;
+ } else {
+ minFreq = fRange.first;
+ maxFreq = m_currentFreq;
+ }
+
+ if ((qreal)(maxFreq - minFreq) / (qreal)(fRange.second - fRange.first) < 0.02) { // don't want to do anything if we have less than 2% of the range to move
+ return;
+ }
+
+ newFreq = (qrand() % (maxFreq - minFreq)) + minFreq;
+ newFreq -= newFreq % frequencyStep(m_currentBand);
+
+ m_searching = false;
+ m_currentFreq = newFreq;
+ emit searchingChanged(m_searching);
+ emit frequencyChanged(m_currentFreq);
+}
diff --git a/src/plugins/fakeradio/fakeradiotunercontrol.h b/src/plugins/fakeradio/fakeradiotunercontrol.h
new file mode 100644
index 000000000..a2faf2c02
--- /dev/null
+++ b/src/plugins/fakeradio/fakeradiotunercontrol.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FAKERADIOTUNERCONTROL_H
+#define FAKERADIOTUNERCONTROL_H
+
+#include <QtCore/qobject.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qdatetime.h>
+
+#include <qradiotunercontrol.h>
+
+QT_USE_NAMESPACE
+
+class FakeRadioService;
+
+class FakeRadioTunerControl : public QRadioTunerControl
+{
+ Q_OBJECT
+public:
+ FakeRadioTunerControl(QObject *parent = 0);
+ ~FakeRadioTunerControl();
+
+ bool isAvailable() const;
+ QtMultimediaKit::AvailabilityError availabilityError() const;
+
+ QRadioTuner::State state() const;
+
+ QRadioTuner::Band band() const;
+ void setBand(QRadioTuner::Band b);
+ bool isBandSupported(QRadioTuner::Band b) const;
+
+ int frequency() const;
+ int frequencyStep(QRadioTuner::Band b) const;
+ QPair<int,int> frequencyRange(QRadioTuner::Band b) const;
+ void setFrequency(int frequency);
+
+ bool isStereo() const;
+ QRadioTuner::StereoMode stereoMode() const;
+ void setStereoMode(QRadioTuner::StereoMode mode);
+
+ int signalStrength() const;
+
+ int volume() const;
+ void setVolume(int volume);
+
+ bool isMuted() const;
+ void setMuted(bool muted);
+
+ bool isSearching() const;
+ void cancelSearch();
+
+ void searchForward();
+ void searchBackward();
+
+ void start();
+ void stop();
+
+ QRadioTuner::Error error() const;
+ QString errorString() const;
+
+private slots:
+ void delayedInit();
+ void performSearch();
+ void searchEnded();
+
+private: //data
+ QRadioTuner::State m_state;
+ QRadioTuner::Band m_currentBand;
+ qint64 m_freqMin;
+ qint64 m_freqMax;
+ qint64 m_currentFreq;
+ bool m_stereo;
+ QRadioTuner::StereoMode m_stereoMode;
+ int m_signalStrength;
+ int m_volume;
+ bool m_muted;
+
+ // searching
+ bool m_searching;
+ bool m_forward;
+ QTimer *m_searchTimer;
+};
+
+#endif // FAKERADIOTUNERCONTROL_H
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index bc82c60b3..15a25b3d5 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -33,7 +33,8 @@ unix:!mac {
SUBDIRS += audiocapture
}
- !maemo*:SUBDIRS += v4l
+ # v4l is turned off because it is not supported in Qt 5
+ # !maemo*:SUBDIRS += v4l
contains(config_test_pulseaudio, yes) {
SUBDIRS += pulseaudio
@@ -44,3 +45,7 @@ mac:!simulator {
SUBDIRS += audiocapture
!qpa: SUBDIRS += qt7
}
+
+# fake radio to test the radio APIs
+SUBDIRS += fakeradio
+