mirror of
https://github.com/transmission/transmission
synced 2025-02-22 14:10:34 +00:00
(trunk) poke at details yet again
This commit is contained in:
parent
a709b719bf
commit
af09bb2853
2 changed files with 31 additions and 19 deletions
|
@ -676,15 +676,15 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n )
|
||||||
if( n < 1 )
|
if( n < 1 )
|
||||||
str = none;
|
str = none;
|
||||||
else {
|
else {
|
||||||
const tr_torrent_activity a = stats[0]->activity;
|
const tr_torrent_activity activity = stats[0]->activity;
|
||||||
const tr_bool f = stats[0]->finished;
|
tr_bool allFinished = stats[0]->finished;
|
||||||
str = activityString( a, f );
|
|
||||||
for( i=1; i<n; ++i ) {
|
for( i=1; i<n; ++i ) {
|
||||||
if( ( stats[i]->activity != a ) || ( stats[i]->finished != f ) ) {
|
if( activity != stats[i]->activity )
|
||||||
str = mixed;
|
|
||||||
break;
|
break;
|
||||||
|
if( !stats[i]->finished )
|
||||||
|
allFinished = FALSE;
|
||||||
}
|
}
|
||||||
}
|
str = i<n ? mixed : activityString( activity, allFinished );
|
||||||
}
|
}
|
||||||
stateString = str;
|
stateString = str;
|
||||||
gtr_label_set_text( GTK_LABEL( di->state_lb ), str );
|
gtr_label_set_text( GTK_LABEL( di->state_lb ), str );
|
||||||
|
@ -694,18 +694,18 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n )
|
||||||
if( n < 1 )
|
if( n < 1 )
|
||||||
str = none;
|
str = none;
|
||||||
else {
|
else {
|
||||||
tr_bool allPaused = TRUE;
|
const time_t baseline = stats[0]->startDate;
|
||||||
time_t baseline = stats[0]->startDate;
|
tr_bool allFinished = stats[0]->finished;
|
||||||
for( i=1; i<n; ++i ) {
|
for( i=1; i<n; ++i ) {
|
||||||
if( baseline != stats[i]->startDate )
|
if( baseline != stats[i]->startDate )
|
||||||
baseline = 0;
|
break;
|
||||||
if( stats[i]->activity != TR_STATUS_STOPPED )
|
if( !stats[i]->finished )
|
||||||
allPaused = FALSE;
|
allFinished = FALSE;
|
||||||
}
|
}
|
||||||
if( allPaused )
|
if( i != n )
|
||||||
str = stateString; // paused || finished
|
|
||||||
else if( !baseline )
|
|
||||||
str = mixed;
|
str = mixed;
|
||||||
|
else if( ( baseline<=0 ) || ( stats[0]->activity == TR_STATUS_STOPPED ) )
|
||||||
|
str = stateString;
|
||||||
else
|
else
|
||||||
str = tr_strltime( buf, time(NULL)-baseline, sizeof( buf ) );
|
str = tr_strltime( buf, time(NULL)-baseline, sizeof( buf ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,14 +245,26 @@ Details :: refresh( )
|
||||||
if( torrents.empty( ) )
|
if( torrents.empty( ) )
|
||||||
string = none;
|
string = none;
|
||||||
else {
|
else {
|
||||||
|
bool isMixed = false;
|
||||||
|
bool allPaused = true;
|
||||||
|
bool allFinished = true;
|
||||||
const tr_torrent_activity activity = torrents[0]->getActivity( );
|
const tr_torrent_activity activity = torrents[0]->getActivity( );
|
||||||
string = torrents[0]->activityString( );
|
|
||||||
foreach( const Torrent * t, torrents ) {
|
foreach( const Torrent * t, torrents ) {
|
||||||
if( activity != t->getActivity( ) ) {
|
if( activity != t->getActivity( ) )
|
||||||
|
isMixed = true;
|
||||||
|
if( activity != TR_STATUS_STOPPED )
|
||||||
|
allPaused = allFinished = false;
|
||||||
|
if( !t->isFinished( ) )
|
||||||
|
allFinished = false;
|
||||||
|
}
|
||||||
|
if( isMixed )
|
||||||
string = mixed;
|
string = mixed;
|
||||||
break;
|
else if( allFinished )
|
||||||
}
|
string = tr( "Finished" );
|
||||||
}
|
else if( allPaused )
|
||||||
|
string = tr( "Paused" );
|
||||||
|
else
|
||||||
|
string = torrents[0]->activityString( );
|
||||||
}
|
}
|
||||||
myStateLabel->setText( string );
|
myStateLabel->setText( string );
|
||||||
const QString stateString = string;
|
const QString stateString = string;
|
||||||
|
|
Loading…
Reference in a new issue