atrooney-online-2/src/moderation_functions.cpp
Salanto fb64ca386c
Add playerlist widget element (#996)
* Commit

* Boyfailure code commit

* Cooking code spaghetti

* Accidental overwrite recursive function call hell

* Implemented player list

* Add partial moderator widget

Sleepy time! Hee-Hoo!

* Moderator Dialog - Step 1 - WIP

* Appease the clang gods

* Clang appeasement policy

* *sacrifices goat to clang*

* Added player report, reworked implementation, ...

* Added player-specific report
* Reworked implementation
  * No longer uses JSON.
* Removed preset loader.

---------

Co-authored-by: TrickyLeifa <date.epoch@gmail.com>
Co-authored-by: Leifa <26681464+TrickyLeifa@users.noreply.github.com>
2024-07-12 11:48:01 +02:00

42 lines
874 B
C++

#include "moderation_functions.h"
#include <QInputDialog>
#include <QMessageBox>
#include <QObject>
std::optional<QString> call_moderator_support(QString title)
{
if (title.isEmpty())
{
title = QObject::tr("Call moderator");
}
else
{
title = QObject::tr("Call moderator: %1").arg(title);
}
QInputDialog input;
input.setLabelText(QObject::tr("Reason:"));
input.setWindowFlags(Qt::WindowSystemMenuHint);
input.setWindowTitle(title);
while (input.exec())
{
QString text = input.textValue();
if (text.isEmpty())
{
QMessageBox::critical(&input, QObject::tr("Error"), QObject::tr("Please, enter a reason."));
}
else if (text.length() > 255)
{
QMessageBox::critical(&input, QObject::tr("Error"), QObject::tr("Reason is too long."));
}
else
{
return text;
}
}
return std::nullopt;
}