[vlc-commits] [Git][videolan/vlc][master] 17 commits: macosx: Add a title view in information panel in XIB

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon May 29 13:56:50 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3c7e9850 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Add a title view in information panel in XIB

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

- - - - -
0a62ac94 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Improve appearance of main text field in VLCLibraryInformationPanel XIB

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

- - - - -
faecf8c3 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Set information panel title text field text

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

- - - - -
f08627bf by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Add NSWindow extension

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

- - - - -
8a47ac57 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Use full content view in VLCLibraryInformationPanel

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

- - - - -
093d68f4 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Add titlebarHeight property to NSWindow extension

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

- - - - -
76064623 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Make top padding of title text field in library information panel responsive to window titlebar height

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

- - - - -
b2cfa3df by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Use property in new nswindow extension in VLCMainVideoViewController

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

- - - - -
07ef0f79 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Adjust VLCLibraryInformationPanel scrollview insets depending on title view

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

- - - - -
b691f4e0 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Remove border from scrollview in VLCLibraryInformationPanel

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

- - - - -
ec495454 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Display window title for VLCLibraryInformationPanel

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

- - - - -
548a67fe by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Use attributed string for VLCLibraryInformationPanel string, bolden Title and Id

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

- - - - -
7a7eccc3 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Add convenience detailLineWithTitle method to VLCLibraryInformationPanel

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

- - - - -
6a3d06c2 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Employ new convenience method for attributed string lines in construction of detail string in VLCLibraryInformationPanel

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

- - - - -
49da02b1 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Use nicer attributed strings with bolding for media item detail string in VLCLibraryInformationPanel

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

- - - - -
01f5ab51 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Return bolded attributed detail string for tracks in VLCLibraryInformationPanel in detailsStringForTrack

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

- - - - -
1942acd9 by Claudio Cambra at 2023-05-29T13:40:09+00:00
macosx: Return nicelyattributed detail string for library items in VLCLibraryInformationPanel

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

- - - - -


8 changed files:

- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/UI/VLCLibraryInformationPanel.xib
- + modules/gui/macosx/extensions/NSWindow+VLCAdditions.h
- + modules/gui/macosx/extensions/NSWindow+VLCAdditions.m
- modules/gui/macosx/library/VLCLibraryInformationPanel.h
- modules/gui/macosx/library/VLCLibraryInformationPanel.m
- modules/gui/macosx/windows/video/VLCMainVideoViewController.m


Changes:

=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -97,6 +97,7 @@
 		536BFD1929B181E100BD0776 /* VLCMainVideoViewOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 536BFD1829B181E100BD0776 /* VLCMainVideoViewOverlayView.m */; };
 		536EFBF5295BCB8300F4CB13 /* VLCLibraryUIUnits.m in Sources */ = {isa = PBXBuildFile; fileRef = 536EFBF4295BCB8300F4CB13 /* VLCLibraryUIUnits.m */; };
 		536EFC39295E521600F4CB13 /* VLCLibraryVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */; };
+		5387FFF52A15127100A3A70A /* NSWindow+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5387FFF42A15127100A3A70A /* NSWindow+VLCAdditions.m */; };
 		538A7EDA29A63EE40068AD4F /* VLCFullVideoViewWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 538A7ED929A63EE40068AD4F /* VLCFullVideoViewWindow.m */; };
 		53903D3A29576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */; };
 		539BA79F298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 539BA79E298C726200918C36 /* VLCAspectRatioRetainingVideoWindow.m */; };
@@ -303,6 +304,8 @@
 		536EFC37295E521600F4CB13 /* VLCLibraryVideoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoViewController.h; sourceTree = "<group>"; };
 		536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoViewController.m; sourceTree = "<group>"; };
 		536EFC3A295F828000F4CB13 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+		5387FFF32A15127100A3A70A /* NSWindow+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSWindow+VLCAdditions.h"; sourceTree = "<group>"; };
+		5387FFF42A15127100A3A70A /* NSWindow+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSWindow+VLCAdditions.m"; sourceTree = "<group>"; };
 		538A7ED829A63EE40068AD4F /* VLCFullVideoViewWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCFullVideoViewWindow.h; sourceTree = "<group>"; };
 		538A7ED929A63EE40068AD4F /* VLCFullVideoViewWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCFullVideoViewWindow.m; sourceTree = "<group>"; };
 		53903D3829576ED500D0B308 /* VLCLibraryAudioGroupDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioGroupDataSource.h; sourceTree = "<group>"; };
@@ -1157,6 +1160,8 @@
 				5307A6F42967859F001E0C6A /* NSImage+VLCAdditions.m */,
 				53ED473A29CBC64200795DB1 /* NSPasteboardItem+VLCAdditions.h */,
 				53ED473B29CBC64200795DB1 /* NSPasteboardItem+VLCAdditions.m */,
+				5387FFF32A15127100A3A70A /* NSWindow+VLCAdditions.h */,
+				5387FFF42A15127100A3A70A /* NSWindow+VLCAdditions.m */,
 			);
 			path = extensions;
 			sourceTree = "<group>";
@@ -2010,6 +2015,7 @@
 				7DBB7639227F3FBC002649E1 /* VLCLibraryCollectionViewSupplementaryElementView.m in Sources */,
 				1C3113A31E508C6900D4DD76 /* VLCCoreDialogProvider.m in Sources */,
 				6B2EFC631F281A0900F3C0EA /* VLCVolumeSliderCell.m in Sources */,
+				5387FFF52A15127100A3A70A /* NSWindow+VLCAdditions.m in Sources */,
 				1C3113A71E508C6900D4DD76 /* VLCLogWindowController.m in Sources */,
 				53F0E930299B17DF00491D49 /* VLCInputNodePathControl.m in Sources */,
 				1C3113A91E508C6900D4DD76 /* VLCDocumentController.m in Sources */,


=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -75,6 +75,8 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/extensions/NSString+Helpers.m \
 	gui/macosx/extensions/NSView+VLCAdditions.h \
 	gui/macosx/extensions/NSView+VLCAdditions.m \
+	gui/macosx/extensions/NSWindow+VLCAdditions.h \
+	gui/macosx/extensions/NSWindow+VLCAdditions.m \
 	gui/macosx/extensions/NSPasteboardItem+VLCAdditions.h \
 	gui/macosx/extensions/NSPasteboardItem+VLCAdditions.m \
 	gui/macosx/extensions/VLCHexNumberFormatter.h \


=====================================
modules/gui/macosx/UI/VLCLibraryInformationPanel.xib
=====================================
@@ -8,44 +8,48 @@
         <customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryInformationPanel">
             <connections>
                 <outlet property="imageView" destination="N4h-LP-IRY" id="Ned-Ju-hyu"/>
+                <outlet property="scrollView" destination="JzV-HY-whQ" id="19b-bb-AK0"/>
                 <outlet property="textField" destination="eeq-7b-IbI" id="tex-TF-135"/>
+                <outlet property="titleTextField" destination="Ode-s8-X3t" id="Ahy-Gv-rPN"/>
+                <outlet property="titleTextFieldTopConstraint" destination="uPW-bq-Yz8" id="J75-Rk-mlI"/>
+                <outlet property="topBarView" destination="g0J-FC-bJg" id="Bkb-Cr-226"/>
                 <outlet property="window" destination="oPi-wT-0nK" id="ODs-Hv-85I"/>
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" frameAutosaveName="" animationBehavior="default" id="oPi-wT-0nK" customClass="NSPanel">
-            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES" HUD="YES"/>
+        <window title="Media information" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" frameAutosaveName="" animationBehavior="default" titlebarAppearsTransparent="YES" id="oPi-wT-0nK" customClass="NSPanel">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES" HUD="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="136" y="189" width="512" height="640"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
             <value key="minSize" type="size" width="386" height="227"/>
             <view key="contentView" id="Nfs-rF-cUN">
-                <rect key="frame" x="0.0" y="0.0" width="544" height="640"/>
+                <rect key="frame" x="0.0" y="0.0" width="512" height="640"/>
                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
-                    <scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JzV-HY-whQ">
+                    <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JzV-HY-whQ">
                         <rect key="frame" x="0.0" y="0.0" width="512" height="640"/>
                         <clipView key="contentView" id="Bl4-q7-swx">
-                            <rect key="frame" x="1" y="1" width="495" height="623"/>
+                            <rect key="frame" x="0.0" y="0.0" width="512" height="640"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <view translatesAutoresizingMaskIntoConstraints="NO" id="bU3-vL-IQb">
-                                    <rect key="frame" x="15" y="194" width="480" height="429"/>
+                                    <rect key="frame" x="0.0" y="216" width="512" height="424"/>
                                     <subviews>
                                         <stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Wv4-dn-5EA">
-                                            <rect key="frame" x="0.0" y="0.0" width="480" height="429"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="512" height="424"/>
                                             <subviews>
                                                 <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="eeq-7b-IbI">
-                                                    <rect key="frame" x="0.0" y="408" width="495" height="21"/>
-                                                    <textFieldCell key="cell" selectable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" id="Jc0-rT-PNg">
+                                                    <rect key="frame" x="8" y="408" width="496" height="16"/>
+                                                    <textFieldCell key="cell" selectable="YES" sendsActionOnEndEditing="YES" state="on" title="Media data" id="Jc0-rT-PNg">
                                                         <font key="font" metaFont="system"/>
                                                         <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                     </textFieldCell>
                                                 </textField>
                                                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="N4h-LP-IRY">
-                                                    <rect key="frame" x="0.0" y="0.0" width="400" height="400"/>
+                                                    <rect key="frame" x="55" y="0.0" width="400" height="400"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" secondItem="N4h-LP-IRY" secondAttribute="height" multiplier="1:1" id="0Uq-LT-xPG"/>
                                                         <constraint firstAttribute="height" constant="400" id="wfM-2D-T6r"/>
@@ -54,9 +58,9 @@
                                                 </imageView>
                                             </subviews>
                                             <constraints>
-                                                <constraint firstAttribute="trailing" secondItem="eeq-7b-IbI" secondAttribute="trailing" id="hIV-HK-m3A"/>
+                                                <constraint firstAttribute="trailing" secondItem="eeq-7b-IbI" secondAttribute="trailing" constant="10" id="hIV-HK-m3A"/>
                                                 <constraint firstItem="N4h-LP-IRY" firstAttribute="centerX" secondItem="Wv4-dn-5EA" secondAttribute="centerX" id="iwt-XU-iJg"/>
-                                                <constraint firstItem="eeq-7b-IbI" firstAttribute="leading" secondItem="Wv4-dn-5EA" secondAttribute="leading" id="k7h-rh-AJ1"/>
+                                                <constraint firstItem="eeq-7b-IbI" firstAttribute="leading" secondItem="Wv4-dn-5EA" secondAttribute="leading" constant="10" id="k7h-rh-AJ1"/>
                                             </constraints>
                                             <visibilityPriorities>
                                                 <integer value="1000"/>
@@ -82,21 +86,44 @@
                                 <constraint firstItem="bU3-vL-IQb" firstAttribute="leading" secondItem="Bl4-q7-swx" secondAttribute="leading" id="oko-yV-hzs"/>
                             </constraints>
                         </clipView>
+                        <edgeInsets key="contentInsets" left="0.0" right="0.0" top="58" bottom="0.0"/>
                         <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="ePK-Cw-UmB">
-                            <rect key="frame" x="1" y="624" width="495" height="15"/>
+                            <rect key="frame" x="1" y="623" width="510" height="16"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
                         <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="SJs-Xf-ZA5">
-                            <rect key="frame" x="496" y="1" width="15" height="623"/>
+                            <rect key="frame" x="495" y="58" width="16" height="581"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
                     </scrollView>
+                    <visualEffectView blendingMode="withinWindow" material="titlebar" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="g0J-FC-bJg">
+                        <rect key="frame" x="0.0" y="582" width="512" height="58"/>
+                        <subviews>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ode-s8-X3t">
+                                <rect key="frame" x="8" y="10" width="496" height="28"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Media title" id="zdh-w0-JZI">
+                                    <font key="font" metaFont="systemBold" size="24"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="bottom" secondItem="Ode-s8-X3t" secondAttribute="bottom" constant="10" id="oE4-HB-V0G"/>
+                            <constraint firstItem="Ode-s8-X3t" firstAttribute="top" secondItem="g0J-FC-bJg" secondAttribute="top" constant="20" id="uPW-bq-Yz8"/>
+                            <constraint firstAttribute="trailing" secondItem="Ode-s8-X3t" secondAttribute="trailing" constant="10" id="vQs-z2-uLJ"/>
+                            <constraint firstItem="Ode-s8-X3t" firstAttribute="leading" secondItem="g0J-FC-bJg" secondAttribute="leading" constant="10" id="z5w-VS-BIE"/>
+                        </constraints>
+                    </visualEffectView>
                 </subviews>
                 <constraints>
+                    <constraint firstAttribute="trailing" secondItem="g0J-FC-bJg" secondAttribute="trailing" id="7ae-5U-Vrw"/>
                     <constraint firstAttribute="bottom" secondItem="JzV-HY-whQ" secondAttribute="bottom" id="BzO-t8-fnM"/>
+                    <constraint firstItem="g0J-FC-bJg" firstAttribute="top" secondItem="Nfs-rF-cUN" secondAttribute="top" id="IcV-al-V2S"/>
                     <constraint firstItem="JzV-HY-whQ" firstAttribute="top" secondItem="Nfs-rF-cUN" secondAttribute="top" id="Rs3-rb-V0C"/>
                     <constraint firstAttribute="trailing" secondItem="JzV-HY-whQ" secondAttribute="trailing" id="cpi-7A-Gzv"/>
                     <constraint firstItem="JzV-HY-whQ" firstAttribute="leading" secondItem="Nfs-rF-cUN" secondAttribute="leading" id="eFQ-HA-0eR"/>
+                    <constraint firstItem="g0J-FC-bJg" firstAttribute="leading" secondItem="Nfs-rF-cUN" secondAttribute="leading" id="lXa-Mv-lIm"/>
                 </constraints>
             </view>
             <point key="canvasLocation" x="209.5" y="121"/>


=====================================
modules/gui/macosx/extensions/NSWindow+VLCAdditions.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * NSWindow+VLCAdditions.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.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 2 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.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface NSWindow (VLCAdditions)
+
+ at property (readonly) CGFloat titlebarHeight;
+
+ at end
+
+NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/extensions/NSWindow+VLCAdditions.m
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * NSWindow+VLCAdditions.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.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 2 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.
+ *****************************************************************************/
+
+#import "NSWindow+VLCAdditions.h"
+
+ at implementation NSWindow (Helpers)
+
+- (CGFloat)titlebarHeight
+{
+    const NSView * const titlebarView = [self standardWindowButton:NSWindowCloseButton].superview;
+    return titlebarView.frame.size.height;
+}
+
+ at end


=====================================
modules/gui/macosx/library/VLCLibraryInformationPanel.h
=====================================
@@ -28,8 +28,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface VLCLibraryInformationPanel : NSWindowController
 
+ at property (readwrite, weak) IBOutlet NSTextField *titleTextField;
 @property (readwrite, weak) IBOutlet NSTextField *textField;
 @property (readwrite, weak) IBOutlet NSImageView *imageView;
+ at property (readwrite, weak) IBOutlet NSVisualEffectView *topBarView;
+ at property (readwrite, weak) IBOutlet NSScrollView *scrollView;
+
+ at property (readwrite, weak) IBOutlet NSLayoutConstraint *titleTextFieldTopConstraint;
 
 - (void)setRepresentedItem:(id<VLCMediaLibraryItemProtocol>)representedItem;
 


=====================================
modules/gui/macosx/library/VLCLibraryInformationPanel.m
=====================================
@@ -23,22 +23,37 @@
 #import "VLCLibraryInformationPanel.h"
 
 #import "extensions/NSString+Helpers.h"
+#import "extensions/NSWindow+VLCAdditions.h"
 
 #import "library/VLCLibraryDataTypes.h"
 #import "library/VLCLibraryImageCache.h"
+#import "library/VLCLibraryUIUnits.h"
 #import "library/VLCInputItem.h"
 
 @interface VLCLibraryInformationPanel ()
 {
     id<VLCMediaLibraryItemProtocol> _representedItem;
+    NSFont *_boldSystemFont;
+    NSDictionary<NSAttributedStringKey, id> *_boldStringAttribute;
 }
 
 @end
 
 @implementation VLCLibraryInformationPanel
 
