Changeset 10457
- Timestamp:
- Apr 6, 2010, 4:54:51 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/details.c
r10456 r10457 677 677 str = none; 678 678 else { 679 const tr_torrent_activity a = stats[0]->activity; 680 const tr_bool f = stats[0]->finished; 681 str = activityString( a, f ); 679 const tr_torrent_activity activity = stats[0]->activity; 680 tr_bool allFinished = stats[0]->finished; 682 681 for( i=1; i<n; ++i ) { 683 if( ( stats[i]->activity != a ) || ( stats[i]->finished != f ) ) { 684 str = mixed; 685 break; 686 } 687 } 682 if( activity != stats[i]->activity ) 683 break; 684 if( !stats[i]->finished ) 685 allFinished = FALSE; 686 } 687 str = i<n ? mixed : activityString( activity, allFinished ); 688 688 } 689 689 stateString = str; … … 695 695 str = none; 696 696 else { 697 tr_bool allPaused = TRUE;698 t ime_t baseline = stats[0]->startDate;697 const time_t baseline = stats[0]->startDate; 698 tr_bool allFinished = stats[0]->finished; 699 699 for( i=1; i<n; ++i ) { 700 700 if( baseline != stats[i]->startDate ) 701 baseline = 0; 702 if( stats[i]->activity != TR_STATUS_STOPPED ) 703 allPaused = FALSE; 704 } 705 if( allPaused ) 706 str = stateString; // paused || finished 707 else if( !baseline ) 701 break; 702 if( !stats[i]->finished ) 703 allFinished = FALSE; 704 } 705 if( i != n ) 708 706 str = mixed; 707 else if( ( baseline<=0 ) || ( stats[0]->activity == TR_STATUS_STOPPED ) ) 708 str = stateString; 709 709 else 710 710 str = tr_strltime( buf, time(NULL)-baseline, sizeof( buf ) ); -
trunk/qt/details.cc
r10455 r10457 246 246 string = none; 247 247 else { 248 bool isMixed = false; 249 bool allPaused = true; 250 bool allFinished = true; 248 251 const tr_torrent_activity activity = torrents[0]->getActivity( ); 249 string = torrents[0]->activityString( );250 252 foreach( const Torrent * t, torrents ) { 251 if( activity != t->getActivity( ) ) { 252 string = mixed; 253 break; 254 } 255 } 253 if( activity != t->getActivity( ) ) 254 isMixed = true; 255 if( activity != TR_STATUS_STOPPED ) 256 allPaused = allFinished = false; 257 if( !t->isFinished( ) ) 258 allFinished = false; 259 } 260 if( isMixed ) 261 string = mixed; 262 else if( allFinished ) 263 string = tr( "Finished" ); 264 else if( allPaused ) 265 string = tr( "Paused" ); 266 else 267 string = torrents[0]->activityString( ); 256 268 } 257 269 myStateLabel->setText( string );
Note: See TracChangeset
for help on using the changeset viewer.