Browse Source

Sort finished torrents by completed date when sorting by queue number.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
12302ee86f
  1. 19
      src/transferlistsortmodel.h

19
src/transferlistsortmodel.h

@ -70,10 +70,23 @@ protected: @@ -70,10 +70,23 @@ protected:
return vL < vR;
}
else if (column == TorrentModelItem::TR_PRIORITY) {
int vL = left.data().toInt();
int vR = right.data().toInt();
const int vL = left.data().toInt();
const int vR = right.data().toInt();
//finished torrents should be last
// Seeding torrents should be sorted by their completed date instead.
if (vL == -1 && vR == -1) {
QAbstractItemModel *model = sourceModel();
const QDateTime dateL = model->data(model->index(left.row(), TorrentModelItem::TR_SEED_DATE)).toDateTime();
const QDateTime dateR = model->data(model->index(right.row(), TorrentModelItem::TR_SEED_DATE)).toDateTime();
//not valid dates should be sorted at the bottom.
if (!dateL.isValid()) return false;
if (!dateR.isValid()) return true;
return dateL < dateR;
}
// Seeding torrents should be at the bottom
if (vL == -1) return false;
if (vR == -1) return true;
return vL < vR;

Loading…
Cancel
Save