1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

* Added gauge for track chart position.

This commit is contained in:
Christian Muehlhaeuser
2013-06-08 12:08:43 +02:00
parent 6c92168a48
commit 3824034113
3 changed files with 11 additions and 3 deletions

View File

@@ -95,10 +95,15 @@ TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* par
QHBoxLayout* l = new QHBoxLayout( ui->statsWidget ); QHBoxLayout* l = new QHBoxLayout( ui->statsWidget );
m_playStatsGauge = new StatsGauge( ui->statsWidget ); m_playStatsGauge = new StatsGauge( ui->statsWidget );
m_playStatsGauge->setText( tr( "# PLAYS / ARTIST" ) ); 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->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) );
l->addWidget( m_playStatsGauge ); l->addWidget( m_playStatsGauge );
l->addSpacerItem( new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding ) ); 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->statsWidget->setLayout( l );
ui->statsLabel->setVisible( false ); ui->statsLabel->setVisible( false );
@@ -213,12 +218,11 @@ TrackInfoWidget::onCoverUpdated()
void void
TrackInfoWidget::onStatsLoaded() TrackInfoWidget::onStatsLoaded()
{ {
QString stats;
QList< Tomahawk::PlaybackLog > history = m_query->track()->playbackHistory( SourceList::instance()->getLocal() ); 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 trackCounter = m_query->track()->playbackCount( SourceList::instance()->getLocal() );
const unsigned int artistCounter = m_artist->playbackCount( SourceList::instance()->getLocal() ); const unsigned int artistCounter = m_artist->playbackCount( SourceList::instance()->getLocal() );
QString stats;
if ( trackCounter ) if ( trackCounter )
stats = tr( "You've listened to this track %n time(s).", "", trackCounter ); stats = tr( "You've listened to this track %n time(s).", "", trackCounter );
else else
@@ -240,6 +244,8 @@ TrackInfoWidget::onStatsLoaded()
stats += "\n" + tr( "You've never listened to %1 before." ).arg( m_artist->name() ); stats += "\n" + tr( "You've never listened to %1 before." ).arg( m_artist->name() );
ui->statsLabel->setText( stats ); ui->statsLabel->setText( stats );
m_playStatsTotalGauge->setMaximum( m_query->track()->chartCount() );
m_playStatsTotalGauge->setValue( m_query->track()->chartPosition() );
} }

View File

@@ -96,6 +96,8 @@ private:
Tomahawk::artist_ptr m_artist; Tomahawk::artist_ptr m_artist;
StatsGauge* m_playStatsGauge; StatsGauge* m_playStatsGauge;
StatsGauge* m_playStatsTotalGauge;
PlayableModel* m_relatedTracksModel; PlayableModel* m_relatedTracksModel;
QString m_title; QString m_title;
QPixmap m_pixmap; QPixmap m_pixmap;

View File

@@ -89,7 +89,7 @@
<widget class="QWidget" name="statsWidget" native="true"> <widget class="QWidget" name="statsWidget" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>220</width> <width>450</width>
<height>240</height> <height>240</height>
</size> </size>
</property> </property>