Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-client-windows
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-client-windows
Commits
ca320d87
Commit
ca320d87
authored
6 years ago
by
Andreas Traczyk
Committed by
Adrien Béraud
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
videoview: fade video overlay when mouse is not moving
Change-Id: I9095888304ba8290e6e9840b9b8bce4b2ba62028
parent
8d5e5495
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
videoview.cpp
+29
-4
29 additions, 4 deletions
videoview.cpp
videoview.h
+7
-0
7 additions, 0 deletions
videoview.h
with
36 additions
and
4 deletions
videoview.cpp
+
29
−
4
View file @
ca320d87
...
...
@@ -46,7 +46,7 @@ VideoView::VideoView(QWidget* parent) :
connect
(
&
CallModel
::
instance
(),
SIGNAL
(
callStateChanged
(
Call
*
,
Call
::
State
)),
this
,
SLOT
(
callStateChanged
(
Call
*
,
Call
::
State
)));
overlay_
=
new
VideoOverlay
(
this
);
auto
effect
=
new
QGraphicsOpacityEffect
(
overlay_
);
effect
->
setOpacity
(
maxOverlayOpacity_
);
...
...
@@ -58,6 +58,12 @@ VideoView::VideoView(QWidget* parent) :
fadeAnim_
->
setStartValue
(
effect
->
opacity
());
fadeAnim_
->
setEndValue
(
0
);
fadeAnim_
->
setEasingCurve
(
QEasingCurve
::
OutQuad
);
// Setup the timer to start the fade when the mouse stops moving
this
->
setMouseTracking
(
true
);
overlay_
->
setMouseTracking
(
true
);
fadeTimer_
.
setSingleShot
(
true
);
connect
(
&
fadeTimer_
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
fadeOverlayOut
()));
this
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
connect
(
this
,
SIGNAL
(
customContextMenuRequested
(
const
QPoint
&
)),
...
...
@@ -119,15 +125,27 @@ void
VideoView
::
enterEvent
(
QEvent
*
event
)
{
Q_UNUSED
(
event
)
fadeAnim_
->
stop
();
fadeAnim_
->
targetObject
()
->
setProperty
(
fadeAnim_
->
propertyName
(),
fadeAnim_
->
startValue
());
showOverlay
();
}
void
VideoView
::
leaveEvent
(
QEvent
*
event
)
{
Q_UNUSED
(
event
)
if
(
not
overlay_
->
isDialogVisible
())
fadeOverlayOut
();
}
void
VideoView
::
showOverlay
()
{
fadeAnim_
->
stop
();
fadeAnim_
->
targetObject
()
->
setProperty
(
fadeAnim_
->
propertyName
(),
fadeAnim_
->
startValue
());
}
void
VideoView
::
fadeOverlayOut
()
{
if
(
not
overlay_
->
isDialogVisible
())
fadeAnim_
->
start
(
QAbstractAnimation
::
KeepWhenStopped
);
}
...
...
@@ -333,6 +351,13 @@ VideoView::mouseReleaseEvent(QMouseEvent* event)
void
VideoView
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
// start/restart the timer after which the overlay will fade
if
(
fadeTimer_
.
isActive
())
{
showOverlay
();
}
else
{
fadeTimer_
.
start
(
startfadeOverlayTime_
);
}
QRect
&
previewRect
=
ui
->
videoWidget
->
getPreviewRect
();
if
(
draggingPreview_
)
{
if
(
previewRect
.
left
()
>
0
...
...
This diff is collapsed.
Click to expand it.
videoview.h
+
7
−
0
View file @
ca320d87
...
...
@@ -54,11 +54,14 @@ private slots:
void
updateCall
();
void
showContextMenu
(
const
QPoint
&
pos
);
void
slotVideoStarted
(
Video
::
Renderer
*
renderer
);
void
fadeOverlayOut
();
void
showOverlay
();
private:
Ui
::
VideoView
*
ui
;
VideoOverlay
*
overlay_
;
QPropertyAnimation
*
fadeAnim_
;
QTimer
fadeTimer_
;
QWidget
*
oldParent_
;
QSize
oldSize_
;
QMetaObject
::
Connection
timerConnection_
;
...
...
@@ -72,6 +75,10 @@ private:
constexpr
static
int
resizeGrip_
=
40
;
constexpr
static
int
minimalSize_
=
100
;
// Time before the overlay starts fading out after the mouse stops
// moving within the videoview.
constexpr
static
int
startfadeOverlayTime_
=
2000
;
//msec
// TODO: fix when changing Qt version
// Full(1.0) opacity bug affecting many Qt version (macOS + win10)
// causing the render to take a buggy code path which can be avoided
...
...
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