Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat(groupchat): mark blocked users with different color
Browse files Browse the repository at this point in the history
Marks blacklisted groupchat users with red color.
  • Loading branch information
tox-user committed Jan 14, 2018
1 parent fdcc695 commit a729f2f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/widget/form/groupchatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a729f2f

Please sign in to comment.