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

@ -1,4 +1,4 @@
QT += widgets core gui network xml remoteobjects
QT += widgets core gui network xml remoteobjects quick
TARGET = AmneziaVPN
TEMPLATE = app
@ -35,6 +35,7 @@ HEADERS += \
settings.h \
ui/Controls/SlidingStackedWidget.h \
ui/mainwindow.h \
ui/uilogic.h \
ui/qautostart.h \
ui/server_widget.h \
ui/sites_model.h \
@ -65,6 +66,7 @@ SOURCES += \
settings.cpp \
ui/Controls/SlidingStackedWidget.cpp \
ui/mainwindow.cpp \
ui/uilogic.cpp \
ui/qautostart.cpp \
ui/server_widget.cpp \
ui/sites_model.cpp \

View file

@ -5,10 +5,16 @@
#include <QTranslator>
#include <QTimer>
#include <QLoggingCategory>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "ui/uilogic.h"
#include "debug.h"
#include "defines.h"
#define QAPPLICATION_CLASS QGuiApplication
#include "singleapplication.h"
#undef QAPPLICATION_CLASS
#include "ui/mainwindow.h"
@ -79,23 +85,35 @@ int main(int argc, char *argv[])
app.setQuitOnLastWindowClosed(false);
MainWindow mainWindow;
// MainWindow mainWindow;
#ifdef Q_OS_WIN
if (parser.isSet("a")) mainWindow.showOnStartup();
else mainWindow.show();
#else
mainWindow.showOnStartup();
#endif
//#ifdef Q_OS_WIN
// if (parser.isSet("a")) mainWindow.showOnStartup();
// else mainWindow.show();
//#else
// mainWindow.showOnStartup();
//#endif
if (app.isPrimary()) {
QObject::connect(&app, &SingleApplication::instanceStarted, &mainWindow, [&](){
qDebug() << "Secondary instance started, showing this window instead";
mainWindow.show();
mainWindow.showNormal();
mainWindow.raise();
});
}
// if (app.isPrimary()) {
// QObject::connect(&app, &SingleApplication::instanceStarted, &mainWindow, [&](){
// qDebug() << "Secondary instance started, showing this window instead";
// mainWindow.show();
// mainWindow.showNormal();
// mainWindow.raise();
// });
// }
UiLogic uiLogic;
UiLogic::declareQML();
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/ui/qml/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.rootContext()->setContextProperty("UiLogic", &uiLogic);
engine.load(url);
return app.exec();
}

View file

@ -67,5 +67,41 @@
<file>server_scripts/wireguard/run_container.sh</file>
<file>server_scripts/wireguard/start.sh</file>
<file>server_scripts/wireguard/template.conf</file>
<file>ui/qml/main.qml</file>
<file>ui/qml/GlobalConfig.qml</file>
<file>ui/qml/qmldir</file>
<file>ui/qml/TitleBar.qml</file>
<file>ui/qml/PageStart.qml</file>
<file>ui/qml/TextFieldType.qml</file>
<file>ui/qml/LabelType.qml</file>
<file>ui/qml/BasicButtonType.qml</file>
<file>ui/qml/ImageButtonType.qml</file>
<file>ui/qml/PageNewServer.qml</file>
<file>ui/qml/BlueButtonType.qml</file>
<file>ui/qml/PageSetupWizard.qml</file>
<file>ui/qml/RadioButtonType.qml</file>
<file>ui/qml/PageSetupWizardHighLevel.qml</file>
<file>ui/qml/PageSetupWizardVPNMode.qml</file>
<file>ui/qml/CheckBoxType.qml</file>
<file>ui/qml/PageSetupWizardMediumLevel.qml</file>
<file>ui/qml/PageSetupWizardLowLevel.qml</file>
<file>ui/qml/PageNewServerConfiguring.qml</file>
<file>ui/qml/PageNewServerProtocol.qml</file>
<file>ui/qml/ComboBoxType.qml</file>
<file>ui/qml/PageVPN.qml</file>
<file>ui/qml/PageSites.qml</file>
<file>ui/qml/PageGeneralSettings.qml</file>
<file>ui/qml/SettingButtonType.qml</file>
<file>ui/qml/PageServer.qml</file>
<file>ui/qml/PageAppSetting.qml</file>
<file>ui/qml/PageNetworkSetting.qml</file>
<file>ui/qml/PageServerSetting.qml</file>
<file>ui/qml/PageServerProtocols.qml</file>
<file>ui/qml/PageShareConnection.qml</file>
<file>ui/qml/PageProtoOpenVPN.qml</file>
<file>ui/qml/PageProtoShadowSock.qml</file>
<file>ui/qml/PageProtoCloak.qml</file>
<file>ui/qml/ShareConnectionContent.qml</file>
<file>ui/qml/ShareConnectionButtonType.qml</file>
</qresource>
</RCC>

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

3057
client/ui/uilogic.cpp Normal file

File diff suppressed because it is too large Load diff

530
client/ui/uilogic.h Normal file
View file

@ -0,0 +1,530 @@
#ifndef UILOGIC_H
#define UILOGIC_H
#include <QLabel>
#include <QListWidget>
#include <QProgressBar>
#include <QPushButton>
#include <QRegExpValidator>
#include <QStack>
#include <QStringListModel>
#include <QSystemTrayIcon>
#include <QQmlEngine>
#include "3rd/QRCodeGenerator/QRCodeGenerator.h"
#include "framelesswindow.h"
#include "protocols/vpnprotocol.h"
#include "settings.h"
#include "sites_model.h"
class VpnConnection;
class UiLogic : public QObject
{
Q_OBJECT
Q_PROPERTY(bool frameWireguardSettingsVisible READ getFrameWireguardSettingsVisible WRITE setFrameWireguardSettingsVisible NOTIFY frameWireguardSettingsVisibleChanged)
Q_PROPERTY(bool frameFireguardVisible READ getFrameFireguardVisible WRITE setFrameFireguardVisible NOTIFY frameFireguardVisibleChanged)
Q_PROPERTY(bool frameNewServerSettingsParentWireguardVisible READ getFrameNewServerSettingsParentWireguardVisible WRITE setFrameNewServerSettingsParentWireguardVisible NOTIFY frameNewServerSettingsParentWireguardVisibleChanged)
Q_PROPERTY(bool radioButtonSetupWizardMediumChecked READ getRadioButtonSetupWizardMediumChecked WRITE setRadioButtonSetupWizardMediumChecked NOTIFY radioButtonSetupWizardMediumCheckedChanged)
Q_PROPERTY(QString lineEditSetupWizardHighWebsiteMaskingText READ getLineEditSetupWizardHighWebsiteMaskingText WRITE setLineEditSetupWizardHighWebsiteMaskingText NOTIFY lineEditSetupWizardHighWebsiteMaskingTextChanged)
Q_PROPERTY(double progressBarNewServerConfiguringValue READ getProgressBarNewServerConfiguringValue WRITE setProgressBarNewServerConfiguringValue NOTIFY progressBarNewServerConfiguringValueChanged)
Q_PROPERTY(bool pushButtonNewServerSettingsCloakChecked READ getPushButtonNewServerSettingsCloakChecked WRITE setPushButtonNewServerSettingsCloakChecked NOTIFY pushButtonNewServerSettingsCloakCheckedChanged)
Q_PROPERTY(bool pushButtonNewServerSettingsSsChecked READ getPushButtonNewServerSettingsSsChecked WRITE setPushButtonNewServerSettingsSsChecked NOTIFY pushButtonNewServerSettingsSsCheckedChanged)
Q_PROPERTY(bool pushButtonNewServerSettingsOpenvpnChecked READ getPushButtonNewServerSettingsOpenvpnChecked WRITE setPushButtonNewServerSettingsOpenvpnChecked NOTIFY pushButtonNewServerSettingsOpenvpnCheckedChanged)
Q_PROPERTY(QString lineEditNewServerCloakPortText READ getLineEditNewServerCloakPortText WRITE setLineEditNewServerCloakPortText NOTIFY lineEditNewServerCloakPortTextChanged)
Q_PROPERTY(QString lineEditNewServerCloakSiteText READ getLineEditNewServerCloakSiteText WRITE setLineEditNewServerCloakSiteText NOTIFY lineEditNewServerCloakSiteTextChanged)
Q_PROPERTY(QString lineEditNewServerSsPortText READ getLineEditNewServerSsPortText WRITE setLineEditNewServerSsPortText NOTIFY lineEditNewServerSsPortTextChanged)
Q_PROPERTY(QString comboBoxNewServerSsCipherText READ getComboBoxNewServerSsCipherText WRITE setComboBoxNewServerSsCipherText NOTIFY comboBoxNewServerSsCipherTextChanged)
Q_PROPERTY(QString lineEditNewServerOpenvpnPortText READ getlineEditNewServerOpenvpnPortText WRITE setLineEditNewServerOpenvpnPortText NOTIFY lineEditNewServerOpenvpnPortTextChanged)
Q_PROPERTY(QString comboBoxNewServerOpenvpnProtoText READ getComboBoxNewServerOpenvpnProtoText WRITE setComboBoxNewServerOpenvpnProtoText NOTIFY comboBoxNewServerOpenvpnProtoTextChanged)
Q_PROPERTY(bool pushButtonNewServerConnectKeyChecked READ getPushButtonNewServerConnectKeyChecked WRITE setPushButtonNewServerConnectKeyChecked NOTIFY pushButtonNewServerConnectKeyCheckedChanged)
Q_PROPERTY(QString lineEditStartExistingCodeText READ getLineEditStartExistingCodeText WRITE setLineEditStartExistingCodeText NOTIFY lineEditStartExistingCodeTextChanged)
Q_PROPERTY(QString textEditNewServerSshKeyText READ getTextEditNewServerSshKeyText WRITE setTextEditNewServerSshKeyText NOTIFY textEditNewServerSshKeyTextChanged)
Q_PROPERTY(QString lineEditNewServerIpText READ getLineEditNewServerIpText WRITE setLineEditNewServerIpText NOTIFY lineEditNewServerIpTextChanged)
Q_PROPERTY(QString lineEditNewServerPasswordText READ getLineEditNewServerPasswordText WRITE setLineEditNewServerPasswordText NOTIFY lineEditNewServerPasswordTextChanged)
Q_PROPERTY(QString lineEditNewServerLoginText READ getLineEditNewServerLoginText WRITE setLineEditNewServerLoginText NOTIFY lineEditNewServerLoginTextChanged)
Q_PROPERTY(bool labelNewServerWaitInfoVisible READ getLabelNewServerWaitInfoVisible WRITE setLabelNewServerWaitInfoVisible NOTIFY labelNewServerWaitInfoVisibleChanged)
Q_PROPERTY(QString labelNewServerWaitInfoText READ getLabelNewServerWaitInfoText WRITE setLabelNewServerWaitInfoText NOTIFY labelNewServerWaitInfoTextChanged)
Q_PROPERTY(double progressBarNewServerConnectionMinimum READ getProgressBarNewServerConnectionMinimum WRITE setProgressBarNewServerConnectionMinimum NOTIFY progressBarNewServerConnectionMinimumChanged)
Q_PROPERTY(double progressBarNewServerConnectionMaximum READ getProgressBarNewServerConnectionMaximum WRITE setProgressBarNewServerConnectionMaximum NOTIFY progressBarNewServerConnectionMaximumChanged)
Q_PROPERTY(bool pushButtonBackFromStartVisible READ getPushButtonBackFromStartVisible WRITE setPushButtonBackFromStartVisible NOTIFY pushButtonBackFromStartVisibleChanged)
Q_PROPERTY(bool pushButtonNewServerConnectVisible READ getPushButtonNewServerConnectVisible WRITE setPushButtonNewServerConnectVisible NOTIFY pushButtonNewServerConnectVisibleChanged)
Q_PROPERTY(bool radioButtonVpnModeAllSitesChecked READ getRadioButtonVpnModeAllSitesChecked WRITE setRadioButtonVpnModeAllSitesChecked NOTIFY radioButtonVpnModeAllSitesCheckedChanged)
Q_PROPERTY(bool radioButtonVpnModeForwardSitesChecked READ getRadioButtonVpnModeForwardSitesChecked WRITE setRadioButtonVpnModeForwardSitesChecked NOTIFY radioButtonVpnModeForwardSitesCheckedChanged)
Q_PROPERTY(bool radioButtonVpnModeExceptSitesChecked READ getRadioButtonVpnModeExceptSitesChecked WRITE setRadioButtonVpnModeExceptSitesChecked NOTIFY radioButtonVpnModeExceptSitesCheckedChanged)
Q_PROPERTY(bool pushButtonVpnAddSiteEnabled READ getPushButtonVpnAddSiteEnabled WRITE setPushButtonVpnAddSiteEnabled NOTIFY pushButtonVpnAddSiteEnabledChanged)
Q_PROPERTY(bool checkBoxAppSettingsAutostartChecked READ getCheckBoxAppSettingsAutostartChecked WRITE setCheckBoxAppSettingsAutostartChecked NOTIFY checkBoxAppSettingsAutostartCheckedChanged)
Q_PROPERTY(bool checkBoxAppSettingsAutoconnectChecked READ getCheckBoxAppSettingsAutoconnectChecked WRITE setCheckBoxAppSettingsAutoconnectChecked NOTIFY checkBoxAppSettingsAutoconnectCheckedChanged)
Q_PROPERTY(bool checkBoxAppSettingsStartMinimizedChecked READ getCheckBoxAppSettingsStartMinimizedChecked WRITE setCheckBoxAppSettingsStartMinimizedChecked NOTIFY checkBoxAppSettingsStartMinimizedCheckedChanged)
Q_PROPERTY(QString lineEditNetworkSettingsDns1Text READ getLineEditNetworkSettingsDns1Text WRITE setLineEditNetworkSettingsDns1Text NOTIFY lineEditNetworkSettingsDns1TextChanged)
Q_PROPERTY(QString lineEditNetworkSettingsDns2Text READ getLineEditNetworkSettingsDns2Text WRITE setLineEditNetworkSettingsDns2Text NOTIFY lineEditNetworkSettingsDns2TextChanged)
Q_PROPERTY(QString labelAppSettingsVersionText READ getLabelAppSettingsVersionText WRITE setLabelAppSettingsVersionText NOTIFY labelAppSettingsVersionTextChanged)
Q_PROPERTY(bool pushButtonGeneralSettingsShareConnectionEnable READ getPushButtonGeneralSettingsShareConnectionEnable WRITE setPushButtonGeneralSettingsShareConnectionEnable NOTIFY pushButtonGeneralSettingsShareConnectionEnableChanged)
Q_PROPERTY(bool labelServerSettingsWaitInfoVisible READ getLabelServerSettingsWaitInfoVisible WRITE setLabelServerSettingsWaitInfoVisible NOTIFY labelServerSettingsWaitInfoVisibleChanged)
Q_PROPERTY(QString labelServerSettingsWaitInfoText READ getLabelServerSettingsWaitInfoText WRITE setLabelServerSettingsWaitInfoText NOTIFY labelServerSettingsWaitInfoTextChanged)
Q_PROPERTY(bool pushButtonServerSettingsClearVisible READ getPushButtonServerSettingsClearVisible WRITE setPushButtonServerSettingsClearVisible NOTIFY pushButtonServerSettingsClearVisibleChanged)
Q_PROPERTY(bool pushButtonServerSettingsClearClientCacheVisible READ getPushButtonServerSettingsClearClientCacheVisible WRITE setPushButtonServerSettingsClearClientCacheVisible NOTIFY pushButtonServerSettingsClearClientCacheVisibleChanged)
Q_PROPERTY(bool pushButtonServerSettingsShareFullVisible READ getPushButtonServerSettingsShareFullVisible WRITE setPushButtonServerSettingsShareFullVisible NOTIFY pushButtonServerSettingsShareFullVisibleChanged)
Q_PROPERTY(QString labelServerSettingsServerText READ getLabelServerSettingsServerText WRITE setLabelServerSettingsServerText NOTIFY labelServerSettingsServerTextChanged)
Q_PROPERTY(QString lineEditServerSettingsDescriptionText READ getLineEditServerSettingsDescriptionText WRITE setLineEditServerSettingsDescriptionText NOTIFY lineEditServerSettingsDescriptionTextChanged)
Q_PROPERTY(QString labelServerSettingsCurrentVpnProtocolText READ getLabelServerSettingsCurrentVpnProtocolText WRITE setLabelServerSettingsCurrentVpnProtocolText NOTIFY labelServerSettingsCurrentVpnProtocolTextChanged)
Q_PROPERTY(int currentPageValue READ getCurrentPageValue WRITE setCurrentPageValue NOTIFY currentPageValueChanged)
Q_PROPERTY(QString trayIconUrl READ getTrayIconUrl WRITE setTrayIconUrl NOTIFY trayIconUrlChanged)
Q_PROPERTY(bool trayActionDisconnectEnabled READ getTrayActionDisconnectEnabled WRITE setTrayActionDisconnectEnabled NOTIFY trayActionDisconnectEnabledChanged)
Q_PROPERTY(bool trayActionConnectEnabled READ getTrayActionConnectEnabled WRITE setTrayActionConnectEnabled NOTIFY trayActionConnectEnabledChanged)
Q_PROPERTY(bool checkBoxNewServerCloakChecked READ getCheckBoxNewServerCloakChecked WRITE setCheckBoxNewServerCloakChecked NOTIFY checkBoxNewServerCloakCheckedChanged)
Q_PROPERTY(bool checkBoxNewServerSsChecked READ getCheckBoxNewServerSsChecked WRITE setCheckBoxNewServerSsChecked NOTIFY checkBoxNewServerSsCheckedChanged)
Q_PROPERTY(bool checkBoxNewServerOpenvpnChecked READ getCheckBoxNewServerOpenvpnChecked WRITE setCheckBoxNewServerOpenvpnChecked NOTIFY checkBoxNewServerOpenvpnCheckedChanged)
Q_PROPERTY(QString comboBoxProtoCloakCipherText READ getComboBoxProtoCloakCipherText WRITE setComboBoxProtoCloakCipherText NOTIFY comboBoxProtoCloakCipherTextChanged)
Q_PROPERTY(QString lineEditProtoCloakSiteText READ getLineEditProtoCloakSiteText WRITE setLineEditProtoCloakSiteText NOTIFY lineEditProtoCloakSiteTextChanged)
Q_PROPERTY(QString lineEditProtoCloakPortText READ getLineEditProtoCloakPortText WRITE setLineEditProtoCloakPortText NOTIFY lineEditProtoCloakPortTextChanged)
Q_PROPERTY(QString comboBoxProtoShadowsocksCipherText READ getComboBoxProtoShadowsocksCipherText WRITE setComboBoxProtoShadowsocksCipherText NOTIFY comboBoxProtoShadowsocksCipherTextChanged)
Q_PROPERTY(QString lineEditProtoShadowsocksPortText READ getLineEditProtoShadowsocksPortText WRITE setLineEditProtoShadowsocksPortText NOTIFY lineEditProtoShadowsocksPortTextChanged)
Q_PROPERTY(QString lineEditProtoOpenvpnSubnetText READ getLineEditProtoOpenvpnSubnetText WRITE setLineEditProtoOpenvpnSubnetText NOTIFY lineEditProtoOpenvpnSubnetTextChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpChecked READ getRadioButtonProtoOpenvpnUdpChecked WRITE setRadioButtonProtoOpenvpnUdpChecked NOTIFY radioButtonProtoOpenvpnUdpCheckedChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnAutoEncryptionChecked READ getCheckBoxProtoOpenvpnAutoEncryptionChecked WRITE setCheckBoxProtoOpenvpnAutoEncryptionChecked NOTIFY checkBoxProtoOpenvpnAutoEncryptionCheckedChanged)
Q_PROPERTY(QString comboBoxProtoOpenvpnCipherText READ getComboBoxProtoOpenvpnCipherText WRITE setComboBoxProtoOpenvpnCipherText NOTIFY comboBoxProtoOpenvpnCipherTextChanged)
Q_PROPERTY(QString comboBoxProtoOpenvpnHashText READ getComboBoxProtoOpenvpnHashText WRITE setComboBoxProtoOpenvpnHashText NOTIFY comboBoxProtoOpenvpnHashTextChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnBlockDnsChecked READ getCheckBoxProtoOpenvpnBlockDnsChecked WRITE setCheckBoxProtoOpenvpnBlockDnsChecked NOTIFY checkBoxProtoOpenvpnBlockDnsCheckedChanged)
Q_PROPERTY(QString lineEditProtoOpenvpnPortText READ getLineEditProtoOpenvpnPortText WRITE setLineEditProtoOpenvpnPortText NOTIFY lineEditProtoOpenvpnPortTextChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnTlsAuthChecked READ getCheckBoxProtoOpenvpnTlsAuthChecked WRITE setCheckBoxProtoOpenvpnTlsAuthChecked NOTIFY checkBoxProtoOpenvpnTlsAuthCheckedChanged)
Q_PROPERTY(bool radioButtonSetupWizardHighChecked READ getRadioButtonSetupWizardHighChecked WRITE setRadioButtonSetupWizardHighChecked NOTIFY radioButtonSetupWizardHighCheckedChanged)
Q_PROPERTY(bool radioButtonSetupWizardLowChecked READ getRadioButtonSetupWizardLowChecked WRITE setRadioButtonSetupWizardLowChecked NOTIFY radioButtonSetupWizardLowCheckedChanged)
Q_PROPERTY(bool checkBoxSetupWizardVpnModeChecked READ getCheckBoxSetupWizardVpnModeChecked WRITE setCheckBoxSetupWizardVpnModeChecked NOTIFY checkBoxSetupWizardVpnModeCheckedChanged)
Q_PROPERTY(QString ipAddressValidatorRegex READ getIpAddressValidatorRegex CONSTANT)
Q_PROPERTY(bool pushButtonConnectChecked READ getPushButtonConnectChecked WRITE setPushButtonConnectChecked NOTIFY pushButtonConnectCheckedChanged)
public:
explicit UiLogic(QObject *parent = nullptr);
// ~UiLogic();
enum Page {Start, NewServer, NewServerProtocols, Vpn,
Wizard, WizardLow, WizardMedium, WizardHigh, WizardVpnMode, ServerConfiguring,
GeneralSettings, AppSettings, NetworkSettings, ServerSettings,
ServerVpnProtocols, ServersList, ShareConnection, Sites,
OpenVpnSettings, ShadowSocksSettings, CloakSettings};
Q_ENUM(Page)
// void showOnStartup();
Q_INVOKABLE void initalizeUiLogic();
static void declareQML() {
qmlRegisterType<UiLogic>("Page", 1, 0, "Style");
}
bool getFrameWireguardSettingsVisible() const;
void setFrameWireguardSettingsVisible(bool frameWireguardSettingsVisible);
bool getFrameFireguardVisible() const;
void setFrameFireguardVisible(bool frameFireguardVisible);
bool getFrameNewServerSettingsParentWireguardVisible() const;
void setFrameNewServerSettingsParentWireguardVisible(bool frameNewServerSettingsParentWireguardVisible);
bool getRadioButtonSetupWizardMediumChecked() const;
void setRadioButtonSetupWizardMediumChecked(bool radioButtonSetupWizardMediumChecked);
QString getLineEditSetupWizardHighWebsiteMaskingText() const;
void setLineEditSetupWizardHighWebsiteMaskingText(const QString &lineEditSetupWizardHighWebsiteMaskingText);
double getProgressBarNewServerConfiguringValue() const;
void setProgressBarNewServerConfiguringValue(double progressBarNewServerConfiguringValue);
bool getPushButtonNewServerSettingsCloakChecked() const;
void setPushButtonNewServerSettingsCloakChecked(bool pushButtonNewServerSettingsCloakChecked);
bool getPushButtonNewServerSettingsSsChecked() const;
void setPushButtonNewServerSettingsSsChecked(bool pushButtonNewServerSettingsSsChecked);
bool getPushButtonNewServerSettingsOpenvpnChecked() const;
void setPushButtonNewServerSettingsOpenvpnChecked(bool pushButtonNewServerSettingsOpenvpnChecked);
QString getLineEditNewServerCloakPortText() const;
void setLineEditNewServerCloakPortText(const QString &lineEditNewServerCloakPortText);
QString getLineEditNewServerCloakSiteText() const;
void setLineEditNewServerCloakSiteText(const QString &lineEditNewServerCloakSiteText);
QString getLineEditNewServerSsPortText() const;
void setLineEditNewServerSsPortText(const QString &lineEditNewServerSsPortText);
QString getComboBoxNewServerSsCipherText() const;
void setComboBoxNewServerSsCipherText(const QString &comboBoxNewServerSsCipherText);
QString getlineEditNewServerOpenvpnPortText() const;
void setLineEditNewServerOpenvpnPortText(const QString &lineEditNewServerOpenvpnPortText);
QString getComboBoxNewServerOpenvpnProtoText() const;
void setComboBoxNewServerOpenvpnProtoText(const QString &comboBoxNewServerOpenvpnProtoText);
QString getLineEditStartExistingCodeText() const;
void setLineEditStartExistingCodeText(const QString &lineEditStartExistingCodeText);
QString getTextEditNewServerSshKeyText() const;
void setTextEditNewServerSshKeyText(const QString &textEditNewServerSshKeyText);
QString getLineEditNewServerIpText() const;
void setLineEditNewServerIpText(const QString &lineEditNewServerIpText);
QString getLineEditNewServerPasswordText() const;
void setLineEditNewServerPasswordText(const QString &lineEditNewServerPasswordText);
QString getLineEditNewServerLoginText() const;
void setLineEditNewServerLoginText(const QString &lineEditNewServerLoginText);
bool getLabelNewServerWaitInfoVisible() const;
void setLabelNewServerWaitInfoVisible(bool labelNewServerWaitInfoVisible);
QString getLabelNewServerWaitInfoText() const;
void setLabelNewServerWaitInfoText(const QString &labelNewServerWaitInfoText);
double getProgressBarNewServerConnectionMinimum() const;
void setProgressBarNewServerConnectionMinimum(double progressBarNewServerConnectionMinimum);
double getProgressBarNewServerConnectionMaximum() const;
void setProgressBarNewServerConnectionMaximum(double progressBarNewServerConnectionMaximum);
bool getPushButtonBackFromStartVisible() const;
void setPushButtonBackFromStartVisible(bool pushButtonBackFromStartVisible);
bool getPushButtonNewServerConnectVisible() const;
void setPushButtonNewServerConnectVisible(bool pushButtonNewServerConnectVisible);
bool getPushButtonNewServerConnectKeyChecked() const;
void setPushButtonNewServerConnectKeyChecked(bool pushButtonNewServerConnectKeyChecked);
bool getRadioButtonVpnModeAllSitesChecked() const;
void setRadioButtonVpnModeAllSitesChecked(bool radioButtonVpnModeAllSitesChecked);
bool getRadioButtonVpnModeForwardSitesChecked() const;
void setRadioButtonVpnModeForwardSitesChecked(bool radioButtonVpnModeForwardSitesChecked);
bool getRadioButtonVpnModeExceptSitesChecked() const;
void setRadioButtonVpnModeExceptSitesChecked(bool radioButtonVpnModeExceptSitesChecked);
bool getPushButtonVpnAddSiteEnabled() const;
void setPushButtonVpnAddSiteEnabled(bool pushButtonVpnAddSiteEnabled);
bool getCheckBoxAppSettingsAutostartChecked() const;
void setCheckBoxAppSettingsAutostartChecked(bool checkBoxAppSettingsAutostartChecked);
bool getCheckBoxAppSettingsAutoconnectChecked() const;
void setCheckBoxAppSettingsAutoconnectChecked(bool checkBoxAppSettingsAutoconnectChecked);
bool getCheckBoxAppSettingsStartMinimizedChecked() const;
void setCheckBoxAppSettingsStartMinimizedChecked(bool checkBoxAppSettingsStartMinimizedChecked);
QString getLineEditNetworkSettingsDns1Text() const;
void setLineEditNetworkSettingsDns1Text(const QString &lineEditNetworkSettingsDns1Text);
QString getLineEditNetworkSettingsDns2Text() const;
void setLineEditNetworkSettingsDns2Text(const QString &lineEditNetworkSettingsDns2Text);
QString getLabelAppSettingsVersionText() const;
void setLabelAppSettingsVersionText(const QString &labelAppSettingsVersionText);
bool getPushButtonGeneralSettingsShareConnectionEnable() const;
void setPushButtonGeneralSettingsShareConnectionEnable(bool pushButtonGeneralSettingsShareConnectionEnable);
bool getLabelServerSettingsWaitInfoVisible() const;
void setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible);
QString getLabelServerSettingsWaitInfoText() const;
void setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText);
bool getPushButtonServerSettingsClearVisible() const;
void setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible);
bool getPushButtonServerSettingsClearClientCacheVisible() const;
void setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible);
bool getPushButtonServerSettingsShareFullVisible() const;
void setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible);
QString getLabelServerSettingsServerText() const;
void setLabelServerSettingsServerText(const QString &labelServerSettingsServerText);
QString getLineEditServerSettingsDescriptionText() const;
void setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText);
QString getLabelServerSettingsCurrentVpnProtocolText() const;
void setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText);
int getCurrentPageValue() const;
void setCurrentPageValue(int currentPageValue);
QString getTrayIconUrl() const;
void setTrayIconUrl(const QString &trayIconUrl);
bool getTrayActionDisconnectEnabled() const;
void setTrayActionDisconnectEnabled(bool trayActionDisconnectEnabled);
bool getTrayActionConnectEnabled() const;
void setTrayActionConnectEnabled(bool trayActionConnectEnabled);
bool getCheckBoxNewServerCloakChecked() const;
void setCheckBoxNewServerCloakChecked(bool checkBoxNewServerCloakChecked);
bool getCheckBoxNewServerSsChecked() const;
void setCheckBoxNewServerSsChecked(bool checkBoxNewServerSsChecked);
bool getCheckBoxNewServerOpenvpnChecked() const;
void setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnChecked);
QString getComboBoxProtoCloakCipherText() const;
void setComboBoxProtoCloakCipherText(const QString &comboBoxProtoCloakCipherText);
QString getLineEditProtoCloakSiteText() const;
void setLineEditProtoCloakSiteText(const QString &lineEditProtoCloakSiteText);
QString getLineEditProtoCloakPortText() const;
void setLineEditProtoCloakPortText(const QString &lineEditProtoCloakPortText);
QString getComboBoxProtoShadowsocksCipherText() const;
void setComboBoxProtoShadowsocksCipherText(const QString &comboBoxProtoShadowsocksCipherText);
QString getLineEditProtoShadowsocksPortText() const;
void setLineEditProtoShadowsocksPortText(const QString &lineEditProtoShadowsocksPortText);
QString getLineEditProtoOpenvpnSubnetText() const;
void setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText);
bool getRadioButtonProtoOpenvpnUdpChecked() const;
void setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked);
bool getCheckBoxProtoOpenvpnAutoEncryptionChecked() const;
void setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked);
QString getComboBoxProtoOpenvpnCipherText() const;
void setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText);
QString getComboBoxProtoOpenvpnHashText() const;
void setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText);
bool getCheckBoxProtoOpenvpnBlockDnsChecked() const;
void setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked);
QString getLineEditProtoOpenvpnPortText() const;
void setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText);
bool getCheckBoxProtoOpenvpnTlsAuthChecked() const;
void setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked);
bool getRadioButtonSetupWizardHighChecked() const;
void setRadioButtonSetupWizardHighChecked(bool radioButtonSetupWizardHighChecked);
bool getRadioButtonSetupWizardLowChecked() const;
void setRadioButtonSetupWizardLowChecked(bool radioButtonSetupWizardLowChecked);
bool getCheckBoxSetupWizardVpnModeChecked() const;
void setCheckBoxSetupWizardVpnModeChecked(bool checkBoxSetupWizardVpnModeChecked);
QString getIpAddressValidatorRegex() const;
bool getPushButtonConnectChecked() const;
void setPushButtonConnectChecked(bool pushButtonConnectChecked);
Q_INVOKABLE void updateWizardHighPage();
Q_INVOKABLE void updateNewServerProtocolsPage();
Q_INVOKABLE void updateStartPage();
Q_INVOKABLE void updateVpnPage();
Q_INVOKABLE void updateAppSettingsPage();
Q_INVOKABLE void updateGeneralSettingPage();
Q_INVOKABLE void updateServerPage();
Q_INVOKABLE void onPushButtonNewServerConnect();
Q_INVOKABLE void onPushButtonNewServerImport();
Q_INVOKABLE void onPushButtonSetupWizardVpnModeFinishClicked();
Q_INVOKABLE void onPushButtonSetupWizardLowFinishClicked();
Q_INVOKABLE void onRadioButtonVpnModeAllSitesToggled(bool checked);
Q_INVOKABLE void onRadioButtonVpnModeForwardSitesToggled(bool checked);
Q_INVOKABLE void onRadioButtonVpnModeExceptSitesToggled(bool checked);
Q_INVOKABLE void onPushButtonAppSettingsOpenLogsChecked();
Q_INVOKABLE void onCheckBoxAppSettingsAutostartToggled(bool checked);
Q_INVOKABLE void onCheckBoxAppSettingsAutoconnectToggled(bool checked);
Q_INVOKABLE void onCheckBoxAppSettingsStartMinimizedToggled(bool checked);
Q_INVOKABLE void onLineEditNetworkSettingsDns1EditFinished(const QString& text);
Q_INVOKABLE void onLineEditNetworkSettingsDns2EditFinished(const QString& text);
Q_INVOKABLE void onPushButtonNetworkSettingsResetdns1Clicked();
Q_INVOKABLE void onPushButtonNetworkSettingsResetdns2Clicked();
Q_INVOKABLE void onPushButtonConnectClicked(bool checked);
signals:
void frameWireguardSettingsVisibleChanged();
void frameFireguardVisibleChanged();
void frameNewServerSettingsParentWireguardVisibleChanged();
void radioButtonSetupWizardMediumCheckedChanged();
void lineEditSetupWizardHighWebsiteMaskingTextChanged();
void progressBarNewServerConfiguringValueChanged();
void pushButtonNewServerSettingsCloakCheckedChanged();
void pushButtonNewServerSettingsSsCheckedChanged();
void pushButtonNewServerSettingsOpenvpnCheckedChanged();
void lineEditNewServerCloakPortTextChanged();
void lineEditNewServerCloakSiteTextChanged();
void lineEditNewServerSsPortTextChanged();
void comboBoxNewServerSsCipherTextChanged();
void lineEditNewServerOpenvpnPortTextChanged();
void comboBoxNewServerOpenvpnProtoTextChanged();
void pushButtonNewServerConnectKeyCheckedChanged();
void lineEditStartExistingCodeTextChanged();
void textEditNewServerSshKeyTextChanged();
void lineEditNewServerIpTextChanged();
void lineEditNewServerPasswordTextChanged();
void lineEditNewServerLoginTextChanged();
void labelNewServerWaitInfoVisibleChanged();
void labelNewServerWaitInfoTextChanged();
void progressBarNewServerConnectionMinimumChanged();
void progressBarNewServerConnectionMaximumChanged();
void pushButtonBackFromStartVisibleChanged();
void pushButtonNewServerConnectVisibleChanged();
void radioButtonVpnModeAllSitesCheckedChanged();
void radioButtonVpnModeForwardSitesCheckedChanged();
void radioButtonVpnModeExceptSitesCheckedChanged();
void pushButtonVpnAddSiteEnabledChanged();
void checkBoxAppSettingsAutostartCheckedChanged();
void checkBoxAppSettingsAutoconnectCheckedChanged();
void checkBoxAppSettingsStartMinimizedCheckedChanged();
void lineEditNetworkSettingsDns1TextChanged();
void lineEditNetworkSettingsDns2TextChanged();
void labelAppSettingsVersionTextChanged();
void pushButtonGeneralSettingsShareConnectionEnableChanged();
void labelServerSettingsWaitInfoVisibleChanged();
void labelServerSettingsWaitInfoTextChanged();
void pushButtonServerSettingsClearVisibleChanged();
void pushButtonServerSettingsClearClientCacheVisibleChanged();
void pushButtonServerSettingsShareFullVisibleChanged();
void labelServerSettingsServerTextChanged();
void lineEditServerSettingsDescriptionTextChanged();
void labelServerSettingsCurrentVpnProtocolTextChanged();
void currentPageValueChanged();
void trayIconUrlChanged();
void trayActionDisconnectEnabledChanged();
void trayActionConnectEnabledChanged();
void checkBoxNewServerCloakCheckedChanged();
void checkBoxNewServerSsCheckedChanged();
void checkBoxNewServerOpenvpnCheckedChanged();
void comboBoxProtoCloakCipherTextChanged();
void lineEditProtoCloakSiteTextChanged();
void lineEditProtoCloakPortTextChanged();
void comboBoxProtoShadowsocksCipherTextChanged();
void lineEditProtoShadowsocksPortTextChanged();
void lineEditProtoOpenvpnSubnetTextChanged();
void radioButtonProtoOpenvpnUdpCheckedChanged();
void checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
void comboBoxProtoOpenvpnCipherTextChanged();
void comboBoxProtoOpenvpnHashTextChanged();
void checkBoxProtoOpenvpnBlockDnsCheckedChanged();
void lineEditProtoOpenvpnPortTextChanged();
void checkBoxProtoOpenvpnTlsAuthCheckedChanged();
void radioButtonSetupWizardHighCheckedChanged();
void radioButtonSetupWizardLowCheckedChanged();
void checkBoxSetupWizardVpnModeCheckedChanged();
void pushButtonConnectCheckedChanged();
void goToPage(Page page, bool reset = true, bool slide = true);
void closePage();
void setStartPage(Page page, bool slide = true);
void pushButtonNewServerConnectConfigureClicked();
private:
bool m_frameWireguardSettingsVisible;
bool m_frameFireguardVisible;
bool m_frameNewServerSettingsParentWireguardVisible;
bool m_radioButtonSetupWizardMediumChecked;
QString m_lineEditSetupWizardHighWebsiteMaskingText;
double m_progressBarNewServerConfiguringValue;
bool m_pushButtonNewServerSettingsCloakChecked;
bool m_pushButtonNewServerSettingsSsChecked;
bool m_pushButtonNewServerSettingsOpenvpnChecked;
QString m_lineEditNewServerCloakPortText;
QString m_lineEditNewServerCloakSiteText;
QString m_lineEditNewServerSsPortText;
QString m_comboBoxNewServerSsCipherText;
QString m_lineEditNewServerOpenvpnPortText;
QString m_comboBoxNewServerOpenvpnProtoText;
bool m_pushButtonNewServerConnectKeyChecked;
QString m_lineEditStartExistingCodeText;
QString m_textEditNewServerSshKeyText;
QString m_lineEditNewServerIpText;
QString m_lineEditNewServerPasswordText;
QString m_lineEditNewServerLoginText;
bool m_labelNewServerWaitInfoVisible;
QString m_labelNewServerWaitInfoText;
double m_progressBarNewServerConnectionMinimum;
double m_progressBarNewServerConnectionMaximum;
bool m_pushButtonBackFromStartVisible;
bool m_pushButtonNewServerConnectVisible;
bool m_radioButtonVpnModeAllSitesChecked;
bool m_radioButtonVpnModeForwardSitesChecked;
bool m_radioButtonVpnModeExceptSitesChecked;
bool m_pushButtonVpnAddSiteEnabled;
bool m_checkBoxAppSettingsAutostartChecked;
bool m_checkBoxAppSettingsAutoconnectChecked;
bool m_checkBoxAppSettingsStartMinimizedChecked;
QString m_lineEditNetworkSettingsDns1Text;
QString m_lineEditNetworkSettingsDns2Text;
QString m_labelAppSettingsVersionText;
bool m_pushButtonGeneralSettingsShareConnectionEnable;
bool m_labelServerSettingsWaitInfoVisible;
QString m_labelServerSettingsWaitInfoText;
bool m_pushButtonServerSettingsClearVisible;
bool m_pushButtonServerSettingsClearClientCacheVisible;
bool m_pushButtonServerSettingsShareFullVisible;
QString m_labelServerSettingsServerText;
QString m_lineEditServerSettingsDescriptionText;
QString m_labelServerSettingsCurrentVpnProtocolText;
int m_currentPageValue;
QString m_trayIconUrl;
bool m_trayActionDisconnectEnabled;
bool m_trayActionConnectEnabled;
bool m_checkBoxNewServerCloakChecked;
bool m_checkBoxNewServerSsChecked;
bool m_checkBoxNewServerOpenvpnChecked;
QString m_comboBoxProtoCloakCipherText;
QString m_lineEditProtoCloakSiteText;
QString m_lineEditProtoCloakPortText;
QString m_comboBoxProtoShadowsocksCipherText;
QString m_lineEditProtoShadowsocksPortText;
QString m_lineEditProtoOpenvpnSubnetText;
bool m_radioButtonProtoOpenvpnUdpChecked;
bool m_checkBoxProtoOpenvpnAutoEncryptionChecked;
QString m_comboBoxProtoOpenvpnCipherText;
QString m_comboBoxProtoOpenvpnHashText;
bool m_checkBoxProtoOpenvpnBlockDnsChecked;
QString m_lineEditProtoOpenvpnPortText;
bool m_checkBoxProtoOpenvpnTlsAuthChecked;
bool m_radioButtonSetupWizardHighChecked;
bool m_radioButtonSetupWizardLowChecked;
bool m_checkBoxSetupWizardVpnModeChecked;
QString m_ipAddressValidatorRegex;
bool m_pushButtonConnectChecked;
//private slots:
// void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
// void onConnectionStateChanged(VpnProtocol::ConnectionState state);
// void onVpnProtocolError(amnezia::ErrorCode errorCode);
void installServer(const QMap<DockerContainer, QJsonObject> &containers);
// void onPushButtonClearServer(bool);
// void onPushButtonForgetServer(bool);
// void onPushButtonAddCustomSitesClicked();
void setTrayState(VpnProtocol::ConnectionState state);
void onConnect();
// void onConnectWorker(int serverIndex, const ServerCredentials &credentials, DockerContainer container, const QJsonObject &containerConfig);
void onDisconnect();
private:
Page currentPage();
// bool installContainers(ServerCredentials credentials, const QMap<DockerContainer, QJsonObject> &containers,
// QWidget *page, QProgressBar *progress, QPushButton *button, QLabel *info);
// ErrorCode doInstallAction(const std::function<ErrorCode()> &action, QWidget *page, QProgressBar *progress, QPushButton *button, QLabel *info);
void setupTray();
void setTrayIcon(const QString &iconPath);
void setupNewServerConnections();
// void setupSitesPageConnections();
// void setupGeneralSettingsConnections();
// void setupProtocolsPageConnections();
void setupNewServerPageConnections();
// void setupServerSettingsPageConnections();
// void setupSharePageConnections();
// void updateSitesPage();
// void updateServersListPage();
// void updateProtocolsPage();
// void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData);
// void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
// void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);
// void updateSharingPage(int serverIndex, const ServerCredentials &credentials,
// DockerContainer container);
// void makeServersListItem(QListWidget* listWidget, const QJsonObject &server, bool isDefault, int index);
// void updateQRCodeImage(const QString &text, QLabel *label);
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
QJsonObject getCloakConfigFromPage(QJsonObject oldConfig);
QMap<DockerContainer, QJsonObject> getInstallConfigsFromProtocolsPage() const;
QMap<DockerContainer, QJsonObject> getInstallConfigsFromWizardPage() const;
private:
VpnConnection* m_vpnConnection;
Settings m_settings;
// QMap<Settings::RouteMode, SitesModel *> sitesModels;
// QRegExpValidator m_ipAddressValidator;
// QRegExpValidator m_ipAddressPortValidator;
// QRegExpValidator m_ipNetwok24Validator;
// QRegExpValidator m_ipPortValidator;
// CQR_Encode m_qrEncode;
// bool canMove = false;
// QPoint offset;
// bool needToHideCustomTitlebar = false;
// bool eventFilter(QObject *obj, QEvent *event) override;
// void keyPressEvent(QKeyEvent* event) override;
// void closeEvent(QCloseEvent *event) override;
// void showEvent(QShowEvent *event) override;
// void hideEvent(QHideEvent *event) override;
const QString ConnectedTrayIconName = "active.png";
const QString DisconnectedTrayIconName = "default.png";
const QString ErrorTrayIconName = "error.png";
// QStack<Page> pagesStack;
int selectedServerIndex = -1; // server index to use when proto settings page opened
DockerContainer selectedDockerContainer; // same
ServerCredentials installCredentials; // used to save cred between pages new_server and new_server_protocols and wizard
};
#endif // UILOGIC_H