diff options
author | Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com> | 2019-11-11 13:04:09 +0100 |
---|---|---|
committer | Bramastyo Harimukti Santoso <bramastyo.harimukti.santoso@pelagicore.com> | 2019-11-18 16:18:39 +0000 |
commit | 64a4257f5b8a3bf9150552394d7e78ec24d713a6 (patch) | |
tree | 7b7b2c63c39ede538fdeae711ae072d569e0c11f /sysui | |
parent | 1fff7e67fe6cc1680ae7ff8f658925b1d2c2c7ce (diff) |
[music] add next and prev intent command
- update the music app to receive the intent
- map 2 signals from the gamepad to send the intent command
Change-Id: I8c2c297b1eff03d4370eafbef9f218e8edff70e0
Reviewed-by: Egor Nemtsev <enemtsev@luxoft.com>
Diffstat (limited to 'sysui')
-rw-r--r-- | sysui/centerconsole/CenterConsoleWindow.qml | 2 | ||||
-rw-r--r-- | sysui/stores/MusicStore.qml | 47 | ||||
-rw-r--r-- | sysui/stores/RootStore.qml | 1 |
3 files changed, 50 insertions, 0 deletions
diff --git a/sysui/centerconsole/CenterConsoleWindow.qml b/sysui/centerconsole/CenterConsoleWindow.qml index 97e9b1e6..9260a3dd 100644 --- a/sysui/centerconsole/CenterConsoleWindow.qml +++ b/sysui/centerconsole/CenterConsoleWindow.qml @@ -118,6 +118,8 @@ Window { sourceComponent: Component { GamePadController { onButtonBPressed: root.nextICAppIsRequested(); + onButtonR1Pressed: root.store.musicStore.sendIntent("next"); + onButtonL1Pressed: root.store.musicStore.sendIntent("prev"); } } active: root.store.enableCursorManagement diff --git a/sysui/stores/MusicStore.qml b/sysui/stores/MusicStore.qml new file mode 100644 index 00000000..204f4f09 --- /dev/null +++ b/sysui/stores/MusicStore.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Luxoft Sweden AB +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Neptune 3 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 QtApplicationManager 2.0 + +QtObject { + id: root + + function sendIntent(command) { + var request = IntentClient.sendIntentRequest("music-command", { musiccommand: command }) + request.onReplyReceived.connect(function() { + if (request.succeeded) + var result = request.result + else + console.log("Intent request failed: " + request.errorMessage) + }) + } +} diff --git a/sysui/stores/RootStore.qml b/sysui/stores/RootStore.qml index 855757d4..ced94b8d 100644 --- a/sysui/stores/RootStore.qml +++ b/sysui/stores/RootStore.qml @@ -51,6 +51,7 @@ Store { readonly property ClusterStore clusterStore: ClusterStore { id: clusterStore } readonly property HUDStore hudStore: HUDStore {} readonly property CenterConsoleStore centerConsole: CenterConsoleStore {} + readonly property MusicStore musicStore: MusicStore {} readonly property string hardwareVariant: ApplicationManager.systemProperties.hardwareVariant property alias clusterAvailable: clusterStore.clusterAvailable |