Changeset 8317


Ignore:
Timestamp:
May 2, 2009, 2:25:18 PM (12 years ago)
Author:
charles
Message:

(trunk qt) HiG: "When there is no interesting status to report, leave a status bar panel blank"

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/mainwin.cc

    r8262 r8317  
    369369{
    370370    QMenu * m;
    371     QLabel * l;
     371    QLabel *l, *l2;
     372    QWidget *w;
    372373    QHBoxLayout * h;
    373374    QPushButton * p;
     
    379380    h = new QHBoxLayout( top );
    380381    h->setContentsMargins( HIG::PAD_SMALL, HIG::PAD_SMALL, HIG::PAD_SMALL, HIG::PAD_SMALL );
     382    h->setSpacing( HIG::PAD_SMALL );
    381383
    382384        p = myOptionsButton = new TrIconPushButton( this );
     
    421423        p->setMenu( m );
    422424        h->addWidget( p ); 
    423         h->addSpacing( HIG :: PAD_SMALL );
    424425        l = myStatsLabel = new QLabel( this );
    425426        h->addWidget( l ); 
    426427   
    427     h->addStretch( 1 );
    428 
     428        w = new QWidget( this );
     429        w->setMinimumSize( HIG::PAD_BIG, 1 );
     430        w->setMaximumSize( HIG::PAD_BIG, 1 );
     431        h->addWidget( w );
    429432        l = new QLabel( this );
    430433        l->setPixmap( getStockIcon( "go-down", QStyle::SP_ArrowDown ).pixmap( smallIconSize ) );
    431434        h->addWidget( l );
    432         l = myDownloadSpeedLabel = new QLabel( this );
    433         h->addWidget( l );
    434 
    435     h->addSpacing( HIG :: PAD_BIG );
    436 
     435        l2 = myDownloadSpeedLabel = new QLabel( this );
     436        h->addWidget( l2 );
     437        myDownStatusWidgets << w << l << l2;
     438
     439        w = new QWidget( this );
     440        w->setMinimumSize( HIG::PAD_BIG, 1 );
     441        w->setMaximumSize( HIG::PAD_BIG, 1 );
     442        h->addWidget( w );
    437443        l = new QLabel;
    438444        l->setPixmap( getStockIcon( "go-up", QStyle::SP_ArrowUp ).pixmap( smallIconSize ) );
    439445        h->addWidget( l );
    440         l = myUploadSpeedLabel = new QLabel;
    441         h->addWidget( l );
     446        l2 = myUploadSpeedLabel = new QLabel;
     447        h->addWidget( l2 );
     448        myUpStatusWidgets << w << l << l2;
    442449
    443450    return top;
     
    601608        str = tr( "%L1 of %Ln Torrent(s)", 0, totalCount ).arg( visibleCount );
    602609    myVisibleCountLabel->setText( str );
     610    myVisibleCountLabel->setVisible( totalCount > 0 );
    603611}
    604612
     
    610618    myUploadSpeedLabel->setText( Utils :: speedToString( up ) );
    611619    myDownloadSpeedLabel->setText( Utils :: speedToString( down ) );
     620    foreach( QWidget * w, myUpStatusWidgets ) w->setVisible( !up.isZero( ) );
     621    foreach( QWidget * w, myDownStatusWidgets ) w->setVisible( !down.isZero( ) );
     622
    612623    const QString mode( myPrefs.getString( Prefs::STATUSBAR_STATS ) );
    613624    QString str;
  • trunk/qt/mainwin.h

    r8255 r8317  
    144144        QWidget * createStatusBar( void );
    145145        QWidget * myStatusBar;
     146        QWidgetList myUpStatusWidgets;
     147        QWidgetList myDownStatusWidgets;
    146148        QPushButton * myAltSpeedButton;
    147149        QPushButton * myOptionsButton;
Note: See TracChangeset for help on using the changeset viewer.