1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 10:48:33 +01:00

ifdef dbus stuff for X11 only.

This commit is contained in:
John Maguire 2010-03-24 21:07:16 +00:00
parent a8a37264f7
commit f9972183c5
3 changed files with 22 additions and 11 deletions

View File

@ -64,7 +64,6 @@ set(CLEMENTINE-SOURCES
globalshortcuts/globalshortcuts.cpp
fixlastfm.cpp
backgroundthread.cpp
mpris.cpp
)
# Header files that have Q_OBJECT in
@ -121,7 +120,6 @@ set(CLEMENTINE-MOC-HEADERS
analyzers/sonogram.h
analyzers/turbine.h
globalshortcuts/globalshortcuts.h
mpris.h
)
# UI files
@ -178,7 +176,7 @@ else(WIN32)
set(CLEMENTINE-MOC-HEADERS ${CLEMENTINE-MOC-HEADERS} xine-engine.h)
endif(WIN32)
# OSD
# OSD and DBus.
if(APPLE)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_mac.mm)
else(APPLE)
@ -195,6 +193,13 @@ else(APPLE)
qt4_add_dbus_adaptor(MPRIS-TRACKLIST-SOURCES
../data/org.freedesktop.MediaPlayer.tracklist.xml
player.h Player mpris_tracklist MprisTrackList)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES}
${MPRIS-PLAYER-SOURCES}
${MPRIS-ROOT-SOURCES}
${MPRIS-TRACKLIST-SOURCES}
mpris.cpp
)
set(CLEMENTINE-MOC-HEADERS ${CLEMENTINE-MOC-HEADERS} mpris.h)
endif(WIN32)
endif(APPLE)
@ -220,9 +225,6 @@ add_library(clementine_lib
${CLEMENTINE-SOURCES-UI}
${CLEMENTINE-SOURCES-RESOURCE}
${CLEMENTINE-QM-FILES}
${MPRIS-ROOT-SOURCES}
${MPRIS-PLAYER-SOURCES}
${MPRIS-TRACKLIST-SOURCES}
)
target_link_libraries(clementine_lib
qtsingleapplication

View File

@ -65,8 +65,6 @@ int main(int argc, char *argv[]) {
qRegisterMetaType<DirectoryList>("DirectoryList");
qRegisterMetaType<SongList>("SongList");
qDBusRegisterMetaType<DBusStatus>();
qDBusRegisterMetaType<Version>();
lastfm::ws::ApiKey = LastFMService::kApiKey;
lastfm::ws::SharedSecret = LastFMService::kSecret;
@ -92,8 +90,13 @@ int main(int argc, char *argv[]) {
QNetworkAccessManager network;
// MPRIS DBus interface.
#ifdef Q_WS_X11
qDBusRegisterMetaType<DBusStatus>();
qDBusRegisterMetaType<Version>();
QDBusConnection::sessionBus().registerService("org.mpris.clementine");
MPRIS mpris;
#endif
// Window
MainWindow w(&network);;

View File

@ -17,8 +17,12 @@
#include "player.h"
#include "playlist.h"
#include "lastfmservice.h"
#include "mpris_player.h"
#include "mpris_tracklist.h"
#ifdef Q_WS_X11
# include "mpris_player.h"
# include "mpris_tracklist.h"
# include <QDBusConnection>
#endif
#ifdef Q_OS_WIN32
# include "phononengine.h"
@ -28,7 +32,6 @@
#include <QtDebug>
#include <QtConcurrentRun>
#include <QDBusConnection>
#include <boost/bind.hpp>
@ -73,12 +76,15 @@ Player::Player(Playlist* playlist, LastFMService* lastfm, QObject* parent)
connect(init_engine_watcher_, SIGNAL(finished()), SLOT(EngineInitFinished()));
connect(engine_, SIGNAL(error(QString)), SIGNAL(Error(QString)));
// MPRIS DBus interface.
#ifdef Q_WS_X11
MprisPlayer* mpris = new MprisPlayer(this);
// Hack so the next registerObject() doesn't override this one.
QDBusConnection::sessionBus().registerObject(
"/Player", mpris, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals);
new MprisTrackList(this);
QDBusConnection::sessionBus().registerObject("/TrackList", this);
#endif
}
void Player::Init() {