FIX: PA profile sort alphabetically on history dialog

github: 4029
Change-Id: Ic7d7d961be11783254d79c8736e265a30fd2af87
(cherry picked from commit 8097610796f9538893189d1633bb4c347cf117a6)
This commit is contained in:
zhimin.zeng 2024-06-21 17:18:23 +08:00 committed by Lane.Wei
parent 6a130a19ef
commit 12c237ac19
1 changed files with 13 additions and 0 deletions

View File

@ -279,6 +279,19 @@ void HistoryWindow::sync_history_data() {
title_action->SetFont(Label::Head_14);
gbSizer->Add(title_action, { 0, 3 }, { 1, 1 });
auto to_lower_case = [](const std::string &str) {
std::string lowerStr = str;
std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), [](unsigned char c) {
return std::tolower(c);
});
return lowerStr;
};
std::sort(m_calib_results_history.begin(), m_calib_results_history.end(), [&to_lower_case](const PACalibResult &left, const PACalibResult &right) {
std::string left_str = to_lower_case(left.name);
std::string right_str = to_lower_case(right.name);
return left_str < right_str ? true : left_str > right_str ? false : (left_str < right_str);
});
int i = 1;
for (auto& result : m_calib_results_history) {
auto name_value = new Label(m_history_data_panel, from_u8(result.name));