mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
Hide the share action from AudioControls if there's no InfoPlugin that
can be used to share a track.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -151,6 +152,10 @@ AudioControls::AudioControls( QWidget* parent )
|
|||||||
ui->pauseButton->setContentsMargins( 0, 0, 0, 0 );
|
ui->pauseButton->setContentsMargins( 0, 0, 0, 0 );
|
||||||
ui->stackedLayout->setSizeConstraint( QLayout::SetFixedSize );
|
ui->stackedLayout->setSizeConstraint( QLayout::SetFixedSize );
|
||||||
|
|
||||||
|
connect( InfoSystem::InfoSystem::instance(), SIGNAL( updatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet ) ),
|
||||||
|
this, SLOT( onInfoSystemPushTypesUpdated( Tomahawk::InfoSystem::InfoTypeSet ) ) );
|
||||||
|
onInfoSystemPushTypesUpdated( InfoSystem::InfoSystem::instance()->supportedPushTypes() );
|
||||||
|
|
||||||
onPlaybackStopped(); // initial state
|
onPlaybackStopped(); // initial state
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +277,7 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result )
|
|||||||
ui->loveButton->setEnabled( true );
|
ui->loveButton->setEnabled( true );
|
||||||
ui->loveButton->setVisible( true );
|
ui->loveButton->setVisible( true );
|
||||||
ui->socialButton->setEnabled( true );
|
ui->socialButton->setEnabled( true );
|
||||||
ui->socialButton->setVisible( true );
|
ui->socialButton->setVisible( m_shouldShowShareAction );
|
||||||
ui->ownerButton->setEnabled( true );
|
ui->ownerButton->setEnabled( true );
|
||||||
ui->ownerButton->setVisible( true );
|
ui->ownerButton->setVisible( true );
|
||||||
|
|
||||||
@@ -351,6 +356,25 @@ AudioControls::onSocialActionsLoaded()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioControls::onInfoSystemPushTypesUpdated( InfoSystem::InfoTypeSet supportedTypes )
|
||||||
|
{
|
||||||
|
if ( supportedTypes.contains( InfoSystem::InfoShareTrack ) )
|
||||||
|
{
|
||||||
|
m_shouldShowShareAction = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_shouldShowShareAction = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( AudioEngine::instance()->state() == AudioEngine::Stopped )
|
||||||
|
ui->socialButton->setVisible( false );
|
||||||
|
else
|
||||||
|
ui->socialButton->setVisible( m_shouldShowShareAction );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioControls::setSocialActions()
|
AudioControls::setSocialActions()
|
||||||
{
|
{
|
||||||
|
@@ -89,6 +89,8 @@ private slots:
|
|||||||
void onCoverUpdated();
|
void onCoverUpdated();
|
||||||
void onSocialActionsLoaded();
|
void onSocialActionsLoaded();
|
||||||
|
|
||||||
|
void onInfoSystemPushTypesUpdated( Tomahawk::InfoSystem::InfoTypeSet supportedTypes );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setCover();
|
void setCover();
|
||||||
void setSocialActions();
|
void setSocialActions();
|
||||||
@@ -100,6 +102,7 @@ private:
|
|||||||
Tomahawk::result_ptr m_currentTrack;
|
Tomahawk::result_ptr m_currentTrack;
|
||||||
Tomahawk::PlaylistModes::RepeatMode m_repeatMode;
|
Tomahawk::PlaylistModes::RepeatMode m_repeatMode;
|
||||||
bool m_shuffled;
|
bool m_shuffled;
|
||||||
|
bool m_shouldShowShareAction;
|
||||||
|
|
||||||
QTimer m_phononTickCheckTimer;
|
QTimer m_phononTickCheckTimer;
|
||||||
QTimeLine m_sliderTimeLine;
|
QTimeLine m_sliderTimeLine;
|
||||||
|
@@ -173,6 +173,12 @@ InfoSystem::init()
|
|||||||
connect( worker, SIGNAL( finished( QString, Tomahawk::InfoSystem::InfoType ) ),
|
connect( worker, SIGNAL( finished( QString, Tomahawk::InfoSystem::InfoType ) ),
|
||||||
this, SIGNAL( finished( QString, Tomahawk::InfoSystem::InfoType ) ), Qt::UniqueConnection );
|
this, SIGNAL( finished( QString, Tomahawk::InfoSystem::InfoType ) ), Qt::UniqueConnection );
|
||||||
|
|
||||||
|
qRegisterMetaType< Tomahawk::InfoSystem::InfoTypeSet >();
|
||||||
|
connect( worker, SIGNAL( updatedSupportedGetTypes( Tomahawk::InfoSystem::InfoTypeSet ) ),
|
||||||
|
this, SLOT( receiveUpdatedSupportedGetTypes( Tomahawk::InfoSystem::InfoTypeSet ) ) );
|
||||||
|
connect( worker, SIGNAL( updatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet ) ),
|
||||||
|
this, SLOT( receiveUpdatedSupportedPushTypes( Tomahawk::InfoSystem::InfoTypeSet ) ) );
|
||||||
|
|
||||||
QMetaObject::invokeMethod( worker, "init", Qt::QueuedConnection, Q_ARG( Tomahawk::InfoSystem::InfoSystemCache*, cache ) );
|
QMetaObject::invokeMethod( worker, "init", Qt::QueuedConnection, Q_ARG( Tomahawk::InfoSystem::InfoSystemCache*, cache ) );
|
||||||
|
|
||||||
m_inited = true;
|
m_inited = true;
|
||||||
|
@@ -269,6 +269,7 @@ Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoType );
|
|||||||
Q_DECLARE_METATYPE( QList< Tomahawk::InfoSystem::InfoStringHash > );
|
Q_DECLARE_METATYPE( QList< Tomahawk::InfoSystem::InfoStringHash > );
|
||||||
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoPluginPtr );
|
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoPluginPtr );
|
||||||
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoPlugin* );
|
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoPlugin* );
|
||||||
|
Q_DECLARE_METATYPE( Tomahawk::InfoSystem::InfoTypeSet );
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE( Tomahawk::InfoSystem::InfoPlugin, "tomahawk.InfoPlugin/1.0" )
|
Q_DECLARE_INTERFACE( Tomahawk::InfoSystem::InfoPlugin, "tomahawk.InfoPlugin/1.0" )
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user