vlc | branch: master | Felix Paul Kühne <[email protected]> | Wed Jan 30 17:07:27 2019 +0100| [b6fbbfce0587af5ca50d743e852d186451027d70] | committer: Felix Paul Kühne
macosx/library window: add playlist table view with sample data > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b6fbbfce0587af5ca50d743e852d186451027d70 --- .../package/macosx/VLC.xcodeproj/project.pbxproj | 10 +- modules/gui/macosx/Makefile.am | 2 + modules/gui/macosx/UI/VLCLibraryWindow.xib | 161 ++++++++++++++++----- modules/gui/macosx/UI/VLCPlaylistTableCellView.xib | 56 +++++++ modules/gui/macosx/VLCLibraryWindow.h | 3 +- modules/gui/macosx/VLCLibraryWindow.m | 61 +++++++- modules/gui/macosx/VLCPlaylistTableCellView.h | 35 +++++ modules/gui/macosx/VLCPlaylistTableCellView.m | 27 ++++ 8 files changed, 318 insertions(+), 37 deletions(-) diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj index b1e169337c..96c931f7c9 100644 --- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj +++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj @@ -86,7 +86,6 @@ 1CCC89042078A3D500E5626F /* StreamOutput.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224131E4D2A9000833BE1 /* StreamOutput.xib */; }; 1CCC89052078A3D500E5626F /* TextfieldPanel.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224151E4D2A9000833BE1 /* TextfieldPanel.xib */; }; 1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224161E4D2A9000833BE1 /* TimeSelectionPanel.xib */; }; - 1CCD8FA02117957700407114 /* avaudiocapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CCD8F9F2117957600407114 /* avaudiocapture.m */; }; 1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */; }; 6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0292E51F43256300A50082 /* VLCBottomBarView.m */; }; 6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0AB0ED1F1AC8B3003A1B4E /* VLCSlider.m */; }; @@ -119,6 +118,7 @@ 6BBBF9851F7B257100B404CD /* VLCLogMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBBF9841F7B257100B404CD /* VLCLogMessage.m */; }; 6BF093F91EE0182B0049D8B0 /* VLCTimeField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */; }; 6BF5C5041EFE66EF008A9C12 /* VLCHUDTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF5C5031EFE66EF008A9C12 /* VLCHUDTableView.m */; }; + 7D0F63FF2201F63400FDB91F /* VLCPlaylistTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */; }; 7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0ED920CD204D0033A221 /* VLCWindow.m */; }; 7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */; }; 7D66D4362200BC340040D04A /* VLCClickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D66D4352200BC340040D04A /* VLCClickerManager.m */; }; @@ -433,6 +433,9 @@ 6BF5C5021EFE66EF008A9C12 /* VLCHUDTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCHUDTableView.h; sourceTree = "<group>"; }; 6BF5C5031EFE66EF008A9C12 /* VLCHUDTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDTableView.m; sourceTree = "<group>"; }; 7D0A387820CBCC4D00D4BF3B /* videotoolbox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = videotoolbox.m; path = ../../../modules/codec/videotoolbox.m; sourceTree = "<group>"; }; + 7D0F63FD2201F63400FDB91F /* VLCPlaylistTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistTableCellView.h; sourceTree = "<group>"; }; + 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistTableCellView.m; sourceTree = "<group>"; }; + 7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCPlaylistTableCellView.xib; sourceTree = "<group>"; }; 7D2E0ED920CD204D0033A221 /* VLCWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCWindow.m; sourceTree = "<group>"; }; 7D2E0EDA20CD204D0033A221 /* VLCWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCWindow.h; sourceTree = "<group>"; }; 7D2E0EDC20CD206F0033A221 /* VLCVideoWindowCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCVideoWindowCommon.h; sourceTree = "<group>"; }; @@ -1290,6 +1293,8 @@ children = ( 7D713D302201AE350042BEB7 /* VLCLibraryWindow.h */, 7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */, + 7D0F63FD2201F63400FDB91F /* VLCPlaylistTableCellView.h */, + 7D0F63FE2201F63400FDB91F /* VLCPlaylistTableCellView.m */, ); name = "Library Window"; sourceTree = "<group>"; @@ -1510,6 +1515,7 @@ 6B8224091E4D2A9000833BE1 /* MainMenu.xib */, 6B82240A1E4D2A9000833BE1 /* MainWindow.xib */, 7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */, + 7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */, 6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */, 6B8224181E4D2A9000833BE1 /* VLCFullScreenPanel.xib */, 6B8223FE1E4D2A8F00833BE1 /* About.xib */, @@ -1658,7 +1664,6 @@ 1C3113961E508C6900D4DD76 /* applescript.m in Sources */, 6B8A6B0121279D2600DC29F3 /* PXSourceListTableCellView.m in Sources */, 1C3113981E508C6900D4DD76 /* VLCAudioEffectsWindowController.m in Sources */, - 1CCD8FA02117957700407114 /* avaudiocapture.m in Sources */, 6BBBF9851F7B257100B404CD /* VLCLogMessage.m in Sources */, 1C31139A1E508C6900D4DD76 /* VLCBookmarksWindowController.m in Sources */, 6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */, @@ -1698,6 +1703,7 @@ 6B8A6B0B2128697E00DC29F3 /* VLCSourceListTableCellView.m in Sources */, 1C3113CD1E508C6900D4DD76 /* VLCPLModel.m in Sources */, 1C3113CF1E508C6900D4DD76 /* prefs_widgets.m in Sources */, + 7D0F63FF2201F63400FDB91F /* VLCPlaylistTableCellView.m in Sources */, 1C3113D11E508C6900D4DD76 /* prefs.m in Sources */, 6B8A6AFF21279D2600DC29F3 /* PXSourceListDelegateDataSourceProxy.m in Sources */, 1C3113D31E508C6900D4DD76 /* VLCResumeDialogController.m in Sources */, diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am index 6544d5f260..2f533aa041 100644 --- a/modules/gui/macosx/Makefile.am +++ b/modules/gui/macosx/Makefile.am @@ -91,6 +91,7 @@ libmacosx_plugin_la_SOURCES = \ gui/macosx/VLCRemoteControlService.h gui/macosx/VLCRemoteControlService.m \ gui/macosx/VLCMainWindow.h gui/macosx/VLCMainWindow.m \ gui/macosx/VLCLibraryWindow.h gui/macosx/VLCLibraryWindow.m \ + gui/macosx/VLCPlaylistTableCellView.h gui/macosx/VLCPlaylistTableCellView.m \ gui/macosx/VLCDetachedVideoWindow.h gui/macosx/VLCDetachedVideoWindow.m \ gui/macosx/VLCRendererDiscovery.h gui/macosx/VLCRendererDiscovery.m \ gui/macosx/VLCRendererItem.h gui/macosx/VLCRendererItem.m \ @@ -150,6 +151,7 @@ libmacosx_plugin_la_XIB_SOURCES = \ gui/macosx/UI/MainMenu.xib \ gui/macosx/UI/MainWindow.xib \ gui/macosx/UI/VLCLibraryWindow.xib \ + gui/macosx/UI/VLCPlaylistTableCellView.xib \ gui/macosx/UI/MediaInfo.xib \ gui/macosx/UI/Open.xib \ gui/macosx/UI/PlaylistAccessoryView.xib \ diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib index 87acd7add0..845ccb9487 100644 --- a/modules/gui/macosx/UI/VLCLibraryWindow.xib +++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> + <deployment identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -35,50 +36,144 @@ </segments> </segmentedCell> </segmentedControl> - <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12s-0J-Uvj" customClass="VLCVoutView"> + <customView hidden="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12s-0J-Uvj" customClass="VLCVoutView"> <rect key="frame" x="0.0" y="0.0" width="480" height="235"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> </customView> - <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nXS-11-7iK"> + <splitView autosaveName="librarywindowsplitview" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u8g-jy-S4e"> <rect key="frame" x="0.0" y="0.0" width="480" height="235"/> - <clipView key="contentView" id="OKa-dt-1yY"> - <rect key="frame" x="0.0" y="0.0" width="480" height="235"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <subviews> - <collectionView id="B8x-e8-7zp"> - <rect key="frame" x="0.0" y="0.0" width="480" height="158"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES"/> - <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="Rag-cM-k1g"> - <size key="itemSize" width="50" height="50"/> - </collectionViewFlowLayout> - <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> - </collectionView> - </subviews> - </clipView> - <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="7ik-B8-JYg"> - <rect key="frame" x="1" y="144" width="233" height="15"/> - <autoresizingMask key="autoresizingMask"/> - </scroller> - <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="rUh-Qg-gUL"> - <rect key="frame" x="234" y="1" width="15" height="143"/> - <autoresizingMask key="autoresizingMask"/> - </scroller> - </scrollView> + <subviews> + <customView id="iSp-bV-w6B"> + <rect key="frame" x="0.0" y="0.0" width="242" height="235"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nXS-11-7iK"> + <rect key="frame" x="0.0" y="0.0" width="242" height="235"/> + <clipView key="contentView" id="OKa-dt-1yY"> + <rect key="frame" x="0.0" y="0.0" width="242" height="235"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <collectionView id="B8x-e8-7zp"> + <rect key="frame" x="0.0" y="0.0" width="242" height="235"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES"/> + <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="Rag-cM-k1g"> + <size key="itemSize" width="50" height="50"/> + </collectionViewFlowLayout> + <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> + </collectionView> + </subviews> + </clipView> + <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="7ik-B8-JYg"> + <rect key="frame" x="-100" y="-100" width="233" height="15"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="rUh-Qg-gUL"> + <rect key="frame" x="234" y="1" width="15" height="143"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + </scrollView> + </subviews> + <constraints> + <constraint firstItem="nXS-11-7iK" firstAttribute="leading" secondItem="iSp-bV-w6B" secondAttribute="leading" id="SPv-yC-58y"/> + <constraint firstItem="nXS-11-7iK" firstAttribute="top" secondItem="iSp-bV-w6B" secondAttribute="top" id="Sje-VZ-Kcw"/> + <constraint firstAttribute="trailing" secondItem="nXS-11-7iK" secondAttribute="trailing" id="Tuh-vj-qaU"/> + <constraint firstAttribute="bottom" secondItem="nXS-11-7iK" secondAttribute="bottom" id="piy-A4-FaO"/> + </constraints> + </customView> + <customView id="dus-WQ-AmE"> + <rect key="frame" x="243" y="0.0" width="237" height="235"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <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="0.0" width="237" height="235"/> + <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Vdr-bg-tuS"> + <rect key="frame" x="0.0" y="0.0" width="237" height="235"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb"> + <rect key="frame" x="0.0" y="0.0" width="237" height="235"/> + <autoresizingMask key="autoresizingMask"/> + <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="234" minWidth="40" maxWidth="1000" id="gkH-E7-Nn4"> + <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border"> + <font key="font" metaFont="smallSystem"/> + <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/> + </tableHeaderCell> + <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="IQu-Aw-5Gr"> + <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="gVL-bx-hRL"> + <rect key="frame" x="1" y="1" width="234" height="17"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hYg-bX-voP"> + <rect key="frame" x="0.0" y="0.0" width="234" height="17"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> + <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="vBe-8X-jwD"> + <font key="font" metaFont="system"/> + <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + <connections> + <outlet property="textField" destination="hYg-bX-voP" id="i9z-OF-vvT"/> + </connections> + </tableCellView> + </prototypeCellViews> + </tableColumn> + </tableColumns> + <connections> + <action selector="selectNextTab:" target="QvC-M9-y7g" id="oNk-CO-d5B"/> + </connections> + </tableView> + </subviews> + <nil key="backgroundColor"/> + </clipView> + <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="5xw-WB-EbP"> + <rect key="frame" x="-100" y="-100" width="0.0" height="16"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="VAH-AH-GC0"> + <rect key="frame" x="224" y="17" width="15" height="102"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + </scrollView> + </subviews> + <constraints> + <constraint firstItem="Z7y-D0-11Q" firstAttribute="leading" secondItem="dus-WQ-AmE" secondAttribute="leading" id="J3s-se-6bL"/> + <constraint firstAttribute="bottom" secondItem="Z7y-D0-11Q" secondAttribute="bottom" id="XsQ-oc-D77"/> + <constraint firstAttribute="trailing" secondItem="Z7y-D0-11Q" secondAttribute="trailing" id="x0A-xI-BVt"/> + <constraint firstItem="Z7y-D0-11Q" firstAttribute="top" secondItem="dus-WQ-AmE" secondAttribute="top" id="zDU-QJ-fx4"/> + </constraints> + </customView> + </subviews> + <holdingPriorities> + <real value="250"/> + <real value="250"/> + </holdingPriorities> + </splitView> </subviews> <constraints> - <constraint firstAttribute="bottom" secondItem="nXS-11-7iK" secondAttribute="bottom" id="0pQ-dO-rse"/> - <constraint firstItem="B8x-e8-7zp" firstAttribute="top" secondItem="W1M-0o-qYG" secondAttribute="bottom" constant="7" id="3Wf-d4-dN1"/> <constraint firstItem="W1M-0o-qYG" firstAttribute="centerX" secondItem="EiT-Mj-1SZ" secondAttribute="centerX" id="4k0-zs-btE"/> - <constraint firstItem="12s-0J-Uvj" firstAttribute="leading" secondItem="nXS-11-7iK" secondAttribute="leading" id="69M-D7-5Yc"/> - <constraint firstItem="12s-0J-Uvj" firstAttribute="bottom" secondItem="nXS-11-7iK" secondAttribute="bottom" id="GcY-YM-Uyd"/> - <constraint firstItem="12s-0J-Uvj" firstAttribute="trailing" secondItem="nXS-11-7iK" secondAttribute="trailing" id="HPG-6j-8DO"/> - <constraint firstItem="12s-0J-Uvj" firstAttribute="top" secondItem="nXS-11-7iK" secondAttribute="top" id="OqY-5k-2vb"/> - <constraint firstItem="nXS-11-7iK" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="pXs-j9-TqM"/> - <constraint firstAttribute="trailing" secondItem="nXS-11-7iK" secondAttribute="trailing" id="rle-L3-teF"/> + <constraint firstItem="u8g-jy-S4e" firstAttribute="top" secondItem="W1M-0o-qYG" secondAttribute="bottom" constant="7" id="QVr-jj-gZM"/> + <constraint firstAttribute="trailing" secondItem="u8g-jy-S4e" secondAttribute="trailing" id="lEc-Vr-8M9"/> + <constraint firstItem="u8g-jy-S4e" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="s58-Wr-5SV"/> + <constraint firstAttribute="bottom" secondItem="u8g-jy-S4e" secondAttribute="bottom" id="tVt-DT-KIr"/> <constraint firstItem="W1M-0o-qYG" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="7" id="y9h-yj-Ufq"/> </constraints> </view> <connections> <outlet property="libraryCollectionView" destination="B8x-e8-7zp" id="djF-Lw-nXT"/> + <outlet property="playlistTableView" destination="Fr1-af-8gb" id="yaB-Ab-jrx"/> <outlet property="segmentedTitleControl" destination="W1M-0o-qYG" id="Gw1-T6-78k"/> <outlet property="videoView" destination="12s-0J-Uvj" id="zTg-s0-qZ5"/> </connections> diff --git a/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib b/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib new file mode 100644 index 0000000000..aaab3b6169 --- /dev/null +++ b/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <objects> + <customObject id="-2" userLabel="File's Owner" customClass="VLCPlaylistTableCellView"/> + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> + <customObject id="-3" userLabel="Application" customClass="NSObject"/> + <customView id="c22-O7-iKe" customClass="VLCPlaylistTableCellView"> + <rect key="frame" x="0.0" y="0.0" width="398" height="65"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <subviews> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ohB-P0-nCv"> + <rect key="frame" x="73" y="24" width="37" height="17"/> + <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="ZPw-XO-XD1"> + <font key="font" usesAppearanceFont="YES"/> + <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Hnm-OH-KKY"> + <rect key="frame" x="0.0" y="0.0" width="65" height="65"/> + <constraints> + <constraint firstAttribute="width" secondItem="Hnm-OH-KKY" secondAttribute="height" multiplier="1:1" id="4tH-UG-Xdn"/> + </constraints> + <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" id="AB8-xJ-YJC"/> + </imageView> + <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Ha-ZH-fa9"> + <rect key="frame" x="353" y="24" width="37" height="17"/> + <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="N0j-xB-3t9"> + <font key="font" usesAppearanceFont="YES"/> + <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> + <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> + </textFieldCell> + </textField> + </subviews> + <constraints> + <constraint firstItem="3Ha-ZH-fa9" firstAttribute="centerY" secondItem="ohB-P0-nCv" secondAttribute="centerY" id="Flo-4k-Vaz"/> + <constraint firstAttribute="bottom" secondItem="Hnm-OH-KKY" secondAttribute="bottom" id="KCN-ec-D7a"/> + <constraint firstItem="ohB-P0-nCv" firstAttribute="leading" secondItem="Hnm-OH-KKY" secondAttribute="trailing" constant="10" id="L6s-Ro-Qtx"/> + <constraint firstAttribute="trailing" secondItem="3Ha-ZH-fa9" secondAttribute="trailing" constant="10" id="SVJ-UL-O5m"/> + <constraint firstItem="ohB-P0-nCv" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="mGo-gc-dR6"/> + <constraint firstItem="Hnm-OH-KKY" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="owl-FT-tZX"/> + <constraint firstItem="Hnm-OH-KKY" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="vEf-1U-gh4"/> + </constraints> + <connections> + <outlet property="durationTextField" destination="3Ha-ZH-fa9" id="vbh-oE-Afj"/> + <outlet property="mediaImageView" destination="Hnm-OH-KKY" id="SzS-Oe-Ghh"/> + <outlet property="mediaTitleTextField" destination="ohB-P0-nCv" id="iS6-q4-h8I"/> + </connections> + <point key="canvasLocation" x="98" y="50.5"/> + </customView> + </objects> +</document> diff --git a/modules/gui/macosx/VLCLibraryWindow.h b/modules/gui/macosx/VLCLibraryWindow.h index 1fdf7f628b..f28a3a3d7c 100644 --- a/modules/gui/macosx/VLCLibraryWindow.h +++ b/modules/gui/macosx/VLCLibraryWindow.h @@ -34,10 +34,11 @@ NS_ASSUME_NONNULL_BEGIN @property (readwrite, weak) IBOutlet NSSegmentedControl *segmentedTitleControl; @property (readwrite, weak) IBOutlet NSCollectionView *libraryCollectionView; +@property (readwrite, weak) IBOutlet NSTableView *playlistTableView; @end -@interface VLCTitlebarAccessoryViewController : NSTitlebarAccessoryViewController +@interface VLCPlaylistDataSource : NSObject <NSTableViewDataSource, NSTableViewDelegate> @end diff --git a/modules/gui/macosx/VLCLibraryWindow.m b/modules/gui/macosx/VLCLibraryWindow.m index 455cd19851..8b6b8293f8 100644 --- a/modules/gui/macosx/VLCLibraryWindow.m +++ b/modules/gui/macosx/VLCLibraryWindow.m @@ -22,9 +22,19 @@ #import "VLCLibraryWindow.h" #import "NSString+Helpers.h" +#import "VLCPlaylistTableCellView.h" static const float f_min_window_width = 604.; static const float f_min_window_height = 307.; +static const float f_playlist_row_height = 40.; + +static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; + +@interface VLCLibraryWindow () +{ + VLCPlaylistDataSource *_playlistDataSource; +} +@end @implementation VLCLibraryWindow @@ -37,6 +47,13 @@ static const float f_min_window_height = 307.; [_segmentedTitleControl setLabel:_NS("Video") forSegment:1]; [_segmentedTitleControl setLabel:_NS("Network") forSegment:2]; [_segmentedTitleControl sizeToFit]; + + _playlistDataSource = [[VLCPlaylistDataSource alloc] init]; + + _playlistTableView.dataSource = _playlistDataSource; + _playlistTableView.delegate = _playlistDataSource; + _playlistTableView.rowHeight = f_playlist_row_height; + [_playlistTableView reloadData]; } - (void)segmentedControlAction @@ -45,6 +62,48 @@ static const float f_min_window_height = 307.; @end +@implementation VLCPlaylistDataSource + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView +{ + return 2; +} + +- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row +{ + VLCPlaylistTableCellView *cellView = [tableView makeViewWithIdentifier:VLCPlaylistCellIdentifier owner:self]; + + if (cellView == nil) { + /* the following code saves us an instance of NSViewController which we don't need */ + NSNib *nib = [[NSNib alloc] initWithNibNamed:@"VLCPlaylistTableCellView" bundle:nil]; + NSArray *topLevelObjects; + if (![nib instantiateWithOwner:self topLevelObjects:&topLevelObjects]) { + NSLog(@"Failed to load nib %@", nib); + return nil; + } + + for (id topLevelObject in topLevelObjects) { + if ([topLevelObject isKindOfClass:[VLCPlaylistTableCellView class]]) { + cellView = topLevelObject; + break; + } + } + cellView.identifier = VLCPlaylistCellIdentifier; + } + + cellView.mediaTitleTextField.stringValue = @"Custom Cell Label Text"; + cellView.durationTextField.stringValue = @"00:00"; + cellView.mediaImageView.image = [NSImage imageNamed: @"noart.png"]; + return cellView; +} + +- (void)tableViewSelectionDidChange:(NSNotification *)notification +{ + NSLog(@"playlist selection changed: %li", (long)[(NSTableView *)notification.object selectedRow]); +} + +@end + @implementation VLCLibraryWindowController - (instancetype)initWithLibraryWindow @@ -55,7 +114,7 @@ static const float f_min_window_height = 307.; - (void)windowDidLoad { - NSWindow *window = self.window; + VLCLibraryWindow *window = (VLCLibraryWindow *)self.window; [window setRestorable:NO]; [window setExcludedFromWindowsMenu:YES]; [window setAcceptsMouseMovedEvents:YES]; diff --git a/modules/gui/macosx/VLCPlaylistTableCellView.h b/modules/gui/macosx/VLCPlaylistTableCellView.h new file mode 100644 index 0000000000..50599576c3 --- /dev/null +++ b/modules/gui/macosx/VLCPlaylistTableCellView.h @@ -0,0 +1,35 @@ +/***************************************************************************** + * VLCPlaylistTableViewCell.h: MacOS X interface module + ***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * Authors: Felix Paul Kühne <fkuehne # videolan -dot- org> + * + * 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 + +@interface VLCPlaylistTableCellView : NSTableCellView + +@property (readwrite, assign) IBOutlet NSTextField *mediaTitleTextField; +@property (readwrite, assign) IBOutlet NSTextField *durationTextField; +@property (readwrite, assign) IBOutlet NSImageView *mediaImageView; + +@end + +NS_ASSUME_NONNULL_END diff --git a/modules/gui/macosx/VLCPlaylistTableCellView.m b/modules/gui/macosx/VLCPlaylistTableCellView.m new file mode 100644 index 0000000000..4eb397047b --- /dev/null +++ b/modules/gui/macosx/VLCPlaylistTableCellView.m @@ -0,0 +1,27 @@ +/***************************************************************************** + * VLCPlaylistTableViewCell.m: MacOS X interface module + ***************************************************************************** + * Copyright (C) 2019 VLC authors and VideoLAN + * + * Authors: Felix Paul Kühne <fkuehne # videolan -dot- org> + * + * 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 "VLCPlaylistTableCellView.h" + +@implementation VLCPlaylistTableCellView + +@end _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
