[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Add method in VLCLibraryController to reload media library folder

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Jun 25 20:04:06 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
1a017d24 by Claudio Cambra at 2023-06-25T19:48:38+00:00
macosx: Add method in VLCLibraryController to reload media library folder

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
df55dcf2 by Claudio Cambra at 2023-06-25T19:48:38+00:00
macosx: Add method to reload library folder in VLCSimplePrefsController

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
ea4b5b05 by Claudio Cambra at 2023-06-25T19:48:38+00:00
macosx: Setup media folder reload button in VLCSimplePrefsController

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
9f592a3b by Claudio Cambra at 2023-06-25T19:48:38+00:00
macosx: Add reload button in SimplePreferences XIB

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
5c6ccf76 by Claudio Cambra at 2023-06-25T19:48:38+00:00
macosx: Fix initial state of mediaLibraryReloadFolderButton

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


5 changed files:

- modules/gui/macosx/UI/SimplePreferences.xib
- modules/gui/macosx/library/VLCLibraryController.h
- modules/gui/macosx/library/VLCLibraryController.m
- modules/gui/macosx/preferences/VLCSimplePrefsController.h
- modules/gui/macosx/preferences/VLCSimplePrefsController.m


Changes:

=====================================
modules/gui/macosx/UI/SimplePreferences.xib
=====================================
@@ -86,6 +86,7 @@
                 <outlet property="mediaLibraryNameTableColumn" destination="wAS-Qh-rAS" id="2ei-jH-cvI"/>
                 <outlet property="mediaLibraryPathTableColumn" destination="QBg-HT-Vvb" id="4AQ-jb-HLf"/>
                 <outlet property="mediaLibraryPresentTableColumn" destination="kVl-Wj-9vm" id="cmW-Jn-uIQ"/>
+                <outlet property="mediaLibraryReloadFolderButton" destination="hvb-5M-TTc" id="HV0-Gc-GLE"/>
                 <outlet property="mediaLibraryRemoveFolderButton" destination="WnC-lv-27l" id="EUb-bH-L13"/>
                 <outlet property="mediaLibraryView" destination="eei-wi-f9H" id="Oh4-jV-mOk"/>
                 <outlet property="osdView" destination="2523" id="d1o-FZ-hXa"/>
@@ -2429,14 +2430,23 @@ Gw
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                 </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hvb-5M-TTc">
+                    <rect key="frame" x="342" y="13" width="118" height="32"/>
+                    <buttonCell key="cell" type="push" title="Reload Folder" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="xjS-NX-mCc">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
+                </button>
             </subviews>
             <constraints>
                 <constraint firstItem="AsR-G7-aHo" firstAttribute="leading" secondItem="eei-wi-f9H" secondAttribute="leading" constant="20" id="3jm-3z-Xs7"/>
-                <constraint firstAttribute="trailing" secondItem="Yvu-g1-fLU" secondAttribute="trailing" constant="250" id="5LJ-Ux-874"/>
                 <constraint firstItem="AsR-G7-aHo" firstAttribute="centerY" secondItem="WnC-lv-27l" secondAttribute="centerY" id="Aj1-lf-d90"/>
+                <constraint firstItem="hvb-5M-TTc" firstAttribute="centerY" secondItem="Yvu-g1-fLU" secondAttribute="centerY" id="DcL-IY-5xh"/>
+                <constraint firstItem="hvb-5M-TTc" firstAttribute="leading" secondItem="Yvu-g1-fLU" secondAttribute="trailing" constant="12" id="GTh-Ae-evd"/>
                 <constraint firstItem="WnC-lv-27l" firstAttribute="centerY" secondItem="Yvu-g1-fLU" secondAttribute="centerY" id="Rsb-k3-Qtk"/>
                 <constraint firstItem="gbE-0a-hRm" firstAttribute="top" secondItem="eei-wi-f9H" secondAttribute="top" constant="60" id="VDk-uE-IWD"/>
                 <constraint firstItem="Yvu-g1-fLU" firstAttribute="leading" secondItem="WnC-lv-27l" secondAttribute="trailing" constant="12" id="YM9-u7-u7m"/>
+                <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="hvb-5M-TTc" secondAttribute="trailing" constant="20" id="dM1-kS-zcj"/>
                 <constraint firstItem="gbE-0a-hRm" firstAttribute="leading" secondItem="eei-wi-f9H" secondAttribute="leading" constant="20" id="ggB-z1-D2B"/>
                 <constraint firstAttribute="bottom" secondItem="AsR-G7-aHo" secondAttribute="bottom" constant="20" id="hxw-eg-Qfw"/>
                 <constraint firstAttribute="trailing" secondItem="gbE-0a-hRm" secondAttribute="trailing" constant="20" id="n4Z-j5-Mtr"/>


=====================================
modules/gui/macosx/library/VLCLibraryController.h
=====================================
@@ -40,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
 - (int)banFolderWithFileURL:(NSURL *)fileURL;
 - (int)unbanFolderWithFileURL:(NSURL *)fileURL;
 - (int)removeFolderWithFileURL:(NSURL *)fileURL;
+- (int)reloadFolderWithFileURL:(NSURL *)fileURL;
 
 - (int)clearHistory;
 


=====================================
modules/gui/macosx/library/VLCLibraryController.m
=====================================
@@ -164,6 +164,17 @@
     return vlc_ml_remove_folder(_p_libraryInstance, [[fileURL absoluteString] UTF8String]);
 }
 
