parent
0118120766
commit
f74f8e3c53
3 changed files with 34 additions and 5 deletions
|
@ -117,7 +117,7 @@ void OSystem_Win32::initBackend() {
|
||||||
|
|
||||||
#if defined(USE_SPARKLE)
|
#if defined(USE_SPARKLE)
|
||||||
// Initialize updates manager
|
// Initialize updates manager
|
||||||
_updateManager = new Win32UpdateManager();
|
_updateManager = new Win32UpdateManager((SdlWindow_Win32*)_window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize text to speech
|
// Initialize text to speech
|
||||||
|
|
|
@ -27,10 +27,12 @@
|
||||||
#include "backends/updates/win32/win32-updates.h"
|
#include "backends/updates/win32/win32-updates.h"
|
||||||
|
|
||||||
#ifdef USE_SPARKLE
|
#ifdef USE_SPARKLE
|
||||||
|
#include "backends/platform/sdl/win32/win32-window.h"
|
||||||
#include "common/translation.h"
|
#include "common/translation.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <windows.h>
|
||||||
#include <winsparkle.h>
|
#include <winsparkle.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,10 +52,15 @@
|
||||||
* https://winsparkle.org/
|
* https://winsparkle.org/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Win32UpdateManager::Win32UpdateManager() {
|
|
||||||
const char *appcastUrl = "https://www.scummvm.org/appcasts/macosx/release.xml";
|
|
||||||
|
|
||||||
win_sparkle_set_appcast_url(appcastUrl);
|
static SdlWindow_Win32 *_window;
|
||||||
|
|
||||||
|
Win32UpdateManager::Win32UpdateManager(SdlWindow_Win32 *window) {
|
||||||
|
_window = window;
|
||||||
|
const char *appcastUrl = "https://www.scummvm.org/appcasts/macosx/release.xml";
|
||||||
|
win_sparkle_set_appcast_url(appcastUrl);
|
||||||
|
win_sparkle_set_can_shutdown_callback(canShutdownCallback);
|
||||||
|
win_sparkle_set_shutdown_request_callback(shutdownRequestCallback);
|
||||||
win_sparkle_init();
|
win_sparkle_init();
|
||||||
|
|
||||||
if (!ConfMan.hasKey("updates_check")
|
if (!ConfMan.hasKey("updates_check")
|
||||||
|
@ -129,4 +136,20 @@ bool Win32UpdateManager::getLastUpdateCheckTimeAndDate(TimeDate &t) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WinSparkle calls this to ask if we can shut down.
|
||||||
|
// At this point the download has completed, the user has
|
||||||
|
// selected Install Update, and the installer has started.
|
||||||
|
// This callback runs on a non-main thread.
|
||||||
|
int Win32UpdateManager::canShutdownCallback() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WinSparkle calls this to request that we shut down.
|
||||||
|
// This callback runs on a non-main thread so we post
|
||||||
|
// a WM_CLOSE message to our window so that we exit
|
||||||
|
// cleanly, as opposed to calling g_system->quit().
|
||||||
|
void Win32UpdateManager::shutdownRequestCallback() {
|
||||||
|
PostMessage(_window->getHwnd(), WM_CLOSE, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,9 +29,11 @@
|
||||||
|
|
||||||
#include "common/updates.h"
|
#include "common/updates.h"
|
||||||
|
|
||||||
|
class SdlWindow_Win32;
|
||||||
|
|
||||||
class Win32UpdateManager : public Common::UpdateManager {
|
class Win32UpdateManager : public Common::UpdateManager {
|
||||||
public:
|
public:
|
||||||
Win32UpdateManager();
|
Win32UpdateManager(SdlWindow_Win32 *window);
|
||||||
virtual ~Win32UpdateManager();
|
virtual ~Win32UpdateManager();
|
||||||
|
|
||||||
virtual void checkForUpdates();
|
virtual void checkForUpdates();
|
||||||
|
@ -43,6 +45,10 @@ public:
|
||||||
virtual int getUpdateCheckInterval();
|
virtual int getUpdateCheckInterval();
|
||||||
|
|
||||||
virtual bool getLastUpdateCheckTimeAndDate(TimeDate &t);
|
virtual bool getLastUpdateCheckTimeAndDate(TimeDate &t);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static int canShutdownCallback();
|
||||||
|
static void shutdownRequestCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue