diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 52ba39e66..7ba067273 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -373,15 +373,18 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/. ${LIBPORTFWD_INCLUDE_DIR} ${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb + ${THIRDPARTY_DIR}/gntp-send/gntp-send/headers ${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src ) IF( UNIX AND NOT APPLE ) SET( libSources ${libSources} + infosystem/infoplugins/win/gfwnotifyplugin.cpp infosystem/infoplugins/unix/fdonotifyplugin.cpp infosystem/infoplugins/unix/imageconverter.cpp ) SET( libHeaders ${libHeaders} + infosystem/infoplugins/win/gfwnotifyplugin.h infosystem/infoplugins/unix/fdonotifyplugin.h infosystem/infoplugins/unix/imageconverter.h ) ENDIF( UNIX AND NOT APPLE ) @@ -439,6 +442,8 @@ target_link_libraries( tomahawklib # Thirdparty shipped with tomahawk ${LIBPORTFWD_LIBRARIES} + tomahawk_growl + # External deps ${QJSON_LIBRARIES} ${PHONON_LIBS} diff --git a/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.cpp b/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.cpp index 0bc778591..e0cb17ad6 100644 --- a/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.cpp @@ -36,31 +36,36 @@ * */ -#include "fdonotifyplugin.h" +#include "gfwnotifyplugin.h" #include "utils/tomahawkutils.h" -#include "imageconverter.h" -#include -#include -#include +#include "growl.h" +#include "growl++.hpp" using namespace Tomahawk::InfoSystem; -FdoNotifyPlugin::FdoNotifyPlugin() +GfwNotifyPlugin::GfwNotifyPlugin() : InfoPlugin() - , m_arg() + , m_growl( 0 ) { + const char* notifications[1]; + const char* name = "Notification"; + notifications[0] = name; + const char* host = "192.168.10.45"; + const char* password = "testing"; + const char* application = "Tomahawk"; + m_growl = new Growl( GROWL_TCP, host, password, application, notifications, 1 ); qDebug() << Q_FUNC_INFO; m_supportedPushTypes << Tomahawk::InfoSystem::InfoNotifyUser; } -FdoNotifyPlugin::~FdoNotifyPlugin() +GfwNotifyPlugin::~GfwNotifyPlugin() { qDebug() << Q_FUNC_INFO; } void -FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant pushData ) +GfwNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant pushData ) { Q_UNUSED( caller ); qDebug() << Q_FUNC_INFO; @@ -76,19 +81,8 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf return; } - QDBusMessage message = QDBusMessage::createMethodCall( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "Notify" ); - QList arguments; - arguments << QString( "Tomahawk" ); //app_name - arguments << quint32( 0 ); //notification_id - arguments << QString(); //app_icon - arguments << QString( "Tomahawk" ); //summary - arguments << hash["message"]; //body - arguments << QStringList(); //actions - QVariantMap dict; - dict["desktop-entry"] = QString( "tomahawk" ); - dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) ); - arguments << dict; //hints - arguments << qint32( -1 ); //expire_timeout - message.setArguments( arguments ); - QDBusConnection::sessionBus().send( message ); + const char* name = "Notification"; + const char* title = "Tomahawk"; + const char* message = strdup( hash["message"].toLocal8Bit().constData() ); + m_growl->Notify( name, title, message ); } diff --git a/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.h b/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.h index 1778ccbcd..9a20055f1 100644 --- a/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.h +++ b/src/libtomahawk/infosystem/infoplugins/win/gfwnotifyplugin.h @@ -16,13 +16,12 @@ * along with Tomahawk. If not, see . */ -#ifndef FDONOTIFYPLUGIN_H -#define FDONOTIFYPLUGIN_H +#ifndef GFWNOTIFYPLUGIN_H +#define GFWNOTIFYPLUGIN_H #include "infosystem/infosystem.h" -#include "infosystem/infosystemworker.h" -#include +class Growl; namespace Tomahawk { @@ -30,13 +29,13 @@ namespace Tomahawk namespace InfoSystem { -class FdoNotifyPlugin : public InfoPlugin +class GfwNotifyPlugin : public InfoPlugin { Q_OBJECT public: - FdoNotifyPlugin(); - virtual ~FdoNotifyPlugin(); + GfwNotifyPlugin(); + virtual ~GfwNotifyPlugin(); virtual void namChangedSlot( QNetworkAccessManager* ) {} @@ -61,11 +60,11 @@ protected slots: } private: - QDBusArgument m_arg; + Growl* m_growl; }; } } -#endif // FDONOTIFYPLUGIN_H +#endif // GFWNOTIFYPLUGIN_H diff --git a/src/libtomahawk/infosystem/infosystemworker.cpp b/src/libtomahawk/infosystem/infosystemworker.cpp index 3dfd4414b..d85369dca 100644 --- a/src/libtomahawk/infosystem/infosystemworker.cpp +++ b/src/libtomahawk/infosystem/infosystemworker.cpp @@ -31,6 +31,7 @@ #endif #ifdef Q_WS_X11 #include "infoplugins/unix/fdonotifyplugin.h" +#include "infoplugins/win/gfwnotifyplugin.h" #endif #include "lastfm/NetworkAccessManager" @@ -81,6 +82,9 @@ InfoSystemWorker::init( QWeakPointer< Tomahawk::InfoSystem::InfoSystemCache> cac InfoPluginPtr fdonotifyptr( new FdoNotifyPlugin() ); m_plugins.append( fdonotifyptr ); registerInfoTypes( fdonotifyptr, fdonotifyptr.data()->supportedGetTypes(), fdonotifyptr.data()->supportedPushTypes() ); + InfoPluginPtr gfwnotifyptr( new GfwNotifyPlugin() ); + m_plugins.append( gfwnotifyptr ); + registerInfoTypes( gfwnotifyptr, gfwnotifyptr.data()->supportedGetTypes(), gfwnotifyptr.data()->supportedPushTypes() ); #endif Q_FOREACH( InfoPluginPtr plugin, m_plugins )