From d53b0d6ad0cac296691ad1cce83814be63fb84ae Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Thu, 10 Nov 2016 14:26:06 +0100 Subject: [PATCH] Add back the genre combo box. --- Classes/PropertyView/Base.lproj/MovieView.xib | 39 +++++++++++-------- Classes/PropertyView/SBMovieViewController.m | 18 ++++++++- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/Classes/PropertyView/Base.lproj/MovieView.xib b/Classes/PropertyView/Base.lproj/MovieView.xib index baf7d5e..adada4a 100755 --- a/Classes/PropertyView/Base.lproj/MovieView.xib +++ b/Classes/PropertyView/Base.lproj/MovieView.xib @@ -1,5 +1,5 @@ - + @@ -205,21 +205,25 @@ - - - - - + + + + + - + + + + + - + - + @@ -242,25 +246,26 @@ - + - + - + - - Item 1 - Item 2 - Item 3 - + + + + + + diff --git a/Classes/PropertyView/SBMovieViewController.m b/Classes/PropertyView/SBMovieViewController.m index d55c61b..db02d75 100755 --- a/Classes/PropertyView/SBMovieViewController.m +++ b/Classes/PropertyView/SBMovieViewController.m @@ -15,6 +15,7 @@ NSString *SublerCoverArtPBoardType = @"SublerCoverArtPBoardType"; #import "SBImageBrowserView.h" #import "SBPopUpCellView.h" #import "SBCheckBoxCellView.h" +#import "SBComboBoxCellView.h" #import #import @@ -456,6 +457,20 @@ static NSArray *_mediaKinds; return popUpCell; } +- (NSTableCellView *)comboBoxCellWithArrayContents:(NSArray *)contents value:(NSString *)value tableView:(NSTableView *)tableView +{ + SBComboBoxCellView *comboBoxCell = [tableView makeViewWithIdentifier:@"ComboCell" owner:self]; + comboBoxCell.comboBox.stringValue = value; + [comboBoxCell.comboBox addItemsWithObjectValues:contents]; + return comboBoxCell; +} + +- (NSArray *)availableGenres { + return @[@"Animation", @"Classic TV", @"Comedy", @"Drama", + @"Fitness & Workout", @"Kids", @"Non-Fiction", @"Reality TV", @"Sci-Fi & Fantasy", + @"Sports"]; +} + - (nullable NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(nullable NSTableColumn *)tableColumn row:(NSInteger)row { NSTableCellView *cell = nil; @@ -470,8 +485,7 @@ static NSArray *_mediaKinds; case MP42MetadataItemDataTypeString: { if ([item.identifier isEqualToString:MP42MetadataKeyUserGenre]) { - cell = [self textCellWithString:item.stringValue tableView:tableView]; - //cell = [tableView makeViewWithIdentifier:@"ComboCell" owner:self]; + cell = [self comboBoxCellWithArrayContents:[self availableGenres] value:item.stringValue tableView:tableView]; break; } else if ([item.identifier isEqualToString:MP42MetadataKeyRating]) {