mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 03:27:40 +01:00
Remove Growl support.
This commit is contained in:
parent
57e4217ccc
commit
712d8ecd8a
@ -107,7 +107,6 @@ if(LASTFM_INCLUDE_DIRS AND LASTFM1_INCLUDE_DIRS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
find_library(GROWL Growl)
|
|
||||||
find_library(SPARKLE Sparkle)
|
find_library(SPARKLE Sparkle)
|
||||||
|
|
||||||
find_library(SPOTIFY libspotify)
|
find_library(SPOTIFY libspotify)
|
||||||
|
@ -853,7 +853,6 @@ optional_source(HAVE_SPOTIFY_DOWNLOADER
|
|||||||
# Platform specific - OS X
|
# Platform specific - OS X
|
||||||
optional_source(APPLE
|
optional_source(APPLE
|
||||||
INCLUDE_DIRECTORIES
|
INCLUDE_DIRECTORIES
|
||||||
${GROWL}/Headers
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/google-breakpad/client/mac/build/Release/Breakpad.framework
|
${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/google-breakpad/client/mac/build/Release/Breakpad.framework
|
||||||
SOURCES
|
SOURCES
|
||||||
core/macfslistener.mm
|
core/macfslistener.mm
|
||||||
@ -1290,7 +1289,6 @@ endif()
|
|||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
target_link_libraries(clementine_lib
|
target_link_libraries(clementine_lib
|
||||||
${GROWL}
|
|
||||||
/System/Library/Frameworks/AppKit.framework
|
/System/Library/Frameworks/AppKit.framework
|
||||||
/System/Library/Frameworks/Carbon.framework
|
/System/Library/Frameworks/Carbon.framework
|
||||||
/System/Library/Frameworks/CoreAudio.framework
|
/System/Library/Frameworks/CoreAudio.framework
|
||||||
@ -1395,9 +1393,6 @@ if (APPLE)
|
|||||||
DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/Sparkle.framework")
|
DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/Sparkle.framework")
|
||||||
endif (HAVE_SPARKLE)
|
endif (HAVE_SPARKLE)
|
||||||
|
|
||||||
install(DIRECTORY "${GROWL}/Versions/Current/Resources"
|
|
||||||
DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/Growl.framework")
|
|
||||||
|
|
||||||
install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist"
|
install(FILES "${QT_QTCORE_LIBRARY_RELEASE}/Contents/Info.plist"
|
||||||
DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/QtCore.framework/Contents")
|
DESTINATION "${CMAKE_BINARY_DIR}/clementine.app/Contents/Frameworks/QtCore.framework/Contents")
|
||||||
install(FILES "${QT_QTGUI_LIBRARY_RELEASE}/Contents/Info.plist"
|
install(FILES "${QT_QTGUI_LIBRARY_RELEASE}/Contents/Info.plist"
|
||||||
|
@ -127,11 +127,6 @@ class OSD : public QObject {
|
|||||||
QString last_image_uri_;
|
QString last_image_uri_;
|
||||||
QImage last_image_;
|
QImage last_image_;
|
||||||
|
|
||||||
#ifdef Q_OS_DARWIN
|
|
||||||
class GrowlNotificationWrapper;
|
|
||||||
GrowlNotificationWrapper* wrapper_;
|
|
||||||
#endif // Q_OS_DARWIN
|
|
||||||
|
|
||||||
#ifdef HAVE_DBUS
|
#ifdef HAVE_DBUS
|
||||||
std::unique_ptr<OrgFreedesktopNotificationsInterface> interface_;
|
std::unique_ptr<OrgFreedesktopNotificationsInterface> interface_;
|
||||||
uint notification_id_;
|
uint notification_id_;
|
||||||
|
@ -22,117 +22,8 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
#import <GrowlApplicationBridge.h>
|
|
||||||
|
|
||||||
#include "core/scoped_nsautorelease_pool.h"
|
|
||||||
#include "core/scoped_nsobject.h"
|
#include "core/scoped_nsobject.h"
|
||||||
|
|
||||||
@interface GrowlInterface : NSObject<GrowlApplicationBridgeDelegate> {
|
|
||||||
}
|
|
||||||
- (void)SendGrowlAlert:(NSString*)message
|
|
||||||
title:(NSString*)title
|
|
||||||
image:(NSData*)image;
|
|
||||||
- (void)ClickCallback; // Called when user clicks on notification.
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation GrowlInterface
|
|
||||||
|
|
||||||
- (id)init {
|
|
||||||
if ((self = [super init])) {
|
|
||||||
[GrowlApplicationBridge setGrowlDelegate:self];
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc {
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSDictionary*)registrationDictionaryForGrowl {
|
|
||||||
NSArray* array = [NSArray
|
|
||||||
arrayWithObjects:@"next_track", nil]; // Valid notification names.
|
|
||||||
NSDictionary* dict = [NSDictionary
|
|
||||||
dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:1], @"TicketVersion",
|
|
||||||
array, @"AllNotifications", array,
|
|
||||||
@"DefaultNotifications",
|
|
||||||
@"com.davidsansome.clementine",
|
|
||||||
@"ApplicationId", nil];
|
|
||||||
return dict;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)growlNotificationWasClicked:(id)clickContext {
|
|
||||||
if (clickContext) {
|
|
||||||
[self ClickCallback];
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)SendGrowlAlert:(NSString*)message
|
|
||||||
title:(NSString*)title
|
|
||||||
image:(NSData*)image {
|
|
||||||
[GrowlApplicationBridge
|
|
||||||
notifyWithTitle:title
|
|
||||||
description:message
|
|
||||||
notificationName:@"next_track"
|
|
||||||
iconData:image
|
|
||||||
priority:0
|
|
||||||
isSticky:NO
|
|
||||||
clickContext:@"click_callback"]; // String sent to our callback.
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)ClickCallback {
|
|
||||||
qDebug() << "Growl notification clicked!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
class OSD::GrowlNotificationWrapper {
|
|
||||||
public:
|
|
||||||
GrowlNotificationWrapper() {
|
|
||||||
growl_interface_ = [[GrowlInterface alloc] init];
|
|
||||||
}
|
|
||||||
|
|
||||||
~GrowlNotificationWrapper() { [growl_interface_ release]; }
|
|
||||||
|
|
||||||
void ShowMessage(const QString& summary, const QString& message,
|
|
||||||
const QImage& image) {
|
|
||||||
|
|
||||||
NSString* mac_message =
|
|
||||||
[[NSString alloc] initWithUTF8String:message.toUtf8().constData()];
|
|
||||||
NSString* mac_summary =
|
|
||||||
[[NSString alloc] initWithUTF8String:summary.toUtf8().constData()];
|
|
||||||
|
|
||||||
NSData* image_data = nil;
|
|
||||||
// Growl expects raw TIFF data.
|
|
||||||
// This is nasty but it keeps the API nice.
|
|
||||||
if (!image.isNull()) {
|
|
||||||
QByteArray tiff_data;
|
|
||||||
QBuffer tiff(&tiff_data);
|
|
||||||
image.save(&tiff, "TIFF");
|
|
||||||
image_data =
|
|
||||||
[NSData dataWithBytes:tiff_data.constData() length:tiff_data.size()];
|
|
||||||
}
|
|
||||||
|
|
||||||
[growl_interface_ SendGrowlAlert:mac_message
|
|
||||||
title:mac_summary
|
|
||||||
image:image_data];
|
|
||||||
|
|
||||||
[mac_message release];
|
|
||||||
[mac_summary release];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
GrowlInterface* growl_interface_;
|
|
||||||
ScopedNSAutoreleasePool pool_;
|
|
||||||
};
|
|
||||||
|
|
||||||
void OSD::Init() { wrapper_ = new GrowlNotificationWrapper; }
|
|
||||||
|
|
||||||
bool OSD::SupportsNativeNotifications() { return true; }
|
|
||||||
|
|
||||||
bool OSD::SupportsTrayPopups() { return false; }
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool NotificationCenterSupported() {
|
bool NotificationCenterSupported() {
|
||||||
@ -152,17 +43,23 @@ void SendNotificationCenterMessage(NSString* title, NSString* subtitle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OSD::Init() {}
|
||||||
|
|
||||||
|
bool OSD::SupportsNativeNotifications() {
|
||||||
|
return NotificationCenterSupported();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OSD::SupportsTrayPopups() { return false; }
|
||||||
|
|
||||||
|
|
||||||
void OSD::ShowMessageNative(const QString& summary, const QString& message,
|
void OSD::ShowMessageNative(const QString& summary, const QString& message,
|
||||||
const QString& icon, const QImage& image) {
|
const QString& icon, const QImage& image) {
|
||||||
Q_UNUSED(icon);
|
Q_UNUSED(icon);
|
||||||
|
|
||||||
if (NotificationCenterSupported()) {
|
if (NotificationCenterSupported()) {
|
||||||
scoped_nsobject<NSString> mac_message(
|
scoped_nsobject<NSString> mac_message(
|
||||||
[[NSString alloc] initWithUTF8String:message.toUtf8().constData()]);
|
[[NSString alloc] initWithUTF8String:message.toUtf8().constData()]);
|
||||||
scoped_nsobject<NSString> mac_summary(
|
scoped_nsobject<NSString> mac_summary(
|
||||||
[[NSString alloc] initWithUTF8String:summary.toUtf8().constData()]);
|
[[NSString alloc] initWithUTF8String:summary.toUtf8().constData()]);
|
||||||
SendNotificationCenterMessage(mac_summary.get(), mac_message.get());
|
SendNotificationCenterMessage(mac_summary.get(), mac_message.get());
|
||||||
} else {
|
|
||||||
wrapper_->ShowMessage(summary, message, image);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user