free point
This commit is contained in:
parent
650c93d2f8
commit
2381dab49d
|
@ -8,13 +8,15 @@ AppMatch::AppMatch(QObject *parent) : QObject(parent)
|
||||||
|
|
||||||
QStringList AppMatch::startMatchApp(QString input){
|
QStringList AppMatch::startMatchApp(QString input){
|
||||||
m_soureText=input;
|
m_soureText=input;
|
||||||
|
m_returnResult.clear();
|
||||||
this->getAppName();
|
this->getAppName();
|
||||||
|
m_returnResult=m_midResult;
|
||||||
|
m_midResult.clear();
|
||||||
return m_returnResult;
|
return m_returnResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMatch::getAllDesktopFilePath(QString path){
|
void AppMatch::getAllDesktopFilePath(QString path){
|
||||||
|
|
||||||
GError** error=nullptr;
|
|
||||||
GKeyFileFlags flags=G_KEY_FILE_NONE;
|
GKeyFileFlags flags=G_KEY_FILE_NONE;
|
||||||
GKeyFile* keyfile=g_key_file_new ();
|
GKeyFile* keyfile=g_key_file_new ();
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ void AppMatch::getAllDesktopFilePath(QString path){
|
||||||
}
|
}
|
||||||
QByteArray fpbyte=filePathStr.toLocal8Bit();
|
QByteArray fpbyte=filePathStr.toLocal8Bit();
|
||||||
char* filepath=fpbyte.data();
|
char* filepath=fpbyte.data();
|
||||||
g_key_file_load_from_file(keyfile,filepath,flags,error);
|
g_key_file_load_from_file(keyfile,filepath,flags,nullptr);
|
||||||
char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","NoDisplay", nullptr, nullptr);
|
char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","NoDisplay", nullptr, nullptr);
|
||||||
if(ret_1!=nullptr)
|
if(ret_1!=nullptr)
|
||||||
{
|
{
|
||||||
|
@ -108,6 +110,8 @@ void AppMatch::getAllDesktopFilePath(QString path){
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
} while(i < list.size());
|
} while(i < list.size());
|
||||||
|
|
||||||
|
g_key_file_free(keyfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMatch::getDesktopFilePath()
|
void AppMatch::getDesktopFilePath()
|
||||||
|
@ -162,7 +166,6 @@ void AppMatch::getDesktopFilePath()
|
||||||
|
|
||||||
void AppMatch::getAppName()
|
void AppMatch::getAppName()
|
||||||
{
|
{
|
||||||
GError** error=nullptr;
|
|
||||||
GKeyFileFlags flags=G_KEY_FILE_NONE;
|
GKeyFileFlags flags=G_KEY_FILE_NONE;
|
||||||
GKeyFile* keyfile=g_key_file_new ();
|
GKeyFile* keyfile=g_key_file_new ();
|
||||||
|
|
||||||
|
@ -175,25 +178,23 @@ void AppMatch::getAppName()
|
||||||
str=m_filePathList.at(i);
|
str=m_filePathList.at(i);
|
||||||
fpbyte=str.toLocal8Bit();
|
fpbyte=str.toLocal8Bit();
|
||||||
filepath=fpbyte.data();
|
filepath=fpbyte.data();
|
||||||
g_key_file_load_from_file(keyfile,filepath,flags,error);
|
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);
|
||||||
appNameMatch(namestr,str);
|
appNameMatch(namestr,str);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_key_file_load_from_file(keyfile,filepath,flags,error);
|
g_key_file_load_from_file(keyfile,filepath,flags,nullptr);
|
||||||
g_key_file_free(keyfile);
|
g_key_file_free(keyfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppMatch::appNameMatch(QString appname,QString desktoppath){
|
void AppMatch::appNameMatch(QString appname,QString desktoppath){
|
||||||
if(appname.contains(m_soureText)){
|
if(appname.contains(m_soureText)){
|
||||||
m_returnResult.append(desktoppath);
|
m_midResult.append(desktoppath);
|
||||||
}
|
}
|
||||||
QString pinyin=chineseCharactersToPinyin::find(appname).toLower(); // 中文转拼音
|
QString pinyin=chineseCharactersToPinyin::find(appname).toLower(); // 中文转拼音
|
||||||
if(pinyin.contains(m_soureText,Qt::CaseInsensitive)){
|
if(pinyin.contains(m_soureText,Qt::CaseInsensitive)){
|
||||||
m_returnResult.append(desktoppath);
|
m_midResult.append(desktoppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ private:
|
||||||
QString m_soureText;
|
QString m_soureText;
|
||||||
QStringList m_filePathList;
|
QStringList m_filePathList;
|
||||||
QStringList m_returnResult;
|
QStringList m_returnResult;
|
||||||
|
QStringList m_midResult;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue