[vlc-commits] [Git][videolan/vlc][master] 22 commits: macosx: Replace VLCTableCellView with columns instead in table view for media source view
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Mon Apr 21 10:55:06 UTC 2025
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
a4e3028e by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Replace VLCTableCellView with columns instead in table view for media source view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2761f979 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Parse child directories too in media source data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
58f13088 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Only perform local directory handling procedures when in LAN media source mode
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
fcba86da by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Correctly initialise media source base data source variables
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
76a1155a by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Add convenience viewMode property to base media source data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
db37f4e8 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Fix broken use of unset _gridViewMode within base data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2d373328 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Add child item count column to media source table view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e8c5338d by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Add NSTextField extension with convenience class method
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
d79c5a92 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Use NSTextField extension for view construction in media source data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
0eb28d03 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Generate directory child nodes on demand, asynchronously, if required by table list view cells
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
d7b80b32 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Enable headers for table view in media source view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
c538bb02 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Fix scroll view insets for media source table view within base data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
85b7f867 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Create image views and text fields for table view properly in base media source data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
20bcc0b2 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Add kind column to media source table view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
4ffeda2d by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Provide kind string based on underlying input item type
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
86212720 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Provide more descriptive strings for file kind
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f378f684 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Provide kind string in base media source data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
791e284f by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Improve sizing of browse table view columns
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
16e82ebd by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Remove icon column from media source table view, rely on first table column based sizing
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
eeb9f21f by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Rely on table view types for views in media source data source for table view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ab44e7a7 by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Add extension method to NSTableCellView to conveniently create a text cell view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7e0c08ff by Claudio Cambra at 2025-04-21T10:27:18+00:00
macosx: Rely on table view types in base data source for table view media source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
11 changed files:
- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/UI/VLCLibraryWindow.xib
- + modules/gui/macosx/extensions/NSTableCellView+VLCAdditions.h
- + modules/gui/macosx/extensions/NSTableCellView+VLCAdditions.m
- + modules/gui/macosx/extensions/NSTextField+VLCAdditions.h
- + modules/gui/macosx/extensions/NSTextField+VLCAdditions.m
- modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m
- modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
- modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
- modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
Changes:
=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -95,6 +95,7 @@
5341F14D2C981B7C003BDF0A /* VLCLibraryWindowAbstractSidebarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5341F14C2C981B7C003BDF0A /* VLCLibraryWindowAbstractSidebarViewController.m */; };
5341F1502C983AF1003BDF0A /* VLCPlayerChapter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5341F14F2C983AF1003BDF0A /* VLCPlayerChapter.m */; };
5341F1542C9865F8003BDF0A /* VLCLibraryWindowSidebarRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5341F1522C9865DD003BDF0A /* VLCLibraryWindowSidebarRootViewController.m */; };
+ 534D28B42DB2B3C0006869CD /* NSTableCellView+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 534D28B32DB2B3C0006869CD /* NSTableCellView+VLCAdditions.m */; };
534E73E229D2EDB1009982DE /* VLCBookmarksTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 534E73E129D2EDB1009982DE /* VLCBookmarksTableViewDelegate.m */; };
534E73E529D2FF07009982DE /* VLCBookmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 534E73E429D2FF07009982DE /* VLCBookmark.m */; };
534E8E3A29A06325009503F8 /* VLCMainVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 534E8E3929A06325009503F8 /* VLCMainVideoViewController.m */; };
@@ -117,6 +118,7 @@
536283F9291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 536283EE291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.m */; };
53628402291147C500640C15 /* VLCBasicView.m in Sources */ = {isa = PBXBuildFile; fileRef = 536283FF291147C500640C15 /* VLCBasicView.m */; };
53628403291147C500640C15 /* VLCSubScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53628400291147C500640C15 /* VLCSubScrollView.m */; };
+ 5363A1FA2DAAD23400C65F0D /* NSTextField+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5363A1F92DAAD23400C65F0D /* NSTextField+VLCAdditions.m */; };
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 */; };
@@ -342,6 +344,8 @@
5341F14F2C983AF1003BDF0A /* VLCPlayerChapter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlayerChapter.m; sourceTree = "<group>"; };
5341F1512C9865DD003BDF0A /* VLCLibraryWindowSidebarRootViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryWindowSidebarRootViewController.h; sourceTree = "<group>"; };
5341F1522C9865DD003BDF0A /* VLCLibraryWindowSidebarRootViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryWindowSidebarRootViewController.m; sourceTree = "<group>"; };
+ 534D28B22DB2B3C0006869CD /* NSTableCellView+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSTableCellView+VLCAdditions.h"; sourceTree = "<group>"; };
+ 534D28B32DB2B3C0006869CD /* NSTableCellView+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSTableCellView+VLCAdditions.m"; sourceTree = "<group>"; };
534E73E029D2EDB1009982DE /* VLCBookmarksTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCBookmarksTableViewDelegate.h; sourceTree = "<group>"; };
534E73E129D2EDB1009982DE /* VLCBookmarksTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCBookmarksTableViewDelegate.m; sourceTree = "<group>"; };
534E73E329D2FF07009982DE /* VLCBookmark.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCBookmark.h; sourceTree = "<group>"; };
@@ -391,6 +395,8 @@
536283FF291147C500640C15 /* VLCBasicView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCBasicView.m; sourceTree = "<group>"; };
53628400291147C500640C15 /* VLCSubScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCSubScrollView.m; sourceTree = "<group>"; };
53628401291147C500640C15 /* VLCSubScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCSubScrollView.h; sourceTree = "<group>"; };
+ 5363A1F82DAAD23400C65F0D /* NSTextField+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSTextField+VLCAdditions.h"; sourceTree = "<group>"; };
+ 5363A1F92DAAD23400C65F0D /* NSTextField+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSTextField+VLCAdditions.m"; sourceTree = "<group>"; };
536BFD1729B181E100BD0776 /* VLCMainVideoViewOverlayView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMainVideoViewOverlayView.h; sourceTree = "<group>"; };
536BFD1829B181E100BD0776 /* VLCMainVideoViewOverlayView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMainVideoViewOverlayView.m; sourceTree = "<group>"; };
536EFBF3295BCB8300F4CB13 /* VLCLibraryUIUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryUIUnits.h; sourceTree = "<group>"; };
@@ -1307,6 +1313,10 @@
6B4D50A61E7AB52C004479B5 /* NSScreen+VLCAdditions.m */,
6B397C4D216C8EB200403ED0 /* NSString+Helpers.h */,
6B397C4E216C8EB200403ED0 /* NSString+Helpers.m */,
+ 534D28B22DB2B3C0006869CD /* NSTableCellView+VLCAdditions.h */,
+ 534D28B32DB2B3C0006869CD /* NSTableCellView+VLCAdditions.m */,
+ 5363A1F82DAAD23400C65F0D /* NSTextField+VLCAdditions.h */,
+ 5363A1F92DAAD23400C65F0D /* NSTextField+VLCAdditions.m */,
7D404ABD2281892C00B28EF4 /* NSView+VLCAdditions.h */,
7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */,
5387FFF32A15127100A3A70A /* NSWindow+VLCAdditions.h */,
@@ -2316,6 +2326,7 @@
1C31139A1E508C6900D4DD76 /* VLCBookmarksWindowController.m in Sources */,
6B0AB0F01F1AC8B3003A1B4E /* VLCPlaybackProgressSlider.m in Sources */,
7D28E6362275B4820098D30E /* NSColor+VLCAdditions.m in Sources */,
+ 534D28B42DB2B3C0006869CD /* NSTableCellView+VLCAdditions.m in Sources */,
535F1BBA2B47ACCE00C78D98 /* VLCLibraryHomeViewVideoContainerViewDataSource.m in Sources */,
53D8ED9A2B583AAF00142EAD /* VLCLibraryModelChangeDelegate.m in Sources */,
53B447FA293BB47B00857588 /* VLCLibraryVideoGroupDescriptor.m in Sources */,
@@ -2355,6 +2366,7 @@
1C3113B61E508C6900D4DD76 /* VLCMain+OldPrefs.m in Sources */,
1C3113B81E508C6900D4DD76 /* VLCMain.m in Sources */,
7D20081A2289835C002679DF /* VLCTrackingView.m in Sources */,
+ 5363A1FA2DAAD23400C65F0D /* NSTextField+VLCAdditions.m in Sources */,
1CAC3EE820CD1B3B00613DB2 /* VLCVideoOutputProvider.m in Sources */,
1C3113BA1E508C6900D4DD76 /* VLCApplication.m in Sources */,
530771F42AEBBD5B00656D3D /* VLCLibraryRepresentedItem.m in Sources */,
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -85,6 +85,10 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/extensions/NSWindow+VLCAdditions.m \
gui/macosx/extensions/NSPasteboardItem+VLCAdditions.h \
gui/macosx/extensions/NSPasteboardItem+VLCAdditions.m \
+ gui/macosx/extensions/NSTableCellView+VLCAdditions.h \
+ gui/macosx/extensions/NSTableCellView+VLCAdditions.m \
+ gui/macosx/extensions/NSTextField+VLCAdditions.h \
+ gui/macosx/extensions/NSTextField+VLCAdditions.m \
gui/macosx/extensions/VLCHexNumberFormatter.h \
gui/macosx/extensions/VLCHexNumberFormatter.m \
gui/macosx/extensions/VLCPositionFormatter.h \
=====================================
modules/gui/macosx/UI/VLCLibraryWindow.xib
=====================================
@@ -837,41 +837,105 @@
<rect key="frame" x="0.0" y="0.0" width="528" height="411"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" viewBased="YES" id="vpJ-Oz-Ebz" customClass="VLCLibraryTableView">
- <rect key="frame" x="0.0" y="0.0" width="528" height="411"/>
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="4cS-pi-5KZ" viewBased="YES" id="vpJ-Oz-Ebz" customClass="VLCLibraryTableView">
+ <rect key="frame" x="0.0" y="0.0" width="718" height="383"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn width="496" minWidth="40" maxWidth="1000" id="89Q-Wg-BdA">
- <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+ <tableColumn identifier="VLCMediaSourceTableNameColumn" width="400" minWidth="100" maxWidth="3.4028234663852886e+38" id="EcE-eg-xPv">
+ <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Name">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
- <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="v9H-KJ-Zhv">
- <font key="font" metaFont="message"/>
+ <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="GBw-7H-zdL">
+ <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
- <tableCellView id="prL-6m-HxA">
- <rect key="frame" x="11" y="1" width="505" height="0.0"/>
+ <tableCellView id="jZm-vo-Rg6">
+ <rect key="frame" x="11" y="1" width="405" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TVO-GX-uf2">
- <rect key="frame" x="0.0" y="-17" width="505" height="17"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
- <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="LYl-7r-eAr">
- <font key="font" metaFont="message"/>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XpY-BL-Ovl">
+ <rect key="frame" x="0.0" y="0.0" width="405" height="16"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="ZeB-Ae-Vhd">
+ <font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
- <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
- <outlet property="textField" destination="TVO-GX-uf2" id="2t6-OK-CMa"/>
+ <outlet property="textField" destination="XpY-BL-Ovl" id="0oE-8s-zWG"/>
+ </connections>
+ </tableCellView>
+ </prototypeCellViews>
+ </tableColumn>
+ <tableColumn identifier="VLCMediaSourceTableCountColumn" width="80" minWidth="32" maxWidth="3.4028234663852886e+38" id="edO-i5-VZb">
+ <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Count">
+ <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ </tableHeaderCell>
+ <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="Nfm-Ca-Ozh">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="dHj-we-t4i">
+ <rect key="frame" x="419" y="1" width="80" height="17"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QMo-CO-uFe">
+ <rect key="frame" x="0.0" y="0.0" width="80" height="16"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="QqW-Vu-2fV">
+ <font key="font" usesAppearanceFont="YES"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <connections>
+ <outlet property="textField" destination="QMo-CO-uFe" id="g69-Si-hMK"/>
+ </connections>
+ </tableCellView>
+ </prototypeCellViews>
+ </tableColumn>
+ <tableColumn identifier="VLCMediaSourceTableKindColumn" width="200" minWidth="50" maxWidth="3.4028234663852886e+38" id="K6u-4u-7Na">
+ <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Kind">
+ <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ </tableHeaderCell>
+ <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="8Uz-Gg-BIx">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="gbm-6b-2wR">
+ <rect key="frame" x="502" y="1" width="204" height="17"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vyv-sc-JqL">
+ <rect key="frame" x="0.0" y="0.0" width="204" height="16"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="Y4L-hX-6Kr">
+ <font key="font" usesAppearanceFont="YES"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <connections>
+ <outlet property="textField" destination="Vyv-sc-JqL" id="CI9-sB-Y0p"/>
</connections>
</tableCellView>
</prototypeCellViews>
@@ -888,6 +952,10 @@
<rect key="frame" x="-16" y="0.0" width="16" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
+ <tableHeaderView key="headerView" wantsLayer="YES" id="4cS-pi-5KZ">
+ <rect key="frame" x="0.0" y="0.0" width="718" height="28"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </tableHeaderView>
</scrollView>
<scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cFG-c9-cI9">
<rect key="frame" x="0.0" y="0.0" width="528" height="411"/>
=====================================
modules/gui/macosx/extensions/NSTableCellView+VLCAdditions.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * NSTableCellView+VLCAdditions.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2025 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 NSTableCellView (VLCAdditions)
+
++ (instancetype)tableCellViewWithIdentifier:(NSString *)identifier showingString:(NSString *)string;
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/extensions/NSTableCellView+VLCAdditions.m
=====================================
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * NSTableCellView+VLCAdditions.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2025 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 "NSTableCellView+VLCAdditions.h"
+
+#import "extensions/NSTextField+VLCAdditions.h"
+
+ at implementation NSTableCellView (VLCAdditions)
+
++ (instancetype)tableCellViewWithIdentifier:(NSString *)identifier showingString:(NSString *)string
+{
+ NSTableCellView * const cellView = [[NSTableCellView alloc] initWithFrame:NSZeroRect];
+ cellView.identifier = identifier;
+
+ NSTextField * const textField = [NSTextField defaultLabelWithString:string];
+ textField.translatesAutoresizingMaskIntoConstraints = NO;
+ cellView.textField = textField;
+ [cellView addSubview:textField];
+ [cellView.centerYAnchor constraintEqualToAnchor:textField.centerYAnchor].active = YES;
+ [cellView.leadingAnchor constraintEqualToAnchor:textField.leadingAnchor].active = YES;
+ [cellView.trailingAnchor constraintEqualToAnchor:textField.trailingAnchor].active = YES;
+
+ return cellView;
+}
+
+ at end
=====================================
modules/gui/macosx/extensions/NSTextField+VLCAdditions.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * NSTextField+VLCAdditions.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2025 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 NSTextField (VLCAdditions)
+
++ (instancetype)defaultLabelWithString:(NSString *)stringValue;
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/extensions/NSTextField+VLCAdditions.m
=====================================
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * NSTextField+VLCAdditions.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2025 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 "NSTextField+VLCAdditions.h"
+
+ at implementation NSTextField (VLCAdditions)
+
++ (instancetype)defaultLabelWithString:(NSString *)stringValue
+{
+ if (@available(macOS 10.12, *))
+ return [NSTextField wrappingLabelWithString:stringValue];
+ NSTextField * const textField = [[NSTextField alloc] initWithFrame:NSZeroRect];
+ textField.stringValue = stringValue;
+ textField.editable = NO;
+ textField.bordered = NO;
+ textField.drawsBackground = NO;
+ textField.lineBreakMode = NSLineBreakByWordWrapping;
+ return textField;
+}
+
+ at end
=====================================
modules/gui/macosx/library/media-source/VLCLibraryMediaSourceViewController.m
=====================================
@@ -119,10 +119,6 @@
_collectionViewScrollView.automaticallyAdjustsContentInsets = NO;
_collectionViewScrollView.contentInsets = defaultInsets;
_collectionViewScrollView.scrollerInsets = scrollerInsets;
-
- _tableViewScrollView.automaticallyAdjustsContentInsets = NO;
- _tableViewScrollView.contentInsets = defaultInsets;
- _tableViewScrollView.scrollerInsets = scrollerInsets;
}
- (void)setupPlaceholderLabel
=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.h
=====================================
@@ -22,6 +22,8 @@
#import <Cocoa/Cocoa.h>
+#import "library/VLCLibraryWindow.h"
+
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, VLCMediaSourceMode) {
@@ -53,6 +55,8 @@ extern NSString * const VLCMediaSourceBaseDataSourceNodeChanged;
@property (readwrite, weak) VLCLibraryMediaSourceViewNavigationStack *navigationStack;
+ at property (readonly) VLCLibraryViewModeSegment viewMode;
+
- (void)setupViews;
- (void)reloadViews;
- (void)homeButtonAction:(id)sender;
=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -30,6 +30,8 @@
#import "VLCMediaSourceDataSource.h"
#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTableCellView+VLCAdditions.h"
+#import "extensions/NSWindow+VLCAdditions.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCInputNodePathControl.h"
@@ -50,7 +52,6 @@ NSString * const VLCMediaSourceBaseDataSourceNodeChanged = @"VLCMediaSourceBaseD
{
NSArray<VLCMediaSource *> *_mediaSources;
NSArray<VLCInputNode *> *_discoveredLANdevices;
- BOOL _gridViewMode;
}
@end
@@ -61,6 +62,8 @@ NSString * const VLCMediaSourceBaseDataSourceNodeChanged = @"VLCMediaSourceBaseD
self = [super init];
if (self) {
_mediaSources = @[];
+ _discoveredLANdevices = @[];
+ _mediaSourceMode = VLCMediaSourceModeLAN;
NSNotificationCenter * const notificationCenter = NSNotificationCenter.defaultCenter;
[notificationCenter addObserver:self
selector:@selector(mediaSourceChildrenReset:)
@@ -91,6 +94,21 @@ NSString * const VLCMediaSourceBaseDataSourceNodeChanged = @"VLCMediaSourceBaseD
#pragma mark - view and model state management
+- (VLCLibraryViewModeSegment)viewMode
+{
+ VLCLibraryWindowPersistentPreferences * const libraryWindowPrefs =
+ VLCLibraryWindowPersistentPreferences.sharedInstance;
+
+ switch (_mediaSourceMode) {
+ case VLCMediaSourceModeLAN:
+ return libraryWindowPrefs.browseLibraryViewMode;
+ case VLCMediaSourceModeInternet:
+ return libraryWindowPrefs.streamLibraryViewMode;
+ default:
+ return VLCLibraryGridViewModeSegment;
+ }
+}
+
- (void)setupViews
{
self.collectionView.dataSource = self;
@@ -120,20 +138,7 @@ NSString * const VLCMediaSourceBaseDataSourceNodeChanged = @"VLCMediaSourceBaseD
- (void)reloadViews
{
- VLCLibraryViewModeSegment viewModeSegment = VLCLibraryGridViewModeSegment;
- VLCLibraryWindowPersistentPreferences * const libraryWindowPrefs = VLCLibraryWindowPersistentPreferences.sharedInstance;
-
- switch (_mediaSourceMode) {
- case VLCMediaSourceModeLAN:
- viewModeSegment = libraryWindowPrefs.browseLibraryViewMode;
- break;
- case VLCMediaSourceModeInternet:
- viewModeSegment = libraryWindowPrefs.streamLibraryViewMode;
- break;
- default:
- break;
- }
-
+ const VLCLibraryViewModeSegment viewModeSegment = self.viewMode;
if (viewModeSegment == VLCLibraryGridViewModeSegment) {
self.collectionViewScrollView.hidden = NO;
self.tableViewScrollView.hidden = YES;
@@ -145,6 +150,7 @@ NSString * const VLCMediaSourceBaseDataSourceNodeChanged = @"VLCMediaSourceBaseD
} else {
NSAssert(false, @"View mode must be grid or list mode");
}
+ [self togglePathControlVisibility:!_pathControlVisualEffectView.hidden];
}
- (void)loadMediaSources
@@ -365,33 +371,71 @@ referenceSizeForHeaderInSection:(NSInteger)section
return _mediaSources.count;
}
-- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+- (NSView *)tableView:(NSTableView *)tableView
+ viewForTableColumn:(NSTableColumn *)tableColumn
+ row:(NSInteger)row
{
- VLCLibraryTableCellView * const cellView = [tableView makeViewWithIdentifier:VLCLibraryTableCellViewIdentifier owner:self];
- cellView.primaryTitleTextField.hidden = YES;
- cellView.secondaryTitleTextField.hidden = YES;
- cellView.singlePrimaryTitleTextField.hidden = NO;
+ if ([tableColumn.identifier isEqualToString:@"VLCMediaSourceTableNameColumn"]) {
+ VLCLibraryTableCellView * const cellView =
+ [tableView makeViewWithIdentifier:VLCLibraryTableCellViewIdentifier owner:self];
+
+ if (_mediaSourceMode == VLCMediaSourceModeLAN) {
+ VLCInputItem * const currentNodeInput = _discoveredLANdevices[row].inputItem;
+ NSURL * const artworkURL = currentNodeInput.artworkURL;
+ NSImage * const placeholder = [NSImage imageNamed:@"NXdefaultappicon"];
+ if (artworkURL) {
+ [cellView.representedImageView setImageURL:artworkURL placeholderImage:placeholder];
+ } else {
+ cellView.representedImageView.image = placeholder;
+ }
+ } else {
+ cellView.representedImageView.image = [NSImage imageNamed:@"NXFollow"];
+ }
- if (_mediaSourceMode == VLCMediaSourceModeLAN) {
- VLCInputNode * const currentNode = _discoveredLANdevices[row];
- VLCInputItem * const currentNodeInput = currentNode.inputItem;
+ NSString * const name = _mediaSourceMode == VLCMediaSourceModeLAN
+ ? _discoveredLANdevices[row].inputItem.name
+ : _mediaSources[row].mediaSourceDescription;
+
+ cellView.primaryTitleTextField.hidden = YES;
+ cellView.secondaryTitleTextField.hidden = YES;
+ cellView.singlePrimaryTitleTextField.hidden = NO;
+ cellView.singlePrimaryTitleTextField.stringValue = name;
+ return cellView;
+ } else if ([tableColumn.identifier isEqualToString:@"VLCMediaSourceTableKindColumn"]) {
+ static NSString * const basicCellViewIdentifier = @"BasicTableCellViewIdentifier";
+ NSTableCellView *cellView =
+ [tableView makeViewWithIdentifier:basicCellViewIdentifier owner:self];
+ if (cellView == nil) {
+ cellView = [NSTableCellView tableCellViewWithIdentifier:basicCellViewIdentifier
+ showingString:@""];
+ }
+ NSAssert(cellView, @"Cell view should not be nil");
- NSURL * const artworkURL = currentNodeInput.artworkURL;
- NSImage * const placeholder = [NSImage imageNamed:@"NXdefaultappicon"];
- if (artworkURL) {
- [cellView.representedImageView setImageURL:artworkURL placeholderImage:placeholder];
+ if (_mediaSourceMode == VLCMediaSourceModeLAN) {
+ VLCInputItem * const currentNodeInput = _discoveredLANdevices[row].inputItem;
+ if (currentNodeInput.inputType == ITEM_TYPE_DIRECTORY) {
+ cellView.textField.stringValue = _NS("Directory");
+ }
} else {
- cellView.representedImageView.image = placeholder;
+ VLCMediaSource * const mediaSource = _mediaSources[row];
+ switch(mediaSource.category) {
+ case SD_CAT_DEVICES:
+ cellView.textField.stringValue = _NS("Devices");
+ break;
+ case SD_CAT_LAN:
+ cellView.textField.stringValue = _NS("LAN");
+ break;
+ case SD_CAT_INTERNET:
+ cellView.textField.stringValue = _NS("Internet");
+ break;
+ case SD_CAT_MYCOMPUTER:
+ cellView.textField.stringValue = _NS("My Computer");
+ break;
+ }
}
-
- cellView.singlePrimaryTitleTextField.stringValue = currentNodeInput.name;
- } else {
- VLCMediaSource * const mediaSource = _mediaSources[row];
- cellView.singlePrimaryTitleTextField.stringValue = mediaSource.mediaSourceDescription;
- cellView.representedImageView.image = [NSImage imageNamed:@"NXFollow"];
+ return cellView;
}
-
- return cellView;
+ return nil;
}
- (void)tableViewSelectionDidChange:(NSNotification *)notification
@@ -499,8 +543,8 @@ referenceSizeForHeaderInSection:(NSInteger)section
_collectionViewScrollView.scrollerInsets = scrollerInsets;
_tableViewScrollView.automaticallyAdjustsContentInsets = NO;
- _tableViewScrollView.contentInsets = scrollViewInsets;
- _tableViewScrollView.scrollerInsets = scrollerInsets;
+ _tableViewScrollView.contentInsets =
+ NSEdgeInsetsMake(scrollViewsTopSpace + _tableViewScrollView.window.titlebarHeight, 0, 0, 0);
}
- (void)returnHome
@@ -570,7 +614,7 @@ referenceSizeForHeaderInSection:(NSInteger)section
- (void)reloadDataForNotification:(NSNotification *)aNotification
{
- if (_gridViewMode) {
+ if (self.viewMode == VLCLibraryGridViewModeSegment) {
if (self.collectionView.dataSource == self) {
const NSInteger index = [_mediaSources indexOfObject:aNotification.object];
if (self.collectionView.numberOfSections > index) {
@@ -591,7 +635,7 @@ referenceSizeForHeaderInSection:(NSInteger)section
- (void)reloadData
{
- if (_gridViewMode) {
+ if (self.viewMode == VLCLibraryGridViewModeSegment) {
[self.collectionView reloadData];
} else {
[self.tableView reloadData];
=====================================
modules/gui/macosx/library/media-source/VLCMediaSourceDataSource.m
=====================================
@@ -33,10 +33,12 @@
#import "VLCMediaSource.h"
#import "extensions/NSString+Helpers.h"
+#import "extensions/NSTableCellView+VLCAdditions.h"
#import "library/VLCInputItem.h"
#import "library/VLCInputNodePathControl.h"
#import "library/VLCInputNodePathControlItem.h"
+#import "library/VLCLibraryImageCache.h"
#import "library/VLCLibraryTableCellView.h"
#import "library/VLCLibraryUIUnits.h"
#import "library/VLCLibraryWindow.h"
@@ -89,29 +91,34 @@ NSString * const VLCMediaSourceDataSourceNodeChanged = @"VLCMediaSourceDataSourc
_nodeToDisplay = nodeToDisplay;
input_item_node_t * const inputNode = nodeToDisplay.vlcInputItemNode;
- NSURL * const nodeUrl = [NSURL URLWithString:nodeToDisplay.inputItem.MRL];
- [self.displayedMediaSource generateChildNodesForDirectoryNode:inputNode withUrl:nodeUrl];
- [self reloadData];
-
- const __weak typeof(self) weakSelf = self;
+ if (self.parentBaseDataSource.mediaSourceMode == VLCMediaSourceModeLAN) {
+ NSURL * const nodeUrl = [NSURL URLWithString:nodeToDisplay.inputItem.MRL];
+ [self.displayedMediaSource generateChildNodesForDirectoryNode:inputNode withUrl:nodeUrl];
+
+ const __weak typeof(self) weakSelf = self;
+ self.observedPathDispatchSource = [self observeLocalUrl:nodeUrl
+ forVnodeEvents:DISPATCH_VNODE_WRITE |
+ DISPATCH_VNODE_DELETE |
+ DISPATCH_VNODE_RENAME
+ withEventHandler:^{
+ const uintptr_t eventFlags =
+ dispatch_source_get_data(weakSelf.observedPathDispatchSource);
+ if (eventFlags & DISPATCH_VNODE_DELETE || eventFlags & DISPATCH_VNODE_RENAME) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.parentBaseDataSource homeButtonAction:weakSelf];
+ });
+ } else {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.displayedMediaSource generateChildNodesForDirectoryNode:inputNode
+ withUrl:nodeUrl];
+ [weakSelf reloadData];
+ });
+ }
+ }];
+ }
- self.observedPathDispatchSource = [self observeLocalUrl:nodeUrl
- forVnodeEvents:DISPATCH_VNODE_WRITE | DISPATCH_VNODE_DELETE | DISPATCH_VNODE_RENAME
- withEventHandler:^{
- const uintptr_t eventFlags = dispatch_source_get_data(weakSelf.observedPathDispatchSource);
- if (eventFlags & DISPATCH_VNODE_DELETE || eventFlags & DISPATCH_VNODE_RENAME) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.parentBaseDataSource homeButtonAction:weakSelf];
- });
- } else {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.displayedMediaSource generateChildNodesForDirectoryNode:inputNode
- withUrl:nodeUrl];
- [weakSelf reloadData];
- });
- }
- }];
+ [self reloadData];
}
- (void)setupViews
@@ -218,10 +225,109 @@ NSString * const VLCMediaSourceDataSourceNodeChanged = @"VLCMediaSourceDataSourc
return 0;
}
-- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+- (NSView *)tableView:(NSTableView *)tableView
+ viewForTableColumn:(NSTableColumn *)tableColumn
+ row:(NSInteger)row
{
- VLCLibraryTableCellView * const cellView = [tableView makeViewWithIdentifier:VLCLibraryTableCellViewIdentifier owner:self];
- cellView.representedInputItem = [self mediaSourceInputItemAtRow:row];
+ VLCInputNode * const inputNode = [self mediaSourceInputNodeAtRow:row];
+
+ if ([tableColumn.identifier isEqualToString:@"VLCMediaSourceTableNameColumn"]) {
+ VLCLibraryTableCellView * const cellView =
+ [tableView makeViewWithIdentifier:VLCLibraryTableCellViewIdentifier owner:self];
+ [VLCLibraryImageCache thumbnailForInputItem:inputNode.inputItem
+ withCompletion:^(NSImage * _Nullable image) {
+ cellView.representedImageView.image = image;
+ }];
+ cellView.primaryTitleTextField.hidden = YES;
+ cellView.secondaryTitleTextField.hidden = YES;
+ cellView.singlePrimaryTitleTextField.hidden = NO;
+ cellView.singlePrimaryTitleTextField.stringValue = inputNode.inputItem.name;
+ return cellView;
+ }
+
+ // Only present count view for folders
+ if ([tableColumn.identifier isEqualToString:@"VLCMediaSourceTableCountColumn"] &&
+ inputNode.inputItem.inputType != ITEM_TYPE_DIRECTORY) {
+ return nil;
+ }
+
+ static NSString * const basicCellViewIdentifier = @"BasicTableCellViewIdentifier";
+ NSTableCellView *cellView =
+ [tableView makeViewWithIdentifier:basicCellViewIdentifier owner:self];
+ if (cellView == nil) {
+ cellView =
+ [NSTableCellView tableCellViewWithIdentifier:basicCellViewIdentifier showingString:@""];
+ }
+ NSAssert(cellView, @"Cell view should not be nil");
+
+ if ([tableColumn.identifier isEqualToString:@"VLCMediaSourceTableCountColumn"]) {
+ if (inputNode.numberOfChildren == 0) {
+ cellView.textField.stringValue = NSTR("Loading…");
+ dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
+ NSURL * const inputNodeUrl = [NSURL URLWithString:inputNode.inputItem.MRL];
+ input_item_node_t * const p_inputNode = inputNode.vlcInputItemNode;
+ [self.displayedMediaSource generateChildNodesForDirectoryNode:p_inputNode
+ withUrl:inputNodeUrl];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ cellView.textField.stringValue =
+ [NSString stringWithFormat:@"%i items", inputNode.numberOfChildren];
+ });
+ });
+ } else {
+ cellView.textField.stringValue =
+ [NSString stringWithFormat:@"%i items", inputNode.numberOfChildren];
+ }
+ } else if ([tableColumn.identifier isEqualToString:@"VLCMediaSourceTableKindColumn"]) {
+ NSString *typeName = NSTR("Unknown");
+ switch (inputNode.inputItem.inputType) {
+ case ITEM_TYPE_UNKNOWN:
+ typeName = NSTR("Unknown");
+ break;
+ case ITEM_TYPE_FILE:
+ {
+ NSString * const filePath = inputNode.inputItem.MRL;
+ NSString * const extension = filePath.pathExtension.lowercaseString;
+ if (extension.length > 0) {
+ typeName = [NSString stringWithFormat:@"%@ File", extension.capitalizedString];
+
+ const CFStringRef extCF = (__bridge CFStringRef)extension;
+ const CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extCF, NULL);
+ if (uti) {
+ CFStringRef descriptionCF = UTTypeCopyDescription(uti);
+ if (descriptionCF) {
+ typeName = CFBridgingRelease(descriptionCF);
+ }
+ CFRelease(uti);
+ }
+ } else {
+ typeName = NSTR("File");
+ }
+ break;
+ }
+ case ITEM_TYPE_DIRECTORY:
+ typeName = NSTR("Directory");
+ break;
+ case ITEM_TYPE_DISC:
+ typeName = NSTR("Disc");
+ break;
+ case ITEM_TYPE_CARD:
+ typeName = NSTR("Card");
+ break;
+ case ITEM_TYPE_STREAM:
+ typeName = NSTR("Stream");
+ break;
+ case ITEM_TYPE_PLAYLIST:
+ typeName = NSTR("Playlist");
+ break;
+ case ITEM_TYPE_NODE:
+ typeName = NSTR("Node");
+ break;
+ case ITEM_TYPE_NUMBER:
+ typeName = NSTR("Undefined");
+ break;
+ }
+ cellView.textField.stringValue = typeName;
+ }
return cellView;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/97d91c1e78d63cbd1e89df7813f8cfdf7429ad9a...7e0c08ff9b109c52a8a8477618a48478cc35c920
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/97d91c1e78d63cbd1e89df7813f8cfdf7429ad9a...7e0c08ff9b109c52a8a8477618a48478cc35c920
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