+- (int)reloadFolderWithFileURL:(NSURL *)fileURL
+{
+    if (!_p_libraryInstance) {
+        return VLC_EACCES;
+    }
+    if (!fileURL) {
+        return VLC_EINVAL;
+    }
+    return vlc_ml_reload_folder(_p_libraryInstance, fileURL.absoluteString.UTF8String);
+}
+
 - (int)clearHistory
 {
     if (!_p_libraryInstance) {


=====================================
modules/gui/macosx/preferences/VLCSimplePrefsController.h
=====================================
@@ -69,6 +69,7 @@
 @property (readwrite, weak) IBOutlet NSButton *mediaLibraryAddFolderButton;
 @property (readwrite, weak) IBOutlet NSButton *mediaLibraryRemoveFolderButton;
 @property (readwrite, weak) IBOutlet NSButton *mediaLibraryBanFolderButton;
+ at property (readwrite, weak) IBOutlet NSButton *mediaLibraryReloadFolderButton;
 
 // hotkeys pane
 @property (readwrite, strong) IBOutlet NSView *hotkeysView;


=====================================
modules/gui/macosx/preferences/VLCSimplePrefsController.m
=====================================
@@ -146,10 +146,13 @@ static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Id
 @property (readwrite, weak) NSTableColumn *bannedTableColumn;
 @property (readwrite, weak) NSButton *removeFolderButton;
 @property (readwrite, weak) NSButton *banFolderButton;
+ at property (readwrite, weak) NSButton *reloadFolderButton;
 
 - (IBAction)addFolder:(id)sender;
 - (IBAction)removeFolder:(id)sender;
 - (IBAction)banFolder:(id)sender;
+- (IBAction)reloadFolder:(id)sender;
+
 @end
 
 @interface VLCSimplePrefsController() <NSToolbarDelegate, NSWindowDelegate>
@@ -232,7 +235,7 @@ static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Id
 - (void)setupMediaLibraryControlInterface
 {
     _mediaLibraryManagementController = [[VLCMediaLibraryFolderManagementController alloc] init];
-    _mediaLibraryBanFolderButton.enabled = _mediaLibraryRemoveFolderButton.enabled = NO;
+    _mediaLibraryBanFolderButton.enabled = _mediaLibraryRemoveFolderButton.enabled = _mediaLibraryReloadFolderButton.enabled = NO;
 
     _mediaLibraryFolderTableView.delegate = _mediaLibraryManagementController;
     _mediaLibraryFolderTableView.dataSource = _mediaLibraryManagementController;
@@ -244,6 +247,7 @@ static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Id
     _mediaLibraryManagementController.pathTableColumn = _mediaLibraryPathTableColumn;
     _mediaLibraryManagementController.removeFolderButton = _mediaLibraryRemoveFolderButton;
     _mediaLibraryManagementController.banFolderButton = _mediaLibraryBanFolderButton;
+    _mediaLibraryManagementController.reloadFolderButton = _mediaLibraryReloadFolderButton;
 
     _mediaLibraryAddFolderButton.target = _mediaLibraryManagementController;
     _mediaLibraryAddFolderButton.action = @selector(addFolder:);
@@ -251,6 +255,8 @@ static NSString* VLCHotkeysSettingToolbarIdentifier = @"Hotkeys Settings Item Id
     _mediaLibraryBanFolderButton.action = @selector(banFolder:);
     _mediaLibraryRemoveFolderButton.target = _mediaLibraryManagementController;
     _mediaLibraryRemoveFolderButton.action = @selector(removeFolder:);
+    _mediaLibraryReloadFolderButton.target = _mediaLibraryManagementController;
+    _mediaLibraryReloadFolderButton.action = @selector(reloadFolder:);
 }
 
 #define CreateToolbarItem(name, desc, img, sel) \
@@ -456,6 +462,7 @@ create_toolbar_item(NSString *itemIdent, NSString *name, NSString *desc, NSStrin
     [_mediaLibraryAddFolderButton setTitle:_NS("Add Folder...")];
     [_mediaLibraryBanFolderButton setTitle:_NS("Ban Folder")];
     [_mediaLibraryRemoveFolderButton setTitle:_NS("Remove Folder")];
+    [_mediaLibraryReloadFolderButton setTitle:_NS("Reload Folder")];
     [_mediaLibraryNameTableColumn setTitle:_NS("Name")];
     [_mediaLibraryPresentTableColumn setTitle:_NS("Present")];
     [_mediaLibraryBannedTableColumn setTitle:_NS("Banned")];
@@ -1594,6 +1601,12 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
     [_libraryController removeFolderWithFileURL:[NSURL URLWithString:entryPoint.MRL]];
 }
 
+- (IBAction)reloadFolder:(id)sender
+{
+    VLCMediaLibraryEntryPoint * const entryPoint = _libraryModel.listOfMonitoredFolders[self.libraryFolderTableView.selectedRow];
+    [_libraryController reloadFolderWithFileURL:[NSURL URLWithString:entryPoint.MRL]];
+}
+
 - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
 {
     return _libraryModel.listOfMonitoredFolders.count;
@@ -1617,11 +1630,11 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
 {
     NSInteger selectedRow = self.libraryFolderTableView.selectedRow;
     if (selectedRow == -1) {
-        self.banFolderButton.enabled = self.removeFolderButton.enabled = NO;
+        self.banFolderButton.enabled = self.removeFolderButton.enabled = self.reloadFolderButton.enabled = NO;
         return;
     }
-    self.banFolderButton.enabled = self.removeFolderButton.enabled = YES;
-    VLCMediaLibraryEntryPoint *entryPoint = _libraryModel.listOfMonitoredFolders[selectedRow];
+    self.banFolderButton.enabled = self.removeFolderButton.enabled = self.reloadFolderButton.enabled = YES;
+    VLCMediaLibraryEntryPoint * const entryPoint = _libraryModel.listOfMonitoredFolders[selectedRow];
     [self.banFolderButton setTitle:entryPoint.isBanned ? _NS("Unban Folder") : _NS("Ban Folder")];
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dfe555a96c8cbbdad1b55c090486936b640268b6...5c6ccf768bf5be8e57e5219ea569a7821926a4bb

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/dfe555a96c8cbbdad1b55c090486936b640268b6...5c6ccf768bf5be8e57e5219ea569a7821926a4bb
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list