Files
deskflow/src/lib/gui/validators/ComputerNameValidator.cpp
Nick Bolton ef186d398d Improve setting enable logic and test coverage (#7430)
* Rename controls and improve setting enable logic

* Move settings dialog to new lib

* Rename dialog to dialogs

* Include .ui files for GUI lib and include autogen headers in exe

* Unit test settings dialog

* Fix lint errors

* Update ChangeLog

* Fixed test name

* Add debug messages

* Tweak message

* Logging for CI issue

* Revert "Logging for CI issue"

This reverts commit 124b2c1acd778f1e422057e203436582fe12d147.

* Revert "Add debug messages"

This reverts commit 39b6a06c716965e0a8199bf34b6652861874cb28.

* Add Windows compiler error

* Exclude test on Windows
2024-08-09 09:08:29 +01:00

36 lines
1.1 KiB
C++

/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2021 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ComputerNameValidator.h"
#include <QRegularExpression>
namespace validators {
ComputerNameValidator::ComputerNameValidator(const QString &message)
: IStringValidator(message) {}
bool ComputerNameValidator::validate(const QString &input) const {
const QRegularExpression re(
"^[\\w\\._-]{0,255}$", QRegularExpression::CaseInsensitiveOption);
auto match = re.match(input);
auto result = match.hasMatch();
return result;
}
} // namespace validators