Update to ARC and 10.9 deployment target.
This commit is contained in:
1 parent
e59092536b
commit
ac05736fed
67 files changed
+1239
-1693
No files matched your search
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (id)dg_objectAtIndexedSubscript:(NSInteger)index {
|
- (id)dg_objectAtIndexedSubscript:(NSInteger)index {
|
||||||
return [self objectAtIndex:index];
|
return self[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(id)dg_objectForKeyedSubscript:(id)key {
|
-(id)dg_objectForKeyedSubscript:(id)key {
|
||||||
return [self objectForKey:key];
|
return self[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
[self addObject:anObject];
|
[self addObject:anObject];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[self replaceObjectAtIndex:index withObject:anObject];
|
self[index] = anObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dg_setObject:(id)object forKeyedSubscript:(id < NSCopying >)aKey {
|
- (void)dg_setObject:(id)object forKeyedSubscript:(id < NSCopying >)aKey {
|
||||||
[self setObject:object forKey:aKey];
|
self[aKey] = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
options:0
|
options:0
|
||||||
error:NULL];
|
error:NULL];
|
||||||
|
|
||||||
NSMutableArray<SBChapterResult *> *resultsArray = [[[NSMutableArray alloc] init] autorelease];
|
NSMutableArray<SBChapterResult *> *resultsArray = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
if (xml) {
|
if (xml) {
|
||||||
NSArray<NSXMLNode *> *children = [xml nodesForXPath:@"//*:chapterInfo" error:nil];
|
NSArray<NSXMLNode *> *children = [xml nodesForXPath:@"//*:chapterInfo" error:nil];
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[xml release];
|
|
||||||
|
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
NSArray<SBChapterResult *> *filteredArray = [self filterArray:resultsArray byDuration:duration delta:10000];
|
NSArray<SBChapterResult *> *filteredArray = [self filterArray:resultsArray byDuration:duration delta:10000];
|
||||||
@@ -133,7 +132,6 @@
|
|||||||
chapter.timestamp = time;
|
chapter.timestamp = time;
|
||||||
|
|
||||||
[chapters addObject:chapter];
|
[chapters addObject:chapter];
|
||||||
[chapter release];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +141,7 @@
|
|||||||
confirmations:confirmations
|
confirmations:confirmations
|
||||||
chapters:chapters];
|
chapters:chapters];
|
||||||
|
|
||||||
return [result autorelease];
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
+ (nullable instancetype)importerForProvider:(NSString *)aProvider
|
+ (nullable instancetype)importerForProvider:(NSString *)aProvider
|
||||||
{
|
{
|
||||||
if ([aProvider isEqualToString:@"ChapterDB"]) {
|
if ([aProvider isEqualToString:@"ChapterDB"]) {
|
||||||
return [[[SBChapterDB alloc] init] autorelease];
|
return [[SBChapterDB alloc] init];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
NSArray<MP42TextSample *> *_chapters;
|
NSArray<MP42TextSample *> *_chapters;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithTitle:(NSString *)title duration:(NSUInteger)duration confirmations:(NSUInteger)confirmations chapters:(NSArray<MP42TextSample *> *)chapters;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
- (instancetype)initWithTitle:(NSString *)title duration:(NSUInteger)duration confirmations:(NSUInteger)confirmations chapters:(NSArray<MP42TextSample *> *)chapters NS_DESIGNATED_INITIALIZER;
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSString *title;
|
@property (nonatomic, readonly) NSString *title;
|
||||||
@property (nonatomic, readonly) NSUInteger duration;
|
@property (nonatomic, readonly) NSUInteger duration;
|
||||||
|
|||||||
@@ -39,36 +39,36 @@
|
|||||||
if (resultDictionary.count) {
|
if (resultDictionary.count) {
|
||||||
results = [[NSMutableDictionary alloc] init];
|
results = [[NSMutableDictionary alloc] init];
|
||||||
NSString *seriesName = [resultDictionary[@"seriesName"] stringByReplacingOccurrencesOfString:@"_" withString:@" "];
|
NSString *seriesName = [resultDictionary[@"seriesName"] stringByReplacingOccurrencesOfString:@"_" withString:@" "];
|
||||||
NSInteger episodeNumber = [resultDictionary[@"episodeNumber"] integerValue];
|
NSInteger episodeNumber = (resultDictionary[@"episodeNumber"]).integerValue;
|
||||||
|
|
||||||
results[@"type"] = @"tv";
|
results[@"type"] = @"tv";
|
||||||
results[@"seriesName"] = seriesName;
|
results[@"seriesName"] = seriesName;
|
||||||
results[@"seasonNum"] = @"1";
|
results[@"seasonNum"] = @"1";
|
||||||
results[@"episodeNum"] = [NSString stringWithFormat:@"%ld", (long)episodeNumber];
|
results[@"episodeNum"] = [NSString stringWithFormat:@"%ld", (long)episodeNumber];
|
||||||
|
|
||||||
return [results autorelease];
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Else use the ParseFilename perl script
|
// Else use the ParseFilename perl script
|
||||||
NSTask *task = [[NSTask alloc] init];
|
NSTask *task = [[NSTask alloc] init];
|
||||||
[task setLaunchPath:@"/usr/bin/perl"];
|
task.launchPath = @"/usr/bin/perl";
|
||||||
|
|
||||||
NSMutableArray<NSString *> *args = [[NSMutableArray alloc] initWithCapacity:3];
|
NSMutableArray<NSString *> *args = [[NSMutableArray alloc] initWithCapacity:3];
|
||||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"ParseFilename" ofType:@""];
|
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"ParseFilename" ofType:@""];
|
||||||
[args addObject:[NSString stringWithFormat:@"-I%@/lib", path]];
|
[args addObject:[NSString stringWithFormat:@"-I%@/lib", path]];
|
||||||
[args addObject:[NSString stringWithFormat:@"%@/ParseFilename.pl", path]];
|
[args addObject:[NSString stringWithFormat:@"%@/ParseFilename.pl", path]];
|
||||||
[args addObject:filename];
|
[args addObject:filename];
|
||||||
[task setArguments:args];
|
task.arguments = args;
|
||||||
|
|
||||||
NSPipe *stdOut = [[NSPipe alloc] init];
|
NSPipe *stdOut = [[NSPipe alloc] init];
|
||||||
NSFileHandle *stdOutWrite = [stdOut fileHandleForWriting];
|
NSFileHandle *stdOutWrite = stdOut.fileHandleForWriting;
|
||||||
[task setStandardOutput:stdOutWrite];
|
task.standardOutput = stdOutWrite;
|
||||||
|
|
||||||
[task launch];
|
[task launch];
|
||||||
[task waitUntilExit];
|
[task waitUntilExit];
|
||||||
[stdOutWrite closeFile];
|
[stdOutWrite closeFile];
|
||||||
|
|
||||||
NSData *outputData = [[stdOut fileHandleForReading] readDataToEndOfFile];
|
NSData *outputData = [stdOut.fileHandleForReading readDataToEndOfFile];
|
||||||
NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];
|
NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];
|
||||||
NSArray<NSString *> *lines = [outputString componentsSeparatedByString:@"\n"];
|
NSArray<NSString *> *lines = [outputString componentsSeparatedByString:@"\n"];
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
withString:@" "];
|
withString:@" "];
|
||||||
results[@"seriesName"] = newSeriesName;
|
results[@"seriesName"] = newSeriesName;
|
||||||
|
|
||||||
if ([lines[2] integerValue]) {
|
if ((lines[2]).integerValue) {
|
||||||
results[@"seasonNum"] = lines[2];
|
results[@"seasonNum"] = lines[2];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -116,23 +116,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[outputString release];
|
|
||||||
[stdOut release];
|
|
||||||
[args release];
|
|
||||||
[task release];
|
|
||||||
|
|
||||||
return [results autorelease];
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString *)urlEncoded:(NSString *)string {
|
+ (NSString *)urlEncoded:(NSString *)string {
|
||||||
string = [string precomposedStringWithCompatibilityMapping];
|
string = string.precomposedStringWithCompatibilityMapping;
|
||||||
CFStringRef urlString = CFURLCreateStringByAddingPercentEscapes(
|
CFStringRef urlString = CFURLCreateStringByAddingPercentEscapes(
|
||||||
NULL,
|
NULL,
|
||||||
(CFStringRef) string,
|
(CFStringRef) string,
|
||||||
NULL,
|
NULL,
|
||||||
(CFStringRef) @"!*'\"();:@&=+$,/?%#[]% ",
|
(CFStringRef) @"!*'\"();:@&=+$,/?%#[]% ",
|
||||||
kCFStringEncodingUTF8);
|
kCFStringEncodingUTF8);
|
||||||
return [(NSString *)urlString autorelease];
|
return CFAutorelease(urlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSString *)md5String:(NSString *)s {
|
+ (NSString *)md5String:(NSString *)s {
|
||||||
@@ -157,11 +153,10 @@
|
|||||||
return [NSString stringWithString:r];
|
return [NSString stringWithString:r];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy error:(NSError **)error {
|
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy error:(NSError * __autoreleasing *)error {
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
|
NSString *bundleName = [NSBundle mainBundle].infoDictionary[@"CFBundleIdentifier"];
|
||||||
NSURL *cacheURL = [[[fileManager URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask]
|
NSURL *cacheURL = [[fileManager URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask].firstObject URLByAppendingPathComponent:bundleName];
|
||||||
firstObject] URLByAppendingPathComponent:bundleName];
|
|
||||||
|
|
||||||
|
|
||||||
NSURL *fileURL = [cacheURL URLByAppendingPathComponent:[SBMetadataHelper sha256String:url.absoluteString]];
|
NSURL *fileURL = [cacheURL URLByAppendingPathComponent:[SBMetadataHelper sha256String:url.absoluteString]];
|
||||||
@@ -194,12 +189,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark NSURLRequest
|
#pragma mark NSURLRequest
|
||||||
+ (nullable NSData *)dataFromUrl:(NSURL *)url withHTTPMethod:(NSString *)method headerOptions:(nullable NSDictionary *)header error:(NSError **)outError
|
+ (nullable NSData *)dataFromUrl:(NSURL *)url withHTTPMethod:(NSString *)method headerOptions:(nullable NSDictionary *)header error:(NSError * __autoreleasing *)outError
|
||||||
{
|
{
|
||||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
|
||||||
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
||||||
timeoutInterval:30.0];
|
timeoutInterval:30.0];
|
||||||
[request setHTTPMethod:method];
|
request.HTTPMethod = method;
|
||||||
|
|
||||||
if (header) {
|
if (header) {
|
||||||
for (NSString *key in header.allKeys) {
|
for (NSString *key in header.allKeys) {
|
||||||
@@ -216,7 +211,7 @@
|
|||||||
if (data) {
|
if (data) {
|
||||||
NSUInteger statusCode = 0;
|
NSUInteger statusCode = 0;
|
||||||
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
|
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||||
statusCode = (long)[(NSHTTPURLResponse *)response statusCode];
|
statusCode = (long)((NSHTTPURLResponse *)response).statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void) cancel;
|
- (void) cancel;
|
||||||
|
|
||||||
#pragma mark Methods to be overridden
|
#pragma mark Methods to be overridden
|
||||||
- (NSArray<NSString *> *) languages;
|
@property (nonatomic, readonly, copy) NSArray<NSString *> * _Nonnull languages;
|
||||||
|
|
||||||
- (NSArray<SBMetadataResult *> *) searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage;
|
- (NSArray<SBMetadataResult *> *) searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage;
|
||||||
- (NSArray<SBMetadataResult *> *) searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(nullable NSString *)aSeasonNum episodeNum:(nullable NSString *)aEpisodeNum;
|
- (NSArray<SBMetadataResult *> *) searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(nullable NSString *)aSeasonNum episodeNum:(nullable NSString *)aEpisodeNum;
|
||||||
|
|||||||
@@ -41,13 +41,13 @@
|
|||||||
|
|
||||||
+ (nullable instancetype)importerForProvider:(NSString *)aProvider {
|
+ (nullable instancetype)importerForProvider:(NSString *)aProvider {
|
||||||
if ([aProvider isEqualToString:@"iTunes Store"]) {
|
if ([aProvider isEqualToString:@"iTunes Store"]) {
|
||||||
return [[[SBiTunesStore alloc] init] autorelease];
|
return [[SBiTunesStore alloc] init];
|
||||||
}
|
}
|
||||||
else if ([aProvider isEqualToString:@"TheMovieDB"]) {
|
else if ([aProvider isEqualToString:@"TheMovieDB"]) {
|
||||||
return [[[SBTheMovieDB3 alloc] init] autorelease];
|
return [[SBTheMovieDB3 alloc] init];
|
||||||
}
|
}
|
||||||
else if ([aProvider isEqualToString:@"TheTVDB"]) {
|
else if ([aProvider isEqualToString:@"TheTVDB"]) {
|
||||||
return [[[SBTheTVDB alloc] init] autorelease];
|
return [[SBTheTVDB alloc] init];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,6 @@
|
|||||||
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage {
|
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage {
|
||||||
SBTheTVDB *searcher = [[SBTheTVDB alloc] init];
|
SBTheTVDB *searcher = [[SBTheTVDB alloc] init];
|
||||||
NSArray *a = [searcher searchTVSeries:aSeriesName language:[[NSUserDefaults standardUserDefaults] valueForKey:@"SBMetadataPreference|TV|TheTVDB|Language"]];
|
NSArray *a = [searcher searchTVSeries:aSeriesName language:[[NSUserDefaults standardUserDefaults] valueForKey:@"SBMetadataPreference|TV|TheTVDB|Language"]];
|
||||||
[searcher release];
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
NSArray<NSURL *> *_artworkFullsizeURLs;
|
NSArray<NSURL *> *_artworkFullsizeURLs;
|
||||||
NSArray<NSString *> *_artworkProviderNames;
|
NSArray<NSString *> *_artworkProviderNames;
|
||||||
|
|
||||||
NSString *_ratingiTunesCode;
|
|
||||||
|
|
||||||
uint8_t _mediaKind;
|
uint8_t _mediaKind;
|
||||||
uint8_t _contentRating;
|
uint8_t _contentRating;
|
||||||
}
|
}
|
||||||
@@ -44,11 +42,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@property (nonatomic, readonly) NSMutableArray<MP42Image *> *artworks;
|
@property (nonatomic, readonly) NSMutableArray<MP42Image *> *artworks;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain, nullable) NSArray<NSURL *> *artworkThumbURLs;
|
@property (nonatomic, readwrite, strong, nullable) NSArray<NSURL *> *artworkThumbURLs;
|
||||||
@property (nonatomic, readwrite, retain, nullable) NSArray<NSURL *> *artworkFullsizeURLs;
|
@property (nonatomic, readwrite, strong, nullable) NSArray<NSURL *> *artworkFullsizeURLs;
|
||||||
@property (nonatomic ,readwrite, retain, nullable) NSArray<NSString *> *artworkProviderNames;
|
@property (nonatomic ,readwrite, strong, nullable) NSArray<NSString *> *artworkProviderNames;
|
||||||
|
|
||||||
@property (nonatomic, readonly) MP42Metadata *metadata;
|
@property (weak, nonatomic, readonly) MP42Metadata *metadata;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -33,20 +33,6 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc
|
|
||||||
{
|
|
||||||
[_artworks release];
|
|
||||||
|
|
||||||
[_artworkThumbURLs release];
|
|
||||||
[_artworkFullsizeURLs release];
|
|
||||||
[_artworkProviderNames release];
|
|
||||||
|
|
||||||
[_ratingiTunesCode release];
|
|
||||||
[_tagsDict release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)merge:(SBMetadataResult *)metadata
|
- (void)merge:(SBMetadataResult *)metadata
|
||||||
{
|
{
|
||||||
[_tagsDict addEntriesFromDictionary:metadata.tags];
|
[_tagsDict addEntriesFromDictionary:metadata.tags];
|
||||||
@@ -66,12 +52,12 @@
|
|||||||
|
|
||||||
- (void)setTag:(id)value forKey:(NSString *)key
|
- (void)setTag:(id)value forKey:(NSString *)key
|
||||||
{
|
{
|
||||||
[_tagsDict setObject:value forKey:key];
|
_tagsDict[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)objectForKeyedSubscript:(NSString *)key
|
- (id)objectForKeyedSubscript:(NSString *)key
|
||||||
{
|
{
|
||||||
return [_tagsDict objectForKey:key];
|
return _tagsDict[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key
|
- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key
|
||||||
@@ -102,7 +88,7 @@
|
|||||||
metadata.mediaKind = self.mediaKind;
|
metadata.mediaKind = self.mediaKind;
|
||||||
metadata.contentRating = self.contentRating;
|
metadata.contentRating = self.contentRating;
|
||||||
|
|
||||||
return [metadata autorelease];
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -52,9 +52,9 @@
|
|||||||
if (iTunesMetadata && iTunesMetadata.artworkThumbURLs && iTunesMetadata.artworkFullsizeURLs &&
|
if (iTunesMetadata && iTunesMetadata.artworkThumbURLs && iTunesMetadata.artworkFullsizeURLs &&
|
||||||
(iTunesMetadata.artworkThumbURLs.count == iTunesMetadata.artworkFullsizeURLs.count)) {
|
(iTunesMetadata.artworkThumbURLs.count == iTunesMetadata.artworkFullsizeURLs.count)) {
|
||||||
|
|
||||||
[artworkThumbURLs addObjectsFromArray:[iTunesMetadata artworkThumbURLs]];
|
[artworkThumbURLs addObjectsFromArray:iTunesMetadata.artworkThumbURLs];
|
||||||
[artworkFullsizeURLs addObjectsFromArray:[iTunesMetadata artworkFullsizeURLs]];
|
[artworkFullsizeURLs addObjectsFromArray:iTunesMetadata.artworkFullsizeURLs];
|
||||||
[artworkProviderNames addObjectsFromArray:[iTunesMetadata artworkProviderNames]];
|
[artworkProviderNames addObjectsFromArray:iTunesMetadata.artworkProviderNames];
|
||||||
}
|
}
|
||||||
|
|
||||||
// load image variables from configuration
|
// load image variables from configuration
|
||||||
@@ -185,7 +185,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [metadata autorelease];
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray<SBMetadataResult *> *)metadataForResults:(NSDictionary *)dict
|
+ (NSArray<SBMetadataResult *> *)metadataForResults:(NSDictionary *)dict
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
for (NSDictionary *language in languagesArray) {
|
for (NSDictionary *language in languagesArray) {
|
||||||
NSString *lang = [language valueForKeyPath:@"abbreviation.text"];
|
NSString *lang = [language valueForKeyPath:@"abbreviation.text"];
|
||||||
if (lang && [lang isKindOfClass:[NSString class]]) {
|
if (lang && [lang isKindOfClass:[NSString class]]) {
|
||||||
iso639_lang_t *isoLanguage = lang_for_code_s([lang UTF8String]);
|
iso639_lang_t *isoLanguage = lang_for_code_s(lang.UTF8String);
|
||||||
[languagesResult addObject:[NSString stringWithUTF8String:isoLanguage->eng_name]];
|
[languagesResult addObject:@(isoLanguage->eng_name)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
for (NSDictionary *s in seriesArray) {
|
for (NSDictionary *s in seriesArray) {
|
||||||
[results addObject:[s retrieveForPath:@"SeriesName.text"]];
|
[results addObject:[s retrieveForPath:@"SeriesName.text"]];
|
||||||
}
|
}
|
||||||
return [[results autorelease] allObjects];
|
return results.allObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(NSString *)aSeasonNum episodeNum:(NSString *)aEpisodeNum
|
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(NSString *)aSeasonNum episodeNum:(NSString *)aEpisodeNum
|
||||||
@@ -137,9 +137,8 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[seriesIDs release];
|
|
||||||
|
|
||||||
return [results autorelease];
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SBMetadataResult *)loadTVMetadata:(SBMetadataResult *)aMetadata language:(NSString *)aLanguage
|
- (SBMetadataResult *)loadTVMetadata:(SBMetadataResult *)aMetadata language:(NSString *)aLanguage
|
||||||
@@ -186,9 +185,9 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
[newArtworkProviderNames addObject:@"TheTVDB|poster"];
|
[newArtworkProviderNames addObject:@"TheTVDB|poster"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[aMetadata setArtworkThumbURLs:newArtworkThumbURLs];
|
aMetadata.artworkThumbURLs = newArtworkThumbURLs;
|
||||||
[aMetadata setArtworkFullsizeURLs:newArtworkFullsizeURLs];
|
aMetadata.artworkFullsizeURLs = newArtworkFullsizeURLs;
|
||||||
[aMetadata setArtworkProviderNames:newArtworkProviderNames];
|
aMetadata.artworkProviderNames = newArtworkProviderNames;
|
||||||
|
|
||||||
return aMetadata;
|
return aMetadata;
|
||||||
}
|
}
|
||||||
@@ -277,14 +276,14 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
[artworkProviderNames addObject:@"TheTVDB|episode"];
|
[artworkProviderNames addObject:@"TheTVDB|episode"];
|
||||||
}
|
}
|
||||||
|
|
||||||
[metadata setArtworkThumbURLs: artworkThumbURLs];
|
metadata.artworkThumbURLs = artworkThumbURLs;
|
||||||
[metadata setArtworkFullsizeURLs: artworkFullsizeURLs];
|
metadata.artworkFullsizeURLs = artworkFullsizeURLs;
|
||||||
[metadata setArtworkProviderNames:artworkProviderNames];
|
metadata.artworkProviderNames = artworkProviderNames;
|
||||||
|
|
||||||
// TheTVDB does not provide the following fields normally associated with TV shows in SBMetadataResult:
|
// TheTVDB does not provide the following fields normally associated with TV shows in SBMetadataResult:
|
||||||
// "Copyright", "Comments", "Producers", "Artist"
|
// "Copyright", "Comments", "Producers", "Artist"
|
||||||
|
|
||||||
return [metadata autorelease];
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [results autorelease];
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSDictionary *)getStoreFor:(NSString *)aLanguageString
|
+ (NSDictionary *)getStoreFor:(NSString *)aLanguageString
|
||||||
@@ -85,32 +85,32 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
for (SBMetadataResult *m in results) {
|
for (SBMetadataResult *m in results) {
|
||||||
if (!aSeriesName || [m[@"TV Show"] isEqualToString:aSeriesName]) {
|
if (!aSeriesName || [m[@"TV Show"] isEqualToString:aSeriesName]) {
|
||||||
// Episode Number and Season Number
|
// Episode Number and Season Number
|
||||||
if ((aEpisodeNum && [aEpisodeNum length]) && (aSeasonNum && [aSeasonNum length])) {
|
if ((aEpisodeNum && aEpisodeNum.length) && (aSeasonNum && aSeasonNum.length)) {
|
||||||
if ([[m[@"TV Episode #"] stringValue] isEqualToString:aEpisodeNum] &&
|
if ([[m[@"TV Episode #"] stringValue] isEqualToString:aEpisodeNum] &&
|
||||||
[m[@"TV Season"] integerValue] == [aSeasonNum integerValue]) {
|
[m[@"TV Season"] integerValue] == aSeasonNum.integerValue) {
|
||||||
[r addObject:m];
|
[r addObject:m];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Episode Number only
|
// Episode Number only
|
||||||
else if ((aEpisodeNum && [aEpisodeNum length]) && !(aSeasonNum && [aSeasonNum length])) {
|
else if ((aEpisodeNum && aEpisodeNum.length) && !(aSeasonNum && aSeasonNum.length)) {
|
||||||
if ([[m[@"TV Episode #"] stringValue] isEqualToString:aEpisodeNum]) {
|
if ([[m[@"TV Episode #"] stringValue] isEqualToString:aEpisodeNum]) {
|
||||||
[r addObject:m];
|
[r addObject:m];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Season Number only
|
// Season Number only
|
||||||
else if (!(aEpisodeNum && [aEpisodeNum length]) && (aSeasonNum && [aSeasonNum length])) {
|
else if (!(aEpisodeNum && aEpisodeNum.length) && (aSeasonNum && aSeasonNum.length)) {
|
||||||
if ([m[@"TV Season"] integerValue] == [aSeasonNum integerValue]) {
|
if ([m[@"TV Season"] integerValue] == aSeasonNum.integerValue) {
|
||||||
[r addObject:m];
|
[r addObject:m];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!(aEpisodeNum && [aEpisodeNum length]) && !(aSeasonNum && [aSeasonNum length])) {
|
else if (!(aEpisodeNum && aEpisodeNum.length) && !(aSeasonNum && aSeasonNum.length)) {
|
||||||
[r addObject:m];
|
[r addObject:m];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [r autorelease];
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(NSString *)aSeasonNum episodeNum:(NSString *)aEpisodeNum
|
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(NSString *)aSeasonNum episodeNum:(NSString *)aEpisodeNum
|
||||||
@@ -180,13 +180,13 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
}
|
}
|
||||||
NSString *country = store[@"country2"];
|
NSString *country = store[@"country2"];
|
||||||
NSString *language = store[@"language2"];
|
NSString *language = store[@"language2"];
|
||||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=tvEpisode", country, [language lowercaseString], [SBMetadataHelper urlEncoded:[NSString stringWithFormat:@"%@ %@", aSeriesName, aEpisodeTitle]]]];
|
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=tvEpisode", country, language.lowercaseString, [SBMetadataHelper urlEncoded:[NSString stringWithFormat:@"%@ %@", aSeriesName, aEpisodeTitle]]]];
|
||||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||||
if (jsonData) {
|
if (jsonData) {
|
||||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||||
NSArray *results = [SBiTunesStore metadataForResults:d store:store];
|
NSArray *results = [SBiTunesStore metadataForResults:d store:store];
|
||||||
return [results firstObject];
|
return results.firstObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
@@ -206,7 +206,7 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||||
NSArray *results = [SBiTunesStore metadataForResults:d store:store];
|
NSArray *results = [SBiTunesStore metadataForResults:d store:store];
|
||||||
return [results firstObject];
|
return results.firstObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
@@ -298,7 +298,7 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
NSArray *nodes = [xml nodesForXPath:[NSString stringWithFormat:@"//li[@class='copyright']"] error:NULL];
|
NSArray *nodes = [xml nodesForXPath:[NSString stringWithFormat:@"//li[@class='copyright']"] error:NULL];
|
||||||
|
|
||||||
for (NSXMLNode *n in nodes) {
|
for (NSXMLNode *n in nodes) {
|
||||||
NSString *copyright = [n stringValue];
|
NSString *copyright = n.stringValue;
|
||||||
copyright = [copyright stringByReplacingOccurrencesOfString:@". All Rights Reserved." withString:@""];
|
copyright = [copyright stringByReplacingOccurrencesOfString:@". All Rights Reserved." withString:@""];
|
||||||
copyright = [copyright stringByReplacingOccurrencesOfString:@". All rights reserved." withString:@""];
|
copyright = [copyright stringByReplacingOccurrencesOfString:@". All rights reserved." withString:@""];
|
||||||
copyright = [copyright stringByReplacingOccurrencesOfString:@". All Rights Reserved" withString:@""];
|
copyright = [copyright stringByReplacingOccurrencesOfString:@". All Rights Reserved" withString:@""];
|
||||||
@@ -307,7 +307,6 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
metadata[@"Copyright"] = copyright;
|
metadata[@"Copyright"] = copyright;
|
||||||
}
|
}
|
||||||
|
|
||||||
[xml release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
@@ -320,15 +319,14 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
if (aXml) {
|
if (aXml) {
|
||||||
NSArray *nodes = [aXml nodesForXPath:[NSString stringWithFormat:@"//div[starts-with(@metrics-loc,'Titledbox_%@')]", aPeople] error:NULL];
|
NSArray *nodes = [aXml nodesForXPath:[NSString stringWithFormat:@"//div[starts-with(@metrics-loc,'Titledbox_%@')]", aPeople] error:NULL];
|
||||||
for (NSXMLNode *n in nodes) {
|
for (NSXMLNode *n in nodes) {
|
||||||
NSXMLDocument *subXML = [[NSXMLDocument alloc] initWithXMLString:[n XMLString] options:0 error:NULL];
|
NSXMLDocument *subXML = [[NSXMLDocument alloc] initWithXMLString:n.XMLString options:0 error:NULL];
|
||||||
if (subXML) {
|
if (subXML) {
|
||||||
NSArray *subNodes = [subXML nodesForXPath:@"//a" error:NULL];
|
NSArray *subNodes = [subXML nodesForXPath:@"//a" error:NULL];
|
||||||
NSMutableArray *r = [[NSMutableArray alloc] initWithCapacity:[subNodes count]];
|
NSMutableArray *r = [[NSMutableArray alloc] initWithCapacity:subNodes.count];
|
||||||
for (NSXMLNode *sub in subNodes) {
|
for (NSXMLNode *sub in subNodes) {
|
||||||
[r addObject:[sub stringValue]];
|
[r addObject:sub.stringValue];
|
||||||
}
|
}
|
||||||
[subXML release];
|
return r;
|
||||||
return [r autorelease];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,7 +380,7 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
if (season) {
|
if (season) {
|
||||||
metadata[@"TV Season"] = season;
|
metadata[@"TV Season"] = season;
|
||||||
|
|
||||||
NSString *episodeID = [NSString stringWithFormat:@"%d%02d", [season intValue], [r[@"trackNumber"] intValue]];
|
NSString *episodeID = [NSString stringWithFormat:@"%d%02d", season.intValue, [r[@"trackNumber"] intValue]];
|
||||||
metadata[@"TV Episode ID"] = episodeID;
|
metadata[@"TV Episode ID"] = episodeID;
|
||||||
|
|
||||||
metadata[@"Sort Album"] = [NSString stringWithFormat:@"%@, Season %@", r[@"artistName"], season];
|
metadata[@"Sort Album"] = [NSString stringWithFormat:@"%@, Season %@", r[@"artistName"], season];
|
||||||
@@ -422,9 +420,9 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
|
|
||||||
NSString *trackExplicitness = r[@"trackExplicitness"];
|
NSString *trackExplicitness = r[@"trackExplicitness"];
|
||||||
if ([trackExplicitness isEqualToString:@"explicit"]) {
|
if ([trackExplicitness isEqualToString:@"explicit"]) {
|
||||||
[metadata setContentRating:4];
|
metadata.contentRating = 4;
|
||||||
} else if ([trackExplicitness isEqualToString:@"cleaned"]) {
|
} else if ([trackExplicitness isEqualToString:@"cleaned"]) {
|
||||||
[metadata setContentRating:2];
|
metadata.contentRating = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Artworks
|
// Artworks
|
||||||
@@ -450,18 +448,17 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (artworkURL && artworkFullSizeURL) {
|
if (artworkURL && artworkFullSizeURL) {
|
||||||
[metadata setArtworkThumbURLs:@[artworkURL]];
|
metadata.artworkThumbURLs = @[artworkURL];
|
||||||
[metadata setArtworkFullsizeURLs:@[artworkFullSizeURL]];
|
metadata.artworkFullsizeURLs = @[artworkFullSizeURL];
|
||||||
[metadata setArtworkProviderNames:@[@"iTunes"]];
|
metadata.artworkProviderNames = @[@"iTunes"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add to array
|
// add to array
|
||||||
[returnArray addObject:metadata];
|
[returnArray addObject:metadata];
|
||||||
[metadata release];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return [returnArray autorelease];
|
return returnArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -15,7 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@class SBTableView;
|
@class SBTableView;
|
||||||
|
|
||||||
@interface SBChapterViewController : NSViewController {
|
@interface SBChapterViewController : NSViewController {
|
||||||
MP42ChapterTrack *track;
|
|
||||||
|
|
||||||
NSDictionary *detailBoldAttr;
|
NSDictionary *detailBoldAttr;
|
||||||
|
|
||||||
@@ -23,10 +22,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
IBOutlet NSButton *removeChapter;
|
IBOutlet NSButton *removeChapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setTrack:(MP42ChapterTrack *)track;
|
@property (nonatomic, readwrite, nullable) MP42ChapterTrack *track;
|
||||||
- (IBAction) addChapter: (id) sender;
|
|
||||||
- (IBAction) removeChapter: (id) sender;
|
- (IBAction)addChapter:(id)sender;
|
||||||
- (IBAction) renameChapters: (id) sender;
|
- (IBAction)removeChapter:(id)sender;
|
||||||
|
- (IBAction)renameChapters:(id)sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -17,44 +17,39 @@
|
|||||||
{
|
{
|
||||||
[super loadView];
|
[super loadView];
|
||||||
|
|
||||||
NSMutableParagraphStyle *ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
[ps setHeadIndent: -10.0];
|
ps.headIndent = -10.0;
|
||||||
[ps setAlignment:NSRightTextAlignment];
|
ps.alignment = NSRightTextAlignment;
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
detailBoldAttr = [@{ NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
detailBoldAttr = @{ NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
||||||
NSParagraphStyleAttributeName: ps,
|
NSParagraphStyleAttributeName: ps,
|
||||||
NSForegroundColorAttributeName: [NSColor grayColor] } retain];
|
NSForegroundColorAttributeName: [NSColor grayColor] };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
detailBoldAttr = [@{ NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
detailBoldAttr = @{ NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
||||||
NSParagraphStyleAttributeName: ps,
|
NSParagraphStyleAttributeName: ps,
|
||||||
NSForegroundColorAttributeName: [NSColor grayColor] } retain];
|
NSForegroundColorAttributeName: [NSColor grayColor] };
|
||||||
}
|
}
|
||||||
|
|
||||||
chapterTableView.defaultEditingColumn = 1;
|
chapterTableView.defaultEditingColumn = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setTrack:(MP42ChapterTrack *)chapterTrack
|
|
||||||
{
|
|
||||||
track = [chapterTrack retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSAttributedString *)boldString:(NSString *)string
|
- (NSAttributedString *)boldString:(NSString *)string
|
||||||
{
|
{
|
||||||
return [[[NSAttributedString alloc] initWithString:string attributes:detailBoldAttr] autorelease];
|
return [[NSAttributedString alloc] initWithString:string attributes:detailBoldAttr];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)t
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)t
|
||||||
{
|
{
|
||||||
return [track chapterCount];
|
return [self.track chapterCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) tableView:(NSTableView *)tableView
|
- (id) tableView:(NSTableView *)tableView
|
||||||
objectValueForTableColumn:(NSTableColumn *)tableColumn
|
objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||||
row:(NSInteger)rowIndex
|
row:(NSInteger)rowIndex
|
||||||
{
|
{
|
||||||
MP42TextSample *chapter = [track chapterAtIndex:rowIndex];
|
MP42TextSample *chapter = [self.track chapterAtIndex:rowIndex];
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"time"]) {
|
if ([tableColumn.identifier isEqualToString:@"time"]) {
|
||||||
return [self boldString:StringFromTime(chapter.timestamp, 1000)];
|
return [self boldString:StringFromTime(chapter.timestamp, 1000)];
|
||||||
@@ -72,29 +67,29 @@
|
|||||||
forTableColumn:(NSTableColumn *)tableColumn
|
forTableColumn:(NSTableColumn *)tableColumn
|
||||||
row:(NSInteger)rowIndex
|
row:(NSInteger)rowIndex
|
||||||
{
|
{
|
||||||
MP42TextSample * chapter = [track chapterAtIndex:rowIndex];
|
MP42TextSample *chapter = [self.track chapterAtIndex:rowIndex];
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"title"]) {
|
if ([tableColumn.identifier isEqualToString:@"title"]) {
|
||||||
if (![chapter.title isEqualToString:anObject]) {
|
if (![chapter.title isEqualToString:anObject]) {
|
||||||
[track setTitle:anObject forChapter:chapter];
|
[self.track setTitle:anObject forChapter:chapter];
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ([tableColumn.identifier isEqualToString:@"time"]) {
|
else if ([tableColumn.identifier isEqualToString:@"time"]) {
|
||||||
MP42Duration timestamp = TimeFromString(anObject, 1000);
|
MP42Duration timestamp = TimeFromString(anObject, 1000);
|
||||||
if (!(chapter.timestamp == timestamp)) {
|
if (!(chapter.timestamp == timestamp)) {
|
||||||
[track setTimestamp:timestamp forChapter:chapter];
|
[self.track setTimestamp:timestamp forChapter:chapter];
|
||||||
[chapterTableView reloadData];
|
[chapterTableView reloadData];
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([chapterTableView selectedRow] != -1) {
|
if (chapterTableView.selectedRow != -1) {
|
||||||
[removeChapter setEnabled:YES];
|
[removeChapter setEnabled:YES];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -105,13 +100,12 @@
|
|||||||
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
||||||
{
|
{
|
||||||
if ([tableColumn.identifier isEqualToString:@"time"]) {
|
if ([tableColumn.identifier isEqualToString:@"time"]) {
|
||||||
if ([[tableView selectedRowIndexes] containsIndex:rowIndex]) {
|
if ([tableView.selectedRowIndexes containsIndex:rowIndex]) {
|
||||||
// Without this, the color won't change because
|
// Without this, the color won't change because
|
||||||
// we are using a attributed string.
|
// we are using a attributed string.
|
||||||
NSMutableAttributedString *highlightedString = [[NSMutableAttributedString alloc] initWithAttributedString:[cell attributedStringValue]];
|
NSMutableAttributedString *highlightedString = [[NSMutableAttributedString alloc] initWithAttributedString:[cell attributedStringValue]];
|
||||||
[highlightedString addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0, [highlightedString length])];
|
[highlightedString addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0, highlightedString.length)];
|
||||||
[cell setAttributedStringValue:highlightedString];
|
[cell setAttributedStringValue:highlightedString];
|
||||||
[highlightedString release];
|
|
||||||
|
|
||||||
[cell setTextColor:[NSColor blackColor]];
|
[cell setTextColor:[NSColor blackColor]];
|
||||||
}
|
}
|
||||||
@@ -122,38 +116,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)removeChapter:(id)sender {
|
- (IBAction)removeChapter:(id)sender {
|
||||||
NSInteger current_index = [chapterTableView selectedRow];
|
NSInteger current_index = chapterTableView.selectedRow;
|
||||||
if (current_index < [track chapterCount]) {
|
if (current_index < [self.track chapterCount]) {
|
||||||
[track removeChapterAtIndex:current_index];
|
[self.track removeChapterAtIndex:current_index];
|
||||||
|
|
||||||
[chapterTableView reloadData];
|
[chapterTableView reloadData];
|
||||||
[[[[[self view] window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)addChapter:(id)sender {
|
- (IBAction)addChapter:(id)sender {
|
||||||
[track addChapter:@"Chapter" duration:0];
|
[self.track addChapter:@"Chapter" duration:0];
|
||||||
|
|
||||||
[chapterTableView reloadData];
|
[chapterTableView reloadData];
|
||||||
[[[[[self view] window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)renameChapters:(id)sender {
|
- (IBAction)renameChapters:(id)sender {
|
||||||
[track.chapters enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
[self.track.chapters enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
NSString *title = [NSString stringWithFormat:@"Chapter %lu", (unsigned long) idx + 1];
|
NSString *title = [NSString stringWithFormat:@"Chapter %lu", (unsigned long) idx + 1];
|
||||||
[track setTitle:title forChapter:(MP42TextSample *)obj];
|
[self.track setTitle:title forChapter:(MP42TextSample *)obj];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[chapterTableView reloadData];
|
[chapterTableView reloadData];
|
||||||
[[[[[self view] window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[track release];
|
|
||||||
[detailBoldAttr release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#import "SBEmptyViewController.h"
|
#import "SBEmptyViewController.h"
|
||||||
|
|
||||||
|
|
||||||
@implementation SBEmptyViewController
|
@implementation SBEmptyViewController
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -16,44 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@class SBTableView;
|
@class SBTableView;
|
||||||
@class SBImageBrowserView;
|
@class SBImageBrowserView;
|
||||||
|
|
||||||
@interface SBMovieViewController : NSViewController {
|
@interface SBMovieViewController : NSViewController
|
||||||
MP42Metadata *metadata;
|
|
||||||
|
|
||||||
IBOutlet NSPopUpButton *tagList;
|
@property (nonatomic, readwrite) MP42Metadata *metadata;
|
||||||
IBOutlet NSPopUpButton *setList;
|
|
||||||
|
|
||||||
IBOutlet SBTableView *tagsTableView;
|
|
||||||
|
|
||||||
IBOutlet NSPopUpButton *mediaKind;
|
|
||||||
IBOutlet NSPopUpButton *contentRating;
|
|
||||||
IBOutlet NSPopUpButton *hdVideo;
|
|
||||||
IBOutlet NSButton *gapless;
|
|
||||||
IBOutlet NSButton *podcast;
|
|
||||||
|
|
||||||
IBOutlet NSButton *removeTag;
|
|
||||||
|
|
||||||
IBOutlet NSWindow *saveWindow;
|
|
||||||
IBOutlet NSTextField *presetName;
|
|
||||||
|
|
||||||
NSPopUpButtonCell *ratingCell;
|
|
||||||
NSComboBoxCell *genreCell;
|
|
||||||
|
|
||||||
NSDictionary<NSString *, id> *tags;
|
|
||||||
NSArray<NSString *> *_tagsArray;
|
|
||||||
NSDictionary *detailBoldAttr;
|
|
||||||
|
|
||||||
NSMutableDictionary *dct;
|
|
||||||
NSTableColumn *tabCol;
|
|
||||||
CGFloat width;
|
|
||||||
|
|
||||||
IBOutlet SBImageBrowserView *imageBrowser;
|
|
||||||
|
|
||||||
IBOutlet NSButton *addArtwork;
|
|
||||||
IBOutlet NSButton *removeArtwork;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setFile: (MP42File *)file;
|
|
||||||
- (void) setMetadata: (MP42Metadata *)data;
|
|
||||||
|
|
||||||
- (IBAction) addTag: (id) sender;
|
- (IBAction) addTag: (id) sender;
|
||||||
- (IBAction) removeTag: (id) sender;
|
- (IBAction) removeTag: (id) sender;
|
||||||
|
|||||||
@@ -19,17 +19,45 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
#import <MP42Foundation/MP42File.h>
|
#import <MP42Foundation/MP42File.h>
|
||||||
|
|
||||||
@interface SBMovieViewController () <SBTableViewDelegate, SBImageBrowserViewDelegate>
|
@interface SBMovieViewController () <SBTableViewDelegate, SBImageBrowserViewDelegate>
|
||||||
|
{
|
||||||
|
IBOutlet NSPopUpButton *tagList;
|
||||||
|
IBOutlet NSPopUpButton *setList;
|
||||||
|
|
||||||
@property (nonatomic, retain) NSArray<NSString *> *tagsArray;
|
IBOutlet SBTableView *tagsTableView;
|
||||||
|
|
||||||
- (void) updateSetsMenu: (id)sender;
|
IBOutlet NSPopUpButton *mediaKind;
|
||||||
|
IBOutlet NSPopUpButton *contentRating;
|
||||||
|
IBOutlet NSPopUpButton *hdVideo;
|
||||||
|
IBOutlet NSButton *gapless;
|
||||||
|
IBOutlet NSButton *podcast;
|
||||||
|
|
||||||
|
IBOutlet NSButton *removeTag;
|
||||||
|
|
||||||
|
IBOutlet NSWindow *saveWindow;
|
||||||
|
IBOutlet NSTextField *presetName;
|
||||||
|
|
||||||
|
NSPopUpButtonCell *ratingCell;
|
||||||
|
NSComboBoxCell *genreCell;
|
||||||
|
|
||||||
|
NSArray<NSString *> *_tagsArray;
|
||||||
|
NSDictionary *detailBoldAttr;
|
||||||
|
|
||||||
|
NSMutableDictionary *dct;
|
||||||
|
NSTableColumn *tabCol;
|
||||||
|
CGFloat width;
|
||||||
|
|
||||||
|
IBOutlet SBImageBrowserView *imageBrowser;
|
||||||
|
|
||||||
|
IBOutlet NSButton *addArtwork;
|
||||||
|
IBOutlet NSButton *removeArtwork;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, strong) NSArray<NSString *> *tagsArray;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBMovieViewController
|
@implementation SBMovieViewController
|
||||||
|
|
||||||
@synthesize tagsArray = _tagsArray;
|
|
||||||
|
|
||||||
- (void)loadView
|
- (void)loadView
|
||||||
{
|
{
|
||||||
[super loadView];
|
[super loadView];
|
||||||
@@ -40,76 +68,64 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
selector:@selector(updateSetsMenu:)
|
selector:@selector(updateSetsMenu:)
|
||||||
name:@"SBPresetManagerUpdatedNotification" object:nil];
|
name:@"SBPresetManagerUpdatedNotification" object:nil];
|
||||||
|
|
||||||
NSArray<NSString *> *tagsMenu = [metadata writableMetadata];
|
NSArray<NSString *> *tagsMenu = [self.metadata writableMetadata];
|
||||||
for (NSString *tag in tagsMenu) {
|
for (NSString *tag in tagsMenu) {
|
||||||
[tagList addItemWithTitle:tag];
|
[tagList addItemWithTitle:tag];
|
||||||
}
|
}
|
||||||
|
|
||||||
ratingCell = [[NSPopUpButtonCell alloc] init];
|
ratingCell = [[NSPopUpButtonCell alloc] init];
|
||||||
[ratingCell setAutoenablesItems:NO];
|
[ratingCell setAutoenablesItems:NO];
|
||||||
[ratingCell setFont:[NSFont systemFontOfSize:11]];
|
ratingCell.font = [NSFont systemFontOfSize:11];
|
||||||
[ratingCell setControlSize:NSSmallControlSize];
|
ratingCell.controlSize = NSSmallControlSize;
|
||||||
[ratingCell setBordered:NO];
|
[ratingCell setBordered:NO];
|
||||||
|
|
||||||
NSArray *ratings = [[MP42Ratings defaultManager] ratings];
|
NSArray *ratings = [MP42Ratings defaultManager].ratings;
|
||||||
for (NSString *rating in ratings) {
|
for (NSString *rating in ratings) {
|
||||||
[[ratingCell menu] addItem:[[[NSMenuItem alloc] initWithTitle:rating action:NULL keyEquivalent:@""] autorelease]];
|
[ratingCell.menu addItem:[[NSMenuItem alloc] initWithTitle:rating action:NULL keyEquivalent:@""]];
|
||||||
}
|
}
|
||||||
|
|
||||||
genreCell = [[NSComboBoxCell alloc] init];
|
genreCell = [[NSComboBoxCell alloc] init];
|
||||||
[genreCell setCompletes:YES];
|
[genreCell setCompletes:YES];
|
||||||
[genreCell setFont:[NSFont systemFontOfSize:11]];
|
genreCell.font = [NSFont systemFontOfSize:11];
|
||||||
[genreCell setDrawsBackground:NO];
|
[genreCell setDrawsBackground:NO];
|
||||||
[genreCell setBezeled:NO];
|
[genreCell setBezeled:NO];
|
||||||
[genreCell setButtonBordered:NO];
|
[genreCell setButtonBordered:NO];
|
||||||
[genreCell setControlSize:NSSmallControlSize];
|
genreCell.controlSize = NSSmallControlSize;
|
||||||
[genreCell setIntercellSpacing:NSMakeSize(1.0, 1.0)];
|
genreCell.intercellSpacing = NSMakeSize(1.0, 1.0);
|
||||||
[genreCell setEditable:YES];
|
[genreCell setEditable:YES];
|
||||||
[genreCell addItemsWithObjectValues:[metadata availableGenres]];
|
[genreCell addItemsWithObjectValues:[self.metadata availableGenres]];
|
||||||
|
|
||||||
NSMutableParagraphStyle * ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
NSMutableParagraphStyle * ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
[ps setHeadIndent: -10.0];
|
ps.headIndent = -10.0;
|
||||||
[ps setAlignment:NSRightTextAlignment];
|
ps.alignment = NSRightTextAlignment;
|
||||||
|
|
||||||
[mediaKind selectItemWithTag:metadata.mediaKind];
|
[mediaKind selectItemWithTag:self.metadata.mediaKind];
|
||||||
[contentRating selectItemWithTag:metadata.contentRating];
|
[contentRating selectItemWithTag:self.metadata.contentRating];
|
||||||
[hdVideo selectItemWithTag:metadata.hdVideo];
|
[hdVideo selectItemWithTag:self.metadata.hdVideo];
|
||||||
[gapless setState:metadata.gapless];
|
gapless.state = self.metadata.gapless;
|
||||||
[podcast setState:metadata.podcast];
|
podcast.state = self.metadata.podcast;
|
||||||
|
|
||||||
tabCol = [[[tagsTableView tableColumns] objectAtIndex:1] retain];
|
tabCol = tagsTableView.tableColumns[1];
|
||||||
width = [tabCol width];
|
width = tabCol.width;
|
||||||
|
|
||||||
[self updateTagsArray];
|
[self updateTagsArray];
|
||||||
|
|
||||||
[tagsTableView setDoubleAction:@selector(doubleClickAction:)];
|
tagsTableView.doubleAction = @selector(doubleClickAction:);
|
||||||
[tagsTableView setTarget:self];
|
tagsTableView.target = self;
|
||||||
tagsTableView.pasteboardTypes = @[MetadataPBoardType];
|
tagsTableView.pasteboardTypes = @[MetadataPBoardType];
|
||||||
[tagsTableView scrollRowToVisible:0];
|
[tagsTableView scrollRowToVisible:0];
|
||||||
|
|
||||||
dct = [[NSMutableDictionary alloc] init];
|
dct = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
[imageBrowser setPasteboardTypes:[NSArray arrayWithObjects: NSPasteboardTypeTIFF, NSPasteboardTypePNG, nil]];
|
imageBrowser.pasteboardTypes = @[NSPasteboardTypeTIFF, NSPasteboardTypePNG];
|
||||||
[imageBrowser setZoomValue:1.0];
|
[imageBrowser setZoomValue:1.0];
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFile:(MP42File *)file
|
|
||||||
{
|
|
||||||
metadata = [file.metadata retain];
|
|
||||||
tags = metadata.tagsDict;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMetadata:(MP42Metadata *)data
|
|
||||||
{
|
|
||||||
metadata = [data retain];
|
|
||||||
tags = data.tagsDict;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) updateTagsArray
|
- (void) updateTagsArray
|
||||||
{
|
{
|
||||||
NSArray<NSString *> *context = [MP42Metadata availableMetadata];
|
NSArray<NSString *> *context = [MP42Metadata availableMetadata];
|
||||||
self.tagsArray = [[tags allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
|
self.tagsArray = [self.metadata.tagsDict.allKeys sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
|
||||||
NSInteger right = [context indexOfObject:obj2];
|
NSInteger right = [context indexOfObject:obj2];
|
||||||
NSInteger left = [context indexOfObject:obj1];
|
NSInteger left = [context indexOfObject:obj1];
|
||||||
|
|
||||||
@@ -122,16 +138,16 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
|
|
||||||
- (void) add:(NSDictionary *) data
|
- (void) add:(NSDictionary *) data
|
||||||
{
|
{
|
||||||
NSArray *metadataKeys = [data allKeys];
|
NSArray *metadataKeys = data.allKeys;
|
||||||
|
|
||||||
for (NSString *key in metadataKeys) {
|
for (NSString *key in metadataKeys) {
|
||||||
[metadata setTag:[data valueForKey:key] forKey:key];
|
[self.metadata setTag:[data valueForKey:key] forKey:key];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undo = [[self view] undoManager];
|
NSUndoManager *undo = self.view.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] remove:data];
|
[[undo prepareWithInvocationTarget:self] remove:data];
|
||||||
|
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Insert", @"Undo tag insert.")];
|
[undo setActionName:NSLocalizedString(@"Insert", @"Undo tag insert.")];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,16 +157,16 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
|
|
||||||
- (void) remove:(NSDictionary *) data
|
- (void) remove:(NSDictionary *) data
|
||||||
{
|
{
|
||||||
NSArray *metadataKeys = [data allKeys];
|
NSArray *metadataKeys = data.allKeys;
|
||||||
|
|
||||||
for (NSString *key in metadataKeys) {
|
for (NSString *key in metadataKeys) {
|
||||||
[metadata removeTagForKey:key];
|
[self.metadata removeTagForKey:key];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undo = [[self view] undoManager];
|
NSUndoManager *undo = self.view.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] add:data];
|
[[undo prepareWithInvocationTarget:self] add:data];
|
||||||
|
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Delete", @"Undo tag delete")];
|
[undo setActionName:NSLocalizedString(@"Delete", @"Undo tag delete")];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,21 +176,21 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
|
|
||||||
- (IBAction) addTag: (id) sender
|
- (IBAction) addTag: (id) sender
|
||||||
{
|
{
|
||||||
NSString *tagName = [[sender selectedItem] title];
|
NSString *tagName = [sender selectedItem].title;
|
||||||
|
|
||||||
if (![metadata.tagsDict valueForKey:tagName])
|
if (![self.metadata.tagsDict valueForKey:tagName])
|
||||||
[self add:[NSDictionary dictionaryWithObject:@"" forKey:tagName]];
|
[self add:@{tagName: @""}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) removeTag: (id) sender {
|
- (IBAction) removeTag: (id) sender {
|
||||||
NSIndexSet *rowIndexes = [tagsTableView selectedRowIndexes];
|
NSIndexSet *rowIndexes = tagsTableView.selectedRowIndexes;
|
||||||
NSUInteger current_index = [rowIndexes lastIndex];
|
NSUInteger current_index = rowIndexes.lastIndex;
|
||||||
NSMutableDictionary *tagDict = [[[NSMutableDictionary alloc] init] autorelease];
|
NSMutableDictionary *tagDict = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
while (current_index != NSNotFound) {
|
while (current_index != NSNotFound) {
|
||||||
if ([tagsTableView editedRow] == -1) {
|
if (tagsTableView.editedRow == -1) {
|
||||||
NSString *tagName = [self.tagsArray objectAtIndex:current_index];
|
NSString *tagName = (self.tagsArray)[current_index];
|
||||||
[tagDict setObject:[metadata.tagsDict valueForKey:tagName] forKey:tagName];
|
tagDict[tagName] = [self.metadata.tagsDict valueForKey:tagName];
|
||||||
}
|
}
|
||||||
current_index = [rowIndexes indexLessThanIndex: current_index];
|
current_index = [rowIndexes indexLessThanIndex: current_index];
|
||||||
}
|
}
|
||||||
@@ -183,36 +199,35 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
|
|
||||||
- (void) updateMetadata:(id)value forKey:(NSString *)key
|
- (void) updateMetadata:(id)value forKey:(NSString *)key
|
||||||
{
|
{
|
||||||
NSString *oldValue = [[[metadata tagsDict] valueForKey:key] retain];
|
NSString *oldValue = [self.metadata.tagsDict valueForKey:key];
|
||||||
|
|
||||||
if ([metadata setTag:value forKey:key]) {
|
if ([self.metadata setTag:value forKey:key]) {
|
||||||
|
|
||||||
[tagsTableView noteHeightOfRowsWithIndexesChanged:
|
[tagsTableView noteHeightOfRowsWithIndexesChanged:
|
||||||
[NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [tagsTableView numberOfRows])]];
|
[NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, tagsTableView.numberOfRows)]];
|
||||||
|
|
||||||
NSUndoManager *undo = [[self view] undoManager];
|
NSUndoManager *undo = self.view.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] updateMetadata:oldValue
|
[[undo prepareWithInvocationTarget:self] updateMetadata:oldValue
|
||||||
forKey:key];
|
forKey:key];
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Editing", @"Undo tag editing.")];
|
[undo setActionName:NSLocalizedString(@"Editing", @"Undo tag editing.")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[oldValue release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) allSet
|
- (NSArray *) allSet
|
||||||
{
|
{
|
||||||
return [metadata writableMetadata];
|
return [self.metadata writableMetadata];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) tvShowSet
|
- (NSArray *) tvShowSet
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects: @"Name", @"Artist", @"Album", @"Release Date", @"Track #", @"Disk #", @"TV Show", @"TV Episode #", @"TV Network", @"TV Episode ID", @"TV Season", @"Genre", @"Description", @"Long Description", nil];
|
return @[@"Name", @"Artist", @"Album", @"Release Date", @"Track #", @"Disk #", @"TV Show", @"TV Episode #", @"TV Network", @"TV Episode ID", @"TV Season", @"Genre", @"Description", @"Long Description"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *) movieSet
|
- (NSArray *) movieSet
|
||||||
{
|
{
|
||||||
return [NSArray arrayWithObjects: @"Name", @"Artist", @"Album", @"Genre", @"Release Date", @"Track #", @"Disk #", @"Cast", @"Director", @"Screenwriters", @"Genre", @"Description", @"Long Description", @"Rating", @"Copyright", nil];
|
return @[@"Name", @"Artist", @"Album", @"Genre", @"Release Date", @"Track #", @"Disk #", @"Cast", @"Director", @"Screenwriters", @"Genre", @"Description", @"Long Description", @"Rating", @"Copyright"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) addMetadataSet: (id)sender
|
- (IBAction) addMetadataSet: (id)sender
|
||||||
@@ -223,18 +238,18 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
}
|
}
|
||||||
else if ([sender tag] == 1) {
|
else if ([sender tag] == 1) {
|
||||||
metadataKeys = [self movieSet];
|
metadataKeys = [self movieSet];
|
||||||
metadata.mediaKind = 9;
|
self.metadata.mediaKind = 9;
|
||||||
[mediaKind selectItemWithTag:metadata.mediaKind];
|
[mediaKind selectItemWithTag:self.metadata.mediaKind];
|
||||||
}
|
}
|
||||||
else if ([sender tag] == 2) {
|
else if ([sender tag] == 2) {
|
||||||
metadataKeys = [self tvShowSet];
|
metadataKeys = [self tvShowSet];
|
||||||
metadata.mediaKind = 10;
|
self.metadata.mediaKind = 10;
|
||||||
[mediaKind selectItemWithTag:metadata.mediaKind];
|
[mediaKind selectItemWithTag:self.metadata.mediaKind];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableDictionary *tagDict = [[[NSMutableDictionary alloc] init] autorelease];
|
NSMutableDictionary *tagDict = [[NSMutableDictionary alloc] init];
|
||||||
for (NSString *key in metadataKeys) {
|
for (NSString *key in metadataKeys) {
|
||||||
if (![[metadata tagsDict] valueForKey:key])
|
if (![self.metadata.tagsDict valueForKey:key])
|
||||||
[tagDict setValue:@"" forKey:key];
|
[tagDict setValue:@"" forKey:key];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,33 +261,33 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
NSInteger tag = [sender tag];
|
NSInteger tag = [sender tag];
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
|
|
||||||
MP42Metadata *newTags = [[presetManager presets] objectAtIndex:tag];
|
MP42Metadata *newTags = presetManager.presets[tag];
|
||||||
|
|
||||||
NSArray *metadataKeys = [[newTags tagsDict] allKeys];
|
NSArray *metadataKeys = newTags.tagsDict.allKeys;
|
||||||
|
|
||||||
NSMutableDictionary *tagDict = [[[NSMutableDictionary alloc] init] autorelease];
|
NSMutableDictionary *tagDict = [[NSMutableDictionary alloc] init];
|
||||||
for (NSString *key in metadataKeys) {
|
for (NSString *key in metadataKeys) {
|
||||||
[tagDict setValue:[[newTags tagsDict] valueForKey:key] forKey:key];
|
[tagDict setValue:[newTags.tagsDict valueForKey:key] forKey:key];
|
||||||
}
|
}
|
||||||
|
|
||||||
[metadata.artworks addObjectsFromArray:newTags.artworks];
|
[self.metadata.artworks addObjectsFromArray:newTags.artworks];
|
||||||
[metadata setIsArtworkEdited:YES];
|
[self.metadata setIsArtworkEdited:YES];
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
|
|
||||||
metadata.mediaKind = newTags.mediaKind;
|
self.metadata.mediaKind = newTags.mediaKind;
|
||||||
[mediaKind selectItemWithTag:metadata.mediaKind];
|
[mediaKind selectItemWithTag:self.metadata.mediaKind];
|
||||||
|
|
||||||
metadata.hdVideo = newTags.hdVideo;
|
self.metadata.hdVideo = newTags.hdVideo;
|
||||||
[hdVideo selectItemWithTag:metadata.hdVideo];
|
[hdVideo selectItemWithTag:self.metadata.hdVideo];
|
||||||
|
|
||||||
metadata.gapless = newTags.gapless;
|
self.metadata.gapless = newTags.gapless;
|
||||||
[gapless setState:metadata.gapless];
|
gapless.state = self.metadata.gapless;
|
||||||
|
|
||||||
metadata.podcast = newTags.podcast;
|
self.metadata.podcast = newTags.podcast;
|
||||||
[podcast setState:metadata.podcast];
|
podcast.state = self.metadata.podcast;
|
||||||
|
|
||||||
metadata.contentRating = newTags.contentRating;
|
self.metadata.contentRating = newTags.contentRating;
|
||||||
[contentRating selectItemWithTag:metadata.contentRating];
|
[contentRating selectItemWithTag:self.metadata.contentRating];
|
||||||
|
|
||||||
[self add:tagDict];
|
[self add:tagDict];
|
||||||
}
|
}
|
||||||
@@ -280,31 +295,31 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
- (void) updateSetsMenu: (id)sender
|
- (void) updateSetsMenu: (id)sender
|
||||||
{
|
{
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
NSMenu * setListMenu = [setList menu];
|
NSMenu * setListMenu = setList.menu;
|
||||||
|
|
||||||
while ([setListMenu numberOfItems] > 1) {
|
while (setListMenu.numberOfItems > 1) {
|
||||||
[setListMenu removeItemAtIndex: 1];
|
[setListMenu removeItemAtIndex: 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMenuItem *newItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Save Set", @"Set menu") action:@selector(showSaveSet:) keyEquivalent:@""] autorelease];
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Save Set", @"Set menu") action:@selector(showSaveSet:) keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[setListMenu addItem:newItem];
|
[setListMenu addItem:newItem];
|
||||||
|
|
||||||
[setListMenu addItem:[NSMenuItem separatorItem]];
|
[setListMenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
|
||||||
newItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"All", @"Set menu All set") action:@selector(addMetadataSet:) keyEquivalent:@""] autorelease];
|
newItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"All", @"Set menu All set") action:@selector(addMetadataSet:) keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag: 0];
|
newItem.tag = 0;
|
||||||
[setListMenu addItem:newItem];
|
[setListMenu addItem:newItem];
|
||||||
|
|
||||||
newItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Movie", @"Set menu Movie set") action:@selector(addMetadataSet:) keyEquivalent:@""] autorelease];
|
newItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Movie", @"Set menu Movie set") action:@selector(addMetadataSet:) keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag: 1];
|
newItem.tag = 1;
|
||||||
[setListMenu addItem:newItem];
|
[setListMenu addItem:newItem];
|
||||||
|
|
||||||
newItem = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"TV Show", @"Set menu TV Show Set") action:@selector(addMetadataSet:) keyEquivalent:@""] autorelease];
|
newItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"TV Show", @"Set menu TV Show Set") action:@selector(addMetadataSet:) keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag: 2];
|
newItem.tag = 2;
|
||||||
[setListMenu addItem:newItem];
|
[setListMenu addItem:newItem];
|
||||||
|
|
||||||
if (presetManager.presets.count) {
|
if (presetManager.presets.count) {
|
||||||
@@ -313,22 +328,21 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
|
|
||||||
NSUInteger i = 0;
|
NSUInteger i = 0;
|
||||||
for (MP42Metadata *set in presetManager.presets) {
|
for (MP42Metadata *set in presetManager.presets) {
|
||||||
newItem = [[NSMenuItem alloc] initWithTitle:[set presetName] action:@selector(applySet:) keyEquivalent:@""];
|
newItem = [[NSMenuItem alloc] initWithTitle:set.presetName action:@selector(applySet:) keyEquivalent:@""];
|
||||||
if (i < 9) {
|
if (i < 9) {
|
||||||
[newItem setKeyEquivalent:[NSString stringWithFormat:@"%lu", (unsigned long)i+1]];
|
newItem.keyEquivalent = [NSString stringWithFormat:@"%lu", (unsigned long)i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag:i++];
|
newItem.tag = i++;
|
||||||
|
|
||||||
[setListMenu addItem:newItem];
|
[setListMenu addItem:newItem];
|
||||||
[newItem release];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) showSaveSet: (id)sender
|
- (IBAction) showSaveSet: (id)sender
|
||||||
{
|
{
|
||||||
[NSApp beginSheet:saveWindow modalForWindow:[[self view]window]
|
[NSApp beginSheet:saveWindow modalForWindow:self.view.window
|
||||||
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,8 +350,8 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
{
|
{
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
|
|
||||||
[metadata setPresetName:[presetName stringValue]];
|
self.metadata.presetName = presetName.stringValue;
|
||||||
[presetManager newSetFromExistingMetadata: metadata];
|
[presetManager newSetFromExistingMetadata: self.metadata];
|
||||||
|
|
||||||
[NSApp endSheet: saveWindow];
|
[NSApp endSheet: saveWindow];
|
||||||
[saveWindow orderOut:self];
|
[saveWindow orderOut:self];
|
||||||
@@ -373,14 +387,14 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
- (void)_copySelectionFromTableView:(NSTableView *)tableView;
|
- (void)_copySelectionFromTableView:(NSTableView *)tableView;
|
||||||
{
|
{
|
||||||
NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
||||||
NSIndexSet *rowIndexes = [tableView selectedRowIndexes];
|
NSIndexSet *rowIndexes = tableView.selectedRowIndexes;
|
||||||
NSUInteger current_index = [rowIndexes lastIndex];
|
NSUInteger current_index = rowIndexes.lastIndex;
|
||||||
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
|
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
|
||||||
NSString *string = @"";
|
NSString *string = @"";
|
||||||
|
|
||||||
while (current_index != NSNotFound) {
|
while (current_index != NSNotFound) {
|
||||||
NSString *tagName = [self.tagsArray objectAtIndex:current_index];
|
NSString *tagName = (self.tagsArray)[current_index];
|
||||||
NSString *tagValue = [tags objectForKey:tagName];
|
NSString *tagValue = self.metadata.tagsDict[tagName];
|
||||||
string = [string stringByAppendingFormat:@"%@: %@\n",tagName, tagValue];
|
string = [string stringByAppendingFormat:@"%@: %@\n",tagName, tagValue];
|
||||||
[data setValue:tagValue forKey:tagName];
|
[data setValue:tagValue forKey:tagName];
|
||||||
|
|
||||||
@@ -391,7 +405,6 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
[pb declareTypes:types owner:nil];
|
[pb declareTypes:types owner:nil];
|
||||||
[pb setString:string forType: NSStringPboardType];
|
[pb setString:string forType: NSStringPboardType];
|
||||||
[pb setData:[NSArchiver archivedDataWithRootObject:data] forType:MetadataPBoardType];
|
[pb setData:[NSArchiver archivedDataWithRootObject:data] forType:MetadataPBoardType];
|
||||||
[data release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_cutSelectionFromTableView:(NSTableView *)tableView;
|
- (void)_cutSelectionFromTableView:(NSTableView *)tableView;
|
||||||
@@ -413,9 +426,8 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
{
|
{
|
||||||
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
||||||
|
|
||||||
NSArray *classes = [NSArray arrayWithObjects:[NSURL class], [NSImage class], nil];
|
NSArray *classes = @[[NSURL class], [NSImage class]];
|
||||||
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSImage imageTypes]
|
NSDictionary *options = @{NSPasteboardURLReadingContentsConformToTypesKey: [NSImage imageTypes]};
|
||||||
forKey:NSPasteboardURLReadingContentsConformToTypesKey];
|
|
||||||
NSArray *copiedItems = [pasteboard readObjectsForClasses:classes options:options];
|
NSArray *copiedItems = [pasteboard readObjectsForClasses:classes options:options];
|
||||||
|
|
||||||
if (copiedItems != nil) {
|
if (copiedItems != nil) {
|
||||||
@@ -423,9 +435,9 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
[self addArtwork:item];
|
[self addArtwork:item];
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata.isArtworkEdited = YES;
|
self.metadata.isArtworkEdited = YES;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,7 +446,7 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
|
|
||||||
- (NSInteger) numberOfRowsInTableView: (NSTableView *) t
|
- (NSInteger) numberOfRowsInTableView: (NSTableView *) t
|
||||||
{
|
{
|
||||||
return [[metadata tagsDict] count];
|
return self.metadata.tagsDict.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||||
@@ -443,10 +455,10 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
NSString *tagName = nil;
|
NSString *tagName = nil;
|
||||||
|
|
||||||
if (tableColumn != nil)
|
if (tableColumn != nil)
|
||||||
tagName = [self.tagsArray objectAtIndex:row];
|
tagName = (self.tagsArray)[row];
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
||||||
cell = [tableColumn dataCell];
|
cell = tableColumn.dataCell;
|
||||||
}
|
}
|
||||||
else if ([tableColumn.identifier isEqualToString:@"value"]) {
|
else if ([tableColumn.identifier isEqualToString:@"value"]) {
|
||||||
if ([tagName isEqualToString:@"Rating"]) {
|
if ([tagName isEqualToString:@"Rating"]) {
|
||||||
@@ -456,7 +468,7 @@ NSString *MetadataPBoardType = @"SublerMetadataPBoardType";
|
|||||||
cell = genreCell;
|
cell = genreCell;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cell = [tableColumn dataCell];
|
cell = tableColumn.dataCell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -475,7 +487,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
||||||
return tags[self.tagsArray[rowIndex]];
|
return self.metadata.tagsDict[self.tagsArray[rowIndex]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
@@ -486,7 +498,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
forTableColumn: (NSTableColumn *) tableColumn
|
forTableColumn: (NSTableColumn *) tableColumn
|
||||||
row: (NSInteger) rowIndex
|
row: (NSInteger) rowIndex
|
||||||
{
|
{
|
||||||
NSString *tagName = [self.tagsArray objectAtIndex:rowIndex];
|
NSString *tagName = (self.tagsArray)[rowIndex];
|
||||||
[dct removeAllObjects];
|
[dct removeAllObjects];
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
||||||
@@ -497,16 +509,16 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (CGFloat) tableView: (NSTableView *) tableView
|
- (CGFloat) tableView: (NSTableView *) tableView
|
||||||
heightOfRow: (NSInteger) rowIndex
|
heightOfRow: (NSInteger) rowIndex
|
||||||
{
|
{
|
||||||
NSString *key = [self.tagsArray objectAtIndex:rowIndex];
|
NSString *key = (self.tagsArray)[rowIndex];
|
||||||
CGFloat height;
|
CGFloat height;
|
||||||
|
|
||||||
if (!(height = [[dct objectForKey:key] floatValue])) {
|
if (!(height = [dct[key] floatValue])) {
|
||||||
//calculate new row height
|
//calculate new row height
|
||||||
NSRect r = NSMakeRect(0,0,width,1000.0);
|
NSRect r = NSMakeRect(0,0,width,1000.0);
|
||||||
NSTextFieldCell *cell = [tabCol dataCellForRow:rowIndex];
|
NSTextFieldCell *cell = [tabCol dataCellForRow:rowIndex];
|
||||||
[cell setObjectValue:[tags objectForKey:[self.tagsArray objectAtIndex:rowIndex]]];
|
cell.objectValue = self.metadata.tagsDict[(self.tagsArray)[rowIndex]];
|
||||||
height = [cell cellSizeForBounds:r].height; // Slow, but we cache it.
|
height = [cell cellSizeForBounds:r].height; // Slow, but we cache it.
|
||||||
[dct setObject:@(height) forKey:key];
|
dct[key] = @(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (height < 14.0) {
|
if (height < 14.0) {
|
||||||
@@ -530,7 +542,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
||||||
{
|
{
|
||||||
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
||||||
if ([[tableView selectedRowIndexes] containsIndex:rowIndex]) {
|
if ([tableView.selectedRowIndexes containsIndex:rowIndex]) {
|
||||||
[cell setTextColor:[NSColor blackColor]];
|
[cell setTextColor:[NSColor blackColor]];
|
||||||
} else {
|
} else {
|
||||||
[cell setTextColor:[NSColor grayColor]];
|
[cell setTextColor:[NSColor grayColor]];
|
||||||
@@ -541,14 +553,14 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (void)tableViewColumnDidResize: (NSNotification* )notification
|
- (void)tableViewColumnDidResize: (NSNotification* )notification
|
||||||
{
|
{
|
||||||
[dct removeAllObjects];
|
[dct removeAllObjects];
|
||||||
width = [tabCol width];
|
width = tabCol.width;
|
||||||
[tagsTableView noteHeightOfRowsWithIndexesChanged:
|
[tagsTableView noteHeightOfRowsWithIndexesChanged:
|
||||||
[NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [tagsTableView numberOfRows])]];
|
[NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, tagsTableView.numberOfRows)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([tagsTableView selectedRow] != -1)
|
if (tagsTableView.selectedRow != -1)
|
||||||
[removeTag setEnabled:YES];
|
[removeTag setEnabled:YES];
|
||||||
else
|
else
|
||||||
[removeTag setEnabled:NO];
|
[removeTag setEnabled:NO];
|
||||||
@@ -558,23 +570,23 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
- (IBAction) changeMediaKind: (id) sender
|
- (IBAction) changeMediaKind: (id) sender
|
||||||
{
|
{
|
||||||
uint8_t tagName = (uint8_t)[[sender selectedItem] tag];
|
uint8_t tagName = (uint8_t)[sender selectedItem].tag;
|
||||||
|
|
||||||
if (metadata.mediaKind != tagName) {
|
if (self.metadata.mediaKind != tagName) {
|
||||||
metadata.mediaKind = tagName;
|
self.metadata.mediaKind = tagName;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) changecContentRating: (id) sender
|
- (IBAction) changecContentRating: (id) sender
|
||||||
{
|
{
|
||||||
uint8_t tagName = (uint8_t)[[sender selectedItem] tag];
|
uint8_t tagName = (uint8_t)[sender selectedItem].tag;
|
||||||
|
|
||||||
if (metadata.contentRating != tagName) {
|
if (self.metadata.contentRating != tagName) {
|
||||||
metadata.contentRating = tagName;
|
self.metadata.contentRating = tagName;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,22 +594,22 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
{
|
{
|
||||||
uint8_t newValue;
|
uint8_t newValue;
|
||||||
if (sender == gapless) {
|
if (sender == gapless) {
|
||||||
newValue = (uint8_t)[gapless state];
|
newValue = (uint8_t)gapless.state;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newValue = ![gapless state];
|
newValue = !gapless.state;
|
||||||
[gapless setState:newValue];
|
gapless.state = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metadata.gapless != newValue) {
|
if (self.metadata.gapless != newValue) {
|
||||||
metadata.gapless = newValue;
|
self.metadata.gapless = newValue;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undo = [[self view] undoManager];
|
NSUndoManager *undo = self.view.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] changeGapless: self];
|
[[undo prepareWithInvocationTarget:self] changeGapless: self];
|
||||||
|
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Check Gapless", @"Undo check gapless")];
|
[undo setActionName:NSLocalizedString(@"Check Gapless", @"Undo check gapless")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -606,33 +618,33 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
{
|
{
|
||||||
uint8_t newValue;
|
uint8_t newValue;
|
||||||
if (sender == podcast) {
|
if (sender == podcast) {
|
||||||
newValue = (uint8_t)[podcast state];
|
newValue = (uint8_t)podcast.state;
|
||||||
} else {
|
} else {
|
||||||
newValue = ![podcast state];
|
newValue = !podcast.state;
|
||||||
[podcast setState:newValue];
|
podcast.state = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metadata.podcast != newValue) {
|
if (self.metadata.podcast != newValue) {
|
||||||
metadata.podcast = newValue;
|
self.metadata.podcast = newValue;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undo = [[self view] undoManager];
|
NSUndoManager *undo = self.view.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] changePodcast: self];
|
[[undo prepareWithInvocationTarget:self] changePodcast: self];
|
||||||
|
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Check Podast", @"Undo check podcast")];
|
[undo setActionName:NSLocalizedString(@"Check Podast", @"Undo check podcast")];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) changehdVideo: (id) sender
|
- (IBAction) changehdVideo: (id) sender
|
||||||
{
|
{
|
||||||
uint8_t tagName = (uint8_t)[[sender selectedItem] tag];
|
uint8_t tagName = (uint8_t)[sender selectedItem].tag;
|
||||||
|
|
||||||
if (metadata.hdVideo != tagName) {
|
if (self.metadata.hdVideo != tagName) {
|
||||||
metadata.hdVideo = tagName;
|
self.metadata.hdVideo = tagName;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -641,28 +653,28 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
- (NSUInteger)numberOfItemsInImageBrowser:(IKImageBrowserView *) aBrowser
|
- (NSUInteger)numberOfItemsInImageBrowser:(IKImageBrowserView *) aBrowser
|
||||||
{
|
{
|
||||||
return [metadata.artworks count];
|
return (self.metadata.artworks).count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index
|
- (id)imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index
|
||||||
{
|
{
|
||||||
return [metadata.artworks objectAtIndex:index];
|
return (self.metadata.artworks)[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex
|
- (BOOL)imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex
|
||||||
{
|
{
|
||||||
destinationIndex -= [indexes countOfIndexesInRange:NSMakeRange(0, destinationIndex)];;
|
destinationIndex -= [indexes countOfIndexesInRange:NSMakeRange(0, destinationIndex)];;
|
||||||
|
|
||||||
NSArray *objects = [metadata.artworks objectsAtIndexes:indexes];
|
NSArray *objects = [self.metadata.artworks objectsAtIndexes:indexes];
|
||||||
[metadata.artworks removeObjectsAtIndexes:indexes];
|
[self.metadata.artworks removeObjectsAtIndexes:indexes];
|
||||||
|
|
||||||
for (id object in objects.reverseObjectEnumerator) {
|
for (id object in objects.reverseObjectEnumerator) {
|
||||||
[metadata.artworks insertObject:object atIndex:destinationIndex];
|
[self.metadata.artworks insertObject:object atIndex:destinationIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
metadata.isArtworkEdited = YES;
|
self.metadata.isArtworkEdited = YES;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@@ -672,8 +684,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
NSInteger index;
|
NSInteger index;
|
||||||
[pasteboard declareTypes:@[NSTIFFPboardType] owner:nil];
|
[pasteboard declareTypes:@[NSTIFFPboardType] owner:nil];
|
||||||
|
|
||||||
for (index = [itemIndexes lastIndex]; index != NSNotFound; index = [itemIndexes indexLessThanIndex:index]) {
|
for (index = itemIndexes.lastIndex; index != NSNotFound; index = [itemIndexes indexLessThanIndex:index]) {
|
||||||
NSArray *representations = [[[metadata.artworks objectAtIndex:index] image] representations];
|
NSArray *representations = (self.metadata.artworks)[index].image.representations;
|
||||||
if (representations) {
|
if (representations) {
|
||||||
NSData *bitmapData = [NSBitmapImageRep representationOfImageRepsInArray:representations
|
NSData *bitmapData = [NSBitmapImageRep representationOfImageRepsInArray:representations
|
||||||
usingType:NSTIFFFileType properties:@{}];
|
usingType:NSTIFFFileType properties:@{}];
|
||||||
@@ -681,17 +693,17 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [itemIndexes count];
|
return itemIndexes.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)imageBrowser:(IKImageBrowserView *) aBrowser removeItemsAtIndexes:(NSIndexSet *) indexes
|
- (void)imageBrowser:(IKImageBrowserView *) aBrowser removeItemsAtIndexes:(NSIndexSet *) indexes
|
||||||
{
|
{
|
||||||
[metadata.artworks removeObjectsAtIndexes:indexes];
|
[self.metadata.artworks removeObjectsAtIndexes:indexes];
|
||||||
|
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
metadata.isArtworkEdited = YES;
|
self.metadata.isArtworkEdited = YES;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@@ -709,11 +721,13 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)zoomSliderDidChange:(id)sender {
|
- (IBAction)zoomSliderDidChange:(id)sender
|
||||||
|
{
|
||||||
[imageBrowser setZoomValue:[sender floatValue]];
|
[imageBrowser setZoomValue:[sender floatValue]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)removeArtwork:(id)sender {
|
- (IBAction)removeArtwork:(id)sender
|
||||||
|
{
|
||||||
[self imageBrowser:imageBrowser removeItemsAtIndexes:[imageBrowser selectionIndexes]];
|
[self imageBrowser:imageBrowser removeItemsAtIndexes:[imageBrowser selectionIndexes]];
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
}
|
}
|
||||||
@@ -727,24 +741,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
if ([item getResourceValue:&type forKey:NSURLTypeIdentifierKey error:&error]) {
|
if ([item getResourceValue:&type forKey:NSURLTypeIdentifierKey error:&error]) {
|
||||||
if (UTTypeConformsTo((__bridge CFStringRef)type, (__bridge CFStringRef)@"public.jpeg")) {
|
if (UTTypeConformsTo((__bridge CFStringRef)type, (__bridge CFStringRef)@"public.jpeg")) {
|
||||||
MP42Image *artwork = [[MP42Image alloc] initWithData:[NSData dataWithContentsOfURL:item] type:MP42_ART_JPEG];
|
MP42Image *artwork = [[MP42Image alloc] initWithData:[NSData dataWithContentsOfURL:item] type:MP42_ART_JPEG];
|
||||||
[metadata.artworks addObject:artwork];
|
[self.metadata.artworks addObject:artwork];
|
||||||
[artwork release];
|
|
||||||
} else {
|
} else {
|
||||||
NSImage *artworkImage = [[NSImage alloc] initWithContentsOfURL:item];
|
NSImage *artworkImage = [[NSImage alloc] initWithContentsOfURL:item];
|
||||||
MP42Image *artwork = [[MP42Image alloc] initWithImage:artworkImage];
|
MP42Image *artwork = [[MP42Image alloc] initWithImage:artworkImage];
|
||||||
[metadata.artworks addObject:artwork];
|
[self.metadata.artworks addObject:artwork];
|
||||||
[artwork release];
|
|
||||||
[artworkImage release];
|
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
} else if ([item isKindOfClass:[NSImage class]]) {
|
} else if ([item isKindOfClass:[NSImage class]]) {
|
||||||
MP42Image *artwork = [[MP42Image alloc] initWithImage:item];
|
MP42Image *artwork = [[MP42Image alloc] initWithImage:item];
|
||||||
[metadata.artworks addObject:artwork];
|
[self.metadata.artworks addObject:artwork];
|
||||||
[artwork release];
|
|
||||||
return YES;
|
return YES;
|
||||||
} else if ([item isKindOfClass:[MP42Image class]]) {
|
} else if ([item isKindOfClass:[MP42Image class]]) {
|
||||||
[metadata.artworks addObject:item];
|
[self.metadata.artworks addObject:item];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -766,10 +776,10 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
[self addArtwork:url];
|
[self addArtwork:url];
|
||||||
}
|
}
|
||||||
|
|
||||||
metadata.isArtworkEdited = YES;
|
self.metadata.isArtworkEdited = YES;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
[[[[[self view] window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
[imageBrowser reloadData];
|
[self->imageBrowser reloadData];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@@ -799,9 +809,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (edited) {
|
if (edited) {
|
||||||
metadata.isArtworkEdited = YES;
|
self.metadata.isArtworkEdited = YES;
|
||||||
metadata.isEdited = YES;
|
self.metadata.isEdited = YES;
|
||||||
[[[[[self view] window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
@@ -825,15 +835,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
[tagsTableView setDelegate:nil];
|
[tagsTableView setDelegate:nil];
|
||||||
[tagsTableView setDataSource:nil];
|
[tagsTableView setDataSource:nil];
|
||||||
|
|
||||||
[_tagsArray release];
|
|
||||||
[tabCol release];
|
|
||||||
[ratingCell release];
|
|
||||||
[genreCell release];
|
|
||||||
[dct release];
|
|
||||||
|
|
||||||
[metadata release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
// Media Tags controls
|
// Media Tags controls
|
||||||
_mediaTagsController = [[SBMediaTagsController alloc] initWithTrack:track];
|
_mediaTagsController = [[SBMediaTagsController alloc] initWithTrack:track];
|
||||||
|
|
||||||
[_mediaTagsController.view setFrame: [mediaTagsView bounds]];
|
(_mediaTagsController.view).frame = mediaTagsView.bounds;
|
||||||
[_mediaTagsController.view setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )];
|
(_mediaTagsController.view).autoresizingMask = ( NSViewWidthSizable | NSViewHeightSizable );
|
||||||
|
|
||||||
[mediaTagsView addSubview:_mediaTagsController.view];
|
[mediaTagsView addSubview:_mediaTagsController.view];
|
||||||
|
|
||||||
@@ -36,16 +36,16 @@
|
|||||||
NSInteger selectedItem = 0;
|
NSInteger selectedItem = 0;
|
||||||
|
|
||||||
for (MP42AudioTrack *fileTrack in [mp4file tracksWithMediaType:MP42MediaTypeAudio]) {
|
for (MP42AudioTrack *fileTrack in [mp4file tracksWithMediaType:MP42MediaTypeAudio]) {
|
||||||
if ([[fileTrack format] isEqualToString:MP42AudioFormatAAC]) {
|
if ([fileTrack.format isEqualToString:MP42AudioFormatAAC]) {
|
||||||
NSMenuItem *newItem = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
||||||
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
||||||
fileTrack.name,
|
fileTrack.name,
|
||||||
fileTrack.language]
|
fileTrack.language]
|
||||||
action:@selector(setFallbackTrack:)
|
action:@selector(setFallbackTrack:)
|
||||||
keyEquivalent:@""] autorelease];
|
keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag:i];
|
newItem.tag = i;
|
||||||
[[fallback menu] addItem:newItem];
|
[fallback.menu addItem:newItem];
|
||||||
[_fallbacks addObject:fileTrack];
|
[_fallbacks addObject:fileTrack];
|
||||||
|
|
||||||
if (track.fallbackTrack == fileTrack)
|
if (track.fallbackTrack == fileTrack)
|
||||||
@@ -66,15 +66,15 @@
|
|||||||
NSInteger selectedItem = 0;
|
NSInteger selectedItem = 0;
|
||||||
|
|
||||||
for (MP42SubtitleTrack *fileTrack in [mp4file tracksWithMediaType:MP42MediaTypeSubtitle]) {
|
for (MP42SubtitleTrack *fileTrack in [mp4file tracksWithMediaType:MP42MediaTypeSubtitle]) {
|
||||||
NSMenuItem *newItem = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
||||||
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
||||||
fileTrack.name,
|
fileTrack.name,
|
||||||
fileTrack.language]
|
fileTrack.language]
|
||||||
action:@selector(setFollowsTrack:)
|
action:@selector(setFollowsTrack:)
|
||||||
keyEquivalent:@""] autorelease];
|
keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag:i];
|
newItem.tag = i;
|
||||||
[[follows menu] addItem:newItem];
|
[follows.menu addItem:newItem];
|
||||||
[_follows addObject:fileTrack];
|
[_follows addObject:fileTrack];
|
||||||
|
|
||||||
if (track.followsTrack == fileTrack)
|
if (track.followsTrack == fileTrack)
|
||||||
@@ -85,17 +85,17 @@
|
|||||||
|
|
||||||
[follows selectItemWithTag:selectedItem];
|
[follows selectItemWithTag:selectedItem];
|
||||||
|
|
||||||
[volume setFloatValue:track.volume * 100];
|
volume.floatValue = track.volume * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFile:(MP42File *)mp4
|
- (void)setFile:(MP42File *)mp4
|
||||||
{
|
{
|
||||||
mp4file = [mp4 retain];
|
mp4file = mp4;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setTrack:(MP42AudioTrack *)soundTrack
|
- (void)setTrack:(MP42AudioTrack *)soundTrack
|
||||||
{
|
{
|
||||||
track = [soundTrack retain];
|
track = soundTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)setTrackVolume:(id)sender
|
- (IBAction)setTrackVolume:(id)sender
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
NSInteger index = [sender tag];
|
NSInteger index = [sender tag];
|
||||||
|
|
||||||
if (index) {
|
if (index) {
|
||||||
MP42AudioTrack *audioTrack = [_fallbacks objectAtIndex:index-1];
|
MP42AudioTrack *audioTrack = _fallbacks[index-1];
|
||||||
|
|
||||||
if (audioTrack != track.fallbackTrack) {
|
if (audioTrack != track.fallbackTrack) {
|
||||||
track.fallbackTrack = audioTrack;
|
track.fallbackTrack = audioTrack;
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
NSInteger index = [sender tag];
|
NSInteger index = [sender tag];
|
||||||
|
|
||||||
if (index) {
|
if (index) {
|
||||||
MP42SubtitleTrack *subTrack = [_follows objectAtIndex:index-1];
|
MP42SubtitleTrack *subTrack = _follows[index-1];
|
||||||
|
|
||||||
if (subTrack != track.followsTrack) {
|
if (subTrack != track.followsTrack) {
|
||||||
track.followsTrack = subTrack;
|
track.followsTrack = subTrack;
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
|
|
||||||
- (IBAction)setAltenateGroup:(id)sender
|
- (IBAction)setAltenateGroup:(id)sender
|
||||||
{
|
{
|
||||||
NSInteger tagName = [[sender selectedItem] tag];
|
NSInteger tagName = [sender selectedItem].tag;
|
||||||
|
|
||||||
if (track.alternate_group != tagName) {
|
if (track.alternate_group != tagName) {
|
||||||
track.alternate_group = tagName;
|
track.alternate_group = tagName;
|
||||||
@@ -153,17 +153,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[track release];
|
|
||||||
[mp4file release];
|
|
||||||
|
|
||||||
[_fallbacks release];
|
|
||||||
[_follows release];
|
|
||||||
|
|
||||||
[_mediaTagsController release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -63,28 +63,28 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
|
|
||||||
_mediaTagsController = [[SBMediaTagsController alloc] initWithTrack:track];
|
_mediaTagsController = [[SBMediaTagsController alloc] initWithTrack:track];
|
||||||
|
|
||||||
[_mediaTagsController.view setFrame: [mediaTagsView bounds]];
|
(_mediaTagsController.view).frame = mediaTagsView.bounds;
|
||||||
[_mediaTagsController.view setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )];
|
(_mediaTagsController.view).autoresizingMask = ( NSViewWidthSizable | NSViewHeightSizable );
|
||||||
|
|
||||||
[mediaTagsView addSubview:_mediaTagsController.view];
|
[mediaTagsView addSubview:_mediaTagsController.view];
|
||||||
|
|
||||||
[sampleWidth setStringValue: [NSString stringWithFormat:@"%lld", track.width]];
|
sampleWidth.stringValue = [NSString stringWithFormat:@"%lld", track.width];
|
||||||
[sampleHeight setStringValue: [NSString stringWithFormat:@"%lld", track.height]];
|
sampleHeight.stringValue = [NSString stringWithFormat:@"%lld", track.height];
|
||||||
|
|
||||||
[trackWidth setStringValue: [NSString stringWithFormat:@"%d", (uint16_t)track.trackWidth]];
|
trackWidth.stringValue = [NSString stringWithFormat:@"%d", (uint16_t)track.trackWidth];
|
||||||
[trackHeight setStringValue: [NSString stringWithFormat:@"%d", (uint16_t)track.trackHeight]];
|
trackHeight.stringValue = [NSString stringWithFormat:@"%d", (uint16_t)track.trackHeight];
|
||||||
|
|
||||||
[hSpacing setStringValue: [NSString stringWithFormat:@"%lld", track.hSpacing]];
|
hSpacing.stringValue = [NSString stringWithFormat:@"%lld", track.hSpacing];
|
||||||
[vSpacing setStringValue: [NSString stringWithFormat:@"%lld", track.vSpacing]];
|
vSpacing.stringValue = [NSString stringWithFormat:@"%lld", track.vSpacing];
|
||||||
|
|
||||||
[offsetX setStringValue: [NSString stringWithFormat:@"%d", track.offsetX]];
|
offsetX.stringValue = [NSString stringWithFormat:@"%d", track.offsetX];
|
||||||
[offsetY setStringValue: [NSString stringWithFormat:@"%d", track.offsetY]];
|
offsetY.stringValue = [NSString stringWithFormat:@"%d", track.offsetY];
|
||||||
|
|
||||||
[alternateGroup selectItemAtIndex:(NSInteger)track.alternate_group];
|
[alternateGroup selectItemAtIndex:(NSInteger)track.alternate_group];
|
||||||
|
|
||||||
if ([track.format isEqualToString:MP42VideoFormatH264] && track.origProfile && track.origLevel) {
|
if ([track.format isEqualToString:MP42VideoFormatH264] && track.origProfile && track.origLevel) {
|
||||||
[profileLevelUnchanged setTitle:[NSString stringWithFormat:@"Current profile: %@ @ %@",
|
profileLevelUnchanged.title = [NSString stringWithFormat:@"Current profile: %@ @ %@",
|
||||||
getProfileName(track.origProfile), getLevelName(track.origLevel)]];
|
getProfileName(track.origProfile), getLevelName(track.origLevel)];
|
||||||
if ((track.origProfile == track.newProfile) && (track.origLevel == track.newLevel)) {
|
if ((track.origProfile == track.newProfile) && (track.origLevel == track.newLevel)) {
|
||||||
[videoProfile selectItemWithTag:1];
|
[videoProfile selectItemWithTag:1];
|
||||||
} else {
|
} else {
|
||||||
@@ -128,15 +128,15 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
NSInteger i = 1;
|
NSInteger i = 1;
|
||||||
NSInteger selectedItem = 0;
|
NSInteger selectedItem = 0;
|
||||||
for (MP42SubtitleTrack *fileTrack in [mp4file tracksWithMediaType:MP42MediaTypeSubtitle]) {
|
for (MP42SubtitleTrack *fileTrack in [mp4file tracksWithMediaType:MP42MediaTypeSubtitle]) {
|
||||||
NSMenuItem *newItem = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
||||||
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"NA",
|
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"NA",
|
||||||
fileTrack.name,
|
fileTrack.name,
|
||||||
fileTrack.language]
|
fileTrack.language]
|
||||||
action:@selector(setForcedTrack:)
|
action:@selector(setForcedTrack:)
|
||||||
keyEquivalent:@""] autorelease];
|
keyEquivalent:@""];
|
||||||
[newItem setTarget:self];
|
newItem.target = self;
|
||||||
[newItem setTag:i];
|
newItem.tag = i;
|
||||||
[[forced menu] addItem:newItem];
|
[forced.menu addItem:newItem];
|
||||||
[_forced addObject:fileTrack];
|
[_forced addObject:fileTrack];
|
||||||
|
|
||||||
if (((MP42SubtitleTrack *)track).forcedTrack == fileTrack)
|
if (((MP42SubtitleTrack *)track).forcedTrack == fileTrack)
|
||||||
@@ -156,12 +156,12 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
|
|
||||||
- (void)setTrack:(MP42VideoTrack *)videoTrack
|
- (void)setTrack:(MP42VideoTrack *)videoTrack
|
||||||
{
|
{
|
||||||
track = [videoTrack retain];
|
track = videoTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFile:(MP42File *)mp4
|
- (void)setFile:(MP42File *)mp4
|
||||||
{
|
{
|
||||||
mp4file = [mp4 retain];
|
mp4file = mp4;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)setSize:(id)sender
|
- (IBAction)setSize:(id)sender
|
||||||
@@ -169,42 +169,42 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
NSInteger i;
|
NSInteger i;
|
||||||
|
|
||||||
if (sender == trackWidth) {
|
if (sender == trackWidth) {
|
||||||
i = [trackWidth integerValue];
|
i = trackWidth.integerValue;
|
||||||
if (track.trackWidth != i) {
|
if (track.trackWidth != i) {
|
||||||
if ([preserveAspectRatio state] == NSOnState) {
|
if (preserveAspectRatio.state == NSOnState) {
|
||||||
track.trackHeight = (track.trackHeight / track.trackWidth) * i;
|
track.trackHeight = (track.trackHeight / track.trackWidth) * i;
|
||||||
[trackHeight setIntegerValue:(NSInteger)track.trackHeight];
|
trackHeight.integerValue = (NSInteger)track.trackHeight;
|
||||||
}
|
}
|
||||||
track.trackWidth = i;
|
track.trackWidth = i;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
track.isEdited = YES;
|
track.isEdited = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sender == trackHeight) {
|
else if (sender == trackHeight) {
|
||||||
i = [trackHeight integerValue];
|
i = trackHeight.integerValue;
|
||||||
if (track.trackHeight != i) {
|
if (track.trackHeight != i) {
|
||||||
track.trackHeight = i;
|
track.trackHeight = i;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
track.isEdited = YES;
|
track.isEdited = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sender == offsetX) {
|
else if (sender == offsetX) {
|
||||||
i = [offsetX integerValue];
|
i = offsetX.integerValue;
|
||||||
if (track.offsetX != i) {
|
if (track.offsetX != i) {
|
||||||
track.offsetX = (uint32_t)i;
|
track.offsetX = (uint32_t)i;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
track.isEdited = YES;
|
track.isEdited = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sender == offsetY) {
|
else if (sender == offsetY) {
|
||||||
i = [offsetY integerValue];
|
i = offsetY.integerValue;
|
||||||
if (track.offsetY != i) {
|
if (track.offsetY != i) {
|
||||||
track.offsetY = (uint32_t)i;
|
track.offsetY = (uint32_t)i;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
track.isEdited = YES;
|
track.isEdited = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,20 +215,20 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
NSInteger i;
|
NSInteger i;
|
||||||
|
|
||||||
if (sender == hSpacing) {
|
if (sender == hSpacing) {
|
||||||
i = [hSpacing integerValue];
|
i = hSpacing.integerValue;
|
||||||
if (track.hSpacing != i) {
|
if (track.hSpacing != i) {
|
||||||
track.hSpacing = i;
|
track.hSpacing = i;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
track.isEdited = YES;
|
track.isEdited = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sender == vSpacing) {
|
else if (sender == vSpacing) {
|
||||||
i = [vSpacing integerValue];
|
i = vSpacing.integerValue;
|
||||||
if (track.vSpacing != i) {
|
if (track.vSpacing != i) {
|
||||||
track.vSpacing = i;
|
track.vSpacing = i;
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
track.isEdited = YES;
|
track.isEdited = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,17 +237,17 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
|
|
||||||
- (IBAction)setAltenateGroup:(id)sender
|
- (IBAction)setAltenateGroup:(id)sender
|
||||||
{
|
{
|
||||||
NSInteger tagName = [[sender selectedItem] tag];
|
NSInteger tagName = [sender selectedItem].tag;
|
||||||
|
|
||||||
if (track.alternate_group != tagName) {
|
if (track.alternate_group != tagName) {
|
||||||
track.alternate_group = tagName;
|
track.alternate_group = tagName;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)setProfileLevel:(id)sender
|
- (IBAction)setProfileLevel:(id)sender
|
||||||
{
|
{
|
||||||
NSInteger tagName = [[sender selectedItem] tag];
|
NSInteger tagName = [sender selectedItem].tag;
|
||||||
switch (tagName) {
|
switch (tagName) {
|
||||||
case 1:
|
case 1:
|
||||||
track.newProfile = track.origProfile;
|
track.newProfile = track.origProfile;
|
||||||
@@ -273,14 +273,14 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)setForcedSubtitles:(id)sender
|
- (IBAction)setForcedSubtitles:(id)sender
|
||||||
{
|
{
|
||||||
if ([track isKindOfClass:[MP42SubtitleTrack class]]) {
|
if ([track isKindOfClass:[MP42SubtitleTrack class]]) {
|
||||||
MP42SubtitleTrack *subTrack = (MP42SubtitleTrack *)track;
|
MP42SubtitleTrack *subTrack = (MP42SubtitleTrack *)track;
|
||||||
NSInteger tagName = [[sender selectedItem] tag];
|
NSInteger tagName = [sender selectedItem].tag;
|
||||||
|
|
||||||
switch (tagName) {
|
switch (tagName) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -299,7 +299,7 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,29 +308,18 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
NSInteger index = [sender tag];
|
NSInteger index = [sender tag];
|
||||||
|
|
||||||
if (index) {
|
if (index) {
|
||||||
MP42SubtitleTrack *subTrack = [_forced objectAtIndex:index-1];
|
MP42SubtitleTrack *subTrack = _forced[index-1];
|
||||||
|
|
||||||
if (subTrack != ((MP42SubtitleTrack *)track).forcedTrack) {
|
if (subTrack != ((MP42SubtitleTrack *)track).forcedTrack) {
|
||||||
((MP42SubtitleTrack *)track).forcedTrack = subTrack;
|
((MP42SubtitleTrack *)track).forcedTrack = subTrack;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
((MP42SubtitleTrack *)track).forcedTrack = nil;
|
((MP42SubtitleTrack *)track).forcedTrack = nil;
|
||||||
[[[[[self view]window] windowController] document] updateChangeCount:NSChangeDone];
|
[self.view.window.windowController.document updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[track release];
|
|
||||||
[mp4file release];
|
|
||||||
|
|
||||||
[_forced release];
|
|
||||||
|
|
||||||
[_mediaTagsController release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+8
-11
@@ -26,9 +26,9 @@
|
|||||||
|
|
||||||
[SBPrefsController registerUserDefaults];
|
[SBPrefsController registerUserDefaults];
|
||||||
|
|
||||||
NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
|
NSString *appSupportPath = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
|
||||||
NSUserDomainMask,
|
NSUserDomainMask,
|
||||||
YES) firstObject] stringByAppendingPathComponent:@"Subler"];
|
YES).firstObject stringByAppendingPathComponent:@"Subler"];
|
||||||
|
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:appSupportPath]) {
|
if (![[NSFileManager defaultManager] fileExistsAtPath:appSupportPath]) {
|
||||||
[[NSFileManager defaultManager] createDirectoryAtPath:appSupportPath withIntermediateDirectories:YES attributes:nil error:NULL];
|
[[NSFileManager defaultManager] createDirectoryAtPath:appSupportPath withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||||
@@ -44,7 +44,6 @@
|
|||||||
debugLogController = [[SBLogWindowController alloc] initWithLogger:logger];
|
debugLogController = [[SBLogWindowController alloc] initWithLogger:logger];
|
||||||
[MP42File setGlobalLogger:logger];
|
[MP42File setGlobalLogger:logger];
|
||||||
|
|
||||||
[logger release];
|
|
||||||
|
|
||||||
if ([[NSUserDefaults standardUserDefaults] valueForKey:@"SBShowQueueWindow"]) {
|
if ([[NSUserDefaults standardUserDefaults] valueForKey:@"SBShowQueueWindow"]) {
|
||||||
[[SBQueueController sharedManager] showWindow:self];
|
[[SBQueueController sharedManager] showWindow:self];
|
||||||
@@ -55,7 +54,7 @@
|
|||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
[presetManager savePresets];
|
[presetManager savePresets];
|
||||||
|
|
||||||
if ([[[SBQueueController sharedManager] window] isVisible]) {
|
if ([SBQueueController sharedManager].window.visible) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"SBShowQueueWindow"];
|
[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"SBShowQueueWindow"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -71,7 +70,7 @@
|
|||||||
|
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
|
||||||
{
|
{
|
||||||
SBQueueStatus status= [[SBQueueController sharedManager] status];
|
SBQueueStatus status= [SBQueueController sharedManager].status;
|
||||||
NSInteger result;
|
NSInteger result;
|
||||||
if (status == SBQueueStatusWorking) {
|
if (status == SBQueueStatusWorking) {
|
||||||
result = NSRunCriticalAlertPanel(
|
result = NSRunCriticalAlertPanel(
|
||||||
@@ -220,32 +219,30 @@
|
|||||||
[extension caseInsensitiveCompare: @"mov"] == NSOrderedSame ||
|
[extension caseInsensitiveCompare: @"mov"] == NSOrderedSame ||
|
||||||
mp4 == nil) {
|
mp4 == nil) {
|
||||||
|
|
||||||
CFRetain(completionHandler);
|
CFBridgingRetain(completionHandler);
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
NSError *outError = nil;
|
NSError *outError = nil;
|
||||||
|
|
||||||
SBDocument *doc = [[self openUntitledDocumentAndDisplay:displayDocument error:&outError] retain];
|
SBDocument *doc = [self openUntitledDocumentAndDisplay:displayDocument error:&outError];
|
||||||
completionHandler(doc, NO, outError);
|
completionHandler(doc, NO, outError);
|
||||||
if (doc) {
|
if (doc) {
|
||||||
[doc showImportSheet:@[url]];
|
[doc showImportSheet:@[url]];
|
||||||
}
|
}
|
||||||
CFRelease(completionHandler);
|
CFRelease((__bridge CFTypeRef)(completionHandler));
|
||||||
[doc release];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[super openDocumentWithContentsOfURL:url display:displayDocument completionHandler:completionHandler];
|
[super openDocumentWithContentsOfURL:url display:displayDocument completionHandler:completionHandler];
|
||||||
}
|
}
|
||||||
|
|
||||||
[mp4 release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable __kindof NSDocument *)documentForURL:(NSURL *)url
|
- (nullable __kindof NSDocument *)documentForURL:(NSURL *)url
|
||||||
{
|
{
|
||||||
NSArray<__kindof NSDocument *> *documents = nil;
|
NSArray<__kindof NSDocument *> *documents = nil;
|
||||||
@synchronized(self) {
|
@synchronized(self) {
|
||||||
documents = [[self.documents copy] autorelease];
|
documents = [self.documents copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NSDocument *doc in documents) {
|
for (NSDocument *doc in documents) {
|
||||||
|
|||||||
@@ -16,15 +16,14 @@ static void CrashMyApplication()
|
|||||||
- (NSAttributedString *)_formattedExceptionBacktrace:(NSArray *)backtrace
|
- (NSAttributedString *)_formattedExceptionBacktrace:(NSArray *)backtrace
|
||||||
{
|
{
|
||||||
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString *result = [[NSMutableAttributedString alloc] init];
|
||||||
for (NSString *s in backtrace)
|
for (__strong NSString *s in backtrace)
|
||||||
{
|
{
|
||||||
s = [s stringByAppendingString:@"\n"];
|
s = [s stringByAppendingString:@"\n"];
|
||||||
NSAttributedString *attrS = [[NSAttributedString alloc] initWithString:s];
|
NSAttributedString *attrS = [[NSAttributedString alloc] initWithString:s];
|
||||||
[result appendAttributedString:attrS];
|
[result appendAttributedString:attrS];
|
||||||
[attrS release];
|
|
||||||
}
|
}
|
||||||
[result addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Monaco" size:10] range:NSMakeRange(0, result.length)];
|
[result addAttribute:NSFontAttributeName value:[NSFont fontWithName:@"Monaco" size:10] range:NSMakeRange(0, result.length)];
|
||||||
return [result autorelease];
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)reportException:(NSException *)exception
|
- (void)reportException:(NSException *)exception
|
||||||
|
|||||||
@@ -15,18 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)selectArtworkDone:(NSIndexSet *)indexes;
|
- (void)selectArtworkDone:(NSIndexSet *)indexes;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SBArtworkSelector : NSWindowController {
|
@interface SBArtworkSelector : NSWindowController
|
||||||
@private
|
|
||||||
id <SBArtworkSelectorDelegate> delegate;
|
|
||||||
IBOutlet IKImageBrowserView *imageBrowser;
|
|
||||||
IBOutlet NSSlider *slider;
|
|
||||||
IBOutlet NSButton *addArtworkButton;
|
|
||||||
IBOutlet NSButton *loadMoreArtworkButton;
|
|
||||||
|
|
||||||
NSMutableArray<NSURL *> *imageURLsUnloaded;
|
|
||||||
NSMutableArray *images;
|
|
||||||
NSArray<NSString *> *artworkProviderNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark Initialization
|
#pragma mark Initialization
|
||||||
- (instancetype)initWithDelegate:(id <SBArtworkSelectorDelegate>)del imageURLs:(NSArray<NSURL *> *)imageURLs artworkProviderNames:(NSArray<NSString *> *)artworkProviderNames;
|
- (instancetype)initWithDelegate:(id <SBArtworkSelectorDelegate>)del imageURLs:(NSArray<NSURL *> *)imageURLs artworkProviderNames:(NSArray<NSString *> *)artworkProviderNames;
|
||||||
|
|||||||
+34
-40
@@ -12,23 +12,20 @@
|
|||||||
#pragma mark IKImageBrowserItem data source objects
|
#pragma mark IKImageBrowserItem data source objects
|
||||||
|
|
||||||
@interface SBArtworkImageObject : NSObject {
|
@interface SBArtworkImageObject : NSObject {
|
||||||
NSURL *_url;
|
|
||||||
NSString *_urlString;
|
NSString *_urlString;
|
||||||
NSString *_artworkProviderName;
|
NSString *_artworkProviderName;
|
||||||
NSData *_data;
|
|
||||||
NSInteger _version;
|
|
||||||
|
|
||||||
id _delegate;
|
id __unsafe_unretained _delegate;
|
||||||
BOOL _isCancelled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (atomic, assign) id delegate;
|
@property (atomic, unsafe_unretained) id delegate;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SBArtworkImageObject ()
|
@interface SBArtworkImageObject ()
|
||||||
|
|
||||||
@property (atomic, retain) NSData *data;
|
@property (nonatomic, readonly) NSURL *url;
|
||||||
|
@property (atomic) NSData *data;
|
||||||
@property (atomic) NSInteger version;
|
@property (atomic) NSInteger version;
|
||||||
@property (atomic) BOOL isCancelled;
|
@property (atomic) BOOL isCancelled;
|
||||||
|
|
||||||
@@ -36,18 +33,12 @@
|
|||||||
|
|
||||||
@implementation SBArtworkImageObject
|
@implementation SBArtworkImageObject
|
||||||
|
|
||||||
@synthesize data = _data;
|
|
||||||
@synthesize version = _version;
|
|
||||||
@synthesize delegate = _delegate;
|
|
||||||
|
|
||||||
@synthesize isCancelled = _isCancelled;
|
|
||||||
|
|
||||||
- (instancetype)initWithURL:(NSURL *)url artworkProviderName:(NSString *)artworkProvider delegate:(id)delegate
|
- (instancetype)initWithURL:(NSURL *)url artworkProviderName:(NSString *)artworkProvider delegate:(id)delegate
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_url = [url copy];
|
_url = [url copy];
|
||||||
_urlString = [[url absoluteString] retain];
|
_urlString = url.absoluteString;
|
||||||
_artworkProviderName = [artworkProvider copy];
|
_artworkProviderName = [artworkProvider copy];
|
||||||
_delegate = delegate;
|
_delegate = delegate;
|
||||||
}
|
}
|
||||||
@@ -56,11 +47,6 @@
|
|||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
self.delegate = nil;
|
self.delegate = nil;
|
||||||
[_url release];
|
|
||||||
[_urlString release];
|
|
||||||
[_artworkProviderName release];
|
|
||||||
[_data release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)cancel {
|
- (void)cancel {
|
||||||
@@ -79,7 +65,7 @@
|
|||||||
// Get the data outside the main thread
|
// Get the data outside the main thread
|
||||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||||
if (!self.isCancelled) {
|
if (!self.isCancelled) {
|
||||||
self.data = [SBMetadataHelper downloadDataFromURL:_url withCachePolicy:SBDefaultPolicy];
|
self.data = [SBMetadataHelper downloadDataFromURL:self.url withCachePolicy:SBDefaultPolicy];
|
||||||
self.version = 2;
|
self.version = 2;
|
||||||
// We got the data, tell the controller to update the view
|
// We got the data, tell the controller to update the view
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
@@ -105,13 +91,13 @@
|
|||||||
|
|
||||||
- (NSString *)imageTitle {
|
- (NSString *)imageTitle {
|
||||||
NSArray *a = [_artworkProviderName componentsSeparatedByString:@"|"];
|
NSArray *a = [_artworkProviderName componentsSeparatedByString:@"|"];
|
||||||
return [a firstObject];
|
return a.firstObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)imageSubtitle {
|
- (NSString *)imageSubtitle {
|
||||||
NSArray *a = [_artworkProviderName componentsSeparatedByString:@"|"];
|
NSArray *a = [_artworkProviderName componentsSeparatedByString:@"|"];
|
||||||
if ([a count] > 1) {
|
if (a.count > 1) {
|
||||||
return [a objectAtIndex:1];
|
return a[1];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -120,6 +106,20 @@
|
|||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
@interface SBArtworkSelector ()
|
||||||
|
{
|
||||||
|
id <SBArtworkSelectorDelegate> delegate;
|
||||||
|
IBOutlet IKImageBrowserView *imageBrowser;
|
||||||
|
IBOutlet NSSlider *slider;
|
||||||
|
IBOutlet NSButton *addArtworkButton;
|
||||||
|
IBOutlet NSButton *loadMoreArtworkButton;
|
||||||
|
|
||||||
|
NSMutableArray<NSURL *> *imageURLsUnloaded;
|
||||||
|
NSMutableArray *images;
|
||||||
|
NSArray<NSString *> *artworkProviderNames;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation SBArtworkSelector
|
@implementation SBArtworkSelector
|
||||||
|
|
||||||
#pragma mark Initialization
|
#pragma mark Initialization
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
if ((self = [super initWithWindowNibName:@"ArtworkSelector"])) {
|
if ((self = [super initWithWindowNibName:@"ArtworkSelector"])) {
|
||||||
delegate = del;
|
delegate = del;
|
||||||
imageURLsUnloaded = [[NSMutableArray alloc] initWithArray:imageURLs];
|
imageURLsUnloaded = [[NSMutableArray alloc] initWithArray:imageURLs];
|
||||||
artworkProviderNames = [aArtworkProviderNames retain];
|
artworkProviderNames = aArtworkProviderNames;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -139,36 +139,34 @@
|
|||||||
images = [[NSMutableArray alloc] initWithCapacity:imageURLsUnloaded.count];
|
images = [[NSMutableArray alloc] initWithCapacity:imageURLsUnloaded.count];
|
||||||
|
|
||||||
for (NSUInteger i = 0; (i < 10) && (imageURLsUnloaded.count > 0); i++) {
|
for (NSUInteger i = 0; (i < 10) && (imageURLsUnloaded.count > 0); i++) {
|
||||||
SBArtworkImageObject *m = [[SBArtworkImageObject alloc] initWithURL:[imageURLsUnloaded objectAtIndex:0]
|
SBArtworkImageObject *m = [[SBArtworkImageObject alloc] initWithURL:imageURLsUnloaded[0]
|
||||||
artworkProviderName:[artworkProviderNames objectAtIndex:[images count]]
|
artworkProviderName:artworkProviderNames[images.count]
|
||||||
delegate:self];
|
delegate:self];
|
||||||
[imageURLsUnloaded removeObjectAtIndex:0];
|
[imageURLsUnloaded removeObjectAtIndex:0];
|
||||||
[images addObject:m];
|
[images addObject:m];
|
||||||
[m release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[loadMoreArtworkButton setEnabled:([imageURLsUnloaded count] > 0)];
|
loadMoreArtworkButton.enabled = (imageURLsUnloaded.count > 0);
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
[imageBrowser setSelectionIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
|
[imageBrowser setSelectionIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) loadMoreArtwork:(id)sender {
|
- (IBAction) loadMoreArtwork:(id)sender {
|
||||||
for (NSUInteger i = 0; (i < 10) && (imageURLsUnloaded.count > 0); i++) {
|
for (NSUInteger i = 0; (i < 10) && (imageURLsUnloaded.count > 0); i++) {
|
||||||
SBArtworkImageObject *m = [[SBArtworkImageObject alloc] initWithURL:[imageURLsUnloaded objectAtIndex:0]
|
SBArtworkImageObject *m = [[SBArtworkImageObject alloc] initWithURL:imageURLsUnloaded[0]
|
||||||
artworkProviderName:[artworkProviderNames objectAtIndex:[images count]]
|
artworkProviderName:artworkProviderNames[images.count]
|
||||||
delegate:self];
|
delegate:self];
|
||||||
[imageURLsUnloaded removeObjectAtIndex:0];
|
[imageURLsUnloaded removeObjectAtIndex:0];
|
||||||
[images addObject:m];
|
[images addObject:m];
|
||||||
[m release];
|
|
||||||
}
|
}
|
||||||
[loadMoreArtworkButton setEnabled:([imageURLsUnloaded count] > 0)];
|
loadMoreArtworkButton.enabled = (imageURLsUnloaded.count > 0);
|
||||||
[imageBrowser reloadData];
|
[imageBrowser reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark User interface
|
#pragma mark User interface
|
||||||
|
|
||||||
- (IBAction) zoomSliderDidChange:(id)sender {
|
- (IBAction) zoomSliderDidChange:(id)sender {
|
||||||
[imageBrowser setZoomValue:[slider floatValue]];
|
[imageBrowser setZoomValue:slider.floatValue];
|
||||||
[imageBrowser setNeedsDisplay:YES];
|
[imageBrowser setNeedsDisplay:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,22 +189,18 @@
|
|||||||
[imageBrowser setDataSource:nil];
|
[imageBrowser setDataSource:nil];
|
||||||
|
|
||||||
[images makeObjectsPerformSelector:@selector(cancel)];
|
[images makeObjectsPerformSelector:@selector(cancel)];
|
||||||
[images release];
|
|
||||||
|
|
||||||
[imageURLsUnloaded release];
|
|
||||||
[artworkProviderNames release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark IKImageBrowserDataSource
|
#pragma mark IKImageBrowserDataSource
|
||||||
|
|
||||||
- (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) aBrowser {
|
- (NSUInteger) numberOfItemsInImageBrowser:(IKImageBrowserView *) aBrowser {
|
||||||
return [images count];
|
return images.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index {
|
- (id) imageBrowser:(IKImageBrowserView *) aBrowser itemAtIndex:(NSUInteger)index {
|
||||||
return [images objectAtIndex:index];
|
return images[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@@ -217,7 +211,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void) imageBrowserSelectionDidChange:(IKImageBrowserView *) aBrowser {
|
- (void) imageBrowserSelectionDidChange:(IKImageBrowserView *) aBrowser {
|
||||||
if ([[aBrowser selectionIndexes] count]) {
|
if ([aBrowser selectionIndexes].count) {
|
||||||
[addArtworkButton setEnabled:YES];
|
[addArtworkButton setEnabled:YES];
|
||||||
} else {
|
} else {
|
||||||
[addArtworkButton setEnabled:NO];
|
[addArtworkButton setEnabled:NO];
|
||||||
|
|||||||
@@ -11,43 +11,13 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class SBTableView;
|
|
||||||
@class SBChapterResult;
|
|
||||||
@class SBChapterImporter;
|
|
||||||
|
|
||||||
@protocol SBChapterSearchControllerDelegate
|
@protocol SBChapterSearchControllerDelegate
|
||||||
|
|
||||||
- (void)chapterImportDone:(NSArray<MP42TextSample *> *)chaptersToBeImported;
|
- (void)chapterImportDone:(NSArray<MP42TextSample *> *)chaptersToBeImported;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SBChapterSearchController : NSWindowController {
|
@interface SBChapterSearchController : NSWindowController
|
||||||
@private
|
|
||||||
id <SBChapterSearchControllerDelegate> delegate;
|
|
||||||
|
|
||||||
NSString *_searchString;
|
|
||||||
NSUInteger _searchDuration;
|
|
||||||
|
|
||||||
NSDictionary *_detailBoldAttr;
|
|
||||||
NSDictionary *_detailBoldMonospacedAttr;
|
|
||||||
NSDictionary *_detailMonospacedAttr;
|
|
||||||
|
|
||||||
IBOutlet NSTextField *searchTitle;
|
|
||||||
|
|
||||||
NSArray<SBChapterResult *> *_resultsArray;
|
|
||||||
IBOutlet NSTableView *resultsTable;
|
|
||||||
NSArray *_selectedChaptersArray;
|
|
||||||
IBOutlet SBTableView *chapterTable;
|
|
||||||
|
|
||||||
|
|
||||||
IBOutlet NSButton *searchButton;
|
|
||||||
IBOutlet NSButton *addButton;
|
|
||||||
|
|
||||||
SBChapterImporter *_currentSearcher;
|
|
||||||
|
|
||||||
IBOutlet NSProgressIndicator *progress;
|
|
||||||
IBOutlet NSTextField *progressText;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithDelegate:(id <SBChapterSearchControllerDelegate>)del searchTitle:(NSString *)title andDuration:(NSUInteger)duration;
|
- (instancetype)initWithDelegate:(id <SBChapterSearchControllerDelegate>)del searchTitle:(NSString *)title andDuration:(NSUInteger)duration;
|
||||||
|
|
||||||
|
|||||||
@@ -10,30 +10,51 @@
|
|||||||
|
|
||||||
#import <MP42Foundation/MP42Utilities.h>
|
#import <MP42Foundation/MP42Utilities.h>
|
||||||
|
|
||||||
|
#import "SBTableView.h"
|
||||||
#import "SBChapterImporter.h"
|
#import "SBChapterImporter.h"
|
||||||
#import "SBChapterResult.h"
|
#import "SBChapterResult.h"
|
||||||
|
|
||||||
@interface SBChapterSearchController () <NSTableViewDelegate>
|
@interface SBChapterSearchController () <NSTableViewDelegate>
|
||||||
|
{
|
||||||
|
id <SBChapterSearchControllerDelegate> delegate;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain) SBChapterImporter *currentSearcher;
|
NSString *_searchString;
|
||||||
@property (nonatomic, readwrite, retain) NSArray<SBChapterResult *> *resultsArray;
|
NSUInteger _searchDuration;
|
||||||
@property (nonatomic, readwrite, retain) NSArray<MP42TextSample *> *selectedChaptersArray;
|
|
||||||
|
NSDictionary *_detailBoldAttr;
|
||||||
|
NSDictionary *_detailBoldMonospacedAttr;
|
||||||
|
NSDictionary *_detailMonospacedAttr;
|
||||||
|
|
||||||
|
IBOutlet NSTextField *searchTitle;
|
||||||
|
|
||||||
|
NSArray<SBChapterResult *> *_resultsArray;
|
||||||
|
IBOutlet NSTableView *resultsTable;
|
||||||
|
NSArray *_selectedChaptersArray;
|
||||||
|
IBOutlet SBTableView *chapterTable;
|
||||||
|
|
||||||
|
|
||||||
|
IBOutlet NSButton *searchButton;
|
||||||
|
IBOutlet NSButton *addButton;
|
||||||
|
|
||||||
|
SBChapterImporter *_currentSearcher;
|
||||||
|
|
||||||
|
IBOutlet NSProgressIndicator *progress;
|
||||||
|
IBOutlet NSTextField *progressText;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, readwrite, strong) SBChapterImporter *currentSearcher;
|
||||||
|
@property (nonatomic, readwrite, strong) NSArray<SBChapterResult *> *resultsArray;
|
||||||
|
@property (nonatomic, readwrite, strong) NSArray<MP42TextSample *> *selectedChaptersArray;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBChapterSearchController
|
@implementation SBChapterSearchController
|
||||||
|
|
||||||
@synthesize currentSearcher = _currentSearcher;
|
|
||||||
@synthesize resultsArray = _resultsArray;
|
|
||||||
@synthesize selectedChaptersArray = _selectedChaptersArray;
|
|
||||||
|
|
||||||
|
|
||||||
- (instancetype)initWithDelegate:(id <SBChapterSearchControllerDelegate>)del searchTitle:(NSString *)title andDuration:(NSUInteger)duration
|
- (instancetype)initWithDelegate:(id <SBChapterSearchControllerDelegate>)del searchTitle:(NSString *)title andDuration:(NSUInteger)duration
|
||||||
{
|
{
|
||||||
self = [super initWithWindowNibName:@"SBChapterSearch"];
|
self = [super initWithWindowNibName:@"SBChapterSearch"];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
|
|
||||||
delegate = del;
|
delegate = del;
|
||||||
_searchString = [title copy];
|
_searchString = [title copy];
|
||||||
_searchDuration = duration;
|
_searchDuration = duration;
|
||||||
@@ -52,43 +73,43 @@
|
|||||||
|
|
||||||
- (void)setupFontAttributes
|
- (void)setupFontAttributes
|
||||||
{
|
{
|
||||||
NSMutableParagraphStyle *ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
ps.headIndent = -10.0;
|
ps.headIndent = -10.0;
|
||||||
ps.alignment = NSTextAlignmentRight;
|
ps.alignment = NSTextAlignmentRight;
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
_detailBoldMonospacedAttr = [@{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
_detailBoldMonospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
||||||
NSParagraphStyleAttributeName: ps,
|
NSParagraphStyleAttributeName: ps,
|
||||||
NSForegroundColorAttributeName: [NSColor grayColor]} retain];
|
NSForegroundColorAttributeName: [NSColor grayColor]};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_detailBoldMonospacedAttr = [@{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
_detailBoldMonospacedAttr = @{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
||||||
NSParagraphStyleAttributeName: ps,
|
NSParagraphStyleAttributeName: ps,
|
||||||
NSForegroundColorAttributeName: [NSColor grayColor]} retain];
|
NSForegroundColorAttributeName: [NSColor grayColor]};
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableParagraphStyle *psL = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
NSMutableParagraphStyle *psL = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
psL.headIndent = -10.0;
|
psL.headIndent = -10.0;
|
||||||
psL.alignment = NSTextAlignmentLeft;
|
psL.alignment = NSTextAlignmentLeft;
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
_detailBoldAttr = [@{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
_detailBoldAttr = @{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
||||||
NSParagraphStyleAttributeName: psL,
|
NSParagraphStyleAttributeName: psL,
|
||||||
NSForegroundColorAttributeName: [NSColor grayColor]} retain];
|
NSForegroundColorAttributeName: [NSColor grayColor]};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_detailBoldAttr = [@{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
_detailBoldAttr = @{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
||||||
NSParagraphStyleAttributeName: ps,
|
NSParagraphStyleAttributeName: ps,
|
||||||
NSForegroundColorAttributeName: [NSColor grayColor]} retain];
|
NSForegroundColorAttributeName: [NSColor grayColor]};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
_detailMonospacedAttr = [@{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular],
|
_detailMonospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular],
|
||||||
NSParagraphStyleAttributeName: ps} retain];
|
NSParagraphStyleAttributeName: ps};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_detailMonospacedAttr = [@{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize]],
|
_detailMonospacedAttr = @{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize]],
|
||||||
NSParagraphStyleAttributeName: ps} retain];
|
NSParagraphStyleAttributeName: ps};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,14 +268,14 @@
|
|||||||
- (NSAttributedString *)boldString:(NSString *)string monospaced:(BOOL)monospaced
|
- (NSAttributedString *)boldString:(NSString *)string monospaced:(BOOL)monospaced
|
||||||
{
|
{
|
||||||
if (monospaced) {
|
if (monospaced) {
|
||||||
return [[[NSAttributedString alloc] initWithString:string attributes:_detailBoldMonospacedAttr] autorelease];
|
return [[NSAttributedString alloc] initWithString:string attributes:_detailBoldMonospacedAttr];
|
||||||
}
|
}
|
||||||
return [[[NSAttributedString alloc] initWithString:string attributes:_detailBoldAttr] autorelease];
|
return [[NSAttributedString alloc] initWithString:string attributes:_detailBoldAttr];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSAttributedString *)monospacedString:(NSString *)string
|
- (NSAttributedString *)monospacedString:(NSString *)string
|
||||||
{
|
{
|
||||||
return [[[NSAttributedString alloc] initWithString:string attributes:_detailMonospacedAttr] autorelease];
|
return [[NSAttributedString alloc] initWithString:string attributes:_detailMonospacedAttr];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +355,7 @@
|
|||||||
if ([tableView.selectedRowIndexes containsIndex:rowIndex]) {
|
if ([tableView.selectedRowIndexes containsIndex:rowIndex]) {
|
||||||
|
|
||||||
// Without this, the color won't change ...
|
// Without this, the color won't change ...
|
||||||
NSMutableAttributedString *highlightedString = [[[NSMutableAttributedString alloc] initWithAttributedString:[cell attributedStringValue]] autorelease];
|
NSMutableAttributedString *highlightedString = [[NSMutableAttributedString alloc] initWithAttributedString:[cell attributedStringValue]];
|
||||||
[highlightedString addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0, highlightedString.length)];
|
[highlightedString addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0, highlightedString.length)];
|
||||||
[cell setAttributedStringValue:highlightedString];
|
[cell setAttributedStringValue:highlightedString];
|
||||||
|
|
||||||
|
|||||||
+1
-38
@@ -12,44 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@class MP42File;
|
@class MP42File;
|
||||||
|
|
||||||
@interface SBDocument : NSDocument {
|
@interface SBDocument : NSDocument
|
||||||
@private
|
|
||||||
MP42File *_mp4File;
|
|
||||||
IBOutlet NSWindow *documentWindow;
|
|
||||||
|
|
||||||
IBOutlet NSTableView *fileTracksTable;
|
|
||||||
IBOutlet NSSplitView *splitView;
|
|
||||||
|
|
||||||
IBOutlet NSWindow *savingWindow;
|
|
||||||
IBOutlet NSTextField *saveOperationName;
|
|
||||||
|
|
||||||
NSSavePanel *_currentSavePanel;
|
|
||||||
IBOutlet NSView *saveView;
|
|
||||||
IBOutlet NSPopUpButton *fileFormat;
|
|
||||||
IBOutlet NSProgressIndicator *optBar;
|
|
||||||
|
|
||||||
IBOutlet NSToolbarItem *addTracks;
|
|
||||||
IBOutlet NSToolbarItem *deleteTrack;
|
|
||||||
IBOutlet NSToolbarItem *searchMetadata;
|
|
||||||
IBOutlet NSToolbarItem *searchChapters;
|
|
||||||
IBOutlet NSToolbarItem *sendToQueue;
|
|
||||||
|
|
||||||
NSArray<NSString *> *languages;
|
|
||||||
|
|
||||||
NSViewController *propertyView;
|
|
||||||
IBOutlet NSView *targetView;
|
|
||||||
NSWindowController *_sheet;
|
|
||||||
|
|
||||||
IBOutlet NSWindow *offsetWindow;
|
|
||||||
IBOutlet NSTextField *offset;
|
|
||||||
|
|
||||||
IBOutlet NSButton *cancelSave;
|
|
||||||
IBOutlet NSButton *_64bit_data;
|
|
||||||
IBOutlet NSButton *_64bit_time;
|
|
||||||
BOOL _optimize;
|
|
||||||
|
|
||||||
NSDictionary *_detailMonospacedAttr;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError;
|
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError;
|
||||||
|
|
||||||
|
|||||||
+130
-125
@@ -10,6 +10,7 @@
|
|||||||
#import "SBQueueController.h"
|
#import "SBQueueController.h"
|
||||||
#import "SBQueueItem.h"
|
#import "SBQueueItem.h"
|
||||||
#import "SBFileImport.h"
|
#import "SBFileImport.h"
|
||||||
|
#import "SBTableView.h"
|
||||||
|
|
||||||
#import "SBEmptyViewController.h"
|
#import "SBEmptyViewController.h"
|
||||||
#import "SBMovieViewController.h"
|
#import "SBMovieViewController.h"
|
||||||
@@ -31,15 +32,49 @@
|
|||||||
#define SublerTableViewDataType @"SublerTableViewDataType"
|
#define SublerTableViewDataType @"SublerTableViewDataType"
|
||||||
|
|
||||||
@interface SBDocument () <NSTableViewDelegate, SBFileImportDelegate, SBMetadataSearchControllerDelegate, SBChapterSearchControllerDelegate>
|
@interface SBDocument () <NSTableViewDelegate, SBFileImportDelegate, SBMetadataSearchControllerDelegate, SBChapterSearchControllerDelegate>
|
||||||
|
{
|
||||||
|
IBOutlet NSSplitView *splitView;
|
||||||
|
|
||||||
@property (nonatomic, retain) MP42File *mp4;
|
NSSavePanel *_currentSavePanel;
|
||||||
|
IBOutlet NSView *saveView;
|
||||||
|
IBOutlet NSPopUpButton *fileFormat;
|
||||||
|
|
||||||
|
IBOutlet NSToolbarItem *addTracks;
|
||||||
|
IBOutlet NSToolbarItem *deleteTrack;
|
||||||
|
IBOutlet NSToolbarItem *searchMetadata;
|
||||||
|
IBOutlet NSToolbarItem *searchChapters;
|
||||||
|
IBOutlet NSToolbarItem *sendToQueue;
|
||||||
|
|
||||||
|
NSArray<NSString *> *languages;
|
||||||
|
|
||||||
|
NSViewController *propertyView;
|
||||||
|
IBOutlet NSView *targetView;
|
||||||
|
NSWindowController *_sheet;
|
||||||
|
|
||||||
|
IBOutlet NSWindow *offsetWindow;
|
||||||
|
IBOutlet NSTextField *offset;
|
||||||
|
|
||||||
|
IBOutlet NSButton *cancelSave;
|
||||||
|
IBOutlet NSButton *_64bit_data;
|
||||||
|
IBOutlet NSButton *_64bit_time;
|
||||||
|
BOOL _optimize;
|
||||||
|
|
||||||
|
NSDictionary *_detailMonospacedAttr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, weak) IBOutlet NSWindow *documentWindow;
|
||||||
|
@property (nonatomic, weak) IBOutlet SBTableView *tracksTable;
|
||||||
|
|
||||||
|
@property (nonatomic, weak) IBOutlet NSWindow *saveWindow;
|
||||||
|
@property (nonatomic, weak) IBOutlet NSTextField *saveOperationName;
|
||||||
|
@property (nonatomic, weak) IBOutlet NSProgressIndicator *progressBar;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) MP42File *mp4;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBDocument
|
@implementation SBDocument
|
||||||
|
|
||||||
@synthesize mp4 = _mp4File;
|
|
||||||
|
|
||||||
- (NSString *)windowNibName
|
- (NSString *)windowNibName
|
||||||
{
|
{
|
||||||
return @"SBDocument";
|
return @"SBDocument";
|
||||||
@@ -49,21 +84,21 @@
|
|||||||
{
|
{
|
||||||
[super windowControllerDidLoadNib:aController];
|
[super windowControllerDidLoadNib:aController];
|
||||||
|
|
||||||
languages = [[[MP42Languages defaultManager] languages] retain];
|
languages = [[MP42Languages defaultManager] languages];
|
||||||
_optimize = NO;
|
_optimize = NO;
|
||||||
|
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[sendToQueue setImage:[NSImage imageNamed:NSImageNameShareTemplate]];
|
sendToQueue.image = [NSImage imageNamed:NSImageNameShareTemplate];
|
||||||
|
|
||||||
[fileTracksTable registerForDraggedTypes:@[SublerTableViewDataType]];
|
[self.tracksTable registerForDraggedTypes:@[SublerTableViewDataType]];
|
||||||
[documentWindow registerForDraggedTypes:@[NSFilenamesPboardType]];
|
[self.documentWindow registerForDraggedTypes:@[NSFilenamesPboardType]];
|
||||||
|
|
||||||
[optBar setUsesThreadedAnimation:NO];
|
[self.progressBar setUsesThreadedAnimation:NO];
|
||||||
|
|
||||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"rememberWindowSize"] integerValue]) {
|
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"rememberWindowSize"] integerValue]) {
|
||||||
[documentWindow setFrameAutosaveName:@"documentSave"];
|
[self.documentWindow setFrameAutosaveName:@"documentSave"];
|
||||||
[documentWindow setFrameUsingName:@"documentSave"];
|
[self.documentWindow setFrameUsingName:@"documentSave"];
|
||||||
[splitView setAutosaveName:@"splitViewSave"];
|
splitView.autosaveName = @"splitViewSave";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
@@ -71,14 +106,13 @@
|
|||||||
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
ps.alignment = NSTextAlignmentRight;
|
ps.alignment = NSTextAlignmentRight;
|
||||||
|
|
||||||
_detailMonospacedAttr = [@{NSFontAttributeName: font,
|
_detailMonospacedAttr = @{NSFontAttributeName: font,
|
||||||
NSParagraphStyleAttributeName: ps} retain];
|
NSParagraphStyleAttributeName: ps};
|
||||||
|
|
||||||
[ps release];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError
|
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError * __autoreleasing *)outError
|
||||||
{
|
{
|
||||||
if (self = [super initWithType:@"Video-MPEG4" error:outError]) {
|
if (self = [super initWithType:@"Video-MPEG4" error:outError]) {
|
||||||
self.mp4 = mp4File;
|
self.mp4 = mp4File;
|
||||||
@@ -87,10 +121,10 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithType:(NSString *)typeName error:(NSError **)outError
|
- (instancetype)initWithType:(NSString *)typeName error:(NSError * __autoreleasing *)outError
|
||||||
{
|
{
|
||||||
if (self = [super initWithType:typeName error:outError]) {
|
if (self = [super initWithType:typeName error:outError]) {
|
||||||
self.mp4 = [[[MP42File alloc] init] autorelease];
|
self.mp4 = [[MP42File alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -109,9 +143,9 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
|
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError * __autoreleasing *)outError
|
||||||
{
|
{
|
||||||
self.mp4 = [[[MP42File alloc] initWithURL:absoluteURL] autorelease];
|
self.mp4 = [[MP42File alloc] initWithURL:absoluteURL];
|
||||||
|
|
||||||
if (outError != NULL && !self.mp4) {
|
if (outError != NULL && !self.mp4) {
|
||||||
*outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
|
*outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
|
||||||
@@ -122,11 +156,11 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)revertToContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
|
- (BOOL)revertToContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError * __autoreleasing *)outError
|
||||||
{
|
{
|
||||||
self.mp4 = [[[MP42File alloc] initWithURL:absoluteURL] autorelease];
|
self.mp4 = [[MP42File alloc] initWithURL:absoluteURL];
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeCleared];
|
[self updateChangeCount:NSChangeCleared];
|
||||||
|
|
||||||
@@ -174,11 +208,11 @@
|
|||||||
[self unblockUserInteraction];
|
[self unblockUserInteraction];
|
||||||
|
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
[optBar setIndeterminate:YES];
|
[self.progressBar setIndeterminate:YES];
|
||||||
[optBar startAnimation:self];
|
[self.progressBar startAnimation:self];
|
||||||
[saveOperationName setStringValue:NSLocalizedString(@"Saving…", @"Document Saving sheet.")];
|
[self.saveOperationName setStringValue:NSLocalizedString(@"Saving…", @"Document Saving sheet.")];
|
||||||
[NSApp beginSheet:savingWindow modalForWindow:documentWindow
|
|
||||||
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
[self.windowForSheet beginSheet:self.saveWindow completionHandler:NULL];
|
||||||
});
|
});
|
||||||
|
|
||||||
IOPMAssertionID assertionID;
|
IOPMAssertionID assertionID;
|
||||||
@@ -189,10 +223,11 @@
|
|||||||
BOOL result = NO;
|
BOOL result = NO;
|
||||||
NSDictionary<NSString *, NSNumber *> *options = [self saveAttributes];
|
NSDictionary<NSString *, NSNumber *> *options = [self saveAttributes];
|
||||||
|
|
||||||
|
__weak SBDocument *weakSelf = self;
|
||||||
self.mp4.progressHandler = ^(double progress){
|
self.mp4.progressHandler = ^(double progress){
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[optBar setIndeterminate:NO];
|
[weakSelf.progressBar setIndeterminate:NO];
|
||||||
[optBar setDoubleValue:progress];
|
weakSelf.progressBar.doubleValue = progress;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -219,7 +254,7 @@
|
|||||||
|
|
||||||
if (result && _optimize) {
|
if (result && _optimize) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[saveOperationName setStringValue:NSLocalizedString(@"Optimizing…", @"Document Optimize sheet.")];
|
[self.saveOperationName setStringValue:NSLocalizedString(@"Optimizing…", @"Document Optimize sheet.")];
|
||||||
});
|
});
|
||||||
result = [self.mp4 optimize];
|
result = [self.mp4 optimize];
|
||||||
_optimize = NO;
|
_optimize = NO;
|
||||||
@@ -239,13 +274,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
[optBar stopAnimation:self];
|
[self.progressBar stopAnimation:self];
|
||||||
[savingWindow orderOut:self];
|
|
||||||
[NSApp endSheet:savingWindow];
|
[self.windowForSheet endSheet:self.saveWindow];
|
||||||
|
|
||||||
if (result == YES && error) {
|
if (result == YES && error) {
|
||||||
[self presentError:error
|
[self presentError:error
|
||||||
modalForWindow:documentWindow
|
modalForWindow:self.windowForSheet
|
||||||
delegate:nil
|
delegate:nil
|
||||||
didPresentSelector:NULL
|
didPresentSelector:NULL
|
||||||
contextInfo:NULL];
|
contextInfo:NULL];
|
||||||
@@ -253,9 +288,8 @@
|
|||||||
|
|
||||||
if (reloadedFile) {
|
if (reloadedFile) {
|
||||||
self.mp4 = reloadedFile;
|
self.mp4 = reloadedFile;
|
||||||
[reloadedFile release];
|
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,28 +378,28 @@
|
|||||||
if (_64bit_data.state) { attributes[MP4264BitData] = @YES; }
|
if (_64bit_data.state) { attributes[MP4264BitData] = @YES; }
|
||||||
if (_64bit_time.state) { attributes[MP4264BitTime] = @YES; }
|
if (_64bit_time.state) { attributes[MP4264BitTime] = @YES; }
|
||||||
|
|
||||||
return [attributes autorelease];
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Interface validation
|
#pragma mark - Interface validation
|
||||||
|
|
||||||
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
|
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
|
||||||
{
|
{
|
||||||
SEL action = [anItem action];
|
SEL action = anItem.action;
|
||||||
|
|
||||||
if (action == @selector(saveDocument:))
|
if (action == @selector(saveDocument:))
|
||||||
if ([self isDocumentEdited])
|
if (self.documentEdited)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(saveDocumentAs:))
|
if (action == @selector(saveDocumentAs:))
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(revertDocumentToSaved:))
|
if (action == @selector(revertDocumentToSaved:))
|
||||||
if ([self isDocumentEdited])
|
if (self.documentEdited)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(saveAndOptimize:))
|
if (action == @selector(saveAndOptimize:))
|
||||||
if (![self isDocumentEdited] && [self.mp4 hasFileRepresentation])
|
if (!self.documentEdited && (self.mp4).hasFileRepresentation)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(selectMetadataFile:))
|
if (action == @selector(selectMetadataFile:))
|
||||||
@@ -389,7 +423,7 @@
|
|||||||
if (action == @selector(sendToExternalApp:))
|
if (action == @selector(sendToExternalApp:))
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(showTrackOffsetSheet:) && [fileTracksTable selectedRow] != -1)
|
if (action == @selector(showTrackOffsetSheet:) && self.tracksTable.selectedRow != -1)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(addChaptersEvery:))
|
if (action == @selector(addChaptersEvery:))
|
||||||
@@ -401,9 +435,9 @@
|
|||||||
if (action == @selector(fixAudioFallbacks:))
|
if (action == @selector(fixAudioFallbacks:))
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (action == @selector(export:) && [fileTracksTable selectedRow] != -1)
|
if (action == @selector(export:) && self.tracksTable.selectedRow != -1)
|
||||||
if ([[self.mp4 trackAtIndex:[fileTracksTable selectedRow]] respondsToSelector:@selector(exportToURL:error:)] &&
|
if ([[self.mp4 trackAtIndex:self.tracksTable.selectedRow] respondsToSelector:@selector(exportToURL:error:)] &&
|
||||||
[[self.mp4 trackAtIndex:[fileTracksTable selectedRow]] muxed])
|
[self.mp4 trackAtIndex:self.tracksTable.selectedRow].muxed)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
@@ -416,7 +450,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toolbarItem == deleteTrack) {
|
if (toolbarItem == deleteTrack) {
|
||||||
if ([fileTracksTable selectedRow] != -1 && [NSApp isActive])
|
if (self.tracksTable.selectedRow != -1 && NSApp.active)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +505,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
if ([tableColumn.identifier isEqualToString:@"trackDuration"]) {
|
if ([tableColumn.identifier isEqualToString:@"trackDuration"]) {
|
||||||
|
|
||||||
if (_detailMonospacedAttr) {
|
if (_detailMonospacedAttr) {
|
||||||
return [[[NSAttributedString alloc] initWithString:track.timeString attributes:_detailMonospacedAttr] autorelease];
|
return [[NSAttributedString alloc] initWithString:track.timeString attributes:_detailMonospacedAttr];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return track.timeString;
|
return track.timeString;
|
||||||
@@ -521,23 +555,22 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
{
|
{
|
||||||
if (propertyView.view != nil) {
|
if (propertyView.view != nil) {
|
||||||
// remove the undo items from the dealloced view
|
// remove the undo items from the dealloced view
|
||||||
[[self undoManager] removeAllActionsWithTarget:propertyView];
|
[self.undoManager removeAllActionsWithTarget:propertyView];
|
||||||
|
|
||||||
// remove the current view
|
// remove the current view
|
||||||
[propertyView.view removeFromSuperview];
|
[propertyView.view removeFromSuperview];
|
||||||
|
|
||||||
// remove the current view controller
|
// remove the current view controller
|
||||||
[propertyView release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSInteger row = [fileTracksTable selectedRow];
|
NSInteger row = self.tracksTable.selectedRow;
|
||||||
|
|
||||||
id controller = nil;
|
id controller = nil;
|
||||||
id track = (row != -1) ? [self.mp4 trackAtIndex:row] : nil;
|
id track = (row != -1) ? [self.mp4 trackAtIndex:row] : nil;
|
||||||
|
|
||||||
if (row == -1) {
|
if (row == -1) {
|
||||||
controller = [[SBMovieViewController alloc] initWithNibName:@"MovieView" bundle:nil];
|
controller = [[SBMovieViewController alloc] initWithNibName:@"MovieView" bundle:nil];
|
||||||
[controller setFile:self.mp4];
|
[controller setMetadata:self.mp4.metadata];
|
||||||
} else if ([track isMemberOfClass:[MP42ChapterTrack class]]) {
|
} else if ([track isMemberOfClass:[MP42ChapterTrack class]]) {
|
||||||
controller = [[SBChapterViewController alloc] initWithNibName:@"ChapterView" bundle:nil];
|
controller = [[SBChapterViewController alloc] initWithNibName:@"ChapterView" bundle:nil];
|
||||||
[controller setTrack:track];
|
[controller setTrack:track];
|
||||||
@@ -557,17 +590,17 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
// embed the current view to our host view
|
// embed the current view to our host view
|
||||||
[targetView addSubview:propertyView.view];
|
[targetView addSubview:propertyView.view];
|
||||||
[documentWindow recalculateKeyViewLoop];
|
[self.documentWindow recalculateKeyViewLoop];
|
||||||
|
|
||||||
// make sure we automatically resize the controller's view to the current window size
|
// make sure we automatically resize the controller's view to the current window size
|
||||||
[[propertyView view] setFrame: [targetView bounds]];
|
propertyView.view.frame = targetView.bounds;
|
||||||
[[propertyView view] setAutoresizingMask:( NSViewWidthSizable | NSViewHeightSizable )];
|
propertyView.view.autoresizingMask = ( NSViewWidthSizable | NSViewHeightSizable );
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
|
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
|
||||||
{
|
{
|
||||||
// Copy the row numbers to the pasteboard.
|
// Copy the row numbers to the pasteboard.
|
||||||
if ([[self.mp4 trackAtIndex:[rowIndexes firstIndex]] muxed]) {
|
if ([self.mp4 trackAtIndex:rowIndexes.firstIndex].muxed) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +617,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
{
|
{
|
||||||
NSUInteger count = self.mp4.tracks.count;
|
NSUInteger count = self.mp4.tracks.count;
|
||||||
if (op == NSTableViewDropAbove && row < count) {
|
if (op == NSTableViewDropAbove && row < count) {
|
||||||
if (![[self.mp4 trackAtIndex:row] muxed]) {
|
if (![self.mp4 trackAtIndex:row].muxed) {
|
||||||
return NSDragOperationEvery;
|
return NSDragOperationEvery;
|
||||||
}
|
}
|
||||||
} else if (op == NSTableViewDropAbove && row == count) {
|
} else if (op == NSTableViewDropAbove && row == count) {
|
||||||
@@ -604,7 +637,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
[self.mp4 moveTrackAtIndex:dragRow toIndex:row];
|
[self.mp4 moveTrackAtIndex:dragRow toIndex:row];
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,11 +650,11 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
- (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)comboBoxCell
|
- (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)comboBoxCell
|
||||||
{
|
{
|
||||||
return [languages count];
|
return languages.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)comboBoxCell:(NSComboBoxCell *)comboBoxCell objectValueForItemAtIndex:(NSInteger)index {
|
- (id)comboBoxCell:(NSComboBoxCell *)comboBoxCell objectValueForItemAtIndex:(NSInteger)index {
|
||||||
return [languages objectAtIndex:index];
|
return languages[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)comboBoxCell:(NSComboBoxCell *)comboBoxCell indexOfItemWithStringValue:(NSString *)string {
|
- (NSUInteger)comboBoxCell:(NSComboBoxCell *)comboBoxCell indexOfItemWithStringValue:(NSString *)string {
|
||||||
@@ -633,16 +666,16 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (void)didEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
- (void)didEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
||||||
{
|
{
|
||||||
[_sheet.window orderOut:nil];
|
[_sheet.window orderOut:nil];
|
||||||
[_sheet autorelease], _sheet = nil;
|
_sheet = nil;
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)sendToQueue:(id)sender
|
- (IBAction)sendToQueue:(id)sender
|
||||||
{
|
{
|
||||||
SBQueueController *queue = [SBQueueController sharedManager];
|
SBQueueController *queue = [SBQueueController sharedManager];
|
||||||
if ([self.mp4 hasFileRepresentation]) {
|
if ((self.mp4).hasFileRepresentation) {
|
||||||
SBQueueItem *item = [SBQueueItem itemWithMP4:self.mp4];
|
SBQueueItem *item = [SBQueueItem itemWithMP4:self.mp4];
|
||||||
[queue addItem:item];
|
[queue addItem:item];
|
||||||
[self close];
|
[self close];
|
||||||
@@ -652,7 +685,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
[self prepareSavePanel:panel];
|
[self prepareSavePanel:panel];
|
||||||
|
|
||||||
[panel beginSheetModalForWindow:documentWindow completionHandler:^(NSInteger result) {
|
[panel beginSheetModalForWindow:self.documentWindow completionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
NSDictionary *attributes = [self saveAttributes];
|
NSDictionary *attributes = [self saveAttributes];
|
||||||
|
|
||||||
@@ -687,7 +720,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
_sheet = [[SBMetadataSearchController alloc] initWithDelegate:self searchString:filename];
|
_sheet = [[SBMetadataSearchController alloc] initWithDelegate:self searchString:filename];
|
||||||
|
|
||||||
[NSApp beginSheet:_sheet.window
|
[NSApp beginSheet:_sheet.window
|
||||||
modalForWindow:documentWindow
|
modalForWindow:self.documentWindow
|
||||||
modalDelegate:self
|
modalDelegate:self
|
||||||
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
||||||
contextInfo:nil];
|
contextInfo:nil];
|
||||||
@@ -695,7 +728,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
- (void)metadataImportDone:(SBMetadataResult *)metadataToBeImported
|
- (void)metadataImportDone:(SBMetadataResult *)metadataToBeImported
|
||||||
{
|
{
|
||||||
[metadataToBeImported retain];
|
|
||||||
if (metadataToBeImported) {
|
if (metadataToBeImported) {
|
||||||
[self.mp4.metadata mergeMetadata:metadataToBeImported.metadata];
|
[self.mp4.metadata mergeMetadata:metadataToBeImported.metadata];
|
||||||
|
|
||||||
@@ -711,7 +743,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
[metadataToBeImported release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Chapters search
|
#pragma mark - Chapters search
|
||||||
@@ -729,7 +760,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
_sheet = [[SBChapterSearchController alloc] initWithDelegate:self searchTitle:title andDuration:duration];
|
_sheet = [[SBChapterSearchController alloc] initWithDelegate:self searchTitle:title andDuration:duration];
|
||||||
|
|
||||||
[NSApp beginSheet:_sheet.window
|
[NSApp beginSheet:_sheet.window
|
||||||
modalForWindow:documentWindow
|
modalForWindow:self.documentWindow
|
||||||
modalDelegate:self
|
modalDelegate:self
|
||||||
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
||||||
contextInfo:nil];
|
contextInfo:nil];
|
||||||
@@ -737,7 +768,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
- (void)chapterImportDone:(NSArray<MP42TextSample *> *)chapterToBeImported
|
- (void)chapterImportDone:(NSArray<MP42TextSample *> *)chapterToBeImported
|
||||||
{
|
{
|
||||||
[chapterToBeImported retain];
|
|
||||||
|
|
||||||
if (chapterToBeImported) {
|
if (chapterToBeImported) {
|
||||||
|
|
||||||
@@ -745,33 +775,31 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
for (MP42TextSample *chapter in chapterToBeImported) {
|
for (MP42TextSample *chapter in chapterToBeImported) {
|
||||||
[newChapter addChapter:chapter];
|
[newChapter addChapter:chapter];
|
||||||
}
|
}
|
||||||
[newChapter setDuration:self.mp4.duration];
|
newChapter.duration = self.mp4.duration;
|
||||||
[self.mp4 addTrack:newChapter];
|
[self.mp4 addTrack:newChapter];
|
||||||
[newChapter release];
|
|
||||||
|
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
[chapterToBeImported release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)showTrackOffsetSheet:(id)sender
|
- (IBAction)showTrackOffsetSheet:(id)sender
|
||||||
{
|
{
|
||||||
[offset setStringValue:[NSString stringWithFormat:@"%lld",
|
offset.stringValue = [NSString stringWithFormat:@"%lld",
|
||||||
[[[self.mp4 tracks] objectAtIndex:[fileTracksTable selectedRow]] startOffset]]];
|
(self.mp4).tracks[self.tracksTable.selectedRow].startOffset];
|
||||||
|
|
||||||
[NSApp beginSheet:offsetWindow modalForWindow:documentWindow
|
[NSApp beginSheet:offsetWindow modalForWindow:self.documentWindow
|
||||||
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)setTrackOffset:(id)sender
|
- (IBAction)setTrackOffset:(id)sender
|
||||||
{
|
{
|
||||||
MP42Track *selectedTrack = [[self.mp4 tracks] objectAtIndex:[fileTracksTable selectedRow]];
|
MP42Track *selectedTrack = (self.mp4).tracks[self.tracksTable.selectedRow];
|
||||||
[selectedTrack setStartOffset:[offset integerValue]];
|
selectedTrack.startOffset = offset.integerValue;
|
||||||
|
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
|
|
||||||
@@ -790,21 +818,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
[_sheet.window orderOut:self];
|
[_sheet.window orderOut:self];
|
||||||
[_sheet release];
|
|
||||||
_sheet = nil;
|
_sheet = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)deleteTrack:(id)sender
|
- (IBAction)deleteTrack:(id)sender
|
||||||
{
|
{
|
||||||
if ([fileTracksTable selectedRow] == -1 || [fileTracksTable editedRow] != -1) {
|
if (self.tracksTable.selectedRow == -1 || self.tracksTable.editedRow != -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.mp4 removeTrackAtIndex:[fileTracksTable selectedRow]];
|
[self.mp4 removeTrackAtIndex:self.tracksTable.selectedRow];
|
||||||
|
|
||||||
[self.mp4 organizeAlternateGroups];
|
[self.mp4 organizeAlternateGroups];
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
@@ -815,7 +842,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
{
|
{
|
||||||
[self.mp4 addTrack:[MP42ChapterTrack chapterTrackFromFile:fileURL]];
|
[self.mp4 addTrack:[MP42ChapterTrack chapterTrackFromFile:fileURL]];
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
@@ -828,7 +855,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[self presentError:error modalForWindow:documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
[self presentError:error modalForWindow:self.documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,14 +876,13 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
}
|
}
|
||||||
|
|
||||||
panel.allowedFileTypes = supportedFileFormats;
|
panel.allowedFileTypes = supportedFileFormats;
|
||||||
[supportedFileFormats release];
|
|
||||||
|
|
||||||
[panel beginSheetModalForWindow:documentWindow completionHandler:^(NSInteger result) {
|
[panel beginSheetModalForWindow:self.documentWindow completionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
NSString *fileExtension = panel.URLs.firstObject.pathExtension;
|
NSString *fileExtension = panel.URLs.firstObject.pathExtension;
|
||||||
|
|
||||||
if ([fileExtension caseInsensitiveCompare: @"txt"] == NSOrderedSame) {
|
if ([fileExtension caseInsensitiveCompare: @"txt"] == NSOrderedSame) {
|
||||||
[self addChapterTrack:[panel.URLs objectAtIndex: 0]];
|
[self addChapterTrack:(panel.URLs)[0]];
|
||||||
}
|
}
|
||||||
else if ([fileExtension caseInsensitiveCompare: @"csv"] == NSOrderedSame) {
|
else if ([fileExtension caseInsensitiveCompare: @"csv"] == NSOrderedSame) {
|
||||||
[self updateChapters:chapters fromCSVFile:panel.URLs.firstObject];
|
[self updateChapters:chapters fromCSVFile:panel.URLs.firstObject];
|
||||||
@@ -876,17 +902,17 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
_sheet = [[SBFileImport alloc] initWithURLs:fileURLs delegate:self error:&error];
|
_sheet = [[SBFileImport alloc] initWithURLs:fileURLs delegate:self error:&error];
|
||||||
|
|
||||||
if (_sheet) {
|
if (_sheet) {
|
||||||
if ([(SBFileImport *)_sheet onlyContainsSubtitleTracks]) {
|
if (((SBFileImport *)_sheet).onlyContainsSubtitleTracks) {
|
||||||
[(SBFileImport *)_sheet addTracks:self];
|
[(SBFileImport *)_sheet addTracks:self];
|
||||||
[self didEndSheet:nil returnCode:NSOKButton contextInfo:nil];
|
[self didEndSheet:nil returnCode:NSOKButton contextInfo:nil];
|
||||||
}
|
}
|
||||||
else { // show the dialog
|
else { // show the dialog
|
||||||
[NSApp beginSheet:_sheet.window modalForWindow:documentWindow
|
[NSApp beginSheet:_sheet.window modalForWindow:self.documentWindow
|
||||||
modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:NULL];
|
modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:NULL];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (error) {
|
else if (error) {
|
||||||
[self presentError:error modalForWindow:documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
[self presentError:error modalForWindow:self.documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,13 +941,11 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
if ([URL.pathExtension isEqualToString:@"xml"] || [URL.pathExtension isEqualToString:@"nfo"]) {
|
if ([URL.pathExtension isEqualToString:@"xml"] || [URL.pathExtension isEqualToString:@"nfo"]) {
|
||||||
MP42Metadata *xmlMetadata = [[MP42Metadata alloc] initWithFileURL:URL];
|
MP42Metadata *xmlMetadata = [[MP42Metadata alloc] initWithFileURL:URL];
|
||||||
[self.mp4.metadata mergeMetadata:xmlMetadata];
|
[self.mp4.metadata mergeMetadata:xmlMetadata];
|
||||||
[xmlMetadata release];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MP42File *file = nil;
|
MP42File *file = nil;
|
||||||
if ((file = [[MP42File alloc] initWithURL:URL])) {
|
if ((file = [[MP42File alloc] initWithURL:URL])) {
|
||||||
[self.mp4.metadata mergeMetadata:file.metadata];
|
[self.mp4.metadata mergeMetadata:file.metadata];
|
||||||
[file release];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -937,9 +961,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
panel.canChooseDirectories = NO;
|
panel.canChooseDirectories = NO;
|
||||||
panel.allowedFileTypes = @[@"mp4", @"m4v", @"m4a", @"xml", @"nfo"];
|
panel.allowedFileTypes = @[@"mp4", @"m4v", @"m4a", @"xml", @"nfo"];
|
||||||
|
|
||||||
[panel beginSheetModalForWindow:documentWindow completionHandler:^(NSInteger result) {
|
[panel beginSheetModalForWindow:self.documentWindow completionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
[self addMetadata:[panel URL]];
|
[self addMetadata:panel.URL];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@@ -949,11 +973,11 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
NSSavePanel *panel = [NSSavePanel savePanel];
|
NSSavePanel *panel = [NSSavePanel savePanel];
|
||||||
|
|
||||||
NSString *filename = self.fileURL.URLByDeletingPathExtension.lastPathComponent;
|
NSString *filename = self.fileURL.URLByDeletingPathExtension.lastPathComponent;
|
||||||
NSInteger row = fileTracksTable.selectedRow;
|
NSInteger row = self.tracksTable.selectedRow;
|
||||||
|
|
||||||
if (row != -1 && [[self.mp4 trackAtIndex:row] isKindOfClass:[MP42SubtitleTrack class]]) {
|
if (row != -1 && [[self.mp4 trackAtIndex:row] isKindOfClass:[MP42SubtitleTrack class]]) {
|
||||||
panel.allowedFileTypes = @[@"srt"];
|
panel.allowedFileTypes = @[@"srt"];
|
||||||
filename = [filename stringByAppendingFormat:@".%@", [[self.mp4 trackAtIndex:row] language]];
|
filename = [filename stringByAppendingFormat:@".%@", [self.mp4 trackAtIndex:row].language];
|
||||||
}
|
}
|
||||||
else if (row != -1 ) {
|
else if (row != -1 ) {
|
||||||
filename = [filename stringByAppendingString:@" - Chapters"];
|
filename = [filename stringByAppendingString:@" - Chapters"];
|
||||||
@@ -963,7 +987,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
panel.canSelectHiddenExtension = YES;
|
panel.canSelectHiddenExtension = YES;
|
||||||
panel.nameFieldStringValue = filename;
|
panel.nameFieldStringValue = filename;
|
||||||
|
|
||||||
[panel beginSheetModalForWindow:documentWindow completionHandler:^(NSInteger result) {
|
[panel beginSheetModalForWindow:self.documentWindow completionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
|
|
||||||
NSError *error;
|
NSError *error;
|
||||||
@@ -974,13 +998,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Export alert panel -> button")];
|
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Export alert panel -> button")];
|
||||||
[alert setMessageText: NSLocalizedString(@"File Could Not Be Saved", "Export alert panel -> title")];
|
[alert setMessageText: NSLocalizedString(@"File Could Not Be Saved", "Export alert panel -> title")];
|
||||||
[alert setInformativeText: [NSString stringWithFormat:
|
alert.informativeText = [NSString stringWithFormat:
|
||||||
NSLocalizedString(@"There was a problem creating the file \"%@\".",
|
NSLocalizedString(@"There was a problem creating the file \"%@\".",
|
||||||
"Export alert panel -> message"), panel.URL.lastPathComponent]];
|
"Export alert panel -> message"), panel.URL.lastPathComponent];
|
||||||
[alert setAlertStyle: NSWarningAlertStyle];
|
alert.alertStyle = NSWarningAlertStyle;
|
||||||
|
|
||||||
[alert runModal];
|
[alert runModal];
|
||||||
[alert release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -994,9 +1017,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
if (!chapterTrack) {
|
if (!chapterTrack) {
|
||||||
chapterTrack = [[MP42ChapterTrack alloc] init];
|
chapterTrack = [[MP42ChapterTrack alloc] init];
|
||||||
[chapterTrack setDuration:self.mp4.duration];
|
chapterTrack.duration = self.mp4.duration;
|
||||||
[self.mp4 addTrack:chapterTrack];
|
[self.mp4 addTrack:chapterTrack];
|
||||||
[chapterTrack release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minutes) {
|
if (minutes) {
|
||||||
@@ -1010,7 +1032,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
duration:self.mp4.duration];
|
duration:self.mp4.duration];
|
||||||
}
|
}
|
||||||
|
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
@@ -1018,19 +1040,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (IBAction)iTunesFriendlyTrackGroups:(id)sender
|
- (IBAction)iTunesFriendlyTrackGroups:(id)sender
|
||||||
{
|
{
|
||||||
[self.mp4 organizeAlternateGroups];
|
[self.mp4 organizeAlternateGroups];
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)fixAudioFallbacks:(id)sender {
|
- (IBAction)fixAudioFallbacks:(id)sender {
|
||||||
[self.mp4 setAutoFallback];
|
[self.mp4 setAutoFallback];
|
||||||
[fileTracksTable reloadData];
|
[self.tracksTable reloadData];
|
||||||
[self reloadPropertyView];
|
[self reloadPropertyView];
|
||||||
[self updateChangeCount:NSChangeDone];
|
[self updateChangeCount:NSChangeDone];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drag & Drop
|
#pragma mark - Drag & Drop
|
||||||
|
|
||||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
|
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
|
||||||
NSPasteboard *pboard = [sender draggingPasteboard];
|
NSPasteboard *pboard = [sender draggingPasteboard];
|
||||||
@@ -1047,9 +1069,9 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
|
||||||
NSPasteboard *pboard = [sender draggingPasteboard];
|
NSPasteboard *pboard = [sender draggingPasteboard];
|
||||||
|
|
||||||
if ( [[pboard types] containsObject:NSURLPboardType] ) {
|
if ( [pboard.types containsObject:NSURLPboardType] ) {
|
||||||
NSArray *items = [pboard readObjectsForClasses:@[[NSURL class]] options:nil];
|
NSArray *items = [pboard readObjectsForClasses:@[[NSURL class]] options:nil];
|
||||||
NSMutableArray<NSURL *> *supportedItems = [[[NSMutableArray alloc] init] autorelease];
|
NSMutableArray<NSURL *> *supportedItems = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
for (NSURL *url in items) {
|
for (NSURL *url in items) {
|
||||||
NSString *pathExtension = url.pathExtension;
|
NSString *pathExtension = url.pathExtension;
|
||||||
@@ -1075,21 +1097,4 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[propertyView release];
|
|
||||||
propertyView = nil;
|
|
||||||
|
|
||||||
[languages release];
|
|
||||||
languages = nil;
|
|
||||||
|
|
||||||
[_mp4File release];
|
|
||||||
_mp4File = nil;
|
|
||||||
|
|
||||||
[_detailMonospacedAttr release];
|
|
||||||
_detailMonospacedAttr = nil;
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+1
-16
@@ -18,22 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)importDoneWithTracks:(NSArray<MP42Track *> *)tracksToBeImported andMetadata:(nullable MP42Metadata *)metadata;
|
- (void)importDoneWithTracks:(NSArray<MP42Track *> *)tracksToBeImported andMetadata:(nullable MP42Metadata *)metadata;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SBFileImport : NSWindowController <NSTableViewDelegate> {
|
@interface SBFileImport : NSWindowController <NSTableViewDelegate>
|
||||||
@private
|
|
||||||
NSArray<NSURL *> *_fileURLs;
|
|
||||||
|
|
||||||
NSMutableArray<MP42FileImporter *> *_fileImporters;
|
|
||||||
NSMutableArray *_tracks;
|
|
||||||
|
|
||||||
NSMutableArray<NSNumber *> *_importCheckArray;
|
|
||||||
NSMutableArray<NSNumber *> *_actionArray;
|
|
||||||
|
|
||||||
id<SBFileImportDelegate> _delegate;
|
|
||||||
|
|
||||||
IBOutlet NSTableView *tracksTableView;
|
|
||||||
IBOutlet NSButton *addTracksButton;
|
|
||||||
IBOutlet NSButton *importMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
- (nullable instancetype)initWithURLs:(NSArray<NSURL *> *)fileURLs delegate:(id <SBFileImportDelegate>)delegate error:(NSError **)error;
|
- (nullable instancetype)initWithURLs:(NSArray<NSURL *> *)fileURLs delegate:(id <SBFileImportDelegate>)delegate error:(NSError **)error;
|
||||||
|
|||||||
+79
-78
@@ -12,8 +12,24 @@
|
|||||||
#import <MP42Foundation/MP42Utilities.h>
|
#import <MP42Foundation/MP42Utilities.h>
|
||||||
|
|
||||||
@implementation SBFileImport
|
@implementation SBFileImport
|
||||||
|
{
|
||||||
|
@private
|
||||||
|
NSArray<NSURL *> *_fileURLs;
|
||||||
|
|
||||||
- (nullable instancetype)initWithURLs:(NSArray<NSURL *> *)fileURLs delegate:(id <SBFileImportDelegate>)delegate error:(NSError **)error
|
NSMutableArray<MP42FileImporter *> *_fileImporters;
|
||||||
|
NSMutableArray *_tracks;
|
||||||
|
|
||||||
|
NSMutableArray<NSNumber *> *_importCheckArray;
|
||||||
|
NSMutableArray<NSNumber *> *_actionArray;
|
||||||
|
|
||||||
|
id<SBFileImportDelegate> _delegate;
|
||||||
|
|
||||||
|
IBOutlet NSTableView *tracksTableView;
|
||||||
|
IBOutlet NSButton *addTracksButton;
|
||||||
|
IBOutlet NSButton *importMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable instancetype)initWithURLs:(NSArray<NSURL *> *)fileURLs delegate:(id <SBFileImportDelegate>)delegate error:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
if ((self = [super initWithWindowNibName:@"FileImport"])) {
|
if ((self = [super initWithWindowNibName:@"FileImport"])) {
|
||||||
_delegate = delegate;
|
_delegate = delegate;
|
||||||
@@ -27,13 +43,11 @@
|
|||||||
if (importer) {
|
if (importer) {
|
||||||
[_tracks addObject:url.lastPathComponent];
|
[_tracks addObject:url.lastPathComponent];
|
||||||
[_fileImporters addObject:importer];
|
[_fileImporters addObject:importer];
|
||||||
[importer release];
|
|
||||||
[_tracks addObjectsFromArray:importer.tracks];
|
[_tracks addObjectsFromArray:importer.tracks];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_tracks.count) {
|
if (!_tracks.count) {
|
||||||
[self release];
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +146,7 @@
|
|||||||
BOOL onlySubtitle = YES;
|
BOOL onlySubtitle = YES;
|
||||||
for (id track in _tracks) {
|
for (id track in _tracks) {
|
||||||
if ([track isKindOfClass:[MP42Track class]]) {
|
if ([track isKindOfClass:[MP42Track class]]) {
|
||||||
if (![track isMemberOfClass:[MP42SubtitleTrack class]] || ![[(MP42Track *)track format] isEqualToString:MP42SubtitleFormatTx3g])
|
if (![track isMemberOfClass:[MP42SubtitleTrack class]] || ![((MP42Track *)track).format isEqualToString:MP42SubtitleFormatTx3g])
|
||||||
onlySubtitle = NO;
|
onlySubtitle = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,40 +196,40 @@
|
|||||||
if ([tableColumn.identifier isEqualToString:@"check"]) {
|
if ([tableColumn.identifier isEqualToString:@"check"]) {
|
||||||
NSButtonCell *buttonCell = [[NSButtonCell alloc] init];
|
NSButtonCell *buttonCell = [[NSButtonCell alloc] init];
|
||||||
[buttonCell setButtonType:NSSwitchButton];
|
[buttonCell setButtonType:NSSwitchButton];
|
||||||
[buttonCell setControlSize:NSSmallControlSize];
|
buttonCell.controlSize = NSSmallControlSize;
|
||||||
[buttonCell setTitle:@""];
|
buttonCell.title = @"";
|
||||||
|
|
||||||
buttonCell.enabled = (isTrackMuxable(track.format) || trackNeedConversion(track.format)) ? YES : NO;
|
buttonCell.enabled = (isTrackMuxable(track.format) || trackNeedConversion(track.format)) ? YES : NO;
|
||||||
|
|
||||||
return [buttonCell autorelease];
|
return buttonCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
||||||
NSPopUpButtonCell *actionCell = [[NSPopUpButtonCell alloc] init];
|
NSPopUpButtonCell *actionCell = [[NSPopUpButtonCell alloc] init];
|
||||||
[actionCell setAutoenablesItems:NO];
|
[actionCell setAutoenablesItems:NO];
|
||||||
[actionCell setFont:[NSFont systemFontOfSize:11]];
|
actionCell.font = [NSFont systemFontOfSize:11];
|
||||||
[actionCell setControlSize:NSSmallControlSize];
|
actionCell.controlSize = NSSmallControlSize;
|
||||||
[actionCell setBordered:NO];
|
[actionCell setBordered:NO];
|
||||||
|
|
||||||
if ([track isMemberOfClass:[MP42VideoTrack class]]) {
|
if ([track isMemberOfClass:[MP42VideoTrack class]]) {
|
||||||
if ([[track.sourceURL pathExtension] caseInsensitiveCompare: @"264"] == NSOrderedSame ||
|
if ([(track.sourceURL).pathExtension caseInsensitiveCompare: @"264"] == NSOrderedSame ||
|
||||||
[[track.sourceURL pathExtension] caseInsensitiveCompare: @"h264"] == NSOrderedSame) {
|
[(track.sourceURL).pathExtension caseInsensitiveCompare: @"h264"] == NSOrderedSame) {
|
||||||
NSInteger i = 0;
|
NSInteger i = 0;
|
||||||
NSArray<NSString *> *formatArray = @[@"23.976", @"24", @"25", @"29.97", @"30", @"50", @"59.96", @"60"];
|
NSArray<NSString *> *formatArray = @[@"23.976", @"24", @"25", @"29.97", @"30", @"50", @"59.96", @"60"];
|
||||||
NSInteger tags[8] = {2398, 24, 25, 2997, 30, 50, 5994, 60};
|
NSInteger tags[8] = {2398, 24, 25, 2997, 30, 50, 5994, 60};
|
||||||
|
|
||||||
for (NSString* format in formatArray) {
|
for (NSString* format in formatArray) {
|
||||||
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""] autorelease];
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""];
|
||||||
[item setTag:tags[i++]];
|
item.tag = tags[i++];
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""] autorelease];
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||||
[item setTag:0];
|
item.tag = 0;
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
|
|
||||||
if (isTrackMuxable(track.format)) {
|
if (isTrackMuxable(track.format)) {
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
@@ -227,72 +241,72 @@
|
|||||||
}
|
}
|
||||||
else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) {
|
else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) {
|
||||||
NSInteger tag = 0;
|
NSInteger tag = 0;
|
||||||
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""] autorelease];
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||||
[item setTag:tag++];
|
item.tag = tag++;
|
||||||
if (!trackNeedConversion(track.format)) {
|
if (!trackNeedConversion(track.format)) {
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[item setEnabled:NO];
|
[item setEnabled:NO];
|
||||||
}
|
}
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
|
|
||||||
NSArray<NSString *> *formatArray = @[MP42SubtitleFormatTx3g];
|
NSArray<NSString *> *formatArray = @[MP42SubtitleFormatTx3g];
|
||||||
for (NSString *format in formatArray) {
|
for (NSString *format in formatArray) {
|
||||||
item = [[[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""] autorelease];
|
item = [[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""];
|
||||||
[item setTag:tag++];
|
item.tag = tag++;
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ([track isMemberOfClass:[MP42ClosedCaptionTrack class]]) {
|
else if ([track isMemberOfClass:[MP42ClosedCaptionTrack class]]) {
|
||||||
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""] autorelease];
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||||
[item setTag:0];
|
item.tag = 0;
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
}
|
}
|
||||||
else if ([track isMemberOfClass:[MP42AudioTrack class]]) {
|
else if ([track isMemberOfClass:[MP42AudioTrack class]]) {
|
||||||
NSInteger tag = 0;
|
NSInteger tag = 0;
|
||||||
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""] autorelease];
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||||
[item setTag:tag++];
|
item.tag = tag++;
|
||||||
if (!trackNeedConversion(track.format))
|
if (!trackNeedConversion(track.format))
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
else
|
else
|
||||||
[item setEnabled:NO];
|
[item setEnabled:NO];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
|
|
||||||
NSArray *formatArray = @[@"AAC - Dolby Pro Logic II", @"AAC - Dolby Pro Logic", @"AAC - Stereo", @"AAC - Mono", @"AAC - Multi-channel"];
|
NSArray *formatArray = @[@"AAC - Dolby Pro Logic II", @"AAC - Dolby Pro Logic", @"AAC - Stereo", @"AAC - Mono", @"AAC - Multi-channel"];
|
||||||
for (NSString *format in formatArray) {
|
for (NSString *format in formatArray) {
|
||||||
item = [[[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""] autorelease];
|
item = [[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""];
|
||||||
[item setTag:tag++];
|
item.tag = tag++;
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([track.format isEqualTo:MP42AudioFormatAC3] ||
|
if ([track.format isEqualTo:MP42AudioFormatAC3] ||
|
||||||
[track.format isEqualTo:MP42AudioFormatEAC3] ||
|
[track.format isEqualTo:MP42AudioFormatEAC3] ||
|
||||||
[track.format isEqualTo:MP42AudioFormatDTS])
|
[track.format isEqualTo:MP42AudioFormatDTS])
|
||||||
{
|
{
|
||||||
item = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AAC + Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""] autorelease];
|
item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AAC + Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||||
[item setTag:tag++];
|
item.tag = tag++;
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ([track isMemberOfClass:[MP42ChapterTrack class]]) {
|
else if ([track isMemberOfClass:[MP42ChapterTrack class]]) {
|
||||||
NSMenuItem *item = [[[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""] autorelease];
|
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||||
[item setTag:0];
|
item.tag = 0;
|
||||||
[item setEnabled:YES];
|
[item setEnabled:YES];
|
||||||
[[actionCell menu] addItem:item];
|
[actionCell.menu addItem:item];
|
||||||
}
|
}
|
||||||
cell = actionCell;
|
cell = actionCell;
|
||||||
|
|
||||||
return [cell autorelease];
|
return cell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [tableColumn dataCell];
|
return tableColumn.dataCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)tableView:(NSTableView *)tableView
|
- (id)tableView:(NSTableView *)tableView
|
||||||
@@ -307,7 +321,7 @@
|
|||||||
|
|
||||||
if ([object isKindOfClass:[MP42Track class]]) {
|
if ([object isKindOfClass:[MP42Track class]]) {
|
||||||
if( [tableColumn.identifier isEqualToString: @"check"] )
|
if( [tableColumn.identifier isEqualToString: @"check"] )
|
||||||
return [_importCheckArray objectAtIndex:rowIndex];
|
return _importCheckArray[rowIndex];
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackId"])
|
if ([tableColumn.identifier isEqualToString:@"trackId"])
|
||||||
return [NSString stringWithFormat:@"%d", [object trackId]];
|
return [NSString stringWithFormat:@"%d", [object trackId]];
|
||||||
@@ -325,8 +339,8 @@
|
|||||||
return [object language];
|
return [object language];
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackAction"])
|
if ([tableColumn.identifier isEqualToString:@"trackAction"])
|
||||||
return [_actionArray objectAtIndex:rowIndex];
|
return _actionArray[rowIndex];
|
||||||
} else if ([tableColumn isEqual:[[tableView tableColumns] objectAtIndex:1]]) {
|
} else if ([tableColumn isEqual:tableView.tableColumns[1]]) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,24 +353,24 @@
|
|||||||
row:(NSInteger)rowIndex
|
row:(NSInteger)rowIndex
|
||||||
{
|
{
|
||||||
if ([tableColumn.identifier isEqualToString: @"check"]) {
|
if ([tableColumn.identifier isEqualToString: @"check"]) {
|
||||||
[_importCheckArray replaceObjectAtIndex:rowIndex withObject:anObject];
|
_importCheckArray[rowIndex] = anObject;
|
||||||
}
|
}
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
||||||
[_actionArray replaceObjectAtIndex:rowIndex withObject:anObject];
|
_actionArray[rowIndex] = anObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)toggleSelectionCheck:(BOOL)value
|
- (void)toggleSelectionCheck:(BOOL)value
|
||||||
{
|
{
|
||||||
NSIndexSet *selection = [tracksTableView selectedRowIndexes];
|
NSIndexSet *selection = tracksTableView.selectedRowIndexes;
|
||||||
NSInteger clickedRow = [tracksTableView clickedRow];
|
NSInteger clickedRow = tracksTableView.clickedRow;
|
||||||
|
|
||||||
if (clickedRow != -1 && ![selection containsIndex:clickedRow]) {
|
if (clickedRow != -1 && ![selection containsIndex:clickedRow]) {
|
||||||
selection = [NSIndexSet indexSetWithIndex:clickedRow];
|
selection = [NSIndexSet indexSetWithIndex:clickedRow];
|
||||||
}
|
}
|
||||||
|
|
||||||
[selection enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
[selection enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
||||||
[_importCheckArray replaceObjectAtIndex:idx withObject:@(value)];
|
self->_importCheckArray[idx] = @(value);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[tracksTableView reloadDataForRowIndexes:selection columnIndexes:[NSIndexSet indexSetWithIndex:0]];
|
[tracksTableView reloadDataForRowIndexes:selection columnIndexes:[NSIndexSet indexSetWithIndex:0]];
|
||||||
@@ -374,10 +388,10 @@
|
|||||||
|
|
||||||
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
|
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
|
||||||
{
|
{
|
||||||
SEL action = [anItem action];
|
SEL action = anItem.action;
|
||||||
|
|
||||||
if (action == @selector(uncheckSelected:) || action == @selector(checkSelected:))
|
if (action == @selector(uncheckSelected:) || action == @selector(checkSelected:))
|
||||||
if ([tracksTableView selectedRow] != -1 || [tracksTableView clickedRow] != -1)
|
if (tracksTableView.selectedRow != -1 || tracksTableView.clickedRow != -1)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
@@ -387,8 +401,8 @@
|
|||||||
{
|
{
|
||||||
[tracksTableView setDelegate:nil];
|
[tracksTableView setDelegate:nil];
|
||||||
[tracksTableView setDataSource:nil];
|
[tracksTableView setDataSource:nil];
|
||||||
[NSApp endSheet:[self window] returnCode:NSOKButton];
|
[NSApp endSheet:self.window returnCode:NSOKButton];
|
||||||
[[self window] orderOut:self];
|
[self.window orderOut:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)addTracks:(id)sender
|
- (IBAction)addTracks:(id)sender
|
||||||
@@ -402,19 +416,18 @@
|
|||||||
|
|
||||||
for (MP42Track *track in _tracks) {
|
for (MP42Track *track in _tracks) {
|
||||||
if ([track isKindOfClass:[MP42Track class]]) {
|
if ([track isKindOfClass:[MP42Track class]]) {
|
||||||
if ([[_importCheckArray objectAtIndex: i] boolValue]) {
|
if (_importCheckArray[i].boolValue) {
|
||||||
NSUInteger conversion = [[_actionArray objectAtIndex:i] integerValue];
|
NSUInteger conversion = _actionArray[i].integerValue;
|
||||||
|
|
||||||
if ([track isMemberOfClass:[MP42AudioTrack class]]) {
|
if ([track isMemberOfClass:[MP42AudioTrack class]]) {
|
||||||
if (conversion == 6) {
|
if (conversion == 6) {
|
||||||
MP42AudioTrack *copy = [track copy];
|
MP42AudioTrack *copy = [track copy];
|
||||||
[copy setNeedConversion:YES];
|
[copy setNeedConversion:YES];
|
||||||
[copy setMixdownType:SBDolbyPlIIMixdown];
|
copy.mixdownType = SBDolbyPlIIMixdown;
|
||||||
|
|
||||||
[(MP42AudioTrack *)track setFallbackTrack:copy];
|
((MP42AudioTrack *)track).fallbackTrack = copy;
|
||||||
|
|
||||||
[tracks addObject:copy];
|
[tracks addObject:copy];
|
||||||
[copy release];
|
|
||||||
} else if (conversion) {
|
} else if (conversion) {
|
||||||
[track setNeedConversion:YES];
|
[track setNeedConversion:YES];
|
||||||
}
|
}
|
||||||
@@ -427,17 +440,17 @@
|
|||||||
[(MP42AudioTrack *)track setMixdownType:nil];
|
[(MP42AudioTrack *)track setMixdownType:nil];
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
[(MP42AudioTrack *)track setMixdownType:SBMonoMixdown];
|
((MP42AudioTrack *)track).mixdownType = SBMonoMixdown;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
[(MP42AudioTrack *)track setMixdownType:SBStereoMixdown];
|
((MP42AudioTrack *)track).mixdownType = SBStereoMixdown;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
[(MP42AudioTrack *)track setMixdownType:SBDolbyMixdown];
|
((MP42AudioTrack *)track).mixdownType = SBDolbyMixdown;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
[(MP42AudioTrack *)track setMixdownType:SBDolbyPlIIMixdown];
|
((MP42AudioTrack *)track).mixdownType = SBDolbyPlIIMixdown;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) {
|
} else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) {
|
||||||
@@ -445,8 +458,8 @@
|
|||||||
[track setNeedConversion:YES];
|
[track setNeedConversion:YES];
|
||||||
}
|
}
|
||||||
} else if ([track isMemberOfClass:[MP42VideoTrack class]]) {
|
} else if ([track isMemberOfClass:[MP42VideoTrack class]]) {
|
||||||
if ([[track.sourceURL pathExtension] caseInsensitiveCompare:@"264"] == NSOrderedSame ||
|
if ([(track.sourceURL).pathExtension caseInsensitiveCompare:@"264"] == NSOrderedSame ||
|
||||||
[[track.sourceURL pathExtension] caseInsensitiveCompare:@"h264"] == NSOrderedSame) {
|
[(track.sourceURL).pathExtension caseInsensitiveCompare:@"h264"] == NSOrderedSame) {
|
||||||
switch(conversion) {
|
switch(conversion) {
|
||||||
case 0:
|
case 0:
|
||||||
track.trackId = 2398;
|
track.trackId = 2398;
|
||||||
@@ -487,30 +500,18 @@
|
|||||||
|
|
||||||
MP42Metadata *metadata = nil;
|
MP42Metadata *metadata = nil;
|
||||||
|
|
||||||
if ([importMetadata state]) {
|
if (importMetadata.state) {
|
||||||
metadata = [[[[_fileImporters firstObject] metadata] retain] autorelease];
|
metadata = _fileImporters.firstObject.metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
[_delegate importDoneWithTracks:tracks andMetadata:metadata];
|
[_delegate importDoneWithTracks:tracks andMetadata:metadata];
|
||||||
|
|
||||||
[tracks release];
|
|
||||||
|
|
||||||
[tracksTableView setDelegate:nil];
|
[tracksTableView setDelegate:nil];
|
||||||
[tracksTableView setDataSource:nil];
|
[tracksTableView setDataSource:nil];
|
||||||
|
|
||||||
[NSApp endSheet:[self window] returnCode:NSOKButton];
|
[NSApp endSheet:self.window returnCode:NSOKButton];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[_fileURLs release];
|
|
||||||
[_fileImporters release];
|
|
||||||
[_tracks release];
|
|
||||||
|
|
||||||
[_importCheckArray release];
|
|
||||||
[_actionArray release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -11,14 +11,16 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@protocol SBImageBrowserViewDelegate
|
@protocol SBImageBrowserViewDelegate
|
||||||
|
|
||||||
@optional
|
@optional
|
||||||
- (void)_pasteToImageBrowserView:(IKImageBrowserView *)ImageBrowserView;
|
- (void)_pasteToImageBrowserView:(IKImageBrowserView *)ImageBrowserView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SBImageBrowserView : IKImageBrowserView {
|
@interface SBImageBrowserView : IKImageBrowserView
|
||||||
NSArray *_pasteboardTypes;
|
|
||||||
}
|
@property(nonatomic, readwrite, strong) NSArray<NSString *> *pasteboardTypes;
|
||||||
@property(nonatomic, readwrite, retain) NSArray<NSString *> *pasteboardTypes;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
@@ -10,13 +10,11 @@
|
|||||||
|
|
||||||
@implementation SBImageBrowserView
|
@implementation SBImageBrowserView
|
||||||
|
|
||||||
@synthesize pasteboardTypes = _pasteboardTypes;
|
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(NSRect)frame
|
- (instancetype)initWithFrame:(NSRect)frame
|
||||||
{
|
{
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
if (self) {
|
if (self) {
|
||||||
_pasteboardTypes = [@[] retain];
|
_pasteboardTypes = @[];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -25,7 +23,7 @@
|
|||||||
{
|
{
|
||||||
self = [super initWithCoder:coder];
|
self = [super initWithCoder:coder];
|
||||||
if (self) {
|
if (self) {
|
||||||
_pasteboardTypes = [@[] retain];
|
_pasteboardTypes = @[];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -33,7 +31,7 @@
|
|||||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||||
{
|
{
|
||||||
id delegate = [self delegate];
|
id delegate = [self delegate];
|
||||||
SEL action = [item action];
|
SEL action = item.action;
|
||||||
|
|
||||||
if (action == @selector(paste:)) {
|
if (action == @selector(paste:)) {
|
||||||
if (![self pasteboardHasSupportedType] || ![delegate respondsToSelector:@selector(_pasteToImageBrowserView:)]) {
|
if (![self pasteboardHasSupportedType] || ![delegate respondsToSelector:@selector(_pasteToImageBrowserView:)]) {
|
||||||
@@ -59,12 +57,4 @@
|
|||||||
return (bestType != nil);
|
return (bestType != nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[_pasteboardTypes release];
|
|
||||||
_pasteboardTypes = nil;
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -23,14 +23,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@private
|
@private
|
||||||
SBQueueItem *_item;
|
SBQueueItem *_item;
|
||||||
|
|
||||||
NSButton *_editButton;
|
NSButton *__weak _editButton;
|
||||||
NSProgressIndicator *_spinner;
|
NSProgressIndicator *__weak _spinner;
|
||||||
|
|
||||||
id<SBItemViewDelegate> _delegate;
|
id<SBItemViewDelegate> __unsafe_unretained _delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, readonly) SBQueueItem *item;
|
@property (nonatomic, readonly) SBQueueItem *item;
|
||||||
@property (nonatomic, assign, readwrite) id<SBItemViewDelegate> delegate;
|
@property (nonatomic, unsafe_unretained, readwrite) id<SBItemViewDelegate> delegate;
|
||||||
|
|
||||||
- (instancetype)initWithItem:(SBQueueItem *)item;
|
- (instancetype)initWithItem:(SBQueueItem *)item;
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ static void *SBItemViewContex = &SBItemViewContex;
|
|||||||
|
|
||||||
@property (nonatomic) SBQueueItem *item;
|
@property (nonatomic) SBQueueItem *item;
|
||||||
|
|
||||||
@property (nonatomic, assign) IBOutlet NSButton *editButton;
|
@property (nonatomic, weak) IBOutlet NSButton *editButton;
|
||||||
@property (nonatomic, assign) IBOutlet NSProgressIndicator *spinner;
|
@property (nonatomic, weak) IBOutlet NSProgressIndicator *spinner;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ static void *SBItemViewContex = &SBItemViewContex;
|
|||||||
- (instancetype)initWithItem:(SBQueueItem *)item {
|
- (instancetype)initWithItem:(SBQueueItem *)item {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_item = [item retain];
|
_item = item;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ static void *SBItemViewContex = &SBItemViewContex;
|
|||||||
[self.editButton setEnabled:YES];
|
[self.editButton setEnabled:YES];
|
||||||
}
|
}
|
||||||
} else if ([keyPath isEqualToString:@"item.actions"]) {
|
} else if ([keyPath isEqualToString:@"item.actions"]) {
|
||||||
NSInteger count = [[change objectForKey:NSKeyValueChangeNewKey] count] - [[change objectForKey:NSKeyValueChangeOldKey] count];
|
NSInteger count = [change[NSKeyValueChangeNewKey] count] - [change[NSKeyValueChangeOldKey] count];
|
||||||
NSSize frameSize = self.view.frame.size;
|
NSSize frameSize = self.view.frame.size;
|
||||||
frameSize.height += TABLE_ROW_HEIGHT * (count >= 0 ? count - 1 : count);
|
frameSize.height += TABLE_ROW_HEIGHT * (count >= 0 ? count - 1 : count);
|
||||||
if ([self.delegate respondsToSelector:@selector(setPopoverSize:)]) {
|
if ([self.delegate respondsToSelector:@selector(setPopoverSize:)]) {
|
||||||
@@ -92,14 +92,11 @@ static void *SBItemViewContex = &SBItemViewContex;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[_item release];
|
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
[self removeObserver:self forKeyPath:@"item.status"];
|
[self removeObserver:self forKeyPath:@"item.status"];
|
||||||
[self removeObserver:self forKeyPath:@"item.actions"];
|
[self removeObserver:self forKeyPath:@"item.actions"];
|
||||||
} @catch (NSException * __unused exception) {}
|
} @catch (NSException * __unused exception) {}
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SBLogWindowController : NSWindowController <MP42Logging> {
|
@interface SBLogWindowController : NSWindowController <MP42Logging> {
|
||||||
@private
|
@private
|
||||||
NSTextView *_logView;
|
NSTextView *__unsafe_unretained _logView;
|
||||||
SBLogger *_logger;
|
SBLogger *_logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
@interface SBLogWindowController ()
|
@interface SBLogWindowController ()
|
||||||
|
|
||||||
@property (nonatomic, assign) IBOutlet NSTextView *logView;
|
@property (nonatomic, unsafe_unretained) IBOutlet NSTextView *logView;
|
||||||
@property (nonatomic, readonly) SBLogger *logger;
|
@property (nonatomic, readonly) SBLogger *logger;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
if ((self = [super initWithWindowNibName:@"SBLogWindow"])) {
|
if ((self = [super initWithWindowNibName:@"SBLogWindow"])) {
|
||||||
(void)[self window];
|
(void)self.window;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
self = [self init];
|
self = [self init];
|
||||||
|
|
||||||
if (self) {
|
if (self) {
|
||||||
_logger = [logger retain];
|
_logger = logger;
|
||||||
_logger.delegate = self;
|
_logger.delegate = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,22 +44,14 @@
|
|||||||
- (void)writeToLog:(NSString *)string {
|
- (void)writeToLog:(NSString *)string {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string];
|
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string];
|
||||||
[[self.logView textStorage] appendAttributedString:attributedString];
|
[(self.logView).textStorage appendAttributedString:attributedString];
|
||||||
[attributedString release];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)clearLog:(id)sender {
|
- (IBAction)clearLog:(id)sender {
|
||||||
[[self.logView textStorage] deleteCharactersInRange:NSMakeRange(0, [[self.logView textStorage] length])];
|
[(self.logView).textStorage deleteCharactersInRange:NSMakeRange(0, (self.logView).textStorage.length)];
|
||||||
[self.logger clearLog];
|
[self.logger clearLog];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[_logger release];
|
|
||||||
_logger = nil;
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+2
-2
@@ -13,10 +13,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SBLogger : NSObject <MP42Logging> {
|
@interface SBLogger : NSObject <MP42Logging> {
|
||||||
NSURL *_fileURL;
|
NSURL *_fileURL;
|
||||||
id <MP42Logging> _delegate;
|
id <MP42Logging> __unsafe_unretained _delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (atomic, assign, readwrite, nullable) id <MP42Logging> delegate;
|
@property (atomic, unsafe_unretained, readwrite, nullable) id <MP42Logging> delegate;
|
||||||
|
|
||||||
- (instancetype)initWithLogFile:(NSURL *)fileURL;
|
- (instancetype)initWithLogFile:(NSURL *)fileURL;
|
||||||
|
|
||||||
|
|||||||
+3
-6
@@ -37,14 +37,14 @@
|
|||||||
|
|
||||||
snprintf(time, sizeof(time), "[%02d:%02d:%02d]", now->tm_hour, now->tm_min, now->tm_sec);
|
snprintf(time, sizeof(time), "[%02d:%02d:%02d]", now->tm_hour, now->tm_min, now->tm_sec);
|
||||||
|
|
||||||
return [NSString stringWithUTF8String:time];
|
return @(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)writeToLog:(NSString *)string {
|
- (void)writeToLog:(NSString *)string {
|
||||||
if (self.fileURL) {
|
if (self.fileURL) {
|
||||||
FILE *f = fopen([[self.fileURL path] fileSystemRepresentation], "a");
|
FILE *f = fopen((self.fileURL).path.fileSystemRepresentation, "a");
|
||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "%s %s", [[self currentTime] UTF8String], [string UTF8String]);
|
fprintf(f, "%s %s", [self currentTime].UTF8String, string.UTF8String);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,12 +66,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[_fileURL release];
|
|
||||||
_fileURL = nil;
|
|
||||||
|
|
||||||
_delegate = nil;
|
_delegate = nil;
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -21,13 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*
|
*
|
||||||
* Custom media tags are preserved.
|
* Custom media tags are preserved.
|
||||||
*/
|
*/
|
||||||
@interface SBMediaTagsController : NSViewController {
|
@interface SBMediaTagsController : NSViewController
|
||||||
@private
|
|
||||||
MP42Track *_track;
|
|
||||||
NSArray<SBMediaTag *> *_tags;
|
|
||||||
|
|
||||||
IBOutlet NSTableView *_tableView;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an SBMediaTagsController with the tags
|
* Initializes an SBMediaTagsController with the tags
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_END
|
|||||||
_localizedTitle = [[SBMediaTag localizedTitleForTag:_value] copy];
|
_localizedTitle = [[SBMediaTag localizedTitleForTag:_value] copy];
|
||||||
|
|
||||||
if (_localizedTitle == nil) {
|
if (_localizedTitle == nil) {
|
||||||
_localizedTitle = [_value retain];
|
_localizedTitle = _value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,27 +123,13 @@ NS_ASSUME_NONNULL_END
|
|||||||
return localizedDescriptions[tag];
|
return localizedDescriptions[tag];
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize state = _state;
|
- (NSString *)description
|
||||||
@synthesize value = _value;
|
{
|
||||||
@synthesize localizedTitle = _localizedTitle;
|
NSString *description = super.description;
|
||||||
@synthesize localizedDescription = _localizedDescription;
|
|
||||||
|
|
||||||
- (NSString *)description {
|
|
||||||
NSString *description = [super description];
|
|
||||||
description = [description stringByAppendingFormat:@" %@, state = %d", _value, _state];
|
description = [description stringByAppendingFormat:@" %@, state = %d", _value, _state];
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[_value release];
|
|
||||||
_value = nil;
|
|
||||||
[_localizedTitle release];
|
|
||||||
_localizedTitle = nil;
|
|
||||||
[_localizedDescription release];
|
|
||||||
_localizedDescription = nil;
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -157,8 +143,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
SBMediaTag *_representedTag;
|
SBMediaTag *_representedTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, readwrite, strong) SBMediaTag *representedTag;
|
||||||
@property (nonatomic, readwrite, retain) SBMediaTag *representedTag;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -166,11 +151,8 @@ NS_ASSUME_NONNULL_END
|
|||||||
|
|
||||||
@implementation SBCheckBoxTableCellView
|
@implementation SBCheckBoxTableCellView
|
||||||
|
|
||||||
@synthesize representedTag = _representedTag;
|
|
||||||
|
|
||||||
- (void)setRepresentedTag:(SBMediaTag *)representedTag {
|
- (void)setRepresentedTag:(SBMediaTag *)representedTag {
|
||||||
[_representedTag autorelease];
|
_representedTag = representedTag;
|
||||||
_representedTag = [representedTag retain];
|
|
||||||
|
|
||||||
_checkBox.title = _representedTag.localizedTitle;
|
_checkBox.title = _representedTag.localizedTitle;
|
||||||
_checkBox.state = _representedTag.state;
|
_checkBox.state = _representedTag.state;
|
||||||
@@ -187,19 +169,19 @@ NS_ASSUME_NONNULL_END
|
|||||||
|
|
||||||
#pragma mark - Main Class
|
#pragma mark - Main Class
|
||||||
|
|
||||||
@implementation SBMediaTagsController
|
@implementation SBMediaTagsController {
|
||||||
|
IBOutlet NSTableView *_tableView;
|
||||||
|
}
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super initWithNibName:@"SBMediaTagsController" bundle:nil];
|
self = [super initWithNibName:@"SBMediaTagsController" bundle:nil];
|
||||||
if (self) {
|
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithTrack:(MP42Track *)track {
|
- (instancetype)initWithTrack:(MP42Track *)track {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_track = [track retain];
|
_track = track;
|
||||||
NSArray<NSString *> *predefinedTags = [SBMediaTag predefinedTagsForMediaType:track.mediaType];
|
NSArray<NSString *> *predefinedTags = [SBMediaTag predefinedTagsForMediaType:track.mediaType];
|
||||||
|
|
||||||
NSMutableArray<SBMediaTag *> *tags = [[NSMutableArray alloc] init];
|
NSMutableArray<SBMediaTag *> *tags = [[NSMutableArray alloc] init];
|
||||||
@@ -210,7 +192,6 @@ NS_ASSUME_NONNULL_END
|
|||||||
SBMediaTag *tag = [[SBMediaTag alloc] initWithValue:availableTag
|
SBMediaTag *tag = [[SBMediaTag alloc] initWithValue:availableTag
|
||||||
state:state];
|
state:state];
|
||||||
[tags addObject:tag];
|
[tags addObject:tag];
|
||||||
[tag release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep the custom ones if present
|
// Keep the custom ones if present
|
||||||
@@ -220,34 +201,18 @@ NS_ASSUME_NONNULL_END
|
|||||||
for (NSString *customTag in custom) {
|
for (NSString *customTag in custom) {
|
||||||
SBMediaTag *tag = [[SBMediaTag alloc] initWithValue:customTag state:YES];
|
SBMediaTag *tag = [[SBMediaTag alloc] initWithValue:customTag state:YES];
|
||||||
[tags addObject:tag];
|
[tags addObject:tag];
|
||||||
[tag release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[custom release];
|
|
||||||
|
|
||||||
_tags = [tags copy];
|
_tags = [tags copy];
|
||||||
[tags release];
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@synthesize track = _track;
|
- (void)dealloc
|
||||||
@synthesize tags = _tags;
|
{
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[_tableView setDelegate:nil];
|
[_tableView setDelegate:nil];
|
||||||
[_tableView setDataSource:nil];
|
[_tableView setDataSource:nil];
|
||||||
[_track release];
|
|
||||||
_track = nil;
|
|
||||||
[_tags release];
|
|
||||||
_tags = nil;
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)loadView
|
|
||||||
{
|
|
||||||
[super loadView];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
||||||
|
|||||||
@@ -10,64 +10,27 @@
|
|||||||
#import <MP42Foundation/MP42Metadata.h>
|
#import <MP42Foundation/MP42Metadata.h>
|
||||||
|
|
||||||
#import "SBMetadataSearchController.h"
|
#import "SBMetadataSearchController.h"
|
||||||
|
#import "SBTableView.h"
|
||||||
#import "SBArtworkSelector.h"
|
#import "SBArtworkSelector.h"
|
||||||
#import "SBDocument.h"
|
#import "SBDocument.h"
|
||||||
#import "SBMetadataImporter.h"
|
#import "SBMetadataImporter.h"
|
||||||
|
|
||||||
@interface SBMetadataSearchController () <NSTableViewDelegate, NSComboBoxDelegate, SBArtworkSelectorDelegate>
|
@interface SBMetadataSearchController () <NSTableViewDelegate, NSComboBoxDelegate, SBArtworkSelectorDelegate>
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain) SBMetadataImporter *currentSearcher;
|
@property (nonatomic, readwrite, strong) SBMetadataImporter *currentSearcher;
|
||||||
@property (nonatomic, readwrite, retain) NSArray<SBMetadataResult *> *resultsArray;
|
@property (nonatomic, readwrite, strong) NSArray<SBMetadataResult *> *resultsArray;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain) SBMetadataResult *selectedResult;
|
@property (nonatomic, readwrite, strong) SBMetadataResult *selectedResult;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain) NSDictionary *selectedResultTags;
|
@property (nonatomic, readwrite, strong) NSDictionary *selectedResultTags;
|
||||||
@property (nonatomic, readwrite, retain) NSArray<NSString *> *selectedResultTagsArray;
|
@property (nonatomic, readwrite, strong) NSArray<NSString *> *selectedResultTagsArray;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain) NSMutableArray<NSString *> *tvSeriesNameSearchArray;
|
@property (nonatomic, readwrite, strong) NSMutableArray<NSString *> *tvSeriesNameSearchArray;
|
||||||
|
|
||||||
#pragma mark Metadata provider
|
|
||||||
- (void) createLanguageMenus;
|
|
||||||
- (void) metadataProvidersSelectDefaultLanguage;
|
|
||||||
- (IBAction) metadataProviderLanguageSelected:(id)sender;
|
|
||||||
- (IBAction) metadataProviderSelected:(id)sender;
|
|
||||||
|
|
||||||
#pragma mark Search input fields
|
|
||||||
- (void) updateSearchButtonVisibility;
|
|
||||||
- (void) searchTVSeriesNameDone:(NSArray *)seriesArray;
|
|
||||||
|
|
||||||
#pragma mark Search for metadata
|
|
||||||
- (IBAction) searchForResults:(id)sender;
|
|
||||||
- (void) searchForResultsDone:(NSArray *)metadataArray;
|
|
||||||
|
|
||||||
#pragma mark Load additional metadata
|
|
||||||
- (IBAction) loadAdditionalMetadata:(id)sender;
|
|
||||||
|
|
||||||
#pragma mark Select artwork
|
|
||||||
- (void) selectArtwork;
|
|
||||||
- (void) selectArtworkDone:(NSIndexSet *)indexes;
|
|
||||||
|
|
||||||
#pragma mark Load artwork
|
|
||||||
- (void) loadArtworks:(NSIndexSet *)indexes;
|
|
||||||
|
|
||||||
#pragma mark Finishing up
|
|
||||||
- (void) addMetadata;
|
|
||||||
- (IBAction) closeWindow: (id) sender;
|
|
||||||
|
|
||||||
#pragma mark Miscellaneous
|
|
||||||
- (NSAttributedString *) boldString: (NSString *) string;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBMetadataSearchController
|
@implementation SBMetadataSearchController
|
||||||
|
|
||||||
@synthesize currentSearcher = _currentSearcher;
|
|
||||||
@synthesize resultsArray = _resultsArray;
|
|
||||||
@synthesize selectedResult = _selectedResult;
|
|
||||||
@synthesize selectedResultTags = _selectedResultTags;
|
|
||||||
@synthesize selectedResultTagsArray = _selectedResultTagsArray;
|
|
||||||
@synthesize tvSeriesNameSearchArray = _tvSeriesNameSearchArray;
|
|
||||||
|
|
||||||
#pragma mark Initialization
|
#pragma mark Initialization
|
||||||
|
|
||||||
- (instancetype)initWithDelegate:(id <SBMetadataSearchControllerDelegate>)del searchString:(NSString *)searchString
|
- (instancetype)initWithDelegate:(id <SBMetadataSearchControllerDelegate>)del searchString:(NSString *)searchString
|
||||||
@@ -76,14 +39,12 @@
|
|||||||
delegate = del;
|
delegate = del;
|
||||||
_searchString = [searchString copy];
|
_searchString = [searchString copy];
|
||||||
|
|
||||||
NSMutableParagraphStyle * ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
NSMutableParagraphStyle * ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||||
[ps setHeadIndent: -10.0];
|
ps.headIndent = -10.0;
|
||||||
[ps setAlignment:NSRightTextAlignment];
|
ps.alignment = NSRightTextAlignment;
|
||||||
detailBoldAttr = [[NSDictionary dictionaryWithObjectsAndKeys:
|
detailBoldAttr = @{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]],
|
||||||
[NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]], NSFontAttributeName,
|
NSParagraphStyleAttributeName: ps,
|
||||||
ps, NSParagraphStyleAttributeName,
|
NSForegroundColorAttributeName: [NSColor grayColor]};
|
||||||
[NSColor grayColor], NSForegroundColorAttributeName,
|
|
||||||
nil] retain];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -93,7 +54,7 @@
|
|||||||
|
|
||||||
[super windowDidLoad];
|
[super windowDidLoad];
|
||||||
|
|
||||||
[[self window] makeFirstResponder:movieName];
|
[self.window makeFirstResponder:movieName];
|
||||||
|
|
||||||
// metadata provider preferences
|
// metadata provider preferences
|
||||||
[movieMetadataProvider selectItemWithTitle:[[NSUserDefaults standardUserDefaults] valueForKey:@"SBMetadataPreference|Movie"]];
|
[movieMetadataProvider selectItemWithTitle:[[NSUserDefaults standardUserDefaults] valueForKey:@"SBMetadataPreference|Movie"]];
|
||||||
@@ -107,20 +68,20 @@
|
|||||||
|
|
||||||
if ([@"movie" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
if ([@"movie" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
||||||
[searchMode selectTabViewItemAtIndex:0];
|
[searchMode selectTabViewItemAtIndex:0];
|
||||||
if ([parsed valueForKey:@"title"]) [movieName setStringValue:[parsed valueForKey:@"title"]];
|
if ([parsed valueForKey:@"title"]) movieName.stringValue = [parsed valueForKey:@"title"];
|
||||||
} else if ([@"tv" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
} else if ([@"tv" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
||||||
[searchMode selectTabViewItemAtIndex:1];
|
[searchMode selectTabViewItemAtIndex:1];
|
||||||
[[self window] makeFirstResponder:tvSeriesName];
|
[self.window makeFirstResponder:tvSeriesName];
|
||||||
if ([parsed valueForKey:@"seriesName"]) [((NSTextField *) tvSeriesName) setStringValue:[parsed valueForKey:@"seriesName"]];
|
if ([parsed valueForKey:@"seriesName"]) ((NSTextField *) tvSeriesName).stringValue = [parsed valueForKey:@"seriesName"];
|
||||||
if ([parsed valueForKey:@"seasonNum"]) [tvSeasonNum setStringValue:[parsed valueForKey:@"seasonNum"]];
|
if ([parsed valueForKey:@"seasonNum"]) tvSeasonNum.stringValue = [parsed valueForKey:@"seasonNum"];
|
||||||
if ([parsed valueForKey:@"episodeNum"]) [tvEpisodeNum setStringValue:[parsed valueForKey:@"episodeNum"]];
|
if ([parsed valueForKey:@"episodeNum"]) tvEpisodeNum.stringValue = [parsed valueForKey:@"episodeNum"];
|
||||||
// just in case this is actually a movie, set the text in the movie field for the user's convenience
|
// just in case this is actually a movie, set the text in the movie field for the user's convenience
|
||||||
[movieName setStringValue:[_searchString stringByDeletingPathExtension]];
|
movieName.stringValue = _searchString.stringByDeletingPathExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self updateSearchButtonVisibility];
|
[self updateSearchButtonVisibility];
|
||||||
|
|
||||||
if ([searchButton isEnabled]) {
|
if (searchButton.enabled) {
|
||||||
[self searchForResults:nil];
|
[self searchForResults:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,36 +94,36 @@
|
|||||||
|
|
||||||
- (void) createLanguageMenus {
|
- (void) createLanguageMenus {
|
||||||
[movieLanguage removeAllItems];
|
[movieLanguage removeAllItems];
|
||||||
NSArray *langs = [SBMetadataImporter languagesForProvider:[[movieMetadataProvider selectedItem] title]];
|
NSArray *langs = [SBMetadataImporter languagesForProvider:movieMetadataProvider.selectedItem.title];
|
||||||
for (NSString *lang in langs) {
|
for (NSString *lang in langs) {
|
||||||
[movieLanguage addItemWithTitle:lang];
|
[movieLanguage addItemWithTitle:lang];
|
||||||
}
|
}
|
||||||
|
|
||||||
[tvLanguage removeAllItems];
|
[tvLanguage removeAllItems];
|
||||||
langs = [SBMetadataImporter languagesForProvider:[[tvMetadataProvider selectedItem] title]];
|
langs = [SBMetadataImporter languagesForProvider:tvMetadataProvider.selectedItem.title];
|
||||||
for (NSString *lang in langs) {
|
for (NSString *lang in langs) {
|
||||||
[tvLanguage addItemWithTitle:lang];
|
[tvLanguage addItemWithTitle:lang];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) metadataProvidersSelectDefaultLanguage {
|
- (void) metadataProvidersSelectDefaultLanguage {
|
||||||
[movieLanguage selectItemWithTitle:[[NSUserDefaults standardUserDefaults] valueForKey:[NSString stringWithFormat:@"SBMetadataPreference|Movie|%@|Language", [[movieMetadataProvider selectedItem] title]]]];
|
[movieLanguage selectItemWithTitle:[[NSUserDefaults standardUserDefaults] valueForKey:[NSString stringWithFormat:@"SBMetadataPreference|Movie|%@|Language", movieMetadataProvider.selectedItem.title]]];
|
||||||
[tvLanguage selectItemWithTitle:[[NSUserDefaults standardUserDefaults] valueForKey:[NSString stringWithFormat:@"SBMetadataPreference|TV|%@|Language", [[tvMetadataProvider selectedItem] title]]]];
|
[tvLanguage selectItemWithTitle:[[NSUserDefaults standardUserDefaults] valueForKey:[NSString stringWithFormat:@"SBMetadataPreference|TV|%@|Language", tvMetadataProvider.selectedItem.title]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) metadataProviderLanguageSelected:(id)sender {
|
- (IBAction) metadataProviderLanguageSelected:(id)sender {
|
||||||
if (sender == movieLanguage) {
|
if (sender == movieLanguage) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[[movieLanguage selectedItem] title] forKey:[NSString stringWithFormat:@"SBMetadataPreference|Movie|%@|Language", [[movieMetadataProvider selectedItem] title]]];
|
[[NSUserDefaults standardUserDefaults] setValue:movieLanguage.selectedItem.title forKey:[NSString stringWithFormat:@"SBMetadataPreference|Movie|%@|Language", movieMetadataProvider.selectedItem.title]];
|
||||||
} else if (sender == tvLanguage) {
|
} else if (sender == tvLanguage) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[[tvLanguage selectedItem] title] forKey:[NSString stringWithFormat:@"SBMetadataPreference|TV|%@|Language", [[tvMetadataProvider selectedItem] title]]];
|
[[NSUserDefaults standardUserDefaults] setValue:tvLanguage.selectedItem.title forKey:[NSString stringWithFormat:@"SBMetadataPreference|TV|%@|Language", tvMetadataProvider.selectedItem.title]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) metadataProviderSelected:(id)sender {
|
- (IBAction) metadataProviderSelected:(id)sender {
|
||||||
if (sender == movieMetadataProvider) {
|
if (sender == movieMetadataProvider) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[[movieMetadataProvider selectedItem] title] forKey:@"SBMetadataPreference|Movie"];
|
[[NSUserDefaults standardUserDefaults] setValue:movieMetadataProvider.selectedItem.title forKey:@"SBMetadataPreference|Movie"];
|
||||||
} else if (sender == tvMetadataProvider) {
|
} else if (sender == tvMetadataProvider) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[[tvMetadataProvider selectedItem] title] forKey:@"SBMetadataPreference|TV"];
|
[[NSUserDefaults standardUserDefaults] setValue:tvMetadataProvider.selectedItem.title forKey:@"SBMetadataPreference|TV"];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self createLanguageMenus];
|
[self createLanguageMenus];
|
||||||
@@ -173,14 +134,14 @@
|
|||||||
#pragma mark Search input fields
|
#pragma mark Search input fields
|
||||||
|
|
||||||
- (void)updateSearchButtonVisibility {
|
- (void)updateSearchButtonVisibility {
|
||||||
if ([[[searchMode selectedTabViewItem] label] isEqualToString:@"Movie"]) {
|
if ([searchMode.selectedTabViewItem.label isEqualToString:@"Movie"]) {
|
||||||
if ([[movieName stringValue] length] > 0) {
|
if (movieName.stringValue.length > 0) {
|
||||||
[searchButton setEnabled:YES];
|
[searchButton setEnabled:YES];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if ([[[searchMode selectedTabViewItem] label] isEqualToString:@"TV Episode"]) {
|
} else if ([searchMode.selectedTabViewItem.label isEqualToString:@"TV Episode"]) {
|
||||||
if ([[tvSeriesName stringValue] length] > 0) {
|
if (tvSeriesName.stringValue.length > 0) {
|
||||||
if (([[tvSeasonNum stringValue] length] == 0) && ([[tvEpisodeNum stringValue] length] > 0)) {
|
if ((tvSeasonNum.stringValue.length == 0) && (tvEpisodeNum.stringValue.length > 0)) {
|
||||||
[searchButton setEnabled:NO];
|
[searchButton setEnabled:NO];
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -194,8 +155,8 @@
|
|||||||
|
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNotification {
|
- (void)controlTextDidChange:(NSNotification *)aNotification {
|
||||||
[self updateSearchButtonVisibility];
|
[self updateSearchButtonVisibility];
|
||||||
[addButton setKeyEquivalent:@""];
|
addButton.keyEquivalent = @"";
|
||||||
[searchButton setKeyEquivalent:@"\r"];
|
searchButton.keyEquivalent = @"\r";
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
|
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem {
|
||||||
@@ -203,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)searchTVSeriesNameDone:(NSArray *)seriesArray {
|
- (void)searchTVSeriesNameDone:(NSArray *)seriesArray {
|
||||||
self.tvSeriesNameSearchArray = [[seriesArray mutableCopy] autorelease];
|
self.tvSeriesNameSearchArray = [seriesArray mutableCopy];
|
||||||
[self.tvSeriesNameSearchArray sortUsingSelector:@selector(compare:)];
|
[self.tvSeriesNameSearchArray sortUsingSelector:@selector(compare:)];
|
||||||
[tvSeriesName noteNumberOfItemsChanged];
|
[tvSeriesName noteNumberOfItemsChanged];
|
||||||
[tvSeriesName reloadData];
|
[tvSeriesName reloadData];
|
||||||
@@ -218,28 +179,28 @@
|
|||||||
[self.currentSearcher cancel];
|
[self.currentSearcher cancel];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[searchMode selectedTabViewItem] label] isEqualToString:@"Movie"] && [[movieName stringValue] length]) {
|
if ([searchMode.selectedTabViewItem.label isEqualToString:@"Movie"] && movieName.stringValue.length) {
|
||||||
|
|
||||||
[self startProgressReportWithString:[NSString stringWithFormat:@"Searching %@ for movie information…",
|
[self startProgressReportWithString:[NSString stringWithFormat:@"Searching %@ for movie information…",
|
||||||
[[movieMetadataProvider selectedItem] title]]];
|
movieMetadataProvider.selectedItem.title]];
|
||||||
|
|
||||||
self.currentSearcher = [SBMetadataImporter importerForProvider:[[movieMetadataProvider selectedItem] title]];
|
self.currentSearcher = [SBMetadataImporter importerForProvider:movieMetadataProvider.selectedItem.title];
|
||||||
[self.currentSearcher searchMovie:[movieName stringValue]
|
[self.currentSearcher searchMovie:movieName.stringValue
|
||||||
language:[movieLanguage titleOfSelectedItem]
|
language:movieLanguage.titleOfSelectedItem
|
||||||
completionHandler:^(NSArray *results) {
|
completionHandler:^(NSArray *results) {
|
||||||
[self searchForResultsDone:results];
|
[self searchForResultsDone:results];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
} else if ([[[searchMode selectedTabViewItem] label] isEqualToString:@"TV Episode"] && [[tvSeriesName stringValue] length]) {
|
} else if ([searchMode.selectedTabViewItem.label isEqualToString:@"TV Episode"] && tvSeriesName.stringValue.length) {
|
||||||
|
|
||||||
[self startProgressReportWithString:[NSString stringWithFormat:@"Searching %@ for episode information…",
|
[self startProgressReportWithString:[NSString stringWithFormat:@"Searching %@ for episode information…",
|
||||||
[[tvMetadataProvider selectedItem] title]]];
|
tvMetadataProvider.selectedItem.title]];
|
||||||
|
|
||||||
self.currentSearcher = [SBMetadataImporter importerForProvider:[[tvMetadataProvider selectedItem] title]];
|
self.currentSearcher = [SBMetadataImporter importerForProvider:tvMetadataProvider.selectedItem.title];
|
||||||
[self.currentSearcher searchTVSeries:[tvSeriesName stringValue]
|
[self.currentSearcher searchTVSeries:tvSeriesName.stringValue
|
||||||
language:[tvLanguage titleOfSelectedItem]
|
language:tvLanguage.titleOfSelectedItem
|
||||||
seasonNum:[tvSeasonNum stringValue]
|
seasonNum:tvSeasonNum.stringValue
|
||||||
episodeNum:[tvEpisodeNum stringValue]
|
episodeNum:tvEpisodeNum.stringValue
|
||||||
completionHandler:^(NSArray *results) {
|
completionHandler:^(NSArray *results) {
|
||||||
[self searchForResultsDone:results];
|
[self searchForResultsDone:results];
|
||||||
}];
|
}];
|
||||||
@@ -267,8 +228,9 @@
|
|||||||
|
|
||||||
[self tableViewSelectionDidChange:[NSNotification notificationWithName:@"tableViewSelectionDidChange" object:resultsTable]];
|
[self tableViewSelectionDidChange:[NSNotification notificationWithName:@"tableViewSelectionDidChange" object:resultsTable]];
|
||||||
|
|
||||||
if ([self.resultsArray count])
|
if (self.resultsArray.count) {
|
||||||
[[self window] makeFirstResponder:resultsTable];
|
[self.window makeFirstResponder:resultsTable];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark Load additional metadata
|
#pragma mark Load additional metadata
|
||||||
@@ -277,7 +239,7 @@
|
|||||||
{
|
{
|
||||||
[progress startAnimation:self];
|
[progress startAnimation:self];
|
||||||
[progress setHidden:NO];
|
[progress setHidden:NO];
|
||||||
[progressText setStringValue:progressString];
|
progressText.stringValue = progressString;
|
||||||
[progressText setHidden:NO];
|
[progressText setHidden:NO];
|
||||||
|
|
||||||
[resultsTable setEnabled:NO];
|
[resultsTable setEnabled:NO];
|
||||||
@@ -302,13 +264,13 @@
|
|||||||
[addButton setEnabled:NO];
|
[addButton setEnabled:NO];
|
||||||
if (self.selectedResult.mediaKind == 9) {
|
if (self.selectedResult.mediaKind == 9) {
|
||||||
[self startProgressReportWithString:NSLocalizedString(@"Downloading additional movie metadata…", nil)];
|
[self startProgressReportWithString:NSLocalizedString(@"Downloading additional movie metadata…", nil)];
|
||||||
self.currentSearcher = [SBMetadataImporter importerForProvider:[[movieMetadataProvider selectedItem] title]];
|
self.currentSearcher = [SBMetadataImporter importerForProvider:movieMetadataProvider.selectedItem.title];
|
||||||
} else if (self.selectedResult.mediaKind == 10) {
|
} else if (self.selectedResult.mediaKind == 10) {
|
||||||
[self startProgressReportWithString:NSLocalizedString(@"Downloading additional TV metadata…", nil)];
|
[self startProgressReportWithString:NSLocalizedString(@"Downloading additional TV metadata…", nil)];
|
||||||
self.currentSearcher = [SBMetadataImporter importerForProvider:[[tvMetadataProvider selectedItem] title]];
|
self.currentSearcher = [SBMetadataImporter importerForProvider:tvMetadataProvider.selectedItem.title];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.currentSearcher loadFullMetadata:self.selectedResult language:[[movieLanguage selectedItem] title] completionHandler:^(SBMetadataResult *metadata) {
|
[self.currentSearcher loadFullMetadata:self.selectedResult language:movieLanguage.selectedItem.title completionHandler:^(SBMetadataResult *metadata) {
|
||||||
[self stopProgressReport];
|
[self stopProgressReport];
|
||||||
|
|
||||||
self.selectedResult = metadata;
|
self.selectedResult = metadata;
|
||||||
@@ -320,14 +282,14 @@
|
|||||||
#pragma mark Select artwork
|
#pragma mark Select artwork
|
||||||
|
|
||||||
- (void) selectArtwork {
|
- (void) selectArtwork {
|
||||||
if (self.selectedResult.artworkThumbURLs && [self.selectedResult.artworkThumbURLs count]) {
|
if (self.selectedResult.artworkThumbURLs && (self.selectedResult.artworkThumbURLs).count) {
|
||||||
if ([self.selectedResult.artworkThumbURLs count] == 1) {
|
if ((self.selectedResult.artworkThumbURLs).count == 1) {
|
||||||
[self loadArtworks:[NSIndexSet indexSetWithIndex:0]];
|
[self loadArtworks:[NSIndexSet indexSetWithIndex:0]];
|
||||||
} else {
|
} else {
|
||||||
artworkSelectorWindow = [[SBArtworkSelector alloc] initWithDelegate:self
|
artworkSelectorWindow = [[SBArtworkSelector alloc] initWithDelegate:self
|
||||||
imageURLs:self.selectedResult.artworkThumbURLs
|
imageURLs:self.selectedResult.artworkThumbURLs
|
||||||
artworkProviderNames:self.selectedResult.artworkProviderNames];
|
artworkProviderNames:self.selectedResult.artworkProviderNames];
|
||||||
[NSApp beginSheet:[artworkSelectorWindow window] modalForWindow:[self window] modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
[NSApp beginSheet:[artworkSelectorWindow window] modalForWindow:self.window modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[self addMetadata];
|
[self addMetadata];
|
||||||
@@ -337,7 +299,7 @@
|
|||||||
- (void) selectArtworkDone:(NSIndexSet *)indexes {
|
- (void) selectArtworkDone:(NSIndexSet *)indexes {
|
||||||
[NSApp endSheet:[artworkSelectorWindow window]];
|
[NSApp endSheet:[artworkSelectorWindow window]];
|
||||||
[[artworkSelectorWindow window] orderOut:self];
|
[[artworkSelectorWindow window] orderOut:self];
|
||||||
[artworkSelectorWindow autorelease]; artworkSelectorWindow = nil;
|
artworkSelectorWindow = nil;
|
||||||
|
|
||||||
[self loadArtworks:indexes];
|
[self loadArtworks:indexes];
|
||||||
}
|
}
|
||||||
@@ -371,7 +333,7 @@
|
|||||||
NSString *provider = providerNames[idx];
|
NSString *provider = providerNames[idx];
|
||||||
if ([provider isEqualToString:@"iTunes"]) {
|
if ([provider isEqualToString:@"iTunes"]) {
|
||||||
NSURL *url = URLs[idx];
|
NSURL *url = URLs[idx];
|
||||||
url = [[url URLByDeletingPathExtension] URLByAppendingPathExtension:@"600x600bb.jpg"];
|
url = [url.URLByDeletingPathExtension URLByAppendingPathExtension:@"600x600bb.jpg"];
|
||||||
artworkData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
artworkData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,7 +342,6 @@
|
|||||||
if (artworkData && artworkData.length) {
|
if (artworkData && artworkData.length) {
|
||||||
MP42Image *artwork = [[MP42Image alloc] initWithData:artworkData type:MP42_ART_JPEG];
|
MP42Image *artwork = [[MP42Image alloc] initWithData:artworkData type:MP42_ART_JPEG];
|
||||||
[self.selectedResult.artworks addObject:artwork];
|
[self.selectedResult.artworks addObject:artwork];
|
||||||
[artwork release];
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -389,8 +350,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
[URLs release];
|
|
||||||
[providerNames release];
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
[self addMetadata];
|
[self addMetadata];
|
||||||
@@ -404,7 +363,7 @@
|
|||||||
if (self.selectedResult.mediaKind == 10) {
|
if (self.selectedResult.mediaKind == 10) {
|
||||||
NSArray *previousTVseries = [[NSUserDefaults standardUserDefaults] arrayForKey:@"Previously used TV series"];
|
NSArray *previousTVseries = [[NSUserDefaults standardUserDefaults] arrayForKey:@"Previously used TV series"];
|
||||||
NSMutableArray *newTVseries;
|
NSMutableArray *newTVseries;
|
||||||
NSString *formattedTVshowName = [self.selectedResultTags objectForKey:@"TV Show"];
|
NSString *formattedTVshowName = (self.selectedResultTags)[@"TV Show"];
|
||||||
|
|
||||||
if (previousTVseries == nil) {
|
if (previousTVseries == nil) {
|
||||||
newTVseries = [NSMutableArray array];
|
newTVseries = [NSMutableArray array];
|
||||||
@@ -423,7 +382,7 @@
|
|||||||
[resultsTable setDelegate:nil];
|
[resultsTable setDelegate:nil];
|
||||||
[resultsTable setDataSource:nil];
|
[resultsTable setDataSource:nil];
|
||||||
|
|
||||||
[NSApp endSheet:[self window] returnCode:1];
|
[NSApp endSheet:self.window returnCode:1];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) closeWindow: (id) sender
|
- (IBAction) closeWindow: (id) sender
|
||||||
@@ -436,25 +395,12 @@
|
|||||||
[resultsTable setDelegate:nil];
|
[resultsTable setDelegate:nil];
|
||||||
[resultsTable setDataSource:nil];
|
[resultsTable setDataSource:nil];
|
||||||
|
|
||||||
[NSApp endSheet:[self window] returnCode:0];
|
[NSApp endSheet:self.window returnCode:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[self.currentSearcher cancel];
|
[self.currentSearcher cancel];
|
||||||
self.currentSearcher = nil;
|
|
||||||
|
|
||||||
self.resultsArray = nil;
|
|
||||||
self.selectedResult = nil;
|
|
||||||
|
|
||||||
self.selectedResultTags = nil;
|
|
||||||
self.selectedResultTagsArray = nil;
|
|
||||||
|
|
||||||
self.tvSeriesNameSearchArray = nil;
|
|
||||||
|
|
||||||
[detailBoldAttr release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@@ -470,8 +416,8 @@
|
|||||||
NSArray<NSString *> *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
NSArray<NSString *> *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||||
|
|
||||||
if (paths.count) {
|
if (paths.count) {
|
||||||
NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
|
NSString *bundleName = [NSBundle mainBundle].infoDictionary[@"CFBundleIdentifier"];
|
||||||
path = [[paths firstObject] stringByAppendingPathComponent:bundleName];
|
path = [paths.firstObject stringByAppendingPathComponent:bundleName];
|
||||||
|
|
||||||
NSArray<NSString *> *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
|
NSArray<NSString *> *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
|
||||||
for (NSString *filename in contents) {
|
for (NSString *filename in contents) {
|
||||||
@@ -483,7 +429,7 @@
|
|||||||
#pragma mark Miscellaneous
|
#pragma mark Miscellaneous
|
||||||
|
|
||||||
- (NSAttributedString *) boldString: (NSString *) string {
|
- (NSAttributedString *) boldString: (NSString *) string {
|
||||||
return [[[NSAttributedString alloc] initWithString:string attributes:detailBoldAttr] autorelease];
|
return [[NSAttributedString alloc] initWithString:string attributes:detailBoldAttr];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
@@ -511,12 +457,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)comboBoxWillPopUp:(NSNotification *)notification {
|
- (void)comboBoxWillPopUp:(NSNotification *)notification {
|
||||||
if ([notification object] == tvSeriesName) {
|
if (notification.object == tvSeriesName) {
|
||||||
if ([[tvSeriesName stringValue] length] == 0) {
|
if (tvSeriesName.stringValue.length == 0) {
|
||||||
self.tvSeriesNameSearchArray = [[[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"Previously used TV series"]] autorelease];
|
self.tvSeriesNameSearchArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"Previously used TV series"]];
|
||||||
[self.tvSeriesNameSearchArray sortUsingSelector:@selector(compare:)];
|
[self.tvSeriesNameSearchArray sortUsingSelector:@selector(compare:)];
|
||||||
[tvSeriesName reloadData];
|
[tvSeriesName reloadData];
|
||||||
} else if ([[tvSeriesName stringValue] length] > 3) {
|
} else if (tvSeriesName.stringValue.length > 3) {
|
||||||
self.tvSeriesNameSearchArray = [NSMutableArray array];
|
self.tvSeriesNameSearchArray = [NSMutableArray array];
|
||||||
[self.tvSeriesNameSearchArray addObject:@"searching…"];
|
[self.tvSeriesNameSearchArray addObject:@"searching…"];
|
||||||
|
|
||||||
@@ -524,11 +470,11 @@
|
|||||||
[self.currentSearcher cancel];
|
[self.currentSearcher cancel];
|
||||||
|
|
||||||
self.currentSearcher = [SBMetadataImporter defaultTVProvider];
|
self.currentSearcher = [SBMetadataImporter defaultTVProvider];
|
||||||
[self.currentSearcher searchTVSeries:[tvSeriesName stringValue] language:[[tvLanguage selectedItem] title] completionHandler:^(NSArray *results) {
|
[self.currentSearcher searchTVSeries:tvSeriesName.stringValue language:tvLanguage.selectedItem.title completionHandler:^(NSArray *results) {
|
||||||
self.tvSeriesNameSearchArray = [[results mutableCopy] autorelease];
|
self.tvSeriesNameSearchArray = [results mutableCopy];
|
||||||
[self.tvSeriesNameSearchArray sortUsingSelector:@selector(compare:)];
|
[self.tvSeriesNameSearchArray sortUsingSelector:@selector(compare:)];
|
||||||
[tvSeriesName noteNumberOfItemsChanged];
|
[self->tvSeriesName noteNumberOfItemsChanged];
|
||||||
[tvSeriesName reloadData];
|
[self->tvSeriesName reloadData];
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
self.tvSeriesNameSearchArray = nil;
|
self.tvSeriesNameSearchArray = nil;
|
||||||
@@ -538,7 +484,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
|
- (void)comboBoxSelectionDidChange:(NSNotification *)notification {
|
||||||
if ([notification object] == tvSeriesName) {
|
if (notification.object == tvSeriesName) {
|
||||||
tvSeriesName.stringValue = [self selectedTvShowName];
|
tvSeriesName.stringValue = [self selectedTvShowName];
|
||||||
[self updateSearchButtonVisibility];
|
[self updateSearchButtonVisibility];
|
||||||
}
|
}
|
||||||
@@ -564,7 +510,7 @@
|
|||||||
|
|
||||||
- (id)comboBox:(NSComboBox *)comboBox objectValueForItemAtIndex:(NSInteger)index {
|
- (id)comboBox:(NSComboBox *)comboBox objectValueForItemAtIndex:(NSInteger)index {
|
||||||
if (comboBox == tvSeriesName) {
|
if (comboBox == tvSeriesName) {
|
||||||
return [self.tvSeriesNameSearchArray objectAtIndex:index];
|
return (self.tvSeriesNameSearchArray)[index];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -585,8 +531,8 @@
|
|||||||
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex {
|
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex {
|
||||||
if (tableView == resultsTable) {
|
if (tableView == resultsTable) {
|
||||||
if (self.resultsArray != nil) {
|
if (self.resultsArray != nil) {
|
||||||
SBMetadataResult *result = [self.resultsArray objectAtIndex:rowIndex];
|
SBMetadataResult *result = (self.resultsArray)[rowIndex];
|
||||||
if ((result.mediaKind == 10) && ([self.resultsArray count] > 1)) { // TV show
|
if ((result.mediaKind == 10) && ((self.resultsArray).count > 1)) { // TV show
|
||||||
return [NSString stringWithFormat:@"%@x%@ - %@", result[@"TV Season"], result[@"TV Episode #"], result[@"Name"]];
|
return [NSString stringWithFormat:@"%@x%@ - %@", result[@"TV Season"], result[@"TV Episode #"], result[@"Name"]];
|
||||||
} else {
|
} else {
|
||||||
return result[@"Name"];
|
return result[@"Name"];
|
||||||
@@ -595,10 +541,10 @@
|
|||||||
} else if (tableView == (NSTableView *) metadataTable) {
|
} else if (tableView == (NSTableView *) metadataTable) {
|
||||||
if (self.selectedResult != nil) {
|
if (self.selectedResult != nil) {
|
||||||
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
||||||
return [self boldString:[self.selectedResultTagsArray objectAtIndex:rowIndex]];
|
return [self boldString:(self.selectedResultTagsArray)[rowIndex]];
|
||||||
}
|
}
|
||||||
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
||||||
return [self.selectedResultTags objectForKey:[self.selectedResultTagsArray objectAtIndex:rowIndex]];
|
return (self.selectedResultTags)[(self.selectedResultTagsArray)[rowIndex]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -608,8 +554,8 @@
|
|||||||
static NSInteger sortFunction (id ldict, id rdict, void *context) {
|
static NSInteger sortFunction (id ldict, id rdict, void *context) {
|
||||||
NSComparisonResult rc;
|
NSComparisonResult rc;
|
||||||
|
|
||||||
NSInteger right = [(NSArray*) context indexOfObject:rdict];
|
NSInteger right = [(__bridge NSArray*) context indexOfObject:rdict];
|
||||||
NSInteger left = [(NSArray*) context indexOfObject:ldict];
|
NSInteger left = [(__bridge NSArray*) context indexOfObject:ldict];
|
||||||
|
|
||||||
if (right < left) {
|
if (right < left) {
|
||||||
rc = NSOrderedDescending;
|
rc = NSOrderedDescending;
|
||||||
@@ -622,42 +568,42 @@ static NSInteger sortFunction (id ldict, id rdict, void *context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification {
|
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification {
|
||||||
if ([aNotification object] == resultsTable || [aNotification object] == metadataTable) {
|
if (aNotification.object == resultsTable || aNotification.object == metadataTable) {
|
||||||
if (self.resultsArray && [self.resultsArray count] > 0 && [resultsTable selectedRow] > -1) {
|
if (self.resultsArray && (self.resultsArray).count > 0 && resultsTable.selectedRow > -1) {
|
||||||
self.selectedResult = [self.resultsArray objectAtIndex:[resultsTable selectedRow]];
|
self.selectedResult = (self.resultsArray)[resultsTable.selectedRow];
|
||||||
self.selectedResultTags = self.selectedResult.tags;
|
self.selectedResultTags = self.selectedResult.tags;
|
||||||
self.selectedResultTagsArray = [[self.selectedResultTags allKeys] sortedArrayUsingFunction:sortFunction context:[MP42Metadata availableMetadata]];
|
self.selectedResultTagsArray = [(self.selectedResultTags).allKeys sortedArrayUsingFunction:sortFunction context:(__bridge void * _Nullable)([MP42Metadata availableMetadata])];
|
||||||
[metadataTable reloadData];
|
[metadataTable reloadData];
|
||||||
[addButton setEnabled:YES];
|
[addButton setEnabled:YES];
|
||||||
[addButton setKeyEquivalent:@"\r"];
|
addButton.keyEquivalent = @"\r";
|
||||||
[searchButton setKeyEquivalent:@""];
|
searchButton.keyEquivalent = @"";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[addButton setEnabled:NO];
|
[addButton setEnabled:NO];
|
||||||
[addButton setKeyEquivalent:@""];
|
addButton.keyEquivalent = @"";
|
||||||
[searchButton setKeyEquivalent:@"\r"];
|
searchButton.keyEquivalent = @"\r";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
|
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
|
||||||
if (tableView != (NSTableView *) metadataTable) return [tableView rowHeight];
|
if (tableView != (NSTableView *) metadataTable) return tableView.rowHeight;
|
||||||
|
|
||||||
// It is important to use a constant value when calculating the height. Querying the tableColumn width will not work, since it dynamically changes as the user resizes -- however, we don't get a notification that the user "did resize" it until after the mouse is let go. We use the latter as a hook for telling the table that the heights changed. We must return the same height from this method every time, until we tell the table the heights have changed. Not doing so will quicly cause drawing problems.
|
// It is important to use a constant value when calculating the height. Querying the tableColumn width will not work, since it dynamically changes as the user resizes -- however, we don't get a notification that the user "did resize" it until after the mouse is let go. We use the latter as a hook for telling the table that the heights changed. We must return the same height from this method every time, until we tell the table the heights have changed. Not doing so will quicly cause drawing problems.
|
||||||
NSTableColumn *tableColumnToWrap = (NSTableColumn *) [[tableView tableColumns] objectAtIndex:1];
|
NSTableColumn *tableColumnToWrap = (NSTableColumn *) tableView.tableColumns[1];
|
||||||
NSInteger columnToWrap = [tableView.tableColumns indexOfObject:tableColumnToWrap];
|
NSInteger columnToWrap = [tableView.tableColumns indexOfObject:tableColumnToWrap];
|
||||||
|
|
||||||
// Grab the fully prepared cell with our content filled in. Note that in IB the cell's Layout is set to Wraps.
|
// Grab the fully prepared cell with our content filled in. Note that in IB the cell's Layout is set to Wraps.
|
||||||
NSCell *cell = [tableView preparedCellAtColumn:columnToWrap row:row];
|
NSCell *cell = [tableView preparedCellAtColumn:columnToWrap row:row];
|
||||||
|
|
||||||
// See how tall it naturally would want to be if given a restricted with, but unbound height
|
// See how tall it naturally would want to be if given a restricted with, but unbound height
|
||||||
NSRect constrainedBounds = NSMakeRect(0, 0, [tableColumnToWrap width], CGFLOAT_MAX);
|
NSRect constrainedBounds = NSMakeRect(0, 0, tableColumnToWrap.width, CGFLOAT_MAX);
|
||||||
NSSize naturalSize = [cell cellSizeForBounds:constrainedBounds];
|
NSSize naturalSize = [cell cellSizeForBounds:constrainedBounds];
|
||||||
|
|
||||||
// Make sure we have a minimum height -- use the table's set height as the minimum.
|
// Make sure we have a minimum height -- use the table's set height as the minimum.
|
||||||
if (naturalSize.height > [tableView rowHeight]) {
|
if (naturalSize.height > tableView.rowHeight) {
|
||||||
return naturalSize.height;
|
return naturalSize.height;
|
||||||
} else {
|
} else {
|
||||||
return [tableView rowHeight];
|
return tableView.rowHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,38 +19,29 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
@interface SBOptionsViewController ()
|
@interface SBOptionsViewController ()
|
||||||
|
|
||||||
@property (nonatomic) NSMutableDictionary *options;
|
@property (nonatomic) NSMutableDictionary *options;
|
||||||
@property (nonatomic, retain) NSMutableArray *sets;
|
@property (nonatomic, strong) NSMutableArray *sets;
|
||||||
|
|
||||||
@property (nonatomic, retain) NSArray *moviesProviders;
|
@property (nonatomic, strong) NSArray *moviesProviders;
|
||||||
@property (nonatomic, retain) NSArray *tvShowsProviders;
|
@property (nonatomic, strong) NSArray *tvShowsProviders;
|
||||||
@property (nonatomic, retain) NSArray *movieLanguages;
|
@property (nonatomic, strong) NSArray *movieLanguages;
|
||||||
@property (nonatomic, retain) NSArray *tvShowLanguages;
|
@property (nonatomic, strong) NSArray *tvShowLanguages;
|
||||||
|
|
||||||
- (IBAction)chooseDestination:(id)sender;
|
- (IBAction)chooseDestination:(id)sender;
|
||||||
- (IBAction)destination:(id)sender;
|
- (IBAction)destination:(id)sender;
|
||||||
|
|
||||||
@property (nonatomic, retain) NSURL *destination;
|
@property (nonatomic, strong) NSURL *destination;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBOptionsViewController
|
@implementation SBOptionsViewController
|
||||||
|
|
||||||
@synthesize options = _options;
|
|
||||||
@synthesize sets = _sets;
|
|
||||||
@synthesize moviesProviders = _moviesProviders;
|
|
||||||
@synthesize tvShowsProviders = _tvShowsProviders;
|
|
||||||
@synthesize movieLanguages = _movieLanguages;
|
|
||||||
@synthesize tvShowLanguages = _tvShowLanguages;
|
|
||||||
|
|
||||||
@synthesize destination = _destination;
|
|
||||||
|
|
||||||
- (instancetype)initWithOptions:(NSMutableDictionary *)options {
|
- (instancetype)initWithOptions:(NSMutableDictionary *)options {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_options = [options retain];
|
_options = options;
|
||||||
_sets = [[NSMutableArray alloc] init];
|
_sets = [[NSMutableArray alloc] init];
|
||||||
_moviesProviders = [[SBMetadataImporter movieProviders] retain];
|
_moviesProviders = [SBMetadataImporter movieProviders];
|
||||||
_tvShowsProviders = [[SBMetadataImporter tvProviders] retain];
|
_tvShowsProviders = [SBMetadataImporter tvProviders];
|
||||||
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -78,7 +69,6 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
attributes:@{NSForegroundColorAttributeName:[NSColor labelColor],
|
attributes:@{NSForegroundColorAttributeName:[NSColor labelColor],
|
||||||
NSFontAttributeName:[NSFont labelFontOfSize:11]}];
|
NSFontAttributeName:[NSFont labelFontOfSize:11]}];
|
||||||
subview.attributedTitle = string;
|
subview.attributedTitle = string;
|
||||||
[string release];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +90,7 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem {
|
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem {
|
||||||
SEL action = [anItem action];
|
SEL action = anItem.action;
|
||||||
|
|
||||||
if (action == @selector(chooseDestination:))
|
if (action == @selector(chooseDestination:))
|
||||||
return YES;
|
return YES;
|
||||||
@@ -163,8 +153,8 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
if (self.destination) {
|
if (self.destination) {
|
||||||
folderItem = [self prepareDestPopupItem:self.destination];
|
folderItem = [self prepareDestPopupItem:self.destination];
|
||||||
|
|
||||||
[[_destButton menu] insertItem:[NSMenuItem separatorItem] atIndex:0];
|
[_destButton.menu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
||||||
[[_destButton menu] insertItem:folderItem atIndex:0];
|
[_destButton.menu insertItem:folderItem atIndex:0];
|
||||||
|
|
||||||
if ([self.options valueForKey:@"SBQueueDestination"]) {
|
if ([self.options valueForKey:@"SBQueueDestination"]) {
|
||||||
[_destButton selectItem:folderItem];
|
[_destButton selectItem:folderItem];
|
||||||
@@ -182,21 +172,21 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
panel.canChooseDirectories = YES;
|
panel.canChooseDirectories = YES;
|
||||||
panel.canCreateDirectories = YES;
|
panel.canCreateDirectories = YES;
|
||||||
|
|
||||||
[panel setPrompt:NSLocalizedString(@"Select", @"Select queue destination.")];
|
panel.prompt = NSLocalizedString(@"Select", @"Select queue destination.");
|
||||||
[panel beginWithCompletionHandler:^(NSInteger result) {
|
[panel beginWithCompletionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
NSMenuItem *folderItem = [self prepareDestPopupItem:[panel URL]];
|
NSMenuItem *folderItem = [self prepareDestPopupItem:panel.URL];
|
||||||
|
|
||||||
[[_destButton menu] removeItemAtIndex:0];
|
[self->_destButton.menu removeItemAtIndex:0];
|
||||||
[[_destButton menu] insertItem:folderItem atIndex:0];
|
[self->_destButton.menu insertItem:folderItem atIndex:0];
|
||||||
|
|
||||||
[_destButton selectItem:folderItem];
|
[self->_destButton selectItem:folderItem];
|
||||||
|
|
||||||
[self.options setValue:[panel URL] forKey:@"SBQueueDestination"];
|
[self.options setValue:panel.URL forKey:@"SBQueueDestination"];
|
||||||
self.destination = panel.URL;
|
self.destination = panel.URL;
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"SBQueueDestinationSelected"];
|
[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"SBQueueDestinationSelected"];
|
||||||
} else {
|
} else {
|
||||||
[_destButton selectItemAtIndex:2];
|
[self->_destButton selectItemAtIndex:2];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@@ -204,19 +194,19 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
- (NSMenuItem *)prepareDestPopupItem:(nonnull NSURL *)dest {
|
- (NSMenuItem *)prepareDestPopupItem:(nonnull NSURL *)dest {
|
||||||
NSMenuItem *folderItem = [[NSMenuItem alloc] initWithTitle:dest.lastPathComponent action:@selector(destination:) keyEquivalent:@""];
|
NSMenuItem *folderItem = [[NSMenuItem alloc] initWithTitle:dest.lastPathComponent action:@selector(destination:) keyEquivalent:@""];
|
||||||
|
|
||||||
NSImage *menuItemIcon = [[NSWorkspace sharedWorkspace] iconForFile:[dest path]];
|
NSImage *menuItemIcon = [[NSWorkspace sharedWorkspace] iconForFile:dest.path];
|
||||||
[menuItemIcon setSize:NSMakeSize(16, 16)];
|
menuItemIcon.size = NSMakeSize(16, 16);
|
||||||
|
|
||||||
[folderItem setImage:menuItemIcon];
|
folderItem.image = menuItemIcon;
|
||||||
|
|
||||||
return [folderItem autorelease];
|
return folderItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)destination:(id)sender {
|
- (IBAction)destination:(id)sender {
|
||||||
if ([sender tag] == 10) {
|
if ([sender tag] == 10) {
|
||||||
[self.options removeObjectForKey:@"SBQueueDestination"];
|
[self.options removeObjectForKey:@"SBQueueDestination"];
|
||||||
} else {
|
} else {
|
||||||
[self.options setObject:self.destination forKey:@"SBQueueDestination"];
|
(self.options)[@"SBQueueDestination"] = self.destination;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,30 +220,22 @@ static void *SBOptionsViewContex = &SBOptionsViewContex;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateSetsMenu:(id)sender {
|
- (void)updateSetsMenu:(id)sender {
|
||||||
self.sets = [[[SBPresetManager sharedManager].presets mutableCopy] autorelease];
|
self.sets = [[SBPresetManager sharedManager].presets mutableCopy];
|
||||||
if (![self.sets containsObject:[self.options objectForKey:@"SBQueueSet"]]) {
|
if (![self.sets containsObject:(self.options)[@"SBQueueSet"]]) {
|
||||||
[self.options removeObjectForKey:@"SBQueueSet"];
|
[self.options removeObjectForKey:@"SBQueueSet"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[_options release];
|
|
||||||
[_sets release];
|
|
||||||
[_destination release];
|
|
||||||
|
|
||||||
[_moviesProviders release];
|
|
||||||
[_tvShowsProviders release];
|
|
||||||
|
|
||||||
[_movieLanguages release];
|
|
||||||
[_tvShowLanguages release];
|
|
||||||
|
|
||||||
@try {
|
@try {
|
||||||
[self removeObserver:self forKeyPath:@"options.SBQueueMovieProvider"];
|
[self removeObserver:self forKeyPath:@"options.SBQueueMovieProvider"];
|
||||||
[self removeObserver:self forKeyPath:@"options.SBQueueTVShowProvider"];
|
[self removeObserver:self forKeyPath:@"options.SBQueueTVShowProvider"];
|
||||||
} @catch (NSException * __unused exception) {}
|
} @catch (NSException * __unused exception) {}
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
+ (void)registerUserDefaults;
|
+ (void)registerUserDefaults;
|
||||||
|
|
||||||
- (instancetype)init;
|
|
||||||
- (IBAction)clearRecentSearches:(id) sender;
|
- (IBAction)clearRecentSearches:(id) sender;
|
||||||
- (IBAction)deleteCachedMetadata:(id) sender;
|
- (IBAction)deleteCachedMetadata:(id) sender;
|
||||||
- (IBAction)toggleInfoWindow:(id) sender;
|
- (IBAction)toggleInfoWindow:(id) sender;
|
||||||
|
|||||||
+28
-30
@@ -19,7 +19,7 @@
|
|||||||
#define TOOLBAR_SETS @"TOOLBAR_SETS"
|
#define TOOLBAR_SETS @"TOOLBAR_SETS"
|
||||||
|
|
||||||
@interface SBPrefsController ()
|
@interface SBPrefsController ()
|
||||||
- (NSArray *)ratingsCountries;
|
@property (nonatomic, readonly, copy) NSArray *ratingsCountries;
|
||||||
|
|
||||||
- (void)setPrefView:(id)sender;
|
- (void)setPrefView:(id)sender;
|
||||||
- (NSToolbarItem *)toolbarItemWithIdentifier:(NSString *)identifier
|
- (NSToolbarItem *)toolbarItemWithIdentifier:(NSString *)identifier
|
||||||
@@ -67,12 +67,12 @@
|
|||||||
|
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"] autorelease];
|
NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"];
|
||||||
[toolbar setDelegate:self];
|
toolbar.delegate = self;
|
||||||
[toolbar setAllowsUserCustomization:NO];
|
[toolbar setAllowsUserCustomization:NO];
|
||||||
[toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
|
toolbar.displayMode = NSToolbarDisplayModeIconAndLabel;
|
||||||
[toolbar setSizeMode:NSToolbarSizeModeRegular];
|
toolbar.sizeMode = NSToolbarSizeModeRegular;
|
||||||
[[self window] setToolbar:toolbar];
|
self.window.toolbar = toolbar;
|
||||||
|
|
||||||
[toolbar setSelectedItemIdentifier:TOOLBAR_GENERAL];
|
[toolbar setSelectedItemIdentifier:TOOLBAR_GENERAL];
|
||||||
[self setPrefView:nil];
|
[self setPrefView:nil];
|
||||||
@@ -126,14 +126,14 @@
|
|||||||
|
|
||||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView {
|
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView {
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
return [[presetManager presets] count];
|
return presetManager.presets.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn
|
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn
|
||||||
row:(NSInteger)rowIndex {
|
row:(NSInteger)rowIndex {
|
||||||
if ([aTableColumn.identifier isEqualToString:@"name"]) {
|
if ([aTableColumn.identifier isEqualToString:@"name"]) {
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
return [[[presetManager presets] objectAtIndex:rowIndex] presetName];
|
return presetManager.presets[rowIndex].presetName;
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
{
|
{
|
||||||
[self closePopOver:self];
|
[self closePopOver:self];
|
||||||
|
|
||||||
NSInteger rowIndex = [tableView selectedRow];
|
NSInteger rowIndex = tableView.selectedRow;
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
[presetManager removePresetAtIndex:rowIndex];
|
[presetManager removePresetAtIndex:rowIndex];
|
||||||
[tableView reloadData];
|
[tableView reloadData];
|
||||||
@@ -153,24 +153,22 @@
|
|||||||
if (_popover) {
|
if (_popover) {
|
||||||
[_popover close];
|
[_popover close];
|
||||||
|
|
||||||
[_popover release];
|
|
||||||
_popover = nil;
|
_popover = nil;
|
||||||
[_controller release];
|
|
||||||
_controller = nil;
|
_controller = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)toggleInfoWindow:(id)sender
|
- (IBAction)toggleInfoWindow:(id)sender
|
||||||
{
|
{
|
||||||
if (_currentRow == [tableView clickedRow] && _popover) {
|
if (_currentRow == tableView.clickedRow && _popover) {
|
||||||
[self closePopOver:sender];
|
[self closePopOver:sender];
|
||||||
} else {
|
} else {
|
||||||
_currentRow = [tableView clickedRow];
|
_currentRow = tableView.clickedRow;
|
||||||
[self closePopOver:sender];
|
[self closePopOver:sender];
|
||||||
|
|
||||||
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
SBPresetManager *presetManager = [SBPresetManager sharedManager];
|
||||||
_controller = [[SBMovieViewController alloc] initWithNibName:@"MovieView" bundle:nil];
|
_controller = [[SBMovieViewController alloc] initWithNibName:@"MovieView" bundle:nil];
|
||||||
[_controller setMetadata:[[presetManager presets] objectAtIndex:_currentRow]];
|
[_controller setMetadata:presetManager.presets[_currentRow]];
|
||||||
|
|
||||||
_popover = [[NSPopover alloc] init];
|
_popover = [[NSPopover alloc] init];
|
||||||
_popover.contentViewController = _controller;
|
_popover.contentViewController = _controller;
|
||||||
@@ -187,7 +185,7 @@
|
|||||||
|
|
||||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if ([tableView selectedRow] != -1)
|
if (tableView.selectedRow != -1)
|
||||||
[removeSet setEnabled:YES];
|
[removeSet setEnabled:YES];
|
||||||
else
|
else
|
||||||
[removeSet setEnabled:NO];
|
[removeSet setEnabled:NO];
|
||||||
@@ -212,29 +210,29 @@
|
|||||||
view = setsView;
|
view = setsView;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSWindow *window = [self window];
|
NSWindow *window = self.window;
|
||||||
if ([window contentView] == view)
|
if (window.contentView == view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSRect windowRect = [window frame];
|
NSRect windowRect = window.frame;
|
||||||
CGFloat difference = ([view frame].size.height - [[window contentView] frame].size.height);
|
CGFloat difference = (view.frame.size.height - window.contentView.frame.size.height);
|
||||||
windowRect.origin.y -= difference;
|
windowRect.origin.y -= difference;
|
||||||
windowRect.size.height += difference;
|
windowRect.size.height += difference;
|
||||||
|
|
||||||
[view setHidden:YES];
|
[view setHidden:YES];
|
||||||
[window setContentView:view];
|
window.contentView = view;
|
||||||
[window setFrame:windowRect display:YES animate:YES];
|
[window setFrame:windowRect display:YES animate:YES];
|
||||||
[view setHidden:NO];
|
[view setHidden:NO];
|
||||||
|
|
||||||
//set title label
|
//set title label
|
||||||
if (sender)
|
if (sender)
|
||||||
[window setTitle:[sender label]];
|
window.title = [sender label];
|
||||||
else {
|
else {
|
||||||
NSToolbar *toolbar = [window toolbar];
|
NSToolbar *toolbar = window.toolbar;
|
||||||
NSString *itemIdentifier = [toolbar selectedItemIdentifier];
|
NSString *itemIdentifier = toolbar.selectedItemIdentifier;
|
||||||
for (NSToolbarItem *item in [toolbar items])
|
for (NSToolbarItem *item in toolbar.items)
|
||||||
if ([[item itemIdentifier] isEqualToString:itemIdentifier]) {
|
if ([item.itemIdentifier isEqualToString:itemIdentifier]) {
|
||||||
[window setTitle: [item label]];
|
window.title = item.label;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,11 +243,11 @@
|
|||||||
image:(NSImage *)image
|
image:(NSImage *)image
|
||||||
{
|
{
|
||||||
NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:identifier];
|
NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:identifier];
|
||||||
[item setLabel:label];
|
item.label = label;
|
||||||
[item setImage:image];
|
item.image = image;
|
||||||
[item setAction:@selector(setPrefView:)];
|
item.action = @selector(setPrefView:);
|
||||||
[item setAutovalidates:NO];
|
[item setAutovalidates:NO];
|
||||||
return [item autorelease];
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -14,10 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
extern NSString *SBPresetManagerUpdatedNotification;
|
extern NSString *SBPresetManagerUpdatedNotification;
|
||||||
|
|
||||||
@interface SBPresetManager : NSObject {
|
@interface SBPresetManager : NSObject
|
||||||
@private
|
|
||||||
NSMutableArray<MP42Metadata *> *_presets;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (SBPresetManager *)sharedManager;
|
+ (SBPresetManager *)sharedManager;
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,11 @@
|
|||||||
NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotification";
|
NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotification";
|
||||||
|
|
||||||
@interface SBPresetManager ()
|
@interface SBPresetManager ()
|
||||||
- (BOOL)loadPresets;
|
{
|
||||||
- (BOOL)savePresets;
|
NSMutableArray<MP42Metadata *> *_presets;
|
||||||
- (NSString *)appSupportPath;
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) NSString *appSupportPath;
|
||||||
- (BOOL)removePresetWithName:(NSString*)name;
|
- (BOOL)removePresetWithName:(NSString*)name;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -53,7 +55,6 @@ NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotificat
|
|||||||
{
|
{
|
||||||
MP42Metadata *newSet = [set copy];
|
MP42Metadata *newSet = [set copy];
|
||||||
[_presets addObject:newSet];
|
[_presets addObject:newSet];
|
||||||
[newSet release];
|
|
||||||
|
|
||||||
[self savePresets];
|
[self savePresets];
|
||||||
[self updateNotification];
|
[self updateNotification];
|
||||||
@@ -64,7 +65,7 @@ NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotificat
|
|||||||
NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
|
NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
|
||||||
NSUserDomainMask,
|
NSUserDomainMask,
|
||||||
YES);
|
YES);
|
||||||
return [[allPaths firstObject] stringByAppendingPathComponent:@"Subler"];
|
return [allPaths.firstObject stringByAppendingPathComponent:@"Subler"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)loadPresets
|
- (BOOL)loadPresets
|
||||||
@@ -80,7 +81,7 @@ NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotificat
|
|||||||
|
|
||||||
NSDirectoryEnumerator *dirEnum = [fileManager enumeratorAtPath:appSupportPath];
|
NSDirectoryEnumerator *dirEnum = [fileManager enumeratorAtPath:appSupportPath];
|
||||||
while ((file = [dirEnum nextObject])) {
|
while ((file = [dirEnum nextObject])) {
|
||||||
if ([[file pathExtension] isEqualToString:@"sbpreset"]) {
|
if ([file.pathExtension isEqualToString:@"sbpreset"]) {
|
||||||
@try {
|
@try {
|
||||||
newPreset = [NSKeyedUnarchiver unarchiveObjectWithFile:[appSupportPath stringByAppendingPathComponent:file]];
|
newPreset = [NSKeyedUnarchiver unarchiveObjectWithFile:[appSupportPath stringByAppendingPathComponent:file]];
|
||||||
}
|
}
|
||||||
@@ -116,8 +117,8 @@ NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotificat
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (MP42Metadata *object in _presets) {
|
for (MP42Metadata *object in _presets) {
|
||||||
if ([object isEdited]) {
|
if (object.isEdited) {
|
||||||
NSString *saveLocation = [NSString stringWithFormat:@"%@/%@.sbpreset", appSupportPath, [object presetName]];
|
NSString *saveLocation = [NSString stringWithFormat:@"%@/%@.sbpreset", appSupportPath, object.presetName];
|
||||||
noErr = [NSKeyedArchiver archiveRootObject:object
|
noErr = [NSKeyedArchiver archiveRootObject:object
|
||||||
toFile:saveLocation];
|
toFile:saveLocation];
|
||||||
}
|
}
|
||||||
@@ -136,7 +137,7 @@ NSString *SBPresetManagerUpdatedNotification = @"SBPresetManagerUpdatedNotificat
|
|||||||
|
|
||||||
- (BOOL)removePresetAtIndex:(NSUInteger)index
|
- (BOOL)removePresetAtIndex:(NSUInteger)index
|
||||||
{
|
{
|
||||||
NSString *name = [[_presets objectAtIndex:index] presetName];
|
NSString *name = _presets[index].presetName;
|
||||||
[_presets removeObjectAtIndex:index];
|
[_presets removeObjectAtIndex:index];
|
||||||
|
|
||||||
[self updateNotification];
|
[self updateNotification];
|
||||||
|
|||||||
+7
-21
@@ -26,35 +26,21 @@ extern NSString *SBQueueCompletedNotification;
|
|||||||
extern NSString *SBQueueFailedNotification;
|
extern NSString *SBQueueFailedNotification;
|
||||||
extern NSString *SBQueueCancelledNotification;
|
extern NSString *SBQueueCancelledNotification;
|
||||||
|
|
||||||
@interface SBQueue : NSObject {
|
@interface SBQueue : NSObject
|
||||||
@private
|
|
||||||
dispatch_queue_t _workQueue;
|
|
||||||
SBQueueStatus _status;
|
|
||||||
|
|
||||||
SBQueueItem *_currentItem;
|
|
||||||
NSUInteger _currentIndex;
|
|
||||||
NSMutableArray<SBQueueItem *> *_items;
|
|
||||||
NSURL *_URL;
|
|
||||||
|
|
||||||
IOPMAssertionID _assertionID;
|
|
||||||
IOReturn _io_success;
|
|
||||||
BOOL _cancelled;
|
|
||||||
|
|
||||||
BOOL _optimize;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (atomic, readonly) SBQueueStatus status;
|
@property (atomic, readonly) SBQueueStatus status;
|
||||||
@property (atomic) BOOL optimize;
|
@property (atomic) BOOL optimize;
|
||||||
|
|
||||||
- (instancetype)initWithURL:(NSURL *)queueURL;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
- (instancetype)initWithURL:(NSURL *)queueURL NS_DESIGNATED_INITIALIZER;
|
||||||
|
|
||||||
- (void)start;
|
- (void)start;
|
||||||
- (void)stop;
|
- (void)stop;
|
||||||
|
|
||||||
- (void)addItem:(SBQueueItem *)item;
|
- (void)addItem:(SBQueueItem *)item;
|
||||||
|
|
||||||
- (NSUInteger)count;
|
@property (nonatomic, readonly) NSUInteger count;
|
||||||
- (NSUInteger)readyCount;
|
@property (nonatomic, readonly) NSUInteger readyCount;
|
||||||
|
|
||||||
- (SBQueueItem *)itemAtIndex:(NSUInteger)index;
|
- (SBQueueItem *)itemAtIndex:(NSUInteger)index;
|
||||||
- (NSUInteger)indexOfItem:(SBQueueItem *)item;
|
- (NSUInteger)indexOfItem:(SBQueueItem *)item;
|
||||||
@@ -66,9 +52,9 @@ extern NSString *SBQueueCancelledNotification;
|
|||||||
- (void)removeItemsAtIndexes:(NSIndexSet *)indexes;
|
- (void)removeItemsAtIndexes:(NSIndexSet *)indexes;
|
||||||
- (void)removeItem:(SBQueueItem *)item;
|
- (void)removeItem:(SBQueueItem *)item;
|
||||||
|
|
||||||
- (NSIndexSet *)removeCompletedItems;
|
@property (nonatomic, readonly, copy) NSIndexSet * _Nonnull removeCompletedItems;
|
||||||
|
|
||||||
- (BOOL)saveQueueToDisk;
|
@property (nonatomic, readonly) BOOL saveQueueToDisk;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
+16
-27
@@ -14,13 +14,17 @@ NSString *SBQueueFailedNotification = @"SBQueueFailedNotification";
|
|||||||
NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
||||||
|
|
||||||
@interface SBQueue ()
|
@interface SBQueue ()
|
||||||
|
{
|
||||||
|
IOPMAssertionID _assertionID;
|
||||||
|
IOReturn _io_success;
|
||||||
|
}
|
||||||
|
|
||||||
@property (atomic) SBQueueStatus status;
|
@property (atomic) SBQueueStatus status;
|
||||||
|
|
||||||
@property (nonatomic, copy) NSURL *URL;
|
@property (nonatomic, copy) NSURL *URL;
|
||||||
@property (nonatomic, retain) NSMutableArray *items;
|
@property (nonatomic) NSMutableArray *items;
|
||||||
|
|
||||||
@property (atomic, retain) SBQueueItem *currentItem;
|
@property (atomic) SBQueueItem *currentItem;
|
||||||
@property (atomic) NSUInteger currentIndex;
|
@property (atomic) NSUInteger currentIndex;
|
||||||
@property (atomic) BOOL cancelled;
|
@property (atomic) BOOL cancelled;
|
||||||
|
|
||||||
@@ -30,21 +34,15 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
|
|
||||||
@implementation SBQueue
|
@implementation SBQueue
|
||||||
|
|
||||||
@synthesize status = _status;
|
|
||||||
@synthesize optimize = _optimize;
|
|
||||||
@synthesize currentItem = _currentItem, currentIndex = _currentIndex;
|
|
||||||
@synthesize cancelled = _cancelled;
|
|
||||||
@synthesize items = _items, URL = _URL, workQueue = _workQueue;
|
|
||||||
|
|
||||||
- (instancetype)initWithURL:(NSURL *)queueURL {
|
- (instancetype)initWithURL:(NSURL *)queueURL {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_workQueue = dispatch_queue_create("org.subler.WorkQueue", NULL);
|
_workQueue = dispatch_queue_create("org.subler.WorkQueue", NULL);
|
||||||
_URL = [queueURL copy];
|
_URL = [queueURL copy];
|
||||||
|
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[queueURL path]]) {
|
if ([[NSFileManager defaultManager] fileExistsAtPath:queueURL.path]) {
|
||||||
@try {
|
@try {
|
||||||
_items = [[NSKeyedUnarchiver unarchiveObjectWithFile:[queueURL path]] retain];
|
_items = [NSKeyedUnarchiver unarchiveObjectWithFile:queueURL.path];
|
||||||
} @catch (NSException *exception) {
|
} @catch (NSException *exception) {
|
||||||
[[NSFileManager defaultManager] removeItemAtURL:queueURL error:nil];
|
[[NSFileManager defaultManager] removeItemAtURL:queueURL error:nil];
|
||||||
_items = nil;
|
_items = nil;
|
||||||
@@ -65,7 +63,7 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)saveQueueToDisk {
|
- (BOOL)saveQueueToDisk {
|
||||||
return [NSKeyedArchiver archiveRootObject:self.items toFile:[self.URL path]];
|
return [NSKeyedArchiver archiveRootObject:self.items toFile:(self.URL).path];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -74,13 +72,13 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
for (SBQueueItem *item in self.items) {
|
for (SBQueueItem *item in self.items) {
|
||||||
if ((item.status != SBQueueItemStatusCompleted) && (item.status != SBQueueItemStatusFailed)) {
|
if ((item.status != SBQueueItemStatusCompleted) && (item.status != SBQueueItemStatusFailed)) {
|
||||||
firstItem = [item retain];
|
firstItem = item;
|
||||||
firstItem.status = SBQueueItemStatusWorking;
|
firstItem.status = SBQueueItemStatusWorking;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return [firstItem autorelease];
|
return firstItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - item management
|
#pragma mark - item management
|
||||||
@@ -90,19 +88,19 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)count {
|
- (NSUInteger)count {
|
||||||
return [self.items count];
|
return (self.items).count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)readyCount {
|
- (NSUInteger)readyCount {
|
||||||
NSUInteger count = 0;
|
NSUInteger count = 0;
|
||||||
for (SBQueueItem *item in self.items)
|
for (SBQueueItem *item in self.items)
|
||||||
if ([item status] == SBQueueItemStatusReady)
|
if (item.status == SBQueueItemStatusReady)
|
||||||
count++;
|
count++;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (SBQueueItem *)itemAtIndex:(NSUInteger)index {
|
- (SBQueueItem *)itemAtIndex:(NSUInteger)index {
|
||||||
return [self.items objectAtIndex:index];
|
return (self.items)[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)itemsAtIndexes:(NSIndexSet *)indexes {
|
- (NSArray *)itemsAtIndexes:(NSIndexSet *)indexes {
|
||||||
@@ -139,12 +137,12 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
NSMutableIndexSet *indexes = [[NSMutableIndexSet alloc] init];
|
NSMutableIndexSet *indexes = [[NSMutableIndexSet alloc] init];
|
||||||
|
|
||||||
for (SBQueueItem *item in self.items)
|
for (SBQueueItem *item in self.items)
|
||||||
if ([item status] == SBQueueItemStatusCompleted)
|
if (item.status == SBQueueItemStatusCompleted)
|
||||||
[indexes addIndex:[self.items indexOfObject:item]];
|
[indexes addIndex:[self.items indexOfObject:item]];
|
||||||
|
|
||||||
[self.items removeObjectsAtIndexes:indexes];
|
[self.items removeObjectsAtIndexes:indexes];
|
||||||
|
|
||||||
return [indexes autorelease];
|
return indexes;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Queue control
|
#pragma mark - Queue control
|
||||||
@@ -290,13 +288,4 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
|||||||
[[NSNotificationCenter defaultCenter] postNotificationName:SBQueueCancelledNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:SBQueueCancelledNotification object:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
dispatch_release(_workQueue);
|
|
||||||
|
|
||||||
[_items release];
|
|
||||||
[_URL release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+17
-30
@@ -24,7 +24,7 @@
|
|||||||
- (NSArray<MP42SubtitleTrack *> *)loadSubtitles:(NSURL *)url {
|
- (NSArray<MP42SubtitleTrack *> *)loadSubtitles:(NSURL *)url {
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSMutableArray<MP42SubtitleTrack *> *tracksArray = [[NSMutableArray alloc] init];
|
NSMutableArray<MP42SubtitleTrack *> *tracksArray = [[NSMutableArray alloc] init];
|
||||||
NSArray<NSURL *> *directory = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:[url URLByDeletingLastPathComponent]
|
NSArray<NSURL *> *directory = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:url.URLByDeletingLastPathComponent
|
||||||
includingPropertiesForKeys:nil
|
includingPropertiesForKeys:nil
|
||||||
options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
|
options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
|
||||||
NSDirectoryEnumerationSkipsHiddenFiles |
|
NSDirectoryEnumerationSkipsHiddenFiles |
|
||||||
@@ -34,16 +34,16 @@
|
|||||||
for (NSURL *dirUrl in directory) {
|
for (NSURL *dirUrl in directory) {
|
||||||
if ([dirUrl.pathExtension caseInsensitiveCompare:@"srt"] == NSOrderedSame) {
|
if ([dirUrl.pathExtension caseInsensitiveCompare:@"srt"] == NSOrderedSame) {
|
||||||
NSComparisonResult result;
|
NSComparisonResult result;
|
||||||
NSString *movieFilename = [[url URLByDeletingPathExtension] lastPathComponent];
|
NSString *movieFilename = url.URLByDeletingPathExtension.lastPathComponent;
|
||||||
NSString *subtitleFilename = [[dirUrl URLByDeletingPathExtension] lastPathComponent];
|
NSString *subtitleFilename = dirUrl.URLByDeletingPathExtension.lastPathComponent;
|
||||||
NSRange range = { 0, movieFilename.length };
|
NSRange range = { 0, movieFilename.length };
|
||||||
|
|
||||||
if (movieFilename.length <= subtitleFilename.length) {
|
if (movieFilename.length <= subtitleFilename.length) {
|
||||||
result = [subtitleFilename compare:movieFilename options:NSCaseInsensitiveSearch range:range];
|
result = [subtitleFilename compare:movieFilename options:NSCaseInsensitiveSearch range:range];
|
||||||
|
|
||||||
if (result == NSOrderedSame) {
|
if (result == NSOrderedSame) {
|
||||||
MP42FileImporter *fileImporter = [[[MP42FileImporter alloc] initWithURL:dirUrl
|
MP42FileImporter *fileImporter = [[MP42FileImporter alloc] initWithURL:dirUrl
|
||||||
error:&error] autorelease];
|
error:&error];
|
||||||
|
|
||||||
for (MP42SubtitleTrack *track in fileImporter.tracks) {
|
for (MP42SubtitleTrack *track in fileImporter.tracks) {
|
||||||
[tracksArray addObject:track];
|
[tracksArray addObject:track];
|
||||||
@@ -53,12 +53,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [tracksArray autorelease];
|
return tracksArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)runAction:(SBQueueItem *)item {
|
- (void)runAction:(SBQueueItem *)item {
|
||||||
// Search for external subtitles files
|
// Search for external subtitles files
|
||||||
NSArray<MP42SubtitleTrack *> *subtitles = [self loadSubtitles:item.URL];
|
NSArray<MP42SubtitleTrack *> *subtitles = [self loadSubtitles:item.fileURL];
|
||||||
for (MP42SubtitleTrack *subTrack in subtitles) {
|
for (MP42SubtitleTrack *subTrack in subtitles) {
|
||||||
[item.mp4File addTrack:subTrack];
|
[item.mp4File addTrack:subTrack];
|
||||||
}
|
}
|
||||||
@@ -89,8 +89,8 @@
|
|||||||
if (self) {
|
if (self) {
|
||||||
_movieLanguage = [SBMetadataImporter defaultMovieLanguage];
|
_movieLanguage = [SBMetadataImporter defaultMovieLanguage];
|
||||||
_tvShowLanguage = [SBMetadataImporter defaultTVLanguage];
|
_tvShowLanguage = [SBMetadataImporter defaultTVLanguage];
|
||||||
_movieProvider = [[SBMetadataImporter movieProviders] firstObject];
|
_movieProvider = [SBMetadataImporter movieProviders].firstObject;
|
||||||
_tvShowProvider = [[SBMetadataImporter tvProviders] firstObject];
|
_tvShowProvider = [SBMetadataImporter tvProviders].firstObject;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -113,22 +113,13 @@
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[_movieLanguage release];
|
|
||||||
[_tvShowLanguage release];
|
|
||||||
[_movieProvider release];
|
|
||||||
[_tvShowProvider release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (MP42Image *)loadArtwork:(nonnull NSURL *)url {
|
- (MP42Image *)loadArtwork:(nonnull NSURL *)url {
|
||||||
NSData *artworkData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
NSData *artworkData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||||
if (artworkData && artworkData.length) {
|
if (artworkData && artworkData.length) {
|
||||||
MP42Image *artwork = [[MP42Image alloc] initWithData:artworkData type:MP42_ART_JPEG];
|
MP42Image *artwork = [[MP42Image alloc] initWithData:artworkData type:MP42_ART_JPEG];
|
||||||
if (artwork != nil) {
|
if (artwork != nil) {
|
||||||
return [artwork autorelease];
|
return artwork;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +181,7 @@
|
|||||||
|
|
||||||
- (void)runAction:(SBQueueItem *)item {
|
- (void)runAction:(SBQueueItem *)item {
|
||||||
// Search for metadata
|
// Search for metadata
|
||||||
MP42Metadata *metadata = [self searchMetadataForFile:item.URL];
|
MP42Metadata *metadata = [self searchMetadataForFile:item.fileURL];
|
||||||
|
|
||||||
for (MP42Track *track in [item.mp4File tracksWithMediaType:MP42MediaTypeVideo])
|
for (MP42Track *track in [item.mp4File tracksWithMediaType:MP42MediaTypeVideo])
|
||||||
if ([track isKindOfClass:[MP42VideoTrack class]]) {
|
if ([track isKindOfClass:[MP42VideoTrack class]]) {
|
||||||
@@ -216,10 +207,10 @@
|
|||||||
- (instancetype)initWithCoder:(NSCoder *)coder {
|
- (instancetype)initWithCoder:(NSCoder *)coder {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
_movieLanguage = [[coder decodeObjectForKey:@"_movieLanguage"] retain];
|
_movieLanguage = [coder decodeObjectForKey:@"_movieLanguage"];
|
||||||
_tvShowLanguage = [[coder decodeObjectForKey:@"_tvShowLanguage"] retain];
|
_tvShowLanguage = [coder decodeObjectForKey:@"_tvShowLanguage"];
|
||||||
_movieProvider = [[coder decodeObjectForKey:@"_movieProvider"] retain];
|
_movieProvider = [coder decodeObjectForKey:@"_movieProvider"];
|
||||||
_tvShowProvider = [[coder decodeObjectForKey:@"_tvShowProvider"] retain];
|
_tvShowProvider = [coder decodeObjectForKey:@"_tvShowProvider"];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -235,7 +226,7 @@
|
|||||||
|
|
||||||
@implementation SBQueueSetAction
|
@implementation SBQueueSetAction
|
||||||
|
|
||||||
- (id)initWithSet:(MP42Metadata *)set {
|
- (instancetype)initWithSet:(MP42Metadata *)set {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_set = [set copy];
|
_set = [set copy];
|
||||||
@@ -258,7 +249,7 @@
|
|||||||
- (instancetype)initWithCoder:(NSCoder *)coder {
|
- (instancetype)initWithCoder:(NSCoder *)coder {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_set = [[coder decodeObjectForKey:@"SBQueueActionSet"] retain];
|
_set = [coder decodeObjectForKey:@"SBQueueActionSet"];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -267,10 +258,6 @@
|
|||||||
[coder encodeObject:_set forKey:@"SBQueueActionSet"];
|
[coder encodeObject:_set forKey:@"SBQueueActionSet"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[_set release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -12,33 +12,8 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class SBQueueItem;
|
@class SBQueueItem;
|
||||||
@class SBOptionsViewController;
|
|
||||||
@class SBQueuePreferences;
|
|
||||||
|
|
||||||
@class SBTableView;
|
@interface SBQueueController : NSWindowController
|
||||||
@class MP42File;
|
|
||||||
|
|
||||||
@interface SBQueueController : NSWindowController {
|
|
||||||
@private
|
|
||||||
IBOutlet NSTextField *_countLabel;
|
|
||||||
IBOutlet NSProgressIndicator *_progressIndicator;
|
|
||||||
|
|
||||||
IBOutlet SBTableView *_tableView;
|
|
||||||
|
|
||||||
IBOutlet NSWindow *_detachedWindow;
|
|
||||||
IBOutlet NSToolbarItem *_startItem;
|
|
||||||
|
|
||||||
NSPopover *_popover;
|
|
||||||
NSPopover *_itemPopover;
|
|
||||||
SBOptionsViewController *_windowController;
|
|
||||||
|
|
||||||
SBQueuePreferences *_prefs;
|
|
||||||
NSMutableDictionary<NSString *, id> *_options;
|
|
||||||
|
|
||||||
NSImage *_docImg;
|
|
||||||
|
|
||||||
SBQueue *_queue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property(readonly) SBQueueStatus status;
|
@property(readonly) SBQueueStatus status;
|
||||||
|
|
||||||
@@ -49,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)addItem:(SBQueueItem *)item;
|
- (void)addItem:(SBQueueItem *)item;
|
||||||
- (void)editItem:(SBQueueItem *)item;
|
- (void)editItem:(SBQueueItem *)item;
|
||||||
|
|
||||||
- (BOOL)saveQueueToDisk;
|
@property (nonatomic, readonly) BOOL saveQueueToDisk;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
+112
-127
@@ -7,8 +7,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#import "SBQueueController.h"
|
#import "SBQueueController.h"
|
||||||
#import "SBQueuePreferences.h"
|
|
||||||
#import "SBQueueItem.h"
|
#import "SBQueueItem.h"
|
||||||
|
#import "SBQueuePreferences.h"
|
||||||
|
|
||||||
#import "SBOptionsViewController.h"
|
#import "SBOptionsViewController.h"
|
||||||
#import "SBItemViewController.h"
|
#import "SBItemViewController.h"
|
||||||
@@ -25,37 +25,28 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
@interface SBQueueController () <NSPopoverDelegate, NSWindowDelegate, NSTableViewDelegate, NSTableViewDataSource, SBTableViewDelegate, SBItemViewDelegate>
|
@interface SBQueueController () <NSPopoverDelegate, NSWindowDelegate, NSTableViewDelegate, NSTableViewDataSource, SBTableViewDelegate, SBItemViewDelegate>
|
||||||
|
|
||||||
@property (nonatomic, readonly) SBQueue *queue;
|
@property (nonatomic, readonly) SBQueue *queue;
|
||||||
@property (nonatomic, retain) NSPopover *popover;
|
|
||||||
@property (nonatomic, retain) NSPopover *itemPopover;
|
|
||||||
@property (nonatomic, retain) SBOptionsViewController *windowController;
|
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSMutableDictionary *options;
|
|
||||||
@property (nonatomic, readonly) SBQueuePreferences *prefs;
|
@property (nonatomic, readonly) SBQueuePreferences *prefs;
|
||||||
|
@property (nonatomic, readonly) NSMutableDictionary<NSString *, id> *options;
|
||||||
|
|
||||||
- (IBAction)removeSelectedItems:(id)sender;
|
@property (nonatomic, weak) IBOutlet SBTableView *table;
|
||||||
- (IBAction)removeCompletedItems:(id)sender;
|
|
||||||
|
|
||||||
- (IBAction)edit:(id)sender;
|
@property (nonatomic, readonly) NSImage *docImg;
|
||||||
- (IBAction)showInFinder:(id)sender;
|
|
||||||
|
|
||||||
- (IBAction)toggleStartStop:(id)sender;
|
@property (nonatomic, strong) NSPopover *popover;
|
||||||
- (IBAction)toggleOptions:(id)sender;
|
@property (nonatomic,weak) IBOutlet NSPanel *detachedWindow;
|
||||||
- (IBAction)toggleItemsOptions:(id)sender;
|
|
||||||
|
|
||||||
- (IBAction)open:(id)sender;
|
@property (nonatomic, strong) NSPopover *itemPopover;
|
||||||
|
@property (nonatomic, strong) SBOptionsViewController *windowController;
|
||||||
|
|
||||||
|
@property (nonatomic, weak) IBOutlet NSToolbarItem *startItem;
|
||||||
|
|
||||||
|
@property (nonatomic, weak) IBOutlet NSTextField *statusLabel;
|
||||||
|
@property (nonatomic, weak) IBOutlet NSProgressIndicator *progressBar;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation SBQueueController
|
@implementation SBQueueController
|
||||||
|
|
||||||
@synthesize queue = _queue;
|
|
||||||
@synthesize popover = _popover;
|
|
||||||
@synthesize itemPopover = _itemPopover;
|
|
||||||
@synthesize windowController = _windowController;
|
|
||||||
@synthesize options = _options;
|
|
||||||
@synthesize prefs = _prefs;
|
|
||||||
|
|
||||||
+ (SBQueueController *)sharedManager {
|
+ (SBQueueController *)sharedManager {
|
||||||
static dispatch_once_t pred;
|
static dispatch_once_t pred;
|
||||||
static SBQueueController *sharedManager = nil;
|
static SBQueueController *sharedManager = nil;
|
||||||
@@ -82,14 +73,14 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
- (void)windowDidLoad {
|
- (void)windowDidLoad {
|
||||||
[super windowDidLoad];
|
[super windowDidLoad];
|
||||||
|
|
||||||
[_progressIndicator setHidden:YES];
|
[self.progressBar setHidden:YES];
|
||||||
|
|
||||||
// Load a generic movie icon to display in the table view
|
// Load a generic movie icon to display in the table view
|
||||||
_docImg = [[[NSWorkspace sharedWorkspace] iconForFileType:@"public.movie"] retain];
|
_docImg = [[NSWorkspace sharedWorkspace] iconForFileType:@"public.movie"];
|
||||||
[_docImg setSize:NSMakeSize(16, 16)];
|
_docImg.size = NSMakeSize(16, 16);
|
||||||
|
|
||||||
[_tableView registerForDraggedTypes:@[NSFilenamesPboardType, SublerBatchTableViewDataType]];
|
|
||||||
|
|
||||||
|
// Drag & Drop
|
||||||
|
[self.table registerForDraggedTypes:@[NSFilenamesPboardType, SublerBatchTableViewDataType]];
|
||||||
|
|
||||||
// Observe the changes to SBQueueOptimize
|
// Observe the changes to SBQueueOptimize
|
||||||
[self addObserver:self forKeyPath:@"options.SBQueueOptimize" options:NSKeyValueObservingOptionInitial context:SBQueueContex];
|
[self addObserver:self forKeyPath:@"options.SBQueueOptimize" options:NSKeyValueObservingOptionInitial context:SBQueueContex];
|
||||||
@@ -98,10 +89,10 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
|
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueWorkingNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueWorkingNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
||||||
NSDictionary *info = [note userInfo];
|
NSDictionary *info = note.userInfo;
|
||||||
[_countLabel setStringValue:[info valueForKey:@"ProgressString"]];
|
self.statusLabel.stringValue = [info valueForKey:@"ProgressString"];
|
||||||
[_progressIndicator setIndeterminate:NO];
|
[self.progressBar setIndeterminate:NO];
|
||||||
[_progressIndicator setDoubleValue:[[info valueForKey:@"Progress"] doubleValue]];
|
self.progressBar.doubleValue = [[info valueForKey:@"Progress"] doubleValue];
|
||||||
|
|
||||||
if ([[info valueForKey:@"ItemIndex"] integerValue] != -1) {
|
if ([[info valueForKey:@"ItemIndex"] integerValue] != -1) {
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
@@ -109,18 +100,18 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueCompletedNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueCompletedNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
||||||
[_progressIndicator setHidden:YES];
|
[self.progressBar setHidden:YES];
|
||||||
[_progressIndicator stopAnimation:self];
|
[self.progressBar stopAnimation:self];
|
||||||
[_progressIndicator setDoubleValue:0];
|
self.progressBar.doubleValue = 0;
|
||||||
[_progressIndicator setIndeterminate:YES];
|
[self.progressBar setIndeterminate:YES];
|
||||||
[_startItem setImage:[NSImage imageNamed:@"playBackTemplate"]];
|
self.startItem.image = [NSImage imageNamed:@"playBackTemplate"];
|
||||||
[_countLabel setStringValue:NSLocalizedString(@"Done", @"Queue -> Done")];
|
[self.statusLabel setStringValue:NSLocalizedString(@"Done", @"Queue -> Done")];
|
||||||
|
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueFailedNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
[[NSNotificationCenter defaultCenter] addObserverForName:SBQueueFailedNotification object:self.queue queue:mainQueue usingBlock:^(NSNotification *note) {
|
||||||
NSDictionary *info = [note userInfo];
|
NSDictionary *info = note.userInfo;
|
||||||
if ([[info valueForKey:@"Error"] isMemberOfClass:[NSError class]]) {
|
if ([[info valueForKey:@"Error"] isMemberOfClass:[NSError class]]) {
|
||||||
[NSApp presentError:[info valueForKey:@"Error"]];
|
[NSApp presentError:[info valueForKey:@"Error"]];
|
||||||
}
|
}
|
||||||
@@ -133,31 +124,31 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
#pragma mark - User Interface Validation
|
#pragma mark - User Interface Validation
|
||||||
|
|
||||||
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem {
|
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem {
|
||||||
SEL action = [anItem action];
|
SEL action = anItem.action;
|
||||||
|
|
||||||
if (action == @selector(removeSelectedItems:)) {
|
if (action == @selector(removeSelectedItems:)) {
|
||||||
if ([_tableView selectedRow] != -1) {
|
if (self.table.selectedRow != -1) {
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView selectedRow]];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.selectedRow];
|
||||||
if ([item status] != SBQueueItemStatusWorking)
|
if (item.status != SBQueueItemStatusWorking)
|
||||||
return YES;
|
return YES;
|
||||||
} else if ([_tableView clickedRow] != -1) {
|
} else if (self.table.clickedRow != -1) {
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView clickedRow]];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
||||||
if ([item status] != SBQueueItemStatusWorking)
|
if (item.status != SBQueueItemStatusWorking)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == @selector(showInFinder:)) {
|
if (action == @selector(showInFinder:)) {
|
||||||
if ([_tableView clickedRow] != -1) {
|
if (self.table.clickedRow != -1) {
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView clickedRow]];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
||||||
if ([item status] == SBQueueItemStatusCompleted)
|
if (item.status == SBQueueItemStatusCompleted)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == @selector(edit:)) {
|
if (action == @selector(edit:)) {
|
||||||
if ([_tableView clickedRow] != -1) {
|
if (self.table.clickedRow != -1) {
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView clickedRow]];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
||||||
if (item.status == SBQueueItemStatusReady)
|
if (item.status == SBQueueItemStatusReady)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@@ -176,7 +167,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
||||||
if (context == SBQueueContex) {
|
if (context == SBQueueContex) {
|
||||||
if ([keyPath isEqualToString:@"options.SBQueueOptimize"]) {
|
if ([keyPath isEqualToString:@"options.SBQueueOptimize"]) {
|
||||||
self.queue.optimize = [[self.options objectForKey:SBQueueOptimize] boolValue];
|
self.queue.optimize = [(self.options)[SBQueueOptimize] boolValue];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||||
@@ -228,7 +219,6 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
[[NSDocumentController sharedDocumentController] addDocument:doc];
|
[[NSDocumentController sharedDocumentController] addDocument:doc];
|
||||||
[doc makeWindowControllers];
|
[doc makeWindowControllers];
|
||||||
[doc showWindows];
|
[doc showWindows];
|
||||||
[doc release];
|
|
||||||
|
|
||||||
[self.itemPopover close];
|
[self.itemPopover close];
|
||||||
|
|
||||||
@@ -250,41 +240,41 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
- (SBQueueItem *)createItemWithURL:(NSURL *)url {
|
- (SBQueueItem *)createItemWithURL:(NSURL *)url {
|
||||||
SBQueueItem *item = [SBQueueItem itemWithURL:url];
|
SBQueueItem *item = [SBQueueItem itemWithURL:url];
|
||||||
|
|
||||||
if ([[self.options objectForKey:SBQueueMetadata] boolValue]) {
|
if ([(self.options)[SBQueueMetadata] boolValue]) {
|
||||||
[item addAction:[[[SBQueueMetadataAction alloc] initWithMovieLanguage:[self.options objectForKey:SBQueueMovieProviderLanguage]
|
[item addAction:[[SBQueueMetadataAction alloc] initWithMovieLanguage:(self.options)[SBQueueMovieProviderLanguage]
|
||||||
tvShowLanguage:[self.options objectForKey:SBQueueTVShowProviderLanguage]
|
tvShowLanguage:(self.options)[SBQueueTVShowProviderLanguage]
|
||||||
movieProvider:[self.options objectForKey:SBQueueMovieProvider]
|
movieProvider:(self.options)[SBQueueMovieProvider]
|
||||||
tvShowProvider:[self.options objectForKey:SBQueueTVShowProvider]] autorelease]];
|
tvShowProvider:(self.options)[SBQueueTVShowProvider]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[self.options objectForKey:SBQueueSubtitles] boolValue]) {
|
if ([(self.options)[SBQueueSubtitles] boolValue]) {
|
||||||
[item addAction:[[[SBQueueSubtitlesAction alloc] init] autorelease]];
|
[item addAction:[[SBQueueSubtitlesAction alloc] init]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[self.options objectForKey:SBQueueOrganize] boolValue]) {
|
if ([(self.options)[SBQueueOrganize] boolValue]) {
|
||||||
[item addAction:[[[SBQueueOrganizeGroupsAction alloc] init] autorelease]];
|
[item addAction:[[SBQueueOrganizeGroupsAction alloc] init]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[self.options objectForKey:SBQueueFixFallbacks] boolValue]) {
|
if ([(self.options)[SBQueueFixFallbacks] boolValue]) {
|
||||||
[item addAction:[[[SBQueueFixFallbacksAction alloc] init] autorelease]];
|
[item addAction:[[SBQueueFixFallbacksAction alloc] init]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self.options objectForKey:SBQueueSet]) {
|
if ((self.options)[SBQueueSet]) {
|
||||||
[item addAction:[[[SBQueueSetAction alloc] initWithSet:[self.options objectForKey:SBQueueSet]] autorelease]];
|
[item addAction:[[SBQueueSetAction alloc] initWithSet:(self.options)[SBQueueSet]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
id type;
|
id type;
|
||||||
[url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:NULL];
|
[url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:NULL];
|
||||||
|
|
||||||
NSURL *destination = [self.options objectForKey:SBQueueDestination];
|
NSURL *destination = (self.options)[SBQueueDestination];
|
||||||
if (destination) {
|
if (destination) {
|
||||||
destination = [[[destination URLByAppendingPathComponent:[url lastPathComponent]] URLByDeletingPathExtension]
|
destination = [[destination URLByAppendingPathComponent:url.lastPathComponent].URLByDeletingPathExtension
|
||||||
URLByAppendingPathExtension:[self.options objectForKey:SBQueueFileType]];
|
URLByAppendingPathExtension:(self.options)[SBQueueFileType]];
|
||||||
} else if (UTTypeConformsTo((__bridge CFStringRef)type, (__bridge CFStringRef)@"public.mpeg-4")) {
|
} else if (UTTypeConformsTo((__bridge CFStringRef)type, (__bridge CFStringRef)@"public.mpeg-4")) {
|
||||||
destination = [[url copy] autorelease];
|
destination = [url copy];
|
||||||
} else {
|
} else {
|
||||||
destination = [[url URLByDeletingPathExtension]
|
destination = [url.URLByDeletingPathExtension
|
||||||
URLByAppendingPathExtension:[self.options objectForKey:SBQueueFileType]];
|
URLByAppendingPathExtension:(self.options)[SBQueueFileType]];
|
||||||
}
|
}
|
||||||
|
|
||||||
item.destURL = destination;
|
item.destURL = destination;
|
||||||
@@ -306,14 +296,14 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
*/
|
*/
|
||||||
- (void)addItems:(NSArray<SBQueueItem *> *)items atIndexes:(NSIndexSet *)indexes; {
|
- (void)addItems:(NSArray<SBQueueItem *> *)items atIndexes:(NSIndexSet *)indexes; {
|
||||||
NSMutableIndexSet *mutableIndexes = [indexes mutableCopy];
|
NSMutableIndexSet *mutableIndexes = [indexes mutableCopy];
|
||||||
if ([indexes count] == [items count]) {
|
if (indexes.count == items.count) {
|
||||||
for (id item in [items reverseObjectEnumerator]) {
|
for (id item in [items reverseObjectEnumerator]) {
|
||||||
[self.queue insertItem:item atIndex:[mutableIndexes firstIndex]];
|
[self.queue insertItem:item atIndex:mutableIndexes.firstIndex];
|
||||||
[mutableIndexes removeIndexesInRange:NSMakeRange(0, 1)];
|
[mutableIndexes removeIndexesInRange:NSMakeRange(0, 1)];
|
||||||
}
|
}
|
||||||
} else if ([indexes count] == 1) {
|
} else if (indexes.count == 1) {
|
||||||
for (id item in [items reverseObjectEnumerator]) {
|
for (id item in [items reverseObjectEnumerator]) {
|
||||||
[self.queue insertItem:item atIndex:[mutableIndexes firstIndex]];
|
[self.queue insertItem:item atIndex:mutableIndexes.firstIndex];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (id item in [items reverseObjectEnumerator]) {
|
for (id item in [items reverseObjectEnumerator]) {
|
||||||
@@ -321,19 +311,18 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undo = [[self window] undoManager];
|
NSUndoManager *undo = self.window.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] removeItems:items];
|
[[undo prepareWithInvocationTarget:self] removeItems:items];
|
||||||
|
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Add Queue Item", @"Queue -> redo add item.")];
|
[undo setActionName:NSLocalizedString(@"Add Queue Item", @"Queue -> redo add item.")];
|
||||||
}
|
}
|
||||||
if ([undo isUndoing] || [undo isRedoing])
|
if (undo.undoing || undo.redoing)
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
|
|
||||||
if ([[self.options objectForKey:SBQueueAutoStart] boolValue])
|
if ([(self.options)[SBQueueAutoStart] boolValue])
|
||||||
[self start:self];
|
[self start:self];
|
||||||
|
|
||||||
[mutableIndexes release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -348,16 +337,15 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
[self.queue removeItem:item];
|
[self.queue removeItem:item];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUndoManager *undo = [[self window] undoManager];
|
NSUndoManager *undo = self.window.undoManager;
|
||||||
[[undo prepareWithInvocationTarget:self] addItems:items atIndexes:indexes];
|
[[undo prepareWithInvocationTarget:self] addItems:items atIndexes:indexes];
|
||||||
|
|
||||||
if (![undo isUndoing]) {
|
if (!undo.undoing) {
|
||||||
[undo setActionName:NSLocalizedString(@"Delete Queue Item", @"Queue -> Undo delete item.")];
|
[undo setActionName:NSLocalizedString(@"Delete Queue Item", @"Queue -> Undo delete item.")];
|
||||||
}
|
}
|
||||||
if ([undo isUndoing] || [undo isRedoing])
|
if (undo.undoing || undo.redoing)
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
|
|
||||||
[indexes release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - NSPopover delegate
|
#pragma mark - NSPopover delegate
|
||||||
@@ -372,7 +360,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
// the popover retains us and we retain the popover,
|
// the popover retains us and we retain the popover,
|
||||||
// we drop the popover whenever it is closed to avoid a cycle
|
// we drop the popover whenever it is closed to avoid a cycle
|
||||||
self.popover.contentViewController = [[[SBOptionsViewController alloc] initWithOptions:self.options] autorelease];
|
self.popover.contentViewController = [[SBOptionsViewController alloc] initWithOptions:self.options];
|
||||||
self.popover.appearance = NSPopoverAppearanceMinimal;
|
self.popover.appearance = NSPopoverAppearanceMinimal;
|
||||||
self.popover.animates = YES;
|
self.popover.animates = YES;
|
||||||
|
|
||||||
@@ -387,7 +375,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
-(NSWindow *)createOptionsWindow {
|
-(NSWindow *)createOptionsWindow {
|
||||||
if (!self.windowController) {
|
if (!self.windowController) {
|
||||||
self.windowController = [[[SBOptionsViewController alloc] initWithOptions:self.options] autorelease];
|
self.windowController = [[SBOptionsViewController alloc] initWithOptions:self.options];
|
||||||
}
|
}
|
||||||
_detachedWindow.contentView = self.windowController.view;
|
_detachedWindow.contentView = self.windowController.view;
|
||||||
_detachedWindow.delegate = self;
|
_detachedWindow.delegate = self;
|
||||||
@@ -399,11 +387,11 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
* Creates a popover with a SBQueueItem
|
* Creates a popover with a SBQueueItem
|
||||||
*/
|
*/
|
||||||
- (void)createItemPopover:(SBQueueItem *)item {
|
- (void)createItemPopover:(SBQueueItem *)item {
|
||||||
self.itemPopover = [[[NSPopover alloc] init] autorelease];
|
self.itemPopover = [[NSPopover alloc] init];
|
||||||
|
|
||||||
// the popover retains us and we retain the popover,
|
// the popover retains us and we retain the popover,
|
||||||
// we drop the popover whenever it is closed to avoid a cycle
|
// we drop the popover whenever it is closed to avoid a cycle
|
||||||
SBItemViewController *view = [[[SBItemViewController alloc] initWithItem:item] autorelease];
|
SBItemViewController *view = [[SBItemViewController alloc] initWithItem:item];
|
||||||
view.delegate = self;
|
view.delegate = self;
|
||||||
self.itemPopover.contentViewController = view;
|
self.itemPopover.contentViewController = view;
|
||||||
self.itemPopover.appearance = NSPopoverAppearanceMinimal;
|
self.itemPopover.appearance = NSPopoverAppearanceMinimal;
|
||||||
@@ -446,7 +434,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)popoverDidClose:(NSNotification *)notification {
|
- (void)popoverDidClose:(NSNotification *)notification {
|
||||||
NSPopover *closedPopover = [notification object];
|
NSPopover *closedPopover = notification.object;
|
||||||
if (self.popover == closedPopover) {
|
if (self.popover == closedPopover) {
|
||||||
self.popover = nil;
|
self.popover = nil;
|
||||||
}
|
}
|
||||||
@@ -464,30 +452,31 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
NSUInteger count = [self.queue readyCount] + ((self.queue.status == SBQueueStatusWorking) ? 1 : 0);
|
NSUInteger count = [self.queue readyCount] + ((self.queue.status == SBQueueStatusWorking) ? 1 : 0);
|
||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
[[NSApp dockTile] setBadgeLabel:[NSString stringWithFormat:@"%lu", (unsigned long)count]];
|
NSApp.dockTile.badgeLabel = [NSString stringWithFormat:@"%lu", (unsigned long)count];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[[NSApp dockTile] setBadgeLabel:nil];
|
[NSApp.dockTile setBadgeLabel:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateUI {
|
- (void)updateUI {
|
||||||
[_tableView reloadData];
|
[self.table reloadData];
|
||||||
[self updateDockTile];
|
[self updateDockTile];
|
||||||
|
|
||||||
if (self.queue.status != SBQueueStatusWorking) {
|
if (self.queue.status != SBQueueStatusWorking) {
|
||||||
[_countLabel setStringValue:[NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]]];
|
self.statusLabel.stringValue = [NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)start:(id)sender {
|
- (void)start:(id)sender {
|
||||||
if (self.queue.status == SBQueueStatusWorking)
|
if (self.queue.status == SBQueueStatusWorking) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
[_startItem setImage:[NSImage imageNamed:@"stopTemplate"]];
|
self.startItem.image = [NSImage imageNamed:@"stopTemplate"];
|
||||||
[_countLabel setStringValue:NSLocalizedString(@"Working.", @"Queue -> Working")];
|
[self.statusLabel setStringValue:NSLocalizedString(@"Working.", @"Queue -> Working")];
|
||||||
[_progressIndicator setHidden:NO];
|
[self.progressBar setHidden:NO];
|
||||||
[_progressIndicator startAnimation:self];
|
[self.progressBar startAnimation:self];
|
||||||
|
|
||||||
[self.queue start];
|
[self.queue start];
|
||||||
}
|
}
|
||||||
@@ -509,7 +498,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
if (!self.popover.isShown) {
|
if (!self.popover.isShown) {
|
||||||
NSButton *targetButton = (NSButton *)sender;
|
NSButton *targetButton = (NSButton *)sender;
|
||||||
[self.popover showRelativeToRect:[targetButton bounds] ofView:sender preferredEdge:NSMaxYEdge];
|
[self.popover showRelativeToRect:targetButton.bounds ofView:sender preferredEdge:NSMaxYEdge];
|
||||||
} else {
|
} else {
|
||||||
[self.popover close];
|
[self.popover close];
|
||||||
self.popover = nil;
|
self.popover = nil;
|
||||||
@@ -520,7 +509,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
NSInteger clickedRow = [sender clickedRow];
|
NSInteger clickedRow = [sender clickedRow];
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:clickedRow];
|
SBQueueItem *item = [self.queue itemAtIndex:clickedRow];
|
||||||
|
|
||||||
if (self.itemPopover.isShown && [(SBItemViewController *)self.itemPopover.contentViewController item] == item) {
|
if (self.itemPopover.isShown && ((SBItemViewController *)self.itemPopover.contentViewController).item == item) {
|
||||||
[self.itemPopover close];
|
[self.itemPopover close];
|
||||||
self.itemPopover = nil;
|
self.itemPopover = nil;
|
||||||
} else {
|
} else {
|
||||||
@@ -538,17 +527,16 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
panel.canChooseDirectories = YES;
|
panel.canChooseDirectories = YES;
|
||||||
panel.allowedFileTypes = [MP42FileImporter supportedFileFormats];
|
panel.allowedFileTypes = [MP42FileImporter supportedFileFormats];
|
||||||
|
|
||||||
[panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
|
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
|
||||||
if (result == NSFileHandlingPanelOKButton) {
|
if (result == NSFileHandlingPanelOKButton) {
|
||||||
NSMutableArray<SBQueueItem *> *items = [[NSMutableArray alloc] init];
|
NSMutableArray<SBQueueItem *> *items = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
for (NSURL *url in [panel URLs]) {
|
for (NSURL *url in panel.URLs) {
|
||||||
SBQueueItem *item = [self createItemWithURL:url];
|
SBQueueItem *item = [self createItemWithURL:url];
|
||||||
[items addObject:item];
|
[items addObject:item];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self addItems:items atIndexes:nil];
|
[self addItems:items atIndexes:nil];
|
||||||
[items release];
|
|
||||||
|
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
}
|
}
|
||||||
@@ -563,9 +551,9 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
|
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
|
||||||
if ([aTableColumn.identifier isEqualToString:@"nameColumn"]) {
|
if ([aTableColumn.identifier isEqualToString:@"nameColumn"]) {
|
||||||
return [[[self.queue itemAtIndex:rowIndex] URL] lastPathComponent];
|
return [self.queue itemAtIndex:rowIndex].fileURL.lastPathComponent;
|
||||||
} else if ([aTableColumn.identifier isEqualToString:@"statusColumn"]) {
|
} else if ([aTableColumn.identifier isEqualToString:@"statusColumn"]) {
|
||||||
SBQueueItemStatus batchStatus = [[self.queue itemAtIndex:rowIndex] status];
|
SBQueueItemStatus batchStatus = [self.queue itemAtIndex:rowIndex].status;
|
||||||
if (batchStatus == SBQueueItemStatusCompleted)
|
if (batchStatus == SBQueueItemStatusCompleted)
|
||||||
return [NSImage imageNamed:@"EncodeComplete"];
|
return [NSImage imageNamed:@"EncodeComplete"];
|
||||||
else if (batchStatus == SBQueueItemStatusWorking || batchStatus == SBQueueItemStatusEditing)
|
else if (batchStatus == SBQueueItemStatusWorking || batchStatus == SBQueueItemStatusEditing)
|
||||||
@@ -580,11 +568,12 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)_deleteSelectionFromTableView:(NSTableView *)aTableView {
|
- (void)_deleteSelectionFromTableView:(NSTableView *)aTableView {
|
||||||
NSMutableIndexSet *rowIndexes = [[aTableView selectedRowIndexes] mutableCopy];
|
NSMutableIndexSet *rowIndexes = [aTableView.selectedRowIndexes mutableCopy];
|
||||||
NSInteger clickedRow = [aTableView clickedRow];
|
NSInteger clickedRow = aTableView.clickedRow;
|
||||||
NSUInteger selectedIndex = -1;
|
NSUInteger selectedIndex = -1;
|
||||||
if ([rowIndexes count])
|
if (rowIndexes.count) {
|
||||||
selectedIndex = [rowIndexes firstIndex];
|
selectedIndex = rowIndexes.firstIndex;
|
||||||
|
}
|
||||||
|
|
||||||
if (clickedRow != -1 && ![rowIndexes containsIndex:clickedRow]) {
|
if (clickedRow != -1 && ![rowIndexes containsIndex:clickedRow]) {
|
||||||
[rowIndexes removeAllIndexes];
|
[rowIndexes removeAllIndexes];
|
||||||
@@ -595,10 +584,10 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
// A item with a status of SBQueueItemStatusWorking can not be removed
|
// A item with a status of SBQueueItemStatusWorking can not be removed
|
||||||
for (SBQueueItem *item in array)
|
for (SBQueueItem *item in array)
|
||||||
if ([item status] == SBQueueItemStatusWorking)
|
if (item.status == SBQueueItemStatusWorking)
|
||||||
[rowIndexes removeIndex:[self.queue indexOfItem:item]];
|
[rowIndexes removeIndex:[self.queue indexOfItem:item]];
|
||||||
|
|
||||||
if ([rowIndexes count]) {
|
if (rowIndexes.count) {
|
||||||
[aTableView beginUpdates];
|
[aTableView beginUpdates];
|
||||||
[aTableView removeRowsAtIndexes:rowIndexes withAnimation:NSTableViewAnimationEffectFade];
|
[aTableView removeRowsAtIndexes:rowIndexes withAnimation:NSTableViewAnimationEffectFade];
|
||||||
[aTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:selectedIndex] byExtendingSelection:NO];
|
[aTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:selectedIndex] byExtendingSelection:NO];
|
||||||
@@ -606,39 +595,37 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
[aTableView endUpdates];
|
[aTableView endUpdates];
|
||||||
|
|
||||||
if (self.queue.status != SBQueueStatusWorking) {
|
if (self.queue.status != SBQueueStatusWorking) {
|
||||||
[_countLabel setStringValue:[NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]]];
|
self.statusLabel.stringValue = [NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]];
|
||||||
[self updateDockTile];
|
[self updateDockTile];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[rowIndexes release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)edit:(id)sender {
|
- (IBAction)edit:(id)sender {
|
||||||
SBQueueItem *item = [[self.queue itemAtIndex:[_tableView clickedRow]] retain];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
||||||
[self editItem:item];
|
[self editItem:item];
|
||||||
[item release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)showInFinder:(id)sender {
|
- (IBAction)showInFinder:(id)sender {
|
||||||
SBQueueItem *item = [self.queue itemAtIndex:[_tableView clickedRow]];
|
SBQueueItem *item = [self.queue itemAtIndex:self.table.clickedRow];
|
||||||
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[item.destURL]];
|
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[item.destURL]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)removeSelectedItems:(id)sender {
|
- (IBAction)removeSelectedItems:(id)sender {
|
||||||
[self _deleteSelectionFromTableView:_tableView];
|
[self _deleteSelectionFromTableView:self.table];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)removeCompletedItems:(id)sender {
|
- (IBAction)removeCompletedItems:(id)sender {
|
||||||
NSIndexSet *indexes = [self.queue indexesOfItemsWithStatus:SBQueueItemStatusCompleted];
|
NSIndexSet *indexes = [self.queue indexesOfItemsWithStatus:SBQueueItemStatusCompleted];
|
||||||
|
|
||||||
if ([indexes count]) {
|
if (indexes.count) {
|
||||||
[_tableView beginUpdates];
|
[self.table beginUpdates];
|
||||||
[_tableView removeRowsAtIndexes:indexes withAnimation:NSTableViewAnimationEffectFade];
|
[self.table removeRowsAtIndexes:indexes withAnimation:NSTableViewAnimationEffectFade];
|
||||||
[_tableView endUpdates];
|
[self.table endUpdates];
|
||||||
[self.queue removeItemsAtIndexes:indexes];
|
[self.queue removeItemsAtIndexes:indexes];
|
||||||
|
|
||||||
if (self.queue.status != SBQueueStatusWorking) {
|
if (self.queue.status != SBQueueStatusWorking) {
|
||||||
[_countLabel setStringValue:[NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]]];
|
self.statusLabel.stringValue = [NSString stringWithFormat:@"%lu files in queue.", (unsigned long)[self.queue count]];
|
||||||
[self updateDockTile];
|
[self updateDockTile];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -676,7 +663,7 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
{
|
{
|
||||||
NSPasteboard *pboard = [info draggingPasteboard];
|
NSPasteboard *pboard = [info draggingPasteboard];
|
||||||
|
|
||||||
if (_tableView == [info draggingSource]) { // From self
|
if (self.table == [info draggingSource]) { // From self
|
||||||
NSData *rowData = [pboard dataForType:SublerBatchTableViewDataType];
|
NSData *rowData = [pboard dataForType:SublerBatchTableViewDataType];
|
||||||
NSIndexSet *rowIndexes = [NSKeyedUnarchiver unarchiveObjectWithData:rowData];
|
NSIndexSet *rowIndexes = [NSKeyedUnarchiver unarchiveObjectWithData:rowData];
|
||||||
NSUInteger i = [rowIndexes countOfIndexesInRange:NSMakeRange(0, row)];
|
NSUInteger i = [rowIndexes countOfIndexesInRange:NSMakeRange(0, row)];
|
||||||
@@ -688,14 +675,14 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
for (id object in [objects reverseObjectEnumerator])
|
for (id object in [objects reverseObjectEnumerator])
|
||||||
[self.queue insertItem:object atIndex:row];
|
[self.queue insertItem:object atIndex:row];
|
||||||
|
|
||||||
NSIndexSet *selectionSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(row, [rowIndexes count])];
|
NSIndexSet *selectionSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(row, rowIndexes.count)];
|
||||||
|
|
||||||
[view reloadData];
|
[view reloadData];
|
||||||
[view selectRowIndexes:selectionSet byExtendingSelection:NO];
|
[view selectRowIndexes:selectionSet byExtendingSelection:NO];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
} else { // From other documents
|
} else { // From other documents
|
||||||
if ([[pboard types] containsObject:NSURLPboardType] ) {
|
if ([pboard.types containsObject:NSURLPboardType] ) {
|
||||||
NSArray *items = [pboard readObjectsForClasses:@[[NSURL class]] options: nil];
|
NSArray *items = [pboard readObjectsForClasses:@[[NSURL class]] options: nil];
|
||||||
NSMutableArray *queueItems = [[NSMutableArray alloc] init];
|
NSMutableArray *queueItems = [[NSMutableArray alloc] init];
|
||||||
NSMutableIndexSet *indexes = [[NSMutableIndexSet alloc] init];
|
NSMutableIndexSet *indexes = [[NSMutableIndexSet alloc] init];
|
||||||
@@ -710,8 +697,6 @@ static void *SBQueueContex = &SBQueueContex;
|
|||||||
|
|
||||||
[self addItems:queueItems atIndexes:indexes];
|
[self addItems:queueItems atIndexes:indexes];
|
||||||
|
|
||||||
[queueItems release];
|
|
||||||
[indexes release];
|
|
||||||
[self updateUI];
|
[self updateUI];
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
+5
-19
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
typedef enum SBQueueItemStatus : NSInteger {
|
typedef NS_ENUM(NSUInteger, SBQueueItemStatus) {
|
||||||
SBQueueItemStatusUnknown = 0,
|
SBQueueItemStatusUnknown = 0,
|
||||||
SBQueueItemStatusReady,
|
SBQueueItemStatusReady,
|
||||||
SBQueueItemStatusEditing,
|
SBQueueItemStatusEditing,
|
||||||
@@ -21,37 +21,23 @@ typedef enum SBQueueItemStatus : NSInteger {
|
|||||||
SBQueueItemStatusCompleted,
|
SBQueueItemStatusCompleted,
|
||||||
SBQueueItemStatusFailed,
|
SBQueueItemStatusFailed,
|
||||||
SBQueueItemStatusCancelled,
|
SBQueueItemStatusCancelled,
|
||||||
} SBQueueItemStatus;
|
|
||||||
|
|
||||||
@interface SBQueueItem : NSObject <NSCoding> {
|
};
|
||||||
@private
|
|
||||||
MP42File *_mp4File;
|
|
||||||
NSURL *_fileURL;
|
|
||||||
NSURL *_destURL;
|
|
||||||
|
|
||||||
NSDictionary<NSString *, id> *_attributes;
|
@interface SBQueueItem : NSObject <NSCoding>
|
||||||
NSMutableArray<id<SBQueueActionProtocol>> *_actions;
|
|
||||||
|
|
||||||
BOOL _cancelled;
|
|
||||||
|
|
||||||
id _delegate;
|
|
||||||
|
|
||||||
SBQueueItemStatus _status;
|
|
||||||
NSString *_localizedWorkingDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (nonatomic, readwrite) SBQueueItemStatus status;
|
@property (nonatomic, readwrite) SBQueueItemStatus status;
|
||||||
@property (nonatomic, readonly, nullable) NSString *localizedWorkingDescription;
|
@property (nonatomic, readonly, nullable) NSString *localizedWorkingDescription;
|
||||||
|
|
||||||
@property (nonatomic, readonly, nullable) MP42File *mp4File;
|
@property (nonatomic, readonly, nullable) MP42File *mp4File;
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSURL *URL;
|
@property (nonatomic, readonly) NSURL *fileURL;
|
||||||
@property (nonatomic, copy) NSURL *destURL;
|
@property (nonatomic, copy) NSURL *destURL;
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSArray<id<SBQueueActionProtocol>> *actions;
|
@property (nonatomic, readonly) NSArray<id<SBQueueActionProtocol>> *actions;
|
||||||
@property (nonatomic, readonly) NSDictionary<NSString *, id> *attributes;
|
@property (nonatomic, readonly) NSDictionary<NSString *, id> *attributes;
|
||||||
|
|
||||||
@property (nonatomic, assign, nullable) id delegate;
|
@property (nonatomic, weak, nullable) id delegate;
|
||||||
|
|
||||||
+ (instancetype)itemWithURL:(NSURL *)URL;
|
+ (instancetype)itemWithURL:(NSURL *)URL;
|
||||||
|
|
||||||
|
|||||||
+82
-103
@@ -17,35 +17,22 @@
|
|||||||
|
|
||||||
@interface SBQueueItem ()
|
@interface SBQueueItem ()
|
||||||
|
|
||||||
|
@property (nonatomic, readonly) NSMutableArray<id<SBQueueActionProtocol>> *actionsInternal;
|
||||||
@property (nonatomic, readwrite) NSString *localizedWorkingDescription;
|
@property (nonatomic, readwrite) NSString *localizedWorkingDescription;
|
||||||
|
|
||||||
@property (nonatomic, readwrite, retain) MP42File *mp4File;
|
@property (nonatomic, readwrite, nullable) MP42File *mp4File;
|
||||||
@property (nonatomic, readwrite) NSMutableArray *actionsInternal;
|
@property (atomic, readwrite) BOOL cancelled;
|
||||||
@property (atomic) BOOL cancelled;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SBQueueItem
|
@implementation SBQueueItem
|
||||||
|
|
||||||
@synthesize status = _status;
|
|
||||||
@synthesize localizedWorkingDescription = _localizedWorkingDescription;
|
|
||||||
|
|
||||||
@synthesize attributes = _attributes;
|
|
||||||
@synthesize actionsInternal = _actions;
|
|
||||||
@synthesize cancelled = _cancelled;
|
|
||||||
|
|
||||||
@synthesize URL = _fileURL;
|
|
||||||
@synthesize destURL = _destURL;
|
|
||||||
@synthesize mp4File = _mp4File;
|
|
||||||
|
|
||||||
@synthesize delegate = _delegate;
|
|
||||||
|
|
||||||
#pragma mark Initializers
|
#pragma mark Initializers
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_actions = [[NSMutableArray alloc] init];
|
_actionsInternal = [[NSMutableArray alloc] init];
|
||||||
_status = SBQueueItemStatusReady;
|
_status = SBQueueItemStatusReady;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -54,19 +41,19 @@
|
|||||||
- (instancetype)initWithURL:(NSURL *)URL {
|
- (instancetype)initWithURL:(NSURL *)URL {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_fileURL = [[URL filePathURL] retain];
|
_fileURL = URL.filePathURL;
|
||||||
|
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:[_fileURL path] error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
|
unsigned long long originalFileSize = [[[fileManager attributesOfItemAtPath:_fileURL.path error:nil] valueForKey:NSFileSize] unsignedLongLongValue];
|
||||||
|
|
||||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
if (originalFileSize > ALMOST_4GiB) {
|
if (originalFileSize > ALMOST_4GiB) {
|
||||||
[attributes setObject:@YES forKey:MP4264BitData];
|
attributes[MP4264BitData] = @YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue]) {
|
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue]) {
|
||||||
[attributes setObject:@YES forKey:MP42GenerateChaptersPreviewTrack];
|
attributes[MP42GenerateChaptersPreviewTrack] = @YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
_attributes = [attributes copy];
|
_attributes = [attributes copy];
|
||||||
@@ -76,21 +63,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)itemWithURL:(NSURL *)URL {
|
+ (instancetype)itemWithURL:(NSURL *)URL {
|
||||||
return [[[SBQueueItem alloc] initWithURL:URL] autorelease];
|
return [[SBQueueItem alloc] initWithURL:URL];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithMP4:(MP42File *)MP4 {
|
- (instancetype)initWithMP4:(MP42File *)MP4 {
|
||||||
self = [self init];
|
self = [self init];
|
||||||
if (self) {
|
if (self) {
|
||||||
_mp4File = [MP4 retain];
|
_mp4File = MP4;
|
||||||
|
|
||||||
_fileURL = [[NSURL fileURLWithPath:[MP4.URL path]] retain];
|
_fileURL = [NSURL fileURLWithPath:(MP4.URL).path];
|
||||||
_destURL = [[NSURL fileURLWithPath:[MP4.URL path]] retain];
|
_destURL = [NSURL fileURLWithPath:(MP4.URL).path];
|
||||||
|
|
||||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue]) {
|
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"chaptersPreviewTrack"] boolValue]) {
|
||||||
[attributes setObject:@YES forKey:MP42GenerateChaptersPreviewTrack];
|
attributes[MP42GenerateChaptersPreviewTrack] = @YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
_attributes = [attributes copy];
|
_attributes = [attributes copy];
|
||||||
@@ -100,12 +87,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)itemWithMP4:(MP42File *)MP4 {
|
+ (instancetype)itemWithMP4:(MP42File *)MP4 {
|
||||||
return [[[SBQueueItem alloc] initWithMP4:MP4] autorelease];
|
return [[SBQueueItem alloc] initWithMP4:MP4];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithMP4:(MP42File *)MP4 url:(NSURL *)URL attributes:(NSDictionary *)dict {
|
- (instancetype)initWithMP4:(MP42File *)MP4 url:(NSURL *)URL attributes:(NSDictionary *)dict {
|
||||||
if (self = [self init]) {
|
if (self = [self init]) {
|
||||||
_mp4File = [MP4 retain];
|
_mp4File = MP4;
|
||||||
|
|
||||||
_fileURL = [URL copy];
|
_fileURL = [URL copy];
|
||||||
_destURL = [URL copy];
|
_destURL = [URL copy];
|
||||||
@@ -117,7 +104,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)itemWithMP4:(MP42File *)MP4 destinationURL:(NSURL *)destURL attributes:(NSDictionary *)dict {
|
+ (instancetype)itemWithMP4:(MP42File *)MP4 destinationURL:(NSURL *)destURL attributes:(NSDictionary *)dict {
|
||||||
return [[[SBQueueItem alloc] initWithMP4:MP4 url:destURL attributes:dict] autorelease];
|
return [[SBQueueItem alloc] initWithMP4:MP4 url:destURL attributes:dict];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark KVO
|
#pragma mark KVO
|
||||||
@@ -160,13 +147,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray *)actions {
|
- (NSArray *)actions {
|
||||||
return [[self.actionsInternal copy] autorelease];
|
return [self.actionsInternal copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark Item processing
|
#pragma mark Item processing
|
||||||
|
|
||||||
- (BOOL)prepare:(NSError **)outError {
|
- (BOOL)prepare:(NSError * __autoreleasing *)outError {
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:[self.URL path]]) {
|
if (![[NSFileManager defaultManager] fileExistsAtPath:self.fileURL.path]) {
|
||||||
if (outError) {
|
if (outError) {
|
||||||
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"File not found",
|
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"File not found",
|
||||||
NSLocalizedRecoverySuggestionErrorKey : @"The source file couldn't be found." };
|
NSLocalizedRecoverySuggestionErrorKey : @"The source file couldn't be found." };
|
||||||
@@ -176,29 +163,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *type;
|
NSString *type;
|
||||||
[self.URL getResourceValue:&type forKey:NSURLTypeIdentifierKey error:outError];
|
[self.fileURL getResourceValue:&type forKey:NSURLTypeIdentifierKey error:outError];
|
||||||
|
|
||||||
if ([type isEqualToString:@"com.apple.m4a-audio"] || [type isEqualToString:@"com.apple.m4v-video"] || [type isEqualToString:@"public.mpeg-4"]) {
|
if ([type isEqualToString:@"com.apple.m4a-audio"] || [type isEqualToString:@"com.apple.m4v-video"] || [type isEqualToString:@"public.mpeg-4"]) {
|
||||||
self.mp4File = [[[MP42File alloc] initWithURL:self.URL] autorelease];
|
self.mp4File = [[MP42File alloc] initWithURL:self.fileURL];
|
||||||
} else {
|
} else {
|
||||||
self.mp4File = [[[MP42File alloc] init] autorelease];
|
self.mp4File = [[MP42File alloc] init];
|
||||||
MP42FileImporter *fileImporter = [[MP42FileImporter alloc] initWithURL:self.URL error:outError];
|
MP42FileImporter *fileImporter = [[MP42FileImporter alloc] initWithURL:self.fileURL error:outError];
|
||||||
|
|
||||||
for (MP42Track *track in fileImporter.tracks) {
|
for (MP42Track *track in fileImporter.tracks) {
|
||||||
// AC-3 track, we might need to do the aac + ac3 trick.
|
// AC-3 track, we might need to do the aac + ac3 trick.
|
||||||
if ([track.format isEqualToString:MP42AudioFormatAC3]) {
|
if ([track.format isEqualToString:MP42AudioFormatAC3]) {
|
||||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioConvertAC3"] boolValue]) {
|
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioConvertAC3"] boolValue]) {
|
||||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioKeepAC3"] boolValue] &&
|
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioKeepAC3"] boolValue] &&
|
||||||
![(MP42AudioTrack *)track fallbackTrack]) {
|
!((MP42AudioTrack *)track).fallbackTrack) {
|
||||||
MP42AudioTrack *copy = [track copy];
|
MP42AudioTrack *copy = [track copy];
|
||||||
copy.needConversion = YES;
|
copy.needConversion = YES;
|
||||||
copy.mixdownType = SBDolbyPlIIMixdown;
|
copy.mixdownType = SBDolbyPlIIMixdown;
|
||||||
|
|
||||||
[(MP42AudioTrack *)track setFallbackTrack:copy];
|
((MP42AudioTrack *)track).fallbackTrack = copy;
|
||||||
|
|
||||||
[self.mp4File addTrack:copy];
|
[self.mp4File addTrack:copy];
|
||||||
|
|
||||||
[copy release];
|
|
||||||
} else {
|
} else {
|
||||||
track.needConversion = YES;
|
track.needConversion = YES;
|
||||||
}
|
}
|
||||||
@@ -215,7 +201,6 @@
|
|||||||
|
|
||||||
[self.mp4File addTrack:copy];
|
[self.mp4File addTrack:copy];
|
||||||
|
|
||||||
[copy release];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
track.needConversion = YES;
|
track.needConversion = YES;
|
||||||
@@ -256,7 +241,6 @@
|
|||||||
[self.mp4File addTrack:track];
|
[self.mp4File addTrack:track];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[fileImporter release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (id<SBQueueActionProtocol> action in self.actions) {
|
for (id<SBQueueActionProtocol> action in self.actions) {
|
||||||
@@ -270,7 +254,7 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)processWithOptions:(BOOL)optimize error:(NSError **)outError {
|
- (BOOL)processWithOptions:(BOOL)optimize error:(NSError * __autoreleasing *)outError {
|
||||||
BOOL noErr = YES;
|
BOOL noErr = YES;
|
||||||
|
|
||||||
#ifdef SB_SANDBOX
|
#ifdef SB_SANDBOX
|
||||||
@@ -279,67 +263,71 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The file has been added directly to the queue
|
// The file has been added directly to the queue
|
||||||
if (!self.mp4File && self.URL) {
|
if (!self.mp4File && self.fileURL) {
|
||||||
noErr = [self prepare:outError];
|
noErr = [self prepare:outError];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noErr) { goto bail; }
|
if (!noErr) { goto bail; }
|
||||||
|
|
||||||
self.mp4File.progressHandler = ^(double progress){
|
{
|
||||||
[self progressStatus:progress];
|
__weak SBQueueItem *weakSelf = self;
|
||||||
};
|
self.mp4File.progressHandler = ^(double progress){
|
||||||
|
[weakSelf progressStatus:progress];
|
||||||
|
};
|
||||||
|
|
||||||
// Check if there is enough space on the destination disk
|
// Check if there is enough space on the destination disk
|
||||||
if (![self.URL isEqualTo:self.destURL]) {
|
if (![self.fileURL isEqualTo:self.destURL]) {
|
||||||
NSDictionary *dict = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[[self.destURL URLByDeletingLastPathComponent] path] error:NULL];
|
NSDictionary *dict = [[NSFileManager defaultManager] attributesOfFileSystemForPath:(self.destURL).URLByDeletingLastPathComponent.path error:NULL];
|
||||||
NSNumber *freeSpace = [dict objectForKey:NSFileSystemFreeSize];
|
NSNumber *freeSpace = dict[NSFileSystemFreeSize];
|
||||||
if (freeSpace && [self.mp4File dataSize] > [freeSpace longLongValue]) {
|
if (freeSpace && (self.mp4File).dataSize > freeSpace.longLongValue) {
|
||||||
noErr = NO;
|
noErr = NO;
|
||||||
if (outError) {
|
if (outError) {
|
||||||
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"Not enough disk space",
|
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"Not enough disk space",
|
||||||
NSLocalizedRecoverySuggestionErrorKey : @"" };
|
NSLocalizedRecoverySuggestionErrorKey : @"" };
|
||||||
*outError = [NSError errorWithDomain:@"SBQueueItemError" code:12 userInfo:errorDetail];
|
*outError = [NSError errorWithDomain:@"SBQueueItemError" code:12 userInfo:errorDetail];
|
||||||
|
}
|
||||||
|
goto bail;
|
||||||
}
|
}
|
||||||
goto bail;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Convert from a file reference url to a normal url
|
// Convert from a file reference url to a normal url
|
||||||
// the file will be replaced if optimized, and the reference url
|
// the file will be replaced if optimized, and the reference url
|
||||||
// may point to nil
|
// may point to nil
|
||||||
[self willChangeValueForKey:@"fileURL"];
|
[self willChangeValueForKey:@"fileURL"];
|
||||||
[_fileURL autorelease];
|
_fileURL = self.fileURL.filePathURL;
|
||||||
_fileURL = [[self.URL filePathURL] retain];
|
[self didChangeValueForKey:@"fileURL"];
|
||||||
[self didChangeValueForKey:@"fileURL"];
|
|
||||||
|
|
||||||
if (!self.cancelled) {
|
if (!self.cancelled) {
|
||||||
if ([self.URL isEqualTo:self.destURL] && [self.mp4File hasFileRepresentation]) {
|
if ([self.fileURL isEqualTo:self.destURL] && (self.mp4File).hasFileRepresentation) {
|
||||||
// We have an existing mp4 file, update it
|
// We have an existing mp4 file, update it
|
||||||
noErr = [self.mp4File updateMP4FileWithOptions:self.attributes error:outError];
|
noErr = [self.mp4File updateMP4FileWithOptions:self.attributes error:outError];
|
||||||
} else {
|
} else {
|
||||||
// Write the new file to disk
|
// Write the new file to disk
|
||||||
noErr = [self.mp4File writeToUrl:self.destURL
|
noErr = [self.mp4File writeToUrl:self.destURL
|
||||||
options:self.attributes
|
options:self.attributes
|
||||||
error:outError];
|
error:outError];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noErr) { goto bail; }
|
if (!noErr) { goto bail; }
|
||||||
|
|
||||||
// Optimize the file
|
{
|
||||||
if (!self.cancelled && optimize) {
|
// Optimize the file
|
||||||
self.localizedWorkingDescription = NSLocalizedString(@"Optimizing", @"");
|
if (!self.cancelled && optimize) {
|
||||||
noErr = [self.mp4File optimize];
|
self.localizedWorkingDescription = NSLocalizedString(@"Optimizing", @"");
|
||||||
self.localizedWorkingDescription = nil;
|
noErr = [self.mp4File optimize];
|
||||||
}
|
self.localizedWorkingDescription = nil;
|
||||||
|
}
|
||||||
if (!noErr) {
|
|
||||||
if (outError) {
|
if (!noErr) {
|
||||||
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"The file couldn't be optimized",
|
if (outError) {
|
||||||
NSLocalizedRecoverySuggestionErrorKey : @"An error occurred while optimizing the file." };
|
NSDictionary *errorDetail = @{ NSLocalizedDescriptionKey : @"The file couldn't be optimized",
|
||||||
*outError = [NSError errorWithDomain:@"SBQueueItemError" code:11 userInfo:errorDetail];
|
NSLocalizedRecoverySuggestionErrorKey : @"An error occurred while optimizing the file." };
|
||||||
|
*outError = [NSError errorWithDomain:@"SBQueueItemError" code:11 userInfo:errorDetail];
|
||||||
|
}
|
||||||
|
goto bail;
|
||||||
}
|
}
|
||||||
goto bail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
@@ -376,34 +364,25 @@ bail:
|
|||||||
[coder encodeObject:_fileURL forKey:@"SBQueueItemFileURL"];
|
[coder encodeObject:_fileURL forKey:@"SBQueueItemFileURL"];
|
||||||
[coder encodeObject:_destURL forKey:@"SBQueueItemDestURL"];
|
[coder encodeObject:_destURL forKey:@"SBQueueItemDestURL"];
|
||||||
[coder encodeObject:_attributes forKey:@"SBQueueItemAttributes"];
|
[coder encodeObject:_attributes forKey:@"SBQueueItemAttributes"];
|
||||||
[coder encodeObject:_actions forKey:@"SBQueueItemActions"];
|
[coder encodeObject:_actionsInternal forKey:@"SBQueueItemActions"];
|
||||||
|
|
||||||
[coder encodeInt:_status forKey:@"SBQueueItemStatus"];
|
[coder encodeInt:_status forKey:@"SBQueueItemStatus"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithCoder:(NSCoder *)decoder {
|
- (instancetype)initWithCoder:(NSCoder *)decoder {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
_mp4File = [[decoder decodeObjectForKey:@"SBQueueItemMp4File"] retain];
|
_mp4File = [decoder decodeObjectForKey:@"SBQueueItemMp4File"];
|
||||||
|
|
||||||
_fileURL = [[decoder decodeObjectForKey:@"SBQueueItemFileURL"] retain];
|
_fileURL = [decoder decodeObjectForKey:@"SBQueueItemFileURL"];
|
||||||
_destURL = [[decoder decodeObjectForKey:@"SBQueueItemDestURL"] retain];
|
_destURL = [decoder decodeObjectForKey:@"SBQueueItemDestURL"];
|
||||||
_attributes = [[decoder decodeObjectForKey:@"SBQueueItemAttributes"] retain];
|
_attributes = [decoder decodeObjectForKey:@"SBQueueItemAttributes"];
|
||||||
_actions = [[decoder decodeObjectForKey:@"SBQueueItemActions"] retain];
|
_actionsInternal = [decoder decodeObjectForKey:@"SBQueueItemActions"];
|
||||||
|
|
||||||
_status = [decoder decodeIntForKey:@"SBQueueItemStatus"];
|
_status = [decoder decodeIntForKey:@"SBQueueItemStatus"];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[_attributes release];
|
|
||||||
[_actions release];
|
|
||||||
[_fileURL release];
|
|
||||||
[_destURL release];
|
|
||||||
[_mp4File release];
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -33,7 +33,7 @@ extern NSString * const SBQueueDestination;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSMutableDictionary *options;
|
@property (nonatomic, readonly) NSMutableDictionary *options;
|
||||||
@property (nonatomic, readonly, nullable) NSURL *queueURL;
|
@property (weak, nonatomic, readonly, nullable) NSURL *queueURL;
|
||||||
|
|
||||||
+ (void)registerUserDefaults;
|
+ (void)registerUserDefaults;
|
||||||
- (void)saveUserDefaults;
|
- (void)saveUserDefaults;
|
||||||
|
|||||||
@@ -41,17 +41,17 @@ NSString * const SBQueueSet = @"SBQueueSet";
|
|||||||
SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage];
|
SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage];
|
||||||
|
|
||||||
[keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
[keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
[_options setObject:[[NSUserDefaults standardUserDefaults] valueForKey:obj] forKey:obj];
|
self.options[obj] = [[NSUserDefaults standardUserDefaults] valueForKey:obj];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if ([[NSUserDefaults standardUserDefaults] valueForKey:SBQueueDestination]) {
|
if ([[NSUserDefaults standardUserDefaults] valueForKey:SBQueueDestination]) {
|
||||||
[_options setObject:[NSURL fileURLWithPath:[[NSUserDefaults standardUserDefaults] valueForKey:SBQueueDestination]] forKey:SBQueueDestination];
|
self.options[SBQueueDestination] = [NSURL fileURLWithPath:[[NSUserDefaults standardUserDefaults] valueForKey:SBQueueDestination]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[NSUserDefaults standardUserDefaults] valueForKey:SBQueueSet]) {
|
if ([[NSUserDefaults standardUserDefaults] valueForKey:SBQueueSet]) {
|
||||||
MP42Metadata *set = [[SBPresetManager sharedManager] setWithName:[[NSUserDefaults standardUserDefaults] valueForKey:SBQueueSet]];
|
MP42Metadata *set = [[SBPresetManager sharedManager] setWithName:[[NSUserDefaults standardUserDefaults] valueForKey:SBQueueSet]];
|
||||||
if (set) {
|
if (set) {
|
||||||
[_options setObject:set forKey:SBQueueSet];
|
self.options[SBQueueSet] = set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,11 +81,11 @@ NSString * const SBQueueSet = @"SBQueueSet";
|
|||||||
SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage];
|
SBQueueMovieProvider, SBQueueTVShowProvider, SBQueueMovieProviderLanguage, SBQueueTVShowProviderLanguage];
|
||||||
|
|
||||||
[keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
[keys enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[self.options objectForKey:obj] forKey:obj];
|
[[NSUserDefaults standardUserDefaults] setValue:(self.options)[obj] forKey:obj];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[[self.options objectForKey:SBQueueDestination] path] forKey:SBQueueDestination];
|
[[NSUserDefaults standardUserDefaults] setValue:[(self.options)[SBQueueDestination] path] forKey:SBQueueDestination];
|
||||||
[[NSUserDefaults standardUserDefaults] setValue:[[self.options objectForKey:SBQueueSet] presetName] forKey:SBQueueSet];
|
[[NSUserDefaults standardUserDefaults] setValue:[(self.options)[SBQueueSet] presetName] forKey:SBQueueSet];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable NSURL *)queueURL {
|
- (nullable NSURL *)queueURL {
|
||||||
@@ -94,7 +94,7 @@ NSString * const SBQueueSet = @"SBQueueSet";
|
|||||||
NSUserDomainMask,
|
NSUserDomainMask,
|
||||||
YES);
|
YES);
|
||||||
if (allPaths.count) {
|
if (allPaths.count) {
|
||||||
appSupportURL = [NSURL fileURLWithPath:[[[allPaths lastObject] stringByAppendingPathComponent:@"Subler"]
|
appSupportURL = [NSURL fileURLWithPath:[[allPaths.lastObject stringByAppendingPathComponent:@"Subler"]
|
||||||
stringByAppendingPathComponent:@"queue.sbqueue"] isDirectory:YES];
|
stringByAppendingPathComponent:@"queue.sbqueue"] isDirectory:YES];
|
||||||
return appSupportURL;
|
return appSupportURL;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -22,12 +22,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
row:(NSInteger)row;
|
row:(NSInteger)row;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface SBTableView : NSTableView {
|
@interface SBTableView : NSTableView
|
||||||
NSArray<NSString *> *_pasteboardTypes;
|
|
||||||
NSInteger _defaultEditingColumn;
|
@property (nonatomic, readwrite, copy) NSArray<NSString *> *pasteboardTypes;
|
||||||
}
|
@property (nonatomic, readwrite) NSInteger defaultEditingColumn;
|
||||||
@property(nonatomic, readwrite, copy) NSArray<NSString *> *pasteboardTypes;
|
|
||||||
@property(nonatomic, readwrite) NSInteger defaultEditingColumn;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
+31
-42
@@ -11,14 +11,11 @@
|
|||||||
|
|
||||||
@implementation SBTableView
|
@implementation SBTableView
|
||||||
|
|
||||||
@synthesize defaultEditingColumn = _defaultEditingColumn;
|
|
||||||
@synthesize pasteboardTypes = _pasteboardTypes;
|
|
||||||
|
|
||||||
- (instancetype)initWithFrame:(NSRect)frame
|
- (instancetype)initWithFrame:(NSRect)frame
|
||||||
{
|
{
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
if (self) {
|
if (self) {
|
||||||
_pasteboardTypes = [@[] retain];
|
_pasteboardTypes = @[];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -27,34 +24,34 @@
|
|||||||
{
|
{
|
||||||
self = [super initWithCoder:coder];
|
self = [super initWithCoder:coder];
|
||||||
if (self) {
|
if (self) {
|
||||||
_pasteboardTypes = [@[] retain];
|
_pasteboardTypes = @[];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)keyDown:(NSEvent *)event
|
- (void)keyDown:(NSEvent *)event
|
||||||
{
|
{
|
||||||
id delegate = [self delegate];
|
id delegate = self.delegate;
|
||||||
|
|
||||||
unichar key = 0;
|
unichar key = 0;
|
||||||
NSString *characters = [event charactersIgnoringModifiers];
|
NSString *characters = event.charactersIgnoringModifiers;
|
||||||
if (characters.length) {
|
if (characters.length) {
|
||||||
key = [characters characterAtIndex:0];
|
key = [characters characterAtIndex:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((key == NSEnterCharacter || key == NSCarriageReturnCharacter) &&
|
if ((key == NSEnterCharacter || key == NSCarriageReturnCharacter) &&
|
||||||
_defaultEditingColumn > 0) {
|
_defaultEditingColumn > 0) {
|
||||||
[self editColumn:_defaultEditingColumn row:[self selectedRow] withEvent:nil select:YES];
|
[self editColumn:_defaultEditingColumn row:self.selectedRow withEvent:nil select:YES];
|
||||||
[self editColumn:1 row:[self selectedRow] withEvent:nil select:YES];
|
[self editColumn:1 row:self.selectedRow withEvent:nil select:YES];
|
||||||
} else if ((key == NSDeleteCharacter || key == NSDeleteFunctionKey) &&
|
} else if ((key == NSDeleteCharacter || key == NSDeleteFunctionKey) &&
|
||||||
[delegate respondsToSelector:@selector(_deleteSelectionFromTableView:)]) {
|
[delegate respondsToSelector:@selector(_deleteSelectionFromTableView:)]) {
|
||||||
if ([self selectedRow] == -1) {
|
if (self.selectedRow == -1) {
|
||||||
NSBeep();
|
NSBeep();
|
||||||
} else {
|
} else {
|
||||||
[delegate _deleteSelectionFromTableView:self];
|
[delegate _deleteSelectionFromTableView:self];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (key == 27 && [self selectedRow] != -1) {
|
} else if (key == 27 && self.selectedRow != -1) {
|
||||||
[self deselectAll:self];
|
[self deselectAll:self];
|
||||||
} else {
|
} else {
|
||||||
[super keyDown:event];
|
[super keyDown:event];
|
||||||
@@ -63,29 +60,29 @@
|
|||||||
|
|
||||||
- (IBAction)delete:(id)sender
|
- (IBAction)delete:(id)sender
|
||||||
{
|
{
|
||||||
if ([self selectedRow] == -1)
|
if (self.selectedRow == -1)
|
||||||
return;
|
return;
|
||||||
else if ([[self delegate] respondsToSelector:@selector(_deleteSelectionFromTableView:)])
|
else if ([self.delegate respondsToSelector:@selector(_deleteSelectionFromTableView:)])
|
||||||
[(id <SBTableViewDelegate>)[self delegate] _deleteSelectionFromTableView:self];
|
[(id <SBTableViewDelegate>)self.delegate _deleteSelectionFromTableView:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)copy:(id)sender {
|
- (IBAction)copy:(id)sender {
|
||||||
if ([self selectedRow] == -1)
|
if (self.selectedRow == -1)
|
||||||
return;
|
return;
|
||||||
else if ([[self delegate] respondsToSelector:@selector(_copySelectionFromTableView:)])
|
else if ([self.delegate respondsToSelector:@selector(_copySelectionFromTableView:)])
|
||||||
[(id <SBTableViewDelegate>)[self delegate] _copySelectionFromTableView:self];
|
[(id <SBTableViewDelegate>)self.delegate _copySelectionFromTableView:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)cut:(id)sender {
|
- (IBAction)cut:(id)sender {
|
||||||
if ([self selectedRow] == -1)
|
if (self.selectedRow == -1)
|
||||||
return;
|
return;
|
||||||
else if ([[self delegate] respondsToSelector:@selector(_cutSelectionFromTableView:)])
|
else if ([self.delegate respondsToSelector:@selector(_cutSelectionFromTableView:)])
|
||||||
[(id <SBTableViewDelegate>)[self delegate] _cutSelectionFromTableView:self];
|
[(id <SBTableViewDelegate>)self.delegate _cutSelectionFromTableView:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)paste:(id)sender {
|
- (IBAction)paste:(id)sender {
|
||||||
if ([[self delegate] respondsToSelector:@selector(_pasteToTableView:)])
|
if ([self.delegate respondsToSelector:@selector(_pasteToTableView:)])
|
||||||
[(id <SBTableViewDelegate>)[self delegate] _pasteToTableView:self];
|
[(id <SBTableViewDelegate>)self.delegate _pasteToTableView:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)pasteboardHasSupportedType {
|
- (BOOL)pasteboardHasSupportedType {
|
||||||
@@ -97,21 +94,21 @@
|
|||||||
|
|
||||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||||
{
|
{
|
||||||
id delegate = [self delegate];
|
id delegate = self.delegate;
|
||||||
SEL action = [item action];
|
SEL action = item.action;
|
||||||
|
|
||||||
if (action == @selector(delete:))
|
if (action == @selector(delete:))
|
||||||
if ([self selectedRow] == -1 ||
|
if (self.selectedRow == -1 ||
|
||||||
![delegate respondsToSelector:@selector(_deleteSelectionFromTableView:)])
|
![delegate respondsToSelector:@selector(_deleteSelectionFromTableView:)])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
if (action == @selector(copy:))
|
if (action == @selector(copy:))
|
||||||
if ([self selectedRow] == -1 ||
|
if (self.selectedRow == -1 ||
|
||||||
![delegate respondsToSelector:@selector(_copySelectionFromTableView:)])
|
![delegate respondsToSelector:@selector(_copySelectionFromTableView:)])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
if (action == @selector(cut:))
|
if (action == @selector(cut:))
|
||||||
if ([self selectedRow] == -1 ||
|
if (self.selectedRow == -1 ||
|
||||||
![delegate respondsToSelector:@selector(_cutSelectionFromTableView:)])
|
![delegate respondsToSelector:@selector(_cutSelectionFromTableView:)])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
@@ -125,14 +122,14 @@
|
|||||||
|
|
||||||
- (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row
|
- (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row
|
||||||
{
|
{
|
||||||
if (![[self delegate] respondsToSelector:@selector(tableView:spanForTableColumn:row:)]) {
|
if (![self.delegate respondsToSelector:@selector(tableView:spanForTableColumn:row:)]) {
|
||||||
return [super frameOfCellAtColumn:column row:row];
|
return [super frameOfCellAtColumn:column row:row];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSInteger colspan = [(id <SBTableViewDelegate>)[self delegate]
|
NSInteger colspan = [(id <SBTableViewDelegate>)self.delegate
|
||||||
tableView:self
|
tableView:self
|
||||||
spanForTableColumn:
|
spanForTableColumn:
|
||||||
[[self tableColumns] objectAtIndex:column]
|
self.tableColumns[column]
|
||||||
row:row];
|
row:row];
|
||||||
if (colspan == 0) {
|
if (colspan == 0) {
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
@@ -156,14 +153,14 @@
|
|||||||
{
|
{
|
||||||
NSRect newClipRect = inClipRect;
|
NSRect newClipRect = inClipRect;
|
||||||
|
|
||||||
if ([[self delegate] respondsToSelector:@selector(tableView:spanForTableColumn:row:)]) {
|
if ([self.delegate respondsToSelector:@selector(tableView:spanForTableColumn:row:)]) {
|
||||||
NSInteger colspan = 0;
|
NSInteger colspan = 0;
|
||||||
NSInteger firstCol = [[self columnIndexesInRect:inClipRect] firstIndex];
|
NSInteger firstCol = [self columnIndexesInRect:inClipRect].firstIndex;
|
||||||
// Does the FIRST one of these have a zero-colspan? If so, extend range.
|
// Does the FIRST one of these have a zero-colspan? If so, extend range.
|
||||||
while (colspan == 0) {
|
while (colspan == 0) {
|
||||||
colspan = [(id <SBTableViewDelegate>)[self delegate]
|
colspan = [(id <SBTableViewDelegate>)self.delegate
|
||||||
tableView:self
|
tableView:self
|
||||||
spanForTableColumn:[[self tableColumns] objectAtIndex:firstCol]
|
spanForTableColumn:self.tableColumns[firstCol]
|
||||||
row:inRow];
|
row:inRow];
|
||||||
if (colspan == 0) {
|
if (colspan == 0) {
|
||||||
firstCol--;
|
firstCol--;
|
||||||
@@ -175,12 +172,4 @@
|
|||||||
[super drawRow:inRow clipRect:newClipRect];
|
[super drawRow:inRow clipRect:newClipRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[_pasteboardTypes release];
|
|
||||||
_pasteboardTypes = nil;
|
|
||||||
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+7
-7
@@ -14,8 +14,8 @@
|
|||||||
{
|
{
|
||||||
if (viewController)
|
if (viewController)
|
||||||
{
|
{
|
||||||
NSResponder *controllerNextResponder = [viewController nextResponder];
|
NSResponder *controllerNextResponder = viewController.nextResponder;
|
||||||
[super setNextResponder:controllerNextResponder];
|
super.nextResponder = controllerNextResponder;
|
||||||
[viewController setNextResponder:nil];
|
[viewController setNextResponder:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
if (newController)
|
if (newController)
|
||||||
{
|
{
|
||||||
NSResponder *ownNextResponder = [self nextResponder];
|
NSResponder *ownNextResponder = self.nextResponder;
|
||||||
[super setNextResponder: viewController];
|
super.nextResponder = viewController;
|
||||||
[viewController setNextResponder:ownNextResponder];
|
viewController.nextResponder = ownNextResponder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,11 +33,11 @@
|
|||||||
{
|
{
|
||||||
if (viewController)
|
if (viewController)
|
||||||
{
|
{
|
||||||
[viewController setNextResponder:newNextResponder];
|
viewController.nextResponder = newNextResponder;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[super setNextResponder:newNextResponder];
|
super.nextResponder = newNextResponder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+9
-20
@@ -1,17 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="15A282a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15G12a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="SBQueueController">
|
<customObject id="-2" userLabel="File's Owner" customClass="SBQueueController">
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="_countLabel" destination="12" id="BMB-K6-Foo"/>
|
|
||||||
<outlet property="_detachedWindow" destination="zHc-NF-Zeh" id="Cr1-ha-Wmx"/>
|
<outlet property="_detachedWindow" destination="zHc-NF-Zeh" id="Cr1-ha-Wmx"/>
|
||||||
<outlet property="_progressIndicator" destination="91" id="Kds-4b-YzV"/>
|
<outlet property="detachedWindow" destination="zHc-NF-Zeh" id="GMJ-fz-AdQ"/>
|
||||||
<outlet property="_startItem" destination="xBN-FT-Sv0" id="Pyh-8B-bce"/>
|
<outlet property="progressBar" destination="91" id="Pyo-9s-F6Q"/>
|
||||||
<outlet property="_tableView" destination="7" id="N5e-Ro-a6f"/>
|
<outlet property="startItem" destination="xBN-FT-Sv0" id="HEs-6f-5RT"/>
|
||||||
|
<outlet property="statusLabel" destination="12" id="VYp-DC-guz"/>
|
||||||
|
<outlet property="table" destination="7" id="KrN-pl-mlK"/>
|
||||||
<outlet property="window" destination="1" id="25"/>
|
<outlet property="window" destination="1" id="25"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
@@ -37,7 +38,6 @@
|
|||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveColumns="NO" id="7" customClass="SBTableView">
|
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveColumns="NO" id="7" customClass="SBTableView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="378" height="21"/>
|
<rect key="frame" x="0.0" y="0.0" width="378" height="21"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<animations/>
|
|
||||||
<size key="intercellSpacing" width="3" height="4"/>
|
<size key="intercellSpacing" width="3" height="4"/>
|
||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||||
@@ -89,25 +89,20 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</tableView>
|
</tableView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<animations/>
|
|
||||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
</clipView>
|
</clipView>
|
||||||
<animations/>
|
|
||||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="6">
|
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="6">
|
||||||
<rect key="frame" x="1" y="270" width="378" height="16"/>
|
<rect key="frame" x="1" y="270" width="378" height="16"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<animations/>
|
|
||||||
</scroller>
|
</scroller>
|
||||||
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="4">
|
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="4">
|
||||||
<rect key="frame" x="543" y="1" width="15" height="275"/>
|
<rect key="frame" x="543" y="1" width="15" height="275"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<animations/>
|
|
||||||
</scroller>
|
</scroller>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
<textField verticalHuggingPriority="750" id="12">
|
<textField verticalHuggingPriority="750" id="12">
|
||||||
<rect key="frame" x="8" y="15" width="214" height="17"/>
|
<rect key="frame" x="8" y="15" width="214" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<animations/>
|
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Queue items" id="13">
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Queue items" id="13">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
@@ -117,10 +112,8 @@
|
|||||||
<progressIndicator wantsLayer="YES" maxValue="100" indeterminate="YES" style="bar" id="91">
|
<progressIndicator wantsLayer="YES" maxValue="100" indeterminate="YES" style="bar" id="91">
|
||||||
<rect key="frame" x="228" y="13" width="140" height="20"/>
|
<rect key="frame" x="228" y="13" width="140" height="20"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||||
<animations/>
|
|
||||||
</progressIndicator>
|
</progressIndicator>
|
||||||
</subviews>
|
</subviews>
|
||||||
<animations/>
|
|
||||||
</view>
|
</view>
|
||||||
<toolbar key="toolbar" implicitIdentifier="7CCC4E53-430A-4EDF-8C9B-E7533A5972A1" autosavesConfiguration="NO" displayMode="iconOnly" sizeMode="regular" id="DiU-kc-8B9">
|
<toolbar key="toolbar" implicitIdentifier="7CCC4E53-430A-4EDF-8C9B-E7533A5972A1" autosavesConfiguration="NO" displayMode="iconOnly" sizeMode="regular" id="DiU-kc-8B9">
|
||||||
<allowedToolbarItems>
|
<allowedToolbarItems>
|
||||||
@@ -128,9 +121,8 @@
|
|||||||
<size key="minSize" width="34" height="25"/>
|
<size key="minSize" width="34" height="25"/>
|
||||||
<size key="maxSize" width="34" height="25"/>
|
<size key="maxSize" width="34" height="25"/>
|
||||||
<button key="view" verticalHuggingPriority="750" id="Ki3-3j-eme">
|
<button key="view" verticalHuggingPriority="750" id="Ki3-3j-eme">
|
||||||
<rect key="frame" x="11" y="14" width="34" height="25"/>
|
<rect key="frame" x="10" y="14" width="34" height="25"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<animations/>
|
|
||||||
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSAddTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yNX-m3-ctU">
|
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSAddTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yNX-m3-ctU">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -144,9 +136,8 @@
|
|||||||
<size key="minSize" width="34" height="25"/>
|
<size key="minSize" width="34" height="25"/>
|
||||||
<size key="maxSize" width="34" height="25"/>
|
<size key="maxSize" width="34" height="25"/>
|
||||||
<button key="view" verticalHuggingPriority="750" id="Eam-QC-F1x">
|
<button key="view" verticalHuggingPriority="750" id="Eam-QC-F1x">
|
||||||
<rect key="frame" x="8" y="14" width="34" height="25"/>
|
<rect key="frame" x="9" y="14" width="34" height="25"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<animations/>
|
|
||||||
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSActionTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="evW-R0-8UU">
|
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSActionTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="evW-R0-8UU">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -162,7 +153,6 @@
|
|||||||
<button key="view" verticalHuggingPriority="750" id="cSb-W5-RNU">
|
<button key="view" verticalHuggingPriority="750" id="cSb-W5-RNU">
|
||||||
<rect key="frame" x="0.0" y="14" width="34" height="25"/>
|
<rect key="frame" x="0.0" y="14" width="34" height="25"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<animations/>
|
|
||||||
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="playBackTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="oYX-z0-L7h">
|
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="playBackTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="oYX-z0-L7h">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -225,7 +215,6 @@
|
|||||||
<view key="contentView" id="hhb-jZ-DWa">
|
<view key="contentView" id="hhb-jZ-DWa">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="334" height="282"/>
|
<rect key="frame" x="0.0" y="0.0" width="334" height="282"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<animations/>
|
|
||||||
</view>
|
</view>
|
||||||
</window>
|
</window>
|
||||||
</objects>
|
</objects>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10109" systemVersion="15E39d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15G12a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10109"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="SBDocument">
|
<customObject id="-2" userLabel="File's Owner" customClass="SBDocument">
|
||||||
@@ -12,20 +12,20 @@
|
|||||||
<outlet property="addTracks" destination="100247" id="100251"/>
|
<outlet property="addTracks" destination="100247" id="100251"/>
|
||||||
<outlet property="cancelSave" destination="100252" id="100255"/>
|
<outlet property="cancelSave" destination="100252" id="100255"/>
|
||||||
<outlet property="deleteTrack" destination="100164" id="100170"/>
|
<outlet property="deleteTrack" destination="100164" id="100170"/>
|
||||||
<outlet property="documentWindow" destination="5" id="100064"/>
|
<outlet property="documentWindow" destination="5" id="AIQ-Aj-grJ"/>
|
||||||
<outlet property="fileFormat" destination="100215" id="100225"/>
|
<outlet property="fileFormat" destination="100215" id="100225"/>
|
||||||
<outlet property="fileTracksTable" destination="100031" id="100037"/>
|
|
||||||
<outlet property="offset" destination="100275" id="100288"/>
|
<outlet property="offset" destination="100275" id="100288"/>
|
||||||
<outlet property="offsetWindow" destination="100271" id="100285"/>
|
<outlet property="offsetWindow" destination="100271" id="100285"/>
|
||||||
<outlet property="optBar" destination="100179" id="100181"/>
|
<outlet property="progressBar" destination="100179" id="21T-ul-KQu"/>
|
||||||
<outlet property="saveOperationName" destination="100177" id="100186"/>
|
<outlet property="saveOperationName" destination="100177" id="OuQ-yM-1z7"/>
|
||||||
<outlet property="saveView" destination="100187" id="100192"/>
|
<outlet property="saveView" destination="100187" id="100192"/>
|
||||||
<outlet property="savingWindow" destination="100175" id="100180"/>
|
<outlet property="saveWindow" destination="100175" id="lQR-rJ-S5i"/>
|
||||||
<outlet property="searchChapters" destination="3A7-gZ-0ev" id="ntV-rn-nkt"/>
|
<outlet property="searchChapters" destination="3A7-gZ-0ev" id="ntV-rn-nkt"/>
|
||||||
<outlet property="searchMetadata" destination="100302" id="100310"/>
|
<outlet property="searchMetadata" destination="100302" id="100310"/>
|
||||||
<outlet property="sendToQueue" destination="100312" id="100316"/>
|
<outlet property="sendToQueue" destination="100312" id="100316"/>
|
||||||
<outlet property="splitView" destination="100127" id="100262"/>
|
<outlet property="splitView" destination="100127" id="100262"/>
|
||||||
<outlet property="targetView" destination="100129" id="100142"/>
|
<outlet property="targetView" destination="100129" id="100142"/>
|
||||||
|
<outlet property="tracksTable" destination="100031" id="yrL-dR-TXc"/>
|
||||||
<outlet property="window" destination="5" id="18"/>
|
<outlet property="window" destination="5" id="18"/>
|
||||||
</connections>
|
</connections>
|
||||||
</customObject>
|
</customObject>
|
||||||
@@ -359,7 +359,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="delegate" destination="-2" id="17"/>
|
<outlet property="delegate" destination="-2" id="17"/>
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="349" y="-6"/>
|
<point key="canvasLocation" x="569" y="0.0"/>
|
||||||
</window>
|
</window>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="100175" userLabel="Saving">
|
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="100175" userLabel="Saving">
|
||||||
@@ -400,7 +400,7 @@ Gw
|
|||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
<point key="canvasLocation" x="393.5" y="411.5"/>
|
<point key="canvasLocation" x="437" y="408"/>
|
||||||
</window>
|
</window>
|
||||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="100271" userLabel="Offset">
|
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="100271" userLabel="Offset">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10109" systemVersion="15E39d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15G12a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10109"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11129.15"/>
|
||||||
<capability name="box content view" minToolsVersion="7.0"/>
|
<capability name="box content view" minToolsVersion="7.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" viewBased="YES" id="xYT-Aq-WLl">
|
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowSizeStyle="automatic" viewBased="YES" id="xYT-Aq-WLl">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="264" height="211"/>
|
<rect key="frame" x="0.0" y="0.0" width="264" height="0.0"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<size key="intercellSpacing" width="3" height="2"/>
|
<size key="intercellSpacing" width="3" height="2"/>
|
||||||
<color key="backgroundColor" red="0.85882352941176465" green="0.85882352941176465" blue="0.85882352941176465" alpha="0.0" colorSpace="calibratedRGB"/>
|
<color key="backgroundColor" red="0.85882352941176465" green="0.85882352941176465" blue="0.85882352941176465" alpha="0.0" colorSpace="calibratedRGB"/>
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
<rect key="frame" x="20" y="195" width="83" height="14"/>
|
<rect key="frame" x="20" y="195" width="83" height="14"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Media tags:" id="3DC-ub-50w">
|
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Media tags:" id="3DC-ub-50w">
|
||||||
<font key="font" metaFont="system" size="11"/>
|
<font key="font" metaFont="smallSystem"/>
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
@@ -105,7 +105,6 @@
|
|||||||
</view>
|
</view>
|
||||||
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
|
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
|
||||||
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<font key="titleFont" metaFont="smallSystem"/>
|
|
||||||
</box>
|
</box>
|
||||||
</subviews>
|
</subviews>
|
||||||
<point key="canvasLocation" x="277.5" y="-519"/>
|
<point key="canvasLocation" x="277.5" y="-519"/>
|
||||||
|
|||||||
@@ -28,16 +28,16 @@
|
|||||||
|
|
||||||
- (void) validate
|
- (void) validate
|
||||||
{
|
{
|
||||||
[self setEnabled: [[self target] validateToolbarItem: self]];
|
self.enabled = [self.target validateToolbarItem: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMenuItem *) menuFormRepresentation
|
- (NSMenuItem *) menuFormRepresentation
|
||||||
{
|
{
|
||||||
NSMenuItem * menuItem = [[NSMenuItem alloc] initWithTitle: [self label] action: [self action] keyEquivalent: @""];
|
NSMenuItem * menuItem = [[NSMenuItem alloc] initWithTitle: self.label action: self.action keyEquivalent: @""];
|
||||||
[menuItem setTarget: [self target]];
|
menuItem.target = self.target;
|
||||||
[menuItem setEnabled: [[self target] validateToolbarItem: self]];
|
menuItem.enabled = [self.target validateToolbarItem: self];
|
||||||
|
|
||||||
return [menuItem autorelease];
|
return menuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+1
-1
@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
NSMutableArray *dictionaryStack;
|
NSMutableArray *dictionaryStack;
|
||||||
NSMutableString *textInProgress;
|
NSMutableString *textInProgress;
|
||||||
NSError **errorPointer;
|
NSError * __autoreleasing *errorPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (nullable NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)errorPointer;
|
+ (nullable NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)errorPointer;
|
||||||
|
|||||||
+17
-29
@@ -27,7 +27,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
|
|
||||||
@interface XMLReader (Internal)
|
@interface XMLReader (Internal)
|
||||||
|
|
||||||
- (id)initWithError:(NSError **)error;
|
- (instancetype)initWithError:(NSError **)error;
|
||||||
- (NSDictionary *)objectWithData:(NSData *)data;
|
- (NSDictionary *)objectWithData:(NSData *)data;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -44,7 +44,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
NSString *path;
|
NSString *path;
|
||||||
|
|
||||||
// Set first branch from self
|
// Set first branch from self
|
||||||
id branch = [self objectForKey:[e nextObject]];
|
id branch = self[[e nextObject]];
|
||||||
int count = 1;
|
int count = 1;
|
||||||
while (path = [e nextObject]) {
|
while (path = [e nextObject]) {
|
||||||
|
|
||||||
@@ -54,8 +54,8 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
if ([path isEqualToString:@"last"]) {
|
if ([path isEqualToString:@"last"]) {
|
||||||
branch = [branch lastObject];
|
branch = [branch lastObject];
|
||||||
} else {
|
} else {
|
||||||
if ([branch count] > [path intValue]) {
|
if ([branch count] > path.intValue) {
|
||||||
branch = [branch objectAtIndex:[path intValue]];
|
branch = branch[path.intValue];
|
||||||
} else {
|
} else {
|
||||||
branch = nil;
|
branch = nil;
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
//branch is assumed to be an NSDictionary
|
//branch is assumed to be an NSDictionary
|
||||||
branch = [branch objectForKey:path];
|
branch = branch[path];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
- (NSArray *)retrieveArrayForPath:(NSString *)navPath {
|
- (NSArray *)retrieveArrayForPath:(NSString *)navPath {
|
||||||
NSObject *r = [self retrieveForPath:navPath];
|
NSObject *r = [self retrieveForPath:navPath];
|
||||||
if ([r isKindOfClass:[NSDictionary class]]) {
|
if ([r isKindOfClass:[NSDictionary class]]) {
|
||||||
return [NSArray arrayWithObject:r];
|
return @[r];
|
||||||
} else {
|
} else {
|
||||||
return (NSArray *) r;
|
return (NSArray *) r;
|
||||||
}
|
}
|
||||||
@@ -92,15 +92,14 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark Public methods
|
#pragma mark Public methods
|
||||||
|
|
||||||
+ (NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)error {
|
+ (NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError * __autoreleasing *)error {
|
||||||
|
|
||||||
XMLReader *reader = [[XMLReader alloc] initWithError:error];
|
XMLReader *reader = [[XMLReader alloc] initWithError:error];
|
||||||
NSDictionary *rootDictionary = [reader objectWithData:data];
|
NSDictionary *rootDictionary = [reader objectWithData:data];
|
||||||
[reader release];
|
|
||||||
return rootDictionary;
|
return rootDictionary;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSDictionary *)dictionaryForXMLString:(NSString *)string error:(NSError **)error {
|
+ (NSDictionary *)dictionaryForXMLString:(NSString *)string error:(NSError * __autoreleasing *)error {
|
||||||
|
|
||||||
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
|
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
|
||||||
return [XMLReader dictionaryForXMLData:data error:error];
|
return [XMLReader dictionaryForXMLData:data error:error];
|
||||||
@@ -109,7 +108,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark Parsing
|
#pragma mark Parsing
|
||||||
|
|
||||||
- (id)initWithError:(NSError **)error {
|
- (instancetype)initWithError:(NSError * __autoreleasing *)error {
|
||||||
|
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
|
|
||||||
@@ -118,18 +117,10 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
|
|
||||||
[dictionaryStack release];
|
|
||||||
[textInProgress release];
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSDictionary *)objectWithData:(NSData *)data {
|
- (NSDictionary *)objectWithData:(NSData *)data {
|
||||||
|
|
||||||
// Clear out any old data
|
// Clear out any old data
|
||||||
[dictionaryStack release];
|
|
||||||
[textInProgress release];
|
|
||||||
|
|
||||||
dictionaryStack = [[NSMutableArray alloc] init];
|
dictionaryStack = [[NSMutableArray alloc] init];
|
||||||
textInProgress = [[NSMutableString alloc] init];
|
textInProgress = [[NSMutableString alloc] init];
|
||||||
@@ -145,13 +136,11 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
// Return the stack's root dictionary on success
|
// Return the stack's root dictionary on success
|
||||||
if (success){
|
if (success){
|
||||||
|
|
||||||
NSDictionary *resultDict = [dictionaryStack objectAtIndex:0];
|
NSDictionary *resultDict = dictionaryStack[0];
|
||||||
|
|
||||||
[parser release];
|
|
||||||
return resultDict;
|
return resultDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
[parser release];
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,14 +150,14 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
|
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
|
||||||
|
|
||||||
// Get the dictionary for the current level in the stack
|
// Get the dictionary for the current level in the stack
|
||||||
NSMutableDictionary *parentDict = [dictionaryStack lastObject];
|
NSMutableDictionary *parentDict = dictionaryStack.lastObject;
|
||||||
|
|
||||||
// Create the child dictionary for the new element, and initilaize it with the attributes
|
// Create the child dictionary for the new element, and initilaize it with the attributes
|
||||||
NSMutableDictionary *childDict = [NSMutableDictionary dictionary];
|
NSMutableDictionary *childDict = [NSMutableDictionary dictionary];
|
||||||
[childDict addEntriesFromDictionary:attributeDict];
|
[childDict addEntriesFromDictionary:attributeDict];
|
||||||
|
|
||||||
// If there's already an item for this key, it means we need to create an array
|
// If there's already an item for this key, it means we need to create an array
|
||||||
id existingValue = [parentDict objectForKey:elementName];
|
id existingValue = parentDict[elementName];
|
||||||
if (existingValue) {
|
if (existingValue) {
|
||||||
NSMutableArray *array = nil;
|
NSMutableArray *array = nil;
|
||||||
if ([existingValue isKindOfClass:[NSMutableArray class]])
|
if ([existingValue isKindOfClass:[NSMutableArray class]])
|
||||||
@@ -183,7 +172,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
[array addObject:existingValue];
|
[array addObject:existingValue];
|
||||||
|
|
||||||
// Replace the child dictionary with an array of children dictionaries
|
// Replace the child dictionary with an array of children dictionaries
|
||||||
[parentDict setObject:array forKey:elementName];
|
parentDict[elementName] = array;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new child dictionary to the array
|
// Add the new child dictionary to the array
|
||||||
@@ -192,7 +181,7 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
// No existing value, so update the dictionary
|
// No existing value, so update the dictionary
|
||||||
[parentDict setObject:childDict forKey:elementName];
|
parentDict[elementName] = childDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the stack
|
// Update the stack
|
||||||
@@ -202,15 +191,14 @@ NSString *const kXMLReaderTextNodeKey = @"text";
|
|||||||
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
|
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
|
||||||
|
|
||||||
// Update the parent dict with text info
|
// Update the parent dict with text info
|
||||||
NSMutableDictionary *dictInProgress = [dictionaryStack lastObject];
|
NSMutableDictionary *dictInProgress = dictionaryStack.lastObject;
|
||||||
|
|
||||||
// Set the text property
|
// Set the text property
|
||||||
if ([textInProgress length] > 0) {
|
if (textInProgress.length > 0) {
|
||||||
|
|
||||||
[dictInProgress setObject:[textInProgress stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:kXMLReaderTextNodeKey];
|
dictInProgress[kXMLReaderTextNodeKey] = [textInProgress stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||||
|
|
||||||
// Reset the text
|
// Reset the text
|
||||||
[textInProgress release];
|
|
||||||
textInProgress = [[NSMutableString alloc] init];
|
textInProgress = [[NSMutableString alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -737,7 +737,7 @@
|
|||||||
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
|
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 0730;
|
LastUpgradeCheck = 0800;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
A95B8DA31B09F37700F2F152 = {
|
A95B8DA31B09F37700F2F152 = {
|
||||||
CreatedOnToolsVersion = 6.3.1;
|
CreatedOnToolsVersion = 6.3.1;
|
||||||
@@ -1114,11 +1114,12 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
@@ -1151,11 +1152,12 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
@@ -1185,6 +1187,8 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = "";
|
CODE_SIGN_ENTITLEMENTS = "";
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
@@ -1201,7 +1205,7 @@
|
|||||||
INSTALL_PATH = "$(HOME)/Applications";
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
LD_RUNPATH_SEARCH_PATHS = "";
|
LD_RUNPATH_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||||
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
|
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "org.galad.${PRODUCT_NAME:identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "org.galad.${PRODUCT_NAME:identifier}";
|
||||||
PRODUCT_NAME = Subler;
|
PRODUCT_NAME = Subler;
|
||||||
@@ -1213,6 +1217,8 @@
|
|||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = "";
|
CODE_SIGN_ENTITLEMENTS = "";
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
@@ -1228,7 +1234,7 @@
|
|||||||
INSTALL_PATH = "$(HOME)/Applications";
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
LD_RUNPATH_SEARCH_PATHS = "";
|
LD_RUNPATH_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||||
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
|
OTHER_LDFLAGS = "-Wl,-rpath,@loader_path/../Frameworks";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "org.galad.${PRODUCT_NAME:identifier}";
|
PRODUCT_BUNDLE_IDENTIFIER = "org.galad.${PRODUCT_NAME:identifier}";
|
||||||
PRODUCT_NAME = Subler;
|
PRODUCT_NAME = Subler;
|
||||||
@@ -1241,6 +1247,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||||
CLANG_ANALYZER_LOCALIZABILITY = YES;
|
CLANG_ANALYZER_LOCALIZABILITY = YES;
|
||||||
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||||
@@ -1252,10 +1259,8 @@
|
|||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
|
|
||||||
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
|
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
|
||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
|
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
@@ -1264,8 +1269,10 @@
|
|||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = c11;
|
GCC_C_LANGUAGE_STANDARD = c11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = "";
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
@@ -1287,7 +1294,7 @@
|
|||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = "";
|
LIBRARY_SEARCH_PATHS = "";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
@@ -1301,6 +1308,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
CLANG_ANALYZER_LOCALIZABILITY = YES;
|
CLANG_ANALYZER_LOCALIZABILITY = YES;
|
||||||
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
|
||||||
@@ -1312,17 +1320,17 @@
|
|||||||
CLANG_WARN_EMPTY_BODY = YES;
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
|
|
||||||
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
|
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
|
||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
|
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO;
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = "";
|
CODE_SIGN_ENTITLEMENTS = "";
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = c11;
|
GCC_C_LANGUAGE_STANDARD = c11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = "";
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||||
@@ -1344,7 +1352,7 @@
|
|||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "";
|
HEADER_SEARCH_PATHS = "";
|
||||||
LIBRARY_SEARCH_PATHS = "";
|
LIBRARY_SEARCH_PATHS = "";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
USER_HEADER_SEARCH_PATHS = "";
|
USER_HEADER_SEARCH_PATHS = "";
|
||||||
|
|||||||
Reference in new issue
Block a user