aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/playerlistwidget.cpp
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2025-05-08 21:21:37 +0200
committerGitHub <noreply@github.com>2025-05-08 14:21:37 -0500
commit4db979187386326df64b9359b8de5e90468f7fc3 (patch)
tree802d5654730a20bf4ebfb12d38b26b5f4caac192 /src/widgets/playerlistwidget.cpp
parentcde34538dc6045223c965958535218a38d22b2ee (diff)
Close punishment dialog when the user leaves (#1097)
* Close punishment dialog when the user leaves Prevents silly moments where the wrong person gets banned/kicked * Fix formatting --------- Co-authored-by: stonedDiscord <Tukz@gmx.de>
Diffstat (limited to 'src/widgets/playerlistwidget.cpp')
-rw-r--r--src/widgets/playerlistwidget.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/widgets/playerlistwidget.cpp b/src/widgets/playerlistwidget.cpp
index c2c65574..04147b82 100644
--- a/src/widgets/playerlistwidget.cpp
+++ b/src/widgets/playerlistwidget.cpp
@@ -117,6 +117,7 @@ void PlayerListWidget::onCustomContextMenuRequested(const QPoint &pos)
ModeratorDialog *dialog = new ModeratorDialog(id, false, ao_app);
dialog->setWindowTitle(tr("Kick %1").arg(name));
connect(this, &PlayerListWidget::destroyed, dialog, &ModeratorDialog::deleteLater);
+ active_moderator_menu = {id, dialog};
dialog->show();
});
@@ -125,6 +126,7 @@ void PlayerListWidget::onCustomContextMenuRequested(const QPoint &pos)
ModeratorDialog *dialog = new ModeratorDialog(id, true, ao_app);
dialog->setWindowTitle(tr("Ban %1").arg(name));
connect(this, &PlayerListWidget::destroyed, dialog, &ModeratorDialog::deleteLater);
+ active_moderator_menu = {id, dialog};
dialog->show();
});
}
@@ -143,6 +145,12 @@ void PlayerListWidget::addPlayer(int playerId)
void PlayerListWidget::removePlayer(int playerId)
{
+ if (active_moderator_menu.first == playerId && active_moderator_menu.second)
+ {
+ delete active_moderator_menu.second;
+ Q_EMIT notify("Closed Moderation Dialog : User left the server.");
+ }
+
delete takeItem(row(m_item_map.take(playerId)));
m_player_map.remove(playerId);
}