Implemented a way to update the queue UI with a description of the current action.
This commit is contained in:
1 parent
a218dc8aae
commit
5219a73a7a
6 files changed
+42
-11
No files matched your search
+6
-1
@@ -249,7 +249,12 @@ NSString *SBQueueCancelledNotification = @"SBQueueCancelledNotification";
|
||||
* sends SBQueueWorkingNotification.
|
||||
*/
|
||||
- (void)handleSBStatusWorking:(CGFloat)progress index:(NSInteger)index {
|
||||
NSString *info = [NSString stringWithFormat:@"Processing file %ld of %lu.",(long)self.currentIndex + 1, (unsigned long)[self.items count]];
|
||||
NSString *description = self.currentItem.localizedWorkingDescription;
|
||||
if (!description) {
|
||||
description = NSLocalizedString(@"Working", @"");
|
||||
}
|
||||
NSString *info = [NSString stringWithFormat:@"%@, item %ld of %lu.", description, (long)self.currentIndex + 1, (unsigned long)self.items.count];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SBQueueWorkingNotification object:self userInfo:@{@"ProgressString": info,
|
||||
@"Progress": @(progress),
|
||||
@"ItemIndex": @(index)}];
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
@protocol SBQueueActionProtocol <NSObject, NSCoding>
|
||||
- (void)runAction:(SBQueueItem *)item;
|
||||
@property (nonatomic, readonly) NSString *localizedDescription;
|
||||
@end
|
||||
|
||||
/**
|
||||
|
||||
+20
-4
@@ -62,7 +62,11 @@
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return @"Load Subtitles";
|
||||
return NSLocalizedString(@"Load Subtitles", @"");
|
||||
}
|
||||
|
||||
- (NSString *)localizedDescription {
|
||||
return NSLocalizedString(@"Loading subtitles", @"");
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder {
|
||||
@@ -187,7 +191,11 @@
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return @"Search Metadata";
|
||||
return NSLocalizedString(@"Search Metadata", @"");
|
||||
}
|
||||
|
||||
- (NSString *)localizedDescription {
|
||||
return NSLocalizedString(@"Searching metadata", @"");
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder {
|
||||
@@ -215,7 +223,11 @@
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"Apply %@ Set", _set.presetName];
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Apply %@ Set", @""), _set.presetName];
|
||||
}
|
||||
|
||||
- (NSString *)localizedDescription {
|
||||
return [NSString stringWithFormat:NSLocalizedString(@"Applying %@ set", @""), _set.presetName];
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder {
|
||||
@@ -244,7 +256,11 @@
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return @"Organize Groups";
|
||||
return NSLocalizedString(@"Organize Groups", @"");
|
||||
}
|
||||
|
||||
- (NSString *)localizedDescription {
|
||||
return NSLocalizedString(@"Organizing groups", @"");
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder {
|
||||
|
||||
@@ -34,9 +34,11 @@ typedef enum SBQueueItemStatus : NSInteger {
|
||||
id _delegate;
|
||||
|
||||
SBQueueItemStatus _status;
|
||||
NSString *_localizedWorkingDescription;
|
||||
}
|
||||
|
||||
@property (nonatomic, readwrite) SBQueueItemStatus status;
|
||||
@property (nonatomic, readonly) NSString *localizedWorkingDescription;
|
||||
|
||||
@property (nonatomic, readonly) MP42File *mp4File;
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
@interface SBQueueItem () <MP42FileDelegate>
|
||||
|
||||
@property (nonatomic, readwrite) NSString *localizedWorkingDescription;
|
||||
|
||||
@property (nonatomic, readwrite, retain) MP42File *mp4File;
|
||||
@property (nonatomic, readwrite) NSMutableArray *actionsInternal;
|
||||
@property (atomic) BOOL cancelled;
|
||||
@@ -26,6 +28,7 @@
|
||||
@implementation SBQueueItem
|
||||
|
||||
@synthesize status = _status;
|
||||
@synthesize localizedWorkingDescription = _localizedWorkingDescription;
|
||||
|
||||
@synthesize attributes = _attributes;
|
||||
@synthesize actionsInternal = _actions;
|
||||
@@ -241,9 +244,13 @@
|
||||
}
|
||||
|
||||
for (id<SBQueueActionProtocol> action in self.actions) {
|
||||
self.localizedWorkingDescription = action.localizedDescription;
|
||||
[self progressStatus:0];
|
||||
[action runAction:self];
|
||||
}
|
||||
|
||||
self.localizedWorkingDescription = nil;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user