mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 15:22:45 +01:00
Merge pull request #5343 from lioncash/qt6
configure_motion_touch: Migrate off QRegExp to QRegularExpression
This commit is contained in:
commit
f1e278c30f
1 changed files with 9 additions and 6 deletions
|
@ -4,12 +4,15 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
|
@ -186,14 +189,14 @@ void ConfigureMotionTouch::ConnectEvents() {
|
||||||
|
|
||||||
void ConfigureMotionTouch::OnUDPAddServer() {
|
void ConfigureMotionTouch::OnUDPAddServer() {
|
||||||
// Validator for IP address
|
// Validator for IP address
|
||||||
QRegExp re(QStringLiteral(
|
const QRegularExpression re(QStringLiteral(
|
||||||
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"));
|
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"));
|
||||||
bool ok;
|
bool ok;
|
||||||
QString port_text = ui->udp_port->text();
|
const QString port_text = ui->udp_port->text();
|
||||||
QString server_text = ui->udp_server->text();
|
const QString server_text = ui->udp_server->text();
|
||||||
const QString server_string = tr("%1:%2").arg(server_text, port_text);
|
const QString server_string = tr("%1:%2").arg(server_text, port_text);
|
||||||
int port_number = port_text.toInt(&ok, 10);
|
const int port_number = port_text.toInt(&ok, 10);
|
||||||
int row = udp_server_list_model->rowCount();
|
const int row = udp_server_list_model->rowCount();
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
QMessageBox::warning(this, tr("yuzu"), tr("Port number has invalid characters"));
|
QMessageBox::warning(this, tr("yuzu"), tr("Port number has invalid characters"));
|
||||||
|
@ -203,7 +206,7 @@ void ConfigureMotionTouch::OnUDPAddServer() {
|
||||||
QMessageBox::warning(this, tr("yuzu"), tr("Port has to be in range 0 and 65353"));
|
QMessageBox::warning(this, tr("yuzu"), tr("Port has to be in range 0 and 65353"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!re.exactMatch(server_text)) {
|
if (!re.match(server_text).hasMatch()) {
|
||||||
QMessageBox::warning(this, tr("yuzu"), tr("IP address is not valid"));
|
QMessageBox::warning(this, tr("yuzu"), tr("IP address is not valid"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue