Fix dbus compile in osd widget

This commit is contained in:
Jonas Kvinge 2018-07-04 00:55:09 +02:00
parent a554032823
commit 8aebfdc88c
2 changed files with 9 additions and 9 deletions

View File

@ -100,7 +100,7 @@ class OSD : public QObject {
QString ReplaceVariable(const QString &variable, const Song &song); QString ReplaceVariable(const QString &variable, const Song &song);
private slots: private slots:
#if defined(HAVE_DBUS) && defined(HAVE_X11) #if defined(HAVE_DBUS)
void CallFinished(QDBusPendingCallWatcher *watcher); void CallFinished(QDBusPendingCallWatcher *watcher);
#endif #endif
void AlbumArtLoaded(const Song &song, const QString &uri, const QImage &image); void AlbumArtLoaded(const Song &song, const QString &uri, const QImage &image);

View File

@ -53,7 +53,7 @@
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) { QDBusArgument &operator<<(QDBusArgument &arg, const QImage &image) {
if (image.isNull()) { if (image.isNull()) {
// Sometimes this gets called with a null QImage for no obvious reason. // Sometimes this gets called with a null QImage for no obvious reason.
@ -72,9 +72,9 @@ QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
// ABGR -> GBAR // ABGR -> GBAR
QImage i(scaled.size(), scaled.format()); QImage i(scaled.size(), scaled.format());
for (int y = 0; y < i.height(); ++y) { for (int y = 0; y < i.height(); ++y) {
QRgb* p = (QRgb*)scaled.scanLine(y); QRgb *p = (QRgb*)scaled.scanLine(y);
QRgb* q = (QRgb*)i.scanLine(y); QRgb *q = (QRgb*)i.scanLine(y);
QRgb* end = p + scaled.width(); QRgb *end = p + scaled.width();
while (p < end) { while (p < end) {
*q = qRgba(qGreen(*p), qBlue(*p), qAlpha(*p), qRed(*p)); *q = qRgba(qGreen(*p), qBlue(*p), qAlpha(*p), qRed(*p));
p++; p++;
@ -97,7 +97,7 @@ QDBusArgument& operator<<(QDBusArgument& arg, const QImage& image) {
} }
const QDBusArgument& operator>>(const QDBusArgument& arg, QImage& image) { const QDBusArgument &operator>>(const QDBusArgument &arg, QImage &image) {
// This is needed to link but shouldn't be called. // This is needed to link but shouldn't be called.
Q_ASSERT(0); Q_ASSERT(0);
return arg; return arg;
@ -129,7 +129,7 @@ bool OSD::SupportsNativeNotifications() {
bool OSD::SupportsTrayPopups() { return true; } bool OSD::SupportsTrayPopups() { return true; }
void OSD::ShowMessageNative(const QString& summary, const QString& message, const QString& icon, const QImage& image) { void OSD::ShowMessageNative(const QString &summary, const QString &message, const QString &icon, const QImage &image) {
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
if (!interface_) return; if (!interface_) return;
@ -147,7 +147,7 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message, cons
} }
QDBusPendingReply<uint> reply = interface_->Notify(QCoreApplication::applicationName(), id, icon, summary, message, QStringList(), hints, timeout_msec_); QDBusPendingReply<uint> reply = interface_->Notify(QCoreApplication::applicationName(), id, icon, summary, message, QStringList(), hints, timeout_msec_);
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*))); connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(CallFinished(QDBusPendingCallWatcher*)));
#else // HAVE_DBUS #else // HAVE_DBUS
qLog(Warning) << "not implemented"; qLog(Warning) << "not implemented";
@ -156,7 +156,7 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message, cons
} }
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
void OSD::CallFinished(QDBusPendingCallWatcher* watcher) { void OSD::CallFinished(QDBusPendingCallWatcher *watcher) {
std::unique_ptr<QDBusPendingCallWatcher> w(watcher); std::unique_ptr<QDBusPendingCallWatcher> w(watcher);