update dock badge images
This commit is contained in:
parent
4158be90cf
commit
ae2c7c8f12
|
@ -99,6 +99,7 @@
|
|||
A24621410C769D0900088E81 /* trevent.h in Headers */ = {isa = PBXBuildFile; fileRef = A24621350C769CF400088E81 /* trevent.h */; };
|
||||
A24621420C769D0900088E81 /* trevent.c in Sources */ = {isa = PBXBuildFile; fileRef = A24621360C769CF400088E81 /* trevent.c */; };
|
||||
A24872B60C9B6BB9000F5B92 /* Advanced.png in Resources */ = {isa = PBXBuildFile; fileRef = A24872B50C9B6BB9000F5B92 /* Advanced.png */; };
|
||||
A24B65600D3F30870079EA4D /* QuitBadge.png in Resources */ = {isa = PBXBuildFile; fileRef = A24B655F0D3F30870079EA4D /* QuitBadge.png */; };
|
||||
A24D2A640C0A624600A0ED9F /* IPCController.m in Sources */ = {isa = PBXBuildFile; fileRef = A24D2A620C0A624600A0ED9F /* IPCController.m */; };
|
||||
A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
||||
A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
||||
|
@ -474,6 +475,7 @@
|
|||
A24621350C769CF400088E81 /* trevent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = trevent.h; path = libtransmission/trevent.h; sourceTree = "<group>"; };
|
||||
A24621360C769CF400088E81 /* trevent.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = trevent.c; path = libtransmission/trevent.c; sourceTree = "<group>"; };
|
||||
A24872B50C9B6BB9000F5B92 /* Advanced.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Advanced.png; path = macosx/Images/Advanced.png; sourceTree = "<group>"; };
|
||||
A24B655F0D3F30870079EA4D /* QuitBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = QuitBadge.png; path = macosx/Images/QuitBadge.png; sourceTree = "<group>"; };
|
||||
A24D2A610C0A624600A0ED9F /* IPCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = IPCController.h; path = macosx/IPCController.h; sourceTree = "<group>"; };
|
||||
A24D2A620C0A624600A0ED9F /* IPCController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = IPCController.m; path = macosx/IPCController.m; sourceTree = "<group>"; };
|
||||
A24D2A770C0A65C400A0ED9F /* ipcparse.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ipcparse.c; path = libtransmission/ipcparse.c; sourceTree = "<group>"; };
|
||||
|
@ -960,6 +962,7 @@
|
|||
4DE5CCA80980739100BE280E /* Badge.png */,
|
||||
4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */,
|
||||
4DDFDD21099A5D8E00189D81 /* UploadBadge.png */,
|
||||
A24B655F0D3F30870079EA4D /* QuitBadge.png */,
|
||||
4DE5CCB80981D27700BE280E /* ResumeAll.png */,
|
||||
4DE5CCB90981D27700BE280E /* PauseAll.png */,
|
||||
A25FCDDD0A37695F002BCBBE /* PauseSelected.png */,
|
||||
|
@ -1643,6 +1646,7 @@
|
|||
A2623B410D3DC5930045D19A /* ResumeHover.png in Resources */,
|
||||
A2623B420D3DC5930045D19A /* PauseHover.png in Resources */,
|
||||
A2623B4E0D3DC6DF0045D19A /* ActionHover.png in Resources */,
|
||||
A24B65600D3F30870079EA4D /* QuitBadge.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
NSDictionary * fAttributes;
|
||||
|
||||
BOOL fQuitting;
|
||||
NSImage * fQuitBadge;
|
||||
}
|
||||
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#import "BadgeView.h"
|
||||
#import "NSStringAdditions.h"
|
||||
|
||||
#define BADGE_HEIGHT 30.0
|
||||
#define BETWEEN_PADDING 2.0
|
||||
|
||||
@interface BadgeView (Private)
|
||||
|
@ -54,7 +53,6 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
[fAttributes release];
|
||||
[fQuitBadge release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -64,22 +62,8 @@
|
|||
|
||||
if (fQuitting)
|
||||
{
|
||||
if (!fQuitBadge)
|
||||
{
|
||||
NSRect badgeRect = NSMakeRect(0.0, 0.0, rect.size.width, BADGE_HEIGHT);
|
||||
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: badgeRect xRadius: 15.0 yRadius: 15.0];
|
||||
|
||||
fQuitBadge = [[NSImage alloc] initWithSize: badgeRect.size];
|
||||
[fQuitBadge lockFocus];
|
||||
|
||||
[[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.75] set];
|
||||
[bp fill];
|
||||
|
||||
[fQuitBadge unlockFocus];
|
||||
}
|
||||
|
||||
[self badge: fQuitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit message")
|
||||
atHeight: (rect.size.height - BADGE_HEIGHT) * 0.5];
|
||||
[self badge: [NSImage imageNamed: @"QuitBadge.png"] string: NSLocalizedString(@"Quitting", "Dock Badger -> quit")
|
||||
atHeight: (rect.size.height - [[NSImage imageNamed: @"UploadBadge"] size].height) * 0.5];
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -91,13 +75,16 @@
|
|||
tr_torrentRates(fLib, &downloadRate, &uploadRate);
|
||||
|
||||
BOOL upload = checkUpload && uploadRate >= 0.1;
|
||||
upload = YES;
|
||||
if (upload)
|
||||
[self badge: [NSImage imageNamed: @"UploadBadge"] string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: 0.0];
|
||||
if (checkDownload && downloadRate >= 0.1)
|
||||
[self badge: [NSImage imageNamed: @"UploadBadge.png"] string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: 0.0];
|
||||
//if (checkDownload && downloadRate >= 0.1)
|
||||
if (YES)
|
||||
{
|
||||
//download rate above upload rate
|
||||
float bottom = upload ? [[NSImage imageNamed: @"UploadBadge"] size].height + BETWEEN_PADDING : 0.0;
|
||||
[self badge: [NSImage imageNamed: @"DownloadBadge"] string: [NSString stringForSpeedAbbrev: downloadRate] atHeight: bottom];
|
||||
float bottom = upload ? [[NSImage imageNamed: @"UploadBadge.png"] size].height + BETWEEN_PADDING : 0.0;
|
||||
[self badge: [NSImage imageNamed: @"DownloadBadge.png"] string: [NSString stringForSpeedAbbrev: downloadRate]
|
||||
atHeight: bottom];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
dockIcon = [fDockIcon copy];
|
||||
|
||||
NSRect badgeRect;
|
||||
badgeRect.size = [[NSImage imageNamed: @"UploadBadge"] size];
|
||||
badgeRect.size = [[NSImage imageNamed: @"UploadBadge.png"] size];
|
||||
badgeRect.origin = NSZeroPoint;
|
||||
|
||||
//ignore shadow of badge when placing string
|
||||
|
@ -170,7 +170,7 @@
|
|||
if (uploadRateString)
|
||||
{
|
||||
//place badge and text
|
||||
[[NSImage imageNamed: @"UploadBadge"] compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
||||
[[NSImage imageNamed: @"UploadBadge.png"] compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
||||
[self badgeString: uploadRateString forRect: stringRect];
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@
|
|||
}
|
||||
|
||||
//place badge and text
|
||||
[[NSImage imageNamed: @"DownloadBadge"] compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
||||
[[NSImage imageNamed: @"DownloadBadge.png"] compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
||||
[self badgeString: downloadRateString forRect: stringRect];
|
||||
}
|
||||
|
||||
|
@ -246,13 +246,10 @@
|
|||
rect.size = [quitIcon size];
|
||||
|
||||
NSRect badgeRect = NSMakeRect(0.0, (rect.size.height - BADGE_HEIGHT) * 0.5, rect.size.width, BADGE_HEIGHT);
|
||||
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: badgeRect radius: 15.0];
|
||||
|
||||
[quitIcon lockFocus];
|
||||
|
||||
[[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.75] set];
|
||||
[bp fill];
|
||||
|
||||
[[NSImage imageNamed: @"QuitBadge.png"] compositeToPoint: badgeRect.origin operation: NSCompositeSourceOver];
|
||||
[self badgeString: NSLocalizedString(@"Quitting", "Dock Badger -> quit message") forRect: badgeRect];
|
||||
|
||||
[quitIcon unlockFocus];
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue