mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-26 10:42:26 +01:00
Start of libnotify plugin
This commit is contained in:
parent
55c894743a
commit
69818f8c96
@ -376,6 +376,13 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
|
||||
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
|
||||
)
|
||||
|
||||
IF( UNIX AND NOT APPLE )
|
||||
SET( libSources ${libSources}
|
||||
infosystem/infoplugins/unix/libnotifyplugin.cpp )
|
||||
|
||||
SET( libHeaders ${libHeaders}
|
||||
infosystem/infoplugins/unix/libnotifyplugin.h )
|
||||
ENDIF( UNIX AND NOT APPLE )
|
||||
|
||||
IF( WIN32 )
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
|
@ -0,0 +1,55 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "libnotifyplugin.h"
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include <libnotify/notify.h>
|
||||
#include <glib-2.0/glib.h>
|
||||
|
||||
using namespace Tomahawk::InfoSystem;
|
||||
|
||||
// for internal neatness
|
||||
|
||||
LibNotifyPlugin::LibNotifyPlugin()
|
||||
: InfoPlugin()
|
||||
, m_isInited( false )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
m_supportedGetTypes << Tomahawk::InfoSystem::InfoNotifyUser;
|
||||
gboolean initSuccess = notify_init( "Tomahawk" );
|
||||
m_isInited = ( initSuccess == TRUE );
|
||||
}
|
||||
|
||||
LibNotifyPlugin::~LibNotifyPlugin()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
void
|
||||
LibNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !data.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
|
||||
return;
|
||||
Tomahawk::InfoSystem::InfoCustomData hash = data.value< Tomahawk::InfoSystem::InfoCustomData >();
|
||||
if ( !hash.contains( "message" ) || !(hash["message"].canConvert< QString >() ) )
|
||||
return;
|
||||
QString message = hash["trackName"].toString();
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LIBNOTIFYPLUGIN_H
|
||||
#define LIBNOTIFYPLUGIN_H
|
||||
|
||||
#include "infosystem/infosystem.h"
|
||||
#include "infosystem/infosystemworker.h"
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
namespace InfoSystem
|
||||
{
|
||||
|
||||
class LibNotifyPlugin : public InfoPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LibNotifyPlugin();
|
||||
virtual ~LibNotifyPlugin();
|
||||
|
||||
protected slots:
|
||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData )
|
||||
{
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
Q_UNUSED( input );
|
||||
Q_UNUSED( customData );
|
||||
}
|
||||
|
||||
virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant data );
|
||||
|
||||
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData )
|
||||
{
|
||||
Q_UNUSED( criteria );
|
||||
Q_UNUSED( caller );
|
||||
Q_UNUSED( type );
|
||||
Q_UNUSED( input );
|
||||
Q_UNUSED( customData );
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_isInited;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // LIBNOTIFYPLUGIN_H
|
Loading…
x
Reference in New Issue
Block a user