]> granicus.if.org Git - transmission/commitdiff
(trunk) set minimum widths for the upload/download labels in the statusbar
authorCharles Kerr <charles@transmissionbt.com>
Sat, 31 Jul 2010 06:20:17 +0000 (06:20 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 31 Jul 2010 06:20:17 +0000 (06:20 +0000)
gtk/tr-window.c
qt/mainwin.cc

index 32437cb73c0604833c051ced086f8d09b54ef46d..bbeb2073b71d2c011f4f9fe0d7f7d261bb72ed29 100644 (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 );
index d063a7165850dea8e0d9fe3a6dd00eb1def00d5f..405d2dc8729971b3ced87122a37cf1f1a868c709 100644 (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 ) );