feat(GODT-2767): unified colorScheme management. [skip-ci]

This commit is contained in:
Xavier Michelon
2023-08-11 09:52:29 +02:00
parent bb5a91ee6d
commit 7355c7dfd6
11 changed files with 75 additions and 87 deletions

View File

@ -47,11 +47,11 @@ ApplicationWindow {
} }
function showSetup(user, address) { function showSetup(user, address) {
contentLayout.currentIndex = 1; contentLayout.currentIndex = 1;
setupWizard.startClientConfig(user, address) setupWizard.showClientConfig(user, address)
} }
function showSignIn(username) { function showSignIn(username) {
contentLayout.currentIndex = 1; contentLayout.currentIndex = 1;
setupWizard.startLogin(username) setupWizard.showLogin(username)
} }
function showWebViewOverlay(url) { function showWebViewOverlay(url) {
@ -69,12 +69,12 @@ ApplicationWindow {
if (!u) { if (!u) {
console.trace(); console.trace();
console.log("empty user"); console.log("empty user");
setupWizard.start(); setupWizard.showOnboarding();
return; return;
} }
if ((userCount === 1) && (u.state === EUserState.SignedOut)) { if ((userCount === 1) && (u.state === EUserState.SignedOut)) {
setupWizard.startLogin(u.primaryEmailOrUsername()); setupWizard.showLogin(u.primaryEmailOrUsername());
} }
} }

View File

@ -128,7 +128,7 @@ T.Button {
return control.colorScheme.text_norm; return control.colorScheme.text_norm;
} }
} }
colorScheme: root.colorScheme colorScheme: control.colorScheme
elide: Text.ElideRight elide: Text.ElideRight
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
opacity: control.enabled || control.loading ? 1.0 : 0.5 opacity: control.enabled || control.loading ? 1.0 : 0.5

View File

