aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandra Betouni <ABetouni@luxoft.com>2018-05-30 12:12:58 +0200
committerBramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>2018-06-05 09:17:24 +0000
commitc7ce662e65a7fad81a7508a2ea33cbf2d587fabf (patch)
treee40ba527d42c0b6239f13b6f31ac566e67a4caa1
parent75e512aac63f60f1de30eaee6afcf2de88203df9 (diff)
[tunerapp] Grouping music sources in a popup
* Created music sources popup grouping all available music sources in it. Task-number: AUTOSUITE-427 Change-Id: I051cf70260a20598d8fd4e6e77ebf63e1b56d1cb Reviewed-by: Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com>
-rw-r--r--apps/com.pelagicore.tuner/popups/MusicSourcesPopup.qml108
-rw-r--r--apps/com.pelagicore.tuner/stores/TunerStore.qml38
-rw-r--r--apps/com.pelagicore.tuner/views/FullScreenBottomView.qml36
-rw-r--r--imports/assets/translations/cs_CZ.ts10
-rw-r--r--imports/assets/translations/de_DE.ts10
-rw-r--r--imports/assets/translations/en_GB.ts10
-rw-r--r--imports/assets/translations/en_US.ts10
-rw-r--r--imports/assets/translations/ja_JP.ts10
-rw-r--r--imports/assets/translations/ko_KR.ts10
-rw-r--r--imports/assets/translations/zh_CN.ts12
10 files changed, 169 insertions, 85 deletions
diff --git a/apps/com.pelagicore.tuner/popups/MusicSourcesPopup.qml b/apps/com.pelagicore.tuner/popups/MusicSourcesPopup.qml
new file mode 100644
index 00000000..82f2a27d
--- /dev/null
+++ b/apps/com.pelagicore.tuner/popups/MusicSourcesPopup.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Neptune 3 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.6
+import QtQuick.Controls 2.2
+import utils 1.0
+
+import com.pelagicore.styles.neptune 3.0
+
+PopupWindow {
+ id: root
+
+ // TODO this will be refactored in 5.12 following the API changes
+ // of the appman. See PopupWindow.qml for further explanations.
+
+ /*!
+ \qmlproperty var MusicSourcesPopup::model
+
+ The alias property of the list view's model.
+ */
+
+ property alias model: listView.model
+
+ Item {
+ id: popupContent
+
+ anchors.fill: parent
+
+ Label {
+ id: header
+ anchors.baseline: parent.top
+ anchors.baselineOffset: popupScale * 75
+ width: parent.width
+ text: qsTr("Choose Source")
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: popupScale * NeptuneStyle.fontSizeM
+ }
+ Image {
+ id: shadow
+ anchors.top: parent.top
+ anchors.topMargin: popupScale * 120
+ width: parent.width
+ height: popupScale * sourceSize.height
+ source: Style.gfx("popup-title-shadow")
+ }
+
+ ListView {
+ id: listView
+ anchors {
+ top: shadow.bottom
+ left: parent.left
+ leftMargin: popupScale * 40
+ right: parent.right
+ rightMargin: popupScale * 40
+ bottom: parent.bottom
+ bottomMargin: popupScale * 40
+ }
+ interactive: false
+ delegate: RadioButton {
+ width: parent.width
+ height: popupScale * 96
+ font.pixelSize: popupScale * NeptuneStyle.fontSizeS
+ indicator.implicitHeight: popupScale * 30
+ indicator.implicitWidth: popupScale * 30
+ text: model.text
+ spacing: 20
+ onClicked: {
+ if (text === "Music Player") {
+ Qt.openUrlExternally("x-music://");
+ } else if (text === "Web radio") {
+ Qt.openUrlExternally("x-webradio://");
+ } else if (text === "Spotify") {
+ Qt.openUrlExternally("x-spotify://");
+ }
+ root.openPopup = false;
+ }
+ }
+ }
+ }
+}
diff --git a/apps/com.pelagicore.tuner/stores/TunerStore.qml b/apps/com.pelagicore.tuner/stores/TunerStore.qml
index 8ae503bc..811ef78c 100644
--- a/apps/com.pelagicore.tuner/stores/TunerStore.qml
+++ b/apps/com.pelagicore.tuner/stores/TunerStore.qml
@@ -77,13 +77,22 @@ Store {
readonly property string freqUnit: root.tunerBand === tunerControl.band.AMBand ? qsTr("KHz") : qsTr("MHz")
+ property ListModel musicSourcesModel: ListModel {
+ id: musicSourcesModel
+ ListElement { text: "Music Player"}
+ }
+
property var ipc: QtObject {
property var musicIntentsInterface: ApplicationInterfaceExtension {
id: musicIntentsInterface
name: "neptune.musicintents.interface"
Component.onCompleted: {
- toolsColumnModel.get(5).greyedOut = !object.spotifyInstalled;
- toolsColumnModel.get(6).greyedOut = !object.webradioInstalled;
+ if (object.webradioInstalled) {
+ musicSourcesModel.append({"text" : "Web radio"});
+ }
+ if (object.spotifyInstalled) {
+ musicSourcesModel.append({"text" : "Spotify"});
+ }
}
}
@@ -91,10 +100,26 @@ Store {
target: musicIntentsInterface.object
onSpotifyInstalledChanged: {
- toolsColumnModel.get(5).greyedOut = !musicIntentsInterface.object.spotifyInstalled;
+ if (musicIntentsInterface.object.spotifyInstalled) {
+ musicSourcesModel.append({"text" : "Spotify"});
+ } else {
+ for (var i = 0; i < musicSourcesModel.count; i++) {
+ if (musicSourcesModel.get(i).text === "Spotify") {
+ musicSourcesModel.remove(i, 1);
+ }
+ }
+ }
}
onWebradioInstalledChanged: {
- toolsColumnModel.get(6).greyedOut = !musicIntentsInterface.object.webradioInstalled;
+ if (musicIntentsInterface.object.webradioInstalled) {
+ musicSourcesModel.append({"text" : "Web radio"});
+ } else {
+ for (var i = 0; i < musicSourcesModel.count; i++) {
+ if (musicSourcesModel.get(i).text === "Web radio") {
+ musicSourcesModel.remove(i, 1);
+ }
+ }
+ }
}
}
}
@@ -105,10 +130,7 @@ Store {
ListElement { icon: "ic-toolbar-am-band"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "AM band"); greyedOut: false }
ListElement { icon: "ic-toolbar-fm-band"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "FM 1 band"); greyedOut: false }
ListElement { icon: "ic-toolbar-fm-band"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "FM 2 band"); greyedOut: false }
- //ListElement { icon: "ic-toolbar-sources-tuner"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "sources"); greyedOut: false }
- ListElement { icon: "ic-folder-browse"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "music"); greyedOut: false }
- ListElement { icon: "ic-folder-browse"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "spotify"); greyedOut: true }
- ListElement { icon: "ic-folder-browse"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "web radio"); greyedOut: true }
+ ListElement { icon: "ic-toolbar-sources-tuner"; text: QT_TRANSLATE_NOOP("TunerToolsColumn", "sources"); greyedOut: false }
}
property ListModel freqPresetsModel: ListModel {
diff --git a/apps/com.pelagicore.tuner/views/FullScreenBottomView.qml b/apps/com.pelagicore.tuner/views/FullScreenBottomView.qml
index 496fdadb..6a0f4ddb 100644
--- a/apps/com.pelagicore.tuner/views/FullScreenBottomView.qml
+++ b/apps/com.pelagicore.tuner/views/FullScreenBottomView.qml
@@ -40,6 +40,7 @@ import com.pelagicore.styles.neptune 3.0
import "../stores"
import "../panels"
import "../controls"
+import "../popups"
Item {
id: root
@@ -54,29 +55,26 @@ Item {
model: root.store.toolsColumnModel
currentIndex: 1
onClicked: {
- switch (currentText) {
- case "music":
- Qt.openUrlExternally("x-music://");
- break;
- case "web radio":
- Qt.openUrlExternally("x-webradio://");
- break;
- case "spotify":
- Qt.openUrlExternally("x-spotify://");
- break;
- case "AM band":
- case "FM 1 band":
- case "FM 2 band":
- root.store.freqPresets = currentIndex - 1;
- break;
- case "favorites":
- //return favorite stations list
- default:
- break;
+ if (currentText === "sources") {
+ // caclulate popup height based on musicSources list items
+ // + 200 for header & margins
+ var calculateHeight = 200 + (root.store.musicSourcesModel.count * 96);
+ var pos = currentItem.mapToItem(root.parent, currentItem.width/2, currentItem.height/2);
+ //set model each time to ensure data accuracy
+ musicSourcesPopup.model = root.store.musicSourcesModel;
+ musicSourcesPopup.originItemX = pos.x;
+ musicSourcesPopup.originItemY = pos.y;
+ musicSourcesPopup.popupWidth = 910;
+ musicSourcesPopup.popupHeight = calculateHeight;
+ musicSourcesPopup.openPopup = true;
}
}
}
+ MusicSourcesPopup {
+ id: musicSourcesPopup
+ }
+
StationBrowseListPanel {
id: stationBrowseListPanel
anchors.left: toolsColumn.right
diff --git a/imports/assets/translations/cs_CZ.ts b/imports/assets/translations/cs_CZ.ts
index fcb52de7..74d67fa5 100644
--- a/imports/assets/translations/cs_CZ.ts
+++ b/imports/assets/translations/cs_CZ.ts
@@ -1522,15 +1522,19 @@ UX na cestu</translation>
</message>
<message>
<source>music</source>
- <translation type="unfinished">hudba</translation>
+ <translation type="obsolete">hudba</translation>
</message>
<message>
<source>spotify</source>
- <translation type="unfinished">spotify</translation>
+ <translation type="obsolete">spotify</translation>
</message>
<message>
<source>web radio</source>
- <translation type="unfinished">web radio</translation>
+ <translation type="obsolete">web radio</translation>
+ </message>
+ <message>
+ <source>sources</source>
+ <translation type="unfinished">zdroje</translation>
</message>
</context>
<context>
diff --git a/imports/assets/translations/de_DE.ts b/imports/assets/translations/de_DE.ts
index a827045a..845bf319 100644
--- a/imports/assets/translations/de_DE.ts
+++ b/imports/assets/translations/de_DE.ts
@@ -1145,15 +1145,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>music</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>spotify</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>web radio</source>
+ <source>sources</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/imports/assets/translations/en_GB.ts b/imports/assets/translations/en_GB.ts
index 2bdf6e0d..625c39cf 100644
--- a/imports/assets/translations/en_GB.ts
+++ b/imports/assets/translations/en_GB.ts
@@ -812,15 +812,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>music</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>spotify</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>web radio</source>
+ <source>sources</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/imports/assets/translations/en_US.ts b/imports/assets/translations/en_US.ts
index 67f4871a..4e82a18f 100644
--- a/imports/assets/translations/en_US.ts
+++ b/imports/assets/translations/en_US.ts
@@ -770,15 +770,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>music</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>spotify</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>web radio</source>
+ <source>sources</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/imports/assets/translations/ja_JP.ts b/imports/assets/translations/ja_JP.ts
index a0aadb79..529b3ce8 100644
--- a/imports/assets/translations/ja_JP.ts
+++ b/imports/assets/translations/ja_JP.ts
@@ -1310,15 +1310,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>music</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>spotify</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>web radio</source>
+ <source>sources</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/imports/assets/translations/ko_KR.ts b/imports/assets/translations/ko_KR.ts
index ccab2135..10882e98 100644
--- a/imports/assets/translations/ko_KR.ts
+++ b/imports/assets/translations/ko_KR.ts
@@ -1329,15 +1329,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <source>music</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>spotify</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>web radio</source>
+ <source>sources</source>
<translation type="unfinished"></translation>
</message>
</context>
diff --git a/imports/assets/translations/zh_CN.ts b/imports/assets/translations/zh_CN.ts
index e46abbea..f65b418d 100644
--- a/imports/assets/translations/zh_CN.ts
+++ b/imports/assets/translations/zh_CN.ts
@@ -1402,16 +1402,8 @@ If it is wrong, you can just delete first two charactor, just ues &quot;源&quot
<translation type="unfinished"></translation>
</message>
<message>
- <source>music</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>spotify</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <source>web radio</source>
- <translation type="unfinished"></translation>
+ <source>sources</source>
+ <translation type="unfinished">播放源</translation>
</message>
</context>
<context>