changed the way to create qml pages, now the page is created when you go to it

- added PageSetupWizardConfigSource, PageSetupWizardInstalling, PageSetupWizardProtocolSettings, PageSetupWizardTextKey
This commit is contained in:
vladimir.kuznetsov 2023-05-03 19:06:16 +03:00
parent 68b27451f2
commit 4f36349630
25 changed files with 503 additions and 158 deletions

View file

@ -0,0 +1,114 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import PageEnum 1.0
import "./"
import "../Pages"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageBase {
id: root
page: PageEnum.PageSetupWizardInstalling
FlickableType {
id: fl
anchors.top: root.top
anchors.bottom: root.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 16
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 20
buttonImage: "qrc:/images/controls/arrow-left.svg"
headerText: "Подключение к серверу"
descriptionText: "Не используйте код подключения из публичных источников. Его могли создать, чтобы перехватывать ваши данные.\n
Всё в порядке, если код передал друг."
}
Header2TextType {
Layout.fillWidth: true
Layout.topMargin: 32
text: "Что у вас есть?"
}
LabelWithButtonType {
Layout.fillWidth: true
Layout.topMargin: 16
text: "Файл с настройками подключения"
buttonImage: "qrc:/images/controls/chevron-right.svg"
iconImage: "qrc:/images/controls/folder-open.svg"
onClickedFunc: function() {
onClicked: fileDialog.open()
}
FileDialog {
id: fileDialog
// currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
onAccepted: {
}
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
//todo ifdef mobile platforms>
LabelWithButtonType {
Layout.fillWidth: true
text: "QR-код"
buttonImage: "qrc:/images/controls/chevron-right.svg"
iconImage: "qrc:/images/controls/qr-code.svg"
onClickedFunc: function() {
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
LabelWithButtonType {
Layout.fillWidth: true
text: "Ключ в виде текста"
buttonImage: "qrc:/images/controls/chevron-right.svg"
iconImage: "qrc:/images/controls/text-cursor.svg"
onClickedFunc: function() {
UiLogic.goToPage(PageEnum.PageSetupWizardTextKey)
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
}
}
}

View file

@ -11,7 +11,7 @@ import "../Config"
PageBase {
id: root
page: PageEnum.WizardCredentials
page: PageEnum.PageSetupWizardCredentials
FlickableType {
id: fl
@ -61,7 +61,7 @@ PageBase {
text: qsTr("Настроить сервер простым образом")
onClicked: function() {
UiLogic.goToPage(PageEnum.WizardEasySetup)
UiLogic.goToPage(PageEnum.PageSetupWizardEasy)
}
}
@ -79,7 +79,7 @@ PageBase {
text: qsTr("Выбрать протокол для установки")
onClicked: function() {
UiLogic.goToPage(PageEnum.WizardProtocols)
UiLogic.goToPage(PageEnum.PageSetupWizardProtocols)
}
}
}

View file

@ -11,7 +11,7 @@ import "../Config"
PageBase {
id: root
page: PageEnum.WizardEasySetup
page: PageEnum.PageSetupWizardEasy
FlickableType {
id: fl

View file

@ -0,0 +1,46 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "./"
import "../Pages"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageBase {
id: root
page: PageEnum.PageSetupWizardInstalling
FlickableType {
id: fl
anchors.top: root.top
anchors.bottom: root.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 16
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 20
//TODO remove later
buttonImage: "qrc:/images/controls/arrow-left.svg"
headerText: "Установка"
descriptionText: ContainersModel.getCurrentlyInstalledContainerName()
}
}
}
}

View file

@ -0,0 +1,96 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "./"
import "../Pages"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageBase {
id: root
page: PageEnum.PageSetupWizardProtocolSettings
FlickableType {
id: fl
anchors.top: root.top
anchors.bottom: root.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 16
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 20
buttonImage: "qrc:/images/controls/arrow-left.svg"
headerText: "Установка " + ContainersModel.getCurrentlyInstalledContainerName()
descriptionText: "Эти настройки можно будет изменить позже"
}
BodyTextType {
Layout.topMargin: 16
text: "Network protocol"
}
//TODO move to separete control
Rectangle {
implicitWidth: buttonGroup.implicitWidth
implicitHeight: buttonGroup.implicitHeight
color: "#1C1D21"
radius: 16
RowLayout {
id: buttonGroup
spacing: 0
HorizontalRadioButton {
implicitWidth: (root.width - 32) / 2
text: "UDP"
}
HorizontalRadioButton {
implicitWidth: (root.width - 32) / 2
text: "TCP"
}
}
}
TextFieldWithHeaderType {
Layout.fillWidth: true
headerText: "Port"
}
}
}
BasicButtonType {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
anchors.bottomMargin: 32
text: qsTr("Установить")
onClicked: function() {
UiLogic.goToPage(PageEnum.PageSetupWizardInstalling)
}
}
}

View file

@ -14,11 +14,11 @@ import "../Config"
PageBase {
id: root
page: PageEnum.WizardProtocols
page: PageEnum.PageSetupWizardProtocols
SortFilterProxyModel {
id: containersModel
sourceModel: UiLogic.containersModel
id: proxyContainersModel
sourceModel: ContainersModel
filters: [
ValueFilter {
roleName: "is_installed_role"
@ -64,7 +64,7 @@ PageBase {
currentIndex: -1
clip: true
interactive: false
model: containersModel
model: proxyContainersModel
delegate: Item {
implicitWidth: containers.width
@ -87,6 +87,10 @@ PageBase {
descriptionText: desc_role
buttonImage: "qrc:/images/controls/chevron-right.svg"
onClickedFunc: function() {
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(index))
UiLogic.goToPage(PageEnum.PageSetupWizardProtocolSettings)
}
}
Rectangle {

View file

@ -0,0 +1,74 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "./"
import "../Pages"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
PageBase {
id: root
page: PageEnum.PageSetupWizardInstalling
FlickableType {
id: fl
anchors.top: root.top
anchors.bottom: root.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 16
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 20
buttonImage: "qrc:/images/controls/arrow-left.svg"
headerText: "Ключ для подключения"
descriptionText: "Строка, которая начинается с vpn://..."
}
TextFieldWithHeaderType {
Layout.fillWidth: true
Layout.topMargin: 32
headerText: "Ключ"
textFieldPlaceholderText: "vpn://"
buttonText: "Вставить"
clickedFunc: function() {
textField.text = ""
textField.paste()
}
}
}
}
BasicButtonType {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
anchors.bottomMargin: 32
text: qsTr("Подключиться")
onClicked: function() {
// UiLogic.goToPage(PageEnum.PageSetupWizardInstalling)
}
}
}

View file

@ -12,7 +12,7 @@ import "../Controls2/TextTypes"
PageBase {
id: root
page: PageEnum.Start
page: PageEnum.PageStart
FlickableType {
id: fl
@ -77,7 +77,7 @@ PageBase {
text: qsTr("У меня ничего нет")
onClicked: {
UiLogic.goToPage(PageEnum.Test)
UiLogic.goToPage(PageEnum.PageTest)
}
}
}
@ -129,7 +129,7 @@ PageBase {
buttonImage: "qrc:/images/controls/chevron-right.svg"
onClickedFunc: function() {
UiLogic.goToPage(PageEnum.WizardCredentials)
UiLogic.goToPage(PageEnum.PageSetupWizardCredentials)
drawer.visible = false
}
}
@ -144,9 +144,10 @@ PageBase {
text: "QR-код, ключ или файл настроек"
buttonImage: "qrc:/images/controls/chevron-right.svg"
// onClickedFunc: function() {
// UiLogic.goToPage(PageEnum.Start)
// }
onClickedFunc: function() {
UiLogic.goToPage(PageEnum.PageSetupWizardConfigSource)
drawer.visible = false
}
}
Rectangle {
Layout.fillWidth: true