mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
when dragging torrents for folders or multiple torrents, show the total file count
This commit is contained in:
parent
f7501a0dd6
commit
cb263cd7f2
1 changed files with 20 additions and 4 deletions
|
@ -76,6 +76,7 @@
|
||||||
|
|
||||||
NSString * name;
|
NSString * name;
|
||||||
BOOL folder;
|
BOOL folder;
|
||||||
|
int fileCount = 0;
|
||||||
|
|
||||||
NSString * file;
|
NSString * file;
|
||||||
NSEnumerator * enumerator = [files objectEnumerator];
|
NSEnumerator * enumerator = [files objectEnumerator];
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
size += info->totalSize;
|
size += info->totalSize;
|
||||||
|
fileCount += info->fileCount;
|
||||||
|
|
||||||
//only useful when one torrent
|
//only useful when one torrent
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
|
@ -102,17 +104,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//set strings and icon
|
||||||
NSImage * icon = nil;
|
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)
|
if (count == 1)
|
||||||
icon = [[NSWorkspace sharedWorkspace] iconForFileType: folder ? NSFileTypeForHFSTypeCode('fldr') : [name pathExtension]];
|
icon = [[NSWorkspace sharedWorkspace] iconForFileType: folder ? NSFileTypeForHFSTypeCode('fldr') : [name pathExtension]];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = [NSString stringWithFormat: NSLocalizedString(@"%d Torrent Files", "Drag overlay -> multiple drag files"), count];
|
name = [NSString stringWithFormat: NSLocalizedString(@"%d Torrent Files", "Drag overlay -> drag files"), count];
|
||||||
sizeString = [sizeString stringByAppendingString: @" Total"];
|
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
|
//stop other animation and set to same progress
|
||||||
if ([fFadeOutAnimation isAnimating])
|
if ([fFadeOutAnimation isAnimating])
|
||||||
|
|
Loading…
Reference in a new issue