Refactor the document window controller and the prefs controller. Some regression still in there.

This commit is contained in:
Damiano Galassi committed 2018-02-08 17:50:44 +01:00
1 parent 3557220f53
commit 32b347c638
4 files changed
+13 -20

No files matched your search

+3 -10
View File
@@ -119,18 +119,11 @@ typedef void (^MP42FileProgressHandler)(double progress);
- (void)addTrack:(MP42Track *)track; - (void)addTrack:(MP42Track *)track;
/** /**
* Removes a track at the index. * Removes the passed tracks.
* *
* @param index The track index. * @param tracks A NSArray of tracks.
*/ */
- (void)removeTrackAtIndex:(NSUInteger)index; - (void)removeTracks:(NSArray<MP42Track *> *)tracks;
/**
* Removes the tracks at the passed indexes.
*
* @param indexes A NSIndexSet of indexes.
*/
- (void)removeTracksAtIndexes:(NSIndexSet *)indexes;
- (void)moveTrackAtIndex:(NSUInteger)index toIndex:(NSUInteger)newIndex; - (void)moveTrackAtIndex:(NSUInteger)index toIndex:(NSUInteger)newIndex;
+3 -10
View File
@@ -482,16 +482,10 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
[self.itracks addObject:track]; [self.itracks addObject:track];
} }
- (void)removeTrackAtIndex:(NSUInteger)index { - (void)removeTracks:(NSArray<MP42Track *> *)tracks {
NSAssert(self.status != MP42StatusWriting, @"Unsupported operation: trying to remove a track while the file is open for writing"); NSAssert(self.status != MP42StatusWriting, @"Unsupported operation: trying to remove a track while the file is open for writing");
[self removeTracksAtIndexes:[NSIndexSet indexSetWithIndex:index]];
}
- (void)removeTracksAtIndexes:(NSIndexSet *)indexes {
NSUInteger index = [indexes firstIndex];
while (index != NSNotFound) {
MP42Track *track = [self.itracks objectAtIndex:index];
for (MP42Track *track in tracks) {
// track is muxed, it needs to be removed from the file // track is muxed, it needs to be removed from the file
if (track.muxed) if (track.muxed)
[_tracksToBeDeleted addObject:track]; [_tracksToBeDeleted addObject:track];
@@ -511,10 +505,9 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
a.forcedTrack = nil; a.forcedTrack = nil;
} }
} }
index = [indexes indexGreaterThanIndex:index];
} }
[self.itracks removeObjectsAtIndexes:indexes]; [self.itracks removeObjectsInArray:tracks];
} }
- (void)moveTrackAtIndex:(NSUInteger)index toIndex:(NSUInteger)newIndex { - (void)moveTrackAtIndex:(NSUInteger)index toIndex:(NSUInteger)newIndex {
+2
View File
@@ -48,6 +48,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) NSString *timeString; @property (nonatomic, readonly) NSString *timeString;
@property (nonatomic, readonly) NSString *formatSummary; @property (nonatomic, readonly) NSString *formatSummary;
- (BOOL)exportToURL:(NSURL *)url error:(NSError * __autoreleasing *)error;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
+5
View File
@@ -323,6 +323,11 @@
return localizedDisplayName(_mediaType, self.targetFormat); return localizedDisplayName(_mediaType, self.targetFormat);
} }
- (BOOL)exportToURL:(NSURL *)url error:(NSError * __autoreleasing *)error
{
return YES;
}
#pragma mark - NSSecureCoding #pragma mark - NSSecureCoding
+ (BOOL)supportsSecureCoding + (BOOL)supportsSecureCoding