Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-client-macos
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-client-macos
Commits
d76f6206
Commit
d76f6206
authored
6 years ago
by
Kateryna Kostiuk
Browse files
Options
Downloads
Patches
Plain Diff
call: enable screen sharing
Change-Id: Iba8a17b534cf5c151b930e0c7df78b5b34ec6a0e
parent
84fc31f7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/CurrentCallVC.mm
+1
-0
1 addition, 0 deletions
src/CurrentCallVC.mm
src/views/CallView.h
+3
-0
3 additions, 0 deletions
src/views/CallView.h
src/views/CallView.mm
+59
-32
59 additions, 32 deletions
src/views/CallView.mm
ui/Base.lproj/Localizable.strings
+3
-0
3 additions, 0 deletions
ui/Base.lproj/Localizable.strings
with
66 additions
and
32 deletions
src/CurrentCallVC.mm
+
1
−
0
View file @
d76f6206
...
...
@@ -160,6 +160,7 @@
if
(
currentCall
.
isAudioOnly
)
{
muteVideoButton
.
image
=
[
NSImage
imageNamed
:
@"ic_action_mute_video.png"
];
}
videoView
.
callId
=
callUid
;
}
-
(
void
)
awakeFromNib
...
...
This diff is collapsed.
Click to expand it.
src/views/CallView.h
+
3
−
0
View file @
d76f6206
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <Cocoa/Cocoa.h>
#import <string>
@protocol
CallDelegate
;
@protocol
CallDelegate
...
...
@@ -46,4 +47,6 @@
*/
@property
(
nonatomic
)
id
<
CallDelegate
>
callDelegate
;
@property
std
::
string
callId
;
@end
This diff is collapsed.
Click to expand it.
src/views/CallView.mm
+
59
−
32
View file @
d76f6206
...
...
@@ -162,7 +162,8 @@
//check to see if we can accept the data
return
conforms
;
}
#if 0
// TODO: add file as a source
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
/*------------------------------------------------------
...
...
@@ -170,16 +171,17 @@
--------------------------------------------------------*/
if ( [sender draggingSource] != self ) {
NSURL* fileURL = [NSURL URLFromPasteboard: [sender draggingPasteboard]];
if
(
auto
current
=
CallModel
::
instance
().
selectedCall
())
{
if
(
auto
outVideo
=
current
->
firstMedia
<
media
::
Video
>
(
media
::
Media
::
Direction
::
OUT
))
{
outVideo
->
sourceModel
()
->
setFile
(
QUrl
::
fromLocalFile
(
QString
::
fromUtf8
([
fileURL
.
path
UTF8String
])));
return
YES
;
}
Call* call = [self getCurrentCall];
if (call == nullptr) return;
if (auto
outVideo
= call->firstMedia<media::Video>(media::Media::Direction::OUT)) {
outVideo->sourceModel()->setFile(QUrl::fromLocalFile(QString::fromUtf8([fileURL.path UTF8String])))
;
return YES;
}
}
return NO;
}
#endif
-
(
void
)
showContextualMenu
:(
NSEvent
*
)
theEvent
{
...
...
@@ -189,22 +191,28 @@
Video
::
Device
*
device
=
Video
::
DeviceModel
::
instance
().
devices
()[
i
];
[
contextualMenu
insertItemWithTitle
:
device
->
name
().
toNSString
()
action
:
@selector
(
switchInput
:
)
keyEquivalent
:
@""
atIndex
:
i
];
}
[
contextualMenu
insertItemWithTitle
:
NSLocalizedString
(
@"Share screen"
,
@"Contextual menu entry"
)
action:
@selector
(
captureScreen
:)
keyEquivalent
:
@""
atIndex
:
contextualMenu
.
itemArray
.
count
];
#if 0
// TODO: add file as a source
[contextualMenu addItem:[NSMenuItem separatorItem]];
[contextualMenu insertItemWithTitle:NSLocalizedString(@"Choose file", @"Contextual menu entry")
action:@selector(chooseFile:)
keyEquivalent:@""
atIndex:contextualMenu.itemArray.count];
#endif
[
NSMenu
popUpContextMenu
:
contextualMenu
withEvent
:
theEvent
forView
:
self
];
}
-
(
void
)
mouseMoved
:(
NSEvent
*
)
theEvent
{
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
];
// cancel showContextualMenu
[
self
performSelector
:
@selector
(
mouseIdle
:)
withObject
:
theEvent
afterDelay
:
3
];
if
(
self
.
callDelegate
&&
shouldAcceptInteractions
)
[
self
.
callDelegate
mouseIsMoving
:
YES
];
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
];
// cancel showContextualMenu
[
self
performSelector
:
@selector
(
mouseIdle
:)
withObject
:
theEvent
afterDelay
:
3
];
if
(
self
.
callDelegate
&&
shouldAcceptInteractions
)
[
self
.
callDelegate
mouseIsMoving
:
YES
];
}
-
(
void
)
mouseIdle
:(
NSEvent
*
)
theEvent
...
...
@@ -213,36 +221,47 @@
[
self
.
callDelegate
mouseIsMoving
:
NO
];
}
-
(
void
)
rightMouseUp
:
(
NSEvent
*
)
theEvent
{
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
];
if
([
theEvent
clickCount
]
==
1
&&
shouldAcceptInteractions
)
{
[
self
performSelector
:
@selector
(
showContextualMenu
:)
withObject
:
theEvent
];
}
}
-
(
void
)
mouseUp
:(
NSEvent
*
)
theEvent
{
if
([
theEvent
clickCount
]
==
1
&&
shouldAcceptInteractions
)
{
if
(
!
contextualMenu
)
[
self
performSelector
:
@selector
(
showContextualMenu
:)
withObject
:
theEvent
afterDelay
:
[
NSEvent
doubleClickInterval
]];
else
contextualMenu
=
nil
;
}
else
if
([
theEvent
clickCount
]
==
2
)
{
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
];
// cancel showContextualMenu
if
(
self
.
callDelegate
)
{
[
self
.
callDelegate
callShouldToggleFullScreen
];
}
if
([
theEvent
clickCount
]
==
2
&&
self
.
callDelegate
)
{
[
self
.
callDelegate
callShouldToggleFullScreen
];
}
}
-
(
void
)
switchInput
:(
NSMenuItem
*
)
sender
{
int
index
=
[
contextualMenu
indexOfItem
:
sender
];
if
(
auto
current
=
CallModel
::
instance
().
selectedCall
())
{
if
(
auto
outVideo
=
current
->
firstMedia
<
media
::
Video
>
(
media
::
Media
::
Direction
::
OUT
))
{
outVideo
->
sourceModel
()
->
switchTo
(
Video
::
DeviceModel
::
instance
().
devices
()[
index
]);
}
Call
*
call
=
[
self
getCurrentCall
];
if
(
call
==
nullptr
)
return
;
if
(
auto
outVideo
=
call
->
firstMedia
<
media
::
Video
>
(
media
::
Media
::
Direction
::
OUT
))
{
outVideo
->
sourceModel
()
->
switchTo
(
Video
::
DeviceModel
::
instance
().
devices
()[
index
]);
}
}
-
(
void
)
captureScreen
:(
NSMenuItem
*
)
sender
{
Call
*
call
=
[
self
getCurrentCall
];
if
(
call
==
nullptr
)
return
;
if
(
auto
outVideo
=
call
->
firstMedia
<
media
::
Video
>
(
media
::
Media
::
Direction
::
OUT
))
{
NSScreen
*
mainScreen
=
[
NSScreen
mainScreen
];
NSRect
screenFrame
=
mainScreen
.
frame
;
QRect
captureRect
=
QRect
(
screenFrame
.
origin
.
x
,
screenFrame
.
origin
.
y
,
screenFrame
.
size
.
width
,
screenFrame
.
size
.
height
);
outVideo
->
sourceModel
()
->
setDisplay
(
0
,
captureRect
);
}
}
-
(
void
)
chooseFile
:(
NSMenuItem
*
)
sender
{
Call
*
call
=
[
self
getCurrentCall
];
if
(
call
==
nullptr
)
return
;
NSOpenPanel
*
browsePanel
=
[[
NSOpenPanel
alloc
]
init
];
[
browsePanel
setDirectoryURL
:[
NSURL
URLWithString
:
NSHomeDirectory
()]];
[
browsePanel
setCanChooseFiles
:
YES
];
...
...
@@ -255,18 +274,26 @@
[
fileTypes
addObject
:(
__bridge
NSString
*
)
kUTTypeMovie
];
[
fileTypes
addObject
:(
__bridge
NSString
*
)
kUTTypeImage
];
[
browsePanel
setAllowedFileTypes
:
fileTypes
];
[
browsePanel
beginSheetModalForWindow
:[
self
window
]
completionHandler
:
^
(
NSInteger
result
)
{
if
(
result
==
NSFileHandlingPanelOKButton
)
{
NSURL
*
theDoc
=
[[
browsePanel
URLs
]
objectAtIndex
:
0
];
if
(
auto
current
=
CallModel
::
instance
().
selectedCall
())
{
if
(
auto
outVideo
=
current
->
firstMedia
<
media
::
Video
>
(
media
::
Media
::
Direction
::
OUT
))
{
outVideo
->
sourceModel
()
->
setFile
(
QUrl
::
fromLocalFile
(
QString
::
fromUtf8
([
theDoc
.
path
UTF8String
])));
}
if
(
auto
outVideo
=
call
->
firstMedia
<
media
::
Video
>
(
media
::
Media
::
Direction
::
OUT
))
{
outVideo
->
sourceModel
()
->
setFile
(
QUrl
::
fromLocalFile
(
QString
::
fromUtf8
([
theDoc
.
path
UTF8String
])));
}
}
}];
}
-
(
Call
*
)
getCurrentCall
{
auto
calls
=
CallModel
::
instance
().
getActiveCalls
();
Call
*
call
=
nullptr
;
for
(
int
i
=
0
;
i
<
calls
.
size
();
i
++
)
{
if
(
calls
.
at
(
i
)
->
historyId
()
==
QString
::
fromStdString
(
self
.
callId
))
{
return
calls
.
at
(
i
);
}
}
return
call
;
}
@end
This diff is collapsed.
Click to expand it.
ui/Base.lproj/Localizable.strings
+
3
−
0
View file @
d76f6206
...
...
@@ -55,6 +55,9 @@
/* Contextual menu entry */
"Choose file" = "Choose file";
/* Contextual menu entry */
"Share screen" = "Share screen";
/* No comment provided by engineer. */
"Copy" = "Copy";
...
...
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