mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 18:30:20 +01:00
When notifying of a played track, show the source's image. Ideally we'd show the album cover but I can't find a good way to get at that (yet).
This commit is contained in:
parent
c6d2a5df89
commit
e983742c9b
@ -154,9 +154,9 @@ AudioEngine::stop()
|
||||
sendWaitingNotification();
|
||||
else if ( TomahawkSettings::instance()->verboseNotifications() )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash stopInfo;
|
||||
Tomahawk::InfoSystem::InfoCustomData stopInfo;
|
||||
stopInfo["message"] = QString( "Tomahawk is stopped." );
|
||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo );
|
||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( stopInfo );
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
|
||||
@ -240,11 +240,11 @@ AudioEngine::mute()
|
||||
void
|
||||
AudioEngine::sendWaitingNotification() const
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash retryInfo;
|
||||
Tomahawk::InfoSystem::InfoCustomData retryInfo;
|
||||
retryInfo["message"] = QString( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo(
|
||||
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( retryInfo ) );
|
||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( retryInfo ) );
|
||||
}
|
||||
|
||||
|
||||
@ -329,12 +329,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
|
||||
if ( TomahawkSettings::instance()->verboseNotifications() )
|
||||
{
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash playInfo;
|
||||
Tomahawk::InfoSystem::InfoCustomData playInfo;
|
||||
playInfo["message"] = QString( "Tomahawk is playing \"%1\" by %2 on album %3." )
|
||||
.arg( m_currentTrack->track() )
|
||||
.arg( m_currentTrack->artist()->name() )
|
||||
.arg( m_currentTrack->album()->name() );
|
||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( playInfo );
|
||||
playInfo["image"] = QVariant( m_currentTrack->collection()->source()->avatar().toImage() );
|
||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCustomData >( playInfo );
|
||||
}
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
|
||||
|
@ -63,12 +63,12 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf
|
||||
{
|
||||
Q_UNUSED( caller );
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCriteriaHash >() )
|
||||
if ( type != Tomahawk::InfoSystem::InfoNotifyUser || !pushData.canConvert< Tomahawk::InfoSystem::InfoCustomData >() )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " not the right type or could not convert the hash";
|
||||
return;
|
||||
}
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash hash = pushData.value< Tomahawk::InfoSystem::InfoCriteriaHash >();
|
||||
Tomahawk::InfoSystem::InfoCustomData hash = pushData.value< Tomahawk::InfoSystem::InfoCustomData >();
|
||||
if ( !hash.contains( "message" ) )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << " hash did not contain a message";
|
||||
@ -81,11 +81,18 @@ FdoNotifyPlugin::pushInfo( const QString caller, const Tomahawk::InfoSystem::Inf
|
||||
arguments << quint32( 0 ); //notification_id
|
||||
arguments << QString(); //app_icon
|
||||
arguments << QString( "Tomahawk" ); //summary
|
||||
arguments << hash["message"]; //body
|
||||
arguments << hash["message"].toString(); //body
|
||||
arguments << QStringList(); //actions
|
||||
QVariantMap dict;
|
||||
dict["desktop-entry"] = QString( "tomahawk" );
|
||||
dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||
if ( hash.contains( "image" ) )
|
||||
{
|
||||
QVariant tempVariant = hash["image"];
|
||||
QImage tempImage = tempVariant.value< QImage >();
|
||||
dict["image_data"] = ImageConverter::variantForImage( tempImage );
|
||||
}
|
||||
else
|
||||
dict["image_data"] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||
arguments << dict; //hints
|
||||
arguments << qint32( -1 ); //expire_timeout
|
||||
message.setArguments( arguments );
|
||||
|
Loading…
x
Reference in New Issue
Block a user