diff --git a/NEWS b/NEWS index e50201732..d6e80228f 100644 --- a/NEWS +++ b/NEWS @@ -9,9 +9,9 @@ NEWS file for Transmission 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 diff --git a/macosx/Badger.m b/macosx/Badger.m index 0d979f36f..6706fa8f2 100644 --- a/macosx/Badger.m +++ b/macosx/Badger.m @@ -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 diff --git a/macosx/Controller.m b/macosx/Controller.m index dbea5da8f..30e195eb4 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -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 diff --git a/macosx/Torrent.m b/macosx/Torrent.m index a0b3e0906..a89ae3e6b 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -606,6 +606,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 - (void) resetCache { tr_torrentRecheck(fHandle); + [self update]; } - (float) ratio