1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: Remove Friend::getChatForm using

This commit is contained in:
Diadlo 2017-05-30 00:14:52 +03:00
parent a7e17a4ee4
commit 31d35ecc62
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 12 additions and 7 deletions

View File

@ -363,15 +363,14 @@ void FriendWidget::search(const QString& searchString, bool hide)
circleWidget->search(searchString); circleWidget->search(searchString);
} }
// TODO: Remove
bool FriendWidget::chatFormIsSet(bool focus) const bool FriendWidget::chatFormIsSet(bool focus) const
{ {
Friend* f = FriendList::findFriend(friendId);
if (focus) { if (focus) {
ContentDialog::focusFriend(friendId); ContentDialog::focusFriend(friendId);
} }
bool exist = ContentDialog::friendWidgetExists(friendId); return ContentDialog::friendWidgetExists(friendId);
return exist || f->getChatForm()->isVisible();
} }
void FriendWidget::setChatForm(ContentLayout* contentLayout) void FriendWidget::setChatForm(ContentLayout* contentLayout)

View File

@ -198,15 +198,14 @@ Group* GroupWidget::getGroup() const
return GroupList::findGroup(groupId); return GroupList::findGroup(groupId);
} }
// TODO: Remove
bool GroupWidget::chatFormIsSet(bool focus) const bool GroupWidget::chatFormIsSet(bool focus) const
{ {
Group* g = GroupList::findGroup(groupId);
if (focus) { if (focus) {
ContentDialog::focusGroup(groupId); ContentDialog::focusGroup(groupId);
} }
bool exist = ContentDialog::groupWidgetExists(groupId); return ContentDialog::groupWidgetExists(groupId);
return exist || g->getChatForm()->isVisible();
} }
void GroupWidget::setChatForm(ContentLayout* contentLayout) void GroupWidget::setChatForm(ContentLayout* contentLayout)

View File

@ -1117,7 +1117,14 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
widget->resetEventFlags(); widget->resetEventFlags();
widget->updateStatusLight(); widget->updateStatusLight();
if (widget->chatFormIsSet(true) && !newWindow) { GenericChatForm* form;
if (widget->getFriend()) {
form = widget->getFriend()->getChatForm();
} else {
form = widget->getGroup()->getChatForm();
}
if ((widget->chatFormIsSet(true) || form->isVisible()) && !newWindow) {
return; return;
} }