Changeset View
Changeset View
Standalone View
Standalone View
src/kitemviews/kfileitemmodel.cpp
Show First 20 Lines • Show All 1728 Lines • ▼ Show 20 Line(s) | 1728 | if (m_sortRole == NameRole) { | |||
---|---|---|---|---|---|
1729 | // Sorting by name can be expensive, in particular if natural sorting is | 1729 | // Sorting by name can be expensive, in particular if natural sorting is | ||
1730 | // enabled. Use all CPU cores to speed up the sorting process. | 1730 | // enabled. Use all CPU cores to speed up the sorting process. | ||
1731 | static const int numberOfThreads = QThread::idealThreadCount(); | 1731 | static const int numberOfThreads = QThread::idealThreadCount(); | ||
1732 | parallelMergeSort(begin, end, lambdaLessThan, numberOfThreads); | 1732 | parallelMergeSort(begin, end, lambdaLessThan, numberOfThreads); | ||
1733 | } else { | 1733 | } else { | ||
1734 | // Sorting by other roles is quite fast. Use only one thread to prevent | 1734 | // Sorting by other roles is quite fast. Use only one thread to prevent | ||
1735 | // problems caused by non-reentrant comparison functions, see | 1735 | // problems caused by non-reentrant comparison functions, see | ||
1736 | // https://bugs.kde.org/show_bug.cgi?id=312679 | 1736 | // https://bugs.kde.org/show_bug.cgi?id=312679 | ||
1737 | mergeSort(begin, end, lambdaLessThan); | 1737 | std::stable_sort(begin, end, lambdaLessThan); | ||
1738 | } | 1738 | } | ||
1739 | } | 1739 | } | ||
1740 | 1740 | | |||
1741 | int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const QCollator& collator) const | 1741 | int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const QCollator& collator) const | ||
1742 | { | 1742 | { | ||
1743 | const KFileItem& itemA = a->item; | 1743 | const KFileItem& itemA = a->item; | ||
1744 | const KFileItem& itemB = b->item; | 1744 | const KFileItem& itemB = b->item; | ||
1745 | 1745 | | |||
▲ Show 20 Lines • Show All 684 Lines • Show Last 20 Lines |