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

refactor(group): Replace 'renameRequest' signal on Group::titleChanged

This commit is contained in:
Diadlo 2017-08-03 00:00:30 +03:00
parent 11e75104f4
commit 4fee43cded
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 7 additions and 4 deletions

View File

@ -23,8 +23,9 @@
#include "friendwidget.h"
#include "groupwidget.h"
#include "widget.h"
#include "src/model/friend.h"
#include "src/friendlist.h"
#include "src/model/friend.h"
#include "src/model/group.h"
#include "src/persistence/settings.h"
#include <QDragEnterEvent>
#include <QDragLeaveEvent>
@ -279,7 +280,11 @@ FriendListWidget::Mode FriendListWidget::getMode() const
void FriendListWidget::addGroupWidget(GroupWidget* widget)
{
groupLayout.addSortedWidget(widget);
connect(widget, &GroupWidget::renameRequested, this, &FriendListWidget::renameGroupWidget);
Group* g = widget->getGroup();
connect(g, &Group::titleChanged, [=](uint32_t groupId, const QString& name) {
Q_UNUSED(groupId);
renameGroupWidget(widget, name);
});
}
void FriendListWidget::addFriendWidget(FriendWidget* w, Status s, int circleIndex)

View File

@ -66,7 +66,6 @@ void GroupWidget::setTitle(const QString& newName)
if (!newName.isEmpty()) {
Group* g = GroupList::findGroup(groupId);
g->setName(newName);
emit renameRequested(this, newName);
emit g->getChatForm()->groupTitleChanged(groupId, newName.left(128));
}
}

View File

@ -41,7 +41,6 @@ public:
signals:
void groupWidgetClicked(GroupWidget* widget);
void renameRequested(GroupWidget* widget, const QString& newName);
void removeGroup(int groupId);
protected: