mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
(trunk qt) HiG: "When there is no interesting status to report, leave a status bar panel blank"
This commit is contained in:
parent
3ecec47b14
commit
55e110938c
2 changed files with 23 additions and 10 deletions
|
@ -368,7 +368,8 @@ QWidget *
|
||||||
TrMainWindow :: createStatusBar( )
|
TrMainWindow :: createStatusBar( )
|
||||||
{
|
{
|
||||||
QMenu * m;
|
QMenu * m;
|
||||||
QLabel * l;
|
QLabel *l, *l2;
|
||||||
|
QWidget *w;
|
||||||
QHBoxLayout * h;
|
QHBoxLayout * h;
|
||||||
QPushButton * p;
|
QPushButton * p;
|
||||||
QActionGroup * a;
|
QActionGroup * a;
|
||||||
|
@ -378,6 +379,7 @@ TrMainWindow :: createStatusBar( )
|
||||||
QWidget * top = myStatusBar = new QWidget;
|
QWidget * top = myStatusBar = new QWidget;
|
||||||
h = new QHBoxLayout( top );
|
h = new QHBoxLayout( top );
|
||||||
h->setContentsMargins( HIG::PAD_SMALL, HIG::PAD_SMALL, HIG::PAD_SMALL, HIG::PAD_SMALL );
|
h->setContentsMargins( HIG::PAD_SMALL, HIG::PAD_SMALL, HIG::PAD_SMALL, HIG::PAD_SMALL );
|
||||||
|
h->setSpacing( HIG::PAD_SMALL );
|
||||||
|
|
||||||
p = myOptionsButton = new TrIconPushButton( this );
|
p = myOptionsButton = new TrIconPushButton( this );
|
||||||
p->setIcon( QIcon( ":/icons/options.png" ) );
|
p->setIcon( QIcon( ":/icons/options.png" ) );
|
||||||
|
@ -420,25 +422,30 @@ TrMainWindow :: createStatusBar( )
|
||||||
p->setFlat( true );
|
p->setFlat( true );
|
||||||
p->setMenu( m );
|
p->setMenu( m );
|
||||||
h->addWidget( p );
|
h->addWidget( p );
|
||||||
h->addSpacing( HIG :: PAD_SMALL );
|
|
||||||
l = myStatsLabel = new QLabel( this );
|
l = myStatsLabel = new QLabel( this );
|
||||||
h->addWidget( l );
|
h->addWidget( l );
|
||||||
|
|
||||||
h->addStretch( 1 );
|
w = new QWidget( this );
|
||||||
|
w->setMinimumSize( HIG::PAD_BIG, 1 );
|
||||||
|
w->setMaximumSize( HIG::PAD_BIG, 1 );
|
||||||
|
h->addWidget( w );
|
||||||
l = new QLabel( this );
|
l = new QLabel( this );
|
||||||
l->setPixmap( getStockIcon( "go-down", QStyle::SP_ArrowDown ).pixmap( smallIconSize ) );
|
l->setPixmap( getStockIcon( "go-down", QStyle::SP_ArrowDown ).pixmap( smallIconSize ) );
|
||||||
h->addWidget( l );
|
h->addWidget( l );
|
||||||
l = myDownloadSpeedLabel = new QLabel( this );
|
l2 = myDownloadSpeedLabel = new QLabel( this );
|
||||||
h->addWidget( l );
|
h->addWidget( l2 );
|
||||||
|
myDownStatusWidgets << w << l << l2;
|
||||||
h->addSpacing( HIG :: PAD_BIG );
|
|
||||||
|
|
||||||
|
w = new QWidget( this );
|
||||||
|
w->setMinimumSize( HIG::PAD_BIG, 1 );
|
||||||
|
w->setMaximumSize( HIG::PAD_BIG, 1 );
|
||||||
|
h->addWidget( w );
|
||||||
l = new QLabel;
|
l = new QLabel;
|
||||||
l->setPixmap( getStockIcon( "go-up", QStyle::SP_ArrowUp ).pixmap( smallIconSize ) );
|
l->setPixmap( getStockIcon( "go-up", QStyle::SP_ArrowUp ).pixmap( smallIconSize ) );
|
||||||
h->addWidget( l );
|
h->addWidget( l );
|
||||||
l = myUploadSpeedLabel = new QLabel;
|
l2 = myUploadSpeedLabel = new QLabel;
|
||||||
h->addWidget( l );
|
h->addWidget( l2 );
|
||||||
|
myUpStatusWidgets << w << l << l2;
|
||||||
|
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
@ -600,6 +607,7 @@ TrMainWindow :: refreshVisibleCount( )
|
||||||
else
|
else
|
||||||
str = tr( "%L1 of %Ln Torrent(s)", 0, totalCount ).arg( visibleCount );
|
str = tr( "%L1 of %Ln Torrent(s)", 0, totalCount ).arg( visibleCount );
|
||||||
myVisibleCountLabel->setText( str );
|
myVisibleCountLabel->setText( str );
|
||||||
|
myVisibleCountLabel->setVisible( totalCount > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -609,6 +617,9 @@ TrMainWindow :: refreshStatusBar( )
|
||||||
const Speed down( myModel.getDownloadSpeed( ) );
|
const Speed down( myModel.getDownloadSpeed( ) );
|
||||||
myUploadSpeedLabel->setText( Utils :: speedToString( up ) );
|
myUploadSpeedLabel->setText( Utils :: speedToString( up ) );
|
||||||
myDownloadSpeedLabel->setText( Utils :: speedToString( down ) );
|
myDownloadSpeedLabel->setText( Utils :: speedToString( down ) );
|
||||||
|
foreach( QWidget * w, myUpStatusWidgets ) w->setVisible( !up.isZero( ) );
|
||||||
|
foreach( QWidget * w, myDownStatusWidgets ) w->setVisible( !down.isZero( ) );
|
||||||
|
|
||||||
const QString mode( myPrefs.getString( Prefs::STATUSBAR_STATS ) );
|
const QString mode( myPrefs.getString( Prefs::STATUSBAR_STATS ) );
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
|
|
|
@ -143,6 +143,8 @@ class TrMainWindow: public QMainWindow
|
||||||
QMenu * createOptionsMenu( void );
|
QMenu * createOptionsMenu( void );
|
||||||
QWidget * createStatusBar( void );
|
QWidget * createStatusBar( void );
|
||||||
QWidget * myStatusBar;
|
QWidget * myStatusBar;
|
||||||
|
QWidgetList myUpStatusWidgets;
|
||||||
|
QWidgetList myDownStatusWidgets;
|
||||||
QPushButton * myAltSpeedButton;
|
QPushButton * myAltSpeedButton;
|
||||||
QPushButton * myOptionsButton;
|
QPushButton * myOptionsButton;
|
||||||
QLabel * myVisibleCountLabel;
|
QLabel * myVisibleCountLabel;
|
||||||
|
|
Loading…
Reference in a new issue