Commit 0a54fa8d authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Philippe Gorley

Hardware acceleration: add UI

Add checkbox to toggle hardware acceleration in video preferences
Reviewed-by: Philippe Gorley's avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>

Change-Id: I4c4b26ceac05e407cbaee5e68920db844c63147d
parent 3420b858
......@@ -36,6 +36,7 @@
@property (assign) IBOutlet NSPopUpButton* videoDevicesList;
@property (assign) IBOutlet NSPopUpButton* sizesList;
@property (assign) IBOutlet NSPopUpButton* ratesList;
@property (assign) IBOutlet NSButton *enableHardwareAccelerationButton;
@property BOOL shouldHandlePreview;
......@@ -111,6 +112,9 @@ QMetaObject::Connection previewStopped;
[previewView.layer setContentsGravity:kCAGravityResizeAspect];
[previewView.layer setFrame:previewView.frame];
[previewView.layer setBounds:previewView.frame];
[self.enableHardwareAccelerationButton setState:Video::ConfigurationProxy::getDecodingAccelerated()];
}
- (IBAction)chooseDevice:(id)sender {
......@@ -131,6 +135,11 @@ QMetaObject::Connection previewStopped;
Video::ConfigurationProxy::rateSelectionModel().setCurrentIndex(qIdx, QItemSelectionModel::ClearAndSelect);
}
- (IBAction)toggleHardwareAcceleration:(NSButton *)sender {
bool enabled = [sender state]==NSOnState;
Video::ConfigurationProxy::setDecodingAccelerated(enabled);
}
- (void) connectPreviewSignals
{
QObject::disconnect(frameUpdated);
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D30a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VideoPrefsVC">
<connections>
<outlet property="enableHardwareAccelerationButton" destination="1hl-Ib-SGY" id="klf-oh-pSA"/>
<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"/>
......@@ -16,11 +18,11 @@
<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="541" height="440"/>
<rect key="frame" x="0.0" y="0.0" width="541" height="500"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FRq-3r-0WL">
<rect key="frame" x="18" y="403" width="66" height="17"/>
<rect key="frame" x="18" y="463" width="66" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="62" id="EZT-vC-kU5"/>
</constraints>
......@@ -31,7 +33,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DTo-76-fYS">
<rect key="frame" x="18" y="284" width="56" height="17"/>
<rect key="frame" x="18" y="291" width="56" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="52" id="cDW-QA-C8K"/>
</constraints>
......@@ -42,14 +44,14 @@
</textFieldCell>
</textField>
<customView wantsLayer="YES" canDrawConcurrently="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qAJ-w8-a6Q" userLabel="Preview">
<rect key="frame" x="32" y="20" width="489" height="256"/>
<rect key="frame" x="32" y="20" width="489" height="263"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="470" id="WVf-8f-i99"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="256" id="cpy-ph-ToC"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VWx-4c-7aF">
<rect key="frame" x="151" y="380" width="46" height="17"/>
<rect key="frame" x="151" y="440" width="46" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="42" id="oUT-qc-42j"/>
</constraints>
......@@ -60,7 +62,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5L8-b6-N3k" userLabel="Devices">
<rect key="frame" x="201" y="375" width="189" height="26"/>
<rect key="frame" x="201" y="435" width="189" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="184" id="WEa-DR-XtX"/>
</constraints>
......@@ -78,7 +80,7 @@
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cDr-8B-RiJ">
<rect key="frame" x="167" y="349" width="30" height="17"/>
<rect key="frame" x="167" y="409" width="30" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="26" id="bvy-Cc-671"/>
</constraints>
......@@ -89,7 +91,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="60X-MX-gun">
<rect key="frame" x="164" y="315" width="33" height="17"/>
<rect key="frame" x="164" y="375" width="33" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="29" id="jrh-Jr-I8X"/>
</constraints>
......@@ -100,7 +102,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Aec-P9-KNS" userLabel="Sizes">
<rect key="frame" x="201" y="344" width="189" height="26"/>
<rect key="frame" x="201" y="404" 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"/>
......@@ -115,7 +117,7 @@
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e3h-qA-wZ5" userLabel="Rates">
<rect key="frame" x="201" y="310" width="189" height="26"/>
<rect key="frame" x="201" y="370" 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"/>
......@@ -129,6 +131,31 @@
<action selector="chooseRate:" target="-2" id="nye-jT-0NU"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UbB-vj-Cwu">
<rect key="frame" x="18" y="348" width="152" height="17"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="62" id="ZRq-Io-2aG"/>
<constraint firstAttribute="height" constant="17" id="fS6-kt-HA7"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Hardware Acceleration" id="3d9-dN-m87">
<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>
<button translatesAutoresizingMaskIntoConstraints="NO" id="1hl-Ib-SGY">
<rect key="frame" x="201" y="319" width="183" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="3RD-4E-kkz"/>
</constraints>
<buttonCell key="cell" type="check" title="Enable hardware decoding" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="e7y-eV-Gsz">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="toggleHardwareAcceleration:" target="-2" id="w58-qW-HGp"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="Aec-P9-KNS" firstAttribute="top" secondItem="5L8-b6-N3k" secondAttribute="bottom" constant="10" symbolic="YES" id="30H-Y4-Vdk"/>
......@@ -144,15 +171,20 @@
<constraint firstItem="5L8-b6-N3k" firstAttribute="leading" secondItem="VWx-4c-7aF" secondAttribute="trailing" constant="8" id="XsG-3e-CZ6"/>
<constraint firstItem="FRq-3r-0WL" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="20" id="YLm-bH-x5h"/>
<constraint firstItem="5L8-b6-N3k" firstAttribute="trailing" secondItem="Aec-P9-KNS" secondAttribute="trailing" id="YUh-dc-lfW"/>
<constraint firstItem="UbB-vj-Cwu" firstAttribute="top" secondItem="e3h-qA-wZ5" secondAttribute="bottom" constant="8" id="aVY-Yi-ZFl"/>
<constraint firstItem="DTo-76-fYS" firstAttribute="top" secondItem="1hl-Ib-SGY" secondAttribute="bottom" constant="13" id="bWP-ZN-dhc"/>
<constraint firstItem="e3h-qA-wZ5" firstAttribute="top" secondItem="Aec-P9-KNS" secondAttribute="bottom" constant="13" id="cK6-VS-WcZ"/>
<constraint firstItem="cDr-8B-RiJ" firstAttribute="centerY" secondItem="Aec-P9-KNS" secondAttribute="centerY" id="dMC-00-cGN"/>
<constraint firstItem="60X-MX-gun" firstAttribute="centerY" secondItem="e3h-qA-wZ5" secondAttribute="centerY" id="efm-js-U8V"/>
<constraint firstItem="UbB-vj-Cwu" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="20" id="ep2-ye-pLY"/>
<constraint firstItem="1hl-Ib-SGY" firstAttribute="leading" secondItem="e3h-qA-wZ5" secondAttribute="leading" id="ezm-Pz-ruJ"/>
<constraint firstItem="5L8-b6-N3k" firstAttribute="centerY" secondItem="VWx-4c-7aF" secondAttribute="centerY" id="gRq-aG-Tev"/>
<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="top" secondItem="e3h-qA-wZ5" secondAttribute="bottom" constant="37" id="hX1-bK-s7J"/>
<constraint firstItem="1hl-Ib-SGY" firstAttribute="top" secondItem="UbB-vj-Cwu" secondAttribute="bottom" constant="13" id="iHy-aP-fCc"/>
<constraint firstItem="5L8-b6-N3k" firstAttribute="trailing" secondItem="e3h-qA-wZ5" secondAttribute="trailing" id="jTr-3S-Lag"/>
<constraint firstItem="e3h-qA-wZ5" firstAttribute="leading" secondItem="60X-MX-gun" secondAttribute="trailing" constant="8" id="k6I-Lc-Rfi"/>
<constraint firstItem="5L8-b6-N3k" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="203" id="vSx-Zv-fHl"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="1hl-Ib-SGY" secondAttribute="trailing" constant="20" id="x3K-V0-1dI"/>
</constraints>
<point key="canvasLocation" x="372.5" y="257"/>
</customView>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment