From ee1af87ccd6616f1cd57148986760144240dd782 Mon Sep 17 00:00:00 2001 From: JunjieBai Date: Mon, 30 Oct 2023 16:10:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(app-search-plugin):=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E5=BA=94=E7=94=A8=E5=8F=B3=E4=BE=A7=E8=A2=AB?= =?UTF-8?q?=E9=81=AE=E6=8C=A1=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=9C=A8=E7=BA=BF=E5=BA=94=E7=94=A8=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E7=95=8C=E9=9D=A2ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/appsearch/app-search-plugin.cpp | 15 ++++++--------- libsearch/appsearch/app-search-plugin.h | 2 -- libsearch/file-utils.cpp | 2 +- .../libukui-search/libukui-search_bo_CN.ts | 10 +++++----- translations/libukui-search/libukui-search_mn.ts | 10 +++++----- .../libukui-search/libukui-search_zh_CN.ts | 10 +++++----- .../libukui-search/libukui-search_zh_HK.ts | 10 +++++----- 7 files changed, 27 insertions(+), 32 deletions(-) diff --git a/libsearch/appsearch/app-search-plugin.cpp b/libsearch/appsearch/app-search-plugin.cpp index 3a0e907..3adf827 100644 --- a/libsearch/appsearch/app-search-plugin.cpp +++ b/libsearch/appsearch/app-search-plugin.cpp @@ -159,11 +159,11 @@ QWidget *AppSearchPlugin::detailPage(const ResultInfo &ri) // QString showDesc = fontMetrics.elidedText(ri.description.at(0).key + " " + ri.description.at(0).value, Qt::ElideRight, 3114); //当字体长度超过215时显示为省略号 QString showDesc = FileUtils::getSnippetWithoutKeyword(ri.description.at(0).key + " " + ri.description.at(0).value, 10); m_descLabel->setText(FileUtils::escapeHtml(showDesc)); - m_descFrame->show(); + m_descLabel->show(); m_line_2->show(); } else { - m_descFrame->hide(); + m_descLabel->hide(); m_line_2->hide(); m_actionLabel1->show(); m_actionLabel2->show(); @@ -232,14 +232,11 @@ void AppSearchPlugin::initDetailPage() m_nameFrameLyt->addWidget(m_pluginLabel); m_line_1 = new SeparationLine(m_detailPage); - m_descFrame = new QFrame(m_detailPage); - m_descFrameLyt = new QVBoxLayout(m_descFrame); - m_descLabel = new QLabel(m_descFrame); + + m_descLabel = new QLabel(m_detailPage); m_descLabel->setTextFormat(Qt::PlainText); + m_descLabel->setContentsMargins(8, 0, 8, 0); // m_descLabel->setWordWrap(true); - m_descFrameLyt->addWidget(m_descLabel); - m_descFrame->setLayout(m_descFrameLyt); - m_descFrameLyt->setContentsMargins(8, 0, 0, 0); m_line_2 = new SeparationLine(m_detailPage); m_actionFrame = new QFrame(m_detailPage); @@ -260,7 +257,7 @@ void AppSearchPlugin::initDetailPage() m_detailLyt->addWidget(m_iconLabel); m_detailLyt->addWidget(m_nameFrame); m_detailLyt->addWidget(m_line_1); - m_detailLyt->addWidget(m_descFrame); + m_detailLyt->addWidget(m_descLabel); m_detailLyt->addWidget(m_line_2); m_detailLyt->addWidget(m_actionFrame); m_detailPage->setLayout(m_detailLyt); diff --git a/libsearch/appsearch/app-search-plugin.h b/libsearch/appsearch/app-search-plugin.h index 3dcf047..114f323 100644 --- a/libsearch/appsearch/app-search-plugin.h +++ b/libsearch/appsearch/app-search-plugin.h @@ -84,9 +84,7 @@ private: QLabel *m_nameLabel = nullptr; QLabel *m_pluginLabel = nullptr; SeparationLine *m_line_1 = nullptr; - QFrame *m_descFrame = nullptr; QLabel *m_descLabel = nullptr; - QVBoxLayout *m_descFrameLyt = nullptr; SeparationLine *m_line_2 = nullptr; QFrame *m_actionFrame = nullptr; QVBoxLayout *m_actionFrameLyt = nullptr; diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 00f2a2e..608fe10 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -1390,7 +1390,7 @@ QString FileUtils::getSnippetWithoutKeyword(const QString &content, int lineCoun } QString word = content.mid(boundaryStart, boundaryEnd - boundaryStart); wordCount += boundaryEnd - boundaryStart; - length = fontMetricsF.horizontalAdvance(content.mid(boundaryStart - wordCount, wordCount)); + length = fontMetricsF.horizontalAdvance(content.mid(boundaryEnd - wordCount, wordCount)); if (length >= LABEL_MAX_WIDTH || word == "\n") { if (word == "\n") { diff --git a/translations/libukui-search/libukui-search_bo_CN.ts b/translations/libukui-search/libukui-search_bo_CN.ts index 4edf88e..e98bf1e 100644 --- a/translations/libukui-search/libukui-search_bo_CN.ts +++ b/translations/libukui-search/libukui-search_bo_CN.ts @@ -25,30 +25,30 @@ UkuiSearch::AppSearchPlugin - + Open སྒོ་ཕྱེ་བ། - + Add Shortcut to Desktop ཅོག་ངོས་སུ་མྱུར་འཐེབ་སྣོན་པ། - + Add Shortcut to Panel ལས་འགན་གྱི་སྒྲོམ་ཐོག་མགྱོགས་མྱུར་གྱི་བྱེད་ཐབས་གསར་སྣོན་བྱ་དགོས - + Install སྒྲིག་སྦྱོར་བྱེད་པ - + Application Description: ཉེར་སྤྱོད་གོ་རིམ་གྱི་གསལ་བཤད། diff --git a/translations/libukui-search/libukui-search_mn.ts b/translations/libukui-search/libukui-search_mn.ts index c256749..3e64b9a 100644 --- a/translations/libukui-search/libukui-search_mn.ts +++ b/translations/libukui-search/libukui-search_mn.ts @@ -32,25 +32,25 @@ UkuiSearch::AppSearchPlugin - + Open ᠨᠡᠬᠡᠬᠡᠬᠦ᠌ - + Add Shortcut to Desktop ᠱᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ᠎ᠤᠨ ᠲᠦᠳᠡ ᠴᠦᠷᠬᠡ᠎ᠶᠢᠨ ᠠᠷᠭ᠎ᠠ᠎ᠳᠤ ᠨᠡᠮᠡᠬᠦ᠌ - + Add Shortcut to Panel ᠡᠬᠦᠷᠭᠡ᠎ᠶᠢᠨ ᠬᠡᠷᠡᠭᠰᠡᠬᠡ᠎ᠶᠢᠨ ᠲᠦᠲᠡ ᠴᠦᠷᠬᠡ᠎ᠳᠦ ᠨᠡᠮᠡᠬᠦ᠌ - + Install ᠤᠭᠰᠠᠷᠠᠬᠤ @@ -66,7 +66,7 @@ ᠬᠡᠷᠡᠭᠯᠡᠯᠳᠡ - + Application Description: 应用描述: diff --git a/translations/libukui-search/libukui-search_zh_CN.ts b/translations/libukui-search/libukui-search_zh_CN.ts index 9d0e957..c9b61c1 100644 --- a/translations/libukui-search/libukui-search_zh_CN.ts +++ b/translations/libukui-search/libukui-search_zh_CN.ts @@ -32,25 +32,25 @@ UkuiSearch::AppSearchPlugin - + Open 打开 - + Add Shortcut to Desktop 添加到桌面快捷方式 - + Add Shortcut to Panel 添加到任务栏快捷方式 - + Install 安装 @@ -66,7 +66,7 @@ 应用 - + Application Description: 应用描述: diff --git a/translations/libukui-search/libukui-search_zh_HK.ts b/translations/libukui-search/libukui-search_zh_HK.ts index 3ecaeb4..83e8872 100644 --- a/translations/libukui-search/libukui-search_zh_HK.ts +++ b/translations/libukui-search/libukui-search_zh_HK.ts @@ -18,25 +18,25 @@ UkuiSearch::AppSearchPlugin - + Open 打開 - + Add Shortcut to Desktop 添加到桌面快捷方式 - + Add Shortcut to Panel 添加到任務列快捷方式 - + Install 安裝 @@ -52,7 +52,7 @@ 應用 - + Application Description: 應用描述: