mirror of
https://github.com/transmission/transmission
synced 2025-02-22 14:10:34 +00:00
random trivial adjustments
This commit is contained in:
parent
90d612f9a9
commit
d6ad9238be
5 changed files with 22 additions and 22 deletions
|
@ -116,8 +116,9 @@
|
||||||
[stringShadow release];
|
[stringShadow release];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSRect badgeRect = NSZeroRect;
|
NSRect badgeRect;
|
||||||
badgeRect.size = [badge size];
|
badgeRect.size = [badge size];
|
||||||
|
badgeRect.origin.x = 0;
|
||||||
badgeRect.origin.y = height;
|
badgeRect.origin.y = height;
|
||||||
|
|
||||||
[badge drawInRect: badgeRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
|
[badge drawInRect: badgeRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0f];
|
||||||
|
|
|
@ -66,37 +66,37 @@ GroupsController * fGroupsInstance = nil;
|
||||||
NSMutableDictionary * red = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * red = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor redColor], @"Color",
|
[NSColor redColor], @"Color",
|
||||||
NSLocalizedString(@"Red", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Red", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 0], @"Index", nil];
|
[NSNumber numberWithInteger: 0], @"Index", nil];
|
||||||
|
|
||||||
NSMutableDictionary * orange = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * orange = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor orangeColor], @"Color",
|
[NSColor orangeColor], @"Color",
|
||||||
NSLocalizedString(@"Orange", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Orange", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 1], @"Index", nil];
|
[NSNumber numberWithInteger: 1], @"Index", nil];
|
||||||
|
|
||||||
NSMutableDictionary * yellow = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * yellow = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor yellowColor], @"Color",
|
[NSColor yellowColor], @"Color",
|
||||||
NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Yellow", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 2], @"Index", nil];
|
[NSNumber numberWithInteger: 2], @"Index", nil];
|
||||||
|
|
||||||
NSMutableDictionary * green = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * green = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor greenColor], @"Color",
|
[NSColor greenColor], @"Color",
|
||||||
NSLocalizedString(@"Green", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Green", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 3], @"Index", nil];
|
[NSNumber numberWithInteger: 3], @"Index", nil];
|
||||||
|
|
||||||
NSMutableDictionary * blue = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * blue = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor blueColor], @"Color",
|
[NSColor blueColor], @"Color",
|
||||||
NSLocalizedString(@"Blue", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Blue", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 4], @"Index", nil];
|
[NSNumber numberWithInteger: 4], @"Index", nil];
|
||||||
|
|
||||||
NSMutableDictionary * purple = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * purple = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor purpleColor], @"Color",
|
[NSColor purpleColor], @"Color",
|
||||||
NSLocalizedString(@"Purple", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Purple", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 5], @"Index", nil];
|
[NSNumber numberWithInteger: 5], @"Index", nil];
|
||||||
|
|
||||||
NSMutableDictionary * gray = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
NSMutableDictionary * gray = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSColor grayColor], @"Color",
|
[NSColor grayColor], @"Color",
|
||||||
NSLocalizedString(@"Gray", "Groups -> Name"), @"Name",
|
NSLocalizedString(@"Gray", "Groups -> Name"), @"Name",
|
||||||
[NSNumber numberWithInt: 6], @"Index", nil];
|
[NSNumber numberWithInteger: 6], @"Index", nil];
|
||||||
|
|
||||||
fGroups = [[NSMutableArray alloc] initWithObjects: red, orange, yellow, green, blue, purple, gray, nil];
|
fGroups = [[NSMutableArray alloc] initWithObjects: red, orange, yellow, green, blue, purple, gray, nil];
|
||||||
[self saveGroups]; //make sure this is saved right away
|
[self saveGroups]; //make sure this is saved right away
|
||||||
|
@ -122,7 +122,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
for (NSInteger i = 0; i < [fGroups count]; i++)
|
for (NSInteger i = 0; i < [fGroups count]; i++)
|
||||||
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] intValue])
|
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] integerValue])
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -130,7 +130,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
|
|
||||||
- (NSInteger) indexForRow: (NSInteger) row
|
- (NSInteger) indexForRow: (NSInteger) row
|
||||||
{
|
{
|
||||||
return [[[fGroups objectAtIndex: row] objectForKey: @"Index"] intValue];
|
return [[[fGroups objectAtIndex: row] objectForKey: @"Index"] integerValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) nameForIndex: (NSInteger) index
|
- (NSString *) nameForIndex: (NSInteger) index
|
||||||
|
@ -256,7 +256,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
{
|
{
|
||||||
BOOL found = NO;
|
BOOL found = NO;
|
||||||
for (NSDictionary * dict in fGroups)
|
for (NSDictionary * dict in fGroups)
|
||||||
if ([[dict objectForKey: @"Index"] intValue] == index)
|
if ([[dict objectForKey: @"Index"] integerValue] == index)
|
||||||
{
|
{
|
||||||
found = YES;
|
found = YES;
|
||||||
break;
|
break;
|
||||||
|
@ -266,7 +266,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
[fGroups addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: index], @"Index",
|
[fGroups addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger: index], @"Index",
|
||||||
[NSColor cyanColor], @"Color", @"", @"Name", nil]];
|
[NSColor cyanColor], @"Color", @"", @"Name", nil]];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
|
||||||
|
@ -275,11 +275,11 @@ GroupsController * fGroupsInstance = nil;
|
||||||
|
|
||||||
- (void) removeGroupWithRowIndex: (NSInteger) row
|
- (void) removeGroupWithRowIndex: (NSInteger) row
|
||||||
{
|
{
|
||||||
NSInteger index = [[[fGroups objectAtIndex: row] objectForKey: @"Index"] intValue];
|
NSInteger index = [[[fGroups objectAtIndex: row] objectForKey: @"Index"] integerValue];
|
||||||
[fGroups removeObjectAtIndex: row];
|
[fGroups removeObjectAtIndex: row];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"GroupValueRemoved" object: self userInfo:
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"GroupValueRemoved" object: self userInfo:
|
||||||
[NSDictionary dictionaryWithObject: [NSNumber numberWithInt: index] forKey: @"Index"]];
|
[NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: index] forKey: @"Index"]];
|
||||||
|
|
||||||
if (index == [[NSUserDefaults standardUserDefaults] integerForKey: @"FilterGroup"])
|
if (index == [[NSUserDefaults standardUserDefaults] integerForKey: @"FilterGroup"])
|
||||||
[[NSUserDefaults standardUserDefaults] setInteger: -2 forKey: @"FilterGroup"];
|
[[NSUserDefaults standardUserDefaults] setInteger: -2 forKey: @"FilterGroup"];
|
||||||
|
@ -335,7 +335,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
item = [[NSMenuItem alloc] initWithTitle: [dict objectForKey: @"Name"] action: action keyEquivalent: @""];
|
item = [[NSMenuItem alloc] initWithTitle: [dict objectForKey: @"Name"] action: action keyEquivalent: @""];
|
||||||
[item setTarget: target];
|
[item setTarget: target];
|
||||||
|
|
||||||
[item setTag: [[dict objectForKey: @"Index"] intValue]];
|
[item setTag: [[dict objectForKey: @"Index"] integerValue]];
|
||||||
|
|
||||||
NSImage * icon = [self imageForGroup: dict];
|
NSImage * icon = [self imageForGroup: dict];
|
||||||
if (small)
|
if (small)
|
||||||
|
@ -360,7 +360,7 @@ GroupsController * fGroupsInstance = nil;
|
||||||
{
|
{
|
||||||
for (NSDictionary * group in fGroups)
|
for (NSDictionary * group in fGroups)
|
||||||
{
|
{
|
||||||
NSInteger row = [[group objectForKey: @"Index"] intValue];
|
NSInteger row = [[group objectForKey: @"Index"] integerValue];
|
||||||
if ([self torrent: torrent doesMatchRulesForGroupAtIndex: row])
|
if ([self torrent: torrent doesMatchRulesForGroupAtIndex: row])
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,22 +428,22 @@
|
||||||
[gradient release];
|
[gradient release];
|
||||||
}
|
}
|
||||||
|
|
||||||
//error image
|
|
||||||
const BOOL error = [torrent isErrorOrWarning];
|
const BOOL error = [torrent isErrorOrWarning];
|
||||||
NSImage * errorImage = error ? [NSImage imageNamed: [NSApp isOnSnowLeopardOrBetter] ? NSImageNameCaution : @"Error.png"] : nil;
|
|
||||||
|
|
||||||
//icon
|
//icon
|
||||||
if (!minimal || !(!fTracking && fHoverAction)) //don't show in minimal mode when hovered over
|
if (!minimal || !(!fTracking && fHoverAction)) //don't show in minimal mode when hovered over
|
||||||
{
|
{
|
||||||
NSImage * icon = (minimal && error) ? errorImage : [torrent icon];
|
NSImage * icon = (minimal && error) ? [NSImage imageNamed: [NSApp isOnSnowLeopardOrBetter] ? NSImageNameCaution : @"Error.png"]
|
||||||
|
: [torrent icon];
|
||||||
[self drawImage: icon inRect: iconRect];
|
[self drawImage: icon inRect: iconRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//error badge
|
||||||
if (error && !minimal)
|
if (error && !minimal)
|
||||||
{
|
{
|
||||||
NSRect errorRect = NSMakeRect(NSMaxX(iconRect) - ERROR_IMAGE_SIZE, NSMaxY(iconRect) - ERROR_IMAGE_SIZE,
|
NSRect errorRect = NSMakeRect(NSMaxX(iconRect) - ERROR_IMAGE_SIZE, NSMaxY(iconRect) - ERROR_IMAGE_SIZE,
|
||||||
ERROR_IMAGE_SIZE, ERROR_IMAGE_SIZE);
|
ERROR_IMAGE_SIZE, ERROR_IMAGE_SIZE);
|
||||||
[self drawImage: errorImage inRect: errorRect];
|
[self drawImage: [NSImage imageNamed: [NSApp isOnSnowLeopardOrBetter] ? NSImageNameCaution : @"Error.png"] inRect: errorRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
//text color
|
//text color
|
||||||
|
|
|
@ -513,6 +513,7 @@
|
||||||
return [fTorrentCell iconRectForBounds: [self rectOfRow: row]];
|
return [fTorrentCell iconRectForBounds: [self rectOfRow: row]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning catch string urls?
|
||||||
- (void) paste: (id) sender
|
- (void) paste: (id) sender
|
||||||
{
|
{
|
||||||
NSURL * url;
|
NSURL * url;
|
||||||
|
|
|
@ -119,11 +119,9 @@
|
||||||
return [self numberOfSelectedRows] > 0;
|
return [self numberOfSelectedRows] > 0;
|
||||||
|
|
||||||
if (action == @selector(paste:))
|
if (action == @selector(paste:))
|
||||||
{
|
|
||||||
return fTorrent && ([NSApp isOnSnowLeopardOrBetter]
|
return fTorrent && ([NSApp isOnSnowLeopardOrBetter]
|
||||||
? [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]
|
? [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]
|
||||||
: [[NSPasteboard generalPasteboard] availableTypeFromArray: [NSArray arrayWithObject: NSStringPboardType]] != nil);
|
: [[NSPasteboard generalPasteboard] availableTypeFromArray: [NSArray arrayWithObject: NSStringPboardType]] != nil);
|
||||||
}
|
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue