mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-02-23 03:20:59 +00:00
Merge branch 'master' of ssh://gitweb/git/desktop/standalone-updater
This commit is contained in:
commit
ea8fcb4e82
7 changed files with 54 additions and 7 deletions
|
@ -13,6 +13,15 @@ endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
set(CMAKE_OSX_ARCHITECTURES i386;x86_64)
|
||||||
|
|
||||||
|
# Build the updater so that it works on OS X 10.5 and above.
|
||||||
|
# If you are building on OS X 10.7 or newer, you will need to up
|
||||||
|
# this target - depending on the versions of the Mac OS X SDK that
|
||||||
|
# are available to build with in /Developer/SDKs/
|
||||||
|
|
||||||
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||||
|
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}.sdk")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
2
TODO
2
TODO
|
@ -19,7 +19,7 @@ General Updater Tasks:
|
||||||
* Fix package dir cleanup failing on Win32 due to executable being in use [done]
|
* Fix package dir cleanup failing on Win32 due to executable being in use [done]
|
||||||
|
|
||||||
* Test installing update if Microsoft Word with Mendeley plugin is active
|
* Test installing update if Microsoft Word with Mendeley plugin is active
|
||||||
* Write log file entries to an actual log file [Linux, Windows: done, Mac: TODO]
|
* Write log file entries to an actual log file [done]
|
||||||
* Test updater on an old Windows system without Visual Studio installed and statically
|
* Test updater on an old Windows system without Visual Studio installed and statically
|
||||||
link C++ runtime libraries if necessary
|
link C++ runtime libraries if necessary
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#
|
#
|
||||||
# INPUT_FILE_TARGET : The name of the target which generates INPUT_FILE
|
# INPUT_FILE_TARGET : The name of the target which generates INPUT_FILE
|
||||||
#
|
#
|
||||||
function (generate_cpp_resource_file INPUT_FILE CPP_FILE INPUT_FILE_TARGET)
|
function (generate_cpp_resource_file TARGET_NAME INPUT_DIR INPUT_FILE CPP_FILE)
|
||||||
add_custom_command(OUTPUT ${CPP_FILE}
|
add_custom_command(OUTPUT ${CPP_FILE} COMMAND cd ${INPUT_DIR} && xxd -i ${INPUT_FILE} ${CPP_FILE}
|
||||||
COMMAND xxd -i ${INPUT_FILE} ${CPP_FILE}
|
DEPENDS ${INPUT_DIR}/${INPUT_FILE})
|
||||||
DEPENDS ${INPUT_FILE_TARGET})
|
add_custom_target(${TARGET_NAME} ALL DEPENDS ${CPP_FILE})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -36,8 +36,13 @@ set (SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(SOURCES ${SOURCES} StandardDirs.mm UpdateDialogCocoa.mm)
|
set(MAC_DOCK_ICON_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/mac_dock_icon.cpp)
|
||||||
|
generate_cpp_resource_file(resource_macdockicon
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/resources
|
||||||
|
mac-dock.png ${MAC_DOCK_ICON_CPP_FILE})
|
||||||
|
set(SOURCES ${SOURCES} StandardDirs.mm UpdateDialogCocoa.mm mac_dock_icon.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(SOURCES ${SOURCES} UpdateDialogWin32.cpp)
|
set(SOURCES ${SOURCES} UpdateDialogWin32.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
@ -65,7 +70,8 @@ if (ENABLE_GTK)
|
||||||
# GTK libraries are available
|
# GTK libraries are available
|
||||||
set(GTK_UPDATER_LIB libupdatergtk.so)
|
set(GTK_UPDATER_LIB libupdatergtk.so)
|
||||||
set(GTK_BIN_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/libupdatergtk.cpp)
|
set(GTK_BIN_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/libupdatergtk.cpp)
|
||||||
generate_cpp_resource_file(${GTK_UPDATER_LIB} ${GTK_BIN_CPP_FILE} updatergtk)
|
generate_cpp_resource_file(resource_updatergtk ${CMAKE_CURRENT_BINARY_DIR} ${GTK_UPDATER_LIB} ${GTK_BIN_CPP_FILE})
|
||||||
|
add_dependencies(resource_updatergtk updatergtk)
|
||||||
|
|
||||||
set(SOURCES ${SOURCES} UpdateDialogGtkWrapper.cpp ${GTK_BIN_CPP_FILE})
|
set(SOURCES ${SOURCES} UpdateDialogGtkWrapper.cpp ${GTK_BIN_CPP_FILE})
|
||||||
set(HEADERS ${HEADERS} UpdateDialogGtkWrapper.h)
|
set(HEADERS ${HEADERS} UpdateDialogGtkWrapper.h)
|
||||||
|
|
|
@ -22,6 +22,8 @@ class UpdateDialogCocoa : public UpdateObserver
|
||||||
static void releaseAutoreleasePool(void* data);
|
static void releaseAutoreleasePool(void* data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void enableDockIcon();
|
||||||
|
|
||||||
UpdateDialogPrivate* d;
|
UpdateDialogPrivate* d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "UpdateDialogCocoa.h"
|
#include "UpdateDialogCocoa.h"
|
||||||
|
|
||||||
#include <Cocoa/Cocoa.h>
|
#include <Cocoa/Cocoa.h>
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
@ -89,8 +90,37 @@ UpdateDialogCocoa::~UpdateDialogCocoa()
|
||||||
[d->pool release];
|
[d->pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern unsigned char mac_dock_png[];
|
||||||
|
extern unsigned int mac_dock_png_len;
|
||||||
|
|
||||||
|
void UpdateDialogCocoa::enableDockIcon()
|
||||||
|
{
|
||||||
|
// convert the application to a foreground application and in
|
||||||
|
// the process, enable the dock icon
|
||||||
|
|
||||||
|
// the reverse transformation is not possible, according to
|
||||||
|
// http://stackoverflow.com/questions/2832961/is-it-possible-to-hide-the-dock-icon-programmatically
|
||||||
|
ProcessSerialNumber psn;
|
||||||
|
GetCurrentProcess(&psn);
|
||||||
|
TransformProcessType(&psn,kProcessTransformToForegroundApplication);
|
||||||
|
|
||||||
|
// loading the icon for the app has to be done after
|
||||||
|
// changing the process type
|
||||||
|
NSData* iconData = [NSData dataWithBytes:mac_dock_png length:mac_dock_png_len];
|
||||||
|
NSImage* iconImage = [[NSImage alloc] initWithData: iconData];
|
||||||
|
[NSApp setApplicationIconImage:iconImage];
|
||||||
|
[iconImage release];
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateDialogCocoa::init()
|
void UpdateDialogCocoa::init()
|
||||||
{
|
{
|
||||||
|
enableDockIcon();
|
||||||
|
|
||||||
|
// make the updater the active application. This does not
|
||||||
|
// happen automatically because the updater starts as a
|
||||||
|
// background application
|
||||||
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
|
|
||||||
d->delegate = [[UpdateDialogDelegate alloc] init];
|
d->delegate = [[UpdateDialogDelegate alloc] init];
|
||||||
d->delegate->dialog = d;
|
d->delegate->dialog = d;
|
||||||
|
|
||||||
|
|
BIN
src/resources/mac-dock.png
Normal file
BIN
src/resources/mac-dock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Loading…
Reference in a new issue