Changeset 11061


Ignore:
Timestamp:
Jul 28, 2010, 2:43:47 PM (12 years ago)
Author:
charles
Message:

(trunk qt) #3454 "sync trackers tab with GTK+ client" --

  1. add "show backup trackers" togglebutton.
  2. fix bug where toggling "show more" didn't take effect instantly
  3. sync the "show more" preferences key with the GTK+ client
  4. fix a couple of minor tracker text inconsistencies with the GTK+ client
Location:
trunk/qt
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/README.txt

    r10903 r11061  
    11VOLUNTEERS WANTED
    22
     3   - Qt developers and translators are needed
    34   - If you find a bug, please report it at http://trac.transmissionbt.com/
    4    - New translations are encouraged
    5    - Windows devs: it would be interesting to see if/how this works on Windows
    65   
    76ABOUT TRANSMISSION-QT
     
    2827BUILDING
    2928
    30    This currently is a little awkward.  We're working on it...
    31 
    3229   1. Prerequisites: Qt >= 4.4 and its development packages
    3330   2. Build Transmission as normal
    34    3. If you built Transmission without DHT, edit qtr.pro:
    35       - LIBS += $${TRANSMISSION_TOP}/third-party/dht/libdht.a
    36    4. In the qt/ directory, type "qmake-qt4 qtr.pro"
    37    5. In the qt/ directory, type "make"
    38    6. In the qt/ directory, as root, type "INSTALL_ROOT=/usr make install"
     31   3. In the qt/ directory, type "qmake qtr.pro" or "qmake-qt4 qtr.pro"
     32   4. In the qt/ directory, type "make"
     33   5. In the qt/ directory, as root, type "INSTALL_ROOT=/usr make install"
    3934      (Feel free to replace /usr with /usr/local or /opt or whatever)
    4035
  • trunk/qt/details.cc

    r11059 r11061  
    5959#include "tracker-delegate.h"
    6060#include "tracker-model.h"
     61#include "tracker-model-filter.h"
    6162
    6263class Prefs;
     
    170171
    171172    QList<int> initKeys;
    172     initKeys << Prefs :: SHOW_TRACKER_SCRAPES;
     173    initKeys << Prefs :: SHOW_TRACKER_SCRAPES
     174             << Prefs :: SHOW_BACKUP_TRACKERS;
    173175    foreach( int key, initKeys )
    174176        refreshPref( key );
     
    224226    switch( key )
    225227    {
    226         case Prefs::SHOW_TRACKER_SCRAPES:
     228        case Prefs :: SHOW_TRACKER_SCRAPES:
    227229            myTrackerDelegate->setShowMore( myPrefs.getBool( key ) );
    228             myTrackerView->update( );
     230            myTrackerView->reset( );
     231            break;
     232
     233        case Prefs :: SHOW_BACKUP_TRACKERS:
     234            myTrackerFilter->setShowBackupTrackers( myPrefs.getBool( key ) );
    229235            break;
    230236
     
    867873
    868874void
     875Details :: onShowBackupTrackersToggled( bool val )
     876{
     877    myPrefs.set( Prefs::SHOW_BACKUP_TRACKERS, val );
     878}
     879
     880void
    869881Details :: onHonorsSessionLimitsToggled( bool val )
    870882{
     
    9971009    assert( selectedRows.size( ) == 1 );
    9981010    QModelIndex i = selectionModel->currentIndex( );
    999     const TrackerInfo trackerInfo = myTrackerModel->data( i, TrackerModel::TrackerRole ).value<TrackerInfo>();
     1011    const TrackerInfo trackerInfo = myTrackerView->model()->data( i, TrackerModel::TrackerRole ).value<TrackerInfo>();
    10001012
    10011013    bool ok = false;
     
    10371049    foreach( QModelIndex i, selectedRows )
    10381050    {
    1039         const TrackerInfo inf = myTrackerModel->data( i, TrackerModel::TrackerRole ).value<TrackerInfo>();
     1051        const TrackerInfo inf = myTrackerView->model()->data( i, TrackerModel::TrackerRole ).value<TrackerInfo>();
    10401052        torrentId_to_urls[ inf.torrentId ].append( inf.st.announce );
    10411053    }
     
    11651177    v2->setSpacing( HIG::PAD );
    11661178
     1179    myTrackerModel = new TrackerModel;
     1180    myTrackerFilter = new TrackerModelFilter;
     1181    myTrackerFilter->setSourceModel( myTrackerModel );
    11671182    myTrackerView = new QTreeView;
    1168     myTrackerView->setModel( myTrackerModel = new TrackerModel );
     1183    myTrackerView->setModel( myTrackerFilter );
    11691184    myTrackerView->setHeaderHidden( true );
    11701185    myTrackerView->setSelectionMode( QTreeWidget::ExtendedSelection );
     
    12131228    v->addWidget( c, 1 );
    12141229    connect( c, SIGNAL(clicked(bool)), this, SLOT(onShowTrackerScrapesToggled(bool)) );
     1230
     1231    c = new QCheckBox( tr( "Show &backup trackers" ) );
     1232    c->setChecked( myPrefs.getBool( Prefs::SHOW_BACKUP_TRACKERS ) );
     1233    myShowBackupTrackersCheck = c;
     1234    v->addWidget( c, 1 );
     1235    connect( c, SIGNAL(clicked(bool)), this, SLOT(onShowBackupTrackersToggled(bool)) );
    12151236
    12161237    return top;
  • trunk/qt/details.h

    r11059 r11061  
    3939class TrackerDelegate;
    4040class TrackerModel;
     41class TrackerModelFilter;
    4142
    4243class Details: public QDialog
     
    9394        QCheckBox * mySingleUpCheck;
    9495        QCheckBox * myShowTrackerScrapesCheck;
     96        QCheckBox * myShowBackupTrackersCheck;
    9597        QPushButton * myAddTrackerButton;
    9698        QPushButton * myEditTrackerButton;
     
    122124
    123125        TrackerModel * myTrackerModel;
     126        TrackerModelFilter * myTrackerFilter;
    124127        TrackerDelegate * myTrackerDelegate;
    125128        QTreeView * myTrackerView;
     
    149152        void onIdleLimitChanged( int );
    150153        void onShowTrackerScrapesToggled( bool );
     154        void onShowBackupTrackersToggled( bool );
    151155        void onTrackerSelectionChanged( );
    152156        void onAddTrackerClicked( );
  • trunk/qt/prefs.cc

    r11044 r11061  
    4646    { STATUSBAR, "show-statusbar", QVariant::Bool },
    4747    { STATUSBAR_STATS, "statusbar-stats", QVariant::String },
    48     { SHOW_TRACKER_SCRAPES, "show-tracker-scrapes", QVariant::Bool },
     48    { SHOW_TRACKER_SCRAPES, "show-extra-peer-details", QVariant::Bool },
     49    { SHOW_BACKUP_TRACKERS, "show-backup-trackers", QVariant::Bool },
    4950    { TOOLBAR, "show-toolbar" , QVariant::Bool },
    5051    { BLOCKLIST_DATE, "blocklist-date", QVariant::DateTime },
     
    240241Prefs :: initDefaults( tr_benc * d )
    241242{
    242     tr_bencDictAddStr( d, keyStr(DIR_WATCH), tr_getDefaultDownloadDir( ) );
    243     tr_bencDictAddInt( d, keyStr(DIR_WATCH_ENABLED), false );
    244     tr_bencDictAddInt( d, keyStr(INHIBIT_HIBERNATION), false );
    245     tr_bencDictAddInt( d, keyStr(BLOCKLIST_DATE), 0 );
    246     tr_bencDictAddInt( d, keyStr(BLOCKLIST_UPDATES_ENABLED), true );
    247     tr_bencDictAddStr( d, keyStr(OPEN_DIALOG_FOLDER), QDir::home().absolutePath().toLatin1() );
    248     tr_bencDictAddInt( d, keyStr(SHOW_TRACKER_SCRAPES), false );
    249     tr_bencDictAddInt( d, keyStr(TOOLBAR), true );
    250     tr_bencDictAddInt( d, keyStr(FILTERBAR), true );
    251     tr_bencDictAddInt( d, keyStr(STATUSBAR), true );
    252     tr_bencDictAddInt( d, keyStr(SHOW_TRAY_ICON), false );
    253     tr_bencDictAddInt( d, keyStr(SHOW_DESKTOP_NOTIFICATION), true );
    254     tr_bencDictAddStr( d, keyStr(STATUSBAR_STATS), "total-ratio" );
    255     tr_bencDictAddInt( d, keyStr(OPTIONS_PROMPT), true );
    256     tr_bencDictAddInt( d, keyStr(MAIN_WINDOW_HEIGHT), 500 );
    257     tr_bencDictAddInt( d, keyStr(MAIN_WINDOW_WIDTH), 300 );
    258     tr_bencDictAddInt( d, keyStr(MAIN_WINDOW_X), 50 );
    259     tr_bencDictAddInt( d, keyStr(MAIN_WINDOW_Y), 50 );
    260     tr_bencDictAddStr( d, keyStr(FILTER_MODE), "all" );
    261     tr_bencDictAddStr( d, keyStr(MAIN_WINDOW_LAYOUT_ORDER), "menu,toolbar,filter,list,statusbar" );
    262     tr_bencDictAddStr( d, keyStr(DOWNLOAD_DIR), tr_getDefaultDownloadDir( ) );
    263     tr_bencDictAddInt( d, keyStr(ASKQUIT), true );
    264     tr_bencDictAddStr( d, keyStr(SORT_MODE), "sort-by-name" );
    265     tr_bencDictAddInt( d, keyStr(SORT_REVERSED), false );
    266     tr_bencDictAddInt( d, keyStr(COMPACT_VIEW), false );
    267     tr_bencDictAddStr( d, keyStr(SESSION_REMOTE_HOST), "localhost" );
    268     tr_bencDictAddInt( d, keyStr(SESSION_REMOTE_PORT), atoi(TR_DEFAULT_RPC_PORT_STR) );
     243    tr_bencDictAddStr ( d, keyStr(DIR_WATCH), tr_getDefaultDownloadDir( ) );
     244    tr_bencDictAddBool( d, keyStr(DIR_WATCH_ENABLED), false );
     245    tr_bencDictAddBool( d, keyStr(INHIBIT_HIBERNATION), false );
     246    tr_bencDictAddInt ( d, keyStr(BLOCKLIST_DATE), 0 );
     247    tr_bencDictAddBool( d, keyStr(BLOCKLIST_UPDATES_ENABLED), true );
     248    tr_bencDictAddStr ( d, keyStr(OPEN_DIALOG_FOLDER), QDir::home().absolutePath().toLatin1() );
     249    tr_bencDictAddInt ( d, keyStr(SHOW_TRACKER_SCRAPES), false );
     250    tr_bencDictAddBool( d, keyStr(TOOLBAR), true );
     251    tr_bencDictAddBool( d, keyStr(FILTERBAR), true );
     252    tr_bencDictAddBool( d, keyStr(STATUSBAR), true );
     253    tr_bencDictAddBool( d, keyStr(SHOW_TRAY_ICON), false );
     254    tr_bencDictAddBool( d, keyStr(SHOW_DESKTOP_NOTIFICATION), true );
     255    tr_bencDictAddStr ( d, keyStr(STATUSBAR_STATS), "total-ratio" );
     256    tr_bencDictAddBool( d, keyStr(SHOW_TRACKER_SCRAPES), false );
     257    tr_bencDictAddBool( d, keyStr(SHOW_BACKUP_TRACKERS), false );
     258    tr_bencDictAddBool( d, keyStr(OPTIONS_PROMPT), true );
     259    tr_bencDictAddInt ( d, keyStr(MAIN_WINDOW_HEIGHT), 500 );
     260    tr_bencDictAddInt ( d, keyStr(MAIN_WINDOW_WIDTH), 300 );
     261    tr_bencDictAddInt ( d, keyStr(MAIN_WINDOW_X), 50 );
     262    tr_bencDictAddInt ( d, keyStr(MAIN_WINDOW_Y), 50 );
     263    tr_bencDictAddStr ( d, keyStr(FILTER_MODE), "all" );
     264    tr_bencDictAddStr ( d, keyStr(MAIN_WINDOW_LAYOUT_ORDER), "menu,toolbar,filter,list,statusbar" );
     265    tr_bencDictAddStr ( d, keyStr(DOWNLOAD_DIR), tr_getDefaultDownloadDir( ) );
     266    tr_bencDictAddBool( d, keyStr(ASKQUIT), true );
     267    tr_bencDictAddStr ( d, keyStr(SORT_MODE), "sort-by-name" );
     268    tr_bencDictAddBool( d, keyStr(SORT_REVERSED), false );
     269    tr_bencDictAddBool( d, keyStr(COMPACT_VIEW), false );
     270    tr_bencDictAddStr ( d, keyStr(SESSION_REMOTE_HOST), "localhost" );
     271    tr_bencDictAddInt ( d, keyStr(SESSION_REMOTE_PORT), atoi(TR_DEFAULT_RPC_PORT_STR) );
    269272    tr_bencDictAddBool( d, keyStr(SESSION_IS_REMOTE), false );
    270273    tr_bencDictAddBool( d, keyStr(SESSION_REMOTE_AUTH), false );
  • trunk/qt/prefs.h

    r11044 r11061  
    5050            STATUSBAR_STATS,
    5151            SHOW_TRACKER_SCRAPES,
     52            SHOW_BACKUP_TRACKERS,
    5253            TOOLBAR,
    5354            BLOCKLIST_DATE,
  • trunk/qt/qtr.pro

    r11059 r11061  
    3737           stats-dialog.cc torrent.cc torrent-delegate.cc \
    3838           torrent-delegate-min.cc torrent-filter.cc torrent-model.cc \
    39            tracker-delegate.cc tracker-model.cc triconpushbutton.cc \
    40            utils.cc watchdir.cc
     39           tracker-delegate.cc tracker-model.cc tracker-model-filter.cc \
     40           triconpushbutton.cc utils.cc watchdir.cc
    4141HEADERS += $$replace(SOURCES, .cc, .h)
    4242HEADERS += speed.h types.h
  • trunk/qt/tracker-delegate.cc

    r11059 r11061  
    2626#include <QUrl>
    2727
     28#include <libtransmission/transmission.h>
     29#include <libtransmission/utils.h>
     30
    2831#include "favicon.h"
    2932#include "formatter.h"
     
    147150
    148151    // hostname
    149     const QString host = Favicons::getHost( QUrl( inf.st.announce ) );
    150152    str += inf.st.isBackup ? "<i>" : "<b>";
    151     str += host;
     153    char * host = NULL;
     154    int port = 0;
     155    tr_urlParse( inf.st.announce.toUtf8().constData(), -1, NULL, &host, &port, NULL );
     156    str += QString( "%1:%2" ).arg( host ).arg( port );
     157    tr_free( host );
    152158    if( !key.isEmpty( ) ) str += " - " + key;
    153159    str += inf.st.isBackup ? "</i>" : "</b>";
     
    170176            else if( inf.st.lastAnnounceTimedOut )
    171177            {
    172                 str += tr( "Peer list request timed out %1%2%3 ago; will retry" )
     178                str += tr( "Peer list request %1timed out%2 %3 ago; will retry" )
    173179                           .arg( timeout_markup_begin )
    174                            .arg( tstr )
    175                            .arg( timeout_markup_end );
     180                           .arg( timeout_markup_end )
     181                           .arg( tstr );
    176182            }
    177183            else
    178184            {
    179                 str += tr( "Got an error %1'%2'%3 %4 ago" )
     185                str += tr( "Got an error %1\"%2\"%3 %4 ago" )
    180186                           .arg( err_markup_begin )
    181187                           .arg( tstr )
     
    188194        {
    189195            case TR_TRACKER_INACTIVE:
    190                 if( inf.st.hasAnnounced ) {
     196                if( !inf.st.hasAnnounced ) {
    191197                    str += "<br/>\n";
    192198                    str += tr( "No updates scheduled" );
     
    233239                else
    234240                {
    235                     str += tr( "Got a scrape error %1'%2'%3 %4 ago" )
     241                    str += tr( "Got a scrape error %1\"%2\"%3 %4 ago" )
    236242                               .arg( err_markup_begin )
    237243                               .arg( inf.st.lastScrapeResult )
     
    271277    return str;
    272278}
    273 
    274 #if 0
    275 
    276     if( inf.isBackup )
    277         str += "<i>";
    278     QString announce;
    279     int announceState;
    280     int downloadCount;
    281     bool hasAnnounced; bool hasScraped;
    282     QString host;
    283     int id;
    284     bool isBackup;
    285     int lastAnnouncePeerCount;
    286     int lastAnnounceResult;
    287     int lastAnnounceStartTime;
    288     bool lastAnnounceSucceeded;
    289     int lastAnnounceTime;
    290     bool lastAnnounceTimedOut;
    291     QString lastScrapeResult;
    292     int lastScrapeStartTime;
    293     bool lastScrapeSucceeded;
    294     int lastScrapeTime;
    295     bool lastScrapeTimedOut;
    296     int leecherCount;
    297     int nextAnnounceTime;
    298     int nextScrapeTime;
    299     int scrapeState;
    300     int seederCount;
    301     int tier;
    302 
    303 }
    304 #endif
  • trunk/qt/tracker-model.cc

    r11059 r11061  
    6464struct CompareTrackers {
    6565    bool operator()( const TrackerInfo& a, const TrackerInfo& b ) const {
    66         if( a.torrentId != b.torrentId ) return a.torrentId < b.torrentId;
    67         if( a.st.tier != b.st.tier ) return a.st.tier < b.st.tier;
     66        if( a.torrentId   != b.torrentId   ) return a.torrentId < b.torrentId;
     67        if( a.st.tier     != b.st.tier     ) return a.st.tier < b.st.tier;
     68        if( a.st.isBackup != b.st.isBackup ) return !a.st.isBackup;
    6869        return a.st.announce < b.st.announce;
    6970    }
Note: See TracChangeset for help on using the changeset viewer.