mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Connect all chatroomWidget clicks to friend list clicks
Remove using getGroupWidget, getFriendWidget and getChatForm from ContentDialog.
This commit is contained in:
parent
29bb319025
commit
d223d916c8
|
@ -181,7 +181,8 @@ FriendWidget* ContentDialog::addFriend(int friendId, QString id)
|
|||
lastDialog->removeFriend(friendId);
|
||||
|
||||
friendList.insert(friendId, std::make_tuple(this, friendWidget));
|
||||
onChatroomWidgetClicked(friendWidget, false);
|
||||
// FIXME: emit should be removed
|
||||
emit friendWidget->chatroomWidgetClicked(friendWidget, false);
|
||||
|
||||
return friendWidget;
|
||||
}
|
||||
|
@ -202,7 +203,8 @@ GroupWidget* ContentDialog::addGroup(int groupId, const QString& name)
|
|||
lastDialog->removeGroup(groupId);
|
||||
|
||||
groupList.insert(groupId, std::make_tuple(this, groupWidget));
|
||||
onChatroomWidgetClicked(groupWidget, false);
|
||||
// FIXME: emit should be removed
|
||||
emit groupWidget->chatroomWidgetClicked(groupWidget, false);
|
||||
|
||||
return groupWidget;
|
||||
}
|
||||
|
@ -357,7 +359,10 @@ void ContentDialog::cycleContacts(bool forward, bool loop)
|
|||
GenericChatroomWidget* chatWidget = qobject_cast<GenericChatroomWidget*>(currentLayout->itemAt(index)->widget());
|
||||
|
||||
if (chatWidget != nullptr && chatWidget != activeChatroomWidget)
|
||||
onChatroomWidgetClicked(chatWidget, false);
|
||||
{
|
||||
// FIXME: emit should be removed
|
||||
emit chatWidget->chatroomWidgetClicked(chatWidget, false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -675,11 +680,6 @@ void ContentDialog::onChatroomWidgetClicked(GenericChatroomWidget *widget, bool
|
|||
widget->resetEventFlags();
|
||||
widget->updateStatusLight();
|
||||
updateTitle(widget);
|
||||
|
||||
if (widget->getFriend())
|
||||
widget->getFriend()->getFriendWidget()->updateStatusLight();
|
||||
else
|
||||
widget->getGroup()->getGroupWidget()->updateStatusLight();
|
||||
}
|
||||
|
||||
void ContentDialog::updateFriendWidget(FriendWidget *w, Status s)
|
||||
|
|
|
@ -1271,6 +1271,18 @@ void Widget::addFriendDialog(Friend *frnd, ContentDialog *dialog)
|
|||
connect(friendWidget, &FriendWidget::copyFriendIdToClipboard,
|
||||
this, &Widget::copyFriendIdToClipboard);
|
||||
|
||||
// Signal transmission from the created `friendWidget` (which shown in
|
||||
// ContentDialog) to the `widget` (which shown in main widget)
|
||||
// FIXME: emit should be removed
|
||||
connect(friendWidget, &FriendWidget::chatroomWidgetClicked,
|
||||
this, [=](GenericChatroomWidget *w, bool group)
|
||||
{
|
||||
Q_UNUSED(w);
|
||||
emit widget->chatroomWidgetClicked(widget, group);
|
||||
});
|
||||
// FIXME: emit should be removed
|
||||
emit widget->chatroomWidgetClicked(widget, false);
|
||||
|
||||
Core* core = Core::getInstance();
|
||||
connect(core, &Core::friendAvatarChanged,
|
||||
friendWidget, &FriendWidget::onAvatarChange);
|
||||
|
@ -1301,6 +1313,19 @@ void Widget::addGroupDialog(Group *group, ContentDialog *dialog)
|
|||
this, SLOT(removeGroup(int)));
|
||||
connect(groupWidget, &GroupWidget::chatroomWidgetClicked,
|
||||
group->getChatForm(), &ChatForm::focusInput);
|
||||
|
||||
// Signal transmission from the created `groupWidget` (which shown in
|
||||
// ContentDialog) to the `widget` (which shown in main widget)
|
||||
// FIXME: emit should be removed
|
||||
connect(groupWidget, &GroupWidget::chatroomWidgetClicked,
|
||||
this, [=](GenericChatroomWidget *w, bool group)
|
||||
{
|
||||
Q_UNUSED(w);
|
||||
emit widget->chatroomWidgetClicked(widget, group);
|
||||
});
|
||||
|
||||
// FIXME: emit should be removed
|
||||
emit widget->chatroomWidgetClicked(widget, false);
|
||||
}
|
||||
|
||||
bool Widget::newFriendMessageAlert(int friendId, bool sound)
|
||||
|
|
Loading…
Reference in New Issue
Block a user