diff --git a/qml.qrc b/qml.qrc index 28597b8d..404de207 100644 --- a/qml.qrc +++ b/qml.qrc @@ -216,7 +216,6 @@ images/local-node@2x.png images/local-node-full.png images/local-node-full@2x.png - wizard/WizardNavProgressDot.qml wizard/WizardOpenWallet1.qml images/arrow-right-in-circle.png images/arrow-right-in-circle@2x.png diff --git a/wizard/WizardCreateDevice1.qml b/wizard/WizardCreateDevice1.qml index 1280ff6a..4cc6640a 100644 --- a/wizard/WizardCreateDevice1.qml +++ b/wizard/WizardCreateDevice1.qml @@ -174,8 +174,8 @@ Rectangle { } WizardNav { - progressSteps: 4 - progress: 1 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: 0 btnNext.enabled: walletInput.verify() && wizardCreateDevice1.deviceName; btnPrev.text: qsTr("Back to menu") + translationManager.emptyString btnNext.text: qsTr("Create wallet") + translationManager.emptyString diff --git a/wizard/WizardCreateWallet1.qml b/wizard/WizardCreateWallet1.qml index 3e84ce17..2e2aff68 100644 --- a/wizard/WizardCreateWallet1.qml +++ b/wizard/WizardCreateWallet1.qml @@ -189,8 +189,8 @@ Rectangle { } WizardNav { - progressSteps: 4 - progress: 1 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: 0 btnNext.enabled: walletInput.verify(); btnPrev.text: qsTr("Back to menu") + translationManager.emptyString onPrevClicked: { diff --git a/wizard/WizardCreateWallet2.qml b/wizard/WizardCreateWallet2.qml index 9df4680a..c2e6736b 100644 --- a/wizard/WizardCreateWallet2.qml +++ b/wizard/WizardCreateWallet2.qml @@ -60,8 +60,8 @@ Rectangle { } WizardNav { - progressSteps: 4 - progress: 2 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: 1 btnNext.enabled: passwordFields.calcStrengthAndVerify(); onPrevClicked: { if(wizardController.walletOptionsIsRecoveringFromDevice){ diff --git a/wizard/WizardCreateWallet3.qml b/wizard/WizardCreateWallet3.qml index 0ef3f1ce..8bc3e048 100644 --- a/wizard/WizardCreateWallet3.qml +++ b/wizard/WizardCreateWallet3.qml @@ -66,7 +66,7 @@ Rectangle { WizardNav { progressSteps: 4 - progress: 3 + progress: 2 onPrevClicked: { wizardStateView.state = "wizardCreateWallet2"; } diff --git a/wizard/WizardCreateWallet4.qml b/wizard/WizardCreateWallet4.qml index 2fa410fe..df05de85 100644 --- a/wizard/WizardCreateWallet4.qml +++ b/wizard/WizardCreateWallet4.qml @@ -66,8 +66,8 @@ Rectangle { WizardNav { Layout.topMargin: 24 btnNextText: qsTr("Create wallet") + translationManager.emptyString - progressSteps: 4 - progress: 4 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: appWindow.walletMode <= 1 ? 2 : 3 onPrevClicked: { if (appWindow.walletMode <= 1){ diff --git a/wizard/WizardNav.qml b/wizard/WizardNav.qml index be363fc7..59dba888 100644 --- a/wizard/WizardNav.qml +++ b/wizard/WizardNav.qml @@ -33,7 +33,7 @@ import QtQuick.Controls 2.0 import "../js/Wizard.js" as Wizard import "../components" as MoneroComponents -GridLayout { +RowLayout { id: menuNav property alias progressEnabled: wizardProgress.visible property int progressSteps: 0 @@ -46,7 +46,6 @@ GridLayout { Layout.topMargin: 20 Layout.preferredHeight: 70 Layout.preferredWidth: parent.width - columns: 3 signal nextClicked; signal prevClicked; @@ -65,7 +64,6 @@ GridLayout { Rectangle { Layout.preferredHeight: parent.height - Layout.fillWidth: true color: "transparent" MoneroComponents.StandardButton { @@ -89,19 +87,25 @@ GridLayout { Layout.fillWidth: true color: "transparent" - RowLayout { + PageIndicator { id: wizardProgress - spacing: 0 - width: 100 // default, dynamically set later - height: 30 + currentIndex: menuNav.progress + count: menuNav.progressSteps anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter + spacing: 25 + delegate: Rectangle { + implicitWidth: 10 + implicitHeight: 10 + radius: 10 + // @TODO: Qt 5.10+ replace === with <= + color: index === menuNav.progress ? MoneroComponents.Style.defaultFontColor : MoneroComponents.Style.progressBarBackgroundColor + } } } Rectangle { Layout.preferredHeight: parent.height - Layout.fillWidth: true color: "transparent" MoneroComponents.StandardButton { @@ -118,14 +122,4 @@ GridLayout { } } } - - Component.onCompleted: { - for(var i =0; i < menuNav.progressSteps; i++) { - var active = i < menuNav.progress ? 'true' : 'false'; - Qt.createQmlObject("WizardNavProgressDot { active: " + active + " }", wizardProgress, 'dynamicWizardNavDot'); - } - - // Set `wizardProgress` width based on amount of progress dots - wizardProgress.width = 30 * menuNav.progressSteps; - } } diff --git a/wizard/WizardNavProgressDot.qml b/wizard/WizardNavProgressDot.qml deleted file mode 100644 index 1a2c4da2..00000000 --- a/wizard/WizardNavProgressDot.qml +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014-2019, The Monero Project -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are -// permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list -// of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import QtQuick 2.9 -import QtQuick.Layouts 1.2 -import QtQuick.Controls 2.0 - -import "../components" as MoneroComponents - -Rectangle { - property bool active: false - Layout.preferredWidth: 30 - Layout.fillHeight: true - property string activeColor: MoneroComponents.Style.defaultFontColor - property string inactiveColor: MoneroComponents.Style.progressBarBackgroundColor - color: "transparent" - - Rectangle { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - width: 10 - height: 10 - radius: 10 - color: parent.active ? parent.activeColor : parent.inactiveColor - } -} diff --git a/wizard/WizardRestoreWallet1.qml b/wizard/WizardRestoreWallet1.qml index b698aa5d..c1514cb3 100644 --- a/wizard/WizardRestoreWallet1.qml +++ b/wizard/WizardRestoreWallet1.qml @@ -294,8 +294,8 @@ Rectangle { WizardNav { id: nav - progressSteps: 4 - progress: 1 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: 0 btnNext.enabled: wizardRestoreWallet1.verify(); btnPrev.text: qsTr("Back to menu") + translationManager.emptyString onPrevClicked: { diff --git a/wizard/WizardRestoreWallet2.qml b/wizard/WizardRestoreWallet2.qml index 8e270984..78670df3 100644 --- a/wizard/WizardRestoreWallet2.qml +++ b/wizard/WizardRestoreWallet2.qml @@ -63,8 +63,8 @@ Rectangle { } WizardNav { - progressSteps: 4 - progress: 2 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: 1 btnNext.enabled: passwordFields.calcStrengthAndVerify(); onPrevClicked: { wizardStateView.state = "wizardRestoreWallet1"; diff --git a/wizard/WizardRestoreWallet3.qml b/wizard/WizardRestoreWallet3.qml index 73874f4f..9fc98358 100644 --- a/wizard/WizardRestoreWallet3.qml +++ b/wizard/WizardRestoreWallet3.qml @@ -74,7 +74,7 @@ Rectangle { WizardNav { progressSteps: 4 - progress: 3 + progress: 2 onPrevClicked: { wizardStateView.state = "wizardRestoreWallet2"; } diff --git a/wizard/WizardRestoreWallet4.qml b/wizard/WizardRestoreWallet4.qml index f4a0456c..152c2bd9 100644 --- a/wizard/WizardRestoreWallet4.qml +++ b/wizard/WizardRestoreWallet4.qml @@ -66,8 +66,8 @@ Rectangle { WizardNav { Layout.topMargin: 24 btnNextText: "Open wallet" - progressSteps: 4 - progress: 4 + progressSteps: appWindow.walletMode <= 1 ? 3 : 4 + progress: appWindow.walletMode <= 1 ? 2 : 3 onPrevClicked: { if (appWindow.walletMode <= 1){