From fce5a7d949a0dc024796a8c512177b69566a1b7c 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 16:38:04 +0800 Subject: [PATCH] replace deprecated qSort with std::sort MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 侯红勋 --- ...td-sort-to-sort-items-as-recommended.patch | 164 ++++++++++++++++++ ukui-menu.spec | 6 +- 2 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 0001-use-std-sort-to-sort-items-as-recommended.patch diff --git a/0001-use-std-sort-to-sort-items-as-recommended.patch b/0001-use-std-sort-to-sort-items-as-recommended.patch new file mode 100644 index 0000000..f6c4db8 --- /dev/null +++ b/0001-use-std-sort-to-sort-items-as-recommended.patch @@ -0,0 +1,164 @@ +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 + diff --git a/ukui-menu.spec b/ukui-menu.spec index 465b640..7fde621 100644 --- a/ukui-menu.spec +++ b/ukui-menu.spec @@ -1,6 +1,6 @@ Name: ukui-menu Version: 3.1.1 -Release: 13 +Release: 14 Summary: Advanced ukui menu License: GPL-3.0-or-later URL: http://www.ukui.org @@ -34,6 +34,7 @@ Patch25: 0001-fix-uninstall-failed-issue.patch Patch26: disable-Suspend-and-Sleep-of-ukui-menu.patch %endif Patch27: 0022-fix-thumbnail-potential-memory-leak.patch +Patch28: 0001-use-std-sort-to-sort-items-as-recommended.patch BuildRequires: qt5-qtbase-devel BuildRequires: libqtxdg-devel @@ -86,6 +87,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/ukui-menu/translations/ %changelog +* Wed May 08 2024 houhongxun - 3.1.1-14 +- use std::sort, replace deprecated qSort + * Tue May 07 2024 douyan - 3.1.1-13 - Type:bugfix - ID:NA