|
|
@ -16,7 +16,7 @@
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QtConcurrent/QtConcurrentRun>
|
|
|
|
#include <QtConcurrent/QtConcurrentRun>
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
#include "core/announce_multiplayer_session.h"
|
|
|
|
#include "network/announce_multiplayer_session.h"
|
|
|
|
#include "ui_chat_room.h"
|
|
|
|
#include "ui_chat_room.h"
|
|
|
|
#include "yuzu/game_list_p.h"
|
|
|
|
#include "yuzu/game_list_p.h"
|
|
|
|
#include "yuzu/multiplayer/chat_room.h"
|
|
|
|
#include "yuzu/multiplayer/chat_room.h"
|
|
|
@ -122,19 +122,22 @@ public:
|
|
|
|
static const int UsernameRole = Qt::UserRole + 2;
|
|
|
|
static const int UsernameRole = Qt::UserRole + 2;
|
|
|
|
static const int AvatarUrlRole = Qt::UserRole + 3;
|
|
|
|
static const int AvatarUrlRole = Qt::UserRole + 3;
|
|
|
|
static const int GameNameRole = Qt::UserRole + 4;
|
|
|
|
static const int GameNameRole = Qt::UserRole + 4;
|
|
|
|
|
|
|
|
static const int GameVersionRole = Qt::UserRole + 5;
|
|
|
|
|
|
|
|
|
|
|
|
PlayerListItem() = default;
|
|
|
|
PlayerListItem() = default;
|
|
|
|
explicit PlayerListItem(const std::string& nickname, const std::string& username,
|
|
|
|
explicit PlayerListItem(const std::string& nickname, const std::string& username,
|
|
|
|
const std::string& avatar_url, const std::string& game_name) {
|
|
|
|
const std::string& avatar_url,
|
|
|
|
|
|
|
|
const AnnounceMultiplayerRoom::GameInfo& game_info) {
|
|
|
|
setEditable(false);
|
|
|
|
setEditable(false);
|
|
|
|
setData(QString::fromStdString(nickname), NicknameRole);
|
|
|
|
setData(QString::fromStdString(nickname), NicknameRole);
|
|
|
|
setData(QString::fromStdString(username), UsernameRole);
|
|
|
|
setData(QString::fromStdString(username), UsernameRole);
|
|
|
|
setData(QString::fromStdString(avatar_url), AvatarUrlRole);
|
|
|
|
setData(QString::fromStdString(avatar_url), AvatarUrlRole);
|
|
|
|
if (game_name.empty()) {
|
|
|
|
if (game_info.name.empty()) {
|
|
|
|
setData(QObject::tr("Not playing a game"), GameNameRole);
|
|
|
|
setData(QObject::tr("Not playing a game"), GameNameRole);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setData(QString::fromStdString(game_name), GameNameRole);
|
|
|
|
setData(QString::fromStdString(game_info.name), GameNameRole);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setData(QString::fromStdString(game_info.version), GameVersionRole);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QVariant data(int role) const override {
|
|
|
|
QVariant data(int role) const override {
|
|
|
@ -149,7 +152,13 @@ public:
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
name = QStringLiteral("%1 (%2)").arg(nickname, username);
|
|
|
|
name = QStringLiteral("%1 (%2)").arg(nickname, username);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return QStringLiteral("%1\n %2").arg(name, data(GameNameRole).toString());
|
|
|
|
const QString version = data(GameVersionRole).toString();
|
|
|
|
|
|
|
|
QString version_string;
|
|
|
|
|
|
|
|
if (!version.isEmpty()) {
|
|
|
|
|
|
|
|
version_string = QStringLiteral("(%1)").arg(version);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return QStringLiteral("%1\n %2 %3")
|
|
|
|
|
|
|
|
.arg(name, data(GameNameRole).toString(), version_string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -167,6 +176,10 @@ ChatRoom::ChatRoom(QWidget* parent) : QWidget(parent), ui(std::make_unique<Ui::C
|
|
|
|
|
|
|
|
|
|
|
|
ui->chat_history->document()->setMaximumBlockCount(max_chat_lines);
|
|
|
|
ui->chat_history->document()->setMaximumBlockCount(max_chat_lines);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto font = ui->chat_history->font();
|
|
|
|
|
|
|
|
font.setPointSizeF(10);
|
|
|
|
|
|
|
|
ui->chat_history->setFont(font);
|
|
|
|
|
|
|
|
|
|
|
|
// register the network structs to use in slots and signals
|
|
|
|
// register the network structs to use in slots and signals
|
|
|
|
qRegisterMetaType<Network::ChatEntry>();
|
|
|
|
qRegisterMetaType<Network::ChatEntry>();
|
|
|
|
qRegisterMetaType<Network::StatusMessageEntry>();
|
|
|
|
qRegisterMetaType<Network::StatusMessageEntry>();
|
|
|
@ -366,7 +379,7 @@ void ChatRoom::SetPlayerList(const Network::RoomMember::MemberList& member_list)
|
|
|
|
if (member.nickname.empty())
|
|
|
|
if (member.nickname.empty())
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
QStandardItem* name_item = new PlayerListItem(member.nickname, member.username,
|
|
|
|
QStandardItem* name_item = new PlayerListItem(member.nickname, member.username,
|
|
|
|
member.avatar_url, member.game_info.name);
|
|
|
|
member.avatar_url, member.game_info);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
if (!icon_cache.count(member.avatar_url) && !member.avatar_url.empty()) {
|
|
|
|
if (!icon_cache.count(member.avatar_url) && !member.avatar_url.empty()) {
|
|
|
|