Browse Source

Merge pull request #3249

Diadlo (3):
      feat(notificationscrollarea): Add ability to delete widget from traced widgets list
      refactor(contentdialog): Refactor window activate event
      fix(contentdialog, widget): Remove "new message" bar after reading message
pull/3298/head
sudden6 9 years ago
parent
commit
cd26923a24
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
  1. 19
      src/widget/contentdialog.cpp
  2. 19
      src/widget/notificationscrollarea.cpp
  3. 3
      src/widget/notificationscrollarea.h
  4. 8
      src/widget/widget.cpp
  5. 1
      src/widget/widget.h

19
src/widget/contentdialog.cpp

@ -484,18 +484,19 @@ bool ContentDialog::event(QEvent* event)
updateTitle(activeChatroomWidget); updateTitle(activeChatroomWidget);
Friend* frnd = activeChatroomWidget->getFriend(); Friend* frnd = activeChatroomWidget->getFriend();
Group* group = activeChatroomWidget->getGroup();
GenericChatroomWidget *widget = nullptr;
if (frnd) if (frnd)
{ widget = frnd->getFriendWidget();
frnd->getFriendWidget()->resetEventFlags();
frnd->getFriendWidget()->updateStatusLight();
}
else else
{ widget = group->getGroupWidget();
Group* g = activeChatroomWidget->getGroup();
g->getGroupWidget()->resetEventFlags(); widget->resetEventFlags();
g->getGroupWidget()->updateStatusLight(); widget->updateStatusLight();
}
Widget::getInstance()->updateScroll(widget);
Widget::getInstance()->resetIcon(); Widget::getInstance()->resetIcon();
} }

19
src/widget/notificationscrollarea.cpp

@ -25,8 +25,8 @@
NotificationScrollArea::NotificationScrollArea(QWidget* parent) NotificationScrollArea::NotificationScrollArea(QWidget* parent)
: AdjustingScrollArea(parent) : AdjustingScrollArea(parent)
{ {
connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateTracking); connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &NotificationScrollArea::updateVisualTracking);
connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateTracking); connect(verticalScrollBar(), &QAbstractSlider::rangeChanged, this, &NotificationScrollArea::updateVisualTracking);
} }
void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget) 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<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin(); QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
while (i != trackedWidgets.end()) while (i != trackedWidgets.end())
{ {
if (widgetVisible(i.key()) == Visible) if (i.key() == widget || widgetVisible(i.key()) == Visible)
{ {
if (i.value() == Above) if (i.value() == Above)
{ {

3
src/widget/notificationscrollarea.h

@ -33,7 +33,8 @@ public:
public slots: public slots:
void trackWidget(GenericChatroomWidget* widget); void trackWidget(GenericChatroomWidget* widget);
void updateTracking(); void updateVisualTracking();
void updateTracking(GenericChatroomWidget *widget);
protected: protected:
void resizeEvent(QResizeEvent *event) final override; void resizeEvent(QResizeEvent *event) final override;

8
src/widget/widget.cpp

@ -1386,6 +1386,11 @@ void Widget::clearContactsList()
removeGroup(g, true); removeGroup(g, true);
} }
void Widget::updateScroll(GenericChatroomWidget *widget) {
ui->friendList->updateTracking(widget);
}
ContentDialog* Widget::createContentDialog() const ContentDialog* Widget::createContentDialog() const
{ {
ContentDialog* contentDialog = new ContentDialog(settingsWidget); ContentDialog* contentDialog = new ContentDialog(settingsWidget);
@ -1683,6 +1688,9 @@ bool Widget::event(QEvent * e)
case QEvent::MouseButtonDblClick: case QEvent::MouseButtonDblClick:
focusChatInput(); focusChatInput();
break; break;
case QEvent::Paint:
ui->friendList->updateVisualTracking();
break;
case QEvent::WindowActivate: case QEvent::WindowActivate:
if (activeChatroomWidget != nullptr) if (activeChatroomWidget != nullptr)
{ {

1
src/widget/widget.h

@ -75,6 +75,7 @@ public:
bool getIsWindowMinimized(); bool getIsWindowMinimized();
void updateIcons(); void updateIcons();
void clearContactsList(); void clearContactsList();
void updateScroll(GenericChatroomWidget *widget);
enum DialogType enum DialogType
{ {

Loading…
Cancel
Save