Commit 56711827 authored by Chupligin Sergey's avatar Chupligin Sergey

[Statusbar] Add media controller panel

parent a15c1f82
...@@ -21,6 +21,7 @@ Requires: connman-qt5 ...@@ -21,6 +21,7 @@ Requires: connman-qt5
Requires: libqofono-qt5-declarative Requires: libqofono-qt5-declarative
Requires: nemo-theme-glacier Requires: nemo-theme-glacier
Requires: google-opensans-fonts Requires: google-opensans-fonts
Requires: mpris-qt5-qml-plugin
BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Quick) BuildRequires: pkgconfig(Qt5Quick)
......
...@@ -35,7 +35,9 @@ import QtQuick.Controls.Nemo 1.0 ...@@ -35,7 +35,9 @@ import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
import org.freedesktop.contextkit 1.0 import org.freedesktop.contextkit 1.0
import MeeGo.Connman 0.2 import MeeGo.Connman 0.2
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import org.nemomobile.mpris 1.0
import "statusbar" import "statusbar"
...@@ -289,9 +291,19 @@ Item { ...@@ -289,9 +291,19 @@ Item {
iconSize: Theme.itemHeightExtraSmall iconSize: Theme.itemHeightExtraSmall
source: "image://theme/icon_gps_normal" source: "image://theme/icon_gps_normal"
} }
StatusbarItem { StatusbarItem {
MprisManager {
id: mprisManager
}
property bool isPlaying: mprisManager.currentService && mprisManager.playbackStatus == Mpris.Playing
iconSize: Theme.itemHeightExtraSmall iconSize: Theme.itemHeightExtraSmall
source: "image://theme/icon_play_pause" source: isPlaying ?
"image://theme/pause"
: "image://theme/play"
panel: MediaController{}
} }
StatusbarItem { StatusbarItem {
iconSize: root.height iconSize: root.height
......
...@@ -40,6 +40,8 @@ Rectangle { ...@@ -40,6 +40,8 @@ Rectangle {
id: commonPanel id: commonPanel
property alias switcherEnabled: columnCheckBox.enabled property alias switcherEnabled: columnCheckBox.enabled
property bool settingsIconEnabled: true
property alias switcherChecked: columnCheckBox.checked property alias switcherChecked: columnCheckBox.checked
property string name: "" property string name: ""
signal click signal click
...@@ -120,7 +122,7 @@ Rectangle { ...@@ -120,7 +122,7 @@ Rectangle {
id:settingsIcon id:settingsIcon
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
height: Theme.itemHeightMedium height: Theme.itemHeightMedium
visible: parent.height > Theme.itemSpacingMedium visible: settingsIconEnabled && parent.height > Theme.itemSpacingMedium
source: "image://theme/icon-app-settings" //maybe better icon? settings.png from statusbar spec source: "image://theme/icon-app-settings" //maybe better icon? settings.png from statusbar spec
anchors{ anchors{
right: parent.right right: parent.right
......
/****************************************************************************************
**
** Copyright (C) 2017 Sergey Chupligin <mail@neochapay.ru>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
import QtQuick.Layouts 1.0
import org.nemomobile.mpris 1.0
Component {
id: mediaPanelItem
CommonPanel {
id: mediaPanelcommon
switcherEnabled: false
settingsIconEnabled: false
property bool isPlaying: mprisManager.currentService && mprisManager.playbackStatus == Mpris.Playing
Item{
width: parent.width
height: parent.height
Label{
id: trackName
width: parent.width
text: if (mprisManager.currentService) {
var artistTag = Mpris.metadataToString(Mpris.Artist)
var titleTag = Mpris.metadataToString(Mpris.Title)
var artistLabel = (artistTag in mprisManager.metadata) ? mprisManager.metadata[artistTag].toString() : "";
var titleLabel = (titleTag in mprisManager.metadata) ? mprisManager.metadata[titleTag].toString() : ""
return artistLabel+"\n"+titleLabel
}else{
return qsTr("No music playing")
}
horizontalAlignment: Text.AlignHCenter
}
Image{
id: backBtn
width: playPause.width*0.6
height: width
visible: mprisManager.currentService
anchors{
right: playPause.left
rightMargin: width/2
verticalCenter: playPause.verticalCenter
}
MouseArea{
anchors.fill: parent
onClicked: if (mprisManager.canGoPrevious) mprisManager.previous()
}
source: "image://theme/backward"
}
Image{
id: playPause
width: Theme.itemHeightHuge
height: width
visible: mprisManager.currentService
anchors{
horizontalCenter: parent.horizontalCenter
top: trackName.bottom
topMargin: Theme.itemSpacingLarge
}
source: isPlaying ?
"image://theme/pause" :
"image://theme/play"
MouseArea{
anchors.fill: parent
onClicked: (isPlaying)? mprisManager.pause() : mprisManager.play()
}
}
Image{
id: forwBtn
width: playPause.width*0.6
height: width
visible: mprisManager.currentService
anchors{
left: playPause.right
leftMargin: width/2
verticalCenter: playPause.verticalCenter
}
source: "image://theme/forward"
MouseArea{
anchors.fill: parent
onClicked: if (mprisManager.canGoNext) mprisManager.next()
}
}
}
}
}
...@@ -80,7 +80,8 @@ statusbar.files = qml/statusbar/BatteryPanel.qml\ ...@@ -80,7 +80,8 @@ statusbar.files = qml/statusbar/BatteryPanel.qml\
qml/statusbar/SimPanel.qml\ qml/statusbar/SimPanel.qml\
qml/statusbar/WifiPanel.qml\ qml/statusbar/WifiPanel.qml\
qml/statusbar/StatusbarItem.qml\ qml/statusbar/StatusbarItem.qml\
qml/statusbar/NumButton.qml qml/statusbar/NumButton.qml \
qml/statusbar/MediaController.qml
INSTALLS += styles \ INSTALLS += styles \
images \ images \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment