diff --git a/frontend/control/stack-pages/home-page.cpp b/frontend/control/stack-pages/home-page.cpp index ae57e8a..a616c07 100644 --- a/frontend/control/stack-pages/home-page.cpp +++ b/frontend/control/stack-pages/home-page.cpp @@ -130,10 +130,10 @@ void HomePage::createSection(const QString §ion_name, const HomePageItemShap this->appendSection(section); connect(section, &HomePageSection::requestAction, this, [ = ](const QString &key, const QString &action, const QString &pluginId) { SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(pluginId); - if (plugin) { - plugin->openAction(action, key); - } else { - qWarning()<<"Get plugin failed!"; - } +// if (plugin) { +// plugin->openAction(action, key); +// } else { +// qWarning()<<"Get plugin failed!"; +// } }); } diff --git a/frontend/control/stack-pages/search-page-section.cpp b/frontend/control/stack-pages/search-page-section.cpp index aece8cb..8b0e317 100644 --- a/frontend/control/stack-pages/search-page-section.cpp +++ b/frontend/control/stack-pages/search-page-section.cpp @@ -162,10 +162,10 @@ void DetailWidget::setWidgetInfo(const QString &plugin_name, const SearchPluginI m_line_2->show(); } clearLayout(m_actionFrameLyt); - Q_FOREACH (auto action, info.actionList) { - ActionLabel * actionLabel = new ActionLabel(action, info.key, plugin_name, m_actionFrame); - m_actionFrameLyt->addWidget(actionLabel); - } +// Q_FOREACH (auto action, info.actionList) { +// ActionLabel * actionLabel = new ActionLabel(action, info.key, plugin_name, m_actionFrame); +// m_actionFrameLyt->addWidget(actionLabel); +// } m_actionFrame->show(); } @@ -288,9 +288,9 @@ bool ActionLabel::eventFilter(QObject *watched, QEvent *event) return true; } else if(event->type() == QEvent::MouseButtonRelease) { SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_plugin); - if (plugin) - plugin->openAction(m_action, m_key); - else +// if (plugin) +// plugin->openAction(m_action, m_key); +// else qWarning()<<"Get plugin failed!"; this->setForegroundRole(QPalette::Light); return true; diff --git a/frontend/frontend.pro b/frontend/frontend.pro index 7922326..93281f8 100644 --- a/frontend/frontend.pro +++ b/frontend/frontend.pro @@ -20,13 +20,14 @@ DEFINES += QT_DEPRECATED_WARNINGS # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - +include(../libsearch/libukui-search-headers.pri) include(control/control.pri) include(model/model.pri) include(xatom/xatom.pri) include(singleapplication/qt-single-application.pri) include(view/view.pri) + SOURCES += \ main.cpp \ mainwindow.cpp diff --git a/frontend/main.cpp b/frontend/main.cpp index c703f26..d23f675 100644 --- a/frontend/main.cpp +++ b/frontend/main.cpp @@ -253,6 +253,14 @@ int main(int argc, char *argv[]) { qDebug() << "Load translations file" << QLocale() << "failed!"; } + QTranslator lib_translator; + try { + if(! lib_translator.load("/usr/share/ukui-search/translations/libukui-search_" + QLocale::system().name())) throw - 1; + app.installTranslator(&lib_translator); + } catch(...) { + qDebug() << "Load translations file" << QLocale() << "failed!"; + } + //set main window to the center of screen MainWindow *w = new MainWindow; qApp->setWindowIcon(QIcon::fromTheme("kylin-search")); diff --git a/frontend/model/search-result-manager.cpp b/frontend/model/search-result-manager.cpp index 2dfcdb2..c62d628 100644 --- a/frontend/model/search-result-manager.cpp +++ b/frontend/model/search-result-manager.cpp @@ -41,57 +41,57 @@ void SearchResultManager::startSearch(const QString &keyword) SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_plugin_id); // plugin->KeywordSearch(keyword, m_result_queue); /*********************测试用数据*********************/ - SearchPluginIface::ResultInfo test_info; - if (m_plugin_id == "File") { - test_info.icon = QIcon::fromTheme("ukui-control-center"); - test_info.name = "搜索"; - QVector desc; - SearchPluginIface::DescriptionInfo desc_1; - desc_1.key = "描述"; - desc_1.value = "控制面板搜索插件"; - desc.append(desc_1); - QStringList actions; - actions.append("打开"); - test_info.description = desc; - test_info.actionList = actions; - m_result_queue->append(test_info); - } else { - test_info.icon = QIcon::fromTheme("unknown"); - test_info.name = "文件12345abcde.txt"; - QVector desc; - SearchPluginIface::DescriptionInfo desc_1; - SearchPluginIface::DescriptionInfo desc_2; - desc_1.key = "描述"; - desc_1.value = "一个文件"; - desc_2.key = "路径"; - desc_2.value = "一个路径/a/b/c/d/e/fffffff/文件12345abcde.txt"; - desc.append(desc_1); - desc.append(desc_2); - QStringList actions; - actions.append("打开"); - actions.append("复制路径"); - test_info.description = desc; - test_info.actionList = actions; - SearchPluginIface::ResultInfo test_info_1 = test_info; - test_info_1.name = "文件1"; - SearchPluginIface::ResultInfo test_info_2 = test_info; - test_info_2.name = "文件2"; - SearchPluginIface::ResultInfo test_info_3 = test_info; - test_info_3.name = "文件3"; - SearchPluginIface::ResultInfo test_info_4 = test_info; - test_info_4.name = "文件4"; - SearchPluginIface::ResultInfo test_info_5 = test_info; - test_info_5.name = "文件5"; - SearchPluginIface::ResultInfo test_info_6 = test_info; - test_info_6.name = "文件6"; - m_result_queue->append(test_info); - m_result_queue->append(test_info_1); - m_result_queue->append(test_info_2); - m_result_queue->append(test_info_3); - m_result_queue->append(test_info_4); - m_result_queue->append(test_info_5); - m_result_queue->append(test_info_6); - } +// SearchPluginIface::ResultInfo test_info; +// if (m_plugin_id == "File") { +// test_info.icon = QIcon::fromTheme("ukui-control-center"); +// test_info.name = "搜索"; +// QVector desc; +// SearchPluginIface::DescriptionInfo desc_1; +// desc_1.key = "描述"; +// desc_1.value = "控制面板搜索插件"; +// desc.append(desc_1); +// QStringList actions; +// actions.append("打开"); +// test_info.description = desc; +// test_info.actionList = actions; +// m_result_queue->append(test_info); +// } else { +// test_info.icon = QIcon::fromTheme("unknown"); +// test_info.name = "文件12345abcde.txt"; +// QVector desc; +// SearchPluginIface::DescriptionInfo desc_1; +// SearchPluginIface::DescriptionInfo desc_2; +// desc_1.key = "描述"; +// desc_1.value = "一个文件"; +// desc_2.key = "路径"; +// desc_2.value = "一个路径/a/b/c/d/e/fffffff/文件12345abcde.txt"; +// desc.append(desc_1); +// desc.append(desc_2); +// QStringList actions; +// actions.append("打开"); +// actions.append("复制路径"); +// test_info.description = desc; +// test_info.actionList = actions; +// SearchPluginIface::ResultInfo test_info_1 = test_info; +// test_info_1.name = "文件1"; +// SearchPluginIface::ResultInfo test_info_2 = test_info; +// test_info_2.name = "文件2"; +// SearchPluginIface::ResultInfo test_info_3 = test_info; +// test_info_3.name = "文件3"; +// SearchPluginIface::ResultInfo test_info_4 = test_info; +// test_info_4.name = "文件4"; +// SearchPluginIface::ResultInfo test_info_5 = test_info; +// test_info_5.name = "文件5"; +// SearchPluginIface::ResultInfo test_info_6 = test_info; +// test_info_6.name = "文件6"; +// m_result_queue->append(test_info); +// m_result_queue->append(test_info_1); +// m_result_queue->append(test_info_2); +// m_result_queue->append(test_info_3); +// m_result_queue->append(test_info_4); +// m_result_queue->append(test_info_5); +// m_result_queue->append(test_info_6); +// } /********************测试用数据********************/ } diff --git a/frontend/model/search-result-model.cpp b/frontend/model/search-result-model.cpp index 2ee5ad8..a3928ba 100644 --- a/frontend/model/search-result-model.cpp +++ b/frontend/model/search-result-model.cpp @@ -126,14 +126,14 @@ const bool &SearchResultModel::isExpanded() QStringList SearchResultModel::getActions(const QModelIndex &index) { if (m_item->m_result_info_list.length() > index.row() && index.row() >= 0) - return m_item->m_result_info_list.at(index.row()).actionList; +// return m_item->m_result_info_list.at(index.row()).actionList; return QStringList(); } QString SearchResultModel::getKey(const QModelIndex &index) { if (m_item->m_result_info_list.length() > index.row() && index.row() >= 0) - return m_item->m_result_info_list.at(index.row()).key; +// return m_item->m_result_info_list.at(index.row()).key; return NULL; } diff --git a/frontend/view/result-view.cpp b/frontend/view/result-view.cpp index ae83c24..0625a3c 100644 --- a/frontend/view/result-view.cpp +++ b/frontend/view/result-view.cpp @@ -155,11 +155,11 @@ void ResultView::onRowDoubleClickedSlot(const QModelIndex &index) SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_plugin_id); try { if (plugin) { - if (!info.actionList.isEmpty()) { - plugin->openAction(info.actionList.at(0), info.key); - } else { - throw -2; - } +// if (!info.actionList.isEmpty()) { +// plugin->openAction(info.actionList.at(0), info.key); +// } else { +// throw -2; +// } } else { throw -1; } @@ -211,7 +211,7 @@ void ResultView::onMenuTriggered(QAction *action) //NEW_TODO 接口调整后需要修改 SearchPluginIface *plugin = SearchPluginManager::getInstance()->getPlugin(m_plugin_id); if (plugin) { - plugin->openAction(action->text(), m_model->getKey(this->currentIndex())); +// plugin->openAction(action->text(), m_model->getKey(this->currentIndex())); } else { qWarning()<<"Get plugin failed!"; } diff --git a/libsearch/common.h b/libsearch/common.h index d3c238c..7ba6118 100644 --- a/libsearch/common.h +++ b/libsearch/common.h @@ -2,6 +2,8 @@ #define COMMON_H #define UKUI_SEARCH_PIPE_PATH (QDir::homePath()+"/.config/org.ukui/ukui-search/ukuisearch").toLocal8Bit().constData() +#define FILE_SEARCH_VALUE "0" +#define DIR_SEARCH_VALUE "1" //TODO Put things that needed to be put here here. #endif // COMMON_H diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 5d4d3f1..d2f9534 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -688,3 +688,18 @@ void FileUtils::getTxtContent(QString &path, QString &textcontent) { return; } + +bool FileUtils::openFile(QString &path, bool openInDir) +{ + if(openInDir) { + return QDesktopServices::openUrl(QUrl::fromLocalFile(path.left(path.lastIndexOf("/")))); + } else { + return QDesktopServices::openUrl(QUrl::fromLocalFile(path)); + } +} + +bool FileUtils::copyPath(QString &path) +{ + QApplication::clipboard()->setText(path); + return true; +} diff --git a/libsearch/file-utils.h b/libsearch/file-utils.h index a352d63..8a4736c 100644 --- a/libsearch/file-utils.h +++ b/libsearch/file-utils.h @@ -35,6 +35,9 @@ #include #include #include +#include +#include +#include #include #include @@ -81,6 +84,9 @@ public: static void getXlsxTextContent(QString &path, QString &textcontent); static void getPdfTextContent(QString &path, QString &textcontent); static void getTxtContent(QString &path, QString &textcontent); + + static bool openFile(QString &path, bool openInDir = false); + static bool copyPath(QString &path); static size_t _max_index_count; static size_t _current_index_count; //this one has been Abandoned,do not use it. static unsigned short _index_status; diff --git a/libsearch/index/data-queue.cpp b/libsearch/index/data-queue.cpp new file mode 100644 index 0000000..b06cd4f --- /dev/null +++ b/libsearch/index/data-queue.cpp @@ -0,0 +1,6 @@ +#include "data-queue.h" + +DataQueue::DataQueue() +{ + +} diff --git a/libsearch/index/data-queue.h b/libsearch/index/data-queue.h new file mode 100644 index 0000000..2af8741 --- /dev/null +++ b/libsearch/index/data-queue.h @@ -0,0 +1,11 @@ +#ifndef DATAQUEUE_H +#define DATAQUEUE_H + + +class DataQueue +{ +public: + DataQueue(); +}; + +#endif // DATAQUEUE_H diff --git a/libsearch/index/file-search-plugin.cpp b/libsearch/index/file-search-plugin.cpp new file mode 100644 index 0000000..67d9647 --- /dev/null +++ b/libsearch/index/file-search-plugin.cpp @@ -0,0 +1,190 @@ +#include "file-search-plugin.h" +#include "search-manager.h" +using namespace Zeeker; + +FileSearchPlugin::FileSearchPlugin(QObject *parent) : QObject(parent) +{ + SearchPluginIface::Actioninfo open { 0, tr("Open")}; + SearchPluginIface::Actioninfo Openpath { 1, tr("Open path")}; + SearchPluginIface::Actioninfo CopyPath { 2, tr("Copy Path")}; + m_actionInfo << open << Openpath << CopyPath; + m_pool.setMaxThreadCount(2); + m_pool.setExpiryTimeout(1000); +} + +const QString FileSearchPlugin::name() +{ + return tr("File Search"); +} + +const QString FileSearchPlugin::description() +{ + return tr("File search."); +} + +QString FileSearchPlugin::getPluginName() +{ + return tr("File Search"); +} + +void Zeeker::FileSearchPlugin::KeywordSearch(QString keyword, DataQueue *searchResult) +{ + SearchManager::m_mutex1.lock(); + ++SearchManager::uniqueSymbol1; + SearchManager::m_mutex1.unlock(); + + if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) { + DirectSearch *directSearch; + directSearch = new DirectSearch(keyword, searchResult, FILE_SEARCH_VALUE, SearchManager::uniqueSymbol1); + m_pool.start(directSearch); + } else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) { + FileSearch *filesearch; + filesearch = new FileSearch(searchResult, SearchManager::uniqueSymbol1, keyword, FILE_SEARCH_VALUE, 1, 0, 5); + m_pool.start(filesearch); + } +} + +QList FileSearchPlugin::getActioninfo(int type) +{ + return m_actionInfo; +} + +void FileSearchPlugin::openAction(int actionkey, QString key) +{ + //TODO add some return message here. + switch (actionkey) { + case 0: + FileUtils::openFile(key); + break; + case 1: + FileUtils::openFile(key, true); + case 2: + FileUtils::copyPath(key); + default: + break; + } +} + +DirSearchPlugin::DirSearchPlugin(QObject *parent) : QObject(parent) +{ + SearchPluginIface::Actioninfo open { 0, tr("Open")}; + SearchPluginIface::Actioninfo Openpath { 1, tr("Open path")}; + SearchPluginIface::Actioninfo CopyPath { 2, tr("Copy Path")}; + m_actionInfo << open << Openpath << CopyPath; + m_pool.setMaxThreadCount(2); + m_pool.setExpiryTimeout(1000); +} + +const QString DirSearchPlugin::name() +{ + return tr("Dir Search"); +} + +const QString DirSearchPlugin::description() +{ + return tr("Dir search."); +} + +QString DirSearchPlugin::getPluginName() +{ + return tr("Dir Search"); +} + +void Zeeker::DirSearchPlugin::KeywordSearch(QString keyword, DataQueue *searchResult) +{ + SearchManager::m_mutex2.lock(); + ++SearchManager::uniqueSymbol2; + SearchManager::m_mutex2.unlock(); + + if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) { + DirectSearch *directSearch; + directSearch = new DirectSearch(keyword, searchResult, DIR_SEARCH_VALUE, SearchManager::uniqueSymbol2); + m_pool.start(directSearch); + } else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) { + FileSearch *filesearch; + filesearch = new FileSearch(searchResult, SearchManager::uniqueSymbol2, keyword, DIR_SEARCH_VALUE, 1, 0, 5); + m_pool.start(filesearch); + } +} + +QList DirSearchPlugin::getActioninfo(int type) +{ + return m_actionInfo; +} + +void DirSearchPlugin::openAction(int actionkey, QString key) +{ + //TODO add some return message here. + switch (actionkey) { + case 0: + FileUtils::openFile(key); + break; + case 1: + FileUtils::openFile(key, true); + case 2: + FileUtils::copyPath(key); + default: + break; + } +} + +FileContengSearchPlugin::FileContengSearchPlugin(QObject *parent) : QObject(parent) +{ + SearchPluginIface::Actioninfo open { 0, tr("Open")}; + SearchPluginIface::Actioninfo Openpath { 1, tr("Open path")}; + SearchPluginIface::Actioninfo CopyPath { 2, tr("Copy Path")}; + m_actionInfo << open << Openpath << CopyPath; + m_pool.setMaxThreadCount(2); + m_pool.setExpiryTimeout(1000); +} + +const QString FileContengSearchPlugin::name() +{ + return tr("File Content Search"); +} + +const QString FileContengSearchPlugin::description() +{ + return tr("File content search."); +} + +QString FileContengSearchPlugin::getPluginName() +{ + return tr("File content search"); +} + +void Zeeker::FileContengSearchPlugin::KeywordSearch(QString keyword, DataQueue *searchResult) +{ + SearchManager::m_mutex3.lock(); + ++SearchManager::uniqueSymbol3; + SearchManager::m_mutex3.unlock(); + + if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) { + return; + } else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) { + FileContentSearch *fileContentSearch; + fileContentSearch = new FileContentSearch(searchResult, SearchManager::uniqueSymbol3, keyword, 0, 5); + m_pool.start(fileContentSearch); + } +} + +QList FileContengSearchPlugin::getActioninfo(int type) +{ + return m_actionInfo; +} + +void FileContengSearchPlugin::openAction(int actionkey, QString key) +{ + //TODO add some return message here. + switch (actionkey) { + case 0: + FileUtils::openFile(key); + break; + case 1: + FileUtils::openFile(key, true); + case 2: + FileUtils::copyPath(key); + default: + break; + } +} diff --git a/libsearch/index/file-search-plugin.h b/libsearch/index/file-search-plugin.h new file mode 100644 index 0000000..0c2fb28 --- /dev/null +++ b/libsearch/index/file-search-plugin.h @@ -0,0 +1,83 @@ +#ifndef FILESEARCHPLUGIN_H +#define FILESEARCHPLUGIN_H + +#include +#include + +#include "libsearch_global.h" +#include "search-plugin-iface.h" +#include "common.h" +namespace Zeeker { +//internal plugin +class LIBSEARCH_EXPORT FileSearchPlugin : public QObject, public SearchPluginIface +{ + Q_OBJECT +public: + FileSearchPlugin(QObject *parent = nullptr); + PluginType pluginType() {return PluginType::SearchPlugin;} + const QString name(); + const QString description(); + const QIcon icon() {return QIcon::fromTheme("folder");} + void setEnable(bool enable) {m_enable = enable;} + bool isEnable() {return m_enable;} + QString getPluginName(); + + void KeywordSearch(QString keyword,DataQueue *searchResult); + QList getActioninfo(int type); + void openAction(int actionkey, QString key); + +private: + bool m_enable = true; + QList m_actionInfo; + QThreadPool m_pool; +}; + +class LIBSEARCH_EXPORT DirSearchPlugin : public QObject, public SearchPluginIface +{ + Q_OBJECT +public: + DirSearchPlugin(QObject *parent = nullptr); + PluginType pluginType() {return PluginType::SearchPlugin;} + const QString name(); + const QString description(); + const QIcon icon() {return QIcon::fromTheme("folder");} + void setEnable(bool enable) {m_enable = enable;} + bool isEnable() {return m_enable;} + QString getPluginName(); + + void KeywordSearch(QString keyword,DataQueue *searchResult); + QList getActioninfo(int type); + void openAction(int actionkey, QString key); + +private: + bool m_enable = true; + QList m_actionInfo; + QThreadPool m_pool; +}; + +class LIBSEARCH_EXPORT FileContengSearchPlugin : public QObject, public SearchPluginIface +{ + Q_OBJECT +public: + FileContengSearchPlugin(QObject *parent = nullptr); + PluginType pluginType() {return PluginType::SearchPlugin;} + const QString name(); + const QString description(); + const QIcon icon() {return QIcon::fromTheme("folder");} + void setEnable(bool enable) {m_enable = enable;} + bool isEnable() {return m_enable;} + QString getPluginName(); + + void KeywordSearch(QString keyword,DataQueue *searchResult); + QList getActioninfo(int type); + void openAction(int actionkey, QString key); + +private: + bool m_enable = true; + QList m_actionInfo; + QThreadPool m_pool; +}; +} + + +#endif // FILESEARCHPLUGIN_H diff --git a/libsearch/index/index.pri b/libsearch/index/index.pri index 6ceadc6..27c89e2 100644 --- a/libsearch/index/index.pri +++ b/libsearch/index/index.pri @@ -4,6 +4,7 @@ HEADERS += \ $$PWD/construct-document.h \ $$PWD/document.h \ $$PWD/file-reader.h \ + $$PWD/file-search-plugin.h \ $$PWD/first-index.h \ $$PWD/index-generator.h \ $$PWD/index-status-recorder.h \ @@ -17,6 +18,7 @@ SOURCES += \ $$PWD/construct-document.cpp \ $$PWD/document.cpp \ $$PWD/file-reader.cpp \ + $$PWD/file-search-plugin.cpp \ $$PWD/first-index.cpp \ $$PWD/index-generator.cpp \ $$PWD/index-status-recorder.cpp \ diff --git a/libsearch/index/search-manager.cpp b/libsearch/index/search-manager.cpp index ce75385..1505e54 100644 --- a/libsearch/index/search-manager.cpp +++ b/libsearch/index/search-manager.cpp @@ -56,25 +56,25 @@ void SearchManager::onKeywordSearch(QString keyword, QQueue *searchResu ++uniqueSymbol3; m_mutex3.unlock(); - if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) { - DirectSearch *directSearch; - directSearch = new DirectSearch(keyword, searchResultFile, searchResultDir, uniqueSymbol1); - m_pool.start(directSearch); - } else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) { - FileSearch *filesearch; - filesearch = new FileSearch(searchResultFile, uniqueSymbol1, keyword, "0", 1, 0, 5); - m_pool.start(filesearch); +// if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) { +// DirectSearch *directSearch; +// directSearch = new DirectSearch(keyword, searchResultFile, searchResultDir, uniqueSymbol1); +// m_pool.start(directSearch); +// } else if(FileUtils::SearchMethod::INDEXSEARCH == FileUtils::searchMethod) { +// FileSearch *filesearch; +// filesearch = new FileSearch(searchResultFile, uniqueSymbol1, keyword, "0", 1, 0, 5); +// m_pool.start(filesearch); - FileSearch *dirsearch; - dirsearch = new FileSearch(searchResultDir, uniqueSymbol2, keyword, "1", 1, 0, 5); - m_pool.start(dirsearch); +// FileSearch *dirsearch; +// dirsearch = new FileSearch(searchResultDir, uniqueSymbol2, keyword, "1", 1, 0, 5); +// m_pool.start(dirsearch); - FileContentSearch *contentSearch; - contentSearch = new FileContentSearch(searchResultContent, uniqueSymbol3, keyword, 0, 5); - m_pool.start(contentSearch); - } else { - qWarning() << "Unknown search method! FileUtils::searchMethod: " << static_cast(FileUtils::searchMethod); - } +// FileContentSearch *contentSearch; +// contentSearch = new FileContentSearch(searchResultContent, uniqueSymbol3, keyword, 0, 5); +// m_pool.start(contentSearch); +// } else { +// qWarning() << "Unknown search method! FileUtils::searchMethod: " << static_cast(FileUtils::searchMethod); +// } return; } @@ -88,7 +88,24 @@ bool SearchManager::isBlocked(QString &path) { } -FileSearch::FileSearch(QQueue *searchResult, size_t uniqueSymbol, QString keyword, QString value, unsigned slot, int begin, int num) { +bool SearchManager::creatResultInfo(SearchPluginIface::ResultInfo &ri, QString path) +{ + QFileInfo info(info); + if(!info.exists()) { + return false; + } + SearchPluginIface::DescriptionInfo di; + di.key = tr("Path:"); + di.value = path; + + ri.icon = FileUtils::getFileIcon(QUrl::fromLocalFile(path).toString()); + ri.name = info.fileName(); + ri.description = QVector() << di; + ri.actionKey = path; + ri.type = 0; + return true; +} +FileSearch::FileSearch(DataQueue *searchResult, size_t uniqueSymbol, QString keyword, QString value, unsigned slot, int begin, int num) { this->setAutoDelete(true); m_search_result = searchResult; m_uniqueSymbol = uniqueSymbol; @@ -178,18 +195,13 @@ int FileSearch::getResult(Xapian::MSet &result) { if(SearchManager::isBlocked(path)) { continue; } - - QFileInfo info(path); - - if(!info.exists()) { -// pathTobeDelete->append(QString::fromStdString(data)); - qDebug() << path << "is not exist!!"; - } else { + SearchPluginIface::ResultInfo ri; + if(SearchManager::creatResultInfo(ri, path)) { switch(m_value.toInt()) { case 1: SearchManager::m_mutex1.lock(); if(m_uniqueSymbol == SearchManager::uniqueSymbol2) { - m_search_result->enqueue(path); + m_search_result->enqueue(ri); SearchManager::m_mutex1.unlock(); } else { SearchManager::m_mutex1.unlock(); @@ -200,7 +212,7 @@ int FileSearch::getResult(Xapian::MSet &result) { case 0: SearchManager::m_mutex2.lock(); if(m_uniqueSymbol == SearchManager::uniqueSymbol1) { - m_search_result->enqueue(path); + m_search_result->enqueue(ri); SearchManager::m_mutex2.unlock(); } else { SearchManager::m_mutex2.unlock(); @@ -210,8 +222,8 @@ int FileSearch::getResult(Xapian::MSet &result) { default: break; } - // searchResult.append(path); } + // searchResult.append(path); qDebug() << "doc=" << path << ",weight=" << docScoreWeight << ",percent=" << docScorePercent; } // if(!pathTobeDelete->isEmpty()) @@ -219,7 +231,7 @@ int FileSearch::getResult(Xapian::MSet &result) { return 0; } -FileContentSearch::FileContentSearch(QQueue> *searchResult, size_t uniqueSymbol, QString keyword, int begin, int num) { +FileContentSearch::FileContentSearch(DataQueue *searchResult, size_t uniqueSymbol, QString keyword, int begin, int num) { this->setAutoDelete(true); m_search_result = searchResult; m_uniqueSymbol = uniqueSymbol; @@ -339,15 +351,12 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord) { continue; } - QFileInfo info(path); - - if(!info.exists()) { - // pathTobeDelete->append(QString::fromStdString(data)); - qDebug() << path << "is not exist!!"; + SearchPluginIface::ResultInfo ri; + if(!SearchManager::creatResultInfo(ri, path)) { continue; } // Construct snippets containing keyword. - QStringList snippets; +// QStringList snippets; // snippets.append(QString::fromStdString( result.snippet(doc.get_data(),400))); // qWarning()<enqueue(qMakePair(path, snippets)); + m_search_result->enqueue(ri); SearchManager::m_mutex3.unlock(); - snippets.clear(); - QStringList().swap(snippets); +// snippets.clear(); +// QStringList().swap(snippets); } else { SearchManager::m_mutex3.unlock(); return -1; @@ -403,12 +415,12 @@ int FileContentSearch::getResult(Xapian::MSet &result, std::string &keyWord) { return 0; } -DirectSearch::DirectSearch(QString keyword, QQueue *searchResultFile, QQueue *searchResultDir, size_t uniqueSymbol) { +DirectSearch::DirectSearch(QString keyword, DataQueue *searchResult, QString value, size_t uniqueSymbol) { this->setAutoDelete(true); m_keyword = keyword; - m_searchResultFile = searchResultFile; - m_searchResultDir = searchResultDir; + m_searchResult = searchResult; m_uniqueSymbol = uniqueSymbol; + m_value = value; } void DirectSearch::run() { @@ -417,8 +429,13 @@ void DirectSearch::run() { QFileInfoList list; QDir dir; // QDir::Hidden - dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); - dir.setSorting(QDir::DirsFirst); + if(m_value == DIR_SEARCH_VALUE) { + dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); + } else { + dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); + dir.setSorting(QDir::DirsFirst); + } + QStringList blockList = GlobalSettings::getInstance()->getBlockDirs(); while(!bfs.empty()) { dir.setPath(bfs.dequeue()); @@ -442,26 +459,22 @@ void DirectSearch::run() { bfs.enqueue(i.absoluteFilePath()); } if(i.fileName().contains(m_keyword, Qt::CaseInsensitive)) { - SearchManager::m_mutex1.lock(); // qWarning() << i.fileName() << m_keyword; - if(m_uniqueSymbol == SearchManager::uniqueSymbol1) { - // TODO - if(i.isDir() && m_searchResultDir->length() < 51) { - m_searchResultDir->enqueue(i.absoluteFilePath()); - } else if(m_searchResultFile->length() < 51) { - m_searchResultFile->enqueue(i.absoluteFilePath()); - } - SearchManager::m_mutex1.unlock(); - if(m_searchResultDir->length() > 49 && m_searchResultFile->length() > 49) { - return; - } - } else { - // TODO - // More suitable method? - m_searchResultFile->clear(); - m_searchResultDir->clear(); - SearchManager::m_mutex1.unlock(); + if(m_searchResult->length() > 49) return; + if((i.isDir() && m_value == DIR_SEARCH_VALUE) || (i.isFile() && m_value == FILE_SEARCH_VALUE)) { + SearchPluginIface::ResultInfo ri; + if(SearchManager::creatResultInfo(ri,i.absoluteFilePath())) { + SearchManager::m_mutex1.lock(); + if(m_uniqueSymbol == SearchManager::uniqueSymbol1) { + m_searchResult->enqueue(ri); + SearchManager::m_mutex1.unlock(); + } else { + SearchManager::m_mutex1.unlock(); + return; + } + + } } } } diff --git a/libsearch/index/search-manager.h b/libsearch/index/search-manager.h index c715306..e458a47 100644 --- a/libsearch/index/search-manager.h +++ b/libsearch/index/search-manager.h @@ -37,19 +37,19 @@ #include #include +#include "search-plugin-iface.h" #include "file-utils.h" #include "global-settings.h" #include "chinese-segmentation.h" - +#include "common.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() - namespace Zeeker { - class LIBSEARCH_EXPORT SearchManager : public QObject { friend class FileSearch; friend class FileContentSearch; + friend class DirectSearch; Q_OBJECT public: explicit SearchManager(QObject *parent = nullptr); @@ -72,33 +72,15 @@ Q_SIGNALS: void resultDir(QQueue *); void resultContent(QQueue> *); private: -// int keywordSearchfile(size_t uniqueSymbol, QString keyword, QString value,unsigned slot = 1,int begin = 0, int num = 20); -// int keywordSearchContent(size_t uniqueSymbol, QString keyword, int begin = 0, int num = 20); - - /** - * @brief SearchManager::creatQueryForFileSearch - * This part shall be optimized frequently to provide a more stable search function. - * @param keyword - * @param db - * @return Xapian::Query - */ -// Xapian::Query creatQueryForFileSearch(QString keyword, Xapian::Database &db); -// Xapian::Query creatQueryForContentSearch(QString keyword, Xapian::Database &db); - -// int getResult(size_t uniqueSymbol, Xapian::MSet &result, QString value); -// int getContentResult(size_t uniqueSymbol, Xapian::MSet &result,std::string &keyWord); - static bool isBlocked(QString &path); + static bool creatResultInfo(Zeeker::SearchPluginIface::ResultInfo &ri, QString path); -// QQueue *m_search_result_file = nullptr; -// QQueue *m_search_result_dir = nullptr; -// QQueue> *m_search_result_content = nullptr; QThreadPool m_pool; }; class FileSearch : public QRunnable { public: - explicit FileSearch(QQueue *searchResult, size_t uniqueSymbol, QString keyword, QString value, unsigned slot = 1, int begin = 0, int num = 20); + explicit FileSearch(DataQueue *searchResult, size_t uniqueSymbol, QString keyword, QString value, unsigned slot = 1, int begin = 0, int num = 20); ~FileSearch(); protected: void run(); @@ -107,7 +89,7 @@ private: Xapian::Query creatQueryForFileSearch(Xapian::Database &db); int getResult(Xapian::MSet &result); - QQueue *m_search_result = nullptr; + DataQueue *m_search_result = nullptr; QString m_value; unsigned m_slot = 1; size_t m_uniqueSymbol; @@ -118,7 +100,7 @@ private: class FileContentSearch : public QRunnable { public: - explicit FileContentSearch(QQueue> *searchResult, size_t uniqueSymbol, QString keyword, int begin = 0, int num = 20); + explicit FileContentSearch(DataQueue *searchResult, size_t uniqueSymbol, QString keyword, int begin = 0, int num = 20); ~FileContentSearch(); protected: void run(); @@ -126,7 +108,7 @@ private: int keywordSearchContent(); int getResult(Xapian::MSet &result, std::string &keyWord); - QQueue> *m_search_result = nullptr; + DataQueue *m_search_result = nullptr; size_t m_uniqueSymbol; QString m_keyword; int m_begin = 0; @@ -135,14 +117,14 @@ private: class DirectSearch : public QRunnable { public: - explicit DirectSearch(QString keyword, QQueue *searchResultFile, QQueue *searchResultDir, size_t uniqueSymbol); + explicit DirectSearch(QString keyword, DataQueue *searchResult, QString value, size_t uniqueSymbol); protected: void run(); private: QString m_keyword; - QQueue* m_searchResultFile = nullptr; - QQueue* m_searchResultDir = nullptr; + DataQueue* m_searchResult = nullptr; size_t m_uniqueSymbol; + QString m_value; }; } diff --git a/libsearch/libsearch.h b/libsearch/libsearch.h index 0fc1e02..5c0bfa7 100644 --- a/libsearch/libsearch.h +++ b/libsearch/libsearch.h @@ -26,12 +26,15 @@ #include "file-utils.h" #include "global-settings.h" +#include "plugininterface/search-plugin-iface.h" +#include "plugininterface/data-queue.h" #include "index/searchmethodmanager.h" #include "index/first-index.h" #include "index/ukui-search-qdbus.h" #include "index/inotify-index.h" #include "index/search-manager.h" + namespace Zeeker { //class LIBSEARCH_EXPORT GlobalSearch { //public: diff --git a/libsearch/libsearch.pro b/libsearch/libsearch.pro index 4b85b0d..6e0a6c4 100644 --- a/libsearch/libsearch.pro +++ b/libsearch/libsearch.pro @@ -24,13 +24,14 @@ DEFINES += PLUGIN_INSTALL_DIRS='\\"$${PLUGIN_INSTALL_DIRS}\\"' # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - +include(pluginmanage/plugin-manager.pri) +include(plugininterface/plugin-interface.pri) include(index/index.pri) include(parser/parser.pri)) include(appsearch/appsearch.pri) include(settingsearch/settingsearch.pri)) -include(plugininterface/plugin-interface.pri) -include(pluginmanage/plugin-manager.pri) + + LIBS += -L$$OUT_PWD/../libchinese-segmentation/ -lchinese-segmentation LIBS += -lxapian -lquazip5 -luchardet @@ -52,13 +53,13 @@ HEADERS += \ RESOURCES += \ resource1.qrc \ -#TRANSLATIONS += \ -# ../translations/libsearch/libukui-search_zh_CN.ts +TRANSLATIONS += \ + ../translations/libukui-search/libukui-search_zh_CN.ts -#qm_files.path = /usr/share/ukui-search/translations/libsearch/ -#qm_files.files = $$OUT_PWD/.qm/*.qm +qm_files.path = /usr/share/ukui-search/translations/ +qm_files.files = $$OUT_PWD/.qm/*.qm -#INSTALLS += qm_files +INSTALLS += qm_files # Default rules for deployment. @@ -67,11 +68,9 @@ unix { INSTALLS += target header.path = /usr/include/ukui-search - header.files += *.h index/*.h appsearch/*.h settingsearch/*.h + header.files += *.h index/*.h appsearch/*.h settingsearch/*.h plugininterface/*.h INSTALLS += header } - - INCLUDEPATH += $$PWD/../libchinese-segmentation DEPENDPATH += $$PWD/../libchinese-segmentation diff --git a/libsearch/libukui-search-headers.pri b/libsearch/libukui-search-headers.pri new file mode 100644 index 0000000..5205df9 --- /dev/null +++ b/libsearch/libukui-search-headers.pri @@ -0,0 +1,8 @@ +INCLUDEPATH += $$PWD +INCLUDEPATH += $$PWD/plugininterface +INCLUDEPATH += $$PWD/index +INCLUDEPATH += $$PWD/parser +INCLUDEPATH += $$PWD/pluginmanage +INCLUDEPATH += $$PWD/settingsearch +INCLUDEPATH += $$PWD/appsearch + diff --git a/libsearch/plugininterface/data-queue.h b/libsearch/plugininterface/data-queue.h new file mode 100644 index 0000000..6820299 --- /dev/null +++ b/libsearch/plugininterface/data-queue.h @@ -0,0 +1,26 @@ +#ifndef DATAQUEUE_H +#define DATAQUEUE_H +#include +#include +#include +#include "libsearch_global.h" +namespace Zeeker { +// TODO I want a unlocked queue +template +class LIBSEARCH_EXPORT DataQueue : public QList +{ +public: + inline void enqueue(const T &t) { + QMutexLocker locker(&m_mutex); + QList::append(t); + } + inline T dequeue() { + QMutexLocker locker(&m_mutex); + return QList::takeFirst(); + } +private: + QMutex m_mutex; +}; +} + +#endif // DATAQUEUE_H diff --git a/libsearch/plugininterface/plugin-interface.pri b/libsearch/plugininterface/plugin-interface.pri index 694ab73..592db4d 100644 --- a/libsearch/plugininterface/plugin-interface.pri +++ b/libsearch/plugininterface/plugin-interface.pri @@ -1,6 +1,7 @@ -INCLUDEPATH += $$PWD +INCLUDEPATH += $$PWD \ HEADERS += \ $$PWD/plugin-iface.h \ - $$PWD/search-plugin-iface.h + $$PWD/search-plugin-iface.h \ + $$PWD/data-queue.h diff --git a/libsearch/plugininterface/search-plugin-iface.h b/libsearch/plugininterface/search-plugin-iface.h index 4b1345a..f8c7c80 100644 --- a/libsearch/plugininterface/search-plugin-iface.h +++ b/libsearch/plugininterface/search-plugin-iface.h @@ -4,8 +4,11 @@ #include #include -#include +#include +#include +#include #include "plugin-iface.h" +#include "data-queue.h" namespace Zeeker { class SearchPluginIface : public PluginInterface @@ -16,6 +19,11 @@ public: QString key; QString value; }; + struct Actioninfo + { + int actionkey; + QString displayName; + }; /** * @brief The ResultInfo struct */ @@ -24,13 +32,15 @@ public: QIcon icon; QString name; QVector description; - QStringList actionList; //all actions, take fist for double click action. - QString key; + QString actionKey; + int type; }; + virtual ~SearchPluginIface() {} virtual QString getPluginName() = 0; - virtual void KeywordSearch(QString keyword,QQueue *searchResult) = 0; - virtual void openAction(QString action, QString key) = 0; + virtual void KeywordSearch(QString keyword,DataQueue *searchResult) = 0; + virtual QList getActioninfo(int type) = 0; + virtual void openAction(int actionkey, QString key) = 0; }; } diff --git a/libsearch/pluginmanage/search-plugin-manager.cpp b/libsearch/pluginmanage/search-plugin-manager.cpp index 8adbfdb..996f4db 100644 --- a/libsearch/pluginmanage/search-plugin-manager.cpp +++ b/libsearch/pluginmanage/search-plugin-manager.cpp @@ -1,8 +1,16 @@ #include "search-plugin-manager.h" +#include "file-search-plugin.h" using namespace Zeeker; static SearchPluginManager *global_instance = nullptr; +SearchPluginManager::SearchPluginManager(QObject *parent) +{ + registerPlugin(new FileSearchPlugin(this)); + registerPlugin(new DirSearchPlugin(this)); + registerPlugin(new FileContengSearchPlugin(this)); +} + bool SearchPluginManager::registerPlugin(Zeeker::SearchPluginIface *plugin) { if (m_hash.value(plugin->name())) { @@ -35,10 +43,6 @@ void SearchPluginManager::close() this->deleteLater(); } -SearchPluginManager::SearchPluginManager(QObject *parent) -{ -} - SearchPluginManager::~SearchPluginManager() { m_hash.clear(); diff --git a/libsearch/pluginmanage/search-plugin-manager.h b/libsearch/pluginmanage/search-plugin-manager.h index 6c93d47..5722ce2 100644 --- a/libsearch/pluginmanage/search-plugin-manager.h +++ b/libsearch/pluginmanage/search-plugin-manager.h @@ -2,7 +2,7 @@ #define SEARCHPLUGINFACTORY_H #include -#include "plugininterface/search-plugin-iface.h" +#include "search-plugin-iface.h" namespace Zeeker { class SearchPluginManager : public QObject diff --git a/src/src.pro b/src/src.pro index e207640..b807b21 100644 --- a/src/src.pro +++ b/src/src.pro @@ -20,11 +20,12 @@ DEFINES += QT_DEPRECATED_WARNINGS # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - +include(../libsearch/libukui-search-headers.pri) include(model/model.pri) include(control/control.pri) include(singleapplication/qt-single-application.pri) + SOURCES += \ content-widget.cpp \ create-index-ask-dialog.cpp \ diff --git a/translations/libukui-search/libukui-search_zh_CN.ts b/translations/libukui-search/libukui-search_zh_CN.ts new file mode 100644 index 0000000..ab22e5d --- /dev/null +++ b/translations/libukui-search/libukui-search_zh_CN.ts @@ -0,0 +1,103 @@ + + + + + Zeeker::DirSearchPlugin + + + Open + 打开 + + + + Open path + 打开文件所在路径 + + + + Copy Path + 复制文件路径 + + + + + Dir Search + 目录搜索 + + + + Dir search. + 目录搜索。 + + + + Zeeker::FileContengSearchPlugin + + + Open + 打开 + + + + Open path + 打开文件所在路径 + + + + Copy Path + 复制文件路径 + + + + File Content Search + 文本内容搜索 + + + + File content search. + 文本内容搜索。 + + + + File content search + 文本内容搜索 + + + + Zeeker::FileSearchPlugin + + + Open + 打开 + + + + Open path + 打开文件所在路径 + + + + Copy Path + 复制文件路径 + + + + + File Search + + + + + File search. + 文件搜索。 + + + + Zeeker::SearchManager + + + Path: + 路径: + + + diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index 121582c..faec90e 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -4,98 +4,40 @@ QObject - + ukui-search is already running! - - Zeeker::ContentWidget - - - Recently Opened - - - - - Open Quickly - - - - - Commonly Used - - - - - Apps - - - - - Settings - - - - - Files - - - - - Dirs - - - - - File Contents - - - - - Best Matches - - - - - Web Pages - - - - - Unknown - - - Zeeker::CreateIndexAskDialog - + ukui-search - + Search - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes @@ -103,260 +45,212 @@ Zeeker::FolderListItem - + Delete the folder out of blacklist + + Zeeker::HomePage + + + Open Quickly + + + + + Recently Opened + + + + + Commonly Used + + + Zeeker::MainWindow - + ukui-search - + Global Search - + Search - - Zeeker::OptionView - - - Open - - - - - Add Shortcut to Desktop - - - - - Add Shortcut to Panel - - - - - Open path - - - - - Copy path - - - - - Install - - - Zeeker::SearchBarHLayout - + Search - - Zeeker::SearchDetailView - - - Introduction: %1 - - - - - Application - - - - - Document - - - - - Preview is not avaliable - - - - - Path - - - - - Last time modified - - - Zeeker::SettingsWidget - + ukui-search-settings - - - + + + 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 @@ -364,36 +258,16 @@ Zeeker::ShowMoreLabel - - - + + + Show More... - + Retract - - - Loading - - - - - Loading. - - - - - Loading.. - - - - - Loading... - - diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 2b68a36..cde87fc 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,90 +247,75 @@ Zeeker::ContentWidget - Recently Opened - Yeni Açılan + Yeni Açılan - Open Quickly - Hızlı Aç + Hızlı Aç - Commonly Used - Genel olarak kullanılan + Genel olarak kullanılan - Apps - Uygulamalar + Uygulamalar - Settings - Ayarlar + Ayarlar - Files - Dosyalar + Dosyalar - Dirs - Dizinler + Dizinler - File Contents - Dosya İçeriği + Dosya İçeriği - Best Matches - En İyi Eşleşen + En İyi Eşleşen - - Web Pages - - - - Unknown - Bilinmeyen + Bilinmeyen Zeeker::CreateIndexAskDialog - + ukui-search - + Search Ara - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes @@ -338,25 +323,43 @@ Zeeker::FolderListItem - + Delete the folder out of blacklist Klasörü kara listeden silin + + Zeeker::HomePage + + + Open Quickly + Hızlı Aç + + + + Recently Opened + Yeni Açılan + + + + Commonly Used + Genel olarak kullanılan + + Zeeker::MainWindow - + ukui-search - + Global Search Genel Arama - + Search Ara @@ -364,40 +367,30 @@ Zeeker::OptionView - Open - + - Add Shortcut to Desktop - Masaüstüne Kısayol Ekle + Masaüstüne Kısayol Ekle - Add Shortcut to Panel - Panele Kısayol Ekle + Panele Kısayol Ekle - Open path - Yolu aç + Yolu aç - Copy path - Yolu kopyala - - - - Install - + Yolu kopyala Zeeker::SearchBarHLayout - + Search Ara @@ -405,193 +398,179 @@ Zeeker::SearchDetailView - - Introduction: %1 - - - - Application - Uygulama + Uygulama - Document - Belge + Belge - - Preview is not avaliable - - - - Path - Yol + Yol - Last time modified - Son değiştirilme zamanı + Son değiştirilme zamanı Zeeker::SettingsWidget - + ukui-search-settings - - - + + + 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 @@ -599,36 +578,32 @@ Zeeker::ShowMoreLabel - - - + + + Show More... Daha Fazla Göster... - + Retract Geri çek - Loading - Yükleniyor + Yükleniyor - Loading. - Yükleniyor. + Yükleniyor. - Loading.. - Yükleniyor.. + Yükleniyor.. - Loading... - Yükleniyor... + Yükleniyor... diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 3b34cf8..afa7fe0 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,90 +12,79 @@ Zeeker::ContentWidget - Recently Opened - 最近 + 最近 - Open Quickly - 快速入口 + 快速入口 - Commonly Used - 常用 + 常用 - Apps - 应用 + 应用 - Settings - 配置项 + 配置项 - Files - 文件 + 文件 - Dirs - 文件夹 + 文件夹 - File Contents - 文件内容 + 文件内容 - Best Matches - 最佳匹配 + 最佳匹配 - Web Pages - 网页 + 网页 - Unknown - 未知 + 未知 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) @@ -103,25 +92,43 @@ Zeeker::FolderListItem - + Delete the folder out of blacklist 删除 + + Zeeker::HomePage + + + Open Quickly + 快速入口 + + + + Recently Opened + 最近 + + + + Commonly Used + 常用 + + Zeeker::MainWindow - + ukui-search 搜索 - + Global Search 搜索 - + Search 搜索 @@ -129,40 +136,34 @@ Zeeker::OptionView - Open - 打开 + 打开 - Add Shortcut to Desktop - 添加到桌面快捷方式 + 添加到桌面快捷方式 - Add Shortcut to Panel - 添加到任务栏快捷方式 + 添加到任务栏快捷方式 - Open path - 打开文件所在路径 + 打开文件所在路径 - Copy path - 复制文件路径 + 复制文件路径 - Install - 安装 + 安装 Zeeker::SearchBarHLayout - + Search 搜索 @@ -170,193 +171,187 @@ Zeeker::SearchDetailView - Introduction: %1 - 软件介绍: %1 + 软件介绍: %1 - Application - 应用 + 应用 - Document - 文件 + 文件 - Preview is not avaliable - 当前预览不可用 + 当前预览不可用 - Path - 路径 + 路径 - Last time modified - 上次修改时间 + 上次修改时间 Zeeker::SettingsWidget - + ukui-search-settings 搜索 - - - + + + 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 好的 @@ -364,36 +359,32 @@ Zeeker::ShowMoreLabel - - - + + + Show More... 显示更多... - + Retract 收起 - Loading - 加载中 + 加载中 - Loading. - 加载中. + 加载中. - Loading.. - 加载中.. + 加载中.. - Loading... - 加载中... + 加载中... diff --git a/ukui-search.pro b/ukui-search.pro index f23af01..5d9598b 100644 --- a/ukui-search.pro +++ b/ukui-search.pro @@ -17,9 +17,9 @@ DEFINES += QT_DEPRECATED_WARNINGS libsearch.depends += libchinese-segmentation src.depends = libsearch +frontend.depends = libsearch CONFIG += ordered \ - qt QT += widgets