Changeset 13978


Ignore:
Timestamp:
Feb 5, 2013, 11:05:26 PM (8 years ago)
Author:
jordan
Message:

(qt) in the statusbar, use the same upload/download symbols as in the torrent list

Location:
trunk/qt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/formatter.cc

    r13897 r13978  
    190190    return str;
    191191}
     192
     193QString
     194Formatter :: uploadSpeedToString (const Speed& uploadSpeed)
     195{
     196  static const QChar uploadSymbol (0x25B4);
     197
     198  return tr( "%1 %2").arg(speedToString(uploadSpeed)).arg(uploadSymbol);
     199}
     200
     201QString
     202Formatter :: downloadSpeedToString (const Speed& downloadSpeed)
     203{
     204  static const QChar downloadSymbol (0x25BE);
     205
     206  return tr( "%1 %2").arg(speedToString(downloadSpeed)).arg(downloadSymbol);
     207}
     208
  • trunk/qt/formatter.h

    r12429 r13978  
    3939        static QString ratioToString( double ratio );
    4040        static QString timeToString( int seconds );
     41        static QString uploadSpeedToString (const Speed& up);
     42        static QString downloadSpeedToString (const Speed& down);
    4143
    4244    public:
  • trunk/qt/mainwin.cc

    r13939 r13978  
    403403
    404404    l = myDownloadSpeedLabel = new QLabel (this);
    405     const int minimumSpeedWidth = l->fontMetrics ().width (Formatter::speedToString (Speed::fromKBps (999.99)));
     405    const int minimumSpeedWidth = l->fontMetrics ().width (Formatter::uploadSpeedToString (Speed::fromKBps (999.99)));
    406406    l->setMinimumWidth (minimumSpeedWidth);
    407407    l->setAlignment (Qt::AlignRight|Qt::AlignVCenter);
    408408    h->addWidget (l);
    409     l = new QLabel (this);
    410     l->setPixmap (getStockIcon ("go-down", QStyle::SP_ArrowDown).pixmap (smallIconSize));
    411     h->addWidget (l);
    412409
    413410  h->addSpacing (HIG::PAD);
     
    416413    l->setMinimumWidth (minimumSpeedWidth);
    417414    l->setAlignment (Qt::AlignRight|Qt::AlignVCenter);
    418     h->addWidget (l);
    419     l = new QLabel;
    420     l->setPixmap (getStockIcon ("go-up", QStyle::SP_ArrowUp).pixmap (smallIconSize));
    421415    h->addWidget (l);
    422416
     
    765759TrMainWindow :: refreshStatusBar ()
    766760{
    767   const Speed up (myModel.getUploadSpeed ());
    768   const Speed down (myModel.getDownloadSpeed ());
    769   myUploadSpeedLabel->setText (Formatter:: speedToString (up));
    770   myDownloadSpeedLabel->setText (Formatter:: speedToString (down));
     761  myUploadSpeedLabel->setText (Formatter::uploadSpeedToString(myModel.getUploadSpeed()));
     762
     763  myDownloadSpeedLabel->setText (Formatter::downloadSpeedToString(myModel.getDownloadSpeed()));
    771764
    772765  myNetworkLabel->setVisible (!mySession.isServer ());
  • trunk/qt/torrent-delegate.cc

    r13897 r13978  
    172172{
    173173  QString str;
    174   static const QChar uploadSymbol (0x25B4);
    175   static const QChar downloadSymbol (0x25BE);
    176174  const bool haveMeta (tor.hasMetadata());
    177175  const bool haveDown (haveMeta && ((tor.webseedsWeAreDownloadingFrom()>0) || (tor.peersWeAreDownloadingFrom()>0)));
     
    179177
    180178  if (haveDown)
    181     str = tr( "%1 %2   %3 %4" ).arg(Formatter::speedToString(tor.downloadSpeed()))
    182                                .arg(downloadSymbol)
    183                                .arg(Formatter::speedToString(tor.uploadSpeed()))
    184                                .arg(uploadSymbol);
     179    str = tr( "%1   %2" ).arg(Formatter::downloadSpeedToString(tor.downloadSpeed()))
     180                         .arg(Formatter::uploadSpeedToString(tor.uploadSpeed()));
    185181
    186182  else if (haveUp)
    187     str = tr( "%1 %2" ).arg(Formatter::speedToString(tor.uploadSpeed()))
    188                        .arg(uploadSymbol);
     183    str = Formatter::uploadSpeedToString(tor.uploadSpeed());
    189184
    190185  return str;
Note: See TracChangeset for help on using the changeset viewer.