Commit b6c31714 authored by David's avatar David

macosx: resume dialog: Replace "always continue" button with a check box

This better matches similarly styled macOS dialogs, with the meaning
"just do it and do not annoy me again". Value will be set on click
on the checkbox.

close #17134
parent cb82fd5a
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G24b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCCoreDialogProvider">
......@@ -31,7 +31,7 @@
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="332" y="446" width="426" height="278"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<view key="contentView" id="249">
<rect key="frame" x="0.0" y="0.0" width="426" height="278"/>
<autoresizingMask key="autoresizingMask"/>
......@@ -167,7 +167,7 @@ Gw
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="319" y="460" width="522" height="182"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<view key="contentView" id="302">
<rect key="frame" x="0.0" y="0.0" width="522" height="182"/>
<autoresizingMask key="autoresizingMask"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10102" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G24b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10102"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ResumeDialogController">
<connections>
<outlet property="o_always_resume_btn" destination="17" id="36"/>
<outlet property="o_always_resume_chk" destination="85X-TN-2Hu" id="ttg-8c-Zbf"/>
<outlet property="o_restart_btn" destination="9" id="37"/>
<outlet property="o_resume_btn" destination="21" id="38"/>
<outlet property="o_text_lbl" destination="3" id="49"/>
......@@ -17,43 +17,49 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="446" height="133"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="contentRect" x="196" y="240" width="446" height="160"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
<value key="minSize" type="size" width="446" height="133"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="446" height="133"/>
<rect key="frame" x="0.0" y="0.0" width="446" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" preferredMaxLayoutWidth="560" translatesAutoresizingMaskIntoConstraints="NO" id="3">
<rect key="frame" x="102" y="56" width="326" height="32"/>
<rect key="frame" x="102" y="83" width="326" height="32"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Do you want to resume this file?
This-is-a-file" id="4">
<font key="font" metaFont="titleBar" size="12"/>
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9">
<rect key="frame" x="98" y="13" width="84" height="32"/>
<buttonCell key="cell" type="push" title="Restart" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="10">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="buttonClicked:" target="-2" id="52"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="17">
<rect key="frame" x="198" y="13" width="139" height="32"/>
<buttonCell key="cell" type="push" title="Always continue" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="18">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="42">
<rect key="frame" x="102" y="123" width="132" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Continue playback?" id="43">
<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>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="55">
<rect key="frame" x="20" y="75" width="65" height="65"/>
<constraints>
<constraint firstAttribute="height" constant="65" id="rlw-rm-gTQ"/>
<constraint firstAttribute="width" constant="65" id="zgb-HV-gIF"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="vlc" id="56"/>
</imageView>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="85X-TN-2Hu">
<rect key="frame" x="102" y="59" width="326" height="18"/>
<buttonCell key="cell" type="check" title="Always continue media playback" bezelStyle="regularSquare" imagePosition="left" inset="2" id="xHm-jn-IdY">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="buttonClicked:" target="-2" id="53"/>
<action selector="resumeSettingChanged:" target="-2" id="alS-ps-u5T"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="21">
......@@ -69,41 +75,32 @@ DQ
<action selector="buttonClicked:" target="-2" id="54"/>
</connections>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="42">
<rect key="frame" x="102" y="96" width="132" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Continue playback?" id="43">
<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>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="55">
<rect key="frame" x="20" y="48" width="65" height="65"/>
<constraints>
<constraint firstAttribute="height" constant="65" id="rlw-rm-gTQ"/>
<constraint firstAttribute="width" constant="65" id="zgb-HV-gIF"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="vlc" id="56"/>
</imageView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9">
<rect key="frame" x="253" y="13" width="84" height="32"/>
<buttonCell key="cell" type="push" title="Restart" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="10">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="buttonClicked:" target="-2" id="52"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="42" firstAttribute="leading" secondItem="3" secondAttribute="leading" id="0IY-K9-Bkl"/>
<constraint firstAttribute="trailing" secondItem="21" secondAttribute="trailing" constant="20" id="32S-YZ-Fpf"/>
<constraint firstItem="3" firstAttribute="top" secondItem="42" secondAttribute="bottom" constant="8" id="3VQ-Ea-6y3"/>
<constraint firstItem="9" firstAttribute="leading" secondItem="3" secondAttribute="leading" id="74W-Gt-9vo"/>
<constraint firstItem="21" firstAttribute="leading" secondItem="17" secondAttribute="trailing" constant="12" id="Bbd-0B-JVY"/>
<constraint firstItem="55" firstAttribute="top" secondItem="42" secondAttribute="top" id="CcT-8r-bRm"/>
<constraint firstItem="55" firstAttribute="top" secondItem="2" secondAttribute="top" constant="20" id="Iav-mD-8iG"/>
<constraint firstItem="17" firstAttribute="centerY" secondItem="9" secondAttribute="centerY" id="Ilq-q1-3cQ"/>
<constraint firstItem="3" firstAttribute="trailing" secondItem="21" secondAttribute="trailing" id="PtC-fY-fIN"/>
<constraint firstItem="17" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="9" secondAttribute="trailing" constant="12" id="eAe-af-AIE"/>
<constraint firstAttribute="bottom" secondItem="9" secondAttribute="bottom" constant="20" id="SZk-pu-Lgd"/>
<constraint firstAttribute="bottom" secondItem="21" secondAttribute="bottom" constant="20" id="fiW-7M-G63"/>
<constraint firstItem="55" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="20" id="lQU-ef-GZw"/>
<constraint firstItem="17" firstAttribute="centerY" secondItem="21" secondAttribute="centerY" id="wBt-aq-2l2"/>
<constraint firstItem="21" firstAttribute="leading" secondItem="9" secondAttribute="trailing" constant="12" id="xrB-He-ihV"/>
<constraint firstItem="42" firstAttribute="leading" secondItem="55" secondAttribute="trailing" constant="19" id="yR0-JV-Hcv"/>
</constraints>
</view>
<point key="canvasLocation" x="358" y="374.5"/>
<point key="canvasLocation" x="358" y="388"/>
</window>
</objects>
<resources>
......
......@@ -28,7 +28,6 @@
enum ResumeResult {
RESUME_RESTART,
RESUME_ALWAYS,
RESUME_NOW
};
......@@ -41,10 +40,11 @@ typedef void(^CompletionBlock)(enum ResumeResult);
IBOutlet id o_restart_btn;
IBOutlet id o_resume_btn;
IBOutlet id o_always_resume_btn;
IBOutlet id o_always_resume_chk;
}
- (IBAction)buttonClicked:(id)sender;
- (IBAction)resumeSettingChanged:(id)sender;
- (void)showWindowWithItem:(input_item_t *)p_item withLastPosition:(NSInteger)pos completionBlock:(CompletionBlock)block;
......
......@@ -48,7 +48,7 @@
[o_title_lbl setStringValue:_NS("Continue playback?")];
[o_resume_btn setTitle:_NS("Continue")];
[o_always_resume_btn setTitle:_NS("Always continue")];
[o_always_resume_chk setTitle:_NS("Always continue media playback")];
}
- (void)showWindowWithItem:(input_item_t *)p_item withLastPosition:(NSInteger)pos completionBlock:(CompletionBlock)block
......@@ -73,6 +73,7 @@
free(psz_title_name);
NSString *labelString = [NSString stringWithFormat:_NS("Playback of \"%@\" will continue at %@"), o_title, [[VLCStringUtility sharedInstance] stringForTime:pos]];
[o_text_lbl setStringValue:labelString];
[o_always_resume_chk setState: NSOffState];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
......@@ -109,8 +110,6 @@
resumeResult = RESUME_RESTART;
else if (sender == o_resume_btn)
resumeResult = RESUME_NOW;
else
resumeResult = RESUME_ALWAYS;
[[self window] close];
......@@ -120,6 +119,13 @@
}
}
- (IBAction)resumeSettingChanged:(id)sender
{
int newState = [sender state] == NSOnState ? 1 : 0;
msg_Dbg(getIntf(), "Changing resume setting to %i", newState);
config_PutInt(getIntf(), "macosx-continue-playback", newState);
}
- (void)updateCocoaWindowLevel:(NSInteger)i_level
{
if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != i_level)
......
......@@ -908,9 +908,6 @@
mtime_t lastPos = (mtime_t)lastPosition.intValue * 1000000;
msg_Dbg(getIntf(), "continuing playback at %lld", lastPos);
var_SetInteger(p_input_thread, "time", lastPos);
if (result == RESUME_ALWAYS)
config_PutInt(getIntf(), "macosx-continue-playback", 1);
};
if (settingValue == 1) { // always
......
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