mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
Initial work on notification cleanup
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "database/databasecommand_logplayback.h"
|
#include "database/databasecommand_logplayback.h"
|
||||||
#include "network/servent.h"
|
#include "network/servent.h"
|
||||||
#include "utils/qnr_iodevicestream.h"
|
#include "utils/qnr_iodevicestream.h"
|
||||||
|
#include "utils/closure.h"
|
||||||
#include "headlesscheck.h"
|
#include "headlesscheck.h"
|
||||||
#include "infosystem/infosystem.h"
|
#include "infosystem/infosystem.h"
|
||||||
#include "album.h"
|
#include "album.h"
|
||||||
@@ -77,8 +78,6 @@ AudioEngine::AudioEngine()
|
|||||||
|
|
||||||
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
|
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
|
||||||
|
|
||||||
connect( this, SIGNAL( sendWaitingNotification() ), SLOT( sendWaitingNotificationSlot() ), Qt::QueuedConnection );
|
|
||||||
|
|
||||||
onVolumeChanged( m_audioOutput->volume() );
|
onVolumeChanged( m_audioOutput->volume() );
|
||||||
|
|
||||||
#ifndef Q_WS_X11
|
#ifndef Q_WS_X11
|
||||||
@@ -137,23 +136,7 @@ AudioEngine::play()
|
|||||||
setVolume( m_volume );
|
setVolume( m_volume );
|
||||||
emit resumed();
|
emit resumed();
|
||||||
|
|
||||||
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
|
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowResumed );
|
||||||
{
|
|
||||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
|
||||||
|
|
||||||
trackInfo["title"] = m_currentTrack->track();
|
|
||||||
trackInfo["artist"] = m_currentTrack->artist()->name();
|
|
||||||
trackInfo["album"] = m_currentTrack->album()->name();
|
|
||||||
trackInfo["albumpos"] = QString::number( m_currentTrack->albumpos() );
|
|
||||||
trackInfo["duration"] = QString::number( m_currentTrack->duration() );
|
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoPushData pushData (
|
|
||||||
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowResumed,
|
|
||||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ),
|
|
||||||
Tomahawk::InfoSystem::PushNoFlag );
|
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
next();
|
next();
|
||||||
@@ -192,19 +175,12 @@ AudioEngine::stop()
|
|||||||
|
|
||||||
setCurrentTrack( Tomahawk::result_ptr() );
|
setCurrentTrack( Tomahawk::result_ptr() );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoTypeMap map;
|
|
||||||
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
|
|
||||||
|
|
||||||
if ( m_waitingOnNewTrack )
|
if ( m_waitingOnNewTrack )
|
||||||
emit sendWaitingNotification();
|
sendWaitingNotification();
|
||||||
else if ( TomahawkSettings::instance()->verboseNotifications() )
|
|
||||||
{
|
|
||||||
QVariantMap stopInfo;
|
|
||||||
stopInfo["message"] = tr( "Tomahawk is stopped." );
|
|
||||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< QVariantMap >( stopInfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map, Tomahawk::InfoSystem::PushNoFlag );
|
Tomahawk::InfoSystem::InfoPushData pushData( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant(), Tomahawk::InfoSystem::PushNoFlag );
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -326,18 +302,16 @@ AudioEngine::mute()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::sendWaitingNotificationSlot() const
|
AudioEngine::sendWaitingNotification() const
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||||
//since it's async, after this is triggered our result could come in, so don't show the popup in that case
|
//since it's async, after this is triggered our result could come in, so don't show the popup in that case
|
||||||
if ( !m_playlist.isNull() && m_playlist->hasNextItem() )
|
if ( !m_playlist.isNull() && m_playlist->hasNextItem() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QVariantMap 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::InfoPushData pushData (
|
Tomahawk::InfoSystem::InfoPushData pushData (
|
||||||
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
|
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoTrackUnresolved,
|
||||||
QVariant::fromValue< QVariantMap >( retryInfo ),
|
QVariant(),
|
||||||
Tomahawk::InfoSystem::PushNoFlag );
|
Tomahawk::InfoSystem::PushNoFlag );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
||||||
@@ -345,14 +319,15 @@ AudioEngine::sendWaitingNotificationSlot() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::sendNowPlayingNotification()
|
AudioEngine::sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType type )
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
if ( m_currentTrack->album().isNull() || m_currentTrack->album()->infoLoaded() )
|
if ( m_currentTrack->album().isNull() || m_currentTrack->album()->infoLoaded() )
|
||||||
onNowPlayingInfoReady();
|
onNowPlayingInfoReady( type );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
connect( m_currentTrack->album().data(), SIGNAL( updated() ), SLOT( onNowPlayingInfoReady() ), Qt::UniqueConnection );
|
_detail::Closure* closure = NewClosure( m_currentTrack->album().data(), SIGNAL( updated() ), const_cast<AudioEngine*>(this), SLOT( onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType ) ), type );
|
||||||
|
closure->setAutoDelete( false );
|
||||||
m_currentTrack->album()->cover( QSize( 0, 0 ) );
|
m_currentTrack->album()->cover( QSize( 0, 0 ) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -360,7 +335,7 @@ AudioEngine::sendNowPlayingNotification()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::onNowPlayingInfoReady()
|
AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||||
if ( m_currentTrack.isNull() ||
|
if ( m_currentTrack.isNull() ||
|
||||||
@@ -370,26 +345,29 @@ AudioEngine::onNowPlayingInfoReady()
|
|||||||
|
|
||||||
if ( !m_currentTrack->album().isNull() && sender() && m_currentTrack->album().data() != sender() )
|
if ( !m_currentTrack->album().isNull() && sender() && m_currentTrack->album().data() != sender() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QVariantMap playInfo;
|
QVariantMap playInfo;
|
||||||
playInfo["message"] = tr( "Tomahawk is playing \"%1\" by %2%3." )
|
|
||||||
.arg( m_currentTrack->track() )
|
|
||||||
.arg( m_currentTrack->artist()->name() )
|
|
||||||
.arg( m_currentTrack->album().isNull() ? QString() : QString( " %1" ).arg( tr( "on album %1" ).arg( m_currentTrack->album()->name() ) ) );
|
|
||||||
|
|
||||||
if ( !m_currentTrack->album().isNull() )
|
if ( !m_currentTrack->album().isNull() )
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
QImage cover;
|
QImage cover;
|
||||||
cover = m_currentTrack->album()->cover( QSize( 0, 0 ) ).toImage();
|
cover = m_currentTrack->album()->cover( QSize( 0, 0 ) ).toImage();
|
||||||
playInfo["image"] = QVariant( cover );
|
playInfo["cover"] = QVariant( cover );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoPushData pushData (
|
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
||||||
s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNotifyUser,
|
trackInfo["title"] = m_currentTrack->track();
|
||||||
QVariant::fromValue< QVariantMap >( playInfo ),
|
trackInfo["artist"] = m_currentTrack->artist()->name();
|
||||||
Tomahawk::InfoSystem::PushNoFlag );
|
trackInfo["album"] = m_currentTrack->album()->name();
|
||||||
|
trackInfo["duration"] = QString::number( m_currentTrack->duration() );
|
||||||
|
trackInfo["albumpos"] = QString::number( m_currentTrack->albumpos() );
|
||||||
|
|
||||||
|
playInfo["trackinfo"] = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo );
|
||||||
|
playInfo["private"] = TomahawkSettings::instance()->privateListeningMode();
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoPushData pushData ( s_aeInfoIdentifier, type, playInfo, Tomahawk::InfoSystem::PushShortUrlFlag );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
||||||
}
|
}
|
||||||
@@ -468,29 +446,13 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
m_mediaObject->play();
|
m_mediaObject->play();
|
||||||
emit started( m_currentTrack );
|
emit started( m_currentTrack );
|
||||||
|
|
||||||
if ( TomahawkSettings::instance()->verboseNotifications() )
|
|
||||||
sendNowPlayingNotification();
|
|
||||||
|
|
||||||
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
|
if ( TomahawkSettings::instance()->privateListeningMode() != TomahawkSettings::FullyPrivate )
|
||||||
{
|
{
|
||||||
DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started );
|
DatabaseCommand_LogPlayback* cmd = new DatabaseCommand_LogPlayback( m_currentTrack, DatabaseCommand_LogPlayback::Started );
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoStringHash trackInfo;
|
|
||||||
trackInfo["title"] = m_currentTrack->track();
|
|
||||||
trackInfo["artist"] = m_currentTrack->artist()->name();
|
|
||||||
trackInfo["album"] = m_currentTrack->album()->name();
|
|
||||||
trackInfo["duration"] = QString::number( m_currentTrack->duration() );
|
|
||||||
trackInfo["albumpos"] = QString::number( m_currentTrack->albumpos() );
|
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoPushData pushData (
|
|
||||||
s_aeInfoIdentifier,
|
|
||||||
Tomahawk::InfoSystem::InfoNowPlaying,
|
|
||||||
QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ),
|
|
||||||
Tomahawk::InfoSystem::PushShortUrlFlag );
|
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowPlaying );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,8 @@
|
|||||||
#include <phonon/AudioOutput>
|
#include <phonon/AudioOutput>
|
||||||
#include <phonon/BackendCapabilities>
|
#include <phonon/BackendCapabilities>
|
||||||
|
|
||||||
|
#include "libtomahawk/infosystem/infosystem.h"
|
||||||
|
|
||||||
#include "result.h"
|
#include "result.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "playlistinterface.h"
|
#include "playlistinterface.h"
|
||||||
@@ -117,8 +119,6 @@ signals:
|
|||||||
|
|
||||||
void error( AudioEngine::AudioErrorCode errorCode );
|
void error( AudioEngine::AudioErrorCode errorCode );
|
||||||
|
|
||||||
void sendWaitingNotification();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
bool loadTrack( const Tomahawk::result_ptr& result );
|
bool loadTrack( const Tomahawk::result_ptr& result );
|
||||||
void loadPreviousTrack();
|
void loadPreviousTrack();
|
||||||
@@ -130,10 +130,10 @@ private slots:
|
|||||||
void timerTriggered( qint64 time );
|
void timerTriggered( qint64 time );
|
||||||
|
|
||||||
void setCurrentTrack( const Tomahawk::result_ptr& result );
|
void setCurrentTrack( const Tomahawk::result_ptr& result );
|
||||||
void onNowPlayingInfoReady();
|
void onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type );
|
||||||
void onPlaylistNextTrackReady();
|
void onPlaylistNextTrackReady();
|
||||||
|
|
||||||
void sendWaitingNotificationSlot() const;
|
void sendWaitingNotification() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setState( AudioState state );
|
void setState( AudioState state );
|
||||||
@@ -141,7 +141,7 @@ private:
|
|||||||
bool isHttpResult( const QString& ) const;
|
bool isHttpResult( const QString& ) const;
|
||||||
bool isLocalResult( const QString& ) const;
|
bool isLocalResult( const QString& ) const;
|
||||||
|
|
||||||
void sendNowPlayingNotification();
|
void sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType type );
|
||||||
|
|
||||||
QSharedPointer<QIODevice> m_input;
|
QSharedPointer<QIODevice> m_input;
|
||||||
|
|
||||||
|
@@ -54,43 +54,100 @@ FdoNotifyPlugin::FdoNotifyPlugin()
|
|||||||
: InfoPlugin()
|
: InfoPlugin()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
m_supportedPushTypes << Tomahawk::InfoSystem::InfoNotifyUser;
|
m_supportedPushTypes << InfoNotifyUser << InfoNowPlaying << InfoTrackUnresolved << InfoNowStopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FdoNotifyPlugin::~FdoNotifyPlugin()
|
FdoNotifyPlugin::~FdoNotifyPlugin()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FdoNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
|
FdoNotifyPlugin::pushInfo( Tomahawk::InfoSystem::InfoPushData pushData )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
QVariant inputData = pushData.infoPair.second;
|
QVariant inputData = pushData.infoPair.second;
|
||||||
if ( pushData.type != Tomahawk::InfoSystem::InfoNotifyUser || !inputData.canConvert< QVariantMap >() )
|
|
||||||
|
switch ( pushData.type )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << " not the right type or could not convert the hash";
|
case Tomahawk::InfoSystem::InfoTrackUnresolved:
|
||||||
return;
|
notifyUser( "The current track could not be resolved. Tomahawk will pick back up with the next resolvable track from this source." );
|
||||||
}
|
return;
|
||||||
QVariantMap hash = inputData.value< QVariantMap >();
|
|
||||||
if ( !hash.contains( "message" ) )
|
case Tomahawk::InfoSystem::InfoNotifyUser:
|
||||||
{
|
notifyUser( pushData.infoPair.second.toString() );
|
||||||
qDebug() << Q_FUNC_INFO << " hash did not contain a message";
|
return;
|
||||||
return;
|
|
||||||
|
case Tomahawk::InfoSystem::InfoNowStopped:
|
||||||
|
notifyUser( "Tomahawk is stopped." );
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Tomahawk::InfoSystem::InfoNowPlaying:
|
||||||
|
nowPlaying( pushData.infoPair.second );
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FdoNotifyPlugin::notifyUser( const QString &messageText )
|
||||||
|
{
|
||||||
QDBusMessage message = QDBusMessage::createMethodCall( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "Notify" );
|
QDBusMessage message = QDBusMessage::createMethodCall( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "Notify" );
|
||||||
QList<QVariant> arguments;
|
QList<QVariant> arguments;
|
||||||
arguments << QString( "Tomahawk" ); //app_name
|
arguments << QString( "Tomahawk" ); //app_name
|
||||||
arguments << quint32( 0 ); //notification_id
|
arguments << quint32( 0 ); //notification_id
|
||||||
arguments << QString(); //app_icon
|
arguments << QString(); //app_icon
|
||||||
arguments << QString( "Tomahawk" ); //summary
|
arguments << QString( "Tomahawk" ); //summary
|
||||||
arguments << hash[ "message" ].toString(); //body
|
arguments << messageText; //body
|
||||||
arguments << QStringList(); //actions
|
arguments << QStringList(); //actions
|
||||||
QVariantMap dict;
|
QVariantMap dict;
|
||||||
dict["desktop-entry"] = QString( "tomahawk" );
|
dict["desktop-entry"] = QString( "tomahawk" );
|
||||||
if ( hash.contains( "image" ) && hash[ "image" ].canConvert< QImage >() )
|
dict[ "image_data" ] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||||
dict[ "image_data" ] = ImageConverter::variantForImage( hash[ "image" ].value< QImage >() );
|
arguments << dict; //hints
|
||||||
|
arguments << qint32( -1 ); //expire_timeout
|
||||||
|
message.setArguments( arguments );
|
||||||
|
QDBusConnection::sessionBus().send( message );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
FdoNotifyPlugin::nowPlaying( const QVariant &input )
|
||||||
|
{
|
||||||
|
if ( !input.canConvert< QVariantMap >() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
QVariantMap map = input.toMap();
|
||||||
|
|
||||||
|
if ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
InfoStringHash hash = map[ "trackinfo" ].value< Tomahawk::InfoSystem::InfoStringHash >();
|
||||||
|
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString messageText = tr( "Tomahawk is playing \"%1\" by %2%3." )
|
||||||
|
.arg( hash[ "title" ] )
|
||||||
|
.arg( hash[ "artist" ] )
|
||||||
|
.arg( hash[ "album" ].isEmpty() ? QString() : QString( " %1" ).arg( tr( "on album %1" ).arg( hash[ "album" ] ) ) );
|
||||||
|
|
||||||
|
QDBusMessage message = QDBusMessage::createMethodCall( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "Notify" );
|
||||||
|
QList<QVariant> arguments;
|
||||||
|
arguments << QString( "Tomahawk" ); //app_name
|
||||||
|
arguments << quint32( 0 ); //notification_id
|
||||||
|
arguments << QString(); //app_icon
|
||||||
|
arguments << QString( "Tomahawk" ); //summary
|
||||||
|
arguments << messageText; //body
|
||||||
|
arguments << QStringList(); //actions
|
||||||
|
QVariantMap dict;
|
||||||
|
dict["desktop-entry"] = QString( "tomahawk" );
|
||||||
|
if ( map.contains( "cover" ) && map[ "cover" ].canConvert< QImage >() )
|
||||||
|
dict[ "image_data" ] = ImageConverter::variantForImage( map[ "cover" ].value< QImage >() );
|
||||||
else
|
else
|
||||||
dict[ "image_data" ] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
dict[ "image_data" ] = ImageConverter::variantForImage( QImage( RESPATH "icons/tomahawk-icon-128x128.png" ) );
|
||||||
arguments << dict; //hints
|
arguments << dict; //hints
|
||||||
|
@@ -49,6 +49,11 @@ protected slots:
|
|||||||
Q_UNUSED( criteria );
|
Q_UNUSED( criteria );
|
||||||
Q_UNUSED( requestData );
|
Q_UNUSED( requestData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void notifyUser( const QString &messageText );
|
||||||
|
|
||||||
|
void nowPlaying( const QVariant &input );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -513,10 +513,18 @@ MprisPlugin::stateChanged( AudioState newState, AudioState oldState )
|
|||||||
void
|
void
|
||||||
MprisPlugin::audioStarted( const QVariant& input )
|
MprisPlugin::audioStarted( const QVariant& input )
|
||||||
{
|
{
|
||||||
if ( !input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
if ( !input.canConvert< QVariantMap >() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InfoStringHash hash = input.value< Tomahawk::InfoSystem::InfoStringHash >();
|
QVariantMap map = input.toMap();
|
||||||
|
|
||||||
|
if ( map.contains( "private" ) && map[ "private" ].value< TomahawkSettings::PrivateListeningMode >() == TomahawkSettings::FullyPrivate )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( !map.contains( "trackinfo" ) || !map[ "trackinfo" ].canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
InfoStringHash hash = map[ "trackinfo" ].value< Tomahawk::InfoSystem::InfoStringHash >();
|
||||||
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
if ( !hash.contains( "title" ) || !hash.contains( "artist" ) || !hash.contains( "album" ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -122,6 +122,7 @@ enum InfoType { // as items are saved in cache, mark them here to not change the
|
|||||||
InfoNowPaused = 81,
|
InfoNowPaused = 81,
|
||||||
InfoNowResumed = 82,
|
InfoNowResumed = 82,
|
||||||
InfoNowStopped = 83,
|
InfoNowStopped = 83,
|
||||||
|
InfoTrackUnresolved = 84,
|
||||||
|
|
||||||
InfoLove = 90,
|
InfoLove = 90,
|
||||||
InfoUnLove = 91,
|
InfoUnLove = 91,
|
||||||
|
@@ -212,5 +212,6 @@ private:
|
|||||||
static TomahawkSettings* s_instance;
|
static TomahawkSettings* s_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE( TomahawkSettings::PrivateListeningMode );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -450,6 +450,8 @@ TomahawkApp::registerMetaTypes()
|
|||||||
qRegisterMetaType< Tomahawk::InfoSystem::InfoPlugin* >( "Tomahawk::InfoSystem::InfoPlugin*" );
|
qRegisterMetaType< Tomahawk::InfoSystem::InfoPlugin* >( "Tomahawk::InfoSystem::InfoPlugin*" );
|
||||||
qRegisterMetaType< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > ");
|
qRegisterMetaType< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > ");
|
||||||
|
|
||||||
|
qRegisterMetaType< TomahawkSettings::PrivateListeningMode >( "TomahawkSettings::PrivateListeningMode" );
|
||||||
|
|
||||||
qRegisterMetaTypeStreamOperators< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > ");
|
qRegisterMetaTypeStreamOperators< QList< Tomahawk::InfoSystem::InfoStringHash > >("QList< Tomahawk::InfoSystem::InfoStringHash > ");
|
||||||
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
qRegisterMetaType< QPersistentModelIndex >( "QPersistentModelIndex" );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user