Browse Source

refactor(widget): Remove 'chatFormIsSet'

'charFormIsSet' is small static method used in one place, replaced
on direct using.
reviewable/pr4484/r1
Diadlo 8 years ago
parent
commit
c667cf5c84
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 10
      src/widget/friendwidget.cpp
  2. 1
      src/widget/friendwidget.h
  3. 1
      src/widget/genericchatroomwidget.h
  4. 10
      src/widget/groupwidget.cpp
  5. 1
      src/widget/groupwidget.h
  6. 13
      src/widget/widget.cpp

10
src/widget/friendwidget.cpp

@ -363,16 +363,6 @@ void FriendWidget::search(const QString& searchString, bool hide) @@ -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);

1
src/widget/friendwidget.h

@ -32,7 +32,6 @@ public: @@ -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;

1
src/widget/genericchatroomwidget.h

@ -39,7 +39,6 @@ public: @@ -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;

10
src/widget/groupwidget.cpp

@ -198,16 +198,6 @@ Group* GroupWidget::getGroup() const @@ -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);

1
src/widget/groupwidget.h

@ -31,7 +31,6 @@ public: @@ -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;

13
src/widget/widget.cpp

@ -1117,14 +1117,21 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow) @@ -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…
Cancel
Save