Added custom notify user event (#2398)
* Added custom notify user event. * Untabbify
This commit is contained in:
parent
0fdb9b7c83
commit
b64eab204c
2 changed files with 17 additions and 0 deletions
|
@ -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: ;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue