mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #2600: Missing username in group chat
This commit is contained in:
parent
fc8de5d0cf
commit
47cb0e3224
|
@ -35,6 +35,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
|
#include <QtAlgorithms>
|
||||||
|
|
||||||
GroupChatForm::GroupChatForm(Group* chatGroup)
|
GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
: group(chatGroup), inCall{false}
|
: group(chatGroup), inCall{false}
|
||||||
|
@ -181,7 +182,7 @@ void GroupChatForm::onUserListChanged()
|
||||||
peerLabels.clear();
|
peerLabels.clear();
|
||||||
|
|
||||||
// the list needs peers in peernumber order, nameLayout needs alphabetical
|
// the list needs peers in peernumber order, nameLayout needs alphabetical
|
||||||
QMap<QString, QLabel*> orderizer;
|
QList<QLabel*> nickLabelList;
|
||||||
|
|
||||||
// first traverse in peer number order, storing the QLabels as necessary
|
// first traverse in peer number order, storing the QLabels as necessary
|
||||||
QStringList names = group->getPeerList();
|
QStringList names = group->getPeerList();
|
||||||
|
@ -193,7 +194,7 @@ void GroupChatForm::onUserListChanged()
|
||||||
if (!tooltip.isEmpty())
|
if (!tooltip.isEmpty())
|
||||||
peerLabels[i]->setToolTip(tooltip);
|
peerLabels[i]->setToolTip(tooltip);
|
||||||
peerLabels[i]->setTextFormat(Qt::PlainText);
|
peerLabels[i]->setTextFormat(Qt::PlainText);
|
||||||
orderizer[names[i]] = peerLabels[i];
|
nickLabelList.append(peerLabels[i]);
|
||||||
if (group->isSelfPeerNumber(i))
|
if (group->isSelfPeerNumber(i))
|
||||||
peerLabels[i]->setStyleSheet("QLabel {color : green;}");
|
peerLabels[i]->setStyleSheet("QLabel {color : green;}");
|
||||||
|
|
||||||
|
@ -205,10 +206,10 @@ void GroupChatForm::onUserListChanged()
|
||||||
static_cast<GroupNetCamView*>(netcam)->clearPeers();
|
static_cast<GroupNetCamView*>(netcam)->clearPeers();
|
||||||
|
|
||||||
// now alphabetize and add to layout
|
// now alphabetize and add to layout
|
||||||
names.sort(Qt::CaseInsensitive);
|
qSort(nickLabelList.begin(), nickLabelList.end(), [](QLabel *a, QLabel *b){return a->text().toLower() < b->text().toLower();});
|
||||||
for (unsigned i=0; i<nNames; ++i)
|
for (unsigned i=0; i<nNames; ++i)
|
||||||
{
|
{
|
||||||
QLabel* label = orderizer[names[i]];
|
QLabel *label = nickLabelList.at(i);
|
||||||
if (i != nNames - 1)
|
if (i != nNames - 1)
|
||||||
label->setText(label->text() + ", ");
|
label->setText(label->text() + ", ");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user