mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(widget): Remove 'chatFormIsSet'
'charFormIsSet' is small static method used in one place, replaced on direct using.
This commit is contained in:
parent
31d35ecc62
commit
c667cf5c84
|
@ -363,16 +363,6 @@ void FriendWidget::search(const QString& searchString, bool hide)
|
|||
circleWidget->search(searchString);
|
||||
}
|
||||
|
||||
// TODO: Remove
|
||||
bool FriendWidget::chatFormIsSet(bool focus) const
|
||||
{
|
||||
if (focus) {
|
||||
ContentDialog::focusFriend(friendId);
|
||||
}
|
||||
|
||||
return ContentDialog::friendWidgetExists(friendId);
|
||||
}
|
||||
|
||||
void FriendWidget::setChatForm(ContentLayout* contentLayout)
|
||||
{
|
||||
Friend* f = FriendList::findFriend(friendId);
|
||||
|
|
|
@ -32,7 +32,6 @@ public:
|
|||
void setAsActiveChatroom() override final;
|
||||
void setAsInactiveChatroom() override final;
|
||||
void updateStatusLight() override final;
|
||||
bool chatFormIsSet(bool focus) const override final;
|
||||
void setChatForm(ContentLayout* contentLayout) override final;
|
||||
void resetEventFlags() override final;
|
||||
QString getStatusString() const override final;
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
virtual void setAsActiveChatroom() = 0;
|
||||
virtual void setAsInactiveChatroom() = 0;
|
||||
virtual void updateStatusLight() = 0;
|
||||
virtual bool chatFormIsSet(bool focus) const = 0;
|
||||
virtual void setChatForm(ContentLayout* contentLayout) = 0;
|
||||
virtual void resetEventFlags() = 0;
|
||||
virtual QString getStatusString() const = 0;
|
||||
|
|
|
@ -198,16 +198,6 @@ Group* GroupWidget::getGroup() const
|
|||
return GroupList::findGroup(groupId);
|
||||
}
|
||||
|
||||
// TODO: Remove
|
||||
bool GroupWidget::chatFormIsSet(bool focus) const
|
||||
{
|
||||
if (focus) {
|
||||
ContentDialog::focusGroup(groupId);
|
||||
}
|
||||
|
||||
return ContentDialog::groupWidgetExists(groupId);
|
||||
}
|
||||
|
||||
void GroupWidget::setChatForm(ContentLayout* contentLayout)
|
||||
{
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
void setAsInactiveChatroom() final override;
|
||||
void setAsActiveChatroom() final override;
|
||||
void updateStatusLight() final override;
|
||||
bool chatFormIsSet(bool focus) const final override;
|
||||
void setChatForm(ContentLayout* contentLayout) final override;
|
||||
void resetEventFlags() final override;
|
||||
QString getStatusString() const final override;
|
||||
|
|
|
@ -1117,14 +1117,21 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
|
|||
widget->resetEventFlags();
|
||||
widget->updateStatusLight();
|
||||
|
||||
uint32_t id;
|
||||
GenericChatForm* form;
|
||||
if (widget->getFriend()) {
|
||||
form = widget->getFriend()->getChatForm();
|
||||
Friend* f = widget->getFriend();
|
||||
form = f->getChatForm();
|
||||
id = f->getFriendId();
|
||||
} else {
|
||||
form = widget->getGroup()->getChatForm();
|
||||
Group* g = widget->getGroup();
|
||||
form = g->getChatForm();
|
||||
id = g->getGroupId();
|
||||
}
|
||||
|
||||
if ((widget->chatFormIsSet(true) || form->isVisible()) && !newWindow) {
|
||||
ContentDialog::focusFriend(id);
|
||||
bool chatFormIsSet = ContentDialog::friendWidgetExists(id);
|
||||
if ((chatFormIsSet || form->isVisible()) && !newWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user