Playlist View: Correctly refresh playlist tooltips when queue is manipulated

CQTexperiment
Christopher Snowhill 2022-01-20 17:54:02 -08:00
parent 7cc4ee22f7
commit 973664f3b3
1 changed files with 31 additions and 18 deletions

View File

@ -1103,11 +1103,11 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
for (PlaylistEntry *queueItem in [self selectedObjects]) { for (PlaylistEntry *queueItem in [self selectedObjects]) {
if (queueItem.queued) { if (queueItem.queued) {
[queueList removeObjectAtIndex:queueItem.queuePosition];
queueItem.queued = NO; queueItem.queued = NO;
queueItem.queuePosition = -1; queueItem.queuePosition = -1;
[queueList removeObject:queueItem];
[store queueRemovePlaylistItems:@[[NSNumber numberWithInteger:[queueItem index]]]]; [store queueRemovePlaylistItems:@[[NSNumber numberWithInteger:[queueItem index]]]];
} else { } else {
queueItem.queued = YES; queueItem.queued = YES;
@ -1123,14 +1123,19 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
DLog(@"TOGGLE QUEUED: %i", queueItem.queued); DLog(@"TOGGLE QUEUED: %i", queueItem.queued);
} }
// Refresh entire row to refresh tooltips for (PlaylistEntry * queueItem in queueList) {
unsigned long columns = [[self.tableView tableColumns] count]; if (![[self selectedObjects] containsObject:queueItem])
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]]; [refreshSet addIndex:[queueItem index]];
}
int i = 0; int i = 0;
for (PlaylistEntry *cur in queueList) { for (PlaylistEntry *cur in queueList) {
cur.queuePosition = i++; cur.queuePosition = i++;
} }
// Refresh entire row to refresh tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
} }
- (IBAction)removeFromQueue:(id)sender { - (IBAction)removeFromQueue:(id)sender {
@ -1148,14 +1153,19 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[refreshSet addIndex:[queueItem index]]; [refreshSet addIndex:[queueItem index]];
} }
// Refresh entire row to refresh tooltips for (PlaylistEntry *queueItem in queueList)
unsigned long columns = [[self.tableView tableColumns] count]; {
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]]; [refreshSet addIndex:[queueItem index]];
}
int i = 0; int i = 0;
for (PlaylistEntry *cur in queueList) { for (PlaylistEntry *cur in queueList) {
cur.queuePosition = i++; cur.queuePosition = i++;
} }
// Refresh entire row to refresh tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
} }
- (IBAction)addToQueue:(id)sender { - (IBAction)addToQueue:(id)sender {
@ -1169,18 +1179,21 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[queueList addObject:queueItem]; [queueList addObject:queueItem];
[store queueAddItem:[queueItem index]]; [store queueAddItem:[queueItem index]];
[refreshSet addIndex:[queueItem index]];
} }
// Refresh entire row to refresh tooltips for (PlaylistEntry *queueItem in queueList)
unsigned long columns = [[self.tableView tableColumns] count]; {
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]]; [refreshSet addIndex:[queueItem index]];
}
int i = 0; int i = 0;
for (PlaylistEntry *cur in queueList) { for (PlaylistEntry *cur in queueList) {
cur.queuePosition = i++; cur.queuePosition = i++;
} }
// Refresh entire row to refresh tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
} }
- (IBAction)stopAfterCurrent:(id)sender { - (IBAction)stopAfterCurrent:(id)sender {