Files
amnezia-client/client/ui/qml/Pages2/PageSetupWizardStart.qml
T

196 lines
5.2 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "./"
import "../Controls2"
import "../Config"
import "../Controls2/TextTypes"
import "../Components"
PageType {
id: root
2024-02-28 19:39:28 +07:00
property bool isControlsDisabled: false
2024-04-18 17:54:55 +04:00
defaultActiveFocusItem: focusItem
Connections {
target: PageController
function onGoToPageViewConfig() {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageSetupWizardViewConfig)
}
function onClosePage() {
if (stackView.depth <= 1) {
PageController.hideWindow()
return
}
stackView.pop()
}
function onGoToPage(page, slide) {
var pagePath = PageController.getPagePath(page)
if (slide) {
stackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
} else {
stackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
}
}
function onGoToStartPage() {
while (stackView.depth > 1) {
stackView.pop()
}
}
2024-02-28 19:39:28 +07:00
function onDisableControls(disabled) {
isControlsDisabled = disabled
}
function onDisableTabBar(disabled) {
isControlsDisabled = disabled
}
2024-02-28 19:39:28 +07:00
function onEscapePressed() {
if (isControlsDisabled) {
2024-02-28 19:39:28 +07:00
return
}
PageController.closePage()
}
}
Connections {
target: SettingsController
function onRestoreBackupFinished() {
PageController.showNotificationMessage(qsTr("Settings restored from backup file"))
PageController.replaceStartPage()
}
}
Connections {
target: InstallController
2024-05-25 13:00:51 +03:00
function onInstallationErrorOccurred(error) {
PageController.showBusyIndicator(false)
2024-05-25 13:00:51 +03:00
PageController.showErrorMessage(error)
var currentPageName = stackView.currentItem.objectName
if (currentPageName === PageController.getPagePath(PageEnum.PageSetupWizardInstalling)) {
PageController.closePage()
}
}
}
Connections {
target: ImportController
function onRestoreAppConfig(data) {
PageController.showBusyIndicator(true)
SettingsController.restoreAppConfigFromData(data)
PageController.showBusyIndicator(false)
}
2024-05-25 13:00:51 +03:00
function onImportErrorOccurred(error, goToPageHome) {
PageController.showErrorMessage(error)
}
}
FlickableType {
id: fl
anchors.top: parent.top
anchors.bottom: parent.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: 0
Image {
id: image
source: "qrc:/images/amneziaBigLogo.png"
Layout.alignment: Qt.AlignCenter
Layout.topMargin: 32
Layout.leftMargin: 8
Layout.rightMargin: 8
Layout.preferredWidth: 344
Layout.preferredHeight: 279
}
ParagraphTextType {
Layout.fillWidth: true
Layout.topMargin: 50
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Free service for creating a personal VPN on your server.") +
qsTr(" Helps you access blocked content without revealing your privacy, even to VPN providers.")
}
2024-04-18 17:54:55 +04:00
Item {
id: focusItem
KeyNavigation.tab: startButton
}
BasicButtonType {
2024-04-18 17:54:55 +04:00
id: startButton
Layout.fillWidth: true
Layout.topMargin: 32
Layout.leftMargin: 16
Layout.rightMargin: 16
2023-07-24 16:33:58 +09:00
text: qsTr("I have the data to connect")
clickedFunc: function() {
2024-02-16 15:24:06 +05:00
connectionTypeSelection.open()
}
2024-04-18 17:54:55 +04:00
KeyNavigation.tab: startButton2
}
BasicButtonType {
2024-04-18 17:54:55 +04:00
id: startButton2
Layout.fillWidth: true
Layout.topMargin: 8
Layout.leftMargin: 16
Layout.rightMargin: 16
defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
pressedColor: Qt.rgba(1, 1, 1, 0.12)
disabledColor: "#878B91"
textColor: "#D7D8DB"
borderWidth: 1
2023-07-24 16:33:58 +09:00
text: qsTr("I have nothing")
clickedFunc: function() {
Qt.openUrlExternally(qsTr("https://amnezia.org/instructions/0_starter-guide"))
}
2024-04-18 17:54:55 +04:00
Keys.onTabPressed: lastItemTabClicked(focusItem)
}
}
2024-02-16 15:24:06 +05:00
}
2024-02-16 15:24:06 +05:00
ConnectionTypeSelectionDrawer {
id: connectionTypeSelection
2024-04-18 17:54:55 +04:00
onClosed: {
PageController.forceTabBarActiveFocus()
root.defaultActiveFocusItem.forceActiveFocus()
}
}
}