Browse Source

refactor: Connect ContentDialog::setStatusMessage to friend directly

reviewable/pr5471/r3
Diadlo 7 years ago
parent
commit
3f5105d5c1
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 1
      src/widget/contentdialog.cpp
  2. 13
      src/widget/contentdialogmanager.cpp
  3. 1
      src/widget/contentdialogmanager.h
  4. 2
      src/widget/widget.cpp

1
src/widget/contentdialog.cpp

@ -158,6 +158,7 @@ FriendWidget* ContentDialog::addFriend(std::shared_ptr<FriendChatroom> chatroom, @@ -158,6 +158,7 @@ FriendWidget* ContentDialog::addFriend(std::shared_ptr<FriendChatroom> chatroom,
// TODO(sudden6): move this connection to the Friend::displayedNameChanged signal
connect(frnd, &Friend::aliasChanged, this, &ContentDialog::updateFriendWidget);
connect(frnd, &Friend::statusMessageChanged, this, &ContentDialog::setStatusMessage);
connect(friendWidget, &FriendWidget::chatroomWidgetClicked, this, &ContentDialog::activate);
// FIXME: emit should be removed

13
src/widget/contentdialogmanager.cpp

@ -133,19 +133,6 @@ void ContentDialogManager::updateFriendStatus(int friendId) @@ -133,19 +133,6 @@ void ContentDialogManager::updateFriendStatus(int friendId)
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)
{
auto dialog = friendDialogs.value(groupId);

1
src/widget/contentdialogmanager.h

@ -36,7 +36,6 @@ public: @@ -36,7 +36,6 @@ public:
void focusFriend(int friendId);
void focusGroup(int groupId);
void updateFriendStatus(int friendId);
void updateFriendStatusMessage(int friendId, const QString& message);
void updateGroupStatus(int groupId);
bool isFriendWidgetActive(int friendId);
bool isGroupWidgetActive(int groupId);

2
src/widget/widget.cpp

@ -1085,8 +1085,6 @@ void Widget::onFriendStatusMessageChanged(int friendId, const QString& message) @@ -1085,8 +1085,6 @@ void Widget::onFriendStatusMessageChanged(int friendId, const QString& message)
friendWidgets[friendId]->setStatusMsg(str);
chatForms[friendId]->setStatusMessage(str);
ContentDialogManager::getInstance()->updateFriendStatusMessage(friendId, message);
}
void Widget::onFriendDisplayedNameChanged(const QString& displayed)

Loading…
Cancel
Save