mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Show speaker icon for any playing playlist
This commit is contained in:
parent
e1c6e83b98
commit
98d939a81b
@ -22,7 +22,8 @@
|
||||
#include "database/databasecommand_genericselect.h"
|
||||
#include "database/database.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include <sourcelist.h>
|
||||
#include "sourcelist.h"
|
||||
#include "audio/audioengine.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -54,6 +55,19 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c
|
||||
CustomPlaylistView::~CustomPlaylistView()
|
||||
{}
|
||||
|
||||
bool
|
||||
CustomPlaylistView::isBeingPlayed() const
|
||||
{
|
||||
return AudioEngine::instance()->currentTrackPlaylist() == playlistInterface();
|
||||
}
|
||||
|
||||
bool
|
||||
CustomPlaylistView::jumpToCurrentTrack()
|
||||
{
|
||||
return PlaylistView::jumpToCurrentTrack();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CustomPlaylistView::generateTracks()
|
||||
{
|
||||
|
@ -46,7 +46,10 @@ public:
|
||||
virtual QPixmap pixmap() const;
|
||||
virtual QString description() const;
|
||||
virtual QString longDescription() const;
|
||||
|
||||
virtual bool isTemporaryPage() const { return false; }
|
||||
virtual bool isBeingPlayed() const;
|
||||
virtual bool jumpToCurrentTrack();
|
||||
|
||||
private slots:
|
||||
void tracksGenerated( QList<Tomahawk::query_ptr> tracks );
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
virtual bool jumpToCurrentTrack() = 0;
|
||||
|
||||
virtual bool isTemporaryPage() const { return false; }
|
||||
virtual bool isBeingPlayed() const { return false; }
|
||||
|
||||
virtual bool canAutoUpdate() const { return false; }
|
||||
virtual void setAutoUpdate( bool ) {}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "AlbumInfoWidget.h"
|
||||
#include "ui_AlbumInfoWidget.h"
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "viewmanager.h"
|
||||
#include "database/database.h"
|
||||
#include "playlist/treemodel.h"
|
||||
@ -117,6 +118,18 @@ AlbumInfoWidget::onLoadingFinished()
|
||||
m_button->show();
|
||||
}
|
||||
|
||||
bool
|
||||
AlbumInfoWidget::isBeingPlayed() const
|
||||
{
|
||||
if ( ui->albumsView->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
if ( ui->tracksView->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AlbumInfoWidget::load( const album_ptr& album )
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
virtual bool showStatsBar() const { return false; }
|
||||
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
virtual bool isBeingPlayed() const;
|
||||
|
||||
signals:
|
||||
void longDescriptionChanged( const QString& description );
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ArtistInfoWidget.h"
|
||||
#include "ui_ArtistInfoWidget.h"
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "viewmanager.h"
|
||||
#include "playlist/treemodel.h"
|
||||
#include "playlist/playlistmodel.h"
|
||||
@ -125,6 +126,36 @@ ArtistInfoWidget::onLoadingFinished()
|
||||
m_button->show();
|
||||
}
|
||||
|
||||
bool
|
||||
ArtistInfoWidget::isBeingPlayed() const
|
||||
{
|
||||
if ( ui->albums->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
if ( ui->relatedArtists->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
if ( ui->topHits->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ArtistInfoWidget::jumpToCurrentTrack()
|
||||
{
|
||||
if ( ui->albums->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->relatedArtists->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->topHits->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArtistInfoWidget::load( const artist_ptr& artist )
|
||||
|
@ -76,7 +76,8 @@ public:
|
||||
virtual bool isTemporaryPage() const { return true; }
|
||||
virtual bool showStatsBar() const { return false; }
|
||||
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
virtual bool jumpToCurrentTrack();
|
||||
virtual bool isBeingPlayed() const;
|
||||
|
||||
signals:
|
||||
void longDescriptionChanged( const QString& description );
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -98,6 +99,12 @@ WelcomeWidget::~WelcomeWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool
|
||||
WelcomeWidget::isBeingPlayed() const
|
||||
{
|
||||
return AudioEngine::instance()->currentTrackPlaylist() == ui->tracksView->playlistInterface();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WelcomeWidget::updateRecentTracks()
|
||||
|
@ -93,6 +93,7 @@ public:
|
||||
virtual bool showInfoBar() const { return false; }
|
||||
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
virtual bool isBeingPlayed() const;
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent* e );
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,6 +30,7 @@
|
||||
#include "RecentPlaylistsModel.h"
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "dynamic/GeneratorInterface.h"
|
||||
#include "playlist/playlistmodel.h"
|
||||
#include "playlist/treeproxymodel.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
@ -36,7 +38,6 @@
|
||||
#include "widgets/kbreadcrumbselectionmodel.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include "utils/logger.h"
|
||||
#include <dynamic/GeneratorInterface.h>
|
||||
#include <pipeline.h>
|
||||
|
||||
#define HISTORY_TRACK_ITEMS 25
|
||||
@ -99,6 +100,7 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
||||
|
||||
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
|
||||
|
||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
|
||||
QTimer::singleShot( 0, this, SLOT( fetchData() ) );
|
||||
}
|
||||
|
||||
@ -109,6 +111,31 @@ WhatsHotWidget::~WhatsHotWidget()
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
WhatsHotWidget::isBeingPlayed() const
|
||||
{
|
||||
if ( AudioEngine::instance()->currentTrackPlaylist() == ui->artistsViewLeft->playlistInterface() )
|
||||
return true;
|
||||
|
||||
if ( AudioEngine::instance()->currentTrackPlaylist() == ui->tracksViewLeft->playlistInterface() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
WhatsHotWidget::jumpToCurrentTrack()
|
||||
{
|
||||
if ( ui->artistsViewLeft->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->tracksViewLeft->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WhatsHotWidget::fetchData()
|
||||
{
|
||||
|
@ -65,7 +65,8 @@ public:
|
||||
virtual bool showStatsBar() const { return false; }
|
||||
virtual bool showInfoBar() const { return false; }
|
||||
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
virtual bool jumpToCurrentTrack();
|
||||
virtual bool isBeingPlayed() const;
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent* e );
|
||||
@ -80,7 +81,6 @@ private slots:
|
||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
void infoSystemFinished( QString target );
|
||||
void leftCrumbIndexChanged( QModelIndex );
|
||||
|
||||
private:
|
||||
void setLeftViewArtists( TreeModel* artistModel );
|
||||
void setLeftViewAlbums( AlbumModel* albumModel );
|
||||
|
@ -85,9 +85,8 @@ GenericPageItem::setText( const QString &text )
|
||||
bool
|
||||
GenericPageItem::isBeingPlayed() const
|
||||
{
|
||||
if ( dynamic_cast< PlaylistInterface* >( m_get() ) )
|
||||
{
|
||||
return AudioEngine::instance()->currentTrackPlaylist() == dynamic_cast< PlaylistInterface* >( m_get() );
|
||||
}
|
||||
if ( m_get() )
|
||||
return m_get()->isBeingPlayed();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define TEMPORARYPAGEITEM_H
|
||||
|
||||
#include "items/sourcetreeitem.h"
|
||||
#include "viewpage.h"
|
||||
|
||||
class TemporaryPageItem : public SourceTreeItem
|
||||
{
|
||||
@ -35,6 +36,7 @@ public:
|
||||
|
||||
void removeFromList();
|
||||
Tomahawk::ViewPage* page() const { return m_page; }
|
||||
virtual bool isBeingPlayed() const { return m_page->isBeingPlayed(); }
|
||||
|
||||
private:
|
||||
Tomahawk::ViewPage* m_page;
|
||||
|
@ -140,6 +140,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
||||
const bool playable = ( type == SourcesModel::StaticPlaylist ||
|
||||
type == SourcesModel::AutomaticPlaylist ||
|
||||
type == SourcesModel::Station ||
|
||||
type == SourcesModel::TemporaryPage ||
|
||||
type == SourcesModel::GenericPage );
|
||||
|
||||
if ( playable && item->isBeingPlayed() )
|
||||
|
Loading…
x
Reference in New Issue
Block a user