1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-13 12:31:52 +02:00

Add sparkle support for OSX

This commit is contained in:
Leo Franchi 2011-03-04 17:02:03 -05:00
parent e178f00fab
commit 7aa844f81b
11 changed files with 104 additions and 28 deletions

View File

@ -7,7 +7,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
SET( ORGANIZATION_NAME "Tomahawk" )
SET( ORGANIZATION_DOMAIN "tomahawk-player.org" )
SET( APPLICATION_NAME "Player" )
SET( VERSION "0.0.0" )
SET( VERSION "0.0.1" )
# set paths

View File

@ -24,17 +24,21 @@
<string>Tomahawk</string>
<key>LSMinimumSystemVersion</key>
<string>10.5.0</string>
<key>SUFeedURL</key>
<string>http://download.tomahawk-player.org/sparkle</string>
<key>SUPublicDSAKeyFile</key>
<string>sparkle_pub.pem</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Tomahawk URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tomahawk</string>
</array>
</dict>
</array>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Tomahawk URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>tomahawk</string>
</array>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>

View File

@ -47,6 +47,7 @@ CREATEDMG='1'
header deposx
$ROOT/../admin/mac/deposx.sh
header "Copying Sparkle pubkey"
cp $ROOT/../admin/mac/sparkle_pub.pem Contents/Resources
header Done!

17
admin/mac/sparkle.rss Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Tomahawk Player Changelog</title>
<link>http://download.tomahawk-player.org/sparkle</link>
<description>Most recent changes with links to updates.</description>
<language>en</language>
<item>
<title>Version 0.0.1 (Tomahawk Player - It Lives!)</title>
<sparkle:releaseNotesLink>
<!-- http://you.com/app/2.0.html -->
</sparkle:releaseNotesLink>
<pubDate>Fri, 04 Mar 2011 16:05:15 -0500</pubDate>
<enclosure url="http://download.tomahawk-player.org/sparkle/updates/tomahawk0.1.tar.bz2" sparkle:version="0.0.1" length="10627176" type="application/octet-stream" sparkle:dsaSignature="MC0CFAyYNZq58X7hPC7Qn+DtotVgym7pAhUA5hkLGllYxjOwwCf7i2LxUsvGyps=" />
</item>
</channel>
</rss>

20
admin/mac/sparkle_pub.pem Normal file
View File

@ -0,0 +1,20 @@
-----BEGIN PUBLIC KEY-----
MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQDRltnNbKWFroVCsG1nTSdlTDmo7fjl
tgOuQ0YB2s0a1bcqgQ5YJRE59pFvF/z2pkHEHdyBA6USd9N7/T9lolwNcJoByJpO
MobUNs04elqZXliriaAdoSb2g6ZpxiedppbbyNP/BlK6o+zpyn0LVYXDI/OwJFzS
xjGXM+rBEWdUJnogZxV31gF9W3yD1Quz6icBulT9V/Soo6me9Mc60ooKSYj4Zgqd
3ln8tG90RFnWfbb0nbrITvR3ll6XXLfn081tjhymcXqHcgvaaqcmpKWL6ZWwX1mH
3t1pImnif/tSSZPG21KGE3FtuQ/+YFo19apQ6U6l8kaSFxqcDLAYzBy9AhUA/QfN
8WEIvzOEZ9uSWT7lYy64mUkCggEABsUmcs3kwjrmszIAAmPIowA0DBrxWZL03JBV
bDKT6tNHZaFFlCufVSjiL1EFZjRARC16OWYaDcElUsZYFMcsNIIa8LyDQaq6+SSm
quhMO5heeJiYPrutDiJzbJr0+HoY77Ll+Q4/cEkl0UAN4Ovp18WKwaq6GpHAvBnv
71LunLGAKsVb5joXBQ8In6zQkibJhgiBJwzLK90/j0OTiDaaOwM3PsAegORBVlVE
TAk4AQmawmF8nBGLzTyKXl83J571ku1Mm2JTl16jMYziKARKXYBmkcP1at0YddVK
WWpAwRKSxOucVJYfV58JqmjZqst8BBeH6esQKr5dklUvvDMaEwOCAQYAAoIBAQCw
5mo+8/R3S9cNYg9o8JNJGdSbMhSkurILHh9WNElsIC3RNtPcpijmAnWtXTVDhe6w
77wLj37tUuFGbsu2qPXtZoup35emf9DDshZ5w5UOclPaZ9HYjlC1H64c6d66Rllk
fY6FRDv9qVfjT84APbvMDrk6csJ5YHxFPDaqeQaFB0nxFiCMVwjEx+ZSvQNK1jJ2
o2gtuOvSPVSphsMeJ72DDNxO+SRRVnOmWaxg9rlmFuGle6Z+UJ2FItfmPEvhSBMY
hzndUbC7Wi4sIpBzbm9O5MiPYMv0VmN+0t1156EiC9uR4f7AKH2S94dnQob/YeY0
jMH+XxU/wzGUCmsOx1lx
-----END PUBLIC KEY-----

View File

@ -14,13 +14,15 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
rtaudio
)
if (APPLE)
# find_library(GROWL Growl)
# option(ENABLE_SPARKLE "Sparkle updating" ON)
# find_library(SPARKLE Sparkle)
# if (ENABLE_SPARKLE AND SPARKLE)
# set(HAVE_SPARKLE ON)
# endif (ENABLE_SPARKLE AND SPARKLE)
option(ENABLE_SPARKLE "Sparkle updating" ON)
find_library(SPARKLE Sparkle)
if (ENABLE_SPARKLE AND SPARKLE)
set(HAVE_SPARKLE ON)
set( OS_SPECIFIC_LINK_LIBRARIES ${OS_SPECIFIC_LINK_LIBRARIES} ${SPARKLE} )
endif(ENABLE_SPARKLE AND SPARKLE)
# Uses Darwin kernel version.
# 9.8.0 -> 10.5/Leopard
# 10.4.0 -> 10.6/Snow Leopard

View File

@ -64,12 +64,6 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
tomahawkwindow.cpp
)
IF( APPLE )
SET( tomahawkHeaders ${tomahawkHeaders} mac/tomahawkapp_mac.h mac/macshortcuthandler.h )
SET( tomahawkSources ${tomahawkSources} mac/tomahawkapp_mac.mm mac/macshortcuthandler.cpp )
ENDIF( APPLE )
SET( tomahawkHeaders ${tomahawkHeaders}
"${TOMAHAWK_INC_DIR}/tomahawk/tomahawkapp.h"
"${TOMAHAWK_INC_DIR}/tomahawk/infosystem.h"
@ -155,6 +149,15 @@ IF( UNIX )
INCLUDE( "CMakeLists.unix.txt" )
ENDIF( UNIX )
IF( APPLE )
SET( tomahawkHeaders ${tomahawkHeaders} mac/tomahawkapp_mac.h mac/macshortcuthandler.h )
SET( tomahawkSources ${tomahawkSources} mac/tomahawkapp_mac.mm mac/macshortcuthandler.cpp )
IF(HAVE_SPARKLE)
SET( tomahawkHeaders ${tomahawkHeaders} ${SPARKLE}/Headers )
ENDIF(HAVE_SPARKLE)
ENDIF( APPLE )
IF(GLOOX_FOUND)
SET( tomahawkHeaders ${tomahawkHeaders} xmppbot/xmppbot.h )
@ -214,4 +217,13 @@ TARGET_LINK_LIBRARIES( tomahawk
${QTWEETLIB_LIBRARIES}
)
IF( APPLE )
IF(HAVE_SPARKLE)
MESSAGE("Sparkle Found, installing framekwork in bundle")
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/Frameworks/Sparkle.framework")
INSTALL(FILES "${CMAKE_SOURCE_DIR}/admin/mac/sparkle_pub.pem" DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/Resources")
ENDIF(HAVE_SPARKLE)
ENDIF( APPLE )
INCLUDE( "CPack.txt" )

View File

@ -24,6 +24,7 @@ void macMain();
void setShortcutHandler(Tomahawk::MacShortcutHandler* engine);
// used for opening files with tomahawk
void setApplicationHandler(PlatformInterface* handler);
void checkForUpdates();
};

View File

@ -16,6 +16,10 @@
#import <AppKit/NSEvent.h>
#import <AppKit/NSNibDeclarations.h>
#ifdef HAVE_SPARKLE
#import <Sparkle/SUUpdater.h>
#endif
// Capture global media keys on Mac (Cocoa only!)
// See: http://www.rogueamoeba.com/utm/2007/09/29/apple-keyboard-media-key-event-handling/
@ -146,10 +150,10 @@ void Tomahawk::macMain() {
[[NSAutoreleasePool alloc] init];
// Creates and sets the magic global variable so QApplication will find it.
[MacApplication sharedApplication];
#ifdef HAVE_SPARKLE
#ifdef HAVE_SPARKLE
// Creates and sets the magic global variable for Sparkle.
[[SUUpdater sharedUpdater] setDelegate: NSApp];
#endif
#endif
}
@ -161,8 +165,8 @@ void Tomahawk::setApplicationHandler(Tomahawk::PlatformInterface* handler) {
[NSApp setApplicationHandler: handler];
}
void CheckForUpdates() {
#ifdef HAVE_SPARKLE
void Tomahawk::checkForUpdates() {
#ifdef HAVE_SPARKLE
[[SUUpdater sharedUpdater] checkForUpdates: NSApp];
#endif
#endif
}

View File

@ -124,6 +124,12 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
toolbar->setToolButtonStyle( Qt::ToolButtonFollowStyle );
toolbar->installEventFilter( new WidgetDragFilter( toolbar ) );
#if defined( Q_OS_DARWIN ) && defined( HAVE_SPARKLE )
QAction* checkForUpdates = ui->menu_Help->addAction( tr( "Check for updates...") );
checkForUpdates->setMenuRole( QAction::ApplicationSpecificRole );
connect(checkForUpdates, SIGNAL( triggered( bool ) ), SLOT( checkForUpdates() ) );
#endif
m_backAvailable = toolbar->addAction( QIcon( RESPATH "images/back.png" ), tr( "Back" ), PlaylistManager::instance(), SLOT( historyBack() ) );
m_forwardAvailable = toolbar->addAction( QIcon( RESPATH "images/forward.png" ), tr( "Forward" ), PlaylistManager::instance(), SLOT( historyForward() ) );
toolbar->addAction( QIcon( RESPATH "images/home.png" ), tr( "Home" ), PlaylistManager::instance(), SLOT( showWelcomePage() ) );
@ -422,3 +428,11 @@ TomahawkWindow::showAboutTomahawk()
"Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Alejandro Wainzinger, Harald Sitter and Steve Robertson" )
.arg( qApp->applicationVersion() ) );
}
void
TomahawkWindow::checkForUpdates()
{
#ifdef Q_WS_MAC
Tomahawk::checkForUpdates();
#endif
}

View File

@ -58,6 +58,7 @@ private slots:
void onHistoryForwardAvailable( bool avail );
void showAboutTomahawk();
void checkForUpdates();
private:
void loadSettings();