Browse Source

Change define to determine use of DBUS to USE_DBUS, to prevent overlap with Qt-defined QT_DBUS

miguelfreitas
Wladimir J. van der Laan 13 years ago
parent
commit
010c4fc0b5
  1. 2
      bitcoin-qt.pro
  2. 12
      src/qt/notificator.cpp
  3. 4
      src/qt/notificator.h

2
bitcoin-qt.pro

@ -23,7 +23,7 @@ count(USE_UPNP, 1) {
# use: qmake "USE_DBUS=1" # use: qmake "USE_DBUS=1"
count(USE_DBUS, 1) { count(USE_DBUS, 1) {
message(Building with DBUS (Freedesktop notifications) support) message(Building with DBUS (Freedesktop notifications) support)
DEFINES += QT_DBUS DEFINES += USE_DBUS
QT += dbus QT += dbus
} }

12
src/qt/notificator.cpp

@ -9,7 +9,7 @@
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QMessageBox> #include <QMessageBox>
#ifdef QT_DBUS #ifdef USE_DBUS
#include <QtDBus/QtDBus> #include <QtDBus/QtDBus>
#include <stdint.h> #include <stdint.h>
#endif #endif
@ -23,7 +23,7 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
programName(programName), programName(programName),
mode(None), mode(None),
trayIcon(trayicon) trayIcon(trayicon)
#ifdef QT_DBUS #ifdef USE_DBUS
,interface(0) ,interface(0)
#endif #endif
{ {
@ -31,7 +31,7 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
{ {
mode = QSystemTray; mode = QSystemTray;
} }
#ifdef QT_DBUS #ifdef USE_DBUS
interface = new QDBusInterface("org.freedesktop.Notifications", interface = new QDBusInterface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications", "org.freedesktop.Notifications"); "/org/freedesktop/Notifications", "org.freedesktop.Notifications");
if(interface->isValid()) if(interface->isValid())
@ -43,12 +43,12 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
Notificator::~Notificator() Notificator::~Notificator()
{ {
#ifdef QT_DBUS #ifdef USE_DBUS
delete interface; delete interface;
#endif #endif
} }
#ifdef QT_DBUS #ifdef USE_DBUS
// Loosely based on http://www.qtcentre.org/archive/index.php/t-25879.html // Loosely based on http://www.qtcentre.org/archive/index.php/t-25879.html
class FreedesktopImage class FreedesktopImage
@ -205,7 +205,7 @@ void Notificator::notify(Class cls, const QString &title, const QString &text, c
{ {
switch(mode) switch(mode)
{ {
#ifdef QT_DBUS #ifdef USE_DBUS
case Freedesktop: case Freedesktop:
notifyDBus(cls, title, text, icon, millisTimeout); notifyDBus(cls, title, text, icon, millisTimeout);
break; break;

4
src/qt/notificator.h

@ -6,7 +6,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSystemTrayIcon; class QSystemTrayIcon;
#ifdef QT_DBUS #ifdef USE_DBUS
class QDBusInterface; class QDBusInterface;
#endif #endif
QT_END_NAMESPACE QT_END_NAMESPACE
@ -52,7 +52,7 @@ private:
QString programName; QString programName;
Mode mode; Mode mode;
QSystemTrayIcon *trayIcon; QSystemTrayIcon *trayIcon;
#ifdef QT_DBUS #ifdef USE_DBUS
QDBusInterface *interface; QDBusInterface *interface;
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout); void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);

Loading…
Cancel
Save