Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
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
Administrator
linphone-desktop
Commits
45e15a03
Commit
45e15a03
authored
Feb 01, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/components/camera/Camera): supports screenshots
parent
e6fbc72e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
17 deletions
+78
-17
en.ts
linphone-desktop/assets/languages/en.ts
+7
-0
fr.ts
linphone-desktop/assets/languages/fr.ts
+7
-0
Camera.cpp
linphone-desktop/src/components/camera/Camera.cpp
+28
-12
Camera.hpp
linphone-desktop/src/components/camera/Camera.hpp
+11
-2
FileMessage.qml
linphone-desktop/ui/modules/Linphone/Chat/FileMessage.qml
+1
-1
Incall.qml
linphone-desktop/ui/views/App/Calls/Incall.qml
+24
-2
No files found.
linphone-desktop/assets/languages/en.ts
View file @
45e15a03
...
...
@@ -357,6 +357,13 @@ Server url not configured.</translation>
<
translation
>
Display
tooltips
to
discover
Linphone
Desktop
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Incall
<
/name
>
<
message
>
<
source
>
saveScreenshotTitle
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
MainWindow
<
/name
>
<
message
>
...
...
linphone-desktop/assets/languages/fr.ts
View file @
45e15a03
...
...
@@ -345,6 +345,13 @@ Url du serveur non configurée.</translation>
<
translation
>
Afficher
les
tooltips
pour
d
é
couvrir
Linphone
Desktop
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Incall
<
/name
>
<
message
>
<
source
>
saveScreenshotTitle
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
IncomingCall
<
/name
>
<
message
>
...
...
linphone-desktop/src/components/camera/Camera.cpp
View file @
45e15a03
#include "Camera.hpp"
#include <QFileInfo>
#include <QOpenGLFunctions>
#include <QOpenGLTexture>
#include "../../utils.hpp"
#include "../core/CoreManager.hpp"
#include "Camera.hpp"
...
...
@@ -52,15 +52,10 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &
context_info
->
width
=
size
.
width
();
context_info
->
height
=
size
.
height
();
shared_ptr
<
linphone
::
Call
>
linphone_call
=
m_camera
->
m_call
->
getLinphoneCall
();
linphone
::
CallState
state
=
linphone_call
->
getState
();
if
(
state
==
linphone
::
CallStateConnected
||
state
==
linphone
::
CallStateStreamsRunning
)
{
if
(
m_camera
->
m_is_preview
)
CoreManager
::
getInstance
()
->
getCore
()
->
setNativePreviewWindowId
(
context_info
);
else
linphone_call
->
setNativeVideoWindowId
(
context_info
);
}
if
(
m_camera
->
m_is_preview
)
CoreManager
::
getInstance
()
->
getCore
()
->
setNativePreviewWindowId
(
context_info
);
else
m_camera
->
m_call
->
getLinphoneCall
()
->
setNativeVideoWindowId
(
context_info
);
return
new
QOpenGLFramebufferObject
(
size
,
format
);
}
...
...
@@ -95,9 +90,30 @@ Camera::~Camera () {
}
QQuickFramebufferObject
::
Renderer
*
Camera
::
createRenderer
()
const
{
return
new
CameraRenderer
(
this
);
m_renderer
=
new
CameraRenderer
(
this
);
return
m_renderer
;
}
// -----------------------------------------------------------------------------
void
Camera
::
takeScreenshot
()
{
m_screenshot
=
m_renderer
->
framebufferObject
()
->
toImage
();
}
void
Camera
::
saveScreenshot
(
const
QString
&
path
)
{
QString
formatted_path
=
path
.
startsWith
(
"file://"
)
?
path
.
mid
(
sizeof
(
"file://"
)
-
1
)
:
path
;
QFileInfo
info
(
formatted_path
);
QString
extension
=
info
.
suffix
();
m_screenshot
.
save
(
formatted_path
,
extension
.
size
()
>
0
?
::
Utils
::
qStringToLinphoneString
(
extension
).
c_str
()
:
"jpg"
,
100
);
}
// -----------------------------------------------------------------------------
void
Camera
::
mousePressEvent
(
QMouseEvent
*
)
{
setFocus
(
true
);
}
...
...
linphone-desktop/src/components/camera/Camera.hpp
View file @
45e15a03
#ifndef CAMERA_H_
#define CAMERA_H_
#include "../call/CallModel.hpp"
#include <QImage>
#include <QOpenGLFramebufferObject>
#include <QQuickFramebufferObject>
#include "../call/CallModel.hpp"
// =============================================================================
class
Camera
;
struct
ContextInfo
;
class
CameraRenderer
:
public
QQuickFramebufferObject
::
Renderer
{
friend
class
Camera
;
public:
CameraRenderer
(
const
Camera
*
camera
);
~
CameraRenderer
()
=
default
;
...
...
@@ -40,6 +43,9 @@ public:
QQuickFramebufferObject
::
Renderer
*
createRenderer
()
const
override
;
Q_INVOKABLE
void
takeScreenshot
();
Q_INVOKABLE
void
saveScreenshot
(
const
QString
&
path
);
signals:
void
callChanged
(
CallModel
*
call
);
void
isPreviewChanged
(
bool
is_preview
);
...
...
@@ -54,6 +60,9 @@ private:
bool
m_is_preview
=
false
;
CallModel
*
m_call
=
nullptr
;
ContextInfo
*
m_context_info
;
mutable
CameraRenderer
*
m_renderer
;
QImage
m_screenshot
;
};
#endif // CAMERA_H_
linphone-desktop/ui/modules/Linphone/Chat/FileMessage.qml
View file @
45e15a03
...
...
@@ -183,8 +183,8 @@ Row {
id
:
fileDialog
folder
:
shortcuts
.
home
title
:
qsTr
(
'
downloadFileTitle
'
)
selectExisting
:
false
title
:
qsTr
(
'
downloadFileTitle
'
)
onAccepted
:
proxyModel
.
downloadFile
(
index
,
fileUrl
)
}
...
...
linphone-desktop/ui/views/App/Calls/Incall.qml
View file @
45e15a03
import
QtQuick
2.7
import
QtQuick
.
Dialogs
1.2
import
QtQuick
.
Layouts
1.3
import
Common
1.0
...
...
@@ -84,13 +85,31 @@ Rectangle {
id
:
cameraActions
anchors.right
:
parent
.
right
active
:
Boolean
(
call
.
videoInputEnabled
)
active
:
Boolean
(
call
.
videoInputEnabled
)
&&
call
.
status
!==
CallModel
.
CallStatusEnded
sourceComponent
:
ActionBar
{
iconSize
:
CallStyle
.
header
.
iconSize
ActionButton
{
icon
:
'
screenshot
'
FileDialog
{
id
:
fileDialog
folder
:
shortcuts
.
home
selectExisting
:
false
title
:
qsTr
(
'
saveScreenshotTitle
'
)
onAccepted
:
cameraLoader
.
item
.
saveScreenshot
(
fileUrl
)
}
onClicked
:
{
// TODO: At this moment, FileDialog does not support default filename, use this name in the future:
//'linphone ' + ((new Date()).toLocaleString(Qt.locale(), 'yyyy-MM-dd hh:mm:ss')) + '.jpg'
cameraLoader
.
item
.
takeScreenshot
()
fileDialog
.
open
()
}
}
ActionButton
{
...
...
@@ -186,8 +205,9 @@ Rectangle {
}
Loader
{
anchors.centerIn
:
parent
id
:
cameraLoader
anchors.centerIn
:
parent
sourceComponent
:
call
.
videoInputEnabled
?
camera
:
avatar
}
}
...
...
@@ -200,6 +220,8 @@ Rectangle {
Layout.fillWidth
:
true
Layout.preferredHeight
:
CallStyle
.
actionArea
.
height
visible
:
call
.
status
!==
CallModel
.
CallStatusEnded
GridLayout
{
anchors
{
left
:
parent
.
left
...
...
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