mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
replace FlickableType with ListViewType in PageSettingsApplication and update layout structure
This commit is contained in:
@@ -21,22 +21,24 @@ PageType {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: 20
|
anchors.topMargin: 20
|
||||||
|
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if(backButton.enabled && backButton.activeFocus) {
|
||||||
|
listView.positionViewAtBeginning()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickableType {
|
ListViewType {
|
||||||
id: fl
|
id: listView
|
||||||
|
|
||||||
anchors.top: backButton.bottom
|
anchors.top: backButton.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
contentHeight: content.height
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
ColumnLayout {
|
header: ColumnLayout {
|
||||||
id: content
|
width: listView.width
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
BaseHeaderType {
|
BaseHeaderType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -45,9 +47,17 @@ PageType {
|
|||||||
|
|
||||||
headerText: qsTr("Application")
|
headerText: qsTr("Application")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
model: 1 // fake model to force the ListView to be created without a model
|
||||||
|
|
||||||
|
delegate: ColumnLayout { // TODO(CyAn84): add DelegateChooser when have migrated to 6.9
|
||||||
|
|
||||||
|
width: listView.width
|
||||||
|
|
||||||
SwitcherType {
|
SwitcherType {
|
||||||
id: switcher
|
id: switcherAllowScreenshots
|
||||||
|
|
||||||
visible: GC.isMobile()
|
visible: GC.isMobile()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -61,10 +71,6 @@ PageType {
|
|||||||
SettingsController.toggleScreenshotsEnabled(checked)
|
SettingsController.toggleScreenshotsEnabled(checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyNavigation.tab: Qt.platform.os === "android" && !SettingsController.isNotificationPermissionGranted ?
|
|
||||||
// labelWithButtonNotification.rightButton : labelWithButtonLanguage.rightButton
|
|
||||||
parentFlickable: fl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerType {
|
DividerType {
|
||||||
@@ -73,15 +79,15 @@ PageType {
|
|||||||
|
|
||||||
LabelWithButtonType {
|
LabelWithButtonType {
|
||||||
id: labelWithButtonNotification
|
id: labelWithButtonNotification
|
||||||
|
|
||||||
visible: Qt.platform.os === "android" && !SettingsController.isNotificationPermissionGranted
|
visible: Qt.platform.os === "android" && !SettingsController.isNotificationPermissionGranted
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("Enable notifications")
|
text: qsTr("Enable notifications")
|
||||||
descriptionText: qsTr("Enable notifications to show the VPN state in the status bar")
|
descriptionText: qsTr("Enable notifications to show the VPN state in the status bar")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
SettingsController.requestNotificationPermission()
|
SettingsController.requestNotificationPermission()
|
||||||
}
|
}
|
||||||
@@ -93,6 +99,7 @@ PageType {
|
|||||||
|
|
||||||
SwitcherType {
|
SwitcherType {
|
||||||
id: switcherAutoStart
|
id: switcherAutoStart
|
||||||
|
|
||||||
visible: !GC.isMobile()
|
visible: !GC.isMobile()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -101,8 +108,6 @@ PageType {
|
|||||||
text: qsTr("Auto start")
|
text: qsTr("Auto start")
|
||||||
descriptionText: qsTr("Launch the application every time the device is starts")
|
descriptionText: qsTr("Launch the application every time the device is starts")
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
checked: SettingsController.isAutoStartEnabled()
|
checked: SettingsController.isAutoStartEnabled()
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isAutoStartEnabled()) {
|
if (checked !== SettingsController.isAutoStartEnabled()) {
|
||||||
@@ -117,6 +122,7 @@ PageType {
|
|||||||
|
|
||||||
SwitcherType {
|
SwitcherType {
|
||||||
id: switcherAutoConnect
|
id: switcherAutoConnect
|
||||||
|
|
||||||
visible: !GC.isMobile()
|
visible: !GC.isMobile()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -125,8 +131,6 @@ PageType {
|
|||||||
text: qsTr("Auto connect")
|
text: qsTr("Auto connect")
|
||||||
descriptionText: qsTr("Connect to VPN on app start")
|
descriptionText: qsTr("Connect to VPN on app start")
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
checked: SettingsController.isAutoConnectEnabled()
|
checked: SettingsController.isAutoConnectEnabled()
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isAutoConnectEnabled()) {
|
if (checked !== SettingsController.isAutoConnectEnabled()) {
|
||||||
@@ -141,6 +145,7 @@ PageType {
|
|||||||
|
|
||||||
SwitcherType {
|
SwitcherType {
|
||||||
id: switcherStartMinimized
|
id: switcherStartMinimized
|
||||||
|
|
||||||
visible: !GC.isMobile()
|
visible: !GC.isMobile()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -152,8 +157,6 @@ PageType {
|
|||||||
enabled: switcherAutoStart.checked
|
enabled: switcherAutoStart.checked
|
||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
checked: SettingsController.isStartMinimizedEnabled()
|
checked: SettingsController.isStartMinimizedEnabled()
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
if (checked !== SettingsController.isStartMinimizedEnabled()) {
|
if (checked !== SettingsController.isStartMinimizedEnabled()) {
|
||||||
@@ -165,17 +168,21 @@ PageType {
|
|||||||
DividerType {
|
DividerType {
|
||||||
visible: !GC.isMobile()
|
visible: !GC.isMobile()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer: ColumnLayout {
|
||||||
|
|
||||||
|
width: listView.width
|
||||||
|
|
||||||
LabelWithButtonType {
|
LabelWithButtonType {
|
||||||
id: labelWithButtonLanguage
|
id: labelWithButtonLanguage
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("Language")
|
text: qsTr("Language")
|
||||||
descriptionText: LanguageModel.currentLanguageName
|
descriptionText: LanguageModel.currentLanguageName
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
selectLanguageDrawer.openTriggered()
|
selectLanguageDrawer.openTriggered()
|
||||||
}
|
}
|
||||||
@@ -185,14 +192,13 @@ PageType {
|
|||||||
|
|
||||||
LabelWithButtonType {
|
LabelWithButtonType {
|
||||||
id: labelWithButtonLogging
|
id: labelWithButtonLogging
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("Logging")
|
text: qsTr("Logging")
|
||||||
descriptionText: SettingsController.isLoggingEnabled ? qsTr("Enabled") : qsTr("Disabled")
|
descriptionText: SettingsController.isLoggingEnabled ? qsTr("Enabled") : qsTr("Disabled")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
PageController.goToPage(PageEnum.PageSettingsLogging)
|
PageController.goToPage(PageEnum.PageSettingsLogging)
|
||||||
}
|
}
|
||||||
@@ -202,14 +208,13 @@ PageType {
|
|||||||
|
|
||||||
LabelWithButtonType {
|
LabelWithButtonType {
|
||||||
id: labelWithButtonReset
|
id: labelWithButtonReset
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: qsTr("Reset settings and remove all data from the application")
|
text: qsTr("Reset settings and remove all data from the application")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
textColor: AmneziaStyle.color.vibrantRed
|
textColor: AmneziaStyle.color.vibrantRed
|
||||||
|
|
||||||
parentFlickable: fl
|
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
var headerText = qsTr("Reset settings and remove all data from the application?")
|
var headerText = qsTr("Reset settings and remove all data from the application?")
|
||||||
var descriptionText = qsTr("All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.")
|
var descriptionText = qsTr("All settings will be reset to default. All installed AmneziaVPN services will still remain on the server.")
|
||||||
|
|||||||
Reference in New Issue
Block a user