Changeset 362


Ignore:
Timestamp:
Jun 15, 2006, 2:35:40 AM (17 years ago)
Author:
livings124
Message:

Should save between launches now, among other things.

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r361 r362  
    1414                <string>189 691 451 44 0 0 1152 842 </string>
    1515                <key>456</key>
    16                 <string>396 374 216 168 0 0 1152 842 </string>
     16                <string>396 374 216 206 0 0 1152 842 </string>
    1717                <key>581</key>
    1818                <string>324 628 112 68 0 0 1152 842 </string>
     
    3131        <array>
    3232                <integer>21</integer>
     33                <integer>29</integer>
    3334        </array>
    3435        <key>IBSystem Version</key>
  • trunk/macosx/Torrent.m

    r361 r362  
    3333        date: (NSDate *) date stopRatioSetting: (NSNumber *) stopRatioSetting
    3434        ratioLimit: (NSNumber *) ratioLimit;
    35 - (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *)
     35- (id) initForSuccessWithPath: (NSString *) path date: (NSDate *) date stopRatioSetting: (NSNumber *)
    3636            stopRatioSetting ratioLimit: (NSNumber *) ratioLimit;
    3737
     
    4545- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
    4646{
     47    fPrivateTorrent = [fDefaults boolForKey: @"SavePrivateTorrent"];
     48    fPublicTorrent = !fPrivateTorrent || ![fDefaults boolForKey: @"DeleteOriginalTorrent"];
     49
    4750    id torrent = [self initWithPath: path lib: lib date: nil
    4851                    stopRatioSetting: nil ratioLimit: nil];
     
    5053    if (torrent)
    5154    {
    52         fPrivateTorrent = [fDefaults boolForKey: @"SavePrivateTorrent"];
    53         fPublicTorrent = !fPrivateTorrent || ![fDefaults boolForKey: @"DeleteOriginalTorrent"];
    54    
    5555        if (!fPublicTorrent)
    5656        {
    5757            [self trashFile: path];
     58           
     59            [fPublicTorrentLocation release];
    5860            fPublicTorrentLocation = nil;
    5961        }
    60         else
    61             fPublicTorrentLocation = [path retain];
    6262    }
    6363   
     
    6767- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib
    6868{
    69     //load from saved torrent file if set to, otherwise try to load from where torrent file should be
    7069    id torrent;
    7170    NSNumber * privateCopy, * publicCopy;
     
    7372    fPublicTorrent = !fPrivateTorrent || ((publicCopy = [history objectForKey: @"PublicCopy"])
    7473                                            && [publicCopy boolValue]);
    75     NSString * path = [history objectForKey: @"TorrentPath"];
    76    
     74   
     75    //load from saved torrent file if set to, otherwise try to load from where torrent file should be
    7776    if (fPrivateTorrent)
    7877        torrent = [self initWithHash: [history objectForKey: @"TorrentHash"]
    79             path: [history objectForKey: @"TorrentPath"] lib: lib
    80             date: [history objectForKey: @"Date"]
     78            path: [history objectForKey: @"TorrentPath"]
     79            lib: lib date: [history objectForKey: @"Date"]
    8180            stopRatioSetting: [history objectForKey: @"StopRatioSetting"]
    8281            ratioLimit: [history objectForKey: @"RatioLimit"]];
     
    8988    if (torrent)
    9089    {
    91         if (fPublicTorrent)
    92             fPublicTorrentLocation = [path retain];
    93    
    9490        NSString * downloadFolder;
    9591        if (!(downloadFolder = [history objectForKey: @"DownloadFolder"]))
     
    120116
    121117    if (fPublicTorrent)
    122         [history setObject: [self torrentLocation] forKey: @"TorrentPath"];
     118        [history setObject: [self publicTorrentLocation] forKey: @"TorrentPath"];
    123119   
    124120    return history;
     
    561557    fLib = lib;
    562558    fDefaults = [NSUserDefaults standardUserDefaults];
    563     fPublicTorrentLocation = path;
    564559
    565560    int error;
     
    571566    }
    572567
    573     return [self initForSuccessWithDate: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
     568    return [self initForSuccessWithPath: path date: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
    574569}
    575570
     
    583578    fLib = lib;
    584579    fDefaults = [NSUserDefaults standardUserDefaults];
    585     fPublicTorrentLocation = path;
    586580
    587581    int error;
     
    592586    }
    593587   
    594     return [self initForSuccessWithDate: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
    595 }
    596 
    597 - (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *)
     588    return [self initForSuccessWithPath: path date: date stopRatioSetting: stopRatioSetting ratioLimit: ratioLimit];
     589}
     590
     591- (id) initForSuccessWithPath: (NSString *) path date: (NSDate *) date stopRatioSetting: (NSNumber *)
    598592            stopRatioSetting ratioLimit: (NSNumber *) ratioLimit
    599593{
    600594    fInfo = tr_torrentInfo( fHandle );
     595
     596    if (path)
     597        fPublicTorrentLocation = [path retain];
    601598
    602599    fDate = date ? [date retain] : [[NSDate alloc] init];
Note: See TracChangeset for help on using the changeset viewer.