From 240cdbfd5dd8802a70d5a3404dfa03a9d9e5e73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E7=BA=A2=E5=8B=8B?= Date: Wed, 8 May 2024 15:52:27 +0800 Subject: [PATCH] use std::sort to sort items as recommended MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 侯红勋 --- .../Interface/ukuimenuinterface.cpp | 28 +++++++++---------- src/BackProcess/Search/searchappthread.cpp | 8 +++--- src/BackProcess/tablet/getmodeldata.cpp | 4 +-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/BackProcess/Interface/ukuimenuinterface.cpp b/src/BackProcess/Interface/ukuimenuinterface.cpp index d7438fb..f526bc8 100755 --- a/src/BackProcess/Interface/ukuimenuinterface.cpp +++ b/src/BackProcess/Interface/ukuimenuinterface.cpp @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#include #include "ukuimenuinterface.h" #include #include @@ -783,8 +783,8 @@ bool UkuiMenuInterface::initAppIni() } } - qSort(appInitVector.begin(), appInitVector.end(), cmpApp); //按中英文字母排序 - qSort(tencentInitVectorList.begin(), tencentInitVectorList.end(), cmpApp); //按中英文字母排序 + std::sort(appInitVector.begin(), appInitVector.end(), cmpApp); //按中英文字母排序 + std::sort(tencentInitVectorList.begin(), tencentInitVectorList.end(), cmpApp); //按中英文字母排序 //腾讯应用的精准类应用处理 if (precise_practiceVector.contains(english)) { @@ -799,8 +799,8 @@ bool UkuiMenuInterface::initAppIni() tencentInitVectorList.insert(0, chainese); } - qSort(customizedVectorList.begin(), customizedVectorList.end(), cmpApp); //按中英文字母排序 - qSort(thirdPartyVectorList.begin(), thirdPartyVectorList.end(), cmpApp); //按中英文字母排序 + std::sort(customizedVectorList.begin(), customizedVectorList.end(), cmpApp); //按中英文字母排序 + std::sort(thirdPartyVectorList.begin(), thirdPartyVectorList.end(), cmpApp); //按中英文字母排序 setting->beginGroup("tencent"); for (int i = 0; i < tencentInitVectorList.count(); i++) { @@ -909,8 +909,8 @@ bool UkuiMenuInterface::initAppIni() } } - qSort(appInitVector.begin(), appInitVector.end(), cmpApp); //按中英文字母排序 - qSort(tencentInitVector.begin(), tencentInitVector.end(), cmpApp); //按中英文字母排序 + std::sort(appInitVector.begin(), appInitVector.end(), cmpApp); //按中英文字母排序 + std::sort(tencentInitVector.begin(), tencentInitVector.end(), cmpApp); //按中英文字母排序 //腾讯应用的精准类应用处理 if (precise_practiceVector.contains(english)) { @@ -925,8 +925,8 @@ bool UkuiMenuInterface::initAppIni() tencentInitVector.insert(0, chainese); } - qSort(customizedVector.begin(), customizedVector.end(), cmpApp); //按中英文字母排序 - qSort(thirdPartyVector.begin(), thirdPartyVector.end(), cmpApp); //按中英文字母排序 + std::sort(customizedVector.begin(), customizedVector.end(), cmpApp); //按中英文字母排序 + std::sort(thirdPartyVector.begin(), thirdPartyVector.end(), cmpApp); //按中英文字母排序 setting->beginGroup("application"); for (int i = 0; i < preorderAppVector.count(); i++) { @@ -1003,7 +1003,7 @@ QVector UkuiMenuInterface::getAllClassification() index++; } - qSort(appVector.begin(), appVector.end(), cmpApp); + std::sort(appVector.begin(), appVector.end(), cmpApp); Q_FOREACH(QString desktopfp, commonVector) { allAppVector.append(desktopfp); @@ -1366,7 +1366,7 @@ QVector UkuiMenuInterface::getAlphabeticClassification() for (int i = 0; i < 26; i++) { QStringList desktopfpList; desktopfpList.clear(); - qSort(appVector[i].begin(), appVector[i].end(), cmpApp); + std::sort(appVector[i].begin(), appVector[i].end(), cmpApp); for (int j = 0; j < appVector[i].size(); j++) { desktopfpList.append(appVector[i].at(j).at(0)); @@ -1389,8 +1389,8 @@ QVector UkuiMenuInterface::getAlphabeticClassification() } } - qSort(otherVector.begin(), otherVector.end(), cmpApp); - qSort(numberVector.begin(), numberVector.end(), cmpApp); + std::sort(otherVector.begin(), otherVector.end(), cmpApp); + std::sort(numberVector.begin(), numberVector.end(), cmpApp); QStringList otherfpList; otherfpList.clear(); @@ -1479,7 +1479,7 @@ QVector UkuiMenuInterface::getFunctionalClassification() for (int i = 0; i < 11; i++) { QStringList desktopfpList; desktopfpList.clear(); - qSort(appVector[i].begin(), appVector[i].end(), cmpApp); + std::sort(appVector[i].begin(), appVector[i].end(), cmpApp); for (int j = 0; j < appVector[i].size(); j++) { desktopfpList.append(appVector[i].at(j).at(0)); diff --git a/src/BackProcess/Search/searchappthread.cpp b/src/BackProcess/Search/searchappthread.cpp index e1368f1..8200b4b 100755 --- a/src/BackProcess/Search/searchappthread.cpp +++ b/src/BackProcess/Search/searchappthread.cpp @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#include #include "searchappthread.h" #include #include "file-utils.h" @@ -81,12 +81,12 @@ void SearchAppThread::run() } } - qSort(m_searchFirstVector.begin(), m_searchFirstVector.end(), UkuiMenuInterface::cmpApp); - qSort(m_searchRestVector.begin(), m_searchRestVector.end(), UkuiMenuInterface::cmpApp); + std::sort(m_searchFirstVector.begin(), m_searchFirstVector.end(), UkuiMenuInterface::cmpApp); + std::sort(m_searchRestVector.begin(), m_searchRestVector.end(), UkuiMenuInterface::cmpApp); //对中文搜索结果进行排序 if (m_searchResultVector.size() != 0) { - qSort(m_searchResultVector.begin(), m_searchResultVector.end(), UkuiMenuInterface::cmpApp); + std::sort(m_searchResultVector.begin(), m_searchResultVector.end(), UkuiMenuInterface::cmpApp); } //优先将严格匹配结果加入列表 diff --git a/src/BackProcess/tablet/getmodeldata.cpp b/src/BackProcess/tablet/getmodeldata.cpp index 0f8080f..ef273d9 100755 --- a/src/BackProcess/tablet/getmodeldata.cpp +++ b/src/BackProcess/tablet/getmodeldata.cpp @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +#include #include "getmodeldata.h" #include #include @@ -125,7 +125,7 @@ QVector GetModelData::getRecentData() } } - qSort(recentDataVector.begin(), recentDataVector.end(), cmpApp); + std::sort(recentDataVector.begin(), recentDataVector.end(), cmpApp); return recentDataVector; } -- 2.43.0