Cleanup 2db88953e7: Remove VL_FIRST_SORT as it's useless

pull/217/head
glx22 3 years ago committed by glx22
parent a7fee48b7f
commit 7222bc5814

@ -21,9 +21,8 @@ enum SortListFlags {
VL_DESC = 1 << 0, ///< sort descending or ascending
VL_RESORT = 1 << 1, ///< instruct the code to resort the list in the next loop
VL_REBUILD = 1 << 2, ///< rebuild the sort list
VL_FIRST_SORT = 1 << 3, ///< sort with quick sort first
VL_FILTER = 1 << 4, ///< filter disabled/enabled
VL_END = 1 << 5,
VL_FILTER = 1 << 3, ///< filter disabled/enabled
VL_END = 1 << 4,
};
DECLARE_ENUM_AS_BIT_SET(SortListFlags)
@ -80,7 +79,7 @@ public:
GUIList() :
sort_func_list(nullptr),
filter_func_list(nullptr),
flags(VL_FIRST_SORT),
flags(VL_NONE),
sort_type(0),
filter_type(0),
resort_timer(1)
@ -104,7 +103,7 @@ public:
void SetSortType(uint8 n_type)
{
if (this->sort_type != n_type) {
SETBITS(this->flags, VL_RESORT | VL_FIRST_SORT);
SETBITS(this->flags, VL_RESORT);
this->sort_type = n_type;
}
}
@ -136,8 +135,6 @@ public:
CLRBITS(this->flags, VL_DESC);
}
this->sort_type = l.criteria;
SETBITS(this->flags, VL_FIRST_SORT);
}
/**
@ -242,10 +239,6 @@ public:
/**
* Sort the list.
* For the first sorting we use quick sort since it is
* faster for irregular sorted data. After that we
* use gsort.
*
* @param compare The function to compare two list items
* @return true if the list sequence has been altered
*
@ -265,13 +258,6 @@ public:
const bool desc = (this->flags & VL_DESC) != 0;
if (this->flags & VL_FIRST_SORT) {
CLRBITS(this->flags, VL_FIRST_SORT);
std::sort(std::vector<T>::begin(), std::vector<T>::end(), [&](const T &a, const T &b) { return desc ? compare(b, a) : compare(a, b); });
return true;
}
std::sort(std::vector<T>::begin(), std::vector<T>::end(), [&](const T &a, const T &b) { return desc ? compare(b, a) : compare(a, b); });
return true;
}
@ -394,7 +380,7 @@ public:
void RebuildDone()
{
CLRBITS(this->flags, VL_REBUILD);
SETBITS(this->flags, VL_RESORT | VL_FIRST_SORT);
SETBITS(this->flags, VL_RESORT);
}
};

Loading…
Cancel
Save