mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
In TorrentModel.updateTorrents(), don't call getIds() if we don't need them
This commit is contained in:
parent
93da75c842
commit
162ccc6d3a
2 changed files with 13 additions and 7 deletions
|
@ -138,11 +138,14 @@ void
|
|||
TorrentModel :: updateTorrents( tr_variant * torrents, bool isCompleteList )
|
||||
{
|
||||
QList<Torrent*> newTorrents;
|
||||
QSet<int> oldIds( getIds( ) );
|
||||
QSet<int> oldIds;
|
||||
QSet<int> addIds;
|
||||
QSet<int> newIds;
|
||||
int updatedCount = 0;
|
||||
|
||||
if ( isCompleteList )
|
||||
oldIds = getIds( );
|
||||
|
||||
if( tr_variantIsList( torrents ) )
|
||||
{
|
||||
size_t i( 0 );
|
||||
|
@ -249,8 +252,11 @@ QSet<int>
|
|||
TorrentModel :: getIds () const
|
||||
{
|
||||
QSet<int> ids;
|
||||
|
||||
ids.reserve (myTorrents.size());
|
||||
foreach (const Torrent * tor, myTorrents)
|
||||
ids.insert (tor->id());
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,10 +51,10 @@ class TorrentModel: public QAbstractListModel
|
|||
public:
|
||||
Torrent* getTorrentFromId( int id );
|
||||
const Torrent* getTorrentFromId( int id ) const;
|
||||
QSet<int> getIds( ) const;
|
||||
|
||||
private:
|
||||
void addTorrent( Torrent * );
|
||||
QSet<int> getIds( ) const;
|
||||
|
||||
public:
|
||||
Speed getUploadSpeed( ) const;
|
||||
|
|
Loading…
Reference in a new issue