From 4df4b90795a8bf1ca9f4ee7a60145500bd88ab3b Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sun, 16 Dec 2018 23:08:47 +0800 Subject: [PATCH 1/2] citra_qt/multiplayer: Change style for pinged messages a bit To allow it to be seen more clearly in dark themes --- src/citra_qt/multiplayer/chat_room.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/citra_qt/multiplayer/chat_room.cpp b/src/citra_qt/multiplayer/chat_room.cpp index 85ac53987..60a41c6b1 100644 --- a/src/citra_qt/multiplayer/chat_room.cpp +++ b/src/citra_qt/multiplayer/chat_room.cpp @@ -70,7 +70,8 @@ public: style = QString("background-color: %1").arg(ping_color); } - return QString("[%1] <%3> %5") + return QString("[%1] <%3> %5") .arg(timestamp, color, name.toHtmlEscaped(), style, message.toHtmlEscaped()); } From 7a379ee03a905b3623dc841b5b752a83223d8822 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sun, 16 Dec 2018 23:10:48 +0800 Subject: [PATCH 2/2] citra_qt/multiplayer: Add `View Profile` option Adds an UI action to navigate to the user's profile located in Citra Community. --- src/citra_qt/multiplayer/chat_room.cpp | 59 ++++++++++++++++---------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/src/citra_qt/multiplayer/chat_room.cpp b/src/citra_qt/multiplayer/chat_room.cpp index 60a41c6b1..47eb2da2c 100644 --- a/src/citra_qt/multiplayer/chat_room.cpp +++ b/src/citra_qt/multiplayer/chat_room.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -411,34 +412,46 @@ void ChatRoom::PopupContextMenu(const QPoint& menu_location) { std::string nickname = player_list->item(item.row())->data(PlayerListItem::NicknameRole).toString().toStdString(); - if (auto room = Network::GetRoomMember().lock()) { - // You can't block, kick or ban yourself - if (nickname == room->GetNickname()) - return; - } QMenu context_menu; - QAction* block_action = context_menu.addAction(tr("Block Player")); - block_action->setCheckable(true); - block_action->setChecked(block_list.count(nickname) > 0); + QString username = player_list->item(item.row())->data(PlayerListItem::UsernameRole).toString(); + if (!username.isEmpty()) { + QAction* view_profile_action = context_menu.addAction(tr("View Profile")); + connect(view_profile_action, &QAction::triggered, [username] { + QDesktopServices::openUrl( + QString("https://community.citra-emu.org/u/%1").arg(username)); + }); + } - connect(block_action, &QAction::triggered, [this, nickname] { - if (block_list.count(nickname)) { - block_list.erase(nickname); - } else { - QMessageBox::StandardButton result = QMessageBox::question( - this, tr("Block Player"), - tr("When you block a player, you will no longer receive chat messages from " - "them.

Are you sure you would like to block %1?") - .arg(QString::fromStdString(nickname)), - QMessageBox::Yes | QMessageBox::No); - if (result == QMessageBox::Yes) - block_list.emplace(nickname); - } - }); + std::string cur_nickname; + if (auto room = Network::GetRoomMember().lock()) { + cur_nickname = room->GetNickname(); + } - if (has_mod_perms) { + if (nickname != cur_nickname) { // You can't block yourself + QAction* block_action = context_menu.addAction(tr("Block Player")); + + block_action->setCheckable(true); + block_action->setChecked(block_list.count(nickname) > 0); + + connect(block_action, &QAction::triggered, [this, nickname] { + if (block_list.count(nickname)) { + block_list.erase(nickname); + } else { + QMessageBox::StandardButton result = QMessageBox::question( + this, tr("Block Player"), + tr("When you block a player, you will no longer receive chat messages from " + "them.

Are you sure you would like to block %1?") + .arg(QString::fromStdString(nickname)), + QMessageBox::Yes | QMessageBox::No); + if (result == QMessageBox::Yes) + block_list.emplace(nickname); + } + }); + } + + if (has_mod_perms && nickname != cur_nickname) { // You can't kick or ban yourself context_menu.addSeparator(); QAction* kick_action = context_menu.addAction(tr("Kick"));