mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Add private listening status showing
This commit is contained in:
@@ -72,6 +72,7 @@
|
|||||||
<file>data/images/music-icon.png</file>
|
<file>data/images/music-icon.png</file>
|
||||||
<file>data/images/configure.png</file>
|
<file>data/images/configure.png</file>
|
||||||
<file>data/images/create-playlist.png</file>
|
<file>data/images/create-playlist.png</file>
|
||||||
|
<file>data/images/private-listening.png</file>
|
||||||
<file>data/images/add.png</file>
|
<file>data/images/add.png</file>
|
||||||
<file>data/images/recently-played.png</file>
|
<file>data/images/recently-played.png</file>
|
||||||
<file>data/images/supercollection.png</file>
|
<file>data/images/supercollection.png</file>
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "actioncollection.h"
|
#include "actioncollection.h"
|
||||||
#include "tomahawksettings.h"
|
#include <tomahawksettings.h>
|
||||||
|
#include <utils/tomahawkutils.h>
|
||||||
|
|
||||||
ActionCollection* ActionCollection::s_instance = 0;
|
ActionCollection* ActionCollection::s_instance = 0;
|
||||||
ActionCollection* ActionCollection::instance()
|
ActionCollection* ActionCollection::instance()
|
||||||
@@ -39,8 +40,12 @@ ActionCollection::initActions()
|
|||||||
{
|
{
|
||||||
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
|
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
|
||||||
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
|
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
|
||||||
m_actionCollection[ "togglePrivacy" ] = new QAction( tr( QString( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening ?
|
|
||||||
"&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
|
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
|
||||||
|
QAction *privacyToggle = new QAction( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
|
||||||
|
privacyToggle->setIcon( QIcon( RESPATH "images/private-listening.png" ) );
|
||||||
|
privacyToggle->setIconVisibleInMenu( isPublic );
|
||||||
|
m_actionCollection[ "togglePrivacy" ] = privacyToggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -411,10 +411,10 @@ AudioEngine::togglePrivateListeningMode()
|
|||||||
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );
|
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );
|
||||||
|
|
||||||
#ifndef TOMAHAWK_HEADLESS
|
#ifndef TOMAHAWK_HEADLESS
|
||||||
ActionCollection::instance()->getAction( "togglePrivacy" )->setText(
|
QAction *privacyToggle = ActionCollection::instance()->getAction( "togglePrivacy" );
|
||||||
tr( QString( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening ?
|
bool isPublic = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening;
|
||||||
"&Listen Privately" : "&Listen Publicly" ).toAscii().constData() )
|
privacyToggle->setText( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ) );
|
||||||
);
|
privacyToggle->setIconVisibleInMenu( isPublic );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,11 +29,13 @@
|
|||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "animationhelper.h"
|
#include "animationhelper.h"
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
|
#include "tomahawksettings.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <audio/audioengine.h>
|
#include <audio/audioengine.h>
|
||||||
|
#include <actioncollection.h>
|
||||||
|
|
||||||
#define TREEVIEW_INDENT_ADD -7
|
#define TREEVIEW_INDENT_ADD -7
|
||||||
|
|
||||||
@@ -66,6 +68,9 @@ SourceDelegate::SourceDelegate( QAbstractItemView* parent )
|
|||||||
m_headphonesOn.load( RESPATH "images/headphones-sidebar.png" );
|
m_headphonesOn.load( RESPATH "images/headphones-sidebar.png" );
|
||||||
m_nowPlayingSpeaker.load( RESPATH "images/now-playing-speaker.png" );
|
m_nowPlayingSpeaker.load( RESPATH "images/now-playing-speaker.png" );
|
||||||
m_nowPlayingSpeakerDark.load( RESPATH "images/now-playing-speaker-dark.png" );
|
m_nowPlayingSpeakerDark.load( RESPATH "images/now-playing-speaker-dark.png" );
|
||||||
|
|
||||||
|
QAction *privacyToggle = ActionCollection::instance()->getAction( "togglePrivacy" );
|
||||||
|
connect( privacyToggle, SIGNAL( triggered( bool ) ), qobject_cast< QWidget* >( this ), SLOT( repaint() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -205,6 +210,15 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
|
|
||||||
textRect = option.rect.adjusted( iconRect.width() + 8, painter->fontMetrics().height() + 6, -figWidth - 24, -4 );
|
textRect = option.rect.adjusted( iconRect.width() + 8, painter->fontMetrics().height() + 6, -figWidth - 24, -4 );
|
||||||
painter->setFont( normal );
|
painter->setFont( normal );
|
||||||
|
bool privacyOn = TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::FullyPrivate;
|
||||||
|
if ( !colItem->source().isNull() && colItem->source()->isLocal() && privacyOn )
|
||||||
|
{
|
||||||
|
QRect pmRect = textRect;
|
||||||
|
pmRect.setTop( pmRect.bottom() - painter->fontMetrics().height() + 3 );
|
||||||
|
pmRect.setRight( pmRect.left() + pmRect.height() );
|
||||||
|
ActionCollection::instance()->getAction( "togglePrivacy" )->icon().paint( painter, pmRect );
|
||||||
|
textRect.adjust( pmRect.width() + 3, 0, 0, 0 );
|
||||||
|
}
|
||||||
if ( isPlaying || ( !colItem->source().isNull() && colItem->source()->isLocal() ) )
|
if ( isPlaying || ( !colItem->source().isNull() && colItem->source()->isLocal() ) )
|
||||||
{
|
{
|
||||||
// Show a listen icon
|
// Show a listen icon
|
||||||
|
Reference in New Issue
Block a user