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