From cb263cd7f2220521bd97da1fc5f2dde864cb61c6 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Fri, 1 Jun 2007 00:33:31 +0000 Subject: [PATCH] when dragging torrents for folders or multiple torrents, show the total file count --- macosx/DragOverlayWindow.m | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/macosx/DragOverlayWindow.m b/macosx/DragOverlayWindow.m index f542d5ed6..e8ecb768d 100644 --- a/macosx/DragOverlayWindow.m +++ b/macosx/DragOverlayWindow.m @@ -76,6 +76,7 @@ NSString * name; BOOL folder; + int fileCount = 0; NSString * file; NSEnumerator * enumerator = [files objectEnumerator]; @@ -90,6 +91,7 @@ count++; size += info->totalSize; + fileCount += info->fileCount; //only useful when one torrent if (count == 1) @@ -102,17 +104,31 @@ } } + if (count <= 0) + return; + + //set strings and icon NSImage * icon = nil; - NSString * sizeString = [NSString stringForFileSize: size]; + NSString * secondString = [NSString stringForFileSize: size]; + if (count > 1 || folder) + { + NSString * fileString; + if (fileCount == 1) + fileString = NSLocalizedString(@"1 File, ", "Drag overlay -> drag files"); + else + fileString= [NSString stringWithFormat: NSLocalizedString(@"%d Files, ", "Drag overlay -> drag files"), fileCount]; + secondString = [fileString stringByAppendingString: secondString]; + } + if (count == 1) icon = [[NSWorkspace sharedWorkspace] iconForFileType: folder ? NSFileTypeForHFSTypeCode('fldr') : [name pathExtension]]; else { - name = [NSString stringWithFormat: NSLocalizedString(@"%d Torrent Files", "Drag overlay -> multiple drag files"), count]; - sizeString = [sizeString stringByAppendingString: @" Total"]; + name = [NSString stringWithFormat: NSLocalizedString(@"%d Torrent Files", "Drag overlay -> drag files"), count]; + secondString = [secondString stringByAppendingString: @" Total"]; } - [[self contentView] setOverlay: icon mainLine: name subLine: sizeString]; + [[self contentView] setOverlay: icon mainLine: name subLine: secondString]; //stop other animation and set to same progress if ([fFadeOutAnimation isAnimating])