mirror of
https://github.com/transmission/transmission
synced 2025-03-06 11:38:21 +00:00
have the badger not set up all of the badge images and other data at launch...instead wait until it's needed
This commit is contained in:
parent
18aa394019
commit
9fc1829ac5
4 changed files with 39 additions and 30 deletions
4
NEWS
4
NEWS
|
@ -9,9 +9,9 @@ NEWS file for Transmission <http://transmission.m0k.org/>
|
|||
to avoid hammering the disk
|
||||
- Many miscellaneous bugfixes and small improvements
|
||||
- OS X:
|
||||
+ Overlay when dragging torrent files onto window
|
||||
+ Overlay when dragging torrent files, URLs, and data files onto window
|
||||
+ Ability to set an amount of time to consider a transfer stalled
|
||||
+ Various smaller interface changes and improvements
|
||||
+ Various smaller interface improvements
|
||||
- GTK:
|
||||
+ Interface significantly reworked to closer match the Mac version
|
||||
+ Torrent inspector
|
||||
|
|
|
@ -39,24 +39,6 @@
|
|||
{
|
||||
fLib = lib;
|
||||
|
||||
fDockIcon = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
|
||||
fBadge = [NSImage imageNamed: @"Badge"];
|
||||
fUploadBadge = [NSImage imageNamed: @"UploadBadge"];
|
||||
fDownloadBadge = [NSImage imageNamed: @"DownloadBadge"];
|
||||
|
||||
NSShadow * stringShadow = [[NSShadow alloc] init];
|
||||
[stringShadow setShadowOffset: NSMakeSize(2.0, -2.0)];
|
||||
[stringShadow setShadowBlurRadius: 4.0];
|
||||
|
||||
NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
|
||||
[NSFont fontWithName: @"Helvetica" size: 28.0] toHaveTrait: NSBoldFontMask];
|
||||
|
||||
fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor whiteColor], NSForegroundColorAttributeName,
|
||||
boldFont, NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];
|
||||
|
||||
[stringShadow release];
|
||||
|
||||
fCompleted = 0;
|
||||
fCompletedBadged = 0;
|
||||
fSpeedBadge = NO;
|
||||
|
@ -69,6 +51,7 @@
|
|||
{
|
||||
[fDockIcon release];
|
||||
[fAttributes release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -81,13 +64,19 @@
|
|||
fCompletedBadged = fCompleted;
|
||||
|
||||
//force image to reload - copy does not work
|
||||
NSSize iconSize = [fDockIcon size];
|
||||
[fDockIcon release];
|
||||
NSImage * icon = [NSImage imageNamed: @"NSApplicationIcon"];
|
||||
NSSize iconSize = [icon size];
|
||||
|
||||
if (fDockIcon)
|
||||
[fDockIcon release];
|
||||
fDockIcon = [[NSImage alloc] initWithSize: iconSize];
|
||||
[fDockIcon addRepresentation: [[NSImage imageNamed: @"NSApplicationIcon"] bestRepresentationForDevice: nil]];
|
||||
[fDockIcon addRepresentation: [icon bestRepresentationForDevice: nil]];
|
||||
|
||||
if (fCompleted > 0)
|
||||
{
|
||||
if (!fBadge)
|
||||
fBadge = [NSImage imageNamed: @"Badge"];
|
||||
|
||||
NSRect badgeRect;
|
||||
NSSize iconSize = [fDockIcon size];
|
||||
badgeRect.size = [fBadge size];
|
||||
|
@ -131,8 +120,15 @@
|
|||
BOOL speedChange;
|
||||
if (speedChange = (uploadRateString || downloadRateString))
|
||||
{
|
||||
if (!fDockIcon)
|
||||
fDockIcon = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
|
||||
dockIcon = [fDockIcon copy];
|
||||
|
||||
if (!fUploadBadge)
|
||||
fUploadBadge = [NSImage imageNamed: @"UploadBadge"];
|
||||
if (!fDownloadBadge)
|
||||
fDownloadBadge = [NSImage imageNamed: @"DownloadBadge"];
|
||||
|
||||
NSRect badgeRect;
|
||||
badgeRect.size = [fUploadBadge size];
|
||||
badgeRect.origin = NSZeroPoint;
|
||||
|
@ -215,6 +211,22 @@
|
|||
//dock icon must have locked focus
|
||||
- (void) badgeString: (NSString *) string forRect: (NSRect) rect
|
||||
{
|
||||
if (!fAttributes)
|
||||
{
|
||||
NSShadow * stringShadow = [[NSShadow alloc] init];
|
||||
[stringShadow setShadowOffset: NSMakeSize(2.0, -2.0)];
|
||||
[stringShadow setShadowBlurRadius: 4.0];
|
||||
|
||||
NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
|
||||
[NSFont fontWithName: @"Helvetica" size: 28.0] toHaveTrait: NSBoldFontMask];
|
||||
|
||||
fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor whiteColor], NSForegroundColorAttributeName,
|
||||
boldFont, NSFontAttributeName, stringShadow, NSShadowAttributeName, nil];
|
||||
|
||||
[stringShadow release];
|
||||
}
|
||||
|
||||
NSSize stringSize = [string sizeWithAttributes: fAttributes];
|
||||
|
||||
//string is in center of image
|
||||
|
|
|
@ -523,13 +523,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
- (void) applicationWillTerminate: (NSNotification *) notification
|
||||
{
|
||||
//remove all torrent downloads
|
||||
NSEnumerator * enumerator;
|
||||
if (fPendingTorrentDownloads)
|
||||
{
|
||||
enumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
|
||||
NSEnumerator * downloadEnumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
|
||||
NSDictionary * downloadDict;
|
||||
NSURLDownload * download;
|
||||
while ((downloadDict = [enumerator nextObject]))
|
||||
while ((downloadDict = [downloadEnumerator nextObject]))
|
||||
{
|
||||
download = [downloadDict objectForKey: @"Download"];
|
||||
[download cancel];
|
||||
|
@ -552,7 +551,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[self updateTorrentHistory];
|
||||
|
||||
//make sure torrents are closed
|
||||
enumerator = [fTorrents objectEnumerator];
|
||||
NSEnumerator * enumerator = [fTorrents objectEnumerator];
|
||||
Torrent * torrent;
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
[torrent closeTorrent];
|
||||
|
@ -1188,7 +1187,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
[self updateUI];
|
||||
[self applyFilter: nil];
|
||||
|
||||
[self updateTorrentHistory];
|
||||
}
|
||||
|
||||
|
@ -1333,8 +1331,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
Torrent * torrent;
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
[torrent resetCache];
|
||||
|
||||
#warning reset queue?
|
||||
}
|
||||
|
||||
- (void) showPreferenceWindow: (id) sender
|
||||
|
|
|
@ -606,6 +606,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
- (void) resetCache
|
||||
{
|
||||
tr_torrentRecheck(fHandle);
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (float) ratio
|
||||
|
|
Loading…
Add table
Reference in a new issue