mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Connect ContentDialog::setStatusMessage to friend directly
This commit is contained in:
parent
52f8ba48c4
commit
3f5105d5c1
|
@ -158,6 +158,7 @@ FriendWidget* ContentDialog::addFriend(std::shared_ptr<FriendChatroom> chatroom,
|
||||||
|
|
||||||
// TODO(sudden6): move this connection to the Friend::displayedNameChanged signal
|
// TODO(sudden6): move this connection to the Friend::displayedNameChanged signal
|
||||||
connect(frnd, &Friend::aliasChanged, this, &ContentDialog::updateFriendWidget);
|
connect(frnd, &Friend::aliasChanged, this, &ContentDialog::updateFriendWidget);
|
||||||
|
connect(frnd, &Friend::statusMessageChanged, this, &ContentDialog::setStatusMessage);
|
||||||
connect(friendWidget, &FriendWidget::chatroomWidgetClicked, this, &ContentDialog::activate);
|
connect(friendWidget, &FriendWidget::chatroomWidgetClicked, this, &ContentDialog::activate);
|
||||||
|
|
||||||
// FIXME: emit should be removed
|
// FIXME: emit should be removed
|
||||||
|
|
|
@ -133,19 +133,6 @@ void ContentDialogManager::updateFriendStatus(int friendId)
|
||||||
dialog->updateFriendStatus(friendId, f->getStatus());
|
dialog->updateFriendStatus(friendId, f->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Update friend status message.
|
|
||||||
* @param friendId Id friend, whose status was changed.
|
|
||||||
* @param message Status message.
|
|
||||||
*/
|
|
||||||
void ContentDialogManager::updateFriendStatusMessage(int friendId, const QString& message)
|
|
||||||
{
|
|
||||||
auto dialog = friendDialogs.value(friendId);
|
|
||||||
if (dialog != nullptr) {
|
|
||||||
dialog->setStatusMessage(friendId, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentDialogManager::updateGroupStatus(int groupId)
|
void ContentDialogManager::updateGroupStatus(int groupId)
|
||||||
{
|
{
|
||||||
auto dialog = friendDialogs.value(groupId);
|
auto dialog = friendDialogs.value(groupId);
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
void focusFriend(int friendId);
|
void focusFriend(int friendId);
|
||||||
void focusGroup(int groupId);
|
void focusGroup(int groupId);
|
||||||
void updateFriendStatus(int friendId);
|
void updateFriendStatus(int friendId);
|
||||||
void updateFriendStatusMessage(int friendId, const QString& message);
|
|
||||||
void updateGroupStatus(int groupId);
|
void updateGroupStatus(int groupId);
|
||||||
bool isFriendWidgetActive(int friendId);
|
bool isFriendWidgetActive(int friendId);
|
||||||
bool isGroupWidgetActive(int groupId);
|
bool isGroupWidgetActive(int groupId);
|
||||||
|
|
|
@ -1085,8 +1085,6 @@ void Widget::onFriendStatusMessageChanged(int friendId, const QString& message)
|
||||||
|
|
||||||
friendWidgets[friendId]->setStatusMsg(str);
|
friendWidgets[friendId]->setStatusMsg(str);
|
||||||
chatForms[friendId]->setStatusMessage(str);
|
chatForms[friendId]->setStatusMessage(str);
|
||||||
|
|
||||||
ContentDialogManager::getInstance()->updateFriendStatusMessage(friendId, message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onFriendDisplayedNameChanged(const QString& displayed)
|
void Widget::onFriendDisplayedNameChanged(const QString& displayed)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user