mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
dim and don't color cells of disabled files in file table
This commit is contained in:
parent
ca6f1934b3
commit
6423d795c6
3 changed files with 29 additions and 19 deletions
|
@ -89,20 +89,25 @@
|
|||
[[self image] drawInRect: [self imageRectForBounds: cellFrame] fromRect: NSZeroRect operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
|
||||
BOOL highlighted = [self isHighlighted] && [[self highlightColorWithFrame: cellFrame inView: controlView]
|
||||
isEqual: [NSColor alternateSelectedControlColor]];
|
||||
Torrent * torrent = [[[[self controlView] window] windowController] selectedTorrent];
|
||||
|
||||
//title
|
||||
NSAttributedString * titleString = [self attributedTitleWithColor: highlighted ? [NSColor whiteColor]
|
||||
: [NSColor controlTextColor]];
|
||||
NSColor * specialColor = nil;
|
||||
if ([self isHighlighted]
|
||||
&& [[self highlightColorWithFrame: cellFrame inView: controlView] isEqual: [NSColor alternateSelectedControlColor]])
|
||||
specialColor = [NSColor whiteColor];
|
||||
else if ([torrent checkForFiles: [[self objectValue] objectForKey: @"Indexes"]] == NSOffState)
|
||||
specialColor = [NSColor disabledControlTextColor];
|
||||
else;
|
||||
|
||||
NSAttributedString * titleString = [self attributedTitleWithColor: specialColor ? specialColor : [NSColor controlTextColor]];
|
||||
NSRect titleRect = [self rectForTitleWithString: titleString inBounds: cellFrame];
|
||||
[titleString drawInRect: titleRect];
|
||||
|
||||
//status
|
||||
if (![[[self objectValue] objectForKey: @"IsFolder"] boolValue])
|
||||
{
|
||||
NSAttributedString * statusString = [self attributedStatusWithColor: highlighted ? [NSColor whiteColor]
|
||||
: [NSColor darkGrayColor]];
|
||||
NSAttributedString * statusString = [self attributedStatusWithColor: specialColor ? specialColor : [NSColor darkGrayColor]];
|
||||
NSRect statusRect = [self rectForStatusWithString: statusString inBounds: cellFrame];
|
||||
[statusString drawInRect: statusRect];
|
||||
}
|
||||
|
|
|
@ -112,23 +112,28 @@
|
|||
{
|
||||
NSDictionary * item = [self itemAtRow: row];
|
||||
Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent];
|
||||
NSIndexSet * indexes = [item objectForKey: @"Indexes"];
|
||||
|
||||
|
||||
NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
|
||||
int count = [priorities count];
|
||||
if (count == 0)
|
||||
if ([torrent checkForFiles: indexes] == NSOffState)
|
||||
[fNormalColor set];
|
||||
else if (count > 1)
|
||||
[fMixedPriorityColor set];
|
||||
else
|
||||
{
|
||||
int priority = [[priorities anyObject] intValue];
|
||||
if (priority == TR_PRI_LOW)
|
||||
[fLowPriorityColor set];
|
||||
else if (priority == TR_PRI_HIGH)
|
||||
[fHighPriorityColor set];
|
||||
else
|
||||
NSSet * priorities = [torrent filePrioritiesForIndexes: indexes];
|
||||
int count = [priorities count];
|
||||
if (count == 0)
|
||||
[fNormalColor set];
|
||||
else if (count > 1)
|
||||
[fMixedPriorityColor 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];
|
||||
}
|
||||
}
|
||||
|
||||
NSRect rect = [self rectOfRow: row];
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
for (i = [indexes lastIndex]; i != NSNotFound; i = [indexes indexLessThanIndex: i])
|
||||
{
|
||||
item = [[menu itemAtIndex:i] retain];
|
||||
[menu removeItem: item];
|
||||
[menu removeItemAtIndex: i];
|
||||
[self insertItem: item atIndex: bottom];
|
||||
[item release];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue