1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-20 20:23:03 +02:00

- 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

View File

@ -9,6 +9,11 @@ if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# VCMI version
set(VCMI_VERSION_MAJOR 0)
set(VCMI_VERSION_MINOR 91)
set(VCMI_VERSION_PATCH 0)
option(DISABLE_ERM "Disable compilation of ERM scripting module" ON)
option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
@ -137,25 +142,20 @@ if(WIN32)
elseif(APPLE)
else()
#install icons and desktop file on Linux
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.64x64.png" DESTINATION share/icons/hicolor/64x64/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.32x32.png" DESTINATION share/icons/hicolor/32x32/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.64x64.png" DESTINATION share/icons/hicolor/64x64/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.32x32.png" DESTINATION share/icons/hicolor/32x32/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.desktop" DESTINATION share/applications)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.desktop" DESTINATION share/applications)
endif()
#######################################
# Packaging section #
#######################################
set(CPACK_PACKAGE_VERSION_MAJOR 0)
set(CPACK_PACKAGE_VERSION_MINOR 90)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_PACKAGE_VERSION_MAJOR ${VCMI_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VCMI_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VCMI_VERSION_PATCH})
# vcmi does not have "patch version" in version string
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")

View File

@ -5,6 +5,6 @@
<key>CFBundleIconFile</key>
<string>vcmi.icns</string>
<key>CFBundleVersion</key>
<string>0.91</string>
<string>${VCMI_VERSION_MAJOR}.${VCMI_VERSION_MINOR}</string>
</dict>
</plist>

Binary file not shown.

View File

@ -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;

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"];