Make DBUS bits optional on Linux. Thanks Nickollai. Fixes issue #1177
This commit is contained in:
parent
6737b8a5c2
commit
e3a9bd7b26
|
@ -9,7 +9,18 @@ include(cmake/Rpm.cmake)
|
||||||
|
|
||||||
find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml)
|
find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml)
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
find_package(Qt4 REQUIRED QtDbus)
|
option(ENABLE_DBUS "Enable D-Bus, MPRIS and native notifications. Required for DeviceKit and Wii remote support" ON)
|
||||||
|
if(ENABLE_DBUS)
|
||||||
|
find_package(Qt4 REQUIRED QtDbus)
|
||||||
|
set(HAVE_DBUS ON)
|
||||||
|
|
||||||
|
option(ENABLE_DEVICEKIT "DeviceKit backend" ON)
|
||||||
|
if(ENABLE_DEVICEKIT)
|
||||||
|
set(HAVE_DEVICEKIT ON)
|
||||||
|
endif(ENABLE_DEVICEKIT)
|
||||||
|
|
||||||
|
option(ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON)
|
||||||
|
endif(ENABLE_DBUS)
|
||||||
endif(UNIX AND NOT APPLE)
|
endif(UNIX AND NOT APPLE)
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
|
@ -127,10 +138,6 @@ option(BUNDLE_PROJECTM_PRESETS "Install Clementine's own copies of libprojectm p
|
||||||
option(ENABLE_SOUNDMENU "Add Clementine to the Gnome sound menu" ON)
|
option(ENABLE_SOUNDMENU "Add Clementine to the Gnome sound menu" ON)
|
||||||
option(ENABLE_LIBLASTFM "Use liblastfm for fetching song info, scrobbling and radio streams" ON)
|
option(ENABLE_LIBLASTFM "Use liblastfm for fetching song info, scrobbling and radio streams" ON)
|
||||||
|
|
||||||
if(NOT APPLE AND NOT WIN32)
|
|
||||||
option(ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON)
|
|
||||||
endif(NOT APPLE AND NOT WIN32)
|
|
||||||
|
|
||||||
if(ENABLE_LIBGPOD AND LIBGPOD_FOUND)
|
if(ENABLE_LIBGPOD AND LIBGPOD_FOUND)
|
||||||
set(HAVE_LIBGPOD ON)
|
set(HAVE_LIBGPOD ON)
|
||||||
endif(ENABLE_LIBGPOD AND LIBGPOD_FOUND)
|
endif(ENABLE_LIBGPOD AND LIBGPOD_FOUND)
|
||||||
|
@ -260,10 +267,12 @@ add_custom_target(uninstall
|
||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
|
||||||
# Show a summary of what we have enabled
|
# Show a summary of what we have enabled
|
||||||
|
summary_add("devices: DeviceKit backend" HAVE_DEVICEKIT)
|
||||||
summary_add("devices: iPod classic support" HAVE_LIBGPOD)
|
summary_add("devices: iPod classic support" HAVE_LIBGPOD)
|
||||||
summary_add("devices: iPod Touch, iPhone, iPad support" HAVE_IMOBILEDEVICE)
|
summary_add("devices: iPod Touch, iPhone, iPad support" HAVE_IMOBILEDEVICE)
|
||||||
summary_add("devices: MTP support" HAVE_LIBMTP)
|
summary_add("devices: MTP support" HAVE_LIBMTP)
|
||||||
summary_add("devices: GIO backend" HAVE_GIO)
|
summary_add("devices: GIO backend" HAVE_GIO)
|
||||||
|
summary_add("D-Bus support" HAVE_DBUS)
|
||||||
summary_add("Gnome sound menu integration" HAVE_LIBINDICATE)
|
summary_add("Gnome sound menu integration" HAVE_LIBINDICATE)
|
||||||
summary_add("Wiimote support" ENABLE_WIIMOTEDEV)
|
summary_add("Wiimote support" ENABLE_WIIMOTEDEV)
|
||||||
summary_add("Visualisations" ENABLE_VISUALISATIONS)
|
summary_add("Visualisations" ENABLE_VISUALISATIONS)
|
||||||
|
|
|
@ -534,7 +534,7 @@ else(APPLE)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
# DBUS and MPRIS - Linux specific
|
# DBUS and MPRIS - Linux specific
|
||||||
if(NOT APPLE AND NOT WIN32)
|
if(HAVE_DBUS)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
|
||||||
|
|
||||||
# Hack to get it to generate interfaces without namespaces - required
|
# Hack to get it to generate interfaces without namespaces - required
|
||||||
|
@ -570,12 +570,14 @@ if(NOT APPLE AND NOT WIN32)
|
||||||
dbus/notification)
|
dbus/notification)
|
||||||
|
|
||||||
# DeviceKit DBUS interfaces
|
# DeviceKit DBUS interfaces
|
||||||
qt4_add_dbus_interface(SOURCES
|
if(HAVE_DEVICEKIT)
|
||||||
dbus/org.freedesktop.UDisks.xml
|
qt4_add_dbus_interface(SOURCES
|
||||||
dbus/udisks)
|
dbus/org.freedesktop.UDisks.xml
|
||||||
qt4_add_dbus_interface(SOURCES
|
dbus/udisks)
|
||||||
dbus/org.freedesktop.UDisks.Device.xml
|
qt4_add_dbus_interface(SOURCES
|
||||||
dbus/udisksdevice)
|
dbus/org.freedesktop.UDisks.Device.xml
|
||||||
|
dbus/udisksdevice)
|
||||||
|
endif(HAVE_DEVICEKIT)
|
||||||
|
|
||||||
# MPRIS source
|
# MPRIS source
|
||||||
list(APPEND SOURCES core/mpris.cpp core/mpris2.cpp)
|
list(APPEND SOURCES core/mpris.cpp core/mpris2.cpp)
|
||||||
|
@ -599,12 +601,14 @@ if(NOT APPLE AND NOT WIN32)
|
||||||
endif(ENABLE_WIIMOTEDEV)
|
endif(ENABLE_WIIMOTEDEV)
|
||||||
|
|
||||||
# DeviceKit lister source
|
# DeviceKit lister source
|
||||||
list(APPEND SOURCES devices/devicekitlister.cpp)
|
if(HAVE_DEVICEKIT)
|
||||||
list(APPEND HEADERS devices/devicekitlister.h)
|
list(APPEND SOURCES devices/devicekitlister.cpp)
|
||||||
|
list(APPEND HEADERS devices/devicekitlister.h)
|
||||||
|
endif(HAVE_DEVICEKIT)
|
||||||
|
|
||||||
# Gnome Screensaver DBus interface
|
# Gnome Screensaver DBus interface
|
||||||
list(APPEND SOURCES ui/dbusscreensaver.cpp)
|
list(APPEND SOURCES ui/dbusscreensaver.cpp)
|
||||||
endif(NOT APPLE AND NOT WIN32)
|
endif(HAVE_DBUS)
|
||||||
|
|
||||||
# Libgpod device backend
|
# Libgpod device backend
|
||||||
if(HAVE_LIBGPOD)
|
if(HAVE_LIBGPOD)
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
# include "radio/lastfmservice.h"
|
# include "radio/lastfmservice.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
# include "mpris.h"
|
# include "mpris.h"
|
||||||
# include "mpris2.h"
|
# include "mpris2.h"
|
||||||
# include <QDBusConnection>
|
# include <QDBusConnection>
|
||||||
|
@ -67,7 +67,7 @@ Player::Player(MainWindow* main_window, PlaylistManager* playlists,
|
||||||
connect(playlists, SIGNAL(CurrentSongChanged(Song)),
|
connect(playlists, SIGNAL(CurrentSongChanged(Song)),
|
||||||
art_loader_, SLOT(LoadArt(Song)));
|
art_loader_, SLOT(LoadArt(Song)));
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
// MPRIS DBus interface.
|
// MPRIS DBus interface.
|
||||||
qDBusRegisterMetaType<QImage>();
|
qDBusRegisterMetaType<QImage>();
|
||||||
qDBusRegisterMetaType<TrackMetadata>();
|
qDBusRegisterMetaType<TrackMetadata>();
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace mpris {
|
||||||
class ArtLoader;
|
class ArtLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
# include <QDBusArgument>
|
# include <QDBusArgument>
|
||||||
QDBusArgument& operator<< (QDBusArgument& arg, const QImage& image);
|
QDBusArgument& operator<< (QDBusArgument& arg, const QImage& image);
|
||||||
const QDBusArgument& operator>> (const QDBusArgument& arg, QImage& image);
|
const QDBusArgument& operator>> (const QDBusArgument& arg, QImage& image);
|
||||||
|
|
|
@ -182,7 +182,7 @@ DeviceManager::DeviceManager(BackgroundThread<Database>* database,
|
||||||
connected_devices_model_ = new DeviceStateFilterModel(this);
|
connected_devices_model_ = new DeviceStateFilterModel(this);
|
||||||
connected_devices_model_->setSourceModel(this);
|
connected_devices_model_->setSourceModel(this);
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DEVICEKIT
|
||||||
AddLister(new DeviceKitLister);
|
AddLister(new DeviceKitLister);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GIO
|
#ifdef HAVE_GIO
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
#include "dbusscreensaver.h"
|
#include "dbusscreensaver.h"
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusConnectionInterface>
|
#include <QDBusConnectionInterface>
|
||||||
|
@ -42,7 +42,7 @@ Screensaver* Screensaver::screensaver_ = 0;
|
||||||
|
|
||||||
Screensaver* Screensaver::GetScreensaver() {
|
Screensaver* Screensaver::GetScreensaver() {
|
||||||
if (!screensaver_) {
|
if (!screensaver_) {
|
||||||
#if defined(Q_WS_X11)
|
#if defined(HAVE_DBUS)
|
||||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kGnomeService)) {
|
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kGnomeService)) {
|
||||||
screensaver_ = new DBusScreensaver(kGnomeService, kGnomePath, kGnomeInterface);
|
screensaver_ = new DBusScreensaver(kGnomeService, kGnomePath, kGnomeInterface);
|
||||||
} else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) {
|
} else if (QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "osdpretty.h"
|
#include "osdpretty.h"
|
||||||
#include "ui/systemtrayicon.h"
|
#include "ui/systemtrayicon.h"
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
# include "dbus/notification.h"
|
# include "dbus/notification.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void OSD::ShowMessage(const QString& summary,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_WS_X11
|
#ifndef HAVE_DBUS
|
||||||
void OSD::CallFinished(QDBusPendingCallWatcher*) {}
|
void OSD::CallFinished(QDBusPendingCallWatcher*) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class SystemTrayIcon;
|
||||||
|
|
||||||
class QDBusPendingCallWatcher;
|
class QDBusPendingCallWatcher;
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
# include <QDBusArgument>
|
# include <QDBusArgument>
|
||||||
# include <boost/scoped_ptr.hpp>
|
# include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class OSD : public QObject {
|
||||||
GrowlNotificationWrapper* wrapper_;
|
GrowlNotificationWrapper* wrapper_;
|
||||||
#endif // Q_OS_DARWIN
|
#endif // Q_OS_DARWIN
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
#ifdef HAVE_DBUS
|
||||||
boost::scoped_ptr<OrgFreedesktopNotificationsInterface> interface_;
|
boost::scoped_ptr<OrgFreedesktopNotificationsInterface> interface_;
|
||||||
uint notification_id_;
|
uint notification_id_;
|
||||||
QDateTime last_notification_time_;
|
QDateTime last_notification_time_;
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
#include "dbus/notification.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
|
#include "dbus/notification.h"
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
using boost::scoped_ptr;
|
using boost::scoped_ptr;
|
||||||
|
@ -52,8 +54,10 @@ const QDBusArgument& operator>> (const QDBusArgument& arg, QImage& image) {
|
||||||
Q_ASSERT(0);
|
Q_ASSERT(0);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_DBUS
|
||||||
|
|
||||||
void OSD::Init() {
|
void OSD::Init() {
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
interface_.reset(new OrgFreedesktopNotificationsInterface(
|
interface_.reset(new OrgFreedesktopNotificationsInterface(
|
||||||
OrgFreedesktopNotificationsInterface::staticInterfaceName(),
|
OrgFreedesktopNotificationsInterface::staticInterfaceName(),
|
||||||
"/org/freedesktop/Notifications",
|
"/org/freedesktop/Notifications",
|
||||||
|
@ -63,10 +67,15 @@ void OSD::Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
notification_id_ = 0;
|
notification_id_ = 0;
|
||||||
|
#endif // HAVE_DBUS
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSD::SupportsNativeNotifications() {
|
bool OSD::SupportsNativeNotifications() {
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OSD::SupportsTrayPopups() {
|
bool OSD::SupportsTrayPopups() {
|
||||||
|
@ -75,6 +84,7 @@ bool OSD::SupportsTrayPopups() {
|
||||||
|
|
||||||
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) {
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
QVariantMap hints;
|
QVariantMap hints;
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
hints["image_data"] = QVariant(image);
|
hints["image_data"] = QVariant(image);
|
||||||
|
@ -101,8 +111,12 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message,
|
||||||
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
|
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
||||||
SLOT(CallFinished(QDBusPendingCallWatcher*)));
|
SLOT(CallFinished(QDBusPendingCallWatcher*)));
|
||||||
|
#else // HAVE_DBUS
|
||||||
|
qWarning() << __PRETTY_FUNCTION__ << ": NOT IMPLEMENTED";
|
||||||
|
#endif // HAVE_DBUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DBUS
|
||||||
void OSD::CallFinished(QDBusPendingCallWatcher* watcher) {
|
void OSD::CallFinished(QDBusPendingCallWatcher* watcher) {
|
||||||
scoped_ptr<QDBusPendingCallWatcher> w(watcher);
|
scoped_ptr<QDBusPendingCallWatcher> w(watcher);
|
||||||
|
|
||||||
|
@ -118,3 +132,4 @@ void OSD::CallFinished(QDBusPendingCallWatcher* watcher) {
|
||||||
last_notification_time_ = QDateTime::currentDateTime();
|
last_notification_time_ = QDateTime::currentDateTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue