Ignore:
Timestamp:
Dec 30, 2012, 1:28:28 AM (9 years ago)
Author:
jordan
Message:

(qt) small speedup when rebuilding the activity combobox's counts: walk the torrent model just once, rather than once per activity

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/filterbar.cc

    r13719 r13720  
    547547  QAbstractItemModel * model = myActivityCombo->model();
    548548
     549  int torrentsPerMode[FilterMode::NUM_MODES] = { };
     550  myFilter.countTorrentsPerMode (torrentsPerMode);
     551
    549552  for (int row=0, n=model->rowCount(); row<n; ++row)
    550553    {
    551554      QModelIndex index = model->index (row, 0);
    552555      const int mode = index.data(ActivityRole).toInt();
    553       model->setData (index, getCountString(myFilter.count(mode)), TorrentCountRole);
     556      model->setData (index, getCountString(torrentsPerMode[mode]), TorrentCountRole);
    554557    }
    555558
Note: See TracChangeset for help on using the changeset viewer.