Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
glacier-home
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
glacier-home
Commits
e3bea66e
Commit
e3bea66e
authored
Mar 10, 2018
by
Chupligin Sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[VolumeControl] added repeating of volume change if key stay pressed
parent
4622bc51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
18 deletions
+71
-18
VolumeControl.qml
src/qml/VolumeControl.qml
+71
-18
No files found.
src/qml/VolumeControl.qml
View file @
e3bea66e
...
@@ -42,6 +42,8 @@ ProgressBar {
...
@@ -42,6 +42,8 @@ ProgressBar {
maximumValue
:
volumeControl
.
maximumVolume
maximumValue
:
volumeControl
.
maximumVolume
property
bool
shouldbevisible
property
bool
shouldbevisible
property
int
pressedKey
opacity
:
volumeSlider
.
shouldbevisible
?
1
:
0
opacity
:
volumeSlider
.
shouldbevisible
?
1
:
0
Behavior
on
opacity
{
Behavior
on
opacity
{
NumberAnimation
{
NumberAnimation
{
...
@@ -49,6 +51,7 @@ ProgressBar {
...
@@ -49,6 +51,7 @@ ProgressBar {
onRunningChanged
:
if
(
!
running
&&
volumeSlider
.
opacity
==
0
)
volumeControl
.
windowVisible
=
false
onRunningChanged
:
if
(
!
running
&&
volumeSlider
.
opacity
==
0
)
volumeControl
.
windowVisible
=
false
}
}
}
}
Timer
{
Timer
{
id
:
voltimer
id
:
voltimer
interval
:
2000
interval
:
2000
...
@@ -58,7 +61,70 @@ ProgressBar {
...
@@ -58,7 +61,70 @@ ProgressBar {
Connections
{
Connections
{
target
:
volumeControl
target
:
volumeControl
onVolumeKeyPressed
:
{
onVolumeKeyPressed
:
{
if
(
key
==
Qt
.
Key_VolumeUp
)
volumeSlider
.
pressedKey
=
key
;
volumeControl
.
windowVisible
=
true
volumeChange
()
keyPressTimer
.
start
()
maxMinTimer
.
start
()
if
(
volumeControl
.
windowVisible
)
{
voltimer
.
restart
()
}
}
onVolumeKeyReleased
:
{
keyPressTimer
.
stop
()
maxMinTimer
.
stop
()
volumeSlider
.
pressedKey
=
""
}
onWindowVisibleChanged
:
{
if
(
volumeControl
.
windowVisible
)
{
volumeSlider
.
shouldbevisible
=
true
voltimer
.
restart
()
}
}
}
PropertyAnimation
{
id
:
volumeChangeAinmation
target
:
volumeSlider
property
:
"
value
"
to
:
volumeControl
.
volume
duration
:
100
}
Timer
{
id
:
keyPressTimer
interval
:
500
onTriggered
:
{
volumeChange
()
voltimer
.
restart
()
}
repeat
:
true
}
Timer
{
id
:
maxMinTimer
interval
:
1900
onTriggered
:
{
if
(
volumeSlider
.
pressedKey
==
Qt
.
Key_VolumeUp
)
{
volumeControl
.
volume
=
volumeSlider
.
maximumValue
}
else
if
(
volumeSlider
.
pressedKey
==
Qt
.
Key_VolumeDown
)
{
volumeControl
.
volume
=
0
}
volumeChangeAinmation
.
start
()
}
}
function
volumeChange
()
{
if
(
volumeSlider
.
pressedKey
==
Qt
.
Key_VolumeUp
)
{
{
//up volume
//up volume
if
(
volumeControl
.
volume
<
maximumValue
)
if
(
volumeControl
.
volume
<
maximumValue
)
...
@@ -66,7 +132,7 @@ ProgressBar {
...
@@ -66,7 +132,7 @@ ProgressBar {
volumeControl
.
volume
=
volumeControl
.
volume
+
1
volumeControl
.
volume
=
volumeControl
.
volume
+
1
}
}
}
}
else
else
if
(
volumeSlider
.
pressedKey
==
Qt
.
Key_VolumeDown
)
{
{
//down volume
//down volume
if
(
volumeControl
.
volume
>
0
)
if
(
volumeControl
.
volume
>
0
)
...
@@ -74,19 +140,6 @@ ProgressBar {
...
@@ -74,19 +140,6 @@ ProgressBar {
volumeControl
.
volume
=
volumeControl
.
volume
-
1
volumeControl
.
volume
=
volumeControl
.
volume
-
1
}
}
}
}
volumeChangeAinmation
.
start
()
volumeControl
.
windowVisible
=
true
volumeSlider
.
value
=
volumeControl
.
volume
if
(
volumeControl
.
windowVisible
)
{
voltimer
.
restart
()
}
}
onWindowVisibleChanged
:
{
if
(
volumeControl
.
windowVisible
)
{
volumeSlider
.
shouldbevisible
=
true
voltimer
.
restart
()
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment