implement qml UI

This commit is contained in:
Ngoc Diep 2021-07-28 16:13:29 +07:00
parent 1baf36282e
commit 8d36c31cb4
41 changed files with 7963 additions and 16 deletions

View file

@ -0,0 +1,13 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Button {
id: root
property alias containsMouse: mouseArea.containsMouse
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
background: Rectangle {
anchors.fill: parent
radius: 4
color: root.containsMouse ? "#211966" : "#100A44"
}
font.pixelSize: 16
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: root.font.pixelSize
color: "#D4D4D4"
text: root.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
CheckBox {
id: root
indicator: Image {
// y: 5
anchors.verticalCenter: root.verticalCenter
height: 20
width: 20
source: root.checked ? "qrc:/images/controls/check_on.png"
: "qrc:/images/controls/check_off.png"
}
contentItem: Text {
text: root.text
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
verticalAlignment: Text.AlignVCenter
leftPadding: root.indicator.width + root.spacing
}
}

View file

@ -0,0 +1,9 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
ComboBox {
id: root
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 13
}

View file

@ -0,0 +1,43 @@
pragma Singleton
import QtQuick 2.12
Item {
readonly property string screenHome: "qrc:/ScreenHome.qml"
readonly property string screenHomeIntroGifEx1: "qrc:/ScreenHomeIntroGifEx1.qml"
readonly property int screenWidth: 380
readonly property int screenHeight: 640
function isMobile() {
if (Qt.platform.os == "android" ||
Qt.platform.os == "ios") {
return true
}
return false
}
function isDesktop() {
if (Qt.platform.os == "windows" ||
Qt.platform.os == "linux" ||
Qt.platform.os == "osx") {
return true
}
return false
}
function trX(x) {
return x
}
function trY(y) {
return y
}
function trW(w) {
return w
}
function trH(h) {
return h
}
}

View file

@ -0,0 +1,14 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
property alias iconMargin: img.anchors.margins
background: Item {}
contentItem: Image {
id: img
source: root.icon.source
anchors.fill: root
anchors.margins: root.containsMouse ? 3 : 4
}
}

View file

@ -0,0 +1,12 @@
import QtQuick 2.12
Text {
id: root
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}

View file

@ -0,0 +1,103 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Application Settings")
x: 10
y: 35
width: 361
height: 31
}
CheckBoxType {
x: 30
y: 140
width: 211
height: 31
text: qsTr("Auto connect")
checked: UiLogic.checkBoxAppSettingsAutoconnectChecked
onCheckedChanged: {
UiLogic.checkBoxAppSettingsAutoconnectChecked = checked
UiLogic.onCheckBoxAppSettingsAutoconnectToggled(checked)
}
}
CheckBoxType {
x: 30
y: 100
width: 211
height: 31
text: qsTr("Auto start")
checked: UiLogic.checkBoxAppSettingsAutostartChecked
onCheckedChanged: {
UiLogic.checkBoxAppSettingsAutostartChecked = checked
UiLogic.onCheckBoxAppSettingsAutostartToggled(checked)
}
}
CheckBoxType {
x: 30
y: 180
width: 211
height: 31
text: qsTr("Start minimized")
checked: UiLogic.checkBoxAppSettingsStartMinimizedChecked
onCheckedChanged: {
UiLogic.checkBoxAppSettingsStartMinimizedChecked = checked
UiLogic.onCheckBoxAppSettingsStartMinimizedToggled(checked)
}
}
Image {
anchors.horizontalCenter: root.horizontalCenter
width: GC.trW(150)
height: GC.trH(22)
y: GC.trY(590)
source: "qrc:/images/AmneziaVPN.png"
}
LabelType {
x: 30
y: 240
width: 281
height: 21
text: UiLogic.labelAppSettingsVersionText
}
BlueButtonType {
x: 30
y: 280
width: 321
height: 41
text: qsTr("Check for updates")
onClicked: {
Qt.openUrlExternally("https://github.com/amnezia-vpn/desktop-client/releases/latest")
}
}
BlueButtonType {
x: 30
y: 340
width: 321
height: 41
text: qsTr("Open logs folder")
onClicked: {
UiLogic.onPushButtonAppSettingsOpenLogsChecked()
}
}
}

View file

@ -0,0 +1,140 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Image {
x: 10
y: 160
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 220
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 620
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 560
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 280
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 100
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 340
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 400
width: 360
height: 1
source: "qrc:/images/line.png"
}
Image {
x: 10
y: 40
width: 360
height: 1
source: "qrc:/images/line.png"
}
SettingButtonType {
x: 30
y: 355
width: 330
height: 30
icon.source: "qrc:/images/plus.png"
text: qsTr("Add server")
}
SettingButtonType {
x: 30
y: 55
width: 330
height: 30
icon.source: "qrc:/images/settings.png"
text: qsTr("App settings")
}
SettingButtonType {
x: 30
y: 575
width: 330
height: 30
icon.source: "qrc:/images/settings.png"
text: qsTr("Exit")
}
SettingButtonType {
x: 30
y: 115
width: 330
height: 30
icon.source: "qrc:/images/settings.png"
text: qsTr("Network settings")
}
SettingButtonType {
x: 30
y: 175
width: 330
height: 30
icon.source: "qrc:/images/server_settings.png"
text: qsTr("Server management")
}
SettingButtonType {
x: 30
y: 295
width: 330
height: 30
icon.source: "qrc:/images/server_settings.png"
text: qsTr("Servers")
}
SettingButtonType {
x: 30
y: 235
width: 330
height: 30
icon.source: "qrc:/images/share.png"
text: qsTr("Share connection")
enabled: UiLogic.pushButtonGeneralSettingsShareConnectionEnable
}
}

View file

@ -0,0 +1,106 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("DNS Servers")
x: 10
y: 35
width: 361
height: 31
}
Image {
anchors.horizontalCenter: root.horizontalCenter
width: GC.trW(150)
height: GC.trH(22)
y: GC.trY(590)
source: "qrc:/images/AmneziaVPN.png"
}
LabelType {
x: 40
y: 95
width: 291
height: 21
text: qsTr("Primary DNS server")
}
LabelType {
x: 40
y: 175
width: 291
height: 21
text: qsTr("Secondray DNS server")
}
TextFieldType {
id: dns1
x: 40
y: 120
width: 271
height: 40
text: UiLogic.lineEditNetworkSettingsDns1Text
onEditingFinished: {
UiLogic.lineEditNetworkSettingsDns1Text = text
UiLogic.onLineEditNetworkSettingsDns1EditFinished(text)
}
validator: RegExpValidator {
regExp: UiLogic.ipAddressValidatorRegex
}
}
TextFieldType {
id: dns2
x: 40
y: 200
width: 271
height: 40
text: UiLogic.lineEditNetworkSettingsDns2Text
onEditingFinished: {
UiLogic.lineEditNetworkSettingsDns2Text = text
UiLogic.onLineEditNetworkSettingsDns2EditFinished(text)
}
validator: RegExpValidator {
regExp: UiLogic.ipAddressValidatorRegex
}
}
ImageButtonType {
id: resetDNS1
x: 320
y: 127
width: 24
height: 24
icon.source: "qrc:/images/reload.png"
onClicked: {
UiLogic.onPushButtonNetworkSettingsResetdns1Clicked()
}
}
ImageButtonType {
id: resetDNS2
x: 320
y: 207
width: 24
height: 24
icon.source: "qrc:/images/reload.png"
onClicked: {
UiLogic.onPushButtonNetworkSettingsResetdns2Clicked()
}
}
}

View file

@ -0,0 +1,83 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Page 1.0
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup your server to use VPN")
x: 10
y: 35
width: 361
height: 31
}
LabelType {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("If you want easily configure your server just run Wizard")
wrapMode: Text.Wrap
x: 40
y: 100
width: 301
height: 41
}
LabelType {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Press configure manually to choose VPN protocols you want to install")
wrapMode: Text.Wrap
x: 40
y: 260
width: 301
height: 41
}
BlueButtonType {
text: qsTr("Run Setup Wizard")
y: 150
width: 301
height: 40
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
UiLogic.goToPage(Page.Wizard);
}
}
BlueButtonType {
text: qsTr("Configure VPN protocols manually")
y: 310
width: 301
height: 40
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
UiLogic.goToPage(Page.NewServerProtocols);
}
}
Image {
anchors.horizontalCenter: root.horizontalCenter
width: GC.trW(150)
height: GC.trH(22)
y: GC.trY(590)
source: "qrc:/images/AmneziaVPN.png"
}
ImageButtonType {
id: back_from_new_server
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
}

View file

@ -0,0 +1,73 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Configuring...")
x: 0
y: 35
width: 381
height: 31
}
LabelType {
x: 30
y: 90
width: 321
height: 31
text: qsTr("Please wait.")
}
LabelType {
x: 40
y: 560
width: 301
height: 41
text: qsTr("Please wait, configuring process may take up to 5 minutes")
}
ProgressBar {
id: pr
anchors.horizontalCenter: parent.horizontalCenter
y: 510
width: 301
height: 40
from: 0
to: 100
value: UiLogic.progressBarNewServerConfiguringValue
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: pr.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
LabelType {
anchors.fill: parent
text: qsTr("Configuring...")
horizontalAlignment: Text.AlignHCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
}
}
}

View file

@ -0,0 +1,422 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Select VPN protocols")
x: 10
y: 35
width: 361
height: 31
}
ProgressBar {
id: progress_bar_new_server_connection
anchors.horizontalCenter: parent.horizontalCenter
y: 570
width: 301
height: 40
from: UiLogic.progressBarNewServerConnectionMinimum
to: UiLogic.progressBarNewServerConnectionMaximum
value: 0
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progress_bar_new_server_connection.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
LabelType {
anchors.fill: parent
text: qsTr("Configuring...")
horizontalAlignment: Text.AlignHCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 570
width: 301
height: 40
text: qsTr("Setup server")
onClicked: {
UiLogic.pushButtonNewServerConnectConfigureClicked()
}
}
ScrollView {
x: 0
y: 70
width: 380
height: 471
clip: true
Column {
spacing: 5
Rectangle {
x: 5
y: 5
width: 368
height: frame_new_server_setting_cloak.visible ? 140 : 72
border.width: 1
border.color: "lightgray"
radius: 2
Rectangle {
id: frame_new_server_setting_cloak
height: 77
width: 353
border.width: 1
border.color: "lightgray"
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
spacing: 5
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: qsTr("Port (TCP)")
}
TextFieldType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: UiLogic.lineEditNewServerCloakPortText
onEditingFinished: {
UiLogic.lineEditNewServerCloakPortText = text
}
}
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: qsTr("Fake Web Site")
}
TextFieldType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: UiLogic.lineEditNewServerCloakSiteText
onEditingFinished: {
UiLogic.lineEditNewServerCloakSiteText = text
}
}
}
}
Row {
anchors.top: parent.top
anchors.topMargin: 5
leftPadding: 15
rightPadding: 5
height: 55
width: parent.width
CheckBoxType {
text: qsTr("OpenVPN and ShadowSocks\n with masking using Cloak plugin")
height: parent.height
width: 308
checked: UiLogic.checkBoxNewServerCloakChecked
onCheckedChanged: {
UiLogic.checkBoxNewServerCloakChecked = checked
}
}
ImageButtonType {
width: 35
height: 35
anchors.verticalCenter: parent.verticalCenter
icon.source: "qrc:/images/settings.png"
checkable: true
checked: UiLogic.pushButtonNewServerSettingsCloakChecked
onCheckedChanged: {
UiLogic.pushButtonNewServerSettingsCloakChecked = checked
}
}
}
}
Rectangle {
x: 5
y: 5
width: 368
height: frame_new_server_settings_ss.visible ? 140 : 72
border.width: 1
border.color: "lightgray"
radius: 2
Rectangle {
id: frame_new_server_settings_ss
height: 77
width: 353
border.width: 1
border.color: "lightgray"
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
spacing: 5
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: qsTr("Port (TCP)")
}
TextFieldType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: UiLogic.lineEditNewServerSsPortText
onEditingFinished: {
UiLogic.lineEditNewServerSsPortText = text
}
}
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: qsTr("Encryption")
}
ComboBoxType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
model: [
qsTr("chacha20-ietf-poly1305"),
qsTr("xchacha20-ietf-poly1305"),
qsTr("aes-256-gcm"),
qsTr("aes-192-gcm"),
qsTr("aes-128-gcm")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxNewServerSsCipherText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxNewServerSsCipherText = currentText
}
}
}
}
Row {
anchors.top: parent.top
anchors.topMargin: 5
leftPadding: 15
rightPadding: 5
height: 55
width: parent.width
CheckBoxType {
text: qsTr("ShadowSocks")
height: parent.height
width: 308
checked: UiLogic.checkBoxNewServerSsChecked
onCheckedChanged: {
UiLogic.checkBoxNewServerSsChecked = checked
}
}
ImageButtonType {
width: 35
height: 35
anchors.verticalCenter: parent.verticalCenter
icon.source: "qrc:/images/settings.png"
checked: UiLogic.pushButtonNewServerSettingsSsChecked
onCheckedChanged: {
UiLogic.pushButtonNewServerSettingsSsChecked = checked
}
}
}
}
Rectangle {
x: 5
y: 5
width: 368
height: frame_new_server_settings_openvpn.visible ? 140 : 72
border.width: 1
border.color: "lightgray"
radius: 2
Rectangle {
id: frame_new_server_settings_openvpn
height: 77
width: 353
border.width: 1
border.color: "lightgray"
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
spacing: 5
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: qsTr("Port (TCP)")
}
TextFieldType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: UiLogic.lineEditNewServerOpenvpnPortText
onEditingFinished: {
UiLogic.lineEditNewServerOpenvpnPortText = text
}
}
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
text: qsTr("Protocol")
}
ComboBoxType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
model: [
qsTr("udp"),
qsTr("tcp"),
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxNewServerOpenvpnProtoText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxNewServerOpenvpnProtoText = currentText
}
}
}
}
Row {
anchors.top: parent.top
anchors.topMargin: 5
leftPadding: 15
rightPadding: 5
height: 55
width: parent.width
CheckBoxType {
text: qsTr("OpenVPN")
height: parent.height
width: 308
checked: UiLogic.checkBoxNewServerOpenvpnChecked
onCheckedChanged: {
UiLogic.checkBoxNewServerOpenvpnChecked = checked
}
}
ImageButtonType {
width: 35
height: 35
anchors.verticalCenter: parent.verticalCenter
icon.source: "qrc:/images/settings.png"
checked: UiLogic.pushButtonNewServerSettingsOpenvpnChecked
onCheckedChanged: {
UiLogic.pushButtonNewServerSettingsOpenvpnChecked = checked
}
}
}
}
Rectangle {
id: frame_new_server_settings_parent_wireguard
visible: UiLogic.frameNewServerSettingsParentWireguardVisible
x: 5
y: 5
width: 368
height: frame_new_server_settings_wireguard.visible ? 109 : 72
border.width: 1
border.color: "lightgray"
radius: 2
Rectangle {
id: frame_new_server_settings_wireguard
height: 46
width: 353
border.width: 1
border.color: "lightgray"
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
spacing: 5
LabelType {
width: 130
height: (parent.height - parent.spacing - parent.topPadding * 2)
text: qsTr("Port (TCP)")
}
TextFieldType {
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
height: (parent.height - parent.spacing - parent.topPadding * 2)
text: "32767"
}
}
}
Row {
anchors.top: parent.top
anchors.topMargin: 5
leftPadding: 15
rightPadding: 5
height: 55
width: parent.width
CheckBoxType {
text: qsTr("WireGuard")
height: parent.height
width: 308
}
ImageButtonType {
width: 35
height: 35
anchors.verticalCenter: parent.verticalCenter
icon.source: "qrc:/images/settings.png"
}
}
}
}
}
}

View file

@ -0,0 +1,147 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Item {
x: 0
y: 40
width: 380
height: 600
ComboBoxType {
x: 190
y: 60
width: 151
height: 31
model: [
qsTr("chacha20-poly1305"),
qsTr("aes-256-gcm"),
qsTr("aes-192-gcm"),
qsTr("aes-128-gcm")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxProtoCloakCipherText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxProtoCloakCipherText = currentText
}
}
LabelType {
x: 30
y: 60
width: 151
height: 31
text: qsTr("Cipher")
}
LabelType {
x: 30
y: 160
width: 151
height: 31
text: qsTr("Port")
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Cloak Settings")
x: 20
y: 0
width: 340
height: 30
}
LabelType {
x: 30
y: 110
width: 151
height: 31
text: qsTr("Fake Web Site")
}
LabelType {
id: label_proto_cloak_info
x: 30
y: 550
width: 321
height: 41
}
TextFieldType {
id: lineEdit_proto_cloak_port
x: 190
y: 160
width: 151
height: 31
text: UiLogic.lineEditProtoCloakPortText
onEditingFinished: {
UiLogic.lineEditProtoCloakPortText = text
}
}
TextFieldType {
id: lineEdit_proto_cloak_site
x: 190
y: 110
width: 151
height: 31
text: UiLogic.lineEditProtoCloakSiteText
onEditingFinished: {
UiLogic.lineEditProtoCloakSiteText = text
}
}
ProgressBar {
id: progressBar_proto_cloak_reset
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
from: 0
to: 100
value: 0
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progressBar_proto_cloak_reset.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
text: qsTr("Save and restart VPN")
}
}
}

View file

@ -0,0 +1,256 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Item {
x: 0
y: 40
width: 380
height: 600
CheckBoxType {
x: 30
y: 280
width: 321
height: 21
text: qsTr("Auto-negotiate encryption")
checked: UiLogic.checkBoxProtoOpenvpnAutoEncryptionChecked
onCheckedChanged: {
UiLogic.checkBoxProtoOpenvpnAutoEncryptionChecked = checked
}
}
CheckBoxType {
x: 30
y: 430
width: 321
height: 21
text: qsTr("Block DNS requests outside of VPN")
checked: UiLogic.checkBoxProtoOpenvpnBlockDnsChecked
onCheckedChanged: {
UiLogic.checkBoxProtoOpenvpnBlockDnsChecked = checked
}
}
CheckBoxType {
x: 30
y: 390
width: 321
height: 21
text: qsTr("Enable TLS auth")
checked: UiLogic.checkBoxProtoOpenvpnTlsAuthChecked
onCheckedChanged: {
UiLogic.checkBoxProtoOpenvpnTlsAuthChecked = checked
}
}
ComboBoxType {
x: 30
y: 340
width: 151
height: 31
model: [
qsTr("AES-256-GCM"),
qsTr("AES-192-GCM"),
qsTr("AES-128-GCM"),
qsTr("AES-256-CBC"),
qsTr("AES-192-CBC"),
qsTr("AES-128-CBC"),
qsTr("ChaCha20-Poly1305"),
qsTr("ARIA-256-CBC"),
qsTr("CAMELLIA-256-CBC"),
qsTr("none")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxProtoOpenvpnCipherText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxProtoOpenvpnCipherText = currentText
}
}
ComboBoxType {
x: 200
y: 340
width: 151
height: 31
model: [
qsTr("SHA512"),
qsTr("SHA384"),
qsTr("SHA256"),
qsTr("SHA3-512"),
qsTr("SHA3-384"),
qsTr("SHA3-256"),
qsTr("whirlpool"),
qsTr("BLAKE2b512"),
qsTr("BLAKE2s256"),
qsTr("SHA1")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxProtoOpenvpnHashText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxProtoOpenvpnHashText = currentText
}
}
Rectangle {
x: 30
y: 140
width: 321
height: 71
border.width: 1
border.color: "lightgray"
radius: 2
RadioButtonType {
x: 10
y: 40
width: 171
height: 19
text: qsTr("TCP")
}
RadioButtonType {
x: 10
y: 10
width: 171
height: 19
text: qsTr("UDP")
checked: UiLogic.radioButtonProtoOpenvpnUdpChecked
onCheckedChanged: {
UiLogic.radioButtonProtoOpenvpnUdpChecked = checked
}
}
}
LabelType {
x: 30
y: 110
width: 151
height: 21
text: qsTr("Network protocol")
}
LabelType {
x: 30
y: 230
width: 151
height: 31
text: qsTr("Port")
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("OpenVPN Settings")
x: 10
y: 0
width: 340
height: 30
}
LabelType {
x: 200
y: 310
width: 151
height: 21
text: qsTr("Hash")
}
LabelType {
x: 30
y: 40
width: 291
height: 21
text: qsTr("VPN Addresses Subnet")
}
LabelType {
x: 30
y: 310
width: 151
height: 21
text: qsTr("Cipher")
}
LabelType {
id: label_proto_openvpn_info
x: 30
y: 550
width: 321
height: 41
}
TextFieldType {
id: lineEdit_proto_openvpn_port
x: 200
y: 230
width: 151
height: 31
text: UiLogic.lineEditProtoOpenvpnPortText
onEditingFinished: {
UiLogic.lineEditProtoOpenvpnPortText = text
}
}
TextFieldType {
id: lineEdit_proto_openvpn_subnet
x: 30
y: 65
width: 321
height: 31
text: UiLogic.lineEditProtoOpenvpnSubnetText
onEditingFinished: {
UiLogic.lineEditProtoOpenvpnSubnetText = text
}
}
ProgressBar {
id: progressBar_proto_openvpn_reset
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
from: 0
to: 100
value: 0
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progressBar_proto_openvpn_reset.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
text: qsTr("Save and restart VPN")
}
}
}

View file

@ -0,0 +1,127 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Item {
x: 0
y: 40
width: 380
height: 600
ComboBoxType {
x: 190
y: 60
width: 151
height: 31
model: [
qsTr("chacha20-poly1305"),
qsTr("aes-256-gcm"),
qsTr("aes-128-gcm")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxProtoShadowsocksCipherText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxProtoShadowsocksCipherText = currentText
}
}
LabelType {
x: 30
y: 60
width: 151
height: 31
text: qsTr("Cipher")
}
LabelType {
x: 30
y: 110
width: 151
height: 31
text: qsTr("Port")
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("ShadowSocks Settings")
x: 30
y: 0
width: 340
height: 30
}
LabelType {
id: label_proto_shadowsocks_info
x: 30
y: 550
width: 321
height: 41
}
TextFieldType {
id: lineEdit_proto_shadowsocks_port
x: 190
y: 110
width: 151
height: 31
text: UiLogic.lineEditProtoShadowsocksPortText
onEditingFinished: {
UiLogic.lineEditProtoShadowsocksPortText = text
}
}
ProgressBar {
id: progressBar_proto_shadowsocks_reset
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
from: 0
to: 100
value: 0
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progressBar_proto_shadowsocks_reset.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
text: qsTr("Save and restart VPN")
}
}
}

View file

@ -0,0 +1,148 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
import QtGraphicalEffects 1.12
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: qsTr("Servers list")
x: 50
y: 30
width: 171
height: 40
}
ImageButtonType {
x: 240
y: 39
width: 24
height: 24
icon.source: "qrc:/images/plus.png"
}
ListModel {
id: md
ListElement {
description: "Bill Smith"
address: "555 3264"
}
ListElement {
description: "John Brown"
address: "555 8426"
}
ListElement {
description: "Sam Wise"
address: "555 0473"
}
}
ListView {
id: listWidget_servers
x: 20
y: 90
width: 340
height: 501
model: md
spacing: 5
delegate: Item {
height: 60
width: 341
LinearGradient {
visible: !ms.containsMouse
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: "#FAFBFE" }
GradientStop { position: 1.0; color: "#ECEEFF" }
}
}
LinearGradient {
visible: ms.containsMouse
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: "#FAFBFE" }
GradientStop { position: 1.0; color: "#DCDEDF" }
}
}
LabelType {
id: label_address
x: 20
y: 40
width: 141
height: 16
text: address
}
Text {
x: 10
y: 10
width: 181
height: 21
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
font.bold: true
color: "#181922"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: description
}
ImageButtonType {
x: 212
y: 25
width: 32
height: 24
checkable: true
iconMargin: 0
icon.source: checked ? "qrc:/images/connect_button_connected.png"
: "qrc:/images/connect_button_disconnected.png"
}
ImageButtonType {
x: 300
y: 25
width: 24
height: 24
checkable: true
icon.source: checked ? "qrc:/images/check.png"
: "qrc:/images/uncheck.png"
}
ImageButtonType {
x: 260
y: 25
width: 24
height: 24
icon.source: "qrc:/images/settings.png"
}
MouseArea {
id: ms
anchors.fill: parent
hoverEnabled: true
onClicked: {
listWidget_servers.currentIndex = index
mouse.accepted = false
}
}
}
}
}

View file

@ -0,0 +1,367 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Protocols")
x: 10
y: 35
width: 361
height: 31
}
ProgressBar {
id: progress_bar
anchors.horizontalCenter: parent.horizontalCenter
y: 570
width: 301
height: 40
from: 0
to: 100
value: 0
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progress_bar.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
LabelType {
anchors.fill: parent
text: qsTr("Configuring...")
horizontalAlignment: Text.AlignHCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
}
}
ScrollView {
x: 0
y: 70
width: 380
height: 471
clip: true
Column {
spacing: 5
Rectangle {
id: frame_openvpn_ss_cloak
x: 9
height: 135
width: 363
border.width: 1
border.color: "lightgray"
radius: 2
Item {
x: 5
y: 5
width: parent.width - 10
height: parent.height - 10
LabelType {
anchors.left: parent.left
width: 239
height: 24
text: qsTr("Cloak container")
leftPadding: 5
}
ImageButtonType {
anchors.right: sr1.left
anchors.rightMargin: 5
checkable: true
icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
width: 24
height: 24
}
ImageButtonType {
id: sr1
anchors.right: cn1.left
anchors.rightMargin: 5
icon.source: "qrc:/images/share.png"
width: 24
height: 24
}
ImageButtonType {
id: cn1
anchors.right: parent.right
checkable: true
icon.source: checked ? "qrc:/images/connect_button_connected.png"
: "qrc:/images/connect_button_disconnected.png"
width: 36
height: 24
}
}
Rectangle {
x: 10
y: 42
height: 83
width: 343
border.width: 1
border.color: "lightgray"
radius: 2
SettingButtonType {
x: 10
y: 10
width: 323
height: 24
text: qsTr("OpenVPN settings")
icon.source: "qrc:/images/settings.png"
}
SettingButtonType {
x: 10
y: 33
width: 323
height: 24
text: qsTr("ShadowSocks settings")
icon.source: "qrc:/images/settings.png"
}
SettingButtonType {
x: 10
y: 56
width: 323
height: 24
text: qsTr("Cloak settings")
icon.source: "qrc:/images/settings.png"
}
}
}
Rectangle {
id: frame_openvpn_ss
x: 9
height: 105
width: 363
border.width: 1
border.color: "lightgray"
radius: 2
Item {
x: 5
y: 5
width: parent.width - 10
height: parent.height - 10
LabelType {
anchors.left: parent.left
width: 239
height: 24
text: qsTr("ShadowSocks container")
leftPadding: 5
}
ImageButtonType {
anchors.right: sr2.left
anchors.rightMargin: 5
checkable: true
icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
width: 24
height: 24
}
ImageButtonType {
id: sr2
anchors.right: cn2.left
anchors.rightMargin: 5
icon.source: "qrc:/images/share.png"
width: 24
height: 24
}
ImageButtonType {
id: cn2
anchors.right: parent.right
checkable: true
icon.source: checked ? "qrc:/images/connect_button_connected.png"
: "qrc:/images/connect_button_disconnected.png"
width: 36
height: 24
}
}
Rectangle {
x: 10
y: 42
height: 53
width: 343
border.width: 1
border.color: "lightgray"
radius: 2
SettingButtonType {
x: 10
y: 5
width: 323
height: 24
text: qsTr("OpenVPN settings")
icon.source: "qrc:/images/settings.png"
}
SettingButtonType {
x: 10
y: 27
width: 323
height: 24
text: qsTr("ShadowSocks settings")
icon.source: "qrc:/images/settings.png"
}
}
}
Rectangle {
id: frame_openvpn
x: 9
height: 100
width: 363
border.width: 1
border.color: "lightgray"
radius: 2
Item {
x: 5
y: 5
width: parent.width - 10
height: parent.height - 10
LabelType {
anchors.left: parent.left
width: 239
height: 24
text: qsTr("OpenVPN container")
leftPadding: 5
}
ImageButtonType {
anchors.right: sr3.left
anchors.rightMargin: 5
checkable: true
icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
width: 24
height: 24
}
ImageButtonType {
id: sr3
anchors.right: cn3.left
anchors.rightMargin: 5
icon.source: "qrc:/images/share.png"
width: 24
height: 24
}
ImageButtonType {
id: cn3
anchors.right: parent.right
checkable: true
icon.source: checked ? "qrc:/images/connect_button_connected.png"
: "qrc:/images/connect_button_disconnected.png"
width: 36
height: 24
}
}
Rectangle {
x: 10
y: 42
height: 44
width: 343
border.width: 1
border.color: "lightgray"
radius: 2
SettingButtonType {
x: 10
y: 10
width: 323
height: 24
text: qsTr("OpenVPN settings")
icon.source: "qrc:/images/settings.png"
}
}
}
Rectangle {
id: frame_wireguard
x: 9
height: 100
width: 363
border.width: 1
border.color: "lightgray"
radius: 2
visible: UiLogic.frameFireguardVisible
Item {
x: 5
y: 5
width: parent.width - 10
height: parent.height - 10
LabelType {
anchors.left: parent.left
width: 239
height: 24
text: qsTr("WireGuard container")
leftPadding: 5
}
ImageButtonType {
anchors.right: sr4.left
anchors.rightMargin: 5
checkable: true
icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
width: 24
height: 24
}
ImageButtonType {
id: sr4
anchors.right: cn4.left
anchors.rightMargin: 5
icon.source: "qrc:/images/share.png"
width: 24
height: 24
}
ImageButtonType {
id: cn4
anchors.right: parent.right
checkable: true
icon.source: checked ? "qrc:/images/connect_button_connected.png"
: "qrc:/images/connect_button_disconnected.png"
width: 36
height: 24
}
}
Rectangle {
id: frame_wireguard_settings
visible: UiLogic.frameWireguardSettingsVisible
x: 10
y: 42
height: 44
width: 343
border.width: 1
border.color: "lightgray"
radius: 2
SettingButtonType {
x: 10
y: 10
width: 323
height: 24
text: qsTr("WireGuard settings")
icon.source: "qrc:/images/settings.png"
}
}
}
}
}
}

View file

@ -0,0 +1,115 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Server settings")
x: 10
y: 35
width: 361
height: 31
}
Image {
anchors.horizontalCenter: root.horizontalCenter
width: GC.trW(150)
height: GC.trH(22)
y: GC.trY(590)
source: "qrc:/images/AmneziaVPN.png"
}
LabelType {
x: 20
y: 150
width: 341
height: 31
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: UiLogic.labelServerSettingsCurrentVpnProtocolText
}
LabelType {
x: 20
y: 120
width: 341
height: 31
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: UiLogic.labelServerSettingsServerText
}
LabelType {
x: 40
y: 530
width: 301
height: 41
text: UiLogic.labelServerSettingsWaitInfoText
visible: UiLogic.labelServerSettingsWaitInfoVisible
}
TextFieldType {
// x: 70
anchors.horizontalCenter: parent.horizontalCenter
y: 80
width: 251
height: 31
text: UiLogic.lineEditServerSettingsDescriptionText
onEditingFinished: {
UiLogic.lineEditServerSettingsDescriptionText = text
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 410
width: 300
height: 40
text: qsTr("Clear server from Amnezia software")
visible: UiLogic.pushButtonServerSettingsClearVisible
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 350
width: 300
height: 40
text: qsTr("Clear client cached profile")
visible: UiLogic.pushButtonServerSettingsClearClientCacheVisible
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 470
width: 300
height: 40
text: qsTr("Forget this server")
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 210
width: 300
height: 40
text: qsTr("VPN protocols")
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 260
width: 300
height: 40
text: qsTr("Share Server (FULL ACCESS)")
visible: UiLogic.pushButtonServerSettingsShareFullVisible
}
}

View file

@ -0,0 +1,122 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Page 1.0
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back_from_setup_wizard
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup your server to use VPN")
x: 10
y: 35
width: 361
height: 31
}
Item {
x: 10
y: 70
width: 361
height: 561
LabelType {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
text: qsTr("I'm living in country with high censorship level. Many of foreign web sites and VPNs blocked by my government. I want to setup reliable VPN, which is invisible for government.")
wrapMode: Text.Wrap
x: 30
y: 40
width: 321
height: 121
}
LabelType {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
text: qsTr("I'm living in country with medium censorship level. Some web sites blocked by my government, but VPNs are not blocked at all. I want to setup flexible solution.")
wrapMode: Text.Wrap
x: 30
y: 210
width: 321
height: 121
}
LabelType {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignTop
text: qsTr("I just want to improve my privacy in internet.")
wrapMode: Text.Wrap
x: 30
y: 360
width: 321
height: 121
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 490
width: 321
height: 40
text: qsTr("Next")
onClicked: {
if (radioButton_setup_wizard_high.checked) {
UiLogic.goToPage(Page.WizardHigh);
} else if (radioButton_setup_wizard_medium.checked) {
UiLogic.goToPage(Page.WizardMedium);
} else if (radioButton_setup_wizard_low.checked) {
UiLogic.goToPage(Page.WizardLow);
}
}
}
RadioButtonType {
id: radioButton_setup_wizard_high
x: 10
y: 10
width: 331
height: 25
text: qsTr("High censorship level")
checked: UiLogic.radioButtonSetupWizardHighChecked
onCheckedChanged: {
UiLogic.radioButtonSetupWizardHighChecked = checked
}
}
RadioButtonType {
id: radioButton_setup_wizard_medium
x: 10
y: 330
width: 331
height: 25
text: qsTr("Low censorship level")
checked: UiLogic.radioButtonSetupWizardLowChecked
onCheckedChanged: {
UiLogic.radioButtonSetupWizardLowChecked = checked
}
}
RadioButtonType {
id: radioButton_setup_wizard_low
x: 10
y: 180
width: 331
height: 25
text: qsTr("Medium censorship level")
checked: UiLogic.radioButtonSetupWizardMediumChecked
onCheckedChanged: {
UiLogic.radioButtonSetupWizardMediumChecked = checked
}
}
}
}

View file

@ -0,0 +1,97 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Page 1.0
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back_from_setup_wizard
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup Wizard")
x: 10
y: 35
width: 361
height: 31
}
Item {
x: 10
y: 70
width: 361
height: 561
LabelType {
x: 30
y: 10
width: 321
height: 321
text: qsTr("AmneziaVPN will install VPN protocol which is not visible for your internet provider and government firewall. Your VPN connection will be detected by your provider as regular web traffic to particular web site.\n\nYou SHOULD set this web site address to some foreign web site which is updatesnot blocked by your internet provider. Other words you need to type below some foreign web site address which is accessible without VPN.\n\nPlease note, this protocol still does not support export connection profile to mobile devices. Keep for updates.")
}
LabelType {
x: 30
y: 400
width: 321
height: 71
text: qsTr("OpenVPN over Cloak (VPN obfuscation) profile will be installed")
}
LabelType {
x: 30
y: 330
width: 291
height: 21
text: qsTr("Type web site address for mask")
}
TextFieldType {
id: website_masking
x: 30
y: 360
width: 301
height: 41
text: UiLogic.lineEditSetupWizardHighWebsiteMaskingText
onEditingFinished: {
let _text = website_masking.text
_text.replace("http://", "");
_text.replace("https://", "");
if (!_text) {
return
}
_text = _text.split("/").first();
UiLogic.lineEditSetupWizardHighWebsiteMaskingText = _text
}
onAccepted: {
next_button.clicked()
}
}
BlueButtonType {
id: next_button
x: 30
y: 490
width: 301
height: 40
text: qsTr("Next")
onClicked: {
let domain = website_masking.text;
if (!domain || !domain.includes(".")) {
return
}
UiLogic.goToPage(Page.WizardVpnMode)
}
}
}
}

View file

@ -0,0 +1,66 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back_from_setup_wizard
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup Wizard")
x: 10
y: 35
width: 361
height: 31
}
Item {
x: 10
y: 70
width: 361
height: 561
LabelType {
x: 30
y: 10
width: 321
height: 341
verticalAlignment: Text.AlignTop
text: qsTr('AmneziaVPN will install OpenVPN protocol with public/private key pairs generated on server and client sides. You can also configure connection on your mobile device by copying exported ".ovpn" file to your device and setting up official OpenVPN client. We recommend do not use messengers for sending connection profile - it contains VPN private keys.')
}
LabelType {
x: 30
y: 400
width: 321
height: 71
text: qsTr('OpenVPN profile will be installed')
verticalAlignment: Text.AlignBottom
}
BlueButtonType {
id: next_button
x: 30
y: 490
width: 301
height: 40
text: qsTr("Start configuring")
onClicked: {
UiLogic.onPushButtonSetupWizardLowFinishClicked()
}
}
}
}

View file

@ -0,0 +1,67 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Page 1.0
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back_from_setup_wizard
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup Wizard")
x: 10
y: 35
width: 361
height: 31
}
Item {
x: 10
y: 70
width: 361
height: 561
LabelType {
x: 30
y: 10
width: 321
height: 341
verticalAlignment: Text.AlignTop
text: qsTr('AmneziaVPN will install VPN protocol which is difficult to detect by your internet provider and government firewall (but possible). In most cases, this is the most suitable protocol. This protocol is faster compared to the VPN protocols with "web traffic masking".\n\nThis protocol support export connection profile to mobile devices using QR code (you should launch 3rd party opensource VPN client - ShadowSocks VPN).')
}
LabelType {
x: 30
y: 400
width: 321
height: 71
text: qsTr('OpenVPN over ShadowSocks profile will be installed')
verticalAlignment: Text.AlignBottom
}
BlueButtonType {
id: next_button
x: 30
y: 490
width: 301
height: 40
text: qsTr("Next")
onClicked: {
UiLogic.goToPage(Page.WizardVpnMode)
}
}
}
}

View file

@ -0,0 +1,68 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
ImageButtonType {
id: back_from_setup_wizard
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup Wizard")
x: 10
y: 35
width: 361
height: 31
}
Item {
x: 10
y: 70
width: 361
height: 561
CheckBoxType {
x: 30
y: 350
width: 301
height: 71
text: qsTr('Turn on mode "VPN for selected sites"')
checked: UiLogic.checkBoxSetupWizardVpnModeChecked
onCheckedChanged: {
UiLogic.checkBoxSetupWizardVpnModeChecked = checked
}
}
LabelType {
x: 30
y: 10
width: 321
height: 341
text: qsTr('Optional.\n\nWe recommend to enable VPN mode "For selected sites" and add blocked sites you need to visit manually. If you will choose this option, you will need add every bloked site you want to visit to the access list. You may switch between modes later.\n\nPlease note, you should add addresses to the list after VPN connection established. You may add any domain, URL or IP address, it will be resolved to IP address.')
}
BlueButtonType {
id: vpn_mode_finish
x: 30
y: 490
width: 301
height: 40
text: qsTr("Start configuring")
onClicked: {
UiLogic.onPushButtonSetupWizardVpnModeFinishClicked()
}
}
}
}

View file

@ -0,0 +1,346 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
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
]
function clearActive() {
for (let i = 0; i < contentList.length; ++i) {
contentList[i].active = false
}
}
Column {
spacing: 5
ShareConnectionContent {
id: full_access
x: 0
text: qsTr("Full access")
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
text: qsTr("Copy")
}
ShareConnectionButtonType {
x: 10
y: 180
width: 341
height: 40
text: qsTr("Save file")
}
TextFieldType {
x: 10
y: 10
width: 341
height: 100
verticalAlignment: Text.AlignTop
}
}
}
onClicked: {
if (active) {
active = false
} else {
ct.clearActive()
active = true
}
}
}
ShareConnectionContent {
id: share_amezia
x: 0
text: qsTr("Share for Amnezia client")
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
text: qsTr("Copy")
}
ShareConnectionButtonType {
x: 10
y: 130
width: 341
height: 40
text: qsTr("Generate config")
}
ShareConnectionButtonType {
x: 10
y: 230
width: 341
height: 40
text: qsTr("Save file")
}
TextFieldType {
x: 10
y: 10
width: 341
height: 100
verticalAlignment: Text.AlignTop
}
}
}
onClicked: {
if (active) {
active = false
} else {
ct.clearActive()
active = true
}
}
}
ShareConnectionContent {
id: share_openvpn
x: 0
text: qsTr("Share for OpenVPN client")
content: Component {
Item {
width: 360
height: 380
ShareConnectionButtonType {
x: 10
y: 180
width: 341
height: 40
text: qsTr("Copy")
}
ShareConnectionButtonType {
x: 10
y: 130
width: 341
height: 40
text: qsTr("Generate config")
}
ShareConnectionButtonType {
x: 10
y: 230
width: 341
height: 40
text: qsTr("Save file")
}
TextFieldType {
x: 10
y: 10
width: 341
height: 100
verticalAlignment: Text.AlignTop
}
}
}
onClicked: {
if (active) {
active = false
} else {
ct.clearActive()
active = true
}
}
}
ShareConnectionContent {
id: share_shadowshock
x: 0
text: qsTr("Share for ShadowSocks client")
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
text: qsTr("Password")
}
LabelType {
x: 130
y: 10
width: 100
height: 20
text: qsTr("Server:")
}
LabelType {
x: 130
y: 50
width: 100
height: 20
text: qsTr("Encryption:")
}
LabelType {
x: 130
y: 30
width: 100
height: 20
text: qsTr("Port:")
}
Image {
id: label_share_ss_qr_code
x: 85
y: 235
width: 200
height: 200
// source: "file"
}
ShareConnectionButtonType {
x: 10
y: 180
width: 331
height: 40
text: qsTr("Copy")
}
TextFieldType {
x: 10
y: 130
width: 331
height: 100
horizontalAlignment: Text.AlignHCenter
}
}
}
onClicked: {
if (active) {
active = false
} else {
ct.clearActive()
active = true
}
}
}
ShareConnectionContent {
id: share_cloak
x: 0
text: qsTr("Share for Cloak client")
content: Component {
Item {
width: 360
height: 380
ShareConnectionButtonType {
x: 10
y: 290
width: 331
height: 40
text: qsTr("Copy")
}
TextInput {
x: 10
y: 30
width: 331
height: 100
}
}
}
onClicked: {
if (active) {
active = false
} else {
ct.clearActive()
active = true
}
}
}
}
}
}
}

157
client/ui/qml/PageSites.qml Normal file
View file

@ -0,0 +1,157 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
import Qt.labs.qmlmodels 1.0
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#333333"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Web site/Hostname/IP address/Subnet")
x: 20
y: 110
width: 311
height: 21
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 20
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignTop
text: qsTr("These sites will be opened using VPN")
x: 20
y: 40
width: 340
height: 60
}
TextFieldType {
x: 20
y: 140
width: 231
height: 31
placeholderText: qsTr("yousite.com or IP address")
}
ImageButtonType {
id: back
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
onClicked: {
UiLogic.closePage()
}
}
BlueButtonType {
id: sites_add
x: 260
y: 140
width: 51
height: 31
font.pixelSize: 24
text: "+"
}
BlueButtonType {
id: sites_delete
x: 80
y: 589
width: 231
height: 31
font.pixelSize: 16
text: qsTr("Delete selected")
}
BasicButtonType {
id: sites_import
x: 320
y: 140
width: 51
height: 31
background: Rectangle {
anchors.fill: parent
radius: 4
color: parent.containsMouse ? "#211966" : "#100A44"
}
font.pixelSize: 16
contentItem: Item {
anchors.fill: parent
Image {
anchors.centerIn: parent
width: 20
height: 20
source: "qrc:/images/folder.png"
fillMode: Image.Stretch
}
}
antialiasing: true
}
TableView {
id: tb
x: 20
y: 200
width: 341
height: 371
rowSpacing: 1
clip: true
property int currentRow: -1
columnSpacing: 0
model: TableModel {
TableModelColumn { display: "name" }
TableModelColumn { display: "color" }
rows: [
{
"name": "cat",
"color": "black"
},
{
"name": "dog",
"color": "brown"
},
{
"name": "bird",
"color": "white"
}
]
}
delegate: Item {
implicitWidth: 170
implicitHeight: 30
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: row !== tb.currentRow
}
Rectangle {
anchors.fill: parent
color: "#63B4FB"
visible: row === tb.currentRow
}
Text {
text: display
anchors.fill: parent
leftPadding: 10
verticalAlignment: Text.AlignVCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
tb.currentRow = row
}
}
}
}
}

306
client/ui/qml/PageStart.qml Normal file
View file

@ -0,0 +1,306 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
Image {
anchors.horizontalCenter: root.horizontalCenter
width: GC.trW(150)
height: GC.trH(22)
y: GC.trY(590)
source: "qrc:/images/AmneziaVPN.png"
}
BasicButtonType {
id: start_switch_page
anchors.horizontalCenter: parent.horizontalCenter
y: 530
width: 301
height: 40
text: qsTr("Set up your own server")
checked: false
checkable: true
onCheckedChanged: {
// if (checked){
// ui->stackedWidget_start->setCurrentWidget(ui->page_start_new_server);
// ui->pushButton_start_switch_page->setText(tr("Import connection"));
// }
// else {
// ui->stackedWidget_start->setCurrentWidget(ui->page_start_import);
// ui->pushButton_start_switch_page->setText(tr("Set up your own server"));
// }
}
background: Rectangle {
anchors.fill: parent
border.width: 1
border.color: "#211C4A"
radius: 4
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#100A44"
text: start_switch_page.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
}
StackView {
id: page_start_stack_view
x: 0
y: 35
width: 380
height: 481
initialItem: page_start_new_server
}
Component {
id: page_start_import
Item {
width: 380
height: 481
Text {
x: 0
y: 20
width: 381
height: 71
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
font.bold: true
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Connect to the already created VPN server")
wrapMode: Text.Wrap
}
LabelType {
x: 40
y: 110
width: 301
height: 21
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
text: qsTr("Connection code")
wrapMode: Text.Wrap
}
TextFieldType {
id: lineEdit_start_existing_code
x: 40
y: 140
width: 300
height: 40
placeholderText: "vpn://..."
text: UiLogic.lineEditStartExistingCodeText
onEditingFinished: {
UiLogic.lineEditStartExistingCodeText = text
}
}
BlueButtonType {
id: new_sever_import
anchors.horizontalCenter: parent.horizontalCenter
y: 210
width: 301
height: 40
text: qsTr("Connect")
onClicked: {
UiLogic.onPushButtonNewServerImport()
}
}
}
}
Component {
id: page_start_new_server
Item {
width: 380
height: 481
Label {
x:10
y:0
width: 361
height: 31
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
font.bold: true
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Setup your server to use VPN")
wrapMode: Text.Wrap
}
LabelType {
x: 40
y: 70
width: 171
height: 21
text: qsTr("Server IP address")
}
LabelType {
x: 40
y: 150
width: 261
height: 21
text: qsTr("Login to connect via SSH")
}
LabelType {
x: 40
y: 230
width: 171
height: 21
text: qsTr("Password")
}
LabelType {
x: 40
y: 390
width: 301
height: 41
text: UiLogic.labelNewServerWaitInfoText
visible: UiLogic.labelNewServerWaitInfoVisible
wrapMode: Text.Wrap
}
TextFieldType {
id: new_server_ip
x: 40
y: 100
width: 300
height: 40
text: UiLogic.lineEditNewServerIpText
onEditingFinished: {
UiLogic.lineEditNewServerIpText = text
}
}
TextFieldType {
id: new_server_login
x: 40
y: 180
width: 300
height: 40
text: UiLogic.lineEditNewServerLoginText
onEditingFinished: {
UiLogic.lineEditNewServerLoginText = text
}
}
TextFieldType {
id: new_server_password
x: 40
y: 260
width: 300
height: 40
echoMode: TextInput.Password
text: UiLogic.lineEditNewServerPasswordText
onEditingFinished: {
UiLogic.lineEditNewServerPasswordText = text
}
}
BlueButtonType {
id: new_sever_connect
anchors.horizontalCenter: parent.horizontalCenter
y: 350
width: 301
height: 40
text: qsTr("Connect")
visible: UiLogic.pushButtonNewServerConnectVisible
onClicked: {
UiLogic.onPushButtonNewServerConnect()
}
}
BasicButtonType {
id: new_sever_connect_key
anchors.horizontalCenter: parent.horizontalCenter
y: 450
width: 281
height: 21
text: qsTr("Connect using SSH key")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: new_sever_connect_key.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: UiLogic.pushButtonNewServerConnectKeyChecked
onCheckedChanged: {
UiLogic.pushButtonNewServerConnectKeyChecked = checked
}
}
BasicButtonType {
id: new_sever_get_info
anchors.horizontalCenter: parent.horizontalCenter
y: 40
width: 281
height: 21
text: qsTr("Where to get connection data →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: new_sever_get_info.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: true
onClicked: {
Qt.openUrlExternally("https://amnezia.org")
}
}
TextFieldType {
id: new_server_ssh_key
x: 40
y: 260
width: 300
height: 71
echoMode: TextInput.Password
font.pixelSize: 9
verticalAlignment: Text.AlignTop
text: UiLogic.textEditNewServerSshKeyText
onEditingFinished: {
UiLogic.textEditNewServerSshKeyText = text
}
}
}
}
ImageButtonType {
id: back_from_start
x: 10
y: 10
width: 26
height: 20
icon.source: "qrc:/images/arrow_left.png"
visible: UiLogic.pushButtonBackFromStartVisible
onClicked: {
UiLogic.closePage()
}
}
}

220
client/ui/qml/PageVPN.qml Normal file
View file

@ -0,0 +1,220 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Page 1.0
import "./"
Item {
id: root
width: GC.screenWidth
height: GC.screenHeight
Image {
x: 20
y: 424
width: 325
height: 1
source: "qrc:/images/line.png"
}
Text {
x: 20
y: 440
width: 281
height: 21
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 15
color: "#181922"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: qsTr("How to use VPN")
}
LabelType {
id: error_text
x: 0
y: 280
width: 381
height: 61
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: qsTr("Error text")
}
Text {
x: 0
y: 250
width: 380
height: 31
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 15
color: "#181922"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: qsTr("Connected")
}
Image {
x: 0
y: 0
width: 380
height: 325
source: "qrc:/images/background_connected.png"
}
BasicButtonType {
id: button_connect
x: 150
y: 200
width: 80
height: 40
checkable: true
checked: UiLogic.pushButtonConnectChecked
onCheckedChanged: {
UiLogic.pushButtonConnectChecked = checked
UiLogic.onPushButtonConnectClicked()
}
background: Image {
anchors.fill: parent
source: button_connect.checked ? "qrc:/images/connect_button_connected.png"
: "qrc:/images/connect_button_disconnected.png"
}
contentItem: Item {}
antialiasing: true
}
ImageButtonType {
x: 340
y: 10
width: 31
height: 31
icon.source: "qrc:/images/settings_grey.png"
}
BasicButtonType {
id: button_add_site
x: 20
y: 560
width: 341
height: 40
text: qsTr("+ Add site")
enabled: UiLogic.pushButtonVpnAddSiteEnabled
background: Rectangle {
anchors.fill: parent
radius: 4
color: {
if (!button_add_site.enabled) {
return "#484952"
}
if (button_add_site.containsMouse) {
return "#282932"
}
return "#181922"
}
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
text: button_add_site.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
onClicked: {
UiLogic.goToPage(Page.Sites)
}
}
Item {
x: 0
y: 360
width: 380
height: 51
Image {
x: 311
y: 10
width: 15
height: 15
source: "qrc:/images/upload.png"
}
Image {
x: 53
y: 10
width: 15
height: 15
source: "qrc:/images/download.png"
}
Text {
x: 0
y: 20
width: 127
height: 30
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#4171D6"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: qsTr("0 Mbps")
}
Text {
x: 260
y: 20
width: 118
height: 30
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#42D185"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: qsTr("0 Mbps")
}
}
Item {
x: 20
y: 470
width: 351
height: 91
RadioButtonType {
x: 0
y: 0
width: 341
height: 19
checked: UiLogic.radioButtonVpnModeAllSitesChecked
text: qsTr("For all connections")
onCheckedChanged: {
UiLogic.radioButtonVpnModeAllSitesChecked = checked
button_add_site.enabled = !checked
UiLogic.onRadioButtonVpnModeAllSitesToggled(checked)
}
}
RadioButtonType {
x: 0
y: 60
width: 341
height: 19
text: qsTr("Except selected sites")
checked: UiLogic.radioButtonVpnModeExceptSitesChecked
onCheckedChanged: {
UiLogic.radioButtonVpnModeExceptSitesChecked = checked
UiLogic.onRadioButtonVpnModeExceptSitesToggled(checked)
}
}
RadioButtonType {
x: 0
y: 30
width: 341
height: 19
text: qsTr("For selected sites")
checked: UiLogic.radioButtonVpnModeForwardSitesChecked
onCheckedChanged: {
UiLogic.radioButtonVpnModeForwardSitesChecked = checked
UiLogic.onRadioButtonVpnModeForwardSitesToggled(checked)
}
}
}
}

View file

@ -0,0 +1,15 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
RadioButton {
id: root
contentItem: Text {
text: root.text
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
verticalAlignment: Text.AlignVCenter
leftPadding: root.indicator.width + root.spacing
}
}

View file

@ -0,0 +1,26 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
background: Item {}
contentItem: Item {
anchors.fill: parent
Image {
source: root.icon.source
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
Text {
anchors.fill: parent
leftPadding: 30
text: root.text
color: root.enabled ? "#100A44": "#AAAAAA"
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 20
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
background: Rectangle {
anchors.fill: parent
radius: 4
color: root.containsMouse ? "#282932" : "#181922"
}
font.pixelSize: 16
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: root.font.pixelSize
color: "#D4D4D4"
text: root.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
}

View file

@ -0,0 +1,75 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
Item {
id: root
property bool active: false
property Component content: undefined
property string text: ""
width: 360
height: active ? contentLoader.item.height + 40 + 5 * 2 : 40
signal clicked()
Rectangle {
x: 0
y: 0
width: parent.width
height: 40
color: "transparent"
clip: true
radius: 2
LinearGradient {
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: "#E1E1E1" }
GradientStop { position: 0.4; color: "#DDDDDD" }
GradientStop { position: 0.5; color: "#D8D8D8" }
GradientStop { position: 1.0; color: "#D3D3D3" }
}
}
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
source: "qrc:/images/share.png"
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 2
color: "#148CD2"
visible: ms.containsMouse ? true : false
}
Text {
x: 40
anchors.verticalCenter: parent.verticalCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 18
color: "#100A44"
font.bold: true
text: root.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}
MouseArea {
id: ms
anchors.fill: parent
hoverEnabled: true
onClicked: root.clicked()
}
}
Loader {
x: 0
y: 40 + 5
id: contentLoader
sourceComponent: root.content
visible: root.active
}
}

View file

@ -0,0 +1,34 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
TextField {
id: root
property bool error: false
// font.
selectionColor: "darkgray"
font.pixelSize: 16
color: "#333333"
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
border.width: 1
color: {
if (root.error) {
return Qt.rgba(213, 40, 60, 255)
}
return root.enabled ? "#F4F4F4" : Qt.rgba(127, 127, 127, 255)
}
border.color: {
if (!root.enabled) {
return Qt.rgba(127, 127, 127, 255)
}
if (root.error) {
return Qt.rgba(213, 40, 60, 255)
}
if (root.focus) {
return "#A7A7A7"
}
return "#A7A7A7"
}
}
}

View file

@ -0,0 +1,37 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "./"
Rectangle {
id: root
color: "#F5F5F5"
width: GC.screenWidth
height: 30
signal closeButtonClicked()
Button {
id: closeButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: 5
icon.source: "qrc:/images/close.png"
icon.width: 16
icon.height: 16
width: height
height: 20
background: Item {}
contentItem: Image {
source: closeButton.icon.source
anchors.fill: closeButton
anchors.margins: ms.containsMouse ? 3 : 4
}
MouseArea {
id: ms
hoverEnabled: true
anchors.fill: closeButton
}
onClicked: {
root.closeButtonClicked()
}
}
}

417
client/ui/qml/main.qml Normal file
View file

@ -0,0 +1,417 @@
import QtQuick 2.14
import QtQuick.Window 2.14
import QtQuick.Controls 2.12
import Page 1.0
import Qt.labs.platform 1.1
import QtQuick.Dialogs 1.1
import "./"
Window {
id: root
visible: true
width: GC.screenWidth
height: GC.isDesktop() ? GC.screenHeight + titleBar.height : GC.screenHeight
// flags: Qt.FramelessWindowHint
title: "AmneziaVPN"
function getPageComponent(page) {
switch (page) {
case Page.Start:
return page_start;
case Page.NewServer:
return page_new_server
case Page.NewServerProtocols:
return page_new_server_protocols
case Page.Wizard:
return page_setup_wizard
case Page.WizardHigh:
return page_setup_wizard_high_level
case Page.WizardLow:
return page_setup_wizard_low_level
case Page.WizardMedium:
return page_setup_wizard_medium_level
case Page.WizardVpnMode:
return page_setup_wizard_vpn_mode
case Page.ServerConfiguring:
return page_new_server_configuring
case Page.Vpn:
return page_vpn
case Page.GeneralSettings:
return page_general_settings
case Page.AppSettings:
return page_app_settings
case Page.NetworkSettings:
return page_network_settings
case Page.ServerSettings:
return page_server_settings
case Page.ServerVpnProtocols:
return page_server_protocols
case Page.ServersList:
return page_servers
case Page.ShareConnection:
return page_share_connection
case Page.Sites:
return page_sites
case Page.OpenVpnSettings:
return page_proto_openvpn
case Page.ShadowSocksSettings:
return page_proto_shadowsocks
case Page.CloakSettings:
return page_proto_cloak
}
return undefined;
}
function getPageEnum(item) {
if (item instanceof PageStart) {
return Page.Start
}
if (item instanceof PageNewServer) {
return Page.NewServer
}
if (item instanceof PageNewServerProtocol) {
return Page.NewServerProtocols
}
if (item instanceof PageSetupWizard) {
return Page.Wizard
}
if (item instanceof PageSetupWizardHighLevel) {
return Page.WizardHigh
}
if (item instanceof PageSetupWizardLowLevel) {
return Page.WizardLow
}
if (item instanceof PageSetupWizardMediumLevel) {
return Page.WizardMedium
}
if (item instanceof PageSetupWizardVPNMode) {
return Page.WizardVpnMode
}
if (item instanceof PageNewServerConfiguring) {
return Page.ServerConfiguring
}
if (item instanceof PageVPN) {
return Page.Vpn
}
if (item instanceof PageGeneralSettings) {
return Page.GeneralSettings
}
if (item instanceof PageAppSetting) {
return Page.AppSettings
}
if (item instanceof PageNetworkSetting) {
return Page.NetworkSettings
}
if (item instanceof PageServerSetting) {
return Page.ServerSettings
}
if (item instanceof PageServerProtocols) {
return Page.ServerVpnProtocols
}
if (item instanceof PageServer) {
return Page.ServersList
}
if (item instanceof PageShareConnection) {
return Page.ShareConnection
}
if (item instanceof PageSites) {
return Page.Sites
}
if (item instanceof PageProtoOpenVPN) {
return Page.OpenVpnSettings
}
if (item instanceof PageProtoShadowSock) {
return Page.ShadowSocksSettings
}
if (item instanceof PageProtoCloak) {
return Page.CloakSettings
}
return Page.Start
}
function gotoPage(page, reset, slide) {
let pageComponent = getPageComponent(page)
if (reset) {
if (page === Page.ServerSettings) {
UiLogic.updateServerPage();
}
if (page === Page.ShareConnection) {}
if (page === Page.Wizard) {
UiLogic.radioButtonSetupWizardMediumChecked = true
}
if (page === Page.WizardHigh) {
UiLogic.updateWizardHighPage();
}
if (page === Page.ServerConfiguring) {
UiLogic.progressBarNewServerConfiguringValue = 0;
}
if (page === Page.GeneralSettings) {
UiLogic.updateGeneralSettingPage();
}
if (page === Page.ServersList) {
UiLogic.updateServersListPage();
}
if (page === Page.Start) {
UiLogic.pushButtonBackFromStartVisible = !pageLoader.empty
UiLogic.updateStartPage();
}
if (page === Page.NewServerProtocols) {
UiLogic.updateNewServerProtocolsPage()
}
if (page === Page.ServerVpnProtocols) {
UiLogic.updateProtocolsPage()
}
if (page === Page.AppSettings) {
UiLogic.updateAppSettingsPage()
}
if (page === Page.NetworkSettings) {
UiLogic.updateAppSettingsPage()
}
if (page === Page.Sites) {
UiLogic.updateSitesPage()
}
if (page === Page.Vpn) {
UiLogic.updateVpnPage()
}
UiLogic.pushButtonNewServerConnectKeyChecked = false
}
if (slide) {
pageLoader.push(pageComponent, {}, StackView.PushTransition)
} else {
pageLoader.push(pageComponent, {}, StackView.Immediate)
}
}
function close_page() {
if (pageLoader.depth <= 1) {
return
}
pageLoader.pop()
}
function set_start_page(page, slide) {
pageLoader.clear()
let pageComponent = getPageComponent(page)
if (slide) {
pageLoader.push(pageComponent, {}, StackView.PushTransition)
} else {
pageLoader.push(pageComponent, {}, StackView.Immediate)
}
if (page === Page.Start) {
UiLogic.pushButtonBackFromStartVisible = !pageLoader.empty
UiLogic.updateStartPage();
}
}
TitleBar {
id: titleBar
anchors.top: root.top
visible: GC.isDesktop()
DragHandler {
grabPermissions: TapHandler.CanTakeOverFromAnything
onActiveChanged: {
if (active) {
root.startSystemMove();
}
}
target: null
}
onCloseButtonClicked: {
if (UiLogic.currentPageValue === Page.Start ||
UiLogic.currentPageValue === Page.NewServer) {
Qt.quit()
} else {
root.hide()
}
}
}
Rectangle {
y: GC.isDesktop() ? titleBar.height : 0
width: GC.screenWidth
height: GC.screenHeight
color: "white"
}
StackView {
id: pageLoader
y: GC.isDesktop() ? titleBar.height : 0
width: GC.screenWidth
height: GC.screenHeight
initialItem: page_vpn
onCurrentItemChanged: {
let pageEnum = root.getPageEnum(currentItem)
console.debug(pageEnum)
UiLogic.currentPageValue = pageEnum
}
}
Component {
id: page_start
PageStart {}
}
Component {
id: page_new_server
PageNewServer {}
}
Component {
id: page_setup_wizard
PageSetupWizard {}
}
Component {
id: page_setup_wizard_high_level
PageSetupWizardHighLevel {}
}
Component {
id: page_setup_wizard_vpn_mode
PageSetupWizardVPNMode {}
}
Component {
id: page_setup_wizard_medium_level
PageSetupWizardMediumLevel {}
}
Component {
id: page_setup_wizard_low_level
PageSetupWizardLowLevel {}
}
Component {
id: page_new_server_protocols
PageNewServerProtocol {}
}
Component {
id: page_vpn
PageVPN {}
}
Component {
id: page_sites
PageSites {}
}
Component {
id: page_general_settings
PageGeneralSettings {}
}
Component {
id: page_servers
PageServer {}
}
Component {
id: page_app_settings
PageAppSetting {}
}
Component {
id: page_network_settings
PageNetworkSetting {}
}
Component {
id: page_server_settings
PageServerSetting {}
}
Component {
id: page_server_protocols
PageServerProtocols {}
}
Component {
id: page_share_connection
PageShareConnection {}
}
Component {
id: page_proto_openvpn
PageProtoOpenVPN {}
}
Component {
id: page_proto_shadowsocks
PageProtoShadowSock {}
}
Component {
id: page_proto_cloak
PageProtoCloak {}
}
Component {
id: page_new_server_configuring
PageNewServerConfiguring {}
}
Component.onCompleted: {
UiLogic.initalizeUiLogic()
}
Connections {
target: UiLogic
onGoToPage: {
root.gotoPage(page, reset, slide)
}
onClosePage: {
root.close_page()
}
onSetStartPage: {
root.set_start_page(page, slide)
}
}
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
onYes: {
Qt.quit()
}
visible: false
}
SystemTrayIcon {
visible: true
icon.source: UiLogic.trayIconUrl
onActivated: {
if (Qt.platform.os == "osx" ||
Qt.platform.os == "linux") {
if (reason === SystemTrayIcon.DoubleClick ||
reason === SystemTrayIcon.Trigger) {
root.show()
root.raise()
root.requestActivate()
}
}
}
menu: Menu {
MenuItem {
iconSource: "qrc:/images/tray/application.png"
text: qsTr("Show") + " " + "AmneziaVPN"
onTriggered: {
root.show()
root.raise()
}
}
MenuSeparator { }
MenuItem {
text: qsTr("Connect")
enabled: UiLogic.trayActionConnectEnabled
onTriggered: {
UiLogic.onConnect()
}
}
MenuItem {
text: qsTr("Disconnect")
enabled: UiLogic.trayActionDisconnectEnabled
onTriggered: {
UiLogic.onDisconnect()
}
}
MenuSeparator { }
MenuItem {
iconSource: "qrc:/images/tray/link.png"
text: qsTr("Visit Website")
onTriggered: {
Qt.openUrlExternally("https://amnezia.org")
}
}
MenuItem {
iconSource: "qrc:/images/tray/cancel.png"
text: qsTr("Quit") + " " + "AmneziaVPN"
onTriggered: {
closePrompt.open()
}
}
}
}
}

1
client/ui/qml/qmldir Normal file
View file

@ -0,0 +1 @@
singleton GC 1.0 GlobalConfig.qml