Changeset 2447


Ignore:
Timestamp:
Jul 20, 2007, 8:54:55 PM (15 years ago)
Author:
livings124
Message:

get quick pausing when moving working

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.h

    r2442 r2447  
    6565    NSBitmapImageRep * fBitmap;
    6666    int8_t * fPieces;
     67   
     68    NSDictionary * fQuickPauseDict;
    6769}
    6870
  • trunk/macosx/Torrent.m

    r2442 r2447  
    5353            flatList: (NSMutableArray *) flatList fileSize: (uint64_t) size index: (int) index;
    5454- (NSImage *) advancedBar;
     55
     56- (void) quickPause;
     57- (void) endQuickPause;
     58
    5559- (void) trashFile: (NSString *) path;
    5660
     
    182186    [fFlatFileList release];
    183187   
     188    [fQuickPauseDict release];
     189   
    184190    [fBitmap release];
    185191   
     
    253259            && (canMove = [self alertForMoveFolderAvailable]))
    254260        {
    255             #warning pause without actually stopping
    256             //pause without actually stopping
     261            [self quickPause];
    257262           
    258263            if ([[NSFileManager defaultManager] movePath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]
     
    262267                canMove = NO;
    263268           
    264             #warning unpause
     269            [self endQuickPause];
    265270        }
    266271       
     
    723728        }
    724729       
    725         #warning pause without actually stopping
    726         //pause without actually stopping
     730        [self quickPause];
    727731       
    728732        if ([[NSFileManager defaultManager] movePath: [oldFolder stringByAppendingPathComponent: [self name]]
     
    740744            [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateInfoSettings" object: nil];
    741745           
    742             #warning unpause
     746            [self endQuickPause];
    743747        }
    744748        else
    745749        {
    746             #warning unpause //restart before showing the alert
     750            [self endQuickPause];
    747751       
    748752            NSAlert * alert = [[NSAlert alloc] init];
     
    18201824}
    18211825
     1826- (void) quickPause
     1827{
     1828    if (fQuickPauseDict)
     1829        return;
     1830
     1831    fQuickPauseDict = [[NSDictionary alloc] initWithObjectsAndKeys:
     1832                    [NSNumber numberWithInt: [self uploadSpeedMode]], @"UploadSpeedMode",
     1833                    [NSNumber numberWithInt: [self uploadSpeedLimit]], @"UploadSpeedLimit",
     1834                    [NSNumber numberWithInt: [self downloadSpeedMode]], @"DownloadSpeedMode",
     1835                    [NSNumber numberWithInt: [self downloadSpeedLimit]], @"DownloadSpeedLimit", nil];
     1836   
     1837    [self setUploadSpeedMode: TR_SPEEDLIMIT_SINGLE];
     1838    [self setUploadSpeedLimit: 0];
     1839    [self setDownloadSpeedMode: TR_SPEEDLIMIT_SINGLE];
     1840    [self setDownloadSpeedLimit: 0];
     1841}
     1842
     1843- (void) endQuickPause
     1844{
     1845    if (!fQuickPauseDict)
     1846        return
     1847   
     1848    [self setUploadSpeedMode: [[fQuickPauseDict objectForKey: @"UploadSpeedMode"] intValue]];
     1849    [self setUploadSpeedLimit: [[fQuickPauseDict objectForKey: @"UploadSpeedLimit"] intValue]];
     1850    [self setDownloadSpeedMode: [[fQuickPauseDict objectForKey: @"DownloadSpeedMode"] intValue]];
     1851    [self setDownloadSpeedLimit: [[fQuickPauseDict objectForKey: @"DownloadSpeedLimit"] intValue]];
     1852   
     1853    [fQuickPauseDict release];
     1854    fQuickPauseDict = nil;
     1855}
     1856
    18221857- (void) trashFile: (NSString *) path
    18231858{
Note: See TracChangeset for help on using the changeset viewer.