1
0
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:
Diadlo 2017-06-23 14:11:24 +03:00
parent 31d35ecc62
commit c667cf5c84
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
6 changed files with 10 additions and 26 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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;
}