Draw tracking progress directly from the completed frame count
这个提交包含在:
1 父节点
d2b6f8ef81
当前提交
6515e0fa67
4 个文件已更改
+36
-15
没有与搜索条件相匹配的文件
@@ -74,6 +74,34 @@
|
||||
}
|
||||
@end
|
||||
|
||||
@interface DYTrackingProgressBar : NSView
|
||||
@property(nonatomic) double doubleValue;
|
||||
@end
|
||||
|
||||
@implementation DYTrackingProgressBar
|
||||
- (BOOL)isAccessibilityElement {return YES;}
|
||||
- (NSString *)accessibilityRole {return NSAccessibilityProgressIndicatorRole;}
|
||||
- (id)accessibilityValue {return @(_doubleValue);}
|
||||
- (id)accessibilityMinValue {return @0;}
|
||||
- (id)accessibilityMaxValue {return @1;}
|
||||
- (void)setDoubleValue:(double)value {
|
||||
_doubleValue=std::clamp(value,0.,1.);
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
- (void)drawRect:(NSRect)dirty {
|
||||
NSRect rail=NSInsetRect(self.bounds,0,2);
|
||||
CGFloat radius=NSHeight(rail)/2;
|
||||
NSBezierPath *track=[NSBezierPath bezierPathWithRoundedRect:rail xRadius:radius yRadius:radius];
|
||||
[[[NSColor labelColor] colorWithAlphaComponent:.18] setFill];
|
||||
[track fill];
|
||||
if(_doubleValue<=0)return;
|
||||
[NSGraphicsContext saveGraphicsState];[track addClip];
|
||||
NSRect fill=rail;fill.size.width*=_doubleValue;
|
||||
[NSColor.controlAccentColor setFill];NSRectFill(fill);
|
||||
[NSGraphicsContext restoreGraphicsState];
|
||||
}
|
||||
@end
|
||||
|
||||
@interface DYTrackingPreview : NSView
|
||||
- (instancetype)initWithTarget:(id)target action:(SEL)action;
|
||||
- (void)applyUpdate:(NSDictionary *)info;
|
||||
@@ -86,7 +114,7 @@
|
||||
DYTrackingPreviewImage *_preview;
|
||||
NSTextField *_title,*_detail,*_status;
|
||||
NSButton *_action;
|
||||
NSProgressIndicator *_progress;
|
||||
DYTrackingProgressBar *_progress;
|
||||
NSString *_maskID;
|
||||
BOOL _running;
|
||||
}
|
||||
@@ -101,8 +129,7 @@
|
||||
_detail=[DYThemeLabel labelWithString:@""];_detail.font=[NSFont monospacedDigitSystemFontOfSize:10 weight:NSFontWeightRegular];
|
||||
_status=[DYThemeLabel labelWithString:@""];_status.font=[NSFont systemFontOfSize:11];_status.maximumNumberOfLines=2;_status.lineBreakMode=NSLineBreakByWordWrapping;
|
||||
_action=DYWorkspaceButton(@"停止跟踪",target,action);
|
||||
_progress=[[[NSProgressIndicator alloc]init]autorelease];_progress.style=NSProgressIndicatorStyleBar;
|
||||
_progress.controlSize=NSControlSizeSmall;_progress.indeterminate=NO;_progress.minValue=0;_progress.maxValue=1;_progress.accessibilityLabel=@"跟踪进度";
|
||||
_progress=[[[DYTrackingProgressBar alloc]init]autorelease];_progress.accessibilityLabel=@"跟踪进度";
|
||||
_preview=[[[DYTrackingPreviewImage alloc]init]autorelease];[_preview showFrame:nil];
|
||||
for(NSView *view in @[_title,_detail,_status,_action,_progress,_preview])[self addSubview:view];
|
||||
self.hidden=YES;
|
||||
@@ -130,17 +157,11 @@
|
||||
_detail.stringValue=[NSString stringWithFormat:@"%.3fs %@",[info[@"time"] doubleValue],stamp?@"青色取样 · 黄色覆盖":@"黄色轮廓"];
|
||||
}
|
||||
NSUInteger total=[info[@"total"] unsignedIntegerValue];
|
||||
if(active){
|
||||
if(_progress.indeterminate!=(total==0)){
|
||||
_progress.indeterminate=total==0;
|
||||
if(total)[_progress stopAnimation:nil];else [_progress startAnimation:nil];
|
||||
}
|
||||
_progress.doubleValue=total?[info[@"completed"] doubleValue]/total:0;
|
||||
}else [_progress stopAnimation:nil];
|
||||
if(active)_progress.doubleValue=total?[info[@"completed"] doubleValue]/total:0;
|
||||
_running=active;_action.title=active?@"停止跟踪":@"返回示波器";_action.accessibilityLabel=_action.title;
|
||||
_status.stringValue=info[@"message"]?:@"";_status.toolTip=_status.stringValue;
|
||||
}
|
||||
- (void)reset {
|
||||
[_progress stopAnimation:nil];_progress.indeterminate=NO;[_preview showFrame:nil];[_maskID release];_maskID=nil;_running=NO;self.hidden=YES;
|
||||
_progress.doubleValue=0;[_preview showFrame:nil];[_maskID release];_maskID=nil;_running=NO;self.hidden=YES;
|
||||
}
|
||||
@end
|
||||
@@ -37,12 +37,12 @@
|
||||
@"rgba":[NSData dataWithBytes:"\xff\x00\x00\xff" length:4],@"width":@1,@"height":@1,
|
||||
@"time":@.08,@"aspect":@1,@"total":@6,@"completed":@3}];
|
||||
NSView *trackingPreview=[workspace valueForKey:@"trackingPreview"];
|
||||
NSProgressIndicator *progress=[trackingPreview valueForKey:@"progress"];
|
||||
NSView *progress=[trackingPreview valueForKey:@"progress"];
|
||||
NSView *image=[trackingPreview valueForKey:@"preview"];
|
||||
NSButton *previewAction=[trackingPreview valueForKey:@"action"];
|
||||
[trackingPreview layoutSubtreeIfNeeded];
|
||||
run.record(@"workspace-tracking-preview-replaces-scopes-with-readable-progress-and-image",
|
||||
!trackingPreview.hidden&&[(NSView *)plots.firstObject isHidden]&&progress.doubleValue==.5&&
|
||||
!trackingPreview.hidden&&[(NSView *)plots.firstObject isHidden]&&[progress.accessibilityValue doubleValue]==.5&&
|
||||
[image.accessibilityLabel containsString:@"0.080"]&&image.clipsToBounds&&NSWidth(image.frame)>200&&NSHeight(image.frame)>120);
|
||||
__block BOOL cancelRouted=NO;
|
||||
id stopObserver=[trackingCenter addObserverForName:@"DYToolTrack" object:host queue:nil usingBlock:^(NSNotification *n){cancelRouted=[n.userInfo[@"direction"]intValue]==9;}];
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.14.3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>93</string>
|
||||
<string>94</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.14.3</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>93</string>
|
||||
<string>94</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
在新工单中引用
屏蔽一个用户