diff options
author | Damiano Galassi <[email protected]> | 2017-02-04 14:04:37 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2017-02-04 14:04:37 +0100 |
commit | 41a737dc5f73013d245d8d64ca2461551adfcf75 (patch) | |
tree | 77ac9fffc021f496c814204caed9ac794b7663ad /macosx/HBTitleSelectionController.m | |
parent | 9bd4723096d9c357c7cbf3242fb18537fc1cb66e (diff) |
MacGui: allow to sort by title/name/duration in the title selections sheet.
Diffstat (limited to 'macosx/HBTitleSelectionController.m')
-rw-r--r-- | macosx/HBTitleSelectionController.m | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/macosx/HBTitleSelectionController.m b/macosx/HBTitleSelectionController.m index 319808a69..7ac625f3c 100644 --- a/macosx/HBTitleSelectionController.m +++ b/macosx/HBTitleSelectionController.m @@ -38,6 +38,7 @@ @interface HBTitleSelectionController () <NSTableViewDataSource, NSTableViewDelegate> +@property (nonatomic, strong) IBOutlet NSArrayController *arrayController; @property (nonatomic, readwrite) NSArray<HBTitleSelection *> *titles; @property (nonatomic, readonly, assign) id<HBTitleSelectionDelegate> delegate; @property (nonatomic, readonly) NSString *message; @@ -75,20 +76,19 @@ - (IBAction)add:(id)sender { - NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet]; - - [self.titles enumerateObjectsUsingBlock:^(HBTitleSelection *obj, NSUInteger idx, BOOL *stop) { + NSMutableArray<HBTitle *> *titles = [NSMutableArray array]; + [self.arrayController.arrangedObjects enumerateObjectsUsingBlock:^(HBTitleSelection *obj, NSUInteger idx, BOOL *stop) { if (obj.selected) { - [indexes addIndex:obj.title.index]; + [titles addObject:obj.title]; } }]; - [self.delegate didSelectIndexes:indexes]; + [self.delegate didSelectTitles:titles]; } - (IBAction)cancel:(id)sender { - [self.delegate didSelectIndexes:[NSIndexSet indexSet]]; + [self.delegate didSelectTitles:@[]]; } @end |