forked from openkylin/ukui-search
parent
bd8f806353
commit
cf12f39851
|
@ -16,6 +16,7 @@ QStringList AppMatch::startMatchApp(QString input){
|
||||||
this->getAppName();
|
this->getAppName();
|
||||||
m_returnResult=m_midResult;
|
m_returnResult=m_midResult;
|
||||||
m_midResult.clear();
|
m_midResult.clear();
|
||||||
|
// qWarning()<<"m_returnResult :"<<m_returnResult;
|
||||||
return m_returnResult;
|
return m_returnResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +193,7 @@ void AppMatch::getAppName()
|
||||||
g_key_file_load_from_file(keyfile,filepath,flags,nullptr);
|
g_key_file_load_from_file(keyfile,filepath,flags,nullptr);
|
||||||
name=g_key_file_get_locale_string(keyfile,"Desktop Entry","Name", nullptr, nullptr);
|
name=g_key_file_get_locale_string(keyfile,"Desktop Entry","Name", nullptr, nullptr);
|
||||||
namestr=QString::fromLocal8Bit(name);
|
namestr=QString::fromLocal8Bit(name);
|
||||||
|
// qWarning()<<"namestr :"<<namestr;
|
||||||
appNameMatch(namestr,str);
|
appNameMatch(namestr,str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,13 +214,15 @@ void AppMatch::appNameMatch(QString appname,QString desktoppath){
|
||||||
m_midResult.append(desktoppath);
|
m_midResult.append(desktoppath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString pinyin=FileUtils::findMultiToneWords(appname).at(0);// 中文转拼音
|
|
||||||
if(pinyin.contains(m_sourceText,Qt::CaseInsensitive)){
|
|
||||||
m_midResult.append(desktoppath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QString shouzimu=FileUtils::findMultiToneWords(appname).at(1);// 中文转首字母
|
QString shouzimu=FileUtils::findMultiToneWords(appname).at(1);// 中文转首字母
|
||||||
if(shouzimu.contains(m_sourceText,Qt::CaseInsensitive)){
|
if(shouzimu.contains(m_sourceText,Qt::CaseInsensitive)){
|
||||||
m_midResult.append(desktoppath);
|
m_midResult.append(desktoppath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(m_sourceText.size()<2)
|
||||||
|
return;
|
||||||
|
QString pinyin=FileUtils::findMultiToneWords(appname).at(0);// 中文转拼音
|
||||||
|
if(pinyin.contains(m_sourceText,Qt::CaseInsensitive)){
|
||||||
|
m_midResult.append(desktoppath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,8 @@ QStringList SettingsMatch::matching(){
|
||||||
// qDebug()<<key;
|
// qDebug()<<key;
|
||||||
for(int t=0; t<regmatch.size();t++)
|
for(int t=0; t<regmatch.size();t++)
|
||||||
{
|
{
|
||||||
|
if(m_sourceText=="/")
|
||||||
|
continue;
|
||||||
QString str =regmatch.at(t);
|
QString str =regmatch.at(t);
|
||||||
if(str.contains(m_sourceText))
|
if(str.contains(m_sourceText))
|
||||||
{
|
{
|
||||||
|
@ -96,14 +98,14 @@ QStringList SettingsMatch::matching(){
|
||||||
returnresult.append(str);//中文名
|
returnresult.append(str);//中文名
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QString pinyin=FileUtils::findMultiToneWords(str).at(0);// 中文转拼音
|
QString shouzimu=FileUtils::findMultiToneWords(str).at(1);// 中文转首字母
|
||||||
if(pinyin.contains(m_sourceText,Qt::CaseInsensitive)){
|
if(shouzimu.contains(m_sourceText,Qt::CaseInsensitive)){
|
||||||
str=key+"/"+str;
|
str=key+"/"+str;
|
||||||
returnresult.append(str);
|
returnresult.append(str);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QString shouzimu=FileUtils::findMultiToneWords(str).at(1);// 中文转首字母
|
QString pinyin=FileUtils::findMultiToneWords(str).at(0);// 中文转拼音
|
||||||
if(shouzimu.contains(m_sourceText,Qt::CaseInsensitive)){
|
if(pinyin.contains(m_sourceText,Qt::CaseInsensitive)){
|
||||||
str=key+"/"+str;
|
str=key+"/"+str;
|
||||||
returnresult.append(str);
|
returnresult.append(str);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue