Merge remote-tracking branch 'origin/dev' into ios-wireguard
This commit is contained in:
commit
7c46e42820
16 changed files with 92 additions and 39 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
NetworkSettingsLogic::NetworkSettingsLogic(UiLogic *logic, QObject *parent):
|
||||
PageLogicBase(logic, parent),
|
||||
m_ipAddressValidatorRegex{Utils::ipAddressRegExp().pattern()}
|
||||
m_ipAddressRegex{Utils::ipAddressRegExp()}
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -18,16 +18,14 @@ void NetworkSettingsLogic::onUpdatePage()
|
|||
|
||||
void NetworkSettingsLogic::onLineEditDns1EditFinished(const QString &text)
|
||||
{
|
||||
QRegExp reg{getIpAddressValidatorRegex()};
|
||||
if (reg.exactMatch(text)) {
|
||||
if (ipAddressRegex().exactMatch(text)) {
|
||||
m_settings.setPrimaryDns(text);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkSettingsLogic::onLineEditDns2EditFinished(const QString &text)
|
||||
{
|
||||
QRegExp reg{getIpAddressValidatorRegex()};
|
||||
if (reg.exactMatch(text)) {
|
||||
if (ipAddressRegex().exactMatch(text)) {
|
||||
m_settings.setSecondaryDns(text);
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +41,3 @@ void NetworkSettingsLogic::onPushButtonResetDns2Clicked()
|
|||
m_settings.setSecondaryDns(m_settings.cloudFlareNs2);
|
||||
onUpdatePage();
|
||||
}
|
||||
|
||||
QString NetworkSettingsLogic::getIpAddressValidatorRegex() const
|
||||
{
|
||||
return m_ipAddressValidatorRegex;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class NetworkSettingsLogic : public PageLogicBase
|
|||
|
||||
AUTO_PROPERTY(QString, lineEditDns1Text)
|
||||
AUTO_PROPERTY(QString, lineEditDns2Text)
|
||||
READONLY_PROPERTY(QString, ipAddressValidatorRegex)
|
||||
READONLY_PROPERTY(QRegExp, ipAddressRegex)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void onUpdatePage() override;
|
||||
|
@ -25,6 +25,5 @@ public:
|
|||
explicit NetworkSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~NetworkSettingsLogic() = default;
|
||||
|
||||
QString getIpAddressValidatorRegex() const;
|
||||
};
|
||||
#endif // NETWORK_SETTINGS_LOGIC_H
|
||||
|
|
|
@ -50,9 +50,6 @@ void QrDecoderLogic::onDetectedQrCode(const QString &code)
|
|||
s >> m_chunks[chunkId];
|
||||
set_receivedChunksCount(m_chunks.size());
|
||||
|
||||
qDebug() << "Received chunks:" << receivedChunksCount() << "/" << chunksCount << "cur" << chunkId << m_chunks[chunkId].size();
|
||||
qDebug() << chunkId << m_chunks[chunkId];
|
||||
|
||||
if (m_chunks.size() == totalChunksCount()) {
|
||||
QByteArray data;
|
||||
for (int i = 0; i < totalChunksCount(); ++i) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <QImage>
|
||||
#include <QDataStream>
|
||||
#include <QZXing>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ShareConnectionLogic.h"
|
||||
|
||||
|
@ -15,6 +16,7 @@
|
|||
|
||||
#include "defines.h"
|
||||
#include "core/defs.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include <functional>
|
||||
|
||||
#include "../uilogic.h"
|
||||
|
@ -194,6 +196,12 @@ void ShareConnectionLogic::onPushButtonShareWireGuardGenerateClicked()
|
|||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
QString cfg = WireguardConfigurator::genWireguardConfig(credentials, container, containerConfig, &e);
|
||||
if (e) {
|
||||
QMessageBox::warning(nullptr, APPLICATION_NAME,
|
||||
tr("Error occurred while configuring server.") + "\n" +
|
||||
errorString(e));
|
||||
return;
|
||||
}
|
||||
cfg = VpnConfigurator::processConfigWithExportSettings(container, Proto::WireGuard, cfg);
|
||||
cfg = QJsonDocument::fromJson(cfg.toUtf8()).object()[config_key::config].toString();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "core/errorstrings.h"
|
||||
#include "configurators/ssh_configurator.h"
|
||||
#include "../uilogic.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
|
@ -23,7 +24,8 @@ StartPageLogic::StartPageLogic(UiLogic *logic, QObject *parent):
|
|||
m_labelWaitInfoVisible{true},
|
||||
m_labelWaitInfoText{},
|
||||
m_pushButtonBackFromStartVisible{true},
|
||||
m_pushButtonConnectVisible{true}
|
||||
m_pushButtonConnectVisible{true},
|
||||
m_ipAddressPortRegex{Utils::ipAddressPortRegExp()}
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ class StartPageLogic : public PageLogicBase
|
|||
AUTO_PROPERTY(bool, pushButtonBackFromStartVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonConnectVisible)
|
||||
|
||||
READONLY_PROPERTY(QRegExp, ipAddressPortRegex)
|
||||
public:
|
||||
Q_INVOKABLE void onUpdatePage() override;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ PageBase {
|
|||
NetworkSettingsLogic.onLineEditDns1EditFinished(text)
|
||||
}
|
||||
validator: RegExpValidator {
|
||||
regExp: NetworkSettingsLogic.ipAddressValidatorRegex
|
||||
regExp: NetworkSettingsLogic.ipAddressRegex
|
||||
}
|
||||
}
|
||||
ImageButtonType {
|
||||
|
@ -74,7 +74,7 @@ PageBase {
|
|||
NetworkSettingsLogic.onLineEditDns2EditFinished(text)
|
||||
}
|
||||
validator: RegExpValidator {
|
||||
regExp: NetworkSettingsLogic.ipAddressValidatorRegex
|
||||
regExp: NetworkSettingsLogic.ipAddressRegex
|
||||
}
|
||||
}
|
||||
ImageButtonType {
|
||||
|
|
|
@ -186,7 +186,7 @@ PageBase {
|
|||
id: label_server_ip
|
||||
x: 40
|
||||
anchors.top: new_sever_get_info.bottom
|
||||
text: qsTr("Server IP address")
|
||||
text: qsTr("Server IP address [:port]")
|
||||
}
|
||||
TextFieldType {
|
||||
id: new_server_ip
|
||||
|
@ -196,6 +196,10 @@ PageBase {
|
|||
onEditingFinished: {
|
||||
StartPageLogic.lineEditIpText = text
|
||||
}
|
||||
|
||||
validator: RegExpValidator {
|
||||
regExp: StartPageLogic.ipAddressPortRegex
|
||||
}
|
||||
}
|
||||
|
||||
LabelType {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue