From 5608fd13ca1e69e1c1ccdd0916a1afe8e85f639d Mon Sep 17 00:00:00 2001 From: iaom Date: Fri, 1 Sep 2023 17:30:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=E5=B0=86=E9=80=9A=E8=BF=87QIcon?= =?UTF-8?q?=E5=92=8CXdgIcon=E8=8E=B7=E5=8F=96=E5=9B=BE=E6=A0=87=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=8A=A0=E9=94=81=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E8=B0=83=E7=94=A8=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/control/create-index-ask-dialog.cpp | 7 +- .../control/list-labels/show-more-label.cpp | 11 +- frontend/control/search-line-edit.cpp | 8 +- frontend/control/settings-widget.cpp | 594 ------------------ frontend/control/settings-widget.h | 154 ----- frontend/mainwindow.cpp | 3 +- frontend/ukui-search-gui.cpp | 3 +- libsearch/CMakeLists.txt | 1 + libsearch/appsearch/app-search-plugin.cpp | 3 +- libsearch/appsearch/app-search-plugin.h | 4 +- libsearch/file-utils.cpp | 71 +-- libsearch/file-utils.h | 3 - libsearch/icon-loader.cpp | 23 + libsearch/icon-loader.h | 19 + libsearch/index/file-search-plugin.h | 7 +- libsearch/notesearch/note-search-plugin.cpp | 15 +- libsearch/notesearch/note-search-plugin.h | 4 +- .../settingsearch/settings-search-plugin.h | 3 +- libsearch/websearch/web-search-plugin.cpp | 2 +- libsearch/websearch/web-search-plugin.h | 3 +- .../libukui-search/libukui-search_bo_CN.ts | 38 +- .../libukui-search/libukui-search_mn.ts | 38 +- .../libukui-search/libukui-search_zh_CN.ts | 38 +- .../ukui-search/appwidget/search_bo_CN.ts | 199 +----- .../ukui-search/appwidget/search_mn.ts | 199 +----- .../ukui-search/appwidget/search_zh_CN.ts | 134 ---- translations/ukui-search/bo_CN.ts | 129 ++-- translations/ukui-search/mn.ts | 129 ++-- translations/ukui-search/tr.ts | 151 ++--- translations/ukui-search/zh_CN.ts | 133 ++-- 30 files changed, 351 insertions(+), 1775 deletions(-) delete mode 100644 frontend/control/settings-widget.cpp delete mode 100644 frontend/control/settings-widget.h create mode 100644 libsearch/icon-loader.cpp create mode 100644 libsearch/icon-loader.h diff --git a/frontend/control/create-index-ask-dialog.cpp b/frontend/control/create-index-ask-dialog.cpp index f0f4e58..38dcca5 100644 --- a/frontend/control/create-index-ask-dialog.cpp +++ b/frontend/control/create-index-ask-dialog.cpp @@ -22,6 +22,7 @@ #include "create-index-ask-dialog.h" #include #include +#include "icon-loader.h" #define MAIN_SIZE QSize(380, 202) #define MAIN_SPACING 0 @@ -61,16 +62,16 @@ void CreateIndexAskDialog::initUi() { m_titleFrame->setLayout(m_titleLyt); m_iconLabel = new QLabel(m_titleFrame); m_iconLabel->setFixedSize(ICON_SIZE); - m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("kylin-search").pixmap(QSize(24, 24))); //主题改变时,更新自定义标题栏的图标 connect(qApp, &QApplication::paletteChanged, this, [ = ]() { - m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("kylin-search").pixmap(QSize(24, 24))); }); m_titleLabel = new QLabel(m_titleFrame); m_titleLabel->setText(tr("Search")); m_closeBtn = new QPushButton(m_titleFrame); m_closeBtn->setFixedSize(CLOSE_BTN_SIZE); - m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); + m_closeBtn->setIcon(IconLoader::loadIconQt("window-close-symbolic")); m_closeBtn->setProperty("isWindowButton", 0x02); m_closeBtn->setProperty("useIconHighlightEffect", 0x08); m_closeBtn->setFlat(true); diff --git a/frontend/control/list-labels/show-more-label.cpp b/frontend/control/list-labels/show-more-label.cpp index 491c56b..41fb861 100644 --- a/frontend/control/list-labels/show-more-label.cpp +++ b/frontend/control/list-labels/show-more-label.cpp @@ -19,6 +19,7 @@ * */ #include "show-more-label.h" +#include "icon-loader.h" #include #include #include @@ -30,13 +31,13 @@ ShowMoreLabel::ShowMoreLabel(QWidget *parent) : QWidget(parent) { void ShowMoreLabel::resetLabel() { m_isOpen = false; - m_iconLabel->setPixmap(QIcon::fromTheme("ukui-down-symbolic", QIcon(":/res/icons/ukui-down-symbolic.svg")).pixmap(QSize(16, 16))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("ukui-down-symbolic", QIcon(":/res/icons/ukui-down-symbolic.svg")).pixmap(QSize(16, 16))); } void ShowMoreLabel::setLabel() { m_isOpen = true; - m_iconLabel->setPixmap(QIcon::fromTheme("ukui-up-symbolic", QIcon(":/res/icons/ukui-up-symbolic.svg")).pixmap(QSize(16, 16))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("ukui-up-symbolic", QIcon(":/res/icons/ukui-up-symbolic.svg")).pixmap(QSize(16, 16))); } /** @@ -53,7 +54,7 @@ void ShowMoreLabel::initUi() { m_layout = new QHBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 6); m_iconLabel = new QLabel(this); - m_iconLabel->setPixmap(QIcon::fromTheme("ukui-down-symbolic", QIcon(":/res/icons/ukui-down-symbolic.svg")).pixmap(QSize(16, 16))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("ukui-down-symbolic", QIcon(":/res/icons/ukui-down-symbolic.svg")).pixmap(QSize(16, 16))); m_iconLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_iconLabel->installEventFilter(this); // m_loadingIconLabel = new QLabel(this); //使用图片显示加载状态时,取消此label的注释 @@ -73,11 +74,11 @@ bool ShowMoreLabel::eventFilter(QObject *watched, QEvent *event) { if(event->type() == QEvent::MouseButtonPress) { if(! m_timer->isActive()) { if(!m_isOpen) { - m_iconLabel->setPixmap(QIcon::fromTheme("ukui-up-symbolic", QIcon(":/res/icons/ukui-up-symbolic.svg")).pixmap(QSize(16, 16))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("ukui-up-symbolic", QIcon(":/res/icons/ukui-up-symbolic.svg")).pixmap(QSize(16, 16))); m_isOpen = true; Q_EMIT this->showMoreClicked(); } else { - m_iconLabel->setPixmap(QIcon::fromTheme("ukui-down-symbolic", QIcon(":/res/icons/ukui-down-symbolic.svg")).pixmap(QSize(16, 16))); + m_iconLabel->setPixmap(IconLoader::loadIconQt("ukui-down-symbolic", QIcon(":/res/icons/ukui-down-symbolic.svg")).pixmap(QSize(16, 16))); m_isOpen = false; Q_EMIT this->retractClicked(); } diff --git a/frontend/control/search-line-edit.cpp b/frontend/control/search-line-edit.cpp index 4d0f666..918eeb8 100644 --- a/frontend/control/search-line-edit.cpp +++ b/frontend/control/search-line-edit.cpp @@ -19,6 +19,7 @@ * */ #include "search-line-edit.h" +#include "icon-loader.h" #include #include #include @@ -39,12 +40,7 @@ SearchLineEdit::SearchLineEdit(QWidget *parent) : QLineEdit(parent) { this->setDragEnabled(true); m_queryIcon = new QLabel; - QPixmap pixmap; - if (!QIcon::fromTheme("system-search-symbolic").isNull()) { - pixmap = QPixmap(QIcon::fromTheme("system-search-symbolic").pixmap(QSize(18, 18))); - } else { - pixmap = QPixmap(QIcon(":/res/icons/system-search.symbolic.png").pixmap(QSize(18, 18))); - } + QPixmap pixmap = QPixmap(IconLoader::loadIconQt("system-search-symbolic", QIcon(":/res/icons/system-search.symbolic.png")).pixmap(QSize(18, 18))); m_queryIcon->setProperty("useIconHighlightEffect", 0x10); m_queryIcon->setFixedSize(pixmap.size() / pixmap.devicePixelRatio()); m_queryIcon->setPixmap(pixmap); diff --git a/frontend/control/settings-widget.cpp b/frontend/control/settings-widget.cpp deleted file mode 100644 index 39abded..0000000 --- a/frontend/control/settings-widget.cpp +++ /dev/null @@ -1,594 +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 "settings-widget.h" -#include -#include -#include -#include -#include -#include -#include "global-settings.h" -#include "file-utils.h" - -using namespace UkuiSearch; -extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); -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->setAttribute(Qt::WA_TranslucentBackground); - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) - 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); -#endif - - initUi(); - refreshIndexState(); - setupBlackList(GlobalSettings::getInstance()->getBlockDirs()); - resetWebEngine(); -} - -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); - m_mainLyt = new QVBoxLayout(this); - m_mainLyt->setContentsMargins(16, 8, 16, 24); - this->setLayout(m_mainLyt); - - //标题栏 - m_titleFrame = new QFrame(this); - m_titleFrame->setFixedHeight(40); - m_titleLyt = new QHBoxLayout(m_titleFrame); - m_titleLyt->setContentsMargins(0, 0, 0, 0); - m_titleFrame->setLayout(m_titleLyt); - m_titleIcon = new QLabel(m_titleFrame); - m_titleIcon->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24))); - //主题改变时,更新自定义标题栏的图标 - connect(qApp, &QApplication::paletteChanged, this, [ = ]() { - m_titleIcon->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24))); - }); - m_titleLabel = new QLabel(m_titleFrame); - m_titleLabel->setText(tr("Search")); - m_closeBtn = new QPushButton(m_titleFrame); - m_closeBtn->setFixedSize(24, 24); -// m_closeBtn->setIcon(QIcon(":/res/icons/close.svg")); - m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); - m_closeBtn->setProperty("isWindowButton", 0x02); - m_closeBtn->setProperty("useIconHighlightEffect", 0x08); - m_closeBtn->setFlat(true); - connect(m_closeBtn, &QPushButton::clicked, this, [ = ]() { - Q_EMIT this->settingWidgetClosed(); - m_timer->stop(); - this->close(); - }); - m_titleLyt->addWidget(m_titleIcon); - m_titleLyt->addWidget(m_titleLabel); - m_titleLyt->addStretch(); - m_titleLyt->addWidget(m_closeBtn); - m_mainLyt->addWidget(m_titleFrame); - - m_contentFrame = new QFrame(this); - m_contentLyt = new QVBoxLayout(m_contentFrame); - m_contentFrame->setLayout(m_contentLyt); - m_contentLyt->setContentsMargins(8, 0, 8, 0); - m_mainLyt->addWidget(m_contentFrame); - - //设置 - m_settingLabel = new QLabel(m_contentFrame); - m_settingLabel->setText(tr("

