mirror of
https://github.com/transmission/transmission
synced 2024-12-23 00:04:06 +00:00
make the pieces view a bit more efficient in terms of not storing values when it's not shown
This commit is contained in:
parent
6d65981a83
commit
9207316488
3 changed files with 18 additions and 18 deletions
|
@ -690,9 +690,14 @@ typedef enum
|
|||
|
||||
switch (oldTabTag)
|
||||
{
|
||||
case TAB_ACTIVITY_TAG:
|
||||
[fPiecesView clearView];
|
||||
break;
|
||||
|
||||
case TAB_TRACKER_TAG:
|
||||
oldResizeSaveKey = @"InspectorContentHeightTracker";
|
||||
break;
|
||||
|
||||
case TAB_PEERS_TAG:
|
||||
//if in the middle of animating, just stop and resize immediately
|
||||
if (fWebSeedTableAnimation)
|
||||
|
@ -705,6 +710,7 @@ typedef enum
|
|||
|
||||
oldResizeSaveKey = @"InspectorContentHeightPeers";
|
||||
break;
|
||||
|
||||
case TAB_FILES_TAG:
|
||||
[[QuickLookController quickLook] updateQuickLook];
|
||||
|
||||
|
@ -736,8 +742,6 @@ typedef enum
|
|||
case TAB_ACTIVITY_TAG:
|
||||
identifier = TAB_ACTIVITY_IDENT;
|
||||
title = NSLocalizedString(@"Activity", "Inspector -> title");
|
||||
|
||||
[fPiecesView resetView];
|
||||
break;
|
||||
case TAB_TRACKER_TAG:
|
||||
identifier = TAB_TRACKER_IDENT;
|
||||
|
@ -1142,7 +1146,8 @@ typedef enum
|
|||
[fPiecesControl setSelected: !available forSegment: PIECES_CONTROL_PROGRESS];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setBool: available forKey: @"PiecesViewShowAvailability"];
|
||||
[fPiecesView resetView];
|
||||
[fPiecesView clearView];
|
||||
[fPiecesView updateView];
|
||||
}
|
||||
|
||||
- (void) revealTorrentFile: (id) sender
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
- (void) setTorrent: (Torrent *) torrent;
|
||||
|
||||
- (void) resetView;
|
||||
- (void) clearView;
|
||||
- (void) updateView;
|
||||
|
||||
@end
|
||||
|
|
|
@ -80,13 +80,7 @@
|
|||
|
||||
- (void) setTorrent: (Torrent *) torrent
|
||||
{
|
||||
//reset the view to blank
|
||||
NSImage * newBack = [fBack copy];
|
||||
[self setImage: newBack];
|
||||
[newBack release];
|
||||
|
||||
tr_free(fPieces);
|
||||
fPieces = NULL;
|
||||
[self clearView];
|
||||
|
||||
fTorrent = torrent;
|
||||
if (fTorrent)
|
||||
|
@ -98,19 +92,20 @@
|
|||
float width = [self bounds].size.width;
|
||||
fWidth = (width - (fAcross + 1) * BETWEEN) / fAcross;
|
||||
fExtraBorder = (width - ((fWidth + BETWEEN) * fAcross + BETWEEN)) / 2;
|
||||
|
||||
[self updateView];
|
||||
}
|
||||
else
|
||||
[self setNeedsDisplay];
|
||||
|
||||
//reset the view to blank
|
||||
NSImage * newBack = [fBack copy];
|
||||
[self setImage: newBack];
|
||||
[newBack release];
|
||||
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void) resetView
|
||||
- (void) clearView
|
||||
{
|
||||
tr_free(fPieces);
|
||||
fPieces = NULL;
|
||||
|
||||
[self updateView];
|
||||
}
|
||||
|
||||
- (void) updateView
|
||||
|
|
Loading…
Reference in a new issue