*
* It is safe to keep a reference to an array object.
*/
-@interface HBDistributedArray : NSMutableArray
+@interface HBDistributedArray<ObjectType> : NSMutableArray
- (instancetype)initWithURL:(NSURL *)fileURL;
NSString *HBDistributedArrayChanged = @"HBDistributedArrayChanged";
NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
-@interface HBDistributedArray ()
+@interface HBDistributedArray<ObjectType> ()
-@property (nonatomic, readonly) NSMutableArray *array;
+@property (nonatomic, readonly) NSMutableArray<ObjectType> *array;
@property (nonatomic, readonly) NSURL *fileURL;
@property (nonatomic, readwrite) NSTimeInterval modifiedTime;
{
for (NSString *keyPath in observerdKeyPaths)
{
- [self removeObserver:self forKeyPath:keyPath];
+ [self removeObserver:self forKeyPath:keyPath context:HBPictureControllerContext];
}
} @catch (NSException * __unused exception) {}
{
@try
{
- [self removeObserver:self forKeyPath:@"self.picture.modulus"];
+ [self removeObserver:self forKeyPath:@"self.picture.modulus" context:HBPictureViewControllerContext];
}
@catch (NSException * __unused exception) {}
}
{
if (context == HBPictureViewControllerContext)
{
- // Set the increment here, it's not possible with bidings.
+ // Set the increment here, it's not possible with bindings.
if ([keyPath isEqualToString:@"self.picture.modulus"])
{
[self.widthStepper setIncrement:self.picture.modulus];
@property (nonatomic, readonly) NSUInteger pendingItemsCount;
- (void)addJob:(HBJob *)item;
-- (void)addJobsFromArray:(NSArray *)items;
+- (void)addJobsFromArray:(NSArray<HBJob *> *)items;
- (BOOL)jobExistAtURL:(NSURL *)url;
@property (nonatomic, readonly) NSMutableDictionary *descriptions;
-@property (nonatomic, readonly) HBDistributedArray *jobs;
+@property (nonatomic, readonly) HBDistributedArray<HBJob *> *jobs;
@property (nonatomic) HBJob *currentJob;
@property (nonatomic) HBJobOutputFileWriter *currentLog;
@property (nonatomic, readwrite) NSUInteger pendingItemsCount;
@property (nonatomic, readwrite) NSUInteger completedItemsCount;
-@property (nonatomic) NSArray *dragNodesArray;
+@property (nonatomic) NSArray<HBJob *> *dragNodesArray;
@end
[self addJobsFromArray:@[item]];
}
-- (void)addJobsFromArray:(NSArray *)items;
+- (void)addJobsFromArray:(NSArray<HBJob *> *)items;
{
NSParameterAssert(items);
- [self addQueueItems:items];
+ if (items.count)
+ {
+ [self addQueueItems:items];
+ }
}
- (BOOL)jobExistAtURL:(NSURL *)url
if ([targetedRows containsIndexes:workingIndexes])
{
[targetedRows removeIndexes:workingIndexes];
- NSArray *workingJobs = [self.jobs filteredArrayUsingBlock:^BOOL(HBJob *item) {
+ NSArray<HBJob *> *workingJobs = [self.jobs filteredArrayUsingBlock:^BOOL(HBJob *item) {
return item.state == HBJobStateWorking;
}];
#import "HBSubtitlesDefaults.h"
#import "HBLanguagesSelection.h"
-static void *HBSubtitlesDefaultsContex = &HBSubtitlesDefaultsContex;
+static void *HBSubtitlesDefaultsContext = &HBSubtitlesDefaultsContext;
@interface HBSubtitlesDefaultsController ()
- (void)windowDidLoad
{
- [self addObserver:self forKeyPath:@"tableController.showSelectedOnly" options:0 context:HBSubtitlesDefaultsContex];
+ [self addObserver:self forKeyPath:@"tableController.showSelectedOnly" options:0 context:HBSubtitlesDefaultsContext];
if (self.settings.trackSelectionLanguages.count)
{
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
- if (context == HBSubtitlesDefaultsContex)
+ if (context == HBSubtitlesDefaultsContext)
{
if ([keyPath isEqualToString:@"tableController.showSelectedOnly"])
{
- (void)dealloc
{
@try {
- [self removeObserver:self forKeyPath:@"tableController.showSelectedOnly"];
+ [self removeObserver:self forKeyPath:@"tableController.showSelectedOnly" context:HBSubtitlesDefaultsContext];
} @catch (NSException * __unused exception) {}
}