/* * SPDX-License-Identifier: GPL-3.0-or-later * SPDX-FileCopyrightText: 2020 Johan Ouwerkerk */ #ifndef DATETIME_VALIDATOR_H #define DATETIME_VALIDATOR_H #include #include #include #include #include namespace validators { std::optional parseDateTime(const QString &input); class EpochValidator : public QValidator { Q_OBJECT public: explicit EpochValidator(const std::function clock = &QDateTime::currentMSecsSinceEpoch, QObject *parent = nullptr); void fixup(QString &input) const override; QValidator::State validate(QString &input, int &pos) const override; private: const std::function m_clock; }; } #endif