From e3d74117caa1e1289879388640797a1a9594c35a Mon Sep 17 00:00:00 2001 From: Diadlo Date: Wed, 4 May 2016 02:22:12 +0300 Subject: [PATCH 1/3] feat(notificationscrollarea): Add ability to delete widget from traced widgets list --- src/widget/notificationscrollarea.cpp | 19 +++++++++++++++---- src/widget/notificationscrollarea.h | 3 ++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/widget/notificationscrollarea.cpp b/src/widget/notificationscrollarea.cpp index dc03586a8..5a37e95a9 100644 --- a/src/widget/notificationscrollarea.cpp +++ b/src/widget/notificationscrollarea.cpp @@ -25,8 +25,8 @@ NotificationScrollArea::NotificationScrollArea(QWidget* parent) : AdjustingScrollArea(parent) { - connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateTracking); - connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateTracking); + connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateVisualTracking); + connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateVisualTracking); } void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget) @@ -66,12 +66,23 @@ void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget) } } -void NotificationScrollArea::updateTracking() +/** + * @brief Delete notification bar to visible elements on scroll area + */ +void NotificationScrollArea::updateVisualTracking() { + updateTracking(nullptr); +} + +/** + * @brief Delete notification bar from visible elements and widget on scroll area + * @param widget Chatroom widget to remove from tracked widgets + */ +void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget) { QHash::iterator i = trackedWidgets.begin(); while (i != trackedWidgets.end()) { - if (widgetVisible(i.key()) == Visible) + if (i.key() == widget || widgetVisible(i.key()) == Visible) { if (i.value() == Above) { diff --git a/src/widget/notificationscrollarea.h b/src/widget/notificationscrollarea.h index 362dab46b..7fc064ae7 100644 --- a/src/widget/notificationscrollarea.h +++ b/src/widget/notificationscrollarea.h @@ -33,7 +33,8 @@ public: public slots: void trackWidget(GenericChatroomWidget* widget); - void updateTracking(); + void updateVisualTracking(); + void updateTracking(GenericChatroomWidget *widget); protected: void resizeEvent(QResizeEvent *event) final override; From 378d648591c85415e28c03fe3f54c68b59b3ab20 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Wed, 4 May 2016 02:36:19 +0300 Subject: [PATCH 2/3] refactor(contentdialog): Refactor window activate event --- src/widget/contentdialog.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/widget/contentdialog.cpp b/src/widget/contentdialog.cpp index 00f4c9d4a..0939158f2 100644 --- a/src/widget/contentdialog.cpp +++ b/src/widget/contentdialog.cpp @@ -484,18 +484,18 @@ bool ContentDialog::event(QEvent* event) updateTitle(activeChatroomWidget); Friend* frnd = activeChatroomWidget->getFriend(); + Group* group = activeChatroomWidget->getGroup(); + + GenericChatroomWidget *widget = nullptr; if (frnd) - { - frnd->getFriendWidget()->resetEventFlags(); - frnd->getFriendWidget()->updateStatusLight(); - } + widget = frnd->getFriendWidget(); else - { - Group* g = activeChatroomWidget->getGroup(); - g->getGroupWidget()->resetEventFlags(); - g->getGroupWidget()->updateStatusLight(); - } + widget = group->getGroupWidget(); + + widget->resetEventFlags(); + widget->updateStatusLight(); + Widget::getInstance()->resetIcon(); } From b2c1f468946aff73b23fb9ac6539331f6c0c7fbe Mon Sep 17 00:00:00 2001 From: Diadlo Date: Wed, 4 May 2016 02:38:35 +0300 Subject: [PATCH 3/3] fix(contentdialog, widget): Remove "new message" bar after reading message Fix #2247. --- src/widget/contentdialog.cpp | 1 + src/widget/widget.cpp | 8 ++++++++ src/widget/widget.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/widget/contentdialog.cpp b/src/widget/contentdialog.cpp index 0939158f2..6dfdc4382 100644 --- a/src/widget/contentdialog.cpp +++ b/src/widget/contentdialog.cpp @@ -496,6 +496,7 @@ bool ContentDialog::event(QEvent* event) widget->resetEventFlags(); widget->updateStatusLight(); + Widget::getInstance()->updateScroll(widget); Widget::getInstance()->resetIcon(); } diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index b3f07ef0f..91e24943d 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1386,6 +1386,11 @@ void Widget::clearContactsList() removeGroup(g, true); } +void Widget::updateScroll(GenericChatroomWidget *widget) { + ui->friendList->updateTracking(widget); +} + + ContentDialog* Widget::createContentDialog() const { ContentDialog* contentDialog = new ContentDialog(settingsWidget); @@ -1683,6 +1688,9 @@ bool Widget::event(QEvent * e) case QEvent::MouseButtonDblClick: focusChatInput(); break; + case QEvent::Paint: + ui->friendList->updateVisualTracking(); + break; case QEvent::WindowActivate: if (activeChatroomWidget != nullptr) { diff --git a/src/widget/widget.h b/src/widget/widget.h index 478a633ed..7885b33e8 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -75,6 +75,7 @@ public: bool getIsWindowMinimized(); void updateIcons(); void clearContactsList(); + void updateScroll(GenericChatroomWidget *widget); enum DialogType {