2
0

Profile opening window and some project updates.

This commit is contained in:
Maarten Billemont 2015-11-01 00:19:47 -04:00
parent 1bcbb3c90e
commit 8316e5331d
5 changed files with 31 additions and 8 deletions

View File

@ -55,7 +55,7 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
@try { @try {
mocBlock( mainManagedObjectContext ); mocBlock( mainManagedObjectContext );
} }
@catch (NSException *exception) { @catch (id exception) {
err( @"While performing managed block:\n%@", [exception fullDescription] ); err( @"While performing managed block:\n%@", [exception fullDescription] );
} }
}]; }];

View File

@ -426,7 +426,9 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
- (IBAction)showPasswordWindow:(id)sender { - (IBAction)showPasswordWindow:(id)sender {
prof_new( @"showPasswordWindow" );
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
prof_rewind(@"activateIgnoringOtherApps");
// If no user, can't activate. // If no user, can't activate.
if (![self activeUserForMainThread]) { if (![self activeUserForMainThread]) {
@ -435,14 +437,18 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
alert.informativeText = @"Begin by selecting or creating your user from the status menu (●●●|) next to the clock."; alert.informativeText = @"Begin by selecting or creating your user from the status menu (●●●|) next to the clock.";
[alert runModal]; [alert runModal];
[self showPopup:nil]; [self showPopup:nil];
prof_finish( @"activeUserForMainThread" );
return; return;
} }
prof_rewind( @"activeUserForMainThread" );
// Don't show window if we weren't already running (ie. if we haven't been activated before). // Don't show window if we weren't already running (ie. if we haven't been activated before).
if (!self.passwordWindowController) if (!self.passwordWindowController)
self.passwordWindowController = [[MPPasswordWindowController alloc] initWithWindowNibName:@"MPPasswordWindowController"]; self.passwordWindowController = [[MPPasswordWindowController alloc] initWithWindowNibName:@"MPPasswordWindowController"];
prof_rewind( @"initWithWindow" );
[self.passwordWindowController showWindow:self]; [self.passwordWindowController showWindow:self];
prof_finish( @"showWindow" );
} }
#pragma mark - Private #pragma mark - Private

View File

@ -43,9 +43,12 @@
- (void)windowDidLoad { - (void)windowDidLoad {
prof_new(@"windowDidLoad");
[super windowDidLoad]; [super windowDidLoad];
prof_rewind( @"super" );
[self replaceFonts:self.window.contentView]; [self replaceFonts:self.window.contentView];
prof_rewind( @"replaceFonts" );
// [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillBecomeActiveNotification object:nil // [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillBecomeActiveNotification object:nil
// queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { // queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
@ -64,7 +67,7 @@
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
NSWindow *sheet = [self.window attachedSheet]; NSWindow *sheet = [self.window attachedSheet];
if (sheet) if (sheet)
[NSApp endSheet:sheet]; [self.window endSheet:sheet];
}]; }];
[[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillResignActiveNotification object:nil [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillResignActiveNotification object:nil
queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
@ -84,8 +87,9 @@
withBlock:^(id from, id to, NSKeyValueChange cause, id _self) { withBlock:^(id from, id to, NSKeyValueChange cause, id _self) {
[_self updateSelection]; [_self updateSelection];
}]; }];
prof_rewind( @"observers" );
NSSearchFieldCell *siteFieldCell = self.siteField.cell; NSSearchFieldCell *siteFieldCell = (NSSearchFieldCell *)self.siteField.cell;
siteFieldCell.searchButtonCell = nil; siteFieldCell.searchButtonCell = nil;
siteFieldCell.cancelButtonCell = nil; siteFieldCell.cancelButtonCell = nil;
@ -96,6 +100,7 @@
self.siteTable.superview.superview.layer.mask = self.siteGradient; self.siteTable.superview.superview.layer.mask = self.siteGradient;
self.siteTable.controller = self; self.siteTable.controller = self;
prof_finish( @"ui" );
} }
- (void)replaceFonts:(NSView *)view { - (void)replaceFonts:(NSView *)view {
@ -134,6 +139,7 @@
#pragma mark - NSResponder #pragma mark - NSResponder
// Handle any unhandled editor command.
- (void)doCommandBySelector:(SEL)commandSelector { - (void)doCommandBySelector:(SEL)commandSelector {
[self handleCommand:commandSelector]; [self handleCommand:commandSelector];
@ -141,6 +147,7 @@
#pragma mark - NSTextFieldDelegate #pragma mark - NSTextFieldDelegate
// Editor command in a text field.
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector { - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector {
if (control == self.siteField) { if (control == self.siteField) {
@ -621,8 +628,11 @@
- (void)fadeIn { - (void)fadeIn {
if ([self.window isOnActiveSpace] && self.window.alphaValue > FLT_EPSILON) prof_new(@"fadeIn");
if ([self.window isOnActiveSpace] && self.window.alphaValue > FLT_EPSILON) {
prof_finish( @"showing" );
return; return;
}
CGDirectDisplayID displayID = [self.window.screen.deviceDescription[@"NSScreenNumber"] unsignedIntValue]; CGDirectDisplayID displayID = [self.window.screen.deviceDescription[@"NSScreenNumber"] unsignedIntValue];
CGImageRef capturedImage = CGDisplayCreateImage( displayID ); CGImageRef capturedImage = CGDisplayCreateImage( displayID );
@ -630,16 +640,20 @@
if (capturedImage) if (capturedImage)
CFRelease( capturedImage ); CFRelease( capturedImage );
wrn( @"Failed to capture screen image for display: %d", displayID ); wrn( @"Failed to capture screen image for display: %d", displayID );
prof_finish( @"capture failed" );
return; return;
} }
prof_rewind( @"capture" );
NSImage *screenImage = [[NSImage alloc] initWithCGImage:capturedImage size:NSMakeSize( NSImage *screenImage = [[NSImage alloc] initWithCGImage:capturedImage size:NSMakeSize(
CGImageGetWidth( capturedImage ) / self.window.backingScaleFactor, CGImageGetWidth( capturedImage ) / self.window.backingScaleFactor,
CGImageGetHeight( capturedImage ) / self.window.backingScaleFactor )]; CGImageGetHeight( capturedImage ) / self.window.backingScaleFactor )];
prof_rewind( @"screenImage" );
NSImage *smallImage = [[NSImage alloc] initWithSize:NSMakeSize( NSImage *smallImage = [[NSImage alloc] initWithSize:NSMakeSize(
CGImageGetWidth( capturedImage ) / 20, CGImageGetWidth( capturedImage ) / 20,
CGImageGetHeight( capturedImage ) / 20 )]; CGImageGetHeight( capturedImage ) / 20 )];
prof_rewind( @"smallImage" );
CFRelease( capturedImage ); CFRelease( capturedImage );
[smallImage lockFocus]; [smallImage lockFocus];
[screenImage drawInRect:(NSRect){ .origin = CGPointZero, .size = smallImage.size, } [screenImage drawInRect:(NSRect){ .origin = CGPointZero, .size = smallImage.size, }
@ -647,12 +661,15 @@
operation:NSCompositeSourceOver operation:NSCompositeSourceOver
fraction:1.0]; fraction:1.0];
[smallImage unlockFocus]; [smallImage unlockFocus];
prof_rewind( @"scale" );
self.blurView.image = smallImage; self.blurView.image = smallImage;
prof_rewind( @"blurView" );
[self.window setFrame:self.window.screen.frame display:YES]; [self.window setFrame:self.window.screen.frame display:YES];
[NSAnimationContext currentContext].timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; [NSAnimationContext currentContext].timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
self.window.animator.alphaValue = 1.0; self.window.animator.alphaValue = 1.0;
prof_finish( @"window setup" );
} }
- (void)fadeOut { - (void)fadeOut {

View File

@ -54,7 +54,7 @@
</ciFilter> </ciFilter>
</contentFilters> </contentFilters>
<animations/> <animations/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="small-screen" id="ArA-2w-I56"/> <imageCell key="cell" enabled="NO" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="small-screen" id="ArA-2w-I56"/>
</imageView> </imageView>
<progressIndicator hidden="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="oSh-Ec-8Nf" userLabel="Progress Spinner"> <progressIndicator hidden="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="oSh-Ec-8Nf" userLabel="Progress Spinner">
<rect key="frame" x="312" y="524" width="16" height="16"/> <rect key="frame" x="312" y="524" width="16" height="16"/>

View File

@ -2471,7 +2471,7 @@
"$(inherit)", "$(inherit)",
"\"$(SRCROOT)/../../../External\"/**", "\"$(SRCROOT)/../../../External\"/**",
); );
MACOSX_DEPLOYMENT_TARGET = 10.8; MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
@ -2560,7 +2560,7 @@
"$(inherit)", "$(inherit)",
"\"$(SRCROOT)/../../../External\"/**", "\"$(SRCROOT)/../../../External\"/**",
); );
MACOSX_DEPLOYMENT_TARGET = 10.8; MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "${TARGET_NAME}"; PRODUCT_NAME = "${TARGET_NAME}";
@ -2736,7 +2736,7 @@
"$(inherit)", "$(inherit)",
"\"$(SRCROOT)/../../../External\"/**", "\"$(SRCROOT)/../../../External\"/**",
); );
MACOSX_DEPLOYMENT_TARGET = 10.8; MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "-ObjC"; OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "${TARGET_NAME}"; PRODUCT_NAME = "${TARGET_NAME}";