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) setPiecesView: (id) sender;
- (void) setPiecesViewForAvailable: (BOOL) available; - (void) setPiecesViewForAvailable: (BOOL) available;
- (void) clearPiecesView; - (void) clearView;
@end @end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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