Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
savoirfairelinux
jami-daemon
Commits
81734dac
Commit
81734dac
authored
19 years ago
by
jpbl
Browse files
Options
Downloads
Patches
Plain Diff
We have a good slider
parent
d1b4c1e9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gui/official/VolumeControl.cpp
+58
-12
58 additions, 12 deletions
src/gui/official/VolumeControl.cpp
src/gui/official/VolumeControl.hpp
+14
-5
14 additions, 5 deletions
src/gui/official/VolumeControl.hpp
with
72 additions
and
17 deletions
src/gui/official/VolumeControl.cpp
+
58
−
12
View file @
81734dac
...
...
@@ -79,8 +79,12 @@ VolumeControl::setMin(int value)
void
VolumeControl
::
setValue
(
int
value
)
{
if
(
value
<=
mMax
&&
value
>=
mMin
)
{
mValue
=
value
;
if
(
value
!=
mValue
)
{
if
(
value
<=
mMax
&&
value
>=
mMin
)
{
mValue
=
value
;
updateSlider
(
value
);
emit
valueUpdated
(
mValue
);
}
}
}
...
...
@@ -89,29 +93,71 @@ void
VolumeControl
::
mouseMoveEvent
(
QMouseEvent
*
e
)
{
if
(
mOrientation
==
VolumeControl
::
Vertical
)
{
// If the slider for the volume is vertical
int
yoffset
=
e
->
y
()
-
mPos
.
y
();
std
::
cout
<<
"yoffset: "
<<
yoffset
<<
std
::
endl
;
if
(
yoffset
<
0
)
{
yoffset
=
0
;
int
newpos
=
mSlider
->
y
()
+
e
->
globalY
()
-
mPos
.
y
();
mPos
=
e
->
globalPos
();
if
(
newpos
<
0
)
{
mPos
.
setY
(
mPos
.
y
()
-
newpos
);
newpos
=
0
;
}
if
(
yoffset
>
mMaxPosition
)
{
yoffset
=
mMaxPosition
;
if
(
newpos
>
mMaxPosition
)
{
mPos
.
setY
(
mPos
.
y
()
-
(
newpos
-
mMaxPosition
));
newpos
=
mMaxPosition
;
}
std
::
cout
<<
"new yoffset: "
<<
yoffset
<<
std
::
endl
<<
std
::
endl
;
mSlider
->
move
(
mSlider
->
x
(),
yoffset
);
mSlider
->
move
(
mSlider
->
x
(),
newpos
);
updateValue
();
}
else
{
mSlider
->
move
(
e
->
y
()
-
mPos
.
x
(),
mSlider
->
y
());
}
}
void
VolumeControl
::
updateValue
()
{
std
::
cout
<<
"offset: "
<<
offset
()
<<
std
::
endl
;
std
::
cout
<<
"max pos: "
<<
mMaxPosition
<<
std
::
endl
;
std
::
cout
<<
"min: "
<<
mMin
<<
std
::
endl
;
std
::
cout
<<
"max: "
<<
mMax
<<
std
::
endl
;
int
value
=
(
int
)((
float
)
offset
()
/
mMaxPosition
*
(
mMax
-
mMin
));
std
::
cout
<<
"Real Value: "
<<
value
<<
std
::
endl
;
mValue
=
value
;
emit
valueUpdated
(
mValue
);
}
void
VolumeControl
::
updateSlider
(
int
value
)
{
if
(
mOrientation
==
VolumeControl
::
Vertical
)
{
std
::
cout
<<
"Move again to : "
<<
value
/
(
mMax
-
mMin
)
*
mMaxPosition
<<
std
::
endl
<<
std
::
endl
;
mSlider
->
move
(
mSlider
->
x
(),
value
/
(
mMax
-
mMin
)
*
mMaxPosition
);
}
else
{
mSlider
->
move
(
value
/
(
mMax
-
mMin
)
*
mMaxPosition
,
mSlider
->
y
());
}
}
int
VolumeControl
::
offset
()
{
if
(
mOrientation
==
VolumeControl
::
Vertical
)
{
return
mSlider
->
y
();
}
else
{
return
mSlider
->
x
();
}
}
void
VolumeControl
::
mousePressEvent
(
QMouseEvent
*
e
)
{
mPos
=
e
->
p
os
();
mPos
=
e
->
globalP
os
();
}
// EOF
This diff is collapsed.
Click to expand it.
src/gui/official/VolumeControl.hpp
+
14
−
5
View file @
81734dac
...
...
@@ -35,17 +35,26 @@ public:
int
maxValue
=
100
);
~
VolumeControl
(
void
);
void
setOrientation
(
Orientation
orientation
);
int
getValue
()
{
return
mValue
;}
int
offset
();
int
minY
();
int
maxY
();
signals
:
void
valueUpdated
(
int
);
public
slots
:
void
updateValue
();
void
setMin
(
int
value
);
void
setMax
(
int
value
);
void
setValue
(
int
value
);
void
resize
();
signals
:
void
setVolumeValue
(
int
);
void
setOrientation
(
Orientation
orientation
);
private
:
void
updateSlider
(
int
value
);
void
mouseMoveEvent
(
QMouseEvent
*
);
void
mousePressEvent
(
QMouseEvent
*
);
...
...
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