[vlc-commits] macosx: update coding style for resume dialog controller

Felix Paul Kühne git at videolan.org
Tue Jul 16 12:40:39 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Jul 16 12:25:56 2019 +0200| [9c41a2d27cd33cf0903c5abfcb5af58c96c4cf76] | committer: Felix Paul Kühne

macosx: update coding style for resume dialog controller

no functional changes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c41a2d27cd33cf0903c5abfcb5af58c96c4cf76
---

 modules/gui/macosx/UI/ResumeDialog.xib             | 21 +++---
 .../panels/dialogs/VLCResumeDialogController.h     | 15 ++--
 .../panels/dialogs/VLCResumeDialogController.m     | 80 +++++++++++-----------
 .../playlist/VLCPlaybackContinuityController.m     |  2 -
 4 files changed, 57 insertions(+), 61 deletions(-)

diff --git a/modules/gui/macosx/UI/ResumeDialog.xib b/modules/gui/macosx/UI/ResumeDialog.xib
index 84fc8f6250..a0a321d987 100644
--- a/modules/gui/macosx/UI/ResumeDialog.xib
+++ b/modules/gui/macosx/UI/ResumeDialog.xib
@@ -1,27 +1,28 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
-        <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="VLCResumeDialogController">
             <connections>
-                <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"/>
-                <outlet property="o_title_lbl" destination="42" id="50"/>
+                <outlet property="alwaysResumeCheckbox" destination="85X-TN-2Hu" id="wMD-re-iG7"/>
+                <outlet property="descriptionLabel" destination="3" id="q0f-ZF-LmI"/>
+                <outlet property="restartButton" destination="9" id="0un-7j-N0C"/>
+                <outlet property="resumeButton" destination="21" id="qft-fx-Xk1"/>
+                <outlet property="titleLabel" destination="42" id="8ub-v7-69Y"/>
                 <outlet property="window" destination="1" id="35"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <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">
+        <window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" 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="549" height="160"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
             <value key="minSize" type="size" width="446" height="133"/>
             <view key="contentView" id="2">
                 <rect key="frame" x="0.0" y="0.0" width="549" height="160"/>
diff --git a/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.h b/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.h
index 306f6fe556..95ef5a9ccd 100644
--- a/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.h
+++ b/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.h
@@ -24,6 +24,7 @@
 #import <Cocoa/Cocoa.h>
 
 @class VLCInputItem;
