5#include <QtCore/QCoreApplication>
6#include <QtCore/QRegularExpression>
10 const auto tr = [](
const char* s) {
return QCoreApplication::translate(
"NTRIPConnectionConfig", s); };
13 return tr(
"No host address");
15 if (port <= 0 || port > 65535) {
16 return tr(
"Invalid port");
19 static const QRegularExpression controlChars(QStringLiteral(
"[\\x00-\\x1f\\x7f]"));
20 if (
host.contains(controlChars)) {
21 return tr(
"Invalid host (contains control characters)");
23 if (
host.contains(QLatin1Char(
' '))) {
24 return tr(
"Invalid host (contains spaces)");
27 return tr(
"Invalid mountpoint name (contains control characters)");
29 if (std::ranges::any_of(
mountpoint, [](QChar c) {
return c.isSpace(); })) {
30 return tr(
"Invalid mountpoint name (contains spaces)");
33 if (
username.contains(QLatin1Char(
':'))) {
34 return tr(
"Invalid username (must not contain ':')");
46 return QCoreApplication::translate(
"NTRIPConnectionConfig",
"Select a mountpoint before connecting");
54 url.setScheme(
useTls ? QStringLiteral(
"https") : QStringLiteral(
"http"));
57 url.setPath(QLatin1Char(
'/') + (withMountpoint ?
mountpoint : QString()));
69 "Credentials are being sent without TLS encryption.")
QString streamValidationError() const
bool sendsCredentialsInClear() const
Credentials go to the caster without TLS.
QString credentialsInClearWarning() const
The user-visible warning when credentials go to the caster without TLS; empty otherwise.
QUrl url(bool withMountpoint=true) const
The caster's HTTP(S) URL, with the mountpoint as its path when withMountpoint is set,...
QString validationError() const