mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
initial saving of collapsed/expanded groups when switching filters, adding torrents, etc
This commit is contained in:
parent
864c563ba1
commit
015f40e498
3 changed files with 38 additions and 2 deletions
|
@ -1912,7 +1912,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
||||||
[fDisplayedTorrents sortUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
|
[fDisplayedTorrents sortUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
|
||||||
|
|
||||||
NSMutableArray * groups = [NSMutableArray array], * groupTorrents;
|
NSMutableArray * groups = [NSMutableArray array], * groupTorrents;
|
||||||
int i, oldGroupValue = -2;
|
int oldGroupValue = -2;
|
||||||
for (i = 0; i < [fDisplayedTorrents count]; i++)
|
for (i = 0; i < [fDisplayedTorrents count]; i++)
|
||||||
{
|
{
|
||||||
Torrent * torrent = [fDisplayedTorrents objectAtIndex: i];
|
Torrent * torrent = [fDisplayedTorrents objectAtIndex: i];
|
||||||
|
@ -1937,6 +1937,22 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
||||||
[self sortTorrentsIgnoreSelected];
|
[self sortTorrentsIgnoreSelected];
|
||||||
[fTableView selectValues: selectedValues];
|
[fTableView selectValues: selectedValues];
|
||||||
|
|
||||||
|
//reset expanded/collapsed rows
|
||||||
|
if (groupRows && [fDisplayedTorrents count] > 0 && [NSApp isOnLeopardOrBetter])
|
||||||
|
{
|
||||||
|
NSIndexSet * collapsed = [fTableView collapsedGroupsIndexes];
|
||||||
|
enumerator = [fDisplayedTorrents objectEnumerator];
|
||||||
|
NSDictionary * dict;
|
||||||
|
while ((dict = [enumerator nextObject]))
|
||||||
|
{
|
||||||
|
int value = [[dict objectForKey: @"Group"] intValue];
|
||||||
|
if ([collapsed containsIndex: value >= 0 ? value : INT_MAX])
|
||||||
|
[fTableView collapseItem: dict];
|
||||||
|
else
|
||||||
|
[fTableView expandItem: dict];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[self setBottomCountTextFiltering: groupRows || filterStatus || filterGroup || filterText];
|
[self setBottomCountTextFiltering: groupRows || filterStatus || filterGroup || filterText];
|
||||||
|
|
||||||
[self setWindowSizeToFit];
|
[self setWindowSizeToFit];
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
@interface TorrentTableView : NSOutlineView
|
@interface TorrentTableView : NSOutlineView
|
||||||
{
|
{
|
||||||
IBOutlet Controller * fController;
|
IBOutlet Controller * fController;
|
||||||
NSIndexSet * fGroupIndexes;
|
NSMutableIndexSet * fCollapsedGroups;
|
||||||
|
|
||||||
TorrentCell * fTorrentCell;
|
TorrentCell * fTorrentCell;
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@
|
||||||
NSTimer * fPiecesBarTimer;
|
NSTimer * fPiecesBarTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSIndexSet *) collapsedGroupsIndexes;
|
||||||
|
|
||||||
- (void) removeButtonTrackingAreas;
|
- (void) removeButtonTrackingAreas;
|
||||||
- (void) setControlButtonHover: (int) row;
|
- (void) setControlButtonHover: (int) row;
|
||||||
- (void) setRevealButtonHover: (int) row;
|
- (void) setRevealButtonHover: (int) row;
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
if (![NSApp isOnLeopardOrBetter])
|
if (![NSApp isOnLeopardOrBetter])
|
||||||
[[self tableColumnWithIdentifier: @"Torrent"] setDataCell: fTorrentCell];
|
[[self tableColumnWithIdentifier: @"Torrent"] setDataCell: fTorrentCell];
|
||||||
|
|
||||||
|
fCollapsedGroups = [[NSMutableIndexSet alloc] init];
|
||||||
|
|
||||||
fMouseControlRow = -1;
|
fMouseControlRow = -1;
|
||||||
fMouseRevealRow = -1;
|
fMouseRevealRow = -1;
|
||||||
fMouseActionRow = -1;
|
fMouseActionRow = -1;
|
||||||
|
@ -76,6 +78,8 @@
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
[fCollapsedGroups release];
|
||||||
|
|
||||||
[fPiecesBarTimer invalidate];
|
[fPiecesBarTimer invalidate];
|
||||||
[fMenuTorrent release];
|
[fMenuTorrent release];
|
||||||
|
|
||||||
|
@ -86,6 +90,11 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSIndexSet *) collapsedGroupsIndexes
|
||||||
|
{
|
||||||
|
return fCollapsedGroups;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) outlineView: (NSOutlineView *) outlineView isGroupItem: (id) item
|
- (BOOL) outlineView: (NSOutlineView *) outlineView isGroupItem: (id) item
|
||||||
{
|
{
|
||||||
return ![item isKindOfClass: [Torrent class]];
|
return ![item isKindOfClass: [Torrent class]];
|
||||||
|
@ -247,11 +256,17 @@
|
||||||
|
|
||||||
- (void) outlineViewItemDidExpand: (NSNotification *) notification
|
- (void) outlineViewItemDidExpand: (NSNotification *) notification
|
||||||
{
|
{
|
||||||
|
int value = [[[[notification userInfo] objectForKey: @"NSObject"] objectForKey: @"Group"] intValue];
|
||||||
|
[fCollapsedGroups removeIndex: value >= 0 ? value : INT_MAX];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"OutlineExpandCollapse" object: self];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"OutlineExpandCollapse" object: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) outlineViewItemDidCollapse: (NSNotification *) notification
|
- (void) outlineViewItemDidCollapse: (NSNotification *) notification
|
||||||
{
|
{
|
||||||
|
int value = [[[[notification userInfo] objectForKey: @"NSObject"] objectForKey: @"Group"] intValue];
|
||||||
|
[fCollapsedGroups addIndex: value >= 0 ? value : INT_MAX];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"OutlineExpandCollapse" object: self];
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"OutlineExpandCollapse" object: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +337,10 @@
|
||||||
{
|
{
|
||||||
id tableItem = [self itemAtRow: i];
|
id tableItem = [self itemAtRow: i];
|
||||||
if (![tableItem isKindOfClass: [Torrent class]] && [[tableItem objectForKey: @"Group"] intValue] == group)
|
if (![tableItem isKindOfClass: [Torrent class]] && [[tableItem objectForKey: @"Group"] intValue] == group)
|
||||||
|
{
|
||||||
[indexSet addIndex: i];
|
[indexSet addIndex: i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue