Multiple ui fixes, save file function reimpl

This commit is contained in:
pokamest 2022-02-15 17:08:55 +03:00
parent b63bf2465f
commit c233f767f4
22 changed files with 229 additions and 2601 deletions

View file

@ -5,11 +5,13 @@ BasicButtonType {
id: root
property alias iconMargin: img.anchors.margins
property alias img: img
property int imgMargin: 4
property int imgMarginHover: 3
background: Item {}
contentItem: Image {
id: img
source: root.icon.source
anchors.fill: root
anchors.margins: root.containsMouse ? 3 : 4
anchors.margins: root.containsMouse ? imgMarginHover : imgMargin
}
}

View file

@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
BasicButtonType {
id: root
property alias textItem: textItem
height: 30
background: Item {}
contentItem: Item {

View file

@ -42,6 +42,7 @@ PageBase {
anchors.right: parent.right
CheckBoxType {
visible: !GC.isMobile()
Layout.fillWidth: true
text: qsTr("Auto connect")
checked: AppSettingsLogic.checkBoxAutoConnectChecked
@ -51,6 +52,7 @@ PageBase {
}
}
CheckBoxType {
visible: !GC.isMobile()
Layout.fillWidth: true
text: qsTr("Auto start")
checked: AppSettingsLogic.checkBoxAutostartChecked
@ -60,6 +62,7 @@ PageBase {
}
}
CheckBoxType {
visible: !GC.isMobile()
Layout.fillWidth: true
text: qsTr("Start minimized")
checked: AppSettingsLogic.checkBoxStartMinimizedChecked
@ -74,6 +77,7 @@ PageBase {
text: AppSettingsLogic.labelVersionText
}
BlueButtonType {
visible: !GC.isMobile()
Layout.fillWidth: true
Layout.preferredHeight: 41
text: qsTr("Check for updates")

View file

@ -1,5 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15
import PageEnum 1.0
import "./"
@ -13,176 +14,155 @@ PageBase {
BackButton {
id: back
z: -1
}
// ---------- App settings ------------
Rectangle {
id: l1
visible: !GC.isMobile()
Flickable {
id: fl
width: root.width
anchors.top: back.bottom
x: 20
width: parent.width - 40
height: GC.isMobile() ? 0: 1
color: "#DDDDDD"
}
anchors.topMargin: 0
anchors.bottom: root.bottom
anchors.bottomMargin: 10
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
SettingButtonType {
id: b1
visible: !GC.isMobile()
anchors.top: l1.bottom
anchors.topMargin: GC.isMobile() ? 0: 15
x: 30
width: parent.width - 80
height: GC.isMobile() ? 0: 30
icon.source: "qrc:/images/svg/settings_black_24dp.svg"
text: qsTr("App settings")
onClicked: {
UiLogic.goToPage(PageEnum.AppSettings)
contentHeight: content.height
clip: true
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.top
anchors.topMargin: 10
anchors.left: parent.left
anchors.right: parent.right
spacing: 15
// ---------- App settings ------------
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
icon.source: "qrc:/images/svg/settings_black_24dp.svg"
text: qsTr("App settings")
onClicked: {
UiLogic.goToPage(PageEnum.AppSettings)
}
}
// ---------- Network settings ------------
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
icon.source: "qrc:/images/svg/settings_suggest_black_24dp.svg"
text: qsTr("Network settings")
onClicked: {
UiLogic.goToPage(PageEnum.NetworkSettings)
}
}
// ---------- Server settings ------------
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
icon.source: "qrc:/images/svg/vpn_key_black_24dp.svg"
text: qsTr("Server Settings")
onClicked: {
GeneralSettingsLogic.onPushButtonGeneralSettingsServerSettingsClicked()
}
}
// ---------- Share connection ------------
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
icon.source: "qrc:/images/svg/share_black_24dp.svg"
text: qsTr("Share connection")
enabled: GeneralSettingsLogic.pushButtonGeneralSettingsShareConnectionEnable
onClicked: {
GeneralSettingsLogic.onPushButtonGeneralSettingsShareConnectionClicked()
}
}
// ---------- Servers ------------
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
icon.source: "qrc:/images/svg/format_list_bulleted_black_24dp.svg"
text: qsTr("Servers")
onClicked: {
UiLogic.goToPage(PageEnum.ServersList)
}
}
// ---------- Add server ------------
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
text: qsTr("Add server")
onClicked: {
UiLogic.goToPage(PageEnum.Start)
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: "#DDDDDD"
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: fl.height > (75+1) * 6 ? fl.height - (75+1) * 6 : 0
}
SettingButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.bottomMargin: 20
icon.source: "qrc:/images/svg/logout_black_24dp.svg"
text: qsTr("Exit")
onClicked: {
Qt.quit()
}
}
}
}
// ---------- Network settings ------------
Rectangle {
id: l2
anchors.top: b1.bottom
anchors.topMargin: 15
x: 20
width: parent.width - 40
height: 1
color: "#DDDDDD"
}
SettingButtonType {
id: b2
x: 30
anchors.top: l2.bottom
anchors.topMargin: 15
width: parent.width - 40
height: 30
icon.source: "qrc:/images/svg/settings_suggest_black_24dp.svg"
text: qsTr("Network settings")
onClicked: {
UiLogic.goToPage(PageEnum.NetworkSettings)
}
}
// ---------- Server settings ------------
Rectangle {
id: l3
anchors.top: b2.bottom
anchors.topMargin: 15
x: 20
width: parent.width - 40
height: 1
color: "#DDDDDD"
}
SettingButtonType {
id: b3
x: 30
anchors.top: l3.bottom
anchors.topMargin: 15
width: 330
height: 30
icon.source: "qrc:/images/svg/vpn_key_black_24dp.svg"
text: qsTr("Server Settings")
onClicked: {
GeneralSettingsLogic.onPushButtonGeneralSettingsServerSettingsClicked()
}
}
// ---------- Share connection ------------
Rectangle {
id: l4
anchors.top: b3.bottom
anchors.topMargin: 15
x: 20
width: parent.width - 40
height: 1
color: "#DDDDDD"
}
SettingButtonType {
id: b4
x: 30
anchors.top: l4.bottom
anchors.topMargin: 15
width: 330
height: 30
icon.source: "qrc:/images/svg/share_black_24dp.svg"
text: qsTr("Share connection")
enabled: GeneralSettingsLogic.pushButtonGeneralSettingsShareConnectionEnable
onClicked: {
GeneralSettingsLogic.onPushButtonGeneralSettingsShareConnectionClicked()
}
}
// ---------- Servers ------------
Rectangle {
id: l5
anchors.top: b4.bottom
anchors.topMargin: 15
x: 20
width: parent.width - 40
height: 1
color: "#DDDDDD"
}
SettingButtonType {
id: b5
x: 30
anchors.top: l5.bottom
anchors.topMargin: 15
width: 330
height: 30
icon.source: "qrc:/images/svg/format_list_bulleted_black_24dp.svg"
text: qsTr("Servers")
onClicked: {
UiLogic.goToPage(PageEnum.ServersList)
}
}
// ---------- Add server ------------
Rectangle {
id: l6
anchors.top: b5.bottom
anchors.topMargin: 15
x: 20
width: parent.width - 40
height: 1
color: "#DDDDDD"
}
SettingButtonType {
id: b6
x: 30
anchors.top: l6.bottom
anchors.topMargin: 15
width: 330
height: 30
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
text: qsTr("Add server")
onClicked: {
UiLogic.goToPage(PageEnum.Start)
}
}
Rectangle {
id: l7
anchors.top: b6.bottom
anchors.topMargin: 15
x: 20
width: parent.width - 40
height: 1
color: "#DDDDDD"
}
SettingButtonType {
x: 30
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
width: 330
height: 30
icon.source: "qrc:/images/svg/logout_black_24dp.svg"
text: qsTr("Exit")
onClicked: {
Qt.quit()
}
}
}

View file

@ -16,16 +16,16 @@ PageBase {
}
Caption {
id: caption
text: qsTr("Servers list")
text: qsTr("Servers")
width: undefined
}
SvgButtonType {
anchors.bottom: caption.bottom
anchors.verticalCenter: caption.verticalCenter
anchors.leftMargin: 10
anchors.left: caption.right
width: 24
height: 24
width: 27
height: 27
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
onClicked: {

View file

@ -59,9 +59,11 @@ PageBase {
ImageButtonType {
x: parent.width - 40
y: 10
width: 31
height: 31
y: 0
width: 41
height: 41
imgMarginHover: 8
imgMargin: 9
icon.source: "qrc:/images/settings_grey.png"
onClicked: {
UiLogic.goToPage(PageEnum.GeneralSettings)
@ -98,7 +100,7 @@ PageBase {
}
contentItem: Item {}
antialiasing: true
enabled: VpnLogic.pushButtonConnectEnabled && VpnLogic.isContainerWorkingOnPlatform
enabled: VpnLogic.pushButtonConnectEnabled && VpnLogic.isContainerSupportedByCurrentPlatform
opacity: VpnLogic.pushButtonConnectVisible ? 1 : 0
// transitions: Transition {
@ -128,14 +130,14 @@ PageBase {
LabelType {
Layout.alignment: Qt.AlignRight
height: 21
text: qsTr("Server") + ": "
text: ( VpnLogic.isContainerHaveAuthData ? qsTr("Server") : qsTr("Profile")) + ": "
}
BasicButtonType {
Layout.alignment: Qt.AlignLeft
height: 21
background: Item {}
text: VpnLogic.labelCurrentServer + " →"
text: VpnLogic.labelCurrentServer + (VpnLogic.isContainerHaveAuthData ? " →" : "")
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
@ -163,12 +165,12 @@ PageBase {
Layout.alignment: Qt.AlignLeft
height: 21
background: Item {}
text: VpnLogic.labelCurrentService + " →"
text: VpnLogic.labelCurrentService + (VpnLogic.isContainerHaveAuthData ? " →" : "")
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
onClicked: {
UiLogic.onGotoCurrentProtocolsPage()
if (VpnLogic.isContainerHaveAuthData) UiLogic.onGotoCurrentProtocolsPage()
}
}
}
@ -192,12 +194,12 @@ PageBase {
height: 21
implicitWidth: implicitContentWidth > root.width * 0.6 ? root.width * 0.6 : implicitContentWidth + leftPadding + rightPadding
background: Item {}
text: VpnLogic.labelCurrentDns + " →"
text: VpnLogic.labelCurrentDns + (VpnLogic.isContainerHaveAuthData ? " →" : "")
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
onClicked: {
UiLogic.goToPage(PageEnum.NetworkSettings)
if (VpnLogic.isContainerHaveAuthData) UiLogic.goToPage(PageEnum.NetworkSettings)
}
}

View file

@ -117,7 +117,7 @@ New encryption keys pair will be generated.")
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "*.vpn", tfShareCode.textArea.text)
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "amnezia_config.vpn", "*.vpn", tfShareCode.textArea.text)
}
}

View file

@ -99,7 +99,7 @@ PageShareProtocolBase {
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "*.json", tfShareCode.textArea.text)
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "amnezia_config_cloak.json", "*.json", tfShareCode.textArea.text)
}
}

View file

@ -102,7 +102,7 @@ PageShareProtocolBase {
visible: tfCert.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Export p12 certificate"), "*.p12", tfCert.textArea.text)
UiLogic.saveTextFile(qsTr("Export p12 certificate"), "amnezia_ikev2_cert_for_windows.p12", "*.p12", tfCert.textArea.text)
}
}
@ -117,7 +117,7 @@ PageShareProtocolBase {
visible: tfMobileConfig.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Export config for Apple"), "*.plist", tfMobileConfig.textArea.text)
UiLogic.saveTextFile(qsTr("Export config for Apple"), "amnezia_for_apple.plist", "*.plist", tfMobileConfig.textArea.text)
}
}
@ -132,7 +132,7 @@ PageShareProtocolBase {
visible: tfStrongSwanConfig.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Export config for StrongSwan"), "*.profile", tfStrongSwanConfig.textArea.text)
UiLogic.saveTextFile(qsTr("Export config for StrongSwan"), "amnezia_for_StrongSwan.profile", "*.profile", tfStrongSwanConfig.textArea.text)
}
}
}

View file

@ -98,7 +98,7 @@ PageShareProtocolBase {
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "amnezia_for_openvpn.ovpn", "*.ovpn", tfShareCode.textArea.text)
}
}
}

View file

@ -96,7 +96,7 @@ PageShareProtocolBase {
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.conf", tfShareCode.textArea.text)
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "amnezia_for_wireguard.conf", "*.conf", tfShareCode.textArea.text)
}
}

View file

@ -26,7 +26,6 @@ Window {
height: GC.isDesktop() ? GC.screenHeight + titleBar.height : GC.screenHeight
minimumWidth: 360
minimumHeight: GC.isDesktop() ? 640 : 0
Keys.enabled: true
onClosing: {
console.debug("QML onClosing signal")
UiLogic.onCloseWindow()