-- (void)windowDidLoad {
+- (void)windowDidLoad
+{
     [super windowDidLoad];
+
+    _titleTextFieldTopConstraint.constant = self.window.titlebarHeight + [VLCLibraryUIUnits smallSpacing];
+
+    NSEdgeInsets scrollViewInsets = _scrollView.contentInsets;
+    scrollViewInsets.top = _topBarView.frame.size.height + [VLCLibraryUIUnits mediumSpacing];
+    _scrollView.contentInsets = scrollViewInsets;
+
+    _boldSystemFont = [NSFont boldSystemFontOfSize:NSFont.systemFontSize];
+    _boldStringAttribute = @{NSFontAttributeName: _boldSystemFont};
+
     [self updateRepresentation];
 }
 
@@ -48,93 +63,133 @@
     [self updateRepresentation];
 }
 
+- (NSAttributedString *)detailLineWithTitle:(NSString *)title detailText:(NSString *)detailText
+{
+    NSString * const detailStringStart = [NSString stringWithFormat:@"%@:", title];
+    NSMutableAttributedString * const detailLine = [[NSMutableAttributedString alloc] initWithString:detailStringStart attributes:_boldStringAttribute];
+    NSString * const detailStringEnd = [NSString stringWithFormat:@" %@\n", detailText];
+    [detailLine appendAttributedString:[[NSAttributedString alloc] initWithString:detailStringEnd]];
+
+    return [detailLine copy];
+}
+
 - (void)updateRepresentation
 {
-    NSMutableString * const textContent = [[NSMutableString alloc] initWithFormat:@"Title: '%@', ID: %lli\n", _representedItem.displayString, _representedItem.libraryID];
+    _titleTextField.stringValue = _representedItem.displayString;
+
+    NSMutableAttributedString * const textContent = [[NSMutableAttributedString alloc] init];
+    [textContent appendAttributedString:[self detailLineWithTitle:@"Title" detailText:_representedItem.displayString]];
+    [textContent appendAttributedString:[self detailLineWithTitle:@"ID" detailText:[NSString stringWithFormat:@"%lli", _representedItem.libraryID]]];
 
-    NSString * itemDetailsString;
     if([_representedItem isKindOfClass:[VLCMediaLibraryMediaItem class]]) {
-        itemDetailsString = [self detailsStringForMediaItem:(VLCMediaLibraryMediaItem *)_representedItem];
+        [textContent appendAttributedString:[self detailsStringForMediaItem:(VLCMediaLibraryMediaItem *)_representedItem]];
     } else {
-        itemDetailsString = [self detailsStringForLibraryItem:_representedItem];
+        [textContent appendAttributedString:[self detailsStringForLibraryItem:_representedItem]];
     }
-    [textContent appendString:itemDetailsString];
-    
+
     NSString * const fileDetailsString = [self fileDetailsStringForLibraryItem:_representedItem];
-    [textContent appendString:fileDetailsString];
+    [textContent appendAttributedString:[[NSAttributedString alloc] initWithString:fileDetailsString]];
     
-    _textField.attributedStringValue = [[NSAttributedString alloc] initWithString:textContent];
+    _textField.attributedStringValue = textContent;
     _textField.font = [NSFont systemFontOfSize:13.];
     _textField.textColor = [NSColor whiteColor];
 
     [VLCLibraryImageCache thumbnailForLibraryItem:_representedItem withCompletion:^(NSImage * const thumbnail) {
         self->_imageView.image = thumbnail;
     }];
-    self.window.title = _representedItem.displayString;
 }
 
-- (NSString *)detailsStringForMediaItem:(VLCMediaLibraryMediaItem *)mediaItem
+- (NSAttributedString *)detailsStringForMediaItem:(VLCMediaLibraryMediaItem *)mediaItem
 {
-    NSMutableString *detailsString = [[NSMutableString alloc] init];
+    NSMutableAttributedString * const detailsString = [[NSMutableAttributedString alloc] init];
 
+    NSMutableString * const mediaTypeString = [[NSMutableString alloc] initWithFormat:@" %@", mediaItem.readableMediaType];
     if (mediaItem.mediaSubType != VLC_ML_MEDIA_SUBTYPE_UNKNOWN) {
-        [detailsString appendFormat:@"Type: %@ — %@\n", mediaItem.readableMediaType, mediaItem.readableMediaSubType];
-    } else {
-        [detailsString appendFormat:@"Type: %@\n", mediaItem.readableMediaType];
+        [mediaTypeString appendFormat:@" — %@", mediaItem.readableMediaSubType];
     }
+    [mediaTypeString appendString:@"\n"];
+
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Type" detailText:mediaTypeString]];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Duration" detailText:_representedItem.durationString]];
 
-    [detailsString appendFormat:@"Duration: %@\n", _representedItem.durationString];
+    NSString * const playCountString = [NSString stringWithFormat:@"%u", mediaItem.playCount];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Play count" detailText:playCountString]];
 
-    [detailsString appendFormat:@"Play count: %u, last played: %@\n", mediaItem.playCount, [NSDateFormatter localizedStringFromDate:[NSDate dateWithTimeIntervalSince1970:mediaItem.lastPlayedDate] dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle]];
+    NSDate * const lastPlayedDate = [NSDate dateWithTimeIntervalSince1970:mediaItem.lastPlayedDate];
+    NSString * const lastPlayedString = [NSDateFormatter localizedStringFromDate:lastPlayedDate
+                                                                       dateStyle:NSDateFormatterShortStyle
+                                                                       timeStyle:NSDateFormatterShortStyle];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Last played" detailText:lastPlayedString]];
 
-    [detailsString appendFormat:@"Small artwork generated? %@\n", _representedItem.smallArtworkGenerated ? _NS("Yes") : _NS("No")];
+    NSString * const smallArtworkGeneratedString = _representedItem.smallArtworkGenerated ? _NS("Yes") : _NS("No");
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Small artwork generated" detailText:smallArtworkGeneratedString]];
 
-    [detailsString appendFormat:@"Favorited? %@\n", mediaItem.favorited ? _NS("Yes") : _NS("No")];
+    NSString * const favouritedString = mediaItem.favorited ? _NS("Yes") : _NS("No");
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Favourited" detailText:favouritedString]];
 
-    [detailsString appendFormat:@"Playback progress: %2.f%%\n", mediaItem.progress * 100.]; // TODO: Calculate progress for other library item types
+    NSString * const playbackProgressString = [NSString stringWithFormat:@"%2.f%%", mediaItem.progress * 100.];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Playback progress" detailText:playbackProgressString]];
+    // TODO: Calculate progress for other library item types
 
-    [detailsString appendFormat:@"\nNumber of tracks: %lu\n", mediaItem.tracks.count];
+    NSString * const trackCountString = [NSString stringWithFormat:@"%lu", mediaItem.tracks.count];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Number of tracks" detailText:trackCountString]];
 
     for (VLCMediaLibraryTrack *track in mediaItem.tracks) {
-        NSString *trackDetailsString = [self detailsStringForTrack:track];
-        [detailsString appendString:trackDetailsString];
+        [detailsString appendAttributedString:[self detailsStringForTrack:track]];
     }
 
     return detailsString;
 }
 
