mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-26 13:16:58 +00:00
citra_qt/multiplayer: Add View Profile
option
Adds an UI action to navigate to the user's profile located in Citra Community.
This commit is contained in:
parent
4df4b90795
commit
7a379ee03a
|
@ -5,6 +5,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
@ -411,13 +412,24 @@ void ChatRoom::PopupContextMenu(const QPoint& menu_location) {
|
||||||
|
|
||||||
std::string nickname =
|
std::string nickname =
|
||||||
player_list->item(item.row())->data(PlayerListItem::NicknameRole).toString().toStdString();
|
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;
|
QMenu context_menu;
|
||||||
|
|
||||||
|
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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string cur_nickname;
|
||||||
|
if (auto room = Network::GetRoomMember().lock()) {
|
||||||
|
cur_nickname = room->GetNickname();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nickname != cur_nickname) { // You can't block yourself
|
||||||
QAction* block_action = context_menu.addAction(tr("Block Player"));
|
QAction* block_action = context_menu.addAction(tr("Block Player"));
|
||||||
|
|
||||||
block_action->setCheckable(true);
|
block_action->setCheckable(true);
|
||||||
|
@ -437,8 +449,9 @@ void ChatRoom::PopupContextMenu(const QPoint& menu_location) {
|
||||||
block_list.emplace(nickname);
|
block_list.emplace(nickname);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (has_mod_perms) {
|
if (has_mod_perms && nickname != cur_nickname) { // You can't kick or ban yourself
|
||||||
context_menu.addSeparator();
|
context_menu.addSeparator();
|
||||||
|
|
||||||
QAction* kick_action = context_menu.addAction(tr("Kick"));
|
QAction* kick_action = context_menu.addAction(tr("Kick"));
|
||||||
|
|
Loading…
Reference in a new issue