diff options
Diffstat (limited to 'CenterConsole/apps/com.pelagicore.media')
17 files changed, 1637 insertions, 0 deletions
diff --git a/CenterConsole/apps/com.pelagicore.media/AlbumScreen.qml b/CenterConsole/apps/com.pelagicore.media/AlbumScreen.qml new file mode 100644 index 0000000..27cf65a --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/AlbumScreen.qml @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 + +import service.music 1.0 +import service.movie 1.0 +import controls 1.0 +import utils 1.0 +import "." + +UIScreen { + id: root + property string modelType: "Music" + + width: Style.screenWidth + title: modelType === "Music" ? 'Music' : 'Movies' + signal showCurrentTrack() + + GridView { + id: grid + width: Style.screenWidth - 60 + height: 1020 + cellWidth: 340 + cellHeight: root.modelType === "Music" ? 340 : 490 + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + anchors.margins: Style.statusBarHeight*2 + model: modelType === "Music" ? MusicProvider.nowPlaying.model : MovieProvider.model + clip: true + snapMode: GridView.SnapToRow + delegate: Item { + width: 330 + height: root.modelType === "Music" ? 330 : 500 + Image { + source: Style.symbol("RectangleGradient256x512") + anchors.fill: parent + } + Tool { + vspan: 2 + z: 3 + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottomMargin: 120 + name: { + if (root.modelType === "Music") + active ? "video-pause" : "video-play" + else + "video-play" + } + onClicked: { + if (root.modelType === "Music") { + active ? MusicService.pause() : MusicService.play() + if (MusicProvider.currentIndex !== index) { + active ? MusicService.pause() : MusicService.play() + MusicProvider.currentIndex = index + } + } + else { + MusicService.pause() + MovieProvider.currentIndex = index + root.showCurrentTrack() + } + } + active: MusicProvider.currentIndex === index && MusicService.playing + } + Image { + z: 2 + source: Style.symbol('MusicOverlayGradient') + anchors.fill: parent + } + + Text { + z: 2 + width: 300 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: coverImage.bottom + anchors.bottomMargin: Style.padding + maximumLineCount: 2 + text: model.title + color: Style.colorWhite + wrapMode: Text.WordWrap + font.pixelSize: Style.fontSizeS + horizontalAlignment: Text.AlignHCenter + visible: modelType === "Music" + } + Image { + id: coverImage + source: modelType === "Music" ? MusicProvider.coverPath(model.cover) : MovieProvider.coverPath(model.cover) + width: parent.width + fillMode: Image.PreserveAspectFit + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + } + } + + + LaunchItemBackground { + id: musicLibrary + text: "Music" + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: Style.padding + height: 226 + width: Style.launchBarHeight + scale: musicArea.pressed?0.85:1.0 + + Image { + source: Style.symbol("music") + anchors.centerIn: parent + } + + MouseArea { + id: musicArea + anchors.fill: parent + onClicked: { + root.modelType = "Music" + } + } + + + Component.onCompleted: MusicProvider.selectRandomTracks() + } + + LaunchItemBackground { + text: "Movies" + + anchors.left: musicLibrary.right + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.margins: Style.padding + height: 226 + width: Style.launchBarHeight + scale: movieArea.pressed?0.85:1.0 + + Image { + source: Style.symbol("video") + anchors.centerIn: parent + } + + MouseArea { + id: movieArea + anchors.fill: parent + onClicked: { + root.modelType = "Movies" + } + } + Component.onCompleted: MovieProvider.selectRandom() + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/ClusterWidget.qml b/CenterConsole/apps/com.pelagicore.media/ClusterWidget.qml new file mode 100644 index 0000000..58dbcc1 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/ClusterWidget.qml @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.7 +import "." +import utils 1.0 + +Item { + id: musicContainer + + property url currentCover: MusicProvider.currentCover + property string currentSong: MusicProvider.currentEntry.title + property string currentArtist: MusicProvider.currentEntry.artist + opacity: 0.5 + property int defaultYPos: 0//400 + y: defaultYPos + + Image { + id: image + width: 354 + height: 354 + source: "ClusterWidgetGradient.png" + + Image { + anchors.margins: 60 + fillMode: Image.PreserveAspectCrop + anchors.fill: parent + asynchronous: true + source: currentCover + } + } + + Text { + id: title + anchors.top: image.bottom + anchors.topMargin: -45 + anchors.horizontalCenter: image.horizontalCenter + text: currentSong + color: "gray" + font.pixelSize: 10 + } + + Text { + anchors.top: title.bottom + anchors.horizontalCenter: image.horizontalCenter + text: currentArtist + color: "lightGray" + font.pixelSize: 10 + } + + Timer { + id: fadeOutTimer + interval: 3000 + running: false + repeat: false + onTriggered: { + fadeOut.start() + } + } + + PropertyAnimation on opacity { + id: fadeIn + to: 1.0 + duration: 500 + } + + PropertyAnimation on opacity { + id: fadeOut + to: 0.5 + duration: 500 + } + + // TODO: Find out why these commented-out animations cause flashing on HW, and fix it +// PropertyAnimation on y { +// id: startupAnimation +// to: 0 +// duration: 500 +// easing.type: Easing.InCubic +// } + + Component.onCompleted: { +// startupAnimation.start() +// fadeIn.start() +// fadeOutTimer.start() + } + + onCurrentCoverChanged: { + fadeIn.start() + fadeOutTimer.restart() + } + + onCurrentSongChanged: { + fadeIn.start() + fadeOutTimer.restart() + } + + onVisibleChanged: { + if (visible) { +// y = defaultYPos +// startupAnimation.start() + fadeIn.start() + fadeOutTimer.restart() + } + } +} + diff --git a/CenterConsole/apps/com.pelagicore.media/ClusterWidgetGradient.png b/CenterConsole/apps/com.pelagicore.media/ClusterWidgetGradient.png Binary files differnew file mode 100644 index 0000000..634f569 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/ClusterWidgetGradient.png diff --git a/CenterConsole/apps/com.pelagicore.media/CoverItem.qml b/CenterConsole/apps/com.pelagicore.media/CoverItem.qml new file mode 100644 index 0000000..c91bd05 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/CoverItem.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +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: 6 + vspan: 12 + signal pressed() + property alias source: image.source + property alias title: title.text + property alias subTitle: subTitle.text + + ColumnLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Item { + anchors.horizontalCenter: parent.horizontalCenter + width: Style.hspan(5) + height: width + Rectangle { + anchors.fill: parent + color: Style.colorWhite + border.color: Qt.darker(color, 1.2) + } + Image { + id: image + anchors.fill: parent + anchors.margins: Style.paddingXS + fillMode: Image.PreserveAspectCrop + asynchronous: true + } + } + Label { + id: title + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + font.weight: Font.Light + opacity: 0.5 + } + Label { + id: subTitle + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + font.pixelSize: Style.fontSizeS + } + } + MouseArea { + anchors.fill: parent + onClicked: root.pressed() + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/CurrentTrackScreen.qml b/CenterConsole/apps/com.pelagicore.media/CurrentTrackScreen.qml new file mode 100644 index 0000000..5d84d6c --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/CurrentTrackScreen.qml @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 + +import controls 1.0 +import utils 1.0 +import service.music 1.0 +import "." + +UIScreen { + id: root + hspan: 24 + vspan: 24 + + title: 'Music' + + property var track: MusicProvider.currentEntry + property bool libraryVisible: false + + signal showAlbums() + + Image { + id: screenCast + source: Style.symbol("screencast") + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 20 + MouseArea { + anchors.fill: parent + onClicked: { + + } + } + } + + ColumnLayout { + id: musicControl + width: Style.screenWidth + height: root.height + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + spacing: 0 + Spacer { + vspan: 2 + } + + SwipeView { + id: pathView + itemWidth: Style.screenWidth + + width: Style.screenWidth + height: Style.cellHeight * 12 + + items: MusicProvider.nowPlaying.model + + currentViewIndex: MusicProvider.currentIndex + + onCurrentViewIndexChanged: MusicProvider.currentIndex = pathView.currentViewIndex + + delegate: CoverItem { + z: PathView.z + scale: PathView.scale + source: MusicProvider.coverPath(model.cover) + title: model.title + subTitle: model.artist + onClicked: { + // MusicService.togglePlay() + root.showAlbums() + } + } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + spacing: 10 + Label { + id: textElement + text: MusicService.currentTime + } + + Slider { + id: slider + value: MusicService.position + minimum: 0.00 + maximum: MusicService.duration + vspan: 1 + function valueToString() { + return Math.floor(value/60000) + ':' + Math.floor((value/1000)%60) + } + onActiveValueChanged: { + MusicService.seek(activeValue) + } + } + + Label { + text: MusicService.durationTime + } + } + + RowLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + Tool { + hspan: 2 + name: 'video-previous' + onClicked: MusicService.previousTrack() + size: Style.symbolSizeXS + } + Spacer { hspan: 2 } + Tool { + hspan: 2 + name: MusicService.playing?'video-pause':'video-play' + onClicked: MusicService.togglePlay() + } + Spacer { hspan: 2 } + Tool { + hspan: 2 + name: 'video-next' + onClicked: MusicService.nextTrack() + size: Style.symbolSizeXS + } + } + Spacer { + Layout.fillWidth: true + Layout.fillHeight: true + } + } + + Library { + id: library + x: parent.width + opacity: 0 + visible: opacity > 0 + onClose: { + root.libraryVisible = false + } + } + + UIElement { + id: sourceOption + hspan: 4 + vspan: 12 + anchors.right: musicControl.left + anchors.rightMargin: 60 + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -60 + + Column { + spacing: 1 + Button_neptune { + hspan: 4 + vspan: 4 + text: "BLUETOOTH" + label.font.pixelSize: Style.fontSizeL + } + Button_neptune { + hspan: 4 + vspan: 4 + text: "USB" + enabled: false + label.font.pixelSize: Style.fontSizeL + } + Button_neptune { + hspan: 4 + vspan: 4 + text: "SPOTIFY" + enabled: false + label.font.pixelSize: Style.fontSizeL + } + } + } + + Component.onCompleted: MusicProvider.selectRandomTracks() + + states: State { + name: "libaryMode"; when: root.libraryVisible + + PropertyChanges { + target: library + opacity: 1 + x: root.width - library.width + } + + PropertyChanges { + target: libraryButton + opacity: 0 + } + + PropertyChanges { + target: sourceOption + opacity: 0 + } + + AnchorChanges { + target: musicControl + anchors.horizontalCenter: undefined + } + + PropertyChanges { + target: musicControl + x: 0 + } + } + + transitions: Transition { + from: ""; to: "libaryMode"; reversible: true + + ParallelAnimation { + NumberAnimation { target: library; properties: "opacity"; duration: 400 } + NumberAnimation { target: library; properties: "x"; duration: 300 } + NumberAnimation { target: libraryButton; properties: "opacity"; duration: 300 } + NumberAnimation { target: sourceOption; properties: "opacity"; duration: 300 } + NumberAnimation { target: musicControl; properties: "x"; duration: 300 } + } + } + +} diff --git a/CenterConsole/apps/com.pelagicore.media/Library.qml b/CenterConsole/apps/com.pelagicore.media/Library.qml new file mode 100644 index 0000000..7896ffa --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/Library.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +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" + } + + + LibraryList { + id: nowPlaying + visible: false + nowPlaying: true + } + + LibraryList { + id: library + visible: false + } +} + diff --git a/CenterConsole/apps/com.pelagicore.media/LibraryList.qml b/CenterConsole/apps/com.pelagicore.media/LibraryList.qml new file mode 100644 index 0000000..3906024 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/LibraryList.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 + +import controls 1.0 +import utils 1.0 +import service.music 1.0 +import "." + +UIElement { + id: root + hspan: 10 + vspan: 18 + + property string type: "" + property bool nowPlaying: false + + onTypeChanged: { + if (type === "songs") + MusicProvider.querySongs() + else if (type === "artists") + MusicProvider.queryArtists() + else if (type === "albums") + MusicProvider.queryAllAlbums() + } + + Rectangle { + anchors.fill: parent + color: "black" + } + + ListView { + id: listView + anchors.fill: parent + anchors.topMargin: 10 + model: root.nowPlaying ? MusicProvider.nowPlaying.model : MusicProvider.musicLibrary.model + clip: true + highlightMoveDuration: 300 + highlightFollowsCurrentItem: false + currentIndex: MusicProvider.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 + Icon { + hspan: 2 + vspan: hspan + anchors.verticalCenter: parent.verticalCenter + fit: true + source: MusicProvider.coverPath(model.cover) + } + + Column { + Label { + text: root.type === "albums" ? model.album.toUpperCase() : model.title.toUpperCase() + font.pixelSize: Style.fontSizeM + } + Label { + text: model.artist.toUpperCase() + font.bold: true + } + } + } + + MouseArea { + anchors.fill: parent + onClicked: { + if (root.nowPlaying) { + MusicProvider.currentIndex = index + } + else { + listView.currentIndex = index + if (root.type === "songs") { + MusicProvider.selectSpecSong() + MusicProvider.currentIndex = index + } + else if (root.type === "artists") + MusicProvider.querySpecArtist(model.artist) + else if (root.type === "albums") + MusicProvider.querySpecAlbum(model.album) + } + MusicService.play() + } + } + } + + 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/CenterConsole/apps/com.pelagicore.media/MediaSelectionWidget.qml b/CenterConsole/apps/com.pelagicore.media/MediaSelectionWidget.qml new file mode 100644 index 0000000..681e3ce --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/MediaSelectionWidget.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 + +import utils 1.0 +import service.movie 1.0 +import controls 1.0 +import "." + +Item { + id: musicLibrary + height: Style.launchBarHeight / 2 + width: 512 + anchors.margins: Style.padding + anchors.rightMargin: Style.paddingXXL + property alias model: repeater.model + property string modelType + + + Image { + source: Style.symbol("RectangleGradient256x512") + } + + Image { + z: 2 + source: Style.symbol("MusicOverlayGradient2") + } + + Label { + id: title + z: 3 + text: modelType + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: Style.paddingXXL + } + + Grid { + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + rows: 2 + columns: 4 + Repeater { + id: repeater + + delegate: Item { + width: musicLibrary.width/4 + height: musicLibrary.height/2 + Image { + source: modelType === "Music" ? MusicProvider.coverPath(model.cover) : MovieService.coverPath(model.cover) + anchors.fill: parent + } + } + } + } + MouseArea { + anchors.fill: parent + onClicked: + root.modelType = modelType + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/MoviePlayer.qml b/CenterConsole/apps/com.pelagicore.media/MoviePlayer.qml new file mode 100644 index 0000000..aa7ada6 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/MoviePlayer.qml @@ -0,0 +1,148 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 +import QtQuick.Controls 1.0 +import QtMultimedia 5.0 +import QtGraphicalEffects 1.0 + +import controls 1.0 +import utils 1.0 +import "." + +UIScreen { + id: root + hspan: 24 + vspan: 24 + + title: 'Movies' + + property bool active: false + property bool hideControls: false + + property var track: MovieProvider.currentEntry + + onBackScreen: { + video.stop() + MovieProvider.state = MediaPlayer.StoppedState + } + + Video { + id: video + anchors.fill: parent + source: MovieProvider.sourcePath(root.track.source) + autoPlay: true + property bool running: playbackState === MediaPlayer.PlayingState + + function togglePlay() { + if (running) { + pause() + } else { + play() + } + } + onPlaybackStateChanged: { + MovieProvider.state = playbackState + } + } + + Rectangle { + anchors.fill: toolBar + anchors.margins: -Style.paddingL + color: '#000' + opacity: toolBar.opacity * 0.85 + radius: Style.buttonRadius + } + ColumnLayout { + id: toolBar + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: Style.vspan(4) + spacing: 0 + opacity: root.hideControls?0.0:1.0 + Behavior on opacity { + NumberAnimation { duration: 1000 } + } + RowLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: Style.hspan(2) + Tool { + name: 'video-previous' + onClicked: MovieProvider.previous() + } + Tool { + name: video.running?'video-pause':'video-play' + onClicked: video.togglePlay() + } + Tool { + name: 'video-next' + onClicked: MovieProvider.next() + } + } + Slider { + anchors.horizontalCenter: parent.horizontalCenter + value: video.position + minimum: 0.00 + maximum: video.duration + vspan: 1 + function valueToString() { + return Math.floor(value/60000) + ':' + Math.floor((value/1000)%60) + } + onActiveValueChanged: { + video.seek(activeValue) + MovieProvider.seek = activeValue + } + } + } + + MouseArea { + id: clickOverlay + anchors.fill: parent + onClicked: { + root.hideControls = false + enabled = false + hideTimer.start() + } + } + + Timer { + id: hideTimer + interval: 5000 + running: video.running + onTriggered: { + root.hideControls = true + clickOverlay.enabled = true + } + } + + Component.onDestruction: { + // required to avoid crashing qmllive + video.source = '' + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/MovieProvider.qml b/CenterConsole/apps/com.pelagicore.media/MovieProvider.qml new file mode 100644 index 0000000..f506957 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/MovieProvider.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.1 +import com.pelagicore.datasource 1.0 +import service.movie 1.0 + +SqlQueryDataSource { + id: root + database: "media" + + property url filePrefix: "file:///" + property int currentIndex: 0 + property var currentEntry: get(currentIndex); + property url currentSource: filePrefix + storageLocation + '/media/movies/' + currentEntry.source + property url currentCover: filePrefix + storageLocation + '/media/movies/' + currentEntry.cover + + /* + MediaPlayer.PlayingState 1 - the media is playing + MediaPlayer.PausedState 2 - the media is paused + MediaPlayer.StoppedState 0 - the media is stopped*/ + //Create playing state and seek to share between views + property int state: 0 + property int seek: 0 + + function selectRandom() { + root.currentIndex = -1 + query = 'select * from movies order by random()' + root.currentIndex = 0 + } + + function coverPath(cover) { + return Qt.resolvedUrl(filePrefix + storageLocation + '/media/movies/' + cover) + } + + function sourcePath(source) { + return Qt.resolvedUrl(filePrefix + storageLocation + '/media/movies/' + source) + } + + function next() { + print('$movies.nextTrack()') + root.currentIndex++ + } + + function previous() { + print('$movies.previousTrack()') + root.currentIndex-- + } + + Component.onCompleted: { + MovieService.movieProvider = root + MovieService.trackCount = Qt.binding(function() { return root.count}) + MovieService.currentTrack = Qt.binding(function() { return root.get(root.currentIndex)}) + MovieService.currentIndex = Qt.binding(function() { return root.currentIndex}) + print("*******************Movie provider completed") + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/Music.qml b/CenterConsole/apps/com.pelagicore.media/Music.qml new file mode 100644 index 0000000..868a387 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/Music.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.1 + +import controls 1.0 +import utils 1.0 +import "." +import com.pelagicore.ScreenManager 1.0 + +AppUIScreen { + id: root + title: "Neptune Music Player" + + onClusterKeyPressed: { + if (key === Qt.Key_Down) { + MusicProvider.next() + } + else if (key === Qt.Key_Up) { + MusicProvider.previous() + } + } + + Component.onCompleted: { + if (ScreenManager.screenCount() > 1) { + clusterComponent = Qt.createComponent("ClusterWidget.qml") + } else { + console.log("Cannot show widget in cluster") + } + if (clusterComponent.status === Component.Ready) { + cluster = clusterComponent.createObject(root) + } + } + passenger: PassengerWidget {} + + AppStackView { + id: stack + anchors.fill: parent + initialItem: albums + + Component { + id: albums + AlbumScreen { + onBackScreen: { + root.back() + } + onShowCurrentTrack: { + stack.push(moviePlayer) + } + } + } + Component { + id: moviePlayer + MoviePlayer { + onBackScreen: { + stack.pop() + } + } + } + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/MusicProvider.qml b/CenterConsole/apps/com.pelagicore.media/MusicProvider.qml new file mode 100644 index 0000000..2df9e8c --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/MusicProvider.qml @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +pragma Singleton +import QtQuick 2.1 +import QtApplicationManager 1.0 +import com.pelagicore.datasource 1.0 +import service.music 1.0 + +QtObject { + id: root + + property SqlQueryDataSource musicLibrary: SqlQueryDataSource { + database: "media" + query: 'select * from music' + } + + property SqlQueryDataSource nowPlaying: SqlQueryDataSource { + database: "media" + query: 'select * from music' + } + + property int currentIndex: 0 + property int count: nowPlaying.count + onCountChanged: { + currentIndex = 0 + } + + + property url filePrefix: "file:///" + + property var currentEntry: nowPlaying.get(currentIndex) + property url currentSource: filePrefix + nowPlaying.storageLocation + '/media/music/' + currentEntry.source + property url currentCover: filePrefix + nowPlaying.storageLocation + '/media/music/' + currentEntry.cover + + function queryAllAlbums() { + musicLibrary.query = 'select * from music group by album' + } + + function querySongs() { + musicLibrary.query = 'select distinct * from music' + } + + function queryArtists() { + musicLibrary.query = 'select * from music group by artist' + } + + function querySpecArtist(artist) { + nowPlaying.query = "select distinct * from music where artist='" + artist + "'" + } + + function querySpecAlbum(album) { + nowPlaying.query = "select distinct * from music where album='" + album + "'" + } + + function selectSpecSong () { + nowPlaying.query = 'select distinct * from music' + } + + function selectRandomTracks() { + nowPlaying.query = 'select distinct * from music order by random()' + // TODO: currentIndex should be updated, otherwise currentEntry is initially wrong + // TODO: Let's just do this hack, it will fix the issues.. + next() + } + + function selectRecentTracks() { + nowPlaying.query = 'select distinct * from music order by random() limit 8' + } + + function coverPath(cover) { + return Qt.resolvedUrl(filePrefix + root.nowPlaying.storageLocation + '/media/music/' + cover) + } + + function sourcePath(source) { + return Qt.resolvedUrl(filePrefix + root.nowPlaying.storageLocation + '/media/music/' + source) + } + + function next() { + print('MusicService.nextTrack()') + if (root.currentIndex < root.count - 1) + currentIndex++ + } + + function previous() { + print('MusicService.previousTrack()') + if (currentIndex > 0) + currentIndex-- + } + + function initialize() { + MusicService.musicProvider = root + MusicService.currentIndex = Qt.binding(function() { return root.currentIndex}) + MusicService.currentTrack = Qt.binding(function() { return root.currentEntry}) + MusicService.trackCount = Qt.binding(function() { return root.nowPlaying.count}) + MusicService.coverPath = Qt.binding(function() { return root.currentCover}) + MusicService.url = Qt.binding(function() { return root.currentSource}) + } + + + property Item ipc: Item { + ApplicationInterfaceExtension { + id: musicRemoteControl + + name: "com.pelagicore.music.control" + } + + Binding { target: musicRemoteControl.object; property: "currentTrack"; value: MusicService.currentTrack } + Binding { target: musicRemoteControl.object; property: "currentTime"; value: MusicService.currentTime } + Binding { target: musicRemoteControl.object; property: "durationTime"; value: MusicService.durationTime } + Binding { target: musicRemoteControl.object; property: "playing"; value: MusicService.playing } + Binding { target: musicRemoteControl.object; property: "currentCover"; value: MusicService.coverPath } + + Connections { + target: musicRemoteControl.object + + onPlay: { + MusicService.musicPlay() + } + + onPause: { + MusicService.pause() + } + + onPreviousTrack: { + MusicService.previousTrack() + } + + onNextTrack: { + MusicService.nextTrack() + } + } + } + + Component.onCompleted: { + initialize() + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/PassengerWidget.qml b/CenterConsole/apps/com.pelagicore.media/PassengerWidget.qml new file mode 100644 index 0000000..1929143 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/PassengerWidget.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import QtMultimedia 5.0 + +import utils 1.0 +import controls 1.0 +import service.music 1.0 +import "." + +Item { + id: musicContainer + property url currentCover: MusicProvider.currentCover + property var track: MovieProvider.currentEntry + property int state: MovieProvider.state + property int seek: MovieProvider.seek + + width: Style.screenHeight + height: Style.screenWidth + + Image { + id: image + anchors.centerIn: parent + asynchronous: true + source: MusicProvider.currentCover + } + + onStateChanged: { + if (state == MediaPlayer.PlayingState) { + video.play() + } else if (state == MediaPlayer.PausedState){ + video.pause() + } else { + video.stop() + } + } + onSeekChanged: video.seek(seek) + + Video { + id: video + visible: state === MediaPlayer.StoppedState ? false : true + anchors.fill: parent + source: MovieProvider.sourcePath(musicContainer.track.source) + property bool running: state === MediaPlayer.PlayingState + } +} + diff --git a/CenterConsole/apps/com.pelagicore.media/PlaylistContainer.qml b/CenterConsole/apps/com.pelagicore.media/PlaylistContainer.qml new file mode 100644 index 0000000..deee005 --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/PlaylistContainer.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt multiscreen demo application. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** 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 General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** 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$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.0 +import utils 1.0 +import controls 1.0 +import "." + +RowLayout { + id: playListContainer + + signal pressed(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 + Layout.fillWidth: true + elide: Text.ElideRight + } + } + } + MouseArea { + anchors.fill: parent + onClicked: { + playListContainer.pressed(index) + closer.restart() + } + } + } + } + } +} diff --git a/CenterConsole/apps/com.pelagicore.media/icon.png b/CenterConsole/apps/com.pelagicore.media/icon.png Binary files differnew file mode 100644 index 0000000..77bd3df --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/icon.png diff --git a/CenterConsole/apps/com.pelagicore.media/info.yaml b/CenterConsole/apps/com.pelagicore.media/info.yaml new file mode 100644 index 0000000..33baf2f --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/info.yaml @@ -0,0 +1,12 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'com.pelagicore.media' +icon: 'icon.png' +code: 'Music.qml' +runtime: 'qml' +name: + en: 'Music' + de: 'Musik' + +categories: [ 'app', 'media' ] diff --git a/CenterConsole/apps/com.pelagicore.media/qmldir b/CenterConsole/apps/com.pelagicore.media/qmldir new file mode 100644 index 0000000..50d659d --- /dev/null +++ b/CenterConsole/apps/com.pelagicore.media/qmldir @@ -0,0 +1,3 @@ +singleton MusicProvider 1.0 MusicProvider.qml +singleton MovieProvider 1.0 MovieProvider.qml + |