Merge pull request #17 from sunfengsheng/main
Modify app and setting matching
This commit is contained in:
commit
29fe4bbaf3
|
@ -7,8 +7,12 @@ AppMatch::AppMatch(QObject *parent) : QObject(parent)
|
|||
}
|
||||
|
||||
QStringList AppMatch::startMatchApp(QString input){
|
||||
input.replace(" ","");
|
||||
m_soureText=input;
|
||||
m_returnResult.clear();
|
||||
if(input.isEmpty()){
|
||||
return m_returnResult;
|
||||
}
|
||||
this->getAppName();
|
||||
m_returnResult=m_midResult;
|
||||
m_midResult.clear();
|
||||
|
@ -42,8 +46,15 @@ void AppMatch::getAllDesktopFilePath(QString path){
|
|||
getAllDesktopFilePath(fileInfo.filePath());
|
||||
}
|
||||
else{
|
||||
//过滤后缀不是.desktop的文件
|
||||
//过滤LXQt、KDE
|
||||
QString filePathStr=fileInfo.filePath();
|
||||
if(filePathStr.contains("KDE",Qt::CaseInsensitive)||
|
||||
filePathStr.contains("mate",Qt::CaseInsensitive)||
|
||||
filePathStr.contains("LX",Qt::CaseInsensitive) ){
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
//过滤后缀不是.desktop的文件
|
||||
if(!filePathStr.endsWith(".desktop"))
|
||||
{
|
||||
i++;
|
||||
|
@ -72,17 +83,6 @@ void AppMatch::getAllDesktopFilePath(QString path){
|
|||
continue;
|
||||
}
|
||||
}
|
||||
//过滤LXQt、KDE
|
||||
char* ret=g_key_file_get_locale_string(keyfile,"Desktop Entry","OnlyShowIn", nullptr, nullptr);
|
||||
if(ret!=nullptr)
|
||||
{
|
||||
QString str=QString::fromLocal8Bit(ret);
|
||||
if(str.contains("LXQt") || str.contains("KDE"))
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//过滤中英文名为空的情况
|
||||
QLocale cn;
|
||||
QString language=cn.languageToString(cn.language());
|
||||
|
|
|
@ -5,7 +5,7 @@ SettingsMatch::SettingsMatch(QObject *parent) : QObject(parent)
|
|||
XmlElement();
|
||||
}
|
||||
|
||||
QStringList SettingsMatch::matchstart(const QString &source){
|
||||
QStringList SettingsMatch::startMatchApp(const QString &source){
|
||||
m_sourceText=source;
|
||||
// qDebug()<<m_sourceText;
|
||||
QStringList settingList=matching();
|
||||
|
@ -16,7 +16,7 @@ void SettingsMatch::XmlElement(){
|
|||
QString pinyinIndex;
|
||||
QString ChineseIndex;
|
||||
|
||||
QFile file(QString::fromLocal8Bit("::/res/search.xml"));
|
||||
QFile file(QString::fromLocal8Bit(":/res/search.xml"));
|
||||
if (!file.open(QIODevice::ReadOnly)){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class SettingsMatch : public QObject
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit SettingsMatch(QObject *parent = nullptr);
|
||||
QStringList matchstart(const QString &source);
|
||||
QStringList startMatchApp(const QString &source);
|
||||
|
||||
private:
|
||||
void XmlElement();
|
||||
|
|
Loading…
Reference in New Issue