implement max lengths for input dialogs that are sent to the server (#4522)

* implement max lengths for input dialogs that are sent to the server

* missed a double setMaxLength

* implement max string lengths server side

* add custom getText dialog with max length

* fix deck storage tab and miscellaneous server side

* add max size for deck uploads

* final pass on client side limits
This commit is contained in:
ebbit1q 2022-01-16 23:57:01 +01:00 committed by GitHub
parent d61c604bf4
commit 994704d353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 564 additions and 348 deletions

View file

@ -10,6 +10,7 @@
#include "deck_loader.h"
#include "dlg_create_token.h"
#include "gamescene.h"
#include "gettextwithmax.h"
#include "handcounter.h"
#include "handzone.h"
#include "main.h"
@ -56,6 +57,7 @@
#include "playertarget.h"
#include "settingscache.h"
#include "stackzone.h"
#include "stringsizes.h"
#include "tab_game.h"
#include "tablezone.h"
#include "thememanager.h"
@ -3034,8 +3036,8 @@ void Player::actSetPT()
}
bool ok;
dialogSemaphore = true;
QString pt = QInputDialog::getText(game, tr("Change power/toughness"), tr("Change stats to:"), QLineEdit::Normal,
oldPT, &ok);
QString pt =
getTextWithMax(game, tr("Change power/toughness"), tr("Change stats to:"), QLineEdit::Normal, oldPT, &ok);
dialogSemaphore = false;
if (clearCardsToDelete() || !ok) {
return;
@ -3141,7 +3143,8 @@ void Player::actSetAnnotation()
bool ok;
dialogSemaphore = true;
QString annotation = QInputDialog::getMultiLineText(game, tr("Set annotation"),
tr("Please enter the new annotation:"), oldAnnotation, &ok);
tr("Please enter the new annotation:"), oldAnnotation, &ok)
.left(MAX_NAME_LENGTH);
dialogSemaphore = false;
if (clearCardsToDelete() || !ok) {
return;