RegExp validators fix

This commit is contained in:
pokamest 2021-12-25 23:01:53 +03:00
parent 68a51c9c63
commit 9943e081d9
7 changed files with 19 additions and 18 deletions

View file

@ -5,7 +5,7 @@
NetworkSettingsLogic::NetworkSettingsLogic(UiLogic *logic, QObject *parent):
PageLogicBase(logic, parent),
m_ipAddressValidatorRegex{Utils::ipAddressRegExp().pattern()}
m_ipAddressRegex{Utils::ipAddressRegExp()}
{
}
@ -18,16 +18,14 @@ void NetworkSettingsLogic::onUpdatePage()
void NetworkSettingsLogic::onLineEditDns1EditFinished(const QString &text)
{
QRegExp reg{getIpAddressValidatorRegex()};
if (reg.exactMatch(text)) {
if (ipAddressRegex().exactMatch(text)) {
m_settings.setPrimaryDns(text);
}
}
void NetworkSettingsLogic::onLineEditDns2EditFinished(const QString &text)
{
QRegExp reg{getIpAddressValidatorRegex()};
if (reg.exactMatch(text)) {
if (ipAddressRegex().exactMatch(text)) {
m_settings.setSecondaryDns(text);
}
}
@ -43,8 +41,3 @@ void NetworkSettingsLogic::onPushButtonResetDns2Clicked()
m_settings.setSecondaryDns(m_settings.cloudFlareNs2);
onUpdatePage();
}
QString NetworkSettingsLogic::getIpAddressValidatorRegex() const
{
return m_ipAddressValidatorRegex;
}