+ at class VLCWrappableTextField;
 
 enum ResumeResult {
     RESUME_RESTART,
@@ -34,16 +35,12 @@ enum ResumeResult {
 typedef void(^CompletionBlock)(enum ResumeResult);
 
 @interface VLCResumeDialogController : NSWindowController
-{
-    IBOutlet id o_title_lbl;
-    IBOutlet id o_text_lbl;
 
-    IBOutlet id o_restart_btn;
-    IBOutlet id o_resume_btn;
-    IBOutlet id o_always_resume_chk;
-
-    NSTimer *o_countdown_timer;
-}
+ at property (readwrite, strong) IBOutlet NSTextField *titleLabel;
+ at property (readwrite, strong) IBOutlet VLCWrappableTextField *descriptionLabel;
+ at property (readwrite, strong) IBOutlet NSButton *restartButton;
+ at property (readwrite, strong) IBOutlet NSButton *resumeButton;
+ at property (readwrite, strong) IBOutlet NSButton *alwaysResumeCheckbox;
 
 - (IBAction)buttonClicked:(id)sender;
 - (IBAction)resumeSettingChanged:(id)sender;
diff --git a/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.m b/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.m
index 1c7d93b3e8..c714ee24da 100644
--- a/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.m
+++ b/modules/gui/macosx/panels/dialogs/VLCResumeDialogController.m
@@ -28,17 +28,19 @@
 #import "extensions/NSString+Helpers.h"
 #import "windows/video/VLCVideoOutputProvider.h"
 #import "library/VLCInputItem.h"
+#import "views/VLCWrappableTextField.h"
 
 @interface VLCResumeDialogController()
 {
-    int currentResumeTimeout;
-    CompletionBlock completionBlock;
+    int _currentResumeTimeout;
+    CompletionBlock _completionBlock;
+    NSTimer *_countdownTimer;
 }
 @end
 
 @implementation VLCResumeDialogController
 
-- (id)init
+- (instancetype)init
 {
     self = [super initWithWindowNibName:@"ResumeDialog"];
     if (self) {
@@ -57,68 +59,66 @@
 
 - (void)windowDidLoad
 {
-    [o_title_lbl setStringValue:_NS("Continue playback?")];
-    [o_resume_btn setTitle:_NS("Continue")];
+    [_titleLabel setStringValue:_NS("Continue playback?")];
+    [_resumeButton setTitle:_NS("Continue")];
 
-    [o_always_resume_chk setTitle:_NS("Always continue media playback")];
+    [_alwaysResumeCheckbox setTitle:_NS("Always continue media playback")];
 }
 
 - (void)showWindowWithItem:(VLCInputItem *)inputItem withLastPosition:(NSInteger)pos completionBlock:(CompletionBlock)block
 {
-    NSWindow *w = [self window];
+    _currentResumeTimeout = 10;
+    _completionBlock = [block copy];
 
-    currentResumeTimeout = 10;
-    completionBlock = [block copy];
-
-    NSString *o_restartButtonLabel = _NS("Restart playback");
-    o_restartButtonLabel = [o_restartButtonLabel stringByAppendingFormat:@" (%d)", currentResumeTimeout];
-    [o_restart_btn setTitle:o_restartButtonLabel];
+    NSString *restartButtonLabel = _NS("Restart playback");
+    restartButtonLabel = [restartButtonLabel stringByAppendingFormat:@" (%d)", _currentResumeTimeout];
+    [_restartButton setTitle:restartButtonLabel];
 
     NSString *labelString = [NSString stringWithFormat:_NS("Playback of \"%@\" will continue at %@"), inputItem.title, [NSString stringWithTime:pos]];
-    [o_text_lbl setStringValue:labelString];
-    [o_always_resume_chk setState: NSOffState];
-
-    o_countdown_timer = [NSTimer scheduledTimerWithTimeInterval:1
-                                                         target:self
-                                                       selector:@selector(updateAlertWindow:)
-                                                       userInfo:nil
-                                                        repeats:YES];
-
-    [w setLevel:[[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
-    [w center];
-
-    [w makeKeyAndOrderFront:nil];
+    [_descriptionLabel setStringValue:labelString];
+    [_alwaysResumeCheckbox setState:NSOffState];
+
+    _countdownTimer = [NSTimer scheduledTimerWithTimeInterval:1
+                                                       target:self
+                                                     selector:@selector(updateAlertWindow:)
+                                                     userInfo:nil
+                                                      repeats:YES];
+
+    NSWindow *window = [self window];
+    [window setLevel:[[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
+    [window center];
+    [window makeKeyAndOrderFront:nil];
 }
 
 - (void)updateAlertWindow:(NSTimer *)timer
 {
-    --currentResumeTimeout;
-    if (currentResumeTimeout <= 0) {
-        [self buttonClicked:o_restart_btn];
+    --_currentResumeTimeout;
+    if (_currentResumeTimeout <= 0) {
+        [self buttonClicked:_restartButton];
         [timer invalidate];
         timer = nil;
     }
 
     NSString *buttonLabel = _NS("Restart playback");
-    buttonLabel = [buttonLabel stringByAppendingFormat:@" (%d)", currentResumeTimeout];
+    buttonLabel = [buttonLabel stringByAppendingFormat:@" (%d)", _currentResumeTimeout];
 
-    [o_restart_btn setTitle:buttonLabel];
+    [_restartButton setTitle:buttonLabel];
 }
 
 - (IBAction)buttonClicked:(id)sender
 {
     enum ResumeResult resumeResult = RESUME_FAIL;
 
-    if (sender == o_restart_btn)
+    if (sender == _restartButton)
         resumeResult = RESUME_RESTART;
-    else if (sender == o_resume_btn)
+    else if (sender == _resumeButton)
         resumeResult = RESUME_NOW;
 
     [[self window] close];
 
-    if (completionBlock) {
-        completionBlock(resumeResult);
-        completionBlock = nil;
+    if (_completionBlock) {
+        _completionBlock(resumeResult);
+        _completionBlock = nil;
     }
 }
 
@@ -141,12 +141,12 @@
     if (![self isWindowLoaded])
         return;
 
-    if (o_countdown_timer != nil) {
-        [o_countdown_timer invalidate];
-        o_countdown_timer = nil;
+    if (_countdownTimer != nil) {
+        [_countdownTimer invalidate];
+        _countdownTimer = nil;
     }
 
-    [[self window] close];
+    [self.window close];
 }
 
 @end
diff --git a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
index 53f47aee91..9de5a7f4c0 100644
--- a/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
+++ b/modules/gui/macosx/playlist/VLCPlaybackContinuityController.m
@@ -30,8 +30,6 @@
 #import "playlist/VLCPlayerController.h"
 #import "library/VLCInputItem.h"
 
-#import <vlc_url.h>
-
 @interface VLCPlaybackContinuityController()
 {
     VLCInputItem *_currentInput;



More information about the vlc-commits mailing list