mirror of
https://github.com/transmission/transmission
synced 2025-03-04 02:28:03 +00:00
(trunk qt,gtk) #3549 "torrent properties window doesn't fix netbook screen" -- merge the "Uploaded" and "Ratio" rows to save a little vertical space
This commit is contained in:
parent
0e5cceef91
commit
71d0b05524
3 changed files with 17 additions and 48 deletions
|
@ -64,7 +64,6 @@ struct DetailsImpl
|
|||
GtkWidget * have_lb;
|
||||
GtkWidget * dl_lb;
|
||||
GtkWidget * ul_lb;
|
||||
GtkWidget * ratio_lb;
|
||||
GtkWidget * error_lb;
|
||||
GtkWidget * date_started_lb;
|
||||
GtkWidget * eta_lb;
|
||||
|
@ -857,29 +856,23 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n )
|
|||
|
||||
|
||||
/* ul_lb */
|
||||
if( n <= 0 )
|
||||
str = no_torrent;
|
||||
else {
|
||||
uint64_t sum = 0;
|
||||
for( i=0; i<n; ++i ) sum += stats[i]->uploadedEver;
|
||||
str = tr_strlsize( buf, sum, sizeof( buf ) );
|
||||
}
|
||||
gtr_label_set_text( GTK_LABEL( di->ul_lb ), str );
|
||||
|
||||
|
||||
/* ratio */
|
||||
if( n <= 0 )
|
||||
str = no_torrent;
|
||||
else {
|
||||
uint64_t up = 0;
|
||||
uint64_t down = 0;
|
||||
char upstr[64];
|
||||
char ratiostr[64];
|
||||
for( i=0; i<n; ++i ) {
|
||||
up += stats[i]->uploadedEver;
|
||||
down += stats[i]->downloadedEver;
|
||||
}
|
||||
str = tr_strlratio( buf, tr_getRatio( up, down ), sizeof( buf ) );
|
||||
tr_strlsize( upstr, up, sizeof( upstr ) );
|
||||
tr_strlratio( ratiostr, tr_getRatio( up, down ), sizeof( ratiostr ) );
|
||||
g_snprintf( buf, sizeof( buf ), _( "%s (Ratio: %s)" ), upstr, ratiostr );
|
||||
str = buf;
|
||||
}
|
||||
gtr_label_set_text( GTK_LABEL( di->ratio_lb ), str );
|
||||
gtr_label_set_text( GTK_LABEL( di->ul_lb ), str );
|
||||
|
||||
/* hash_lb */
|
||||
if( n <= 0 )
|
||||
|
@ -962,10 +955,6 @@ info_page_new( struct DetailsImpl * di )
|
|||
l = di->ul_lb = gtk_label_new( NULL );
|
||||
hig_workarea_add_row( t, &row, _( "Uploaded:" ), l, NULL );
|
||||
|
||||
/* ratio */
|
||||
l = di->ratio_lb = gtk_label_new( NULL );
|
||||
hig_workarea_add_row( t, &row, _( "Ratio:" ), l, NULL );
|
||||
|
||||
/* state */
|
||||
l = di->state_lb = gtk_label_new( NULL );
|
||||
hig_workarea_add_row( t, &row, _( "State:" ), l, NULL );
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/bencode.h>
|
||||
#include <libtransmission/utils.h> // tr_getRatio()
|
||||
|
||||
#include "details.h"
|
||||
#include "file-tree.h"
|
||||
|
@ -426,40 +427,21 @@ Details :: refresh( )
|
|||
}
|
||||
myDownloadedLabel->setText( string );
|
||||
|
||||
uint64_t u = 0;
|
||||
if( torrents.empty( ) )
|
||||
string = none;
|
||||
else {
|
||||
foreach( const Torrent * t, torrents ) u += t->uploadedEver( );
|
||||
string = QString( Formatter::sizeToString( u ) );
|
||||
uint64_t u = 0;
|
||||
uint64_t d = 0;
|
||||
foreach( const Torrent * t, torrents ) {
|
||||
u += t->uploadedEver( );
|
||||
d += t->downloadedEver( );
|
||||
}
|
||||
string = tr( "%1 (Ratio: %2)" )
|
||||
.arg( Formatter::sizeToString( u ) )
|
||||
.arg( Formatter::ratioToString( tr_getRatio( u, d ) ) );
|
||||
}
|
||||
myUploadedLabel->setText( string );
|
||||
|
||||
if( torrents.empty( ) )
|
||||
string = none;
|
||||
else if( torrents.count() == 1 )
|
||||
string = Formatter::ratioToString( torrents.first()->ratio() );
|
||||
else {
|
||||
bool isMixed = false;
|
||||
int ratioType = (int) torrents.first()->ratio();
|
||||
if( ratioType > 0 ) ratioType = 0;
|
||||
foreach( const Torrent *t, torrents )
|
||||
{
|
||||
if( ratioType != ( t->ratio() >= 0 ? 0 : t->ratio() ) )
|
||||
{
|
||||
isMixed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( isMixed )
|
||||
string = mixed;
|
||||
else if( ratioType < 0 )
|
||||
string = Formatter::ratioToString( ratioType );
|
||||
else
|
||||
string = Formatter::ratioToString( (double)u / d );
|
||||
}
|
||||
myRatioLabel->setText( string );
|
||||
|
||||
const QDateTime qdt_now = QDateTime::currentDateTime( );
|
||||
|
||||
// myRunTimeLabel
|
||||
|
@ -860,7 +842,6 @@ Details :: createInfoTab( )
|
|||
hig->addRow( tr( "Availability:" ), myAvailabilityLabel = new SqueezeLabel );
|
||||
hig->addRow( tr( "Downloaded:" ), myDownloadedLabel = new SqueezeLabel );
|
||||
hig->addRow( tr( "Uploaded:" ), myUploadedLabel = new SqueezeLabel );
|
||||
hig->addRow( tr( "Ratio:" ), myRatioLabel = new SqueezeLabel );
|
||||
hig->addRow( tr( "State:" ), myStateLabel = new SqueezeLabel );
|
||||
hig->addRow( tr( "Running time:" ), myRunTimeLabel = new SqueezeLabel );
|
||||
hig->addRow( tr( "Remaining time:" ), myETALabel = new SqueezeLabel );
|
||||
|
|
|
@ -83,7 +83,6 @@ class Details: public QDialog
|
|||
QLabel * myAvailabilityLabel;
|
||||
QLabel * myDownloadedLabel;
|
||||
QLabel * myUploadedLabel;
|
||||
QLabel * myRatioLabel;
|
||||
QLabel * myErrorLabel;
|
||||
QLabel * myRunTimeLabel;
|
||||
QLabel * myETALabel;
|
||||
|
|
Loading…
Add table
Reference in a new issue