using properties where possible

This commit is contained in:
michael starke
2017-08-29 14:58:25 +02:00
parent aeeca850c2
commit a0b94312ed

View File

@@ -52,32 +52,27 @@
} }
- (void)displayOverlayImage:(NSImage *)imageOrNil label:(NSString *)labelOrNil atView:(NSView *)view { - (void)displayOverlayImage:(NSImage *)imageOrNil label:(NSString *)labelOrNil atView:(NSView *)view {
if(![NSThread currentThread].isMainThread) { NSAssert(NO, @"Must be called on main thread"); } if(!NSThread.currentThread.isMainThread) {
/* NSAssert(NO, @"Must be called on main thread");
if(![NSThread currentThread].isMainThread) {
__weak MPOverlayWindowController *welf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[welf displayOverlayImage:imageOrNil label:labelOrNil atView:view];
});
return; return;
} }
*/
if(self.isAnimating) { if(self.isAnimating) {
return; return;
} }
self.isAnimating = YES; self.isAnimating = YES;
/* make window transparent */ /* make window transparent */
[self.window setAlphaValue:0]; self.window.alphaValue = 0;
[self.window setIsVisible:YES]; self.window.isVisible = YES;
/* setup any provided images and labels*/ /* setup any provided images and labels*/
[self.imageView setImage:imageOrNil]; self.imageView.image = imageOrNil;
if(labelOrNil) { if(labelOrNil) {
[self.textField setStringValue:labelOrNil]; self.textField.stringValue = labelOrNil;
} }
else { else {
[self.textField setStringValue:@""]; self.textField.stringValue = @"";
} }
[self.textField sizeToFit]; [self.textField sizeToFit];
/* /*
@@ -105,7 +100,7 @@
} }
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
context.duration = 0.2; context.duration = 0.2;
[[self.window animator]setAlphaValue:1]; [self.window animator].alphaValue = 1;
} completionHandler:^{ } completionHandler:^{
[self performSelector:@selector(_didEndAnimation) withObject:nil afterDelay:0.5]; [self performSelector:@selector(_didEndAnimation) withObject:nil afterDelay:0.5];
}]; }];