11 changed files with 49 additions and 5 deletions
@ -0,0 +1,12 @@
|
||||
#include "filenamevalidator.hpp" |
||||
|
||||
#include <formatter.hpp> |
||||
#include <platformbackend.hpp> |
||||
|
||||
FilenameValidator::FilenameValidator(QObject *parent) : QValidator(parent) { |
||||
} |
||||
|
||||
QValidator::State FilenameValidator::validate(QString &input, int &) const { |
||||
QString name = formatter::format(input, "lol"); |
||||
return PlatformBackend::inst().filenameValid(name) ? State::Acceptable : State::Invalid; |
||||
} |
@ -0,0 +1,12 @@
|
||||
#ifndef FILENAMEVALIDATOR_HPP |
||||
#define FILENAMEVALIDATOR_HPP |
||||
|
||||
#include <QValidator> |
||||
|
||||
class FilenameValidator : public QValidator { |
||||
public: |
||||
FilenameValidator(QObject *parent = nullptr); |
||||
QValidator::State validate(QString &input, int &) const override; |
||||
}; |
||||
|
||||
#endif // FILENAMEVALIDATOR_HPP
|
Loading…
Reference in new issue