mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Pass Friend in ContentDialog::addFriend
friendId and name (old parameters) can be getted from Friend
This commit is contained in:
parent
90a262e9b5
commit
1a0a1d6949
|
@ -120,7 +120,7 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||
|
||||
if (friendWidget != nullptr) {
|
||||
Friend* f = friendWidget->getFriend();
|
||||
dialog->addFriend(friendWidget->friendId, f->getDisplayedName());
|
||||
dialog->addFriend(f);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < friendOfflineLayout()->count(); ++i) {
|
||||
|
@ -129,7 +129,7 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||
|
||||
if (friendWidget != nullptr) {
|
||||
Friend* f = friendWidget->getFriend();
|
||||
dialog->addFriend(friendWidget->friendId, f->getDisplayedName());
|
||||
dialog->addFriend(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,11 +161,12 @@ ContentDialog::~ContentDialog()
|
|||
Translator::unregister(this);
|
||||
}
|
||||
|
||||
FriendWidget* ContentDialog::addFriend(int friendId, QString id)
|
||||
FriendWidget* ContentDialog::addFriend(Friend* frnd)
|
||||
{
|
||||
bool compact = Settings::getInstance().getCompactLayout();
|
||||
FriendWidget* friendWidget = new FriendWidget(friendId, id, compact);
|
||||
Friend* frnd = friendWidget->getFriend();
|
||||
uint32_t friendId = frnd->getFriendId();
|
||||
QString name = frnd->getDisplayedName();
|
||||
FriendWidget* friendWidget = new FriendWidget(friendId, name, compact);
|
||||
friendLayout->addFriendWidget(friendWidget, frnd->getStatus());
|
||||
|
||||
ChatForm* form = frnd->getChatForm();
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
ContentDialog(SettingsWidget* settingsWidget, QWidget* parent = 0);
|
||||
~ContentDialog();
|
||||
|
||||
FriendWidget* addFriend(int friendId, QString id);
|
||||
FriendWidget* addFriend(Friend* f);
|
||||
GroupWidget* addGroup(int groupId, const QString& name);
|
||||
void removeFriend(int friendId);
|
||||
void removeGroup(int groupId);
|
||||
|
|
|
@ -961,9 +961,9 @@ void Widget::onCallEnd(uint32_t friendId)
|
|||
void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
||||
{
|
||||
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
||||
|
||||
QString name = newfriend->getDisplayedName();
|
||||
bool compact = Settings::getInstance().getCompactLayout();
|
||||
|
||||
FriendWidget* widget = new FriendWidget(friendId, name, compact);
|
||||
ChatForm* friendForm = newfriend->getChatForm();
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ void Widget::addFriendDialog(Friend* frnd, ContentDialog* dialog)
|
|||
onAddClicked();
|
||||
}
|
||||
|
||||
FriendWidget* friendWidget = dialog->addFriend(frnd->getFriendId(), frnd->getDisplayedName());
|
||||
FriendWidget* friendWidget = dialog->addFriend(frnd);
|
||||
|
||||
friendWidget->setStatusMsg(widget->getStatusMsg());
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user