mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
* Fix qt 6.9 support * add support android sdk 36 * feat: add support SafeMargins from Android * Fix black screen --------- Co-authored-by: NickVs2015 <nv@amnezia.org>
194 lines
5.2 KiB
QML
194 lines
5.2 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import QtQuick.Dialogs
|
|
|
|
import PageEnum 1.0
|
|
import Style 1.0
|
|
|
|
import "./"
|
|
import "../Controls2"
|
|
import "../Controls2/TextTypes"
|
|
import "../Config"
|
|
|
|
PageType {
|
|
id: root
|
|
|
|
Connections {
|
|
target: ApiNewsController
|
|
function onFetchNewsFinished() {
|
|
PageController.showBusyIndicator(false)
|
|
}
|
|
|
|
function onErrorOccurred(errorCode) {
|
|
PageController.showErrorMessage(errorCode)
|
|
PageController.closePage()
|
|
PageController.showBusyIndicator(false)
|
|
}
|
|
}
|
|
|
|
ListViewType {
|
|
id: listView
|
|
|
|
anchors.fill: parent
|
|
|
|
header: ColumnLayout {
|
|
width: listView.width
|
|
|
|
BaseHeaderType {
|
|
id: header
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: 24 + SettingsController.safeAreaTopMargin
|
|
Layout.bottomMargin: 16
|
|
Layout.rightMargin: 16
|
|
Layout.leftMargin: 16
|
|
|
|
headerText: qsTr("Settings")
|
|
}
|
|
}
|
|
|
|
model: settingsEntries
|
|
|
|
delegate: ColumnLayout {
|
|
width: listView.width
|
|
|
|
spacing: 0
|
|
|
|
LabelWithButtonType {
|
|
Layout.fillWidth: true
|
|
|
|
visible: isVisible
|
|
|
|
text: title
|
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
|
leftImageSource: leftImagePath
|
|
|
|
clickedFunction: clickedHandler
|
|
}
|
|
|
|
DividerType {
|
|
visible: isVisible
|
|
}
|
|
}
|
|
|
|
footer: ColumnLayout {
|
|
width: listView.width
|
|
|
|
LabelWithButtonType {
|
|
id: close
|
|
|
|
visible: GC.isDesktop()
|
|
Layout.fillWidth: true
|
|
|
|
text: qsTr("Close application")
|
|
leftImageSource: "qrc:/images/controls/x-circle.svg"
|
|
isLeftImageHoverEnabled: false
|
|
|
|
clickedFunction: function() {
|
|
PageController.closeApplication()
|
|
}
|
|
}
|
|
|
|
DividerType {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 16
|
|
Layout.rightMargin: 16
|
|
|
|
visible: GC.isDesktop()
|
|
}
|
|
}
|
|
}
|
|
|
|
property list<QtObject> settingsEntries: [
|
|
servers,
|
|
connection,
|
|
application,
|
|
news,
|
|
backup,
|
|
about,
|
|
devConsole
|
|
]
|
|
|
|
QtObject {
|
|
id: servers
|
|
|
|
property string title: qsTr("Servers")
|
|
readonly property string leftImagePath: "qrc:/images/controls/server.svg"
|
|
property bool isVisible: true
|
|
readonly property var clickedHandler: function() {
|
|
PageController.goToPage(PageEnum.PageSettingsServersList)
|
|
}
|
|
}
|
|
|
|
QtObject {
|
|
id: connection
|
|
|
|
property string title: qsTr("Connection")
|
|
readonly property string leftImagePath: "qrc:/images/controls/radio.svg"
|
|
property bool isVisible: true
|
|
readonly property var clickedHandler: function() {
|
|
PageController.goToPage(PageEnum.PageSettingsConnection)
|
|
}
|
|
}
|
|
|
|
QtObject {
|
|
id: application
|
|
|
|
property string title: qsTr("Application")
|
|
readonly property string leftImagePath: "qrc:/images/controls/app.svg"
|
|
property bool isVisible: true
|
|
readonly property var clickedHandler: function() {
|
|
PageController.goToPage(PageEnum.PageSettingsApplication)
|
|
}
|
|
}
|
|
|
|
QtObject {
|
|
id: news
|
|
|
|
property string title: qsTr("News & Notifications")
|
|
readonly property string leftImagePath: NewsModel.hasUnread ? "qrc:/images/controls/news-unread.svg" : "qrc:/images/controls/news.svg"
|
|
property bool isVisible: ServersModel.hasServersFromGatewayApi
|
|
readonly property var clickedHandler: function() {
|
|
if (!ServersModel.hasServersFromGatewayApi) {
|
|
return;
|
|
}
|
|
PageController.showBusyIndicator(true)
|
|
ApiNewsController.fetchNews()
|
|
PageController.goToPage(PageEnum.PageSettingsNewsNotifications)
|
|
}
|
|
}
|
|
|
|
QtObject {
|
|
id: backup
|
|
|
|
property string title: qsTr("Backup")
|
|
readonly property string leftImagePath: "qrc:/images/controls/save.svg"
|
|
property bool isVisible: true
|
|
readonly property var clickedHandler: function() {
|
|
PageController.goToPage(PageEnum.PageSettingsBackup)
|
|
}
|
|
}
|
|
|
|
QtObject {
|
|
id: about
|
|
|
|
property string title: qsTr("About AmneziaVPN")
|
|
readonly property string leftImagePath: "qrc:/images/controls/amnezia.svg"
|
|
property bool isVisible: true
|
|
readonly property var clickedHandler: function() {
|
|
PageController.goToPage(PageEnum.PageSettingsAbout)
|
|
}
|
|
}
|
|
|
|
QtObject {
|
|
id: devConsole
|
|
|
|
property string title: qsTr("Dev console")
|
|
readonly property string leftImagePath: "qrc:/images/controls/bug.svg"
|
|
property bool isVisible: SettingsController.isDevModeEnabled
|
|
readonly property var clickedHandler: function() {
|
|
PageController.goToPage(PageEnum.PageDevMenu)
|
|
}
|
|
}
|
|
}
|