Share page reimpl

This commit is contained in:
pokamest 2021-11-08 15:18:52 +03:00
parent a89104127a
commit 396af917b5
12 changed files with 298 additions and 286 deletions

View file

@ -66,6 +66,7 @@ PageBase {
text: qsTr("Share for Amnezia")
height: 40
width: tb_c.width - 10
onClicked: UiLogic.onGotoShareProtocolPage(ProtocolEnum.Any)
}
ListView {
@ -350,63 +351,6 @@ PageBase {
// Item {
// width: 360
// height: 380
// Text {
// x: 10
// y: 280
// width: 341
// height: 111
// font.family: "Lato"
// font.styleName: "normal"
// font.pixelSize: 16
// color: "#181922"
// horizontalAlignment: Text.AlignLeft
// verticalAlignment: Text.AlignVCenter
// wrapMode: Text.Wrap
// text: qsTr("Anyone who logs in with this code will be able to connect to this VPN server. \nThis code does not include server credentials.")
// }
// ShareConnectionButtonType {
// x: 10
// y: 180
// width: 341
// height: 40
// text: ShareConnectionLogic.pushButtonShareAmneziaCopyText
// onClicked: {
// ShareConnectionLogic.onPushButtonShareAmneziaCopyClicked()
// }
// enabled: ShareConnectionLogic.pushButtonShareAmneziaCopyEnabled
// }
// ShareConnectionButtonType {
// x: 10
// y: 130
// width: 341
// height: 40
// text: ShareConnectionLogic.pushButtonShareAmneziaGenerateText
// enabled: ShareConnectionLogic.pushButtonShareAmneziaGenerateEnabled
// onClicked: {
// ShareConnectionLogic.onPushButtonShareAmneziaGenerateClicked()
// }
// }
// ShareConnectionButtonType {
// x: 10
// y: 230
// width: 341
// height: 40
// text: qsTr("Save file")
// onClicked: {
// ShareConnectionLogic.onPushButtonShareAmneziaSaveClicked()
// }
// }
// TextFieldType {
// x: 10
// y: 10
// width: 341
// height: 100
// verticalAlignment: Text.AlignTop
// text: ShareConnectionLogic.textEditShareAmneziaCodeText
// onEditingFinished: {
// ShareConnectionLogic.textEditShareAmneziaCodeText = text
// }
// }
// }
// }
// onClicked: {
@ -428,99 +372,7 @@ PageBase {
// Item {
// width: 360
// height: 380
// LabelType {
// x: 10
// y: 70
// width: 100
// height: 20
// text: qsTr("Password")
// }
// LabelType {
// x: 10
// y: 10
// width: 100
// height: 20
// text: qsTr("Server:")
// }
// LabelType {
// x: 10
// y: 50
// width: 100
// height: 20
// text: qsTr("Encryption:")
// }
// LabelType {
// x: 10
// y: 30
// width: 100
// height: 20
// text: qsTr("Port:")
// }
// LabelType {
// x: 10
// y: 100
// width: 191
// height: 20
// text: qsTr("Connection string")
// }
// LabelType {
// x: 130
// y: 70
// width: 100
// height: 20
// text: ShareConnectionLogic.labelShareShadowSocksPasswordText
// }
// LabelType {
// x: 130
// y: 10
// width: 100
// height: 20
// text: ShareConnectionLogic.labelShareShadowSocksServerText
// }
// LabelType {
// x: 130
// y: 50
// width: 100
// height: 20
// text: ShareConnectionLogic.labelShareShadowSocksMethodText
// }
// LabelType {
// x: 130
// y: 30
// width: 100
// height: 20
// text: ShareConnectionLogic.labelShareShadowSocksPortText
// }
// Image {
// id: label_share_ss_qr_code
// x: 85
// y: 235
// width: 200
// height: 200
// source: ShareConnectionLogic.labelShareShadowSocksQrCodeText === "" ? "" : "data:image/png;base64," + UiLogic.labelShareShadowSocksQrCodeText
// }
// ShareConnectionButtonType {
// x: 10
// y: 180
// width: 331
// height: 40
// text: ShareConnectionLogic.pushButtonShareShadowSocksCopyText
// enabled: ShareConnectionLogic.pushButtonShareShadowSocksCopyEnabled
// onClicked: {
// ShareConnectionLogic.onPushButtonShareShadowSocksCopyClicked()
// }
// }
// TextFieldType {
// x: 10
// y: 130
// width: 331
// height: 100
// horizontalAlignment: Text.AlignHCenter
// text: ShareConnectionLogic.lineEditShareShadowSocksStringText
// onEditingFinished: {
// ShareConnectionLogic.lineEditShareShadowSocksStringText = text
// }
// }
// }
// }
// onClicked: {

View file

@ -0,0 +1,90 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import ProtocolEnum 1.0
import "../"
import "../../Controls"
import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.Any
logic: ShareConnectionLogic
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("Share for Amnezia")
}
Text {
id: lb_desc
anchors.top: caption.bottom
anchors.topMargin: 20
width: parent.width - 60
anchors.horizontalCenter: root.horizontalCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: qsTr("Anyone who logs in with this code will be able to connect to this VPN server. \nThis code does not include server credentials.")
}
TextAreaType {
anchors.top: lb_desc.bottom
anchors.topMargin: 20
anchors.bottom: pb_gen.top
anchors.bottomMargin: 20
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
textArea.readOnly: true
textArea.wrapMode: TextEdit.WrapAnywhere
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareAmneziaCodeText
}
ShareConnectionButtonType {
id: pb_gen
anchors.bottom: pb_copy.top
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
text: ShareConnectionLogic.pushButtonShareAmneziaGenerateText
enabled: ShareConnectionLogic.pushButtonShareAmneziaGenerateEnabled
onClicked: {
ShareConnectionLogic.onPushButtonShareAmneziaGenerateClicked()
}
}
ShareConnectionButtonType {
id: pb_copy
anchors.bottom: pb_save.top
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
text: ShareConnectionLogic.pushButtonShareAmneziaCopyText
onClicked: {
ShareConnectionLogic.onPushButtonShareAmneziaCopyClicked()
}
enabled: ShareConnectionLogic.pushButtonShareAmneziaCopyEnabled
}
ShareConnectionButtonType {
id: pb_save
anchors.bottom: root.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
text: qsTr("Save file")
onClicked: {
ShareConnectionLogic.onPushButtonShareAmneziaSaveClicked()
}
}
}

View file

@ -40,7 +40,7 @@ PageShareProtocolBase {
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
text: ShareConnectionLogic.pushButtonShareCloakCopyText
enabled: ShareConnectionLogic.pushButtonShareCloakCopyEnabled
//enabled: ShareConnectionLogic.pushButtonShareCloakCopyEnabled
onClicked: {
ShareConnectionLogic.onPushButtonShareCloakCopyClicked()
}

View file

@ -74,7 +74,4 @@ PageShareProtocolBase {
ShareConnectionLogic.onPushButtonShareOpenVpnSaveClicked()
}
}
}

View file

@ -31,18 +31,101 @@ PageShareProtocolBase {
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
contentHeight: content.height + content2.height + 40
clip: true
ColumnLayout {
GridLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
columns: 2
//
LabelType {
height: 20
text: qsTr("Server:")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksServerText
readOnly: true
}
//
LabelType {
height: 20
text: qsTr("Port:")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksPortText
readOnly: true
}
//
LabelType {
height: 20
text: qsTr("Password")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksPasswordText
readOnly: true
}
//
LabelType {
height: 20
text: qsTr("Encryption:")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksMethodText
readOnly: true
}
}
}
ColumnLayout {
id: content2
enabled: logic.pageEnabled
anchors.top: content.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
LabelType {
height: 20
text: qsTr("Connection string")
}
TextFieldType {
id: tfConnString
height: 100
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
text: ShareConnectionLogic.lineEditShareShadowSocksStringText
readOnly: true
}
ShareConnectionButtonType {
height: 40
Layout.fillWidth: true
text: ShareConnectionLogic.pushButtonShareShadowSocksCopyText
enabled: tfConnString.length > 0
onClicked: {
ShareConnectionLogic.onPushButtonShareShadowSocksCopyClicked()
}
}
Image {
id: label_share_ss_qr_code
Layout.topMargin: 20
Layout.fillWidth: true
Layout.preferredHeight: width
smooth: false
source: ShareConnectionLogic.labelShareShadowSocksQrCodeText
}
}
}
}