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 /examples | |
parent | 3d909ba8ac0f43af6d70830a5c95df3e741f1221 (diff) |
Remove Radio support
Fixes: QTBUG-84592
Change-Id: I3b9e51689fd542c35cb57cf6c51a141aec3034df
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/multimedia/declarative-radio/Button.qml | 81 | ||||
-rw-r--r-- | examples/multimedia/declarative-radio/declarative-radio.pro | 9 | ||||
-rw-r--r-- | examples/multimedia/declarative-radio/declarative-radio.qrc | 7 | ||||
-rw-r--r-- | examples/multimedia/declarative-radio/doc/images/declarative-radio-example.png | bin | 9809 -> 0 bytes | |||
-rw-r--r-- | examples/multimedia/declarative-radio/doc/src/declarative-radio.qdoc | 40 | ||||
-rw-r--r-- | examples/multimedia/declarative-radio/main.cpp | 69 | ||||
-rw-r--r-- | examples/multimedia/declarative-radio/view.qml | 143 | ||||
-rw-r--r-- | examples/multimedia/multimedia.pro | 2 | ||||
-rw-r--r-- | examples/multimedia/radio/main.cpp | 63 | ||||
-rw-r--r-- | examples/multimedia/radio/radio.cpp | 176 | ||||
-rw-r--r-- | examples/multimedia/radio/radio.h | 85 | ||||
-rw-r--r-- | examples/multimedia/radio/radio.pro | 16 |
12 files changed, 0 insertions, 691 deletions
diff --git a/examples/multimedia/declarative-radio/Button.qml b/examples/multimedia/declarative-radio/Button.qml deleted file mode 100644 index c579795e7..000000000 --- a/examples/multimedia/declarative-radio/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Rectangle { - id: button - border.color: "black" - border.width: 1 - radius: 5 - - property string text - signal clicked - - width: d.buttonWidth - height: d.buttonHeight - - anchors { - margins: root.margins - top: parent.top - } - - Text { - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - text: button.text - } - - MouseArea { - anchors.fill: parent - onClicked: button.clicked(); - } -} diff --git a/examples/multimedia/declarative-radio/declarative-radio.pro b/examples/multimedia/declarative-radio/declarative-radio.pro deleted file mode 100644 index 68942fa3f..000000000 --- a/examples/multimedia/declarative-radio/declarative-radio.pro +++ /dev/null @@ -1,9 +0,0 @@ -QT += qml quick multimedia - -SOURCES += main.cpp -RESOURCES += declarative-radio.qrc - -EXAMPLE_FILES += view.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/declarative-radio -INSTALLS += target diff --git a/examples/multimedia/declarative-radio/declarative-radio.qrc b/examples/multimedia/declarative-radio/declarative-radio.qrc deleted file mode 100644 index 0f7859d78..000000000 --- a/examples/multimedia/declarative-radio/declarative-radio.qrc +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> -<file>view.qml</file> -<file>Button.qml</file> -</qresource> -</RCC> - diff --git a/examples/multimedia/declarative-radio/doc/images/declarative-radio-example.png b/examples/multimedia/declarative-radio/doc/images/declarative-radio-example.png Binary files differdeleted file mode 100644 index 882180b21..000000000 --- a/examples/multimedia/declarative-radio/doc/images/declarative-radio-example.png +++ /dev/null diff --git a/examples/multimedia/declarative-radio/doc/src/declarative-radio.qdoc b/examples/multimedia/declarative-radio/doc/src/declarative-radio.qdoc deleted file mode 100644 index ea0e33da9..000000000 --- a/examples/multimedia/declarative-radio/doc/src/declarative-radio.qdoc +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example multimedia/declarative-radio - \title Declarative Radio Example - \brief Demonstrates using the Radio QML type from Qt Multimedia. - \ingroup multimedia_examples - - This examples uses the \l{Qt Multimedia} \l Radio QML type to list the - available channels on the FM frequency. - - \image declarative-radio-example.png - - \include examples-run.qdocinc -*/ diff --git a/examples/multimedia/declarative-radio/main.cpp b/examples/multimedia/declarative-radio/main.cpp deleted file mode 100644 index 3ed6f1950..000000000 --- a/examples/multimedia/declarative-radio/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2017 The Qt Company Ltd. - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** 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. - ** - ** BSD License Usage - ** Alternatively, you may use this file under the terms of the BSD license - ** as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of The Qt Company Ltd nor the names of its - ** contributors may be used to endorse or promote products derived - ** from this software without specific prior written permission. - ** - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include <QGuiApplication> - -#include <qqml.h> -#include <QtQuick/qquickview.h> - - -int main(int argc, char ** argv) -{ - QGuiApplication app(argc, argv); - - QQuickView view; - - view.setSource(QUrl("qrc:/view.qml")); - view.setMinimumSize(QSize(400, 100)); - view.show(); - - return app.exec(); -} - diff --git a/examples/multimedia/declarative-radio/view.qml b/examples/multimedia/declarative-radio/view.qml deleted file mode 100644 index ab173a737..000000000 --- a/examples/multimedia/declarative-radio/view.qml +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2017 The Qt Company Ltd. - ** Contact: https://www.qt.io/licensing/ - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** 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. - ** - ** BSD License Usage - ** Alternatively, you may use this file under the terms of the BSD license - ** as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of The Qt Company Ltd nor the names of its - ** contributors may be used to endorse or promote products derived - ** from this software without specific prior written permission. - ** - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -import QtQuick 2.0 -import QtMultimedia 5.0 - -Rectangle { - anchors.fill: parent - id: root - property int margins: 5 - property int spacing: 10 - - QtObject { - id: d - property int buttonHeight: root.height > root.width ? root.width / 3 : root.height / 3 - property int buttonWidth: (root.width - spacing * 4) / 4 - } - - Radio { - id: radio - band: Radio.FM - } - - Column { - anchors.fill: parent - anchors.margins: root.margins - - Rectangle { - color: root.color - width: parent.width - height: root.height - d.buttonHeight - 40 - - Text { - id: freq - verticalAlignment: Text.AlignVCenter - text: "" + radio.frequency / 1000 + " kHz" - anchors { - bottom: parent.bottom - margins: root.margins - } - } - Text { - id: sig - anchors { - bottom: parent.bottom - right: parent.right - margins: root.margins - - } - - verticalAlignment: Text.AlignVCenter - text: (radio.availability == Radio.Available ? "No Signal " : "No Radio Found") - } - } - - Row { - spacing: 5 - - Rectangle { - width: root.width - 10 - height: 20 - color: "black" - - Rectangle { - width: 5 - height: 20 - color: "red" - - y: 0 - x: (parent.width - 5) * ((radio.frequency - radio.minimumFrequency) / (radio.maximumFrequency - - radio.minimumFrequency)) - } - } - } - Row { - spacing: root.spacing - Button { - text: "Scan Down" - onClicked: radio.scanDown() - } - Button { - text: "Freq Down" - onClicked: radio.tuneDown() - } - Button { - text: "Freq Up" - onClicked: radio.tuneUp() - } - Button { - text: "Scan Up" - onClicked: radio.scanUp() - } - } - } -} - diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro index 0a01439c4..f49988c31 100644 --- a/examples/multimedia/multimedia.pro +++ b/examples/multimedia/multimedia.pro @@ -6,7 +6,6 @@ SUBDIRS += audiodecoder # These examples all need widgets for now (using creator templates that use widgets) qtHaveModule(widgets) { SUBDIRS += \ - radio \ spectrum \ audiorecorder \ audiodevices \ @@ -17,7 +16,6 @@ qtHaveModule(widgets) { qtHaveModule(quick) { SUBDIRS += \ declarative-camera \ - declarative-radio \ video } diff --git a/examples/multimedia/radio/main.cpp b/examples/multimedia/radio/main.cpp deleted file mode 100644 index d80ae93e3..000000000 --- a/examples/multimedia/radio/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "radio.h" - -#include <QtWidgets> - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - Radio radio; - radio.show(); - - return app.exec(); -}; diff --git a/examples/multimedia/radio/radio.cpp b/examples/multimedia/radio/radio.cpp deleted file mode 100644 index f4c9f5531..000000000 --- a/examples/multimedia/radio/radio.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "radio.h" - -Radio::Radio() -{ - radio = new QRadioTuner; - connect(radio, QOverload<QRadioTuner::Error>::of(&QRadioTuner::error), - this, QOverload<QRadioTuner::Error>::of(&Radio::error)); - - if (radio->isBandSupported(QRadioTuner::FM)) - radio->setBand(QRadioTuner::FM); - - QWidget *window = new QWidget; - QVBoxLayout *layout = new QVBoxLayout; - QHBoxLayout *buttonBar = new QHBoxLayout; - QHBoxLayout *topBar = new QHBoxLayout; - - layout->addLayout(topBar); - - freq = new QLabel; - freq->setText(QString("%1 kHz").arg(radio->frequency()/1000)); - topBar->addWidget(freq); - connect(radio, &QRadioTuner::frequencyChanged, - this, &Radio::freqChanged); - - signal = new QLabel; - if (radio->isAvailable()) - signal->setText(tr("No Signal")); - else - signal->setText(tr("No radio found")); - topBar->addWidget(signal); - connect(radio, &QRadioTuner::signalStrengthChanged, - this, &Radio::signalChanged); - - volumeSlider = new QSlider(Qt::Vertical,this); - volumeSlider->setRange(0, 100); - volumeSlider->setValue(50); - connect(volumeSlider, &QSlider::valueChanged, - this, &Radio::updateVolume); - topBar->addWidget(volumeSlider); - - layout->addLayout(buttonBar); - - searchLeft = new QPushButton; - searchLeft->setText(tr("scan Down")); - connect(searchLeft, &QPushButton::clicked, - this, &Radio::searchDown); - buttonBar->addWidget(searchLeft); - - left = new QPushButton; - left->setText(tr("Freq Down")); - connect(left, &QPushButton::clicked, - this, &Radio::freqDown); - buttonBar->addWidget(left); - - right = new QPushButton; - connect(right, &QPushButton::clicked, - this, &Radio::freqUp); - right->setText(tr("Freq Up")); - buttonBar->addWidget(right); - - searchRight = new QPushButton; - searchRight->setText(tr("scan Up")); - connect(searchRight, &QPushButton::clicked, - this, &Radio::searchUp); - buttonBar->addWidget(searchRight); - - window->setLayout(layout); - setCentralWidget(window); - window->show(); - - radio->start(); -} - -Radio::~Radio() -{ -} - -void Radio::freqUp() -{ - int f = radio->frequency(); - f += radio->frequencyStep(QRadioTuner::FM); - radio->setFrequency(f); -} - -void Radio::freqDown() -{ - int f = radio->frequency(); - f -= radio->frequencyStep(QRadioTuner::FM); - radio->setFrequency(f); -} - -void Radio::searchUp() -{ - radio->searchForward(); -} - -void Radio::searchDown() -{ - radio->searchBackward(); -} - -void Radio::freqChanged(int) -{ - freq->setText(QString("%1 kHz").arg(radio->frequency()/1000)); -} - -void Radio::signalChanged(int) -{ - if(radio->signalStrength() > 25) - signal->setText(tr("Got Signal")); - else - signal->setText(tr("No Signal")); -} - -void Radio::updateVolume(int v) -{ - radio->setVolume(v); -} - -void Radio::error(QRadioTuner::Error error) -{ - const QMetaObject *metaObj = radio->metaObject(); - QMetaEnum errorEnum = metaObj->enumerator(metaObj->indexOfEnumerator("Error")); - qWarning().nospace() << "Warning: Example application received error QRadioTuner::" << errorEnum.valueToKey(error); -} - diff --git a/examples/multimedia/radio/radio.h b/examples/multimedia/radio/radio.h deleted file mode 100644 index f497e6aa2..000000000 --- a/examples/multimedia/radio/radio.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef RADIO_H -#define RADIO_H - -#include <QtWidgets> -#include <QRadioTuner> - -class Radio : public QMainWindow -{ - Q_OBJECT -public: - Radio(); - ~Radio(); - -public slots: - void freqUp(); - void freqDown(); - void searchUp(); - void searchDown(); - void freqChanged(int f); - void signalChanged(int s); - void updateVolume(int v); - void error(QRadioTuner::Error error); - -private: - QLabel *freq; - QLabel *signal; - QPushButton *left; - QPushButton *right; - QPushButton *searchLeft; - QPushButton *searchRight; - QSlider *volumeSlider; - QRadioTuner *radio; -}; - -#endif // RADIO_H diff --git a/examples/multimedia/radio/radio.pro b/examples/multimedia/radio/radio.pro deleted file mode 100644 index 1b1a35b34..000000000 --- a/examples/multimedia/radio/radio.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app -TARGET = radio - -QT += multimedia - -HEADERS = \ - radio.h - -SOURCES = \ - main.cpp \ - radio.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/radio -INSTALLS += target - -QT+=widgets |