[vlc-commits] macosx: add window to manage library folders
Felix Paul Kühne
git at videolan.org
Mon Apr 29 19:27:02 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sat Apr 27 20:21:07 2019 +0200| [d13b51222b83721487d7c8aadce2142e91caeeff] | committer: Felix Paul Kühne
macosx: add window to manage library folders
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d13b51222b83721487d7c8aadce2142e91caeeff
---
.../package/macosx/VLC.xcodeproj/project.pbxproj | 8 +
modules/gui/macosx/Makefile.am | 3 +
modules/gui/macosx/UI/MainMenu.xib | 13 +-
.../macosx/UI/VLCLibraryFolderManagementWindow.xib | 168 +++++++++++++++++++++
.../macosx/library/VLCLibraryCollectionViewItem.m | 3 +
modules/gui/macosx/library/VLCLibraryController.h | 5 +
modules/gui/macosx/library/VLCLibraryController.m | 22 +++
.../library/VLCLibraryFolderManagementWindow.h | 48 ++++++
.../library/VLCLibraryFolderManagementWindow.m | 154 +++++++++++++++++++
modules/gui/macosx/library/VLCLibraryModel.h | 3 +
modules/gui/macosx/library/VLCLibraryModel.m | 22 +++
modules/gui/macosx/menus/VLCMainMenu.h | 5 +-
modules/gui/macosx/menus/VLCMainMenu.m | 16 +-
po/POTFILES.in | 2 +
14 files changed, 455 insertions(+), 17 deletions(-)
diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 98fc938254..8907b37bf2 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -126,6 +126,7 @@
7D903EAF224392B400917358 /* timespec_get.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D903EAE224392B400917358 /* timespec_get.c */; };
7D903EB6224394BE00917358 /* specific.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D903EB5224394BE00917358 /* specific.c */; };
7D903EB92243952100917358 /* threads.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D903EB82243952100917358 /* threads.c */; };
+ 7D94E28D2274D2140008057F /* VLCLibraryFolderManagementWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D94E28B2274D2140008057F /* VLCLibraryFolderManagementWindow.m */; };
7DB40D2A20CBCEB500F63173 /* VLCMainMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB40D2920CBCEB500F63173 /* VLCMainMenu.m */; };
7DB40D2D20CBCEC200F63173 /* VLCStatusBarIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB40D2B20CBCEC200F63173 /* VLCStatusBarIcon.m */; };
7DB7F1EC20CC036D00C2CAED /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DB7F1EB20CC036D00C2CAED /* AudioUnit.framework */; };
@@ -478,6 +479,9 @@
7D903EAE224392B400917358 /* timespec_get.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = timespec_get.c; path = ../../../../compat/timespec_get.c; sourceTree = "<group>"; };
7D903EB5224394BE00917358 /* specific.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = specific.c; path = ../../../src/darwin/specific.c; sourceTree = "<group>"; };
7D903EB82243952100917358 /* threads.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = threads.c; path = ../../../../src/misc/threads.c; sourceTree = "<group>"; };
+ 7D94E28A2274D2140008057F /* VLCLibraryFolderManagementWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryFolderManagementWindow.h; sourceTree = "<group>"; };
+ 7D94E28B2274D2140008057F /* VLCLibraryFolderManagementWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryFolderManagementWindow.m; sourceTree = "<group>"; };
+ 7D94E28C2274D2140008057F /* VLCLibraryFolderManagementWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCLibraryFolderManagementWindow.xib; sourceTree = "<group>"; };
7DB40D2820CBCEB500F63173 /* VLCMainMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMainMenu.h; sourceTree = "<group>"; };
7DB40D2920CBCEB500F63173 /* VLCMainMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMainMenu.m; sourceTree = "<group>"; };
7DB40D2B20CBCEC200F63173 /* VLCStatusBarIcon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCStatusBarIcon.m; sourceTree = "<group>"; };
@@ -956,6 +960,8 @@
7DFBDCAD2269ED0C00B700A5 /* VLCLibraryDataSource.m */,
7DFBDCAF226A518400B700A5 /* VLCLibraryMenuController.h */,
7DFBDCB0226A518400B700A5 /* VLCLibraryMenuController.m */,
+ 7D94E28A2274D2140008057F /* VLCLibraryFolderManagementWindow.h */,
+ 7D94E28B2274D2140008057F /* VLCLibraryFolderManagementWindow.m */,
7DFBDCBF226DC16200B700A5 /* VLCInputItem.h */,
7DFBDCC0226DC16200B700A5 /* VLCInputItem.m */,
);
@@ -1435,6 +1441,7 @@
children = (
6B8224091E4D2A9000833BE1 /* MainMenu.xib */,
7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */,
+ 7D94E28C2274D2140008057F /* VLCLibraryFolderManagementWindow.xib */,
7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */,
7D445D8F220339D400263D34 /* VLCPlaylistMenu.xib */,
7D0F64052202047900FDB91F /* VLCLibraryCollectionViewItem.xib */,
@@ -1576,6 +1583,7 @@
1CCC89012078A3D500E5626F /* Preferences.xib in Sources */,
7DC21A7422049A6600F98A02 /* VLCOpenInputMetadata.m in Sources */,
1CCC89022078A3D500E5626F /* ResumeDialog.xib in Sources */,
+ 7D94E28D2274D2140008057F /* VLCLibraryFolderManagementWindow.m in Sources */,
1CCC89032078A3D500E5626F /* SimplePreferences.xib in Sources */,
1CCC89042078A3D500E5626F /* StreamOutput.xib in Sources */,
1CCC89052078A3D500E5626F /* TextfieldPanel.xib in Sources */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 78ac1c9233..425fc14523 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -54,6 +54,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibraryDataSource.m \
gui/macosx/library/VLCLibraryDataTypes.h \
gui/macosx/library/VLCLibraryDataTypes.m \
+ gui/macosx/library/VLCLibraryFolderManagementWindow.h \
+ gui/macosx/library/VLCLibraryFolderManagementWindow.m \
gui/macosx/library/VLCLibraryMenuController.h \
gui/macosx/library/VLCLibraryMenuController.m \
gui/macosx/library/VLCLibraryModel.h \
@@ -240,6 +242,7 @@ libmacosx_plugin_la_XIB_SOURCES = \
gui/macosx/UI/LogMessageWindow.xib \
gui/macosx/UI/MainMenu.xib \
gui/macosx/UI/VLCLibraryWindow.xib \
+ gui/macosx/UI/VLCLibraryFolderManagementWindow.xib \
gui/macosx/UI/VLCPlaylistMenu.xib \
gui/macosx/UI/VLCPlaylistTableCellView.xib \
gui/macosx/UI/VLCLibraryCollectionViewItem.xib \
diff --git a/modules/gui/macosx/UI/MainMenu.xib b/modules/gui/macosx/UI/MainMenu.xib
index e0bbe65f8b..ee8d623a61 100644
--- a/modules/gui/macosx/UI/MainMenu.xib
+++ b/modules/gui/macosx/UI/MainMenu.xib
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="17E139j" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
- <development version="7000" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCMainMenu">
@@ -115,6 +116,7 @@
<outlet property="screenMenu" destination="1015" id="l5t-0E-DfG"/>
<outlet property="select_all" destination="198" id="Is0-ct-CbR"/>
<outlet property="services" destination="1996" id="X3H-XI-xFK"/>
+ <outlet property="showLibraryFolders" destination="5413" id="Yfe-WM-WVa"/>
<outlet property="show_all" destination="150" id="XQ2-CW-0PI"/>
<outlet property="snapshot" destination="2249" id="6bO-HY-I3I"/>
<outlet property="stop" destination="5156" id="irh-Cr-vBT"/>
@@ -146,7 +148,6 @@
<outlet property="toggleEffectsButton" destination="5537" id="Gg8-nl-gzx"/>
<outlet property="toggleJumpButtons" destination="5240" id="53V-UC-536"/>
<outlet property="togglePlaymodeButtons" destination="5242" id="9TB-F7-ttT"/>
- <outlet property="toggleSidebar" destination="5413" id="cz7-Zr-1lC"/>
<outlet property="trackSynchronization" destination="4412" id="BHW-NJ-jbd"/>
<outlet property="videoMenu" destination="334" id="7Ri-Tc-yej"/>
<outlet property="videoeffects" destination="2390" id="fXe-JA-9GI"/>
@@ -386,10 +387,10 @@
<action selector="toggleEffectsButton:" target="-2" id="QSm-2E-Nlo"/>
</connections>
</menuItem>
- <menuItem title="Show Sidebar" id="5413">
+ <menuItem title="Show Library Folders..." id="5413">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
- <action selector="toggleSidebar:" target="-2" id="e7y-3l-ZUS"/>
+ <action selector="showLibraryFolders:" target="-2" id="7L9-pf-bP7"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5250"/>
diff --git a/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib b/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib
new file mode 100644
index 0000000000..580517ec65
--- /dev/null
+++ b/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib
@@ -0,0 +1,168 @@
+<?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" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryFolderManagementWindow">
+ <connections>
+ <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5" customClass="VLCLibraryFolderManagementWindow">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="196" y="240" width="638" height="375"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
+ <view key="contentView" id="se5-gp-TjO">
+ <rect key="frame" x="0.0" y="0.0" width="638" height="375"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cN4-CV-0ZY">
+ <rect key="frame" x="0.0" y="40" width="638" height="335"/>
+ <clipView key="contentView" id="iBY-dM-gpy">
+ <rect key="frame" x="1" y="0.0" width="636" height="334"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="qUX-xV-r50" id="yXW-Oh-c8y">
+ <rect key="frame" x="0.0" y="0.0" width="874" height="309"/>
+ <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 editable="NO" width="116" minWidth="40" maxWidth="1000" id="yeU-u1-CWG">
+ <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" alignment="left" id="i4B-9b-CSN">
+ <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"/>
+ </tableColumn>
+ <tableColumn editable="NO" width="116" minWidth="40" maxWidth="1000" id="Bs6-l7-T2R">
+ <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" alignment="left" title="Text Cell" id="s5u-MH-82l">
+ <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"/>
+ </tableColumn>
+ <tableColumn editable="NO" width="116" minWidth="40" maxWidth="1000" id="MyB-sf-7Zj">
+ <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" alignment="left" title="Text Cell" id="BTa-z6-tCC">
+ <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"/>
+ </tableColumn>
+ <tableColumn editable="NO" width="514" minWidth="40" maxWidth="1000" id="oY3-Hl-Pyi">
+ <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" alignment="left" id="rue-hK-UWM" customClass="NSPathComponentCell">
+ <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"/>
+ </tableColumn>
+ </tableColumns>
+ <connections>
+ <outlet property="dataSource" destination="F0z-JX-Cv5" id="8f8-Oz-6wF"/>
+ <outlet property="delegate" destination="F0z-JX-Cv5" id="p5g-fz-zBe"/>
+ </connections>
+ </tableView>
+ </subviews>
+ </clipView>
+ <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="AbQ-Qa-KFB">
+ <rect key="frame" x="1" y="318" width="636" height="16"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="wbF-0g-t3S">
+ <rect key="frame" x="224" y="17" width="15" height="102"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ <tableHeaderView key="headerView" id="qUX-xV-r50">
+ <rect key="frame" x="0.0" y="0.0" width="874" height="25"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </tableHeaderView>
+ </scrollView>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="M6Q-FK-KFM">
+ <rect key="frame" x="4" y="3" width="117" height="32"/>
+ <buttonCell key="cell" type="push" title="Add Folder..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="dz7-Ho-opb">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="addFolder:" target="F0z-JX-Cv5" id="ESX-mj-rsH"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TXg-4i-ifD">
+ <rect key="frame" x="121" y="3" width="131" height="32"/>
+ <buttonCell key="cell" type="push" title="Remove Folder" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ntF-De-N3a">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="removeFolder:" target="F0z-JX-Cv5" id="0va-hY-kub"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7YE-Q5-Ga6">
+ <rect key="frame" x="252" y="3" width="64" height="32"/>
+ <buttonCell key="cell" type="push" title="Ban" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="aeQ-5m-txD">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="banFolder:" target="F0z-JX-Cv5" id="hwx-lv-G4o"/>
+ </connections>
+ </button>
+ </subviews>
+ <constraints>
+ <constraint firstItem="TXg-4i-ifD" firstAttribute="leading" secondItem="M6Q-FK-KFM" secondAttribute="trailing" constant="12" id="3Aa-O9-FDM"/>
+ <constraint firstAttribute="trailing" secondItem="cN4-CV-0ZY" secondAttribute="trailing" id="9fQ-kS-fVl"/>
+ <constraint firstAttribute="bottom" secondItem="cN4-CV-0ZY" secondAttribute="bottom" constant="40" id="JcK-pt-MPl"/>
+ <constraint firstAttribute="bottom" secondItem="M6Q-FK-KFM" secondAttribute="bottom" constant="10" id="QBc-i9-VOn"/>
+ <constraint firstItem="TXg-4i-ifD" firstAttribute="centerY" secondItem="7YE-Q5-Ga6" secondAttribute="centerY" id="a1p-pU-qbP"/>
+ <constraint firstItem="M6Q-FK-KFM" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="10" id="aaN-ZG-9yy"/>
+ <constraint firstItem="7YE-Q5-Ga6" firstAttribute="leading" secondItem="TXg-4i-ifD" secondAttribute="trailing" constant="12" id="f4V-bp-uA6"/>
+ <constraint firstItem="cN4-CV-0ZY" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="jtK-jp-ohZ"/>
+ <constraint firstItem="M6Q-FK-KFM" firstAttribute="centerY" secondItem="TXg-4i-ifD" secondAttribute="centerY" id="lIc-z2-MZT"/>
+ <constraint firstItem="cN4-CV-0ZY" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="xqp-sF-QJZ"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="addFolderButton" destination="M6Q-FK-KFM" id="kjf-Yh-hL2"/>
+ <outlet property="banFolderButton" destination="7YE-Q5-Ga6" id="2Ef-2r-gFE"/>
+ <outlet property="bannedTableColumn" destination="MyB-sf-7Zj" id="ViU-oo-A7U"/>
+ <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+ <outlet property="libraryFolderTableView" destination="yXW-Oh-c8y" id="pKb-oj-bkV"/>
+ <outlet property="nameTableColumn" destination="yeU-u1-CWG" id="Dxp-QO-oXu"/>
+ <outlet property="pathTableColumn" destination="oY3-Hl-Pyi" id="fZs-RB-NLB"/>
+ <outlet property="presentTableColumn" destination="Bs6-l7-T2R" id="BLH-Ag-kYm"/>
+ <outlet property="removeFolderButton" destination="TXg-4i-ifD" id="h1S-AS-JhG"/>
+ </connections>
+ <point key="canvasLocation" x="60" y="199.5"/>
+ </window>
+ </objects>
+</document>
diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
index 0da62b8fa7..7bf3cb1bdd 100644
--- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
+++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
@@ -68,6 +68,9 @@ NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier";
- (void)mediaItemUpdated:(NSNotification *)aNotification
{
VLCMediaLibraryMediaItem *updatedMediaItem = aNotification.object;
+ if (updatedMediaItem == nil || _representedMediaItem == nil) {
+ return;
+ }
if (updatedMediaItem.libraryID == _representedMediaItem.libraryID) {
[self updateRepresentation];
}
diff --git a/modules/gui/macosx/library/VLCLibraryController.h b/modules/gui/macosx/library/VLCLibraryController.h
index a3fada8079..06c0b2cf86 100644
--- a/modules/gui/macosx/library/VLCLibraryController.h
+++ b/modules/gui/macosx/library/VLCLibraryController.h
@@ -35,6 +35,11 @@ NS_ASSUME_NONNULL_BEGIN
- (void)showItemAtIndexPathInFinder:(NSIndexPath *)indexPath;
- (int)attemptToGenerateThumbnailForMediaItem:(VLCMediaLibraryMediaItem *)mediaItem;
+- (int)addFolderWithFileURL:(NSURL *)fileURL;
+- (int)banFolderWithFileURL:(NSURL *)fileURL;
+- (int)unbanFolderWithFileURL:(NSURL *)fileURL;
+- (int)removeFolderWithFileURL:(NSURL *)fileURL;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/library/VLCLibraryController.m b/modules/gui/macosx/library/VLCLibraryController.m
index 01ed5f42ab..fb81ede9e8 100644
--- a/modules/gui/macosx/library/VLCLibraryController.m
+++ b/modules/gui/macosx/library/VLCLibraryController.m
@@ -126,4 +126,26 @@
return vlc_ml_media_generate_thumbnail(_p_libraryInstance, mediaItem.libraryID);
}
+#pragma mark - folder management
+
+- (int)addFolderWithFileURL:(NSURL *)fileURL
+{
+ return vlc_ml_add_folder(_p_libraryInstance, [[fileURL absoluteString] UTF8String]);
+}
+
+- (int)banFolderWithFileURL:(NSURL *)fileURL
+{
+ return vlc_ml_ban_folder(_p_libraryInstance, [[fileURL absoluteString] UTF8String]);
+}
+
+- (int)unbanFolderWithFileURL:(NSURL *)fileURL
+{
+ return vlc_ml_unban_folder(_p_libraryInstance, [[fileURL absoluteString] UTF8String]);
+}
+
+- (int)removeFolderWithFileURL:(NSURL *)fileURL
+{
+ return vlc_ml_remove_folder(_p_libraryInstance, [[fileURL absoluteString] UTF8String]);
+}
+
@end
diff --git a/modules/gui/macosx/library/VLCLibraryFolderManagementWindow.h b/modules/gui/macosx/library/VLCLibraryFolderManagementWindow.h
new file mode 100644
index 0000000000..4bf8e3d486
--- /dev/null
+++ b/modules/gui/macosx/library/VLCLibraryFolderManagementWindow.h
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * VLCLibraryFolderManagementWindow.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
+
+ at interface VLCLibraryFolderManagementWindowController : NSWindowController
+
+ at end
+
+ at interface VLCLibraryFolderManagementWindow : NSWindow <NSTableViewDelegate, NSTableViewDataSource>
+
+ at property (readwrite, weak) IBOutlet NSTableView *libraryFolderTableView;
+ at property (readwrite, weak) IBOutlet NSTableColumn *nameTableColumn;
+ at property (readwrite, weak) IBOutlet NSTableColumn *pathTableColumn;
+ at property (readwrite, weak) IBOutlet NSTableColumn *presentTableColumn;
+ at property (readwrite, weak) IBOutlet NSTableColumn *bannedTableColumn;
+ at property (readwrite, weak) IBOutlet NSButton *addFolderButton;
+ at property (readwrite, weak) IBOutlet NSButton *removeFolderButton;
+ at property (readwrite, weak) IBOutlet NSButton *banFolderButton;
+
+- (IBAction)addFolder:(id)sender;
+- (IBAction)removeFolder:(id)sender;
+- (IBAction)banFolder:(id)sender;
+
+ at end
+
+NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/library/VLCLibraryFolderManagementWindow.m b/modules/gui/macosx/library/VLCLibraryFolderManagementWindow.m
new file mode 100644
index 0000000000..84c7b54459
--- /dev/null
+++ b/modules/gui/macosx/library/VLCLibraryFolderManagementWindow.m
@@ -0,0 +1,154 @@
+/*****************************************************************************
+ * VLCLibraryFolderManagementWindow.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 "VLCLibraryFolderManagementWindow.h"
+
+#import "main/VLCMain.h"
+#import "library/VLCLibraryController.h"
+#import "library/VLCLibraryModel.h"
+#import "library/VLCLibraryDataTypes.h"
+#import "extensions/NSString+Helpers.h"
+
+ at implementation VLCLibraryFolderManagementWindowController
+
+- (void)windowDidLoad {
+ [super windowDidLoad];
+
+ VLCLibraryFolderManagementWindow *window = (VLCLibraryFolderManagementWindow *)self.window;
+ [window setTitle:_NS("Media Library")];
+ [window.addFolderButton setTitle:_NS("Add Folder...")];
+ [window.banFolderButton setTitle:_NS("Ban Folder")];
+ [window.removeFolderButton setTitle:_NS("Remove Folder")];
+ [window.nameTableColumn setTitle:_NS("Name")];
+ [window.presentTableColumn setTitle:_NS("Present")];
+ [window.bannedTableColumn setTitle:_NS("Banned")];
+ [window.pathTableColumn setTitle:_NS("Location")];
+}
+
+ at end
+
+ at interface VLCLibraryFolderManagementWindow ()
+{
+ NSArray *_cachedFolderList;
+ VLCLibraryController *_libraryController;
+}
+ at end
+
+ at implementation VLCLibraryFolderManagementWindow
+
+- (instancetype)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)style backing:(NSBackingStoreType)backingStoreType defer:(BOOL)flag
+{
+ self = [super initWithContentRect:contentRect styleMask:style backing:backingStoreType defer:flag];
+ if (self) {
+ _libraryController = [[VLCMain sharedInstance] libraryController];
+ }
+ return self;
+}
+
+- (void)awakeFromNib
+{
+ self.banFolderButton.enabled = self.removeFolderButton.enabled = NO;
+}
+
+- (void)makeKeyAndOrderFront:(id)sender
+{
+ [super makeKeyAndOrderFront:sender];
+ [self.libraryFolderTableView reloadData];
+}
+
+- (IBAction)addFolder:(id)sender
+{
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+ [openPanel setTitle:_NS("Add Folder")];
+ [openPanel setCanChooseFiles:NO];
+ [openPanel setCanChooseDirectories:YES];
+ [openPanel setAllowsMultipleSelection:YES];
+
+ NSModalResponse returnValue = [openPanel runModal];
+
+ if (returnValue == NSModalResponseOK) {
+ NSArray *URLs = [openPanel URLs];
+ NSUInteger count = [URLs count];
+ for (NSUInteger i = 0; i < count ; i++) {
+ NSURL *url = URLs[i];
+ [_libraryController addFolderWithFileURL:url];
+ }
+
+ [self.libraryFolderTableView reloadData];
+ }
+}
+
+- (IBAction)banFolder:(id)sender
+{
+ VLCMediaLibraryEntryPoint *entryPoint = _cachedFolderList[self.libraryFolderTableView.selectedRow];
+ if (entryPoint.isBanned) {
+ [_libraryController unbanFolderWithFileURL:[NSURL URLWithString:entryPoint.MRL]];
+ } else {
+ [_libraryController banFolderWithFileURL:[NSURL URLWithString:entryPoint.MRL]];
+ }
+
+ [self.libraryFolderTableView reloadData];
+}
+
+- (IBAction)removeFolder:(id)sender
+{
+ VLCMediaLibraryEntryPoint *entryPoint = _cachedFolderList[self.libraryFolderTableView.selectedRow];
+ [_libraryController removeFolderWithFileURL:[NSURL URLWithString:entryPoint.MRL]];
+
+ [self.libraryFolderTableView reloadData];
+}
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
+{
+ if (!_cachedFolderList) {
+ _cachedFolderList = [[_libraryController libraryModel] listOfMonitoredFolders];
+ }
+ return _cachedFolderList.count;
+}
+
+- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+{
+ VLCMediaLibraryEntryPoint *entryPoint = _cachedFolderList[row];
+ if (tableColumn == self.nameTableColumn) {
+ return [entryPoint.MRL lastPathComponent];
+ } else if (tableColumn == self.presentTableColumn) {
+ return entryPoint.isPresent ? @"✔" : @"✘";
+ } else if (tableColumn == self.bannedTableColumn) {
+ return entryPoint.isBanned ? @"✔" : @"✘";
+ } else {
+ return entryPoint.MRL;
+ }
+}
+
+- (void)tableViewSelectionDidChange:(NSNotification *)notification
+{
+ NSInteger selectedRow = self.libraryFolderTableView.selectedRow;
+ if (selectedRow == -1) {
+ self.banFolderButton.enabled = self.removeFolderButton.enabled = NO;
+ return;
+ }
+ self.banFolderButton.enabled = self.removeFolderButton.enabled = YES;
+ VLCMediaLibraryEntryPoint *entryPoint = _cachedFolderList[selectedRow];
+ [self.banFolderButton setTitle:entryPoint.isBanned ? _NS("Unban Folder") : _NS("Ban Folder")];
+}
+
+ at end
diff --git a/modules/gui/macosx/library/VLCLibraryModel.h b/modules/gui/macosx/library/VLCLibraryModel.h
index 7ff90a31a2..4bb13f9128 100644
--- a/modules/gui/macosx/library/VLCLibraryModel.h
+++ b/modules/gui/macosx/library/VLCLibraryModel.h
@@ -32,6 +32,7 @@ typedef NS_ENUM(NSInteger, VLCLibraryMode) {
};
@class VLCMediaLibraryMediaItem;
+ at class VLCMediaLibraryEntryPoint;
extern NSString *VLCLibraryModelAudioMediaListUpdated;
extern NSString *VLCLibraryModelVideoMediaListUpdated;
@@ -51,6 +52,8 @@ extern NSString *VLCLibraryModelMediaItemUpdated;
- (nullable VLCMediaLibraryMediaItem *)mediaItemAtIndexPath:(NSIndexPath *)index;
+ at property (readonly) NSArray <VLCMediaLibraryEntryPoint *> *listOfMonitoredFolders;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/library/VLCLibraryModel.m b/modules/gui/macosx/library/VLCLibraryModel.m
index a21d38c3d4..35c8c8fbb6 100644
--- a/modules/gui/macosx/library/VLCLibraryModel.m
+++ b/modules/gui/macosx/library/VLCLibraryModel.m
@@ -22,6 +22,7 @@
#import "VLCLibraryModel.h"
+#import "main/VLCMain.h"
#import "library/VLCLibraryDataTypes.h"
NSString *VLCLibraryModelAudioMediaListUpdated = @"VLCLibraryModelAudioMediaListUpdated";
@@ -190,4 +191,25 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
return _cachedVideoMedia;
}
+- (NSArray<VLCMediaLibraryEntryPoint *> *)listOfMonitoredFolders
+{
+ vlc_ml_entry_point_list_t *pp_entrypoints;
+ int ret = vlc_ml_list_folder(_p_mediaLibrary, &pp_entrypoints);
+ if (ret != VLC_SUCCESS) {
+ msg_Err(getIntf(), "failed to retrieve list of monitored library folders (%i)", ret);
+ return @[];
+ }
+
+ NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithCapacity:pp_entrypoints->i_nb_items];
+ for (size_t x = 0; x < pp_entrypoints->i_nb_items; x++) {
+ VLCMediaLibraryEntryPoint *entryPoint = [[VLCMediaLibraryEntryPoint alloc] initWithEntryPoint:&pp_entrypoints->p_items[x]];
+ if (entryPoint) {
+ [mutableArray addObject:entryPoint];
+ }
+ }
+
+ vlc_ml_entry_point_list_release(pp_entrypoints);
+ return [mutableArray copy];
+}
+
@end
diff --git a/modules/gui/macosx/menus/VLCMainMenu.h b/modules/gui/macosx/menus/VLCMainMenu.h
index 57050e67aa..b7091c7bde 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.h
+++ b/modules/gui/macosx/menus/VLCMainMenu.h
@@ -66,7 +66,7 @@
@property (readwrite, weak) IBOutlet NSMenuItem *toggleJumpButtons;
@property (readwrite, weak) IBOutlet NSMenuItem *togglePlaymodeButtons;
@property (readwrite, weak) IBOutlet NSMenuItem *toggleEffectsButton;
- at property (readwrite, weak) IBOutlet NSMenuItem *toggleSidebar;
+ at property (readwrite, weak) IBOutlet NSMenuItem *showLibraryFolders;
@property (readwrite, weak) IBOutlet NSMenu *playlistTableColumnsMenu;
@property (readwrite, weak) IBOutlet NSMenuItem *playlistTableColumns;
@@ -212,7 +212,6 @@
- (void)releaseRepresentedObjects:(NSMenu *)the_menu;
- (void)setRateControlsEnabled:(BOOL)b_enabled;
-- (void)updateSidebarMenuItem:(BOOL)show;
- (IBAction)openAddonManager:(id)sender;
@@ -226,7 +225,7 @@
- (IBAction)toggleEffectsButton:(id)sender;
- (IBAction)toggleJumpButtons:(id)sender;
- (IBAction)togglePlaymodeButtons:(id)sender;
-- (IBAction)toggleSidebar:(id)sender;
+- (IBAction)showLibraryFolders:(id)sender;
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index 0614248d7d..49ab9dc053 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -27,6 +27,7 @@
#import "extensions/NSScreen+VLCAdditions.h"
#import "library/VLCLibraryWindow.h"
+#import "library/VLCLibraryFolderManagementWindow.h"
#import "menus/renderers/VLCRendererMenuController.h"
@@ -91,6 +92,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
VLCRendererMenuController *_rendererMenuController;
VLCPlaylistController *_playlistController;
VLCPlayerController *_playerController;
+ VLCLibraryFolderManagementWindowController *_libraryFoldersController;
NSTimer *_cancelRendererDiscoveryTimer;
NSMenu *_playlistTableColumnsContextMenu;
@@ -366,7 +368,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[_togglePlaymodeButtons setState: var_InheritBool(getIntf(), "macosx-show-playmode-buttons")];
[_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")];
[_toggleEffectsButton setState: var_InheritBool(getIntf(), "macosx-show-effects-button")];
- [_toggleSidebar setTitle: _NS("Show Sidebar")];
+ [_showLibraryFolders setTitle: _NS("Show Library Folders...")];
[_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[_controlsMenu setTitle: _NS("Playback")];
@@ -760,14 +762,12 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[_togglePlaymodeButtons setState: b_value];
}
-- (IBAction)toggleSidebar:(id)sender
+- (IBAction)showLibraryFolders:(id)sender
{
- // FIXME: remove this method as it is no longer needed
-}
-
-- (void)updateSidebarMenuItem:(BOOL)show;
-{
- [_toggleSidebar setState:show];
+ if (!_libraryFoldersController) {
+ _libraryFoldersController = [[VLCLibraryFolderManagementWindowController alloc] initWithWindowNibName:@"VLCLibraryFolderManagementWindow"];
+ }
+ [_libraryFoldersController showWindow:sender];
}
#pragma mark - Playback
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 596134165d..532066fed1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -472,6 +472,8 @@ modules/gui/macosx/library/VLCLibraryDataSource.h
modules/gui/macosx/library/VLCLibraryDataSource.m
modules/gui/macosx/library/VLCLibraryDataTypes.h
modules/gui/macosx/library/VLCLibraryDataTypes.m
+modules/gui/macosx/library/VLCLibraryFolderManagementWindow.h
+modules/gui/macosx/library/VLCLibraryFolderManagementWindow.m
modules/gui/macosx/library/VLCLibraryMenuController.h
modules/gui/macosx/library/VLCLibraryMenuController.m
modules/gui/macosx/library/VLCLibraryModel.h
More information about the vlc-commits
mailing list