Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 28 lines (21 sloc) 0.616 kb
85a7158 raptorswing Initial project file commit
authored
1 #include "PortEntryValidator.h"
2
3 #include <QStringList>
4
5 PortEntryValidator::PortEntryValidator(QObject *parent) :
6 QValidator(parent)
7 {
8 }
9
10 QValidator::State PortEntryValidator::validate(QString &input, int &pos) const
11 {
12 Q_UNUSED(pos)
13 input.remove(QRegExp("[^,0123456789]"));
14
15 QStringList ports = input.split(QChar(','),QString::SkipEmptyParts);
16 foreach (QString sub, ports)
17 {
18 if (sub.length() > 5)
19 return QValidator::Invalid;
20
21 quint32 val = sub.toUInt();
22 if (val > 65535)
23 return QValidator::Invalid;
24 }
25
26 return QValidator::Acceptable;
27 }
Something went wrong with that request. Please try again.