Example #1
0
void
PlaylistInterface::onItemsChanged()
{
    if ( QThread::currentThread() != thread() )
    {
        QMetaObject::invokeMethod( this, "onItemsChanged", Qt::QueuedConnection );
        return;
    }

    Tomahawk::result_ptr prevResult = siblingResult( -1, m_currentIndex );
    Tomahawk::result_ptr nextResult = siblingResult( 1, m_currentIndex );

    {
        bool avail = prevResult && prevResult->toQuery()->playable();
        if ( avail != m_prevAvail )
        {
            m_prevAvail = avail;
            emit previousTrackAvailable( avail );
        }
    }

    {
        bool avail = nextResult && nextResult->toQuery()->playable();
        if ( avail != m_nextAvail )
        {
            m_nextAvail = avail;
            emit nextTrackAvailable( avail );
        }
    }
}
DatabaseCommand_ShareTrack::DatabaseCommand_ShareTrack( const Tomahawk::result_ptr& result,
                                                        const QString& recipientDbid,
                                                        QObject* parent )
    : DatabaseCommand_SocialAction( result->toQuery(), "Inbox", "", parent )
    , m_recipient( recipientDbid )
{}