Changeset 456


Ignore:
Timestamp:
Jun 24, 2006, 4:32:17 AM (16 years ago)
Author:
livings124
Message:

Torrents will each store an int to signify it's place in the "custom order" (I need to come up with a better name for that). This functionality will become more useful once it's actually used.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.h

    r446 r456  
    5151    float   fRatioLimit;
    5252    BOOL    fFinishedSeeding, fWaitToStart;
     53   
     54    int fOrderValue;
    5355}
    5456
     
    126128- (uint64_t)    uploadedTotal;
    127129
     130- (NSNumber *) orderValue;
     131- (void) setOrderValue: (int) orderValue;
     132
    128133- (NSArray *) fileList;
    129134
  • trunk/macosx/Torrent.m

    r452 r456  
    3131        privateTorrent: (NSNumber *) privateTorrent publicTorrent: (NSNumber *) publicTorrent
    3232        date: (NSDate *) date stopRatioSetting: (NSNumber *) stopRatioSetting
    33         ratioLimit: (NSNumber *) ratioLimit waitToStart: (NSNumber *) waitToStart;
     33        ratioLimit: (NSNumber *) ratioLimit waitToStart: (NSNumber *) waitToStart
     34        orderValue: (NSNumber *) orderValue;
    3435
    3536- (void) trashFile: (NSString *) path;
     
    4344{
    4445    self = [self initWithHash: nil path: path lib: lib privateTorrent: nil publicTorrent: nil
    45             date: nil stopRatioSetting: nil ratioLimit: nil waitToStart: nil];
     46            date: nil stopRatioSetting: nil ratioLimit: nil waitToStart: nil orderValue: nil];
    4647   
    4748    if (self)
     
    6263                stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
    6364                ratioLimit: [history objectForKey: @"RatioLimit"]
    64                 waitToStart: [history objectForKey: @"WaitToStart"]];
     65                waitToStart: [history objectForKey: @"WaitToStart"]
     66                orderValue: [history objectForKey: @"OrderValue"]];
    6567   
    6668    if (self)
     
    8890                    [NSNumber numberWithInt: fStopRatioSetting], @"StopRatioSetting",
    8991                    [NSNumber numberWithFloat: fRatioLimit], @"RatioLimit",
    90                     [NSNumber numberWithBool: fWaitToStart], @"WaitToStart", nil];
     92                    [NSNumber numberWithBool: fWaitToStart], @"WaitToStart",
     93                    [self orderValue], @"OrderValue", nil];
    9194           
    9295    if (fPrivateTorrent)
     
    518521}
    519522
     523- (NSNumber *) orderValue
     524{
     525    return [NSNumber numberWithInt: fOrderValue];
     526}
     527
     528- (void) setOrderValue: (int) orderValue
     529{
     530    fOrderValue = orderValue;
     531}
     532
    520533- (NSArray *) fileList
    521534{
     
    558571        date: (NSDate *) date stopRatioSetting: (NSNumber *) stopRatioSetting
    559572        ratioLimit: (NSNumber *) ratioLimit waitToStart: (NSNumber *) waitToStart
     573        orderValue: (NSNumber *) orderValue
    560574{
    561575    if (!(self = [super init]))
     
    605619    fProgressString = [[NSMutableString alloc] initWithCapacity: 50];
    606620    fStatusString = [[NSMutableString alloc] initWithCapacity: 75];
     621   
     622    fOrderValue = orderValue ? [orderValue intValue] : tr_torrentCount(fLib) - 1;
    607623
    608624    [self update];
     
    612628- (void) trashFile: (NSString *) path
    613629{
     630    //attempt to move to trash
    614631    if (![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation
    615632            source: [path stringByDeletingLastPathComponent] destination: @""
    616633            files: [NSArray arrayWithObject: [path lastPathComponent]] tag: nil])
    617634    {
    618         /* We can't move it to the trash, let's try just to delete it
    619            (will work if it is on a remote volume) */
     635        //if cannot trash, just delete it (will work if it is on a remote volume)
    620636        if (![[NSFileManager defaultManager] removeFileAtPath: path handler: nil])
    621637            NSLog([@"Could not trash " stringByAppendingString: path]);
Note: See TracChangeset for help on using the changeset viewer.