From b64eab204c801777f468fdf7dbf97956d81eede0 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Wed, 8 Feb 2017 18:00:53 -0500 Subject: [PATCH] Added custom notify user event (#2398) * Added custom notify user event. * Untabbify --- cockatrice/src/tab_supervisor.cpp | 14 ++++++++++++++ common/pb/event_notify_user.proto | 3 +++ 2 files changed, 17 insertions(+) diff --git a/cockatrice/src/tab_supervisor.cpp b/cockatrice/src/tab_supervisor.cpp index ae8f1e52..fd61cf56 100644 --- a/cockatrice/src/tab_supervisor.cpp +++ b/cockatrice/src/tab_supervisor.cpp @@ -587,6 +587,20 @@ void TabSupervisor::processNotifyUserEvent(const Event_NotifyUser &event) QMessageBox::warning(this, tr("Warned"), tr("You have received a warning due to %1.\nPlease refrain from engaging in this activity or further actions may be taken against you. If you have any questions, please private message a moderator.").arg(QString::fromStdString(event.warning_reason()).simplified())); break; } + case Event_NotifyUser::CUSTOM: { + if (!QString::fromStdString(event.custom_title()).simplified().isEmpty() && !QString::fromStdString(event.custom_content()).simplified().isEmpty()) { + QMessageBox msgBox; + msgBox.setParent(this); + msgBox.setWindowFlags(Qt::Dialog); + msgBox.setIcon(QMessageBox::Information); + msgBox.setWindowTitle(QString::fromStdString(event.custom_title()).simplified()); + msgBox.setText(tr("You have received the following message from the server.\n(custom messages like these could be untranslated)")); + msgBox.setDetailedText(QString::fromStdString(event.custom_content()).simplified()); + msgBox.setMinimumWidth(200); + msgBox.exec(); + } + break; + } default: ; } diff --git a/common/pb/event_notify_user.proto b/common/pb/event_notify_user.proto index 73df1ec2..5cda9578 100644 --- a/common/pb/event_notify_user.proto +++ b/common/pb/event_notify_user.proto @@ -8,6 +8,7 @@ message Event_NotifyUser { PROMOTED = 1; WARNING = 2; IDLEWARNING = 3; + CUSTOM = 4; } extend SessionEvent { @@ -15,5 +16,7 @@ message Event_NotifyUser { } optional NotificationType type = 1; optional string warning_reason = 2; + optional string custom_title = 3; + optional string custom_content = 4; }