Merge branch 'dev' of github.com:amnezia-vpn/desktop-client into feature/qt6-client-management-panel
This commit is contained in:
commit
4171afe275
55 changed files with 820 additions and 337 deletions
57
client/ui/qml/Controls/PopupWithQuestion.qml
Normal file
57
client/ui/qml/Controls/PopupWithQuestion.qml
Normal file
|
@ -0,0 +1,57 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Popup {
|
||||
id: root
|
||||
|
||||
property string questionText
|
||||
property string yesText: "yes"
|
||||
property string noText: "no"
|
||||
property var yesFunc
|
||||
property var noFunc
|
||||
|
||||
anchors.centerIn: Overlay.overlay
|
||||
modal: true
|
||||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
width: parent.width - 20
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
Text {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: 16
|
||||
text: questionText
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
BlueButtonType {
|
||||
id: yesButton
|
||||
Layout.preferredWidth: parent.width / 2
|
||||
Layout.fillWidth: true
|
||||
text: yesText
|
||||
onClicked: {
|
||||
root.enabled = false
|
||||
if (yesFunc && typeof yesFunc === "function") {
|
||||
yesFunc()
|
||||
}
|
||||
root.enabled = true
|
||||
}
|
||||
}
|
||||
BlueButtonType {
|
||||
id: noButton
|
||||
Layout.preferredWidth: parent.width / 2
|
||||
Layout.fillWidth: true
|
||||
text: noText
|
||||
onClicked: {
|
||||
if (noFunc && typeof noFunc === "function") {
|
||||
noFunc()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ PageBase {
|
|||
pageLoader.focus = true
|
||||
}
|
||||
|
||||
onContainerSelected: {
|
||||
onContainerSelected: function(c_index){
|
||||
var containerProto = ContainerProps.defaultProtocol(c_index)
|
||||
|
||||
tf_port_num.text = ProtocolProps.defaultPort(containerProto)
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtMultimedia
|
||||
import PageEnum 1.0
|
||||
import QZXing 3.2
|
||||
|
||||
import "./"
|
||||
import "../Controls"
|
||||
import "../Config"
|
||||
|
||||
PageBase {
|
||||
id: root
|
||||
page: PageEnum.QrDecoder
|
||||
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 : null
|
||||
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
|
||||
|
||||
Camera
|
||||
{
|
||||
id:camera
|
||||
focus {
|
||||
focusMode: CameraFocus.FocusContinuous
|
||||
focusPointMode: CameraFocus.FocusPointAuto
|
||||
}
|
||||
}
|
||||
|
||||
VideoOutput
|
||||
{
|
||||
id: videoOutput
|
||||
source: camera
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
autoOrientation: true
|
||||
fillMode: VideoOutput.PreserveAspectFit
|
||||
// filters: [ zxingFilter ]
|
||||
|
||||
|
||||
Rectangle {
|
||||
color: "black"
|
||||
opacity: 0.5
|
||||
width: videoOutput.contentRect.width * 0.15
|
||||
height: videoOutput.contentRect.height
|
||||
x: (videoOutput.width - videoOutput.contentRect.width)/2
|
||||
anchors.verticalCenter: videoOutput.verticalCenter
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "black"
|
||||
opacity: 0.5
|
||||
width: videoOutput.contentRect.width * 0.15
|
||||
height: videoOutput.contentRect.height
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
LabelType {
|
||||
width: parent.width
|
||||
text: qsTr("Decoded QR chunks " + QrDecoderLogic.receivedChunksCount + "/" + QrDecoderLogic.totalChunksCount)
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
visible: QrDecoderLogic.totalChunksCount > 0
|
||||
anchors.horizontalCenter: videoOutput.horizontalCenter
|
||||
y: videoOutput.height/2 + videoOutput.contentRect.height/2
|
||||
}
|
||||
}
|
||||
|
||||
QZXingFilter
|
||||
{
|
||||
id: zxingFilter
|
||||
orientation: videoOutput.orientation
|
||||
captureRect: {
|
||||
// setup bindings
|
||||
videoOutput.contentRect;
|
||||
videoOutput.sourceRect;
|
||||
return videoOutput.mapRectToSource(videoOutput.mapNormalizedRectToItem(Qt.rect(
|
||||
0.15, 0.15, 0.7, 0.7 //0, 0, 1.0, 1.0
|
||||
)));
|
||||
}
|
||||
|
||||
decoder {
|
||||
enabledDecoders: QZXing.DecoderFormat_QR_CODE
|
||||
|
||||
onTagFound: {
|
||||
QrDecoderLogic.onDetectedQrCode(tag)
|
||||
}
|
||||
|
||||
tryHarder: true
|
||||
}
|
||||
|
||||
property int framesDecoded: 0
|
||||
property real timePerFrameDecode: 0
|
||||
|
||||
onDecodingFinished:
|
||||
{
|
||||
timePerFrameDecode = (decodeTime + framesDecoded * timePerFrameDecode) / (framesDecoded + 1);
|
||||
framesDecoded++;
|
||||
if(succeeded)
|
||||
console.log("frame finished: " + succeeded, decodeTime, timePerFrameDecode, framesDecoded);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -55,7 +55,6 @@ PageBase {
|
|||
tf_port_num.text = qsTr("Default")
|
||||
}
|
||||
else tf_port_num.text = ProtocolProps.defaultPort(containerProto)
|
||||
|
||||
cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto)
|
||||
|
||||
tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto)
|
||||
|
@ -297,23 +296,24 @@ PageBase {
|
|||
implicitHeight: 30
|
||||
|
||||
checked: default_role
|
||||
|
||||
MessageDialog {
|
||||
id: dialogRemove
|
||||
buttons: StandardButton.Yes | StandardButton.Cancel
|
||||
title: "AmneziaVPN"
|
||||
text: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
|
||||
onAccepted: {
|
||||
tb_c.currentIndex = -1
|
||||
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: dialogRemove.open()
|
||||
onClicked: popupRemove.open()
|
||||
|
||||
VisibleBehavior on visible { }
|
||||
}
|
||||
|
||||
PopupWithQuestion {
|
||||
id: popupRemove
|
||||
questionText: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
|
||||
yesFunc: function() {
|
||||
tb_c.currentIndex = -1
|
||||
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
|
||||
close()
|
||||
}
|
||||
noFunc: function() {
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
ImageButtonType {
|
||||
id: button_share
|
||||
visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer
|
||||
|
@ -418,7 +418,7 @@ PageBase {
|
|||
|
||||
BlueButtonType {
|
||||
id: pb_add_container
|
||||
visible: container_selector.selectedIndex < 0
|
||||
visible: container_selector.selectedIndex < 0 && ServerContainersLogic.isManagedServer
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
|
@ -430,6 +430,5 @@ PageBase {
|
|||
text: qsTr("Install new service")
|
||||
font.pixelSize: 16
|
||||
onClicked: container_selector.visible ? container_selector.close() : container_selector.open()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,24 +102,49 @@ PageBase {
|
|||
ServerSettingsLogic.onPushButtonClearClientCacheClicked()
|
||||
}
|
||||
}
|
||||
|
||||
BlueButtonType {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
text: ServerSettingsLogic.pushButtonClearText
|
||||
visible: ServerSettingsLogic.pushButtonClearVisible
|
||||
onClicked: {
|
||||
ServerSettingsLogic.onPushButtonClearServer()
|
||||
onClicked: {
|
||||
popupClearServer.open()
|
||||
}
|
||||
}
|
||||
|
||||
PopupWithQuestion {
|
||||
id: popupClearServer
|
||||
questionText: "Attention! All containers will be deleted on the server. This means that configuration files, keys and certificates will be deleted. Continue?"
|
||||
yesFunc: function() {
|
||||
ServerSettingsLogic.onPushButtonClearServer()
|
||||
close()
|
||||
}
|
||||
noFunc: function() {
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
||||
BlueButtonType {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
text: qsTr("Forget this server")
|
||||
onClicked: {
|
||||
ServerSettingsLogic.onPushButtonForgetServer()
|
||||
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()
|
||||
}
|
||||
noFunc: function() {
|
||||
close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ PageBase {
|
|||
if (Qt.platform.os === "ios") {
|
||||
UiLogic.goToPage(PageEnum.QrDecoderIos)
|
||||
} else {
|
||||
UiLogic.goToPage(PageEnum.QrDecoder)
|
||||
StartPageLogic.startQrDecoder()
|
||||
}
|
||||
}
|
||||
enabled: StartPageLogic.pushButtonConnectEnabled
|
||||
|
|
|
@ -11,10 +11,9 @@ PageProtocolBase {
|
|||
protocol: ProtocolEnum.Cloak
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
enabled: logic.pageEnabled
|
||||
BackButton {
|
||||
id: back
|
||||
enabled: logic.pageEnabled
|
||||
enabled: !logic.pushButtonCancelVisible
|
||||
}
|
||||
|
||||
Caption {
|
||||
|
|
|
@ -13,7 +13,7 @@ PageProtocolBase {
|
|||
|
||||
BackButton {
|
||||
id: back
|
||||
enabled: logic.pageEnabled
|
||||
enabled: !logic.pushButtonCancelVisible
|
||||
}
|
||||
|
||||
Caption {
|
||||
|
@ -285,8 +285,6 @@ PageProtocolBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
|
@ -338,8 +336,6 @@ PageProtocolBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
LabelType {
|
||||
|
|
|
@ -13,7 +13,7 @@ PageProtocolBase {
|
|||
|
||||
BackButton {
|
||||
id: back
|
||||
enabled: logic.pageEnabled
|
||||
enabled: !logic.pushButtonCancelVisible
|
||||
}
|
||||
|
||||
Caption {
|
||||
|
|
|
@ -254,18 +254,6 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: closePrompt
|
||||
// x: (root.width - width) / 2
|
||||
// y: (root.height - height) / 2
|
||||
title: qsTr("Exit")
|
||||
text: qsTr("Do you really want to quit?")
|
||||
// standardButtons: StandardButton.Yes | StandardButton.No
|
||||
// onYesClicked: {
|
||||
// Qt.quit()
|
||||
// }
|
||||
visible: false
|
||||
}
|
||||
MessageDialog {
|
||||
id: publicKeyWarning
|
||||
title: "AmneziaVPN"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue