mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-31 17:42:13 +02:00
Add sparkle support for OSX
This commit is contained in:
@@ -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
|
||||
|
@@ -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" )
|
||||
|
@@ -24,6 +24,7 @@ void macMain();
|
||||
void setShortcutHandler(Tomahawk::MacShortcutHandler* engine);
|
||||
// used for opening files with tomahawk
|
||||
void setApplicationHandler(PlatformInterface* handler);
|
||||
void checkForUpdates();
|
||||
|
||||
};
|
||||
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@ private slots:
|
||||
void onHistoryForwardAvailable( bool avail );
|
||||
|
||||
void showAboutTomahawk();
|
||||
void checkForUpdates();
|
||||
|
||||
private:
|
||||
void loadSettings();
|
||||
|
Reference in New Issue
Block a user