deskflow/src/lib/gui/validators/LineEditValidator.h
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

47 lines
1.4 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/>.
*/
#pragma once
#include "IStringValidator.h"
#include <QLabel>
#include <QLineEdit>
#include <QValidator>
#include <memory>
#include <vector>
#include "ValidationError.h"
namespace validators {
class LineEditValidator : public QValidator {
public:
explicit LineEditValidator(
QLineEdit *lineEdit = nullptr, ValidationError *error = nullptr);
QValidator::State validate(QString &input, int &pos) const override;
void addValidator(std::unique_ptr<IStringValidator> validator);
private:
ValidationError *m_pError = nullptr;
QLineEdit *m_pLineEdit = nullptr;
std::vector<std::unique_ptr<IStringValidator>> m_Validators;
void setError(const QString &message) const;
};
} // namespace validators