diff options
author | Henrik Persson <henrik.persson@intunio.se> | 2016-09-16 09:47:02 +0200 |
---|---|---|
committer | Henrik Persson <henrik.persson@intunio.se> | 2016-10-05 07:58:36 +0000 |
commit | 8c18130960801ba1c9bdf39316aac3801e879a6a (patch) | |
tree | 97ee0cbe23ae69b437bc11e106b0a38d9bdd9eb6 /apps | |
parent | 800bcbfaaaba19fec02a3f37974389b12989574f (diff) |
Radio application using the QtIvi am/fm tuner
A very basic sample of a radio application
Change-Id: I7d26482726791356f558b0182b99df37af9d465b
Reviewed-by: Nedim Hadzic <nedim.hadzic@pelagicore.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/com.pelagicore.radio/ClusterWidget.qml | 71 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/CurrentStationScreen.qml | 216 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/Library.qml | 97 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/LibraryList.qml | 122 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/ManualTuner.qml | 115 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/PlaylistContainer.qml | 148 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/Radio.qml | 65 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/RadioProvider.qml | 65 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/StationInfo.qml | 144 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/TunerSlider.qml | 244 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/icon.png | bin | 0 -> 2484 bytes | |||
-rw-r--r-- | apps/com.pelagicore.radio/info.yaml | 14 | ||||
-rw-r--r-- | apps/com.pelagicore.radio/qmldir | 1 |
13 files changed, 1302 insertions, 0 deletions
diff --git a/apps/com.pelagicore.radio/ClusterWidget.qml b/apps/com.pelagicore.radio/ClusterWidget.qml new file mode 100644 index 0000000..7ff4b0a --- /dev/null +++ b/apps/com.pelagicore.radio/ClusterWidget.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import utils 1.0 +import controls 1.0 +import "." + +Item { + width: Style.clusterWidth * 0.677 + height: parent.height + anchors.horizontalCenter: parent.horizontalCenter + + UIElement { + hspan: 4 + vspan: 3 + + anchors.topMargin: Style.vspan(2) + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + + ColumnLayout { + spacing: 0 + + Label { + text: ((RadioProvider.currentStation.frequency * 0.00001) * 0.1).toFixed(1) + font.pixelSize: Style.fontSizeXL + Layout.fillWidth: true + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + } + Label { + text:RadioProvider.currentStation.stationName + font.pixelSize: Style.fontSizeS + opacity: 0.5 + elide: Text.ElideRight + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + } + } + } +} diff --git a/apps/com.pelagicore.radio/CurrentStationScreen.qml b/apps/com.pelagicore.radio/CurrentStationScreen.qml new file mode 100644 index 0000000..af8ef5b --- /dev/null +++ b/apps/com.pelagicore.radio/CurrentStationScreen.qml @@ -0,0 +1,216 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Layouts 1.0 + +import controls 1.0 +import utils 1.0 +import service.tuner 1.0 +import "." + +UIScreen { + id: root + hspan: 24 + vspan: 24 + + title: 'Radio' + + Connections { + target: RadioProvider + + onCurrentFrequencyChanged: { + if (!slider.dragging) { + radioStationInformation.tuningMode = false + slider.value = RadioProvider.currentFrequency + } + } + } + + ColumnLayout { + id: stationControl + width: Style.hspan(12) + height: Style.vspan(20) + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + spacing: 0 + Spacer {} + Item { + anchors.horizontalCenter: parent.horizontalCenter + id: radioStationInformation + + width: stationInfo.width + height: stationInfo.height + + property bool tuningMode: false + + StationInfo { + id: stationInfo + title: RadioProvider.currentStation.stationName + radioText: RadioProvider.currentStation.radioText + frequency: radioStationInformation.tuningMode ? slider.value : RadioProvider.currentFrequency + } + } + + RowLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 10 + + Tool { + hspan: 1 + vspan: 1 + name: 'backward' + anchors.verticalCenter: parent.verticalCenter + size: Style.symbolSizeS + onClicked: { + RadioProvider.scanBack() + } + } + + TunerSlider { + id: slider + + useAnimation: true + + readonly property real minFrequency: RadioProvider.minimumFrequency + readonly property real maxFrequency: RadioProvider.maximumFrequency + + hspan: 9 + vspan: 1 + + value: RadioProvider.currentFrequency + minimum: minFrequency + maximum: maxFrequency + + function valueToString() { + return value.toFixed(1) + } + + onActiveValueChanged: { + value = activeValue + } + + onDraggingChanged: { + if (dragging) { + radioStationInformation.tuningMode = true + } else { + // radioStationInformation.tuningMode = false + RadioProvider.setFrequency(value) + } + } + } + + Tool { + hspan: 1 + vspan: 1 + name: 'forward' + anchors.verticalCenter: parent.verticalCenter + size: Style.symbolSizeS + onClicked: { + RadioProvider.scanForward() + } + } + } + RowLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Spacer { hspan: 2 } + Tool { + hspan: 2 + name: RadioService.playing?'pause':'play' + onClicked: RadioService.togglePlay() + } + Spacer { hspan: 2 } + } + RowLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Symbol { + vspan: 2 + hspan: 1 + size: Style.symbolSizeXS + name: 'speaker' + } + VolumeSlider { + hspan: 8 + vspan: 2 + anchors.horizontalCenter: parent.horizontalCenter + value: RadioService.volume + onValueChanged: { + RadioService.volume = value + } + } + Label { + hspan: 1 + vspan: 2 + text: Math.floor(RadioService.volume*100) + } + } + Spacer { + Layout.fillWidth: true + Layout.fillHeight: true + } + } + + UIElement { + id: sourceOption + hspan: 4 + vspan: 12 + anchors.right: stationControl.left + anchors.rightMargin: 60 + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -60 + + Column { + spacing: 1 + Button { + hspan: 4 + vspan: 4 + text: "FM" + label.font.pixelSize: Style.fontSizeL + } + Button { + hspan: 4 + vspan: 4 + text: "AM" + enabled: false + label.font.pixelSize: Style.fontSizeL + } + Button { + hspan: 4 + vspan: 4 + text: "SiriusXM" + enabled: false + label.font.pixelSize: Style.fontSizeL + } + } + } +} diff --git a/apps/com.pelagicore.radio/Library.qml b/apps/com.pelagicore.radio/Library.qml new file mode 100644 index 0000000..39337ad --- /dev/null +++ b/apps/com.pelagicore.radio/Library.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 + +import controls 1.0 +import utils 1.0 +import "." + +UIElement { + id: root + hspan: 12 + vspan: 22 + + signal close() + + Rectangle { + anchors.fill: parent + color: "black" + } + + Tool { + id: closeButton + vspan: 2 + hspan: 2 + + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: 35 + name: 'close' + onClicked: root.close() + } + + TabView { + id: tabView + vspan: root.vspan - 2 + hspan: root.hspan + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + horizontalAlignment: false + viewLeftMargin: letterPicker.width + tabWidth: 2 + tabs: [ + { title : "ALL", url : library, properties : {} }, + { title : "FAVS", url : favs, properties : { type: "favorites" } } + ] + + } + + LetterPicker { + id: letterPicker + vspan: root.vspan - 3 + anchors.left: parent.left + anchors.leftMargin: 5 + anchors.bottom: parent.bottom + numOfVisibleLetters: 17 + } + + LibraryList { + id: library + visible: false + } + + LibraryList { + id: favs + visible: false + } +} diff --git a/apps/com.pelagicore.radio/LibraryList.qml b/apps/com.pelagicore.radio/LibraryList.qml new file mode 100644 index 0000000..63427ef --- /dev/null +++ b/apps/com.pelagicore.radio/LibraryList.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 + +import controls 1.0 +import utils 1.0 +import "." + +UIElement { + id: root + hspan: 10 + vspan: 18 + + property string type: "" + + onTypeChanged: { + if (type === "favorites") + listView.model = RadioProvider.radioFavorites + } + + Rectangle { + anchors.fill: parent + color: "black" + } + + ListView { + id: listView + anchors.fill: parent + anchors.topMargin: 10 + model: RadioProvider.stationList + clip: true + highlightMoveDuration: 300 + highlightFollowsCurrentItem: false + currentIndex: RadioProvider.currentIndex + + delegate: UIElement { + hspan: root.hspan + vspan: 3 + + Rectangle { + anchors.fill: parent + opacity: 0.2 + visible: listView.currentIndex === index + } + + Rectangle { + width: parent.width + height: 1 + opacity: 0.2 + color: "white" + } + + Row { + anchors.verticalCenter: parent.verticalCenter + Column { + Label { + hspan: 7 + vspan: 1 + text: model.item.stationName.toUpperCase() + font.pixelSize: Style.fontSizeM + } + Label { + hspan: 7 + vspan: 1 + text: (model.item.frequency / 1000000).toFixed(1) + font.pixelSize: Style.fontSizeS + font.bold: true + } + } + } + + MouseArea { + anchors.fill: parent + onClicked: { + RadioProvider.setStationFromStationList(index) + // RadioProvider.currentIndex = index + } + } + } + + Rectangle { + width: parent.width + height: 300 + anchors.bottom: parent.bottom + gradient: Gradient { + GradientStop { position: 0.0; color: "transparent" } + GradientStop { position: 1.0; color: "black" } + } + } + } + +} diff --git a/apps/com.pelagicore.radio/ManualTuner.qml b/apps/com.pelagicore.radio/ManualTuner.qml new file mode 100644 index 0000000..194b3f6 --- /dev/null +++ b/apps/com.pelagicore.radio/ManualTuner.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 + +import controls 1.0 +import utils 1.0 +import "." + +UIElement { + id: root + hspan: 6 + vspan: 3 + + readonly property real minFrequency: RadioProvider.minimumFrequency * 0.000001 + readonly property real maxFrequency: RadioProvider.maximumFrequency * 0.000001 + readonly property real currentFrequency: (RadioProvider.currentFrequency * 0.00001) * 0.1 // To get the one decimal we use two steps + + Item { + id: content + anchors.fill: parent + anchors.margins: Style.padding + + Rectangle { + color: "black" + anchors.fill: parent + } + + ColumnLayout { + width: 2 + anchors.bottom: view.bottom + anchors.horizontalCenter: parent.horizontalCenter + + Label { + text: (minFrequency + (view.currentIndex * 0.1)).toFixed(1) + horizontalAlignment: Text.AlignHCenter + font.pixelSize: Style.fontSizeS + anchors.horizontalCenter: parent.horizontalCenter + } + + Rectangle { + width: 2 + height: Style.cellHeight * 2.3 + color: '#E61123' + opacity: 0.6 + } + } + + ListView { + id: view + height: Style.cellHeight * 2 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + orientation: Qt.Horizontal + + model: (maxFrequency - minFrequency) * 10 + spacing: 10 + + currentIndex: (currentFrequency - minFrequency) * 10 + + snapMode: ListView.SnapToItem + highlightMoveDuration: 250 + highlightRangeMode: ListView.StrictlyEnforceRange + preferredHighlightBegin: view.width * 0.5 - 1 + preferredHighlightEnd: view.width * 0.5 + 1 + + delegate: Item { + width: 2 + height: view.height + Rectangle { + + width: 2 + height: parent.height + anchors.centerIn: parent + border.color: Qt.darker(color, 1.1) + color: Style.colorOrange + scale: (minFrequency + (index * (maxFrequency - minFrequency))) % 10 === 0 ? 1.2 : 1.0 + transformOrigin: Item.Bottom + opacity: view.currentIndex === index ? 1.0 : 0.25 + Behavior on opacity { NumberAnimation {} } + } + } + } + } +} diff --git a/apps/com.pelagicore.radio/PlaylistContainer.qml b/apps/com.pelagicore.radio/PlaylistContainer.qml new file mode 100644 index 0000000..8224c98 --- /dev/null +++ b/apps/com.pelagicore.radio/PlaylistContainer.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import utils 1.0 +import controls 1.0 +import "." + +RowLayout { + id: playListContainer + + signal clicked(int index) + + spacing: 5 + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: Style.vspan(1) + height: Style.vspan(16) + width: Style.hspan(5) + anchors.rightMargin: expanded ? Style.hspan(0) : -Style.hspan(4) + Behavior on anchors.rightMargin { + NumberAnimation { easing.type: Easing.InCirc; duration: 250 } + } + + property bool expanded: false + + function toggleExpand() { + expanded = !expanded + } + + Tool { + name: 'music' + Layout.alignment: Qt.AlignTop + onClicked: { + playListContainer.toggleExpand() + } + } + Timer { + id: closer + interval: 3000 + onTriggered: { + playListContainer.expanded = false + } + } + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: '#000' + anchors.margins: -Style.padding + ListView { + id: playListView + anchors.fill: parent + clip: true + model: MusicProvider.model + currentIndex: MusicProvider.currentIndex + highlight: Rectangle { + color: Style.colorWhite; opacity: 0.25 + border.color: Qt.lighter(color, 1.2) + } + highlightMoveDuration: 75 + delegate: UIElement { + hspan: 5 + vspan: 2 + RowLayout { + anchors.fill: parent + spacing: 0 + Item { + Layout.fillHeight: true + width: Style.hspan(1) + Item { + anchors.fill: parent + anchors.margins: Style.padding + Rectangle { + anchors.fill: parent + anchors.leftMargin: -6 + anchors.rightMargin: -6 + anchors.topMargin: -2 + anchors.bottomMargin: -2 + color: Style.colorWhite + } + + Image { + anchors.centerIn: parent + height: parent.height + width: parent.height + source: MusicProvider.coverPath(model.cover) + fillMode: Image.PreserveAspectCrop + asynchronous: true + } + } + } + ColumnLayout { + spacing: 0 + Label { + text: model.title + font.pixelSize: Style.fontSizeXS + opacity: 0.5 + elide: Text.ElideRight + Layout.fillWidth: true + } + Label { + text: model.artist + font.pixelSize: Style.fontSizeS + Layout.fillWidth: true + elide: Text.ElideRight + } + } + } + MouseArea { + anchors.fill: parent + onClicked: { + playListContainer.clicked(index) + closer.restart() + } + } + } + } + } +} diff --git a/apps/com.pelagicore.radio/Radio.qml b/apps/com.pelagicore.radio/Radio.qml new file mode 100644 index 0000000..2823e8d --- /dev/null +++ b/apps/com.pelagicore.radio/Radio.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 +import controls 1.0 +import utils 1.0 +import "." + +AppUIScreen { + id: root + title: "Neptune Radio Player" + + onClusterKeyPressed: { + if (key === Qt.Key_Down) { + RadioProvider.next() + } + else if (key === Qt.Key_Up) { + RadioProvider.previous() + } + } + + cluster: ClusterWidget {} + + AppStackView { + id: stack + anchors.fill: parent + initialItem: currentTrack + Component { + id: currentTrack + CurrentStationScreen { + onBackScreen: { + root.back() + } + } + } + } +} diff --git a/apps/com.pelagicore.radio/RadioProvider.qml b/apps/com.pelagicore.radio/RadioProvider.qml new file mode 100644 index 0000000..a6e91be --- /dev/null +++ b/apps/com.pelagicore.radio/RadioProvider.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.1 +import QtIvi 1.0 +import QtIvi.Media 1.0 +import service.tuner 1.0 + +QtObject { + id: root + + readonly property real minimumFrequency: TunerService.frequency.minimum + readonly property real maximumFrequency: TunerService.frequency.maximum + readonly property real currentFrequency: TunerService.frequency.current + readonly property var currentStation: TunerService.station.current + + function stepBack() { + TunerService.stepDown() + } + + function stepForward() { + TunerService.stepUp() + } + + function scanBack() { + TunerService.seekDown() + } + + function scanForward() { + TunerService.seekUp() + } + + function setFrequency(frequency) { + TunerService.setFrequency(frequency) + } +} diff --git a/apps/com.pelagicore.radio/StationInfo.qml b/apps/com.pelagicore.radio/StationInfo.qml new file mode 100644 index 0000000..40de438 --- /dev/null +++ b/apps/com.pelagicore.radio/StationInfo.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 + +import QtQuick.Layouts 1.0 +import QtGraphicalEffects 1.0 +import utils 1.0 +import controls 1.0 + +UIElement { + id: root + hspan: 7 + vspan: 12 + signal clicked() + property alias title: title.text + property alias radioText: radioText.text + property real frequency + + ColumnLayout { + id: theLayout + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: Style.vspan(-1) + spacing: Style.paddingL + Item { + id: mainItem + height: Style.vspan(1.5) + width: root.width + clip: false + + Label { + id: frequency + height: Style.vspan(2) + width: Style.hspan(3) + text: root.frequency.toFixed(1) + anchors.right: suffix.left + + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + + font.pixelSize: Style.fontSizeXXL + } + Label { + id: suffix + height: Style.vspan(1.2) + width: Style.hspan(1) + + text: "MHz" + + font.pixelSize: Style.fontSizeXXS + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignTop + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: frequency.bottom + + anchors.horizontalCenterOffset: Style.hspan(1) + } + } + + Label { + id: title + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignHCenter + font.weight: Font.Light + opacity: 0.5 + } + Item { + id: radioTextContainer + width: root.width + height: radioText.height + clip: true + + property bool scrollingText: radioText.contentWidth > radioText.width + + Text { + id: radioText + + width: parent.width + + horizontalAlignment: radioTextContainer.scrollingText ? Text.AlignLeft : Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + font.family: Style.fontFamily + font.pixelSize: Style.fontSizeS + font.weight: Style.fontWeight + + color: Style.colorWhite + + onTextChanged: { + if (text != "" && radioTextContainer.scrollingText ) { + pingPongAnimation.running = true + } else { + pingPongAnimation.running = false + radioText.x = 0 + } + } + } + + SequentialAnimation { + id: pingPongAnimation + PauseAnimation { duration: 500 } + NumberAnimation { target: radioText; property: "x"; from: 0; to: radioTextContainer.width - radioText.contentWidth; duration: 3000; } + PauseAnimation { duration: 1000 } + NumberAnimation { target: radioText; property: "x"; to: 0; duration: 3000 } + PauseAnimation { duration: 500 } + } + } + } + MouseArea { + anchors.fill: parent + onClicked: root.clicked() + } +} diff --git a/apps/com.pelagicore.radio/TunerSlider.qml b/apps/com.pelagicore.radio/TunerSlider.qml new file mode 100644 index 0000000..9bca9ed --- /dev/null +++ b/apps/com.pelagicore.radio/TunerSlider.qml @@ -0,0 +1,244 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune IVI UI. +** +** $QT_BEGIN_LICENSE:GPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) 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.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-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: GPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 +import utils 1.0 +import controls 1.0 + +UIElement { + id: root; + hspan: 8 + vspan: 2 + property real value // value is read/write. + property real minimum: 0 + property real maximum: 1 + property int length: width - handle.width + property int animationDuration: 250 + property bool useAnimation: false + property alias dragging: area.pressed + + property real activeValue + + Behavior on value { + enabled: useAnimation && !area.drag.active + NumberAnimation { duration: animationDuration} + } + + function valueToString() { + return activeValue.toFixed(2) + } + + Rectangle { + id: background + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: handle.width * 0.5 + anchors.rightMargin: handle.width * 0.5 + height: 4 + radius: 4 + border.color: Qt.lighter(color, 1.1) + color: "#999" + opacity: 0.25 + } + + ColumnLayout { + anchors.bottom: background.top + anchors.left: background.left + anchors.right: background.right + anchors.bottomMargin: markers.markerWidth + + spacing: 0 + + Item { + id: frequencies + Layout.fillWidth: true + height: Style.vspan(1) + + Label { + id: minFreqLabel + text: minimum + + width: 0 + horizontalAlignment: Text.AlignHCenter + + anchors.horizontalCenter: parent.left + anchors.bottom: parent.bottom + + font.family: Style.fontFamily + font.pixelSize: Style.fontSizeS + font.weight: Style.fontWeight + + color: Style.colorWhite + } + + Label { + text: "MHz" + + anchors.left: minFreqLabel.left + + width: Style.hspan(0.9) + + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + + font.pixelSize: Style.fontSizeXXS + } + + Label { + id: meanFreqLabel + text: (minimum + maximum) / 2 + + width: 0 + horizontalAlignment: Text.AlignHCenter + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: Style.paddingXS + + + font.family: Style.fontFamily + font.pixelSize: Style.fontSizeM + font.weight: Style.fontWeight + + color: Style.colorWhite + } + + Label { + text: "MHz" + + width: Style.hspan(1.1) + + anchors.left: meanFreqLabel.left + + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + + font.pixelSize: Style.fontSizeXXS + } + + Label { + id: maxFreqLabel + text: maximum + + width: 0 + horizontalAlignment: Text.AlignHCenter + + anchors.horizontalCenter: parent.right + anchors.bottom: parent.bottom + + font.family: Style.fontFamily + font.pixelSize: Style.fontSizeS + font.weight: Style.fontWeight + + color: Style.colorWhite + } + + Label { + text: "MHz" + + width: Style.hspan(0.9) + + anchors.left: maxFreqLabel.left + + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignBottom + + font.pixelSize: Style.fontSizeXXS + } + } + + Item { + id: markers + height: Style.vspan(1.5) + Layout.fillWidth: true + + property int markerWidth: 2 + property int markerCount: 41 + + RowLayout { + anchors.fill: parent + spacing: (parent.width - (markers.markerCount * markers.markerWidth)) / (markers.markerCount - 1) + Repeater { + model: markers.markerCount + delegate: Rectangle { + id: marker + Layout.alignment: Qt.AlignLeft | Qt.AlignBottom + transformOrigin: Item.Bottom + height: Style.vspan(1.5) + width: markers.markerWidth + radius: markers.markerWidth + opacity: index % 10 ? 0.25 : 0.5 + scale: index % 10 ? 0.7 : 1 + color: "#999" + } + } + } + } + } + + Rectangle { + id: handle; + smooth: true + width: 26; + y: (root.height - height)/2; + x: (root.value - root.minimum) * root.length / (root.maximum - root.minimum) + + height: width; radius: width/2 + border.color: Qt.lighter(color, 1.1) + color: '#fff' + + Rectangle { + color: Style.colorOrange + width: 2 + height: Style.vspan(1.2) + + radius: width + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.top + } + + MouseArea { + id: area + hoverEnabled: false + width: Style.hspan(2) + height: width + anchors.centerIn: parent + drag.target: root.dragging ? parent : undefined + drag.axis: Drag.XAxis; drag.minimumX: 0; drag.maximumX: root.length + onPositionChanged: { + root.activeValue = root.minimum + (root.maximum - root.minimum) * handle.x / root.length + } + } + } +} diff --git a/apps/com.pelagicore.radio/icon.png b/apps/com.pelagicore.radio/icon.png Binary files differnew file mode 100644 index 0000000..5ec0d39 --- /dev/null +++ b/apps/com.pelagicore.radio/icon.png diff --git a/apps/com.pelagicore.radio/info.yaml b/apps/com.pelagicore.radio/info.yaml new file mode 100644 index 0000000..df1622c --- /dev/null +++ b/apps/com.pelagicore.radio/info.yaml @@ -0,0 +1,14 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'com.pelagicore.radio' +icon: 'icon.png' +code: 'Radio.qml' +runtime: 'qml' +name: + en: 'Radio' + de: 'Radio' + +categories: [ 'media' ] + +built-in: yes diff --git a/apps/com.pelagicore.radio/qmldir b/apps/com.pelagicore.radio/qmldir new file mode 100644 index 0000000..7ab2b7f --- /dev/null +++ b/apps/com.pelagicore.radio/qmldir @@ -0,0 +1 @@ +singleton RadioProvider 1.0 RadioProvider.qml |