@ -20,7 +20,6 @@ import Proton
Item { Item {
id: root id: root
property ColorScheme colorScheme: wizard.colorScheme
readonly property bool onMacOS: (Backend.goos === "darwin") readonly property bool onMacOS: (Backend.goos === "darwin")
readonly property bool onWindows: (Backend.goos === "windows") readonly property bool onWindows: (Backend.goos === "windows")
property var wizard property var wizard
@ -34,7 +33,7 @@ Item {
Label { Label {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Pick your version of Outlook") text: qsTr("Pick your version of Outlook")
type: Label.LabelType.Heading type: Label.LabelType.Heading
} }
@ -43,7 +42,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-microsoft-outlook.svg" iconSource: "/qml/icons/ic-microsoft-outlook.svg"
text: "Outlook from Microsoft 365" text: "Outlook from Microsoft 365"
@ -54,7 +53,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-microsoft-outlook.svg" iconSource: "/qml/icons/ic-microsoft-outlook.svg"
text: "Outlook 2019" text: "Outlook 2019"
@ -65,7 +64,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-microsoft-outlook.svg" iconSource: "/qml/icons/ic-microsoft-outlook.svg"
text: "Outlook 2016" text: "Outlook 2016"
@ -79,7 +78,7 @@ Item {
} }
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
secondary: true secondary: true
text: qsTr("Cancel") text: qsTr("Cancel")

View File

@ -21,7 +21,6 @@ import ".."
Rectangle { Rectangle {
id: root id: root
property var wizard property var wizard
property ColorScheme colorScheme: wizard.colorScheme
color: colorScheme.background_weak color: colorScheme.background_weak
readonly property bool genericClient: SetupWizard.Client.Generic === wizard.client readonly property bool genericClient: SetupWizard.Client.Generic === wizard.client
@ -42,7 +41,7 @@ Rectangle {
Label { Label {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("Configure %1").arg(wizard.clientName()) text: qsTr("Configure %1").arg(wizard.clientName())
type: Label.LabelType.Heading type: Label.LabelType.Heading
@ -54,7 +53,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 8 Layout.topMargin: 8
color: colorScheme.text_weak color: colorScheme.text_weak
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: genericClient ? qsTr("Here are the IMAP and SMTP configuration parameters for your email client") : text: genericClient ? qsTr("Here are the IMAP and SMTP configuration parameters for your email client") :
qsTr("Here are your email configuration parameters for %1. \nWe have prepared an easy to follow configuration guide to help you setup your account in %1.").arg(wizard.clientName()) qsTr("Here are your email configuration parameters for %1. \nWe have prepared an easy to follow configuration guide to help you setup your account in %1.").arg(wizard.clientName())
@ -70,7 +69,7 @@ Rectangle {
spacing: 64 spacing: 64
Configuration { Configuration {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
hostname: Backend.hostname hostname: Backend.hostname
password: wizard.user ? wizard.user.password : "" password: wizard.user ? wizard.user.password : ""
port: Backend.imapPort.toString() port: Backend.imapPort.toString()
@ -80,7 +79,7 @@ Rectangle {
} }
Configuration { Configuration {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
hostname: Backend.hostname hostname: Backend.hostname
password: wizard.user ? wizard.user.password : "" password: wizard.user ? wizard.user.password : ""
port: Backend.smtpPort.toString() port: Backend.smtpPort.toString()
@ -94,7 +93,7 @@ Rectangle {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 444 Layout.preferredWidth: 444
Layout.topMargin: 32 Layout.topMargin: 32
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Open configuration guide") text: qsTr("Open configuration guide")
visible: !genericClient visible: !genericClient
} }
@ -103,7 +102,7 @@ Rectangle {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: 444 Layout.preferredWidth: 444
Layout.topMargin: 32 Layout.topMargin: 32
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Done") text: qsTr("Done")
onClicked: wizard.closeWizard() onClicked: wizard.closeWizard()
} }
@ -114,7 +113,7 @@ Rectangle {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 48 anchors.bottomMargin: 48
anchors.right: parent.right anchors.right: parent.right
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
text: link("#", qsTr("Report problem")) text: link("#", qsTr("Report problem"))

View File

@ -20,7 +20,6 @@ import Proton
Item { Item {
id: root id: root
property ColorScheme colorScheme: wizard.colorScheme
readonly property bool onMacOS: (Backend.goos === "darwin") readonly property bool onMacOS: (Backend.goos === "darwin")
readonly property bool onWindows: (Backend.goos === "windows") readonly property bool onWindows: (Backend.goos === "windows")
property var wizard property var wizard
@ -34,7 +33,7 @@ Item {
Label { Label {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Select your email application") text: qsTr("Select your email application")
type: Label.LabelType.Heading type: Label.LabelType.Heading
} }
@ -43,7 +42,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-apple-mail.svg" iconSource: "/qml/icons/ic-apple-mail.svg"
text: "Apple Mail" text: "Apple Mail"
visible: root.onMacOS visible: root.onMacOS
@ -54,7 +53,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-microsoft-outlook.svg" iconSource: "/qml/icons/ic-microsoft-outlook.svg"
text: "Microsoft Outlook" text: "Microsoft Outlook"
visible: root.onMacOS || root.onWindows visible: root.onMacOS || root.onWindows
@ -66,7 +65,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-mozilla-thunderbird.svg" iconSource: "/qml/icons/ic-mozilla-thunderbird.svg"
text: "Mozilla Thunderbird" text: "Mozilla Thunderbird"
@ -77,7 +76,7 @@ Item {
} }
ClientListItem { ClientListItem {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
iconSource: "/qml/icons/ic-other-mail-clients.svg" iconSource: "/qml/icons/ic-other-mail-clients.svg"
text: "Other" text: "Other"
@ -91,7 +90,7 @@ Item {
} }
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
secondary: true secondary: true
text: qsTr("Cancel") text: qsTr("Cancel")

View File

@ -39,7 +39,6 @@ import Proton
Item { Item {
id: root id: root
property ColorScheme colorScheme: wizard.colorScheme
property var wizard property var wizard
ColumnLayout { ColumnLayout {
@ -50,7 +49,7 @@ Item {
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("A word of warning") text: qsTr("A word of warning")
type: Label.LabelType.Heading type: Label.LabelType.Heading
@ -63,7 +62,7 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Do not enter your Proton account password in you email application.") text: qsTr("Do not enter your Proton account password in you email application.")
type: Label.LabelType.Body type: Label.LabelType.Body
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@ -74,7 +73,7 @@ Item {
Label { Label {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("We have generated a new password for you. It will work only on this computer, and can safely be entered in your email client.") text: qsTr("We have generated a new password for you. It will work only on this computer, and can safely be entered in your email client.")
type: Label.LabelType.Body type: Label.LabelType.Body
@ -85,7 +84,7 @@ Item {
} }
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("I understand") text: qsTr("I understand")
onClicked: { onClicked: {
@ -97,7 +96,7 @@ Item {
} }
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
secondary: true secondary: true
text: qsTr("Cancel") text: qsTr("Cancel")

View File

@ -21,7 +21,6 @@ import ".."
Item { Item {
id: root id: root
property var wizard property var wizard
property ColorScheme colorScheme
function showClientSelector() { function showClientSelector() {
titleLabel.text = qsTr("Configure your email client"); titleLabel.text = qsTr("Configure your email client");
@ -71,7 +70,7 @@ Item {
} }
function showLoginMailboxPassword() { function showLoginMailboxPassword() {
root.description = qsTr("You have secured your account with a separate mailbox password."); descriptionLabel.text = qsTr("You have secured your account with a separate mailbox password.");
linkLabel1.clear(); linkLabel1.clear();
linkLabel2.clear(); linkLabel2.clear();
showLoginCommon(); showLoginCommon();
@ -127,7 +126,7 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: "" text: ""
type: Label.LabelType.Heading type: Label.LabelType.Heading
@ -138,7 +137,7 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 96 Layout.topMargin: 96
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: "" text: ""
type: Label.LabelType.Body type: Label.LabelType.Body
@ -148,14 +147,14 @@ Item {
id: linkLabel1 id: linkLabel1
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 96 Layout.topMargin: 96
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
visible: (text !== "") visible: (text !== "")
} }
LinkLabel { LinkLabel {
id: linkLabel2 id: linkLabel2
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 16 Layout.topMargin: 16
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
visible: (text !== "") visible: (text !== "")
} }
} }

View File

@ -20,7 +20,7 @@ import Proton
FocusScope { FocusScope {
id: root id: root
property ColorScheme colorScheme property var wizard
property alias currentIndex: stackLayout.currentIndex property alias currentIndex: stackLayout.currentIndex
property alias username: usernameTextField.text property alias username: usernameTextField.text
@ -141,7 +141,7 @@ FocusScope {
Label { Label {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Sign in") text: qsTr("Sign in")
type: Label.LabelType.Heading type: Label.LabelType.Heading
} }
@ -149,8 +149,8 @@ FocusScope {
id: subTitle id: subTitle
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 8 Layout.topMargin: 8
color: root.colorScheme.text_weak color: wizard.colorScheme.text_weak
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Enter your Proton Account details.") text: qsTr("Enter your Proton Account details.")
type: Label.LabelType.Lead type: Label.LabelType.Lead
} }
@ -161,7 +161,7 @@ FocusScope {
visible: errorLabel.text.length > 0 visible: errorLabel.text.length > 0
ColorImage { ColorImage {
color: root.colorScheme.signal_danger color: wizard.colorScheme.signal_danger
height: errorLabel.lineHeight height: errorLabel.lineHeight
source: "/qml/icons/ic-exclamation-circle-filled.svg" source: "/qml/icons/ic-exclamation-circle-filled.svg"
sourceSize.height: errorLabel.lineHeight sourceSize.height: errorLabel.lineHeight
@ -170,8 +170,8 @@ FocusScope {
id: errorLabel id: errorLabel
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 4 Layout.leftMargin: 4
color: root.colorScheme.signal_danger color: wizard.colorScheme.signal_danger
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
type: root.error ? Label.LabelType.Caption_semibold : Label.LabelType.Caption type: root.error ? Label.LabelType.Caption_semibold : Label.LabelType.Caption
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
@ -180,7 +180,7 @@ FocusScope {
id: usernameTextField id: usernameTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 48 Layout.topMargin: 48
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
focus: true focus: true
label: qsTr("Email or username") label: qsTr("Email or username")
validateOnEditingFinished: false validateOnEditingFinished: false
@ -204,7 +204,7 @@ FocusScope {
id: passwordTextField id: passwordTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 48 Layout.topMargin: 48
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
echoMode: TextInput.Password echoMode: TextInput.Password
label: qsTr("Password") label: qsTr("Password")
validateOnEditingFinished: false validateOnEditingFinished: false
@ -240,7 +240,7 @@ FocusScope {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 48 Layout.topMargin: 48
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
enabled: !loading enabled: !loading
text: loading ? qsTr("Signing in") : qsTr("Sign in") text: loading ? qsTr("Signing in") : qsTr("Sign in")
@ -251,7 +251,7 @@ FocusScope {
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
enabled: !signInButton.loading enabled: !signInButton.loading
secondary: true secondary: true
text: qsTr("Cancel") text: qsTr("Cancel")
@ -275,7 +275,7 @@ FocusScope {
Label { Label {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Two-factor authentication") text: qsTr("Two-factor authentication")
type: Label.LabelType.Heading type: Label.LabelType.Heading
} }
@ -283,8 +283,8 @@ FocusScope {
id: twoFactorUsernameLabel id: twoFactorUsernameLabel
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.topMargin: 8 Layout.topMargin: 8
color: root.colorScheme.text_weak color: wizard.colorScheme.text_weak
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
type: Label.LabelType.Lead type: Label.LabelType.Lead
} }
TextField { TextField {
@ -292,7 +292,7 @@ FocusScope {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
assistiveText: qsTr("Enter the 6-digit code") assistiveText: qsTr("Enter the 6-digit code")
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
label: qsTr("Two-factor code") label: qsTr("Two-factor code")
validateOnEditingFinished: false validateOnEditingFinished: false
validator: function (str) { validator: function (str) {
@ -314,7 +314,7 @@ FocusScope {
id: twoFAButton id: twoFAButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 48 Layout.topMargin: 48
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
enabled: !loading enabled: !loading
text: loading ? qsTr("Authenticating") : qsTr("Authenticate") text: loading ? qsTr("Authenticating") : qsTr("Authenticate")
@ -331,7 +331,7 @@ FocusScope {
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
enabled: !twoFAButton.loading enabled: !twoFAButton.loading
secondary: true secondary: true
text: qsTr("Cancel") text: qsTr("Cancel")
@ -355,22 +355,22 @@ FocusScope {
Label { Label {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Unlock your mailbox") text: qsTr("Unlock your mailbox")
type: Label.LabelType.Heading type: Label.LabelType.Heading
} }
Label { Label {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.topMargin: 8 Layout.topMargin: 8
color: root.colorScheme.text_weak color: wizard.colorScheme.text_weak
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
type: Label.LabelType.Lead type: Label.LabelType.Lead
} }
TextField { TextField {
id: secondPasswordTextField id: secondPasswordTextField
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 48 Layout.topMargin: 48
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
echoMode: TextInput.Password echoMode: TextInput.Password
label: qsTr("Mailbox password") label: qsTr("Mailbox password")
validateOnEditingFinished: false validateOnEditingFinished: false
@ -388,7 +388,7 @@ FocusScope {
id: secondPasswordButton id: secondPasswordButton
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 48 Layout.topMargin: 48
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
enabled: !loading enabled: !loading
text: loading ? qsTr("Unlocking") : qsTr("Unlock") text: loading ? qsTr("Unlocking") : qsTr("Unlock")
@ -405,7 +405,7 @@ FocusScope {
Button { Button {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 32 Layout.topMargin: 32
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
enabled: !secondPasswordButton.loading enabled: !secondPasswordButton.loading
secondary: true secondary: true
text: qsTr("Cancel") text: qsTr("Cancel")

View File

@ -19,10 +19,7 @@ import "." as Proton
Item { Item {
id: root id: root
property var wizard
property ColorScheme colorScheme
signal onboardingAccepted
ColumnLayout { ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
@ -33,20 +30,20 @@ Item {
Label { Label {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("Two-step process") text: qsTr("Two-step process")
type: Label.LabelType.Heading type: Label.LabelType.Heading
} }
StepDescriptionBox { StepDescriptionBox {
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
description: qsTr("Connect Bridge to your Proton account") description: qsTr("Connect Bridge to your Proton account")
icon: "/qml/icons/ic-bridge.svg" icon: "/qml/icons/ic-bridge.svg"
iconSize: 48 iconSize: 48
title: qsTr("Step 1") title: qsTr("Step 1")
} }
StepDescriptionBox { StepDescriptionBox {
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
description: qsTr("Connect your email client to Bridge") description: qsTr("Connect your email client to Bridge")
icon: "/qml/icons/img-mail-clients.svg" icon: "/qml/icons/img-mail-clients.svg"
iconSize: 64 iconSize: 64
@ -55,10 +52,10 @@ Item {
Button { Button {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme colorScheme: wizard.colorScheme
text: qsTr("Let's start") text: qsTr("Let's start")
onClicked: root.onboardingAccepted(); onClicked: wizard.showLogin();
} }
} }
} }

View File

@ -91,13 +91,13 @@ Item {
rightContent.currentIndex = SetupWizard.ContentStack.ClientConfigOutlookSelector; rightContent.currentIndex = SetupWizard.ContentStack.ClientConfigOutlookSelector;
} }
function start() { function showOnboarding() {
rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView; rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView;
leftContent.showOnboarding(); leftContent.showOnboarding();
rightContent.currentIndex = SetupWizard.ContentStack.Onboarding; rightContent.currentIndex = SetupWizard.ContentStack.Onboarding;
} }
function startClientConfig(user, address) { function showClientConfig(user, address) {
root.user = user root.user = user
root.address = address root.address = address
rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView; rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView;
@ -105,7 +105,7 @@ Item {
rightContent.currentIndex = SetupWizard.ContentStack.ClientConfigSelector; rightContent.currentIndex = SetupWizard.ContentStack.ClientConfigSelector;
} }
function startLogin(username = "") { function showLogin(username = "") {
rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView; rootStackLayout.currentIndex = SetupWizard.RootStack.TwoPanesView;
root.address = ""; root.address = "";
leftContent.showLogin(); leftContent.showLogin();
@ -133,7 +133,7 @@ Item {
} }
let user = Backend.users.get(userIndex) let user = Backend.users.get(userIndex)
let address = user ? user.addresses[0] : "" let address = user ? user.addresses[0] : ""
startClientConfig(user, address); showClientConfig(user, address);
} }
target: Backend target: Backend
@ -143,7 +143,7 @@ Item {
id: rootStackLayout id: rootStackLayout
anchors.fill: parent anchors.fill: parent
// rootStackLayout index 0 SetupWizard.RootStack.TwoPanesView // rootStackLayout index 0
RowLayout { RowLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
@ -164,7 +164,6 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 96 anchors.topMargin: 96
clip: true clip: true
colorScheme: root.colorScheme
width: 444 width: 444
wizard: root wizard: root
} }
@ -196,42 +195,40 @@ Item {
currentIndex: 0 currentIndex: 0
width: 444 width: 444
// stack index 0 // rightContent stack index 0
Onboarding { Onboarding {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme wizard: root
onOnboardingAccepted: root.startLogin()
} }
// stack index 1 // rightContent tack index 1
Login { Login {
id: login id: login
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
colorScheme: root.colorScheme wizard: root
onLoginAbort: { onLoginAbort: {
root.closeWizard(); root.closeWizard();
} }
} }
// stack index 2 // rightContent stack index 2
ClientConfigSelector { ClientConfigSelector {
id: clientConfigSelector id: clientConfigSelector
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
wizard: root wizard: root
} }
// stack index 3 // rightContent stack index 3
ClientConfigOutlookSelector { ClientConfigOutlookSelector {
id: clientConfigOutlookSelector id: clientConfigOutlookSelector
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
wizard: root wizard: root
} }
// stack index 4 // rightContent stack index 4
ClientConfigWarning { ClientConfigWarning {
id: clientConfigWarning id: clientConfigWarning
Layout.fillHeight: true Layout.fillHeight: true
@ -257,7 +254,7 @@ Item {
} }
} }
// rootStackLayout index 1 SetupWizard.RootStack.ClientConfigParameters // rootStackLayout index 1
ClientConfigParameters { ClientConfigParameters {
id: clientConfigParameters id: clientConfigParameters
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -37,7 +37,6 @@ Item {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.preferredHeight: iconSize Layout.preferredHeight: iconSize
Layout.preferredWidth: iconSize Layout.preferredWidth: iconSize
antialiasing: true
mipmap: true mipmap: true
source: root.icon source: root.icon
} }