mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
updated snore api
This commit is contained in:
parent
d23a9c4fe2
commit
217c52cf32
@ -50,7 +50,7 @@ SnoreNotifyPlugin::SnoreNotifyPlugin()
|
||||
m_supportedPushTypes << InfoNotifyUser << InfoNowPlaying << InfoTrackUnresolved << InfoNowStopped << InfoInboxReceived;
|
||||
|
||||
m_snore = new Snore::SnoreCore();
|
||||
m_snore->loadPlugins( Snore::PluginContainer::BACKEND );
|
||||
m_snore->loadPlugins( Snore::SnorePlugin::BACKEND );
|
||||
QString backend = qgetenv( "SNORE_BACKEND" ).constData();
|
||||
|
||||
if( backend.isEmpty() )
|
||||
@ -68,7 +68,7 @@ SnoreNotifyPlugin::SnoreNotifyPlugin()
|
||||
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << m_snore->primaryNotificationBackend();
|
||||
|
||||
m_application = new Snore::Application( qApp->applicationName(), m_defaultIcon );
|
||||
m_application = Snore::Application( qApp->applicationName(), m_defaultIcon );
|
||||
|
||||
addAlert( InfoNotifyUser, tr( "Notify User" ) );
|
||||
addAlert( InfoNowPlaying, tr( "Now Playing" ) );
|
||||
@ -87,12 +87,7 @@ SnoreNotifyPlugin::~SnoreNotifyPlugin()
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
|
||||
m_snore->deregisterApplication( m_application );
|
||||
foreach( Snore::Alert* alert, m_alerts )
|
||||
{
|
||||
alert->deleteLater();
|
||||
}
|
||||
m_snore->deleteLater();
|
||||
m_application->deleteLater();
|
||||
}
|
||||
|
||||
void
|
||||
@ -152,8 +147,8 @@ SnoreNotifyPlugin::notifyUser( Tomahawk::InfoSystem::InfoType type, const QStrin
|
||||
{
|
||||
icon = m_defaultIcon;
|
||||
}
|
||||
Snore::Alert* alert = m_alerts[ type ];
|
||||
Snore::Notification n( qApp->applicationName(), alert->name(), alert->title(), messageText, icon );
|
||||
const Snore::Alert &alert = m_alerts[ type ];
|
||||
Snore::Notification n( m_application , alert, alert.title(), messageText, icon );
|
||||
m_snore->broadcastNotification( n );
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "showing notification:" << messageText;
|
||||
|
||||
@ -162,8 +157,8 @@ SnoreNotifyPlugin::notifyUser( Tomahawk::InfoSystem::InfoType type, const QStrin
|
||||
void
|
||||
SnoreNotifyPlugin::addAlert( Tomahawk::InfoSystem::InfoType type, const QString &title )
|
||||
{
|
||||
Snore::Alert* alert = new Snore::Alert( title, title, m_defaultIcon );
|
||||
m_application->addAlert( alert );
|
||||
Snore::Alert alert( title, title, m_defaultIcon );
|
||||
m_application.addAlert( alert );
|
||||
m_alerts[ type ] = alert;
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,9 @@ private:
|
||||
void notifyUser( InfoType type, const QString &messageText, Snore::Icon icon = Snore::Icon() );
|
||||
void addAlert( Tomahawk::InfoSystem::InfoType type, const QString &title );
|
||||
Snore::SnoreCore *m_snore;
|
||||
Snore::Application *m_application;
|
||||
Snore::Application m_application;
|
||||
Snore::Icon m_defaultIcon;
|
||||
QHash< Tomahawk::InfoSystem::InfoType, Snore::Alert* > m_alerts;
|
||||
QHash< Tomahawk::InfoSystem::InfoType, Snore::Alert > m_alerts;
|
||||
|
||||
void nowPlaying( const QVariant &input );
|
||||
void inboxReceived( const QVariant &input );
|
||||
|
Loading…
x
Reference in New Issue
Block a user