(trunk) set minimum widths for the upload/download labels in the statusbar

This commit is contained in:
Charles Kerr 2010-07-31 06:20:17 +00:00
parent 5ebcdd5fc5
commit 344e4bedc5
2 changed files with 10 additions and 3 deletions

View File

@ -728,10 +728,12 @@ tr_window_new( GtkUIManager * ui_mgr, TrCore * core )
}
{
int w=0, h=0;
/* this is to determine the maximum width/height for the label */
PangoLayout * pango_layout =
gtk_widget_create_pango_layout( p->ul_lb, _( "999.99 KiB/s" ) );
int w=0, h=0;
char buf[64];
PangoLayout * pango_layout;
tr_formatter_speed_KBps( buf, 999.99, sizeof( buf ) );
pango_layout = gtk_widget_create_pango_layout( p->ul_lb, buf );
pango_layout_get_pixel_size( pango_layout, &w, &h );
gtk_widget_set_size_request( p->ul_lb, w, h );
gtk_widget_set_size_request( p->dl_lb, w, h );

View File

@ -425,6 +425,9 @@ TrMainWindow :: createStatusBar( )
w->setMaximumSize( HIG::PAD_BIG, 1 );
h->addWidget( w );
l = myDownloadSpeedLabel = new QLabel( this );
const int minimumSpeedWidth = l->fontMetrics().width( Formatter::speedToString(Speed::fromKBps(999.99)));
l->setMinimumWidth( minimumSpeedWidth );
l->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
h->addWidget( l );
l = new QLabel( this );
l->setPixmap( getStockIcon( "go-down", QStyle::SP_ArrowDown ).pixmap( smallIconSize ) );
@ -437,6 +440,8 @@ TrMainWindow :: createStatusBar( )
w->setMaximumSize( HIG::PAD_BIG, 1 );
h->addWidget( w );
l = myUploadSpeedLabel = new QLabel;
l->setMinimumWidth( minimumSpeedWidth );
l->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
h->addWidget( l );
l = new QLabel;
l->setPixmap( getStockIcon( "go-up", QStyle::SP_ArrowUp ).pixmap( smallIconSize ) );