mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
get quick pausing when moving working
This commit is contained in:
parent
15f1a5f9ad
commit
2d0be4f0b9
2 changed files with 44 additions and 7 deletions
|
@ -64,6 +64,8 @@
|
||||||
|
|
||||||
NSBitmapImageRep * fBitmap;
|
NSBitmapImageRep * fBitmap;
|
||||||
int8_t * fPieces;
|
int8_t * fPieces;
|
||||||
|
|
||||||
|
NSDictionary * fQuickPauseDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithPath: (NSString *) path location: (NSString *) location forceDeleteTorrent: (BOOL) delete lib: (tr_handle_t *) lib;
|
- (id) initWithPath: (NSString *) path location: (NSString *) location forceDeleteTorrent: (BOOL) delete lib: (tr_handle_t *) lib;
|
||||||
|
|
|
@ -52,6 +52,10 @@ static int static_lastid = 0;
|
||||||
withParent: (NSMutableDictionary *) parent previousPath: (NSString *) previousPath
|
withParent: (NSMutableDictionary *) parent previousPath: (NSString *) previousPath
|
||||||
flatList: (NSMutableArray *) flatList fileSize: (uint64_t) size index: (int) index;
|
flatList: (NSMutableArray *) flatList fileSize: (uint64_t) size index: (int) index;
|
||||||
- (NSImage *) advancedBar;
|
- (NSImage *) advancedBar;
|
||||||
|
|
||||||
|
- (void) quickPause;
|
||||||
|
- (void) endQuickPause;
|
||||||
|
|
||||||
- (void) trashFile: (NSString *) path;
|
- (void) trashFile: (NSString *) path;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -181,6 +185,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
[fFileList release];
|
[fFileList release];
|
||||||
[fFlatFileList release];
|
[fFlatFileList release];
|
||||||
|
|
||||||
|
[fQuickPauseDict release];
|
||||||
|
|
||||||
[fBitmap release];
|
[fBitmap release];
|
||||||
|
|
||||||
if (fPieces)
|
if (fPieces)
|
||||||
|
@ -252,8 +258,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
if (fUseIncompleteFolder && ![[self downloadFolder] isEqualToString: fDownloadFolder]
|
if (fUseIncompleteFolder && ![[self downloadFolder] isEqualToString: fDownloadFolder]
|
||||||
&& (canMove = [self alertForMoveFolderAvailable]))
|
&& (canMove = [self alertForMoveFolderAvailable]))
|
||||||
{
|
{
|
||||||
#warning pause without actually stopping
|
[self quickPause];
|
||||||
//pause without actually stopping
|
|
||||||
|
|
||||||
if ([[NSFileManager defaultManager] movePath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]
|
if ([[NSFileManager defaultManager] movePath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]
|
||||||
toPath: [fDownloadFolder stringByAppendingPathComponent: [self name]] handler: nil])
|
toPath: [fDownloadFolder stringByAppendingPathComponent: [self name]] handler: nil])
|
||||||
|
@ -261,7 +266,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
else
|
else
|
||||||
canMove = NO;
|
canMove = NO;
|
||||||
|
|
||||||
#warning unpause
|
[self endQuickPause];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canMove)
|
if (!canMove)
|
||||||
|
@ -722,8 +727,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning pause without actually stopping
|
[self quickPause];
|
||||||
//pause without actually stopping
|
|
||||||
|
|
||||||
if ([[NSFileManager defaultManager] movePath: [oldFolder stringByAppendingPathComponent: [self name]]
|
if ([[NSFileManager defaultManager] movePath: [oldFolder stringByAppendingPathComponent: [self name]]
|
||||||
toPath: [folder stringByAppendingPathComponent: [self name]] handler: nil])
|
toPath: [folder stringByAppendingPathComponent: [self name]] handler: nil])
|
||||||
|
@ -739,11 +743,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateInfoSettings" object: nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateInfoSettings" object: nil];
|
||||||
|
|
||||||
#warning unpause
|
[self endQuickPause];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#warning unpause //restart before showing the alert
|
[self endQuickPause];
|
||||||
|
|
||||||
NSAlert * alert = [[NSAlert alloc] init];
|
NSAlert * alert = [[NSAlert alloc] init];
|
||||||
[alert setMessageText: NSLocalizedString(@"There was an error moving the data file.", "Move error alert -> title")];
|
[alert setMessageText: NSLocalizedString(@"There was an error moving the data file.", "Move error alert -> title")];
|
||||||
|
@ -1819,6 +1823,37 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
return [bar autorelease];
|
return [bar autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) quickPause
|
||||||
|
{
|
||||||
|
if (fQuickPauseDict)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fQuickPauseDict = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSNumber numberWithInt: [self uploadSpeedMode]], @"UploadSpeedMode",
|
||||||
|
[NSNumber numberWithInt: [self uploadSpeedLimit]], @"UploadSpeedLimit",
|
||||||
|
[NSNumber numberWithInt: [self downloadSpeedMode]], @"DownloadSpeedMode",
|
||||||
|
[NSNumber numberWithInt: [self downloadSpeedLimit]], @"DownloadSpeedLimit", nil];
|
||||||
|
|
||||||
|
[self setUploadSpeedMode: TR_SPEEDLIMIT_SINGLE];
|
||||||
|
[self setUploadSpeedLimit: 0];
|
||||||
|
[self setDownloadSpeedMode: TR_SPEEDLIMIT_SINGLE];
|
||||||
|
[self setDownloadSpeedLimit: 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) endQuickPause
|
||||||
|
{
|
||||||
|
if (!fQuickPauseDict)
|
||||||
|
return
|
||||||
|
|
||||||
|
[self setUploadSpeedMode: [[fQuickPauseDict objectForKey: @"UploadSpeedMode"] intValue]];
|
||||||
|
[self setUploadSpeedLimit: [[fQuickPauseDict objectForKey: @"UploadSpeedLimit"] intValue]];
|
||||||
|
[self setDownloadSpeedMode: [[fQuickPauseDict objectForKey: @"DownloadSpeedMode"] intValue]];
|
||||||
|
[self setDownloadSpeedLimit: [[fQuickPauseDict objectForKey: @"DownloadSpeedLimit"] intValue]];
|
||||||
|
|
||||||
|
[fQuickPauseDict release];
|
||||||
|
fQuickPauseDict = nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) trashFile: (NSString *) path
|
- (void) trashFile: (NSString *) path
|
||||||
{
|
{
|
||||||
//attempt to move to trash
|
//attempt to move to trash
|
||||||
|
|
Loading…
Reference in a new issue