-- (NSString *)detailsStringForTrack:(VLCMediaLibraryTrack *)track
+- (NSAttributedString *)detailsStringForTrack:(VLCMediaLibraryTrack *)track
 {
-    NSMutableString *detailsString = [[NSMutableString alloc] init];
+    NSMutableAttributedString * const detailsString = [[NSMutableAttributedString alloc] init];
+
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Type" detailText:track.readableTrackType]];
+
+    NSString * const codecString = [NSString stringWithFormat:@"%@ (%@) @ %u kB/s\n",
+                                    track.readableCodecName,
+                                    track.codec,
+                                    track.bitrate / 1024 / 8];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Codec" detailText:codecString]];
 
-    [detailsString appendFormat:@"Type: %@\n", track.readableTrackType];
-    [detailsString appendFormat:@"Codec: %@ (%@) @ %u kB/s\n", track.readableCodecName, track.codec, track.bitrate / 1024 / 8];
     if (track.language.length > 0) {
-        [detailsString appendFormat:@"Language: %@\n", track.language];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Language" detailText:track.language]];
     }
+
     if (track.trackDescription.length > 0) {
-        [detailsString appendFormat:@"Description: %@\n", track.trackDescription];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Description" detailText:track.trackDescription]];
     }
 
     if (track.trackType == VLC_ML_TRACK_TYPE_AUDIO) {
-        [detailsString appendFormat:@"Number of Channels: %u, Sample rate: %u\n", track.numberOfAudioChannels, track.audioSampleRate];
+        NSString * const numChannelsString = [NSString stringWithFormat:@"%u", track.numberOfAudioChannels];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Number of channels" detailText:numChannelsString]];
+
+        NSString * const sampleRateString = [NSString stringWithFormat:@"%u", track.audioSampleRate];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Sample rate" detailText:sampleRateString]];
     } else if (track.trackType == VLC_ML_TRACK_TYPE_VIDEO) {
-        [detailsString appendFormat:@"Dimensions: %ux%u px, Aspect-Ratio: %2.f\n", track.videoWidth, track.videoHeight, (float)track.sourceAspectRatio / track.sourceAspectRatioDenominator];
-        [detailsString appendFormat:@"Framerate: %2.f\n", (float)track.frameRate / track.frameRateDenominator];
+        NSString * const dimensionsString = [NSString stringWithFormat:@"%ux%u px", track.videoWidth, track.videoHeight];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Dimensions" detailText:dimensionsString]];
+
+        NSString * const aspectRatioString = [NSString stringWithFormat:@"%2.f", (float)track.sourceAspectRatio / track.sourceAspectRatioDenominator];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Aspect ratio" detailText:aspectRatioString]];
+
+        NSString * const frameRateString = [NSString stringWithFormat:@"%2.f", (float)track.frameRate / track.frameRateDenominator];
+        [detailsString appendAttributedString:[self detailLineWithTitle:@"Framerate" detailText:frameRateString]];
     }
-    [detailsString appendString:@"\n"];
 
-    return detailsString;
+    return [detailsString copy];
 }
 
-- (NSString *)detailsStringForLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem
+- (NSAttributedString *)detailsStringForLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem
 {
-    NSMutableString *detailsString = [[NSMutableString alloc] init];
+    NSMutableAttributedString * const detailsString = [[NSMutableAttributedString alloc] init];
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Duration" detailText:libraryItem.durationString]];
 
-    [detailsString appendFormat:@"Duration: %@\n", libraryItem.durationString];
-    [detailsString appendFormat:@"Small artwork generated? %@\n", libraryItem.smallArtworkGenerated ? _NS("Yes") : _NS("No")];
+    NSString * const smallArtworkGeneratedString = libraryItem.smallArtworkGenerated ? _NS("Yes") : _NS("No");
+    [detailsString appendAttributedString:[self detailLineWithTitle:@"Small artwork generated" detailText:smallArtworkGeneratedString]];
 
-    return detailsString;
+    return [detailsString copy];
 }
 
 - (NSString *)fileDetailsStringForLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem


=====================================
modules/gui/macosx/windows/video/VLCMainVideoViewController.m
=====================================
@@ -22,6 +22,8 @@
 
 #import "VLCMainVideoViewController.h"
 
+#import "extensions/NSWindow+VLCAdditions.h"
+
 #import "library/VLCLibraryDataTypes.h"
 #import "library/VLCLibraryWindow.h"
 #import "library/VLCLibraryUIUnits.h"
@@ -305,8 +307,7 @@
     }
 
     const NSWindow * const viewWindow = self.view.window;
-    const NSView * const titlebarView = [viewWindow standardWindowButton:NSWindowCloseButton].superview;
-    const CGFloat windowTitlebarHeight = titlebarView.frame.size.height;
+    const CGFloat windowTitlebarHeight = viewWindow.titlebarHeight;
 
     const BOOL windowFullscreen = [(VLCWindow*)viewWindow isInNativeFullscreen] ||
                                   [(VLCWindow*)viewWindow fullscreen];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/43242656f96fc09099ca8e05b78a4868787e60bd...1942acd96d65c8ab30a342246422f8a381d7dbfe

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/43242656f96fc09099ca8e05b78a4868787e60bd...1942acd96d65c8ab30a342246422f8a381d7dbfe
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