Changeset 1996


Ignore:
Timestamp:
Jun 1, 2007, 12:33:31 AM (15 years ago)
Author:
livings124
Message:

when dragging torrents for folders or multiple torrents, show the total file count

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/DragOverlayWindow.m

    r1912 r1996  
    7777    NSString * name;
    7878    BOOL folder;
     79    int fileCount = 0;
    7980   
    8081    NSString * file;
     
    9192            count++;
    9293            size += info->totalSize;
     94            fileCount += info->fileCount;
    9395           
    9496            //only useful when one torrent
     
    103105    }
    104106   
     107    if (count <= 0)
     108        return;
     109   
     110    //set strings and icon
    105111    NSImage * icon = nil;
    106     NSString * sizeString = [NSString stringForFileSize: size];
     112    NSString * secondString = [NSString stringForFileSize: size];
     113    if (count > 1 || folder)
     114    {
     115        NSString * fileString;
     116        if (fileCount == 1)
     117            fileString = NSLocalizedString(@"1 File, ", "Drag overlay -> drag files");
     118        else
     119            fileString= [NSString stringWithFormat: NSLocalizedString(@"%d Files, ", "Drag overlay -> drag files"), fileCount];
     120         secondString = [fileString stringByAppendingString: secondString];
     121    }
     122   
    107123    if (count == 1)
    108124        icon = [[NSWorkspace sharedWorkspace] iconForFileType: folder ? NSFileTypeForHFSTypeCode('fldr') : [name pathExtension]];
    109125    else
    110126    {
    111         name = [NSString stringWithFormat: NSLocalizedString(@"%d Torrent Files", "Drag overlay -> multiple drag files"), count];
    112         sizeString = [sizeString stringByAppendingString: @" Total"];
     127        name = [NSString stringWithFormat: NSLocalizedString(@"%d Torrent Files", "Drag overlay -> drag files"), count];
     128        secondString = [secondString stringByAppendingString: @" Total"];
    113129    }
    114130   
    115     [[self contentView] setOverlay: icon mainLine: name subLine: sizeString];
     131    [[self contentView] setOverlay: icon mainLine: name subLine: secondString];
    116132   
    117133    //stop other animation and set to same progress
Note: See TracChangeset for help on using the changeset viewer.