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]) {
if (queueItem.queued) {
[queueList removeObjectAtIndex:queueItem.queuePosition];
queueItem.queued = NO;
queueItem.queuePosition = -1;
[queueList removeObject:queueItem];
[store queueRemovePlaylistItems:@[[NSNumber numberWithInteger:[queueItem index]]]];
} else {
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);
}
// Refresh entire row to refresh tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
for (PlaylistEntry * queueItem in queueList) {
if (![[self selectedObjects] containsObject:queueItem])
[refreshSet addIndex:[queueItem index]];
}
int i = 0;
for (PlaylistEntry *cur in queueList) {
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 {
@ -1148,14 +1153,19 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[refreshSet addIndex:[queueItem index]];
}
// Refresh entire row to refresh tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
for (PlaylistEntry *queueItem in queueList)
{
[refreshSet addIndex:[queueItem index]];
}
int i = 0;
for (PlaylistEntry *cur in queueList) {
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 {
@ -1169,18 +1179,21 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[queueList addObject:queueItem];
[store queueAddItem:[queueItem index]];
[refreshSet addIndex:[queueItem index]];
}
// Refresh entire row to refresh tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
for (PlaylistEntry *queueItem in queueList)
{
[refreshSet addIndex:[queueItem index]];
}
int i = 0;
for (PlaylistEntry *cur in queueList) {
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 {