|
|
@ -22,12 +22,6 @@ Rectangle { |
|
|
|
property var positionValue: 0 |
|
|
|
property var positionValue: 0 |
|
|
|
property var position |
|
|
|
property var position |
|
|
|
property bool shouldShowControls: !playingVideo || playerMouseArea.shouldShowControls || volumeSlider.state == "shown" |
|
|
|
property bool shouldShowControls: !playingVideo || playerMouseArea.shouldShowControls || volumeSlider.state == "shown" |
|
|
|
color: { |
|
|
|
|
|
|
|
var wc = Nheko.colors.alternateBase; |
|
|
|
|
|
|
|
return Qt.rgba(wc.r, wc.g, wc.b, 0.5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
opacity: control.shouldShowControls ? 1 : 0 |
|
|
|
|
|
|
|
height: controlLayout.implicitHeight |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signal playPauseActivated() |
|
|
|
signal playPauseActivated() |
|
|
|
signal loadActivated() |
|
|
|
signal loadActivated() |
|
|
@ -55,19 +49,25 @@ Rectangle { |
|
|
|
return hh + ":" + mm + ":" + ss; |
|
|
|
return hh + ":" + mm + ":" + ss; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
color: { |
|
|
|
|
|
|
|
var wc = Nheko.colors.alternateBase; |
|
|
|
|
|
|
|
return Qt.rgba(wc.r, wc.g, wc.b, 0.5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
opacity: control.shouldShowControls ? 1 : 0 |
|
|
|
|
|
|
|
height: controlLayout.implicitHeight |
|
|
|
|
|
|
|
|
|
|
|
HoverHandler { |
|
|
|
HoverHandler { |
|
|
|
id: playerMouseArea |
|
|
|
id: playerMouseArea |
|
|
|
|
|
|
|
|
|
|
|
property bool shouldShowControls: hovered || controlHideTimer.running || control.mediaState != MediaPlayer.PlayingState |
|
|
|
property bool shouldShowControls: hovered || controlHideTimer.running || control.mediaState != MediaPlayer.PlayingState |
|
|
|
|
|
|
|
|
|
|
|
onHoveredChanged: showControls(); |
|
|
|
onHoveredChanged: showControls() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
|
ColumnLayout { |
|
|
|
|
|
|
|
|
|
|
|
id: controlLayout |
|
|
|
id: controlLayout |
|
|
|
enabled: control.shouldShowControls |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enabled: control.shouldShowControls |
|
|
|
spacing: 0 |
|
|
|
spacing: 0 |
|
|
|
anchors.bottom: control.bottom |
|
|
|
anchors.bottom: control.bottom |
|
|
|
anchors.left: control.left |
|
|
|
anchors.left: control.left |
|
|
@ -77,9 +77,7 @@ Rectangle { |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.leftMargin: Nheko.paddingSmall |
|
|
|
Layout.leftMargin: Nheko.paddingSmall |
|
|
|
Layout.rightMargin: Nheko.paddingSmall |
|
|
|
Layout.rightMargin: Nheko.paddingSmall |
|
|
|
|
|
|
|
|
|
|
|
enabled: control.mediaLoaded |
|
|
|
enabled: control.mediaLoaded |
|
|
|
|
|
|
|
|
|
|
|
value: control.positionValue |
|
|
|
value: control.positionValue |
|
|
|
onMoved: control.position = value |
|
|
|
onMoved: control.position = value |
|
|
|
from: 0 |
|
|
|
from: 0 |
|
|
@ -87,7 +85,6 @@ Rectangle { |
|
|
|
alwaysShowSlider: false |
|
|
|
alwaysShowSlider: false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RowLayout { |
|
|
|
RowLayout { |
|
|
|
Layout.margins: Nheko.paddingSmall |
|
|
|
Layout.margins: Nheko.paddingSmall |
|
|
|
spacing: Nheko.paddingSmall |
|
|
|
spacing: Nheko.paddingSmall |
|
|
@ -95,95 +92,87 @@ Rectangle { |
|
|
|
|
|
|
|
|
|
|
|
// Cache/Play/pause button |
|
|
|
// Cache/Play/pause button |
|
|
|
ImageButton { |
|
|
|
ImageButton { |
|
|
|
Layout.alignment: Qt.AlignLeft |
|
|
|
|
|
|
|
id: playbackStateImage |
|
|
|
id: playbackStateImage |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignLeft |
|
|
|
buttonTextColor: Nheko.colors.text |
|
|
|
buttonTextColor: Nheko.colors.text |
|
|
|
Layout.preferredHeight: 24 |
|
|
|
Layout.preferredHeight: 24 |
|
|
|
Layout.preferredWidth: 24 |
|
|
|
Layout.preferredWidth: 24 |
|
|
|
|
|
|
|
|
|
|
|
image: { |
|
|
|
image: { |
|
|
|
if (control.mediaLoaded) { |
|
|
|
if (control.mediaLoaded) { |
|
|
|
if (control.mediaState == MediaPlayer.PlayingState) |
|
|
|
if (control.mediaState == MediaPlayer.PlayingState) |
|
|
|
return ":/icons/icons/ui/pause-symbol.png"; |
|
|
|
return ":/icons/icons/ui/pause-symbol.png"; |
|
|
|
else |
|
|
|
else |
|
|
|
return ":/icons/icons/ui/play-sign.png"; |
|
|
|
return ":/icons/icons/ui/play-sign.png"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return ":/icons/icons/ui/arrow-pointing-down.png"; |
|
|
|
return ":/icons/icons/ui/arrow-pointing-down.png"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
onClicked: control.mediaLoaded ? control.playPauseActivated() : control.loadActivated() |
|
|
|
onClicked: control.mediaLoaded ? control.playPauseActivated() : control.loadActivated(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ImageButton { |
|
|
|
ImageButton { |
|
|
|
Layout.alignment: Qt.AlignLeft |
|
|
|
|
|
|
|
id: volumeButton |
|
|
|
id: volumeButton |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignLeft |
|
|
|
buttonTextColor: Nheko.colors.text |
|
|
|
buttonTextColor: Nheko.colors.text |
|
|
|
Layout.preferredHeight: 24 |
|
|
|
Layout.preferredHeight: 24 |
|
|
|
Layout.preferredWidth: 24 |
|
|
|
Layout.preferredWidth: 24 |
|
|
|
|
|
|
|
|
|
|
|
image: { |
|
|
|
image: { |
|
|
|
if (control.muted || control.desiredVolume <= 0) { |
|
|
|
if (control.muted || control.desiredVolume <= 0) |
|
|
|
return ":/icons/icons/ui/volume-off-indicator.png"; |
|
|
|
return ":/icons/icons/ui/volume-off-indicator.png"; |
|
|
|
} else { |
|
|
|
else |
|
|
|
return ":/icons/icons/ui/volume-up.png"; |
|
|
|
return ":/icons/icons/ui/volume-up.png"; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onClicked: control.muted = !control.muted |
|
|
|
onClicked: control.muted = !control.muted |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
NhekoSlider { |
|
|
|
NhekoSlider { |
|
|
|
state: "" |
|
|
|
id: volumeSlider |
|
|
|
|
|
|
|
|
|
|
|
states: State { |
|
|
|
property real desiredVolume: QtMultimedia.convertVolume(volumeSlider.value, QtMultimedia.LogarithmicVolumeScale, QtMultimedia.LinearVolumeScale) |
|
|
|
name: "shown" |
|
|
|
|
|
|
|
when: Settings.mobileMode || volumeButton.hovered || volumeSlider.hovered || volumeSlider.pressed |
|
|
|
|
|
|
|
PropertyChanges {target: volumeSlider; Layout.preferredWidth: 100} |
|
|
|
|
|
|
|
PropertyChanges {target: volumeSlider; opacity: 1} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state: "" |
|
|
|
Layout.alignment: Qt.AlignLeft |
|
|
|
Layout.alignment: Qt.AlignLeft |
|
|
|
Layout.preferredWidth: 0 |
|
|
|
Layout.preferredWidth: 0 |
|
|
|
opacity: 0 |
|
|
|
opacity: 0 |
|
|
|
id: volumeSlider |
|
|
|
|
|
|
|
orientation: Qt.Horizontal |
|
|
|
orientation: Qt.Horizontal |
|
|
|
property real desiredVolume: QtMultimedia.convertVolume(volumeSlider.value, QtMultimedia.LogarithmicVolumeScale, QtMultimedia.LinearVolumeScale) |
|
|
|
|
|
|
|
value: 1 |
|
|
|
value: 1 |
|
|
|
|
|
|
|
|
|
|
|
onDesiredVolumeChanged: { |
|
|
|
onDesiredVolumeChanged: { |
|
|
|
control.muted = !(desiredVolume > 0); |
|
|
|
control.muted = !(desiredVolume > 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
transitions: [ |
|
|
|
transitions: [ |
|
|
|
Transition { |
|
|
|
Transition { |
|
|
|
from: "" |
|
|
|
from: "" |
|
|
|
to: "shown" |
|
|
|
to: "shown" |
|
|
|
|
|
|
|
|
|
|
|
SequentialAnimation { |
|
|
|
SequentialAnimation { |
|
|
|
PauseAnimation { duration: 50 } |
|
|
|
PauseAnimation { |
|
|
|
|
|
|
|
duration: 50 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
NumberAnimation { |
|
|
|
NumberAnimation { |
|
|
|
duration: 100 |
|
|
|
duration: 100 |
|
|
|
properties: "opacity" |
|
|
|
properties: "opacity" |
|
|
|
easing.type: Easing.InQuad |
|
|
|
easing.type: Easing.InQuad |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
NumberAnimation { |
|
|
|
NumberAnimation { |
|
|
|
properties: "Layout.preferredWidth" |
|
|
|
properties: "Layout.preferredWidth" |
|
|
|
duration: 150 |
|
|
|
duration: 150 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
Transition { |
|
|
|
Transition { |
|
|
|
from: "shown" |
|
|
|
from: "shown" |
|
|
|
to: "" |
|
|
|
to: "" |
|
|
|
|
|
|
|
|
|
|
|
SequentialAnimation { |
|
|
|
SequentialAnimation { |
|
|
|
PauseAnimation { duration: 100 } |
|
|
|
PauseAnimation { |
|
|
|
|
|
|
|
duration: 100 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ParallelAnimation { |
|
|
|
ParallelAnimation { |
|
|
|
NumberAnimation { |
|
|
|
NumberAnimation { |
|
|
@ -196,16 +185,34 @@ Rectangle { |
|
|
|
properties: "Layout.preferredWidth" |
|
|
|
properties: "Layout.preferredWidth" |
|
|
|
duration: 150 |
|
|
|
duration: 150 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
states: State { |
|
|
|
|
|
|
|
name: "shown" |
|
|
|
|
|
|
|
when: Settings.mobileMode || volumeButton.hovered || volumeSlider.hovered || volumeSlider.pressed |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PropertyChanges { |
|
|
|
|
|
|
|
target: volumeSlider |
|
|
|
|
|
|
|
Layout.preferredWidth: 100 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PropertyChanges { |
|
|
|
|
|
|
|
target: volumeSlider |
|
|
|
|
|
|
|
opacity: 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
Label { |
|
|
|
Layout.alignment: Qt.AlignRight |
|
|
|
Layout.alignment: Qt.AlignRight |
|
|
|
|
|
|
|
|
|
|
|
text: (!control.mediaLoaded) ? "-- / --" : (durationToString(control.positionValue) + " / " + durationToString(control.duration)) |
|
|
|
text: (!control.mediaLoaded) ? "-- / --" : (durationToString(control.positionValue) + " / " + durationToString(control.duration)) |
|
|
|
color: Nheko.colors.text |
|
|
|
color: Nheko.colors.text |
|
|
|
} |
|
|
|
} |
|
|
@ -218,14 +225,6 @@ Rectangle { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Fade controls in/out |
|
|
|
|
|
|
|
Behavior on opacity { |
|
|
|
|
|
|
|
OpacityAnimator { |
|
|
|
|
|
|
|
duration: 100 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For hiding controls on stationary cursor |
|
|
|
// For hiding controls on stationary cursor |
|
|
|
Timer { |
|
|
|
Timer { |
|
|
|
id: controlHideTimer |
|
|
|
id: controlHideTimer |
|
|
@ -234,4 +233,12 @@ Rectangle { |
|
|
|
repeat: false |
|
|
|
repeat: false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Fade controls in/out |
|
|
|
|
|
|
|
Behavior on opacity { |
|
|
|
|
|
|
|
OpacityAnimator { |
|
|
|
|
|
|
|
duration: 100 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|