[vlc-commits] [Git][videolan/vlc][master] 3 commits: macosx: Make trailing time field in playback control bas functional

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jan 23 14:32:22 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5bc13bb5 by Claudio Cambra at 2023-01-23T14:00:37+00:00
macosx: Make trailing time field in playback control bas functional

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
1d3b4b44 by Claudio Cambra at 2023-01-23T14:00:37+00:00
macosx: Simplify setIsTimeRemaining property setter

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
01d73811 by Claudio Cambra at 2023-01-23T14:00:37+00:00
macosx: Prevent slider and media item label shifting around as time labels change

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


5 changed files:

- modules/gui/macosx/UI/VLCLibraryWindow.xib
- modules/gui/macosx/views/VLCTimeField.h
- modules/gui/macosx/views/VLCTimeField.m
- modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h
- modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m


Changes:

=====================================
modules/gui/macosx/UI/VLCLibraryWindow.xib
=====================================
@@ -19,24 +19,24 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="896" height="456"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
             <visualEffectView key="contentView" wantsLayer="YES" misplaced="YES" blendingMode="behindWindow" material="appearanceBased" state="followsWindowActiveState" id="EiT-Mj-1SZ">
                 <rect key="frame" x="0.0" y="0.0" width="896" height="456"/>
                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
                     <splitView autosaveName="librarywindowsplitview" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u8g-jy-S4e">
-                        <rect key="frame" x="0.0" y="45" width="896" height="138"/>
+                        <rect key="frame" x="0.0" y="45" width="896" height="134"/>
                         <subviews>
-                            <customView id="iSp-bV-w6B" customClass="VLCBasicView">
-                                <rect key="frame" x="0.0" y="0.0" width="598" height="138"/>
+                            <customView misplaced="YES" id="iSp-bV-w6B" customClass="VLCBasicView">
+                                <rect key="frame" x="0.0" y="0.0" width="598" height="134"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             </customView>
-                            <customView id="dus-WQ-AmE">
-                                <rect key="frame" x="599" y="0.0" width="297" height="138"/>
+                            <customView misplaced="YES" id="dus-WQ-AmE">
+                                <rect key="frame" x="599" y="0.0" width="297" height="134"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 <subviews>
                                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TET-5r-zHx">
-                                        <rect key="frame" x="18" y="97" width="66" height="31"/>
+                                        <rect key="frame" x="18" y="92" width="66" height="31"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="fo5-R8-TeO">
                                             <font key="font" textStyle="largeTitle" name=".SFNS-Regular"/>
                                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -44,7 +44,7 @@
                                         </textFieldCell>
                                     </textField>
                                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mbV-My-cm7" customClass="VLCRoundedCornerTextField">
-                                        <rect key="frame" x="242" y="105" width="37" height="16"/>
+                                        <rect key="frame" x="242" y="100" width="37" height="16"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="4hq-fU-NXW">
                                             <font key="font" metaFont="message"/>
                                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -52,12 +52,12 @@
                                         </textFieldCell>
                                     </textField>
                                     <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="qmL-Ar-cj1">
-                                        <rect key="frame" x="20" y="87" width="257" height="5"/>
+                                        <rect key="frame" x="20" y="82" width="257" height="5"/>
                                     </box>
                                     <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z7y-D0-11Q">
-                                        <rect key="frame" x="0.0" y="63" width="297" height="18"/>
+                                        <rect key="frame" x="0.0" y="62" width="297" height="14"/>
                                         <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Vdr-bg-tuS">
-                                            <rect key="frame" x="0.0" y="0.0" width="297" height="18"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="297" height="14"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView">
@@ -122,10 +122,10 @@
                                         </scroller>
                                     </scrollView>
                                     <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="nAW-KH-ipk">
-                                        <rect key="frame" x="20" y="52" width="257" height="5"/>
+                                        <rect key="frame" x="20" y="51" width="257" height="5"/>
                                     </box>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jg5-33-vH0">
