limited the length of the displayed server name
- added auto-selection of the first available protocol when changing the server on the PageShare page
This commit is contained in:
parent
c0aca97083
commit
f40bf2d9ba
9 changed files with 136 additions and 115 deletions
|
@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
||||||
|
|
||||||
set(PROJECT AmneziaVPN)
|
set(PROJECT AmneziaVPN)
|
||||||
|
|
||||||
project(${PROJECT} VERSION 4.0.5.1
|
project(${PROJECT} VERSION 4.0.6.1
|
||||||
DESCRIPTION "AmneziaVPN"
|
DESCRIPTION "AmneziaVPN"
|
||||||
HOMEPAGE_URL "https://amnezia.org/"
|
HOMEPAGE_URL "https://amnezia.org/"
|
||||||
)
|
)
|
||||||
set(RELEASE_DATE "2023-09-11")
|
set(RELEASE_DATE "2023-09-17")
|
||||||
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
set(APP_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
|
|
@ -10,6 +10,8 @@ Item {
|
||||||
property string text
|
property string text
|
||||||
property string textColor: "#d7d8db"
|
property string textColor: "#d7d8db"
|
||||||
property string textDisabledColor: "#878B91"
|
property string textDisabledColor: "#878B91"
|
||||||
|
property int textMaximumLineCount: 2
|
||||||
|
property int textElide: Qt.ElideRight
|
||||||
|
|
||||||
property string descriptionText
|
property string descriptionText
|
||||||
property string descriptionTextColor: "#878B91"
|
property string descriptionTextColor: "#878B91"
|
||||||
|
@ -102,6 +104,8 @@ Item {
|
||||||
|
|
||||||
color: root.enabled ? root.textColor : root.textDisabledColor
|
color: root.enabled ? root.textColor : root.textDisabledColor
|
||||||
text: root.text
|
text: root.text
|
||||||
|
maximumLineCount: root.textMaximumLineCount
|
||||||
|
elide: root.textElide
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ Item {
|
||||||
property var actionButtonFunction
|
property var actionButtonFunction
|
||||||
|
|
||||||
property string headerText
|
property string headerText
|
||||||
|
property int headerTextMaximumLineCount: 2
|
||||||
|
property int headerTextElide: Qt.ElideRight
|
||||||
|
|
||||||
property string descriptionText
|
property string descriptionText
|
||||||
|
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
|
@ -26,6 +29,8 @@ Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: root.headerText
|
text: root.headerText
|
||||||
|
maximumLineCount: root.headerTextMaximumLineCount
|
||||||
|
elide: root.headerTextElide
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
|
|
|
@ -8,6 +8,9 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string text
|
property string text
|
||||||
|
property int textMaximumLineCount: 2
|
||||||
|
property int textElide: Qt.ElideRight
|
||||||
|
|
||||||
property string descriptionText
|
property string descriptionText
|
||||||
|
|
||||||
property var clickedFunction
|
property var clickedFunction
|
||||||
|
@ -68,6 +71,8 @@ Item {
|
||||||
ListItemTitleType {
|
ListItemTitleType {
|
||||||
text: root.text
|
text: root.text
|
||||||
color: root.descriptionOnTop ? root.descriptionColor : root.textColor
|
color: root.descriptionOnTop ? root.descriptionColor : root.textColor
|
||||||
|
maximumLineCount: root.textMaximumLineCount
|
||||||
|
elide: root.textElide
|
||||||
|
|
||||||
opacity: root.textOpacity
|
opacity: root.textOpacity
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,15 @@ import QtQuick.Layouts
|
||||||
import "TextTypes"
|
import "TextTypes"
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: menuContent
|
id: root
|
||||||
|
|
||||||
property var rootWidth
|
property var rootWidth
|
||||||
|
|
||||||
property var selectedText
|
property var selectedText
|
||||||
|
|
||||||
|
property int textMaximumLineCount: 2
|
||||||
|
property int textElide: Qt.ElideRight
|
||||||
|
|
||||||
property string imageSource: "qrc:/images/controls/check.svg"
|
property string imageSource: "qrc:/images/controls/check.svg"
|
||||||
|
|
||||||
property var clickedFunction
|
property var clickedFunction
|
||||||
|
@ -18,7 +21,7 @@ ListView {
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
|
|
||||||
width: rootWidth
|
width: rootWidth
|
||||||
height: menuContent.contentItem.height
|
height: root.contentItem.height
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
interactive: false
|
interactive: false
|
||||||
|
@ -27,6 +30,12 @@ ListView {
|
||||||
id: buttonGroup
|
id: buttonGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function triggerCurrentItem() {
|
||||||
|
var item = root.itemAtIndex(currentIndex)
|
||||||
|
var radioButton = item.children[0].children[0]
|
||||||
|
radioButton.clicked()
|
||||||
|
}
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
implicitWidth: rootWidth
|
implicitWidth: rootWidth
|
||||||
implicitHeight: content.implicitHeight
|
implicitHeight: content.implicitHeight
|
||||||
|
@ -74,6 +83,9 @@ ListView {
|
||||||
Layout.bottomMargin: 20
|
Layout.bottomMargin: 20
|
||||||
|
|
||||||
text: name
|
text: name
|
||||||
|
maximumLineCount: root.textMaximumLineCount
|
||||||
|
elide: root.textElide
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
@ -88,11 +100,11 @@ ListView {
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonGroup.group: buttonGroup
|
ButtonGroup.group: buttonGroup
|
||||||
checked: menuContent.currentIndex === index
|
checked: root.currentIndex === index
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
menuContent.currentIndex = index
|
root.currentIndex = index
|
||||||
menuContent.selectedText = name
|
root.selectedText = name
|
||||||
if (clickedFunction && typeof clickedFunction === "function") {
|
if (clickedFunction && typeof clickedFunction === "function") {
|
||||||
clickedFunction()
|
clickedFunction()
|
||||||
}
|
}
|
||||||
|
@ -101,8 +113,8 @@ ListView {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (menuContent.currentIndex === index) {
|
if (root.currentIndex === index) {
|
||||||
menuContent.selectedText = name
|
root.selectedText = name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import "TextTypes"
|
||||||
RadioButton {
|
RadioButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property int textMaximumLineCount: 2
|
||||||
|
property int textElide: Qt.ElideRight
|
||||||
property string descriptionText
|
property string descriptionText
|
||||||
|
|
||||||
property string hoveredColor: Qt.rgba(1, 1, 1, 0.05)
|
property string hoveredColor: Qt.rgba(1, 1, 1, 0.05)
|
||||||
|
@ -104,6 +106,8 @@ RadioButton {
|
||||||
|
|
||||||
ListItemTitleType {
|
ListItemTitleType {
|
||||||
text: root.text
|
text: root.text
|
||||||
|
maximumLineCount: root.textMaximumLineCount
|
||||||
|
elide: root.textElide
|
||||||
|
|
||||||
color: {
|
color: {
|
||||||
if (root.checked) {
|
if (root.checked) {
|
||||||
|
|
|
@ -75,12 +75,20 @@ PageType {
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 24
|
||||||
|
Layout.leftMargin: 24
|
||||||
|
Layout.rightMargin: 24
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Header1TextType {
|
Header1TextType {
|
||||||
|
Layout.maximumWidth: buttonContent.width - 48 - 18 - 12 // todo
|
||||||
|
|
||||||
|
maximumLineCount: 2
|
||||||
|
elide: Qt.ElideRight
|
||||||
|
|
||||||
text: root.defaultServerName
|
text: root.defaultServerName
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
@ -148,10 +156,15 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
||||||
Header1TextType {
|
Header1TextType {
|
||||||
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 24
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.leftMargin: 16
|
||||||
|
Layout.rightMargin: 16
|
||||||
|
|
||||||
text: root.defaultServerName
|
text: root.defaultServerName
|
||||||
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
|
maximumLineCount: 2
|
||||||
|
elide: Qt.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelTextType {
|
LabelTextType {
|
||||||
|
|
|
@ -101,7 +101,7 @@ PageType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
headerText: qsTr("Server name")
|
headerText: qsTr("Server name")
|
||||||
textFieldText: name
|
textFieldText: name
|
||||||
textField.maximumLength: 20
|
textField.maximumLength: 30
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
|
|
|
@ -173,19 +173,22 @@ PageType {
|
||||||
DropDownType {
|
DropDownType {
|
||||||
id: serverSelector
|
id: serverSelector
|
||||||
|
|
||||||
|
signal severSelectorIndexChanged
|
||||||
|
property int currentIndex: 0
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
|
|
||||||
drawerHeight: 0.4375
|
drawerHeight: 0.4375
|
||||||
|
|
||||||
descriptionText: accessTypeSelector.currentIndex === 0 ? qsTr("Server and service") : qsTr("Server")
|
descriptionText: qsTr("Servers")
|
||||||
headerText: qsTr("Server")
|
headerText: qsTr("Server")
|
||||||
|
|
||||||
listView: ListViewWithLabelsType {
|
listView: ListViewWithRadioButtonType {
|
||||||
rootWidth: root.width
|
id: serverSelectorListView
|
||||||
dividerVisible: true
|
|
||||||
|
|
||||||
imageSource: "qrc:/images/controls/chevron-right.svg"
|
rootWidth: root.width
|
||||||
|
imageSource: "qrc:/images/controls/check.svg"
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
model: SortFilterProxyModel {
|
||||||
id: proxyServersModel
|
id: proxyServersModel
|
||||||
|
@ -203,14 +206,16 @@ PageType {
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
handler()
|
handler()
|
||||||
|
|
||||||
if (accessTypeSelector.currentIndex === 0) {
|
if (serverSelector.currentIndex !== serverSelectorListView.currentIndex) {
|
||||||
protocolSelector.visible = true
|
serverSelector.currentIndex = serverSelectorListView.currentIndex
|
||||||
root.shareButtonEnabled = false
|
serverSelector.severSelectorIndexChanged()
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (accessTypeSelector.currentIndex !== 0) {
|
||||||
shareConnectionDrawer.headerText = qsTr("Accessing ") + serverSelector.text
|
shareConnectionDrawer.headerText = qsTr("Accessing ") + serverSelector.text
|
||||||
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
|
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
|
||||||
serverSelector.menuVisible = false
|
|
||||||
}
|
}
|
||||||
|
serverSelector.menuVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -224,117 +229,90 @@ PageType {
|
||||||
ServersModel.currentlyProcessedIndex = proxyServersModel.mapToSource(currentIndex)
|
ServersModel.currentlyProcessedIndex = proxyServersModel.mapToSource(currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DrawerType {
|
DropDownType {
|
||||||
id: protocolSelector
|
id: protocolSelector
|
||||||
|
|
||||||
width: parent.width
|
Layout.fillWidth: true
|
||||||
height: parent.height * 0.5
|
Layout.topMargin: 16
|
||||||
|
|
||||||
ColumnLayout {
|
drawerHeight: 0.5
|
||||||
id: protocolSelectorHeader
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
descriptionText: qsTr("Protocols")
|
||||||
anchors.left: parent.left
|
headerText: qsTr("Protocol")
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.topMargin: 16
|
|
||||||
|
|
||||||
BackButtonType {
|
listView: ListViewWithRadioButtonType {
|
||||||
backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
id: protocolSelectorListView
|
||||||
backButtonFunction: function() {
|
|
||||||
protocolSelector.visible = false
|
rootWidth: root.width
|
||||||
|
imageSource: "qrc:/images/controls/check.svg"
|
||||||
|
|
||||||
|
model: SortFilterProxyModel {
|
||||||
|
id: proxyContainersModel
|
||||||
|
sourceModel: ContainersModel
|
||||||
|
filters: [
|
||||||
|
ValueFilter {
|
||||||
|
roleName: "isInstalled"
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
ValueFilter {
|
||||||
|
roleName: "isShareable"
|
||||||
|
value: true
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
currentIndex: 0
|
||||||
|
|
||||||
|
clickedFunction: function() {
|
||||||
|
handler()
|
||||||
|
|
||||||
|
protocolSelector.menuVisible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (accessTypeSelector.currentIndex === 0) {
|
||||||
|
handler()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickableType {
|
Connections {
|
||||||
anchors.top: protocolSelectorHeader.bottom
|
target: serverSelector
|
||||||
anchors.topMargin: 16
|
|
||||||
contentHeight: protocolSelectorContent.implicitHeight
|
|
||||||
|
|
||||||
Column {
|
function onSeverSelectorIndexChanged() {
|
||||||
id: protocolSelectorContent
|
protocolSelectorListView.currentIndex = 0
|
||||||
anchors.top: parent.top
|
protocolSelectorListView.triggerCurrentItem()
|
||||||
anchors.left: parent.left
|
}
|
||||||
anchors.right: parent.right
|
}
|
||||||
|
|
||||||
spacing: 16
|
function handler() {
|
||||||
|
if (!proxyContainersModel.count) {
|
||||||
|
root.shareButtonEnabled = false
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
root.shareButtonEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
Header2TextType {
|
protocolSelector.text = selectedText
|
||||||
anchors.left: parent.left
|
root.connectionServerSelectorText = serverSelector.text
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.leftMargin: 16
|
|
||||||
anchors.rightMargin: 16
|
|
||||||
|
|
||||||
text: qsTr("Protocols and services")
|
shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text
|
||||||
wrapMode: Text.WordWrap
|
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
|
||||||
}
|
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(currentIndex))
|
||||||
|
|
||||||
ListViewWithRadioButtonType {
|
fillConnectionTypeModel()
|
||||||
rootWidth: root.width
|
}
|
||||||
|
|
||||||
imageSource: "qrc:/images/controls/check.svg"
|
function fillConnectionTypeModel() {
|
||||||
|
root.connectionTypesModel = [amneziaConnectionFormat]
|
||||||
|
|
||||||
model: SortFilterProxyModel {
|
var index = proxyContainersModel.mapToSource(currentIndex)
|
||||||
id: proxyContainersModel
|
|
||||||
sourceModel: ContainersModel
|
|
||||||
filters: [
|
|
||||||
ValueFilter {
|
|
||||||
roleName: "isInstalled"
|
|
||||||
value: true
|
|
||||||
},
|
|
||||||
ValueFilter {
|
|
||||||
roleName: "isShareable"
|
|
||||||
value: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
currentIndex: 0
|
if (index === ContainerProps.containerFromString("amnezia-openvpn")) {
|
||||||
|
root.connectionTypesModel.push(openVpnConnectionFormat)
|
||||||
clickedFunction: function() {
|
} else if (index === ContainerProps.containerFromString("amnezia-wireguard")) {
|
||||||
handler()
|
root.connectionTypesModel.push(wireGuardConnectionFormat)
|
||||||
|
|
||||||
protocolSelector.visible = false
|
|
||||||
serverSelector.menuVisible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (accessTypeSelector.currentIndex === 0) {
|
|
||||||
handler()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handler() {
|
|
||||||
if (!proxyContainersModel.count) {
|
|
||||||
root.shareButtonEnabled = false
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
root.shareButtonEnabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
serverSelector.text += ", " + selectedText
|
|
||||||
root.connectionServerSelectorText = serverSelector.text
|
|
||||||
|
|
||||||
shareConnectionDrawer.headerText = qsTr("Connection to ") + serverSelector.text
|
|
||||||
shareConnectionDrawer.configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
|
|
||||||
ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(currentIndex))
|
|
||||||
|
|
||||||
fillConnectionTypeModel()
|
|
||||||
}
|
|
||||||
|
|
||||||
function fillConnectionTypeModel() {
|
|
||||||
root.connectionTypesModel = [amneziaConnectionFormat]
|
|
||||||
|
|
||||||
var index = proxyContainersModel.mapToSource(currentIndex)
|
|
||||||
|
|
||||||
if (index === ContainerProps.containerFromString("amnezia-openvpn")) {
|
|
||||||
root.connectionTypesModel.push(openVpnConnectionFormat)
|
|
||||||
} else if (index === ContainerProps.containerFromString("amnezia-wireguard")) {
|
|
||||||
root.connectionTypesModel.push(wireGuardConnectionFormat)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue