#6078: Show main window and scroll to torrent on notification click
This commit is contained in:
parent
e4f929fba9
commit
375571c9b4
|
@ -1991,8 +1991,9 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
}
|
||||
|
||||
NSAssert1(row != -1, @"expected a row to be found for torrent %@", torrent);
|
||||
[fTableView selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection:NO];
|
||||
#warning focus the window
|
||||
|
||||
[self showMainWindow: nil];
|
||||
[fTableView selectAndScrollToRow: row];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,4 +91,6 @@
|
|||
- (void) togglePiecesBar;
|
||||
- (CGFloat) piecesBarPercent;
|
||||
|
||||
- (void) selectAndScrollToRow: (NSInteger) row;
|
||||
|
||||
@end
|
||||
|
|
|
@ -842,6 +842,24 @@
|
|||
return fPiecesBarPercent;
|
||||
}
|
||||
|
||||
- (void) selectAndScrollToRow: (NSInteger) row
|
||||
{
|
||||
NSParameterAssert(row >= 0);
|
||||
NSParameterAssert(row < [self numberOfRows]);
|
||||
|
||||
[self selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection: NO];
|
||||
|
||||
const NSRect rowRect = [self rectOfRow: row];
|
||||
const NSRect viewRect = [[self superview] frame];
|
||||
|
||||
NSPoint scrollOrigin = rowRect.origin;
|
||||
scrollOrigin.y += (rowRect.size.height - viewRect.size.height) / 2;
|
||||
if (scrollOrigin.y < 0)
|
||||
scrollOrigin.y = 0;
|
||||
|
||||
[[[self superview] animator] setBoundsOrigin: scrollOrigin];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TorrentTableView (Private)
|
||||
|
|
Loading…
Reference in New Issue