QDir: remove an unneeded QFlags->int conversion
Just use the original QFlags. Drive by, use testFlag to check if it contains a given value or not. Change-Id: I4d5e8454df33a3f4727855d55f7587143450dda6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
5f29ed0d5c
commit
0533695ddd
@ -242,9 +242,9 @@ struct QDirSortItem
|
|||||||
|
|
||||||
class QDirSortItemComparator
|
class QDirSortItemComparator
|
||||||
{
|
{
|
||||||
int qt_cmp_si_sort_flags;
|
QDir::SortFlags qt_cmp_si_sort_flags;
|
||||||
public:
|
public:
|
||||||
QDirSortItemComparator(int flags) : qt_cmp_si_sort_flags(flags) {}
|
QDirSortItemComparator(QDir::SortFlags flags) : qt_cmp_si_sort_flags(flags) {}
|
||||||
bool operator()(const QDirSortItem &, const QDirSortItem &) const;
|
bool operator()(const QDirSortItem &, const QDirSortItem &) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -259,8 +259,8 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt
|
|||||||
return !f1->item.isDir();
|
return !f1->item.isDir();
|
||||||
|
|
||||||
qint64 r = 0;
|
qint64 r = 0;
|
||||||
int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask)
|
int sortBy = ((qt_cmp_si_sort_flags & QDir::SortByMask)
|
||||||
| (qt_cmp_si_sort_flags & QDir::Type);
|
| (qt_cmp_si_sort_flags & QDir::Type)).toInt();
|
||||||
|
|
||||||
switch (sortBy) {
|
switch (sortBy) {
|
||||||
case QDir::Time: {
|
case QDir::Time: {
|
||||||
@ -282,7 +282,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt
|
|||||||
break;
|
break;
|
||||||
case QDir::Type:
|
case QDir::Type:
|
||||||
{
|
{
|
||||||
bool ic = qt_cmp_si_sort_flags & QDir::IgnoreCase;
|
bool ic = qt_cmp_si_sort_flags.testAnyFlag(QDir::IgnoreCase);
|
||||||
|
|
||||||
if (f1->suffix_cache.isNull())
|
if (f1->suffix_cache.isNull())
|
||||||
f1->suffix_cache = ic ? f1->item.suffix().toLower()
|
f1->suffix_cache = ic ? f1->item.suffix().toLower()
|
||||||
@ -302,7 +302,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt
|
|||||||
|
|
||||||
if (r == 0 && sortBy != QDir::Unsorted) {
|
if (r == 0 && sortBy != QDir::Unsorted) {
|
||||||
// Still not sorted - sort by name
|
// Still not sorted - sort by name
|
||||||
bool ic = qt_cmp_si_sort_flags & QDir::IgnoreCase;
|
bool ic = qt_cmp_si_sort_flags.testAnyFlag(QDir::IgnoreCase);
|
||||||
|
|
||||||
if (f1->filename_cache.isNull())
|
if (f1->filename_cache.isNull())
|
||||||
f1->filename_cache = ic ? f1->item.fileName().toLower()
|
f1->filename_cache = ic ? f1->item.fileName().toLower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user