mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-03-16 10:38:32 +01:00
qt: Update moderation UI visibility in chat room
This commit is contained in:
parent
c14206640b
commit
d63c7948ba
@ -459,12 +459,15 @@ void ChatRoom::PopupContextMenu(const QPoint& menu_location) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_mod_perms && nickname != cur_nickname) { // You can't kick or ban yourself
|
if (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"));
|
||||||
QAction* ban_action = context_menu.addAction(tr("Ban"));
|
QAction* ban_action = context_menu.addAction(tr("Ban"));
|
||||||
|
|
||||||
|
kick_action->setEnabled(has_mod_perms);
|
||||||
|
ban_action->setEnabled(has_mod_perms);
|
||||||
|
|
||||||
connect(kick_action, &QAction::triggered, [this, nickname] {
|
connect(kick_action, &QAction::triggered, [this, nickname] {
|
||||||
QMessageBox::StandardButton result =
|
QMessageBox::StandardButton result =
|
||||||
QMessageBox::question(this, tr("Kick Player"),
|
QMessageBox::question(this, tr("Kick Player"),
|
||||||
|
@ -47,8 +47,6 @@ ClientRoomWindow::ClientRoomWindow(QWidget* parent)
|
|||||||
ModerationDialog dialog(this);
|
ModerationDialog dialog(this);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
});
|
});
|
||||||
ui->moderation->setDefault(false);
|
|
||||||
ui->moderation->setAutoDefault(false);
|
|
||||||
connect(ui->chat, &ChatRoom::UserPinged, this, &ClientRoomWindow::ShowNotification);
|
connect(ui->chat, &ChatRoom::UserPinged, this, &ClientRoomWindow::ShowNotification);
|
||||||
UpdateView();
|
UpdateView();
|
||||||
}
|
}
|
||||||
@ -57,9 +55,7 @@ ClientRoomWindow::~ClientRoomWindow() = default;
|
|||||||
|
|
||||||
void ClientRoomWindow::SetModPerms(bool is_mod) {
|
void ClientRoomWindow::SetModPerms(bool is_mod) {
|
||||||
ui->chat->SetModPerms(is_mod);
|
ui->chat->SetModPerms(is_mod);
|
||||||
ui->moderation->setVisible(is_mod);
|
ui->moderation->setEnabled(is_mod);
|
||||||
ui->moderation->setDefault(false);
|
|
||||||
ui->moderation->setAutoDefault(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientRoomWindow::RetranslateUi() {
|
void ClientRoomWindow::RetranslateUi() {
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<string>Moderation...</string>
|
<string>Moderation...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="visible">
|
<property name="visible">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user