mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
- OSX patch from stoppicot
This commit is contained in:
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;
|
||||
|
||||
|
||||
@@ -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"];
|
||||
|
||||
Reference in New Issue
Block a user