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 {
mocBlock( mainManagedObjectContext );
}
@catch (NSException *exception) {
@catch (id exception) {
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 {
prof_new( @"showPasswordWindow" );
[NSApp activateIgnoringOtherApps:YES];
prof_rewind(@"activateIgnoringOtherApps");
// If no user, can't activate.
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 runModal];
[self showPopup:nil];
prof_finish( @"activeUserForMainThread" );
return;
}
prof_rewind( @"activeUserForMainThread" );
// Don't show window if we weren't already running (ie. if we haven't been activated before).
if (!self.passwordWindowController)
self.passwordWindowController = [[MPPasswordWindowController alloc] initWithWindowNibName:@"MPPasswordWindowController"];
prof_rewind( @"initWithWindow" );
[self.passwordWindowController showWindow:self];
prof_finish( @"showWindow" );
}
#pragma mark - Private

View File

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

View File

@ -54,7 +54,7 @@
</ciFilter>
</contentFilters>
<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>
<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"/>

View File

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