Commit 19443f1b authored by Sam Lade's avatar Sam Lade
Browse files

Show play progress in tray icon tooltip

FEATURE:278445
FIXED-IN:2.4.4
parent 6bf86ac0
......@@ -2,6 +2,10 @@ Amarok ChangeLog
================
(C) 2002-2011 the Amarok authors.
Version 2.4.4-Beta 1
FEATURES:
* Display current timestamp in tray tooltip. (BR 278445)
Version 2.4.3
BUGFIXES:
* Fix KWallet auth requests on every track change. (BR 278177)
......
......@@ -961,6 +961,7 @@ EngineController::slotTick( qint64 position )
}
else
{
m_lastTickPosition = position;
emit trackPositionChanged( static_cast<long>( position ), false ); //it expects milliseconds
}
}
......@@ -1380,7 +1381,7 @@ bool EngineController::isPlayingAudioCd()
return m_currentIsAudioCd;
}
QString EngineController::prettyNowPlaying() const
QString EngineController::prettyNowPlaying( bool progress ) const
{
Meta::TrackPtr track = currentTrack();
......@@ -1417,7 +1418,10 @@ QString EngineController::prettyNowPlaying() const
if ( track->length() > 0 ) {
QString length = Qt::escape( Meta::msToPrettyTime( track->length() ) );
title += " (" + length + ')';
title += " (";
if ( progress )
title+= Qt::escape( Meta::msToPrettyTime( m_lastTickPosition ) ) + "/";
title += length + ")";
}
return title;
......
......@@ -204,8 +204,9 @@ public:
/**
* @return QString with a pretty name for the current track
* @param whether to include the playing progress (default false)
*/
QString prettyNowPlaying() const;
QString prettyNowPlaying( bool progress = false ) const;
public slots:
/**
......
......@@ -96,6 +96,9 @@ Amarok::TrayIcon::TrayIcon( QObject *parent )
connect( engine, SIGNAL( playbackStateChanged() ),
this, SLOT( updateOverlayIcon() ) );
connect( engine, SIGNAL( trackPositionChanged( qint64, bool ) ),
this, SLOT( updateToolTipTitle() ) );
connect( this, SIGNAL( scrollRequested( int, Qt::Orientation ) ),
SLOT( slotScrollRequested(int, Qt::Orientation) ) );
......@@ -132,7 +135,7 @@ Amarok::TrayIcon::updateToolTip()
{
if( m_track )
{
setToolTipTitle( The::engineController()->prettyNowPlaying() );
setToolTipTitle( The::engineController()->prettyNowPlaying( true ) );
QStringList tooltip;
......@@ -185,10 +188,20 @@ Amarok::TrayIcon::updateToolTip()
else
{
setToolTipTitle( KCmdLineArgs::aboutData()->programName() );
setToolTipSubTitle( The::engineController()->prettyNowPlaying() );
setToolTipSubTitle( The::engineController()->prettyNowPlaying( true ) );
}
}
void Amarok::TrayIcon::updateToolTipTitle()
{
// quick update of the prettyNowPlaying only, rather than the full tooltip, for timestamp advancing
if( m_track )
setToolTipTitle( The::engineController()->prettyNowPlaying( true ) );
else
setToolTipSubTitle( The::engineController()->prettyNowPlaying( true ) );
}
void
Amarok::TrayIcon::trackPlaying( Meta::TrackPtr track )
{
......
......@@ -40,6 +40,7 @@ private slots:
void updateOverlayIcon();
void updateToolTipIcon();
void updateToolTip();
void updateToolTipTitle();
void updateMenu();
void trackPlaying( Meta::TrackPtr track );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment