summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/yuzu/configuration/configure_motion_touch.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp
index 68110c195..1c477f868 100644
--- a/src/yuzu/configuration/configure_motion_touch.cpp
+++ b/src/yuzu/configuration/configure_motion_touch.cpp
@@ -4,12 +4,15 @@
4 4
5#include <array> 5#include <array>
6#include <sstream> 6#include <sstream>
7
7#include <QCloseEvent> 8#include <QCloseEvent>
8#include <QLabel> 9#include <QLabel>
9#include <QMessageBox> 10#include <QMessageBox>
10#include <QPushButton> 11#include <QPushButton>
12#include <QRegularExpression>
11#include <QStringListModel> 13#include <QStringListModel>
12#include <QVBoxLayout> 14#include <QVBoxLayout>
15
13#include "common/logging/log.h" 16#include "common/logging/log.h"
14#include "core/settings.h" 17#include "core/settings.h"
15#include "input_common/main.h" 18#include "input_common/main.h"
@@ -186,14 +189,14 @@ void ConfigureMotionTouch::ConnectEvents() {
186 189
187void ConfigureMotionTouch::OnUDPAddServer() { 190void ConfigureMotionTouch::OnUDPAddServer() {
188 // Validator for IP address 191 // Validator for IP address
189 QRegExp re(QStringLiteral( 192 const QRegularExpression re(QStringLiteral(
190 R"re(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)re")); 193 R"re(^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$)re"));
191 bool ok; 194 bool ok;
192 QString port_text = ui->udp_port->text(); 195 const QString port_text = ui->udp_port->text();
193 QString server_text = ui->udp_server->text(); 196 const QString server_text = ui->udp_server->text();
194 const QString server_string = tr("%1:%2").arg(server_text, port_text); 197 const QString server_string = tr("%1:%2").arg(server_text, port_text);
195 int port_number = port_text.toInt(&ok, 10); 198 const int port_number = port_text.toInt(&ok, 10);
196 int row = udp_server_list_model->rowCount(); 199 const int row = udp_server_list_model->rowCount();
197 200
198 if (!ok) { 201 if (!ok) {
199 QMessageBox::warning(this, tr("yuzu"), tr("Port number has invalid characters")); 202 QMessageBox::warning(this, tr("yuzu"), tr("Port number has invalid characters"));
@@ -203,7 +206,7 @@ void ConfigureMotionTouch::OnUDPAddServer() {
203 QMessageBox::warning(this, tr("yuzu"), tr("Port has to be in range 0 and 65353")); 206 QMessageBox::warning(this, tr("yuzu"), tr("Port has to be in range 0 and 65353"));
204 return; 207 return;
205 } 208 }
206 if (!re.exactMatch(server_text)) { 209 if (!re.match(server_text).hasMatch()) {
207 QMessageBox::warning(this, tr("yuzu"), tr("IP address is not valid")); 210 QMessageBox::warning(this, tr("yuzu"), tr("IP address is not valid"));
208 return; 211 return;
209 } 212 }