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);
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user