Merge commit '367789bda2' into improve_navigation_cpp
This commit is contained in:
commit
149c9d12d3
34 changed files with 1052 additions and 218 deletions
|
|
@ -169,6 +169,7 @@ Button {
|
|||
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
enabled: root.enabled
|
||||
|
||||
onEntered: {
|
||||
backgroundRect.color = root.hoveredColor
|
||||
|
|
|
|||
|
|
@ -51,8 +51,14 @@ PageType {
|
|||
imageSource: "qrc:/images/controls/download.svg"
|
||||
|
||||
checked: index === ApiCountryModel.currentIndex
|
||||
checkable: !ConnectionController.isConnected
|
||||
|
||||
onClicked: {
|
||||
if (ConnectionController.isConnected) {
|
||||
PageController.showNotificationMessage(qsTr("Unable change server location while there is an active connection"))
|
||||
return
|
||||
}
|
||||
|
||||
if (index !== ApiCountryModel.currentIndex) {
|
||||
PageController.showBusyIndicator(true)
|
||||
var prevIndex = ApiCountryModel.currentIndex
|
||||
|
|
|
|||
|
|
@ -49,12 +49,15 @@ PageType {
|
|||
}
|
||||
|
||||
LabelWithImageType {
|
||||
property bool showSubscriptionEndDate: ServersModel.getProcessedServerData("isCountrySelectionAvailable")
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: 16
|
||||
|
||||
imageSource: "qrc:/images/controls/history.svg"
|
||||
leftText: qsTr("Work period")
|
||||
rightText: ApiServicesModel.getSelectedServiceData("workPeriod")
|
||||
leftText: showSubscriptionEndDate ? qsTr("Valid until") : qsTr("Work period")
|
||||
rightText: showSubscriptionEndDate ? ApiServicesModel.getSelectedServiceData("endDate")
|
||||
: ApiServicesModel.getSelectedServiceData("workPeriod")
|
||||
|
||||
visible: rightText !== ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ PageType {
|
|||
readonly property int pageSettingsApiServerInfo: 3
|
||||
readonly property int pageSettingsApiLanguageList: 4
|
||||
|
||||
property var server
|
||||
property var processedServer
|
||||
|
||||
Connections {
|
||||
target: PageController
|
||||
|
|
@ -35,10 +35,18 @@ PageType {
|
|||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: ServersModel
|
||||
|
||||
function onProcessedServerChanged() {
|
||||
root.processedServer = proxyServersModel.get(0)
|
||||
}
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: proxyServersModel
|
||||
objectName: "proxyServersModel"
|
||||
|
||||
|
||||
sourceModel: ServersModel
|
||||
filters: [
|
||||
ValueFilter {
|
||||
|
|
@ -48,7 +56,7 @@ PageType {
|
|||
]
|
||||
|
||||
Component.onCompleted: {
|
||||
root.server = proxyServersModel.get(0)
|
||||
root.processedServer = proxyServersModel.get(0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,8 +73,8 @@ PageType {
|
|||
objectName: "backButton"
|
||||
|
||||
backButtonFunction: function() {
|
||||
if (nestedStackView.currentIndex === root.pageSettingsApiServerInfo
|
||||
&& ServersModel.getProcessedServerData("isCountrySelectionAvailable")) {
|
||||
if (nestedStackView.currentIndex === root.pageSettingsApiServerInfo &&
|
||||
root.processedServer.isCountrySelectionAvailable) {
|
||||
nestedStackView.currentIndex = root.pageSettingsApiLanguageList
|
||||
} else {
|
||||
PageController.closePage()
|
||||
|
|
@ -83,18 +91,23 @@ PageType {
|
|||
Layout.rightMargin: 16
|
||||
Layout.bottomMargin: 10
|
||||
|
||||
actionButtonImage: nestedStackView.currentIndex === root.pageSettingsApiLanguageList ? "qrc:/images/controls/settings.svg" : "qrc:/images/controls/edit-3.svg"
|
||||
actionButtonImage: nestedStackView.currentIndex === root.pageSettingsApiLanguageList ? "qrc:/images/controls/settings.svg"
|
||||
: "qrc:/images/controls/edit-3.svg"
|
||||
|
||||
headerText: root.server.name
|
||||
headerText: root.processedServer.name
|
||||
descriptionText: {
|
||||
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
|
||||
return ApiServicesModel.getSelectedServiceData("serviceDescription")
|
||||
} else if (ServersModel.getProcessedServerData("isServerFromTelegramApi")) {
|
||||
return root.server.serverDescription
|
||||
} else if (ServersModel.isProcessedServerHasWriteAccess()) {
|
||||
return root.server.credentialsLogin + " · " + root.server.hostName
|
||||
if (root.processedServer.isServerFromGatewayApi) {
|
||||
if (nestedStackView.currentIndex === root.pageSettingsApiLanguageList) {
|
||||
return qsTr("Subscription is valid until ") + ApiServicesModel.getSelectedServiceData("endDate")
|
||||
} else {
|
||||
return ApiServicesModel.getSelectedServiceData("serviceDescription")
|
||||
}
|
||||
} else if (root.processedServer.isServerFromTelegramApi) {
|
||||
return root.processedServer.serverDescription
|
||||
} else if (root.processedServer.hasWriteAccess) {
|
||||
return root.processedServer.credentialsLogin + " · " + root.processedServer.hostName
|
||||
} else {
|
||||
return root.server.hostName
|
||||
return root.processedServer.hostName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +142,7 @@ PageType {
|
|||
|
||||
Layout.fillWidth: true
|
||||
headerText: qsTr("Server name")
|
||||
textFieldText: root.server.name
|
||||
textFieldText: root.processedServer.name
|
||||
textField.maximumLength: 30
|
||||
checkEmptyText: true
|
||||
}
|
||||
|
|
@ -146,9 +159,8 @@ PageType {
|
|||
return
|
||||
}
|
||||
|
||||
if (serverName.textFieldText !== root.server.name) {
|
||||
if (serverName.textFieldText !== root.processedServer.name) {
|
||||
ServersModel.setProcessedServerData("name", serverName.textFieldText);
|
||||
root.server = proxyServersModel.get(0);
|
||||
}
|
||||
serverNameEditDrawer.closeTriggered()
|
||||
}
|
||||
|
|
@ -238,6 +250,5 @@ PageType {
|
|||
stackView: root.stackView
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,84 +14,83 @@ import "../Config"
|
|||
PageType {
|
||||
id: root
|
||||
|
||||
FlickableType {
|
||||
id: fl
|
||||
ColumnLayout {
|
||||
id: header
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
spacing: 0
|
||||
|
||||
BackButtonType {
|
||||
id: backButton
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
|
||||
HeaderType {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 8
|
||||
Layout.rightMargin: 16
|
||||
Layout.leftMargin: 16
|
||||
Layout.bottomMargin: 16
|
||||
|
||||
headerText: qsTr("VPN by Amnezia")
|
||||
descriptionText: qsTr("Choose a VPN service that suits your needs.")
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: servicesListView
|
||||
|
||||
anchors.top: header.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
contentHeight: content.height
|
||||
anchors.topMargin: 16
|
||||
spacing: 0
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
property bool isFocusable: true
|
||||
selectedIndex: 1
|
||||
clip: true
|
||||
model: ApiServicesModel
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
spacing: 0
|
||||
delegate: Item {
|
||||
implicitWidth: servicesListView.width
|
||||
implicitHeight: delegateContent.implicitHeight
|
||||
|
||||
BackButtonType {
|
||||
id: backButton
|
||||
Layout.topMargin: 20
|
||||
}
|
||||
ColumnLayout {
|
||||
id: delegateContent
|
||||
|
||||
HeaderType {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 8
|
||||
Layout.rightMargin: 16
|
||||
Layout.leftMargin: 16
|
||||
Layout.bottomMargin: 32
|
||||
anchors.fill: parent
|
||||
|
||||
headerText: qsTr("VPN by Amnezia")
|
||||
descriptionText: qsTr("Choose a VPN service that suits your needs.")
|
||||
}
|
||||
CardWithIconsType {
|
||||
id: card
|
||||
|
||||
ListView {
|
||||
id: containers
|
||||
width: parent.width
|
||||
height: containers.contentItem.height
|
||||
spacing: 16
|
||||
Layout.fillWidth: true
|
||||
Layout.rightMargin: 16
|
||||
Layout.leftMargin: 16
|
||||
Layout.bottomMargin: 16
|
||||
|
||||
property bool isFocusable: true
|
||||
headerText: name
|
||||
bodyText: cardDescription
|
||||
footerText: price
|
||||
|
||||
currentIndex: 1
|
||||
interactive: false
|
||||
model: ApiServicesModel
|
||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||
|
||||
delegate: Item {
|
||||
implicitWidth: containers.width
|
||||
implicitHeight: delegateContent.implicitHeight
|
||||
enabled: isServiceAvailable
|
||||
|
||||
ColumnLayout {
|
||||
id: delegateContent
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
CardWithIconsType {
|
||||
id: card
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.rightMargin: 16
|
||||
Layout.leftMargin: 16
|
||||
|
||||
headerText: name
|
||||
bodyText: cardDescription
|
||||
footerText: price
|
||||
|
||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||
|
||||
onClicked: {
|
||||
if (isServiceAvailable) {
|
||||
ApiServicesModel.setServiceIndex(index)
|
||||
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onEnterPressed: clicked()
|
||||
Keys.onReturnPressed: clicked()
|
||||
onClicked: {
|
||||
if (isServiceAvailable) {
|
||||
ApiServicesModel.setServiceIndex(index)
|
||||
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onEnterPressed: clicked()
|
||||
Keys.onReturnPressed: clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,30 +32,6 @@ PageType {
|
|||
|
||||
property bool isFocusable: true
|
||||
|
||||
Keys.onTabPressed: {
|
||||
FocusController.nextKeyTabItem()
|
||||
}
|
||||
|
||||
Keys.onBacktabPressed: {
|
||||
FocusController.previousKeyTabItem()
|
||||
}
|
||||
|
||||
Keys.onUpPressed: {
|
||||
FocusController.nextKeyUpItem()
|
||||
}
|
||||
|
||||
Keys.onDownPressed: {
|
||||
FocusController.nextKeyDownItem()
|
||||
}
|
||||
|
||||
Keys.onLeftPressed: {
|
||||
FocusController.nextKeyLeftItem()
|
||||
}
|
||||
|
||||
Keys.onRightPressed: {
|
||||
FocusController.nextKeyRightItem()
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBarType {}
|
||||
|
||||
model: variants
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ PageType {
|
|||
break
|
||||
}
|
||||
case PageShare.ConfigType.Xray: {
|
||||
ExportController.generateXrayConfig()
|
||||
ExportController.generateXrayConfig(clientNameTextField.textFieldText)
|
||||
shareConnectionDrawer.configCaption = qsTr("Save XRay config")
|
||||
shareConnectionDrawer.configExtension = ".json"
|
||||
shareConnectionDrawer.configFileName = "amnezia_for_xray"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue