Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
df17e4e2
Verified
Commit
df17e4e2
authored
3 years ago
by
Joe Donofry
Browse files
Options
Downloads
Patches
Plain Diff
Fix audio player and use same controls for video and audio
parent
c1c9c71b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!15
Video player enhancements
Pipeline
#2018
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/qml/delegates/PlayableMediaMessage.qml
+77
-80
77 additions, 80 deletions
resources/qml/delegates/PlayableMediaMessage.qml
with
77 additions
and
80 deletions
resources/qml/delegates/PlayableMediaMessage.qml
+
77
−
80
View file @
df17e4e2
...
...
@@ -67,7 +67,6 @@ ColumnLayout {
property
double
divisor
:
isReply
?
4
:
2
property
bool
tooHigh
:
tempHeight
>
timelineRoot
.
height
/
divisor
visible
:
type
==
MtxEvent
.
VideoMessage
color
:
Nheko
.
colors
.
window
Layout.preferredHeight
:
tooHigh
?
timelineRoot
.
height
/
divisor
:
tempHeight
Layout.preferredWidth
:
tooHigh
?
(
timelineRoot
.
height
/
divisor
)
/
proportionalHeight
:
tempWidth
...
...
@@ -109,99 +108,97 @@ ColumnLayout {
VideoOutput
{
id
:
videoOutput
visible
:
type
==
MtxEvent
.
VideoMessage
clip
:
true
anchors.fill
:
parent
fillMode
:
VideoOutput
.
PreserveAspectFit
source
:
mxcmedia
flushMode
:
VideoOutput
.
FirstFrame
}
MediaControls
{
id
:
mediaControls
anchors.fill
:
parent
x
:
videoOutput
.
contentRect
.
x
y
:
videoOutput
.
contentRect
.
y
width
:
videoOutput
.
contentRect
.
width
height
:
videoOutput
.
contentRect
.
height
positionValue
:
mxcmedia
.
position
duration
:
mxcmedia
.
duration
mediaLoaded
:
mxcmedia
.
loaded
mediaState
:
mxcmedia
.
state
volumeOrientation
:
Qt
.
Vertical
onPositionChanged
:
mxcmedia
.
position
=
position
onActivated
:
mxcmedia
.
state
==
MediaPlayer
.
PlayingState
?
mxcmedia
.
pause
()
:
mxcmedia
.
play
()
}
MediaControls
{
id
:
mediaControls
anchors.fill
:
parent
x
:
type
==
MtxEvent
.
VideoMessage
?
videoOutput
.
contentRect
.
x
:
videoContainer
.
x
y
:
type
==
MtxEvent
.
VideoMessage
?
videoOutput
.
contentRect
.
y
:
videoContainer
.
y
width
:
type
==
MtxEvent
.
VideoMessage
?
videoOutput
.
contentRect
.
width
:
videoContainer
.
width
height
:
type
==
MtxEvent
.
VideoMessage
?
videoOutput
.
contentRect
.
height
:
videoContainer
.
height
positionValue
:
mxcmedia
.
position
duration
:
mxcmedia
.
duration
mediaLoaded
:
mxcmedia
.
loaded
mediaState
:
mxcmedia
.
state
volumeOrientation
:
Qt
.
Vertical
onPositionChanged
:
mxcmedia
.
position
=
position
onActivated
:
mxcmedia
.
state
==
MediaPlayer
.
PlayingState
?
mxcmedia
.
pause
()
:
mxcmedia
.
play
()
}
}
}
// Audio player
// TODO: share code with the video player
Rectangle
{
id
:
audioControlRect
property
int
controlHeight
:
25
visible
:
type
!=
MtxEvent
.
VideoMessage
Layout.preferredHeight
:
40
RowLayout
{
anchors.fill
:
parent
width
:
parent
.
width
// Play/pause button
Image
{
id
:
audioPlaybackStateImage
property
color
controlColor
:
(
audioPlaybackStateArea
.
containsMouse
)
?
Nheko
.
colors
.
highlight
:
Nheko
.
colors
.
text
fillMode
:
Image
.
PreserveAspectFit
Layout.preferredHeight
:
controlRect
.
controlHeight
Layout.alignment
:
Qt
.
AlignVCenter
source
:
{
if
(
!
mxcmedia
.
loaded
)
return
"
image://colorimage/:/icons/icons/ui/arrow-pointing-down.png?
"
+
controlColor
;
return
(
mxcmedia
.
state
==
MediaPlayer
.
PlayingState
)
?
"
image://colorimage/:/icons/icons/ui/pause-symbol.png?
"
+
controlColor
:
"
image://colorimage/:/icons/icons/ui/play-sign.png?
"
+
controlColor
;
}
MouseArea
{
id
:
audioPlaybackStateArea
anchors.fill
:
parent
hoverEnabled
:
true
onClicked
:
{
if
(
!
mxcmedia
.
loaded
)
{
mxcmedia
.
eventId
=
eventId
;
return
;
}
(
mxcmedia
.
state
==
MediaPlayer
.
PlayingState
)
?
mxcmedia
.
pause
()
:
mxcmedia
.
play
();
}
}
}
Label
{
text
:
(
!
mxcmedia
.
loaded
)
?
"
-/-
"
:
durationToString
(
mxcmedia
.
position
)
+
"
/
"
+
durationToString
(
mxcmedia
.
duration
)
}
Slider
{
Layout.fillWidth
:
true
Layout.minimumWidth
:
50
height
:
controlRect
.
controlHeight
value
:
mxcmedia
.
position
onMoved
:
mxcmedia
.
position
=
value
from
:
0
to
:
mxcmedia
.
duration
}
}
}
//
Rectangle {
//
id: audioControlRect
//
property int controlHeight: 25
//
visible: type != MtxEvent.VideoMessage
//
Layout.preferredHeight: 40
//
RowLayout {
//
anchors.fill: parent
//
width: parent.width
//
// Play/pause button
//
Image {
//
id: audioPlaybackStateImage
//
property color controlColor: (audioPlaybackStateArea.containsMouse) ? Nheko.colors.highlight : Nheko.colors.text
//
fillMode: Image.PreserveAspectFit
//
Layout.preferredHeight: controlRect.controlHeight
//
Layout.alignment: Qt.AlignVCenter
//
source: {
//
if (!mxcmedia.loaded)
//
return "image://colorimage/:/icons/icons/ui/arrow-pointing-down.png?" + controlColor;
//
return (mxcmedia.state == MediaPlayer.PlayingState) ? "image://colorimage/:/icons/icons/ui/pause-symbol.png?" + controlColor : "image://colorimage/:/icons/icons/ui/play-sign.png?" + controlColor;
//
}
//
MouseArea {
//
id: audioPlaybackStateArea
//
anchors.fill: parent
//
hoverEnabled: true
//
onClicked: {
//
if (!mxcmedia.loaded) {
//
mxcmedia.eventId = eventId;
//
return ;
//
}
//
(mxcmedia.state == MediaPlayer.PlayingState) ? mxcmedia.pause() : mxcmedia.play();
//
}
//
}
//
}
//
Label {
//
text: (!mxcmedia.loaded) ? "-/-" : durationToString(mxcmedia.position) + "/" + durationToString(mxcmedia.duration)
//
}
//
Slider {
//
Layout.fillWidth: true
//
Layout.minimumWidth: 50
//
height: controlRect.controlHeight
//
value: mxcmedia.position
//
onMoved: mxcmedia.position = value
//
from: 0
//
to: mxcmedia.duration
//
}
//
}
//
}
Label
{
id
:
fileInfoLabel
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment