Fix player list not showing in lobby. Fix host and direct connect crashing citra
This commit is contained in:
parent
01b49b7e78
commit
2be02f221d
11 changed files with 68 additions and 31 deletions
|
@ -9,36 +9,40 @@
|
|||
|
||||
class Validation {
|
||||
public:
|
||||
static Validation get() {
|
||||
static Validation validation;
|
||||
return validation;
|
||||
}
|
||||
|
||||
~Validation() {
|
||||
delete room_name;
|
||||
delete nickname;
|
||||
delete ip;
|
||||
delete port;
|
||||
Validation()
|
||||
: room_name(room_name_regex), nickname(nickname_regex), ip(ip_regex), port(0, 65535) {}
|
||||
|
||||
~Validation() = default;
|
||||
|
||||
const QValidator* GetRoomName() const {
|
||||
return &room_name;
|
||||
}
|
||||
const QValidator* GetNickname() const {
|
||||
return &nickname;
|
||||
}
|
||||
const QValidator* GetIP() const {
|
||||
return &ip;
|
||||
}
|
||||
const QValidator* GetPort() const {
|
||||
return &port;
|
||||
}
|
||||
|
||||
private:
|
||||
/// room name can be alphanumeric and " " "_" "." and "-"
|
||||
QRegExp room_name_regex = QRegExp("^[a-zA-Z0-9._- ]+$");
|
||||
const QValidator* room_name = new QRegExpValidator(room_name_regex);
|
||||
QRegExpValidator room_name;
|
||||
|
||||
/// nickname can be alphanumeric and " " "_" "." and "-"
|
||||
QRegExp nickname_regex = QRegExp("^[a-zA-Z0-9._- ]+$");
|
||||
const QValidator* nickname = new QRegExpValidator(nickname_regex);
|
||||
QRegExpValidator nickname;
|
||||
|
||||
/// ipv4 address only
|
||||
// TODO remove this when we support hostnames in direct connect
|
||||
QRegExp ip_regex = QRegExp(
|
||||
"(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|"
|
||||
"2[0-4][0-9]|25[0-5])");
|
||||
const QValidator* ip = new QRegExpValidator(ip_regex);
|
||||
QRegExpValidator ip;
|
||||
|
||||
/// port must be between 0 and 65535
|
||||
const QValidator* port = new QIntValidator(0, 65535);
|
||||
|
||||
private:
|
||||
Validation() = default;
|
||||
QIntValidator port;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue