- OSX patch from stoppicot

This commit is contained in:
Ivan Savenko
2013-02-21 17:32:50 +00:00
parent 01e563b579
commit 9fa59276c9
5 changed files with 34 additions and 26 deletions
BIN
View File
Binary file not shown.
@@ -35,6 +35,7 @@
- (void)selectFile:(NSArray*)fileTypes withTextField:(NSTextField*)textField;
- (void)showProgressText:(NSString*)text;
- (void)showErrorText:(NSString*)text;
- (void)showNotification:(NSString*)text;
- (void)nextAction;
- (int)runTask:(NSString*)executable withArgs:(NSArray*)args withWorkingDir:(NSString*)workingDir withPipe:(NSPipe*)pipe;
+20 -13
View File
@@ -248,19 +248,7 @@
[self.progressIndicator stopAnimation:self];
// Notify user that installation completed
NSUserNotification* notification = [[NSUserNotification alloc] init];
if (notification != nil) {
// On OS X 10.8 and newer use notification center
[notification setTitle:@"VCMI"];
[notification setInformativeText:@"Installation completed"];
[notification setDeliveryDate:[NSDate dateWithTimeInterval:0 sinceDate:[NSDate date]]];
[notification setSoundName:NSUserNotificationDefaultSoundName];
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center scheduleNotification:notification];
} else {
// On older OS X version force dock icon to jump
[NSApp requestUserAttention:NSCriticalRequest];
}
[self showNotification:@"Installation completed"];
// Hide all progress related controls
[self.progressIndicator setHidden:YES];
@@ -321,6 +309,23 @@
}
}
- (void)showNotification:(NSString*)text
{
// Notification Center is supported only on OS X 10.8 and newer
NSUserNotification* notification = [[NSUserNotification alloc] init];
if (notification != nil) {
notification.title = @"VCMI";
notification.informativeText = text;
notification.deliveryDate = [NSDate dateWithTimeInterval:0 sinceDate:[NSDate date]];
notification.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
} else {
// On older OS X version force dock icon to jump
[NSApp requestUserAttention:NSCriticalRequest];
}
}
- (void)showProgressText:(NSString*)text
{
// All GUI updates should be done on main thread
@@ -334,6 +339,8 @@
{
// All GUI updates should be done on main thread
dispatch_async(dispatch_get_main_queue(), ^{
[self showNotification:@"Installation failed"];
// Show error alert
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Error"];