Settings

")); - m_contentLyt->addWidget(m_settingLabel); - - //文件索引 - m_indexTitleLabel = new QLabel(m_contentFrame); - m_indexTitleLabel->setText(tr("

Index State

")); - m_indexStateLabel = new QLabel(m_contentFrame); - m_indexStateLabel->setText(tr("...")); - m_indexNumLabel = new QLabel(m_contentFrame); - m_indexNumLabel->setText(tr("...")); - m_contentLyt->addWidget(m_indexTitleLabel); - m_contentLyt->addWidget(m_indexStateLabel); -// m_mainLyt->addWidget(m_indexNumLabel); - m_indexNumLabel->hide(); - - //文件索引设置(黑名单) - m_indexSettingLabel = new QLabel(m_contentFrame); - m_indexSettingLabel->setText(tr("

File Index Settings

")); - m_indexDescLabel = new QLabel(m_contentFrame); - m_indexDescLabel->setText(tr("Following folders will not be searched. You can set it by adding and removing folders.")); - m_indexDescLabel->setWordWrap(true); - m_indexBtnFrame = new QFrame(m_contentFrame); - m_indexBtnLyt = new QHBoxLayout(m_indexBtnFrame); - m_indexBtnLyt->setContentsMargins(0, 0, 0, 0); - m_indexBtnFrame->setLayout(m_indexBtnLyt); - m_addDirBtn = new QPushButton(m_indexBtnFrame); - m_addDirBtn->setFixedHeight(32); - m_addDirBtn->setMinimumWidth(164); - m_addDirBtn->setText(tr("Add ignored folders")); - connect(m_addDirBtn, &QPushButton::clicked, this, &SettingsWidget::onBtnAddClicked); - m_indexBtnLyt->addWidget(m_addDirBtn); - m_indexBtnLyt->addStretch(); - m_dirListArea = new QScrollArea(m_contentFrame); - m_dirListArea->setPalette(pal); - m_dirListArea->setFrameShape(QFrame::Shape::NoFrame); - m_dirListWidget = new QWidget(m_contentFrame); - m_dirListLyt = new QVBoxLayout(m_dirListWidget); - m_dirListLyt->setContentsMargins(0, 0, 0, 0); - m_dirListLyt->setSpacing(0); - m_dirListWidget->setLayout(m_dirListLyt); - m_dirListArea->setWidget(m_dirListWidget); - m_dirListArea->setWidgetResizable(m_contentFrame); - m_contentLyt->addWidget(m_indexSettingLabel); - m_contentLyt->addWidget(m_indexDescLabel); - m_contentLyt->addWidget(m_indexBtnFrame); - m_contentLyt->addWidget(m_dirListArea); - - //搜索引擎设置 - m_searchEngineLabel = new QLabel(m_contentFrame); - m_searchEngineLabel->setText(tr("

Search Engine Settings

")); - m_engineDescLabel = new QLabel(m_contentFrame); - m_engineDescLabel->setText(tr("Please select search engine you preferred.")); - m_engineDescLabel->setWordWrap(true); - m_engineBtnGroup = new QButtonGroup(m_contentFrame); - m_baiduBtn = new QRadioButton(m_contentFrame); - m_sougouBtn = new QRadioButton(m_contentFrame); - m_360Btn = new QRadioButton(m_contentFrame); - m_baiduBtn->setFixedSize(16, 16); - m_sougouBtn->setFixedSize(16, 16); - m_360Btn->setFixedSize(16, 16); - m_radioBtnFrame = new QFrame(m_contentFrame); - m_radioBtnLyt = new QHBoxLayout(m_radioBtnFrame); - m_radioBtnFrame->setLayout(m_radioBtnLyt); - m_baiduLabel = new QLabel(); - m_baiduLabel->setText(tr("baidu")); - m_sougouLabel = new QLabel(); - m_sougouLabel->setText(tr("sougou")); - m_360Label = new QLabel(); - m_360Label->setText(tr("360")); - m_radioBtnLyt->setContentsMargins(0, 0, 0, 0); - m_radioBtnLyt->addWidget(m_baiduBtn); - m_radioBtnLyt->addWidget(m_baiduLabel); - m_radioBtnLyt->addWidget(m_sougouBtn); - m_radioBtnLyt->addWidget(m_sougouLabel); - m_radioBtnLyt->addWidget(m_360Btn); - m_radioBtnLyt->addWidget(m_360Label); - m_radioBtnLyt->addStretch(); - m_engineBtnGroup->setExclusive(true); - m_engineBtnGroup->addButton(m_baiduBtn); - m_engineBtnGroup->addButton(m_sougouBtn); - m_engineBtnGroup->addButton(m_360Btn); -// m_engineBtnGroup->setId(m_baiduBtn, WebEngine::Baidu); -// m_engineBtnGroup->setId(m_sougouBtn, WebEngine::Sougou); -// m_engineBtnGroup->setId(m_360Btn, WebEngine::_360); -// connect(m_engineBtnGroup, QOverload::of(&QButtonGroup::buttonClicked), [ = ] (int id) { -// setWebEngine(id); -// }); - connect(m_baiduBtn, &QRadioButton::clicked, [ = ](bool checked) { - if(checked) setWebEngine("baidu"); - }); - connect(m_sougouBtn, &QRadioButton::clicked, [ = ](bool checked) { - if(checked) setWebEngine("sougou"); - }); - connect(m_360Btn, &QRadioButton::clicked, [ = ](bool checked) { - if(checked) setWebEngine("360"); - }); - - m_contentLyt->addWidget(m_searchEngineLabel); - m_contentLyt->addWidget(m_engineDescLabel); - m_contentLyt->addWidget(m_radioBtnFrame); - - //取消与确认按钮 (隐藏) -// m_bottomBtnFrame = new QFrame(this); -// m_bottomBtnLyt = new QHBoxLayout(m_bottomBtnFrame); -// m_bottomBtnFrame->setLayout(m_bottomBtnLyt); -// m_bottomBtnLyt->setSpacing(20); -// m_cancelBtn = new QPushButton(m_bottomBtnFrame); -// m_cancelBtn->setText(tr("Cancel")); -// m_cancelBtn->setFixedSize(80, 32); -// connect(m_cancelBtn, &QPushButton::clicked, this, &SettingsWidget::onBtnCancelClicked); -// m_confirmBtn = new QPushButton(m_bottomBtnFrame); -// m_confirmBtn->setText(tr("Confirm")); -// m_confirmBtn->setFixedSize(80, 32); -// connect(m_confirmBtn, &QPushButton::clicked, this, &SettingsWidget::onBtnConfirmClicked); -// m_bottomBtnLyt->addStretch(); -// m_bottomBtnLyt->addWidget(m_cancelBtn); -// m_bottomBtnLyt->addWidget(m_confirmBtn); -// 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 -} - -/** - * @brief SettingsWidget::setupBlackList 创建黑名单列表 - * @param list 文件夹路径列表 - */ -void SettingsWidget::setupBlackList(const QStringList& list) { - clearLayout(m_dirListLyt); - m_blockdirs = 0; - Q_FOREACH(QString path, list) { - FolderListItem * item = new FolderListItem(m_dirListWidget, path); - m_dirListLyt->addWidget(item); - item->setMaximumWidth(this->width() - 52); - connect(item, &FolderListItem::onDelBtnClicked, this, &SettingsWidget::onBtnDelClicked); - m_blockdirs ++; - } - this->resize(); - m_dirListWidget->setFixedWidth(this->width() - 68); -// m_dirListLyt->addStretch(); -} - -/** - * @brief SettingsWidget::clearLayout 清空某个布局 - * @param layout 需要清空的布局 - */ -void SettingsWidget::clearLayout(QLayout * layout) { - if(! layout) return; - QLayoutItem * child; - while((child = layout->takeAt(0)) != 0) { - if(child->widget()) { - child->widget()->setParent(NULL); - } - delete child; - } - child = NULL; -} - -/** - * @brief SettingsWidget::refreshIndexState 定时刷新索引项 - */ -void SettingsWidget::refreshIndexState() { -// qDebug()<<"FileUtils::indexStatus: "<setIndexState(true); - } else { - this->setIndexState(false); - } - m_indexNumLabel->setText(QString("%1/%2").arg(QString::number(SearchManager::getCurrentIndexCount())).arg(QString::number(FileUtils::maxIndexCount))); - m_timer = new QTimer; - connect(m_timer, &QTimer::timeout, this, [ = ]() { - qDebug() << "FileUtils::indexStatus: " << FileUtils::indexStatus; - if(FileUtils::indexStatus != 0) { - this->setIndexState(true); - } else { - this->setIndexState(false); - } - m_indexNumLabel->setText(QString("%1/%2").arg(QString::number(SearchManager::getCurrentIndexCount())).arg(QString::number(FileUtils::maxIndexCount))); - }); - m_timer->start(0.5 * 1000); -} - -/** - * @brief SettingsWidget::onBtnDelClicked 删除黑名单中的目录 - * @param path 文件夹路径 - */ -void SettingsWidget::onBtnDelClicked(const QString& path) { - QMessageBox message(QMessageBox::Question, tr("Search"), tr("Whether to delete this directory?")); - QPushButton * buttonYes = message.addButton(tr("Yes"), QMessageBox::YesRole); - message.addButton(tr("No"), QMessageBox::NoRole); - message.exec(); - if(message.clickedButton() != buttonYes) { - return; - } - - int returnCode = 0; - if(GlobalSettings::getInstance()->setBlockDirs(path, returnCode, true)) { - qDebug() << "Remove block dir in onBtnDelClicked() successed."; - Q_FOREACH(FolderListItem * item, m_dirListWidget->findChildren()) { - if(item->getPath() == path) { - item->deleteLater(); - item = NULL; - m_blockdirs --; - this->resize(); - return; - } - } - } else { - showWarningDialog(returnCode); - } -} - -/** - * @brief SettingsWidget::resetWebEngine 获取当前的搜索引擎并反映在UI控件上 - */ -void SettingsWidget::resetWebEngine() { - QString engine = GlobalSettings::getInstance()->getValue(WEB_ENGINE).toString(); - m_engineBtnGroup->blockSignals(true); - if(!engine.isEmpty()) { - if(engine == "360") { - m_360Btn->setChecked(true); - } else if(engine == "sougou") { - m_sougouBtn->setChecked(true); - } else { - m_baiduBtn->setChecked(true); - } - } else { - m_baiduBtn->setChecked(true); - } - m_engineBtnGroup->blockSignals(false); -} - -/** - * @brief SettingsWidget::setWebEngine - * @param engine 选择的搜索引擎 - */ -void SettingsWidget::setWebEngine(const QString& engine) { -// GlobalSettings::getInstance()->setValue(WEB_ENGINE, engine); - Q_EMIT this->webEngineChanged(engine); -} - -/** - * @brief setIndexState 设置当前索引状态 - * @param isCreatingIndex 是否正在创建索引 - */ -void SettingsWidget::setIndexState(bool isCreatingIndex) { - if(isCreatingIndex) { - m_indexStateLabel->setText(tr("Creating ...")); - return; - } - m_indexStateLabel->setText(tr("Done")); -} - -/** - * @brief SettingsWidget::setIndexNum 设置当前索引项数量 - * @param num 索引项数量 - */ -void SettingsWidget::setIndexNum(int num) { - m_indexNumLabel->setText(QString(tr("Index Entry: %1")).arg(QString::number(num))); -} - -/** - * @brief SettingsWidget::showWidget 显示此窗口 - */ -void SettingsWidget::showWidget() { - Qt::WindowFlags flags = this->windowFlags(); - flags |= Qt::WindowStaysOnTopHint; - this->setWindowFlags(flags); - flags &= ~Qt::WindowStaysOnTopHint; - this->setWindowFlags(flags); - m_timer->start(); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) - XAtomHelper::getInstance()->setWindowMotifHint(winId(), m_hints); -#endif - this->show(); -} - -///** -// * @brief SettingsWidget::onBtnConfirmClicked 点击确认按钮的槽函数 -// */ -//void SettingsWidget::onBtnConfirmClicked() { -// Q_EMIT this->settingWidgetClosed(); -// m_timer->stop(); -// this->close(); -//} - -///** -// * @brief SettingsWidget::onBtnCancelClicked 点击取消按钮的槽函数 -// */ -//void SettingsWidget::onBtnCancelClicked() { -// Q_EMIT this->settingWidgetClosed(); -// m_timer->stop(); -// this->close(); -//} - -/** - * @brief SettingsWidget::onBtnAddClicked 点击添加黑名单按钮的槽函数 - */ -void SettingsWidget::onBtnAddClicked() { - QFileDialog * fileDialog = new QFileDialog(this); -// fileDialog->setFileMode(QFileDialog::Directory); //允许查看文件和文件夹,但只允许选择文件夹 - fileDialog->setFileMode(QFileDialog::DirectoryOnly); //只允许查看文件夹 -// fileDialog->setViewMode(QFileDialog::Detail); - fileDialog->setDirectory(QDir::homePath()); - fileDialog->setNameFilter(tr("Directories")); - fileDialog->setWindowTitle(tr("select blocked folder")); - fileDialog->setLabelText(QFileDialog::Accept, tr("Select")); - fileDialog->setLabelText(QFileDialog::LookIn, tr("Position: ")); - fileDialog->setLabelText(QFileDialog::FileName, tr("FileName: ")); - fileDialog->setLabelText(QFileDialog::FileType, tr("FileType: ")); - fileDialog->setLabelText(QFileDialog::Reject, tr("Cancel")); - if(fileDialog->exec() != QDialog::Accepted) { - fileDialog->deleteLater(); - return; - } - QString selectedDir = 0; - int returnCode; - selectedDir = fileDialog->selectedFiles().first(); - qDebug() << "Selected a folder in onBtnAddClicked(): " << selectedDir << ". ->settings-widget.cpp #238"; - if(GlobalSettings::getInstance()->setBlockDirs(selectedDir, returnCode)) { - setupBlackList(GlobalSettings::getInstance()->getBlockDirs()); - qDebug() << "Add block dir in onBtnAddClicked() successed. ->settings-widget.cpp #238"; - } else { - showWarningDialog(returnCode); - } -} - -/** - * @brief SettingsWidget::paintEvent 绘制弹窗阴影 - * @param event - */ -void SettingsWidget::paintEvent(QPaintEvent *event) { - Q_UNUSED(event) - - QPainter p(this); - p.setRenderHint(QPainter::Antialiasing); - QPainterPath rectPath; - rectPath.addRect(this->rect()); - - // 绘制一个背景 - p.save(); - p.fillPath(rectPath, palette().color(QPalette::Base)); - p.restore(); -} - -/** - * @brief SettingsWidget::resize 重新计算窗口应有大小 - */ -void SettingsWidget::resize() { -// if (m_blockdirs <= 1) { -// this->setFixedSize(528, 455); -// } else if (m_blockdirs <= 3) { -// this->setFixedSize(528, 425 + 30 * m_blockdirs); -// } else { -// this->setFixedSize(528, 515); -// } - if(m_blockdirs <= 4) { - m_dirListArea->setFixedHeight(32 * m_blockdirs + 4); - m_dirListWidget->setFixedHeight(32 * m_blockdirs); - } else { - m_dirListWidget->setFixedHeight(32 * m_blockdirs); - m_dirListArea->setFixedHeight(32 * 4 + 4); - } - this->setFixedSize(528, 410 + m_dirListArea->height()); -} - -/** - * @brief SettingsWidget::showWarningDialog 显示警告弹窗 - * @param errorCode 错误码 - */ -void SettingsWidget::showWarningDialog(const int & errorCode) { - qWarning() << "Add block dir in onBtnAddClicked() failed. Code: " << errorCode << " ->settings-widget.cpp #238"; - QString errorMessage; - switch(errorCode) { - case 1: { - errorMessage = tr("Choosen path is Empty!"); - break; - } - case 2: { - errorMessage = tr("Choosen path is not in \"home\"!"); - break; - } - case 3: { - errorMessage = tr("Its' parent folder has been blocked!"); - break; - } - default: { - errorMessage = tr("Set blocked folder failed!"); - break; - } - } - QMessageBox message(QMessageBox::Warning, tr("Search"), errorMessage); - message.addButton(tr("OK"), QMessageBox::AcceptRole); - message.exec(); -} - - -FolderListItem::FolderListItem(QWidget *parent, const QString &path) : QWidget(parent) { - m_path = path; - initUi(); -} - -FolderListItem::~FolderListItem() { - -} - -/** - * @brief FolderListItem::initUi 构建ui - */ -void FolderListItem::initUi() { - m_layout = new QVBoxLayout(this); - m_layout->setSpacing(0); - m_layout->setContentsMargins(0, 0, 0, 0); - m_widget = new QWidget(this); - m_widget->setObjectName("mWidget"); - this->setFixedHeight(32); - m_layout->addWidget(m_widget); - m_widgetlayout = new QHBoxLayout(m_widget); - m_widgetlayout->setContentsMargins(8, 4, 8, 4); - m_widget->setLayout(m_widgetlayout); - - m_iconLabel = new QLabel(m_widget); - m_pathLabel = new QLabel(m_widget); - m_delLabel = new QLabel(m_widget); - 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")); - 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(); - m_widgetlayout->addWidget(m_iconLabel); - m_widgetlayout->addWidget(m_pathLabel); - m_widgetlayout->addStretch(); - m_widgetlayout->addWidget(m_delLabel); -} - -/** - * @brief FolderListItem::getPath 获取当前文件夹路径 - * @return - */ -QString FolderListItem::getPath() { - return m_path; -} - -/** - * @brief FolderListItem::enterEvent 鼠标移入事件 - * @param event - */ -void FolderListItem::enterEvent(QEvent *event) { - m_delLabel->show(); - m_widget->setStyleSheet("QWidget#mWidget{background: rgba(0,0,0,0.1);}"); - QWidget::enterEvent(event); -} - -/** - * @brief FolderListItem::leaveEvent 鼠标移出事件 - * @param event - */ -void FolderListItem::leaveEvent(QEvent *event) { - m_delLabel->hide(); - m_widget->setStyleSheet("QWidget#mWidget{background: transparent;}"); - QWidget::leaveEvent(event); -} - - -/** - * @brief FolderListItem::eventFilter 处理删除按钮点击事件 - * @param watched - * @param event - * @return - */ -bool FolderListItem::eventFilter(QObject *watched, QEvent *event) { - if(watched == m_delLabel) { - if(event->type() == QEvent::MouseButtonPress) { -// qDebug()<<"pressed!"; - Q_EMIT this->onDelBtnClicked(m_path); - } - } - return QObject::eventFilter(watched, event); -} diff --git a/frontend/control/settings-widget.h b/frontend/control/settings-widget.h deleted file mode 100644 index 185a8c1..0000000 --- a/frontend/control/settings-widget.h +++ /dev/null @@ -1,154 +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 SETTINGSWIDGET_H -#define SETTINGSWIDGET_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "libsearch.h" -#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) -#include "xatom-helper.h" -#endif - -namespace UkuiSearch { -class FolderListItem : public QWidget { - Q_OBJECT -public: - explicit FolderListItem(QWidget *parent = nullptr, const QString &path = 0); - ~FolderListItem(); - QString getPath(); - -protected: - virtual void enterEvent(QEvent *); - virtual void leaveEvent(QEvent *); - bool eventFilter(QObject *, QEvent *); - -private: - void initUi(); - - QString m_path; - - QVBoxLayout * m_layout = nullptr; - QWidget * m_widget = nullptr; - QHBoxLayout * m_widgetlayout = nullptr; - QLabel * m_iconLabel = nullptr; - QLabel * m_pathLabel = nullptr; - QLabel * m_delLabel = nullptr; -Q_SIGNALS: - void onDelBtnClicked(const QString&); -}; - -class SettingsWidget : public QWidget { - Q_OBJECT -public: - explicit SettingsWidget(QWidget *parent = nullptr); - ~SettingsWidget(); - - void setIndexState(bool); - void setIndexNum(int); - void showWidget(); - void resetWebEngine(); - -private: - void initUi(); - void setupBlackList(const QStringList &); - void clearLayout(QLayout *); - void refreshIndexState(); - void paintEvent(QPaintEvent *); - void resize(); - void showWarningDialog(const int&); - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) - MotifWmHints m_hints; -#endif - - //标题栏 - QVBoxLayout * m_mainLyt = nullptr; - QFrame * m_contentFrame = nullptr; - QVBoxLayout * m_contentLyt = nullptr; - QFrame * m_titleFrame = nullptr; - QHBoxLayout * m_titleLyt = nullptr; - QLabel * m_titleIcon = nullptr; - QLabel * m_titleLabel = nullptr; - QPushButton * m_closeBtn = nullptr; - - //设置 - QLabel * m_settingLabel = nullptr; - //文件索引 - QLabel * m_indexTitleLabel = nullptr; - QLabel * m_indexStateLabel = nullptr; - QLabel * m_indexNumLabel = nullptr; - //文件索引设置(黑名单) - QLabel * m_indexSettingLabel = nullptr; - QLabel * m_indexDescLabel = nullptr; - QFrame * m_indexBtnFrame = nullptr; - QHBoxLayout * m_indexBtnLyt = nullptr; - QPushButton * m_addDirBtn = nullptr; - QScrollArea * m_dirListArea = nullptr; - QWidget * m_dirListWidget = nullptr; - QVBoxLayout * m_dirListLyt = nullptr; - - //搜索引擎设置 - QLabel * m_searchEngineLabel = nullptr; - QLabel * m_engineDescLabel = nullptr; - QButtonGroup * m_engineBtnGroup = nullptr; - QFrame * m_radioBtnFrame = nullptr; - QHBoxLayout * m_radioBtnLyt = nullptr; - QRadioButton * m_baiduBtn = nullptr; - QLabel * m_baiduLabel = nullptr; - QRadioButton * m_sougouBtn = nullptr; - QLabel * m_sougouLabel = nullptr; - QRadioButton * m_360Btn = nullptr; - QLabel * m_360Label = nullptr; - - //取消与确认按钮 - QFrame * m_bottomBtnFrame = nullptr; - QHBoxLayout * m_bottomBtnLyt = nullptr; - QPushButton * m_cancelBtn = nullptr; - QPushButton * m_confirmBtn = nullptr; - - QTimer * m_timer; - - int m_blockdirs = 0; //黑名单文件夹数量 - -Q_SIGNALS: - void settingWidgetClosed(); - void webEngineChanged(const QString&); - -private Q_SLOTS: -// void onBtnConfirmClicked(); -// void onBtnCancelClicked(); - void onBtnAddClicked(); - void onBtnDelClicked(const QString&); - void setWebEngine(const QString&); -}; -} - -#endif // SETTINGSWIDGET_H diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp index b674884..83e2826 100644 --- a/frontend/mainwindow.cpp +++ b/frontend/mainwindow.cpp @@ -36,6 +36,7 @@ #include "windowmanager/windowmanager.h" #include "global-settings.h" #include "action-transmiter.h" +#include "icon-loader.h" #define MAIN_MARGINS 0, 0, 0, 0 #define TITLE_MARGINS 0,0,0,0 @@ -75,7 +76,7 @@ MainWindow::MainWindow(QWidget *parent) : initTimer(); m_sys_tray_icon = new QSystemTrayIcon(this); - m_sys_tray_icon->setIcon(QIcon::fromTheme("system-search-symbolic", QIcon(":/res/icons/edit-find-symbolic.svg"))); + m_sys_tray_icon->setIcon(IconLoader::loadIconQt("system-search-symbolic", QIcon(":/res/icons/edit-find-symbolic.svg"))); m_sys_tray_icon->setToolTip(tr("Global Search")); m_sys_tray_icon->show(); installEventFilter(this); diff --git a/frontend/ukui-search-gui.cpp b/frontend/ukui-search-gui.cpp index 9fab07b..4b6e747 100644 --- a/frontend/ukui-search-gui.cpp +++ b/frontend/ukui-search-gui.cpp @@ -25,6 +25,7 @@ #include #include "plugin-manager.h" #include "search-plugin-manager.h" +#include "icon-loader.h" using namespace UkuiSearch; UkuiSearchGui::UkuiSearchGui(int &argc, char *argv[], const QString &applicationName): QtSingleApplication (applicationName, argc, argv) @@ -73,7 +74,7 @@ UkuiSearchGui::UkuiSearchGui(int &argc, char *argv[], const QString &application m_mainWindow = new UkuiSearch::MainWindow(); m_dbusService = new UkuiSearch::UkuiSearchDbusServices(m_mainWindow); - qApp->setWindowIcon(QIcon::fromTheme("kylin-search")); + qApp->setWindowIcon(IconLoader::loadIconQt("kylin-search")); this->setActivationWindow(m_mainWindow); } diff --git a/libsearch/CMakeLists.txt b/libsearch/CMakeLists.txt index ccbfa2a..78f0d62 100644 --- a/libsearch/CMakeLists.txt +++ b/libsearch/CMakeLists.txt @@ -99,6 +99,7 @@ set(LIBUKUI_SEARCH_SRC searchinterface/ukui-search-task.cpp searchinterface/ukui-search-task.h settingsearch/settings-search-plugin.cpp settingsearch/settings-search-plugin.h websearch/web-search-plugin.cpp websearch/web-search-plugin.h + icon-loader.cpp icon-loader.h ) set(QRC_FILES resource1.qrc) file(GLOB TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../translations/libukui-search/*.ts) diff --git a/libsearch/appsearch/app-search-plugin.cpp b/libsearch/appsearch/app-search-plugin.cpp index 50a6063..b10ba5d 100644 --- a/libsearch/appsearch/app-search-plugin.cpp +++ b/libsearch/appsearch/app-search-plugin.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include "file-utils.h" using namespace UkuiSearch; @@ -191,7 +190,7 @@ void AppSearchPlugin::run() SearchPluginIface::ResultInfo ri; ri.name = data.value(SearchProperty::SearchResultProperty::ApplicationLocalName).toString(); - ri.icon = XdgIcon::fromTheme(data.value(SearchProperty::SearchResultProperty::ApplicationIconName).toString(), QIcon(":/res/icons/unknown.svg")); + ri.icon = IconLoader::loadIconQt(data.value(SearchProperty::SearchResultProperty::ApplicationIconName).toString(), QIcon(":/res/icons/unknown.svg")); SearchPluginIface::DescriptionInfo description; description.key = QString(tr("Application Description:")); description.value = data.value(SearchProperty::SearchResultProperty::ApplicationDescription).toString(); diff --git a/libsearch/appsearch/app-search-plugin.h b/libsearch/appsearch/app-search-plugin.h index 8c26ebc..3dcf047 100644 --- a/libsearch/appsearch/app-search-plugin.h +++ b/libsearch/appsearch/app-search-plugin.h @@ -35,6 +35,8 @@ #include "separation-line.h" #include "libsearch_global.h" #include "ukui-search-task.h" +#include "icon-loader.h" + namespace UkuiSearch { class LIBSEARCH_EXPORT AppSearchPlugin : public QThread, public SearchPluginIface { @@ -46,7 +48,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("appsearch");} + const QIcon icon() {return IconLoader::loadIconQt("appsearch");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 24f6dd9..e7c0d99 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -55,11 +55,11 @@ #include "gobject-template.h" #include "hanzi-to-pinyin.h" #include "common.h" +#include "icon-loader.h" using namespace UkuiSearch; #define MAX_CONTENT_LENGTH 20480000 -static QMutex iconMutex; /** * @brief 查找elem的子节点 * @param elem 起始节点 @@ -219,7 +219,6 @@ std::string FileUtils::makeDocUterm(QString path) { */ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) { Q_UNUSED(checkValid) - QMutexLocker locker(&iconMutex); auto file = wrapGFile(g_file_new_for_uri(uri.toUtf8().constData())); auto info = wrapGFileInfo(g_file_query_info(file.get()->get(), G_FILE_ATTRIBUTE_STANDARD_ICON, @@ -227,7 +226,8 @@ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) { nullptr, nullptr)); if(!G_IS_FILE_INFO(info.get()->get())) - return QIcon::fromTheme("unknown",QIcon(":/res/icons/unknown.svg")); + return IconLoader::loadIconQt("unknown",QIcon(":/res/icons/unknown.svg")); + GIcon *g_icon = g_file_info_get_icon(info.get()->get()); //do not unref the GIcon from info. @@ -236,7 +236,7 @@ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) { if(icon_names) { auto p = icon_names; while(*p) { - QIcon icon = QIcon::fromTheme(*p); + QIcon icon = IconLoader::loadIconQt(*p); if(!icon.isNull()) { return icon; } else { @@ -245,63 +245,12 @@ QIcon FileUtils::getFileIcon(const QString &uri, bool checkValid) { } } } - return QIcon::fromTheme("unknown",QIcon(":/res/icons/unknown.svg")); -} - -/** - * @brief FileUtils::getAppIcon 获取应用图标 - * @param path .desktop文件的完整路径 - * @return - */ -QIcon FileUtils::getAppIcon(const QString &path) { - QByteArray ba; - ba = path.toUtf8(); - GKeyFile * keyfile; - keyfile = g_key_file_new(); - if(!g_key_file_load_from_file(keyfile, ba.data(), G_KEY_FILE_NONE, NULL)) { - g_key_file_free(keyfile); - return QIcon::fromTheme("unknown",QIcon(":/res/icons/unknown.svg")); - } - QString icon = QString(g_key_file_get_locale_string(keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL, NULL)); - g_key_file_free(keyfile); - if(QIcon::fromTheme(icon).isNull()) { - return QIcon(":/res/icons/desktop.png"); - } - return QIcon::fromTheme(icon); -} - -/** - * @brief FileUtils::getSettingIcon 获取设置图标 - * @param setting 设置项传入参数,格式为 About/About->Properties - * @param is_white 选择是否返回白色图标 - * @return - */ -QIcon FileUtils::getSettingIcon(const QString &setting, const bool is_white) { - QString name = setting.left(setting.indexOf("/")); - if(! name.isEmpty()) { - name.replace(QString(name.at(0)), QString(name.at(0).toUpper())); - } - QString path; - if(is_white) { - path = QString("/usr/share/ukui-control-center/shell/res/secondaryleftmenu/%1White.svg").arg(name); - } else { - path = QString("/usr/share/ukui-control-center/shell/res/secondaryleftmenu/%1.svg").arg(name); - } - QFile file(path); - if(file.exists()) { - return QIcon(path); - } else { - return QIcon::fromTheme("ukui-control-center", QIcon(":/res/icons/ukui-control-center.svg")); //无插件图标时,返回控制面板应用图标 -// if (is_white) { -// return QIcon(QString("/usr/share/ukui-control-center/shell/res/secondaryleftmenu/%1White.svg").arg("About")); -// } else { -// return QIcon(QString("/usr/share/ukui-control-center/shell/res/secondaryleftmenu/%1.svg").arg("About")); -// } - } + return IconLoader::loadIconQt("unknown", QIcon(":/res/icons/unknown.svg")); } QIcon FileUtils::getSettingIcon() { - return QIcon::fromTheme("ukui-control-center", QIcon(":/res/icons/ukui-control-center.svg")); //返回控制面板应用图标 + return IconLoader::loadIconQt("ukui-control-center", QIcon(":/res/icons/ukui-control-center.svg")); //返回控制面板应用图标 +// 返回控制面板应用图标 } /** @@ -971,12 +920,6 @@ QString FileUtils::getSnippet(const std::string &myStr, uint start, const QStrin return snippet; } -QIcon FileUtils::iconFromTheme(const QString &name, const QIcon &iconDefault) -{ - QMutexLocker locker(&iconMutex); - return QIcon::fromTheme(name, iconDefault); -} - bool FileUtils::isOpenXMLFileEncrypted(const QString &path) { QFile file(path); diff --git a/libsearch/file-utils.h b/libsearch/file-utils.h index 64ea928..fdca51e 100644 --- a/libsearch/file-utils.h +++ b/libsearch/file-utils.h @@ -37,8 +37,6 @@ public: static qreal horizontalAdvanceContainsKeyword(const QString &content, const QString &keyword); static std::string makeDocUterm(QString path); static QIcon getFileIcon(const QString &uri, bool checkValid = true); - static QIcon getAppIcon(const QString &path); - static QIcon getSettingIcon(const QString &setting, const bool is_white); static QIcon getSettingIcon(); static QString getFileName(const QString &uri); @@ -64,7 +62,6 @@ public: static bool copyPath(QString &path); static QString escapeHtml(const QString &str); static QString getSnippet(const std::string &myStr, uint start, const QString &keyword); - static QIcon iconFromTheme(const QString &name, const QIcon &iconDefault); static bool isOpenXMLFileEncrypted(const QString &path); /** * @brief isEncrypedOrUnsupport diff --git a/libsearch/icon-loader.cpp b/libsearch/icon-loader.cpp new file mode 100644 index 0000000..2e0e8a4 --- /dev/null +++ b/libsearch/icon-loader.cpp @@ -0,0 +1,23 @@ +// +// Created by zpf on 2023/9/1. +// + +#include "icon-loader.h" +#include +#include +#include +namespace UkuiSearch { +static QMutex qtIconMutex; +static QMutex xdgIconMutex; +QIcon IconLoader::loadIconQt(const QString &name, const QIcon &fallback) +{ + QMutexLocker locker(&qtIconMutex); + return QIcon::fromTheme(name,fallback); +} + +QIcon IconLoader::loadIconXdg(const QString &name, const QIcon &fallback) +{ + QMutexLocker locker(&xdgIconMutex); + return XdgIcon::fromTheme("name",fallback); +} +} // UkuiSearch \ No newline at end of file diff --git a/libsearch/icon-loader.h b/libsearch/icon-loader.h new file mode 100644 index 0000000..d160196 --- /dev/null +++ b/libsearch/icon-loader.h @@ -0,0 +1,19 @@ +// +// Created by zpf on 2023/9/1. +// + +#ifndef UKUI_SEARCH_ICON_LOADER_H +#define UKUI_SEARCH_ICON_LOADER_H +#include +namespace UkuiSearch { + +class IconLoader +{ +public: + static QIcon loadIconQt(const QString &name, const QIcon &fallback = {}); + static QIcon loadIconXdg(const QString &name, const QIcon &fallback = {}); +}; + +} // UkuiSearch + +#endif //UKUI_SEARCH_ICON_LOADER_H diff --git a/libsearch/index/file-search-plugin.h b/libsearch/index/file-search-plugin.h index 1e2f8a4..888ae0a 100644 --- a/libsearch/index/file-search-plugin.h +++ b/libsearch/index/file-search-plugin.h @@ -34,6 +34,7 @@ #include "action-label.h" #include "separation-line.h" #include "global-settings.h" +#include "icon-loader.h" namespace UkuiSearch { //internal plugin @@ -45,7 +46,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("folder");} + const QIcon icon() {return IconLoader::loadIconQt("folder");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); @@ -100,7 +101,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("folder");} + const QIcon icon() {return IconLoader::loadIconQt("folder");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); @@ -155,7 +156,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("folder");} + const QIcon icon() {return IconLoader::loadIconQt("folder");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); diff --git a/libsearch/notesearch/note-search-plugin.cpp b/libsearch/notesearch/note-search-plugin.cpp index fb94552..edd310e 100644 --- a/libsearch/notesearch/note-search-plugin.cpp +++ b/libsearch/notesearch/note-search-plugin.cpp @@ -20,7 +20,6 @@ #include "note-search-plugin.h" #include #include -#include #include #include "file-utils.h" #include "chinese-segmentation.h" @@ -233,13 +232,13 @@ void NoteSearch::run() { dbusArgs.endArray(); qDebug() << str; SearchPluginIface::ResultInfo ri( - XdgIcon::fromTheme("kylin-notebook", QIcon(":/res/icons/desktop.png")), - str.at(1), - QVector() << SearchPluginIface::DescriptionInfo { - key : QString(tr("Note Description:")), - value : str.at(0) - }, - it.first + IconLoader::loadIconQt("kylin-notebook", QIcon(":/res/icons/desktop.png")), + str.at(1), + QVector() << SearchPluginIface::DescriptionInfo { + key : QString(tr("Note Description:")), + value : str.at(0) + }, + it.first ); if (m_uniqueSymbol ^ g_uniqueSymbol) { qDebug() << m_uniqueSymbol << g_uniqueSymbol; diff --git a/libsearch/notesearch/note-search-plugin.h b/libsearch/notesearch/note-search-plugin.h index 134056a..07e4881 100644 --- a/libsearch/notesearch/note-search-plugin.h +++ b/libsearch/notesearch/note-search-plugin.h @@ -36,6 +36,8 @@ #include "action-label.h" #include "separation-line.h" #include "libsearch_global.h" +#include "icon-loader.h" + namespace UkuiSearch { static size_t g_uniqueSymbol; @@ -52,7 +54,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("folder");} + const QIcon icon() {return IconLoader::loadIconQt("folder");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); diff --git a/libsearch/settingsearch/settings-search-plugin.h b/libsearch/settingsearch/settings-search-plugin.h index d0f9405..a4af278 100644 --- a/libsearch/settingsearch/settings-search-plugin.h +++ b/libsearch/settingsearch/settings-search-plugin.h @@ -15,6 +15,7 @@ #include "action-label.h" #include "separation-line.h" #include "search-plugin-iface.h" +#include "icon-loader.h" namespace UkuiSearch { class LIBSEARCH_EXPORT SettingsSearchPlugin : public QObject, public SearchPluginIface @@ -27,7 +28,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("folder");} + const QIcon icon() {return IconLoader::loadIconQt("folder");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); diff --git a/libsearch/websearch/web-search-plugin.cpp b/libsearch/websearch/web-search-plugin.cpp index 67bc92a..a2a78aa 100644 --- a/libsearch/websearch/web-search-plugin.cpp +++ b/libsearch/websearch/web-search-plugin.cpp @@ -56,7 +56,7 @@ void UkuiSearch::WebSearchPlugin::KeywordSearch(QString keyword, DataQueue #include +#include "icon-loader.h" namespace UkuiSearch { @@ -26,7 +27,7 @@ public: PluginType pluginType() {return PluginType::SearchPlugin;} const QString name(); const QString description(); - const QIcon icon() {return QIcon::fromTheme("folder");} + const QIcon icon() {return IconLoader::loadIconQt("folder");} void setEnable(bool enable) {m_enable = enable;} bool isEnable() {return m_enable;} QString getPluginName(); diff --git a/translations/libukui-search/libukui-search_bo_CN.ts b/translations/libukui-search/libukui-search_bo_CN.ts index 8d84dc0..4edf88e 100644 --- a/translations/libukui-search/libukui-search_bo_CN.ts +++ b/translations/libukui-search/libukui-search_bo_CN.ts @@ -24,42 +24,42 @@ UkuiSearch::AppSearchPlugin - - + + Open སྒོ་ཕྱེ་བ། - - + + Add Shortcut to Desktop ཅོག་ངོས་སུ་མྱུར་འཐེབ་སྣོན་པ། - - + + Add Shortcut to Panel ལས་འགན་གྱི་སྒྲོམ་ཐོག་མགྱོགས་མྱུར་གྱི་བྱེད་ཐབས་གསར་སྣོན་བྱ་དགོས - - + + Install སྒྲིག་སྦྱོར་བྱེད་པ - + Application Description: ཉེར་སྤྱོད་གོ་རིམ་གྱི་གསལ་བཤད། - - + + Applications Search ཉེར་སྤྱོད་གོ་རིམ་འཚོལ་བཤེར། - + Application ཉེར་སྤྱོད་བྱ་རིམ། @@ -313,7 +313,7 @@ UkuiSearch::NoteSearch - + Note Description: སྟབས་བདེ་བྱང་བུ།ནང་དོན། @@ -321,24 +321,24 @@ UkuiSearch::NoteSearchPlugin - - + + Open སྒོ་ཕྱེ་བ། - + Note Search. སྟབས་བདེ་བྱང་བུ།འཚོལ་ཞིབ་བྱེད་པ། - - + + Note Search སྟབས་བདེ་བྱང་བུ།འཚོལ་ཞིབ་བྱེད་པ། - + Application ཉེར་སྤྱོད་བྱ་རིམ། diff --git a/translations/libukui-search/libukui-search_mn.ts b/translations/libukui-search/libukui-search_mn.ts index de822c9..c256749 100644 --- a/translations/libukui-search/libukui-search_mn.ts +++ b/translations/libukui-search/libukui-search_mn.ts @@ -31,42 +31,42 @@ UkuiSearch::AppSearchPlugin - - + + Open ᠨᠡᠬᠡᠬᠡᠬᠦ᠌ - - + + Add Shortcut to Desktop ᠱᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ᠎ᠤᠨ ᠲᠦᠳᠡ ᠴᠦᠷᠬᠡ᠎ᠶᠢᠨ ᠠᠷᠭ᠎ᠠ᠎ᠳᠤ ᠨᠡᠮᠡᠬᠦ᠌ - - + + Add Shortcut to Panel ᠡᠬᠦᠷᠭᠡ᠎ᠶᠢᠨ ᠬᠡᠷᠡᠭᠰᠡᠬᠡ᠎ᠶᠢᠨ ᠲᠦᠲᠡ ᠴᠦᠷᠬᠡ᠎ᠳᠦ ᠨᠡᠮᠡᠬᠦ᠌ - - + + Install ᠤᠭᠰᠠᠷᠠᠬᠤ - - + + Applications Search ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡ - + Application ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡ - + Application Description: 应用描述: @@ -328,7 +328,7 @@ UkuiSearch::NoteSearch - + Note Description: 便签内容: ᠳᠦᠬᠦᠮ ᠱᠤᠱᠢᠭ᠎ᠠ᠎ᠶᠢᠨ ᠠᠭᠤᠯᠭ᠎ᠠ ᠄ @@ -337,27 +337,27 @@ UkuiSearch::NoteSearchPlugin - - + + Open 打开 ᠨᠡᠬᠡᠬᠡᠬᠦ᠌ - - + + Note Search 便签 ᠳᠦᠬᠦᠮ ᠱᠤᠱᠢᠭ᠎ᠠ - + Note Search. 便签. ᠳᠦᠬᠦᠮ ᠱᠤᠱᠢᠭ᠎ᠠ ᠄ - + Application 应用 ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡ diff --git a/translations/libukui-search/libukui-search_zh_CN.ts b/translations/libukui-search/libukui-search_zh_CN.ts index 62cc0c0..9d0e957 100644 --- a/translations/libukui-search/libukui-search_zh_CN.ts +++ b/translations/libukui-search/libukui-search_zh_CN.ts @@ -31,42 +31,42 @@ UkuiSearch::AppSearchPlugin - - + + Open 打开 - - + + Add Shortcut to Desktop 添加到桌面快捷方式 - - + + Add Shortcut to Panel 添加到任务栏快捷方式 - - + + Install 安装 - - + + Applications Search 应用 - + Application 应用 - + Application Description: 应用描述: @@ -328,7 +328,7 @@ UkuiSearch::NoteSearch - + Note Description: 便签内容: 便签内容: @@ -337,27 +337,27 @@ UkuiSearch::NoteSearchPlugin - - + + Open 打开 打开 - - + + Note Search 便签 便签 - + Note Search. 便签. 便签. - + Application 应用 应用 diff --git a/translations/ukui-search/appwidget/search_bo_CN.ts b/translations/ukui-search/appwidget/search_bo_CN.ts index b6a8cb1..52f9a29 100644 --- a/translations/ukui-search/appwidget/search_bo_CN.ts +++ b/translations/ukui-search/appwidget/search_bo_CN.ts @@ -12,53 +12,45 @@ UkuiSearch::CreateIndexAskDialog - + ukui-search - + Search - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes - - UkuiSearch::FolderListItem - - - Delete the folder out of blacklist - - - UkuiSearch::MainWindow - + ukui-search - + Global Search @@ -66,201 +58,40 @@ UkuiSearch::SearchLineEdit - + Search - - UkuiSearch::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 - - - UkuiSearch::UkuiSearchGui - + Quit ukui-search application - + Show main window - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/appwidget/search_mn.ts b/translations/ukui-search/appwidget/search_mn.ts index 43282b0..7763ed3 100644 --- a/translations/ukui-search/appwidget/search_mn.ts +++ b/translations/ukui-search/appwidget/search_mn.ts @@ -12,53 +12,45 @@ UkuiSearch::CreateIndexAskDialog - + ukui-search - + Search - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes - - UkuiSearch::FolderListItem - - - Delete the folder out of blacklist - - - UkuiSearch::MainWindow - + ukui-search - + Global Search @@ -66,201 +58,40 @@ UkuiSearch::SearchLineEdit - + Search - - UkuiSearch::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 - - - UkuiSearch::UkuiSearchGui - + Quit ukui-search application - + Show main window - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/appwidget/search_zh_CN.ts b/translations/ukui-search/appwidget/search_zh_CN.ts index 51226eb..f8a5697 100644 --- a/translations/ukui-search/appwidget/search_zh_CN.ts +++ b/translations/ukui-search/appwidget/search_zh_CN.ts @@ -35,13 +35,6 @@ - - UkuiSearch::FolderListItem - - Delete the folder out of blacklist - - - UkuiSearch::MainWindow @@ -60,133 +53,6 @@ - - UkuiSearch::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 - - - UkuiSearch::UkuiSearchGui diff --git a/translations/ukui-search/bo_CN.ts b/translations/ukui-search/bo_CN.ts index c07a672..ae8ea3e 100644 --- a/translations/ukui-search/bo_CN.ts +++ b/translations/ukui-search/bo_CN.ts @@ -12,32 +12,32 @@ UkuiSearch::CreateIndexAskDialog - + ukui-search འཚོལ་བཤེར། - + Search འཚོལ་ཞིབ། - + Creating index can help you getting results quickly, whether to create or not? དཀར་ཆག་གསར་བཟོ་བྱས་ཚེ་འཚོལ་བྱ་མྱུར་དུ་རྙེད་ཐུབ། གསར་བཟོ་བྱའམ། - + Don't remind ད་ནས་གསལ་བརྡ་མི་གཏོང་བ། - + No མིན། - + Yes རེད། @@ -45,20 +45,19 @@ UkuiSearch::FolderListItem - Delete the folder out of blacklist - མིང་ཐོ་ནག་པོའི་ནང་ནས་ཡིག་སྣོད་བསུབ་པ། + མིང་ཐོ་ནག་པོའི་ནང་ནས་ཡིག་སྣོད་བསུབ་པ། UkuiSearch::MainWindow - + ukui-search འཚོལ་བཤེར། - + Global Search འཚོལ་བཤེར། @@ -66,7 +65,7 @@ UkuiSearch::SearchLineEdit - + Search འཚོལ་ཞིབ། @@ -74,193 +73,159 @@ UkuiSearch::SettingsWidget - ukui-search-settings - འཚོལ་བཤེར། + འཚོལ་བཤེར། - - - Search - འཚོལ་ཞིབ། + འཚོལ་ཞིབ། - <h2>Settings</h2> - <h2> སྒྲིག་འགོད། </h2> + <h2> སྒྲིག་འགོད། </h2> - <h3>Index State</h3> - <h3>དཀར་ཆག་གི་རྣམ་པ།</h3> + <h3>དཀར་ཆག་གི་རྣམ་པ།</h3> - - ... - ... + ... - <h3>File Index Settings</h3> - <h3>ཡིག་ཆའི་དཀར་ཆག་སྒྲིག་འགོད། </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> + <h3>འཚོལ་བཤེར་ཆས་སྒྲིག་འགོད།</h3> - Please select search engine you preferred. - ཁྱེད་རང་གིས་དགའ་པོ་བྱེད་པའི་འཚོལ་བཤེར་མ་ལག་འདེམས་ + ཁྱེད་རང་གིས་དགའ་པོ་བྱེད་པའི་འཚོལ་བཤེར་མ་ལག་འདེམས་ - baidu - པའེ་ཏུའུ། + པའེ་ཏུའུ། - sougou - སོའོ་གོའུ། + སོའོ་གོའུ། - 360 - 360 + 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 - འགྲིགས། + འགྲིགས། UkuiSearch::UkuiSearchGui - + Quit ukui-search application ཉེར་སྤྱོད་གོ་རིམ་ལས་ཕྱིར་འཐེན་བྱ། - + Show main window སྒེའུ་ཁུང་གཙོ་བོ་མངོན་པ། - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/mn.ts b/translations/ukui-search/mn.ts index 1d407da..4edbbc3 100644 --- a/translations/ukui-search/mn.ts +++ b/translations/ukui-search/mn.ts @@ -12,32 +12,32 @@ UkuiSearch::CreateIndexAskDialog - + ukui-search ᠬᠠᠢᠯᠲᠠ - + Search ᠬᠠᠢᠯᠳᠠ - + Creating index can help you getting results quickly, whether to create or not? ᠬᠡᠯᠬᠢᠶᠡᠰᠦ ᠪᠠᠢᠭᠤᠯᠵᠤ ᠬᠠᠢᠯᠲᠠ᠎ᠶᠢᠨ ᠦᠷ᠎ᠡ ᠳ᠋ᠦᠩ᠎ᠢ ᠬᠤᠷᠳᠤᠨ ᠤᠯᠵᠤ ᠪᠤᠯᠤᠨ᠎ᠠ ᠂ ᠪᠠᠢᠭᠤᠯᠬᠤ ᠤᠤ? - + Don't remind ᠳᠠᠬᠢᠵᠤ ᠰᠠᠨᠠᠭᠤᠯᠬᠤ ᠦᠬᠡᠢ - + No ᠦᠭᠡᠢ - + Yes ᠪᠣᠯᠣᠨ᠎ᠠ @@ -45,20 +45,19 @@ UkuiSearch::FolderListItem - Delete the folder out of blacklist - ᠬᠠᠰᠤᠬᠤ + ᠬᠠᠰᠤᠬᠤ UkuiSearch::MainWindow - + ukui-search ᠬᠠᠢᠯᠲᠠ - + Global Search ᠬᠠᠢᠯᠲᠠ @@ -66,7 +65,7 @@ UkuiSearch::SearchLineEdit - + Search ᠬᠠᠢᠯᠳᠠ @@ -74,193 +73,159 @@ UkuiSearch::SettingsWidget - ukui-search-settings - ᠬᠠᠢᠯᠲᠠ + ᠬᠠᠢᠯᠲᠠ - - - Search - ᠬᠠᠢᠯᠲᠠ + ᠬᠠᠢᠯᠲᠠ - <h2>Settings</h2> - <h2> ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ</h2> + <h2> ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ</h2> - <h3>Index State</h3> - <h3> ᠬᠡᠯᠬᠢᠶᠡᠰᠦ᠎ᠶᠢᠨ ᠪᠠᠢᠳᠠᠯ</h3> + <h3> ᠬᠡᠯᠬᠢᠶᠡᠰᠦ᠎ᠶᠢᠨ ᠪᠠᠢᠳᠠᠯ</h3> - - ... - ... + ... - <h3>File Index Settings</h3> - <h3> ᠹᠠᠢᠯ᠎ᠤᠨ ᠬᠡᠯᠬᠢᠶᠡᠰᠦ᠎ᠶᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ</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> + <h3>ᠡᠷᠢᠯᠲᠡ ᠬᠦᠳᠡᠯᠬᠡᠬᠦᠷ᠎ᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ</h3> - Please select search engine you preferred. - ᠢᠨᠲᠸᠷᠨ᠋ᠸᠲ᠎ᠦᠨ ᠡᠷᠢᠯᠳᠡ ᠬᠦᠳᠡᠯᠬᠡᠬᠦᠷ᠎ᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + ᠢᠨᠲᠸᠷᠨ᠋ᠸᠲ᠎ᠦᠨ ᠡᠷᠢᠯᠳᠡ ᠬᠦᠳᠡᠯᠬᠡᠬᠦᠷ᠎ᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ - baidu - ᠪᠠᠢ ᠳ᠋ᠦ᠋ + ᠪᠠᠢ ᠳ᠋ᠦ᠋ - sougou - ᠰᠸᠤ ᠭᠸᠦ + ᠰᠸᠤ ᠭᠸᠦ - 360 - 360 + 360 - Whether to delete this directory? - ᠲᠤᠰ ᠭᠠᠷᠴᠠᠭ᠎ᠢ ᠬᠠᠰᠤᠬᠤ ᠤᠤ? + ᠲᠤᠰ ᠭᠠᠷᠴᠠᠭ᠎ᠢ ᠬᠠᠰᠤᠬᠤ ᠤᠤ? - Yes - Yes + Yes - No - No + No - Creating ... - ᠶᠠᠭ ᠬᠡᠯᠬᠢᠶᠡᠰᠦᠯᠡᠵᠤ ᠪᠠᠢᠨ᠎ᠠ ... + ᠶᠠᠭ ᠬᠡᠯᠬᠢᠶᠡᠰᠦᠯᠡᠵᠤ ᠪᠠᠢᠨ᠎ᠠ ... - Done - ᠬᠡᠯᠬᠢᠶᠡᠰᠦᠯᠡᠵᠤ ᠳᠠᠭᠤᠰᠪᠠ + ᠬᠡᠯᠬᠢᠶᠡᠰᠦᠯᠡᠵᠤ ᠳᠠᠭᠤᠰᠪᠠ - Index Entry: %1 - ᠬᠡᠯᠬᠢᠶᠡᠰᠦ᠎ᠶᠢᠨ ᠵᠦᠢᠯ ᠄%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 - OK + OK UkuiSearch::UkuiSearchGui - + Quit ukui-search application ᠬᠠᠢᠯᠲᠠ᠎ᠶᠢᠨ ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡ᠎ᠡᠴᠡ ᠪᠤᠴᠠᠵᠤ ᠭᠠᠷᠬᠤ - + Show main window ᠭᠤᠤᠯ ᠨᠢᠭᠤᠷ ᠬᠠᠭᠤᠳᠠᠰᠤ᠎ᠶᠢ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ᠌ - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 57a1cc4..0c481c1 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -297,32 +297,32 @@ UkuiSearch::CreateIndexAskDialog - + ukui-search - + Search Ara - + Creating index can help you getting results quickly, whether to create or not? - + Don't remind - + No - + Yes @@ -330,9 +330,8 @@ UkuiSearch::FolderListItem - Delete the folder out of blacklist - Klasörü kara listeden silin + Klasörü kara listeden silin @@ -353,12 +352,12 @@ UkuiSearch::MainWindow - + ukui-search - + Global Search Genel Arama @@ -419,7 +418,7 @@ UkuiSearch::SearchLineEdit - + Search Ara @@ -427,162 +426,84 @@ UkuiSearch::SettingsWidget - - ukui-search-settings - - - - - - Search - Ara + Ara - <h2>Settings</h2> - <h2>Ayarlar</h2> + <h2>Ayarlar</h2> - <h3>Index State</h3> - <h3>Dizin Durumu</h3> + <h3>Dizin Durumu</h3> - - ... - ... + ... - <h3>File Index Settings</h3> - <h3>Dosya Dizini Ayarları</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. + Aşağıdaki klasörler aranmayacaktır. Klasör ekleyip kaldırarak ayarlayabilirsiniz. - Add ignored folders - Göz ardı edilen klasörleri ekleyin + Göz ardı edilen klasörleri ekleyin - <h3>Search Engine Settings</h3> - <h3>SArama Motoru Ayarları</h3> + <h3>SArama Motoru Ayarları</h3> - Please select search engine you preferred. - Lütfen tercih ettiğiniz arama motorunu seçin. + Lütfen tercih ettiğiniz arama motorunu seçin. - - baidu - - - - - sougou - - - - - 360 - - - - Whether to delete this directory? - Bu dizini silinsin mi? + Bu dizini silinsin mi? - - Yes - - - - - No - - - - Creating ... - Oluşturuluyor... + Oluşturuluyor... - Done - Tamam + Tamam - Index Entry: %1 - Dizin Girişi: %1 + Dizin Girişi: %1 - Directories - Dizinler + Dizinler - select blocked folder - engellenen klasörü seç + engellenen klasörü seç - Select - Seç + Seç - Position: - Pozisyon: + Pozisyon: - FileName: - Dosya Adı: + Dosya Adı: - FileType: - Dosya Türü: + 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 - + İptal @@ -615,32 +536,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application - + Show main window - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index> diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index ec5f96c..8e3773f 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -59,32 +59,32 @@ UkuiSearch::CreateIndexAskDialog - + ukui-search 搜索 - + Search 搜索 - + Creating index can help you getting results quickly, whether to create or not? 创建索引可以快速获取搜索结果,是否创建? - + Don't remind 不再提醒 - + No 否(N) - + Yes 是(Y) @@ -92,9 +92,8 @@ UkuiSearch::FolderListItem - Delete the folder out of blacklist - 删除 + 删除 @@ -115,12 +114,12 @@ UkuiSearch::MainWindow - + ukui-search 搜索 - + Global Search 搜索 @@ -193,7 +192,7 @@ UkuiSearch::SearchLineEdit - + Search 搜索 @@ -201,162 +200,120 @@ UkuiSearch::SettingsWidget - ukui-search-settings - 搜索 + 搜索 - - - Search - 搜索 + 搜索 - <h2>Settings</h2> - <h2>设置</h2> + <h2>设置</h2> - <h3>Index State</h3> - <h3>索引状态</h3> + <h3>索引状态</h3> - - - ... - - - - <h3>File Index Settings</h3> - <h3>文件索引设置</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> + <h3>搜索引擎设置</h3> - Please select search engine you preferred. - 设置互联网搜索引擎 + 设置互联网搜索引擎 - baidu - 百度 + 百度 - sougou - 搜狗 + 搜狗 - 360 - 360 + 360 - Whether to delete this directory? - 是否要删除此目录? + 是否要删除此目录? - Yes - 是(Y) + 是(Y) - No - 否(N) + 否(N) - Creating ... - 正在索引... + 正在索引... - Done - 索引完成 + 索引完成 - Index Entry: %1 - 索引项: %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 - 好的 + 好的 @@ -389,32 +346,32 @@ UkuiSearch::UkuiSearchGui - + Quit ukui-search application 退出搜索应用 - + Show main window 显示主页面 - + unregister a plugin with <pluginName> - + register a plugin with <pluginName> - + move <pluginName> to the target pos - + move plugin to <index>