Fixes for code review comments for r252

This commit is contained in:
David Sansome 2010-02-27 00:39:46 +00:00
parent 04fda5badd
commit 9993342ead
2 changed files with 11 additions and 11 deletions

View File

@ -1,10 +1,10 @@
// Libnotify headers need to go before Qt ones because they use "signals" as // Libnotify headers need to go before Qt ones because they use "signals" as
// a variable name // a variable name
#ifndef NOLIBNOTIFY #ifdef HAVE_LIBNOTIFY
# include <libnotify/notify.h> # include <libnotify/notify.h>
# include <gdk-pixbuf/gdk-pixbuf.h> # include <gdk-pixbuf/gdk-pixbuf.h>
# include <glib.h> # include <glib.h>
#endif // NOLIBNOTIFY #endif // HAVE_LIBNOTIFY
#include "osd.h" #include "osd.h"
@ -15,16 +15,16 @@
void OSD::Init() { void OSD::Init() {
notification_ = NULL; notification_ = NULL;
pixbuf_ = NULL; pixbuf_ = NULL;
#ifndef NOLIBNOTIFY #ifdef HAVE_LIBNOTIFY
notify_init(QCoreApplication::applicationName().toUtf8().constData()); notify_init(QCoreApplication::applicationName().toUtf8().constData());
#endif #endif
} }
bool OSD::SupportsNativeNotifications() { bool OSD::SupportsNativeNotifications() {
#ifdef NOLIBNOTIFY #ifdef HAVE_LIBNOTIFY
return false;
#else
return true; return true;
#else
return false;
#endif #endif
} }
@ -34,7 +34,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 QString& icon) {
#ifndef NOLIBNOTIFY #ifdef HAVE_LIBNOTIFY
if (summary.isNull()) if (summary.isNull())
return; return;
@ -60,12 +60,12 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message,
} }
pixbuf_ = NULL; pixbuf_ = NULL;
#endif // NOLIBNOTIFY #endif // HAVE_LIBNOTIFY
} }
void OSD::ShowMessageNative(const QString& summary, const QString& message, void OSD::ShowMessageNative(const QString& summary, const QString& message,
const QImage& image) { const QImage& image) {
#ifndef NOLIBNOTIFY #ifdef HAVE_LIBNOTIFY
QImage happy_gdk_image = image.convertToFormat(QImage::Format_RGB888).scaledToHeight(100); QImage happy_gdk_image = image.convertToFormat(QImage::Format_RGB888).scaledToHeight(100);
pixbuf_ = gdk_pixbuf_new_from_data( pixbuf_ = gdk_pixbuf_new_from_data(
happy_gdk_image.bits(), happy_gdk_image.bits(),
@ -78,5 +78,5 @@ void OSD::ShowMessageNative(const QString& summary, const QString& message,
NULL, NULL); NULL, NULL);
ShowMessageNative(summary, message, QString()); ShowMessageNative(summary, message, QString());
#endif // NOLIBNOTIFY #endif // HAVE_LIBNOTIFY
} }

View File

@ -179,9 +179,9 @@ win32|fedora-win32-cross:LIBS += -ltag \
# OSD # OSD
unix:!macx { unix:!macx {
nolibnotify:DEFINES += NOLIBNOTIFY
SOURCES += osd_x11.cpp SOURCES += osd_x11.cpp
!nolibnotify { !nolibnotify {
DEFINES += HAVE_LIBNOTIFY
QMAKE_CXXFLAGS += $$system(pkg-config --cflags libnotify) QMAKE_CXXFLAGS += $$system(pkg-config --cflags libnotify)
LIBS += $$system(pkg-config --libs libnotify) LIBS += $$system(pkg-config --libs libnotify)
} }