1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-29 23:26:24 +01:00

WizardNav: use PageIndicator in wizardProgress

This commit is contained in:
rating89us 2020-04-22 06:32:55 +02:00 committed by rating89us
parent 6f71d47806
commit 7f9b28c05f
12 changed files with 28 additions and 86 deletions

View File

@ -216,7 +216,6 @@
<file>images/local-node@2x.png</file>
<file>images/local-node-full.png</file>
<file>images/local-node-full@2x.png</file>
<file>wizard/WizardNavProgressDot.qml</file>
<file>wizard/WizardOpenWallet1.qml</file>
<file>images/arrow-right-in-circle.png</file>
<file>images/arrow-right-in-circle@2x.png</file>

View File

@ -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

View File

@ -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: {

View File

@ -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){

View File

@ -66,7 +66,7 @@ Rectangle {
WizardNav {
progressSteps: 4
progress: 3
progress: 2
onPrevClicked: {
wizardStateView.state = "wizardCreateWallet2";
}

View File

@ -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){

View File

@ -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;
}
}

View File

@ -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
}
}

View File

@ -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: {

View File

@ -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";

View File

@ -74,7 +74,7 @@ Rectangle {
WizardNav {
progressSteps: 4
progress: 3
progress: 2
onPrevClicked: {
wizardStateView.state = "wizardRestoreWallet2";
}

View File

@ -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){