forked from openkylin/ukui-search
Merge branch '0720-newfrontend' into 'new-frontend'
Update UI;Update internal plugins. See merge request kylin-desktop/ukui-search!78
This commit is contained in:
commit
6b5a3fc18d
|
@ -108,6 +108,11 @@ void SeachBarWidget::clear()
|
|||
m_searchLineEdit->clear();
|
||||
}
|
||||
|
||||
void SeachBarWidget::reSearch()
|
||||
{
|
||||
Q_EMIT this->m_searchLineEdit->requestSearchKeyword(m_searchLineEdit->text());
|
||||
}
|
||||
|
||||
void SeachBarWidget::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
~SeachBarWidget();
|
||||
|
||||
void clear();
|
||||
void reSearch();
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ void MainWindow::centerToScreen(QWidget* widget) {
|
|||
desk_x = width;
|
||||
desk_y = height;
|
||||
}
|
||||
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
|
||||
widget->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 3 + desk_rect.top());
|
||||
}
|
||||
|
||||
void MainWindow::initGsettings() {
|
||||
|
@ -457,21 +457,21 @@ void MainWindow::initTimer() {
|
|||
});
|
||||
m_researchTimer = new QTimer;
|
||||
m_researchTimer->setInterval(RESEARCH_TIME);
|
||||
// connect(m_researchTimer, &QTimer::timeout, this, [ = ]() {
|
||||
// if(this->isVisible()) {
|
||||
// m_searchLayout->reSearch();
|
||||
// }
|
||||
// m_researchTimer->stop();
|
||||
// });
|
||||
// connect(m_searchLayout, &SearchBarHLayout::requestSearchKeyword, this, [ = ](QString text) {
|
||||
// if(text == "" || text.isEmpty()) {
|
||||
// m_askTimer->stop();
|
||||
// } else {
|
||||
// //允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索
|
||||
// if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH)
|
||||
// m_askTimer->start();
|
||||
// }
|
||||
// });
|
||||
connect(m_researchTimer, &QTimer::timeout, this, [ = ]() {
|
||||
if(this->isVisible()) {
|
||||
m_searchBarWidget->reSearch();
|
||||
}
|
||||
m_researchTimer->stop();
|
||||
});
|
||||
connect(m_searchBarWidget, &SeachBarWidget::requestSearchKeyword, this, [ = ](QString text) {
|
||||
if(text == "" || text.isEmpty()) {
|
||||
m_askTimer->stop();
|
||||
} else {
|
||||
//允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索
|
||||
if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH)
|
||||
m_askTimer->start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,7 @@ AppSearchPlugin::AppSearchPlugin(QObject *parent) : QObject(parent)
|
|||
m_actionInfo_installed << open << addtoDesktop << addtoPanel;
|
||||
m_actionInfo_not_installed << install;
|
||||
AppMatch::getAppMatch()->start();
|
||||
m_pool.setMaxThreadCount(2);
|
||||
m_pool.setMaxThreadCount(1);
|
||||
m_pool.setExpiryTimeout(1000);
|
||||
initDetailPage();
|
||||
}
|
||||
|
@ -292,11 +292,7 @@ void AppSearch::run()
|
|||
while (i.hasNext()) {
|
||||
i.next();
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(!QIcon::fromTheme(i.value().at(1)).isNull()) {
|
||||
ri.icon = QIcon::fromTheme(i.value().at(1));
|
||||
}else {
|
||||
ri.icon = QIcon(":/res/icons/desktop.png");
|
||||
}
|
||||
ri.icon = QIcon::fromTheme(i.value().at(1), QIcon(":/res/icons/desktop.png"));
|
||||
ri.name = i.key().app_name;
|
||||
ri.actionKey = i.value().at(0);
|
||||
ri.type = 0; //0 means installed apps.
|
||||
|
@ -310,11 +306,7 @@ void AppSearch::run()
|
|||
while (in.hasNext()) {
|
||||
in.next();
|
||||
SearchPluginIface::ResultInfo ri;
|
||||
if(!QIcon(in.value().at(1)).isNull()) {
|
||||
ri.icon = QIcon(in.value().at(1));
|
||||
}else {
|
||||
ri.icon = QIcon(":/res/icons/desktop.png");
|
||||
}
|
||||
ri.icon = QIcon::fromTheme(in.value().at(1), QIcon(":/res/icons/desktop.png"));
|
||||
ri.name = in.key().app_name;
|
||||
SearchPluginIface::DescriptionInfo di;
|
||||
di.key = QString(tr("Application Description:"));
|
||||
|
|
|
@ -73,7 +73,7 @@ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(QIcon::fromTheme(icon_name).isNull()) {
|
||||
if(!QIcon::hasThemeIcon(icon_name)) {
|
||||
return QIcon::fromTheme("unknown");
|
||||
}
|
||||
return QIcon::fromTheme(icon_name);
|
||||
|
|
|
@ -11,7 +11,7 @@ FileSearchPlugin::FileSearchPlugin(QObject *parent) : QObject(parent)
|
|||
SearchPluginIface::Actioninfo Openpath { 1, tr("Open path")};
|
||||
SearchPluginIface::Actioninfo CopyPath { 2, tr("Copy Path")};
|
||||
m_actionInfo << open << Openpath << CopyPath;
|
||||
m_pool.setMaxThreadCount(2);
|
||||
m_pool.setMaxThreadCount(1);
|
||||
m_pool.setExpiryTimeout(1000);
|
||||
initDetailPage();
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent)
|
|||
SearchPluginIface::Actioninfo Openpath { 1, tr("Open path")};
|
||||
SearchPluginIface::Actioninfo CopyPath { 2, tr("Copy Path")};
|
||||
m_actionInfo << open << Openpath << CopyPath;
|
||||
m_pool.setMaxThreadCount(2);
|
||||
m_pool.setMaxThreadCount(1);
|
||||
m_pool.setExpiryTimeout(1000);
|
||||
initDetailPage();
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(pare
|
|||
SearchPluginIface::Actioninfo Openpath { 1, tr("Open path")};
|
||||
SearchPluginIface::Actioninfo CopyPath { 2, tr("Copy Path")};
|
||||
m_actionInfo << open << Openpath << CopyPath;
|
||||
m_pool.setMaxThreadCount(2);
|
||||
m_pool.setMaxThreadCount(1);
|
||||
m_pool.setExpiryTimeout(1000);
|
||||
initDetailPage();
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ bool SearchManager::creatResultInfo(SearchPluginIface::ResultInfo &ri, QString p
|
|||
if(!info.exists()) {
|
||||
return false;
|
||||
}
|
||||
ri.icon = FileUtils::getFileIcon(QUrl::fromLocalFile(path).toString());
|
||||
ri.icon = FileUtils::getFileIcon(QUrl::fromLocalFile(path).toString(), false);
|
||||
ri.name = info.fileName();
|
||||
ri.description = QVector<SearchPluginIface::DescriptionInfo>() \
|
||||
<< SearchPluginIface::DescriptionInfo{tr("Path:"), path} \
|
||||
|
|
|
@ -18,6 +18,15 @@ public:
|
|||
QMutexLocker locker(&m_mutex);
|
||||
return QList<T>::takeFirst();
|
||||
}
|
||||
inline void clear() {
|
||||
QMutexLocker locker(&m_mutex);
|
||||
QList<T>::clear();
|
||||
return;
|
||||
}
|
||||
inline bool isEmpty() {
|
||||
QMutexLocker locker(&m_mutex);
|
||||
return QList<T>::isEmpty();
|
||||
}
|
||||
private:
|
||||
QMutex m_mutex;
|
||||
};
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{opacity:0.85;}</style></defs><title>close</title><path class="cls-1" d="M8.71,8l5.14-5.15a.49.49,0,0,0-.7-.7L8,7.29,2.85,2.15a.49.49,0,0,0-.7.7L7.29,8,2.15,13.15a.48.48,0,0,0,0,.7.48.48,0,0,0,.7,0L8,8.71l5.15,5.14a.48.48,0,0,0,.7,0,.48.48,0,0,0,0-.7Z"/></svg>
|
After Width: | Height: | Size: 374 B |
Binary file not shown.
After Width: | Height: | Size: 998 B |
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>edit-find-symbolic</title>
|
||||
<g id="Icon" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Icon-Sets" transform="translate(-68.000000, -2529.000000)" fill-rule="nonzero">
|
||||
<g id="编组-9" transform="translate(0.000000, 2399.000000)">
|
||||
<g id="编组" transform="translate(68.000000, 130.000000)">
|
||||
<polygon id="矩形备份" fill="#000000" opacity="0" points="0 0 16 0 16 16 0 16"/>
|
||||
<path d="M6.86630772,1 C8.48762671,1 9.95614366,1.64816049 11.0189488,2.69780957 C12.0771269,3.74288891 12.7327736,5.18634211 12.7327736,6.78146875 C12.7327736,8.28192337 12.1523076,9.64806734 11.2023613,10.6749557 L11.2023613,10.6749557 L14.9869478,14.4127374 L10.6532367,11.3057557 C9.58274699,12.0665702 8.28388099,12.5629531 6.86630772,12.5629531 C5.2449219,12.5629531 3.77647181,11.9148388 2.71373977,10.8652353 C1.65557494,9.82014255 1,8.37664384 1,6.78146875 C1,5.18630217 1.65557811,3.74280894 2.71374274,2.69771882 C3.77647668,1.64811584 5.24492743,1 6.86630772,1 Z" id="路径" stroke="#2FB3E8" stroke-width="2"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="98px" height="87px" viewBox="0 0 98 87" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 59 (86127) - https://sketch.com -->
|
||||
<title>image-viewer-app-symbolic</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs>
|
||||
<filter x="-2.4%" y="-2.7%" width="104.7%" height="105.3%" filterUnits="objectBoundingBox" id="filter-1">
|
||||
<feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
|
||||
<feGaussianBlur stdDeviation="4" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
|
||||
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix>
|
||||
<feMerge>
|
||||
<feMergeNode in="shadowMatrixOuter1"></feMergeNode>
|
||||
<feMergeNode in="SourceGraphic"></feMergeNode>
|
||||
</feMerge>
|
||||
</filter>
|
||||
</defs>
|
||||
<g id="综合搜索" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.200000003">
|
||||
<g id="搜索结果——网页" transform="translate(-883.000000, -627.000000)">
|
||||
<g id="编组-2" filter="url(#filter-1)" transform="translate(447.000000, 427.000000)">
|
||||
<g id="image-viewer-app-symbolic" transform="translate(436.000000, 200.000000)">
|
||||
<g id="图层_2" transform="translate(4.000000, 5.000000)">
|
||||
<path d="M24,72 L12,72 C5.4,72 0,66.6 0,60 L0,12 C0,5.4 5.4,0 12,0 L78,0 C84.6,0 90,5.4 90,12 L90,60" id="路径" stroke="#1F2022" stroke-width="6" stroke-linecap="round"></path>
|
||||
<path d="M51,15 C34.2,15 21,28.2 21,45 C21,61.8 34.2,75 51,75 C67.8,75 81,61.8 81,45 C81,28.2 67.8,15 51,15 Z M51,21 C64.2,21 75,31.8 75,45 C75,58.2 64.2,69 51,69 C37.8,69 27,58.2 27,45 C27,31.8 37.8,21 51,21 Z" id="circle2567-9" fill="#1F2022" fill-rule="nonzero"></path>
|
||||
<path d="M71.4,60.6 L67.2,64.8 L80.1,77.7 C81.259798,78.859798 83.140202,78.859798 84.3,77.7 C85.459798,76.540202 85.459798,74.659798 84.3,73.5 L71.4,60.6 L71.4,60.6 Z" id="path2570-36" fill="#1F2022"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 498 B |
|
@ -2,5 +2,10 @@
|
|||
<qresource prefix="/">
|
||||
<file>index/pinyinWithTone.txt</file>
|
||||
<file>index/pinyinWithoutTone.txt</file>
|
||||
<file>res/icons/desktop.png</file>
|
||||
<file>res/icons/close.svg</file>
|
||||
<file>res/icons/edit-find-symbolic.svg</file>
|
||||
<file>res/icons/net-disconnected.svg</file>
|
||||
<file>res/icons/system-search.symbolic.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -50,7 +50,7 @@ void Zeeker::SettingsSearchPlugin::KeywordSearch(QString keyword, DataQueue<Resu
|
|||
str = key + "/" + str;
|
||||
resultInfo.icon = FileUtils::getSettingIcon(str, true);
|
||||
resultInfo.actionKey = str;
|
||||
searchResult->append(resultInfo);
|
||||
searchResult->enqueue(resultInfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ void Zeeker::SettingsSearchPlugin::KeywordSearch(QString keyword, DataQueue<Resu
|
|||
str = key + "/" + str;
|
||||
resultInfo.icon = FileUtils::getSettingIcon(str, true);
|
||||
resultInfo.actionKey = str;
|
||||
searchResult->append(resultInfo);
|
||||
searchResult->enqueue(resultInfo);
|
||||
break;
|
||||
}
|
||||
if (keyword.size() < 2)
|
||||
|
@ -74,7 +74,7 @@ void Zeeker::SettingsSearchPlugin::KeywordSearch(QString keyword, DataQueue<Resu
|
|||
str = key + "/" + str;
|
||||
resultInfo.icon = FileUtils::getSettingIcon(str, true);
|
||||
resultInfo.actionKey = str;
|
||||
searchResult->append(resultInfo);
|
||||
searchResult->enqueue(resultInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ void Zeeker::SettingsSearchPlugin::KeywordSearch(QString keyword, DataQueue<Resu
|
|||
str = key + "/" + str;
|
||||
resultInfo.icon = FileUtils::getSettingIcon(str, true);
|
||||
resultInfo.actionKey = str;
|
||||
searchResult->append(resultInfo);
|
||||
searchResult->enqueue(resultInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue