From 7aadf794adbc46da320fdf36cedb296a20413686 Mon Sep 17 00:00:00 2001 From: zhangjiaping Date: Mon, 25 Jan 2021 11:37:34 +0800 Subject: [PATCH] fix(frontend): Adjust UI according to blueprint. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 根据设计稿调整UI Log: 根据设计稿调整UI --- src/content-widget.cpp | 42 +++++------- src/content-widget.h | 13 ++-- src/control/control.pri | 6 +- src/control/home-page-item.cpp | 37 +++++++++-- src/control/home-page-item.h | 2 + src/control/option-view.cpp | 100 +++++++++++++++++++++++------ src/control/search-detail-view.cpp | 17 +++++ src/control/search-detail-view.h | 3 + src/control/show-more-label.cpp | 14 ++-- src/control/show-more-label.h | 1 + src/control/title-label.cpp | 32 +++++++++ src/control/title-label.h | 16 +++++ src/input-box.cpp | 4 +- src/mainwindow.cpp | 12 ++-- src/settings-widget.cpp | 81 ++++++++++++----------- src/settings-widget.h | 4 +- translations/ukui-search/bo.ts | 73 +++++++++++---------- translations/ukui-search/tr.ts | 73 +++++++++++---------- translations/ukui-search/zh_CN.ts | 81 ++++++++++++----------- 19 files changed, 390 insertions(+), 221 deletions(-) create mode 100644 src/control/title-label.cpp create mode 100644 src/control/title-label.h diff --git a/src/content-widget.cpp b/src/content-widget.cpp index aaf2d91..35208f0 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -64,8 +64,8 @@ void ContentWidget::initUI() { }); m_resultDetailArea->setWidget(m_detailView); m_resultDetailArea->setWidgetResizable(true); - m_resultListArea->setStyleSheet("QScrollArea{background:transparent;}"); - m_resultDetailArea->setStyleSheet("QScrollArea{background: rgba(0,0,0,0.05); border-radius: 4px;}"); + m_resultListArea->setStyleSheet("QScrollArea{background: transparent;}"); + m_resultDetailArea->setStyleSheet("QScrollArea{background: transparent; border-radius: 4px;}"); this->addWidget(m_homePage); this->addWidget(m_resultPage); @@ -90,35 +90,17 @@ void ContentWidget::initListView() setupConnect(m_appListView); setupConnect(m_bestListView); - m_fileTitleLabel = new QLabel(m_resultList); - m_fileTitleLabel->setContentsMargins(8, 0, 0, 0); - m_fileTitleLabel->setFixedHeight(24); - m_fileTitleLabel->setStyleSheet("QLabel{background: rgba(0,0,0,0.1);}"); + m_fileTitleLabel = new TitleLabel(m_resultList); m_fileTitleLabel->setText(getTitleName(SearchItem::SearchType::Files)); - m_dirTitleLabel = new QLabel(m_resultList); - m_dirTitleLabel->setContentsMargins(8, 0, 0, 0); - m_dirTitleLabel->setFixedHeight(24); - m_dirTitleLabel->setStyleSheet("QLabel{background: rgba(0,0,0,0.1);}"); + m_dirTitleLabel = new TitleLabel(m_resultList); m_dirTitleLabel->setText(getTitleName(SearchItem::SearchType::Dirs)); - m_contentTitleLabel = new QLabel(m_resultList); - m_contentTitleLabel->setContentsMargins(8, 0, 0, 0); - m_contentTitleLabel->setFixedHeight(24); - m_contentTitleLabel->setStyleSheet("QLabel{background: rgba(0,0,0,0.1);}"); + m_contentTitleLabel = new TitleLabel(m_resultList); m_contentTitleLabel->setText(getTitleName(SearchItem::SearchType::Contents)); - m_appTitleLabel = new QLabel(m_resultList); - m_appTitleLabel->setContentsMargins(8, 0, 0, 0); - m_appTitleLabel->setFixedHeight(24); - m_appTitleLabel->setStyleSheet("QLabel{background: rgba(0,0,0,0.1);}"); + m_appTitleLabel = new TitleLabel(m_resultList); m_appTitleLabel->setText(getTitleName(SearchItem::SearchType::Apps)); - m_settingTitleLabel = new QLabel(m_resultList); - m_settingTitleLabel->setContentsMargins(8, 0, 0, 0); - m_settingTitleLabel->setFixedHeight(24); - m_settingTitleLabel->setStyleSheet("QLabel{background: rgba(0,0,0,0.1);}"); + m_settingTitleLabel = new TitleLabel(m_resultList); m_settingTitleLabel->setText(getTitleName(SearchItem::SearchType::Settings)); - m_bestTitleLabel = new QLabel(m_resultList); - m_bestTitleLabel->setContentsMargins(8, 0, 0, 0); - m_bestTitleLabel->setFixedHeight(24); - m_bestTitleLabel->setStyleSheet("QLabel{background: rgba(0,0,0,0.1);}"); + m_bestTitleLabel = new TitleLabel(m_resultList); m_bestTitleLabel->setText(getTitleName(SearchItem::SearchType::Best)); m_appShowMoreLabel = new ShowMoreLabel(m_resultList); @@ -329,6 +311,7 @@ void ContentWidget::initHomePage() { itemWidget->setLayout(layout); for (int j = 0; j < lists.at(i).count(); j++) { HomePageItem * item = new HomePageItem(itemWidget, i, lists.at(i).at(j)); + item->setFixedSize(265, 48); layout->addWidget(item, j / 2, j % 2); } } else { @@ -339,6 +322,7 @@ void ContentWidget::initHomePage() { itemWidget->setLayout(layout); Q_FOREACH(QString path, lists.at(i)){ HomePageItem * item = new HomePageItem(itemWidget, i, path); + item->setFixedSize(100, 100); layout->addWidget(item); } for (int j = 0; j < 5 - lists.at(i).length(); j++) { @@ -425,6 +409,12 @@ void ContentWidget::refreshSearchList(const QVector& lists) { m_detailView->clearLayout(); m_contentDetailList.clear(); + m_appShowMoreLabel->resetLabel(); + m_settingShowMoreLabel->resetLabel(); + m_dirShowMoreLabel->resetLabel(); + m_fileShowMoreLabel->resetLabel(); + m_contentShowMoreLabel->resetLabel(); + if (! m_appList.isEmpty()) m_appList.clear(); if (! m_settingList.isEmpty()) diff --git a/src/content-widget.h b/src/content-widget.h index fa4e049..5c68d41 100644 --- a/src/content-widget.h +++ b/src/content-widget.h @@ -8,6 +8,7 @@ #include "control/search-detail-view.h" #include "home-page-item.h" #include "show-more-label.h" +#include "title-label.h" class ContentWidget : public QStackedWidget { @@ -50,12 +51,12 @@ private: SearchListView * m_settingListView = nullptr; SearchListView * m_appListView = nullptr; SearchListView * m_bestListView = nullptr; - QLabel * m_fileTitleLabel = nullptr; - QLabel * m_dirTitleLabel = nullptr; - QLabel * m_contentTitleLabel = nullptr; - QLabel * m_appTitleLabel = nullptr; - QLabel * m_settingTitleLabel = nullptr; - QLabel * m_bestTitleLabel = nullptr; + TitleLabel * m_fileTitleLabel = nullptr; + TitleLabel * m_dirTitleLabel = nullptr; + TitleLabel * m_contentTitleLabel = nullptr; + TitleLabel * m_appTitleLabel = nullptr; + TitleLabel * m_settingTitleLabel = nullptr; + TitleLabel * m_bestTitleLabel = nullptr; ShowMoreLabel * m_appShowMoreLabel = nullptr; ShowMoreLabel * m_settingShowMoreLabel = nullptr; ShowMoreLabel * m_dirShowMoreLabel = nullptr; diff --git a/src/control/control.pri b/src/control/control.pri index d63444e..9d0f8be 100644 --- a/src/control/control.pri +++ b/src/control/control.pri @@ -8,7 +8,8 @@ HEADERS += \ $$PWD/search-detail-view.h \ $$PWD/option-view.h \ $$PWD/home-page-item.h \ - $$PWD/show-more-label.h + $$PWD/show-more-label.h \ + $$PWD/title-label.h SOURCES += \ $$PWD/config-file.cpp \ @@ -18,4 +19,5 @@ SOURCES += \ $$PWD/search-detail-view.cpp \ $$PWD/option-view.cpp \ $$PWD/home-page-item.cpp \ - $$PWD/show-more-label.cpp + $$PWD/show-more-label.cpp \ + $$PWD/title-label.cpp diff --git a/src/control/home-page-item.cpp b/src/control/home-page-item.cpp index 9d24974..f73306c 100644 --- a/src/control/home-page-item.cpp +++ b/src/control/home-page-item.cpp @@ -3,10 +3,12 @@ #include #include #include +#include HomePageItem::HomePageItem(QWidget *parent, const int& type, const QString& path) : QWidget(parent) { setupUi(type, path); + m_transparency = 0.06; } HomePageItem::~HomePageItem() @@ -21,7 +23,7 @@ HomePageItem::~HomePageItem() void HomePageItem::setupUi(const int& type, const QString& path) { m_widget = new QWidget(this); m_widget->setObjectName("MainWidget"); - m_widget->setStyleSheet("QWidget#MainWidget{background: rgba(0, 0, 0, 0.05); border-radius: 4px;}"); +// m_widget->setStyleSheet("QWidget#MainWidget{background: rgba(0, 0, 0, 0.05); border-radius: 4px;}"); m_widget->installEventFilter(this); connect(this, &HomePageItem::onItemClicked, this, [ = ]() { switch (SearchListView::getResType(path)) { @@ -129,14 +131,41 @@ void HomePageItem::setupUi(const int& type, const QString& path) { bool HomePageItem::eventFilter(QObject *watched, QEvent *event){ if (watched == m_widget){ if (event->type() == QEvent::MouseButtonPress) { - Q_EMIT this->onItemClicked(); - m_widget->setStyleSheet("QWidget#MainWidget{background: rgba(0, 0, 0, 0.1); border-radius: 4px;}"); + m_transparency = 0.06; + this->repaint(); return true; } else if (event->type() == QEvent::MouseButtonRelease) { - m_widget->setStyleSheet("QWidget#MainWidget{background: rgba(0, 0, 0, 0.05); border-radius: 4px;}"); + Q_EMIT this->onItemClicked(); + m_transparency = 0.06; + this->repaint(); + return true; + } else if (event->type() == QEvent::Enter) { + m_transparency = 0.15; + this->repaint(); + return true; + } else if (event->type() == QEvent::Leave) { + m_transparency = 0.06; + this->repaint(); return true; } } return QObject::eventFilter(watched, event); } + +void HomePageItem::paintEvent(QPaintEvent *event) { + Q_UNUSED(event) + + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + QRect rect = this->rect(); + p.setRenderHint(QPainter::Antialiasing); // 反锯齿; + p.setBrush(opt.palette.color(QPalette::Text)); + p.setOpacity(m_transparency); + p.setPen(Qt::NoPen); + p.drawRoundedRect(rect, 4, 4); + return QWidget::paintEvent(event); +} diff --git a/src/control/home-page-item.h b/src/control/home-page-item.h index 7f0d3e7..c595d0f 100644 --- a/src/control/home-page-item.h +++ b/src/control/home-page-item.h @@ -23,6 +23,7 @@ public: protected: bool eventFilter(QObject *, QEvent *); + void paintEvent(QPaintEvent *); private: void setupUi(const int&, const QString&); @@ -32,6 +33,7 @@ private: QVBoxLayout * m_vlayout = nullptr; QLabel * m_iconlabel = nullptr; QLabel * m_namelabel = nullptr; + double m_transparency = 0; Q_SIGNALS: void onItemClicked(); diff --git a/src/control/option-view.cpp b/src/control/option-view.cpp index 63c37f5..e53e4bf 100644 --- a/src/control/option-view.cpp +++ b/src/control/option-view.cpp @@ -73,35 +73,35 @@ void OptionView::initUI() m_openLabel = new QLabel(m_optionFrame); m_openLabel->setText(tr("Open")); //打开 - m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3D6BE5}"); + m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); m_openLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_openLabel->installEventFilter(this); m_optionLyt->addWidget(m_openLabel); m_shortcutLabel = new QLabel(m_optionFrame); m_shortcutLabel->setText(tr("Add Shortcut to Desktop")); //添加到桌面快捷方式 - m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3D6BE5}"); + m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); m_shortcutLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_shortcutLabel->installEventFilter(this); m_optionLyt->addWidget(m_shortcutLabel); m_panelLabel = new QLabel(m_optionFrame); m_panelLabel->setText(tr("Add Shortcut to Panel")); //添加到任务栏快捷方式 - m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3D6BE5}"); + m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); m_panelLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_panelLabel->installEventFilter(this); m_optionLyt->addWidget(m_panelLabel); m_openPathLabel = new QLabel(m_optionFrame); m_openPathLabel->setText(tr("Open path")); //打开所在路径 - m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3D6BE5}"); + m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); m_openPathLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_openPathLabel->installEventFilter(this); m_optionLyt->addWidget(m_openPathLabel); m_copyPathLabel = new QLabel(m_optionFrame); m_copyPathLabel->setText(tr("Copy path")); //复制所在路径 - m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3D6BE5}"); + m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); m_copyPathLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_copyPathLabel->installEventFilter(this); m_optionLyt->addWidget(m_copyPathLabel); @@ -193,21 +193,81 @@ void OptionView::setupSettingOptions() { * @return */ bool OptionView::eventFilter(QObject *watched, QEvent *event){ - if (m_openLabel && watched == m_openLabel && event->type() == QEvent::MouseButtonPress){ - Q_EMIT this->onOptionClicked(Options::Open); - return true; - } else if (m_shortcutLabel && watched == m_shortcutLabel && event->type() == QEvent::MouseButtonPress) { - Q_EMIT this->onOptionClicked(Options::Shortcut); - return true; - } else if (m_panelLabel && watched == m_panelLabel && event->type() == QEvent::MouseButtonPress) { - Q_EMIT this->onOptionClicked(Options::Panel); - return true; - } else if (m_openPathLabel && watched == m_openPathLabel && event->type() == QEvent::MouseButtonPress) { - Q_EMIT this->onOptionClicked(Options::OpenPath); - return true; - } else if (m_copyPathLabel && watched == m_copyPathLabel && event->type() == QEvent::MouseButtonPress) { - Q_EMIT this->onOptionClicked(Options::CopyPath); - return true; + if (m_openLabel && watched == m_openLabel){ + if (event->type() == QEvent::MouseButtonPress) { + m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + return true; + } else if (event->type() == QEvent::MouseButtonRelease) { + m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + Q_EMIT this->onOptionClicked(Options::Open); + return true; + } else if (event->type() == QEvent::Enter) { + m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + return true; + } else if (event->type() == QEvent::Leave) { + m_openLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + return true; + } + } else if (m_shortcutLabel && watched == m_shortcutLabel) { + if (event->type() == QEvent::MouseButtonPress) { + m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + return true; + } else if (event->type() == QEvent::MouseButtonRelease) { + m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + Q_EMIT this->onOptionClicked(Options::Shortcut); + return true; + } else if (event->type() == QEvent::Enter) { + m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + return true; + } else if (event->type() == QEvent::Leave) { + m_shortcutLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + return true; + } + } else if (m_panelLabel && watched == m_panelLabel) { + if (event->type() == QEvent::MouseButtonPress) { + m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + return true; + } else if (event->type() == QEvent::MouseButtonRelease) { + m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + Q_EMIT this->onOptionClicked(Options::Panel); + return true; + } else if (event->type() == QEvent::Enter) { + m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + return true; + } else if (event->type() == QEvent::Leave) { + m_panelLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + return true; + } + } else if (m_openPathLabel && watched == m_openPathLabel) { + if (event->type() == QEvent::MouseButtonPress) { + m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + return true; + } else if (event->type() == QEvent::MouseButtonRelease) { + m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + Q_EMIT this->onOptionClicked(Options::OpenPath); + return true; + } else if (event->type() == QEvent::Enter) { + m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + return true; + } else if (event->type() == QEvent::Leave) { + m_openPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + return true; + } + } else if (m_copyPathLabel && watched == m_copyPathLabel) { + if (event->type() == QEvent::MouseButtonPress) { + m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #296CD9;}"); + return true; + } else if (event->type() == QEvent::MouseButtonRelease) { + m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + Q_EMIT this->onOptionClicked(Options::CopyPath); + return true; + } else if (event->type() == QEvent::Enter) { + m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #40A9FB;}"); + return true; + } else if (event->type() == QEvent::Leave) { + m_copyPathLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); + return true; + } } return QObject::eventFilter(watched, event); } diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index 76b102e..017e0ee 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -432,3 +432,20 @@ bool SearchDetailView::copyPathAction(const QString& path) { clipboard->setText(path); return true; } + +void SearchDetailView::paintEvent(QPaintEvent *event) { + Q_UNUSED(event) + + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + QRect rect = this->rect(); + p.setRenderHint(QPainter::Antialiasing); // 反锯齿; + p.setBrush(opt.palette.color(QPalette::Text)); + p.setOpacity(0.06); + p.setPen(Qt::NoPen); + p.drawRoundedRect(rect, 4, 4); + return QWidget::paintEvent(event); +} diff --git a/src/control/search-detail-view.h b/src/control/search-detail-view.h index 9b853e6..7f45119 100644 --- a/src/control/search-detail-view.h +++ b/src/control/search-detail-view.h @@ -17,6 +17,9 @@ public: bool isEmpty(); int getType(); +protected: + void paintEvent(QPaintEvent *); + private: QVBoxLayout * m_layout = nullptr; QString m_contentText; diff --git a/src/control/show-more-label.cpp b/src/control/show-more-label.cpp index cf0ffa7..f1c58c2 100644 --- a/src/control/show-more-label.cpp +++ b/src/control/show-more-label.cpp @@ -14,19 +14,25 @@ ShowMoreLabel::~ShowMoreLabel() { } +void ShowMoreLabel::resetLabel() +{ + m_textLabel->setText(tr("Show More...")); +} + void ShowMoreLabel::initUi() { m_layout = new QHBoxLayout(this); m_layout->setContentsMargins(0,0,0,6); m_textLabel = new QLabel(this); - m_textLabel->setText(tr("Show More...")); + m_textLabel->setText(tr("Show More...")); m_textLabel->setCursor(QCursor(Qt::PointingHandCursor)); m_textLabel->installEventFilter(this); // m_loadingIconLabel = new QLabel(this); //使用图片显示加载状态时,取消此label的注释 // m_loadingIconLabel->setFixedSize(18, 18); // m_loadingIconLabel->hide(); - m_layout->setAlignment(Qt::AlignCenter); + m_layout->setAlignment(Qt::AlignRight); m_layout->addWidget(m_textLabel); + m_textLabel->setStyleSheet("QLabel{font-size: 14px; color: #3790FA}"); // m_layout->addWidget(m_loadingIconLabel); } @@ -46,9 +52,9 @@ void ShowMoreLabel::stopLoading() m_timer->stop(); } if (m_isOpen) { - m_textLabel->setText(tr("Retract")); + m_textLabel->setText(tr("Retract")); } else { - m_textLabel->setText(tr("Show More...")); + m_textLabel->setText(tr("Show More...")); } m_textLabel->setCursor(QCursor(Qt::PointingHandCursor)); } diff --git a/src/control/show-more-label.h b/src/control/show-more-label.h index 715c0e9..ff7c18b 100644 --- a/src/control/show-more-label.h +++ b/src/control/show-more-label.h @@ -12,6 +12,7 @@ class ShowMoreLabel : public QWidget public: explicit ShowMoreLabel(QWidget *parent = nullptr); ~ShowMoreLabel(); + void resetLabel(); protected: bool eventFilter(QObject *, QEvent *); diff --git a/src/control/title-label.cpp b/src/control/title-label.cpp new file mode 100644 index 0000000..acc04b0 --- /dev/null +++ b/src/control/title-label.cpp @@ -0,0 +1,32 @@ +#include "title-label.h" +#include +#include + +TitleLabel::TitleLabel(QWidget * parent) : QLabel(parent) +{ + this->setContentsMargins(8, 0, 0, 0); + this->setFixedHeight(24); +} + +TitleLabel::~TitleLabel() +{ + +} + +void TitleLabel::paintEvent(QPaintEvent * event) +{ + Q_UNUSED(event) + + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + + QRect rect = this->rect(); + p.setRenderHint(QPainter::Antialiasing); // 反锯齿; + p.setBrush(opt.palette.color(QPalette::Text)); + p.setOpacity(0.06); + p.setPen(Qt::NoPen); + p.drawRoundedRect(rect, 0, 0); + return QLabel::paintEvent(event); +} diff --git a/src/control/title-label.h b/src/control/title-label.h new file mode 100644 index 0000000..cdb8d41 --- /dev/null +++ b/src/control/title-label.h @@ -0,0 +1,16 @@ +#ifndef TITLELABEL_H +#define TITLELABEL_H + +#include + +class TitleLabel : public QLabel +{ +public: + TitleLabel(QWidget * parent = nullptr); + ~TitleLabel(); + +protected: + void paintEvent(QPaintEvent *); +}; + +#endif // TITLELABEL_H diff --git a/src/input-box.cpp b/src/input-box.cpp index f3c7e79..2e9184d 100644 --- a/src/input-box.cpp +++ b/src/input-box.cpp @@ -90,7 +90,7 @@ void SearchBarHLayout::initUI() m_queryWidget->setLayout(queryWidLayout); - QPixmap pixmap(QString(":/res/icons/edit-find-symbolic.svg")); + QPixmap pixmap(QIcon::fromTheme("system-search-symbolic").pixmap(QSize(20, 20))); m_queryIcon = new QLabel; m_queryIcon->setStyleSheet("background:transparent"); m_queryIcon->setFixedSize(pixmap.size()); @@ -99,7 +99,7 @@ void SearchBarHLayout::initUI() m_queryText = new QLabel; m_queryText->setText(tr("Search")); m_queryText->setStyleSheet("background:transparent;color:#626c6e;"); - m_queryText->setContentsMargins(0,0,0,4); +// m_queryText->setContentsMargins(0,0,0,4); m_queryText->adjustSize(); queryWidLayout->addWidget(m_queryIcon); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fac4544..64456c1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -157,16 +157,16 @@ void MainWindow::initUi() m_titleLyt = new QHBoxLayout(m_titleFrame); m_titleLyt->setContentsMargins(0, 0, 0, 0); m_iconLabel = new QLabel(m_titleFrame); - m_iconLabel->setFixedSize(20, 20); - m_iconLabel->setPixmap(QPixmap(":/res/icons/edit-find-symbolic.svg")); + m_iconLabel->setFixedSize(24, 24); + m_iconLabel->setPixmap(QIcon::fromTheme("kylin-search").pixmap(QSize(24, 24))); m_titleLabel = new QLabel(m_titleFrame); m_titleLabel->setText(tr("Search")); m_menuBtn = new QPushButton(m_titleFrame); m_menuBtn->setFixedSize(24, 24); // m_menuBtn->setIcon(QIcon(":/res/icons/commonuse.svg")); m_menuBtn->setIcon(QIcon::fromTheme("document-properties-symbolic")); - m_menuBtn->setStyleSheet("QPushButton{background: transparent;}" - "QPushButton:hover:!pressed{background: transparent;}"); + m_menuBtn->setProperty("useIconHighlightEffect", 0x08); + m_menuBtn->setFlat(true); connect(m_menuBtn, &QPushButton::clicked, this, [ = ]() { if (m_settingsWidget) { //当此窗口已存在时,仅需置顶 m_settingsWidget->showWidget(); @@ -282,6 +282,10 @@ void MainWindow::searchContent(QString searchcontent){ m_app_setting_lists.clear(); m_contentFrame->setKeyword(searchcontent); + m_search_result_file->clear(); + m_search_result_dir->clear(); + m_search_result_content->clear(); + AppMatch * appMatchor = new AppMatch(this); SettingsMatch * settingMatchor = new SettingsMatch(this); //应用与设置搜索 diff --git a/src/settings-widget.cpp b/src/settings-widget.cpp index ce75d5d..70e60ab 100644 --- a/src/settings-widget.cpp +++ b/src/settings-widget.cpp @@ -31,7 +31,7 @@ void SettingsWidget::initUi() { this->setMinimumHeight(460); this->setMaximumHeight(680); m_mainLyt = new QVBoxLayout(this); - m_mainLyt->setContentsMargins(24, 9, 24, 24); + m_mainLyt->setContentsMargins(24, 9, 16, 24); this->setLayout(m_mainLyt); this->setStyleSheet("QLabel{color: palette(text);}"); @@ -42,14 +42,18 @@ void SettingsWidget::initUi() { m_titleLyt->setContentsMargins(0, 0, 0, 0); m_titleFrame->setLayout(m_titleLyt); m_titleIcon = new QLabel(m_titleFrame); - m_titleIcon->setPixmap(QPixmap(":/res/icons/edit-find-symbolic.svg")); + 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->setStyleSheet("QPushButton{background: transparent;}" - "QPushButton:hover:!pressed{background: transparent;}"); +// m_closeBtn->setStyleSheet("QPushButton{background: transparent;}" +// "QPushButton:hover:!pressed{background: transparent;}"); + m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); + m_closeBtn->setProperty("isWindowButton", 0x02); + m_closeBtn->setProperty("useIconHighlightEffect", 0x08); + m_closeBtn->setFlat(true); connect(m_closeBtn, &QPushButton::clicked, this, [ = ]() { Q_EMIT this->settingWidgetClosed(); m_timer->stop(); @@ -77,7 +81,8 @@ void SettingsWidget::initUi() { m_indexNumLabel->setText(tr("...")); m_mainLyt->addWidget(m_indexTitleLabel); m_mainLyt->addWidget(m_indexStateLabel); - m_mainLyt->addWidget(m_indexNumLabel); +// m_mainLyt->addWidget(m_indexNumLabel); + m_indexNumLabel->hide(); //文件索引设置(黑名单) m_indexSettingLabel = new QLabel(this); @@ -151,23 +156,23 @@ void SettingsWidget::initUi() { m_mainLyt->addWidget(m_engineDescLabel); m_mainLyt->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_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_mainLyt->addStretch(); } @@ -285,23 +290,23 @@ void SettingsWidget::showWidget() this->show(); } -/** - * @brief SettingsWidget::onBtnConfirmClicked 点击确认按钮的槽函数 - */ -void SettingsWidget::onBtnConfirmClicked() { - Q_EMIT this->settingWidgetClosed(); - m_timer->stop(); - this->close(); -} +///** +// * @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::onBtnCancelClicked 点击取消按钮的槽函数 +// */ +//void SettingsWidget::onBtnCancelClicked() { +// Q_EMIT this->settingWidgetClosed(); +// m_timer->stop(); +// this->close(); +//} /** * @brief SettingsWidget::onBtnAddClicked 点击添加黑名单按钮的槽函数 diff --git a/src/settings-widget.h b/src/settings-widget.h index 6a7b5ef..0cfef85 100644 --- a/src/settings-widget.h +++ b/src/settings-widget.h @@ -78,8 +78,8 @@ Q_SIGNALS: void settingWidgetClosed(); private Q_SLOTS: - void onBtnConfirmClicked(); - void onBtnCancelClicked(); +// void onBtnConfirmClicked(); +// void onBtnCancelClicked(); void onBtnAddClicked(); void onBtnDelClicked(const QString&); }; diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index 561bf68..4eb2aeb 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -9,47 +9,47 @@ - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Unknown @@ -106,7 +106,7 @@ QObject - + ukui-search is already running! @@ -150,114 +150,113 @@ - + Settings - + Index State - - + + ... - + File Index Settings - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + Search Engine Settings - + Please select search engine you preferred. - + baidu - + sougou - + 360 - - + Cancel - - Confirm + + Parent folder has been blocked! - + Creating ... - + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: @@ -267,12 +266,12 @@ - <u>Show More...</u> + Show More... - <u>Retract</u> + Retract diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index 561bf68..4eb2aeb 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -9,47 +9,47 @@ - + Open Quickly - + Commonly Used - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Unknown @@ -106,7 +106,7 @@ QObject - + ukui-search is already running! @@ -150,114 +150,113 @@ - + Settings - + Index State - - + + ... - + File Index Settings - + Following folders will not be searched. You can set it by adding and removing folders. - + Add ignored folders - + Search Engine Settings - + Please select search engine you preferred. - + baidu - + sougou - + 360 - - + Cancel - - Confirm + + Parent folder has been blocked! - + Creating ... - + Done - + Index Entry: %1 - + Directories - + select blocked folder - + Select - + Position: - + FileName: - + FileType: @@ -267,12 +266,12 @@ - <u>Show More...</u> + Show More... - <u>Retract</u> + Retract diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index a5b9b9c..4bee14c 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -9,47 +9,47 @@ 最近 - + Open Quickly 快速 - + Commonly Used 常用 - + Apps 应用 - + Settings 配置项 - + Files 文件 - + Dirs 文件夹 - + File Contents 文件内容 - + Best Matches 最佳匹配 - + Unknown 未知 @@ -106,7 +106,7 @@ QObject - + ukui-search is already running! @@ -150,114 +150,117 @@ 搜索 - + Settings 配置项 - + Index State 索引状态 - - + + ... - + File Index Settings 文件索引设置 - + Following folders will not be searched. You can set it by adding and removing folders. 搜索将不再查看以下文件夹。通过增加和删除文件夹可进行文件索引设置。 - + Add ignored folders 添加禁止索引文件夹 - + Search Engine Settings 搜索引擎设置 - + Please select search engine you preferred. 设置互联网搜索引擎 - + baidu 百度 - + sougou 搜狗 - + 360 360 - - + Cancel 取消 - - Confirm - 确认 + + Parent folder has been blocked! + 12345 - + Confirm + 确认 + + + Creating ... 正在索引 - + Done 索引完成 - + Index Entry: %1 索引项: %1 - + Directories 文件夹 - + select blocked folder 选择屏蔽文件夹 - + Select 选择 - + Position: 位置: - + FileName: 名称: - + FileType: 类型: @@ -267,12 +270,12 @@ - <u>Show More...</u> - <u>显示更多...< + Show More... + 显示更多... - <u>Retract</u> + Retract <u>收起<