TorInfoDialog: validate port

This commit is contained in:
tobtoht 2021-07-03 00:56:17 +02:00
parent 801041aeaa
commit 2d07483577
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C

View file

@ -8,6 +8,7 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QPushButton>
#include <QRegularExpressionValidator>
#include "utils/ColorScheme.h"
#include "utils/Icons.h"
@ -37,6 +38,9 @@ TorInfoDialog::TorInfoDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
initPrivacyLevel();
onConnectionStatusChanged(torManager()->torConnected);
auto *portValidator = new QRegularExpressionValidator{QRegularExpression("[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]")};
ui->line_port->setValidator(portValidator);
connect(torManager(), &TorManager::connectionStateChanged, this, &TorInfoDialog::onConnectionStatusChanged);
connect(torManager(), &TorManager::logsUpdated, this, &TorInfoDialog::onLogsUpdated);