mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 15:29:42 +01:00
* Added gauge for track chart position.
This commit is contained in:
parent
6c92168a48
commit
3824034113
@ -95,10 +95,15 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
|
||||
QHBoxLayout* l = new QHBoxLayout( ui->statsWidget );
|
||||
m_playStatsGauge = new StatsGauge( ui->statsWidget );
|
||||
m_playStatsGauge->setText( tr( "# PLAYS / ARTIST" ) );
|
||||
m_playStatsTotalGauge = new StatsGauge( ui->statsWidget );
|
||||
m_playStatsTotalGauge->setText( tr( "# IN YOUR CHARTS" ) );
|
||||
m_playStatsTotalGauge->setInvertedAppearance( true );
|
||||
|
||||
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
|
||||
l->addWidget( m_playStatsGauge );
|
||||
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
|
||||
l->addWidget( m_playStatsTotalGauge );
|
||||
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
|
||||
ui->statsWidget->setLayout( l );
|
||||
ui->statsLabel->setVisible( false );
|
||||
|
||||
@ -213,12 +218,11 @@ TrackInfoWidget::onCoverUpdated()
|
||||
void
|
||||
TrackInfoWidget::onStatsLoaded()
|
||||
{
|
||||
QString stats;
|
||||
QList< Tomahawk::PlaybackLog > history = m_query->track()->playbackHistory( SourceList::instance()->getLocal() );
|
||||
const unsigned int trackCounter = m_query->track()->playbackCount( SourceList::instance()->getLocal() );
|
||||
const unsigned int artistCounter = m_artist->playbackCount( SourceList::instance()->getLocal() );
|
||||
|
||||
QString stats;
|
||||
|
||||
if ( trackCounter )
|
||||
stats = tr( "You've listened to this track %n time(s).", "", trackCounter );
|
||||
else
|
||||
@ -240,6 +244,8 @@ TrackInfoWidget::onStatsLoaded()
|
||||
stats += "\n" + tr( "You've never listened to %1 before." ).arg( m_artist->name() );
|
||||
|
||||
ui->statsLabel->setText( stats );
|
||||
m_playStatsTotalGauge->setMaximum( m_query->track()->chartCount() );
|
||||
m_playStatsTotalGauge->setValue( m_query->track()->chartPosition() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,6 +96,8 @@ private:
|
||||
Tomahawk::artist_ptr m_artist;
|
||||
|
||||
StatsGauge* m_playStatsGauge;
|
||||
StatsGauge* m_playStatsTotalGauge;
|
||||
|
||||
PlayableModel* m_relatedTracksModel;
|
||||
QString m_title;
|
||||
QPixmap m_pixmap;
|
||||
|
@ -89,7 +89,7 @@
|
||||
<widget class="QWidget" name="statsWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<width>450</width>
|
||||
<height>240</height>
|
||||
</size>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user