commit
9f53cafb8d
|
@ -341,24 +341,25 @@ void ResultArea::mouseReleaseEvent(QMouseEvent *event)
|
|||
|
||||
bool ResultArea::viewportEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::TouchBegin) {
|
||||
QTouchEvent *e = dynamic_cast<QTouchEvent *>(event);
|
||||
if(e->touchPoints().size() == 1) {
|
||||
m_pressPoint = m_widget->mapFrom(this, e->touchPoints().at(0).pos().toPoint());
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
QMouseEvent *e = dynamic_cast<QMouseEvent *>(event);
|
||||
if (e->source() == Qt::MouseEventSynthesizedByApplication) {
|
||||
qDebug() << "MouseButtonPress MouseEventSynthesizedByApplication";
|
||||
m_pressPoint = m_widget->mapFrom(this, e->pos());
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
} else if (event->type() == QEvent::TouchUpdate) {
|
||||
QTouchEvent *e = dynamic_cast<QTouchEvent *>(event);
|
||||
// qDebug() << "touchpoint===========" << e->touchPoints().size();
|
||||
if(e->touchPoints().size() == 1) {
|
||||
int delta = m_pressPoint.y() - m_widget->mapFrom(this, e->touchPoints().at(0).pos().toPoint()).y();
|
||||
// qDebug() << "last pos:" << m_pressPoint.y();
|
||||
// qDebug() << "new pos:" << m_widget->mapFrom(this, e->touchPoints().at(0).pos().toPoint()).y();
|
||||
// qDebug() << "delta" << delta;
|
||||
// qDebug() << "height" << m_widget->height() << "--" << verticalScrollBar()->maximum();
|
||||
} else if (event->type() == QEvent::MouseMove) {
|
||||
QMouseEvent *e = dynamic_cast<QMouseEvent *>(event);
|
||||
if (e->source() == Qt::MouseEventSynthesizedByApplication) {
|
||||
qDebug() << "MouseMove MouseEventSynthesizedByApplication";
|
||||
int delta = m_pressPoint.y() - m_widget->mapFrom(this, e->pos()).y();
|
||||
// qDebug() << "last pos:" << m_pressPoint.y();
|
||||
// qDebug() << "new pos:" << m_widget->mapFrom(this, e->touchPoints().at(0).pos().toPoint()).y();
|
||||
// qDebug() << "delta" << delta;
|
||||
// qDebug() << "value" << verticalScrollBar()->value() << "--" << verticalScrollBar()->value() + delta;
|
||||
this->verticalScrollBar()->setValue(verticalScrollBar()->value() + delta);
|
||||
m_pressPoint = m_widget->mapFrom(this,e->touchPoints().at(0).pos().toPoint());
|
||||
m_pressPoint = m_widget->mapFrom(this,e->pos());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,6 +168,7 @@ ResultView::ResultView(const QString &plugin_id, QWidget *parent) : QTreeView(pa
|
|||
{
|
||||
// setStyle(ResultItemStyle::getStyle());
|
||||
this->setFrameShape(QFrame::NoFrame);
|
||||
this->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
this->viewport()->setAutoFillBackground(false);
|
||||
this->setIconSize(QSize(VIEW_ICON_SIZE, VIEW_ICON_SIZE));
|
||||
this->setRootIsDecorated(false);
|
||||
|
@ -181,6 +182,9 @@ ResultView::ResultView(const QString &plugin_id, QWidget *parent) : QTreeView(pa
|
|||
m_plugin_id = plugin_id;
|
||||
m_styleDelegate = new ResultViewDelegate(this);
|
||||
this->setItemDelegate(m_styleDelegate);
|
||||
m_touchTimer = new QTimer(this);
|
||||
m_touchTimer->setSingleShot(true);
|
||||
m_touchTimer->setInterval(100);
|
||||
}
|
||||
|
||||
bool ResultView::isSelected()
|
||||
|
@ -344,6 +348,53 @@ void ResultView::mouseMoveEvent(QMouseEvent *event)
|
|||
return QTreeView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
bool ResultView::viewportEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::TouchBegin) {
|
||||
qDebug() << "TouchBegin==============";
|
||||
QTouchEvent *e = dynamic_cast<QTouchEvent *>(event);
|
||||
QMouseEvent me(QEvent::MouseButtonPress,
|
||||
e->touchPoints().at(0).pos(),
|
||||
this->mapTo(this->window(),e->touchPoints().at(0).pos().toPoint()),
|
||||
this->mapToGlobal(e->touchPoints().at(0).pos().toPoint()),
|
||||
Qt::LeftButton,Qt::LeftButton,Qt::NoModifier,Qt::MouseEventSynthesizedByApplication);
|
||||
QApplication::sendEvent(parent(), &me);
|
||||
m_touchTimer->start();
|
||||
event->accept();
|
||||
return true;
|
||||
} else if (event->type() == QEvent::TouchEnd) {
|
||||
qDebug() << "touchend==============" << m_touchTimer->remainingTime();
|
||||
if (m_touchTimer->remainingTime() > 0.001) {
|
||||
QTouchEvent *e = dynamic_cast<QTouchEvent *>(event);
|
||||
QMouseEvent me(QEvent::MouseButtonPress,
|
||||
e->touchPoints().at(0).pos(),
|
||||
this->mapTo(this->window(),e->touchPoints().at(0).pos().toPoint()),
|
||||
this->mapToGlobal(e->touchPoints().at(0).pos().toPoint()),
|
||||
Qt::LeftButton,Qt::LeftButton,Qt::NoModifier,Qt::MouseEventSynthesizedByApplication);
|
||||
QApplication::sendEvent(this->viewport(),&me);
|
||||
|
||||
QMouseEvent mer(QEvent::MouseButtonRelease,
|
||||
e->touchPoints().at(0).pos(),
|
||||
this->mapTo(this->window(),e->touchPoints().at(0).pos().toPoint()),
|
||||
this->mapToGlobal(e->touchPoints().at(0).pos().toPoint()),
|
||||
Qt::LeftButton,Qt::LeftButton,Qt::NoModifier,Qt::MouseEventSynthesizedByApplication);
|
||||
QApplication::sendEvent(this->viewport(),&mer);
|
||||
}
|
||||
return true;
|
||||
} else if (event->type() == QEvent::TouchUpdate) {
|
||||
qDebug() << "touchupdate==============";
|
||||
QTouchEvent *e = dynamic_cast<QTouchEvent *>(event);
|
||||
QMouseEvent me(QEvent::MouseMove,
|
||||
e->touchPoints().at(0).pos(),
|
||||
this->mapTo(this->window(),e->touchPoints().at(0).pos().toPoint()),
|
||||
this->mapToGlobal(e->touchPoints().at(0).pos().toPoint()),
|
||||
Qt::LeftButton,Qt::LeftButton,Qt::NoModifier,Qt::MouseEventSynthesizedByApplication);
|
||||
QApplication::sendEvent(parent(), &me);
|
||||
return true;
|
||||
}
|
||||
return QTreeView::viewportEvent(event);
|
||||
}
|
||||
|
||||
void ResultView::initConnections()
|
||||
{
|
||||
connect(this, &ResultView::startSearch, [ = ](const QString &keyword) {
|
||||
|
|
|
@ -37,6 +37,7 @@ protected:
|
|||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
bool viewportEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
void initConnections();
|
||||
|
@ -47,6 +48,7 @@ private:
|
|||
int m_count = 0;
|
||||
QModelIndex m_tmpCurrentIndex;
|
||||
QModelIndex m_tmpMousePressIndex;
|
||||
QTimer *m_touchTimer;
|
||||
|
||||
Q_SIGNALS:
|
||||
void startSearch(const QString &);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "file-system-watcher.h"
|
|
@ -92,7 +92,8 @@ unix {
|
|||
searchinterface/ukui-search-task.h \
|
||||
appdata/app-info-table.h \
|
||||
searchinterface/search-controller.h \
|
||||
searchinterface/result-item.h
|
||||
searchinterface/result-item.h \
|
||||
filesystemwatcher/file-system-watcher.h
|
||||
header.files += development-files/header-files/*
|
||||
|
||||
INSTALLS += header
|
||||
|
|
|
@ -17,7 +17,8 @@ SOURCES += search.cpp
|
|||
|
||||
HEADERS += search.h
|
||||
|
||||
TRANSLATIONS += translations/zh_CN.ts
|
||||
TRANSLATIONS += translations/zh_CN.ts \
|
||||
translations/bo_CN.ts
|
||||
|
||||
images.files = image/*
|
||||
images.path = /usr/share/ukui-search/search-ukcc-plugin/image/
|
||||
|
|
|
@ -195,8 +195,9 @@ void Search::initUi()
|
|||
m_addBlockDirFrame->setFrameShape(QFrame::Shape::NoFrame);
|
||||
m_addBlockDirFrame->setFixedHeight(60);
|
||||
|
||||
m_addBlockDirWidget = new QPushButton(m_addBlockDirFrame);
|
||||
m_addBlockDirWidget->setFixedHeight(60);
|
||||
// m_addBlockDirWidget = new QPushButton(m_addBlockDirFrame);
|
||||
m_addBlockDirWidget = new AddBtn(m_addBlockDirFrame);
|
||||
// m_addBlockDirWidget->setFixedHeight(60);
|
||||
|
||||
// m_addBlockDirWidget->setObjectName("addBlockDirWidget");
|
||||
// QPalette pal;
|
||||
|
@ -212,27 +213,28 @@ void Search::initUi()
|
|||
// HoverWidget:hover:!pressed#addBlockDirWidget{background: %1; \
|
||||
// border-radius: 4px;}").arg(stringColor));
|
||||
|
||||
m_addBlockDirWidget->setProperty("useButtonPalette", true);
|
||||
// m_addBlockDirWidget->setStyleSheet("QPushButton:!checked{background: palette(base);}");
|
||||
m_addBlockDirWidget->setFlat(true);
|
||||
//之前自己写的添加按钮,目前方案用控制面板提供的AddBtn,后面有变动再放出来(属性全都注掉了,有问题找ukcc寻求帮助)
|
||||
// m_addBlockDirWidget->setProperty("useButtonPalette", true);
|
||||
//// m_addBlockDirWidget->setStyleSheet("QPushButton:!checked{background: palette(base);}");
|
||||
// m_addBlockDirWidget->setFlat(true);
|
||||
|
||||
m_addBlockDirIcon = new QLabel(m_addBlockDirWidget);
|
||||
m_addBlockDirIcon->setPixmap(QIcon("/usr/share/ukui-search/search-ukcc-plugin/image/add.svg").pixmap(12, 12));
|
||||
m_addBlockDirIcon->setProperty("useIconHighlightEffect", true);
|
||||
m_addBlockDirIcon->setProperty("iconHighlightEffectMode", 1);
|
||||
// m_addBlockDirIcon = new QLabel(m_addBlockDirWidget);
|
||||
// m_addBlockDirIcon->setPixmap(QIcon("/usr/share/ukui-search/search-ukcc-plugin/image/add.svg").pixmap(12, 12));
|
||||
// m_addBlockDirIcon->setProperty("useIconHighlightEffect", true);
|
||||
// m_addBlockDirIcon->setProperty("iconHighlightEffectMode", 1);
|
||||
|
||||
m_addBlockDirLabel = new QLabel(m_addBlockDirWidget);
|
||||
m_addBlockDirLabel->setText(tr("Choose folder"));
|
||||
// m_addBlockDirLabel = new QLabel(m_addBlockDirWidget);
|
||||
// m_addBlockDirLabel->setText(tr("Choose folder"));
|
||||
|
||||
m_addBlockDirLyt = new QHBoxLayout(m_addBlockDirWidget);
|
||||
m_addBlockDirWidget->setLayout(m_addBlockDirLyt);
|
||||
// m_addBlockDirLyt = new QHBoxLayout(m_addBlockDirWidget);
|
||||
// m_addBlockDirWidget->setLayout(m_addBlockDirLyt);
|
||||
|
||||
m_blockDirsLyt->addWidget(m_addBlockDirWidget);
|
||||
|
||||
m_addBlockDirLyt->addStretch();
|
||||
m_addBlockDirLyt->addWidget(m_addBlockDirIcon);
|
||||
m_addBlockDirLyt->addWidget(m_addBlockDirLabel);
|
||||
m_addBlockDirLyt->addStretch();
|
||||
// m_addBlockDirLyt->addStretch();
|
||||
// m_addBlockDirLyt->addWidget(m_addBlockDirIcon);
|
||||
// m_addBlockDirLyt->addWidget(m_addBlockDirLabel);
|
||||
// m_addBlockDirLyt->addStretch();
|
||||
m_mainLyt->addSpacing(32);
|
||||
m_mainLyt->addWidget(m_blockDirTitleLabel);
|
||||
m_mainLyt->addWidget(m_blockDirDescLabel);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <ukcc/widgets/switchbutton.h>
|
||||
#include <ukcc/widgets/comboxframe.h>
|
||||
#include <ukcc/widgets/titlelabel.h>
|
||||
#include <ukcc/widgets/addbtn.h>
|
||||
|
||||
#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings"
|
||||
#define SEARCH_METHOD_KEY "fileIndexEnable"
|
||||
|
@ -88,7 +89,8 @@ private:
|
|||
QLabel * m_blockDirDescLabel = nullptr;
|
||||
QFrame * m_blockDirsFrame = nullptr;
|
||||
QVBoxLayout * m_blockDirsLyt = nullptr;
|
||||
QPushButton * m_addBlockDirWidget = nullptr;
|
||||
// QPushButton * m_addBlockDirWidget = nullptr;
|
||||
AddBtn * m_addBlockDirWidget = nullptr;
|
||||
QLabel * m_addBlockDirIcon = nullptr;
|
||||
QLabel * m_addBlockDirLabel = nullptr;
|
||||
QHBoxLayout * m_addBlockDirLyt = nullptr;
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="bo_CN">
|
||||
<context>
|
||||
<name>Search</name>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="13"/>
|
||||
<location filename="../search.cpp" line="121"/>
|
||||
<source>Search</source>
|
||||
<translation>འཚོལ་ཞིབ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="145"/>
|
||||
<source>Create index</source>
|
||||
<translation>གསར་འཛུགས་འཚོལ་ཞིབ་བྱེད་པར་ཁྲིད་སྟོན།</translation>
|
||||
<extra-contents_path>/Search/Create index</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="146"/>
|
||||
<source>Creating index can help you getting results quickly.</source>
|
||||
<translation>སྟོན་གྲངས་གསར་སྐྲུན་བྱས་ན་ཁྱོད་ལ་མགྱོགས་མྱུར་ངང་གྲུབ་འབྲས་ཐོབ་པར་རོགས་རམ་བྱེད་ཐུབ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="165"/>
|
||||
<source>Default web searching engine</source>
|
||||
<translation>ཁོག་གི་དྲ་ཤོག་གཏོད་པ་བཤེར་འཚོལ་རིགས་དབྱིབས།</translation>
|
||||
<extra-contents_path>/Search/Default web searching engine</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="169"/>
|
||||
<source>baidu</source>
|
||||
<translation>པའེ་ཏུའུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="170"/>
|
||||
<source>sougou</source>
|
||||
<translation>སོའོ་གོའུ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="171"/>
|
||||
<source>360</source>
|
||||
<translation>360</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="179"/>
|
||||
<source>Block Folders</source>
|
||||
<translation>ལྐོག་བཀོད་མིང་ཐོ།</translation>
|
||||
<extra-contents_path>/Search/Block Folders</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="184"/>
|
||||
<source>Following folders will not be searched. You can set it by adding and removing folders.</source>
|
||||
<translation>གཤམ་གྱི་ཡིག་སྣོད་འཚོལ་བཤེར་མི་བྱེད། ཡིག་སྣོད་གསར་སྣོན་དང་གསུབ་འཕྲི་བྱས་ཚེ་ཡིག་ཆའི་དཀར་ཆག་སྒྲིག་འགོད་བྱ་ཐུབ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="225"/>
|
||||
<source>Choose folder</source>
|
||||
<translation>བསལ་འདེམས་ཀྱི་དཀར་ཆག།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="338"/>
|
||||
<source>delete</source>
|
||||
<translation>བསུབ་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="393"/>
|
||||
<source>Directories</source>
|
||||
<translation>དཀར་ཆག</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="394"/>
|
||||
<source>select blocked folder</source>
|
||||
<translation>བཀག་སྡོམ་བྱས་པའི་ཡིག་སྣོད་གདམ་གསེས</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="395"/>
|
||||
<source>Select</source>
|
||||
<translation>བདམས་ཐོན་བྱུང་བ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="396"/>
|
||||
<source>Position: </source>
|
||||
<translation>གོ་གནས་ནི། </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="397"/>
|
||||
<source>FileName: </source>
|
||||
<translation>ཡིག་ཆའི་མིང་ནི། </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="398"/>
|
||||
<source>FileType: </source>
|
||||
<translation>ཡིག་ཆའི་རིགས་དབྱིབས་ནི། </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="399"/>
|
||||
<source>Cancel</source>
|
||||
<translation>ཕྱིར་འཐེན།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="415"/>
|
||||
<location filename="../search.cpp" line="419"/>
|
||||
<location filename="../search.cpp" line="423"/>
|
||||
<location filename="../search.cpp" line="427"/>
|
||||
<source>Warning</source>
|
||||
<translation>ཐ་ཚིག་སྒྲོག་པ།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="415"/>
|
||||
<source>Add blocked folder failed, choosen path is empty!</source>
|
||||
<translation>སྦྱོར་རྟ་ལྐོག་བཀོད་མིང་ཐོ་ཕམ་ཁ་བསལ་འདེམས་ཀྱི་ཐབས་ལམ་སྟོང་བ་རེད།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="419"/>
|
||||
<source>Add blocked folder failed, it is not in home path!</source>
|
||||
<translation>སྦྱོར་རྟ་ལྐོག་བཀོད་མིང་ཐོ་ཕམ་ཁ་བསལ་འདེམས་ཀྱི་དཀར་ཆག་མི་ཁྱིམ་དཀར་ཆག་འོག།</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="423"/>
|
||||
<source>Add blocked folder failed, its parent dir is exist!</source>
|
||||
<translation>སྦྱོར་རྟ་ལྐོག་བཀོད་མིང་ཐོ་ཕམ་ཁ་བསལ་འདེམས་ཀྱི་དཀར་ཆག་ནི་ལྐོག་བཀོད་མིང་ཐོ་འི་ཁྲོད་ཀྱི་དཀར་ཆག་འོག</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../search.cpp" line="427"/>
|
||||
<source>Add blocked folder failed, it has been already blocked!</source>
|
||||
<translation>སྦྱོར་རྟ་ལྐོག་བཀོད་མིང་ཐོ་ཕམ་ཁ་བསལ་འདེམས་ཀྱི་དཀར་ཆག་ནི་ལྐོག་བཀོད་མིང་ཐོ་འི་ཁྲོད་ཀྱི་དཀར་ཆག་འོག</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
Loading…
Reference in New Issue