forked from openkylin/ukui-search
解决当搜索UI关闭后未正确停止插件搜索线程的问题;解决遍历搜索时文件搜索插件长时间cpu占用较高的问题。
This commit is contained in:
parent
8b7276bc15
commit
ba52540c4e
|
@ -48,11 +48,11 @@ void SearchResultManager::stopSearch()
|
|||
{
|
||||
if(m_getResultThread->isRunning()) {
|
||||
m_getResultThread->stop();
|
||||
}
|
||||
SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_pluginId);
|
||||
plugin->stopSearch();
|
||||
qDebug() << m_pluginId << "stopped";
|
||||
}
|
||||
}
|
||||
|
||||
void SearchResultManager::initConnections()
|
||||
{
|
||||
|
|
|
@ -541,7 +541,14 @@ void DirectSearch::run() {
|
|||
}
|
||||
bfs.enqueue(i.absoluteFilePath());
|
||||
}
|
||||
SearchManager::m_mutexDir.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolDir) {
|
||||
match(i);
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -549,29 +556,10 @@ void DirectSearch::run() {
|
|||
void DirectSearch::match(const QFileInfo &info)
|
||||
{
|
||||
if(info.fileName().contains(m_keyword, Qt::CaseInsensitive)) {
|
||||
if((info.isDir() && m_value == DIR_SEARCH_VALUE)) {
|
||||
if((info.isDir() && m_value == DIR_SEARCH_VALUE) || (info.isFile() && m_value == FILE_SEARCH_VALUE)) {
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(SearchManager::creatResultInfo(ri,info.absoluteFilePath())) {
|
||||
SearchManager::m_mutexDir.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolDir) {
|
||||
m_searchResult->enqueue(ri);
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexDir.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (info.isFile() && m_value == FILE_SEARCH_VALUE) {
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(SearchManager::creatResultInfo(ri,info.absoluteFilePath())) {
|
||||
SearchManager::m_mutexFile.lock();
|
||||
if(m_uniqueSymbol == SearchManager::uniqueSymbolFile) {
|
||||
m_searchResult->enqueue(ri);
|
||||
SearchManager::m_mutexFile.unlock();
|
||||
} else {
|
||||
SearchManager::m_mutexFile.unlock();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue