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
GitLab 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
e52278b6
Commit
e52278b6
authored
5 years ago
by
Yang Wang
Committed by
Andreas Traczyk
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
videoview: fix the preview reposition problems
Gitlab: #495 Change-Id: I29cd215147b673e82b692b194ef79099f58cc01a
parent
6019918a
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
videoview.cpp
+13
-5
13 additions, 5 deletions
videoview.cpp
videowidget.cpp
+10
-4
10 additions, 4 deletions
videowidget.cpp
videowidget.h
+5
-3
5 additions, 3 deletions
videowidget.h
with
28 additions
and
12 deletions
videoview.cpp
+
13
−
5
View file @
e52278b6
...
...
@@ -67,6 +67,7 @@ VideoView::VideoView(QWidget* parent) :
this
,
SLOT
(
showContextMenu
(
const
QPoint
&
)));
connect
(
overlay_
,
&
VideoOverlay
::
setChatVisibility
,
[
=
](
bool
visible
)
{
emit
this
->
setChatVisibility
(
visible
);
connect
(
this
,
SIGNAL
(
toggleFullScreenClicked
()),
ui
->
videoWidget
,
SLOT
(
slotToggleFullScreenClicked
()));
});
}
...
...
@@ -81,6 +82,7 @@ VideoView::~VideoView()
void
VideoView
::
resizeEvent
(
QResizeEvent
*
event
)
{
int
marginWidth
=
ui
->
videoWidget
->
getPreviewMargin
();
QRect
&
previewRect
=
ui
->
videoWidget
->
getPreviewRect
();
int
deltaW
=
event
->
size
().
width
()
-
event
->
oldSize
().
width
();
int
deltaH
=
event
->
size
().
height
()
-
event
->
oldSize
().
height
();
...
...
@@ -102,16 +104,20 @@ VideoView::resizeEvent(QResizeEvent* event)
}
if
(
previewRect
.
left
()
<=
0
)
previewRect
.
moveLeft
(
1
);
previewRect
.
moveLeft
(
marginWidth
);
previewRect
.
moveRight
(
width
()
-
marginWidth
);
if
(
previewRect
.
right
()
>=
width
())
previewRect
.
moveRight
(
width
()
-
1
);
previewRect
.
moveRight
(
width
()
-
marginWidth
);
if
(
previewRect
.
top
()
<=
0
)
previewRect
.
moveTop
(
1
);
previewRect
.
moveTop
(
marginWidth
);
previewRect
.
moveBottom
(
height
()
-
marginWidth
);
if
(
previewRect
.
bottom
()
>=
height
())
previewRect
.
moveBottom
(
height
()
-
1
);
previewRect
.
moveBottom
(
height
()
-
marginWidth
);
ui
->
videoWidget
->
resetPreview
();
overlay_
->
resize
(
this
->
size
());
overlay_
->
show
();
...
...
@@ -164,8 +170,10 @@ VideoView::slotCallStatusChanged(const std::string& callId)
}
return
;
}
default
:
case
Status
::
ENDED
:
emit
closing
(
call
.
id
);
default
:
//emit closing(call.id);
break
;
}
QObject
::
disconnect
(
timerConnection_
);
...
...
This diff is collapsed.
Click to expand it.
videowidget.cpp
+
10
−
4
View file @
e52278b6
...
...
@@ -109,6 +109,12 @@ VideoWidget::renderFrame(const std::string& id)
}
}
void
VideoWidget
::
slotToggleFullScreenClicked
()
{
this
->
update
();
}
void
VideoWidget
::
paintEvent
(
QPaintEvent
*
e
)
{
...
...
@@ -155,8 +161,8 @@ VideoWidget::paintEvent(QPaintEvent* e)
}
if
(
previewImage_
)
{
if
(
resetPreview_
)
{
auto
previewHeight
=
fullPreview_
?
height
()
:
height
()
/
4
;
auto
previewWidth
=
fullPreview_
?
width
()
:
width
()
/
4
;
auto
previewHeight
=
fullPreview_
?
height
()
:
height
()
/
6
;
auto
previewWidth
=
fullPreview_
?
width
()
:
width
()
/
6
;
QImage
scaledPreview
;
if
(
photoMode_
)
scaledPreview
=
Utils
::
getCirclePhoto
(
*
previewImage_
,
previewHeight
);
...
...
@@ -164,8 +170,8 @@ VideoWidget::paintEvent(QPaintEvent* e)
scaledPreview
=
previewImage_
->
scaled
(
previewWidth
,
previewHeight
,
Qt
::
KeepAspectRatio
);
auto
xDiff
=
(
previewWidth
-
scaledPreview
.
width
())
/
2
;
auto
yDiff
=
(
previewHeight
-
scaledPreview
.
height
())
/
2
;
auto
yPos
=
fullPreview_
?
yDiff
:
height
()
-
previewHeight
-
previewMargin_
;
auto
xPos
=
fullPreview_
?
xDiff
:
width
()
-
scaledPreview
.
width
()
-
previewMargin_
;
auto
yPos
=
fullPreview_
?
yDiff
:
height
()
-
scaledPreview
.
height
()
-
previewMargin_
;
previewGeometry_
.
setRect
(
xPos
,
yPos
,
scaledPreview
.
width
(),
scaledPreview
.
height
());
painter
.
drawImage
(
previewGeometry_
,
scaledPreview
);
resetPreview_
=
false
;
...
...
This diff is collapsed.
Click to expand it.
videowidget.h
+
5
−
3
View file @
e52278b6
...
...
@@ -43,11 +43,14 @@ public:
inline
void
setResetPreview
(
bool
reset
)
{
resetPreview_
=
reset
;
hasFrame_
=
false
;
}
void
setPhotoMode
(
bool
isPhotoMode
);
QImage
takePhoto
();
int
getPreviewMargin
(){
return
previewMargin_
;
}
void
resetPreview
()
{
resetPreview_
=
true
;
}
protected
:
void
paintEvent
(
QPaintEvent
*
e
);
public
slots
:
void
slotToggleFullScreenClicked
();
void
slotRendererStarted
(
const
std
::
string
&
id
);
void
renderFrame
(
const
std
::
string
&
id
);
inline
QRect
&
getPreviewRect
(){
return
previewGeometry_
;
}
...
...
@@ -57,6 +60,8 @@ private:
QMetaObject
::
Connection
started
,
stopped
,
updated
;
}
rendererConnections_
;
void
paintBackgroundColor
(
QPainter
*
painter
,
QColor
color
);
video
::
Renderer
*
previewRenderer_
;
video
::
Frame
previewFrame_
;
std
::
unique_ptr
<
QImage
>
previewImage_
;
...
...
@@ -77,7 +82,4 @@ private:
bool
hasFrame_
=
false
;
constexpr
static
int
previewMargin_
=
15
;
private
:
void
paintBackgroundColor
(
QPainter
*
painter
,
QColor
color
);
};
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