mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
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
This commit is contained in:
commit
cd26923a24
|
@ -484,18 +484,19 @@ 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()->updateScroll(widget);
|
||||
Widget::getInstance()->resetIcon();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<GenericChatroomWidget*, Visibility>::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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
bool getIsWindowMinimized();
|
||||
void updateIcons();
|
||||
void clearContactsList();
|
||||
void updateScroll(GenericChatroomWidget *widget);
|
||||
|
||||
enum DialogType
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user