-                                        <rect key="frame" x="20" y="15" width="24" height="24"/>
+                                        <rect key="frame" x="20" y="14" width="24" height="24"/>
                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="shuffleOn" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="J31-h3-U4s">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -135,7 +135,7 @@
                                         </connections>
                                     </button>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8zF-Wo-H79">
-                                        <rect key="frame" x="64" y="15" width="24" height="24"/>
+                                        <rect key="frame" x="64" y="14" width="24" height="24"/>
                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="repeatOff" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="ol2-xi-TEm">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -145,7 +145,7 @@
                                         </connections>
                                     </button>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cih-xp-HmY">
-                                        <rect key="frame" x="262" y="12" width="15.5" height="17"/>
+                                        <rect key="frame" x="262" y="11" width="15.5" height="17"/>
                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="trash" catalog="system" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="OjM-W9-IrQ">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -155,10 +155,10 @@
                                         </connections>
                                     </button>
                                     <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VFI-oW-dMZ" customClass="VLCDragDropView">
-                                        <rect key="frame" x="0.0" y="55" width="297" height="34"/>
+                                        <rect key="frame" x="0.0" y="54" width="297" height="30"/>
                                         <subviews>
                                             <box boxType="custom" borderType="line" borderWidth="0.0" cornerRadius="10" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="AXk-h7-dZ0">
-                                                <rect key="frame" x="81" y="-50" width="135" height="134"/>
+                                                <rect key="frame" x="81" y="-52" width="135" height="134"/>
                                                 <view key="contentView" id="NSp-cB-V4X">
                                                     <rect key="frame" x="0.0" y="0.0" width="135" height="134"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -166,7 +166,7 @@
                                                 <color key="borderColor" name="separatorColor" catalog="System" colorSpace="catalog"/>
                                             </box>
                                             <imageView translatesAutoresizingMaskIntoConstraints="NO" id="cTV-Wf-TfJ" customClass="VLCDropDisabledImageView">
-                                                <rect key="frame" x="93" y="-39" width="112" height="112"/>
+                                                <rect key="frame" x="93" y="-41" width="112" height="112"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" constant="112" id="IvG-i0-rbs"/>
                                                     <constraint firstAttribute="height" constant="112" id="dO8-Iv-pDk"/>
@@ -174,7 +174,7 @@
                                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="dropzone" id="sHO-XQ-hCU"/>
                                             </imageView>
                                             <button wantsLayer="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SWh-4E-Qtf">
-                                                <rect key="frame" x="89" y="-87" width="119" height="32"/>
+                                                <rect key="frame" x="89" y="-89" width="119" height="32"/>
                                                 <buttonCell key="cell" type="push" title="Open media..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="UUH-HF-Iqc">
                                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                     <font key="font" metaFont="system"/>
@@ -196,7 +196,7 @@
                                         </constraints>
                                     </customView>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="244-FS-P3T">
-                                        <rect key="frame" x="236" y="15" width="16" height="10"/>
+                                        <rect key="frame" x="236" y="14" width="16" height="10"/>
                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="line.horizontal.3.decrease" catalog="system" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="qDZ-84-3uy">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
@@ -383,8 +383,11 @@
                                                 </customSpacing>
                                             </stackView>
                                             <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zOB-QJ-TUy" customClass="VLCTimeField">
-                                                <rect key="frame" x="43" y="0.0" width="35" height="13"/>
-                                                <textFieldCell key="cell" lineBreakMode="clipping" title="00:00" id="q8L-S3-Ylc">
+                                                <rect key="frame" x="39" y="0.0" width="44" height="13"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="40" id="Rox-Cf-MSz"/>
+                                                </constraints>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="00:00" id="q8L-S3-Ylc">
                                                     <font key="font" metaFont="systemSemibold" size="10"/>
                                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -413,15 +416,18 @@
                                                 </constraints>
                                             </customView>
                                             <slider hidden="YES" horizontalHuggingPriority="200" verticalHuggingPriority="750" verticalCompressionResistancePriority="751" mirrorLayoutDirectionWhenInternationalizing="never" translatesAutoresizingMaskIntoConstraints="NO" id="9Hg-t2-K5z" customClass="VLCSlider">
