Changeset 10451


Ignore:
Timestamp:
Apr 6, 2010, 2:34:45 AM (12 years ago)
Author:
charles
Message:

(trunk) #1869 "New status for torrents that reached the seed ratio" -- implemented for GTK+, Qt, and transmission-remote by Longinus00's patch

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r10431 r10451  
    338338    "honorsSessionLimits",
    339339    "id",
     340    "isFinished",
    340341    "isPrivate",
    341342    "leftUntilDone",
     
    370371    "eta",
    371372    "id",
     373    "isFinished",
    372374    "leftUntilDone",
    373375    "name",
     
    10091011{
    10101012    int64_t status;
     1013    tr_bool boolVal;
    10111014
    10121015    if( !tr_bencDictFindInt( t, "status", &status ) )
     
    10171020    {
    10181021        case TR_STATUS_STOPPED:
    1019             tr_strlcpy( buf, "Stopped", buflen );
     1022            if( tr_bencDictFindBool( t, "isFinished", &boolVal ) && boolVal )
     1023                tr_strlcpy( buf, "Finished", buflen );
     1024            else
     1025                tr_strlcpy( buf, "Stopped", buflen );
    10201026            break;
    10211027
  • trunk/gtk/torrent-cell-renderer.c

    r10433 r10451  
    203203    {
    204204        case TR_STATUS_STOPPED:
    205             g_string_assign( gstr, _( "Paused" ) );
     205            if( torStat->finished )
     206                g_string_assign( gstr, _( "Finished" ) );
     207            else
     208                g_string_assign( gstr, _( "Paused" ) );
    206209            break;
    207210
  • trunk/gtk/tr-torrent.c

    r9691 r10451  
    216216}
    217217
    218 char *
    219 tr_torrent_status_str( TrTorrent * gtor )
    220 {
    221     char *          top = NULL;
    222 
    223     const tr_stat * st = tr_torrent_stat( gtor );
    224 
    225     const int       tpeers = MAX ( st->peersConnected, 0 );
    226     const int       upeers = MAX ( st->peersGettingFromUs, 0 );
    227     const int       eta = st->eta;
    228 
    229     switch( st->activity )
    230     {
    231         case TR_STATUS_CHECK_WAIT:
    232             top =
    233                 g_strdup_printf( _( "Waiting to verify local data (%.1f%% tested)" ),
    234                                  tr_truncd( 100 * st->recheckProgress, 1 ) );
    235             break;
    236 
    237         case TR_STATUS_CHECK:
    238             top =
    239                 g_strdup_printf( _( "Verifying local data (%.1f%% tested)" ),
    240                                  tr_truncd( 100 * st->recheckProgress, 1 ) );
    241             break;
    242 
    243         case TR_STATUS_DOWNLOAD:
    244 
    245             if( eta < 0 )
    246                 top = g_strdup_printf( _( "Remaining time unknown" ) );
    247             else
    248             {
    249                 char timestr[128];
    250                 tr_strltime( timestr, eta, sizeof( timestr ) );
    251                 /* %s is # of minutes */
    252                 top = g_strdup_printf( _( "%1$s remaining" ), timestr );
    253             }
    254             break;
    255 
    256         case TR_STATUS_SEED:
    257             top = g_strdup_printf(
    258                 ngettext( "Seeding to %1$'d of %2$'d connected peer",
    259                           "Seeding to %1$'d of %2$'d connected peers",
    260                           tpeers ),
    261                 upeers, tpeers );
    262             break;
    263 
    264         case TR_STATUS_STOPPED:
    265             top = g_strdup( _( "Stopped" ) );
    266             break;
    267 
    268         default:
    269             top = g_strdup( "???" );
    270             break;
    271     }
    272 
    273     return top;
    274 }
    275 
    276218void
    277219tr_torrent_set_remove_flag( TrTorrent * gtor,
  • trunk/gtk/tr-torrent.h

    r7860 r10451  
    6666const tr_info *tr_torrent_info( TrTorrent *tor );
    6767
    68 char*          tr_torrent_status_str( TrTorrent * tor );
    69 
    7068void           tr_torrent_delete_files( TrTorrent * tor );
    7169
  • trunk/qt/torrent-delegate.cc

    r10441 r10451  
    183183    switch( tor.getActivity( ) )
    184184    {
    185         case TR_STATUS_STOPPED:
    186             str = tr( "Paused" );
    187             break;
    188 
    189         case TR_STATUS_CHECK_WAIT:
    190             str = tr( "Waiting to verify local data" );
    191             break;
    192 
    193185        case TR_STATUS_CHECK:
    194186            str = tr( "Verifying local data (%1% tested)" ).arg( tor.getVerifyProgress()*100.0, 0, 'f', 1 );
     
    203195
    204196        default:
     197            str = tor.activityString( );
    205198            break;
    206199    }
  • trunk/qt/torrent.cc

    r10442 r10451  
    9797    { PEER_LIMIT, "peer-limit", QVariant::Int, STAT_EXTRA },
    9898    { HASH_STRING, "hashString", QVariant::String, INFO },
     99    { IS_FINISHED, "isFinished", QVariant::Bool, STAT },
    99100    { IS_PRIVATE, "isPrivate", QVariant::Bool, INFO },
    100101    { COMMENT, "comment", QVariant::String, INFO },
     
    676677        case TR_STATUS_DOWNLOAD:   str = tr( "Downloading" ); break;
    677678        case TR_STATUS_SEED:       str = tr( "Seeding" ); break;
    678         case TR_STATUS_STOPPED:    str = tr( "Paused" ); break;
     679        case TR_STATUS_STOPPED:    str = isFinished() ? tr( "Finished" ): tr( "Paused" ); break;
    679680    }
    680681
  • trunk/qt/torrent.h

    r10442 r10451  
    160160            PEER_LIMIT,
    161161            HASH_STRING,
     162            IS_FINISHED,
    162163            IS_PRIVATE,
    163164            COMMENT,
     
    294295        QString activityString( ) const;
    295296        tr_torrent_activity getActivity( ) const { return (tr_torrent_activity) getInt( ACTIVITY ); }
     297        bool isFinished( ) const { return getBool( IS_FINISHED ); }
    296298        bool isPaused( ) const { return getActivity( ) == TR_STATUS_STOPPED; }
    297299        bool isVerifying( ) const { return getActivity( ) == TR_STATUS_CHECK; }
Note: See TracChangeset for help on using the changeset viewer.