From 7b386ec0d5c2a714c65cbc352d5725ff52f5ddc9 Mon Sep 17 00:00:00 2001 From: iaom Date: Tue, 20 Apr 2021 19:21:42 +0800 Subject: [PATCH 01/25] Adjust code for v10. --- .gitignore | 2 +- debian/control | 3 +- debian/ukui-search.install | 1 - .../chinese-segmentation.h | 2 +- libsearch/global-settings.cpp | 3 +- libsearch/index/first-index.h | 1 + src/control/highlight-item-delegate.cpp | 3 +- src/control/search-list-view.cpp | 14 ++- src/main.cpp | 5 +- src/mainwindow.cpp | 28 ++--- src/mainwindow.h | 5 +- src/model/search-item-model.cpp | 28 ++--- src/resource.qrc | 1 + src/settings-widget.cpp | 12 +- src/settings-widget.h | 4 +- src/src.pro | 16 +-- translations/ukui-search/bo.ts | 108 +++++++++--------- translations/ukui-search/tr.ts | 108 +++++++++--------- translations/ukui-search/zh_CN.ts | 108 +++++++++--------- 19 files changed, 228 insertions(+), 224 deletions(-) diff --git a/.gitignore b/.gitignore index fab7372..20e2d0e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ *.so.* *_pch.h.cpp *_resource.rc -*.qm +#*.qm .#* *.*# core diff --git a/debian/control b/debian/control index 411e22f..de27efd 100644 --- a/debian/control +++ b/debian/control @@ -11,9 +11,8 @@ Build-Depends: debhelper (>=9.0.0), qtscript5-dev, qttools5-dev-tools, libxapian-dev, - libquazip5-dev(>=0.7.6-6build1), + libquazip5-dev, libglib2.0-dev, - libkf5windowsystem-dev, libgsettings-qt-dev, libqt5x11extras5-dev, libuchardet-dev, diff --git a/debian/ukui-search.install b/debian/ukui-search.install index db54699..d0ffb18 100644 --- a/debian/ukui-search.install +++ b/debian/ukui-search.install @@ -1,4 +1,3 @@ usr/bin/ukui-search etc/xdg/autostart/*.desktop usr/share/applications/*.desktop -src/.qm/*.qm usr/share/ukui-search/translations diff --git a/libchinese-segmentation/chinese-segmentation.h b/libchinese-segmentation/chinese-segmentation.h index db054c4..e1f9d96 100644 --- a/libchinese-segmentation/chinese-segmentation.h +++ b/libchinese-segmentation/chinese-segmentation.h @@ -39,7 +39,7 @@ struct SKeyWord{ ~SKeyWord(){ word = std::move(""); offsets.clear(); - offsets.shrink_to_fit(); +// offsets.shrink_to_fit(); } }; diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 34b7176..136ad9d 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -55,9 +55,10 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) qWarning()<<"Kylinssoclient Dbus connect fail!"; this->forceSync(); + m_cache.insert(FONT_SIZE_KEY, 11); //the default number of transparency in mainwindow is 0.7 //if someone changes the num in mainwindow, here should be modified too - m_cache.insert(TRANSPARENCY_KEY, 0.7); + m_cache.insert(TRANSPARENCY_KEY, 1); if (QGSettings::isSchemaInstalled(CONTROL_CENTER_PERSONALISE_GSETTINGS_ID)) { m_trans_gsettings = new QGSettings(CONTROL_CENTER_PERSONALISE_GSETTINGS_ID, QByteArray(), this); connect(m_trans_gsettings, &QGSettings::changed, this, [=](const QString& key) { diff --git a/libsearch/index/first-index.h b/libsearch/index/first-index.h index 2d90ba9..8a0a4f8 100644 --- a/libsearch/index/first-index.h +++ b/libsearch/index/first-index.h @@ -33,6 +33,7 @@ #include #include #include +#include "assert.h" #include //#include #include "traverse_bfs.h" diff --git a/src/control/highlight-item-delegate.cpp b/src/control/highlight-item-delegate.cpp index 334a8bc..57a971e 100644 --- a/src/control/highlight-item-delegate.cpp +++ b/src/control/highlight-item-delegate.cpp @@ -56,7 +56,8 @@ void HighlightItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem ctx.palette.setColor(QPalette::Text, optionV4.palette.color(QPalette::Active, QPalette::HighlightedText)); QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &optionV4); - textRect.adjust(-20, -5, 0, 0); +// textRect.adjust(-20, -5, 0, 0); + textRect.adjust(0, -5, 0, 0); painter->save(); painter->translate(textRect.topLeft()); painter->setClipRect(textRect.translated(-textRect.topLeft())); diff --git a/src/control/search-list-view.cpp b/src/control/search-list-view.cpp index a4ddca6..f4e18c1 100644 --- a/src/control/search-list-view.cpp +++ b/src/control/search-list-view.cpp @@ -37,16 +37,16 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const m_model->setItem(m_item); this->setModel(m_model); this->setHeaderHidden(true); - this->setColumnWidth(0, 20); - this->setColumnWidth(1, 80); +// this->setColumnWidth(0, 20); +// this->setColumnWidth(1, 80); rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())) + 1; this->setFixedHeight(list.count() * rowheight + 4); this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAutoFillBackground(false); - this->setStyleSheet("QWidget{background:transparent;}"); - m_styleDelegate = new HighlightItemDelegate(this); +// this->setStyleSheet("QWidget{background:transparent;}"); +// m_styleDelegate = new HighlightItemDelegate(this); // m_styleDelegate->setSearchKeyword(keyword); - this->setItemDelegate(m_styleDelegate); +// this->setItemDelegate(m_styleDelegate); m_type = type; connect(this->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ](const QItemSelection &selected, const QItemSelection &deselected) { @@ -99,6 +99,8 @@ void SearchListView::setList(QStringList list) this->blockSignals(false); } rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())); + qDebug()<<"setList rowheight"<< rowheight; + qDebug()<<"setList indexRowSizeHint"<setFixedHeight(m_item->getCurrentSize() * rowheight + 4); } @@ -135,7 +137,7 @@ void SearchListView::clear() */ void SearchListView::setKeyword(QString keyword) { - m_styleDelegate->setSearchKeyword(keyword); +// m_styleDelegate->setSearchKeyword(keyword); } /** diff --git a/src/main.cpp b/src/main.cpp index eb76c89..f2a4344 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -229,7 +229,8 @@ int main(int argc, char *argv[]) // Load translations QTranslator translator; try { - if (! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw -1; +// if (! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw -1; + if (! translator.load(":/res/translations/zh_CN.qm" + QLocale::system().name())) throw -1; app.installTranslator(&translator); } catch (...) { qDebug() << "Load translations file" << QLocale() << "failed!"; @@ -263,7 +264,7 @@ int main(int argc, char *argv[]) if (QString::compare(QString("-s"), QString(QLatin1String(argv[1]))) == 0) { // w->moveToPanel(); centerToScreen(w); - XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints); w->show(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 227c691..8d5ac33 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -29,9 +29,9 @@ #include #include #include -#include +//#include #include -#include "kwindowsystem.h" +//#include "kwindowsystem.h" #include "qt-single-application.h" //#include "inotify-manager.h" @@ -67,10 +67,10 @@ MainWindow::MainWindow(QWidget *parent) : initUi(); // setProperty("useStyleWindowManager", false); //禁止拖动 - m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; - m_hints.functions = MWM_FUNC_ALL; - m_hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; +// m_hints.functions = MWM_FUNC_ALL; +// m_hints.decorations = MWM_DECOR_BORDER; +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); QPainterPath path; auto rect = this->rect(); @@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent) : // path.addRoundedRect(rect, 0, 0); path.addRect(rect); setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); - KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); +// KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); const QByteArray id("org.ukui.control-center.personalise"); if (QGSettings::isSchemaInstalled(id)) { @@ -130,7 +130,7 @@ MainWindow::MainWindow(QWidget *parent) : clearSearchResult(); // this->moveToPanel(); centerToScreen(this); - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入 this->raise(); @@ -272,7 +272,7 @@ void MainWindow::bootOptionsFilter(QString opt) clearSearchResult(); // this->moveToPanel(); centerToScreen(this); - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); this->m_searchLayout->focusIn(); this->raise(); @@ -438,10 +438,12 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r switch (event->response_type & ~0x80) { case XCB_FOCUS_OUT: - this->hide(); - m_contentFrame->closeWebView(); - m_search_result_thread->requestInterruption(); - m_search_result_thread->quit(); + //iaom begian +// this->hide(); +// m_contentFrame->closeWebView(); +// m_search_result_thread->requestInterruption(); +// m_search_result_thread->quit(); + //iaom finish // m_seach_app_thread->stop(); break; default: diff --git a/src/mainwindow.h b/src/mainwindow.h index be2a3fe..ae1fa71 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -43,6 +43,7 @@ #include #include #include +#include #include "content-widget.h" #include "input-box.h" @@ -50,7 +51,7 @@ #include "settings-widget.h" #include "libsearch.h" #include "search-app-thread.h" -#include "xatom-helper.h" +//#include "xatom-helper.h" class SearchResult; class MainWindow : public QMainWindow @@ -74,7 +75,7 @@ public: // The position which mainwindow shows in the center of screen where the cursor in. void centerToScreen(QWidget* widget); - MotifWmHints m_hints; +// MotifWmHints m_hints; private: diff --git a/src/model/search-item-model.cpp b/src/model/search-item-model.cpp index ecdca91..3a08954 100644 --- a/src/model/search-item-model.cpp +++ b/src/model/search-item-model.cpp @@ -71,7 +71,7 @@ int SearchItemModel::rowCount(const QModelIndex& index) const */ int SearchItemModel::columnCount(const QModelIndex& index) const { - return index.isValid() ? 0 : 2; + return index.isValid() ? 0 : 1; } /** @@ -96,29 +96,31 @@ QVariant SearchItemModel::data(const QModelIndex &index, int role) const { if(!index.isValid()) return QVariant(); - switch (index.column()) { - case Icon: { +// switch (index.column()) { +// case Icon: { switch (role) { case Qt::DecorationRole: { return m_item->getIcon(index.row()); } + case Qt::DisplayRole: { + return QVariant(m_item->getName(index.row())); default: return QVariant(); } } - case Name: { - switch (role) { - case Qt::DisplayRole: { - return QVariant(m_item->getName(index.row())); - } +// case Name: { +// switch (role) { +// case Qt::DisplayRole: { +// return QVariant(m_item->getName(index.row())); +// } // case Qt::ForegroundRole: { // return QColor(50, 50, 50); // } - default: - return QVariant(); - } - } - } +// default: +// return QVariant(); +// } +// } +// } return QVariant(); } diff --git a/src/resource.qrc b/src/resource.qrc index 018ebdd..9d1ba42 100644 --- a/src/resource.qrc +++ b/src/resource.qrc @@ -5,5 +5,6 @@ res/icons/close.svg res/qt-translations/qt_zh_CN.qm res/icons/net-disconnected.svg + res/translations/zh_CN.qm diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index 0581fac..f185f35 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -34,13 +34,13 @@ SettingsWidget::SettingsWidget(QWidget *parent) : QWidget(parent) { this->setWindowIcon(QIcon::fromTheme("kylin-search")); this->setWindowTitle(tr("ukui-search-settings")); -// this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); + this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); // this->setAttribute(Qt::WA_TranslucentBackground); - m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; - m_hints.functions = MWM_FUNC_ALL; - m_hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// m_hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS; +// m_hints.functions = MWM_FUNC_ALL; +// m_hints.decorations = MWM_DECOR_BORDER; +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); initUi(); refreshIndexState(); @@ -375,7 +375,7 @@ void SettingsWidget::showWidget() flags &= ~Qt::WindowStaysOnTopHint; this->setWindowFlags(flags); m_timer->start(); - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); +// XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); this->show(); } diff --git a/src/settings-widget.h b/src/settings-widget.h index fdb1c87..0a272ea 100644 --- a/src/settings-widget.h +++ b/src/settings-widget.h @@ -33,7 +33,7 @@ #include #include #include -#include "xatom-helper.h" +//#include "xatom-helper.h" class SettingsWidget : public QWidget { @@ -56,7 +56,7 @@ private: void showWarningDialog(const int&); void resetWebEngine(); - MotifWmHints m_hints; +// MotifWmHints m_hints; //标题栏 QVBoxLayout * m_mainLyt = nullptr; diff --git a/src/src.pro b/src/src.pro index 35eff8a..4030056 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,4 +1,4 @@ -QT += core gui dbus KWindowSystem xml x11extras +QT += core gui dbus xml x11extras greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -32,8 +32,8 @@ SOURCES += \ mainwindow.cpp \ search-app-thread.cpp \ search-result.cpp \ - settings-widget.cpp \ - xatom-helper.cpp + settings-widget.cpp +# xatom-helper.cpp HEADERS += \ @@ -43,8 +43,8 @@ HEADERS += \ mainwindow.h \ search-app-thread.h \ search-result.h \ - settings-widget.h \ - xatom-helper.h + settings-widget.h +# xatom-helper.h # Default rules for deployment. @@ -78,9 +78,3 @@ DEPENDPATH += $$PWD/../libchinese-segmentation INCLUDEPATH += $$PWD/../libsearch DEPENDPATH += $$PWD/../libsearch - -#DISTFILES += \ -# ../data/ukui-search-menu.desktop \ -# $$OUT_PWD/.qm/bo.qm \ -# $$OUT_PWD/.qm/tr.qm \ -# $$OUT_PWD/.qm/zh_CN.qm diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index 9e5b6d5..304ee25 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -4,57 +4,57 @@ ContentWidget - + Recently Opened - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Web Pages - + Unknown @@ -70,12 +70,12 @@ MainWindow - + ukui-search - + Global Search @@ -121,7 +121,7 @@ QObject - + ukui-search is already running! @@ -129,7 +129,7 @@ SearchBarHLayout - + Search @@ -137,32 +137,32 @@ SearchDetailView - + Path - + Last time modified - + Application - + Introduction: %1 - + Document - + Preview is not avaliable @@ -170,55 +170,55 @@ SettingsWidget - - - + + + Search - - + + ... - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + Please select search engine you preferred. - + baidu - + sougou - + 360 - + Cancel - + Creating ... @@ -228,102 +228,102 @@ - + <h2>Settings</h2> - + <h3>Index State</h3> - + <h3>File Index Settings</h3> - + <h3>Search Engine Settings</h3> - + Whether to delete this directory? - + Yes - + No - + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: - + Choosen path is Empty! - + Choosen path is not in "home"! - + Its' parent folder has been blocked! - + Set blocked folder failed! - + OK diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 6f1933a..ab1d08a 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -4,57 +4,57 @@ ContentWidget - + Recently Opened Yeni Açılan - + Open Quickly Hızlı Aç - + Commonly Used Genel olarak kullanılan - + Apps Uygulamalar - + Settings Ayarlar - + Files Dosyalar - + Dirs Dizinler - + File Contents Dosya İçeriği - + Best Matches En İyi Eşleşen - + Web Pages - + Unknown Bilinmeyen @@ -70,12 +70,12 @@ MainWindow - + ukui-search ukui-ara - + Global Search Genel Arama @@ -121,7 +121,7 @@ QObject - + ukui-search is already running! ukui-bul zaten çalışıyor! @@ -129,7 +129,7 @@ SearchBarHLayout - + Search Ara @@ -137,32 +137,32 @@ SearchDetailView - + Path Yol - + Last time modified Son değiştirilme zamanı - + Application Uygulama - + Introduction: %1 - + Document Belge - + Preview is not avaliable @@ -170,55 +170,55 @@ SettingsWidget - - - + + + Search Ara - - + + ... ... - + Following folders will not be searched. You can set it by adding and removing folders. Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz. - + Add ignored folders Göz ardı edilen klasörleri ekleyin - + Please select search engine you preferred. Lütfen tercih ettiğiniz arama motorunu seçin. - + baidu - + sougou - + 360 - + Cancel İptal - + Creating ... Oluşturuluyor... @@ -232,102 +232,102 @@ - + <h2>Settings</h2> <h2>Ayarlar</h2> - + <h3>Index State</h3> <h3>Dizin Durumu</h3> - + <h3>File Index Settings</h3> <h3>Dosya Dizini Ayarları</h3> - + <h3>Search Engine Settings</h3> <h3>SArama Motoru Ayarları</h3> - + Whether to delete this directory? Bu dizini silinsin mi? - + Yes - + No - + Done Tamam - + Index Entry: %1 Dizin Girişi: %1 - + Directories Dizinler - + select blocked folder engellenen klasörü seç - + Select Seç - + Position: Pozisyon: - + FileName: Dosya Adı: - + FileType: Dosya Türü: - + Choosen path is Empty! - + Choosen path is not in "home"! - + Its' parent folder has been blocked! - + Set blocked folder failed! - + OK diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 983c03b..f9d53c5 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -4,57 +4,57 @@ ContentWidget - + Recently Opened 最近 - + Open Quickly 快速入口 - + Commonly Used 常用 - + Apps 应用 - + Settings 配置项 - + Files 文件 - + Dirs 文件夹 - + File Contents 文件内容 - + Best Matches 最佳匹配 - + Web Pages 网页 - + Unknown 未知 @@ -70,12 +70,12 @@ MainWindow - + ukui-search 搜索 - + Global Search 搜索 @@ -121,7 +121,7 @@ QObject - + ukui-search is already running! @@ -129,7 +129,7 @@ SearchBarHLayout - + Search 搜索 @@ -137,32 +137,32 @@ SearchDetailView - + Path 路径 - + Last time modified 上次修改时间 - + Application 应用 - + Introduction: %1 软件介绍: %1 - + Document 文件 - + Preview is not avaliable 当前预览不可用 @@ -175,115 +175,115 @@ 搜索 - - - + + + Search 搜索 - + <h2>Settings</h2> <h2>设置</h2> - + <h3>Index State</h3> <h3>索引状态</h3> - - + + ... - + <h3>File Index Settings</h3> <h3>文件索引设置</h3> - + Following folders will not be searched. You can set it by adding and removing folders. 搜索将不再查看以下文件夹。通过增加和删除文件夹可进行文件索引设置。 - + Add ignored folders 添加文件夹至黑名单 - + <h3>Search Engine Settings</h3> <h3>搜索引擎设置</h3> - + Please select search engine you preferred. 设置互联网搜索引擎 - + baidu 百度 - + sougou 搜狗 - + 360 360 - + Whether to delete this directory? 是否要删除此目录 - + Yes 是(Y) - + No 否(N) - + Cancel 取消 - + Choosen path is Empty! 选择的路径不存在! - + Choosen path is not in "home"! 请选择家目录下的文件夹! - + Its' parent folder has been blocked! 父文件夹已被屏蔽! - + Set blocked folder failed! - + OK 好的 - + Creating ... 正在索引 @@ -292,42 +292,42 @@ 搜索 - + Done 索引完成 - + Index Entry: %1 索引项: %1 - + Directories 文件夹 - + select blocked folder 选择屏蔽文件夹 - + Select 选择 - + Position: 位置: - + FileName: 名称: - + FileType: 类型: From 1d6c0c3374b8861cfd1a153d6b92f96bddacf174 Mon Sep 17 00:00:00 2001 From: iaom Date: Tue, 20 Apr 2021 19:26:35 +0800 Subject: [PATCH 02/25] Add translations. --- src/res/translations/zh_CN.qm | Bin 0 -> 4370 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/res/translations/zh_CN.qm diff --git a/src/res/translations/zh_CN.qm b/src/res/translations/zh_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..b09ce9026a946114ba8b911e3ebadabd61d3aaee GIT binary patch literal 4370 zcma)9eQX@X6`!;BZtvTUn?PiuWb6WUUBw@<>c*+-lGuS*wfF2h$Cs-im%ZD$yRG+j zue*CbPT;syMsbu6I|W)xji?b-L`4*(6-`M?gZibQB1)o4RDk+{O4J}ELTP0FKp}l| zd!C%lZNypf-0Z&J@BQAJH*e;8Uz9ff`P#{+UTfO)@_}c5`}bW4)wmIIejOp-9vDL~ z-i1(S5FrE>Ho zhHJncEu(Kg_b5C+jWRR81pGhI^Itmv{Fl(X3+*s}$T9wp69{>~UmHDpCqjYq+&Bh) z$9vr3;7bVc%iMpS-3R)9?bLoZ3*$!TBaSm*ch&jhxkZ?tutqLtjs9Ba$*=qrcsraY zk9Q*ER-LEsdl$t1)iuAl7H|i7*LJGAm0wp6@p&%tTc*LkljFCweFX1){HY5B#!>#X z_9^K6E`Ro}{Rjmc`Cm1^0&zUdU)|XT`55OvZl%v(aKC!!I*fFay*FsS-Jkj#=MI9Oknc?0c8FW_^L%=Q!$rTWErO z{@(x2&&~kuVj%Wk74+N)Jo}4HVBZmVGa-XrQ*i0^7hsIm;kiq|ceU=)o50Wg1YQO| zgiIlB|C9L^H+(@ZI@_7c89aOm^lPd~R5L0|X<|C4r8|v6Mx^J&FthgWB8G{FMKhTp zb|`ND_6mNW&1N-KDdN2bk!&2f$RS}l*2COz1F~*M@20k+k58Ou)`9zFh2XM$I~Ye{ z4C15^J5zW3{e>-~B=T=&?hoaNibwNua#AVU#K5J|{AGry3zH-y6T+rY`@l~O&!~$< z26IP5F#e&$%$o;@LQI0q z48bW)k%*49yot3GPADRzK{ib4Hh6#O-4IL%O_D8@4JU1yZe~P*2NW$KDmX$!J(-~x z@31JVQCXF=LKS=0=QZ@@C-d@F!2y+>sgjQ6m0+vOvzq>zJrJcS;hDWHjAO zLQtlL2Z%9gYPpiUP|lP!bzCNvy!953@JaZYOx#ddECF*;I#3EFe zRSm1!lMmXHA}2+Tw6Yr_-LqFL)=LLLZPGvi#I_M$j-MLW?xzEWue#l2fv^`E7)+S^{pQ zTn5#RgYigscyaddD?%W0t)j(l9MQ=XR4ZK#RWq?TB`UI*P>7B6Rm)l1*49Stf-9Y; zqW`;47wSeGEVSCL?hZTKJ5Vpmplzt{$b}gdzPDR5hF#a2+19t>qqiLFO5|Z^FjngX@-AEQ#uai(te-pJC`+v*UQdb3oTg}! z+Y&OhwCTk+NPn?WyM>Zk1&?>DX;~$oPjIP=(M-g89{bHFMWkp!ngYn>zIWm5WP8G;o4I$tDynIY}h@ni{(owIBg~nPsL%(CpTX zi%n16I>&25-?B4opxG9F@V&8_(Um5__*+L5A{sQs3RGb^)0kKd0?tI7(@Bcxu)%G! z=?cLeva)tYG()ydFFQrHM{>1nb9DbQ!Ek<4rFP8qsrIpZ4?jlhZc?IKo&lSp83LC{ zo!+*jmAfUh52?KWir=*3bf?;3RbmyZQX8}1tlZSW{im2$XF`;vyd86phDHl$O;gxV zUXF6Tlr_%V2gmj&vU@Fll_4 jn7U}yRTX8yR9|sN>UyjZwb4HY^V6^~jl10P*I@q-6Kh9? literal 0 HcmV?d00001 From 108a1bb4e06a7414e431e08ae7fc267ebedd359f Mon Sep 17 00:00:00 2001 From: iaom Date: Thu, 6 May 2021 20:59:49 +0800 Subject: [PATCH 03/25] Add C++ interface. --- debian/control | 8 + debian/libchinese-segmentation-dev.install | 2 + debian/libchinese-segmentation0.install | 2 +- debian/libukui-search-dev.install | 2 +- debian/libukui-search0.install | 2 +- .../libchinese-segmentation.pro | 6 + libsearch/index/construct-document.cpp | 2 +- libsearch/index/index-generator.cpp | 2 +- libsearch/index/search-manager.cpp | 385 ++++++++++++++++++ libsearch/index/search-manager.h | 63 ++- libsearch/libsearch.h | 14 +- libsearch/libsearch.pro | 17 +- 12 files changed, 484 insertions(+), 21 deletions(-) create mode 100644 debian/libchinese-segmentation-dev.install diff --git a/debian/control b/debian/control index de27efd..a59ed26 100644 --- a/debian/control +++ b/debian/control @@ -42,6 +42,14 @@ Description: Libraries for chinese-segmentation This package contains a few runtime libraries needed by libsearch. +Package: libchinese-segmentation-dev +Section: libdevel +Architecture: any +Depends: ${misc:Depends}, + ${shlibs:Depends}, + libchinese-segmentation0 (= ${binary:Version}) +Description: Libraries for chinese-segmentation(development files). + Package: libukui-search0 Section: libs Architecture: any diff --git a/debian/libchinese-segmentation-dev.install b/debian/libchinese-segmentation-dev.install new file mode 100644 index 0000000..037e91e --- /dev/null +++ b/debian/libchinese-segmentation-dev.install @@ -0,0 +1,2 @@ +usr/include/chinese-seg/* +usr/lib/*.so diff --git a/debian/libchinese-segmentation0.install b/debian/libchinese-segmentation0.install index 0299c40..b726c3c 100644 --- a/debian/libchinese-segmentation0.install +++ b/debian/libchinese-segmentation0.install @@ -1,2 +1,2 @@ -usr/lib/*.so.* +usr/lib/libchinese-segmentation.so.* /usr/share/ukui-search/res/dict/*.utf8 diff --git a/debian/libukui-search-dev.install b/debian/libukui-search-dev.install index b814d89..e31886a 100644 --- a/debian/libukui-search-dev.install +++ b/debian/libukui-search-dev.install @@ -1,2 +1,2 @@ usr/include/ukui-search/* -usr/lib/*/*.so \ No newline at end of file +usr/lib/*/libukui-search.so diff --git a/debian/libukui-search0.install b/debian/libukui-search0.install index 3de3b10..c6bfa96 100644 --- a/debian/libukui-search0.install +++ b/debian/libukui-search0.install @@ -1 +1 @@ -usr/lib/*/*.so.* +usr/lib/*/libukui-search.so.* diff --git a/libchinese-segmentation/libchinese-segmentation.pro b/libchinese-segmentation/libchinese-segmentation.pro index 8823ae7..941875a 100644 --- a/libchinese-segmentation/libchinese-segmentation.pro +++ b/libchinese-segmentation/libchinese-segmentation.pro @@ -39,6 +39,12 @@ unix { } !isEmpty(target.path): INSTALLS += target +header.path = /usr/include/chinese-seg/ +header.files = *.h +header_cppjieba.path = /usr/include/chinese-seg/cppjieba/ +header_cppjieba.files = cppjieba/* +INSTALLS += header header_cppjieba + #DISTFILES += \ # jiaba/jieba.pri diff --git a/libsearch/index/construct-document.cpp b/libsearch/index/construct-document.cpp index 3b9b780..5fc6bbb 100644 --- a/libsearch/index/construct-document.cpp +++ b/libsearch/index/construct-document.cpp @@ -19,7 +19,7 @@ */ #include "construct-document.h" #include "file-utils.h" -#include "chinese-segmentation.h" +#include "chinese-seg/chinese-segmentation.h" #include #include #include diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index 3847cb3..4b4d2b9 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -28,7 +28,7 @@ #include "file-utils.h" #include "index-generator.h" #include "global-settings.h" -#include "chinese-segmentation.h" +#include "chinese-seg/chinese-segmentation.h" #include "construct-document.h" #include diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index b8202cb..acc9d6b 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -31,6 +31,33 @@ SearchManager::SearchManager(QObject *parent) : QObject(parent) m_pool.setExpiryTimeout(1000); } +void SearchManager::searchLocalFiles(std::string keyword, std::queue *searchResultFile, std::queue *searchResultDir, std::queue *searchResultContent) +{ + m_mutex1.lock(); + ++uniqueSymbol1; + m_mutex1.unlock(); + m_mutex2.lock(); + ++uniqueSymbol2; + m_mutex2.unlock(); + m_mutex3.lock(); + ++uniqueSymbol3; + m_mutex3.unlock(); + + FileSearchV4 *filesearch; + filesearch = new FileSearchV4(searchResultFile,uniqueSymbol1,QString::fromStdString(keyword),"0",1,0,5); + m_pool.start(filesearch); + + FileSearchV4 *dirsearch; + dirsearch = new FileSearchV4(searchResultDir,uniqueSymbol2,QString::fromStdString(keyword),"1",1,0,5); + m_pool.start(dirsearch); + + FileContentSearchV4 *contentSearch; + contentSearch = new FileContentSearchV4(searchResultContent,uniqueSymbol3,QString::fromStdString(keyword),0,5); + m_pool.start(contentSearch); + return; + +} + SearchManager::~SearchManager() { } @@ -438,3 +465,361 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord) // // deleteAllIndex(pathTobeDelete) return 0; } + +FileSearchV4::FileSearchV4(std::queue *searchResultFile, size_t uniqueSymbol, QString keyword, QString value, unsigned slot, int begin, int num) +{ + this->setAutoDelete(true); + m_search_result = searchResultFile; + m_uniqueSymbol = uniqueSymbol; + m_keyword = keyword; + m_value = value; + m_slot = slot; + m_begin = begin; + m_num = num; +} + +FileSearchV4::~FileSearchV4() +{ + m_search_result = nullptr; +} + +void FileSearchV4::run() +{ + int resultCount = 0; + int total = 0; + while(total < 100) + { + resultCount = keywordSearchfile(); + if(resultCount == 0 || resultCount == -1) + break; + total += resultCount; + m_begin += m_num; + } + return; +} + +int FileSearchV4::keywordSearchfile() +{ + try + { + qDebug() << "--keywordSearchfile start--"; + Xapian::Database db(INDEX_PATH); + Xapian::Query query = creatQueryForFileSearch(db); + Xapian::Enquire enquire(db); + + Xapian::Query queryFile; + if(!m_value.isEmpty()) + { + std::string slotValue = m_value.toStdString(); + Xapian::Query queryValue = Xapian::Query(Xapian::Query::OP_VALUE_RANGE,m_slot,slotValue,slotValue); + queryFile = Xapian::Query(Xapian::Query::OP_AND,query,queryValue); + } + else + { + queryFile = query; + } + + qDebug() << "keywordSearchfile:"< v; + for(int i=0;iappend(QString::fromStdString(data)); + qDebug()<(info.size()); + sSearchResult.type = info.suffix().toStdString(); + sSearchResult.time = info.lastModified().toString("yyyy/MM/dd hh:mm:ss").toStdString(); + + switch (m_value.toInt()) + { + case 1: + SearchManager::m_mutex1.lock(); + if(m_uniqueSymbol == SearchManager::uniqueSymbol2) + { + m_search_result->push(sSearchResult); + SearchManager::m_mutex1.unlock(); + } + else + { + SearchManager::m_mutex1.unlock(); + return -1; + } + + break; + case 0: + SearchManager::m_mutex2.lock(); + if(m_uniqueSymbol == SearchManager::uniqueSymbol1) + { + m_search_result->push(sSearchResult); + SearchManager::m_mutex2.unlock(); + } + else + { + SearchManager::m_mutex2.unlock(); + return -1; + } + break; + default: + break; + } + // searchResult.append(path); + } + qDebug()<< "doc="<< path << ",weight=" <callSegement(ret, keyword.toLocal8Bit().data()); + for (::friso::ResultMap::iterator it_map = ret.begin(); it_map != ret.end(); ++it_map){ + target_str += it_map->first; + target_str += " "; + it_map->second.first.clear(); + ::std::vector().swap(it_map->second.first); + } + + ret.clear(); + ret.erase(ret.begin(), ret.end()); + ::friso::ResultMap().swap(ret); +*/ + QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword); + //Creat a query + std::string words; + for(int i=0;i sKeyWord = ChineseSegmentation::getInstance()->callSegement(keyword); +// //Creat a query +// std::string words; +// for(int i=0;i v; + // for(int i=0;iappend(QString::fromStdString(data)); + qDebug()<(info.size()); + sSearchResult.type = info.suffix().toStdString(); + sSearchResult.time = info.lastModified().toString("yyyy/MM/dd hh:mm:ss").toStdString(); + + // Construct snippets containing keyword. +// snippets.append(QString::fromStdString( result.snippet(doc.get_data(),400))); +// qWarning()< 6 + QString::fromStdString(keyWord).size()) + snippet.replace(0,3,"...").replace(snippet.size()-3,3,"..."); + else + snippet.append("...").prepend("..."); + sSearchResult.snippets.push_back(snippet.toStdString()); + + QString().swap(snippet); + std::string().swap(s); + ++count; + } + std::string().swap(data); + +// for(QString i : QString::fromStdString(keyWord).split(" ",QString::SkipEmptyParts)) +// { +// std::string word = i.toStdString(); +// term.skip_to(word); +// int size = word.size(); +// auto pos = term.positionlist_begin(); +// std::string s = data.substr((*pos < 60)? 0: (*pos - 60) , size + 120); +// QString snippet = QString::fromStdString(s); +// snippet.replace(0,3,"...").replace(snippet.size()-3,3,"..."); +// snippets.append(snippet); +// std::string().swap(word); +// std::string().swap(s); +// QString().swap(snippet); +// } + + SearchManager::m_mutex3.lock(); + if(m_uniqueSymbol == SearchManager::uniqueSymbol3) + { + + m_search_result->push(sSearchResult); + SearchManager::m_mutex3.unlock(); + } + else + { + SearchManager::m_mutex3.unlock(); + return -1; + } + // searchResult.insert(path,snippets); + qDebug()<< "path="<< path << ",weight=" < snippets; + std::string time; + std::string type; + size_t size; +}; -class SearchManager : public QObject +class LIBSEARCH_EXPORT SearchManager : public QObject { friend class FileSearch; friend class FileContentSearch; + friend class FileSearchV4; + friend class FileContentSearchV4; Q_OBJECT public: explicit SearchManager(QObject *parent = nullptr); + void searchLocalFiles(std::string keyword, + std::queue *searchResultFile, + std::queue *searchResultDir, + std::queue *searchResultContent); ~SearchManager(); static int getCurrentIndexCount(); @@ -60,6 +76,7 @@ public: static size_t uniqueSymbol1; static size_t uniqueSymbol2; static size_t uniqueSymbol3; + static QMutex m_mutex1; static QMutex m_mutex2; static QMutex m_mutex3; @@ -133,4 +150,42 @@ private: int m_begin = 0; int m_num = 20; }; + +class FileSearchV4 : public QRunnable +{ +public: + explicit FileSearchV4(std::queue *searchResult,size_t uniqueSymbol, QString keyword, QString value,unsigned slot = 1,int begin = 0, int num = 20); + ~FileSearchV4(); +protected: + void run(); +private: + int keywordSearchfile(); + Xapian::Query creatQueryForFileSearch(Xapian::Database &db); + int getResult(Xapian::MSet &result); + + std::queue *m_search_result = nullptr; + QString m_value; + unsigned m_slot = 1; + size_t m_uniqueSymbol; + QString m_keyword; + int m_begin = 0; + int m_num = 20; +}; +class FileContentSearchV4 : public QRunnable +{ +public: + explicit FileContentSearchV4(std::queue *searchResult,size_t uniqueSymbol, QString keyword, int begin = 0, int num = 20); + ~FileContentSearchV4(); +protected: + void run(); +private: + int keywordSearchContent(); + int getResult(Xapian::MSet &result,std::string &keyWord); + + std::queue *m_search_result = nullptr; + size_t m_uniqueSymbol; + QString m_keyword; + int m_begin = 0; + int m_num = 20; +}; #endif // SEARCHMANAGER_H diff --git a/libsearch/libsearch.h b/libsearch/libsearch.h index 83febb4..5ed2945 100644 --- a/libsearch/libsearch.h +++ b/libsearch/libsearch.h @@ -31,14 +31,14 @@ #include "index/ukui-search-qdbus.h" #include "index/inotify-index.h" -class LIBSEARCH_EXPORT GlobalSearch -{ -public: +//class LIBSEARCH_EXPORT GlobalSearch +//{ +//public: - static QStringList fileSearch(QString keyword, int begin = 0, int num = -1); +// static QStringList fileSearch(QString keyword, int begin = 0, int num = -1); -private: - GlobalSearch(); -}; +//private: +// GlobalSearch(); +//}; #endif // LIBSEARCH_H diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro index 7a11e61..4de2e65 100644 --- a/libsearch/libsearch.pro +++ b/libsearch/libsearch.pro @@ -59,15 +59,22 @@ unix { target.path = $$[QT_INSTALL_LIBS] INSTALLS += target - header.path = /usr/include/ukui-search - header.files += libsearch.h - INSTALLS += header + header.path = /usr/include/ukui-search/ + header.files += *.h + header_appsearch.path = /usr/include/ukui-search/appsearch/ + header_appsearch.files = appsearch/*.h + header_index.path = /usr/include/ukui-search/index/ + header_index.files = index/*.h + header_settingsearch.path = /usr/include/ukui-search/settingsearch/ + header_settingsearch.files = settingsearch/*.h + + INSTALLS += header header_appsearch header_index header_settingsearch } -INCLUDEPATH += $$PWD/../libchinese-segmentation -DEPENDPATH += $$PWD/../libchinese-segmentation +#INCLUDEPATH += $$PWD/../libchinese-segmentation +#DEPENDPATH += $$PWD/../libchinese-segmentation #DISTFILES += \ # ../translations/libsearch/libukui-search_zh_CN.ts From 483947db31a6c892b7656ad533fe895175144309 Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 7 May 2021 19:39:43 +0800 Subject: [PATCH 04/25] Add autostart confs; --- data/ukui-search.desktop | 7 +++---- libsearch/index/first-index.cpp | 6 +++--- libsearch/index/inotify-index.cpp | 2 +- src/search-app-thread.cpp | 4 +++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/data/ukui-search.desktop b/data/ukui-search.desktop index 1a8bbe0..db77937 100644 --- a/data/ukui-search.desktop +++ b/data/ukui-search.desktop @@ -8,7 +8,6 @@ Comment[zh_CN]=全局搜索 Exec=/usr/bin/ukui-search %U Type=Application Icon=kylin-search -X-UKUI-AutoRestart=true -OnlyShowIn=UKUI -X-UKUI-Autostart-Phase=Application -Terminal=false +OnlyShowIn=MATE; +X-MATE-Autostart-Phase=Application +X-MATE-AutoRestart=true diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index 878593b..144ea59 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -129,7 +129,7 @@ void FirstIndex::run(){ mutex2.lock(); mutex3.lock(); sem.acquire(4); - QtConcurrent::run([&](){ +// QtConcurrent::run([&](){ sem.acquire(1); mutex1.unlock(); this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); @@ -137,7 +137,7 @@ void FirstIndex::run(){ FileUtils::_max_index_count = this->q_index->length(); qDebug()<<"max_index_count:"<forceSync(); +// GlobalSettings::getInstance()->forceSync(); ::_exit(0); } else if(pid < 0) diff --git a/libsearch/index/inotify-index.cpp b/libsearch/index/inotify-index.cpp index fa7ae2b..dddc18b 100644 --- a/libsearch/index/inotify-index.cpp +++ b/libsearch/index/inotify-index.cpp @@ -323,7 +323,7 @@ fork: qDebug() << "select timeout!"; ::free(read_timeout); IndexGenerator::getInstance()->~IndexGenerator(); - GlobalSettings::getInstance()->forceSync(); +// GlobalSettings::getInstance()->forceSync(); ::_exit(0); }else{ GlobalSettings::getInstance()->setValue(INOTIFY_NORMAL_EXIT, "0"); diff --git a/src/search-app-thread.cpp b/src/search-app-thread.cpp index ffd1493..c382742 100644 --- a/src/search-app-thread.cpp +++ b/src/search-app-thread.cpp @@ -39,8 +39,10 @@ SearchApp::~SearchApp() void SearchApp::run() { + size_t tmp_uniqueSymbol; m_mutex.lock(); uniqueSymbol++; + tmp_uniqueSymbol = uniqueSymbol; m_mutex.unlock(); //nameList:应用名,pathList:已安装的是.desktop路径,未安装为空,iconList:已安装的是图标名,未安装的是图标路径 QStringList nameList, pathList, iconList, descList; @@ -74,7 +76,7 @@ void SearchApp::run() appVector.append(iconList); appVector.append(descList); m_mutex.lock(); - if (uniqueSymbol == uniqueSymbol) { + if (tmp_uniqueSymbol == uniqueSymbol) { Q_EMIT this->searchResultApp(appVector); } m_mutex.unlock(); From c8f718eeb7ae7ffca8ff1ecb589a23a5481f2543 Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 7 May 2021 19:55:54 +0800 Subject: [PATCH 05/25] Add menu action. --- data/ukui-search-menu.desktop | 3 --- 1 file changed, 3 deletions(-) diff --git a/data/ukui-search-menu.desktop b/data/ukui-search-menu.desktop index 07b5690..eeaf1ab 100644 --- a/data/ukui-search-menu.desktop +++ b/data/ukui-search-menu.desktop @@ -8,7 +8,4 @@ Comment[zh_CN]=全局搜索 Exec=/usr/bin/ukui-search -s Type=Application Icon=kylin-search -X-UKUI-AutoRestart=true -OnlyShowIn=UKUI -X-UKUI-Autostart-Phase=Application Terminal=false From cbc592b9d3a28f1e9d277d8da39acd514decd8de Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Thu, 13 May 2021 10:34:31 +0800 Subject: [PATCH 06/25] Optimize code. --- libsearch/index/construct-document.cpp | 2 +- libsearch/index/index-generator.cpp | 2 +- libsearch/index/search-manager.h | 6 +++--- libsearch/libsearch.pro | 19 +++++-------------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/libsearch/index/construct-document.cpp b/libsearch/index/construct-document.cpp index 5fc6bbb..3b9b780 100644 --- a/libsearch/index/construct-document.cpp +++ b/libsearch/index/construct-document.cpp @@ -19,7 +19,7 @@ */ #include "construct-document.h" #include "file-utils.h" -#include "chinese-seg/chinese-segmentation.h" +#include "chinese-segmentation.h" #include #include #include diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index 4b4d2b9..3847cb3 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -28,7 +28,7 @@ #include "file-utils.h" #include "index-generator.h" #include "global-settings.h" -#include "chinese-seg/chinese-segmentation.h" +#include "chinese-segmentation.h" #include "construct-document.h" #include diff --git a/libsearch/index/search-manager.h b/libsearch/index/search-manager.h index 4e34b71..e359125 100644 --- a/libsearch/index/search-manager.h +++ b/libsearch/index/search-manager.h @@ -39,9 +39,9 @@ #include #include -#include "../file-utils.h" -#include "../global-settings.h" -#include "chinese-seg/chinese-segmentation.h" +#include "file-utils.h" +#include "global-settings.h" +#include "chinese-segmentation.h" #define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro index 4de2e65..42dd0cb 100644 --- a/libsearch/libsearch.pro +++ b/libsearch/libsearch.pro @@ -59,22 +59,13 @@ unix { target.path = $$[QT_INSTALL_LIBS] INSTALLS += target - header.path = /usr/include/ukui-search/ - header.files += *.h - header_appsearch.path = /usr/include/ukui-search/appsearch/ - header_appsearch.files = appsearch/*.h - header_index.path = /usr/include/ukui-search/index/ - header_index.files = index/*.h - header_settingsearch.path = /usr/include/ukui-search/settingsearch/ - header_settingsearch.files = settingsearch/*.h - - INSTALLS += header header_appsearch header_index header_settingsearch + header.path = /usr/include/ukui-search + header.files += *.h index/*.h appsearch/*.h settingsearch/*.h + INSTALLS += header } - - -#INCLUDEPATH += $$PWD/../libchinese-segmentation -#DEPENDPATH += $$PWD/../libchinese-segmentation +INCLUDEPATH += $$PWD/../libchinese-segmentation +DEPENDPATH += $$PWD/../libchinese-segmentation #DISTFILES += \ # ../translations/libsearch/libukui-search_zh_CN.ts From fdcb6e66ffe6085c205caef7338c54f7828dfa44 Mon Sep 17 00:00:00 2001 From: iaom Date: Tue, 25 May 2021 09:17:54 +0800 Subject: [PATCH 07/25] Modified index path. --- debian/changelog | 18 ++++++ .../chinese-segmentation.cpp | 8 +-- .../chinese-segmentation.h | 2 +- libsearch/appsearch/app-match.cpp | 10 +-- libsearch/global-settings.cpp | 8 +++ libsearch/global-settings.h | 12 +++- libsearch/index/construct-document.cpp | 2 +- libsearch/index/document.cpp | 2 +- libsearch/index/document.h | 2 +- libsearch/index/first-index.cpp | 7 +- libsearch/index/index-generator.cpp | 8 ++- libsearch/index/index-status-recorder.h | 2 +- libsearch/index/inotify-index.cpp | 35 +++++----- libsearch/index/inotify-index.h | 6 +- libsearch/index/search-manager.cpp | 7 +- libsearch/index/search-manager.h | 6 +- libsearch/index/searchmethodmanager.cpp | 7 +- libsearch/index/traverse_bfs.cpp | 41 ++++++------ libsearch/index/traverse_bfs.h | 6 +- libsearch/index/ukui-search-qdbus.cpp | 2 +- libsearch/parser/binary-parser.cpp | 5 +- .../plugininterface/search-plugin-iface.h | 5 +- libsearch/settingsearch/setting-match.cpp | 9 +++ src/content-widget.cpp | 15 +++-- src/content-widget.h | 2 +- src/control/config-file.h | 2 +- src/control/folder-list-item.cpp | 5 +- src/control/home-page-item.cpp | 1 - src/control/option-view.cpp | 64 ++++++++++--------- src/control/option-view.h | 4 ++ src/control/search-detail-view.cpp | 16 ++--- src/control/search-detail-view.h | 1 + src/control/search-list-view.cpp | 13 +--- src/control/show-more-label.cpp | 4 +- src/create-index-ask-dialog.cpp | 2 - src/custom-style.cpp | 49 -------------- src/custom-style.h | 39 ----------- src/input-box.cpp | 5 +- src/main.cpp | 7 ++ src/mainwindow.cpp | 10 +-- src/mainwindow.h | 2 +- src/model/search-item-model.cpp | 6 -- src/model/search-item-model.h | 1 - src/settings-widget.cpp | 8 +-- src/src.pro | 2 - 45 files changed, 221 insertions(+), 247 deletions(-) delete mode 100644 src/custom-style.cpp delete mode 100644 src/custom-style.h diff --git a/debian/changelog b/debian/changelog index b4d18d9..7f17c1f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +ukui-search (0.4.0+0520) v101; urgency=medium + + * Bug 55034,55545,55326,55496 + * 任务29459 + * 其他改动: + * Fix:Seletion is cleared when paletted changed. + - 修复收到palettechanged信号时列表选中状态消失的问题。 + * Fix:Icon in detail view will not refresh when icon-theme changed. + - 修复主题图标改变时详情页图标未更新的问题。 + * Fix:Index process crashed when parsing some wps templates. + - 修复了解析某些wps模板文件时索引崩溃的问题。 + * Fix:Block list conf won't work. + - 修复了在控制面板设置黑名单不能及时生效的问题。 + * Fix:Automatic completion won't work in next search after clicked actions in detial widget. + - 修复了点击详情页不会保存搜索历史记录的bug。 + + -- zhangpengfei Thu, 20 May 2021 09:08:15 +0800 + ukui-search (0.4.0+0508) v101; urgency=medium * Bug 49153. diff --git a/libchinese-segmentation/chinese-segmentation.cpp b/libchinese-segmentation/chinese-segmentation.cpp index ea80a67..477f5b7 100644 --- a/libchinese-segmentation/chinese-segmentation.cpp +++ b/libchinese-segmentation/chinese-segmentation.cpp @@ -52,10 +52,10 @@ ChineseSegmentation *ChineseSegmentation::getInstance() { return global_instance_chinese_segmentation; } -QVector ChineseSegmentation::callSegement(QString str) { - std::string s; - s = str.toStdString(); - str.squeeze(); +QVector ChineseSegmentation::callSegement(std::string s) { +// std::string s; +// s = str.toStdString(); +// str.squeeze(); const size_t topk = -1; std::vector keywordres; diff --git a/libchinese-segmentation/chinese-segmentation.h b/libchinese-segmentation/chinese-segmentation.h index 0950e84..b3c8090 100644 --- a/libchinese-segmentation/chinese-segmentation.h +++ b/libchinese-segmentation/chinese-segmentation.h @@ -47,7 +47,7 @@ class CHINESESEGMENTATION_EXPORT ChineseSegmentation { public: static ChineseSegmentation *getInstance(); ~ChineseSegmentation(); - QVector callSegement(QString str); + QVector callSegement(std::string s); void convert(std::vector& keywordres, QVector& kw); private: static QMutex m_mutex; diff --git a/libsearch/appsearch/app-match.cpp b/libsearch/appsearch/app-match.cpp index 5b0b55c..0e0269e 100644 --- a/libsearch/appsearch/app-match.cpp +++ b/libsearch/appsearch/app-match.cpp @@ -102,12 +102,12 @@ void AppMatch::getAllDesktopFilePath(QString path) { } else { //过滤LXQt、KDE QString filePathStr = fileInfo.filePath(); - if(filePathStr.contains("KDE", Qt::CaseInsensitive) || +// if(filePathStr.contains("KDE", Qt::CaseInsensitive) || // filePathStr.contains("mate",Qt::CaseInsensitive)|| - filePathStr.contains("LX", Qt::CaseInsensitive)) { - i++; - continue; - } +// filePathStr.contains("LX", Qt::CaseInsensitive)) { +// i++; +// continue; +// } //过滤后缀不是.desktop的文件 if(!filePathStr.endsWith(".desktop")) { i++; diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index 8644fcf..2a441da 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -37,6 +37,14 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { // m_settings->setAtomicSyncRequired(false); m_block_dirs_settings = new QSettings(BLOCK_DIRS, QSettings::IniFormat, this); m_block_dirs_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); +// m_block_dirs_settings->setValue("These_are_block_dirs_conf_for_ukui_search","0"); +// m_block_dirs_settings->sync(); +// m_confWatcher = new QFileSystemWatcher(this); +// m_confWatcher->addPath(BLOCK_DIRS); +// connect(m_confWatcher, &QFileSystemWatcher::fileChanged, this, [ & ]() { +// m_block_dirs_settings->sync(); +// m_confWatcher->addPath(BLOCK_DIRS); +// }); m_search_record_settings = new QSettings(SEARCH_HISTORY, QSettings::IniFormat, this); m_search_record_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); diff --git a/libsearch/global-settings.h b/libsearch/global-settings.h index 3de9ded..7cc977a 100644 --- a/libsearch/global-settings.h +++ b/libsearch/global-settings.h @@ -26,6 +26,7 @@ #include #include #include +#include //#include //If use pkg_config, it wont build succes,why????????? //My demo can build access yet. @@ -49,9 +50,13 @@ #define PATH_NOT_IN_HOME 2; #define PATH_PARENT_BLOCKED 3; -#define MAIN_SETTINGS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search.conf" -#define BLOCK_DIRS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf" -#define SEARCH_HISTORY QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-history.conf" +//#define MAIN_SETTINGS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search.conf" +//#define BLOCK_DIRS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf" +//#define SEARCH_HISTORY QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-history.conf" + +#define MAIN_SETTINGS "/media/用户保险箱/.ukui-search/ukui-search.conf" +#define BLOCK_DIRS "/media/用户保险箱/.ukui-search/ukui-search-block-dirs.conf" +#define SEARCH_HISTORY "/media/用户保险箱/.ukui-search/ukui-search-history.conf" //#define CLOUD_HISTORY "history" //#define CLOUD_APPLICATIONS "applications" @@ -102,6 +107,7 @@ private: QSettings *m_search_record_settings; QMap m_cache; QStringList m_history; + QFileSystemWatcher *m_confWatcher; QMutex m_mutex; // size_t test = 0; diff --git a/libsearch/index/construct-document.cpp b/libsearch/index/construct-document.cpp index a479ba2..5be7af1 100644 --- a/libsearch/index/construct-document.cpp +++ b/libsearch/index/construct-document.cpp @@ -111,7 +111,7 @@ void ConstructDocumentForContent::run() { QString uniqueterm = QString::fromStdString(FileUtils::makeDocUterm(m_path)); QString upTerm = QString::fromStdString(FileUtils::makeDocUterm(m_path.section("/", 0, -2, QString::SectionIncludeLeadingSep))); - QVector term = ChineseSegmentation::getInstance()->callSegement(content.left(20480000)); + QVector term = ChineseSegmentation::getInstance()->callSegement(content.left(20480000).toStdString()); Document doc; doc.setData(content); diff --git a/libsearch/index/document.cpp b/libsearch/index/document.cpp index 6200c0c..68b21df 100644 --- a/libsearch/index/document.cpp +++ b/libsearch/index/document.cpp @@ -20,7 +20,7 @@ #include "document.h" #include using namespace Zeeker; -void Document::setData(QString data) { +void Document::setData(QString &data) { if(data.isEmpty()) return; m_document.set_data(data.toStdString()); diff --git a/libsearch/index/document.h b/libsearch/index/document.h index f6b8c20..d4549e8 100644 --- a/libsearch/index/document.h +++ b/libsearch/index/document.h @@ -39,7 +39,7 @@ public: m_index_text = other.m_index_text; m_unique_term = other.m_unique_term; } - void setData(QString data); + void setData(QString &data); void addPosting(std::string term, QVector offset, int weight = 1); void addPosting(std::string term, unsigned int offset, int weight = 1); void addTerm(QString term); diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index f60aaab..a170270 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -138,7 +138,12 @@ void FirstIndex::run() { // QtConcurrent::run([&](){ sem.acquire(1); mutex1.unlock(); - this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + QStringList pathList; + pathList.append("/media/用户保险箱"); + pathList.append("/media/邮件保险箱"); + pathList.append("/media/公共保险箱"); + pathList.append("/media/备份保险箱"); + this->setPath(pathList); this->Traverse(); FileUtils::_max_index_count = this->q_index->length(); qDebug() << "max_index_count:" << FileUtils::_max_index_count; diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index e650271..666d12c 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -32,8 +32,10 @@ #include -#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() -#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +//#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() +//#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +#define INDEX_PATH "/media/用户保险箱/.ukui-search/index_data" +#define CONTENT_INDEX_PATH "/media/用户保险箱/.ukui-search/content_index_data" using namespace Zeeker; @@ -354,7 +356,7 @@ Document IndexGenerator::GenerateContentDocument(const QString &path) { QString upTerm; FileReader::getTextContent(path, content); - term = ChineseSegmentation::getInstance()->callSegement(content); + term = ChineseSegmentation::getInstance()->callSegement(content.toStdString()); // QStringList term = content.split(""); doc.setData(content); diff --git a/libsearch/index/index-status-recorder.h b/libsearch/index/index-status-recorder.h index 25f8009..44dbd35 100644 --- a/libsearch/index/index-status-recorder.h +++ b/libsearch/index/index-status-recorder.h @@ -7,7 +7,7 @@ #define CONTENT_INDEX_DATABASE_STATE "content_index_database_state" #define INDEX_DATABASE_STATE "index_database_state" #define INOTIFY_NORMAL_EXIT "inotify_normal_exit" -#define INDEX_STATUS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-index-status.conf" +#define INDEX_STATUS "/media/用户保险箱/.ukui-search/ukui-search-index-status.conf" namespace Zeeker { //fixme: we need a better way to record index status. class IndexStatusRecorder : public QObject diff --git a/libsearch/index/inotify-index.cpp b/libsearch/index/inotify-index.cpp index 0396f9e..fd82521 100644 --- a/libsearch/index/inotify-index.cpp +++ b/libsearch/index/inotify-index.cpp @@ -37,7 +37,7 @@ QFileInfo fi(tmp); \ if(!fi.isSymLink()){ \ AddWatch(tmp); \ - setPath(tmp); \ + setPath(QStringList(tmp)); \ Traverse(); \ } @@ -46,7 +46,7 @@ CREATE_FILE_NAME_INDEX \ CREATE_FILE_CONTENT_INDEX using namespace Zeeker; -InotifyIndex::InotifyIndex(const QString& path) : Traverse_BFS(path) { +InotifyIndex::InotifyIndex(const QStringList &pathList) : Traverse_BFS(pathList) { qDebug() << "setInotifyMaxUserWatches start"; UkuiSearchQDBus usQDBus; usQDBus.setInotifyMaxUserWatches(); @@ -61,18 +61,21 @@ InotifyIndex::~InotifyIndex() { void InotifyIndex::firstTraverse() { QQueue bfs; - bfs.enqueue(this->path); - QFileInfoList list; - QDir dir; - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - this->AddWatch(i.absoluteFilePath()); - bfs.enqueue(i.absoluteFilePath()); + for(QString path : this->m_pathList) { + this->AddWatch(path); + bfs.enqueue(path); + QFileInfoList list; + QDir dir; + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + this->AddWatch(i.absoluteFilePath()); + bfs.enqueue(i.absoluteFilePath()); + } } } } @@ -248,8 +251,8 @@ void InotifyIndex::run() { m_fd = inotify_init(); qDebug() << "m_fd----------->" << m_fd; - this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); - this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); +// this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); +// this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); this->firstTraverse(); int fifo_fd; diff --git a/libsearch/index/inotify-index.h b/libsearch/index/inotify-index.h index fe3dd7b..5b5f72c 100644 --- a/libsearch/index/inotify-index.h +++ b/libsearch/index/inotify-index.h @@ -40,13 +40,13 @@ static InotifyIndex* global_instance_of_index = nullptr; class InotifyIndex : public QThread, public Traverse_BFS { Q_OBJECT public: - static InotifyIndex* getInstance(const QString& path) { + static InotifyIndex* getInstance(const QStringList &pathList) { if(!global_instance_of_index) { - global_instance_of_index = new InotifyIndex(path); + global_instance_of_index = new InotifyIndex(pathList); } return global_instance_of_index; } - InotifyIndex(const QString&); + InotifyIndex(const QStringList &pathList); ~InotifyIndex(); bool AddWatch(const QString&); diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index 70c1071..09a8577 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -301,7 +301,7 @@ int FileContentSearch::keywordSearchContent() { ret.erase(ret.begin(), ret.end()); ::friso::ResultMap().swap(ret); */ - QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword); + QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword.toStdString()); //Creat a query std::string words; for(int i = 0; i < sKeyWord.size(); i++) { @@ -645,7 +645,7 @@ int FileContentSearchV4::keywordSearchContent() ret.erase(ret.begin(), ret.end()); ::friso::ResultMap().swap(ret); */ - QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword); + QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword.toStdString()); //Creat a query std::string words; for(int i=0;igetBlockDirs(); while(!bfs.empty()) { dir.setPath(bfs.dequeue()); list = dir.entryInfoList(); @@ -810,8 +811,6 @@ void DirectSearch::run() { if (i.isDir() && (!(i.isSymLink()))) { bool findIndex = false; - - QStringList blockList = GlobalSettings::getInstance()->getBlockDirs(); for (QString j : blockList) { if (i.absoluteFilePath().startsWith(j.prepend("/"))) { findIndex = true; diff --git a/libsearch/index/search-manager.h b/libsearch/index/search-manager.h index bdb6404..2711450 100644 --- a/libsearch/index/search-manager.h +++ b/libsearch/index/search-manager.h @@ -44,9 +44,11 @@ #include "chinese-segmentation.h" -#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() -#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +//#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() +//#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() +#define INDEX_PATH "/media/用户保险箱/.ukui-search/index_data" +#define CONTENT_INDEX_PATH "/media/用户保险箱/.ukui-search/content_index_data" namespace Zeeker { struct SearchResultInfo{ std::string filePath; diff --git a/libsearch/index/searchmethodmanager.cpp b/libsearch/index/searchmethodmanager.cpp index 0726abd..3f53581 100644 --- a/libsearch/index/searchmethodmanager.cpp +++ b/libsearch/index/searchmethodmanager.cpp @@ -15,7 +15,12 @@ void SearchMethodManager::searchMethod(FileUtils::SearchMethod sm) { qWarning() << "start inotify index"; // InotifyIndex ii("/home"); // ii.start(); - this->m_ii = InotifyIndex::getInstance("/home"); + QStringList pathList; + pathList.append("/media/用户保险箱"); + pathList.append("/media/邮件保险箱"); + pathList.append("/media/公共保险箱"); + pathList.append("/media/备份保险箱"); + this->m_ii = InotifyIndex::getInstance(pathList); if(!this->m_ii->isRunning()) { this->m_ii->start(); } diff --git a/libsearch/index/traverse_bfs.cpp b/libsearch/index/traverse_bfs.cpp index 97a5f13..e8c99c7 100644 --- a/libsearch/index/traverse_bfs.cpp +++ b/libsearch/index/traverse_bfs.cpp @@ -19,31 +19,36 @@ */ #include "traverse_bfs.h" using namespace Zeeker; -Traverse_BFS::Traverse_BFS(const QString& path) { - Q_ASSERT('/' == path.at(0)); - this->path = path; +Traverse_BFS::Traverse_BFS(const QStringList& pathList) { + for(QString path : pathList) { + Q_ASSERT('/' == path.at(0)); + } + + this->m_pathList = pathList; } void Traverse_BFS::Traverse() { QQueue bfs; - bfs.enqueue(this->path); - QFileInfoList list; - QDir dir; - // QDir::Hidden - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - bfs.enqueue(i.absoluteFilePath()); + for(QString path : m_pathList) { + bfs.enqueue(path); + QFileInfoList list; + QDir dir; + // QDir::Hidden + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + bfs.enqueue(i.absoluteFilePath()); + } + DoSomething(i); } - DoSomething(i); } } } -void Traverse_BFS::setPath(const QString& path) { - this->path = path; +void Traverse_BFS::setPath(const QStringList &pathList) { + this->m_pathList = pathList; } diff --git a/libsearch/index/traverse_bfs.h b/libsearch/index/traverse_bfs.h index a3388d0..e7e21ac 100644 --- a/libsearch/index/traverse_bfs.h +++ b/libsearch/index/traverse_bfs.h @@ -31,10 +31,10 @@ public: void Traverse(); virtual ~Traverse_BFS() = default; virtual void DoSomething(const QFileInfo&) = 0; - void setPath(const QString&); + void setPath(const QStringList &pathList); protected: - Traverse_BFS(const QString&); - QString path = "/home"; + Traverse_BFS(const QStringList &pathList); + QStringList m_pathList; private: Traverse_BFS(const Traverse_BFS&) = delete; void operator=(const Traverse_BFS&) = delete; diff --git a/libsearch/index/ukui-search-qdbus.cpp b/libsearch/index/ukui-search-qdbus.cpp index 05b3900..b03f340 100644 --- a/libsearch/index/ukui-search-qdbus.cpp +++ b/libsearch/index/ukui-search-qdbus.cpp @@ -38,7 +38,7 @@ UkuiSearchQDBus::~UkuiSearchQDBus() { //一键三连 void UkuiSearchQDBus::setInotifyMaxUserWatches() { // /proc/sys/fs/inotify/max_user_watches - this->tmpSystemQDBusInterface->call("setInotifyMaxUserWatchesStep1"); +// this->tmpSystemQDBusInterface->call("setInotifyMaxUserWatchesStep1"); // sysctl this->tmpSystemQDBusInterface->call("setInotifyMaxUserWatchesStep2"); // /etc/sysctl.conf diff --git a/libsearch/parser/binary-parser.cpp b/libsearch/parser/binary-parser.cpp index 698297a..0f927c5 100644 --- a/libsearch/parser/binary-parser.cpp +++ b/libsearch/parser/binary-parser.cpp @@ -4457,15 +4457,14 @@ bool bReadBuffer(FILE *pFile, ULONG ulStartBlock, ULONG ulBegin, ulIndex; size_t tLen; - for(ulIndex = ulStartBlock; - ulIndex != END_OF_CHAIN && tToRead != 0; - ulIndex = aulBlockDepot[ulIndex]) { + for(ulIndex = ulStartBlock;ulIndex != END_OF_CHAIN && tToRead != 0;ulIndex = aulBlockDepot[ulIndex]) { if(ulIndex >= (ULONG)tBlockDepotLen) { if(tBlockSize >= BIG_BLOCK_SIZE) { qWarning() << "The Big Block Depot is damaged"; } else { qWarning() << "The Small Block Depot is damaged"; } + return (tToRead == 0); } if(ulOffset >= (ULONG)tBlockSize) { ulOffset -= tBlockSize; diff --git a/libsearch/plugininterface/search-plugin-iface.h b/libsearch/plugininterface/search-plugin-iface.h index a2cb769..4b1345a 100644 --- a/libsearch/plugininterface/search-plugin-iface.h +++ b/libsearch/plugininterface/search-plugin-iface.h @@ -24,12 +24,13 @@ public: QIcon icon; QString name; QVector description; - QMap actionMap;//action name and action key + QStringList actionList; //all actions, take fist for double click action. + QString key; }; virtual ~SearchPluginIface() {} virtual QString getPluginName() = 0; virtual void KeywordSearch(QString keyword,QQueue *searchResult) = 0; - virtual void openAction(QString name, QString key) = 0; + virtual void openAction(QString action, QString key) = 0; }; } diff --git a/libsearch/settingsearch/setting-match.cpp b/libsearch/settingsearch/setting-match.cpp index d9635d2..89b3c9e 100644 --- a/libsearch/settingsearch/setting-match.cpp +++ b/libsearch/settingsearch/setting-match.cpp @@ -19,6 +19,7 @@ */ #include "setting-match.h" #include "file-utils.h" +#include using namespace Zeeker; SettingsMatch::SettingsMatch(QObject *parent) : QObject(parent) { xmlElement(); @@ -44,6 +45,8 @@ QStringList SettingsMatch::startMatchApp(const QString &source) { void SettingsMatch::xmlElement() { QString ChineseIndex; QString EnglishIndex; + QString path = QProcessEnvironment::systemEnvironment().value("XDG_SESSION_TYPE"); + QString version; QFile file(QString::fromLocal8Bit("/usr/share/ukui-control-center/shell/res/search.xml")); if(!file.open(QIODevice::ReadOnly)) { return; @@ -62,6 +65,12 @@ void SettingsMatch::xmlElement() { QDomNodeList list = element.childNodes(); for(int i = 0; i < list.count(); ++i) { QDomNode n = list.at(i); + if(n.nodeName()==QString::fromLocal8Bit("Environment")){ + version=n.toElement().text(); + if((version=="v101"&&path=="wayland")||(version=="hw990"&&path=="x11")){ + break; + } + } if(n.nodeName() == QString::fromLocal8Bit("ChinesePlugin")) { ChineseIndex = n.toElement().text(); } diff --git a/src/content-widget.cpp b/src/content-widget.cpp index 532c6c6..e289b41 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -52,6 +52,9 @@ ContentWidget::~ContentWidget() { * @brief initUI 初始化homepage和resultpage */ void ContentWidget::initUI() { + QPalette pal = palette(); + pal.setColor(QPalette::Base, QColor(0, 0, 0, 0)); + pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); //使用此palette的窗口背景将为透明 m_homePage = new QWidget(this); m_homePageLyt = new QVBoxLayout(m_homePage); m_homePageLyt->setSpacing(0); @@ -79,7 +82,6 @@ void ContentWidget::initUI() { m_detailLyt = new QVBoxLayout(m_resultDetail); m_resultList->setFixedWidth(236); m_resultList->setFixedHeight(0); - m_resultList->setStyleSheet("QWidget{background:transparent;}"); m_listLyt->setContentsMargins(0, 0, 12, 0); m_listLyt->setSpacing(0); m_resultListArea->setWidget(m_resultList); @@ -89,10 +91,13 @@ void ContentWidget::initUI() { clearLayout(m_homePageLyt); initHomePage(); }); + connect(m_detailView, &SearchDetailView::actionTriggerd, this, &ContentWidget::effectiveSearch); m_resultDetailArea->setWidget(m_detailView); m_resultDetailArea->setWidgetResizable(true); - m_resultListArea->setStyleSheet("QScrollArea{background: transparent;}"); - m_resultDetailArea->setStyleSheet("QScrollArea{background: transparent; border-radius: 4px;}"); + m_resultListArea->setFrameShape(QFrame::NoFrame); + m_resultDetailArea->setFrameShape(QFrame::NoFrame); + m_resultListArea->setPalette(pal); + m_resultDetailArea->setPalette(pal); this->addWidget(m_homePage); this->addWidget(m_resultPage); @@ -226,7 +231,7 @@ void ContentWidget::initListView() { this->resetListHeight(); }); - connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) { + connect(qApp, &QApplication::paletteChanged, this, [ = ]() { m_fileListView->refresh(); m_dirListView->refresh(); m_contentListView->refresh(); @@ -279,7 +284,7 @@ void ContentWidget::setupConnect(SearchListView * listview) { connect(listview, &SearchListView::currentSelectPos, [ = ](QPoint pos) { m_resultListArea->ensureVisible(pos.x(), pos.y()); }); - connect(listview, &SearchListView::mousePressed, this, &ContentWidget::mousePressed); + connect(listview, &SearchListView::mousePressed, this, &ContentWidget::effectiveSearch); connect(listview, &SearchListView::currentRowChanged, this, &ContentWidget::onListViewRowChanged); connect(listview, &SearchListView::onRowDoubleClicked, this, &ContentWidget::onListViewRowDoubleClicked); } diff --git a/src/content-widget.h b/src/content-widget.h index 5f5132b..d57e956 100644 --- a/src/content-widget.h +++ b/src/content-widget.h @@ -109,7 +109,7 @@ private: Q_SIGNALS: void currentItemChanged(); - void mousePressed(); + void effectiveSearch(); private Q_SLOTS: void clearLayout(QLayout *); diff --git a/src/control/config-file.h b/src/control/config-file.h index 41bb24d..e7ec5a6 100644 --- a/src/control/config-file.h +++ b/src/control/config-file.h @@ -25,7 +25,7 @@ #include #include #include -#define HOMEPAGE_SETTINGS QDir::homePath()+"/.config/org.ukui/ukui-search/ukui-search-homepage.conf" +#define HOMEPAGE_SETTINGS "media/用户保险箱/.ukui-search/ukui-search-homepage.conf" namespace Zeeker { class ConfigFile : public QObject { Q_OBJECT diff --git a/src/control/folder-list-item.cpp b/src/control/folder-list-item.cpp index bc50e72..318d5b4 100644 --- a/src/control/folder-list-item.cpp +++ b/src/control/folder-list-item.cpp @@ -53,8 +53,9 @@ void FolderListItem::initUi() { m_iconLabel->setPixmap(QIcon::fromTheme("inode-directory").pixmap(QSize(16, 16))); m_pathLabel->setText(m_path); m_delLabel->setText(tr("Delete the folder out of blacklist")); - m_pathLabel->setStyleSheet("QLabel{color: palette(text); background: transparent;}"); - m_delLabel->setStyleSheet("QLabel{color: #3790FA; background: transparent;}"); + QPalette pal = palette(); + pal.setColor(QPalette::WindowText, QColor(55, 144, 250, 255)); + m_delLabel->setPalette(pal); m_delLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_delLabel->installEventFilter(this); m_delLabel->hide(); diff --git a/src/control/home-page-item.cpp b/src/control/home-page-item.cpp index 5fe596d..0201d97 100644 --- a/src/control/home-page-item.cpp +++ b/src/control/home-page-item.cpp @@ -56,7 +56,6 @@ void HomePageItem::setupUi(const int& type, const QString& path) { m_type = type; m_widget = new QWidget(this); m_widget->setObjectName("MainWidget"); -// m_widget->setStyleSheet("QWidget#MainWidget{background: rgba(0, 0, 0, 0.05); border-radius: 4px;}"); m_widget->installEventFilter(this); m_iconlabel = new QLabel(m_widget); m_namelabel = new QLabel(m_widget); diff --git a/src/control/option-view.cpp b/src/control/option-view.cpp index fb9117f..e188a0f 100644 --- a/src/control/option-view.cpp +++ b/src/control/option-view.cpp @@ -91,48 +91,52 @@ void OptionView::setupOptions(const int& type, bool is_appInstalled) { void OptionView::initUI() { + QPalette pal = palette(); + pal.setColor(QPalette::WindowText, NORMAL_COLOR); + pal.setColor(QPalette::Light, HOVER_COLOR); + pal.setColor(QPalette::Dark, PRESS_COLOR); m_optionFrame = new QFrame(this); m_optionLyt = new QVBoxLayout(m_optionFrame); m_optionLyt->setContentsMargins(8, 0, 0, 0); m_openLabel = new QLabel(m_optionFrame); m_openLabel->setText(tr("Open")); //打开 - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openLabel->setPalette(pal); m_openLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_openLabel->installEventFilter(this); m_optionLyt->addWidget(m_openLabel); m_shortcutLabel = new QLabel(m_optionFrame); m_shortcutLabel->setText(tr("Add Shortcut to Desktop")); //添加到桌面快捷方式 - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_shortcutLabel->setPalette(pal); m_shortcutLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_shortcutLabel->installEventFilter(this); m_optionLyt->addWidget(m_shortcutLabel); m_panelLabel = new QLabel(m_optionFrame); m_panelLabel->setText(tr("Add Shortcut to Panel")); //添加到任务栏快捷方式 - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_panelLabel->setPalette(pal); m_panelLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_panelLabel->installEventFilter(this); m_optionLyt->addWidget(m_panelLabel); m_openPathLabel = new QLabel(m_optionFrame); m_openPathLabel->setText(tr("Open path")); //打开所在路径 - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openPathLabel->setPalette(pal); m_openPathLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_openPathLabel->installEventFilter(this); m_optionLyt->addWidget(m_openPathLabel); m_copyPathLabel = new QLabel(m_optionFrame); m_copyPathLabel->setText(tr("Copy path")); //复制所在路径 - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_copyPathLabel->setPalette(pal); m_copyPathLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_copyPathLabel->installEventFilter(this); m_optionLyt->addWidget(m_copyPathLabel); m_installLabel = new QLabel(m_optionFrame); m_installLabel->setText(tr("Install")); //复制所在路径 - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_installLabel->setPalette(pal); m_installLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_installLabel->installEventFilter(this); m_optionLyt->addWidget(m_installLabel); @@ -235,92 +239,92 @@ void OptionView::setupSettingOptions() { bool OptionView::eventFilter(QObject *watched, QEvent *event) { if(m_openLabel && watched == m_openLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_openLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Open); return true; } else if(event->type() == QEvent::Enter) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_openLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_shortcutLabel && watched == m_shortcutLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_shortcutLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_shortcutLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Shortcut); return true; } else if(event->type() == QEvent::Enter) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_shortcutLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_shortcutLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_panelLabel && watched == m_panelLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_panelLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_panelLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Panel); return true; } else if(event->type() == QEvent::Enter) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_panelLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_panelLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_openPathLabel && watched == m_openPathLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_openPathLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openPathLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::OpenPath); return true; } else if(event->type() == QEvent::Enter) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_openPathLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_openPathLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_copyPathLabel && watched == m_copyPathLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_copyPathLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_copyPathLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::CopyPath); return true; } else if(event->type() == QEvent::Enter) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_copyPathLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_copyPathLabel->setForegroundRole(QPalette::WindowText); return true; } } else if(m_installLabel && watched == m_installLabel) { if(event->type() == QEvent::MouseButtonPress) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + m_installLabel->setForegroundRole(QPalette::Dark); return true; } else if(event->type() == QEvent::MouseButtonRelease) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_installLabel->setForegroundRole(QPalette::WindowText); Q_EMIT this->onOptionClicked(Options::Install); return true; } else if(event->type() == QEvent::Enter) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + m_installLabel->setForegroundRole(QPalette::Light); return true; } else if(event->type() == QEvent::Leave) { - m_installLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_installLabel->setForegroundRole(QPalette::WindowText); return true; } } diff --git a/src/control/option-view.h b/src/control/option-view.h index bc368e0..4ac1319 100644 --- a/src/control/option-view.h +++ b/src/control/option-view.h @@ -28,6 +28,10 @@ #include #include "search-list-view.h" +#define NORMAL_COLOR QColor(55, 144, 250, 255) +#define HOVER_COLOR QColor(64, 169, 251, 255) +#define PRESS_COLOR QColor(41, 108, 217, 255) + namespace Zeeker { class OptionView : public QWidget { Q_OBJECT diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index 319cbeb..291547f 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -217,7 +217,8 @@ void SearchDetailView::setAppWidget(const QString &appname, const QString &path, QFontMetrics fontMetrics = m_nameLabel->fontMetrics(); QString showname = fontMetrics.elidedText(m_name, Qt::ElideRight, 274); //当字体长度超过215时显示为省略号 - m_nameLabel->setText(showname); +// m_nameLabel->setText(showname); + m_nameLabel->setText(QString("

%1

").arg(escapeHtml(showname))); if(QString::compare(showname, m_name)) { m_nameLabel->setToolTip(m_name); } @@ -350,18 +351,19 @@ void SearchDetailView::setupWidget(const int& type, const QString& path) { QFontMetrics fontMetrics = m_nameLabel->fontMetrics(); QString wholeName = FileUtils::getFileName(path); QString name = fontMetrics.elidedText(wholeName, Qt::ElideRight, 274); - m_nameLabel->setText(name); +// m_nameLabel->setText(name); + m_nameLabel->setText(QString("

%1

").arg(escapeHtml(name))); if(QString::compare(name, wholeName)) { m_nameLabel->setToolTip(wholeName); } - m_nameLabel->setTextFormat(Qt::PlainText); //显示纯文本 m_typeLabel->setText(tr("Document")); break; } case SearchListView::ResType::Setting : { setIcon(path); QString settingType = path.mid(path.indexOf("/") + 1, path.lastIndexOf("/") - path.indexOf("/") - 1); //配置项所属控制面板插件名 - m_nameLabel->setText(settingType); +// m_nameLabel->setText(settingType); + m_nameLabel->setText(QString("

%1

").arg(escapeHtml(settingType))); m_typeLabel->setText(FileUtils::getSettingName(path)); break; } @@ -404,6 +406,7 @@ void SearchDetailView::execActions(const int& type, const int& option, const QSt default: break; } + Q_EMIT this->actionTriggerd(); } /** @@ -462,8 +465,6 @@ void SearchDetailView::initUI() { m_layout = new QVBoxLayout(this); this->setLayout(m_layout); m_layout->setContentsMargins(16, 60, 16, 24); - this->setObjectName("detailView"); - this->setStyleSheet("QWidget#detailView{background:transparent;}"); this->setFixedWidth(378); //没有网络的时候的提示信息 @@ -491,8 +492,7 @@ void SearchDetailView::initUI() { m_nameLayout = new QHBoxLayout(m_nameFrame); m_nameLabel = new QLabel(m_nameFrame); m_typeLabel = new QLabel(m_nameFrame); - m_nameLabel->setStyleSheet("QLabel{font-size: 18px;}"); - m_typeLabel->setStyleSheet("QLabel{font-size: 14px; color: palette(mid);}"); + m_typeLabel->setEnabled(false); m_nameFrame->setFixedHeight(48); m_nameLabel->setMaximumWidth(280); m_nameLayout->addWidget(m_nameLabel); diff --git a/src/control/search-detail-view.h b/src/control/search-detail-view.h index a06cf87..0d5770a 100644 --- a/src/control/search-detail-view.h +++ b/src/control/search-detail-view.h @@ -105,6 +105,7 @@ private: Q_SIGNALS: void configFileChanged(); + void actionTriggerd(); private Q_SLOTS: void execActions(const int&, const int&, const QString&); void refreshIcon(); diff --git a/src/control/search-list-view.cpp b/src/control/search-list-view.cpp index 53989ab..fb923fc 100644 --- a/src/control/search-list-view.cpp +++ b/src/control/search-list-view.cpp @@ -21,12 +21,11 @@ #include "search-list-view.h" #include #include -#include "custom-style.h" using namespace Zeeker; SearchListView::SearchListView(QWidget * parent, const QStringList& list, const int& type) : QTreeView(parent) { -// CustomStyle * style = new CustomStyle(GlobalSettings::getInstance()->getValue(STYLE_NAME_KEY).toString()); - this->setStyle(CustomStyle::getStyle()); + this->setFrameShape(QFrame::NoFrame); + this->viewport()->setAutoFillBackground(false); setRootIsDecorated(false); this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -43,7 +42,6 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const // this->setFixedHeight(list.count() * rowheight + 4); this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAutoFillBackground(false); -// this->setStyleSheet("QWidget{background:transparent;}"); m_styleDelegate = new HighlightItemDelegate(this); // m_styleDelegate->setSearchKeyword(keyword); this->setItemDelegate(m_styleDelegate); @@ -130,13 +128,6 @@ void SearchListView::clear() { */ void SearchListView::refresh() { - QModelIndex index = this->currentIndex(); - m_model->refresh(); - if(index.row() >= 0 && index.row() < m_model->length() && m_isSelected) { - this->blockSignals(true); - this->setCurrentIndex(index); - this->blockSignals(false); - } rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())) + 1; this->setFixedHeight(m_item->getCurrentSize() * rowheight + 4); } diff --git a/src/control/show-more-label.cpp b/src/control/show-more-label.cpp index f9888f4..ae0d880 100644 --- a/src/control/show-more-label.cpp +++ b/src/control/show-more-label.cpp @@ -47,6 +47,8 @@ bool ShowMoreLabel::getExpanded() { } void ShowMoreLabel::initUi() { + QPalette pal = palette(); + pal.setColor(QPalette::WindowText, QColor(55, 144, 250, 255)); m_layout = new QHBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 6); m_textLabel = new QLabel(this); @@ -58,7 +60,7 @@ void ShowMoreLabel::initUi() { // m_loadingIconLabel->hide(); m_layout->setAlignment(Qt::AlignRight); m_layout->addWidget(m_textLabel); - m_textLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + m_textLabel->setPalette(pal); // m_layout->addWidget(m_loadingIconLabel); } diff --git a/src/create-index-ask-dialog.cpp b/src/create-index-ask-dialog.cpp index 0d1fc1e..517510c 100644 --- a/src/create-index-ask-dialog.cpp +++ b/src/create-index-ask-dialog.cpp @@ -126,8 +126,6 @@ void CreateIndexAskDialog::initUi() { * @brief CreateIndexAskDialog::paintEvent 绘制窗口背景(默认背景较暗) */ void CreateIndexAskDialog::paintEvent(QPaintEvent *event) { - Q_UNUSED(event) - QPainter p(this); p.setRenderHint(QPainter::Antialiasing); QPainterPath rectPath; diff --git a/src/custom-style.cpp b/src/custom-style.cpp deleted file mode 100644 index d3be980..0000000 --- a/src/custom-style.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright (C) 2020, 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 . - * - * Authors: zhangjiaping - * - */ - -#include "custom-style.h" - -using namespace Zeeker; -static CustomStyle *customstyle_global_instance = nullptr; -CustomStyle::CustomStyle(QStyle *style) { - -} -CustomStyle *CustomStyle::getStyle() -{ - if (!customstyle_global_instance) - customstyle_global_instance = new CustomStyle; - return customstyle_global_instance; -} - -QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const { - switch(type) { - case CT_ItemViewItem: { - QSize size(0, GlobalSettings::getInstance()->getValue(FONT_SIZE_KEY).toDouble() * 2); - return size; - } - break; - default: - break; - } - return QProxyStyle::sizeFromContents(type, option, contentsSize, widget); -} - - diff --git a/src/custom-style.h b/src/custom-style.h deleted file mode 100644 index b3b1ab6..0000000 --- a/src/custom-style.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Copyright (C) 2020, 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 . - * - * Authors: zhangjiaping - * - */ - -#ifndef CUSTOMSTYLE_H -#define CUSTOMSTYLE_H -#include -#include "global-settings.h" - -namespace Zeeker { -class CustomStyle : public QProxyStyle { - Q_OBJECT -public: - static CustomStyle *getStyle(); - virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget = nullptr) const; -private: - explicit CustomStyle(QStyle *style = nullptr); - ~CustomStyle() override {} -}; -} - -#endif // CUSTOMSTYLE_H diff --git a/src/input-box.cpp b/src/input-box.cpp index 9dc404e..416c69a 100644 --- a/src/input-box.cpp +++ b/src/input-box.cpp @@ -98,7 +98,6 @@ void SearchBarHLayout::initUI() { m_queryWidget = new QWidget(m_queryLineEdit); m_queryWidget->setFocusPolicy(Qt::NoFocus); - m_queryWidget->setStyleSheet("border:0px;background:transparent"); QHBoxLayout* queryWidLayout = new QHBoxLayout; queryWidLayout->setContentsMargins(8, 4, 0, 0); @@ -109,13 +108,12 @@ void SearchBarHLayout::initUI() { QPixmap pixmap(QIcon::fromTheme("system-search-symbolic").pixmap(QSize(20, 20))); m_queryIcon = new QLabel; - m_queryIcon->setStyleSheet("background:transparent"); m_queryIcon->setFixedSize(pixmap.size()); m_queryIcon->setPixmap(pixmap); m_queryText = new QLabel; m_queryText->setText(tr("Search")); - m_queryText->setStyleSheet("background:transparent;color:#626c6e;"); + m_queryText->setEnabled(false); m_queryText->setContentsMargins(0, 0, 0, 4); m_queryText->adjustSize(); @@ -215,7 +213,6 @@ SearchLineEdit::SearchLineEdit() { // popView->setProperty("customShadowMargins", QVector4D(20, 20, 20, 20)); // popView->setAttribute(Qt::WA_TranslucentBackground); // m_completer->setPopup(popView); -// m_completer->popup()->setStyle(CustomStyle::getStyle()); m_completer->setMaxVisibleItems(14); setCompleter(m_completer); diff --git a/src/main.cpp b/src/main.cpp index 332dda1..9dac608 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,6 +174,13 @@ int main(int argc, char *argv[]) { syslog(LOG_ERR, "Home is not exits!!\n"); ::sleep(1); } + while(!QDir("/media/用户保险箱").exists()) { + qWarning() << "集中管控目录未挂载!!"; + printf("集中管控目录未挂载!!"); + syslog(LOG_ERR, "集中管控目录未挂载!!\n"); + ::sleep(1); + } + // Output log to file qInstallMessageHandler(messageOutput); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e143a6a..6b29824 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -263,7 +263,7 @@ void MainWindow::initUi() { mainlayout->addWidget(m_titleFrame); mainlayout->addWidget(m_contentFrame); mainlayout->addWidget(m_searchWidget); - connect(m_contentFrame, &ContentWidget::mousePressed, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord); + connect(m_contentFrame, &ContentWidget::effectiveSearch, m_searchLayout, &SearchBarHLayout::effectiveSearchRecord); connect(QApplication::primaryScreen(), &QScreen::geometryChanged, this, &MainWindow::monitorResolutionChange); @@ -287,7 +287,7 @@ void MainWindow::initUi() { if(! m_search_result_thread->isRunning()) { m_search_result_thread->start(); } - searchContent(text); + startSearch(text); // //允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索 // if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH) // m_askTimer->start(); @@ -389,10 +389,10 @@ void MainWindow::primaryScreenChangedSlot(QScreen *screen) { } /** - * @brief searchContent 搜索关键字 - * @param searchcontent + * @brief startSearch 搜索关键字 + * @param keyword */ -void MainWindow::searchContent(QString keyword) { +void MainWindow::startSearch(QString keyword) { m_contentFrame->setKeyword(keyword); //设置搜索 diff --git a/src/mainwindow.h b/src/mainwindow.h index e131cc8..63f3f83 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -81,7 +81,7 @@ public: */ // The parameter:keyword is the word or sentence which users want to search. - void searchContent(QString keyword); + void startSearch(QString keyword); // The position which mainwindow shows follow the ukui-panel. void moveToPanel(); diff --git a/src/model/search-item-model.cpp b/src/model/search-item-model.cpp index 021f577..9ec3197 100644 --- a/src/model/search-item-model.cpp +++ b/src/model/search-item-model.cpp @@ -182,12 +182,6 @@ void SearchItemModel::setBestAppIcon(const QString &str, const bool & is_install } } -void SearchItemModel::refresh() -{ - this->beginResetModel(); - this->endResetModel(); -} - int SearchItemModel::length() { return m_item->m_pathlist.length(); diff --git a/src/model/search-item-model.h b/src/model/search-item-model.h index 396c77e..087bb09 100644 --- a/src/model/search-item-model.h +++ b/src/model/search-item-model.h @@ -59,7 +59,6 @@ public: void removeItem(QString); void clear(); void setBestAppIcon(const QString &, const bool &); - void refresh(); int length(); private : diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index 520784d..36b2226 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -57,6 +57,8 @@ SettingsWidget::~SettingsWidget() { * @brief SettingsWidget::initUi 初始化界面UI */ void SettingsWidget::initUi() { + QPalette pal = palette(); + pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); // this->setFixedWidth(528); // this->setMinimumHeight(460); // this->setMaximumHeight(680); @@ -81,8 +83,6 @@ void SettingsWidget::initUi() { m_closeBtn = new QPushButton(m_titleFrame); m_closeBtn->setFixedSize(24, 24); // m_closeBtn->setIcon(QIcon(":/res/icons/close.svg")); -// m_closeBtn->setStyleSheet("QPushButton{background: transparent;}" -// "QPushButton:hover:!pressed{background: transparent;}"); m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); m_closeBtn->setProperty("isWindowButton", 0x02); m_closeBtn->setProperty("useIconHighlightEffect", 0x08); @@ -139,9 +139,9 @@ void SettingsWidget::initUi() { m_indexBtnLyt->addWidget(m_addDirBtn); m_indexBtnLyt->addStretch(); m_dirListArea = new QScrollArea(m_contentFrame); - m_dirListArea->setStyleSheet("QScrollArea{background:transparent;}"); + m_dirListArea->setPalette(pal); + m_dirListArea->setFrameShape(QFrame::Shape::NoFrame); m_dirListWidget = new QWidget(m_contentFrame); - m_dirListWidget->setStyleSheet("QWidget{background:transparent;}"); m_dirListLyt = new QVBoxLayout(m_dirListWidget); m_dirListLyt->setContentsMargins(0, 0, 0, 0); m_dirListLyt->setSpacing(0); diff --git a/src/src.pro b/src/src.pro index 1786c22..2c0ecdf 100644 --- a/src/src.pro +++ b/src/src.pro @@ -28,7 +28,6 @@ include(singleapplication/qt-single-application.pri) SOURCES += \ content-widget.cpp \ create-index-ask-dialog.cpp \ - custom-style.cpp \ input-box.cpp \ main.cpp \ mainwindow.cpp \ @@ -41,7 +40,6 @@ SOURCES += \ HEADERS += \ content-widget.h \ create-index-ask-dialog.h \ - custom-style.h \ input-box.h \ mainwindow.h \ search-app-thread.h \ From e82e3292c8f0dd54fb514080d4e43d2bd3ffcee3 Mon Sep 17 00:00:00 2001 From: iaom Date: Wed, 2 Jun 2021 20:55:48 +0800 Subject: [PATCH 08/25] [FIX]: Unable to switch input method in search box. --- src/input-box.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/input-box.cpp b/src/input-box.cpp index 416c69a..50bdf6c 100644 --- a/src/input-box.cpp +++ b/src/input-box.cpp @@ -194,7 +194,8 @@ bool SearchBarHLayout::eventFilter(QObject *watched, QEvent *event) { */ SearchLineEdit::SearchLineEdit() { this->setFocusPolicy(Qt::ClickFocus); - this->installEventFilter(this); + this->setAttribute(Qt::WA_InputMethodEnabled); +// this->installEventFilter(this); // this->setContextMenuPolicy(Qt::NoContextMenu); this->setMaxLength(100); From 59b0bb7e9a53f719a45ad734770f7e19bbf87b43 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Thu, 3 Jun 2021 10:32:36 +0800 Subject: [PATCH 09/25] Update changelog. --- debian/changelog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/debian/changelog b/debian/changelog index 28cde68..52b71d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +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 Wed, 02 Jun 2021 15:32:04 +0800 + ukui-search (0.4.0+0530) v101; urgency=medium * Bug 57129 From 7bdffee0d830491b8003dec1517083b77d6683e1 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Fri, 4 Jun 2021 11:31:00 +0800 Subject: [PATCH 10/25] Update changelog. --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 52b71d2..8038621 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ukui-search (0.4.0+0604) v101; urgency=medium + + * Bug 无 + * 任务 33347, 33346, 33337 + * 其他改动:无 + + -- zhangpengfei Fri, 04 Jun 2021 11:23:51 +0800 + ukui-search (0.4.0+0602) v101; urgency=medium * Bug 58540,58539,58581 From 50f5c1209534d031885d8e83b9f1f3a9a3102012 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 5 Jun 2021 15:04:25 +0800 Subject: [PATCH 11/25] Update changelog. --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8038621..eed6eae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ukui-search (0.4.0+0605) v101; urgency=medium + + * Bug 58229,58171,57963 + * 任务 33340 + * 其他改动:无 + + -- zhangpengfei Sat, 05 Jun 2021 14:28:08 +0800 + ukui-search (0.4.0+0604) v101; urgency=medium * Bug 无 From 6c850992063fc273f72607fa01720f4e56072464 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Wed, 9 Jun 2021 16:35:47 +0800 Subject: [PATCH 12/25] Update changelog. --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index eed6eae..dd8f257 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +ukui-search (0.4.0+0608) v101; urgency=medium + + * Bug 无 + * 任务 无 + * 其他改动: + * Fix: Show more label is blocked by scrollbar. + - 微调UI,解决收起按钮被遮挡的问题。 + + -- zhangpengfei Tue, 08 Jun 2021 20:57:00 +0800 + ukui-search (0.4.0+0605) v101; urgency=medium * Bug 58229,58171,57963 From 2ff95636b50caff307a4d48e9aaacb24e193f7fb Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Fri, 11 Jun 2021 13:48:54 +0800 Subject: [PATCH 13/25] Update changelog. --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index dd8f257..de45e2e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ukui-search (0.4.0+0610) focal; urgency=medium + + * Bugs Fixed and performance optimized. + - 解决bug,优化性能。 + + -- zhangpengfei Thu, 10 Jun 2021 20:58:32 +0800 + ukui-search (0.4.0+0608) v101; urgency=medium * Bug 无 From 15c2fde25ec35bd68ad058ebe1b328a9d91e919a Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Fri, 11 Jun 2021 16:21:07 +0800 Subject: [PATCH 14/25] Update changelog. --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index de45e2e..fabe5cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ukui-search (0.4.0+0611) v101; urgency=medium + + * Bug 61034 + * 需求6448 + * 其他改动:无 + + -- zhangpengfei Fri, 11 Jun 2021 14:05:18 +0800 + ukui-search (0.4.0+0610) focal; urgency=medium * Bugs Fixed and performance optimized. From 5621aba5651b4d63f690842bc7a20c69c0afd9b2 Mon Sep 17 00:00:00 2001 From: hepuyao <2410474020@qq.com> Date: Sat, 12 Jun 2021 00:42:50 +0800 Subject: [PATCH 15/25] =?UTF-8?q?=E5=B0=86=E6=90=9C=E7=B4=A2-=E6=89=98?= =?UTF-8?q?=E7=9B=98=E5=9B=BE=E6=A0=87=E6=8F=90=E5=89=8D=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9=E7=B3=BB=E7=BB=9F=E5=90=AF=E5=8A=A8=E6=9C=89?= =?UTF-8?q?=E4=B8=80=E5=AE=9A=E4=BC=98=E5=8C=96=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mainwindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2c593da..e27a28a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -55,6 +55,14 @@ extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int tran MainWindow::MainWindow(QWidget *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_settingsMatch = new SettingsMatch(this); @@ -109,13 +117,6 @@ MainWindow::MainWindow(QWidget *parent) : 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) { if(reason == QSystemTrayIcon::Trigger) { if(!this->isVisible()) { From 6d1eccc9d33e5fcfdf370c7929612929723255ce Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 12 Jun 2021 08:56:37 +0800 Subject: [PATCH 16/25] Update changelog. --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index fabe5cd..1a17c87 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +ukui-search (0.4.0+0612) v101; urgency=medium + + * Bug 无 + * 任务 无 + * 其他改动: + * Startup time optimization. + - 更改托盘图标注册时间,优化开机启动速度。 + + -- zhangpengfei Sat, 12 Jun 2021 08:53:45 +0800 + ukui-search (0.4.0+0611) v101; urgency=medium * Bug 61034 From 2d5fae69d670da86d252514f68c9e3387170df45 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 19 Jun 2021 15:11:31 +0800 Subject: [PATCH 17/25] Update changelog. --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1a17c87..306ca47 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +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 Sat, 19 Jun 2021 09:12:10 +0800 + ukui-search (0.4.0+0612) v101; urgency=medium * Bug 无 From 3a3d05a468fc95a4f0015d4740864f9440adf0b4 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Tue, 29 Jun 2021 11:32:20 +0800 Subject: [PATCH 18/25] Update changelog. --- debian/changelog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/debian/changelog b/debian/changelog index 306ca47..5180890 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,23 @@ +ukui-search (0.4.0+0629) v101; urgency=medium + + * Bug 无 + * 任务号:无 + * 其他改动: + * Fix:App search error when display applications of the same name. + - 修复了当存在重名应用时应用搜索显示错误的问题。 + + -- zhangpengfei 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 Mon, 28 Jun 2021 09:35:15 +0800 + ukui-search (0.4.0+0619) v101; urgency=medium * Bug 无 From 8ad678302ee59a8e8a4513542ce91fd13ef184ea Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Wed, 30 Jun 2021 14:31:50 +0800 Subject: [PATCH 19/25] Update changelog ukui-search0.4.0+0630. --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 5180890..a889059 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +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 Wed, 30 Jun 2021 11:38:31 +0800 + ukui-search (0.4.0+0629) v101; urgency=medium * Bug 无 From 701fdf783ccf435a53e77964970cdc0db3e32c56 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 3 Jul 2021 10:50:46 +0800 Subject: [PATCH 20/25] Update changelog ukui-search0.4.0+0703. --- debian/changelog | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index a889059..ac33d6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +ukui-search (0.4.0+0703) v101; urgency=medium + + * Bug 无 + * 任务号:无 + * 其他改动: + * Fix:Creat fifo error sometimes. + - 修复了在开关索引时偶现的由于创建管道失败导致的崩溃问题。 + * Remove entry from ukui-menu. + - 移除了开始菜单入口(开始菜单里的搜索应用显示)。 + + -- zhangpengfei Sat, 03 Jul 2021 10:13:23 +0800 + ukui-search (0.4.0+0630) v101; urgency=medium * Bug 无 From a152d54f5c81ebc5ac8abfcde15a2b436b28a915 Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 10 Jul 2021 10:50:40 +0800 Subject: [PATCH 21/25] =?UTF-8?q?Update=20changelog=20ukui-search0.4.0+070?= =?UTF-8?q?9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index ac33d6d..16d0351 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +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 Fri, 09 Jul 2021 14:43:14 +0800 + ukui-search (0.4.0+0703) v101; urgency=medium * Bug 无 From f1ce5825aae753b091956358ea255ed0c99bafa3 Mon Sep 17 00:00:00 2001 From: iaom Date: Thu, 15 Jul 2021 21:03:07 +0800 Subject: [PATCH 22/25] Add step for check index path permission. --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 3b720aa..c139916 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -180,6 +180,12 @@ int main(int argc, char *argv[]) { syslog(LOG_ERR, "集中管控目录未挂载!!\n"); ::sleep(1); } + while(!QFileInfo("/media/用户保险箱").permission(QFileDevice::WriteUser)) { + qWarning() << "/media/用户保险箱 无写入权限!!"; + printf("/media/用户保险箱 无写入权限!!"); + syslog(LOG_ERR, "/media/用户保险箱 无写入权限!!\n"); + ::sleep(1); + } // Output log to file From 1449cfabbb3e345736de32093d05bc75b8fe3e7c Mon Sep 17 00:00:00 2001 From: iaom Date: Mon, 19 Jul 2021 10:58:17 +0800 Subject: [PATCH 23/25] Update file-utils.cpp. --- libchinese-segmentation/cppjieba/cppjieba.pri | 2 +- libsearch/file-utils.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libchinese-segmentation/cppjieba/cppjieba.pri b/libchinese-segmentation/cppjieba/cppjieba.pri index cec0ba9..fffe320 100644 --- a/libchinese-segmentation/cppjieba/cppjieba.pri +++ b/libchinese-segmentation/cppjieba/cppjieba.pri @@ -16,6 +16,6 @@ HEADERS += \ $$PWD/SegmentBase.hpp \ $$PWD/SegmentTagged.hpp \ $$PWD/TextRankExtractor.hpp \ - $$PWD/Trie.hpp \ +# $$PWD/Trie.hpp \ $$PWD/Unicode.hpp include(limonp/limonp.pri) diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 4b74868..393ed72 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -181,9 +181,9 @@ QString FileUtils::getSettingName(const QString& setting) { bool FileUtils::isOrUnder(QString pathA, QString pathB) { - if(pathA[0] != "/") + if(!pathA.startsWith("/")) pathA.prepend("/"); - if(pathB[0] != "/") + if(!pathB.startsWith("/")) pathB.prepend("/"); if(pathA.length() < pathB.length()) From d62580360fd2af970d78d4bb1bec302d51137090 Mon Sep 17 00:00:00 2001 From: PengfeiZhang Date: Mon, 19 Jul 2021 05:34:13 +0000 Subject: [PATCH 24/25] Revert "Merge branch '0715-v4-dev' into 'main'" This reverts merge request !61 --- .gitignore | 2 +- data/org.ukui.log4qt.ukui-search.gschema.xml | 39 ++ data/org.ukui.search.data.gschema.xml | 14 + data/ukui-search-menu.desktop | 4 + data/ukui-search.desktop | 7 +- debian/control | 14 +- debian/ukui-search.install | 2 + .../chinese-segmentation.h | 2 +- libchinese-segmentation/cppjieba/cppjieba.pri | 2 +- .../libchinese-segmentation.pro | 11 +- libsearch/file-utils.cpp | 7 +- libsearch/global-settings.cpp | 19 +- libsearch/global-settings.h | 10 +- libsearch/index/first-index.cpp | 9 +- libsearch/index/first-index.h | 1 - libsearch/index/index-generator.cpp | 6 +- libsearch/index/index-status-recorder.h | 2 +- libsearch/index/inotify-index.cpp | 35 +- libsearch/index/inotify-index.h | 6 +- libsearch/index/inotify-watch.cpp | 41 +- libsearch/index/inotify-watch.h | 4 +- libsearch/index/search-manager.cpp | 386 +----------------- libsearch/index/search-manager.h | 61 +-- libsearch/index/searchmethodmanager.cpp | 7 +- libsearch/index/traverse_bfs.cpp | 41 +- libsearch/index/traverse_bfs.h | 6 +- libsearch/libsearch.h | 1 - libsearch/libsearch.pro | 1 + src/content-widget.cpp | 8 +- src/control/config-file.h | 2 +- src/control/search-list-view.cpp | 3 - src/input-box.cpp | 3 +- src/main.cpp | 18 +- src/mainwindow.cpp | 235 +++++------ src/mainwindow.h | 13 +- src/model/search-item-model.cpp | 1 - src/res/translations/zh_CN.qm | Bin 5485 -> 0 bytes src/resource.qrc | 1 - src/settings-widget.cpp | 7 +- src/settings-widget.h | 1 - src/src.pro | 28 +- translations/ukui-search/bo.ts | 120 +++--- translations/ukui-search/tr.ts | 120 +++--- translations/ukui-search/zh_CN.ts | 120 +++--- 44 files changed, 489 insertions(+), 931 deletions(-) create mode 100644 data/org.ukui.log4qt.ukui-search.gschema.xml create mode 100644 data/org.ukui.search.data.gschema.xml delete mode 100644 src/res/translations/zh_CN.qm diff --git a/.gitignore b/.gitignore index 20e2d0e..fab7372 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ *.so.* *_pch.h.cpp *_resource.rc -#*.qm +*.qm .#* *.*# core diff --git a/data/org.ukui.log4qt.ukui-search.gschema.xml b/data/org.ukui.log4qt.ukui-search.gschema.xml new file mode 100644 index 0000000..c36f8d9 --- /dev/null +++ b/data/org.ukui.log4qt.ukui-search.gschema.xml @@ -0,0 +1,39 @@ + + + + "true" + hook qt messages + Control if hook qt messages + + + "WARN,console,daily" + config rootLogger's level and appenders + config rootLogger's level and appenders:"level,appender" + + + ".yyyy-MM-dd" + daily log file pattern + set daily log file pattern format:one day + + + "%d{yyyy-MM-dd HH:mm:ss,zzz}(%-4r)[%t]|%-5p| - %m%n" + set log message's format + set log message's format + + + 3600 + set check log files delay time + set check log files delay time + + + 7 + set log files count + set log files count,unit s + + + 512 + set log files total size + set log files total size, unit M + + + diff --git a/data/org.ukui.search.data.gschema.xml b/data/org.ukui.search.data.gschema.xml new file mode 100644 index 0000000..f4f0158 --- /dev/null +++ b/data/org.ukui.search.data.gschema.xml @@ -0,0 +1,14 @@ + + + + false + search method + Is current search-method index-search. + + + "baidu" + web engine + Web engine to search keyword online. + + + diff --git a/data/ukui-search-menu.desktop b/data/ukui-search-menu.desktop index eeaf1ab..085b75c 100644 --- a/data/ukui-search-menu.desktop +++ b/data/ukui-search-menu.desktop @@ -8,4 +8,8 @@ Comment[zh_CN]=全局搜索 Exec=/usr/bin/ukui-search -s Type=Application Icon=kylin-search +X-UKUI-AutoRestart=true +NoDisplay=true +OnlyShowIn=UKUI +X-UKUI-Autostart-Phase=Application Terminal=false diff --git a/data/ukui-search.desktop b/data/ukui-search.desktop index db77937..1a8bbe0 100644 --- a/data/ukui-search.desktop +++ b/data/ukui-search.desktop @@ -8,6 +8,7 @@ Comment[zh_CN]=全局搜索 Exec=/usr/bin/ukui-search %U Type=Application Icon=kylin-search -OnlyShowIn=MATE; -X-MATE-Autostart-Phase=Application -X-MATE-AutoRestart=true +X-UKUI-AutoRestart=true +OnlyShowIn=UKUI +X-UKUI-Autostart-Phase=Application +Terminal=false diff --git a/debian/control b/debian/control index a59ed26..3a03d6d 100644 --- a/debian/control +++ b/debian/control @@ -11,12 +11,14 @@ Build-Depends: debhelper (>=9.0.0), qtscript5-dev, qttools5-dev-tools, libxapian-dev, - libquazip5-dev, + libquazip5-dev(>=0.7.6-6build1), libglib2.0-dev, + libkf5windowsystem-dev, libgsettings-qt-dev, libqt5x11extras5-dev, libuchardet-dev, - libpoppler-qt5-dev + libpoppler-qt5-dev, + libukui-log4qt-dev Standards-Version: 4.5.0 Homepage: https://www.ukui.org/ Vcs-Git: https://github.com/ukui/ukui-search.git @@ -42,14 +44,6 @@ Description: Libraries for chinese-segmentation This package contains a few runtime libraries needed by libsearch. -Package: libchinese-segmentation-dev -Section: libdevel -Architecture: any -Depends: ${misc:Depends}, - ${shlibs:Depends}, - libchinese-segmentation0 (= ${binary:Version}) -Description: Libraries for chinese-segmentation(development files). - Package: libukui-search0 Section: libs Architecture: any diff --git a/debian/ukui-search.install b/debian/ukui-search.install index d0ffb18..d7f1780 100644 --- a/debian/ukui-search.install +++ b/debian/ukui-search.install @@ -1,3 +1,5 @@ usr/bin/ukui-search etc/xdg/autostart/*.desktop usr/share/applications/*.desktop +src/.qm/*.qm usr/share/ukui-search/translations +usr/share/glib-2.0/schemas/*.xml diff --git a/libchinese-segmentation/chinese-segmentation.h b/libchinese-segmentation/chinese-segmentation.h index 7e1e440..01e8046 100644 --- a/libchinese-segmentation/chinese-segmentation.h +++ b/libchinese-segmentation/chinese-segmentation.h @@ -39,7 +39,7 @@ struct SKeyWord { ~SKeyWord() { word = std::move(""); offsets.clear(); -// offsets.shrink_to_fit(); + offsets.shrink_to_fit(); } }; diff --git a/libchinese-segmentation/cppjieba/cppjieba.pri b/libchinese-segmentation/cppjieba/cppjieba.pri index fffe320..cec0ba9 100644 --- a/libchinese-segmentation/cppjieba/cppjieba.pri +++ b/libchinese-segmentation/cppjieba/cppjieba.pri @@ -16,6 +16,6 @@ HEADERS += \ $$PWD/SegmentBase.hpp \ $$PWD/SegmentTagged.hpp \ $$PWD/TextRankExtractor.hpp \ -# $$PWD/Trie.hpp \ + $$PWD/Trie.hpp \ $$PWD/Unicode.hpp include(limonp/limonp.pri) diff --git a/libchinese-segmentation/libchinese-segmentation.pro b/libchinese-segmentation/libchinese-segmentation.pro index dc26ddc..28fb1a1 100644 --- a/libchinese-segmentation/libchinese-segmentation.pro +++ b/libchinese-segmentation/libchinese-segmentation.pro @@ -40,11 +40,12 @@ unix { target.path = $$[QT_INSTALL_LIBS] } !isEmpty(target.path): INSTALLS += target -header.path = /usr/include/chinese-seg/ -header.files = *.h -header_cppjieba.path = /usr/include/chinese-seg/cppjieba/ -header_cppjieba.files = cppjieba/* -INSTALLS += header header_cppjieba + + header.path = /usr/include/chinese-seg/ + header.files += *.h + headercppjieba.path = /usr/include/chinese-seg/cppjieba/ + headercppjieba.files = cppjieba/* + INSTALLS += header headercppjieba #DISTFILES += \ # jiaba/jieba.pri diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 393ed72..113fbf5 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -26,8 +26,7 @@ using namespace Zeeker; size_t FileUtils::_max_index_count = 0; size_t FileUtils::_current_index_count = 0; unsigned short FileUtils::_index_status = 0; -//FileUtils::SearchMethod FileUtils::searchMethod = FileUtils::SearchMethod::DIRECTSEARCH; -FileUtils::SearchMethod FileUtils::searchMethod = FileUtils::SearchMethod::INDEXSEARCH; +FileUtils::SearchMethod FileUtils::searchMethod = FileUtils::SearchMethod::DIRECTSEARCH; QMap FileUtils::map_chinese2pinyin = QMap(); FileUtils::FileUtils() { @@ -181,9 +180,9 @@ QString FileUtils::getSettingName(const QString& setting) { bool FileUtils::isOrUnder(QString pathA, QString pathB) { - if(!pathA.startsWith("/")) + if(pathA[0] != "/") pathA.prepend("/"); - if(!pathB.startsWith("/")) + if(pathB[0] != "/") pathB.prepend("/"); if(pathA.length() < pathB.length()) diff --git a/libsearch/global-settings.cpp b/libsearch/global-settings.cpp index aa848fc..3aebc89 100644 --- a/libsearch/global-settings.cpp +++ b/libsearch/global-settings.cpp @@ -37,14 +37,14 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { // m_settings->setAtomicSyncRequired(false); m_block_dirs_settings = new QSettings(BLOCK_DIRS, QSettings::IniFormat, this); m_block_dirs_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); -// m_block_dirs_settings->setValue("These_are_block_dirs_conf_for_ukui_search","0"); -// m_block_dirs_settings->sync(); -// m_confWatcher = new QFileSystemWatcher(this); -// m_confWatcher->addPath(BLOCK_DIRS); -// connect(m_confWatcher, &QFileSystemWatcher::fileChanged, this, [ & ]() { -// m_block_dirs_settings->sync(); -// m_confWatcher->addPath(BLOCK_DIRS); -// }); + m_block_dirs_settings->setValue("These_are_block_dirs_conf_for_ukui_search","0"); + m_block_dirs_settings->sync(); + m_confWatcher = new QFileSystemWatcher(this); + m_confWatcher->addPath(BLOCK_DIRS); + connect(m_confWatcher, &QFileSystemWatcher::fileChanged, this, [ & ]() { + m_block_dirs_settings->sync(); + m_confWatcher->addPath(BLOCK_DIRS); + }); m_search_record_settings = new QSettings(SEARCH_HISTORY, QSettings::IniFormat, this); m_search_record_settings->setIniCodec(QTextCodec::codecForName("UTF-8")); @@ -60,10 +60,9 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { qWarning() << "Kylinssoclient Dbus connect fail!"; this->forceSync(); - m_cache.insert(FONT_SIZE_KEY, 11); //the default number of transparency in mainwindow is 0.7 //if someone changes the num in mainwindow, here should be modified too - m_cache.insert(TRANSPARENCY_KEY, 1); + m_cache.insert(TRANSPARENCY_KEY, 0.7); if(QGSettings::isSchemaInstalled(CONTROL_CENTER_PERSONALISE_GSETTINGS_ID)) { m_trans_gsettings = new QGSettings(CONTROL_CENTER_PERSONALISE_GSETTINGS_ID, QByteArray(), this); connect(m_trans_gsettings, &QGSettings::changed, this, [ = ](const QString & key) { diff --git a/libsearch/global-settings.h b/libsearch/global-settings.h index 5ded1cf..de520ab 100644 --- a/libsearch/global-settings.h +++ b/libsearch/global-settings.h @@ -51,13 +51,9 @@ #define PATH_NOT_IN_HOME 2; #define PATH_PARENT_BLOCKED 3; -//#define MAIN_SETTINGS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search.conf" -//#define BLOCK_DIRS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf" -//#define SEARCH_HISTORY QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-history.conf" - -#define MAIN_SETTINGS "/media/用户保险箱/.ukui-search/ukui-search.conf" -#define BLOCK_DIRS "/media/用户保险箱/.ukui-search/ukui-search-block-dirs.conf" -#define SEARCH_HISTORY "/media/用户保险箱/.ukui-search/ukui-search-history.conf" +#define MAIN_SETTINGS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search.conf" +#define BLOCK_DIRS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-block-dirs.conf" +#define SEARCH_HISTORY QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-history.conf" //#define CLOUD_HISTORY "history" //#define CLOUD_APPLICATIONS "applications" diff --git a/libsearch/index/first-index.cpp b/libsearch/index/first-index.cpp index d1ecc0d..15f6429 100644 --- a/libsearch/index/first-index.cpp +++ b/libsearch/index/first-index.cpp @@ -169,12 +169,7 @@ void FirstIndex::run() { // QtConcurrent::run([&](){ sem.acquire(1); mutex1.unlock(); - QStringList pathList; - pathList.append("/media/用户保险箱"); - pathList.append("/media/邮件保险箱"); - pathList.append("/media/公共保险箱"); - pathList.append("/media/备份保险箱"); - this->setPath(pathList); + this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); this->Traverse(); FileUtils::_max_index_count = this->q_index->length(); qDebug() << "max_index_count:" << FileUtils::_max_index_count; @@ -244,7 +239,7 @@ void FirstIndex::run() { if(p_indexGenerator) delete p_indexGenerator; p_indexGenerator = nullptr; - +// GlobalSettings::getInstance()->forceSync(); IndexStatusRecorder::getInstance()->setStatus(INDEX_DATABASE_STATE, "2"); IndexStatusRecorder::getInstance()->setStatus(CONTENT_INDEX_DATABASE_STATE, "2"); ::_exit(0); diff --git a/libsearch/index/first-index.h b/libsearch/index/first-index.h index d6ff2e9..ab1d23e 100644 --- a/libsearch/index/first-index.h +++ b/libsearch/index/first-index.h @@ -33,7 +33,6 @@ #include #include #include -#include "assert.h" #include #include //#include diff --git a/libsearch/index/index-generator.cpp b/libsearch/index/index-generator.cpp index 6ac571a..06efc6e 100644 --- a/libsearch/index/index-generator.cpp +++ b/libsearch/index/index-generator.cpp @@ -31,10 +31,8 @@ #include #include -//#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() -//#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() -#define INDEX_PATH "/media/用户保险箱/.ukui-search/index_data" -#define CONTENT_INDEX_PATH "/media/用户保险箱/.ukui-search/content_index_data" +#define INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/index_data").toStdString() +#define CONTENT_INDEX_PATH (QStandardPaths::writableLocation(QStandardPaths::HomeLocation)+"/.config/org.ukui/ukui-search/content_index_data").toStdString() using namespace Zeeker; diff --git a/libsearch/index/index-status-recorder.h b/libsearch/index/index-status-recorder.h index 3900165..bf65850 100644 --- a/libsearch/index/index-status-recorder.h +++ b/libsearch/index/index-status-recorder.h @@ -8,8 +8,8 @@ #define CONTENT_INDEX_DATABASE_STATE "content_index_database_state" #define INDEX_DATABASE_STATE "index_database_state" #define INOTIFY_NORMAL_EXIT "inotify_normal_exit" -#define INDEX_STATUS "/media/用户保险箱/.ukui-search/ukui-search-index-status.conf" #define PENDING_FILE_QUEUE_FINISH "pending_file_queue_finish" +#define INDEX_STATUS QDir::homePath() + "/.config/org.ukui/ukui-search/ukui-search-index-status.conf" namespace Zeeker { //fixme: we need a better way to record index status. class IndexStatusRecorder : public QObject diff --git a/libsearch/index/inotify-index.cpp b/libsearch/index/inotify-index.cpp index 924adbb..04351f1 100644 --- a/libsearch/index/inotify-index.cpp +++ b/libsearch/index/inotify-index.cpp @@ -38,7 +38,7 @@ QFileInfo fi(tmp); \ if(!fi.isSymLink()){ \ AddWatch(tmp); \ - setPath(QStringList(tmp)); \ + setPath(tmp); \ Traverse(); \ } @@ -47,7 +47,7 @@ CREATE_FILE_NAME_INDEX \ CREATE_FILE_CONTENT_INDEX using namespace Zeeker; -InotifyIndex::InotifyIndex(const QStringList &pathList) : Traverse_BFS(pathList) { +InotifyIndex::InotifyIndex(const QString& path) : Traverse_BFS(path) { qDebug() << "setInotifyMaxUserWatches start"; UkuiSearchQDBus usQDBus; usQDBus.setInotifyMaxUserWatches(); @@ -62,21 +62,18 @@ InotifyIndex::~InotifyIndex() { void InotifyIndex::firstTraverse() { QQueue bfs; - for(QString path : this->m_pathList) { - this->AddWatch(path); - bfs.enqueue(path); - QFileInfoList list; - QDir dir; - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - this->AddWatch(i.absoluteFilePath()); - bfs.enqueue(i.absoluteFilePath()); - } + bfs.enqueue(this->path); + QFileInfoList list; + QDir dir; + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + this->AddWatch(i.absoluteFilePath()); + bfs.enqueue(i.absoluteFilePath()); } } } @@ -252,8 +249,8 @@ void InotifyIndex::run() { m_fd = inotify_init(); qDebug() << "m_fd----------->" << m_fd; -// this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); -// this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + this->AddWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); this->firstTraverse(); int fifo_fd; diff --git a/libsearch/index/inotify-index.h b/libsearch/index/inotify-index.h index d9f8f4a..1b31f2a 100644 --- a/libsearch/index/inotify-index.h +++ b/libsearch/index/inotify-index.h @@ -41,13 +41,13 @@ static InotifyIndex* global_instance_of_index = nullptr; class InotifyIndex : public QThread, public Traverse_BFS { Q_OBJECT public: - static InotifyIndex* getInstance(const QStringList &pathList) { + static InotifyIndex* getInstance(const QString& path) { if(!global_instance_of_index) { - global_instance_of_index = new InotifyIndex(pathList); + global_instance_of_index = new InotifyIndex(path); } return global_instance_of_index; } - InotifyIndex(const QStringList &pathList); + InotifyIndex(const QString&); ~InotifyIndex(); bool AddWatch(const QString&); diff --git a/libsearch/index/inotify-watch.cpp b/libsearch/index/inotify-watch.cpp index 8b51d8d..eb845a8 100644 --- a/libsearch/index/inotify-watch.cpp +++ b/libsearch/index/inotify-watch.cpp @@ -5,15 +5,15 @@ using namespace Zeeker; static InotifyWatch* global_instance_InotifyWatch = nullptr; -Zeeker::InotifyWatch *Zeeker::InotifyWatch::getInstance(const QStringList &pathList) +Zeeker::InotifyWatch *Zeeker::InotifyWatch::getInstance(const QString &path) { if(!global_instance_InotifyWatch) { - global_instance_InotifyWatch = new InotifyWatch(pathList); + global_instance_InotifyWatch = new InotifyWatch(path); } return global_instance_InotifyWatch; } -Zeeker::InotifyWatch::InotifyWatch(const QStringList &pathList): Traverse_BFS(pathList) +Zeeker::InotifyWatch::InotifyWatch(const QString &path): Traverse_BFS(path) { qDebug() << "setInotifyMaxUserWatches start"; UkuiSearchQDBus usQDBus; @@ -98,21 +98,18 @@ void InotifyWatch::DoSomething(const QFileInfo &info) void InotifyWatch::firstTraverse() { QQueue bfs; - for(QString path : this->m_pathList) { - this->addWatch(path); - bfs.enqueue(path); - QFileInfoList list; - QDir dir; - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - this->addWatch(i.absoluteFilePath()); - bfs.enqueue(i.absoluteFilePath()); - } + bfs.enqueue(this->path); + QFileInfoList list; + QDir dir; + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + this->addWatch(i.absoluteFilePath()); + bfs.enqueue(i.absoluteFilePath()); } } } @@ -150,8 +147,8 @@ void InotifyWatch::run() } } -// this->addWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); -// this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + this->addWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); + this->setPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); this->firstTraverse(); int fifo_fd; @@ -399,7 +396,7 @@ void InotifyWatch::eventProcess(const char *buffer, ssize_t len) if(event->mask & IN_ISDIR) { if(!QFileInfo(path).isSymLink()){ addWatch(path); - setPath(QStringList(path)); + setPath(path); Traverse(); } } @@ -439,7 +436,7 @@ void InotifyWatch::eventProcess(const char *buffer, ssize_t len) if(!QFileInfo(path).isSymLink()){ addWatch(path); - setPath(QStringList(path)); + setPath(path); Traverse(); } } else { diff --git a/libsearch/index/inotify-watch.h b/libsearch/index/inotify-watch.h index a4a3909..eb21587 100644 --- a/libsearch/index/inotify-watch.h +++ b/libsearch/index/inotify-watch.h @@ -20,7 +20,7 @@ class InotifyWatch : public QThread, public Traverse_BFS { Q_OBJECT public: - static InotifyWatch* getInstance(const QStringList &pathList); + static InotifyWatch* getInstance(const QString& path); bool addWatch(const QString &path); bool removeWatch(const QString &path, bool removeFromDatabase = true); @@ -34,7 +34,7 @@ protected: private Q_SLOTS: void slotEvent(char *buf, ssize_t len); private: - explicit InotifyWatch(const QStringList &pathList); + explicit InotifyWatch(const QString& path); ~InotifyWatch(); char * filter(); void eventProcess(int socket); diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index fbb6969..c501594 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -31,35 +31,7 @@ SearchManager::SearchManager(QObject *parent) : QObject(parent) { m_pool.setExpiryTimeout(1000); } -void SearchManager::searchLocalFiles(std::string keyword, std::queue *searchResultFile, std::queue *searchResultDir, std::queue *searchResultContent) -{ - m_mutex1.lock(); - ++uniqueSymbol1; - m_mutex1.unlock(); - m_mutex2.lock(); - ++uniqueSymbol2; - m_mutex2.unlock(); - m_mutex3.lock(); - ++uniqueSymbol3; - m_mutex3.unlock(); - - FileSearchV4 *filesearch; - filesearch = new FileSearchV4(searchResultFile,uniqueSymbol1,QString::fromStdString(keyword),"0",1,0,5); - m_pool.start(filesearch); - - FileSearchV4 *dirsearch; - dirsearch = new FileSearchV4(searchResultDir,uniqueSymbol2,QString::fromStdString(keyword),"1",1,0,5); - m_pool.start(dirsearch); - - FileContentSearchV4 *contentSearch; - contentSearch = new FileContentSearchV4(searchResultContent,uniqueSymbol3,QString::fromStdString(keyword),0,5); - m_pool.start(contentSearch); - return; - -} - -SearchManager::~SearchManager() -{ +SearchManager::~SearchManager() { } int SearchManager::getCurrentIndexCount() { @@ -416,363 +388,7 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord) { // // deleteAllIndex(pathTobeDelete) return 0; } -FileSearchV4::FileSearchV4(std::queue *searchResultFile, size_t uniqueSymbol, QString keyword, QString value, unsigned slot, int begin, int num) -{ - this->setAutoDelete(true); - m_search_result = searchResultFile; - m_uniqueSymbol = uniqueSymbol; - m_keyword = keyword; - m_value = value; - m_slot = slot; - m_begin = begin; - m_num = num; -} -FileSearchV4::~FileSearchV4() -{ - m_search_result = nullptr; -} - -void FileSearchV4::run() -{ - int resultCount = 0; - int total = 0; - while(total < 100) - { - resultCount = keywordSearchfile(); - if(resultCount == 0 || resultCount == -1) - break; - total += resultCount; - m_begin += m_num; - } - return; -} - -int FileSearchV4::keywordSearchfile() -{ - try - { - qDebug() << "--keywordSearchfile start--"; - Xapian::Database db(INDEX_PATH); - Xapian::Query query = creatQueryForFileSearch(db); - Xapian::Enquire enquire(db); - - Xapian::Query queryFile; - if(!m_value.isEmpty()) - { - std::string slotValue = m_value.toStdString(); - Xapian::Query queryValue = Xapian::Query(Xapian::Query::OP_VALUE_RANGE,m_slot,slotValue,slotValue); - queryFile = Xapian::Query(Xapian::Query::OP_AND,query,queryValue); - } - else - { - queryFile = query; - } - - qDebug() << "keywordSearchfile:"< v; - for(int i=0;iappend(QString::fromStdString(data)); - qDebug()<(info.size()); - sSearchResult.type = info.suffix().toStdString(); - sSearchResult.time = info.lastModified().toString("yyyy/MM/dd hh:mm:ss").toStdString(); - - switch (m_value.toInt()) - { - case 1: - SearchManager::m_mutex1.lock(); - if(m_uniqueSymbol == SearchManager::uniqueSymbol2) - { - m_search_result->push(sSearchResult); - SearchManager::m_mutex1.unlock(); - } - else - { - SearchManager::m_mutex1.unlock(); - return -1; - } - - break; - case 0: - SearchManager::m_mutex2.lock(); - if(m_uniqueSymbol == SearchManager::uniqueSymbol1) - { - m_search_result->push(sSearchResult); - SearchManager::m_mutex2.unlock(); - } - else - { - SearchManager::m_mutex2.unlock(); - return -1; - } - break; - default: - break; - } - // searchResult.append(path); - } - qDebug()<< "doc="<< path << ",weight=" <callSegement(ret, keyword.toLocal8Bit().data()); - for (::friso::ResultMap::iterator it_map = ret.begin(); it_map != ret.end(); ++it_map){ - target_str += it_map->first; - target_str += " "; - it_map->second.first.clear(); - ::std::vector().swap(it_map->second.first); - } - - ret.clear(); - ret.erase(ret.begin(), ret.end()); - ::friso::ResultMap().swap(ret); -*/ - QVector sKeyWord = ChineseSegmentation::getInstance()->callSegement(m_keyword.toStdString()); - //Creat a query - std::string words; - for(int i=0;i sKeyWord = ChineseSegmentation::getInstance()->callSegement(keyword); -// //Creat a query -// std::string words; -// for(int i=0;i v; - // for(int i=0;iappend(QString::fromStdString(data)); - qDebug()<(info.size()); - sSearchResult.type = info.suffix().toStdString(); - sSearchResult.time = info.lastModified().toString("yyyy/MM/dd hh:mm:ss").toStdString(); - - // Construct snippets containing keyword. -// snippets.append(QString::fromStdString( result.snippet(doc.get_data(),400))); -// qWarning()< 6 + QString::fromStdString(keyWord).size()) - snippet.replace(0,3,"...").replace(snippet.size()-3,3,"..."); - else - snippet.append("...").prepend("..."); - sSearchResult.snippets.push_back(snippet.toStdString()); - - QString().swap(snippet); - std::string().swap(s); - ++count; - } - std::string().swap(data); - -// for(QString i : QString::fromStdString(keyWord).split(" ",QString::SkipEmptyParts)) -// { -// std::string word = i.toStdString(); -// term.skip_to(word); -// int size = word.size(); -// auto pos = term.positionlist_begin(); -// std::string s = data.substr((*pos < 60)? 0: (*pos - 60) , size + 120); -// QString snippet = QString::fromStdString(s); -// snippet.replace(0,3,"...").replace(snippet.size()-3,3,"..."); -// snippets.append(snippet); -// std::string().swap(word); -// std::string().swap(s); -// QString().swap(snippet); -// } - - SearchManager::m_mutex3.lock(); - if(m_uniqueSymbol == SearchManager::uniqueSymbol3) - { - - m_search_result->push(sSearchResult); - SearchManager::m_mutex3.unlock(); - } - else - { - SearchManager::m_mutex3.unlock(); - return -1; - } - // searchResult.insert(path,snippets); - qDebug()<< "path="<< path << ",weight=" < snippets; - std::string time; - std::string type; - size_t size; -}; class LIBSEARCH_EXPORT SearchManager : public QObject { friend class FileSearch; friend class FileContentSearch; - friend class FileSearchV4; - friend class FileContentSearchV4; Q_OBJECT public: explicit SearchManager(QObject *parent = nullptr); - void searchLocalFiles(std::string keyword, - std::queue *searchResultFile, - std::queue *searchResultDir, - std::queue *searchResultContent); ~SearchManager(); static int getCurrentIndexCount(); @@ -78,7 +60,6 @@ public: static size_t uniqueSymbol1; static size_t uniqueSymbol2; static size_t uniqueSymbol3; - static QMutex m_mutex1; static QMutex m_mutex2; static QMutex m_mutex3; @@ -152,44 +133,6 @@ private: int m_num = 20; }; -class FileSearchV4 : public QRunnable -{ -public: - explicit FileSearchV4(std::queue *searchResult,size_t uniqueSymbol, QString keyword, QString value,unsigned slot = 1,int begin = 0, int num = 20); - ~FileSearchV4(); -protected: - void run(); -private: - int keywordSearchfile(); - Xapian::Query creatQueryForFileSearch(Xapian::Database &db); - int getResult(Xapian::MSet &result); - - std::queue *m_search_result = nullptr; - QString m_value; - unsigned m_slot = 1; - size_t m_uniqueSymbol; - QString m_keyword; - int m_begin = 0; - int m_num = 20; -}; -class FileContentSearchV4 : public QRunnable -{ -public: - explicit FileContentSearchV4(std::queue *searchResult,size_t uniqueSymbol, QString keyword, int begin = 0, int num = 20); - ~FileContentSearchV4(); -protected: - void run(); -private: - int keywordSearchContent(); - int getResult(Xapian::MSet &result,std::string &keyWord); - - std::queue *m_search_result = nullptr; - size_t m_uniqueSymbol; - QString m_keyword; - int m_begin = 0; - int m_num = 20; -}; - class DirectSearch : public QRunnable { public: explicit DirectSearch(QString keyword, QQueue *searchResultFile, QQueue *searchResultDir, size_t uniqueSymbol); diff --git a/libsearch/index/searchmethodmanager.cpp b/libsearch/index/searchmethodmanager.cpp index dae3ef3..bfdc7ee 100644 --- a/libsearch/index/searchmethodmanager.cpp +++ b/libsearch/index/searchmethodmanager.cpp @@ -2,12 +2,7 @@ using namespace Zeeker; SearchMethodManager::SearchMethodManager() { - QStringList pathList; - pathList.append("/media/用户保险箱"); - pathList.append("/media/邮件保险箱"); - pathList.append("/media/公共保险箱"); - pathList.append("/media/备份保险箱"); - m_iw = InotifyWatch::getInstance(pathList); + m_iw = InotifyWatch::getInstance(HOME_PATH); } void SearchMethodManager::searchMethod(FileUtils::SearchMethod sm) { diff --git a/libsearch/index/traverse_bfs.cpp b/libsearch/index/traverse_bfs.cpp index e8c99c7..97a5f13 100644 --- a/libsearch/index/traverse_bfs.cpp +++ b/libsearch/index/traverse_bfs.cpp @@ -19,36 +19,31 @@ */ #include "traverse_bfs.h" using namespace Zeeker; -Traverse_BFS::Traverse_BFS(const QStringList& pathList) { - for(QString path : pathList) { - Q_ASSERT('/' == path.at(0)); - } - - this->m_pathList = pathList; +Traverse_BFS::Traverse_BFS(const QString& path) { + Q_ASSERT('/' == path.at(0)); + this->path = path; } void Traverse_BFS::Traverse() { QQueue bfs; - for(QString path : m_pathList) { - bfs.enqueue(path); - QFileInfoList list; - QDir dir; - // QDir::Hidden - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); - while(!bfs.empty()) { - dir.setPath(bfs.dequeue()); - list = dir.entryInfoList(); - for(auto i : list) { - if(i.isDir() && (!(i.isSymLink()))) { - bfs.enqueue(i.absoluteFilePath()); - } - DoSomething(i); + bfs.enqueue(this->path); + QFileInfoList list; + QDir dir; + // QDir::Hidden + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + while(!bfs.empty()) { + dir.setPath(bfs.dequeue()); + list = dir.entryInfoList(); + for(auto i : list) { + if(i.isDir() && (!(i.isSymLink()))) { + bfs.enqueue(i.absoluteFilePath()); } + DoSomething(i); } } } -void Traverse_BFS::setPath(const QStringList &pathList) { - this->m_pathList = pathList; +void Traverse_BFS::setPath(const QString& path) { + this->path = path; } diff --git a/libsearch/index/traverse_bfs.h b/libsearch/index/traverse_bfs.h index e7e21ac..a3388d0 100644 --- a/libsearch/index/traverse_bfs.h +++ b/libsearch/index/traverse_bfs.h @@ -31,10 +31,10 @@ public: void Traverse(); virtual ~Traverse_BFS() = default; virtual void DoSomething(const QFileInfo&) = 0; - void setPath(const QStringList &pathList); + void setPath(const QString&); protected: - Traverse_BFS(const QStringList &pathList); - QStringList m_pathList; + Traverse_BFS(const QString&); + QString path = "/home"; private: Traverse_BFS(const Traverse_BFS&) = delete; void operator=(const Traverse_BFS&) = delete; diff --git a/libsearch/libsearch.h b/libsearch/libsearch.h index cc79320..0fc1e02 100644 --- a/libsearch/libsearch.h +++ b/libsearch/libsearch.h @@ -43,5 +43,4 @@ namespace Zeeker { //}; } - #endif // LIBSEARCH_H diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro index eeab32d..38cbb89 100644 --- a/libsearch/libsearch.pro +++ b/libsearch/libsearch.pro @@ -71,6 +71,7 @@ unix { INSTALLS += header } + INCLUDEPATH += $$PWD/../libchinese-segmentation DEPENDPATH += $$PWD/../libchinese-segmentation diff --git a/src/content-widget.cpp b/src/content-widget.cpp index 53b9c19..0fdcee8 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -62,8 +62,8 @@ void ContentWidget::initUI() { QPalette pal = palette(); QPalette scroll_bar_pal = palette(); // pal.setColor(QPalette::Base, QColor(0, 0, 0, 0)); -// pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); //使用此palette的窗口背景将为透明 -// scroll_bar_pal.setColor(QPalette::Base, QColor(0, 0, 0, 0)); + pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); //使用此palette的窗口背景将为透明 + scroll_bar_pal.setColor(QPalette::Base, QColor(0, 0, 0, 0)); m_homePage = new QWidget(this); m_homePageLyt = new QVBoxLayout(m_homePage); m_homePageLyt->setSpacing(0); @@ -108,8 +108,8 @@ void ContentWidget::initUI() { m_resultDetailArea->setFrameShape(QFrame::NoFrame); m_resultListArea->setPalette(pal); m_resultDetailArea->setPalette(pal); -// m_resultListArea->verticalScrollBar()->setPalette(scroll_bar_pal); -// m_resultDetailArea->verticalScrollBar()->setPalette(scroll_bar_pal); + m_resultListArea->verticalScrollBar()->setPalette(scroll_bar_pal); + m_resultDetailArea->verticalScrollBar()->setPalette(scroll_bar_pal); this->addWidget(m_homePage); this->addWidget(m_resultPage); diff --git a/src/control/config-file.h b/src/control/config-file.h index e7ec5a6..41bb24d 100644 --- a/src/control/config-file.h +++ b/src/control/config-file.h @@ -25,7 +25,7 @@ #include #include #include -#define HOMEPAGE_SETTINGS "media/用户保险箱/.ukui-search/ukui-search-homepage.conf" +#define HOMEPAGE_SETTINGS QDir::homePath()+"/.config/org.ukui/ukui-search/ukui-search-homepage.conf" namespace Zeeker { class ConfigFile : public QObject { Q_OBJECT diff --git a/src/control/search-list-view.cpp b/src/control/search-list-view.cpp index fb923fc..8a3f706 100644 --- a/src/control/search-list-view.cpp +++ b/src/control/search-list-view.cpp @@ -94,8 +94,6 @@ void SearchListView::setList(QStringList list) { this->blockSignals(false); } rowheight = this->rowHeight(this->model()->index(0, 0, QModelIndex())); - qDebug()<<"setList rowheight"<< rowheight; - qDebug()<<"setList indexRowSizeHint"<setFixedHeight(m_item->getCurrentSize() * rowheight + 4); } @@ -136,7 +134,6 @@ void SearchListView::refresh() * @brief SearchListView::setKeyword 设置关键词 * @param keyword 关键词 */ - void SearchListView::setKeyword(QString keyword) { m_styleDelegate->setSearchKeyword(keyword); } diff --git a/src/input-box.cpp b/src/input-box.cpp index ecb9b9a..1d3fcba 100644 --- a/src/input-box.cpp +++ b/src/input-box.cpp @@ -206,8 +206,7 @@ bool SearchBarHLayout::eventFilter(QObject *watched, QEvent *event) { */ SearchLineEdit::SearchLineEdit(QWidget *parent) : QLineEdit(parent) { this->setFocusPolicy(Qt::ClickFocus); - this->setAttribute(Qt::WA_InputMethodEnabled); -// this->installEventFilter(this); + this->installEventFilter(this); // this->setContextMenuPolicy(Qt::NoContextMenu); this->setMaxLength(100); diff --git a/src/main.cpp b/src/main.cpp index c139916..37674a2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,19 +174,6 @@ int main(int argc, char *argv[]) { syslog(LOG_ERR, "Home is not exits!!\n"); ::sleep(1); } - while(!QDir("/media/用户保险箱").exists()) { - qWarning() << "集中管控目录未挂载!!"; - printf("集中管控目录未挂载!!"); - syslog(LOG_ERR, "集中管控目录未挂载!!\n"); - ::sleep(1); - } - while(!QFileInfo("/media/用户保险箱").permission(QFileDevice::WriteUser)) { - qWarning() << "/media/用户保险箱 无写入权限!!"; - printf("/media/用户保险箱 无写入权限!!"); - syslog(LOG_ERR, "/media/用户保险箱 无写入权限!!\n"); - ::sleep(1); - } - // Output log to file qInstallMessageHandler(messageOutput); @@ -276,8 +263,7 @@ int main(int argc, char *argv[]) { // Load translations QTranslator translator; try { -// if (! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw -1; - if (! translator.load(":/res/translations/zh_CN.qm")) throw -1; + if(! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw - 1; app.installTranslator(&translator); } catch(...) { qDebug() << "Load translations file" << QLocale() << "failed!"; @@ -315,11 +301,9 @@ int main(int argc, char *argv[]) { if(QString::compare(QString("-s"), QString(QLatin1String(argv[1]))) == 0) { // w->moveToPanel(); centerToScreen(w); - #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), w->m_hints); #endif - w->show(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index da169ae..e83f741 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -29,11 +29,11 @@ #include #include #include - -//#include #include -//#include "kwindowsystem.h" - +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) +#include +#include "kwindowsystem.h" +#endif #include "qt-single-application.h" //#include "inotify-manager.h" @@ -75,7 +75,7 @@ MainWindow::MainWindow(QWidget *parent) : this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); this->setWindowTitle(tr("ukui-search")); initUi(); -// initTimer(); + initTimer(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) // setProperty("useStyleWindowManager", false); //禁止拖动 @@ -92,15 +92,6 @@ MainWindow::MainWindow(QWidget *parent) : setProperty("blurRegion", QRegion(path.toFillPolygon().toPolygon())); KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); #endif - connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette & pal) { - this->setPalette(pal); - this->update(); - Q_FOREACH(QWidget *widget, this->findChildren()) { - if(widget) { - widget->update(); - } - } - }); m_search_result_file = new QQueue; m_search_result_dir = new QQueue; @@ -146,10 +137,9 @@ MainWindow::MainWindow(QWidget *parent) : } } }); -// QObject::connect(this, &MainWindow::searchMethodChanged, this, [ = ](FileUtils::SearchMethod sm) { -// this->m_searchMethodManager.searchMethod(sm); -// }); - this->m_searchMethodManager.searchMethod(FileUtils::SearchMethod::INDEXSEARCH); + QObject::connect(this, &MainWindow::searchMethodChanged, this, [ = ](FileUtils::SearchMethod sm) { + this->m_searchMethodManager.searchMethod(sm); + }); } @@ -168,14 +158,14 @@ MainWindow::~MainWindow() { m_settingsWidget = NULL; } #endif -// if(m_askDialog) { -// delete m_askDialog; -// m_askDialog = NULL; -// } -// if(m_askTimer) { -// delete m_askTimer; -// m_askTimer = NULL; -// } + if(m_askDialog) { + delete m_askDialog; + m_askDialog = NULL; + } + if(m_askTimer) { + delete m_askTimer; + m_askTimer = NULL; + } if(m_search_gsettings) { delete m_search_gsettings; m_search_gsettings = NULL; @@ -283,17 +273,14 @@ void MainWindow::initUi() { } // m_seach_app_thread->stop(); m_contentFrame->setCurrentIndex(0); -// m_askTimer->stop(); + m_askTimer->stop(); } else { m_contentFrame->setCurrentIndex(1); QTimer::singleShot(10, this, [ = ]() { startSearch(text); -// //允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索 -// if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH) -// m_askTimer->start(); }); } -// m_researchTimer->stop(); //如果搜索内容发生改变,则停止建索引后重新搜索的倒计时 + m_researchTimer->stop(); //如果搜索内容发生改变,则停止建索引后重新搜索的倒计时 }); //初始化homepage @@ -301,34 +288,34 @@ void MainWindow::initUi() { m_contentFrame->initHomePage(); //创建索引询问弹窗 -// m_askDialog = new CreateIndexAskDialog(this); -//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) -// MotifWmHints ask_dialog_hints; -// ask_dialog_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; -// ask_dialog_hints.functions = MWM_FUNC_ALL; -// ask_dialog_hints.decorations = MWM_DECOR_BORDER; -// XAtomHelper::getInstance()->setWindowMotifHint(m_askDialog->winId(), ask_dialog_hints); -//#endif -// connect(m_askDialog, &CreateIndexAskDialog::closed, this, [ = ]() { -// m_isAskDialogVisible = false; -// }); -// connect(m_askDialog, &CreateIndexAskDialog::btnClicked, this, [ = ](const bool & create_index, const bool & no_longer_ask) { -// if(no_longer_ask) { -// GlobalSettings::getInstance()->setValue(ENABLE_CREATE_INDEX_ASK_DIALOG, "false"); -// } else { -// GlobalSettings::getInstance()->setValue(ENABLE_CREATE_INDEX_ASK_DIALOG, "true"); -// } -// if(create_index) { -// if(m_search_gsettings && m_search_gsettings->keys().contains(SEARCH_METHOD_KEY)) { -// m_search_gsettings->set(SEARCH_METHOD_KEY, true); -// } else { -// //调用创建索引接口 -// Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::INDEXSEARCH); -// //创建索引十秒后重新搜索一次(如果用户十秒内没有退出搜索界面且没有重新搜索) -// m_researchTimer->start(); -// } -// } -// }); + m_askDialog = new CreateIndexAskDialog(this); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) + MotifWmHints ask_dialog_hints; + ask_dialog_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; + ask_dialog_hints.functions = MWM_FUNC_ALL; + ask_dialog_hints.decorations = MWM_DECOR_BORDER; + XAtomHelper::getInstance()->setWindowMotifHint(m_askDialog->winId(), ask_dialog_hints); +#endif + connect(m_askDialog, &CreateIndexAskDialog::closed, this, [ = ]() { + m_isAskDialogVisible = false; + }); + connect(m_askDialog, &CreateIndexAskDialog::btnClicked, this, [ = ](const bool & create_index, const bool & no_longer_ask) { + if(no_longer_ask) { + GlobalSettings::getInstance()->setValue(ENABLE_CREATE_INDEX_ASK_DIALOG, "false"); + } else { + GlobalSettings::getInstance()->setValue(ENABLE_CREATE_INDEX_ASK_DIALOG, "true"); + } + if(create_index) { + if(m_search_gsettings && m_search_gsettings->keys().contains(SEARCH_METHOD_KEY)) { + m_search_gsettings->set(SEARCH_METHOD_KEY, true); + } else { + //调用创建索引接口 + Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::INDEXSEARCH); + //创建索引十秒后重新搜索一次(如果用户十秒内没有退出搜索界面且没有重新搜索) + m_researchTimer->start(); + } + } + }); installEventFilter(this); } @@ -399,9 +386,9 @@ void MainWindow::startSearch(QString keyword) { if(! m_search_result_thread->isRunning()) { m_search_result_thread->start(); } -// //允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索 -// if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH) -// m_askTimer->start(); + //允许弹窗且当前次搜索(为关闭主界面,算一次搜索过程)未询问且当前为暴力搜索 + if(GlobalSettings::getInstance()->getValue(ENABLE_CREATE_INDEX_ASK_DIALOG).toString() != "false" && !m_currentSearchAsked && FileUtils::searchMethod == FileUtils::SearchMethod::DIRECTSEARCH) + m_askTimer->start(); m_contentFrame->setKeyword(keyword); @@ -499,28 +486,28 @@ void MainWindow::centerToScreen(QWidget* widget) { } void MainWindow::initGsettings() { -// const QByteArray id(UKUI_SEARCH_SCHEMAS); -// if(QGSettings::isSchemaInstalled(id)) { -// m_search_gsettings = new QGSettings(id); -// connect(m_search_gsettings, &QGSettings::changed, this, [ = ](const QString & key) { -// if(key == SEARCH_METHOD_KEY) { -// bool is_index_search = m_search_gsettings->get(SEARCH_METHOD_KEY).toBool(); -// this->setSearchMethod(is_index_search); -// } else if(key == WEB_ENGINE_KEY) { -// QString web_engine = m_search_gsettings->get(WEB_ENGINE_KEY).toString(); -// GlobalSettings::getInstance()->setValue(WEB_ENGINE, web_engine); -// Q_EMIT this->webEngineChanged(); -// } -// }); -// if(m_search_gsettings->keys().contains(SEARCH_METHOD_KEY)) { -// bool is_index_search = m_search_gsettings->get(SEARCH_METHOD_KEY).toBool(); -// this->setSearchMethod(is_index_search); -// } -// if(m_search_gsettings->keys().contains(WEB_ENGINE_KEY)) { -// QString web_engine = m_search_gsettings->get(WEB_ENGINE_KEY).toString(); -// GlobalSettings::getInstance()->setValue(WEB_ENGINE, web_engine); -// } -// } + const QByteArray id(UKUI_SEARCH_SCHEMAS); + if(QGSettings::isSchemaInstalled(id)) { + m_search_gsettings = new QGSettings(id); + connect(m_search_gsettings, &QGSettings::changed, this, [ = ](const QString & key) { + if(key == SEARCH_METHOD_KEY) { + bool is_index_search = m_search_gsettings->get(SEARCH_METHOD_KEY).toBool(); + this->setSearchMethod(is_index_search); + } else if(key == WEB_ENGINE_KEY) { + QString web_engine = m_search_gsettings->get(WEB_ENGINE_KEY).toString(); + GlobalSettings::getInstance()->setValue(WEB_ENGINE, web_engine); + Q_EMIT this->webEngineChanged(); + } + }); + if(m_search_gsettings->keys().contains(SEARCH_METHOD_KEY)) { + bool is_index_search = m_search_gsettings->get(SEARCH_METHOD_KEY).toBool(); + this->setSearchMethod(is_index_search); + } + if(m_search_gsettings->keys().contains(WEB_ENGINE_KEY)) { + QString web_engine = m_search_gsettings->get(WEB_ENGINE_KEY).toString(); + GlobalSettings::getInstance()->setValue(WEB_ENGINE, web_engine); + } + } } //使用GSetting获取当前窗口应该使用的透明度 @@ -528,26 +515,26 @@ double MainWindow::getTransparentData() { return GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble(); } -//void MainWindow::initTimer() { -// m_askTimer = new QTimer; -// m_askTimer->setInterval(5 * 1000); -// connect(m_askTimer, &QTimer::timeout, this, [ = ]() { -// if(this->isVisible()) { -// m_isAskDialogVisible = true; -// m_askDialog->show(); -// m_currentSearchAsked = true; -// } -// m_askTimer->stop(); -// }); -// m_researchTimer = new QTimer; -// m_researchTimer->setInterval(10 * 1000); -// connect(m_researchTimer, &QTimer::timeout, this, [ = ]() { -// if(this->isVisible()) { -// searchContent(m_searchLayout->text()); -// } -// m_researchTimer->stop(); -// }); -//} +void MainWindow::initTimer() { + m_askTimer = new QTimer; + m_askTimer->setInterval(5 * 1000); + connect(m_askTimer, &QTimer::timeout, this, [ = ]() { + if(this->isVisible()) { + m_isAskDialogVisible = true; + m_askDialog->show(); + m_currentSearchAsked = true; + } + m_askTimer->stop(); + }); + m_researchTimer = new QTimer; + m_researchTimer->setInterval(10 * 1000); + connect(m_researchTimer, &QTimer::timeout, this, [ = ]() { + if(this->isVisible()) { + startSearch(m_searchLayout->text()); + } + m_researchTimer->stop(); + }); +} /** * @brief MainWindow::tryHideMainwindow 尝试隐藏主界面并停止部分未完成的动作,重置部分状态值 @@ -556,13 +543,13 @@ bool MainWindow::tryHideMainwindow() { if (!m_isAskDialogVisible) { qDebug()<<"Mainwindow will be hidden"; -// m_currentSearchAsked = false; + m_currentSearchAsked = false; this->hide(); -// m_askTimer->stop(); -// m_researchTimer->stop(); + m_askTimer->stop(); + m_researchTimer->stop(); m_contentFrame->closeWebView(); m_search_result_thread->requestInterruption(); -// m_search_result_thread->quit(); + m_search_result_thread->quit(); return true; } else { //有上层弹窗未关闭,不允许隐藏主界面 @@ -575,17 +562,17 @@ bool MainWindow::tryHideMainwindow() * @brief MainWindow::setSearchMethod 设置搜索模式 * @param is_index_search true为索引搜索,false为暴力搜索 */ -//void MainWindow::setSearchMethod(const bool &is_index_search) { -// if(is_index_search) { -// //调用创建索引接口 -// Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::INDEXSEARCH); -// //创建索引十秒后重新搜索一次(如果用户十秒内没有退出搜索界面且没有重新搜索) -// m_researchTimer->start(); -// } else { -// Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::DIRECTSEARCH); -// m_researchTimer->stop(); -// } -//} +void MainWindow::setSearchMethod(const bool &is_index_search) { + if(is_index_search) { + //调用创建索引接口 + Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::INDEXSEARCH); + //创建索引十秒后重新搜索一次(如果用户十秒内没有退出搜索界面且没有重新搜索) + m_researchTimer->start(); + } else { + Q_EMIT this->searchMethodChanged(FileUtils::SearchMethod::DIRECTSEARCH); + m_researchTimer->stop(); + } +} /** * @brief MainWindow::nativeEvent 处理窗口失焦事件 @@ -630,11 +617,11 @@ void MainWindow::keyPressEvent(QKeyEvent *event) bool MainWindow::eventFilter(QObject *watched, QEvent *event) { -// if (event->type() == QEvent::ActivationChange) { -// if(QApplication::activeWindow() != this) { -// tryHideMainwindow(); -// } -// } + if (event->type() == QEvent::ActivationChange) { + if(QApplication::activeWindow() != this) { + tryHideMainwindow(); + } + } return QMainWindow::eventFilter(watched,event); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 63f3f83..4895adf 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -44,16 +44,13 @@ #include #include #include - #include - #include "content-widget.h" #include "input-box.h" #include "index/index-generator.h" #include "libsearch.h" #include "search-app-thread.h" - #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) #include "xatom-helper.h" #endif @@ -66,7 +63,6 @@ #define SEARCH_METHOD_KEY "indexSearch" #define WEB_ENGINE_KEY "webEngine" - namespace Zeeker { class SearchResult; class MainWindow : public QMainWindow { @@ -94,7 +90,6 @@ public: MotifWmHints m_hints; #endif - private: // MainWindow quit when focus out. @@ -124,7 +119,7 @@ private: SearchManager* m_searcher = nullptr; SettingsMatch *m_settingsMatch = nullptr; QSystemTrayIcon *m_sys_tray_icon = nullptr; -// CreateIndexAskDialog * m_askDialog = nullptr; + CreateIndexAskDialog * m_askDialog = nullptr; bool m_isAskDialogVisible = false; QTimer * m_askTimer = nullptr; //询问是否创建索引弹窗弹出的计时器 @@ -134,9 +129,9 @@ private: SearchMethodManager m_searchMethodManager; -// void setSearchMethod(const bool&); + void setSearchMethod(const bool&); double getTransparentData(); -// void initTimer(); + void initTimer(); bool tryHideMainwindow(); protected: @@ -146,7 +141,7 @@ protected: void initUi(); Q_SIGNALS: -// void searchMethodChanged(FileUtils::SearchMethod); + void searchMethodChanged(FileUtils::SearchMethod); void webEngineChanged(); public Q_SLOTS: diff --git a/src/model/search-item-model.cpp b/src/model/search-item-model.cpp index 9ec3197..f011a18 100644 --- a/src/model/search-item-model.cpp +++ b/src/model/search-item-model.cpp @@ -66,7 +66,6 @@ int SearchItemModel::rowCount(const QModelIndex& index) const { * @param index 条目的索引 * @return model显示的列数 */ - int SearchItemModel::columnCount(const QModelIndex& index) const { return index.isValid() ? 0 : 1; } diff --git a/src/res/translations/zh_CN.qm b/src/res/translations/zh_CN.qm deleted file mode 100644 index de78a30c8f79c20f612f847275e577fe73ce33ce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5485 zcmb7I4@?`^8GpdpXN=9igfydB@<3@zvjvh+u|OG30_lnh2iOGS(1o0R5BuixoqKnN zS}kaX*cIuxbrlyyoJMb(zJ+LmqIrgg2lB%9W$i8ifj({<`px-LqkRUP}D z&wkjnxnm%B-1+^!@Av(A-}gP*UyxS5GB^9gYjvxBzUS$m{bd_M#aj?^-HTB9Nm%<3 zDtXdc%VmT%mLueO389wbuzrBh=&ums{MK5z7jXv-gwVZ+JO3?M-$C4k?Fjk$k!$QC zLhgge6?+zNZK$^xa77`s>)E~Veg}#j_%TA2&!ID4+JjI<3wrx_6FlRhp}(F$$p4Fy zj!kQUN1$Z*{A~zTo#low=qWb2neLw=3=q*fslw?}OgcuGwQ75h^oXXSckK5HGu@SC;@@=G~jAJqf<5 z672VV!mrr}y!h|&n;Jg^p6~FdFA~^y4}VtsFZk^efByE}2vvWcf4=@@uNPipy_+9)3M+TDGiY9=<$47rEhQ zO)8#}*BeCCBQY!+SX6W(N@=X8R8>}^bv*3h2l~QaBN4L*oQ}BN-%d3!IJY&KH0Yk1 zU4+Dm-qzNssU}g)VOfe23*m{PJ|ozAqL-n3+lXP}UeS!ih!dLIy*W>xzf(&jG*wCC z9R`sc6uZem;by3nspYz4-ASE?Vg?=?d6A*~_sa^wS+ktr9ECHei$a|sp3(P?uNff0 zw;0UVmn144NXe17l6J6>i=yc(3|SE%5pX`Zhl+4^(23py>P(u!Jwalc5OpWYTy)*U zb%x@1sBu-BP@R|_7??>hQ0XuU<9;#f=$?ka?YsZ8uYR;9I44}EuKMQl!Pli#`|9`q zF*-Z%8*3W8lkS*b!$b?6kiygqEUOavI*y1cju9n^(^?8cQf5BViIGxF13zqe`HOfW zM$8z|v8mw*#S^UQSk=t?s9CF6c4t27rgFC$@h(|Zv}op7cm)5z(a7Z!k24y+E=|45 z#5zd;jU@^hyc0Db0o~1n6bstYpd57xgSms51HCk;XRHadhVrzQgsiYQn_Z~3EU%a> zO*a?7-;o&Y`Yxgn@H_+pk72-EESDRh|m` z;QxxEg+&D~xT89U?Gcq!^Q-KY!o+rbj??ooai=!3H z`rEcj5)Q^R-Hd?IkcVBwh?`oHn#|<&B~4jVhh$>WUT(<~J`Ow`tN4_}n#B_PMU^Oa z@_ZqGpoP}3qjRH^j9F=?mQ3TMXvXZY+{mG+-!Kf{ts17N*lOd#!BNBz9IaV)3M%P# zN-n%*xS^0>reZo0EXa+#7_ZDFg_S4UME!vt5vs*!b-Xg@c#0f>0;6TfF2Z&ZQCz&p1Qcj$r9H56S`%&xukL>hwIPh|KpUBxD!Wxv*Q8X0GHAnhY;+dp6TI=d zzV}Hhx%tEmCaAhcgf48#34#-vB#+5fzp&@U75JU&&*p?ZsC+aS=$)B7^s?X&&gFIU zmHj#yhg7D62b5YYj*E&ch85yqQo#gM(%9HY_p_>yYhrmLh#NJd7PNtxUeesM!3nbh zwWAo?ggOpiJfOngP1X~WQPm#X)REKG-UJU$5?5y=Hlq%j!?dO4Nrtyf@~ZY&b4O|tZWln-I4?|_Vg5u)=0m<1^YErxOI^5 zb~P%if@#1e~eGkWEcD+JBJ(QiKR z8%^Mc+;m`zUY{rvt_x+B=^KiV*G~U-=gGjS!6S4ovEByfrms!)(7&mXH0d`KGsZ(O zf+*Sq9X73j#lRD?qGYOBm|!C_h7qX|hhX-kgQ!6uq$Uohu_#FtCaMyh5w-C=8IJX= zoKl%df2ucBSciH$bcl4WHP{89TF*55Q0rGeoI3MR-(z3S%f_|crg0bKxDNd)H;u(a z1BVHuept~WaUwbAt?O5aXwXn7 zkj>eMU}6;}dLu~cWQ^!gP#nGP?t|-6e$Mr4hHQ0VCx(S{a^C1+>jzpdm>~e77T9Vk zXpFVcH*$f>1#k?8lO=?$l3uG0JxUKjT%z@gv8WqfxF<=uX&q{ylr0wN%zequs#{+- z>`>hJ{@te;3s+c_rIf8JU?M1|{-asFsIt{$b0M3=S>HHGgAnR}W(?ehmWpbQ6bj?M zJnw!4|8rTmYuj1w4xF0aC#+|h`5sNAm4otS|8;?D!$dE1#U3$C6zf82!B8Uuda}Sw zp4%Y3Ib3Hp`xd}?a4&;9;W^TBbb?Xl1H{xtE9q?*mydO%+s1B$YEdKoW^f;M N3#NX__P<-m_#dL0r>Fn` diff --git a/src/resource.qrc b/src/resource.qrc index 207b8d7..8f84cfb 100644 --- a/src/resource.qrc +++ b/src/resource.qrc @@ -5,7 +5,6 @@ res/icons/close.svg res/qt-translations/qt_zh_CN.qm res/icons/net-disconnected.svg - res/translations/zh_CN.qm res/icons/system-search.symbolic.png diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index 36b2226..ca98ca2 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -34,7 +34,7 @@ extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int tran SettingsWidget::SettingsWidget(QWidget *parent) : QWidget(parent) { // this->setWindowIcon(QIcon::fromTheme("kylin-search")); this->setWindowTitle(tr("ukui-search-settings")); - this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); +// this->setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint); // this->setAttribute(Qt::WA_TranslucentBackground); #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) @@ -226,6 +226,11 @@ void SettingsWidget::initUi() { // m_mainLyt->addWidget(m_bottomBtnFrame); m_contentLyt->addStretch(); + +#if (QT_VERSION < QT_VERSION_CHECK(5, 12, 0)) + this->m_titleFrame->hide(); + setAttribute(Qt::WA_DeleteOnClose); +#endif } /** diff --git a/src/settings-widget.h b/src/settings-widget.h index cd6236b..421a099 100644 --- a/src/settings-widget.h +++ b/src/settings-widget.h @@ -62,7 +62,6 @@ private: MotifWmHints m_hints; #endif - //标题栏 QVBoxLayout * m_mainLyt = nullptr; QFrame * m_contentFrame = nullptr; diff --git a/src/src.pro b/src/src.pro index 2c0ecdf..f61b5a7 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,4 +1,4 @@ -QT += core gui dbus xml x11extras +QT += core gui dbus KWindowSystem xml x11extras greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -9,7 +9,7 @@ TEMPLATE = app PKGCONFIG += gio-2.0 glib-2.0 gio-unix-2.0 CONFIG += c++11 link_pkgconfig no_keywords lrelease LIBS += -lxapian -lgsettings-qt -lquazip5 -lX11 -#LIBS += -lukui-log4qt +LIBS += -lukui-log4qt #-L/usr/local/lib/libjemalloc -ljemalloc # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the @@ -33,8 +33,8 @@ SOURCES += \ mainwindow.cpp \ search-app-thread.cpp \ search-result.cpp \ - settings-widget.cpp -# xatom-helper.cpp + settings-widget.cpp \ + xatom-helper.cpp HEADERS += \ @@ -44,8 +44,8 @@ HEADERS += \ mainwindow.h \ search-app-thread.h \ search-result.h \ - settings-widget.h -# xatom-helper.h + settings-widget.h \ + xatom-helper.h # Default rules for deployment. @@ -70,10 +70,10 @@ TRANSLATIONS += \ qm_files.path = /usr/share/ukui-search/translations/ qm_files.files = $$OUT_PWD/.qm/*.qm -#schemes.path = /usr/share/glib-2.0/schemas/ -#schemes.files += ../data/org.ukui.search.data.gschema.xml ../data/org.ukui.log4qt.ukui-search.gschema.xml +schemes.path = /usr/share/glib-2.0/schemas/ +schemes.files += ../data/org.ukui.search.data.gschema.xml ../data/org.ukui.log4qt.ukui-search.gschema.xml -INSTALLS += qm_files +INSTALLS += qm_files schemes LIBS += -L$$OUT_PWD/../libchinese-segmentation -lchinese-segmentation \ -L$$OUT_PWD/../libsearch -lukui-search @@ -83,3 +83,13 @@ DEPENDPATH += $$PWD/../libchinese-segmentation INCLUDEPATH += $$PWD/../libsearch DEPENDPATH += $$PWD/../libsearch + +#DISTFILES += \ +# ../data/ukui-search-menu.desktop \ +# $$OUT_PWD/.qm/bo.qm \ +# $$OUT_PWD/.qm/tr.qm \ +# $$OUT_PWD/.qm/zh_CN.qm + +DISTFILES += \ + ../data/org.ukui.log4qt.ukui-search.gschema.xml \ + ../data/org.ukui.search.data.gschema.xml diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index 01cca72..121582c 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -4,7 +4,7 @@ QObject - + ukui-search is already running! @@ -12,57 +12,57 @@ Zeeker::ContentWidget - + Recently Opened - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Web Pages - + Unknown @@ -70,32 +70,32 @@ Zeeker::CreateIndexAskDialog - + ukui-search - + Search - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes @@ -111,17 +111,17 @@ Zeeker::MainWindow - + ukui-search - + Global Search - + Search @@ -170,32 +170,32 @@ Zeeker::SearchDetailView - + Introduction: %1 - + Application - + Document - + Preview is not avaliable - + Path - + Last time modified @@ -208,155 +208,155 @@ - - - + + + Search - + <h2>Settings</h2> - + <h3>Index State</h3> - - + + ... - + <h3>File Index Settings</h3> - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + <h3>Search Engine Settings</h3> - + Please select search engine you preferred. - + baidu - + sougou - + 360 - + Whether to delete this directory? - + Yes - + No - + Creating ... - + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: - + Cancel - + Choosen path is Empty! - + Choosen path is not in "home"! - + Its' parent folder has been blocked! - + Set blocked folder failed! - + OK diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 73ae8de..2b68a36 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -99,7 +99,7 @@ QObject - + ukui-search is already running! ukui-bul zaten çalışıyor! @@ -247,57 +247,57 @@ Zeeker::ContentWidget - + Recently Opened Yeni Açılan - + Open Quickly Hızlı Aç - + Commonly Used Genel olarak kullanılan - + Apps Uygulamalar - + Settings Ayarlar - + Files Dosyalar - + Dirs Dizinler - + File Contents Dosya İçeriği - + Best Matches En İyi Eşleşen - + Web Pages - + Unknown Bilinmeyen @@ -305,32 +305,32 @@ Zeeker::CreateIndexAskDialog - + ukui-search - + Search Ara - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes @@ -346,17 +346,17 @@ Zeeker::MainWindow - + ukui-search - + Global Search Genel Arama - + Search Ara @@ -405,32 +405,32 @@ Zeeker::SearchDetailView - + Introduction: %1 - + Application Uygulama - + Document Belge - + Preview is not avaliable - + Path Yol - + Last time modified Son değiştirilme zamanı @@ -443,155 +443,155 @@ - - - + + + Search Ara - + <h2>Settings</h2> <h2>Ayarlar</h2> - + <h3>Index State</h3> <h3>Dizin Durumu</h3> - - + + ... ... - + <h3>File Index Settings</h3> <h3>Dosya Dizini Ayarları</h3> - + Following folders will not be searched. You can set it by adding and removing folders. Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz. - + Add ignored folders Göz ardı edilen klasörleri ekleyin - + <h3>Search Engine Settings</h3> <h3>SArama Motoru Ayarları</h3> - + Please select search engine you preferred. Lütfen tercih ettiğiniz arama motorunu seçin. - + baidu - + sougou - + 360 - + Whether to delete this directory? Bu dizini silinsin mi? - + Yes - + No - + Creating ... Oluşturuluyor... - + Done Tamam - + Index Entry: %1 Dizin Girişi: %1 - + Directories Dizinler - + select blocked folder engellenen klasörü seç - + Select Seç - + Position: Pozisyon: - + FileName: Dosya Adı: - + FileType: Dosya Türü: - + Cancel İptal - + Choosen path is Empty! - + Choosen path is not in "home"! - + Its' parent folder has been blocked! - + Set blocked folder failed! - + OK diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 18f6bf2..3b34cf8 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -4,7 +4,7 @@ QObject - + ukui-search is already running! @@ -12,57 +12,57 @@ Zeeker::ContentWidget - + Recently Opened 最近 - + Open Quickly 快速入口 - + Commonly Used 常用 - + Apps 应用 - + Settings 配置项 - + Files 文件 - + Dirs 文件夹 - + File Contents 文件内容 - + Best Matches 最佳匹配 - + Web Pages 网页 - + Unknown 未知 @@ -70,32 +70,32 @@ Zeeker::CreateIndexAskDialog - + ukui-search 搜索 - + Search 搜索 - + Creating index can help you getting results quickly, whether to create or not? 创建索引可以快速获取搜索结果,是否创建? - + Don't remind 不再提醒 - + No 否(N) - + Yes 是(Y) @@ -111,17 +111,17 @@ Zeeker::MainWindow - + ukui-search 搜索 - + Global Search 搜索 - + Search 搜索 @@ -170,32 +170,32 @@ Zeeker::SearchDetailView - + Introduction: %1 软件介绍: %1 - + Application 应用 - + Document 文件 - + Preview is not avaliable 当前预览不可用 - + Path 路径 - + Last time modified 上次修改时间 @@ -208,155 +208,155 @@ 搜索 - - - + + + Search 搜索 - + <h2>Settings</h2> <h2>设置</h2> - + <h3>Index State</h3> <h3>索引状态</h3> - - + + ... - + <h3>File Index Settings</h3> <h3>文件索引设置</h3> - + Following folders will not be searched. You can set it by adding and removing folders. 搜索将不再查看以下文件夹。通过增加和删除文件夹可进行文件索引设置。 - + Add ignored folders 添加文件夹至黑名单 - + <h3>Search Engine Settings</h3> <h3>搜索引擎设置</h3> - + Please select search engine you preferred. 设置互联网搜索引擎 - + baidu 百度 - + sougou 搜狗 - + 360 360 - + Whether to delete this directory? 是否要删除此目录 - + Yes 是(Y) - + No 否(N) - + Creating ... 正在索引 - + Done 索引完成 - + Index Entry: %1 索引项: %1 - + Directories 文件夹 - + select blocked folder 选择屏蔽文件夹 - + Select 选择 - + Position: 位置: - + FileName: 名称: - + FileType: 类型: - + Cancel 取消 - + Choosen path is Empty! 选择的路径不存在! - + Choosen path is not in "home"! 请选择家目录下的文件夹! - + Its' parent folder has been blocked! 父文件夹已被屏蔽! - + Set blocked folder failed! - + OK 好的 From 2a8bba28867881d659d1e28787a614d02f82b3fa Mon Sep 17 00:00:00 2001 From: iaom <18504285112@163.com> Date: Sat, 31 Jul 2021 14:39:46 +0800 Subject: [PATCH 25/25] Update changelog ukui-search0.4.0+0720. --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index 16d0351..d9c057b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +ukui-search (0.4.0+0720) v101; urgency=medium + + * Bug 无 + * 任务号:无 + * 其他改动: + *Fix: A potential index crash issue. + - 修复了一个潜在的索引崩溃问题(由某些特定的格式损坏的文本文件引起)。 + + -- zhangpengfei Tue, 20 Jul 2021 10:42:32 +0800 + ukui-search (0.4.0+0709) v101; urgency=medium * Bug 无