Merge pull request #2845

7f9b28c WizardNav: use PageIndicator in wizardProgress (rating89us)
This commit is contained in:
luigi1111 2020-05-01 15:51:48 -05:00
commit ce6cc47afe
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
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){