Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7410 from Techjar/netplay-max-name-length
NetPlay: Limit nickname length
- Loading branch information
Showing
10 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Source/Core/DolphinQt/QtUtils/UTF8CodePointCountValidator.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2020 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "DolphinQt/QtUtils/UTF8CodePointCountValidator.h" | ||
|
||
#include "Common/StringUtil.h" | ||
|
||
UTF8CodePointCountValidator::UTF8CodePointCountValidator(int max_count, QObject* parent) | ||
: QValidator(parent), m_max_count(max_count) | ||
{ | ||
} | ||
|
||
QValidator::State UTF8CodePointCountValidator::validate(QString& input, int& pos) const | ||
{ | ||
if (StringUTF8CodePointCount(input.toStdString()) > m_max_count) | ||
return QValidator::Invalid; | ||
|
||
return QValidator::Acceptable; | ||
} |
19 changes: 19 additions & 0 deletions
19
Source/Core/DolphinQt/QtUtils/UTF8CodePointCountValidator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2020 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#include <QString> | ||
#include <QValidator> | ||
|
||
class UTF8CodePointCountValidator : public QValidator | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit UTF8CodePointCountValidator(int max_count, QObject* parent = nullptr); | ||
|
||
QValidator::State validate(QString& input, int& pos) const override; | ||
|
||
int m_max_count; | ||
}; |