修改全部应用界面应用排序顺序

This commit is contained in:
youdiansaodongxi 2023-04-28 10:13:52 +08:00 committed by He Sir
parent 841fd7571d
commit 6d9742c5f7
2 changed files with 16 additions and 2 deletions

View File

@ -158,8 +158,13 @@ bool AllAppDataProvider::appDataSort(const DataEntity &a, const DataEntity &b)
} else if ((a.top() == 0) && (b.top() == 0)) {
if (a.isRecentInstall()) {
if (b.isRecentInstall()) {
return QDateTime::fromString(a.insertTime(), "yyyy-MM-dd hh:mm:ss")
> QDateTime::fromString(b.insertTime(), "yyyy-MM-dd hh:mm:ss");
if (QDateTime::fromString(a.insertTime(), "yyyy-MM-dd hh:mm:ss")
!= QDateTime::fromString(b.insertTime(), "yyyy-MM-dd hh:mm:ss")) {
return QDateTime::fromString(a.insertTime(), "yyyy-MM-dd hh:mm:ss")
> QDateTime::fromString(b.insertTime(), "yyyy-MM-dd hh:mm:ss");
} else {
return letterSort(a.firstLetter(), b.firstLetter());
}
} else {
return true;
}
@ -188,6 +193,14 @@ void AllAppDataProvider::setRecentState(DataEntity &app)
app.setRecentInstall(false);
}
bool AllAppDataProvider::letterSort(const QString &a, const QString &b)
{
if (QString::compare(a, b, Qt::CaseInsensitive) == 0) {
return false;
}
return QString::compare(a, b, Qt::CaseInsensitive) > 0 ? false : true;
}
void AllAppDataProvider::sendData()
{
QVector<DataEntity> data;

View File

@ -55,6 +55,7 @@ private:
void updateData(const QList<DataEntity>& apps);
static bool appDataSort(const DataEntity &a, const DataEntity &b);
static void setRecentState(DataEntity &app);
static bool letterSort(const QString &a, const QString &b);
private:
QMutex m_mutex;