vlc | branch: master | Felix Paul Kühne <[email protected]> | Mon Oct 21 10:45:52 2019 +0200| [66180178cafcd09561ba4a202a921e7d3d6d4b2b] | committer: Felix Paul Kühne
macosx: implement playlist reordering (closes #22757) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=66180178cafcd09561ba4a202a921e7d3d6d4b2b --- modules/gui/macosx/UI/VLCLibraryWindow.xib | 104 ++++++++++----------- .../gui/macosx/playlist/VLCPlaylistController.h | 8 ++ .../gui/macosx/playlist/VLCPlaylistController.m | 35 ++++++- .../gui/macosx/playlist/VLCPlaylistDataSource.m | 21 ++++- modules/gui/macosx/playlist/VLCPlaylistItem.h | 3 + modules/gui/macosx/playlist/VLCPlaylistItem.m | 7 ++ modules/gui/macosx/playlist/VLCPlaylistModel.h | 1 + modules/gui/macosx/playlist/VLCPlaylistModel.m | 7 ++ 8 files changed, 132 insertions(+), 54 deletions(-) diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib index 202c305c39..19092e7cb8 100644 --- a/modules/gui/macosx/UI/VLCLibraryWindow.xib +++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> <deployment identifier="macosx"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -17,7 +17,7 @@ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <rect key="contentRect" x="196" y="240" width="480" height="363"/> - <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/> + <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/> <view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ"> <rect key="frame" x="0.0" y="0.0" width="480" height="363"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> @@ -25,7 +25,7 @@ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W1M-0o-qYG"> <rect key="frame" x="212.5" y="333" width="56" height="23"/> <segmentedCell key="cell" borderStyle="border" alignment="left" style="texturedRounded" trackingMode="selectOne" id="Twg-gp-8ng"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <segments> <segment/> <segment selected="YES" tag="1"/> @@ -45,17 +45,17 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TET-5r-zHx"> - <rect key="frame" x="18" y="230" width="37" height="17"/> + <rect key="frame" x="18" y="230" width="37" height="16"/> <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="fo5-R8-TeO"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> </textField> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mbV-My-cm7" customClass="VLCRoundedCornerTextField"> - <rect key="frame" x="182" y="230" width="37" height="17"/> + <rect key="frame" x="182" y="230" width="37" height="16"/> <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="4hq-fU-NXW"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -69,21 +69,21 @@ <rect key="frame" x="0.0" y="0.0" width="237" height="151"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView"> + <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView"> <rect key="frame" x="0.0" y="0.0" width="237" height="151"/> - <autoresizingMask key="autoresizingMask"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <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"/> + <font key="font" metaFont="message" size="11"/> <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"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -97,7 +97,7 @@ <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="vlq-wz-y8v"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -134,7 +134,7 @@ <rect key="frame" x="20" y="15" width="24" height="24"/> <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="shuffleOn" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="J31-h3-U4s"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="shuffleAction:" target="QvC-M9-y7g" id="IPl-lr-hFA"/> @@ -144,7 +144,7 @@ <rect key="frame" x="64" y="15" width="24" height="24"/> <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="repeatOff" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="ol2-xi-TEm"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="repeatAction:" target="QvC-M9-y7g" id="zpd-jv-1v1"/> @@ -154,7 +154,7 @@ <rect key="frame" x="202" y="15" width="15" height="30"/> <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSTouchBarDeleteTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="OjM-W9-IrQ"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="clearPlaylist:" target="QvC-M9-y7g" id="tzd-mR-sDu"/> @@ -175,7 +175,7 @@ <rect key="frame" x="56" y="-10" width="125" height="32"/> <buttonCell key="cell" type="push" title="Open media..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="UUH-HF-Iqc"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="openMedia:" target="QvC-M9-y7g" id="Px5-M7-DSb"/> @@ -193,7 +193,7 @@ <rect key="frame" x="171" y="23" width="21" height="14"/> <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSTextRulerLineHeightIncrease" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="qDZ-84-3uy"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="sortPlaylist:" target="QvC-M9-y7g" id="sBc-0X-g5C"/> @@ -249,7 +249,7 @@ <rect key="frame" x="0.0" y="0.0" width="29" height="23"/> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="backward-3btns" imagePosition="only" alignment="center" alternateImage="backward-3btns-pressed" continuous="YES" enabled="NO" id="tnS-iP-qgi"> <behavior key="behavior" lightByContents="YES"/> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> </buttonCell> <connections> <action selector="bwd:" target="Uzf-Tf-H8x" id="oqX-44-Xe8"/> @@ -269,7 +269,7 @@ <rect key="frame" x="56" y="0.0" width="29" height="23"/> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="forward-3btns" imagePosition="only" alignment="center" alternateImage="forward-3btns-pressed" continuous="YES" enabled="NO" id="5ig-mn-y7F"> <behavior key="behavior" lightByContents="YES"/> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> </buttonCell> <connections> <action selector="fwd:" target="Uzf-Tf-H8x" id="jMH-cC-gq9"/> @@ -296,7 +296,7 @@ <constraint firstAttribute="height" constant="14" id="4YR-vo-ZfK"/> </constraints> <sliderCell key="cell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="1" doubleValue="0.32600000000000001" tickMarkPosition="above" sliderType="linear" id="YMg-uo-8nX" customClass="VLCSliderCell"> - <font key="font" size="12" name="Helvetica"/> + <font key="font" metaFont="user"/> </sliderCell> <connections> <action selector="timeSliderAction:" target="Uzf-Tf-H8x" id="eDh-39-Ej1"/> @@ -309,7 +309,7 @@ <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="52" id="aOU-Hc-ufI"/> </constraints> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" alignment="center" title="00:00" id="adD-oG-KsD"> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> <color key="textColor" white="0.25" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -322,7 +322,7 @@ </constraints> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="fullscreen-one-button" imagePosition="only" alignment="center" alternateImage="fullscreen-one-button-pressed" id="fMb-sg-sZ1"> <behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> </buttonCell> <connections> <action selector="fullscreen:" target="Uzf-Tf-H8x" id="ayV-qE-Nmy"/> @@ -335,7 +335,7 @@ </constraints> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="volume-low" imagePosition="only" alignment="center" id="qTN-dX-Oj5"> <behavior key="behavior" lightByContents="YES"/> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> </buttonCell> <connections> <action selector="volumeAction:" target="Uzf-Tf-H8x" id="ugn-Py-dV8"/> @@ -358,7 +358,7 @@ </constraints> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="volume-high" imagePosition="only" alignment="center" id="a9Z-7I-lXJ"> <behavior key="behavior" lightByContents="YES"/> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> </buttonCell> <connections> <action selector="volumeAction:" target="Uzf-Tf-H8x" id="8aL-jE-MXa"/> @@ -371,7 +371,7 @@ </constraints> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="stop" imagePosition="only" alignment="center" alternateImage="stop-pressed" enabled="NO" id="NEI-Es-D2A"> <behavior key="behavior" lightByContents="YES"/> - <font key="font" metaFont="label"/> + <font key="font" metaFont="system" size="10"/> </buttonCell> <connections> <action selector="stop:" target="Uzf-Tf-H8x" id="kMO-P8-eOG"/> @@ -414,7 +414,7 @@ <constraint firstAttribute="width" constant="96" id="pdg-70-JyS"/> </constraints> <searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" usesSingleLineMode="YES" bezelStyle="round" id="hOD-ST-dRA"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </searchFieldCell> @@ -426,7 +426,7 @@ </constraints> <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="NSPrivateChaptersTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="qZO-fT-bFY"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="showAndHidePlaylist:" target="QvC-M9-y7g" id="hRz-bm-JJi"/> @@ -435,7 +435,7 @@ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8iI-b7-Eag"> <rect key="frame" x="212" y="301" width="56" height="24"/> <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="j8T-nk-7Ny"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <segments> <segment/> <segment selected="YES" tag="1"/> @@ -448,7 +448,7 @@ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7K7-4r-Swk"> <rect key="frame" x="177" y="301" width="67" height="24"/> <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="Txm-sT-UX4"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <segments> <segment image="NSIconViewTemplate"/> <segment image="NSListViewTemplate" selected="YES" tag="1"/> @@ -459,7 +459,7 @@ <rect key="frame" x="4" y="296" width="57" height="32"/> <buttonCell key="cell" type="push" bezelStyle="rounded" image="NSTextRulerLineHeightIncrease" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="PIW-C4-naY"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> <connections> <action selector="sortLibrary:" target="QvC-M9-y7g" id="VJd-p4-owD"/> @@ -469,14 +469,14 @@ <rect key="frame" x="56" y="328" width="45" height="32"/> <buttonCell key="cell" type="push" bezelStyle="rounded" image="NSLeftFacingTriangleTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iCT-DX-7zt"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> </button> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ehX-wB-NgX"> <rect key="frame" x="89" y="328" width="45" height="32"/> <buttonCell key="cell" type="push" bezelStyle="rounded" image="NSRightFacingTriangleTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2fB-Bb-72z"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> </buttonCell> </button> </subviews> @@ -651,23 +651,23 @@ <rect key="frame" x="0.0" y="0.0" width="528" height="267"/> <clipView key="contentView" id="5co-vI-cEn"> <rect key="frame" x="0.0" y="0.0" width="528" height="267"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <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"> <rect key="frame" x="0.0" y="0.0" width="528" height="267"/> - <autoresizingMask key="autoresizingMask"/> + <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="525" minWidth="40" maxWidth="1000" id="89Q-Wg-BdA"> <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border"> - <font key="font" metaFont="smallSystem"/> + <font key="font" metaFont="message" size="11"/> <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="v9H-KJ-Zhv"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -681,7 +681,7 @@ <rect key="frame" x="0.0" y="-17" width="525" 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="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -710,7 +710,7 @@ <rect key="frame" x="0.0" y="0.0" width="528" height="267"/> <clipView key="contentView" id="tI4-x3-55j"> <rect key="frame" x="0.0" y="0.0" width="528" height="267"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <autoresizingMask key="autoresizingMask"/> <subviews> <collectionView selectable="YES" id="r7v-GI-W1U"> <rect key="frame" x="0.0" y="0.0" width="528" height="267"/> @@ -734,7 +734,7 @@ <pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rjk-Q6-FYy"> <rect key="frame" x="46" y="277" width="472" height="20"/> <pathCell key="cell" controlSize="small" selectable="YES" editable="YES" alignment="left" id="kIb-Jz-eus"> - <font key="font" metaFont="smallSystem"/> + <font key="font" metaFont="message" size="11"/> <url key="url" string="file://localhost/Applications/"/> </pathCell> </pathControl> @@ -745,7 +745,7 @@ </constraints> <buttonCell key="cell" type="push" bezelStyle="rounded" image="NSHomeTemplate" imagePosition="only" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OHf-j4-3In"> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> - <font key="font" metaFont="smallSystem"/> + <font key="font" metaFont="message" size="11"/> </buttonCell> </button> </subviews> @@ -778,23 +778,23 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <clipView key="contentView" id="qva-RZ-DvL"> <rect key="frame" x="0.0" y="0.0" width="312" height="390"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <autoresizingMask key="autoresizingMask"/> <subviews> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" viewBased="YES" id="LNt-ot-2wU"> <rect key="frame" x="0.0" y="0.0" width="312" height="390"/> - <autoresizingMask key="autoresizingMask"/> + <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="309" minWidth="40" maxWidth="1000" id="z5o-3O-6vc"> <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border"> - <font key="font" metaFont="smallSystem"/> + <font key="font" metaFont="message" size="11"/> <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="eXM-oB-xvr"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -808,7 +808,7 @@ <rect key="frame" x="0.0" y="0.0" width="309" height="17"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="zRF-hR-42C"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -838,23 +838,23 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <clipView key="contentView" id="xCC-h9-931"> <rect key="frame" x="0.0" y="0.0" width="401" height="390"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <autoresizingMask key="autoresizingMask"/> <subviews> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="4ll-T2-J16"> <rect key="frame" x="0.0" y="0.0" width="401" height="390"/> - <autoresizingMask key="autoresizingMask"/> + <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="398" minWidth="40" maxWidth="1000" id="WLd-Pi-bR4"> <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border"> - <font key="font" metaFont="smallSystem"/> + <font key="font" metaFont="message" size="11"/> <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="Ecs-pW-kyf"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -868,7 +868,7 @@ <rect key="frame" x="0.0" y="0.0" width="398" height="17"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="dbf-tg-Ss3"> - <font key="font" metaFont="system"/> + <font key="font" metaFont="message"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> @@ -903,7 +903,7 @@ <rect key="frame" x="0.0" y="0.0" width="714" height="390"/> <clipView key="contentView" id="2oa-WL-dxA"> <rect key="frame" x="0.0" y="0.0" width="714" height="390"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <autoresizingMask key="autoresizingMask"/> <subviews> <collectionView id="QAt-jP-zE7"> <rect key="frame" x="0.0" y="0.0" width="714" height="390"/> diff --git a/modules/gui/macosx/playlist/VLCPlaylistController.h b/modules/gui/macosx/playlist/VLCPlaylistController.h index bec3b8a1f1..fcdecdf822 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistController.h +++ b/modules/gui/macosx/playlist/VLCPlaylistController.h @@ -132,6 +132,14 @@ extern NSString *VLCPlaylistItemsRemoved; atPosition:(size_t)insertionIndex startPlayback:(BOOL)startPlayback; +/** + * Move an item with a given unique ID to a new position + * @param uniqueID the ID of the playlist item to move + * @param target the target index of where to move the item + * @return returns VLC_SUCCESS or an error + */ +- (int)moveItemWithID:(int64_t)uniqueID toPosition:(size_t)target; + /** * Remove all items at the given index set * @param indexes Set of indexes to remove diff --git a/modules/gui/macosx/playlist/VLCPlaylistController.m b/modules/gui/macosx/playlist/VLCPlaylistController.m index 13bfa3ae87..415d6cf60e 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistController.m +++ b/modules/gui/macosx/playlist/VLCPlaylistController.m @@ -52,6 +52,7 @@ NSString *VLCPlaylistItemsRemoved = @"VLCPlaylistItemsRemoved"; - (void)playlistResetWithItems:(NSArray *)items; - (void)playlistAdded:(NSArray *)items atIndex:(size_t)insertionIndex count:(size_t)numberOfItems; +- (void)playlistMovedIndex:(size_t)index toTarget:(size_t)target numberOfItems:(size_t)count; - (void)playlistRemovedItemsAtIndex:(size_t)index count:(size_t)numberOfItems; - (void)playlistUpdatedForIndex:(size_t)firstUpdatedIndex items:(vlc_playlist_item_t *const *)items count:(size_t)numberOfItems; - (void)playlistPlaybackRepeatUpdated:(enum vlc_playlist_playback_repeat)currentRepeatMode; @@ -100,6 +101,19 @@ cb_playlist_items_added(vlc_playlist_t *playlist, }); } +static void +cb_playlist_items_moved(vlc_playlist_t *playlist, + size_t index, + size_t numberOfMovedItems, + size_t target, + void *p_data) +{ + dispatch_async(dispatch_get_main_queue(), ^{ + VLCPlaylistController *playlistController = (__bridge VLCPlaylistController *)p_data; + [playlistController playlistMovedIndex:index toTarget:target numberOfItems:numberOfMovedItems]; + }); +} + static void cb_playlist_items_removed(vlc_playlist_t *playlist, size_t index, @@ -183,7 +197,7 @@ cb_playlist_has_next_changed(vlc_playlist_t *playlist, static const struct vlc_playlist_callbacks playlist_callbacks = { cb_playlist_items_reset, cb_playlist_items_added, - NULL, + cb_playlist_items_moved, cb_playlist_items_removed, cb_playlist_items_updated, cb_playlist_playback_repeat_changed, @@ -288,6 +302,12 @@ static const struct vlc_playlist_callbacks playlist_callbacks = { [_defaultNotificationCenter postNotificationName:VLCPlaylistItemsAdded object:self]; } +- (void)playlistMovedIndex:(size_t)index toTarget:(size_t)target numberOfItems:(size_t)count +{ + [_playlistModel moveItemAtIndex:index toTarget:target]; + [_playlistDataSource playlistUpdated]; +} + - (void)playlistRemovedItemsAtIndex:(size_t)index count:(size_t)numberOfItems { NSRange range = NSMakeRange(index, numberOfItems); @@ -423,6 +443,19 @@ static const struct vlc_playlist_callbacks playlist_callbacks = { return ret; } +- (int)moveItemWithID:(int64_t)uniqueID toPosition:(size_t)target +{ + vlc_playlist_item_t **items = calloc(1, sizeof(vlc_playlist_item_t *)); + vlc_playlist_Lock(_p_playlist); + ssize_t itemIndex = vlc_playlist_IndexOfId(_p_playlist, uniqueID); + vlc_playlist_item_t *p_item = vlc_playlist_Get(_p_playlist, itemIndex); + items[0] = p_item; + int ret = vlc_playlist_RequestMove(_p_playlist, items, 1, target, itemIndex); + vlc_playlist_Unlock(_p_playlist); + free(items); + return ret; +} + - (void)removeItemsAtIndexes:(NSIndexSet *)indexes { if (indexes.count == 0) diff --git a/modules/gui/macosx/playlist/VLCPlaylistDataSource.m b/modules/gui/macosx/playlist/VLCPlaylistDataSource.m index 61a8b39391..a6502be7a4 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistDataSource.m +++ b/modules/gui/macosx/playlist/VLCPlaylistDataSource.m @@ -50,7 +50,7 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; - (void)prepareForUse { - [_tableView registerForDraggedTypes:@[VLCMediaLibraryMediaItemPasteboardType, NSFilenamesPboardType]]; + [_tableView registerForDraggedTypes:@[VLCMediaLibraryMediaItemPasteboardType, VLCPlaylistItemPasteboardType, NSFilenamesPboardType]]; } - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView @@ -102,6 +102,14 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; [_tableView reloadData]; } +- (id<NSPasteboardWriting>)tableView:(NSTableView *)tableView pasteboardWriterForRow:(NSInteger)row +{ + NSPasteboardItem *pboardItem = [[NSPasteboardItem alloc] init]; + VLCPlaylistItem *playlistItem = [_playlistModel playlistItemAtIndex:row]; + [pboardItem setString:[@(playlistItem.uniqueID) stringValue] forType:VLCPlaylistItemPasteboardType]; + return pboardItem; +} + - (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id<NSDraggingInfo>)info proposedRow:(NSInteger)row @@ -115,8 +123,17 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation { + NSString *encodedIDtoMove = [info.draggingPasteboard stringForType:VLCPlaylistItemPasteboardType]; + if (encodedIDtoMove != nil) { + int64_t uniqueID = [encodedIDtoMove integerValue]; + [_playlistController moveItemWithID:uniqueID toPosition:row]; + return YES; + } + + /* check whether the receive data is a library item from the left-hand side */ NSData *data = [info.draggingPasteboard dataForType:VLCMediaLibraryMediaItemPasteboardType]; if (!data) { + /* it's not, so check if it is a file handle from the Finder */ id propertyList = [info.draggingPasteboard propertyListForType:NSFilenamesPboardType]; if (propertyList == nil) { return NO; @@ -142,6 +159,8 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier"; } return NO; } + + /* it is a media library item, so unarchive it and add it to the playlist */ NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data]; if (!data) { return NO; diff --git a/modules/gui/macosx/playlist/VLCPlaylistItem.h b/modules/gui/macosx/playlist/VLCPlaylistItem.h index a8841f1acc..96ff2efb75 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistItem.h +++ b/modules/gui/macosx/playlist/VLCPlaylistItem.h @@ -28,9 +28,12 @@ NS_ASSUME_NONNULL_BEGIN @class VLCInputItem; @class VLCMediaLibraryMediaItem; +extern NSString *VLCPlaylistItemPasteboardType; + @interface VLCPlaylistItem : NSObject @property (readonly) vlc_playlist_item_t *playlistItem; +@property (readonly) uint64_t uniqueID; @property (readwrite, retain) NSString *title; @property (readonly, copy, nullable) NSURL *url; @property (readonly, copy, nullable) NSString *path; diff --git a/modules/gui/macosx/playlist/VLCPlaylistItem.m b/modules/gui/macosx/playlist/VLCPlaylistItem.m index f6792903ef..cf13dca131 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistItem.m +++ b/modules/gui/macosx/playlist/VLCPlaylistItem.m @@ -29,6 +29,8 @@ #import "library/VLCInputItem.h" #import "library/VLCLibraryDataTypes.h" +NSString *VLCPlaylistItemPasteboardType = @"org.videolan.vlc.playlistitemtype"; + @implementation VLCPlaylistItem - (instancetype)initWithPlaylistItem:(vlc_playlist_item_t *)p_item @@ -52,6 +54,11 @@ return [NSString stringWithFormat:@"item %p, title: %@ duration %lli", &_playlistItem, _title, _duration]; } +- (uint64_t)uniqueID +{ + return vlc_playlist_item_GetId(_playlistItem); +} + - (VLCInputItem *)inputItem { if (!_playlistItem) { diff --git a/modules/gui/macosx/playlist/VLCPlaylistModel.h b/modules/gui/macosx/playlist/VLCPlaylistModel.h index ea570580fe..10b7bb014f 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistModel.h +++ b/modules/gui/macosx/playlist/VLCPlaylistModel.h @@ -37,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN - (VLCPlaylistItem *)playlistItemAtIndex:(NSInteger)index; - (void)addItems:(NSArray *)array; - (void)addItems:(NSArray *)array atIndex:(size_t)index count:(size_t)count; +- (void)moveItemAtIndex:(size_t)index toTarget:(size_t)target; - (void)removeItemsInRange:(NSRange)range; - (void)updateItemAtIndex:(size_t)index; diff --git a/modules/gui/macosx/playlist/VLCPlaylistModel.m b/modules/gui/macosx/playlist/VLCPlaylistModel.m index 7b10022490..dd07fd1bf2 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistModel.m +++ b/modules/gui/macosx/playlist/VLCPlaylistModel.m @@ -69,6 +69,13 @@ [_playlistArray insertObjects:array atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(index, count)]]; } +- (void)moveItemAtIndex:(size_t)index toTarget:(size_t)target +{ + VLCPlaylistItem *item = [_playlistArray objectAtIndex:index]; + [_playlistArray removeObjectAtIndex:index]; + [_playlistArray insertObject:item atIndex:target]; +} + - (void)removeItemsInRange:(NSRange)range { [_playlistArray removeObjectsInRange:range]; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
