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

Merge pull request #4913

tox-user (1):
      feat(groupchat): mark blocked users with different color
This commit is contained in:
sudden6 2018-01-20 00:17:20 +01:00
commit c41de48a6b
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -34,6 +34,7 @@
#include "src/widget/style.h"
#include "src/widget/tool/croppinglabel.h"
#include "src/widget/translator.h"
#include "src/persistence/settings.h"
#include <QDragEnterEvent>
#include <QMimeData>
@ -116,6 +117,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
});
connect(group, &Group::userListChanged, this, &GroupChatForm::onUserListChanged);
connect(group, &Group::titleChanged, this, &GroupChatForm::onTitleChanged);
connect(&Settings::getInstance(), &Settings::blackListChanged, this, &GroupChatForm::updateUserNames);
setAcceptDrops(true);
Translator::registerHandler(std::bind(&GroupChatForm::retranslateUi, this), this);
@ -225,9 +227,16 @@ void GroupChatForm::updateUserNames()
label->setToolTip(fullName);
}
label->setTextFormat(Qt::PlainText);
const Settings& s = Settings::getInstance();
const Core* core = Core::getInstance();
const ToxPk peerPk = core->getGroupPeerPk(group->getId(), peerNumber);
if (group->isSelfPeerNumber(peerNumber)) {
label->setStyleSheet(QStringLiteral("QLabel {color : green;}"));
} else if (netcam != nullptr) {
} else if (s.getBlackList().contains(peerPk.toString())) {
label->setStyleSheet(QStringLiteral("QLabel {color : darkRed;}"));
} else if (netcam != nullptr) {
static_cast<GroupNetCamView*>(netcam)->addPeer(peerNumber, fullName);
}
peerLabels.append(label);