Added a few comment.

This commit is contained in:
Damiano Galassi authored and Damiano Galassi committed 2015-09-13 19:53:26 +02:00
1 parent d9da44e19b
commit a9793e2ed8
5 files changed
+65 -18

No files matched your search

+16
View File
@@ -13,6 +13,14 @@ NS_ASSUME_NONNULL_BEGIN
@class MP42Track;
@class SBMediaTag;
/**
* A SBMediaTagsControllert takes a MP42Track in input,
* and show a windows to configure the media characteristic tags
* of the input track. The new set of tags is added to the track
* after the user press the OK button.
*
* Custom media tags are preserved.
*/
@interface SBMediaTagsController : NSWindowController {
@private
MP42Track *_track;
@@ -21,6 +29,14 @@ NS_ASSUME_NONNULL_BEGIN
IBOutlet NSTableView *_tableView;
}
/**
* Initializes an SBMediaTagsController with the tags
* from the provided track.
*
* @param track the track
*
* @return an SBMediaTagsController.
*/
- (instancetype)initWithTrack:(MP42Track *)track;
@end
+40 -9
View File
@@ -11,6 +11,11 @@
#pragma mark - Helpers
NS_ASSUME_NONNULL_BEGIN
/**
* A SBMediaTag is composed of a tag value and a boolean state.
*/
@interface SBMediaTag : NSObject {
@private
BOOL _state;
@@ -19,17 +24,35 @@
NSString *_localizedDescription;
}
/**
* Returns the complete array of the predefined tags.
*/
+ (NSArray<NSString *> *)predefinedTags;
/**
* Returns the predefined supported media tags
* for a particular media type.
*
* @param mediaType a MP42MediaType type.
*
* @return an array of NSString with the supported tags.
*/
+ (NSArray<NSString *> *)predefinedTagsForMediaType:(NSString *)mediaType;
+ (nullable NSString *)localizedDescriptionForTag:(NSString *)tag;
/**
* Returns the localized human readable title of a partical tag.
*/
+ (nullable NSString *)localizedTitleForTag:(NSString *)tag;
@property (nonatomic, readwrite) BOOL state;
@property (nonatomic, readonly, nonnull) NSString *value;
@property (nonatomic, readonly, nonnull) NSString *localizedTitle;
@property (nonatomic, readonly, nonnull) NSString *localizedDescription;
@property (nonatomic, readonly) NSString *value;
@property (nonatomic, readonly) NSString *localizedTitle;
@property (nonatomic, readonly) NSString *localizedDescription;
@end
NS_ASSUME_NONNULL_END
@implementation SBMediaTag
- (instancetype)initWithValue:(NSString *)value state:(BOOL)state {
@@ -37,7 +60,7 @@
if (self) {
_state = state;
_value = [value copy];
_localizedTitle = [[SBMediaTag localizedDescriptionForTag:_value] copy];
_localizedTitle = [[SBMediaTag localizedTitleForTag:_value] copy];
if (_localizedTitle == nil) {
_localizedTitle = [_value retain];
@@ -76,8 +99,9 @@
}
else if ([mediaType isEqualToString:MP42MediaTypeSubtitle] ||
[mediaType isEqualToString:MP42MediaTypeClosedCaption]) {
if ([mediaType isEqualToString:MP42MediaTypeSubtitle] ||
[mediaType isEqualToString:MP42MediaTypeClosedCaption] ||
[mediaType isEqualToString:MP42MediaTypeAudio]) {
[tags addObjectsFromArray:@[@"public.translation"]];
}
@@ -85,7 +109,7 @@
return tags;
}
+ (nullable NSString *)localizedDescriptionForTag:(NSString *)tag {
+ (nullable NSString *)localizedTitleForTag:(NSString *)tag {
NSDictionary *localizedDescriptions = @{@"public.main-program-content": NSLocalizedString(@"Main Program Content", nil),
@"public.auxiliary-content": NSLocalizedString(@"Auxiliary Content", nil),
@"public.subtitles.forced-only": NSLocalizedString(@"Contains Only Forced Subtitles", nil),
@@ -117,16 +141,23 @@
@end
NS_ASSUME_NONNULL_BEGIN
/**
* A NSTableCellView that contains a single checkbox.
*/
@interface SBCheckBoxTableCellView : NSTableCellView {
IBOutlet NSButton *_checkBox;
SBMediaTag *_representedTag;
}
@property (nonatomic, readwrite, retain, nonnull) SBMediaTag *representedTag;
@property (nonatomic, readwrite, retain) SBMediaTag *representedTag;
@end
NS_ASSUME_NONNULL_END
@implementation SBCheckBoxTableCellView
@synthesize representedTag = _representedTag;
View File
File mode changed.