mirror of
https://github.com/transmission/transmission
synced 2024-12-24 00:34:04 +00:00
use new functions for setting multiple file dl/priorities
This commit is contained in:
parent
e6e6d574db
commit
35dc48dc1d
2 changed files with 22 additions and 11 deletions
|
@ -105,12 +105,11 @@
|
|||
NSDictionary * item = [self itemAtRow: row];
|
||||
Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent];
|
||||
|
||||
if ([[item objectForKey: @"IsFolder"] boolValue]
|
||||
|| ![torrent canChangeDownloadCheckForFiles: [item objectForKey: @"Indexes"]])
|
||||
NSIndexSet * indexSet = [item objectForKey: @"Indexes"];
|
||||
if ([[item objectForKey: @"IsFolder"] boolValue] || ![torrent canChangeDownloadCheckForFiles: indexSet])
|
||||
[fNormalColor set];
|
||||
else
|
||||
{
|
||||
NSIndexSet * indexSet = [item objectForKey: @"Indexes"];
|
||||
if ([torrent hasFilePriority: TR_PRI_HIGH forIndexes: indexSet])
|
||||
[fHighPriorityColor set];
|
||||
else if ([torrent hasFilePriority: TR_PRI_LOW forIndexes: indexSet])
|
||||
|
|
|
@ -147,8 +147,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
[NSNumber numberWithInt: fCheckDownload], @"CheckDownload",
|
||||
[NSNumber numberWithInt: fDownloadLimit], @"DownloadLimit",
|
||||
[NSNumber numberWithBool: fWaitToStart], @"WaitToStart",
|
||||
[self orderValue], @"OrderValue",
|
||||
nil];
|
||||
[self orderValue], @"OrderValue", nil];
|
||||
|
||||
if (fIncompleteFolder)
|
||||
[history setObject: fIncompleteFolder forKey: @"IncompleteFolder"];
|
||||
|
@ -1313,10 +1312,16 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
|
||||
- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet
|
||||
{
|
||||
#warning multiples
|
||||
int index;
|
||||
int count = [indexSet count], i = 0, index;
|
||||
int * files = malloc(count * sizeof(int));
|
||||
|
||||
for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
|
||||
tr_torrentSetFileDL(fHandle, index, state != NSOffState);
|
||||
{
|
||||
files[i] = index;
|
||||
i++;
|
||||
}
|
||||
tr_torrentSetFileDLs(fHandle, files, count, state != NSOffState);
|
||||
free(files);
|
||||
|
||||
[self update];
|
||||
if ([self isPaused])
|
||||
|
@ -1325,10 +1330,17 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
|
||||
- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet
|
||||
{
|
||||
#warning multiples
|
||||
int index;
|
||||
int count = [indexSet count], i = 0, index;
|
||||
int * files = malloc(count * sizeof(int));
|
||||
|
||||
for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
|
||||
tr_torrentSetFilePriority(fHandle, index, priority);
|
||||
{
|
||||
files[i] = index;
|
||||
i++;
|
||||
}
|
||||
|
||||
tr_torrentSetFilePriorities(fHandle, files, count, priority);
|
||||
free(files);
|
||||
}
|
||||
|
||||
- (BOOL) hasFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet
|
||||
|
|
Loading…
Reference in a new issue