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
8a511a78
Commit
8a511a78
authored
5 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Add progress bar to audio messages
parent
ea98d7b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/qml/delegates/AudioMessage.qml
+110
-68
110 additions, 68 deletions
resources/qml/delegates/AudioMessage.qml
with
110 additions
and
68 deletions
resources/qml/delegates/AudioMessage.qml
+
110
−
68
View file @
8a511a78
import
QtQuick
2.6
import
QtQuick
.
Layouts
1.6
import
QtMultimedia
5.12
import
QtQuick
.
Controls
2.5
import
QtMultimedia
5.6
Rectangle
{
radius
:
10
color
:
colors
.
dark
height
:
row
.
height
+
24
height
:
content
.
height
+
24
width
:
parent
.
width
RowLayout
{
id
:
row
anchors.centerIn
:
parent
ColumnLayout
{
id
:
content
width
:
parent
.
width
-
24
anchors.centerIn
:
parent
RowLayout
{
Text
{
id
:
positionText
text
:
"
--:--:--
"
color
:
colors
.
text
}
Slider
{
Layout.fillWidth
:
true
id
:
progress
value
:
media
.
position
from
:
0
to
:
media
.
duration
onMoved
:
media
.
seek
(
value
)
//indeterminate: true
function
updatePositionTexts
()
{
function
formatTime
(
date
)
{
var
hh
=
date
.
getUTCHours
();
var
mm
=
date
.
getUTCMinutes
();
var
ss
=
date
.
getSeconds
();
if
(
hh
<
10
)
{
hh
=
"
0
"
+
hh
;}
if
(
mm
<
10
)
{
mm
=
"
0
"
+
mm
;}
if
(
ss
<
10
)
{
ss
=
"
0
"
+
ss
;}
return
hh
+
"
:
"
+
mm
+
"
:
"
+
ss
;
}
positionText
.
text
=
formatTime
(
new
Date
(
media
.
position
))
durationText
.
text
=
formatTime
(
new
Date
(
media
.
duration
))
}
onValueChanged
:
updatePositionTexts
()
}
Text
{
id
:
durationText
text
:
"
--:--:--
"
color
:
colors
.
text
}
}
spacing
:
15
RowLayout
{
width
:
parent
.
width
Rectangle
{
id
:
button
color
:
colors
.
light
radius
:
22
height
:
44
width
:
44
Image
{
id
:
img
anchors.centerIn
:
parent
spacing
:
15
source
:
"
qrc:/icons/icons/ui/arrow-pointing-down.png
"
fillMode
:
Image
.
Pad
Rectangle
{
id
:
button
color
:
colors
.
light
radius
:
22
height
:
44
width
:
44
Image
{
id
:
img
anchors.centerIn
:
parent
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
switch
(
button
.
state
)
{
case
""
:
timelineManager
.
cacheMedia
(
eventData
.
url
,
eventData
.
mimetype
);
break
;
case
"
stopped
"
:
audio
.
play
();
console
.
log
(
"
play
"
);
source
:
"
qrc:/icons/icons/ui/arrow-pointing-down.png
"
fillMode
:
Image
.
Pad
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
switch
(
button
.
state
)
{
case
""
:
timelineManager
.
cacheMedia
(
eventData
.
url
,
eventData
.
mimetype
);
break
;
case
"
stopped
"
:
media
.
play
();
console
.
log
(
"
play
"
);
button
.
state
=
"
playing
"
break
case
"
playing
"
:
au
di
o
.
pause
();
console
.
log
(
"
pause
"
);
case
"
playing
"
:
me
di
a
.
pause
();
console
.
log
(
"
pause
"
);
button
.
state
=
"
stopped
"
break
}
}
cursorShape
:
Qt
.
PointingHandCursor
}
MediaPlayer
{
id
:
media
onError
:
console
.
log
(
errorString
)
onStatusChanged
:
if
(
status
==
MediaPlayer
.
Loaded
)
progress
.
updatePositionTexts
()
}
cursorShape
:
Qt
.
PointingHandCursor
}
MediaPlayer
{
id
:
audio
onError
:
console
.
log
(
errorString
)
}
Connections
{
target
:
timelineManager
onMediaCached
:
{
if
(
mxcUrl
==
eventData
.
url
)
{
audio
.
source
=
"
file://
"
+
cacheUrl
button
.
state
=
"
stopped
"
console
.
log
(
"
media loaded:
"
+
mxcUrl
+
"
at
"
+
cacheUrl
)
Connections
{
target
:
timelineManager
onMediaCached
:
{
if
(
mxcUrl
==
eventData
.
url
)
{
media
.
source
=
"
file://
"
+
cacheUrl
button
.
state
=
"
stopped
"
console
.
log
(
"
media loaded:
"
+
mxcUrl
+
"
at
"
+
cacheUrl
)
}
console
.
log
(
"
media cached:
"
+
mxcUrl
+
"
at
"
+
cacheUrl
)
}
console
.
log
(
"
media cached:
"
+
mxcUrl
+
"
at
"
+
cacheUrl
)
}
states
:
[
State
{
name
:
"
stopped
"
PropertyChanges
{
target
:
img
;
source
:
"
qrc:/icons/icons/ui/play-sign.png
"
}
},
State
{
name
:
"
playing
"
PropertyChanges
{
target
:
img
;
source
:
"
qrc:/icons/icons/ui/pause-symbol.png
"
}
}
]
}
ColumnLayout
{
id
:
col
states
:
[
State
{
name
:
"
stopped
"
PropertyChanges
{
target
:
img
;
source
:
"
qrc:/icons/icons/ui/play-sign.png
"
}
},
State
{
name
:
"
playing
"
PropertyChanges
{
target
:
img
;
source
:
"
qrc:/icons/icons/ui/pause-symbol.png
"
}
Text
{
Layout.fillWidth
:
true
text
:
eventData
.
body
textFormat
:
Text
.
PlainText
elide
:
Text
.
ElideRight
color
:
colors
.
text
}
Text
{
Layout.fillWidth
:
true
text
:
eventData
.
filesize
textFormat
:
Text
.
PlainText
elide
:
Text
.
ElideRight
color
:
colors
.
text
}
]
}
ColumnLayout
{
id
:
col
Text
{
Layout.fillWidth
:
true
text
:
eventData
.
body
textFormat
:
Text
.
PlainText
elide
:
Text
.
ElideRight
color
:
colors
.
text
}
Text
{
Layout.fillWidth
:
true
text
:
eventData
.
filesize
textFormat
:
Text
.
PlainText
elide
:
Text
.
ElideRight
color
:
colors
.
text
}
}
}
...
...
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