Changeset 94


Ignore:
Timestamp:
Feb 7, 2006, 5:02:45 AM (15 years ago)
Author:
titer
Message:

Show ratio instead of the download rate once the download is complete.
Fixed windowWillUseStandardFrame.
Cleaning

Location:
trunk/macosx
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r59 r94  
    5050
    5151    IBOutlet NSWindow           * fWindow;
     52    IBOutlet NSScrollView       * fScrollView;
    5253    IBOutlet TorrentTableView   * fTableView;
    5354    IBOutlet NSTextField        * fTotalDLField;
  • trunk/macosx/Controller.m

    r92 r94  
    966966
    967967    rectWin  = [fWindow frame];
    968     rectView = [[fWindow contentView] frame];
    969     foo      = 47.0 + MAX( 1, tr_torrentCount( fHandle ) ) * 62.0 -
    970                   rectView.size.height;
     968    rectView = [fScrollView frame];
     969    foo      = 25.0 + MAX( 1, fCount ) * ( [fTableView rowHeight] +
     970                 [fTableView intercellSpacing].height ) -
     971                 rectView.size.height;
    971972
    972973    rectWin.size.height += foo;
  • trunk/macosx/English.lproj/MainMenu.nib/classes.nib

    r58 r94  
    4848                fRemoveTorrentItem = NSMenuItem;
    4949                fRevealItem = NSMenuItem;
     50                fScrollView = NSScrollView;
    5051                fShowHideToolbar = NSMenuItem;
    5152                fTableView = TorrentTableView;
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r58 r94  
    1616                <string>54 521 112 118 0 0 1152 842 </string>
    1717                <key>783</key>
    18                 <string>387 422 470 265 0 0 1280 832 </string>
     18                <string>456 452 470 265 0 0 1440 878 </string>
    1919                <key>796</key>
    2020                <string>412 490 470 129 0 0 1280 832 </string>
     
    2626        <key>IBOldestOS</key>
    2727        <integer>3</integer>
    28         <key>IBOpenObjects</key>
    29         <array>
    30                 <integer>783</integer>
    31         </array>
    3228        <key>IBSystem Version</key>
    33         <string>8G32</string>
     29        <string>8F1111g</string>
    3430</dict>
    3531</plist>
  • trunk/macosx/NameCell.m

    r74 r94  
    3535                    [NSString stringForFileSize: stat->info.totalSize]];
    3636
    37     if( stat->folder )
    38         fIcon = [[NSWorkspace sharedWorkspace] iconForFile:
    39                     [[NSString stringWithUTF8String: stat->folder]
    40                     stringByAppendingPathComponent: fNameString]];
     37    if( stat->info.fileCount > 1 )
     38        fIcon = [[NSWorkspace sharedWorkspace] iconForFileType:
     39            NSFileTypeForHFSTypeCode('fldr')];
    4140    else
    42         /* XXX The torrent is still being opened, the destination hasn't
    43            been chosen yet. It shouldn't be added to the table view so
    44            soon */
    45         fIcon = [[NSWorkspace sharedWorkspace] iconForFile: @"/System"];
     41        fIcon = [[NSWorkspace sharedWorkspace] iconForFileType:
     42            [fNameString pathExtension]];
    4643    [fIcon setFlipped: YES];
    4744
  • trunk/macosx/ProgressCell.m

    r37 r94  
    123123
    124124    /* Update the strings to be displayed */
    125     fDlString = [@"DL: " stringByAppendingString:
    126                     [NSString stringForSpeed: fStat->rateDownload]];
     125    if( fStat->progress == 1.0 )
     126        fDlString = [@"Ratio: " stringByAppendingString:
     127                        [NSString stringForRatio: fStat->downloaded
     128                            upload: fStat->uploaded]];
     129    else
     130        fDlString = [@"DL: " stringByAppendingString:
     131                        [NSString stringForSpeed: fStat->rateDownload]];
    127132    fUlString = [@"UL: " stringByAppendingString:
    128133                    [NSString stringForSpeed: fStat->rateUpload]];
  • trunk/macosx/StringAdditions.h

    r34 r94  
    1313+ (NSString *) stringForFileSize: (uint64_t) size;
    1414+ (NSString *) stringForSpeed: (float) speed;
     15+ (NSString *) stringForRatio: (uint64_t) down upload: (uint64_t) up;
    1516- (NSString *) stringFittingInWidth: (float) width
    1617                                        withAttributes: (NSDictionary *) attributes;
  • trunk/macosx/StringAdditions.m

    r34 r94  
    3737}
    3838
     39+ (NSString *) stringForRatio: (uint64_t) down upload: (uint64_t) up;
     40{
     41    if( !down && !up )
     42        return @"N/A";
     43    if( !down )
     44        return @"Inf.";
     45
     46    float ratio = (float) up / (float) down;
     47    if( ratio < 10.0 )
     48        return [NSString stringWithFormat: @"%.2f", ratio];
     49    else if( ratio < 100.0 )
     50        return [NSString stringWithFormat: @"%.1f", ratio];
     51    else
     52        return [NSString stringWithFormat: @"%.0f", ratio];
     53}
     54
    3955- (NSString *) stringFittingInWidth: (float) width
    4056                    withAttributes: (NSDictionary *) attributes
Note: See TracChangeset for help on using the changeset viewer.