Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DolphinQt / InputCommon - add DSU string validator to avoid crashes, …
…limited backwards compatibility support
- Loading branch information
Showing
8 changed files
with
86 additions
and
0 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
23 changes: 23 additions & 0 deletions
23
Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.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,23 @@ | ||
// Copyright 2020 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "DolphinQt/Config/ControllerInterface/ServerStringValidator.h" | ||
|
||
ServerStringValidator::ServerStringValidator(QObject* parent) : QValidator(parent) | ||
{ | ||
} | ||
|
||
QValidator::State ServerStringValidator::validate(QString& input, int& pos) const | ||
{ | ||
if (input.isEmpty()) | ||
return Invalid; | ||
|
||
if (input.contains(QStringLiteral(":"))) | ||
return Invalid; | ||
|
||
if (input.contains(QStringLiteral(";"))) | ||
return Invalid; | ||
|
||
return Acceptable; | ||
} |
16 changes: 16 additions & 0 deletions
16
Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.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,16 @@ | ||
// Copyright 2020 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#include <QValidator> | ||
|
||
class ServerStringValidator : public QValidator | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ServerStringValidator(QObject* parent); | ||
|
||
State validate(QString& input, int& pos) const override; | ||
}; |
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