diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2020-05-31 20:41:43 +0200 |
---|---|---|
committer | Christian Strømme <christian.stromme@qt.io> | 2020-06-10 18:29:22 +0000 |
commit | ba2f42c2548a5175126497d2d69eef95c2a849ba (patch) | |
tree | 0570570b5c997186b74396ddb6e9cd330209e859 /src/imports | |
parent | 3d909ba8ac0f43af6d70830a5c95df3e741f1221 (diff) |
Remove Radio support
Fixes: QTBUG-84592
Change-Id: I3b9e51689fd542c35cb57cf6c51a141aec3034df
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/multimedia/multimedia.cpp | 4 | ||||
-rw-r--r-- | src/imports/multimedia/multimedia.pro | 4 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeradio.cpp | 541 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeradio_p.h | 203 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeradiodata.cpp | 325 | ||||
-rw-r--r-- | src/imports/multimedia/qdeclarativeradiodata_p.h | 190 |
6 files changed, 0 insertions, 1267 deletions
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp index 45990e4f9..bbc48647a 100644 --- a/src/imports/multimedia/multimedia.cpp +++ b/src/imports/multimedia/multimedia.cpp @@ -49,8 +49,6 @@ #include "qdeclarativemultimediaglobal_p.h" #include "qdeclarativemediametadata_p.h" #include "qdeclarativeaudio_p.h" -#include "qdeclarativeradio_p.h" -#include "qdeclarativeradiodata_p.h" #include "qdeclarativeplaylist_p.h" #include "qdeclarativecamera_p.h" #include "qdeclarativecamerapreviewprovider_p.h" @@ -88,8 +86,6 @@ public: qmlRegisterType<QDeclarativeAudio>(uri, 5, 0, "Audio"); qmlRegisterType<QDeclarativeAudio>(uri, 5, 0, "MediaPlayer"); qmlRegisterType<QDeclarativeVideoOutput>(uri, 5, 0, "VideoOutput"); - qmlRegisterType<QDeclarativeRadio>(uri, 5, 0, "Radio"); - qmlRegisterType<QDeclarativeRadioData>(uri, 5, 0, "RadioData"); qmlRegisterType<QDeclarativeCamera>(uri, 5, 0, "Camera"); qmlRegisterType<QDeclarativeTorch>(uri, 5, 0, "Torch"); qmlRegisterUncreatableType<QDeclarativeCameraCapture>(uri, 5, 0, "CameraCapture", diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro index 4c35784b9..4fa911d54 100644 --- a/src/imports/multimedia/multimedia.pro +++ b/src/imports/multimedia/multimedia.pro @@ -8,8 +8,6 @@ HEADERS += \ qdeclarativeaudio_p.h \ qdeclarativemediametadata_p.h \ qdeclarativeplaylist_p.h \ - qdeclarativeradio_p.h \ - qdeclarativeradiodata_p.h \ qdeclarativecamera_p.h \ qdeclarativecameracapture_p.h \ qdeclarativecamerarecorder_p.h \ @@ -26,8 +24,6 @@ SOURCES += \ multimedia.cpp \ qdeclarativeaudio.cpp \ qdeclarativeplaylist.cpp \ - qdeclarativeradio.cpp \ - qdeclarativeradiodata.cpp \ qdeclarativecamera.cpp \ qdeclarativecameracapture.cpp \ qdeclarativecamerarecorder.cpp \ diff --git a/src/imports/multimedia/qdeclarativeradio.cpp b/src/imports/multimedia/qdeclarativeradio.cpp deleted file mode 100644 index 655b87ca5..000000000 --- a/src/imports/multimedia/qdeclarativeradio.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativeradio_p.h" -#include "qdeclarativeradiodata_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype Radio - \instantiates QDeclarativeRadio - \inqmlmodule QtMultimedia - \brief Access radio functionality from a QML application. - \ingroup multimedia_qml - \ingroup multimedia_radio_qml - \inherits Item - \deprecated - - \qml - Rectangle { - width: 320 - height: 480 - - Radio { - id: radio - band: Radio.FM - } - - MouseArea { - x: 0; y: 0 - height: parent.height - width: parent.width / 2 - - onClicked: radio.scanDown() - } - - MouseArea { - x: parent.width / 2; y: 0 - height: parent.height - width: parent.width / 2 - - onClicked: radio.scanUp() - } - } - \endqml - - You can use \c Radio to tune the radio and get information about the signal. - You can also use the Radio to get information about tuning, for instance the - frequency steps supported for tuning. - - The corresponding \l RadioData gives RDS information about the - current radio station. The best way to access the RadioData for - the current Radio is to use the \c radioData property. - - \sa {Radio Overview} - -*/ - - -QDeclarativeRadio::QDeclarativeRadio(QObject *parent) : - QObject(parent) -{ - m_radioTuner = new QRadioTuner(this); - m_radioData = new QDeclarativeRadioData(m_radioTuner, this); - - connect(m_radioTuner, SIGNAL(stateChanged(QRadioTuner::State)), this, SLOT(_q_stateChanged(QRadioTuner::State))); - connect(m_radioTuner, SIGNAL(bandChanged(QRadioTuner::Band)), this, SLOT(_q_bandChanged(QRadioTuner::Band))); - - connect(m_radioTuner, SIGNAL(frequencyChanged(int)), this, SIGNAL(frequencyChanged(int))); - connect(m_radioTuner, SIGNAL(stereoStatusChanged(bool)), this, SIGNAL(stereoStatusChanged(bool))); - connect(m_radioTuner, SIGNAL(searchingChanged(bool)), this, SIGNAL(searchingChanged(bool))); - connect(m_radioTuner, SIGNAL(signalStrengthChanged(int)), this, SIGNAL(signalStrengthChanged(int))); - connect(m_radioTuner, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); - connect(m_radioTuner, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); - connect(m_radioTuner, SIGNAL(stationFound(int,QString)), this, SIGNAL(stationFound(int,QString))); - connect(m_radioTuner, SIGNAL(antennaConnectedChanged(bool)), this, SIGNAL(antennaConnectedChanged(bool))); - connect(m_radioTuner, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); - - connect(m_radioTuner, SIGNAL(error(QRadioTuner::Error)), this, SLOT(_q_error(QRadioTuner::Error))); -} - -QDeclarativeRadio::~QDeclarativeRadio() -{ -} - -/*! - \qmlproperty enumeration QtMultimedia::Radio::state - - This property holds the current state of the Radio. - - \table - \header \li Value \li Description - \row \li ActiveState - \li The radio is started and active - - \row \li StoppedState - \li The radio is stopped - - \endtable - - \sa start, stop -*/ -QDeclarativeRadio::State QDeclarativeRadio::state() const -{ - return static_cast<QDeclarativeRadio::State>(m_radioTuner->state()); -} - -/*! - \qmlproperty enumeration QtMultimedia::Radio::band - - This property holds the frequency band used for the radio, which can be specified as - any one of the values in the table below. - - \table - \header \li Value \li Description - \row \li AM - \li 520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz - - \row \li FM - \li 87.5 to 108.0 MHz, except Japan 76-90 MHz - - \row \li SW - \li 1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing - - \row \li LW - \li 148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia) - - \row \li FM2 - \li range not defined, used when area supports more than one FM range - - \endtable -*/ -QDeclarativeRadio::Band QDeclarativeRadio::band() const -{ - return static_cast<QDeclarativeRadio::Band>(m_radioTuner->band()); -} - -/*! - \qmlproperty int QtMultimedia::Radio::frequency - - Sets the frequency in Hertz that the radio is tuned to. The frequency must be within the frequency - range for the current band, otherwise it will be changed to be within the frequency range. - - \sa maximumFrequency, minimumFrequency -*/ -int QDeclarativeRadio::frequency() const -{ - return m_radioTuner->frequency(); -} - -/*! - \qmlproperty enumeration QtMultimedia::Radio::stereoMode - - This property holds the stereo mode of the radio, which can be set to any one of the - values in the table below. - - \table - \header \li Value \li Description - \row \li Auto - \li Uses stereo mode matching the station - - \row \li ForceStereo - \li Forces the radio to play the station in stereo, converting the sound signal if necessary - - \row \li ForceMono - \li Forces the radio to play the station in mono, converting the sound signal if necessary - - \endtable -*/ -QDeclarativeRadio::StereoMode QDeclarativeRadio::stereoMode() const -{ - return static_cast<QDeclarativeRadio::StereoMode>(m_radioTuner->stereoMode()); -} - -/*! - \qmlproperty int QtMultimedia::Radio::volume - - Set this property to control the volume of the radio. The valid range of the volume is from 0 to 100. -*/ -int QDeclarativeRadio::volume() const -{ - return m_radioTuner->volume(); -} - -/*! - \qmlproperty bool QtMultimedia::Radio::muted - - This property reflects whether the radio is muted or not. -*/ -bool QDeclarativeRadio::muted() const -{ - return m_radioTuner->isMuted(); -} - -/*! - \qmlproperty bool QtMultimedia::Radio::stereo - - This property holds whether the radio is receiving a stereo signal or not. If \l stereoMode is - set to ForceMono the value will always be false. Likewise, it will always be true if stereoMode - is set to ForceStereo. - - \sa stereoMode -*/ -bool QDeclarativeRadio::stereo() const -{ - return m_radioTuner->isStereo(); -} - -/*! - \qmlproperty int QtMultimedia::Radio::signalStrength - - The strength of the current radio signal as a percentage where 0% equals no signal, and 100% is a - very good signal. -*/ -int QDeclarativeRadio::signalStrength() const -{ - return m_radioTuner->signalStrength(); -} - -/*! - \qmlproperty bool QtMultimedia::Radio::searching - - This property is true if the radio is currently searching for radio stations, for instance using the \l scanUp, - \l scanDown, and \l searchAllStations methods. Once the search completes, or if it is cancelled using - \l cancelScan, this property will be false. -*/ -bool QDeclarativeRadio::searching() const -{ - return m_radioTuner->isSearching(); -} - -/*! - \qmlproperty int QtMultimedia::Radio::frequencyStep - - The number of Hertz for each step when tuning the radio manually. The value is for the current \l band. - */ -int QDeclarativeRadio::frequencyStep() const -{ - return m_radioTuner->frequencyStep(m_radioTuner->band()); -} - -/*! - \qmlproperty int QtMultimedia::Radio::minimumFrequency - - The minimum frequency for the current \l band. - */ -int QDeclarativeRadio::minimumFrequency() const -{ - return m_radioTuner->frequencyRange(m_radioTuner->band()).first; -} - -/*! - \qmlproperty int QtMultimedia::Radio::maximumFrequency - - The maximum frequency for the current \l band. - */ -int QDeclarativeRadio::maximumFrequency() const -{ - return m_radioTuner->frequencyRange(m_radioTuner->band()).second; -} - -/*! - \qmlproperty int QtMultimedia::Radio::antennaConnected - - This property is true if there is an antenna connected. Otherwise it will be false. - */ -bool QDeclarativeRadio::isAntennaConnected() const -{ - return m_radioTuner->isAntennaConnected(); -} - -/*! - \qmlproperty enumeration QtMultimedia::Radio::availability - - Returns the availability state of the radio. - - This is one of: - - \table - \header \li Value \li Description - \row \li Available - \li The radio is available to use - \row \li Busy - \li The radio is usually available to use, but is currently busy. - This can happen when some other process needs to use the audio - hardware. - \row \li Unavailable - \li The radio is not available to use (there may be no radio - hardware) - \row \li ResourceMissing - \li There is one or more resources missing, so the radio cannot - be used. It may be possible to try again at a later time. This - can occur if there is no antenna connected - see the \l antennaConnected - property as well. - \endtable - */ -QDeclarativeRadio::Availability QDeclarativeRadio::availability() const -{ - return Availability(m_radioTuner->availability()); -} - -void QDeclarativeRadio::setBand(QDeclarativeRadio::Band band) -{ - m_radioTuner->setBand(static_cast<QRadioTuner::Band>(band)); -} - -void QDeclarativeRadio::setFrequency(int frequency) -{ - m_radioTuner->setFrequency(frequency); -} - -void QDeclarativeRadio::setStereoMode(QDeclarativeRadio::StereoMode stereoMode) -{ - m_radioTuner->setStereoMode(static_cast<QRadioTuner::StereoMode>(stereoMode)); -} - -void QDeclarativeRadio::setVolume(int volume) -{ - m_radioTuner->setVolume(volume); -} - -void QDeclarativeRadio::setMuted(bool muted) -{ - m_radioTuner->setMuted(muted); -} - -/*! - \qmlmethod QtMultimedia::Radio::cancelScan() - - Cancel the current scan. Will also cancel a search started with \l searchAllStations. - */ -void QDeclarativeRadio::cancelScan() -{ - m_radioTuner->cancelSearch(); -} - -/*! - \qmlmethod QtMultimedia::Radio::scanDown() - - Searches backward in the frequency range for the current band. - */ -void QDeclarativeRadio::scanDown() -{ - m_radioTuner->searchBackward(); -} - -/*! - \qmlmethod QtMultimedia::Radio::scanUp() - - Searches forward in the frequency range for the current band. - */ -void QDeclarativeRadio::scanUp() -{ - m_radioTuner->searchForward(); -} - -/*! - \qmlmethod QtMultimedia::Radio::searchAllStations(enumeration searchMode) - - Start searching the complete frequency range for the current band, and save all the - radio stations found. The \a searchMode can be either of the values described in the - table below. - - \table - \header \li Value \li Description - \row \li SearchFast - \li Stores each radio station for later retrival and tuning - - \row \li SearchGetStationId - \li Does the same as SearchFast, but also emits the station Id with the \l stationFound signal. - - \endtable - - The snippet below uses \c searchAllStations with \c SearchGetStationId to receive all the radio - stations in the current band, and store them in a ListView. The station Id is shown to the user - and if the user presses a station, the radio is tuned to this station. - - \qml - Item { - width: 640 - height: 360 - - Radio { - id: radio - onStationFound: radioStations.append({"frequency": frequency, "stationId": stationId}) - } - - ListModel { - id: radioStations - } - - ListView { - model: radioStations - delegate: Rectangle { - MouseArea { - anchors.fill: parent - onClicked: radio.frequency = frequency - } - - Text { - anchors.fill: parent - text: stationId - } - } - } - - Rectangle { - MouseArea { - anchors.fill: parent - onClicked: radio.searchAllStations(Radio.SearchGetStationId) - } - } - } - \endqml - */ -void QDeclarativeRadio::searchAllStations(QDeclarativeRadio::SearchMode searchMode) -{ - m_radioTuner->searchAllStations(static_cast<QRadioTuner::SearchMode>(searchMode)); -} - -/*! - \qmlmethod QtMultimedia::Radio::tuneDown() - - Decrements the frequency by the frequency step for the current band. If the frequency is already set - to the minimum frequency, calling this function has no effect. - - \sa band, frequencyStep, minimumFrequency - */ -void QDeclarativeRadio::tuneDown() -{ - int f = frequency(); - f = f - frequencyStep(); - setFrequency(f); -} - -/*! - \qmlmethod QtMultimedia::Radio::tuneUp() - - Increments the frequency by the frequency step for the current band. If the frequency is already set - to the maximum frequency, calling this function has no effect. - - \sa band, frequencyStep, maximumFrequency - */ -void QDeclarativeRadio::tuneUp() -{ - int f = frequency(); - f = f + frequencyStep(); - setFrequency(f); -} - -/*! - \qmlmethod QtMultimedia::Radio::start() - - Starts the radio. If the radio is available, as determined by the \l availability property, - this will result in the \l state becoming \c ActiveState. - */ -void QDeclarativeRadio::start() -{ - m_radioTuner->start(); -} - -/*! - \qmlmethod QtMultimedia::Radio::stop() - - Stops the radio. After calling this method the \l state will be \c StoppedState. - */ -void QDeclarativeRadio::stop() -{ - m_radioTuner->stop(); -} - -void QDeclarativeRadio::_q_stateChanged(QRadioTuner::State state) -{ - emit stateChanged(static_cast<QDeclarativeRadio::State>(state)); -} - -void QDeclarativeRadio::_q_bandChanged(QRadioTuner::Band band) -{ - emit bandChanged(static_cast<QDeclarativeRadio::Band>(band)); -} - -void QDeclarativeRadio::_q_error(QRadioTuner::Error errorCode) -{ - emit error(static_cast<QDeclarativeRadio::Error>(errorCode)); - emit errorChanged(); -} - -void QDeclarativeRadio::_q_availabilityChanged(QMultimedia::AvailabilityStatus availability) -{ - emit availabilityChanged(Availability(availability)); -} - -/*! - \qmlsignal QtMultimedia::Radio::stationFound(int frequency, string stationId) - - This signal is emitted when a new radio station is found. This signal is only emitted - if \l searchAllStations is called with \c SearchGetStationId. - - The \a frequency is returned in Hertz, and the \a stationId corresponds to the station Id - in the \l RadioData for this radio station. - - The corresponding handler is \c onStationFound. - */ - -QT_END_NAMESPACE diff --git a/src/imports/multimedia/qdeclarativeradio_p.h b/src/imports/multimedia/qdeclarativeradio_p.h deleted file mode 100644 index b1dc4e6d9..000000000 --- a/src/imports/multimedia/qdeclarativeradio_p.h +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVERADIO_P_H -#define QDECLARATIVERADIO_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qradiotuner.h> -#include <QtQml/qqml.h> - -Q_MOC_INCLUDE("qdeclarativeradiodata_p.h") - -QT_BEGIN_NAMESPACE - -class QDeclarativeRadioData; - -class QDeclarativeRadio : public QObject -{ - Q_OBJECT - Q_PROPERTY(State state READ state NOTIFY stateChanged) - Q_PROPERTY(Band band READ band WRITE setBand NOTIFY bandChanged) - Q_PROPERTY(int frequency READ frequency WRITE setFrequency NOTIFY frequencyChanged) - Q_PROPERTY(bool stereo READ stereo NOTIFY stereoStatusChanged) - Q_PROPERTY(StereoMode stereoMode READ stereoMode WRITE setStereoMode) - Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged) - Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) - Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged) - Q_PROPERTY(bool searching READ searching NOTIFY searchingChanged) - Q_PROPERTY(int frequencyStep READ frequencyStep NOTIFY bandChanged) - Q_PROPERTY(int minimumFrequency READ minimumFrequency NOTIFY bandChanged) - Q_PROPERTY(int maximumFrequency READ maximumFrequency NOTIFY bandChanged) - Q_PROPERTY(bool antennaConnected READ isAntennaConnected NOTIFY antennaConnectedChanged) - Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged) - Q_PROPERTY(QDeclarativeRadioData* radioData READ radioData CONSTANT) - Q_ENUMS(State) - Q_ENUMS(Band) - Q_ENUMS(Error) - Q_ENUMS(StereoMode) - Q_ENUMS(SearchMode) - Q_ENUMS(Availability) - -public: - enum State { - ActiveState = QRadioTuner::ActiveState, - StoppedState = QRadioTuner::StoppedState - }; - - enum Band { - AM = QRadioTuner::AM, - FM = QRadioTuner::FM, - SW = QRadioTuner::SW, - LW = QRadioTuner::LW, - FM2 = QRadioTuner::FM2 - }; - - enum Error { - NoError = QRadioTuner::NoError, - ResourceError = QRadioTuner::ResourceError, - OpenError = QRadioTuner::OpenError, - OutOfRangeError = QRadioTuner::OutOfRangeError - }; - - enum StereoMode { - ForceStereo = QRadioTuner::ForceStereo, - ForceMono = QRadioTuner::ForceMono, - Auto = QRadioTuner::Auto - }; - - enum SearchMode { - SearchFast = QRadioTuner::SearchFast, - SearchGetStationId = QRadioTuner::SearchGetStationId - }; - - enum Availability { - Available = QMultimedia::Available, - Busy = QMultimedia::Busy, - Unavailable = QMultimedia::ServiceMissing, - ResourceMissing = QMultimedia::ResourceError - }; - - QDeclarativeRadio(QObject *parent = 0); - ~QDeclarativeRadio(); - - QDeclarativeRadio::State state() const; - QDeclarativeRadio::Band band() const; - int frequency() const; - QDeclarativeRadio::StereoMode stereoMode() const; - int volume() const; - bool muted() const; - - bool stereo() const; - int signalStrength() const; - bool searching() const; - - int frequencyStep() const; - int minimumFrequency() const; - int maximumFrequency() const; - - bool isAntennaConnected() const; - - Q_INVOKABLE bool isAvailable() const {return availability() == Available;} - Availability availability() const; - - QDeclarativeRadioData *radioData() { return m_radioData; } - -public Q_SLOTS: - void setBand(QDeclarativeRadio::Band band); - void setFrequency(int frequency); - void setStereoMode(QDeclarativeRadio::StereoMode stereoMode); - void setVolume(int volume); - void setMuted(bool muted); - - void cancelScan(); - void scanDown(); - void scanUp(); - void tuneUp(); - void tuneDown(); - void searchAllStations(QDeclarativeRadio::SearchMode searchMode = QDeclarativeRadio::SearchFast ); - - void start(); - void stop(); - -Q_SIGNALS: - void stateChanged(QDeclarativeRadio::State state); - void bandChanged(QDeclarativeRadio::Band band); - void frequencyChanged(int frequency); - void stereoStatusChanged(bool stereo); - void searchingChanged(bool searching); - void signalStrengthChanged(int signalStrength); - void volumeChanged(int volume); - void mutedChanged(bool muted); - void stationFound(int frequency, QString stationId); - void antennaConnectedChanged(bool connectionStatus); - - void availabilityChanged(Availability availability); - - void errorChanged(); - void error(QDeclarativeRadio::Error errorCode); - -private Q_SLOTS: - void _q_stateChanged(QRadioTuner::State state); - void _q_bandChanged(QRadioTuner::Band band); - void _q_error(QRadioTuner::Error errorCode); - void _q_availabilityChanged(QMultimedia::AvailabilityStatus); - -private: - Q_DISABLE_COPY(QDeclarativeRadio) - - QRadioTuner *m_radioTuner; - QDeclarativeRadioData *m_radioData; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadio)) - -#endif // QDECLARATIVERADIO_P_H diff --git a/src/imports/multimedia/qdeclarativeradiodata.cpp b/src/imports/multimedia/qdeclarativeradiodata.cpp deleted file mode 100644 index 770d6d7c0..000000000 --- a/src/imports/multimedia/qdeclarativeradiodata.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativeradiodata_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype RadioData - \instantiates QDeclarativeRadioData - \inqmlmodule QtMultimedia - \brief Access RDS data from a QML application. - \ingroup multimedia_qml - \ingroup multimedia_radio_qml - \inherits Item - - \c RadioData is your gateway to all the data available through RDS. RDS is the Radio Data System - which allows radio stations to broadcast information like the \l stationId, \l programType, \l programTypeName, - \l stationName, and \l radioText. This information can be read from the \c RadioData. It also allows - you to set whether the radio should tune to alternative frequencies if the current signal strength falls too much. - - \qml - Rectangle { - width: 480 - height: 320 - - Radio { - id: radio - band: Radio.FM - } - - Column { - Text { - text: radio.radioData.stationName - } - - Text { - text: radio.radioData.programTypeName - } - - Text { - text: radio.radioData.radioText - } - } - } - - \endqml - - You use \c RadioData together with a \l Radio, either by - accessing the \c radioData property of the Radio, or - creating a separate RadioData. The properties of the - RadioData type will reflect the information broadcast by the - radio station the Radio is currently tuned to. - - \sa {Radio Overview} -*/ -QDeclarativeRadioData::QDeclarativeRadioData(QObject *parent) : - QObject(parent) -{ - m_radioTuner = new QRadioTuner(this); - m_radioData = m_radioTuner->radioData(); - - connectSignals(); -} - -QDeclarativeRadioData::QDeclarativeRadioData(QRadioTuner *tuner, QObject *parent) : - QObject(parent) -{ - m_radioTuner = tuner; - m_radioData = m_radioTuner->radioData(); - - connectSignals(); -} - -QDeclarativeRadioData::~QDeclarativeRadioData() -{ -} - -/*! - \qmlproperty enumeration QtMultimedia::RadioData::availability - - Returns the availability state of the radio data interface. - - This is one of: - - \table - \header \li Value \li Description - \row \li Available - \li The radio data interface is available to use - \row \li Busy - \li The radio data interface is usually available to use, but is currently busy. - \row \li Unavailable - \li The radio data interface is not available to use (there may be no radio - hardware) - \row \li ResourceMissing - \li There is one or more resources missing, so the radio cannot - be used. It may be possible to try again at a later time. - \endtable - */ -QDeclarativeRadioData::Availability QDeclarativeRadioData::availability() const -{ - if (m_radioData) - return Availability(m_radioData->availability()); - - return Unavailable; -} - - -/*! - \qmlproperty string QtMultimedia::RadioData::stationId - - This property allows you to read the station Id of the currently tuned radio - station. - */ -QString QDeclarativeRadioData::stationId() const -{ - if (m_radioData) - return m_radioData->stationId(); - - return QString(); -} - -/*! - \qmlproperty enumeration QtMultimedia::RadioData::programType - - This property holds the type of the currently playing program as transmitted - by the radio station. The value can be any one of the values defined in the - table below. - - \table - \header \li Value - \row \li Undefined - \row \li News - \row \li CurrentAffairs - \row \li Information - \row \li Sport - \row \li Education - \row \li Drama - \row \li Culture - \row \li Science - \row \li Varied - \row \li PopMusic - \row \li RockMusic - \row \li EasyListening - \row \li LightClassical - \row \li SeriousClassical - \row \li OtherMusic - \row \li Weather - \row \li Finance - \row \li ChildrensProgrammes - \row \li SocialAffairs - \row \li Religion - \row \li PhoneIn - \row \li Travel - \row \li Leisure - \row \li JazzMusic - \row \li CountryMusic - \row \li NationalMusic - \row \li OldiesMusic - \row \li FolkMusic - \row \li Documentary - \row \li AlarmTest - \row \li Alarm - \row \li Talk - \row \li ClassicRock - \row \li AdultHits - \row \li SoftRock - \row \li Top40 - \row \li Soft - \row \li Nostalgia - \row \li Classical - \row \li RhythmAndBlues - \row \li SoftRhythmAndBlues - \row \li Language - \row \li ReligiousMusic - \row \li ReligiousTalk - \row \li Personality - \row \li Public - \row \li College - - \endtable - */ -QDeclarativeRadioData::ProgramType QDeclarativeRadioData::programType() const -{ - if (m_radioData) - return static_cast<QDeclarativeRadioData::ProgramType>(m_radioData->programType()); - - return Undefined; -} - -/*! - \qmlproperty string QtMultimedia::RadioData::programTypeName - - This property holds a string representation of the \l programType. - */ -QString QDeclarativeRadioData::programTypeName() const -{ - if (m_radioData) - return m_radioData->programTypeName(); - - return QString(); -} - -/*! - \qmlproperty string QtMultimedia::RadioData::stationName - - This property has the name of the currently tuned radio station. - */ -QString QDeclarativeRadioData::stationName() const -{ - if (m_radioData) - return m_radioData->stationName(); - - return QString(); -} - -/*! - \qmlproperty string QtMultimedia::RadioData::radioText - - This property holds free-text transmitted by the radio station. This is typically used to - show supporting information for the currently playing content, for instance song title or - artist name. - */ -QString QDeclarativeRadioData::radioText() const -{ - if (m_radioData) - return m_radioData->radioText(); - - return QString(); -} - -/*! - \qmlproperty bool QtMultimedia::RadioData::alternativeFrequenciesEnabled - - This property allows you to specify whether the radio should try and tune to alternative - frequencies if the signal strength of the current station becomes too weak. The alternative - frequencies are emitted over RDS by the radio station, and the tuning happens automatically. - */ -bool QDeclarativeRadioData::alternativeFrequenciesEnabled() const -{ - if (m_radioData) - return m_radioData->isAlternativeFrequenciesEnabled(); - - return false; -} - -void QDeclarativeRadioData::setAlternativeFrequenciesEnabled(bool enabled) -{ - if (m_radioData) - m_radioData->setAlternativeFrequenciesEnabled(enabled); -} - -void QDeclarativeRadioData::_q_programTypeChanged(QRadioData::ProgramType programType) -{ - emit programTypeChanged(static_cast<QDeclarativeRadioData::ProgramType>(programType)); -} - -void QDeclarativeRadioData::_q_error(QRadioData::Error errorCode) -{ - emit error(static_cast<QDeclarativeRadioData::Error>(errorCode)); - emit errorChanged(); -} - -void QDeclarativeRadioData::_q_availabilityChanged(QMultimedia::AvailabilityStatus availability) -{ - emit availabilityChanged(Availability(availability)); -} - -void QDeclarativeRadioData::connectSignals() -{ - if (!m_radioData) - return; - - connect(m_radioData, SIGNAL(programTypeChanged(QRadioData::ProgramType)), this, - SLOT(_q_programTypeChanged(QRadioData::ProgramType))); - - connect(m_radioData, SIGNAL(stationIdChanged(QString)), this, SIGNAL(stationIdChanged(QString))); - connect(m_radioData, SIGNAL(programTypeNameChanged(QString)), this, SIGNAL(programTypeNameChanged(QString))); - connect(m_radioData, SIGNAL(stationNameChanged(QString)), this, SIGNAL(stationNameChanged(QString))); - connect(m_radioData, SIGNAL(radioTextChanged(QString)), this, SIGNAL(radioTextChanged(QString))); - connect(m_radioData, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), this, - SIGNAL(alternativeFrequenciesEnabledChanged(bool))); - // Since the radio data type depends on the service for the tuner, the availability is also dictated from the tuner - connect(m_radioTuner, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); - - connect(m_radioData, SIGNAL(error(QRadioData::Error)), this, SLOT(_q_error(QRadioData::Error))); -} - -QT_END_NAMESPACE diff --git a/src/imports/multimedia/qdeclarativeradiodata_p.h b/src/imports/multimedia/qdeclarativeradiodata_p.h deleted file mode 100644 index df99ff6e0..000000000 --- a/src/imports/multimedia/qdeclarativeradiodata_p.h +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVERADIODATA_P_H -#define QDECLARATIVERADIODATA_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <qradiodata.h> -#include <qradiotuner.h> -#include <QtQml/qqml.h> - -QT_BEGIN_NAMESPACE - -class QDeclarativeRadioData : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString stationId READ stationId NOTIFY stationIdChanged) - Q_PROPERTY(QDeclarativeRadioData::ProgramType programType READ programType NOTIFY programTypeChanged) - Q_PROPERTY(QString programTypeName READ programTypeName NOTIFY programTypeNameChanged) - Q_PROPERTY(QString stationName READ stationName NOTIFY stationNameChanged) - Q_PROPERTY(QString radioText READ radioText NOTIFY radioTextChanged) - Q_PROPERTY(bool alternativeFrequenciesEnabled READ alternativeFrequenciesEnabled - WRITE setAlternativeFrequenciesEnabled NOTIFY alternativeFrequenciesEnabledChanged) - Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged) - Q_ENUMS(Error) - Q_ENUMS(ProgramType) - Q_ENUMS(Availability) - -public: - - enum Error { - NoError = QRadioData::NoError, - ResourceError = QRadioData::ResourceError, - OpenError = QRadioData::OpenError, - OutOfRangeError = QRadioData::OutOfRangeError - }; - - enum ProgramType { - Undefined = QRadioData::Undefined, - News = QRadioData::News, - CurrentAffairs = QRadioData::CurrentAffairs, - Information = QRadioData::Information, - Sport = QRadioData::Sport, - Education = QRadioData::Education, - Drama = QRadioData::Drama, - Culture = QRadioData::Culture, - Science = QRadioData::Science, - Varied = QRadioData::Varied, - PopMusic = QRadioData::PopMusic, - RockMusic = QRadioData::RockMusic, - EasyListening = QRadioData::EasyListening, - LightClassical = QRadioData::LightClassical, - SeriousClassical = QRadioData::SeriousClassical, - OtherMusic = QRadioData::OtherMusic, - Weather = QRadioData::Weather, - Finance = QRadioData::Finance, - ChildrensProgrammes = QRadioData::ChildrensProgrammes, - SocialAffairs = QRadioData::SocialAffairs, - Religion = QRadioData::Religion, - PhoneIn = QRadioData::PhoneIn, - Travel = QRadioData::Travel, - Leisure = QRadioData::Leisure, - JazzMusic = QRadioData::JazzMusic, - CountryMusic = QRadioData::CountryMusic, - NationalMusic = QRadioData::NationalMusic, - OldiesMusic = QRadioData::OldiesMusic, - FolkMusic = QRadioData::FolkMusic, - Documentary = QRadioData::Documentary, - AlarmTest = QRadioData::AlarmTest, - Alarm = QRadioData::Alarm, - Talk = QRadioData::Talk, - ClassicRock = QRadioData::ClassicRock, - AdultHits = QRadioData::AdultHits, - SoftRock = QRadioData::SoftRock, - Top40 = QRadioData::Top40, - Soft = QRadioData::Soft, - Nostalgia = QRadioData::Nostalgia, - Classical = QRadioData::Classical, - RhythmAndBlues = QRadioData::RhythmAndBlues, - SoftRhythmAndBlues = QRadioData::SoftRhythmAndBlues, - Language = QRadioData::Language, - ReligiousMusic = QRadioData::ReligiousMusic, - ReligiousTalk = QRadioData::ReligiousTalk, - Personality = QRadioData::Personality, - Public = QRadioData::Public, - College = QRadioData::College - }; - - enum Availability { - Available = QMultimedia::Available, - Busy = QMultimedia::Busy, - Unavailable = QMultimedia::ServiceMissing, - ResourceMissing = QMultimedia::ResourceError - }; - - QDeclarativeRadioData(QObject *parent = 0); - QDeclarativeRadioData(QRadioTuner *tuner, QObject *parent = 0); - ~QDeclarativeRadioData(); - - QString stationId() const; - QDeclarativeRadioData::ProgramType programType() const; - QString programTypeName() const; - QString stationName() const; - QString radioText() const; - bool alternativeFrequenciesEnabled() const; - - Q_INVOKABLE bool isAvailable() const {return availability() == Available;} - Availability availability() const; - -public Q_SLOTS: - void setAlternativeFrequenciesEnabled(bool enabled); - -Q_SIGNALS: - void stationIdChanged(QString stationId); - void programTypeChanged(QDeclarativeRadioData::ProgramType programType); - void programTypeNameChanged(QString programTypeName); - void stationNameChanged(QString stationName); - void radioTextChanged(QString radioText); - void alternativeFrequenciesEnabledChanged(bool enabled); - - void availabilityChanged(Availability availability); - - void errorChanged(); - void error(QDeclarativeRadioData::Error errorCode); - -private Q_SLOTS: - void _q_programTypeChanged(QRadioData::ProgramType programType); - void _q_error(QRadioData::Error errorCode); - void _q_availabilityChanged(QMultimedia::AvailabilityStatus); - -private: - void connectSignals(); - - Q_DISABLE_COPY(QDeclarativeRadioData) - - QRadioData *m_radioData; - QRadioTuner *m_radioTuner; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadioData)) - -#endif // QDECLARATIVERADIODATA_P_H |