Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-client-macos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Iterations
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
savoirfairelinux
jami-client-macos
Commits
b8a81161
Commit
b8a81161
authored
Mar 20, 2015
by
Alexandre Lision
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preferences: bind video prefs to lrc
Refs #66840 Change-Id: I15d6f872f87392574b2868a9d571e6a81419f17b
parent
5db3e4e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
314 additions
and
99 deletions
+314
-99
VideoPrefs.xib
VideoPrefs.xib
+79
-88
VideoPrefsVC.h
VideoPrefsVC.h
+36
-8
VideoPrefsVC.mm
VideoPrefsVC.mm
+199
-3
No files found.
VideoPrefs.xib
View file @
b8a81161
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.Cocoa.XIB"
version=
"3.0"
toolsVersion=
"6
254"
systemVersion=
"13F34
"
targetRuntime=
"MacOSX.Cocoa"
propertyAccessControl=
"none"
useAutolayout=
"YES"
customObjectInstantitationMethod=
"direct"
>
<document
type=
"com.apple.InterfaceBuilder3.Cocoa.XIB"
version=
"3.0"
toolsVersion=
"6
751"
systemVersion=
"14C1510
"
targetRuntime=
"MacOSX.Cocoa"
propertyAccessControl=
"none"
useAutolayout=
"YES"
customObjectInstantitationMethod=
"direct"
>
<dependencies>
<deployment
identifier=
"macosx"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.CocoaPlugin"
version=
"6254"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.CocoaPlugin"
version=
"6751"
/>
</dependencies>
<objects>
<customObject
id=
"-2"
userLabel=
"File's Owner"
customClass=
"VideoPrefsVC"
>
<connections>
<outlet
property=
"previewView"
destination=
"qAJ-w8-a6Q"
id=
"uSq-tE-heV"
/>
<outlet
property=
"ratesList"
destination=
"e3h-qA-wZ5"
id=
"EPS-08-l6m"
/>
<outlet
property=
"sizesList"
destination=
"Aec-P9-KNS"
id=
"nYI-YP-fpQ"
/>
<outlet
property=
"videoDevicesList"
destination=
"5L8-b6-N3k"
id=
"ZsJ-sc-pYZ"
/>
<outlet
property=
"view"
destination=
"c22-O7-iKe"
id=
"EfM-Op-S9T"
/>
</connections>
</customObject>
<customObject
id=
"-1"
userLabel=
"First Responder"
customClass=
"FirstResponder"
/>
<customObject
id=
"-3"
userLabel=
"Application"
customClass=
"NSObject"
/>
<customView
id=
"c22-O7-iKe"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"
683"
height=
"609
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"
541"
height=
"440
"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
<subviews>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"
DTo-76-fYS
"
>
<rect
key=
"frame"
x=
"
71"
y=
"369"
width=
"53
"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"
Camera"
id=
"YCM-JC-jin
"
>
<font
key=
"font"
metaFont=
"system"
/>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"
FRq-3r-0WL
"
>
<rect
key=
"frame"
x=
"
16"
y=
"406"
width=
"66
"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"
Selection"
id=
"VqO-Gm-CbB
"
>
<font
key=
"font"
metaFont=
"system
Bold
"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textFieldCell>
</textField>
<customView
wantsLayer=
"YES"
canDrawConcurrently=
"YES"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"qAJ-w8-a6Q"
userLabel=
"Preview"
>
<rect
key=
"frame"
x=
"106"
y=
"104"
width=
"470"
height=
"230"
/>
</customView>
<button
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Upa-iB-KCC"
>
<rect
key=
"frame"
x=
"124"
y=
"358"
width=
"122"
height=
"32"
/>
<buttonCell
key=
"cell"
type=
"push"
title=
"Start preview"
bezelStyle=
"rounded"
alignment=
"center"
borderStyle=
"border"
imageScaling=
"proportionallyDown"
inset=
"2"
id=
"bX7-eQ-8Ea"
>
<behavior
key=
"behavior"
pushIn=
"YES"
lightByBackground=
"YES"
lightByGray=
"YES"
/>
<font
key=
"font"
metaFont=
"system"
/>
</buttonCell>
</button>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"VWx-4c-7aF"
>
<rect
key=
"frame"
x=
"
116"
y=
"550
"
width=
"50"
height=
"17"
/>
<rect
key=
"frame"
x=
"
61"
y=
"381
"
width=
"50"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Device:"
id=
"170-NP-CSP"
>
<font
key=
"font"
metaFont=
"system"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textFieldCell>
</textField>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Y00-jB-8Ux"
>
<rect
key=
"frame"
x=
"106"
y=
"505"
width=
"60"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Channel:"
id=
"IJ5-l7-dN7"
>
<font
key=
"font"
metaFont=
"system"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textFieldCell>
</textField>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"5L8-b6-N3k"
userLabel=
"Devices"
>
<rect
key=
"frame"
x=
"115"
y=
"375"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
id=
"6Vf-hb-26C"
>
<behavior
key=
"behavior"
lightByBackground=
"YES"
lightByGray=
"YES"
/>
<font
key=
"font"
metaFont=
"menu"
/>
<menu
key=
"menu"
title=
"devices"
id=
"zJ9-1a-cpr"
>
<connections>
<outlet
property=
"delegate"
destination=
"-2"
id=
"mF2-Zc-wNP"
/>
</connections>
</menu>
</popUpButtonCell>
<connections>
<action
selector=
"chooseDevice:"
target=
"-2"
id=
"JjJ-Ul-8VM"
/>
</connections>
</popUpButton>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"cDr-8B-RiJ"
>
<rect
key=
"frame"
x=
"
132"
y=
"460
"
width=
"34"
height=
"17"
/>
<rect
key=
"frame"
x=
"
77"
y=
"349
"
width=
"34"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Size:"
id=
"4bq-ls-mCp"
>
<font
key=
"font"
metaFont=
"system"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
...
...
@@ -59,87 +59,78 @@
</textFieldCell>
</textField>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"60X-MX-gun"
>
<rect
key=
"frame"
x=
"
130"
y=
"413
"
width=
"36"
height=
"17"
/>
<rect
key=
"frame"
x=
"
75"
y=
"315
"
width=
"36"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Rate:"
id=
"5Im-df-jdd"
>
<font
key=
"font"
metaFont=
"system"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textFieldCell>
</textField>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"5L8-b6-N3k"
>
<rect
key=
"frame"
x=
"170"
y=
"544"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
title=
"Item 1"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
state=
"on"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
selectedItem=
"PLA-b4-Y2Z"
id=
"6Vf-hb-26C"
>
<behavior
key=
"behavior"
lightByBackground=
"YES"
lightByGray=
"YES"
/>
<font
key=
"font"
metaFont=
"menu"
/>
<menu
key=
"menu"
id=
"zJ9-1a-cpr"
>
<items>
<menuItem
title=
"Item 1"
state=
"on"
id=
"PLA-b4-Y2Z"
/>
<menuItem
title=
"Item 2"
id=
"AqV-S1-JqC"
/>
<menuItem
title=
"Item 3"
id=
"CkU-QC-dVQ"
/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"weW-fX-GwJ"
>
<rect
key=
"frame"
x=
"170"
y=
"500"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
title=
"Item 1"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
state=
"on"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
selectedItem=
"jp0-zC-w4a"
id=
"TPq-dw-EwN"
>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Aec-P9-KNS"
userLabel=
"Sizes"
>
<rect
key=
"frame"
x=
"115"
y=
"344"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
id=
"6ly-dX-MT4"
>
<behavior
key=
"behavior"
lightByBackground=
"YES"
lightByGray=
"YES"
/>
<font
key=
"font"
metaFont=
"menu"
/>
<menu
key=
"menu"
id=
"9bI-4N-gfG"
>
<items>
<menuItem
title=
"Item 1"
state=
"on"
id=
"jp0-zC-w4a"
/>
<menuItem
title=
"Item 2"
id=
"WQz-Y3-iY1"
/>
<menuItem
title=
"Item 3"
id=
"gky-36-FHp"
/>
</items>
<menu
key=
"menu"
title=
"sizes"
id=
"ykd-50-las"
>
<connections>
<outlet
property=
"delegate"
destination=
"-2"
id=
"5cI-wH-0AT"
/>
</connections>
</menu>
</popUpButtonCell>
<connections>
<action
selector=
"chooseSize:"
target=
"-2"
id=
"qra-Ci-Om8"
/>
</connections>
</popUpButton>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"
Aec-P9-KNS
"
>
<rect
key=
"frame"
x=
"1
70"
y=
"455
"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
title=
"Item 1"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
state=
"on"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
selectedItem=
"n8r-LT-t3t"
id=
"6ly-dX-MT4
"
>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"
e3h-qA-wZ5"
userLabel=
"Rates
"
>
<rect
key=
"frame"
x=
"1
15"
y=
"310
"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
id=
"pDt-c4-Fhs
"
>
<behavior
key=
"behavior"
lightByBackground=
"YES"
lightByGray=
"YES"
/>
<font
key=
"font"
metaFont=
"menu"
/>
<menu
key=
"menu"
id=
"ykd-50-las"
>
<items>
<menuItem
title=
"Item 1"
state=
"on"
id=
"n8r-LT-t3t"
/>
<menuItem
title=
"Item 2"
id=
"jUy-xn-1kn"
/>
<menuItem
title=
"Item 3"
id=
"obd-cQ-mz8"
/>
</items>
<menu
key=
"menu"
title=
"rates"
id=
"aKL-76-vSP"
>
<connections>
<outlet
property=
"delegate"
destination=
"-2"
id=
"5Gu-bg-y3C"
/>
</connections>
</menu>
</popUpButtonCell>
<connections>
<action
selector=
"chooseRate:"
target=
"-2"
id=
"nye-jT-0NU"
/>
</connections>
</popUpButton>
<popUpButton
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"e3h-qA-wZ5"
>
<rect
key=
"frame"
x=
"170"
y=
"408"
width=
"189"
height=
"26"
/>
<popUpButtonCell
key=
"cell"
type=
"push"
title=
"Item 1"
bezelStyle=
"rounded"
alignment=
"left"
lineBreakMode=
"truncatingTail"
state=
"on"
borderStyle=
"borderAndBezel"
imageScaling=
"proportionallyDown"
inset=
"2"
selectedItem=
"GFu-rO-tr4"
id=
"pDt-c4-Fhs"
>
<behavior
key=
"behavior"
lightByBackground=
"YES"
lightByGray=
"YES"
/>
<font
key=
"font"
metaFont=
"menu"
/>
<menu
key=
"menu"
id=
"aKL-76-vSP"
>
<items>
<menuItem
title=
"Item 1"
state=
"on"
id=
"GFu-rO-tr4"
/>
<menuItem
title=
"Item 2"
id=
"aF9-ac-MF4"
/>
<menuItem
title=
"Item 3"
id=
"FoN-dd-DcF"
/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"WNL-Ul-Jbr"
>
<rect
key=
"frame"
x=
"526"
y=
"342"
width=
"52"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Preview"
id=
"Lrq-tD-NYF"
>
<font
key=
"font"
metaFont=
"system"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textFieldCell>
</textField>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"FRq-3r-0WL"
>
<rect
key=
"frame"
x=
"71"
y=
"575"
width=
"61"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Selection"
id=
"VqO-Gm-CbB"
>
<font
key=
"font"
metaFont=
"system"
/>
<customView
wantsLayer=
"YES"
canDrawConcurrently=
"YES"
ambiguous=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"qAJ-w8-a6Q"
userLabel=
"Preview"
>
<rect
key=
"frame"
x=
"32"
y=
"20"
width=
"470"
height=
"230"
/>
<constraints>
<constraint
firstAttribute=
"width"
relation=
"greaterThanOrEqual"
constant=
"470"
id=
"WVf-8f-i99"
/>
<constraint
firstAttribute=
"height"
relation=
"greaterThanOrEqual"
constant=
"230"
id=
"udn-lE-Jd4"
/>
</constraints>
</customView>
<button
verticalHuggingPriority=
"750"
ambiguous=
"YES"
misplaced=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"qHu-4n-CTV"
>
<rect
key=
"frame"
x=
"32"
y=
"257"
width=
"122"
height=
"19"
/>
<buttonCell
key=
"cell"
type=
"roundRect"
title=
"Test preview"
bezelStyle=
"roundedRect"
alignment=
"center"
borderStyle=
"border"
imageScaling=
"proportionallyDown"
inset=
"2"
id=
"IGT-OE-qJj"
>
<behavior
key=
"behavior"
pushIn=
"YES"
lightByBackground=
"YES"
lightByGray=
"YES"
changeBackground=
"YES"
changeGray=
"YES"
/>
<font
key=
"font"
metaFont=
"cellTitle"
/>
</buttonCell>
<connections>
<action
selector=
"togglePreview:"
target=
"-2"
id=
"Z1R-EV-1Na"
/>
</connections>
</button>
<textField
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"750"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"DTo-76-fYS"
>
<rect
key=
"frame"
x=
"18"
y=
"284"
width=
"53"
height=
"17"
/>
<textFieldCell
key=
"cell"
scrollable=
"YES"
lineBreakMode=
"clipping"
sendsActionOnEndEditing=
"YES"
title=
"Camera"
id=
"YCM-JC-jin"
>
<font
key=
"font"
metaFont=
"systemBold"
/>
<color
key=
"textColor"
name=
"controlTextColor"
catalog=
"System"
colorSpace=
"catalog"
/>
<color
key=
"backgroundColor"
name=
"controlColor"
catalog=
"System"
colorSpace=
"catalog"
/>
</textFieldCell>
</textField>
</subviews>
<point
key=
"canvasLocation"
x=
"428.5"
y=
"407.5"
/>
<constraints>
<constraint
firstAttribute=
"trailing"
secondItem=
"qAJ-w8-a6Q"
secondAttribute=
"trailing"
constant=
"39"
id=
"EIm-N6-noX"
/>
<constraint
firstItem=
"qHu-4n-CTV"
firstAttribute=
"leading"
secondItem=
"c22-O7-iKe"
secondAttribute=
"leading"
constant=
"32"
id=
"HL9-hR-8AT"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"qAJ-w8-a6Q"
secondAttribute=
"bottom"
constant=
"20"
id=
"Sv6-Ls-4tS"
/>
<constraint
firstItem=
"qAJ-w8-a6Q"
firstAttribute=
"top"
secondItem=
"qHu-4n-CTV"
secondAttribute=
"bottom"
constant=
"8"
id=
"cQh-RN-ARc"
/>
<constraint
firstItem=
"qAJ-w8-a6Q"
firstAttribute=
"leading"
secondItem=
"c22-O7-iKe"
secondAttribute=
"leading"
constant=
"32"
id=
"gt3-zq-vOi"
/>
<constraint
firstItem=
"qAJ-w8-a6Q"
firstAttribute=
"leading"
secondItem=
"qHu-4n-CTV"
secondAttribute=
"leading"
id=
"oaw-xG-gPo"
/>
</constraints>
<point
key=
"canvasLocation"
x=
"372.5"
y=
"257"
/>
</customView>
</objects>
</document>
VideoPrefsVC.h
View file @
b8a81161
//
// VideoPrefsVC.h
// Ring
//
// Created by Alexandre Lision on 2015-02-20.
//
//
/*
* Copyright (C) 2004-2015 Savoir-Faire Linux Inc.
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef RING_VIDEOPREFSVC_H
#define RING_VIDEOPREFSVC_H
#import <Cocoa/Cocoa.h>
@interface
VideoPrefsVC
:
NSViewController
@interface
VideoPrefsVC
:
NSViewController
<
NSMenuDelegate
>
{
}
@end
#endif // RING_VIDEOPREFSVC_H
VideoPrefsVC.mm
View file @
b8a81161
...
...
@@ -29,15 +29,211 @@
*/
#import "VideoPrefsVC.h"
#import <QuartzCore/QuartzCore.h>
#import <QItemSelectionModel>
#import <QAbstractProxyModel>
#import <video/configurationproxy.h>
#import <video/sourcemodel.h>
#import <video/previewmanager.h>
#import <video/renderer.h>
#import <video/device.h>
#import <video/devicemodel.h>
@interface
VideoPrefsVC
()
@property
(
assign
)
IBOutlet
NSView
*
previewView
;
@property
(
assign
)
IBOutlet
NSPopUpButton
*
videoDevicesList
;
@property
(
assign
)
IBOutlet
NSPopUpButton
*
sizesList
;
@property
(
assign
)
IBOutlet
NSPopUpButton
*
ratesList
;
@end
@implementation
VideoPrefsVC
@synthesize
previewView
;
@synthesize
videoDevicesList
;
@synthesize
sizesList
;
@synthesize
ratesList
;
QMetaObject
::
Connection
frameUpdated
;
QMetaObject
::
Connection
previewStarted
;
QMetaObject
::
Connection
previewStopped
;
-
(
void
)
loadView
{
[
super
loadView
];
Video
::
ConfigurationProxy
::
deviceModel
()
->
rowCount
();
Video
::
ConfigurationProxy
::
resolutionModel
()
->
rowCount
();
Video
::
ConfigurationProxy
::
rateModel
()
->
rowCount
();
QModelIndex
qDeviceIdx
=
Video
::
ConfigurationProxy
::
deviceSelectionModel
()
->
currentIndex
();
qDeviceIdx
=
Video
::
ConfigurationProxy
::
deviceSelectionModel
()
->
currentIndex
();
[
videoDevicesList
addItemWithTitle
:
Video
:
:
ConfigurationProxy
::
deviceModel
()
->
data
(
qDeviceIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
QModelIndex
qSizeIdx
=
Video
::
ConfigurationProxy
::
resolutionSelectionModel
()
->
currentIndex
();
[
sizesList
addItemWithTitle
:
Video
:
:
ConfigurationProxy
::
resolutionModel
()
->
data
(
qSizeIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
if
(
qobject_cast
<
QAbstractProxyModel
*>
(
Video
::
ConfigurationProxy
::
resolutionModel
()))
{
QObject
::
connect
(
qobject_cast
<
QAbstractProxyModel
*>
(
Video
::
ConfigurationProxy
::
resolutionModel
()),
&
QAbstractProxyModel
::
modelReset
,
[
=
]()
{
NSLog
(
@"resolution Source model changed!!!"
);
});
}
QModelIndex
qRate
=
Video
::
ConfigurationProxy
::
rateSelectionModel
()
->
currentIndex
();
[
ratesList
addItemWithTitle
:
Video
:
:
ConfigurationProxy
::
rateModel
()
->
data
(
qDeviceIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
if
(
qobject_cast
<
QAbstractProxyModel
*>
(
Video
::
ConfigurationProxy
::
rateModel
()))
{
QObject
::
connect
(
qobject_cast
<
QAbstractProxyModel
*>
(
Video
::
ConfigurationProxy
::
rateModel
()),
&
QAbstractProxyModel
::
modelReset
,
[
=
]()
{
NSLog
(
@"rates Source model changed!!!"
);
});
}
[
previewView
setWantsLayer
:
YES
];
[
previewView
setLayer
:[
CALayer
layer
]];
[
previewView
.
layer
setBackgroundColor
:[
NSColor
blackColor
].
CGColor
];
[
previewView
.
layer
setContentsGravity
:
kCAGravityResizeAspect
];
[
previewView
.
layer
setFrame
:
previewView
.
frame
];
[
previewView
.
layer
setBounds
:
previewView
.
frame
];
[
self
connectPreviewSignals
];
}
-
(
IBAction
)
chooseDevice
:(
id
)
sender
{
int
index
=
[
sender
indexOfSelectedItem
];
QModelIndex
qIdx
=
Video
::
ConfigurationProxy
::
deviceModel
()
->
index
(
index
,
0
);
Video
::
ConfigurationProxy
::
deviceSelectionModel
()
->
setCurrentIndex
(
qIdx
,
QItemSelectionModel
::
ClearAndSelect
);
}
-
(
IBAction
)
chooseSize
:(
id
)
sender
{
int
index
=
[
sender
indexOfSelectedItem
];
QModelIndex
qIdx
=
Video
::
ConfigurationProxy
::
resolutionModel
()
->
index
(
index
,
0
);
Video
::
ConfigurationProxy
::
resolutionSelectionModel
()
->
setCurrentIndex
(
qIdx
,
QItemSelectionModel
::
ClearAndSelect
);
}
-
(
IBAction
)
chooseRate
:(
id
)
sender
{
int
index
=
[
sender
indexOfSelectedItem
];
QModelIndex
qIdx
=
Video
::
ConfigurationProxy
::
rateModel
()
->
index
(
index
,
0
);
Video
::
ConfigurationProxy
::
rateSelectionModel
()
->
setCurrentIndex
(
qIdx
,
QItemSelectionModel
::
ClearAndSelect
);
}
-
(
void
)
connectPreviewSignals
{
QObject
::
disconnect
(
frameUpdated
);
QObject
::
disconnect
(
previewStopped
);
QObject
::
disconnect
(
previewStarted
);
previewStarted
=
QObject
::
connect
(
Video
::
PreviewManager
::
instance
(),
&
Video
::
PreviewManager
::
previewStarted
,
[
=
](
Video
::
Renderer
*
renderer
)
{
NSLog
(
@"Preview started"
);
QObject
::
disconnect
(
frameUpdated
);
frameUpdated
=
QObject
::
connect
(
renderer
,
&
Video
::
Renderer
::
frameUpdated
,
[
=
]()
{
[
self
renderer
:
Video
:
:
PreviewManager
::
instance
()
->
previewRenderer
()
renderFrameForView
:
previewView
];
});
});
previewStopped
=
QObject
::
connect
(
Video
::
PreviewManager
::
instance
(),
&
Video
::
PreviewManager
::
previewStopped
,
[
=
](
Video
::
Renderer
*
renderer
)
{
NSLog
(
@"Preview stopped"
);
QObject
::
disconnect
(
frameUpdated
);
[
previewView
.
layer
setContents
:
nil
];
});
frameUpdated
=
QObject
::
connect
(
Video
::
PreviewManager
::
instance
()
->
previewRenderer
(),
&
Video
::
Renderer
::
frameUpdated
,
[
=
]()
{
[
self
renderer
:
Video
:
:
PreviewManager
::
instance
()
->
previewRenderer
()
renderFrameForView:
previewView
];
});
}
-
(
void
)
renderer
:
(
Video
::
Renderer
*
)
renderer
renderFrameForView
:(
NSView
*
)
view
{
const
QByteArray
&
data
=
renderer
->
currentFrame
();
QSize
res
=
renderer
->
size
();
auto
buf
=
reinterpret_cast
<
const
unsigned
char
*>
(
data
.
data
());
CGColorSpaceRef
colorSpace
=
CGColorSpaceCreateDeviceRGB
();
CGContextRef
newContext
=
CGBitmapContextCreate
((
void
*
)
buf
,
res
.
width
(),
res
.
height
(),
8
,
4
*
res
.
width
(),
colorSpace
,
kCGImageAlphaPremultipliedLast
);
CGImageRef
newImage
=
CGBitmapContextCreateImage
(
newContext
);
/*We release some components*/
CGContextRelease
(
newContext
);
CGColorSpaceRelease
(
colorSpace
);
[
CATransaction
begin
];
view
.
layer
.
contents
=
(
__bridge
id
)
newImage
;
[
CATransaction
commit
];
CFRelease
(
newImage
);
}
-
(
IBAction
)
togglePreview
:(
id
)
sender
{
if
([
sender
state
]
==
NSOnState
)
Video
::
PreviewManager
::
instance
()
->
startPreview
();
else
Video
::
PreviewManager
::
instance
()
->
stopPreview
();
}
-
(
void
)
viewWillDisappear
{
Video
::
PreviewManager
::
instance
()
->
stopPreview
();
}
#pragma mark - NSMenuDelegate methods
-
(
BOOL
)
menu
:(
NSMenu
*
)
menu
updateItem
:(
NSMenuItem
*
)
item
atIndex
:(
NSInteger
)
index
shouldCancel
:(
BOOL
)
shouldCancel
{
QModelIndex
qIdx
;
if
([
menu
.
title
isEqualToString
:
@"devices"
])
{
qIdx
=
Video
::
ConfigurationProxy
::
deviceModel
()
->
index
(
index
,
0
);
[
item
setTitle
:
Video
:
:
ConfigurationProxy
::
deviceModel
()
->
data
(
qIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
}
else
if
([
menu
.
title
isEqualToString
:
@"sizes"
])
{
qIdx
=
Video
::
ConfigurationProxy
::
resolutionModel
()
->
index
(
index
,
0
);
[
item
setTitle
:
Video
:
:
ConfigurationProxy
::
resolutionModel
()
->
data
(
qIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
}
else
if
([
menu
.
title
isEqualToString
:
@"rates"
])
{
qIdx
=
Video
::
ConfigurationProxy
::
rateModel
()
->
index
(
index
,
0
);
[
item
setTitle
:
Video
:
:
ConfigurationProxy
::
rateModel
()
->
data
(
qIdx
,
Qt
::
DisplayRole
).
toString
().
toNSString
()];
}
return
YES
;
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do view setup here.
-
(
NSInteger
)
numberOfItemsInMenu
:(
NSMenu
*
)
menu
{
if
([
menu
.
title
isEqualToString
:
@"devices"
])
{
return
Video
::
ConfigurationProxy
::
deviceModel
()
->
rowCount
();
}
else
if
([
menu
.
title
isEqualToString
:
@"sizes"
])
{
return
Video
::
ConfigurationProxy
::
resolutionModel
()
->
rowCount
();
}
else
if
([
menu
.
title
isEqualToString
:
@"rates"
])
{
return
Video
::
ConfigurationProxy
::
rateModel
()
->
rowCount
();
}
}
@end
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