Most of the work to use Sparkle on OS X.

Updates issue #210.
This commit is contained in:
John Maguire 2010-04-15 15:23:12 +00:00
parent dd86b60411
commit 8abb9ecd4b
8 changed files with 73 additions and 3 deletions

View File

@ -44,6 +44,7 @@ find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
if (APPLE)
find_library(GROWL Growl)
find_library(SPARKLE Sparkle)
endif (APPLE)
if(${CMAKE_BUILD_TYPE} MATCHES "Release")

38
dist/Info.plist vendored Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>clementine</string>
<key>CFBundleGetInfoString</key>
<string>Clementine 0.3 beta 2</string>
<key>CFBundleIconFile</key>
<string>clementine</string>
<key>CFBundleIdentifier</key>
<string>com.davidsansome.clementine</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>0.3 beta 3</string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.3_beta3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>123</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>SUFeedURL</key>
<string>http://clementine-player.appspot.com/sparkle</string>
</dict>
</plist>

View File

@ -356,11 +356,13 @@ target_link_libraries(clementine_lib
if (APPLE)
target_link_libraries(clementine_lib
${GROWL}
${SPARKLE}
/System/Library/Frameworks/Carbon.framework
/System/Library/Frameworks/Foundation.framework
/System/Library/Frameworks/AppKit.framework
)
include_directories(${GROWL}/Headers)
include_directories(${SPARKLE}/Headers)
else (APPLE)
target_link_libraries(clementine_lib qxt)
endif (APPLE)

View File

@ -9,6 +9,7 @@ namespace mac {
void MacMain();
void SetShortcutHandler(GlobalShortcuts* handler);
void SetApplicationHandler(QObject* handler);
void CheckForUpdates();
} // namespace mac

View File

@ -1,18 +1,24 @@
#import <IOKit/hidsystem/ev_keymap.h>
#import <AppKit/NSApplication.h>
#import <AppKit/NSEvent.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSTimer.h>
#import <Foundation/NSURL.h>
#import <AppKit/NSNibDeclarations.h>
#import <Sparkle/SUUpdater.h>
#include "globalshortcuts/globalshortcuts.h"
#include "mac_startup.h"
#include <QCoreApplication>
#include <QEvent>
#include <QObject>
#import <AppKit/NSApplication.h>
// Capture global media keys on Mac (Cocoa only!)
// See: http://www.rogueamoeba.com/utm/2007/09/29/apple-keyboard-media-key-event-handling/
@interface MacApplication :NSApplication <NSApplicationDelegate> {
@interface MacApplication :NSApplication { //<NSApplicationDelegate> { //, SUUpdaterDelegateInformalProtocol> {
GlobalShortcuts* shortcut_handler_;
QObject* application_handler_;
}
@ -107,6 +113,8 @@ namespace mac {
void MacMain() {
// Creates and sets the magic global variable so QApplication will find it.
[MacApplication sharedApplication];
// Creates and sets the magic global variable for Sparkle.
[[SUUpdater sharedUpdater] setDelegate: NSApp];
}
void SetShortcutHandler(GlobalShortcuts* handler) {
@ -117,4 +125,8 @@ void SetApplicationHandler(QObject* handler) {
[NSApp SetApplicationHandler: handler];
}
void CheckForUpdates() {
[[SUUpdater sharedUpdater] checkForUpdates: NSApp];
}
} // namespace mac

View File

@ -41,6 +41,7 @@
#include "engines/gstengine.h"
#include "equalizer.h"
#include "commandlineoptions.h"
#include "mac_startup.h"
#include "globalshortcuts/globalshortcuts.h"
@ -343,8 +344,12 @@ MainWindow::MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWid
tray_menu->addSeparator();
tray_menu->addAction(ui_.action_quit);
// We use the dock instead of the system tray on mac.
#ifdef Q_OS_DARWIN
// Add check for updates item to application menu.
QAction* check_updates = ui_.menuSettings->addAction(tr("Check for updates..."));
check_updates->setMenuRole(QAction::ApplicationSpecificRole);
connect(check_updates, SIGNAL(triggered(bool)), SLOT(CheckForUpdates()));
// We use the dock instead of the system tray on mac.
qt_mac_set_dock_menu(tray_menu);
#else
tray_icon_->setContextMenu(tray_menu);
@ -999,3 +1004,9 @@ bool MainWindow::event(QEvent* event) {
}
return QMainWindow::event(event);
}
void MainWindow::CheckForUpdates() {
#ifdef Q_OS_DARWIN
mac::CheckForUpdates();
#endif
}

View File

@ -127,6 +127,8 @@ class MainWindow : public QMainWindow {
void CommandlineOptionsReceived(const QByteArray& serialized_options);
void CheckForUpdates();
private:
void SaveGeometry();

View File

@ -17,6 +17,9 @@ msgstr ""
msgid "Stop after this track"
msgstr ""
msgid "Check for updates..."
msgstr ""
msgid "Pause"
msgstr ""