Merge pull request #53 from amnezia-vpn/ios-wireguard

iOS initial support
This commit is contained in:
pokamest 2022-07-06 16:26:50 +03:00 committed by GitHub
commit cd70f4b1c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1975 changed files with 395894 additions and 814 deletions

View file

@ -24,7 +24,7 @@ enum class Page {Start = 0, NewServer, NewServerProtocols, Vpn,
Wizard, WizardLow, WizardMedium, WizardHigh, WizardVpnMode, ServerConfiguringProgress,
GeneralSettings, AppSettings, NetworkSettings, ServerSettings,
ServerContainers, ServersList, ShareConnection, Sites,
ProtocolSettings, ProtocolShare, QrDecoder, About};
ProtocolSettings, ProtocolShare, QrDecoder, QrDecoderIos, About};
Q_ENUM_NS(Page)
static void declareQmlPageEnum() {

View file

@ -118,7 +118,10 @@ void VpnLogic::onBytesChanged(quint64 receivedData, quint64 sentData)
void VpnLogic::onConnectionStateChanged(VpnProtocol::VpnConnectionState state)
{
qDebug() << "VpnLogic::onConnectionStateChanged" << VpnProtocol::textConnectionState(state);
if (uiLogic()->m_vpnConnection == NULL) {
qDebug() << "VpnLogic::onConnectionStateChanged" << VpnProtocol::textConnectionState(state) << "невозможно, соединение отсутствует (уничтожено ранее)";
return;
}
bool pbConnectEnabled = false;
bool pbConnectChecked = false;

View file

@ -26,7 +26,7 @@ PageBase {
}
Connections {
target: QrDecoderLogic
target: Qt.platform.os != "ios" ? QrDecoderLogic : nil
function onStartDecode() {
console.debug("Starting QR decoder")
loader.sourceComponent = component
@ -51,6 +51,7 @@ PageBase {
Item {
anchors.fill: parent
Camera
{
id:camera
@ -76,7 +77,7 @@ PageBase {
Rectangle {
color: "black"
opacity: 0.5
width: videoOutput.contentRect.width *0.15
width: videoOutput.contentRect.width * 0.15
height: videoOutput.contentRect.height
x: (videoOutput.width - videoOutput.contentRect.width)/2
anchors.verticalCenter: videoOutput.verticalCenter
@ -85,28 +86,28 @@ PageBase {
Rectangle {
color: "black"
opacity: 0.5
width: videoOutput.contentRect.width *0.15
width: videoOutput.contentRect.width * 0.15
height: videoOutput.contentRect.height
x: videoOutput.width/2 + videoOutput.contentRect.width/2 - videoOutput.contentRect.width *0.15
x: videoOutput.width/2 + videoOutput.contentRect.width/2 - videoOutput.contentRect.width * 0.15
anchors.verticalCenter: videoOutput.verticalCenter
}
Rectangle {
color: "black"
opacity: 0.5
width: videoOutput.contentRect.width *0.7
height: videoOutput.contentRect.height *0.15
x: (videoOutput.width - videoOutput.contentRect.width)/2 + videoOutput.contentRect.width *0.15
width: videoOutput.contentRect.width * 0.7
height: videoOutput.contentRect.height * 0.15
x: (videoOutput.width - videoOutput.contentRect.width)/2 + videoOutput.contentRect.width * 0.15
y: (videoOutput.height - videoOutput.contentRect.height)/2
}
Rectangle {
color: "black"
opacity: 0.5
width: videoOutput.contentRect.width *0.7
height: videoOutput.contentRect.height *0.15
x: (videoOutput.width - videoOutput.contentRect.width)/2 + videoOutput.contentRect.width *0.15
y: videoOutput.height/2 + videoOutput.contentRect.height/2 - videoOutput.contentRect.height *0.15
width: videoOutput.contentRect.width * 0.7
height: videoOutput.contentRect.height * 0.15
x: (videoOutput.width - videoOutput.contentRect.width)/2 + videoOutput.contentRect.width * 0.15
y: videoOutput.height/2 + videoOutput.contentRect.height/2 - videoOutput.contentRect.height * 0.15
}
LabelType {

View file

@ -0,0 +1,76 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import PageEnum 1.0
import QRCodeReader 1.0
import "./"
import "../Controls"
import "../Config"
PageBase {
id: root
page: PageEnum.QrDecoderIos
logic: QrDecoderLogic
onDeactivated: {
console.debug("Stopping QR decoder")
loader.sourceComponent = undefined
}
BackButton {
}
Caption {
id: caption
text: qsTr("Import configuration")
}
Connections {
target: Qt.platform.os == "ios" ? QrDecoderLogic : nil
function onStartDecode() {
console.debug("Starting QR decoder")
loader.sourceComponent = component
}
function onStopDecode() {
console.debug("Stopping QR decoder")
loader.sourceComponent = undefined
}
}
Loader {
id: loader
anchors.top: caption.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
}
Component {
id: component
Item {
anchors.fill: parent
QRCodeReader {
id: qrCodeReader
onCodeReaded: {
QrDecoderLogic.onDetectedQrCode(code)
}
Component.onCompleted: {
qrCodeReader.setCameraSize(Qt.rect(loader.x,
loader.y,
loader.width,
loader.height))
qrCodeReader.startReading()
}
Component.onDestruction: qrCodeReader.stopReading()
}
}
}
}

View file

@ -135,7 +135,11 @@ PageBase {
text: qsTr("Scan QR code")
visible: StartPageLogic.pushButtonConnectVisible
onClicked: {
UiLogic.goToPage(PageEnum.QrDecoder)
if (Qt.platform.os == "ios") {
UiLogic.goToPage(PageEnum.QrDecoderIos)
} else {
UiLogic.goToPage(PageEnum.QrDecoder)
}
}
enabled: StartPageLogic.pushButtonConnectEnabled
}