Merge remote-tracking branch 'remotes/origin/dev' into feature/new-gui
This commit is contained in:
commit
d0c9c1043c
179 changed files with 3824 additions and 4107 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#include "AppSettingsLogic.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "ui/qautostart.h"
|
||||
#include "ui/uilogic.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "core/servercontroller.h"
|
||||
#include "ui/models/clientManagementModel.h"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "core/servercontroller.h"
|
||||
#include "ui/pages_logic/ClientInfoLogic.h"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "NetworkSettingsLogic.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "utilities.h"
|
||||
#include "settings.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "ServerConfiguringProgressLogic.h"
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include <QTimer>
|
||||
#include <QEventLoop>
|
||||
|
|
|
|||
|
|
@ -100,6 +100,11 @@ void ServerSettingsLogic::onLineEditDescriptionEditingFinished()
|
|||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
||||
bool ServerSettingsLogic::isCurrentServerHasCredentials()
|
||||
{
|
||||
return m_settings->haveAuthData(uiLogic()->m_selectedServerIndex);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
/* Auth result handler for Android */
|
||||
void authResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QJniObject &data)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public:
|
|||
Q_INVOKABLE void onPushButtonClearClientCacheClicked();
|
||||
Q_INVOKABLE void onLineEditDescriptionEditingFinished();
|
||||
|
||||
Q_INVOKABLE bool isCurrentServerHasCredentials();
|
||||
|
||||
public:
|
||||
explicit ServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~ServerSettingsLogic() = default;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include "configurators/ikev2_configurator.h"
|
||||
#include "configurators/ssh_configurator.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "core/defs.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "core/servercontroller.h"
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void StartPageLogic::onPushButtonImportOpenFile()
|
|||
file.open(QIODevice::ReadOnly);
|
||||
QByteArray data = file.readAll();
|
||||
|
||||
selectConfigFormat(QString(data));
|
||||
importAnyFile(QString(data));
|
||||
}
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
|
|
@ -202,7 +202,7 @@ void StartPageLogic::startQrDecoder()
|
|||
}
|
||||
#endif
|
||||
|
||||
void StartPageLogic::selectConfigFormat(QString configData)
|
||||
void StartPageLogic::importAnyFile(const QString &configData)
|
||||
{
|
||||
auto configFormat = checkConfigFormat(configData);
|
||||
if (configFormat == ConfigTypes::OpenVpn) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class StartPageLogic : public PageLogicBase
|
|||
AUTO_PROPERTY(QString, labelWaitInfoText)
|
||||
AUTO_PROPERTY(bool, pushButtonBackFromStartVisible)
|
||||
|
||||
AUTO_PROPERTY(QString, privateKeyPassphrase);
|
||||
AUTO_PROPERTY(QString, privateKeyPassphrase)
|
||||
|
||||
READONLY_PROPERTY(QRegularExpression, ipAddressPortRegex)
|
||||
public:
|
||||
|
|
@ -37,7 +37,7 @@ public:
|
|||
Q_INVOKABLE void startQrDecoder();
|
||||
#endif
|
||||
|
||||
void selectConfigFormat(QString configData);
|
||||
void importAnyFile(const QString &configData);
|
||||
|
||||
bool importConnection(const QJsonObject &profile);
|
||||
bool importConnectionFromCode(QString code);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <QTimer>
|
||||
#include <functional>
|
||||
#include "../uilogic.h"
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include <configurators/vpn_configurator.h>
|
||||
|
||||
|
||||
|
|
@ -80,7 +80,6 @@ void VpnLogic::onUpdatePage()
|
|||
set_labelCurrentDns(dns.first + ", " + dns.second);
|
||||
}
|
||||
|
||||
|
||||
set_isContainerSupportedByCurrentPlatform(ContainerProps::isSupportedByCurrentPlatform(selectedContainer));
|
||||
if (!isContainerSupportedByCurrentPlatform()) {
|
||||
set_labelErrorText(tr("AmneziaVPN not supporting selected protocol on this device. Select another protocol."));
|
||||
|
|
|
|||
|
|
@ -13,12 +13,18 @@ Popup {
|
|||
|
||||
anchors.centerIn: Overlay.overlay
|
||||
modal: true
|
||||
closePolicy: Popup.NoAutoClose
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
|
||||
width: parent.width - 20
|
||||
focus: true
|
||||
|
||||
onAboutToHide: {
|
||||
parent.forceActiveFocus(true)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
|
||||
Text {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -28,9 +34,9 @@ Popup {
|
|||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
BlueButtonType {
|
||||
id: yesButton
|
||||
Layout.preferredWidth: parent.width / 2
|
||||
Layout.fillWidth: true
|
||||
text: yesText
|
||||
onClicked: {
|
||||
|
|
@ -43,7 +49,6 @@ Popup {
|
|||
}
|
||||
BlueButtonType {
|
||||
id: noButton
|
||||
Layout.preferredWidth: parent.width / 2
|
||||
Layout.fillWidth: true
|
||||
text: noText
|
||||
onClicked: {
|
||||
|
|
|
|||
|
|
@ -110,13 +110,18 @@ PageBase {
|
|||
Layout.topMargin: 10
|
||||
text: qsTr("Forget this server")
|
||||
onClicked: {
|
||||
if (ServerSettingsLogic.isCurrentServerHasCredentials()) {
|
||||
popupForgetServer.questionText = "Attention! This action will not remove any data from the server, it will just remove server from the list. Continue?"
|
||||
}
|
||||
else {
|
||||
popupForgetServer.questionText = "Remove server from the list?"
|
||||
}
|
||||
popupForgetServer.open()
|
||||
}
|
||||
}
|
||||
|
||||
PopupWithQuestion {
|
||||
id: popupForgetServer
|
||||
questionText: "Attention! This action will not remove the container on the server, it will only remove the container information from the application. Continue?"
|
||||
yesFunc: function() {
|
||||
ServerSettingsLogic.onPushButtonForgetServer()
|
||||
close()
|
||||
|
|
|
|||
|
|
@ -233,9 +233,8 @@ PageBase {
|
|||
anchors.top: label_server_ip.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: StartPageLogic.lineEditIpText
|
||||
onEditingFinished: {
|
||||
StartPageLogic.lineEditIpText = text
|
||||
}
|
||||
onEditingFinished: { StartPageLogic.lineEditIpText = text }
|
||||
onTextEdited: { StartPageLogic.lineEditIpText = text }
|
||||
|
||||
validator: RegularExpressionValidator {
|
||||
regularExpression: StartPageLogic.ipAddressPortRegex
|
||||
|
|
@ -253,9 +252,8 @@ PageBase {
|
|||
anchors.top: label_login.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: StartPageLogic.lineEditLoginText
|
||||
onEditingFinished: {
|
||||
StartPageLogic.lineEditLoginText = text
|
||||
}
|
||||
onEditingFinished: { StartPageLogic.lineEditLoginText = text }
|
||||
onTextEdited: { StartPageLogic.lineEditLoginText = text }
|
||||
}
|
||||
|
||||
LabelType {
|
||||
|
|
@ -268,25 +266,29 @@ PageBase {
|
|||
id: new_server_password
|
||||
anchors.top: label_new_server_password.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
inputMethodHints: Qt.ImhSensitiveData
|
||||
echoMode: TextInput.Password
|
||||
text: StartPageLogic.lineEditPasswordText
|
||||
onEditingFinished: {
|
||||
StartPageLogic.lineEditPasswordText = text
|
||||
}
|
||||
onEditingFinished: { StartPageLogic.lineEditPasswordText = text }
|
||||
onTextEdited: { StartPageLogic.lineEditPasswordText = text }
|
||||
onAccepted: { StartPageLogic.onPushButtonConnect() }
|
||||
}
|
||||
TextFieldType {
|
||||
id: new_server_ssh_key
|
||||
anchors.top: label_new_server_password.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
visible: false
|
||||
height: 71
|
||||
font.pixelSize: 10
|
||||
verticalAlignment: Text.AlignTop
|
||||
inputMethodHints: Qt.ImhSensitiveData
|
||||
|
||||
text: StartPageLogic.textEditSshKeyText
|
||||
onEditingFinished: {
|
||||
StartPageLogic.textEditSshKeyText = text
|
||||
}
|
||||
visible: false
|
||||
onEditingFinished: { StartPageLogic.textEditSshKeyText = text }
|
||||
onTextEdited: { StartPageLogic.textEditSshKeyText = text }
|
||||
onAccepted: { StartPageLogic.onPushButtonConnect() }
|
||||
}
|
||||
|
||||
LabelType {
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ Window {
|
|||
}
|
||||
textArea.wrapMode: cbLogWrap.checked ? TextEdit.WordWrap: TextEdit.NoWrap
|
||||
|
||||
Keys.onPressed: {
|
||||
Keys.onPressed: function(event) {
|
||||
UiLogic.keyPressEvent(event.key)
|
||||
event.accepted = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include <QIcon>
|
||||
#include <QWindow>
|
||||
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
SystemTrayNotificationHandler::SystemTrayNotificationHandler(QObject* parent) :
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "ui/qautostart.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "defines.h"
|
||||
#include "version.h"
|
||||
#include "uilogic.h"
|
||||
#include "utilities.h"
|
||||
#include "vpnconnection.h"
|
||||
|
|
@ -132,13 +132,13 @@ void UiLogic::initializeUiLogic()
|
|||
connect(AndroidController::instance(), &AndroidController::initialized, [this](bool status, bool connected, const QDateTime& connectionDate) {
|
||||
if (connected) {
|
||||
pageLogic<VpnLogic>()->onConnectionStateChanged(Vpn::ConnectionState::Connected);
|
||||
m_vpnConnection->restoreConnection();
|
||||
if (m_vpnConnection) m_vpnConnection->restoreConnection();
|
||||
}
|
||||
});
|
||||
if (!AndroidController::instance()->initialize(pageLogic<StartPageLogic>())) {
|
||||
qCritical() << QString("Init failed") ;
|
||||
emit Vpn::ConnectionState::Error;
|
||||
return;
|
||||
qCritical() << QString("Init failed");
|
||||
if (m_vpnConnection) m_vpnConnection->connectionStateChanged(Vpn::ConnectionState::Error);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -475,11 +475,7 @@ void UiLogic::saveBinaryFile(const QString &desc, QString ext, const QString &da
|
|||
|
||||
void UiLogic::copyToClipboard(const QString &text)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
AndroidController::instance()->copyTextToClipboard(text);
|
||||
#else
|
||||
qApp->clipboard()->setText(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
void UiLogic::shareTempFile(const QString &suggestedName, QString ext, const QString& data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue