Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: UI error on collapse mode #57

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 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,30 @@ void NotifyCenterWidget::updateTabFocus()
}

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

void NotifyCenterWidget::expandNotificationFoldingImpl(const bool refreshData)
{
m_isCollapesNotificationFolding = false;
m_notifyWidget->model()->expandData();
m_toggleNotificationFolding->setIcon(DDciIcon::fromTheme("arrow_ordinary_up"));
if (refreshData)
m_notifyWidget->model()->expandData();
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
Loading