-                                                <rect key="frame" x="78" y="-2" width="357" height="17"/>
+                                                <rect key="frame" x="83" y="-2" width="339" height="17"/>
                                                 <sliderCell key="cell" controlSize="mini" continuous="YES" state="on" alignment="left" maxValue="1" doubleValue="0.32600000000000001" tickMarkPosition="above" sliderType="linear" id="YMg-uo-8nX" customClass="VLCSliderCell"/>
                                                 <connections>
                                                     <action selector="timeSliderAction:" target="Uzf-Tf-H8x" id="eDh-39-Ej1"/>
                                                 </connections>
                                             </slider>
                                             <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oGd-mG-cFw" customClass="VLCTimeField">
-                                                <rect key="frame" x="435" y="0.0" width="39" height="13"/>
-                                                <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" state="on" alignment="center" title="00:00" id="adD-oG-KsD">
+                                                <rect key="frame" x="422" y="0.0" width="52" height="13"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="48" id="mAg-xF-yHo"/>
+                                                </constraints>
+                                                <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" alignment="left" title="-00:00" id="adD-oG-KsD">
                                                     <font key="font" metaFont="systemSemibold" size="10"/>
                                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -442,7 +448,7 @@
                                             <constraint firstItem="5o7-Z0-dqS" firstAttribute="leading" secondItem="Ktr-qT-1fr" secondAttribute="leading" id="Zqk-vQ-rnV"/>
                                             <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="jlv-jC-dQB" secondAttribute="trailing" constant="4" id="dE6-x3-y9L"/>
                                             <constraint firstItem="jlv-jC-dQB" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="zOB-QJ-TUy" secondAttribute="leading" id="nyg-q0-uLs"/>
-                                            <constraint firstItem="zOB-QJ-TUy" firstAttribute="leading" secondItem="5o7-Z0-dqS" secondAttribute="trailing" constant="8" id="ob8-aS-evc"/>
+                                            <constraint firstItem="zOB-QJ-TUy" firstAttribute="leading" secondItem="5o7-Z0-dqS" secondAttribute="trailing" constant="4" id="ob8-aS-evc"/>
                                             <constraint firstItem="jlv-jC-dQB" firstAttribute="centerX" secondItem="9Hg-t2-K5z" secondAttribute="centerX" id="spW-Wf-nKA"/>
                                             <constraint firstItem="9Hg-t2-K5z" firstAttribute="leading" secondItem="zOB-QJ-TUy" secondAttribute="trailing" constant="4" id="tjf-4h-ukW"/>
                                         </constraints>
@@ -794,6 +800,7 @@
                 <outlet property="songNameTextField" destination="d0e-29-yNq" id="JTI-XG-miC"/>
                 <outlet property="timeField" destination="zOB-QJ-TUy" id="mJL-1V-2lQ"/>
                 <outlet property="timeSlider" destination="9Hg-t2-K5z" id="sVe-s8-xW6"/>
+                <outlet property="trailingTimeField" destination="oGd-mG-cFw" id="geo-iq-0th"/>
                 <outlet property="volumeDownButton" destination="IAy-58-UPp" id="dDN-pE-Vmj"/>
                 <outlet property="volumeSlider" destination="noz-yJ-oH4" id="nbe-1c-lFH"/>
                 <outlet property="volumeUpButton" destination="75c-FF-mgb" id="xRz-F4-n0Z"/>


=====================================
modules/gui/macosx/views/VLCTimeField.h
=====================================
@@ -30,6 +30,7 @@
  * we need the implementation to catch our click-event in the controller window
  *****************************************************************************/
 
+extern NSString *VLCTimeFieldDisplayTimeAsElapsed;
 extern NSString *VLCTimeFieldDisplayTimeAsRemaining;
 
 @interface VLCTimeField : NSTextField


=====================================
modules/gui/macosx/views/VLCTimeField.m
=====================================
@@ -28,6 +28,7 @@
 #import "main/VLCMain.h"
 #import "menus/VLCMainMenu.h"
 
+NSString *VLCTimeFieldDisplayTimeAsElapsed = @"DisplayTimeAsTimeElapsed";
 NSString *VLCTimeFieldDisplayTimeAsRemaining = @"DisplayTimeAsTimeRemaining";
 
 @interface VLCTimeField ()
@@ -59,12 +60,10 @@ NSString *VLCTimeFieldDisplayTimeAsRemaining = @"DisplayTimeAsTimeRemaining";
 
 - (void)setIsTimeRemaining:(BOOL)isTimeRemaining
 {
+    _isTimeRemaining = isTimeRemaining;
+
     if (_identifier) {
-        _isTimeRemaining = [[NSUserDefaults standardUserDefaults] boolForKey:_identifier];
-        _isTimeRemaining = !_isTimeRemaining;
         [[NSUserDefaults standardUserDefaults] setObject:(_isTimeRemaining ? @"YES" : @"NO") forKey:_identifier];
-    } else {
-        _isTimeRemaining = !_isTimeRemaining;
     }
 
     [self updateTimeValue];


=====================================
modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h
=====================================
@@ -54,6 +54,7 @@
 @property (readwrite, strong) IBOutlet VLCWrappableTextField *songNameTextField;
 @property (readwrite, strong) IBOutlet VLCWrappableTextField *artistNameTextField;
 @property (readwrite, strong) IBOutlet VLCTimeField *timeField;
+ at property (readwrite, strong) IBOutlet VLCTimeField *trailingTimeField;
 
 @property (readwrite, strong) IBOutlet NSButton *fullscreenButton;
 @property (readwrite, strong) IBOutlet NSLayoutConstraint *fullscreenButtonWidthConstraint;


=====================================
modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m
=====================================
@@ -140,13 +140,24 @@
     [self updateTimeSlider:nil];
 
     NSColor *timeFieldTextColor = [NSColor controlTextColor];
+
     [self.timeField setTextColor: timeFieldTextColor];
     [self.timeField setFont:[NSFont titleBarFontOfSize:10.0]];
     [self.timeField setAlignment: NSCenterTextAlignment];
     [self.timeField setNeedsDisplay:YES];
-    [self.timeField setRemainingIdentifier:VLCTimeFieldDisplayTimeAsRemaining];
+    [self.timeField setRemainingIdentifier:VLCTimeFieldDisplayTimeAsElapsed];
+    self.trailingTimeField.isTimeRemaining = NO;
     self.timeField.accessibilityLabel = _NS("Playback time");
 
+    self.trailingTimeField.isTimeRemaining = !self.timeField.isTimeRemaining;
+    [self.trailingTimeField setTextColor: timeFieldTextColor];
+    [self.trailingTimeField setFont:[NSFont titleBarFontOfSize:10.0]];
+    [self.trailingTimeField setAlignment: NSCenterTextAlignment];
+    [self.trailingTimeField setNeedsDisplay:YES];
+    [self.trailingTimeField setRemainingIdentifier:VLCTimeFieldDisplayTimeAsRemaining];
+    self.trailingTimeField.isTimeRemaining = YES;
+    self.trailingTimeField.accessibilityLabel = _NS("Playback time");
+
     // remove fullscreen button for lion fullscreen
     if (_nativeFullscreenMode) {
         self.fullscreenButtonWidthConstraint.constant = 0;
@@ -387,6 +398,8 @@
                                                   negative:YES];
     [self.timeField setTime:timeString withRemainingTime:remainingTime];
     [self.timeField setNeedsDisplay:YES];
+    [self.trailingTimeField setTime:timeString withRemainingTime:remainingTime];
+    [self.trailingTimeField setNeedsDisplay:YES];
 }
 
 - (void)playerStateUpdated:(NSNotification *)aNotification



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d7a9bc23261abb69d80893abf57d58b035ccf654...01d73811d7560862efff4870c498cddf2ff3f511

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d7a9bc23261abb69d80893abf57d58b035ccf654...01d73811d7560862efff4870c498cddf2ff3f511
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list