Changeset 11097


Ignore:
Timestamp:
Aug 2, 2010, 6:31:27 PM (12 years ago)
Author:
charles
Message:

(trunk qt) minor cleanup in the delegate code

Location:
trunk/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/torrent-delegate-min.cc

    r11092 r11097  
    5757    const bool isMagnet( !tor.hasMetadata( ) );
    5858    const QString nameStr = (isMagnet ? progressString( tor ) : tor.name( ) );
    59     const QSize nameSize( nameFM.size( 0, nameStr ) );
     59    const int nameWidth = nameFM.width( nameStr );
    6060
    6161    QFont statusFont( option.font );
     
    6363    const QFontMetrics statusFM( statusFont );
    6464    const QString statusStr( shortStatusString( tor ) );
    65     const QSize statusSize( statusFM.size( 0, statusStr ) );
     65    const int statusWidth = statusFM.width( statusStr );
    6666
    6767    const QSize m( margin( *style ) );
    6868
    69     return QSize( m.width()*2 + iconSize + GUI_PAD + nameSize.width()
    70                                          + GUI_PAD + statusSize.width()
     69    return QSize( m.width()*2 + iconSize + GUI_PAD + nameWidth
     70                                         + GUI_PAD + statusWidth
    7171                                         + GUI_PAD + BAR_WIDTH,
    72                   m.height()*2 + std::max( nameSize.height(), (int)BAR_HEIGHT ) );
     72                  m.height()*2 + std::max( nameFM.height(), (int)BAR_HEIGHT ) );
    7373}
    7474
     
    8484    const bool isMagnet( !tor.hasMetadata( ) );
    8585    const QString nameStr = (isMagnet ? progressString( tor ) : tor.name( ) );
    86     const QSize nameSize( nameFM.size( 0, nameStr ) );
    8786
    8887    QFont statusFont( option.font );
  • trunk/qt/torrent-delegate.cc

    r11092 r11097  
    279279    const QFontMetrics nameFM( nameFont );
    280280    const QString nameStr( tor.name( ) );
    281     const QSize nameSize( nameFM.size( 0, nameStr ) );
     281    const int nameWidth = nameFM.width( nameStr );
    282282    QFont statusFont( option.font );
    283283    statusFont.setPointSize( int( option.font.pointSize( ) * 0.9 ) );
    284284    const QFontMetrics statusFM( statusFont );
    285285    const QString statusStr( statusString( tor ) );
    286     const QSize statusSize( statusFM.size( 0, statusStr ) );
     286    const int statusWidth = statusFM.width( statusStr );
    287287    QFont progressFont( statusFont );
    288288    const QFontMetrics progressFM( progressFont );
    289289    const QString progressStr( progressString( tor ) );
    290     const QSize progressSize( progressFM.size( 0, progressStr ) );
     290    const int progressWidth = progressFM.width( progressStr );
    291291    const QSize m( margin( *style ) );
    292     return QSize( m.width()*2 + iconSize + GUI_PAD + MAX3( nameSize.width(), statusSize.width(), progressSize.width() ),
     292    return QSize( m.width()*2 + iconSize + GUI_PAD + MAX3( nameWidth, statusWidth, progressWidth ),
    293293                  //m.height()*3 + nameFM.lineSpacing() + statusFM.lineSpacing()*2 + progressFM.lineSpacing() );
    294294                  m.height()*3 + nameFM.lineSpacing() + statusFM.lineSpacing() + BAR_HEIGHT + progressFM.lineSpacing() );
  • trunk/qt/tracker-delegate.cc

    r11092 r11097  
    1313#include <iostream>
    1414
    15 #include <QApplication>
    16 #include <QBrush>
    17 #include <QFont>
    18 #include <QFontMetrics>
    19 #include <QIcon>
    20 #include <QModelIndex>
    2115#include <QPainter>
    2216#include <QPixmap>
    23 #include <QPixmapCache>
    24 #include <QStyleOptionProgressBarV2>
    2517#include <QTextDocument>
    26 #include <QUrl>
    2718
    2819#include <libtransmission/transmission.h>
Note: See TracChangeset for help on using the changeset viewer.