Merge branch '0720-newfrontend' into 'new-frontend'
Update UI;Update debian files. See merge request kylin-desktop/ukui-search!71
This commit is contained in:
commit
b680eef808
|
@ -1,3 +1,148 @@
|
||||||
|
ukui-search (1.0.0+0731) v101; urgency=medium
|
||||||
|
|
||||||
|
* test.
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Sat, 31 Jul 2021 14:43:21 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0720) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务号:无
|
||||||
|
* 其他改动:
|
||||||
|
*Fix: A potential index crash issue.
|
||||||
|
- 修复了一个潜在的索引崩溃问题(由某些特定的格式损坏的文本文件引起)。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Tue, 20 Jul 2021 10:42:32 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0709) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务号:无
|
||||||
|
* 其他改动:
|
||||||
|
* Fix: Path inclusive relation judgment incorrectly.
|
||||||
|
-修复了由于目录包含关系判断不当导致的一系列问题(黑名单屏蔽错误等)。
|
||||||
|
* Merge DAG and DP code; Preprocessing text content distinguish Chinese from
|
||||||
|
others.
|
||||||
|
- 优化关键词提取流程,缩短了一些索引所需的时间.
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Fri, 09 Jul 2021 14:43:14 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0703) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务号:无
|
||||||
|
* 其他改动:
|
||||||
|
* Fix:Creat fifo error sometimes.
|
||||||
|
- 修复了在开关索引时偶现的由于创建管道失败导致的崩溃问题。
|
||||||
|
* Remove entry from ukui-menu.
|
||||||
|
- 移除了开始菜单入口(开始菜单里的搜索应用显示)。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Sat, 03 Jul 2021 10:13:23 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0630) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务号:无
|
||||||
|
* 其他改动:
|
||||||
|
* Add a systembus iface for add inotify_max_user_instance, avoid inotify_init fail.
|
||||||
|
- 增加修改inotify_max_user_instance配置的dbus接口,避免由于超出最大数量导致的inotify_init失败问题。
|
||||||
|
* Fix: Detail page display incorrectly occasionally.
|
||||||
|
- 修复了偶现的点击最佳列表,右侧详情显示错误的问题。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Wed, 30 Jun 2021 11:38:31 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0629) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务号:无
|
||||||
|
* 其他改动:
|
||||||
|
* Fix:App search error when display applications of the same name.
|
||||||
|
- 修复了当存在重名应用时应用搜索显示错误的问题。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Tue, 29 Jun 2021 11:19:25 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0628) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务号:41543
|
||||||
|
* 其他改动:
|
||||||
|
* Fix: Tray icon click won't work after Win+D.
|
||||||
|
-修复了在弹出建立索引提示弹窗后按WIN+D之后,点击任务栏托盘无法呼出页面的问题。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Mon, 28 Jun 2021 09:35:15 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0619) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 需求6732,6733,6734,6938
|
||||||
|
* 其他改动:
|
||||||
|
* Add inotify events queue for merging events,reduce disk io operations.
|
||||||
|
- 增加inotify信号合并缓冲队列,减少90%以上磁盘io操作。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Sat, 19 Jun 2021 09:12:10 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0612) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务 无
|
||||||
|
* 其他改动:
|
||||||
|
* Startup time optimization.
|
||||||
|
- 更改托盘图标注册时间,优化开机启动速度。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Sat, 12 Jun 2021 08:53:45 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0611) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 61034
|
||||||
|
* 需求6448
|
||||||
|
* 其他改动:无
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Fri, 11 Jun 2021 14:05:18 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0610) focal; urgency=medium
|
||||||
|
|
||||||
|
* Bugs Fixed and performance optimized.
|
||||||
|
- 解决bug,优化性能。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Thu, 10 Jun 2021 20:58:32 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0608) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务 无
|
||||||
|
* 其他改动:
|
||||||
|
* Fix: Show more label is blocked by scrollbar.
|
||||||
|
- 微调UI,解决收起按钮被遮挡的问题。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Tue, 08 Jun 2021 20:57:00 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0605) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 58229,58171,57963
|
||||||
|
* 任务 33340
|
||||||
|
* 其他改动:无
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Sat, 05 Jun 2021 14:28:08 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0604) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 无
|
||||||
|
* 任务 33347, 33346, 33337
|
||||||
|
* 其他改动:无
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Fri, 04 Jun 2021 11:23:51 +0800
|
||||||
|
|
||||||
|
ukui-search (0.4.0+0602) v101; urgency=medium
|
||||||
|
|
||||||
|
* Bug 58540,58539,58581
|
||||||
|
* 任务 无
|
||||||
|
* 其他改动:
|
||||||
|
* Reduced the memory footprint of file indexing,and reduced the time it
|
||||||
|
takes.
|
||||||
|
- 减少了文件索引的内存占用并且缩短了文件索引的时间。
|
||||||
|
|
||||||
|
-- zhangpengfei <zhangpengfei@kylinos.cn> Wed, 02 Jun 2021 15:32:04 +0800
|
||||||
|
|
||||||
ukui-search (0.4.0+0530) v101; urgency=medium
|
ukui-search (0.4.0+0530) v101; urgency=medium
|
||||||
|
|
||||||
* Bug 57129
|
* Bug 57129
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
usr/lib/*/libukui-search.so.*
|
usr/lib/*/libukui-search.so.*
|
||||||
|
libsearch/.qm/*.qm usr/share/ukui-search/translations
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
usr/bin/ukui-search
|
usr/bin/ukui-search
|
||||||
etc/xdg/autostart/*.desktop
|
etc/xdg/autostart/*.desktop
|
||||||
usr/share/applications/*.desktop
|
usr/share/applications/*.desktop
|
||||||
src/.qm/*.qm usr/share/ukui-search/translations
|
frontend/.qm/*.qm usr/share/ukui-search/translations
|
||||||
usr/share/glib-2.0/schemas/*.xml
|
usr/share/glib-2.0/schemas/*.xml
|
||||||
|
|
|
@ -189,5 +189,8 @@ void LineEditStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyle
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
// return QProxyStyle::drawPrimitive(element, option, painter, widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
#include "search-page-section.h"
|
#include "search-page-section.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QScrollBar>
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
|
|
||||||
#define RESULT_LAYOUT_MARGINS 0,0,0,0
|
#define RESULT_LAYOUT_MARGINS 0,0,0,0
|
||||||
|
@ -80,6 +81,7 @@ void ResultArea::onWidgetSizeChanged()
|
||||||
|
|
||||||
void ResultArea::initUi()
|
void ResultArea::initUi()
|
||||||
{
|
{
|
||||||
|
// this->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
|
||||||
QPalette pal = palette();
|
QPalette pal = palette();
|
||||||
pal.setColor(QPalette::Base, RESULT_BACKGROUND_COLOR);
|
pal.setColor(QPalette::Base, RESULT_BACKGROUND_COLOR);
|
||||||
pal.setColor(QPalette::Window, RESULT_BACKGROUND_COLOR);
|
pal.setColor(QPalette::Window, RESULT_BACKGROUND_COLOR);
|
||||||
|
@ -107,7 +109,8 @@ void ResultArea::setupConnectionsForWidget(ResultWidget *widget)
|
||||||
DetailArea::DetailArea(QWidget *parent) : QScrollArea(parent)
|
DetailArea::DetailArea(QWidget *parent) : QScrollArea(parent)
|
||||||
{
|
{
|
||||||
initUi();
|
initUi();
|
||||||
connect(this, &DetailArea::setWidgetInfo, m_detailWidget, &DetailWidget::setWidgetInfo);
|
connect(this, &DetailArea::setWidgetInfo, m_detailWidget, &DetailWidget::updateDetailPage);
|
||||||
|
connect(this, &DetailArea::setWidgetInfo, this, &DetailArea::show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailArea::initUi()
|
void DetailArea::initUi()
|
||||||
|
@ -120,6 +123,7 @@ void DetailArea::initUi()
|
||||||
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
this->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
this->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
this->setWidgetResizable(true);
|
this->setWidgetResizable(true);
|
||||||
|
this->setFixedSize(368, 516);
|
||||||
m_detailWidget = new DetailWidget(this);
|
m_detailWidget = new DetailWidget(this);
|
||||||
this->setWidget(m_detailWidget);
|
this->setWidget(m_detailWidget);
|
||||||
this->hide();
|
this->hide();
|
||||||
|
@ -127,8 +131,14 @@ void DetailArea::initUi()
|
||||||
|
|
||||||
DetailWidget::DetailWidget(QWidget *parent) : QWidget(parent)
|
DetailWidget::DetailWidget(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
initUi();
|
// initUi();
|
||||||
clear();
|
// clear();
|
||||||
|
this->setFixedWidth(368);
|
||||||
|
m_mainLyt = new QVBoxLayout(this);
|
||||||
|
this->setLayout(m_mainLyt);
|
||||||
|
m_mainLyt->setContentsMargins(DETAIL_WIDGET_MARGINS);
|
||||||
|
m_mainLyt->setAlignment(Qt::AlignHCenter);
|
||||||
|
// m_mainLyt->addStretch();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString escapeHtml(const QString & str) {
|
QString escapeHtml(const QString & str) {
|
||||||
|
@ -140,111 +150,133 @@ QString escapeHtml(const QString & str) {
|
||||||
|
|
||||||
void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginIface::ResultInfo &info)
|
void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginIface::ResultInfo &info)
|
||||||
{
|
{
|
||||||
clearLayout(m_descFrameLyt);
|
// clearLayout(m_descFrameLyt);
|
||||||
clearLayout(m_previewFrameLyt);
|
// clearLayout(m_previewFrameLyt);
|
||||||
if(SearchPluginManager::getInstance()->getPlugin(plugin_name)->isPreviewEnable(info.actionKey,info.type)) {
|
// if(SearchPluginManager::getInstance()->getPlugin(plugin_name)->isPreviewEnable(info.actionKey,info.type)) {
|
||||||
m_iconLabel->hide();
|
// m_iconLabel->hide();
|
||||||
m_previewFrameLyt->addWidget(SearchPluginManager::getInstance()->getPlugin(plugin_name)->previewPage(info.actionKey,info.type, m_previewFrame), 0 , Qt::AlignHCenter);
|
// m_previewFrameLyt->addWidget(SearchPluginManager::getInstance()->getPlugin(plugin_name)->previewPage(info.actionKey,info.type, m_previewFrame), 0 , Qt::AlignHCenter);
|
||||||
m_previewFrameLyt->setContentsMargins(0,0,0,0);
|
// m_previewFrameLyt->setContentsMargins(0,0,0,0);
|
||||||
m_previewFrame->show();
|
// m_previewFrame->show();
|
||||||
} else {
|
// } else {
|
||||||
m_previewFrame->hide();
|
// m_previewFrame->hide();
|
||||||
m_iconLabel->setPixmap(info.icon.pixmap(info.icon.actualSize(ICON_SIZE)));
|
// m_iconLabel->setPixmap(info.icon.pixmap(info.icon.actualSize(ICON_SIZE)));
|
||||||
m_iconLabel->show();
|
// m_iconLabel->show();
|
||||||
}
|
// }
|
||||||
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
// QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
QString name = fontMetrics.elidedText(info.name, Qt::ElideRight, NAME_LABEL_WIDTH - 8);
|
// QString name = fontMetrics.elidedText(info.name, Qt::ElideRight, NAME_LABEL_WIDTH - 8);
|
||||||
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(name)));
|
// m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(escapeHtml(name)));
|
||||||
m_nameLabel->setToolTip(info.name);
|
// m_nameLabel->setToolTip(info.name);
|
||||||
m_pluginLabel->setText(plugin_name);
|
// m_pluginLabel->setText(plugin_name);
|
||||||
m_nameFrame->show();
|
// m_nameFrame->show();
|
||||||
m_line_1->show();
|
// m_line_1->show();
|
||||||
|
|
||||||
if (info.description.length() > 0) {
|
// if (info.description.length() > 0) {
|
||||||
//NEW_TODO 样式待优化
|
// //NEW_TODO 样式待优化
|
||||||
clearLayout(m_descFrameLyt);
|
// clearLayout(m_descFrameLyt);
|
||||||
Q_FOREACH (SearchPluginIface::DescriptionInfo desc, info.description) {
|
// Q_FOREACH (SearchPluginIface::DescriptionInfo desc, info.description) {
|
||||||
QLabel * descLabel = new QLabel(m_descFrame);
|
// QLabel * descLabel = new QLabel(m_descFrame);
|
||||||
descLabel->setTextFormat(Qt::PlainText);
|
// descLabel->setTextFormat(Qt::PlainText);
|
||||||
descLabel->setWordWrap(true);
|
// descLabel->setWordWrap(true);
|
||||||
QString show_desc = desc.key + " " + desc.value;
|
// QString show_desc = desc.key + " " + desc.value;
|
||||||
descLabel->setText(show_desc);
|
// descLabel->setText(show_desc);
|
||||||
m_descFrameLyt->addWidget(descLabel);
|
// m_descFrameLyt->addWidget(descLabel);
|
||||||
|
// }
|
||||||
|
// m_descFrame->show();
|
||||||
|
// m_line_2->show();
|
||||||
|
// }
|
||||||
|
// clearLayout(m_actionFrameLyt);
|
||||||
|
// Q_FOREACH (SearchPluginIface::Actioninfo actioninfo, SearchPluginManager::getInstance()->getPlugin(plugin_name)->getActioninfo(info.type)) {
|
||||||
|
// ActionLabel * actionLabel = new ActionLabel(actioninfo.displayName, info.actionKey, actioninfo.actionkey, plugin_name, info.type, m_actionFrame);
|
||||||
|
// m_actionFrameLyt->addWidget(actionLabel);
|
||||||
|
// }
|
||||||
|
// m_actionFrame->show();
|
||||||
}
|
}
|
||||||
m_descFrame->show();
|
|
||||||
m_line_2->show();
|
void DetailWidget::updateDetailPage(const QString &plugin_name, const SearchPluginIface::ResultInfo &info)
|
||||||
|
{
|
||||||
|
if(m_detailPage) {
|
||||||
|
if(m_currentPluginId == plugin_name) {
|
||||||
|
SearchPluginManager::getInstance()->getPlugin(plugin_name)->detailPage(info);
|
||||||
|
} else {
|
||||||
|
m_mainLyt->removeWidget(m_detailPage);
|
||||||
|
m_detailPage->hide();
|
||||||
|
m_detailPage = SearchPluginManager::getInstance()->getPlugin(plugin_name)->detailPage(info);
|
||||||
|
m_detailPage->setParent(this);
|
||||||
|
m_mainLyt->addWidget(m_detailPage);
|
||||||
|
m_detailPage->show();
|
||||||
|
// m_mainLyt->insertWidget(0, m_detailPage, 0);
|
||||||
}
|
}
|
||||||
clearLayout(m_actionFrameLyt);
|
} else {
|
||||||
Q_FOREACH (SearchPluginIface::Actioninfo actioninfo, SearchPluginManager::getInstance()->getPlugin(plugin_name)->getActioninfo(info.type)) {
|
m_detailPage = SearchPluginManager::getInstance()->getPlugin(plugin_name)->detailPage(info);
|
||||||
ActionLabel * actionLabel = new ActionLabel(actioninfo.displayName, info.actionKey, actioninfo.actionkey, plugin_name, info.type, m_actionFrame);
|
m_detailPage->setParent(this);
|
||||||
m_actionFrameLyt->addWidget(actionLabel);
|
m_mainLyt->addWidget(m_detailPage);
|
||||||
|
// m_mainLyt->insertWidget(0, m_detailPage, 0);
|
||||||
}
|
}
|
||||||
m_actionFrame->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailWidget::clear()
|
void DetailWidget::clear()
|
||||||
{
|
{
|
||||||
m_iconLabel->hide();
|
// m_iconLabel->hide();
|
||||||
m_nameFrame->hide();
|
// m_nameFrame->hide();
|
||||||
m_line_1->hide();
|
// m_line_1->hide();
|
||||||
m_descFrame->hide();
|
// m_descFrame->hide();
|
||||||
m_line_2->hide();
|
// m_line_2->hide();
|
||||||
m_actionFrame->hide();
|
// m_actionFrame->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailWidget::initUi()
|
void DetailWidget::initUi()
|
||||||
{
|
{
|
||||||
this->setFixedSize(368, 516);
|
// this->setFixedSize(368, 516);
|
||||||
m_mainLyt = new QVBoxLayout(this);
|
// m_mainLyt = new QVBoxLayout(this);
|
||||||
this->setLayout(m_mainLyt);
|
// this->setLayout(m_mainLyt);
|
||||||
m_mainLyt->setContentsMargins(DETAIL_WIDGET_MARGINS);
|
// m_mainLyt->setContentsMargins(DETAIL_WIDGET_MARGINS);
|
||||||
m_mainLyt->setAlignment(Qt::AlignHCenter);
|
// m_mainLyt->setAlignment(Qt::AlignHCenter);
|
||||||
|
|
||||||
m_iconLabel = new QLabel(this);
|
// m_iconLabel = new QLabel(this);
|
||||||
m_iconLabel->setFixedHeight(DETAIL_ICON_HEIGHT);
|
// m_iconLabel->setFixedHeight(DETAIL_ICON_HEIGHT);
|
||||||
m_iconLabel->setAlignment(Qt::AlignCenter);
|
// m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
m_previewFrame = new QFrame(this);
|
// m_previewFrame = new QFrame(this);
|
||||||
m_previewFrameLyt = new QHBoxLayout(m_previewFrame);
|
// m_previewFrameLyt = new QHBoxLayout(m_previewFrame);
|
||||||
|
|
||||||
m_nameFrame = new QFrame(this);
|
// m_nameFrame = new QFrame(this);
|
||||||
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
// m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
m_nameFrame->setLayout(m_nameFrameLyt);
|
// m_nameFrame->setLayout(m_nameFrameLyt);
|
||||||
m_nameFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
// m_nameFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
||||||
m_nameLabel = new QLabel(m_nameFrame);
|
// m_nameLabel = new QLabel(m_nameFrame);
|
||||||
m_nameLabel->setMaximumWidth(NAME_LABEL_WIDTH);
|
// m_nameLabel->setMaximumWidth(NAME_LABEL_WIDTH);
|
||||||
m_pluginLabel = new QLabel(m_nameFrame);
|
// m_pluginLabel = new QLabel(m_nameFrame);
|
||||||
m_pluginLabel->setEnabled(false);
|
// m_pluginLabel->setEnabled(false);
|
||||||
m_nameFrameLyt->addWidget(m_nameLabel);
|
// m_nameFrameLyt->addWidget(m_nameLabel);
|
||||||
m_nameFrameLyt->addStretch();
|
// m_nameFrameLyt->addStretch();
|
||||||
m_nameFrameLyt->addWidget(m_pluginLabel);
|
// m_nameFrameLyt->addWidget(m_pluginLabel);
|
||||||
|
|
||||||
m_line_1 = new QFrame(this);
|
// m_line_1 = new QFrame(this);
|
||||||
m_line_1->setFixedHeight(1);
|
// m_line_1->setFixedHeight(1);
|
||||||
m_line_1->setLineWidth(0);
|
// m_line_1->setLineWidth(0);
|
||||||
m_line_1->setStyleSheet(LINE_STYLE);
|
// m_line_1->setStyleSheet(LINE_STYLE);
|
||||||
m_line_2 = new QFrame(this);
|
// m_line_2 = new QFrame(this);
|
||||||
m_line_2->setFixedHeight(1);
|
// m_line_2->setFixedHeight(1);
|
||||||
m_line_2->setLineWidth(0);
|
// m_line_2->setLineWidth(0);
|
||||||
m_line_2->setStyleSheet(LINE_STYLE);
|
// m_line_2->setStyleSheet(LINE_STYLE);
|
||||||
|
|
||||||
m_descFrame = new QFrame(this);
|
// m_descFrame = new QFrame(this);
|
||||||
m_descFrameLyt = new QVBoxLayout(m_descFrame);
|
// m_descFrameLyt = new QVBoxLayout(m_descFrame);
|
||||||
m_descFrame->setLayout(m_descFrameLyt);
|
// m_descFrame->setLayout(m_descFrameLyt);
|
||||||
m_descFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
// m_descFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
||||||
|
|
||||||
m_actionFrame = new QFrame(this);
|
// m_actionFrame = new QFrame(this);
|
||||||
m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
// m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
||||||
m_actionFrame->setLayout(m_actionFrameLyt);
|
// m_actionFrame->setLayout(m_actionFrameLyt);
|
||||||
m_actionFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
// m_actionFrameLyt->setContentsMargins(DETAIL_FRAME_MARGINS);
|
||||||
|
|
||||||
m_mainLyt->addWidget(m_iconLabel);
|
// m_mainLyt->addWidget(m_iconLabel);
|
||||||
m_mainLyt->addWidget(m_previewFrame, 0, Qt::AlignHCenter);
|
// m_mainLyt->addWidget(m_previewFrame, 0, Qt::AlignHCenter);
|
||||||
m_mainLyt->addWidget(m_nameFrame);
|
// m_mainLyt->addWidget(m_nameFrame);
|
||||||
m_mainLyt->addWidget(m_line_1);
|
// m_mainLyt->addWidget(m_line_1);
|
||||||
m_mainLyt->addWidget(m_descFrame);
|
// m_mainLyt->addWidget(m_descFrame);
|
||||||
m_mainLyt->addWidget(m_line_2);
|
// m_mainLyt->addWidget(m_line_2);
|
||||||
m_mainLyt->addWidget(m_actionFrame);
|
// m_mainLyt->addWidget(m_actionFrame);
|
||||||
m_mainLyt->addStretch();
|
// m_mainLyt->addStretch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailWidget::paintEvent(QPaintEvent *event)
|
void DetailWidget::paintEvent(QPaintEvent *event)
|
||||||
|
@ -254,7 +286,7 @@ void DetailWidget::paintEvent(QPaintEvent * event)
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
|
||||||
QRect rect = this->rect();
|
QRect rect = this->rect().adjusted(0, 0, -8, 0);
|
||||||
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
p.setRenderHint(QPainter::Antialiasing); // 反锯齿;
|
||||||
p.setBrush(opt.palette.color(QPalette::Text));
|
p.setBrush(opt.palette.color(QPalette::Text));
|
||||||
p.setOpacity(DETAIL_WIDGET_TRANSPARENT);
|
p.setOpacity(DETAIL_WIDGET_TRANSPARENT);
|
||||||
|
@ -276,49 +308,49 @@ void DetailWidget::clearLayout(QLayout *layout)
|
||||||
child = NULL;
|
child = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionLabel::ActionLabel(const QString &action, const QString &key, const int &ActionKey, const QString &pluginId, const int type, QWidget *parent) : QLabel(parent)
|
//ActionLabel::ActionLabel(const QString &action, const QString &key, const int &ActionKey, const QString &pluginId, const int type, QWidget *parent) : QLabel(parent)
|
||||||
{
|
//{
|
||||||
m_action = action;
|
// m_action = action;
|
||||||
m_key = key;
|
// m_key = key;
|
||||||
m_actionKey = ActionKey;
|
// m_actionKey = ActionKey;
|
||||||
m_type = type;
|
// m_type = type;
|
||||||
m_pluginId = pluginId;
|
// m_pluginId = pluginId;
|
||||||
this->initUi();
|
// this->initUi();
|
||||||
this->installEventFilter(this);
|
// this->installEventFilter(this);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void ActionLabel::initUi()
|
//void ActionLabel::initUi()
|
||||||
{
|
//{
|
||||||
this->setText(m_action);
|
// this->setText(m_action);
|
||||||
QPalette pal = palette();
|
// QPalette pal = palette();
|
||||||
pal.setColor(QPalette::WindowText, ACTION_NORMAL_COLOR);
|
// pal.setColor(QPalette::WindowText, ACTION_NORMAL_COLOR);
|
||||||
pal.setColor(QPalette::Light, ACTION_HOVER_COLOR);
|
// pal.setColor(QPalette::Light, ACTION_HOVER_COLOR);
|
||||||
pal.setColor(QPalette::Dark, ACTION_PRESS_COLOR);
|
// pal.setColor(QPalette::Dark, ACTION_PRESS_COLOR);
|
||||||
this->setPalette(pal);
|
// this->setPalette(pal);
|
||||||
this->setForegroundRole(QPalette::WindowText);
|
// this->setForegroundRole(QPalette::WindowText);
|
||||||
this->setCursor(QCursor(Qt::PointingHandCursor));
|
// this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
}
|
//}
|
||||||
|
|
||||||
bool ActionLabel::eventFilter(QObject *watched, QEvent *event)
|
//bool ActionLabel::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
//{
|
||||||
if (watched == this) {
|
// if (watched == this) {
|
||||||
if(event->type() == QEvent::MouseButtonPress) {
|
// if(event->type() == QEvent::MouseButtonPress) {
|
||||||
this->setForegroundRole(QPalette::Dark);
|
// this->setForegroundRole(QPalette::Dark);
|
||||||
return true;
|
// return true;
|
||||||
} else if(event->type() == QEvent::MouseButtonRelease) {
|
// } else if(event->type() == QEvent::MouseButtonRelease) {
|
||||||
SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_pluginId);
|
// SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_pluginId);
|
||||||
if (plugin)
|
// if (plugin)
|
||||||
plugin->openAction(m_actionKey, m_key, m_type);
|
// plugin->openAction(m_actionKey, m_key, m_type);
|
||||||
else
|
// else
|
||||||
qWarning()<<"Get plugin failed!";
|
// qWarning()<<"Get plugin failed!";
|
||||||
this->setForegroundRole(QPalette::Light);
|
// this->setForegroundRole(QPalette::Light);
|
||||||
return true;
|
// return true;
|
||||||
} else if(event->type() == QEvent::Enter) {
|
// } else if(event->type() == QEvent::Enter) {
|
||||||
this->setForegroundRole(QPalette::Light);
|
// this->setForegroundRole(QPalette::Light);
|
||||||
return true;
|
// return true;
|
||||||
} else if(event->type() == QEvent::Leave) {
|
// } else if(event->type() == QEvent::Leave) {
|
||||||
this->setForegroundRole(QPalette::WindowText);
|
// this->setForegroundRole(QPalette::WindowText);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -62,26 +62,29 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setWidgetInfo(const QString&, const SearchPluginIface::ResultInfo&);
|
void setWidgetInfo(const QString &plugin_name, const SearchPluginIface::ResultInfo &info);
|
||||||
|
void updateDetailPage(const QString &plugin_name, const SearchPluginIface::ResultInfo &info);
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
private:
|
private:
|
||||||
void initUi();
|
void initUi();
|
||||||
void paintEvent(QPaintEvent *);
|
|
||||||
void clearLayout(QLayout *);
|
void clearLayout(QLayout *);
|
||||||
QVBoxLayout * m_mainLyt = nullptr;
|
QVBoxLayout * m_mainLyt = nullptr;
|
||||||
QLabel * m_iconLabel = nullptr;
|
QString m_currentPluginId;
|
||||||
QFrame *m_previewFrame = nullptr;
|
QWidget *m_detailPage = nullptr;
|
||||||
QHBoxLayout *m_previewFrameLyt = nullptr;
|
// QLabel * m_iconLabel = nullptr;
|
||||||
QFrame * m_nameFrame = nullptr;
|
// QFrame *m_previewFrame = nullptr;
|
||||||
QHBoxLayout * m_nameFrameLyt = nullptr;
|
// QHBoxLayout *m_previewFrameLyt = nullptr;
|
||||||
QLabel * m_nameLabel = nullptr;
|
// QFrame * m_nameFrame = nullptr;
|
||||||
QLabel * m_pluginLabel = nullptr;
|
// QHBoxLayout * m_nameFrameLyt = nullptr;
|
||||||
QFrame * m_line_1 = nullptr;
|
// QLabel * m_nameLabel = nullptr;
|
||||||
QFrame * m_descFrame = nullptr;
|
// QLabel * m_pluginLabel = nullptr;
|
||||||
QVBoxLayout * m_descFrameLyt = nullptr;
|
// QFrame * m_line_1 = nullptr;
|
||||||
QFrame * m_line_2 = nullptr;
|
// QFrame * m_descFrame = nullptr;
|
||||||
QFrame * m_actionFrame = nullptr;
|
// QVBoxLayout * m_descFrameLyt = nullptr;
|
||||||
QVBoxLayout * m_actionFrameLyt = nullptr;
|
// QFrame * m_line_2 = nullptr;
|
||||||
|
// QFrame * m_actionFrame = nullptr;
|
||||||
|
// QVBoxLayout * m_actionFrameLyt = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DetailArea : public QScrollArea
|
class DetailArea : public QScrollArea
|
||||||
|
@ -98,23 +101,23 @@ Q_SIGNALS:
|
||||||
void setWidgetInfo(const QString&, const SearchPluginIface::ResultInfo&);
|
void setWidgetInfo(const QString&, const SearchPluginIface::ResultInfo&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionLabel : public QLabel
|
//class ActionLabel : public QLabel
|
||||||
{
|
//{
|
||||||
Q_OBJECT
|
// Q_OBJECT
|
||||||
public:
|
//public:
|
||||||
ActionLabel(const QString &action, const QString &key, const int &ActionKey, const QString &pluginId, const int type = 0, QWidget *parent = nullptr);
|
// ActionLabel(const QString &action, const QString &key, const int &ActionKey, const QString &pluginId, const int type = 0, QWidget *parent = nullptr);
|
||||||
~ActionLabel() = default;
|
// ~ActionLabel() = default;
|
||||||
private:
|
//private:
|
||||||
void initUi();
|
// void initUi();
|
||||||
QString m_action;
|
// QString m_action;
|
||||||
QString m_key;
|
// QString m_key;
|
||||||
int m_actionKey;
|
// int m_actionKey;
|
||||||
int m_type = 0;
|
// int m_type = 0;
|
||||||
QString m_pluginId;
|
// QString m_pluginId;
|
||||||
|
|
||||||
protected:
|
//protected:
|
||||||
bool eventFilter(QObject *, QEvent *);
|
// bool eventFilter(QObject *, QEvent *);
|
||||||
};
|
//};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,8 @@ void SearchResultPage::initConnections()
|
||||||
{
|
{
|
||||||
connect(this, &SearchResultPage::startSearch, m_resultArea, &ResultArea::startSearch);
|
connect(this, &SearchResultPage::startSearch, m_resultArea, &ResultArea::startSearch);
|
||||||
connect(this, &SearchResultPage::stopSearch, m_resultArea, &ResultArea::stopSearch);
|
connect(this, &SearchResultPage::stopSearch, m_resultArea, &ResultArea::stopSearch);
|
||||||
|
connect(this, &SearchResultPage::startSearch, m_detailArea, &DetailArea::hide);
|
||||||
|
connect(this, &SearchResultPage::stopSearch, m_detailArea, &DetailArea::hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchResultPage::setupConnectionsForWidget(ResultWidget *widget)
|
void SearchResultPage::setupConnectionsForWidget(ResultWidget *widget)
|
||||||
|
|
|
@ -142,6 +142,8 @@ void ResultView::clearSelectedRow()
|
||||||
this->blockSignals(true);
|
this->blockSignals(true);
|
||||||
this->clearSelection();
|
this->clearSelection();
|
||||||
this->blockSignals(false);
|
this->blockSignals(false);
|
||||||
|
} else {
|
||||||
|
m_is_selected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +180,7 @@ void ResultView::onRowSelectedSlot(const QItemSelection &selected, const QItemSe
|
||||||
//NEW_TODO
|
//NEW_TODO
|
||||||
m_is_selected = true;
|
m_is_selected = true;
|
||||||
Q_EMIT this->currentRowChanged(m_plugin_id, m_model->getInfo(this->currentIndex()));
|
Q_EMIT this->currentRowChanged(m_plugin_id, m_model->getInfo(this->currentIndex()));
|
||||||
m_is_selected = false;
|
|
||||||
if(!selected.isEmpty()) {
|
if(!selected.isEmpty()) {
|
||||||
QRegion region = visualRegionForSelection(selected);
|
QRegion region = visualRegionForSelection(selected);
|
||||||
QRect rect = region.boundingRect();
|
QRect rect = region.boundingRect();
|
||||||
|
@ -240,7 +242,6 @@ void ResultView::initConnections()
|
||||||
{
|
{
|
||||||
// connect(this, &ResultView::startSearch, m_model, &SearchResultModel::startSearch);
|
// connect(this, &ResultView::startSearch, m_model, &SearchResultModel::startSearch);
|
||||||
connect(this, &ResultView::startSearch, [ = ](const QString &keyword) {
|
connect(this, &ResultView::startSearch, [ = ](const QString &keyword) {
|
||||||
qDebug() << "==========start search!";
|
|
||||||
m_style_delegate->setSearchKeyword(keyword);
|
m_style_delegate->setSearchKeyword(keyword);
|
||||||
m_model->startSearch(keyword);
|
m_model->startSearch(keyword);
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <gio/gdesktopappinfo.h>
|
#include <gio/gdesktopappinfo.h>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include "file-utils.h"
|
||||||
using namespace Zeeker;
|
using namespace Zeeker;
|
||||||
size_t AppSearchPlugin::uniqueSymbol = 0;
|
size_t AppSearchPlugin::uniqueSymbol = 0;
|
||||||
QMutex AppSearchPlugin::m_mutex;
|
QMutex AppSearchPlugin::m_mutex;
|
||||||
|
@ -16,6 +17,7 @@ AppSearchPlugin::AppSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
AppMatch::getAppMatch()->start();
|
AppMatch::getAppMatch()->start();
|
||||||
m_pool.setMaxThreadCount(2);
|
m_pool.setMaxThreadCount(2);
|
||||||
m_pool.setExpiryTimeout(1000);
|
m_pool.setExpiryTimeout(1000);
|
||||||
|
initDetailPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AppSearchPlugin::name()
|
const QString AppSearchPlugin::name()
|
||||||
|
@ -91,16 +93,126 @@ void AppSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppSearchPlugin::isPreviewEnable(QString key, int type)
|
QWidget *AppSearchPlugin::detailPage(const ResultInfo &ri)
|
||||||
{
|
{
|
||||||
return false;
|
m_currentActionKey = ri.actionKey;
|
||||||
|
m_iconLabel->setPixmap(ri.icon.pixmap(120, 120));
|
||||||
|
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
|
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 274); //当字体长度超过215时显示为省略号
|
||||||
|
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(FileUtils::escapeHtml(showname)));
|
||||||
|
if(QString::compare(showname, ri.name)) {
|
||||||
|
m_nameLabel->setToolTip(ri.name);
|
||||||
|
}
|
||||||
|
m_pluginLabel->setText(tr("Application"));
|
||||||
|
if(ri.type == 1) {
|
||||||
|
m_actionLabel1->hide();
|
||||||
|
m_actionLabel2->hide();
|
||||||
|
m_actionLabel3->hide();
|
||||||
|
m_actionLabel4->show();
|
||||||
|
QString showDesc = fontMetrics.elidedText(ri.description.at(0).key + " " + ri.description.at(0).value, Qt::ElideRight, 3114); //当字体长度超过215时显示为省略号
|
||||||
|
m_descLabel->setText(FileUtils::escapeHtml(showDesc));
|
||||||
|
m_descFrame->show();
|
||||||
|
m_line_2->show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
m_descFrame->hide();
|
||||||
|
m_line_2->hide();
|
||||||
|
m_actionLabel1->show();
|
||||||
|
m_actionLabel2->show();
|
||||||
|
m_actionLabel3->show();
|
||||||
|
m_actionLabel4->hide();
|
||||||
|
}
|
||||||
|
return m_detailPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *AppSearchPlugin::previewPage(QString key, int type, QWidget *parent = nullptr)
|
void AppSearchPlugin::initDetailPage()
|
||||||
{
|
{
|
||||||
return nullptr;
|
m_detailPage = new QWidget();
|
||||||
|
m_detailPage->setFixedWidth(360);
|
||||||
|
m_detailPage->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
m_detailLyt = new QVBoxLayout(m_detailPage);
|
||||||
|
m_detailLyt->setContentsMargins(8, 0, 16, 0);
|
||||||
|
m_iconLabel = new QLabel(m_detailPage);
|
||||||
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
m_iconLabel->setFixedHeight(128);
|
||||||
|
|
||||||
|
m_nameFrame = new QFrame(m_detailPage);
|
||||||
|
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
|
m_nameFrame->setLayout(m_nameFrameLyt);
|
||||||
|
m_nameFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_nameLabel = new QLabel(m_nameFrame);
|
||||||
|
m_nameLabel->setMaximumWidth(280);
|
||||||
|
m_pluginLabel = new QLabel(m_nameFrame);
|
||||||
|
m_pluginLabel->setEnabled(false);
|
||||||
|
m_nameFrameLyt->addWidget(m_nameLabel);
|
||||||
|
m_nameFrameLyt->addStretch();
|
||||||
|
m_nameFrameLyt->addWidget(m_pluginLabel);
|
||||||
|
|
||||||
|
m_line_1 = new QFrame(m_detailPage);
|
||||||
|
m_line_1->setLineWidth(0);
|
||||||
|
m_line_1->setFixedHeight(1);
|
||||||
|
m_line_1->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
m_descFrame = new QFrame(m_detailPage);
|
||||||
|
m_descFrameLyt = new QVBoxLayout(m_descFrame);
|
||||||
|
m_descLabel = new QLabel(m_descFrame);
|
||||||
|
m_descLabel->setTextFormat(Qt::PlainText);
|
||||||
|
m_descLabel->setWordWrap(true);
|
||||||
|
m_descFrameLyt->addWidget(m_descLabel);
|
||||||
|
m_descFrame->setLayout(m_descFrameLyt);
|
||||||
|
m_descFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_line_2 = new QFrame(m_detailPage);
|
||||||
|
m_line_2->setLineWidth(0);
|
||||||
|
m_line_2->setFixedHeight(1);
|
||||||
|
m_line_2->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_actionFrame = new QFrame(m_detailPage);
|
||||||
|
m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
||||||
|
m_actionFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_actionLabel1 = new ActionLabel(tr("Open"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel2 = new ActionLabel(tr("Add Shortcut to Desktop"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel3 = new ActionLabel(tr("Add Shortcut to Panel"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel4 = new ActionLabel(tr("Install"), m_currentActionKey, m_actionFrame);
|
||||||
|
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel1);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel2);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel3);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel4);
|
||||||
|
m_actionFrame->setLayout(m_actionFrameLyt);
|
||||||
|
|
||||||
|
m_detailLyt->addSpacing(50);
|
||||||
|
m_detailLyt->addWidget(m_iconLabel);
|
||||||
|
m_detailLyt->addWidget(m_nameFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_1);
|
||||||
|
m_detailLyt->addWidget(m_descFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_2);
|
||||||
|
m_detailLyt->addWidget(m_actionFrame);
|
||||||
|
m_detailPage->setLayout(m_detailLyt);
|
||||||
|
m_detailLyt->addStretch();
|
||||||
|
|
||||||
|
connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
launch(m_currentActionKey);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel2, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
addDesktopShortcut(m_currentActionKey);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel3, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
addPanelShortcut(m_currentActionKey);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel4, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
installAppAction(m_currentActionKey);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bool AppSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
//{
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//QWidget *AppSearchPlugin::previewPage(QString key, int type, QWidget *parent = nullptr)
|
||||||
|
//{
|
||||||
|
// return nullptr;
|
||||||
|
//}
|
||||||
|
|
||||||
bool AppSearchPlugin::launch(const QString &path)
|
bool AppSearchPlugin::launch(const QString &path)
|
||||||
{
|
{
|
||||||
GDesktopAppInfo * desktopAppInfo = g_desktop_app_info_new_from_filename(path.toLocal8Bit().data());
|
GDesktopAppInfo * desktopAppInfo = g_desktop_app_info_new_from_filename(path.toLocal8Bit().data());
|
||||||
|
|
|
@ -2,8 +2,15 @@
|
||||||
#define APPSEARCHPLUGIN_H
|
#define APPSEARCHPLUGIN_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QAction>
|
||||||
#include "search-plugin-iface.h"
|
#include "search-plugin-iface.h"
|
||||||
#include "app-match.h"
|
#include "app-match.h"
|
||||||
|
#include "action-label.h"
|
||||||
#include "libsearch_global.h"
|
#include "libsearch_global.h"
|
||||||
namespace Zeeker {
|
namespace Zeeker {
|
||||||
class LIBSEARCH_EXPORT AppSearchPlugin : public QObject, public SearchPluginIface
|
class LIBSEARCH_EXPORT AppSearchPlugin : public QObject, public SearchPluginIface
|
||||||
|
@ -23,9 +30,11 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type);
|
void openAction(int actionkey, QString key, int type);
|
||||||
bool isPreviewEnable(QString key, int type);
|
// bool isPreviewEnable(QString key, int type);
|
||||||
QWidget *previewPage(QString key, int type, QWidget *parent);
|
// QWidget *previewPage(QString key, int type, QWidget *parent);
|
||||||
|
QWidget *detailPage(const ResultInfo &ri);
|
||||||
private:
|
private:
|
||||||
|
void initDetailPage();
|
||||||
bool launch(const QString &path);
|
bool launch(const QString &path);
|
||||||
bool addPanelShortcut(const QString &path);
|
bool addPanelShortcut(const QString &path);
|
||||||
bool addDesktopShortcut(const QString &path);
|
bool addDesktopShortcut(const QString &path);
|
||||||
|
@ -36,6 +45,28 @@ private:
|
||||||
QThreadPool m_pool;
|
QThreadPool m_pool;
|
||||||
static size_t uniqueSymbol;
|
static size_t uniqueSymbol;
|
||||||
static QMutex m_mutex;
|
static QMutex m_mutex;
|
||||||
|
|
||||||
|
QString m_currentActionKey;
|
||||||
|
QWidget *m_detailPage;
|
||||||
|
QVBoxLayout *m_detailLyt = nullptr;
|
||||||
|
QLabel *m_iconLabel = nullptr;
|
||||||
|
QFrame *m_nameFrame = nullptr;
|
||||||
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
||||||
|
QLabel *m_nameLabel = nullptr;
|
||||||
|
QLabel *m_pluginLabel = nullptr;
|
||||||
|
QFrame *m_line_1 = nullptr;
|
||||||
|
QFrame *m_descFrame = nullptr;
|
||||||
|
QLabel *m_descLabel = nullptr;
|
||||||
|
QVBoxLayout *m_descFrameLyt = nullptr;
|
||||||
|
QFrame *m_line_2 = nullptr;
|
||||||
|
QFrame *m_actionFrame = nullptr;
|
||||||
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
||||||
|
ActionLabel *m_actionLabel1 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel2 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel3 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel4 = nullptr;
|
||||||
|
|
||||||
|
QVBoxLayout * m_actionLyt = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AppSearch : public QObject, public QRunnable {
|
class AppSearch : public QObject, public QRunnable {
|
||||||
|
|
|
@ -788,3 +788,11 @@ bool FileUtils::copyPath(QString &path)
|
||||||
QApplication::clipboard()->setText(path);
|
QApplication::clipboard()->setText(path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FileUtils::escapeHtml(const QString &str)
|
||||||
|
{
|
||||||
|
QString temp = str;
|
||||||
|
temp.replace("<", "<");
|
||||||
|
temp.replace(">", ">");
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
|
|
||||||
static bool openFile(QString &path, bool openInDir = false);
|
static bool openFile(QString &path, bool openInDir = false);
|
||||||
static bool copyPath(QString &path);
|
static bool copyPath(QString &path);
|
||||||
|
static QString escapeHtml(const QString & str);
|
||||||
static size_t _max_index_count;
|
static size_t _max_index_count;
|
||||||
static size_t _current_index_count; //this one has been Abandoned,do not use it.
|
static size_t _current_index_count; //this one has been Abandoned,do not use it.
|
||||||
static unsigned short _index_status;
|
static unsigned short _index_status;
|
||||||
|
|
|
@ -13,6 +13,7 @@ FileSearchPlugin::FileSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
m_actionInfo << open << Openpath << CopyPath;
|
m_actionInfo << open << Openpath << CopyPath;
|
||||||
m_pool.setMaxThreadCount(2);
|
m_pool.setMaxThreadCount(2);
|
||||||
m_pool.setExpiryTimeout(1000);
|
m_pool.setExpiryTimeout(1000);
|
||||||
|
initDetailPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString FileSearchPlugin::name()
|
const QString FileSearchPlugin::name()
|
||||||
|
@ -68,25 +69,131 @@ void FileSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileSearchPlugin::isPreviewEnable(QString key, int type)
|
QWidget *FileSearchPlugin::detailPage(const ResultInfo &ri)
|
||||||
{
|
{
|
||||||
return true;
|
m_currentActionKey = ri.actionKey;
|
||||||
|
m_iconLabel->setPixmap(ri.icon.pixmap(120, 120));
|
||||||
|
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
|
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 274); //当字体长度超过215时显示为省略号
|
||||||
|
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(FileUtils::escapeHtml(showname)));
|
||||||
|
if(QString::compare(showname, ri.name)) {
|
||||||
|
m_nameLabel->setToolTip(ri.name);
|
||||||
|
}
|
||||||
|
m_pluginLabel->setText(tr("File"));
|
||||||
|
|
||||||
|
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));
|
||||||
|
m_pathLabel2->setToolTip(m_currentActionKey);
|
||||||
|
m_timeLabel2->setText(ri.description.at(1).value);
|
||||||
|
return m_detailPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *FileSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
void FileSearchPlugin::initDetailPage()
|
||||||
{
|
{
|
||||||
QWidget *previewPage = new QWidget(parent);
|
m_detailPage = new QWidget();
|
||||||
QHBoxLayout * previewLyt = new QHBoxLayout(previewPage);
|
m_detailPage->setFixedWidth(360);
|
||||||
previewLyt->setContentsMargins(0, 0, 0, 0);
|
m_detailPage->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
QLabel *label = new QLabel(previewPage);
|
m_detailLyt = new QVBoxLayout(m_detailPage);
|
||||||
previewLyt->addWidget(label);
|
m_detailLyt->setContentsMargins(8, 0, 16, 0);
|
||||||
label->setFixedHeight(120);
|
m_iconLabel = new QLabel(m_detailPage);
|
||||||
previewPage->setFixedSize(120,120);
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
previewLyt->setAlignment(Qt::AlignCenter);
|
m_iconLabel->setFixedHeight(128);
|
||||||
label->setPixmap(FileUtils::getFileIcon(QUrl::fromLocalFile(key).toString()).pixmap(120,120));
|
|
||||||
return previewPage;
|
m_nameFrame = new QFrame(m_detailPage);
|
||||||
|
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
|
m_nameFrame->setLayout(m_nameFrameLyt);
|
||||||
|
m_nameFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_nameLabel = new QLabel(m_nameFrame);
|
||||||
|
m_nameLabel->setMaximumWidth(280);
|
||||||
|
m_pluginLabel = new QLabel(m_nameFrame);
|
||||||
|
m_pluginLabel->setEnabled(false);
|
||||||
|
m_nameFrameLyt->addWidget(m_nameLabel);
|
||||||
|
m_nameFrameLyt->addStretch();
|
||||||
|
m_nameFrameLyt->addWidget(m_pluginLabel);
|
||||||
|
|
||||||
|
m_line_1 = new QFrame(m_detailPage);
|
||||||
|
m_line_1->setLineWidth(0);
|
||||||
|
m_line_1->setFixedHeight(1);
|
||||||
|
m_line_1->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_pathFrame = new QFrame(m_detailPage);
|
||||||
|
m_pathFrameLyt = new QHBoxLayout(m_pathFrame);
|
||||||
|
m_pathLabel1 = new QLabel(m_pathFrame);
|
||||||
|
m_pathLabel2 = new QLabel(m_pathFrame);
|
||||||
|
m_pathLabel1->setText(tr("Path"));
|
||||||
|
m_pathLabel2->setFixedWidth(240);
|
||||||
|
m_pathLabel2->setAlignment(Qt::AlignRight);
|
||||||
|
m_pathFrameLyt->addWidget(m_pathLabel1);
|
||||||
|
m_pathFrameLyt->addStretch();
|
||||||
|
m_pathFrameLyt->addWidget(m_pathLabel2);
|
||||||
|
|
||||||
|
m_timeFrame = new QFrame(m_detailPage);
|
||||||
|
m_timeFrameLyt = new QHBoxLayout(m_timeFrame);
|
||||||
|
m_timeLabel1 = new QLabel(m_timeFrame);
|
||||||
|
m_timeLabel2 = new QLabel(m_timeFrame);
|
||||||
|
m_timeLabel2->setAlignment(Qt::AlignRight);
|
||||||
|
m_timeLabel1->setText(tr("Last time modified"));
|
||||||
|
m_timeFrameLyt->addWidget(m_timeLabel1);
|
||||||
|
m_timeFrameLyt->addStretch();
|
||||||
|
m_timeFrameLyt->addWidget(m_timeLabel2);
|
||||||
|
|
||||||
|
m_line_2 = new QFrame(m_detailPage);
|
||||||
|
m_line_2->setLineWidth(0);
|
||||||
|
m_line_2->setFixedHeight(1);
|
||||||
|
m_line_2->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_actionFrame = new QFrame(m_detailPage);
|
||||||
|
m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
||||||
|
m_actionFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_actionLabel1 = new ActionLabel(tr("Open"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel2 = new ActionLabel(tr("Open path"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel3 = new ActionLabel(tr("Copy path"), m_currentActionKey, m_actionFrame);
|
||||||
|
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel1);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel2);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel3);
|
||||||
|
m_actionFrame->setLayout(m_actionFrameLyt);
|
||||||
|
|
||||||
|
m_detailLyt->addSpacing(50);
|
||||||
|
m_detailLyt->addWidget(m_iconLabel);
|
||||||
|
m_detailLyt->addWidget(m_nameFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_1);
|
||||||
|
m_detailLyt->addWidget(m_pathFrame);
|
||||||
|
m_detailLyt->addWidget(m_timeFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_2);
|
||||||
|
m_detailLyt->addWidget(m_actionFrame);
|
||||||
|
m_detailPage->setLayout(m_detailLyt);
|
||||||
|
m_detailLyt->addStretch();
|
||||||
|
|
||||||
|
connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::openFile(m_currentActionKey);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel2, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::openFile(m_currentActionKey, true);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel3, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::copyPath(m_currentActionKey);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bool FileSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
//{
|
||||||
|
// return true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//QWidget *FileSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
||||||
|
//{
|
||||||
|
// QWidget *previewPage = new QWidget(parent);
|
||||||
|
// QHBoxLayout * previewLyt = new QHBoxLayout(previewPage);
|
||||||
|
// previewLyt->setContentsMargins(0, 0, 0, 0);
|
||||||
|
// QLabel *label = new QLabel(previewPage);
|
||||||
|
// previewLyt->addWidget(label);
|
||||||
|
// label->setFixedHeight(120);
|
||||||
|
// previewPage->setFixedSize(120,120);
|
||||||
|
// previewLyt->setAlignment(Qt::AlignCenter);
|
||||||
|
// label->setPixmap(FileUtils::getFileIcon(QUrl::fromLocalFile(key).toString()).pixmap(120,120));
|
||||||
|
// return previewPage;
|
||||||
|
//}
|
||||||
|
|
||||||
DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent)
|
DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
||||||
|
@ -95,6 +202,7 @@ DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
m_actionInfo << open << Openpath << CopyPath;
|
m_actionInfo << open << Openpath << CopyPath;
|
||||||
m_pool.setMaxThreadCount(2);
|
m_pool.setMaxThreadCount(2);
|
||||||
m_pool.setExpiryTimeout(1000);
|
m_pool.setExpiryTimeout(1000);
|
||||||
|
initDetailPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString DirSearchPlugin::name()
|
const QString DirSearchPlugin::name()
|
||||||
|
@ -150,16 +258,122 @@ void DirSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DirSearchPlugin::isPreviewEnable(QString key, int type)
|
QWidget *DirSearchPlugin::detailPage(const ResultInfo &ri)
|
||||||
{
|
{
|
||||||
return false;
|
m_currentActionKey = ri.actionKey;
|
||||||
|
m_iconLabel->setPixmap(ri.icon.pixmap(120, 120));
|
||||||
|
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
|
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 274); //当字体长度超过215时显示为省略号
|
||||||
|
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(FileUtils::escapeHtml(showname)));
|
||||||
|
if(QString::compare(showname, ri.name)) {
|
||||||
|
m_nameLabel->setToolTip(ri.name);
|
||||||
|
}
|
||||||
|
m_pluginLabel->setText(tr("directory"));
|
||||||
|
|
||||||
|
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));
|
||||||
|
m_pathLabel2->setToolTip(m_currentActionKey);
|
||||||
|
m_timeLabel2->setText(ri.description.at(1).value);
|
||||||
|
return m_detailPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *DirSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
void DirSearchPlugin::initDetailPage()
|
||||||
{
|
{
|
||||||
return nullptr;
|
m_detailPage = new QWidget();
|
||||||
|
m_detailPage->setFixedWidth(360);
|
||||||
|
m_detailPage->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
m_detailLyt = new QVBoxLayout(m_detailPage);
|
||||||
|
m_detailLyt->setContentsMargins(8, 0, 16, 0);
|
||||||
|
m_iconLabel = new QLabel(m_detailPage);
|
||||||
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
m_iconLabel->setFixedHeight(128);
|
||||||
|
|
||||||
|
m_nameFrame = new QFrame(m_detailPage);
|
||||||
|
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
|
m_nameFrame->setLayout(m_nameFrameLyt);
|
||||||
|
m_nameFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_nameLabel = new QLabel(m_nameFrame);
|
||||||
|
m_nameLabel->setMaximumWidth(280);
|
||||||
|
m_pluginLabel = new QLabel(m_nameFrame);
|
||||||
|
m_pluginLabel->setEnabled(false);
|
||||||
|
m_nameFrameLyt->addWidget(m_nameLabel);
|
||||||
|
m_nameFrameLyt->addStretch();
|
||||||
|
m_nameFrameLyt->addWidget(m_pluginLabel);
|
||||||
|
|
||||||
|
m_line_1 = new QFrame(m_detailPage);
|
||||||
|
m_line_1->setLineWidth(0);
|
||||||
|
m_line_1->setFixedHeight(1);
|
||||||
|
m_line_1->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_pathFrame = new QFrame(m_detailPage);
|
||||||
|
m_pathFrameLyt = new QHBoxLayout(m_pathFrame);
|
||||||
|
m_pathLabel1 = new QLabel(m_pathFrame);
|
||||||
|
m_pathLabel2 = new QLabel(m_pathFrame);
|
||||||
|
m_pathLabel1->setText(tr("Path"));
|
||||||
|
m_pathLabel2->setFixedWidth(240);
|
||||||
|
m_pathLabel2->setAlignment(Qt::AlignRight);
|
||||||
|
m_pathFrameLyt->addWidget(m_pathLabel1);
|
||||||
|
m_pathFrameLyt->addStretch();
|
||||||
|
m_pathFrameLyt->addWidget(m_pathLabel2);
|
||||||
|
|
||||||
|
m_timeFrame = new QFrame(m_detailPage);
|
||||||
|
m_timeFrameLyt = new QHBoxLayout(m_timeFrame);
|
||||||
|
m_timeLabel1 = new QLabel(m_timeFrame);
|
||||||
|
m_timeLabel2 = new QLabel(m_timeFrame);
|
||||||
|
m_timeLabel2->setAlignment(Qt::AlignRight);
|
||||||
|
m_timeLabel1->setText(tr("Last time modified"));
|
||||||
|
m_timeFrameLyt->addWidget(m_timeLabel1);
|
||||||
|
m_timeFrameLyt->addStretch();
|
||||||
|
m_timeFrameLyt->addWidget(m_timeLabel2);
|
||||||
|
|
||||||
|
m_line_2 = new QFrame(m_detailPage);
|
||||||
|
m_line_2->setLineWidth(0);
|
||||||
|
m_line_2->setFixedHeight(1);
|
||||||
|
m_line_2->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_actionFrame = new QFrame(m_detailPage);
|
||||||
|
m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
||||||
|
m_actionFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_actionLabel1 = new ActionLabel(tr("Open"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel2 = new ActionLabel(tr("Open path"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel3 = new ActionLabel(tr("Copy path"), m_currentActionKey, m_actionFrame);
|
||||||
|
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel1);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel2);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel3);
|
||||||
|
m_actionFrame->setLayout(m_actionFrameLyt);
|
||||||
|
|
||||||
|
m_detailLyt->addSpacing(50);
|
||||||
|
m_detailLyt->addWidget(m_iconLabel);
|
||||||
|
m_detailLyt->addWidget(m_nameFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_1);
|
||||||
|
m_detailLyt->addWidget(m_pathFrame);
|
||||||
|
m_detailLyt->addWidget(m_timeFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_2);
|
||||||
|
m_detailLyt->addWidget(m_actionFrame);
|
||||||
|
m_detailPage->setLayout(m_detailLyt);
|
||||||
|
m_detailLyt->addStretch();
|
||||||
|
|
||||||
|
connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::openFile(m_currentActionKey);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel2, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::openFile(m_currentActionKey, true);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel3, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::copyPath(m_currentActionKey);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bool DirSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
//{
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//QWidget *DirSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
||||||
|
//{
|
||||||
|
// return nullptr;
|
||||||
|
//}
|
||||||
|
|
||||||
FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(parent)
|
FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
SearchPluginIface::Actioninfo open { 0, tr("Open")};
|
||||||
|
@ -168,6 +382,7 @@ FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(pare
|
||||||
m_actionInfo << open << Openpath << CopyPath;
|
m_actionInfo << open << Openpath << CopyPath;
|
||||||
m_pool.setMaxThreadCount(2);
|
m_pool.setMaxThreadCount(2);
|
||||||
m_pool.setExpiryTimeout(1000);
|
m_pool.setExpiryTimeout(1000);
|
||||||
|
initDetailPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString FileContengSearchPlugin::name()
|
const QString FileContengSearchPlugin::name()
|
||||||
|
@ -191,6 +406,7 @@ void Zeeker::FileContengSearchPlugin::KeywordSearch(QString keyword, DataQueue<R
|
||||||
++SearchManager::uniqueSymbol3;
|
++SearchManager::uniqueSymbol3;
|
||||||
SearchManager::m_mutex3.unlock();
|
SearchManager::m_mutex3.unlock();
|
||||||
|
|
||||||
|
m_keyWord = keyword;
|
||||||
if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) {
|
if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) {
|
||||||
return;
|
return;
|
||||||
} else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) {
|
} else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) {
|
||||||
|
@ -221,12 +437,148 @@ void FileContengSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileContengSearchPlugin::isPreviewEnable(QString key, int type)
|
QWidget *FileContengSearchPlugin::detailPage(const ResultInfo &ri)
|
||||||
{
|
{
|
||||||
return false;
|
m_currentActionKey = ri.actionKey;
|
||||||
|
m_iconLabel->setPixmap(ri.icon.pixmap(120, 120));
|
||||||
|
|
||||||
|
m_pluginLabel->setText(tr("File"));
|
||||||
|
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
|
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 215); //当字体长度超过215时显示为省略号
|
||||||
|
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(FileUtils::escapeHtml(showname)));
|
||||||
|
if(QString::compare(showname, ri.name)) {
|
||||||
|
m_nameLabel->setToolTip(ri.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *FileContengSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
m_snippetLabel->setText(getHtmlText(ri.description.at(0).value, m_keyWord));
|
||||||
{
|
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));
|
||||||
return nullptr;
|
m_pathLabel2->setToolTip(m_currentActionKey);
|
||||||
|
m_timeLabel2->setText(ri.description.at(2).value);
|
||||||
|
return m_detailPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FileContengSearchPlugin::getHtmlText(const QString &text, const QString &keyword)
|
||||||
|
{
|
||||||
|
QString htmlString;
|
||||||
|
bool boldOpenned = false;
|
||||||
|
for(int i = 0; i < text.length(); i++) {
|
||||||
|
if((keyword.toUpper()).contains(QString(text.at(i)).toUpper())) {
|
||||||
|
if(! boldOpenned) {
|
||||||
|
boldOpenned = true;
|
||||||
|
htmlString.append(QString("<b><font size=\"4\">"));
|
||||||
|
}
|
||||||
|
htmlString.append(FileUtils::escapeHtml(QString(text.at(i))));
|
||||||
|
} else {
|
||||||
|
if(boldOpenned) {
|
||||||
|
boldOpenned = false;
|
||||||
|
htmlString.append(QString("</font></b>"));
|
||||||
|
}
|
||||||
|
htmlString.append(FileUtils::escapeHtml(QString(text.at(i))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
htmlString.replace("\n", "<br />");//替换换行符
|
||||||
|
return htmlString;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileContengSearchPlugin::initDetailPage()
|
||||||
|
{
|
||||||
|
m_detailPage = new QWidget();
|
||||||
|
m_detailPage->setFixedWidth(360);
|
||||||
|
m_detailPage->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
m_detailLyt = new QVBoxLayout(m_detailPage);
|
||||||
|
m_detailLyt->setContentsMargins(8, 0, 16, 0);
|
||||||
|
m_iconLabel = new QLabel(m_detailPage);
|
||||||
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
m_iconLabel->setFixedHeight(128);
|
||||||
|
|
||||||
|
m_nameFrame = new QFrame(m_detailPage);
|
||||||
|
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
|
m_nameFrame->setLayout(m_nameFrameLyt);
|
||||||
|
m_nameFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_nameLabel = new QLabel(m_nameFrame);
|
||||||
|
m_nameLabel->setMaximumWidth(280);
|
||||||
|
m_pluginLabel = new QLabel(m_nameFrame);
|
||||||
|
m_pluginLabel->setEnabled(false);
|
||||||
|
m_nameFrameLyt->addWidget(m_nameLabel);
|
||||||
|
m_nameFrameLyt->addStretch();
|
||||||
|
m_nameFrameLyt->addWidget(m_pluginLabel);
|
||||||
|
|
||||||
|
m_line_1 = new QFrame(m_detailPage);
|
||||||
|
m_line_1->setLineWidth(0);
|
||||||
|
m_line_1->setFixedHeight(1);
|
||||||
|
m_line_1->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_snippetLabel = new QLabel(m_detailPage);
|
||||||
|
m_snippetLabel->setWordWrap(true);
|
||||||
|
m_snippetLabel->setContentsMargins(8, 0, 8, 0);
|
||||||
|
|
||||||
|
m_pathFrame = new QFrame(m_detailPage);
|
||||||
|
m_pathFrameLyt = new QHBoxLayout(m_pathFrame);
|
||||||
|
m_pathLabel1 = new QLabel(m_pathFrame);
|
||||||
|
m_pathLabel2 = new QLabel(m_pathFrame);
|
||||||
|
m_pathLabel1->setText(tr("Path"));
|
||||||
|
m_pathLabel2->setFixedWidth(240);
|
||||||
|
m_pathLabel2->setAlignment(Qt::AlignRight);
|
||||||
|
m_pathFrameLyt->addWidget(m_pathLabel1);
|
||||||
|
m_pathFrameLyt->addStretch();
|
||||||
|
m_pathFrameLyt->addWidget(m_pathLabel2);
|
||||||
|
|
||||||
|
m_timeFrame = new QFrame(m_detailPage);
|
||||||
|
m_timeFrameLyt = new QHBoxLayout(m_timeFrame);
|
||||||
|
m_timeLabel1 = new QLabel(m_timeFrame);
|
||||||
|
m_timeLabel2 = new QLabel(m_timeFrame);
|
||||||
|
m_timeLabel2->setAlignment(Qt::AlignRight);
|
||||||
|
m_timeLabel1->setText(tr("Last time modified"));
|
||||||
|
m_timeFrameLyt->addWidget(m_timeLabel1);
|
||||||
|
m_timeFrameLyt->addStretch();
|
||||||
|
m_timeFrameLyt->addWidget(m_timeLabel2);
|
||||||
|
|
||||||
|
m_line_2 = new QFrame(m_detailPage);
|
||||||
|
m_line_2->setLineWidth(0);
|
||||||
|
m_line_2->setFixedHeight(1);
|
||||||
|
m_line_2->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_actionFrame = new QFrame(m_detailPage);
|
||||||
|
m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
||||||
|
m_actionFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_actionLabel1 = new ActionLabel(tr("Open"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel2 = new ActionLabel(tr("Open path"), m_currentActionKey, m_actionFrame);
|
||||||
|
m_actionLabel3 = new ActionLabel(tr("Copy path"), m_currentActionKey, m_actionFrame);
|
||||||
|
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel1);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel2);
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel3);
|
||||||
|
m_actionFrame->setLayout(m_actionFrameLyt);
|
||||||
|
|
||||||
|
m_detailLyt->addSpacing(50);
|
||||||
|
m_detailLyt->addWidget(m_iconLabel);
|
||||||
|
m_detailLyt->addWidget(m_nameFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_1);
|
||||||
|
m_detailLyt->addWidget(m_snippetLabel);
|
||||||
|
m_detailLyt->addWidget(m_pathFrame);
|
||||||
|
m_detailLyt->addWidget(m_timeFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_2);
|
||||||
|
m_detailLyt->addWidget(m_actionFrame);
|
||||||
|
m_detailPage->setLayout(m_detailLyt);
|
||||||
|
m_detailLyt->addStretch();
|
||||||
|
|
||||||
|
connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::openFile(m_currentActionKey);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel2, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::openFile(m_currentActionKey, true);
|
||||||
|
});
|
||||||
|
connect(m_actionLabel3, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
FileUtils::copyPath(m_currentActionKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool FileContengSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
|
//{
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//QWidget *FileContengSearchPlugin::previewPage(QString key, int type, QWidget *parent)
|
||||||
|
//{
|
||||||
|
// return nullptr;
|
||||||
|
//}
|
||||||
|
|
|
@ -3,10 +3,17 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
#include "libsearch_global.h"
|
#include "libsearch_global.h"
|
||||||
#include "search-plugin-iface.h"
|
#include "search-plugin-iface.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "action-label.h"
|
||||||
namespace Zeeker {
|
namespace Zeeker {
|
||||||
//internal plugin
|
//internal plugin
|
||||||
class LIBSEARCH_EXPORT FileSearchPlugin : public QObject, public SearchPluginIface
|
class LIBSEARCH_EXPORT FileSearchPlugin : public QObject, public SearchPluginIface
|
||||||
|
@ -25,10 +32,39 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type = 0);
|
void openAction(int actionkey, QString key, int type = 0);
|
||||||
bool isPreviewEnable(QString key, int type);
|
// bool isPreviewEnable(QString key, int type);
|
||||||
QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
// QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
||||||
|
QWidget *detailPage(const ResultInfo &ri);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initDetailPage();
|
||||||
|
QString m_currentActionKey;
|
||||||
|
QWidget *m_detailPage;
|
||||||
|
QVBoxLayout *m_detailLyt = nullptr;
|
||||||
|
QLabel *m_iconLabel = nullptr;
|
||||||
|
QFrame *m_nameFrame = nullptr;
|
||||||
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
||||||
|
QLabel *m_nameLabel = nullptr;
|
||||||
|
QLabel *m_pluginLabel = nullptr;
|
||||||
|
QFrame *m_line_1 = nullptr;
|
||||||
|
QFrame *m_pathFrame = nullptr;
|
||||||
|
QLabel *m_pathLabel1 = nullptr;
|
||||||
|
QLabel *m_pathLabel2 = nullptr;
|
||||||
|
QHBoxLayout *m_pathFrameLyt = nullptr;
|
||||||
|
QFrame *m_timeFrame = nullptr;
|
||||||
|
QLabel *m_timeLabel1 = nullptr;
|
||||||
|
QLabel *m_timeLabel2 = nullptr;
|
||||||
|
QHBoxLayout *m_timeFrameLyt = nullptr;
|
||||||
|
|
||||||
|
QFrame *m_line_2 = nullptr;
|
||||||
|
QFrame *m_actionFrame = nullptr;
|
||||||
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
||||||
|
ActionLabel *m_actionLabel1 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel2 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel3 = nullptr;
|
||||||
|
|
||||||
|
QVBoxLayout * m_actionLyt = nullptr;
|
||||||
|
|
||||||
bool m_enable = true;
|
bool m_enable = true;
|
||||||
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
||||||
QThreadPool m_pool;
|
QThreadPool m_pool;
|
||||||
|
@ -50,9 +86,38 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type = 0);
|
void openAction(int actionkey, QString key, int type = 0);
|
||||||
bool isPreviewEnable(QString key, int type);
|
// bool isPreviewEnable(QString key, int type);
|
||||||
QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
// QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
||||||
|
QWidget *detailPage(const ResultInfo &ri);
|
||||||
private:
|
private:
|
||||||
|
void initDetailPage();
|
||||||
|
QWidget *m_detailPage = nullptr;
|
||||||
|
QString m_currentActionKey;
|
||||||
|
QVBoxLayout *m_detailLyt = nullptr;
|
||||||
|
QLabel *m_iconLabel = nullptr;
|
||||||
|
QFrame *m_nameFrame = nullptr;
|
||||||
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
||||||
|
QLabel *m_nameLabel = nullptr;
|
||||||
|
QLabel *m_pluginLabel = nullptr;
|
||||||
|
QFrame *m_line_1 = nullptr;
|
||||||
|
QFrame *m_pathFrame = nullptr;
|
||||||
|
QLabel *m_pathLabel1 = nullptr;
|
||||||
|
QLabel *m_pathLabel2 = nullptr;
|
||||||
|
QHBoxLayout *m_pathFrameLyt = nullptr;
|
||||||
|
QFrame *m_timeFrame = nullptr;
|
||||||
|
QLabel *m_timeLabel1 = nullptr;
|
||||||
|
QLabel *m_timeLabel2 = nullptr;
|
||||||
|
QHBoxLayout *m_timeFrameLyt = nullptr;
|
||||||
|
|
||||||
|
QFrame *m_line_2 = nullptr;
|
||||||
|
QFrame *m_actionFrame = nullptr;
|
||||||
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
||||||
|
ActionLabel *m_actionLabel1 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel2 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel3 = nullptr;
|
||||||
|
|
||||||
|
QVBoxLayout * m_actionLyt = nullptr;
|
||||||
|
|
||||||
bool m_enable = true;
|
bool m_enable = true;
|
||||||
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
||||||
QThreadPool m_pool;
|
QThreadPool m_pool;
|
||||||
|
@ -74,9 +139,40 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type = 0);
|
void openAction(int actionkey, QString key, int type = 0);
|
||||||
bool isPreviewEnable(QString key, int type);
|
// bool isPreviewEnable(QString key, int type);
|
||||||
QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
// QWidget *previewPage(QString key, int type, QWidget *parent = nullptr);
|
||||||
|
QWidget *detailPage(const ResultInfo &ri);
|
||||||
|
QString getHtmlText(const QString & text, const QString & keyword);
|
||||||
private:
|
private:
|
||||||
|
void initDetailPage();
|
||||||
|
QWidget *m_detailPage = nullptr;
|
||||||
|
QString m_currentActionKey;
|
||||||
|
QVBoxLayout *m_detailLyt = nullptr;
|
||||||
|
QLabel *m_iconLabel = nullptr;
|
||||||
|
QFrame *m_nameFrame = nullptr;
|
||||||
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
||||||
|
QLabel *m_nameLabel = nullptr;
|
||||||
|
QLabel *m_pluginLabel = nullptr;
|
||||||
|
QFrame *m_line_1 = nullptr;
|
||||||
|
QLabel *m_snippetLabel = nullptr;
|
||||||
|
QFrame *m_pathFrame = nullptr;
|
||||||
|
QLabel *m_pathLabel1 = nullptr;
|
||||||
|
QLabel *m_pathLabel2 = nullptr;
|
||||||
|
QHBoxLayout *m_pathFrameLyt = nullptr;
|
||||||
|
QFrame *m_timeFrame = nullptr;
|
||||||
|
QLabel *m_timeLabel1 = nullptr;
|
||||||
|
QLabel *m_timeLabel2 = nullptr;
|
||||||
|
QHBoxLayout *m_timeFrameLyt = nullptr;
|
||||||
|
|
||||||
|
QFrame *m_line_2 = nullptr;
|
||||||
|
QFrame *m_actionFrame = nullptr;
|
||||||
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
||||||
|
ActionLabel *m_actionLabel1 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel2 = nullptr;
|
||||||
|
ActionLabel *m_actionLabel3 = nullptr;
|
||||||
|
|
||||||
|
QVBoxLayout * m_actionLyt = nullptr;
|
||||||
|
QString m_keyWord;
|
||||||
bool m_enable = true;
|
bool m_enable = true;
|
||||||
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
QList<SearchPluginIface::Actioninfo> m_actionInfo;
|
||||||
QThreadPool m_pool;
|
QThreadPool m_pool;
|
||||||
|
|
|
@ -347,21 +347,35 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord) {
|
||||||
std::string wordTobeFound = QString::fromStdString(keyWord).section(" ", 0, 0).toStdString();
|
std::string wordTobeFound = QString::fromStdString(keyWord).section(" ", 0, 0).toStdString();
|
||||||
int size = wordTobeFound.length();
|
int size = wordTobeFound.length();
|
||||||
term.skip_to(wordTobeFound);
|
term.skip_to(wordTobeFound);
|
||||||
int count = 0;
|
// int count = 0;
|
||||||
for(auto pos = term.positionlist_begin(); pos != term.positionlist_end() && count < 6; ++pos) {
|
// for(auto pos = term.positionlist_begin(); pos != term.positionlist_end() && count < 6; ++pos) {
|
||||||
std::string s = data.substr((*pos < 60) ? 0 : (*pos - 60), size + 120);
|
// std::string s = data.substr((*pos < 60) ? 0 : (*pos - 60), size + 120);
|
||||||
QString snippet = QString::fromStdString(s);
|
// QString snippet = QString::fromStdString(s);
|
||||||
if(snippet.size() > 6 + QString::fromStdString(keyWord).size()) {
|
// if(snippet.size() > 6 + QString::fromStdString(keyWord).size()) {
|
||||||
snippet.replace(0, 3, "...").replace(snippet.size() - 3, 3, "...");
|
// snippet.replace(0, 3, "...").replace(snippet.size() - 3, 3, "...");
|
||||||
|
// } else {
|
||||||
|
// snippet.append("...").prepend("...");
|
||||||
|
// }
|
||||||
|
// ri.description.prepend(SearchPluginIface::DescriptionInfo{"",snippet});
|
||||||
|
//// snippets.append(snippet);
|
||||||
|
// QString().swap(snippet);
|
||||||
|
// std::string().swap(s);
|
||||||
|
// ++count;
|
||||||
|
// }
|
||||||
|
//fix me: make a snippet without cut cjk char.
|
||||||
|
auto pos = term.positionlist_begin();
|
||||||
|
QString snippet;
|
||||||
|
if(data.length() - *pos < 120) {
|
||||||
|
std::string s = data.substr((data.length() < 120) ? 0 : (data.length() - 120), 120);
|
||||||
|
snippet = QString::fromStdString(s);
|
||||||
} else {
|
} else {
|
||||||
snippet.append("...").prepend("...");
|
std::string s = data.substr(*pos, 120);
|
||||||
|
snippet = QString::fromStdString(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
ri.description.prepend(SearchPluginIface::DescriptionInfo{"",snippet});
|
ri.description.prepend(SearchPluginIface::DescriptionInfo{"",snippet});
|
||||||
// snippets.append(snippet);
|
|
||||||
QString().swap(snippet);
|
QString().swap(snippet);
|
||||||
std::string().swap(s);
|
// std::string().swap(s);
|
||||||
++count;
|
|
||||||
}
|
|
||||||
std::string().swap(data);
|
std::string().swap(data);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2021, KylinSoft Co., Ltd.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: zhangpengfei <zhangpengfei@kylinos.cn>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "action-label.h"
|
||||||
|
#define ACTION_NORMAL_COLOR QColor(55, 144, 250, 255)
|
||||||
|
#define ACTION_HOVER_COLOR QColor(64, 169, 251, 255)
|
||||||
|
#define ACTION_PRESS_COLOR QColor(41, 108, 217, 255)
|
||||||
|
using namespace Zeeker;
|
||||||
|
ActionLabel::ActionLabel(const QString &action, const QString &key, QWidget *parent) : QLabel(parent)
|
||||||
|
{
|
||||||
|
m_action = action;
|
||||||
|
m_key = key;
|
||||||
|
this->initUi();
|
||||||
|
this->installEventFilter(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionLabel::initUi()
|
||||||
|
{
|
||||||
|
this->setText(m_action);
|
||||||
|
QPalette pal = palette();
|
||||||
|
pal.setColor(QPalette::WindowText, ACTION_NORMAL_COLOR);
|
||||||
|
pal.setColor(QPalette::Light, ACTION_HOVER_COLOR);
|
||||||
|
pal.setColor(QPalette::Dark, ACTION_PRESS_COLOR);
|
||||||
|
this->setPalette(pal);
|
||||||
|
this->setForegroundRole(QPalette::WindowText);
|
||||||
|
this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ActionLabel::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
if (watched == this) {
|
||||||
|
if(event->type() == QEvent::MouseButtonPress) {
|
||||||
|
this->setForegroundRole(QPalette::Dark);
|
||||||
|
return true;
|
||||||
|
} else if(event->type() == QEvent::MouseButtonRelease) {
|
||||||
|
Q_EMIT this->actionTriggered(m_action);
|
||||||
|
this->setForegroundRole(QPalette::Light);
|
||||||
|
return true;
|
||||||
|
} else if(event->type() == QEvent::Enter) {
|
||||||
|
this->setForegroundRole(QPalette::Light);
|
||||||
|
return true;
|
||||||
|
} else if(event->type() == QEvent::Leave) {
|
||||||
|
this->setForegroundRole(QPalette::WindowText);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2021, KylinSoft Co., Ltd.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Authors: zhangpengfei <zhangpengfei@kylinos.cn>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef ACTIONLABEL_H
|
||||||
|
#define ACTIONLABEL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QEvent>
|
||||||
|
namespace Zeeker {
|
||||||
|
class ActionLabel : public QLabel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ActionLabel(const QString &action, const QString &key, QWidget *parent = nullptr);
|
||||||
|
~ActionLabel() = default;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void actionTriggered(QString &action);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *, QEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initUi();
|
||||||
|
QString m_action;
|
||||||
|
QString m_key;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // ACTIONLABEL_H
|
|
@ -1,9 +1,11 @@
|
||||||
INCLUDEPATH += $$PWD \
|
INCLUDEPATH += $$PWD \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
$$PWD/action-label.h \
|
||||||
$$PWD/plugin-iface.h \
|
$$PWD/plugin-iface.h \
|
||||||
$$PWD/search-plugin-iface.h \
|
$$PWD/search-plugin-iface.h \
|
||||||
$$PWD/data-queue.h
|
$$PWD/data-queue.h
|
||||||
|
|
||||||
SOURCES +=
|
SOURCES += \
|
||||||
|
$$PWD/action-label.cpp
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,9 @@ public:
|
||||||
virtual void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult) = 0;
|
virtual void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult) = 0;
|
||||||
virtual QList<Actioninfo> getActioninfo(int type) = 0;
|
virtual QList<Actioninfo> getActioninfo(int type) = 0;
|
||||||
virtual void openAction(int actionkey, QString key, int type) = 0;
|
virtual void openAction(int actionkey, QString key, int type) = 0;
|
||||||
virtual bool isPreviewEnable(QString key, int type) = 0;
|
// virtual bool isPreviewEnable(QString key, int type) = 0;
|
||||||
virtual QWidget *previewPage(QString key, int type, QWidget *parent = nullptr) = 0;
|
// virtual QWidget *previewPage(QString key, int type, QWidget *parent = nullptr) = 0;
|
||||||
|
virtual QWidget *detailPage(const ResultInfo &ri) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ SettingsSearchPlugin::SettingsSearchPlugin(QObject *parent) : QObject(parent)
|
||||||
m_pool.setMaxThreadCount(1);
|
m_pool.setMaxThreadCount(1);
|
||||||
m_pool.setExpiryTimeout(1000);
|
m_pool.setExpiryTimeout(1000);
|
||||||
xmlElement();
|
xmlElement();
|
||||||
|
initDetailPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString SettingsSearchPlugin::name()
|
const QString SettingsSearchPlugin::name()
|
||||||
|
@ -123,15 +124,28 @@ void SettingsSearchPlugin::openAction(int actionkey, QString key, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SettingsSearchPlugin::isPreviewEnable(QString key, int type)
|
QWidget *SettingsSearchPlugin::detailPage(const ResultInfo &ri)
|
||||||
{
|
{
|
||||||
return false;
|
m_currentActionKey = ri.actionKey;
|
||||||
|
m_iconLabel->setPixmap(ri.icon.pixmap(120, 120));
|
||||||
|
QFontMetrics fontMetrics = m_nameLabel->fontMetrics();
|
||||||
|
QString showname = fontMetrics.elidedText(ri.name, Qt::ElideRight, 274); //当字体长度超过215时显示为省略号
|
||||||
|
m_nameLabel->setText(QString("<h3 style=\"font-weight:normal;\">%1</h3>").arg(FileUtils::escapeHtml(showname)));
|
||||||
|
if(QString::compare(showname, ri.name)) {
|
||||||
|
m_nameLabel->setToolTip(ri.name);
|
||||||
|
}
|
||||||
|
return m_detailPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *SettingsSearchPlugin::previewPage(QString key, int type, QWidget *parent = nullptr)
|
//bool SettingsSearchPlugin::isPreviewEnable(QString key, int type)
|
||||||
{
|
//{
|
||||||
return nullptr;
|
// return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
//QWidget *SettingsSearchPlugin::previewPage(QString key, int type, QWidget *parent = nullptr)
|
||||||
|
//{
|
||||||
|
// return nullptr;
|
||||||
|
//}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SettingsSearchPlugin::xmlElement
|
* @brief SettingsSearchPlugin::xmlElement
|
||||||
|
@ -201,3 +215,53 @@ void SettingsSearchPlugin::xmlElement() {
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsSearchPlugin::initDetailPage()
|
||||||
|
{
|
||||||
|
m_detailPage = new QWidget();
|
||||||
|
m_detailPage->setFixedWidth(360);
|
||||||
|
m_detailPage->setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
m_detailLyt = new QVBoxLayout(m_detailPage);
|
||||||
|
m_detailLyt->setContentsMargins(8, 0, 16, 0);
|
||||||
|
m_iconLabel = new QLabel(m_detailPage);
|
||||||
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
m_iconLabel->setFixedHeight(128);
|
||||||
|
|
||||||
|
m_nameFrame = new QFrame(m_detailPage);
|
||||||
|
m_nameFrameLyt = new QHBoxLayout(m_nameFrame);
|
||||||
|
m_nameFrame->setLayout(m_nameFrameLyt);
|
||||||
|
m_nameFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_nameLabel = new QLabel(m_nameFrame);
|
||||||
|
m_nameLabel->setMaximumWidth(280);
|
||||||
|
m_pluginLabel = new QLabel(m_nameFrame);
|
||||||
|
m_pluginLabel->setText(tr("Settings"));
|
||||||
|
m_pluginLabel->setEnabled(false);
|
||||||
|
m_nameFrameLyt->addWidget(m_nameLabel);
|
||||||
|
m_nameFrameLyt->addStretch();
|
||||||
|
m_nameFrameLyt->addWidget(m_pluginLabel);
|
||||||
|
|
||||||
|
m_line_1 = new QFrame(m_detailPage);
|
||||||
|
m_line_1->setLineWidth(0);
|
||||||
|
m_line_1->setFixedHeight(1);
|
||||||
|
m_line_1->setStyleSheet("QFrame{background: rgba(0,0,0,0.2);}");
|
||||||
|
|
||||||
|
m_actionFrame = new QFrame(m_detailPage);
|
||||||
|
m_actionFrameLyt = new QVBoxLayout(m_actionFrame);
|
||||||
|
m_actionFrameLyt->setContentsMargins(8, 0, 0, 0);
|
||||||
|
m_actionLabel1 = new ActionLabel(tr("Open"), m_currentActionKey, m_actionFrame);
|
||||||
|
|
||||||
|
m_actionFrameLyt->addWidget(m_actionLabel1);;
|
||||||
|
m_actionFrame->setLayout(m_actionFrameLyt);
|
||||||
|
|
||||||
|
m_detailLyt->addSpacing(50);
|
||||||
|
m_detailLyt->addWidget(m_iconLabel);
|
||||||
|
m_detailLyt->addWidget(m_nameFrame);
|
||||||
|
m_detailLyt->addWidget(m_line_1);
|
||||||
|
m_detailLyt->addWidget(m_actionFrame);
|
||||||
|
m_detailPage->setLayout(m_detailLyt);
|
||||||
|
m_detailLyt->addStretch();
|
||||||
|
|
||||||
|
connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){
|
||||||
|
openAction(0, m_currentActionKey, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QAction>
|
||||||
|
#include "action-label.h"
|
||||||
#include "search-plugin-iface.h"
|
#include "search-plugin-iface.h"
|
||||||
|
|
||||||
namespace Zeeker {
|
namespace Zeeker {
|
||||||
|
@ -22,11 +29,28 @@ public:
|
||||||
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
void KeywordSearch(QString keyword,DataQueue<ResultInfo> *searchResult);
|
||||||
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
QList<SearchPluginIface::Actioninfo> getActioninfo(int type);
|
||||||
void openAction(int actionkey, QString key, int type);
|
void openAction(int actionkey, QString key, int type);
|
||||||
bool isPreviewEnable(QString key, int type);
|
// bool isPreviewEnable(QString key, int type);
|
||||||
QWidget *previewPage(QString key, int type, QWidget *parent);
|
// QWidget *previewPage(QString key, int type, QWidget *parent);
|
||||||
|
QWidget *detailPage(const ResultInfo &ri);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void xmlElement();
|
void xmlElement();
|
||||||
|
void initDetailPage();
|
||||||
|
QString m_currentActionKey;
|
||||||
|
QWidget *m_detailPage = nullptr;
|
||||||
|
QVBoxLayout *m_detailLyt = nullptr;
|
||||||
|
QLabel *m_iconLabel = nullptr;
|
||||||
|
QFrame *m_nameFrame = nullptr;
|
||||||
|
QHBoxLayout *m_nameFrameLyt = nullptr;
|
||||||
|
QLabel *m_nameLabel = nullptr;
|
||||||
|
QLabel *m_pluginLabel = nullptr;
|
||||||
|
QFrame *m_line_1 = nullptr;
|
||||||
|
QFrame *m_actionFrame = nullptr;
|
||||||
|
QVBoxLayout *m_actionFrameLyt = nullptr;
|
||||||
|
ActionLabel *m_actionLabel1 = nullptr;
|
||||||
|
|
||||||
|
QVBoxLayout * m_actionLyt = nullptr;
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QStringList> m_chineseSearchList;
|
QMap<QString, QStringList> m_chineseSearchList;
|
||||||
QMap<QString, QStringList> m_englishSearchList;
|
QMap<QString, QStringList> m_englishSearchList;
|
||||||
|
|
|
@ -55,6 +55,14 @@ extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int tran
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent) {
|
QMainWindow(parent) {
|
||||||
|
|
||||||
|
m_sys_tray_icon = new QSystemTrayIcon(this);
|
||||||
|
if (!QIcon::fromTheme("system-search-symbolic").isNull())
|
||||||
|
m_sys_tray_icon->setIcon(QIcon::fromTheme("system-search-symbolic"));
|
||||||
|
else
|
||||||
|
m_sys_tray_icon->setIcon(QIcon(":/res/icons/system-search.symbolic.png"));
|
||||||
|
m_sys_tray_icon->setToolTip(tr("Global Search"));
|
||||||
|
m_sys_tray_icon->show();
|
||||||
|
|
||||||
m_searcher = new SearchManager(this);
|
m_searcher = new SearchManager(this);
|
||||||
m_settingsMatch = new SettingsMatch(this);
|
m_settingsMatch = new SettingsMatch(this);
|
||||||
|
|
||||||
|
@ -109,13 +117,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
m_contentFrame->setAppList(applist);
|
m_contentFrame->setAppList(applist);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_sys_tray_icon = new QSystemTrayIcon(this);
|
|
||||||
if (!QIcon::fromTheme("system-search-symbolic").isNull())
|
|
||||||
m_sys_tray_icon->setIcon(QIcon::fromTheme("system-search-symbolic"));
|
|
||||||
else
|
|
||||||
m_sys_tray_icon->setIcon(QIcon(":/res/icons/system-search.symbolic.png"));
|
|
||||||
m_sys_tray_icon->setToolTip(tr("Global Search"));
|
|
||||||
m_sys_tray_icon->show();
|
|
||||||
connect(m_sys_tray_icon, &QSystemTrayIcon::activated, this, [ = ](QSystemTrayIcon::ActivationReason reason) {
|
connect(m_sys_tray_icon, &QSystemTrayIcon::activated, this, [ = ](QSystemTrayIcon::ActivationReason reason) {
|
||||||
if(reason == QSystemTrayIcon::Trigger) {
|
if(reason == QSystemTrayIcon::Trigger) {
|
||||||
if(!this->isVisible()) {
|
if(!this->isVisible()) {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Zeeker::AppSearch</name>
|
<name>Zeeker::AppSearch</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="208"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="320"/>
|
||||||
<source>Application Description:</source>
|
<source>Application Description:</source>
|
||||||
<translation>应用描述:</translation>
|
<translation>应用描述:</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -12,32 +12,41 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Zeeker::AppSearchPlugin</name>
|
<name>Zeeker::AppSearchPlugin</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="10"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="11"/>
|
||||||
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="171"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>打开</translation>
|
<translation>打开</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="11"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="12"/>
|
||||||
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="172"/>
|
||||||
<source>Add Shortcut to Desktop</source>
|
<source>Add Shortcut to Desktop</source>
|
||||||
<translation>添加到桌面快捷方式</translation>
|
<translation>添加到桌面快捷方式</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="12"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="13"/>
|
||||||
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="173"/>
|
||||||
<source>Add Shortcut to Panel</source>
|
<source>Add Shortcut to Panel</source>
|
||||||
<translation>添加到任务栏快捷方式</translation>
|
<translation>添加到任务栏快捷方式</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="13"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="14"/>
|
||||||
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="174"/>
|
||||||
<source>Install</source>
|
<source>Install</source>
|
||||||
<translation>安装</translation>
|
<translation>安装</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="23"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="25"/>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="28"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="30"/>
|
||||||
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="33"/>
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="35"/>
|
||||||
<source>Applications Search</source>
|
<source>Applications Search</source>
|
||||||
<translation>应用搜索</translation>
|
<translation>应用搜索</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/appsearch/app-search-plugin.cpp" line="106"/>
|
||||||
|
<source>Application</source>
|
||||||
|
<translation>应用</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Application Description:</source>
|
<source>Application Description:</source>
|
||||||
<translation type="vanished">应用描述:</translation>
|
<translation type="vanished">应用描述:</translation>
|
||||||
|
@ -46,74 +55,120 @@
|
||||||
<context>
|
<context>
|
||||||
<name>Zeeker::DirSearchPlugin</name>
|
<name>Zeeker::DirSearchPlugin</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="92"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="199"/>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="336"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>打开</translation>
|
<translation>打开</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="93"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="200"/>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="337"/>
|
||||||
<source>Open path</source>
|
<source>Open path</source>
|
||||||
<translation>打开文件所在路径</translation>
|
<translation>打开文件所在路径</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="94"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="201"/>
|
||||||
<source>Copy Path</source>
|
<source>Copy Path</source>
|
||||||
<translation>复制文件路径</translation>
|
<translation>复制文件路径</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="102"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="210"/>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="112"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="220"/>
|
||||||
<source>Dir Search</source>
|
<source>Dir Search</source>
|
||||||
<translation>目录搜索</translation>
|
<translation>目录搜索</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="107"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="215"/>
|
||||||
<source>Dir search.</source>
|
<source>Dir search.</source>
|
||||||
<translation>目录搜索。</translation>
|
<translation>目录搜索。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="271"/>
|
||||||
|
<source>directory</source>
|
||||||
|
<translation>目录</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="311"/>
|
||||||
|
<source>Path</source>
|
||||||
|
<translation>路径</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="323"/>
|
||||||
|
<source>Last time modified</source>
|
||||||
|
<translation>上次修改时间</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="338"/>
|
||||||
|
<source>Copy path</source>
|
||||||
|
<translation>复制路径</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Zeeker::FileContengSearchPlugin</name>
|
<name>Zeeker::FileContengSearchPlugin</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="165"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="379"/>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="544"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>打开</translation>
|
<translation>打开</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="166"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="380"/>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="545"/>
|
||||||
<source>Open path</source>
|
<source>Open path</source>
|
||||||
<translation>打开文件所在路径</translation>
|
<translation>打开文件所在路径</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="167"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="381"/>
|
||||||
<source>Copy Path</source>
|
<source>Copy Path</source>
|
||||||
<translation>复制文件路径</translation>
|
<translation>复制文件路径</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="175"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="390"/>
|
||||||
<source>File Content Search</source>
|
<source>File Content Search</source>
|
||||||
<translation>文本内容搜索</translation>
|
<translation>文本内容搜索</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="180"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="395"/>
|
||||||
<source>File content search.</source>
|
<source>File content search.</source>
|
||||||
<translation>文本内容搜索。</translation>
|
<translation>文本内容搜索。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="185"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="400"/>
|
||||||
<source>File content search</source>
|
<source>File content search</source>
|
||||||
<translation>文本内容搜索</translation>
|
<translation>文本内容搜索</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="445"/>
|
||||||
|
<source>File</source>
|
||||||
|
<translation>文件</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="519"/>
|
||||||
|
<source>Path</source>
|
||||||
|
<translation>路径</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="531"/>
|
||||||
|
<source>Last time modified</source>
|
||||||
|
<translation>上次修改时间</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="546"/>
|
||||||
|
<source>Copy path</source>
|
||||||
|
<translation>复制路径</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Zeeker::FileSearchPlugin</name>
|
<name>Zeeker::FileSearchPlugin</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="10"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="10"/>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="147"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>打开</translation>
|
<translation>打开</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="11"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="11"/>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="148"/>
|
||||||
<source>Open path</source>
|
<source>Open path</source>
|
||||||
<translation>打开文件所在路径</translation>
|
<translation>打开文件所在路径</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -123,16 +178,36 @@
|
||||||
<translation>复制文件路径</translation>
|
<translation>复制文件路径</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="20"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="21"/>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="30"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="31"/>
|
||||||
<source>File Search</source>
|
<source>File Search</source>
|
||||||
<translation>文件搜索</translation>
|
<translation>文件搜索</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/index/file-search-plugin.cpp" line="25"/>
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="26"/>
|
||||||
<source>File search.</source>
|
<source>File search.</source>
|
||||||
<translation>文件搜索。</translation>
|
<translation>文件搜索。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="82"/>
|
||||||
|
<source>File</source>
|
||||||
|
<translation>文件</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="122"/>
|
||||||
|
<source>Path</source>
|
||||||
|
<translation>路径</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="134"/>
|
||||||
|
<source>Last time modified</source>
|
||||||
|
<translation>上次修改时间</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/index/file-search-plugin.cpp" line="149"/>
|
||||||
|
<source>Copy path</source>
|
||||||
|
<translation>复制路径</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>Zeeker::SearchManager</name>
|
<name>Zeeker::SearchManager</name>
|
||||||
|
@ -151,19 +226,25 @@
|
||||||
<name>Zeeker::SettingsSearchPlugin</name>
|
<name>Zeeker::SettingsSearchPlugin</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="11"/>
|
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="11"/>
|
||||||
|
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="251"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>打开</translation>
|
<translation>打开</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="20"/>
|
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="21"/>
|
||||||
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="30"/>
|
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="31"/>
|
||||||
<source>Settings Search</source>
|
<source>Settings Search</source>
|
||||||
<translation>设置</translation>
|
<translation>设置</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="25"/>
|
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="26"/>
|
||||||
<source>Settings search.</source>
|
<source>Settings search.</source>
|
||||||
<translation>设置。</translation>
|
<translation>设置。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../../libsearch/settingsearch/settings-search-plugin.cpp" line="237"/>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>设置项</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
SUBDIRS += $$PWD/libchinese-segmentation \
|
SUBDIRS += $$PWD/libchinese-segmentation \
|
||||||
$$PWD/libsearch \
|
$$PWD/libsearch \
|
||||||
$$PWD/src \
|
# $$PWD/src \
|
||||||
$$PWD/frontend \
|
$$PWD/frontend \
|
||||||
$$PWD/ukuisearch-systemdbus
|
$$PWD/ukuisearch-systemdbus
|
||||||
# The following define makes your compiler emit warnings if you use
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
@ -16,7 +16,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
libsearch.depends += libchinese-segmentation
|
libsearch.depends += libchinese-segmentation
|
||||||
src.depends = libsearch
|
#src.depends = libsearch
|
||||||
frontend.depends = libsearch
|
frontend.depends = libsearch
|
||||||
|
|
||||||
CONFIG += ordered \
|
CONFIG += ordered \
|
||||||
|
|
Loading…
Reference in New Issue