add an optional clearView method to the InfoViewController protocol

This commit is contained in:
Mitchell Livingston 2010-03-14 01:52:45 +00:00
parent efce4e9759
commit c5a3856e4f
8 changed files with 13 additions and 17 deletions

View File

@ -50,6 +50,6 @@
- (void) setPiecesView: (id) sender;
- (void) setPiecesViewForAvailable: (BOOL) available;
- (void) clearPiecesView;
- (void) clearView;
@end

View File

@ -148,7 +148,7 @@
[fPiecesView updateView];
}
- (void) clearPiecesView
- (void) clearView
{
[fPiecesView clearView];
}

View File

@ -44,7 +44,7 @@
- (void) setInfoForTorrents: (NSArray *) torrents;
- (void) updateInfo;
- (void) clearPeers;
- (void) clearView;
- (void) stopWebSeedAnimation;
@end

View File

@ -221,7 +221,7 @@
}
}
- (void) clearPeers
- (void) clearView
{
//if in the middle of animating, just stop and resize immediately
if (fWebSeedTableAnimation)

View File

@ -46,7 +46,7 @@
- (void) setInfoForTorrents: (NSArray *) torrents;
- (void) updateInfo;
- (void) clearTrackers;
- (void) clearView;
- (void) addRemoveTracker: (id) sender;

View File

@ -122,7 +122,7 @@
}
}
- (void) clearTrackers
- (void) clearView
{
[fTrackers release];
fTrackers = nil;

View File

@ -30,4 +30,7 @@
- (void) setInfoForTorrents: (NSArray *) torrents;
- (void) updateInfo;
@optional
- (void) clearView;
@end

View File

@ -213,31 +213,24 @@ typedef enum
//deselect old tab item
[(InfoTabButtonCell *)[fTabMatrix cellWithTag: oldTabTag] setSelectedTab: NO];
if ([fViewController respondsToSelector: @selector(clearView)])
[fViewController clearView];
switch (oldTabTag)
{
case TAB_ACTIVITY_TAG:
[fActivityViewController clearPiecesView];
break;
case TAB_TRACKERS_TAG:
[fTrackersViewController clearTrackers];
oldResizeSaveKey = @"InspectorContentHeightTracker";
break;
case TAB_PEERS_TAG:
[fPeersViewController clearPeers];
oldResizeSaveKey = @"InspectorContentHeightPeers";
break;
case TAB_FILE_TAG:
oldResizeSaveKey = @"InspectorContentHeightFiles";
break;
}
NSView * oldView = [fViewController view];
oldHeight = [oldView frame].size.height;
oldHeight = NSHeight([oldView frame]);
if (oldResizeSaveKey)
[[NSUserDefaults standardUserDefaults] setFloat: oldHeight forKey: oldResizeSaveKey];