mirror of
https://github.com/transmission/transmission
synced 2024-12-23 16:24:02 +00:00
experiment with badging the dock with "Quitting"
This commit is contained in:
parent
6bf981d0e3
commit
e26b814175
2 changed files with 20 additions and 2 deletions
|
@ -32,6 +32,7 @@
|
|||
NSDictionary * fAttributes;
|
||||
|
||||
BOOL fQuitting;
|
||||
NSImage * fQuitBadge;
|
||||
}
|
||||
|
||||
- (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib;
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#define BOTTOM_PADDING 2.0
|
||||
#define BETWEEN_PADDING 2.0
|
||||
|
||||
#define BADGE_HEIGHT 30.0
|
||||
|
||||
@interface BadgeView (Private)
|
||||
|
||||
- (void) badge: (NSImage *) badge string: (NSString *) string atHeight: (float) height;
|
||||
|
@ -54,6 +56,7 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
[fAttributes release];
|
||||
[fQuitBadge release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -63,8 +66,22 @@
|
|||
|
||||
if (fQuitting)
|
||||
{
|
||||
#warning make better
|
||||
//[self badge: [NSImage imageNamed: @"UploadBadge"] string: @"Quitting" atHeight: 0.0];
|
||||
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];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue