2021-07-28 16:13:29 +07:00
import QtQuick 2.12
import QtQuick . Controls 2.12
import "./"
2021-08-19 01:27:22 +03:00
import "../Controls"
import "../Config"
2021-07-28 16:13:29 +07:00
Item {
id: root
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic . closePage ( )
}
}
ScrollView {
x: 10
y: 40
width: 360
height: 580
Item {
id: ct
width: parent . width
height: childrenRect . height + 10
property var contentList: [
full_access ,
share_amezia ,
share_openvpn ,
share_shadowshock ,
share_cloak
]
2021-09-04 15:21:36 +03:00
property int currentIndex: ShareConnectionLogic . toolBoxShareConnectionCurrentIndex
2021-08-09 00:41:52 +07:00
onCurrentIndexChanged: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . toolBoxShareConnectionCurrentIndex = currentIndex
2021-08-09 00:41:52 +07:00
for ( let i = 0 ; i < contentList . length ; ++ i ) {
if ( i == currentIndex ) {
contentList [ i ] . active = true
} else {
contentList [ i ] . active = false
}
}
}
2021-07-28 16:13:29 +07:00
function clearActive ( ) {
for ( let i = 0 ; i < contentList . length ; ++ i ) {
contentList [ i ] . active = false
}
2021-08-09 00:41:52 +07:00
currentIndex = - 1 ;
2021-07-28 16:13:29 +07:00
}
Column {
spacing: 5
ShareConnectionContent {
id: full_access
x: 0
text: qsTr ( "Full access" )
2021-09-04 15:21:36 +03:00
visible: ShareConnectionLogic . pageShareFullAccessVisible
2021-07-28 16:13:29 +07:00
content: Component {
Item {
width: 360
height: 380
Text {
x: 10
y: 250
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 have the same permissions to use VPN and your server as you. \nThis code includes your server credentials!\nProvide this code only to TRUSTED users." )
}
ShareConnectionButtonType {
x: 10
y: 130
width: 341
height: 40
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareFullCopyText
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareFullCopyClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
ShareConnectionButtonType {
x: 10
y: 180
width: 341
height: 40
text: qsTr ( "Save file" )
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareFullSaveClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
TextFieldType {
x: 10
y: 10
width: 341
height: 100
verticalAlignment: Text . AlignTop
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . textEditShareFullCodeText
2021-08-09 00:41:52 +07:00
onEditingFinished: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . textEditShareFullCodeText = text
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
}
}
onClicked: {
if ( active ) {
2021-08-09 00:41:52 +07:00
ct . currentIndex = - 1
2021-07-28 16:13:29 +07:00
} else {
ct . clearActive ( )
2021-08-09 00:41:52 +07:00
ct . currentIndex = 0
2021-07-28 16:13:29 +07:00
}
}
}
ShareConnectionContent {
id: share_amezia
x: 0
text: qsTr ( "Share for Amnezia client" )
2021-09-04 15:21:36 +03:00
visible: ShareConnectionLogic . pageShareAmneziaVisible
2021-07-28 16:13:29 +07:00
content: Component {
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
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareAmneziaCopyText
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareAmneziaCopyClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-09-04 15:21:36 +03:00
enabled: ShareConnectionLogic . pushButtonShareAmneziaCopyEnabled
2021-07-28 16:13:29 +07:00
}
ShareConnectionButtonType {
x: 10
y: 130
width: 341
height: 40
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareAmneziaGenerateText
enabled: ShareConnectionLogic . pushButtonShareAmneziaGenerateEnabled
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareAmneziaGenerateClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
ShareConnectionButtonType {
x: 10
y: 230
width: 341
height: 40
text: qsTr ( "Save file" )
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareAmneziaSaveClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
TextFieldType {
x: 10
y: 10
width: 341
height: 100
verticalAlignment: Text . AlignTop
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . textEditShareAmneziaCodeText
2021-08-09 00:41:52 +07:00
onEditingFinished: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . textEditShareAmneziaCodeText = text
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
}
}
onClicked: {
if ( active ) {
2021-08-09 00:41:52 +07:00
ct . currentIndex = - 1
2021-07-28 16:13:29 +07:00
} else {
ct . clearActive ( )
2021-08-09 00:41:52 +07:00
ct . currentIndex = 1
2021-07-28 16:13:29 +07:00
}
}
}
ShareConnectionContent {
id: share_openvpn
x: 0
text: qsTr ( "Share for OpenVPN client" )
2021-09-04 15:21:36 +03:00
visible: ShareConnectionLogic . pageShareOpenvpnVisible
2021-07-28 16:13:29 +07:00
content: Component {
Item {
width: 360
height: 380
ShareConnectionButtonType {
x: 10
y: 180
width: 341
height: 40
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareOpenvpnCopyText
enabled: ShareConnectionLogic . pushButtonShareOpenvpnCopyEnabled
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareOpenvpnCopyClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
ShareConnectionButtonType {
x: 10
y: 130
width: 341
height: 40
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareOpenvpnGenerateText
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareOpenvpnGenerateClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-09-04 15:21:36 +03:00
enabled: ShareConnectionLogic . pushButtonShareOpenvpnGenerateEnabled
2021-07-28 16:13:29 +07:00
}
ShareConnectionButtonType {
x: 10
y: 230
width: 341
height: 40
text: qsTr ( "Save file" )
2021-09-04 15:21:36 +03:00
enabled: ShareConnectionLogic . pushButtonShareOpenvpnSaveEnabled
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareOpenvpnSaveClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
TextFieldType {
x: 10
y: 10
width: 341
height: 100
verticalAlignment: Text . AlignTop
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . textEditShareOpenvpnCodeText
2021-08-09 00:41:52 +07:00
onEditingFinished: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . textEditShareOpenvpnCodeText = text
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
}
}
onClicked: {
if ( active ) {
2021-08-09 00:41:52 +07:00
ct . currentIndex = - 1
2021-07-28 16:13:29 +07:00
} else {
ct . clearActive ( )
2021-08-09 00:41:52 +07:00
ct . currentIndex = 2
2021-07-28 16:13:29 +07:00
}
}
}
ShareConnectionContent {
id: share_shadowshock
x: 0
text: qsTr ( "Share for ShadowSocks client" )
2021-09-04 15:21:36 +03:00
visible: ShareConnectionLogic . pageShareShadowsocksVisible
2021-07-28 16:13:29 +07:00
content: Component {
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
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . labelShareSsPasswordText
2021-07-28 16:13:29 +07:00
}
LabelType {
x: 130
y: 10
width: 100
height: 20
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . labelShareSsServerText
2021-07-28 16:13:29 +07:00
}
LabelType {
x: 130
y: 50
width: 100
height: 20
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . labelShareSsMethodText
2021-07-28 16:13:29 +07:00
}
LabelType {
x: 130
y: 30
width: 100
height: 20
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . labelShareSsPortText
2021-07-28 16:13:29 +07:00
}
Image {
id: label_share_ss_qr_code
x: 85
y: 235
width: 200
height: 200
2021-09-04 15:21:36 +03:00
source: ShareConnectionLogic . labelShareSsQrCodeText === "" ? "" : "data:image/png;base64," + UiLogic . labelShareSsQrCodeText
2021-07-28 16:13:29 +07:00
}
ShareConnectionButtonType {
x: 10
y: 180
width: 331
height: 40
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareSsCopyText
enabled: ShareConnectionLogic . pushButtonShareSsCopyEnabled
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareSsCopyClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
TextFieldType {
x: 10
y: 130
width: 331
height: 100
horizontalAlignment: Text . AlignHCenter
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . lineEditShareSsStringText
2021-08-09 00:41:52 +07:00
onEditingFinished: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . lineEditShareSsStringText = text
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
}
}
onClicked: {
if ( active ) {
2021-08-09 00:41:52 +07:00
ct . currentIndex = - 1
2021-07-28 16:13:29 +07:00
} else {
ct . clearActive ( )
2021-08-09 00:41:52 +07:00
ct . currentIndex = 3
2021-07-28 16:13:29 +07:00
}
}
}
ShareConnectionContent {
id: share_cloak
x: 0
text: qsTr ( "Share for Cloak client" )
2021-09-04 15:21:36 +03:00
visible: ShareConnectionLogic . pageShareCloakVisible
2021-07-28 16:13:29 +07:00
content: Component {
Item {
width: 360
height: 380
ShareConnectionButtonType {
x: 10
y: 290
width: 331
height: 40
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . pushButtonShareCloakCopyText
enabled: ShareConnectionLogic . pushButtonShareCloakCopyEnabled
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . onPushButtonShareCloakCopyClicked ( )
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
TextInput {
x: 10
y: 30
width: 331
height: 100
2021-09-04 15:21:36 +03:00
text: ShareConnectionLogic . plainTextEditShareCloakText
2021-08-09 00:41:52 +07:00
onEditingFinished: {
2021-09-04 15:21:36 +03:00
ShareConnectionLogic . plainTextEditShareCloakText = text
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
}
}
onClicked: {
if ( active ) {
2021-08-09 00:41:52 +07:00
ct . currentIndex = - 1
2021-07-28 16:13:29 +07:00
} else {
ct . clearActive ( )
2021-08-09 00:41:52 +07:00
ct . currentIndex = 4
2021-07-28 16:13:29 +07:00
}
}
}
}
}
}
}