diff --git a/macosx/FileOutlineView.h b/macosx/FileOutlineView.h index 505896ee2..07ab1684f 100644 --- a/macosx/FileOutlineView.h +++ b/macosx/FileOutlineView.h @@ -26,7 +26,7 @@ @interface FileOutlineView : NSOutlineView { - NSColor * fNormalColor, * fHighPriorityColor, * fLowPriorityColor; + NSColor * fNormalColor, * fHighPriorityColor, * fLowPriorityColor, * fMixedPriorityColor; int fHoverRow; } diff --git a/macosx/FileOutlineView.m b/macosx/FileOutlineView.m index 9ee4b69bc..731024a28 100644 --- a/macosx/FileOutlineView.m +++ b/macosx/FileOutlineView.m @@ -38,8 +38,9 @@ [self setIndentationPerLevel: 14.0]; fNormalColor = [self backgroundColor]; - fHighPriorityColor = [[NSColor colorWithCalibratedRed: 0.678 green: 0.937 blue: 0.451 alpha: 1.0] retain]; - fLowPriorityColor = [[NSColor colorWithCalibratedRed: 0.984 green: 0.878 blue: 0.431 alpha: 1.0] retain]; + fHighPriorityColor = [[NSColor colorWithCalibratedRed: 0.8588 green: 0.9961 blue: 0.8311 alpha: 1.0] retain]; + fLowPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 0.9529 blue: 0.8078 alpha: 1.0] retain]; + fMixedPriorityColor = [[NSColor colorWithCalibratedRed: 0.9216 green: 0.9059 blue: 1.0 alpha: 1.0] retain]; fHoverRow = -1; } @@ -48,6 +49,7 @@ { [fHighPriorityColor release]; [fLowPriorityColor release]; + [fMixedPriorityColor release]; [super dealloc]; } @@ -105,23 +107,22 @@ NSDictionary * item = [self itemAtRow: row]; Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent]; - if ([[item objectForKey: @"IsFolder"] boolValue]) + + NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]]; + int count = [priorities count]; + if (count == 0) [fNormalColor set]; + else if (count > 1) + [fMixedPriorityColor set]; else { - NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]]; - if ([priorities count] == 0) - [fNormalColor set]; + int priority = [[priorities anyObject] intValue]; + if (priority == TR_PRI_LOW) + [fLowPriorityColor set]; + else if (priority == TR_PRI_HIGH) + [fHighPriorityColor set]; else - { - int priority = [[priorities anyObject] intValue]; - if (priority == TR_PRI_LOW) - [fLowPriorityColor set]; - else if (priority == TR_PRI_HIGH) - [fHighPriorityColor set]; - else - [fNormalColor set]; - } + [fNormalColor set]; } NSRect rect = [self rectOfRow: row]; @@ -136,39 +137,39 @@ - (void) drawRect: (NSRect) r { [super drawRect: r]; - + NSDictionary * item; NSIndexSet * indexSet; - int i, priority; + int i, count, priority; Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent]; for (i = 0; i < [self numberOfRows]; i++) { if ([self isRowSelected: i]) { item = [self itemAtRow: i]; - if (![[item objectForKey: @"IsFolder"] boolValue]) - { - NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]]; - if ([priorities count] == 1) - { - int priority = [[priorities anyObject] intValue]; - if (priority == TR_PRI_LOW) - [fLowPriorityColor set]; - else if (priority == TR_PRI_HIGH) - [fHighPriorityColor set]; - else - continue; - - NSRect rect = [self rectOfRow: i]; - float width = 14.0; - rect.origin.y += (rect.size.height - width) * 0.5; - rect.origin.x += 3.0; - rect.size.width = width; - rect.size.height = width; - - [[NSBezierPath bezierPathWithOvalInRect: rect] fill]; - } - } + if ([[item objectForKey: @"IsFolder"] boolValue]) + continue; + + NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]]; + if ([priorities count] != 1) + continue; + + priority = [[priorities anyObject] intValue]; + if (priority == TR_PRI_LOW) + [fLowPriorityColor set]; + else if (priority == TR_PRI_HIGH) + [fHighPriorityColor set]; + else + continue; + + NSRect rect = [self rectOfRow: i]; + float width = 14.0; + rect.origin.y += (rect.size.height - width) * 0.5; + rect.origin.x += 3.0; + rect.size.width = width; + rect.size.height = width; + + [[NSBezierPath bezierPathWithOvalInRect: rect] fill]; } } } diff --git a/macosx/FilePriorityCell.m b/macosx/FilePriorityCell.m index 95484358b..e5cda6041 100644 --- a/macosx/FilePriorityCell.m +++ b/macosx/FilePriorityCell.m @@ -34,8 +34,6 @@ //only for when clicking manually Torrent * torrent = [[[[self controlView] window] windowController] selectedTorrent]; NSIndexSet * indexes = [fItem objectForKey: @"Indexes"]; - if (![torrent canChangeDownloadCheckForFiles: indexes]) - return; int priority; if (segment == 0) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 73662b594..968879950 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1303,6 +1303,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 - (BOOL) canChangeDownloadCheckForFile: (int) index { + if (!fileStat) + [self updateFileStat]; + return [self fileCount] > 1 && fileStat[index].completionStatus != TR_CP_COMPLETE; }