mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-27 16:32:20 -07:00
[Server/Client] Unify report categories (#7345)
* [Server/Client] Unify report categories into one shared source of truth * Lont. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
a1d8ce6165
commit
eae9591a17
8 changed files with 173 additions and 20 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/protocol/pb/command_report.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/utility/report_categories.h>
|
||||
|
||||
DlgReportUser::DlgReportUser(AbstractClient *_client,
|
||||
const QString &_reportedUser,
|
||||
|
|
@ -56,22 +57,14 @@ DlgReportUser::DlgReportUser(AbstractClient *_client,
|
|||
auto *categoryGrid = new QGridLayout(categoryGroup);
|
||||
|
||||
categoryBox = new QComboBox;
|
||||
categoryBox->addItem(tr("Cheating / Unsporting behavior"), "cheating");
|
||||
categoryBox->setItemData(categoryBox->count() - 1,
|
||||
tr("Using external tools, card marked manipulation, or exploiting game bugs"),
|
||||
Qt::ToolTipRole);
|
||||
categoryBox->addItem(tr("Harassment / Abuse"), "harassment");
|
||||
categoryBox->setItemData(categoryBox->count() - 1, tr("Threatening, bullying, or persistent unwanted contact"),
|
||||
Qt::ToolTipRole);
|
||||
categoryBox->addItem(tr("Hate speech"), "hate_speech");
|
||||
categoryBox->setItemData(categoryBox->count() - 1,
|
||||
tr("Discriminatory language targeting race, gender, religion, etc."), Qt::ToolTipRole);
|
||||
categoryBox->addItem(tr("Spam"), "spam");
|
||||
categoryBox->setItemData(categoryBox->count() - 1, tr("Repeated unwanted messages or advertisements"),
|
||||
Qt::ToolTipRole);
|
||||
categoryBox->addItem(tr("Other"), "other");
|
||||
categoryBox->setItemData(categoryBox->count() - 1, tr("Any behavior not covered by the above categories"),
|
||||
Qt::ToolTipRole);
|
||||
for (const QString &key : ReportCategories::keys()) {
|
||||
const QString label = categoryLabel(key);
|
||||
if (label.isEmpty()) {
|
||||
continue; // skip keys without a dialog label
|
||||
}
|
||||
categoryBox->addItem(label, key);
|
||||
categoryBox->setItemData(categoryBox->count() - 1, categoryToolTip(key), Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
categoryGrid->addWidget(new QLabel(tr("Category:")), 0, 0);
|
||||
categoryGrid->addWidget(categoryBox, 0, 1);
|
||||
|
|
@ -189,3 +182,55 @@ void DlgReportUser::reportResponse(const Response &response)
|
|||
QMessageBox::warning(this, tr("Submission Failed"), tr("Failed to submit report. Please try again."));
|
||||
}
|
||||
}
|
||||
|
||||
QString DlgReportUser::categoryLabel(const QString &key)
|
||||
{
|
||||
if (key == QLatin1String("cheating")) {
|
||||
return tr("Cheating / Unsporting behavior");
|
||||
}
|
||||
if (key == QLatin1String("bug_abuse")) {
|
||||
return tr("Bug Abuse");
|
||||
}
|
||||
if (key == QLatin1String("harassment")) {
|
||||
return tr("Harassment / Abuse");
|
||||
}
|
||||
if (key == QLatin1String("verbal_abuse")) {
|
||||
return tr("Verbal Abuse");
|
||||
}
|
||||
if (key == QLatin1String("hate_speech")) {
|
||||
return tr("Hate speech");
|
||||
}
|
||||
if (key == QLatin1String("spam")) {
|
||||
return tr("Spam");
|
||||
}
|
||||
if (key == QLatin1String("other")) {
|
||||
return tr("Other");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString DlgReportUser::categoryToolTip(const QString &key)
|
||||
{
|
||||
if (key == QLatin1String("cheating")) {
|
||||
return tr("Using external tools, cheat programs, or exploiting game bugs");
|
||||
}
|
||||
if (key == QLatin1String("bug_abuse")) {
|
||||
return tr("Exploiting a bug or glitch to gain an unfair advantage");
|
||||
}
|
||||
if (key == QLatin1String("harassment")) {
|
||||
return tr("Threatening, bullying, or persistent unwanted contact");
|
||||
}
|
||||
if (key == QLatin1String("verbal_abuse")) {
|
||||
return tr("Abusive or offensive language directed at another player");
|
||||
}
|
||||
if (key == QLatin1String("hate_speech")) {
|
||||
return tr("Discriminatory language targeting race, gender, religion, etc.");
|
||||
}
|
||||
if (key == QLatin1String("spam")) {
|
||||
return tr("Repeated unwanted messages or advertisements");
|
||||
}
|
||||
if (key == QLatin1String("other")) {
|
||||
return tr("Any behavior not covered by the above categories");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ private slots:
|
|||
void reportResponse(const Response &response);
|
||||
|
||||
private:
|
||||
static QString categoryLabel(const QString &key);
|
||||
static QString categoryToolTip(const QString &key);
|
||||
|
||||
AbstractClient *client;
|
||||
QString reportedUser;
|
||||
int gameId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue