Changeset 2021
- Timestamp:
- Jun 10, 2007, 4:00:44 AM (15 years ago)
- Location:
- branches/file_selection/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/file_selection/macosx/Torrent.h
r2016 r2021 165 165 - (BOOL) isError; 166 166 - (NSString *) errorMessage; 167 - (BOOL) justFinished;168 167 169 168 - (NSArray *) peers; -
branches/file_selection/macosx/Torrent.m
r2020 r2021 31 31 #define BLANK_PIECE -99 32 32 33 #define PRIORITY_LOW -1 34 #define PRIORITY_NORMAL 0 35 #define PRIORITY_HIGH 1 36 33 37 static int static_lastid = 0; 34 38 … … 50 54 - (void) insertPath: (NSMutableArray *) components forSiblings: (NSMutableArray *) siblings 51 55 withParent: (NSMutableDictionary *) parent previousPath: (NSString *) previousPath 52 fileSize: (uint64_t) size index: (int) index ;56 fileSize: (uint64_t) size index: (int) index priority: (int) priority; 53 57 - (NSImage *) advancedBar; 54 58 - (void) trashFile: (NSString *) path; … … 186 190 [history setObject: filesShouldDownload forKey: @"FilesShouldDownload"]; 187 191 188 #warning add priorities 192 NSMutableArray * filePriorities = [NSMutableArray arrayWithCapacity: fileCount]; 193 #warning get priorities 194 [history setObject: filePriorities forKey: @"FilePriorities"]; 195 189 196 if (fUseIncompleteFolder) 190 197 [history setObject: fIncompleteFolder forKey: @"IncompleteFolder"]; … … 301 308 302 309 //notification when downloading finished 303 if ( [self justFinished])310 if (tr_getFinished(fHandle)) 304 311 { 305 312 BOOL canMove = YES; … … 1124 1131 } 1125 1132 1126 - (BOOL) justFinished1127 {1128 return tr_getFinished(fHandle);1129 }1130 1131 1133 - (NSArray *) peers 1132 1134 { … … 1350 1352 - (void) setFileCheckState: (int) state forFileItem: (NSDictionary *) item 1351 1353 { 1354 #warning use index set 1352 1355 if (![[item objectForKey: @"IsFolder"] boolValue]) 1353 1356 tr_torrentSetFilePriority(fHandle, [[item objectForKey: @"Index"] intValue], … … 1548 1551 NSMutableArray * pathComponents; 1549 1552 NSString * path; 1550 BOOL shouldDownload; 1553 int priority; 1554 tr_priority_t actualPriority; 1551 1555 1552 1556 NSMutableArray * fileList = [[NSMutableArray alloc] init]; … … 1565 1569 path = @""; 1566 1570 1571 priority = filePriorities ? [[filesShouldDownload objectAtIndex: i] intValue] : PRIORITY_NORMAL; 1567 1572 [self insertPath: pathComponents forSiblings: fileList withParent: nil previousPath: path 1568 fileSize: file->length index: i ];1573 fileSize: file->length index: i priority: priority]; 1569 1574 [pathComponents autorelease]; 1570 1575 1571 shouldDownload = filesShouldDownload ? [[filesShouldDownload objectAtIndex: i] boolValue] : YES; 1572 #warning add priorities 1573 tr_torrentSetFilePriority(fHandle, i, YES ? TR_PRI_NORMAL : TR_PRI_DND); 1576 if (!filesShouldDownload || [[filesShouldDownload objectAtIndex: i] boolValue]) 1577 { 1578 if (priority == PRIORITY_HIGH) 1579 actualPriority = TR_PRI_HIGH; 1580 else if (priority == PRIORITY_LOW) 1581 actualPriority = TR_PRI_LOW; 1582 else 1583 actualPriority = TR_PRI_NORMAL; 1584 } 1585 else 1586 actualPriority = TR_PRI_DND; 1587 1588 tr_torrentSetFilePriority(fHandle, i, actualPriority); 1574 1589 } 1575 1590 … … 1580 1595 - (void) insertPath: (NSMutableArray *) components forSiblings: (NSMutableArray *) siblings 1581 1596 withParent: (NSMutableDictionary *) parent previousPath: (NSString *) previousPath 1582 fileSize: (uint64_t) size index: (int) index 1597 fileSize: (uint64_t) size index: (int) index priority: (int) priority 1583 1598 { 1584 1599 NSString * name = [components objectAtIndex: 0]; … … 1613 1628 [dict setObject: [NSNumber numberWithUnsignedLongLong: size] forKey: @"Size"]; 1614 1629 [dict setObject: [[NSWorkspace sharedWorkspace] iconForFileType: [name pathExtension]] forKey: @"Icon"]; 1630 [dict setObject: [NSNumber numberWithInt: priority] forKey: @"Priority"]; 1615 1631 } 1616 1632 … … 1628 1644 [components removeObjectAtIndex: 0]; 1629 1645 [self insertPath: components forSiblings: [dict objectForKey: @"Children"] 1630 withParent: dict previousPath: currentPath fileSize: size index: index ];1646 withParent: dict previousPath: currentPath fileSize: size index: index priority: priority]; 1631 1647 } 1632 1648 }
Note: See TracChangeset
for help on using the changeset viewer.