Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (40)
Showing
with 505 additions and 30 deletions
......@@ -83,6 +83,8 @@
531343E72A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m */; };
531343EA2A8E8965007AEDFA /* VLCLibrarySegment.m in Sources */ = {isa = PBXBuildFile; fileRef = 531343E92A8E8965007AEDFA /* VLCLibrarySegment.m */; };
5317FE04294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5317FE03294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m */; };
532572032C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 532572022C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.m */; };
532572062C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 532572052C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.m */; };
5325C57D29302E6800B2B63A /* VLCLibraryAudioViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5325C57B29302E6800B2B63A /* VLCLibraryAudioViewController.m */; };
533B5D2C29CF94C6003DE887 /* VLCBookmarksTableViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 533B5D2B29CF94C6003DE887 /* VLCBookmarksTableViewDataSource.m */; };
534E73E229D2EDB1009982DE /* VLCBookmarksTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 534E73E129D2EDB1009982DE /* VLCBookmarksTableViewDelegate.m */; };
......@@ -294,6 +296,10 @@
5317FE02294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryCollectionViewDelegate.h; sourceTree = "<group>"; };
5317FE03294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryCollectionViewDelegate.m; sourceTree = "<group>"; };
5317FE05294E8D1A001702F0 /* VLCLibraryCollectionViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryCollectionViewDataSource.h; sourceTree = "<group>"; };
532572012C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibrarySegmentBookmarkedLocation.h; sourceTree = "<group>"; };
532572022C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibrarySegmentBookmarkedLocation.m; sourceTree = "<group>"; };
532572042C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryWindowNavigationSidebarOutlineView.h; sourceTree = "<group>"; };
532572052C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryWindowNavigationSidebarOutlineView.m; sourceTree = "<group>"; };
5325C57B29302E6800B2B63A /* VLCLibraryAudioViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioViewController.m; sourceTree = "<group>"; };
5325C57C29302E6800B2B63A /* VLCLibraryAudioViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioViewController.h; sourceTree = "<group>"; };
533B5D2A29CF94C6003DE887 /* VLCBookmarksTableViewDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCBookmarksTableViewDataSource.h; sourceTree = "<group>"; };
......@@ -1310,6 +1316,8 @@
530771F32AEBBD5B00656D3D /* VLCLibraryRepresentedItem.m */,
531343E82A8E8965007AEDFA /* VLCLibrarySegment.h */,
531343E92A8E8965007AEDFA /* VLCLibrarySegment.m */,
532572012C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.h */,
532572022C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.m */,
7D22A8F222BC14F80063ECD2 /* VLCLibrarySortingMenuController.h */,
7D22A8F322BC14F80063ECD2 /* VLCLibrarySortingMenuController.m */,
7DE2F0452282D5D10040DD0A /* VLCLibraryTableCellView.h */,
......@@ -1328,6 +1336,8 @@
7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */,
5362550B293FD639005D64FA /* VLCLibraryWindowController.h */,
5362550C293FD639005D64FA /* VLCLibraryWindowController.m */,
532572042C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.h */,
532572052C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.m */,
531343E52A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.h */,
531343E62A8E7B94007AEDFA /* VLCLibraryWindowNavigationSidebarViewController.m */,
5352B37429E149AC0011CE03 /* VLCLibraryWindowPersistentPreferences.h */,
......@@ -2102,6 +2112,7 @@
1CCC89012078A3D500E5626F /* Preferences.xib in Sources */,
7DC21A7422049A6600F98A02 /* VLCOpenInputMetadata.m in Sources */,
1CCC89022078A3D500E5626F /* ResumeDialog.xib in Sources */,
532572032C3D79D80068DEC3 /* VLCLibrarySegmentBookmarkedLocation.m in Sources */,
7DE7232E22A51F8D00D72616 /* VLCPositionFormatter.m in Sources */,
534E8E3A29A06325009503F8 /* VLCMainVideoViewController.m in Sources */,
536EFBF5295BCB8300F4CB13 /* VLCLibraryUIUnits.m in Sources */,
......@@ -2131,6 +2142,7 @@
1C3113EF1E508C7600D4DD76 /* VLCRendererDiscovery.m in Sources */,
1C3113F11E508C7600D4DD76 /* VLCRendererItem.m in Sources */,
1C3113F31E508C7600D4DD76 /* VLCRendererMenuController.m in Sources */,
532572062C3EF3710068DEC3 /* VLCLibraryWindowNavigationSidebarOutlineView.m in Sources */,
53ED473629CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m in Sources */,
6B4D50931E7979CB004479B5 /* VLCSimplePrefsWindow.m in Sources */,
6B397C4F216C8EB200403ED0 /* NSString+Helpers.m in Sources */,
......
......@@ -135,6 +135,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibraryRepresentedItem.m \
gui/macosx/library/VLCLibrarySegment.h \
gui/macosx/library/VLCLibrarySegment.m \
gui/macosx/library/VLCLibrarySegmentBookmarkedLocation.h \
gui/macosx/library/VLCLibrarySegmentBookmarkedLocation.m \
gui/macosx/library/VLCLibrarySortingMenuController.h \
gui/macosx/library/VLCLibrarySortingMenuController.m \
gui/macosx/library/VLCLibraryTableView.h \
......@@ -153,6 +155,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibraryWindow.m \
gui/macosx/library/VLCLibraryWindowController.h \
gui/macosx/library/VLCLibraryWindowController.m \
gui/macosx/library/VLCLibraryWindowNavigationSidebarOutlineView.h \
gui/macosx/library/VLCLibraryWindowNavigationSidebarOutlineView.m \
gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.h \
gui/macosx/library/VLCLibraryWindowNavigationSidebarViewController.m \
gui/macosx/library/VLCLibraryWindowPersistentPreferences.h \
......
......@@ -7,7 +7,7 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryWindowNavigationSidebarViewController">
<connections>
<outlet property="outlineView" destination="7u8-Zm-gnd" id="sWc-AU-MVa"/>
<outlet property="outlineView" destination="7u8-Zm-gnd" id="8i3-ld-a1v"/>
<outlet property="view" destination="gLW-4d-ery" id="lAX-ki-W5E"/>
</connections>
</customObject>
......@@ -20,7 +20,7 @@
<rect key="frame" x="0.0" y="0.0" width="52" height="408"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="13" outlineTableColumn="0BA-rc-l73" id="7u8-Zm-gnd">
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" floatsGroupRows="NO" indentationPerLevel="13" outlineTableColumn="0BA-rc-l73" id="7u8-Zm-gnd" customClass="VLCLibraryWindowNavigationSidebarOutlineView">
<rect key="frame" x="0.0" y="0.0" width="52" height="408"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="0.0"/>
......
......@@ -28,6 +28,7 @@
#import "library/VLCInputItem.h"
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryRepresentedItem.h"
#import "library/VLCLibrarySegment.h"
#import "main/VLCMain.h"
......@@ -45,6 +46,7 @@
NSHashTable<NSMenuItem*> *_mediaItemRequiringMenuItems;
NSHashTable<NSMenuItem*> *_inputItemRequiringMenuItems;
NSHashTable<NSMenuItem*> *_localInputItemRequiringMenuItems;
NSHashTable<NSMenuItem*> *_folderInputItemRequiringMenuItems;
}
@end
......@@ -79,8 +81,22 @@
NSMenuItem *informationItem = [[NSMenuItem alloc] initWithTitle:_NS("Information...") action:@selector(showInformation:) keyEquivalent:@""];
informationItem.target = self;
NSMenuItem * const bookmarkItem = [[NSMenuItem alloc] initWithTitle:_NS("Toggle Bookmark")
action:@selector(toggleBookmark:)
keyEquivalent:@""];
bookmarkItem.target = self;
_libraryMenu = [[NSMenu alloc] initWithTitle:@""];
[_libraryMenu addMenuItemsFromArray:@[playItem, appendItem, revealItem, deleteItem, informationItem, [NSMenuItem separatorItem], addItem]];
[_libraryMenu addMenuItemsFromArray:@[
playItem,
appendItem,
bookmarkItem,
revealItem,
deleteItem,
informationItem,
[NSMenuItem separatorItem],
addItem
]];
_mediaItemRequiringMenuItems = [NSHashTable weakObjectsHashTable];
[_mediaItemRequiringMenuItems addObject:playItem];
......@@ -96,12 +112,15 @@
_localInputItemRequiringMenuItems = [NSHashTable weakObjectsHashTable];
[_localInputItemRequiringMenuItems addObject:revealItem];
[_localInputItemRequiringMenuItems addObject:deleteItem];
_folderInputItemRequiringMenuItems = [NSHashTable weakObjectsHashTable];
[_folderInputItemRequiringMenuItems addObject:bookmarkItem];
}
- (void)menuItems:(NSHashTable<NSMenuItem*>*)menuItems
setHidden:(BOOL)hidden
{
for (NSMenuItem *menuItem in menuItems) {
for (NSMenuItem * const menuItem in menuItems) {
menuItem.hidden = hidden;
}
}
......@@ -111,6 +130,7 @@
if (self.representedItems != nil && self.representedItems.count > 0) {
[self menuItems:_inputItemRequiringMenuItems setHidden:YES];
[self menuItems:_localInputItemRequiringMenuItems setHidden:YES];
[self menuItems:_folderInputItemRequiringMenuItems setHidden:YES];
[self menuItems:_mediaItemRequiringMenuItems setHidden:NO];
} else if (_representedInputItems != nil && self.representedInputItems.count > 0) {
[self menuItems:_mediaItemRequiringMenuItems setHidden:YES];
......@@ -123,7 +143,13 @@
break;
}
}
const BOOL bookmarkable =
self.representedInputItems.count == 1 &&
self.representedInputItems.firstObject.inputType == ITEM_TYPE_DIRECTORY;
[self menuItems:_localInputItemRequiringMenuItems setHidden:anyStream];
[self menuItems:_folderInputItemRequiringMenuItems setHidden:!bookmarkable];
}
}
......@@ -234,6 +260,30 @@
[_informationWindowController toggleWindow:sender];
}
- (void)toggleBookmark:(id)sender
{
if (self.representedInputItems == nil ||
self.representedInputItems.count != 1 ||
self.representedInputItems.firstObject.inputType != ITEM_TYPE_DIRECTORY) {
return;
}
VLCInputItem * const inputItem = self.representedInputItems.firstObject;
NSString * const inputItemMRL = inputItem.MRL;
NSUserDefaults * const defaults = NSUserDefaults.standardUserDefaults;
NSMutableArray<NSString *> * const bookmarkedLocations =
[defaults stringArrayForKey:VLCLibraryBookmarkedLocationsKey].mutableCopy;
NSNotificationCenter * const defaultCenter = NSNotificationCenter.defaultCenter;
if ([bookmarkedLocations containsObject:inputItemMRL]) {
[bookmarkedLocations removeObject:inputItemMRL];
} else {
[bookmarkedLocations addObject:inputItemMRL];
}
[defaults setObject:bookmarkedLocations forKey:VLCLibraryBookmarkedLocationsKey];
[defaultCenter postNotificationName:VLCLibraryBookmarkedLocationsChanged object:inputItemMRL];
}
- (void)setRepresentedItems:(NSArray<VLCLibraryRepresentedItem *> *)items
{
_representedItems = items;
......@@ -241,7 +291,7 @@
[self updateMenuItems];
}
- (void)setRepresentedInputItem:(NSArray<VLCInputItem *> *)representedInputItems
- (void)setRepresentedInputItems:(NSArray<VLCInputItem *> *)representedInputItems
{
_representedInputItems = representedInputItems;
_representedItems = nil;
......
/*****************************************************************************
* VLCLibrarySection.h: MacOS X interface module
* VLCLibrarySegment.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2023 VLC authors and VideoLAN
*
......@@ -24,6 +24,9 @@
NS_ASSUME_NONNULL_BEGIN
extern NSString * const VLCLibraryBookmarkedLocationsKey;
extern NSString * const VLCLibraryBookmarkedLocationsChanged;
typedef NS_ENUM(NSInteger, VLCLibrarySegmentType) {
VLCLibraryLowSentinelSegment = -1,
VLCLibraryHomeSegment,
......@@ -34,6 +37,7 @@ typedef NS_ENUM(NSInteger, VLCLibrarySegmentType) {
VLCLibrarySongsMusicSubSegment,
VLCLibraryGenresMusicSubSegment,
VLCLibraryBrowseSegment,
VLCLibraryBrowseBookmarkedLocationSubSegment,
VLCLibraryStreamsSegment,
VLCLibraryHighSentinelSegment,
};
......
/*****************************************************************************
* VLCLibrarySection.h: MacOS X interface module
* VLCLibrarySegment.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2023 VLC authors and VideoLAN
*
......@@ -24,6 +24,15 @@
#import "extensions/NSString+Helpers.h"
#import "library/VLCInputItem.h"
#import "library/VLCLibrarySegmentBookmarkedLocation.h"
#import "library/media-source/VLCMediaSource.h"
#import "library/media-source/VLCMediaSourceProvider.h"
NSString * const VLCLibraryBookmarkedLocationsKey = @"VLCLibraryBookmarkedLocations";
NSString * const VLCLibraryBookmarkedLocationsChanged = @"VLCLibraryBookmarkedLocationsChanged";
@implementation VLCLibrarySegment
+ (NSArray<VLCLibrarySegment *> *)librarySegments
......@@ -49,10 +58,18 @@
- (instancetype)initWithRepresentedObject:(id)modelObject
{
NSNumber * const segmentNumber = (NSNumber *)modelObject;
const NSInteger segmentValue = segmentNumber.integerValue;
NSAssert(segmentNumber != nil &&
segmentValue > VLCLibraryLowSentinelSegment &&
NSInteger segmentValue = VLCLibraryLowSentinelSegment;
if ([modelObject isKindOfClass:NSNumber.class]) {
NSNumber * const segmentNumber = (NSNumber *)modelObject;
segmentValue = segmentNumber.integerValue;
} else if ([modelObject isKindOfClass:VLCLibrarySegmentBookmarkedLocation.class]) {
VLCLibrarySegmentBookmarkedLocation * const descriptor =
(VLCLibrarySegmentBookmarkedLocation *)modelObject;
segmentValue = descriptor.segmentType;
}
NSAssert(segmentValue > VLCLibraryLowSentinelSegment &&
segmentValue < VLCLibraryHighSentinelSegment,
@"VLCLibrarySegment represented object must be a library segment type value!");
......@@ -66,16 +83,58 @@
- (NSArray<NSTreeNode *> *)childNodes
{
if (self.segmentType != VLCLibraryMusicSegment) {
return nil;
if (self.segmentType == VLCLibraryMusicSegment) {
return @[
[VLCLibrarySegment segmentWithSegmentType:VLCLibraryArtistsMusicSubSegment],
[VLCLibrarySegment segmentWithSegmentType:VLCLibraryAlbumsMusicSubSegment],
[VLCLibrarySegment segmentWithSegmentType:VLCLibrarySongsMusicSubSegment],
[VLCLibrarySegment segmentWithSegmentType:VLCLibraryGenresMusicSubSegment],
];
} else if (self.segmentType == VLCLibraryBrowseSegment) {
NSUserDefaults * const defaults = NSUserDefaults.standardUserDefaults;
NSArray<NSString *> *bookmarkedLocations =
[defaults stringArrayForKey:VLCLibraryBookmarkedLocationsKey];
if (bookmarkedLocations == nil) {
bookmarkedLocations = self.defaultBookmarkedLocations;
[defaults setObject:bookmarkedLocations forKey:VLCLibraryBookmarkedLocationsKey];
}
const VLCLibrarySegmentType segmentType = VLCLibraryBrowseBookmarkedLocationSubSegment;
NSMutableArray<NSTreeNode *> * const bookmarkedLocationNodes = NSMutableArray.array;
for (NSString * const locationMrl in bookmarkedLocations) {
NSString * const locationName = locationMrl.lastPathComponent;
VLCLibrarySegmentBookmarkedLocation * const descriptor =
[[VLCLibrarySegmentBookmarkedLocation alloc] initWithSegmentType:segmentType
name:locationName
mrl:locationMrl];
VLCLibrarySegment * const node =
[VLCLibrarySegment treeNodeWithRepresentedObject:descriptor];
[bookmarkedLocationNodes addObject:node];
}
return bookmarkedLocationNodes.copy;
}
return @[
[VLCLibrarySegment segmentWithSegmentType:VLCLibraryArtistsMusicSubSegment],
[VLCLibrarySegment segmentWithSegmentType:VLCLibraryAlbumsMusicSubSegment],
[VLCLibrarySegment segmentWithSegmentType:VLCLibrarySongsMusicSubSegment],
[VLCLibrarySegment segmentWithSegmentType:VLCLibraryGenresMusicSubSegment],
];
return nil;
}
- (NSArray<NSString *> *)defaultBookmarkedLocations
{
NSMutableArray<NSString *> * const locationMrls = NSMutableArray.array;
NSArray<VLCMediaSource *> * const localMediaSources =
VLCMediaSourceProvider.listOfLocalMediaSources;
for (VLCMediaSource * const mediaSource in localMediaSources) {
VLCInputNode * const rootNode = mediaSource.rootNode;
[mediaSource preparseInputNodeWithinTree:rootNode];
for (VLCInputNode * const node in rootNode.children) {
[locationMrls addObject:node.inputItem.MRL];
}
}
return locationMrls.copy;
}
- (NSInteger)childCount
......@@ -102,6 +161,8 @@
return _NS("Videos");
case VLCLibraryBrowseSegment:
return _NS("Browse");
case VLCLibraryBrowseBookmarkedLocationSubSegment:
NSAssert(true, @"displayStringForType should not be called for this segment type");
case VLCLibraryStreamsSegment:
return _NS("Streams");
case VLCLibraryLowSentinelSegment:
......@@ -126,6 +187,7 @@
case VLCLibraryVideoSegment:
return [NSImage imageNamed:@"sidebar-movie"];
case VLCLibraryBrowseSegment:
case VLCLibraryBrowseBookmarkedLocationSubSegment:
return [NSImage imageNamed:@"NSFolder"];
case VLCLibraryStreamsSegment:
return [NSImage imageNamed:@"NSActionTemplate"];
......@@ -163,6 +225,9 @@
case VLCLibraryBrowseSegment:
return [NSImage imageWithSystemSymbolName:@"folder"
accessibilityDescription:@"Browse icon"];
case VLCLibraryBrowseBookmarkedLocationSubSegment:
return [NSImage imageWithSystemSymbolName:@"folder"
accessibilityDescription:@"Bookmarked location icon"];
case VLCLibraryStreamsSegment:
return [NSImage imageWithSystemSymbolName:@"antenna.radiowaves.left.and.right"
accessibilityDescription:@"Streams icon"];
......@@ -190,7 +255,13 @@
- (void)updateSegmentTypeRepresentation
{
_displayString = [self displayStringForType:_segmentType];
if ([self.representedObject isKindOfClass:VLCLibrarySegmentBookmarkedLocation.class]) {
VLCLibrarySegmentBookmarkedLocation * const descriptor =
(VLCLibrarySegmentBookmarkedLocation *)self.representedObject;
_displayString = descriptor.name;
} else {
_displayString = [self displayStringForType:_segmentType];
}
_displayImage = [self iconForType:_segmentType];
}
......
/*****************************************************************************
* VLCLibrarySegmentBookmarkedLocation.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2024 VLC authors and VideoLAN
*
* Authors: Claudio Cambra <developer@claudiocambra.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "library/VLCLibrarySegment.h"
NS_ASSUME_NONNULL_BEGIN
@interface VLCLibrarySegmentBookmarkedLocation : NSObject
@property (readonly) VLCLibrarySegmentType segmentType;
@property (readonly) NSString *name;
@property (readonly) NSString *mrl;
- (instancetype)initWithSegmentType:(VLCLibrarySegmentType)segmentType
name:(NSString *)name
mrl:(NSString *)mrl;
@end
NS_ASSUME_NONNULL_END
/*****************************************************************************
* VLCLibrarySegmentBookmarkedLocation.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2024 VLC authors and VideoLAN
*
* Authors: Claudio Cambra <developer@claudiocambra.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCLibrarySegmentBookmarkedLocation.h"
@implementation VLCLibrarySegmentBookmarkedLocation
- (instancetype)initWithSegmentType:(VLCLibrarySegmentType)segmentType
name:(NSString *)name
mrl:(NSString *)mrl
{
self = [super init];
if (self) {
_segmentType = segmentType;
_name = name;
_mrl = mrl;
}
return self;
}
@end
......@@ -135,6 +135,7 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
- (void)clearFilterString;
- (void)presentLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem;
- (void)goToLocalFolderMrl:(NSString *)mrl;
- (IBAction)goToBrowseSection:(id)sender;
- (IBAction)sortLibrary:(id)sender;
......
......@@ -257,6 +257,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self showAudioLibrary];
break;
case VLCLibraryBrowseSegment:
case VLCLibraryBrowseBookmarkedLocationSubSegment:
case VLCLibraryStreamsSegment:
[self showMediaSourceLibrary];
break;
......@@ -309,6 +310,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
preferences.songsLibraryViewMode = _currentSelectedViewModeSegment;
break;
case VLCLibraryBrowseSegment:
case VLCLibraryBrowseBookmarkedLocationSubSegment:
preferences.browseLibraryViewMode = _currentSelectedViewModeSegment;
break;
case VLCLibraryStreamsSegment:
......@@ -389,6 +391,12 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
NSLog(@"Unknown kind of library item provided, cannot present library view for it: %@", libraryItem.displayString);
}
- (void)goToLocalFolderMrl:(NSString *)mrl
{
[self goToBrowseSection:self];
[self.libraryMediaSourceViewController presentLocalFolderMrl:mrl];
}
- (IBAction)sortLibrary:(id)sender
{
if (!_librarySortingMenuController) {
......
/*****************************************************************************
* VLCLibraryWindowNavigationSidebarOutlineView.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2024 VLC authors and VideoLAN
*
* Authors: Claudio Cambra <developer@claudiocambra.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface VLCLibraryWindowNavigationSidebarOutlineView : NSOutlineView
@end
NS_ASSUME_NONNULL_END
/*****************************************************************************
* VLCLibraryWindowNavigationSidebarOutlineView.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2024 VLC authors and VideoLAN
*
* Authors: Claudio Cambra <developer@claudiocambra.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCLibraryWindowNavigationSidebarOutlineView.h"
#import "extensions/NSString+Helpers.h"
#import "library/VLCLibrarySegment.h"
#import "library/VLCLibrarySegmentBookmarkedLocation.h"
@implementation VLCLibraryWindowNavigationSidebarOutlineView
- (NSMenu *)menuForEvent:(NSEvent *)event
{
const NSPoint location = [self convertPoint:event.locationInWindow fromView:nil];
const NSInteger row = [self rowAtPoint:location];
NSTreeNode * const node = [self itemAtRow:row];
VLCLibrarySegment * const segment = node.representedObject;
if ([segment.representedObject isKindOfClass:NSNumber.class]) {
return nil;
}
if ([segment.representedObject isKindOfClass:VLCLibrarySegmentBookmarkedLocation.class]) {
VLCLibrarySegmentBookmarkedLocation * const descriptor = segment.representedObject;
NSMenu * const bookmarkMenu = [[NSMenu alloc] initWithTitle:descriptor.name];
NSMenuItem * const removeBookmarkItem =
[[NSMenuItem alloc] initWithTitle:_NS("Remove Bookmark")
action:@selector(removeBookmark:)
keyEquivalent:@""];
removeBookmarkItem.representedObject = descriptor;
[bookmarkMenu addItem:removeBookmarkItem];
return bookmarkMenu;
}
return nil;
}
- (void)removeBookmark:(id)sender
{
NSMenuItem * const menuItem = sender;
NSParameterAssert(menuItem != nil);
VLCLibrarySegmentBookmarkedLocation * const descriptor = menuItem.representedObject;
NSParameterAssert(descriptor != nil);
NSString * const descriptorMrl = descriptor.mrl;
NSParameterAssert(descriptorMrl != nil);
NSUserDefaults * const defaults = NSUserDefaults.standardUserDefaults;
NSMutableArray<NSString *> * const bookmarkedLocations =
[defaults stringArrayForKey:VLCLibraryBookmarkedLocationsKey].mutableCopy;
[bookmarkedLocations removeObject:descriptorMrl];
[defaults setObject:bookmarkedLocations forKey:VLCLibraryBookmarkedLocationsKey];
NSNotificationCenter * const defaultCenter = NSNotificationCenter.defaultCenter;
[defaultCenter postNotificationName:VLCLibraryBookmarkedLocationsChanged object:descriptor];
}
@end
......@@ -25,6 +25,7 @@
NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryWindow;
@class VLCLibraryWindowNavigationSidebarOutlineView;
@class VLCLibrarySegment;
@interface VLCLibraryWindowNavigationSidebarViewController : NSViewController<NSOutlineViewDelegate>
......@@ -33,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly) NSArray<VLCLibrarySegment *> *segments;
@property (readonly) NSTreeController *treeController;
@property (readwrite, weak) IBOutlet NSOutlineView *outlineView;
@property (readwrite, weak) IBOutlet VLCLibraryWindowNavigationSidebarOutlineView *outlineView;
- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow;
- (void)selectSegment:(NSInteger)segmentType;
......
......@@ -23,11 +23,19 @@
#import "VLCLibraryWindowNavigationSidebarViewController.h"
#import "library/VLCLibraryWindow.h"
#import "library/VLCLibraryWindowNavigationSidebarOutlineView.h"
#import "library/VLCLibrarySegment.h"
#import "library/VLCLibrarySegmentBookmarkedLocation.h"
// This needs to match whatever identifier has been set in the library window XIB
static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCellIdentifier";
@interface VLCLibraryWindowNavigationSidebarViewController ()
@property BOOL ignoreSegmentSelectionChanges;
@end
@implementation VLCLibraryWindowNavigationSidebarViewController
- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow
......@@ -36,6 +44,7 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
if (self) {
_libraryWindow = libraryWindow;
_segments = VLCLibrarySegment.librarySegments;
_ignoreSegmentSelectionChanges = NO;
}
return self;
}
......@@ -61,6 +70,56 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
options:nil];
[_outlineView reloadData];
NSNotificationCenter * const defaultCenter = NSNotificationCenter.defaultCenter;
[defaultCenter addObserver:self
selector:@selector(bookmarkedLocationsChanged:)
name:VLCLibraryBookmarkedLocationsChanged
object:nil];
}
- (void)bookmarkedLocationsChanged:(NSNotification *)notification
{
const VLCLibrarySegmentType currentSegmentType = self.libraryWindow.librarySegmentType;
self.ignoreSegmentSelectionChanges = YES;
[self.treeController rearrangeObjects];
[self.outlineView reloadData];
NSTreeNode * const targetNode = [self nodeForSegmentType:currentSegmentType];
const NSInteger segmentIndex = [self.outlineView rowForItem:targetNode];
[self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:segmentIndex]
byExtendingSelection:NO];
self.ignoreSegmentSelectionChanges = NO;
}
- (NSTreeNode *)nodeForSegmentType:(VLCLibrarySegmentType)segmentType
{
NSArray<NSTreeNode *> *nodes = self.treeController.arrangedObjects.childNodes;
while (nodes.count != 0) {
NSMutableArray<NSTreeNode *> * const nextLevelNodes = NSMutableArray.array;
const NSInteger nodeIdx = [nodes indexOfObjectPassingTest:^BOOL(NSTreeNode * const obj,
NSUInteger idx,
BOOL * const stop) {
VLCLibrarySegment * const segment = obj.representedObject;
const BOOL matching = segment.segmentType == segmentType;
if (!matching) {
[nextLevelNodes addObjectsFromArray:obj.childNodes];
}
return matching;
}];
if (nodeIdx != NSNotFound) {
return nodes[nodeIdx];
}
nodes = nextLevelNodes.copy;
}
NSAssert(NO, @"Could not find node for segment type %ld", segmentType);
return nil;
}
- (void)selectSegment:(NSInteger)segmentType
......@@ -72,12 +131,16 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
VLCLibrarySegment * const segment = [VLCLibrarySegment segmentWithSegmentType:segmentType];
self.libraryWindow.librarySegmentType = segment.segmentType;
if (segmentType >= VLCLibraryMusicSegment) {
NSTreeNode * const itemNode = (NSTreeNode *)[_outlineView itemAtRow:VLCLibraryMusicSegment];
[self.outlineView expandItem:itemNode];
if (segmentType >= VLCLibraryMusicSegment && segmentType <= VLCLibraryGenresMusicSubSegment) {
[self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryMusicSegment]];
} else if (segmentType >= VLCLibraryBrowseSegment &&
segmentType <= VLCLibraryBrowseBookmarkedLocationSubSegment) {
[self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryBrowseSegment]];
}
[self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:segmentType]
NSTreeNode * const targetNode = [self nodeForSegmentType:segmentType];
const NSInteger segmentIndex = [self.outlineView rowForItem:targetNode];
[self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:segmentIndex]
byExtendingSelection:NO];
}
......@@ -103,18 +166,33 @@ static NSString * const VLCLibrarySegmentCellIdentifier = @"VLCLibrarySegmentCel
if (proposedSelectionIndexes.count == 0 || proposedSelectionIndexes.firstIndex != VLCLibraryMusicSegment) {
return proposedSelectionIndexes;
} else {
NSTreeNode * const itemNode = (NSTreeNode *)[_outlineView itemAtRow:VLCLibraryMusicSegment];
[self.outlineView expandItem:itemNode];
return [NSIndexSet indexSetWithIndex:VLCLibraryArtistsMusicSubSegment];
[self.outlineView expandItem:[self nodeForSegmentType:VLCLibraryMusicSegment]];
NSTreeNode * const artistsNode = [self nodeForSegmentType:VLCLibraryArtistsMusicSubSegment];
const NSInteger artistsIndex = [self.outlineView rowForItem:artistsNode];
return [NSIndexSet indexSetWithIndex:artistsIndex];
}
}
- (void)outlineViewSelectionDidChange:(NSNotification *)notification
{
if (self.ignoreSegmentSelectionChanges) {
return;
}
NSTreeNode * const node = (NSTreeNode *)[_outlineView itemAtRow:_outlineView.selectedRow];
NSParameterAssert(node != nil);
VLCLibrarySegment * const segment = (VLCLibrarySegment *)node.representedObject;
_libraryWindow.librarySegmentType = segment.segmentType;
NSObject * const representedObject = segment.representedObject;
NSParameterAssert(representedObject != nil);
if ([representedObject isKindOfClass:NSNumber.class]) {
self.libraryWindow.librarySegmentType = segment.segmentType;
} else if ([representedObject isKindOfClass:VLCLibrarySegmentBookmarkedLocation.class]) {
VLCLibrarySegmentBookmarkedLocation * const bookmarkedLocation =
(VLCLibrarySegmentBookmarkedLocation *)representedObject;
self.libraryWindow.librarySegmentType = bookmarkedLocation.segmentType;
[self.libraryWindow goToLocalFolderMrl:bookmarkedLocation.mrl];
}
}
@end
......@@ -169,6 +169,7 @@ NSString * const VLCLibraryWindowTrackingSeparatorToolbarItemIdentifier =
break;
case VLCLibraryBrowseSegment:
case VLCLibraryStreamsSegment:
case VLCLibraryBrowseBookmarkedLocationSubSegment:
[self setForwardsBackwardsToolbarItemsVisible:YES];
[self setSortOrderToolbarItemVisible:NO];
[self setLibrarySearchToolbarItemVisible:NO];
......
......@@ -51,6 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)presentBrowseView;
- (void)presentStreamsView;
- (void)presentLocalFolderMrl:(NSString *)mrl;
@end
......
......@@ -190,4 +190,10 @@
[_baseDataSource reloadViews];
}
- (void)presentLocalFolderMrl:(NSString *)mrl
{
[self presentBrowseView];
[self.baseDataSource presentLocalFolderMrl:mrl];
}
@end
......@@ -41,6 +41,8 @@ extern NSString *VLCMediaSourcePreparsingEnded;
andLibVLCInstance:(libvlc_int_t *)p_libvlcInstance
forCategory:(enum services_discovery_category_e)category;
- (instancetype)initMyFoldersMediaSourceWithLibVLCInstance:(libvlc_int_t *)p_libvlcInstance;
- (instancetype)initWithLocalFolderMrl:(NSString *)mrl
andLibVLCInstance:(libvlc_int_t *)p_libvlcInstance;
- (void)preparseInputNodeWithinTree:(VLCInputNode *)inputNode;
- (void)clearChildNodesForNode:(input_item_node_t*)inputNode;
......
......@@ -215,6 +215,51 @@ static const char *const myFoldersDescription = "My Folders";
return self;
}
- (instancetype)initWithLocalFolderMrl:(NSString *)mrl
andLibVLCInstance:(libvlc_int_t *)p_libvlcInstance
{
self = [super init];
if (self) {
_p_libvlcInstance = p_libvlcInstance;
_p_mediaSource = malloc(sizeof(vlc_media_source_t));
if (!_p_mediaSource) {
return self;
}
_p_mediaSource->description = myFoldersDescription;
_p_mediaSource->tree = calloc(1, sizeof(vlc_media_tree_t));
if (_p_mediaSource->tree == NULL) {
free(_p_mediaSource);
_p_mediaSource = NULL;
return self;
}
_category = SD_CAT_MYCOMPUTER;
NSFileManager * const fileManager = NSFileManager.defaultManager;
NSURL * const directoryUrl = [NSURL URLWithString:mrl];
BOOL mrlTargetIsDirectory = NO;
const BOOL mrlTargetExists = [fileManager fileExistsAtPath:directoryUrl.path
isDirectory:&mrlTargetIsDirectory];
if (!mrlTargetExists || !mrlTargetIsDirectory) {
return nil;
}
const char * const directoryPath = mrl.UTF8String;
const char * const directoryDesc = mrl.lastPathComponent.UTF8String;
input_item_t * const directoryItem = input_item_NewExt(directoryPath,
directoryDesc,
0,
ITEM_TYPE_DIRECTORY,
ITEM_LOCAL);
input_item_node_t * const directoryNode = input_item_node_Create(directoryItem);
_p_mediaSource->tree->root = *directoryNode;
}
return self;
}
- (void)dealloc
{
if (_p_mediaSource != NULL) {
......
......@@ -55,6 +55,8 @@ extern NSString * const VLCMediaSourceBaseDataSourceNodeChanged;
- (void)homeButtonAction:(id)sender;
- (void)pathControlAction:(id)sender;
- (void)presentLocalFolderMrl:(NSString *)mrl;
@end
NS_ASSUME_NONNULL_END