From 3b2f9b779bafc197c2be4a73defe9b6e1431a4a7 Mon Sep 17 00:00:00 2001 From: "huheng@kylinos.cn" Date: Fri, 25 Nov 2022 11:31:53 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(UI=E6=A8=A1=E5=9D=97):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=90=9C=E7=B4=A2=E6=A1=86=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/filemanageview/filemanagewin.cpp | 39 ++++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/ui/filemanageview/filemanagewin.cpp b/ui/filemanageview/filemanagewin.cpp index 8fb6ca7..2b7c4a4 100644 --- a/ui/filemanageview/filemanagewin.cpp +++ b/ui/filemanageview/filemanagewin.cpp @@ -170,8 +170,8 @@ FileManageWin::FileManageWin(QWidget *parent) : QWidget(parent) hLayout->addWidget(m_crumb); hLayout->addStretch(); hLayout->addWidget(m_searchBtn); - hLayout->addWidget(m_lab3); hLayout->addWidget(m_searchLine); + hLayout->addWidget(m_lab3); hLayout->addWidget(m_editBtn); hLayout->addWidget(m_selectBtn); hLayout->addWidget(m_lab4); @@ -185,7 +185,7 @@ FileManageWin::FileManageWin(QWidget *parent) : QWidget(parent) m_loadAnimation = new LoadAnimation(this); m_stackedWin = new QStackedWidget(this); - m_stackedWin->setContentsMargins(0, 0, 0, 0); + m_stackedWin->setContentsMargins(0, 5, 0, 0); m_stackedWin->addWidget(m_loadAnimation); m_stackedWin->setCurrentIndex(FileManageWin::PageIndex::LoadPage); @@ -312,7 +312,9 @@ void FileManageWin::changeTabMode(FileManageWin::TabType type) m_forwardBtn->show(); m_lab2->show(); m_crumb->show(); - m_searchBtn->show(); + if (m_searchLine->isHidden()) { + m_searchBtn->show(); + } m_lab3->show(); m_editBtn->show(); m_lab4->show(); @@ -326,7 +328,9 @@ void FileManageWin::changeTabMode(FileManageWin::TabType type) m_statusLab->setText(CrumbTag::FileList); m_lab1->show(); m_statusLab->show(); - m_searchBtn->show(); + if (m_searchLine->isHidden()) { + m_searchBtn->show(); + } m_lab4->show(); } break; case FileManageWin::TabType::AppHomePage: { @@ -335,21 +339,24 @@ void FileManageWin::changeTabMode(FileManageWin::TabType type) m_forwardBtn->show(); m_lab2->show(); m_crumb->show(); - m_searchBtn->show(); + if (m_searchLine->isHidden()) { + m_searchBtn->show(); + } m_lab4->show(); } break; case FileManageWin::TabType::SearchResultsPage: { m_statusLab->setText(tr("Search File")); + m_retreatBtn->setEnabled(true); m_retreatBtn->show(); m_statusLab->show(); if (m_searchLine->isHidden()) { m_searchBtn->show(); - m_lab3->show(); - m_editBtn->show(); - m_lab4->show(); - m_verticalLine->show(); - m_lab5->show(); } + m_lab3->show(); + m_editBtn->show(); + m_lab4->show(); + m_verticalLine->show(); + m_lab5->show(); m_modeBtn->show(); m_lab6->show(); m_refreshBtn->show(); @@ -360,6 +367,7 @@ void FileManageWin::changeTabMode(FileManageWin::TabType type) } break; case FileManageWin::TabType::Edit: { m_statusLab->show(); + m_lab3->show(); m_selectBtn->show(); m_lab5->show(); m_finishBtn->show(); @@ -392,13 +400,12 @@ void FileManageWin::slotCrumbIndexChange(int index) void FileManageWin::slotKdkBtnClicked() { hideSearchLine(); - kdk::KToolButton *btn = qobject_cast(sender()); if (btn == m_retreatBtn) { load(); if (m_isSearch) { m_isSearch = false; - Q_EMIT sigBtnCliked(FileManageWin::BtnType::ReturnBtn); + m_searchLine->clear(); } else { Q_EMIT sigBtnCliked(FileManageWin::BtnType::GoBacktBtn); } @@ -407,8 +414,6 @@ void FileManageWin::slotKdkBtnClicked() Q_EMIT sigBtnCliked(FileManageWin::BtnType::GoForwardBtn); } else if (btn == m_searchBtn) { m_searchBtn->hide(); - m_editBtn->hide(); - m_verticalLine->hide(); m_searchLine->show(); m_searchLineAnimation->setStartValue(0); m_searchLineAnimation->setEndValue(SEARCHLINE_WIDTH); @@ -436,7 +441,6 @@ void FileManageWin::slotKdkBtnClicked() void FileManageWin::slotBtnClicked() { hideSearchLine(); - ClickLabel *btn = qobject_cast(sender()); if (btn == m_selectBtn) { if (m_selectBtn->text() == tr("Select All")) { @@ -477,5 +481,10 @@ void FileManageWin::slotSearchTextChanged() return; } load(); + if (m_searchLine->text().isEmpty()) { + m_isSearch = false; + Q_EMIT sigBtnCliked(FileManageWin::BtnType::ReturnBtn); + return; + } Q_EMIT sigSearchTextChanged(m_searchLine->text()); } \ No newline at end of file