aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/widgets/playerlistwidget.cpp15
-rw-r--r--src/widgets/playerlistwidget.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/widgets/playerlistwidget.cpp b/src/widgets/playerlistwidget.cpp
index c72b74ae..1dabe157 100644
--- a/src/widgets/playerlistwidget.cpp
+++ b/src/widgets/playerlistwidget.cpp
@@ -73,6 +73,10 @@ void PlayerListWidget::updatePlayer(const PlayerUpdate &update)
void PlayerListWidget::setAuthenticated(bool f_state)
{
m_is_authenticated = f_state;
+ for (const PlayerData &data : qAsConst(m_player_map))
+ {
+ updatePlayer(data.id, false);
+ }
}
void PlayerListWidget::onCustomContextMenuRequested(const QPoint &pos)
@@ -159,7 +163,7 @@ void PlayerListWidget::updatePlayer(int playerId, bool updateIcon)
return;
}
- item->setText(data.name.isEmpty() ? QObject::tr("Unnamed Player") : data.name);
+ item->setText(formatLabel(data));
if (data.character.isEmpty())
{
item->setToolTip(QString());
@@ -179,3 +183,12 @@ void PlayerListWidget::updatePlayer(int playerId, bool updateIcon)
item->setIcon(QIcon(ao_app->get_image_suffix(ao_app->get_character_path(data.character, "char_icon"), true)));
}
}
+
+QString PlayerListWidget::formatLabel(const PlayerData &data)
+{
+ if (m_is_authenticated)
+ {
+ return QString("%1 %2 %3").arg(data.character, data.character_name, data.name).simplified();
+ }
+ return QString("%1 %2").arg(data.character, data.character_name).simplified();
+}
diff --git a/src/widgets/playerlistwidget.h b/src/widgets/playerlistwidget.h
index e771d7e1..217c9f92 100644
--- a/src/widgets/playerlistwidget.h
+++ b/src/widgets/playerlistwidget.h
@@ -29,6 +29,8 @@ private:
void removePlayer(int playerId);
void updatePlayer(int playerId, bool updateIcon);
+ QString formatLabel(const PlayerData &data);
+
void filterPlayerList();
private Q_SLOTS: