[vlc-commits] [Git][videolan/vlc][master] macos: update play queue rows incrementally

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Sep 15 06:24:58 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
045b9204 by Serhii Bykov at 2026-09-15T06:13:30+00:00
macos: update play queue rows incrementally

- - - - -


3 changed files:

- modules/gui/macosx/playqueue/VLCPlayQueueController.m
- modules/gui/macosx/playqueue/VLCPlayQueueDataSource.h
- modules/gui/macosx/playqueue/VLCPlayQueueDataSource.m


Changes:

=====================================
modules/gui/macosx/playqueue/VLCPlayQueueController.m
=====================================
@@ -324,7 +324,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
 {
     [_playQueueModel addItems:items atIndex:insertionIndex count:numberOfItems];
 
-    [_playQueueDataSource playQueueUpdated];
+    [_playQueueDataSource playQueueItemsInsertedAtIndex:insertionIndex count:numberOfItems];
     [_defaultNotificationCenter postNotificationName:VLCPlayQueueItemsAdded object:self];
 }
 
@@ -356,7 +356,7 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
     }
     vlc_playlist_Unlock(_p_playlist);
 
-    [_playQueueDataSource playQueueUpdated];
+    [_playQueueDataSource playQueueItemsUpdatedAtIndex:firstUpdatedIndex count:numberOfItems];
 
 }
 


=====================================
modules/gui/macosx/playqueue/VLCPlayQueueDataSource.h
=====================================
@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite, nonatomic) NSTextField *counterTextField;
 
 - (void)prepareForUse;
+- (void)playQueueItemsInsertedAtIndex:(NSUInteger)index count:(NSUInteger)count;
+- (void)playQueueItemsUpdatedAtIndex:(NSUInteger)index count:(NSUInteger)count;
 - (void)playQueueUpdated;
 - (void)scrollToCurrentPlayQueueItem;
 


=====================================
modules/gui/macosx/playqueue/VLCPlayQueueDataSource.m
=====================================
@@ -110,6 +110,35 @@ static NSString *VLCPlayQueueCellIdentifier = @"VLCPlayQueueCellIdentifier";
     [_tableView reloadData];
 }
 
+- (void)playQueueItemsInsertedAtIndex:(NSUInteger)index count:(NSUInteger)count
+{
+    const NSUInteger numberOfPlayQueueItems = _playQueueModel.numberOfPlayQueueItems;
+    self.dragDropView.hidden = numberOfPlayQueueItems > 0 ? YES : NO;
+    self.counterTextField.stringValue = [NSString stringWithFormat:@"%lu", numberOfPlayQueueItems];
+
+    if (count == 0) {
+        return;
+    }
+
+    NSAssert(index <= numberOfPlayQueueItems - count,
+             @"Inserted play queue rows must be within the model bounds");
+    NSIndexSet * const indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(index, count)];
+    [_tableView insertRowsAtIndexes:indexes withAnimation:NSTableViewAnimationEffectNone];
+}
+
+- (void)playQueueItemsUpdatedAtIndex:(NSUInteger)index count:(NSUInteger)count
+{
+    if (count == 0) {
+        return;
+    }
+
+    const NSUInteger numberOfPlayQueueItems = _playQueueModel.numberOfPlayQueueItems;
+    NSAssert(index <= numberOfPlayQueueItems - count,
+             @"Updated play queue rows must be within the model bounds");
+    NSIndexSet * const indexes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(index, count)];
+    [_tableView reloadDataForRowIndexes:indexes columnIndexes:[NSIndexSet indexSetWithIndex:0]];
+}
+
 - (id<NSPasteboardWriting>)tableView:(NSTableView *)tableView pasteboardWriterForRow:(NSInteger)row
 {
     NSPasteboardItem * const pboardItem = [[NSPasteboardItem alloc] init];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/045b920433197a9e8cbcf5a6566f6475ea3edbb8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/045b920433197a9e8cbcf5a6566f6475ea3edbb8
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list