~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to dragonplayer/src/app/timeLabel.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * published by the Free Software Foundation; either version 2 of
8
8
 * the License or (at your option) version 3 or any later version
9
9
 * accepted by the membership of KDE e.V. (or its successor approved
10
 
 * by the membership of KDE e.V.), which shall act as a proxy 
 
10
 * by the membership of KDE e.V.), which shall act as a proxy
11
11
 * defined in Section 14 of version 3 of the license.
12
12
 *
13
13
 * This program is distributed in the hope that it will be useful,
26
26
#include <KGlobal>
27
27
#include <KGlobalSettings>
28
28
 
29
 
TimeLabel::TimeLabel( QWidget *parent ) 
30
 
    : QLabel( " 0:00:00 ", parent )
 
29
TimeLabel::TimeLabel( QWidget *parent )
 
30
    : QLabel( QLatin1String( " 0:00:00 " ), parent )
31
31
    , m_currentTime( 0 )
32
32
{
33
33
    setFont( KGlobalSettings::fixedFont() );
57
57
TimeLabel::updateTime()
58
58
{
59
59
    qint64 ms;
60
 
    #define zeroPad( n ) n < 10 ? QString("0%1").arg( n ) : QString::number( n )
 
60
#define zeroPad( n ) n < 10 ? QString::fromLatin1("0%1").arg( n ) : QString::number( n )
61
61
    if( m_timeFormat == SHOW_REMAINING )
62
62
        ms = m_totalTime - m_currentTime;
63
63
    else
66
66
    const int m  =  s / 60;
67
67
    const int h  =  m / 60;
68
68
    QString time = zeroPad( s % 60 ); //seconds
69
 
    time.prepend( ':' );
 
69
    time.prepend( QLatin1Char( ':' ) );
70
70
    time.prepend( zeroPad( m % 60 ) ); //minutes
71
 
    time.prepend( ':' );
 
71
    time.prepend( QLatin1Char( ':' ) );
72
72
    time.prepend( QString::number( h ) ); //hours
73
73
    if( m_timeFormat == SHOW_REMAINING )
74
 
        time.prepend('-');
 
74
        time.prepend(QLatin1Char( '-' ));
75
75
    setText( time );
76
76
}
77
77