|
|
@ -90,11 +90,19 @@ bool TorrentContentFilterModel::lessThan(const QModelIndex &left, const QModelIn |
|
|
|
Q_ASSERT(vL.isValid()); |
|
|
|
Q_ASSERT(vL.isValid()); |
|
|
|
Q_ASSERT(vR.isValid()); |
|
|
|
Q_ASSERT(vR.isValid()); |
|
|
|
|
|
|
|
|
|
|
|
bool res = false; |
|
|
|
TorrentContentModelItem::ItemType leftType, rightType; |
|
|
|
if (misc::naturalSort(vL.toString(), vR.toString(), res)) |
|
|
|
leftType = m_model->itemType(m_model->index(left.row(), 0, left.parent())); |
|
|
|
return res; |
|
|
|
rightType = m_model->itemType(m_model->index(right.row(), 0, right.parent())); |
|
|
|
|
|
|
|
if (leftType == rightType) { |
|
|
|
return QSortFilterProxyModel::lessThan(left, right); |
|
|
|
bool res = false; |
|
|
|
|
|
|
|
if (misc::naturalSort(vL.toString(), vR.toString(), res)) |
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
return QSortFilterProxyModel::lessThan(left, right); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (leftType == TorrentContentModelItem::FolderType && sortOrder() == Qt::AscendingOrder) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
return QSortFilterProxyModel::lessThan(left, right); |
|
|
|
return QSortFilterProxyModel::lessThan(left, right); |
|
|
|
} |
|
|
|
} |
|
|
|