Changeset 11086


Ignore:
Timestamp:
Aug 1, 2010, 5:43:35 PM (12 years ago)
Author:
Longinus00
Message:

(trunk) #3471:Add 'finished' to filterbar

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r11062 r11086  
    21612161            di->trackers = NULL;
    21622162            di->tracker_buffer = NULL;
    2163             tr_core_torrent_changed( di->core, tr_torrentId( tor ) );
    21642163        }
    21652164
  • trunk/gtk/filter.c

    r10672 r11086  
    590590    ACTIVITY_FILTER_ACTIVE,
    591591    ACTIVITY_FILTER_PAUSED,
     592    ACTIVITY_FILTER_FINISHED,
    592593    ACTIVITY_FILTER_QUEUED,
    593594    ACTIVITY_FILTER_VERIFYING,
     
    634635            return st->activity == TR_STATUS_STOPPED;
    635636
     637        case ACTIVITY_FILTER_FINISHED:
     638            return st->finished == TRUE;
     639
    636640        case ACTIVITY_FILTER_QUEUED:
    637             return FALSE;
     641            return st->activity == TR_STATUS_CHECK_WAIT;
    638642
    639643        case ACTIVITY_FILTER_VERIFYING:
    640             return ( st->activity == TR_STATUS_CHECK_WAIT )
    641                 || ( st->activity == TR_STATUS_CHECK );
     644            return st->activity == TR_STATUS_CHECK ;
    642645
    643646        case ACTIVITY_FILTER_ERROR:
     
    646649        default: /* ACTIVITY_FILTER_ALL */
    647650            return TRUE;
    648 
    649651    }
    650652}
     
    721723        { ACTIVITY_FILTER_SEEDING, N_( "Seeding" ), GTK_STOCK_GO_UP },
    722724        { ACTIVITY_FILTER_PAUSED, N_( "Paused" ), GTK_STOCK_MEDIA_PAUSE },
     725        { ACTIVITY_FILTER_FINISHED, N_( "Finished" ), NULL },
    723726        { ACTIVITY_FILTER_QUEUED, N_( "Queued" ), NULL },
    724727        { ACTIVITY_FILTER_VERIFYING, N_( "Verifying" ), GTK_STOCK_REFRESH },
  • trunk/gtk/tr-core.c

    r11067 r11086  
    553553}
    554554
     555static char *
     556torrentTrackerString( tr_torrent * tor )
     557{
     558    int i;
     559    GString * str = g_string_new( "" );
     560    const tr_info * inf = tr_torrentInfo( tor );
     561
     562    for( i = 0; i < inf->trackerCount; ++i )
     563    {
     564        const tr_tracker_info * t = &inf->trackers[i];
     565        str = g_string_append( str, t->announce );
     566    }
     567
     568    return g_string_free( str, FALSE );
     569}
     570
    555571#ifdef HAVE_GIO
    556572
     
    780796                      G_TYPE_DOUBLE,    /* tr_stat.pieceUploadSpeed_KBps */
    781797                      G_TYPE_DOUBLE,    /* tr_stat.pieceDownloadSpeed_KBps */
    782                       G_TYPE_INT };     /* tr_stat.status */
     798                      G_TYPE_INT,       /* tr_stat.activity */
     799                      G_TYPE_UCHAR,     /* tr_stat.finished */
     800                      G_TYPE_CHAR,      /* tr_priority_t */
     801                      G_TYPE_STRING };  /* concatenated trackers string */
    783802
    784803    p = self->priv = G_TYPE_INSTANCE_GET_PRIVATE( self,
     
    887906    tr_torrent *    tor = tr_torrent_handle( gtor );
    888907    char *          collated = g_utf8_strdown( inf->name, -1 );
     908    char *          trackers = torrentTrackerString( tor );
    889909    GtkListStore *  store = GTK_LIST_STORE( tr_core_model( self ) );
    890910    GtkTreeIter     unused;
     
    898918                                       MC_SPEED_DOWN,    st->pieceDownloadSpeed_KBps,
    899919                                       MC_ACTIVITY,      st->activity,
     920                                       MC_FINISHED,      st->finished,
     921                                       MC_PRIORITY,      tr_torrentGetPriority( tor ),
     922                                       MC_TRACKERS,      trackers,
    900923                                       -1 );
    901924
     
    906929    g_object_unref( G_OBJECT( gtor ) );
    907930    g_free( collated );
     931    g_free( trackers );
    908932}
    909933
     
    12971321{
    12981322    int oldActivity, newActivity;
     1323    tr_bool oldFinished, newFinished;
     1324    tr_priority_t oldPriority, newPriority;
     1325    char * oldTrackers, * newTrackers;
    12991326    double oldUpSpeed, newUpSpeed;
    13001327    double oldDownSpeed, newDownSpeed;
    13011328    const tr_stat * st;
    13021329    TrTorrent * gtor;
     1330    tr_torrent * tor;
    13031331
    13041332    /* get the old states */
     
    13061334                        MC_TORRENT, &gtor,
    13071335                        MC_ACTIVITY, &oldActivity,
     1336                        MC_FINISHED, &oldFinished,
     1337                        MC_PRIORITY, &oldPriority,
     1338                        MC_TRACKERS, &oldTrackers,
    13081339                        MC_SPEED_UP, &oldUpSpeed,
    13091340                        MC_SPEED_DOWN, &oldDownSpeed,
     
    13111342
    13121343    /* get the new states */
    1313     st = tr_torrentStat( tr_torrent_handle( gtor ) );
     1344    tor = tr_torrent_handle( gtor );
     1345    st = tr_torrentStat( tor );
    13141346    newActivity = st->activity;
     1347    newFinished = st->finished;
     1348    newPriority = tr_torrentGetPriority( tor );
     1349    newTrackers = torrentTrackerString( tor );
    13151350    newUpSpeed = st->pieceUploadSpeed_KBps;
    13161351    newDownSpeed = st->pieceDownloadSpeed_KBps;
     
    13191354       so don't do it unless something's actually changed... */
    13201355    if( ( newActivity  != oldActivity  )
     1356        || ( newFinished != oldFinished )
     1357        || ( newPriority != oldPriority )
     1358        || tr_strcmp( oldTrackers, newTrackers )
    13211359        || gtr_compare_double( newUpSpeed, oldUpSpeed, 3 )
    13221360        || gtr_compare_double( newDownSpeed, oldDownSpeed, 3 ) )
     
    13241362        gtk_list_store_set( GTK_LIST_STORE( model ), iter,
    13251363                            MC_ACTIVITY, newActivity,
     1364                            MC_FINISHED, newFinished,
     1365                            MC_PRIORITY, newPriority,
     1366                            MC_TRACKERS, newTrackers,
    13261367                            MC_SPEED_UP, newUpSpeed,
    13271368                            MC_SPEED_DOWN, newDownSpeed,
     
    13311372    /* cleanup */
    13321373    g_object_unref( gtor );
     1374    g_free( newTrackers );
     1375    g_free( oldTrackers );
    13331376    return FALSE;
    13341377}
  • trunk/gtk/tr-core.h

    r10863 r11086  
    198198    MC_SPEED_DOWN,
    199199    MC_ACTIVITY,
     200    MC_FINISHED,
     201    MC_PRIORITY,
     202    MC_TRACKERS,
    200203    MC_ROW_COUNT
    201204};
  • trunk/libtransmission/transmission.h

    r11046 r11086  
    17691769    char errorString[512];
    17701770
    1771     /** When tr_stat.status is TR_STATUS_CHECK or TR_STATUS_CHECK_WAIT,
     1771    /** When tr_stat.activity is TR_STATUS_CHECK or TR_STATUS_CHECK_WAIT,
    17721772        this is the percentage of how much of the files has been
    17731773        verified.  When it gets to 1, the verify process is done.
    17741774        Range is [0..1]
    1775         @see tr_stat.status */
     1775        @see tr_stat.activity */
    17761776    double recheckProgress;
    17771777
  • trunk/qt/filterbar.cc

    r11078 r11086  
    244244    model->appendRow( row );
    245245
     246    row = new QStandardItem( blankIcon, tr( "Finished" ) );
     247    row->setData( FilterMode::SHOW_FINISHED, ActivityRole );
     248    model->appendRow( row );
     249
    246250    row = new QStandardItem( blankIcon, tr( "Queued" ) );
    247251    row->setData( FilterMode::SHOW_QUEUED, ActivityRole );
  • trunk/qt/filters.cc

    r11072 r11086  
    2020    "show-seeding",
    2121    "show-paused",
     22    "show-finished",
    2223    "show-queued",
    2324    "show-verifying",
  • trunk/qt/filters.h

    r11072 r11086  
    2727        static const QString names[];
    2828        enum { SHOW_ALL, SHOW_ACTIVE, SHOW_DOWNLOADING, SHOW_SEEDING, SHOW_PAUSED,
    29                SHOW_QUEUED, SHOW_VERIFYING, SHOW_ERROR, NUM_MODES };
     29               SHOW_FINISHED, SHOW_QUEUED, SHOW_VERIFYING, SHOW_ERROR, NUM_MODES };
    3030        static int modeFromName( const QString& name );
    3131        static const QString& nameFromMode( int mode ) { return names[mode]; }
  • trunk/qt/torrent-filter.cc

    r11071 r11086  
    145145{
    146146    bool accepts;
    147     const tr_torrent_activity activity = tor->getActivity( );
    148147
    149148    switch( m.mode( ) )
     
    156155            break;
    157156        case FilterMode::SHOW_DOWNLOADING:
    158             accepts = activity == TR_STATUS_DOWNLOAD;
     157            accepts = tor->isDownloading( );
    159158            break;
    160159        case FilterMode::SHOW_SEEDING:
    161             accepts = activity == TR_STATUS_SEED;
     160            accepts = tor->isSeeding( );
    162161            break;
    163162        case FilterMode::SHOW_PAUSED:
    164             accepts = activity == TR_STATUS_STOPPED;
     163            accepts = tor->isPaused( );
     164            break;
     165        case FilterMode::SHOW_FINISHED:
     166            accepts = tor->isFinished( );
    165167            break;
    166168        case FilterMode::SHOW_QUEUED:
    167             accepts = activity == TR_STATUS_CHECK_WAIT;
     169            accepts = tor->isWaitingToVerify( );
    168170            break;
    169171        case FilterMode::SHOW_VERIFYING:
    170             accepts = activity == TR_STATUS_CHECK;
     172            accepts = tor->isVerifying( );
    171173            break;
    172174        case FilterMode::SHOW_ERROR:
  • trunk/qt/torrent.h

    r11083 r11086  
    309309        bool isFinished( ) const { return getBool( IS_FINISHED ); }
    310310        bool isPaused( ) const { return getActivity( ) == TR_STATUS_STOPPED; }
     311        bool isWaitingToVerify( ) const { return getActivity( ) == TR_STATUS_CHECK_WAIT; }
    311312        bool isVerifying( ) const { return getActivity( ) == TR_STATUS_CHECK; }
    312313        bool isDownloading( ) const { return getActivity( ) == TR_STATUS_DOWNLOAD; }
Note: See TracChangeset for help on using the changeset viewer.