mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
create file lists lazily
This commit is contained in:
@@ -204,9 +204,9 @@
|
||||
- (void) checkGroupValueForRemoval: (NSNotification *) notification;
|
||||
|
||||
- (NSArray *) fileList;
|
||||
- (NSArray *) flatFileList;
|
||||
- (NSInteger) fileCount;
|
||||
- (void) updateFileStat;
|
||||
- (NSArray *) flatFileList;
|
||||
|
||||
//methods require fileStats to have been updated recently to be accurate
|
||||
- (CGFloat) fileProgress: (FileListNode *) node;
|
||||
|
||||
@@ -1257,9 +1257,20 @@ int trashDataFile(const char * filename)
|
||||
|
||||
- (NSArray *) fileList
|
||||
{
|
||||
if (!fFileList && ![self isMagnet])
|
||||
[self createFileList];
|
||||
|
||||
return fFileList;
|
||||
}
|
||||
|
||||
- (NSArray *) flatFileList
|
||||
{
|
||||
if (!fFlatFileList && ![self isMagnet])
|
||||
[self createFileList];
|
||||
|
||||
return fFlatFileList;
|
||||
}
|
||||
|
||||
- (NSInteger) fileCount
|
||||
{
|
||||
return fInfo->fileCount;
|
||||
@@ -1294,11 +1305,6 @@ int trashDataFile(const char * filename)
|
||||
return (CGFloat)have / [node size];
|
||||
}
|
||||
|
||||
- (NSArray *) flatFileList
|
||||
{
|
||||
return fFlatFileList;
|
||||
}
|
||||
|
||||
- (BOOL) canChangeDownloadCheckForFile: (NSUInteger) index
|
||||
{
|
||||
NSAssert2(index < [self fileCount], @"Index %d is greater than file count %d", index, [self fileCount]);
|
||||
@@ -1586,9 +1592,6 @@ int trashDataFile(const char * filename)
|
||||
fWaitToStart = waitToStart && [waitToStart boolValue];
|
||||
fResumeOnWake = NO;
|
||||
|
||||
if (![self isMagnet])
|
||||
[self createFileList];
|
||||
|
||||
fGroupValue = groupValue ? [groupValue intValue] : [[GroupsController groups] groupIndexForTorrent: self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(checkGroupValueForRemoval:)
|
||||
@@ -1737,8 +1740,6 @@ int trashDataFile(const char * filename)
|
||||
{
|
||||
fStat = tr_torrentStat(fHandle);
|
||||
|
||||
[self createFileList];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"ResetInspector" object: self];
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
const CGFloat totalRowHeight = [self rowHeight] + [self intercellSpacing].height;
|
||||
|
||||
NSRect gridRects[(NSInteger)(ceil(visibleRect.size.height / totalRowHeight / 2.0)) + 1]; //add one if partial rows at top and bottom
|
||||
NSRect gridRects[(NSInteger)(ceil(NSHeight(visibleRect) / totalRowHeight / 2.0)) + 1]; //add one if partial rows at top and bottom
|
||||
NSInteger rectNum = 0;
|
||||
|
||||
if (rows.length > 0)
|
||||
|
||||
Reference in New Issue
Block a user