]> granicus.if.org Git - transmission/commitdiff
(trunk qt,gtk) include torrents-being-verified in the "active torrents" filter.
authorCharles Kerr <charles@transmissionbt.com>
Thu, 9 Apr 2009 22:42:55 +0000 (22:42 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 9 Apr 2009 22:42:55 +0000 (22:42 +0000)
gtk/tr-window.c
qt/prefs-dialog.cc
qt/prefs-dialog.h
qt/session.cc
qt/torrent-delegate.cc
qt/torrent-filter.cc
qt/torrent.h

index 4b871e89900a50ebb2b3afa23e077a14833afebe..4322def2445720f6289a247bd898ebf312fdc541 100644 (file)
@@ -372,7 +372,9 @@ checkFilterMode( filter_mode_t filter_mode,
         case FILTER_MODE_ACTIVE:
         {
             const tr_stat * s = tr_torrentStatCached( tor );
-            ret = s->peersSendingToUs > 0 || s->peersGettingFromUs > 0;
+            ret = s->peersSendingToUs > 0
+               || s->peersGettingFromUs > 0
+               || tr_torrentGetActivity( tor ) == TR_STATUS_CHECK;
             break;
         }
 
index da7400ee80c981e759ed6228c503d0d9deca7d3d..e095b73775a72137f67e76898bef7a88c91bebea 100644 (file)
@@ -444,7 +444,7 @@ PrefsDialog :: createPeersTab( const Session& session )
     QPushButton * w = new QPushButton( i, tr( "&Update blocklist" ) );
     connect( w, SIGNAL(clicked(bool)), this, SLOT(onUpdateBlocklistClicked()));
     myBlockWidgets << w;
-    QWidget * l = checkBoxNew( tr( "Enable &blocklist (contains %Ln rule(s))", 0, session.blocklistSize( ) ), Prefs::BLOCKLIST_ENABLED );
+    QWidget * l = checkBoxNew( "", Prefs::BLOCKLIST_ENABLED );
     h->addWidget( l );
     h->addStretch( 1 );
     h->addWidget( w );
@@ -471,7 +471,7 @@ PrefsDialog :: createPeersTab( const Session& session )
     hig->addWideControl( checkBoxNew( tr( "Use peer e&xchange" ), Prefs::PEX_ENABLED ) );
 
     hig->finish( );
-    myUnsupportedWhenRemote << myBlockWidgets;
+    updateBlocklistCheckBox( );
     return hig;
 }
 
@@ -617,9 +617,19 @@ PrefsDialog :: ~PrefsDialog( )
 
 void
 PrefsDialog :: sessionUpdated( )
+{
+    updateBlocklistCheckBox( );
+}
+
+void
+PrefsDialog :: updateBlocklistCheckBox( )
 {
     QCheckBox * box = qobject_cast<QCheckBox*>( myWidgets[Prefs::BLOCKLIST_ENABLED] );
-    box->setText( tr( "Enable &blocklist (%Ln rules)", 0, mySession.blocklistSize( ) ) );
+    const int n = mySession.blocklistSize( );
+    if( n < 0 ) // unknown
+        box->setText( tr( "Enable &blocklist" ) );
+    else
+        box->setText( tr( "Enable &blocklist (%Ln rules)", 0, n ) );
 }
 
 void
@@ -656,6 +666,7 @@ PrefsDialog :: updatePref( int key )
 
         case Prefs :: BLOCKLIST_ENABLED: {
             const bool enabled = myPrefs.getBool( key );
+            std::cerr << " setting " << myBlockWidgets.size() << " block widgets to " << enabled << std::endl;
             foreach( QWidget * w, myBlockWidgets ) w->setEnabled( enabled );
             break;
         }
index 8b45a041217c89203a1b0444e81e2da4b754d1ef..2399d67e486abb29fc63e011c56b80c6e62d39e5 100644 (file)
@@ -69,6 +69,7 @@ class PrefsDialog: public QDialog
         QTimeEdit * timeEditNew( int key );
         QLineEdit * lineEditNew( int key, int mode = 0 );
         void enableBuddyWhenChecked( QCheckBox *, QWidget * );
+        void updateBlocklistCheckBox( );
 
     public:
         PrefsDialog( Session&, Prefs&, QWidget * parent = 0 );
index 218688f52a82bf30bd91a985fe5a4378fc93f35d..3ea348f9879986a55345889d7cd2c254a03dabef 100644 (file)
@@ -174,7 +174,7 @@ std::cerr << "setting whitelist" << std::endl;
 ***/
 
 Session :: Session( const char * configDir, Prefs& prefs, const char * url, bool paused ):
-    myBlocklistSize( ),
+    myBlocklistSize( -1 ),
     myPrefs( prefs ),
     mySession( 0 ),
     myUrl( url )
index 27acdfa436adf2633042ea1f155af8bafeaeda56..82081f93861fe56e4d216cab5848923cb66e3648 100644 (file)
@@ -218,10 +218,9 @@ TorrentDelegate :: statusString( const Torrent& tor ) const
             break;
     }
 
-    if( !tor.isChecking( ) && !tor.isPaused( ) )
+    if( tor.isReadyToTransfer( ) )
         str += tr( " - " ) + shortTransferString( tor );
 
-    //str += "asdfasdf";
     return str;
 }
 
index 9019f88bcf6270bf81de44e0ab6070cc3793a1a3..d2307152160d14f315df347515323d74f82fb603 100644 (file)
@@ -80,7 +80,7 @@ TorrentFilter :: filterAcceptsRow( int sourceRow, const QModelIndex& sourceParen
             accepts = true;
             break;
         case SHOW_ACTIVE:
-            accepts = tor->peersWeAreUploadingTo( ) > 0 || tor->peersWeAreDownloadingFrom( ) > 0;
+            accepts = tor->peersWeAreUploadingTo( ) > 0 || tor->peersWeAreDownloadingFrom( ) > 0 || tor->isVerifying( );
             break;
         case SHOW_DOWNLOADING:
             accepts = activity == TR_STATUS_DOWNLOAD;
index 0d5545fa55bf1176b450e155601fa02a3fbbacfa..a3b9d721ad5098e01c11a80ef0ae9fae19f0f889 100644 (file)
@@ -271,8 +271,9 @@ class Torrent: public QObject
         QString activityString( ) const;
         tr_torrent_activity getActivity( ) const { return (tr_torrent_activity) getInt( ACTIVITY ); }
         bool isPaused( ) const { return getActivity( ) == TR_STATUS_STOPPED; }
-        bool isChecking( ) const { return getActivity( ) == TR_STATUS_CHECK || getActivity( ) == TR_STATUS_CHECK_WAIT; }
+        bool isVerifying( ) const { return getActivity( ) == TR_STATUS_CHECK; }
         bool isDownloading( ) const { return getActivity( ) == TR_STATUS_DOWNLOAD; }
+        bool isReadyToTransfer( ) const { return getActivity()==TR_STATUS_DOWNLOAD || getActivity()==TR_STATUS_SEED; }
         void notifyComplete( ) const;
 
     public: