1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 18:25:35 +00:00

(trunk qt,gtk) include torrents-being-verified in the "active torrents" filter.

This commit is contained in:
Charles Kerr 2009-04-09 22:42:55 +00:00
parent 57f6e81dba
commit f6672e8911
7 changed files with 23 additions and 9 deletions

View 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;
}

View 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;
}

View 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 );

View 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 )

View 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;
}

View 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;

View 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: