new 3rdparty/sparkle example

This commit is contained in:
therecipe 2018-12-06 00:01:43 +01:00
parent 531ee97d86
commit 33cc660323
5 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>sparkle</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleIconFile</key>
<string>sparkle.icns</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.sparkle</string>
<key>CFBundleName</key>
<string>sparkle</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSMinimumSystemVersion</key>
<string>10.11</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SUFeedURL</key>
<string>https://example.com/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>someBase64Key</string>
</dict>
</plist>

6
internal/examples/3rdparty/sparkle/init.sh vendored Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -ev
mkdir -p ./darwin/Contents/Frameworks
curl -sL https://github.com/sparkle-project/Sparkle/releases/download/1.21.0/Sparkle-1.21.0.tar.bz2 | tar -C ./darwin/Contents/Frameworks -x Sparkle.framework

View file

@ -0,0 +1,17 @@
package main
import (
"os"
"github.com/therecipe/qt/widgets"
)
func main() {
widgets.NewQApplication(len(os.Args), os.Args)
button := widgets.NewQPushButton2("check for updates", nil)
button.ConnectClicked(func(bool) { sparkle_checkUpdates() })
button.Show()
widgets.QApplication_Exec()
}

View file

@ -0,0 +1,11 @@
package main
/*
#cgo CFLAGS: -I ${SRCDIR}/darwin/Contents/Frameworks/Sparkle.framework
#cgo LDFLAGS: -F ${SRCDIR}/darwin/Contents/Frameworks -framework Sparkle
void sparkle_checkUpdates();
*/
import "C"
func sparkle_checkUpdates() { C.sparkle_checkUpdates() }

View file

@ -0,0 +1,12 @@
#import <Headers/SUUpdater.h>
static SUUpdater* updater = nil;
void sparkle_checkUpdates()
{
if (!updater)
updater = [[SUUpdater sharedUpdater] retain];
[updater setUpdateCheckInterval:3600];
[updater checkForUpdatesInBackground];
}