Skip to content

Commit

Permalink
fix: UI error on collapse mode
Browse files Browse the repository at this point in the history
modify UI on collapse mode

Issue: linuxdeepin/developer-center#4642
  • Loading branch information
FeiWang1119 committed Aug 23, 2023
1 parent 29dd4e5 commit 556da6b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 19 additions & 4 deletions notification/notifycenterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void NotifyCenterWidget::initUI()
m_toggleNotificationFolding = new CicleIconButton(nullptr);
m_toggleNotificationFolding->setAccessibleName("ToggleNotificationFolding");
m_toggleNotificationFolding->setFixedSize(UI::Panel::buttonSize);
m_toggleNotificationFolding->setIcon(DDciIcon::fromTheme("arrow_ordinary_up"));
connect(m_toggleNotificationFolding, &CicleIconButton::clicked, this, &NotifyCenterWidget::toggleNotificationFolding);

m_settingBtn = new CicleIconButton(nullptr);
Expand Down Expand Up @@ -164,12 +165,15 @@ void NotifyCenterWidget::updateDisplayOfRemainingNotification()
} else {
const int rowCount = m_notifyWidget->model()->remainNotificationCount();
if (rowCount > 0) {
if (m_bottomTipLayout->parentWidget()->isHidden())
if (m_bottomTipLayout->parentWidget()->isHidden()) {
m_bottomTipLayout->parentWidget()->show();
collapesNotificationFoldingImpl(false);
}
m_expandRemaining->setText(tr("%1 more notifications").arg(QString::number(rowCount)));
m_bottomTipLayout->setCurrentWidget(m_expandRemaining);
} else {
m_bottomTipLayout->parentWidget()->hide();
expandNotificationFoldingImpl(false);
}
}
}
Expand All @@ -191,20 +195,31 @@ void NotifyCenterWidget::updateTabFocus()
}

void NotifyCenterWidget::expandNotificationFolding()
{
expandNotificationFoldingImpl(true);
}

void NotifyCenterWidget::expandNotificationFoldingImpl(const bool refreshData)
{
m_isCollapesNotificationFolding = false;
m_notifyWidget->model()->expandData();
if (refreshData)
m_notifyWidget->model()->expandData();
m_toggleNotificationFolding->setIcon(DDciIcon::fromTheme("arrow_ordinary_up"));
Q_EMIT notificationFoldingChanged(m_isCollapesNotificationFolding);
m_expandRemaining->hide();
m_toggleNotificationFolding->show();
}

void NotifyCenterWidget::collapesNotificationFolding()
{
collapesNotificationFoldingImpl(true);
}

void NotifyCenterWidget::collapesNotificationFoldingImpl(const bool refreshData)
{
m_isCollapesNotificationFolding = true;
m_notifyWidget->model()->collapseData();
m_toggleNotificationFolding->setIcon(DDciIcon::fromTheme("arrow_ordinary_down"));
if (refreshData)
m_notifyWidget->model()->collapseData();
Q_EMIT notificationFoldingChanged(m_isCollapesNotificationFolding);
m_expandRemaining->show();
m_toggleNotificationFolding->hide();
Expand Down
2 changes: 2 additions & 0 deletions notification/notifycenterwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ private Q_SLOTS:
void updateDisplayOfRemainingNotification();
void updateTabFocus();
void expandNotificationFolding();
void expandNotificationFoldingImpl(const bool refreshData);
void collapesNotificationFolding();
void collapesNotificationFoldingImpl(const bool refreshData);
void toggleNotificationFolding();
void showSettingMenu();
void showNotificationModuleOfControlCenter();
Expand Down

0 comments on commit 556da6b

Please sign in to comment.