mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-24 02:00:24 +07:00
chore: add tr to nextAvailableServerName
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
@@ -206,16 +205,14 @@ QString SecureServersRepository::nextAvailableServerName() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QRegularExpression serverNameRe(QStringLiteral("^Server (\\d+)$"));
|
int i = 0;
|
||||||
int maxN = 0;
|
QString candidate;
|
||||||
for (const QString &name : std::as_const(usedNames)) {
|
do {
|
||||||
const QRegularExpressionMatch match = serverNameRe.match(name);
|
++i;
|
||||||
if (match.hasMatch()) {
|
candidate = tr("Server") + QLatin1Char(' ') + QString::number(i);
|
||||||
maxN = std::max(maxN, match.captured(1).toInt());
|
} while (usedNames.contains(candidate));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QStringLiteral("Server %1").arg(maxN + 1);
|
return candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SecureServersRepository::addServer(const QString &serverId, const QJsonObject &serverJson, serverConfigUtils::ConfigType kind)
|
QString SecureServersRepository::addServer(const QString &serverId, const QJsonObject &serverJson, serverConfigUtils::ConfigType kind)
|
||||||
|
|||||||
Reference in New Issue
Block a user