Skip to content

Commit

Permalink
fix(ui-tests): do not crash on inline components
Browse files Browse the repository at this point in the history
- crashes only on old Qt versions -> have to not use inline components
anywhere in the chain
  • Loading branch information
caybro committed Dec 11, 2024
1 parent 46aecf5 commit efb0078
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 63 deletions.
38 changes: 9 additions & 29 deletions ui/StatusQ/src/StatusQ/Components/StatusDotsLoadingIndicator.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import QtQuick 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls 2.14
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15

import StatusQ.Core.Theme 0.1

import "private"

/*!
\qmltype StatusDotsLoadingIndicator
\inherits Control
Expand Down Expand Up @@ -39,7 +41,7 @@ Control {

/*!
\qmlproperty string StatusDotsLoadingIndicator::duration
This property holds the duration of the animation.
This property holds the duration of the animation in milliseconds
*/
property int duration: 1500

Expand All @@ -59,33 +61,11 @@ Control {

spacing: 2

component DotItem: Rectangle{
id: dotItem

property double maxOpacity

width: root.dotsDiameter
height: width
radius: width / 2
color: root.dotsColor

SequentialAnimation {
id: blinkingAnimation

loops: Animation.Infinite
running: visible
NumberAnimation { target: dotItem; property: "opacity"; to: 0; duration: root.duration;}
NumberAnimation { target: dotItem; property: "opacity"; to: dotItem.maxOpacity; duration: root.duration;}
}

Component.onCompleted: blinkingAnimation.start()
}

contentItem: RowLayout {
spacing: root.spacing

DotItem { id: firstDot; maxOpacity: d.opacity1}
DotItem { id: secondDot; maxOpacity: d.opacity2}
DotItem { id: thirdDot; maxOpacity: d.opacity3}
LoadingDotItem { dotsDiameter: root.dotsDiameter; duration: root.duration; dotsColor: root.dotsColor; maxOpacity: d.opacity1 }
LoadingDotItem { dotsDiameter: root.dotsDiameter; duration: root.duration; dotsColor: root.dotsColor; maxOpacity: d.opacity2 }
LoadingDotItem { dotsDiameter: root.dotsDiameter; duration: root.duration; dotsColor: root.dotsColor; maxOpacity: d.opacity3 }
}
}
28 changes: 28 additions & 0 deletions ui/StatusQ/src/StatusQ/Components/private/LoadingDotItem.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import QtQuick 2.15

import StatusQ.Core.Theme 0.1

Rectangle {
id: root

property double dotsDiameter
property int duration
property double maxOpacity
property color dotsColor

width: root.dotsDiameter
height: width
radius: width / 2
color: root.dotsColor

SequentialAnimation {
id: blinkingAnimation

loops: Animation.Infinite
running: visible
NumberAnimation { target: root; property: "opacity"; to: 0; duration: root.duration }
NumberAnimation { target: root; property: "opacity"; to: root.maxOpacity; duration: root.duration }
}

Component.onCompleted: blinkingAnimation.start()
}
23 changes: 23 additions & 0 deletions ui/app/AppLayouts/Onboarding2/controls/BulletPoint.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15

import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1

RowLayout {
property string text
property bool checked

spacing: 6
StatusIcon {
Layout.preferredWidth: 20
Layout.preferredHeight: 20
icon: parent.checked ? "check-circle" : "close-circle"
color: parent.checked ? Theme.palette.successColor1 : Theme.palette.dangerColor1
}
StatusBaseText {
Layout.fillWidth: true
text: parent.text
font.pixelSize: Theme.additionalTextSize
}
}
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Onboarding2/controls/qmldir
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BulletPoint 1.0 BulletPoint.qml
OnboardingButtonFrame 1.0 OnboardingButtonFrame.qml
OnboardingFrame 1.0 OnboardingFrame.qml
ListItemButton 1.0 ListItemButton.qml
Expand Down
22 changes: 2 additions & 20 deletions ui/app/AppLayouts/Onboarding2/pages/HelpUsImproveStatusPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ OnboardingPage {
spacing: 12
BulletPoint {
text: qsTr("Gather basic usage data, like clicks and page views")
check: true
checked: true
}
BulletPoint {
text: qsTr("Gather core diagnostics, like bandwidth usage")
check: true
checked: true
}
BulletPoint {
text: qsTr("Never collect your profile information or wallet address")
Expand Down Expand Up @@ -149,22 +149,4 @@ OnboardingPage {
}
}
}

component BulletPoint: RowLayout {
property string text
property bool check

spacing: 6
StatusIcon {
Layout.preferredWidth: 20
Layout.preferredHeight: 20
icon: parent.check ? "check-circle" : "close-circle"
color: parent.check ? Theme.palette.successColor1 : Theme.palette.dangerColor1
}
StatusBaseText {
Layout.fillWidth: true
text: parent.text
font.pixelSize: Theme.additionalTextSize
}
}
}
13 changes: 13 additions & 0 deletions ui/imports/shared/views/PasswordComponentIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import QtQuick 2.15

import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1

StatusBaseText {
property bool checked
property string caption

text: "%1 %2".arg(checked ? "" : "+").arg(caption)
font.pixelSize: Theme.tertiaryTextFontSize
color: checked ? Theme.palette.successColor1 : Theme.palette.baseColor1
}
19 changes: 5 additions & 14 deletions ui/imports/shared/views/PasswordView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ColumnLayout {

property int contentAlignment: Qt.AlignHCenter

property var passwordStrengthScoreFunction: function () {}
property var passwordStrengthScoreFunction: (password) => { console.error("passwordStrengthScoreFunction: IMPLEMENT ME") }

readonly property int zBehind: 1
readonly property int zFront: 100
Expand Down Expand Up @@ -354,22 +354,22 @@ ColumnLayout {
spacing: Theme.padding
Layout.alignment: Qt.AlignHCenter

PassIncludesIndicator {
PasswordComponentIndicator {
caption: qsTr("Lower case")
checked: d.lowerCaseValidator(newPswInput.text)
}

PassIncludesIndicator {
PasswordComponentIndicator {
caption: qsTr("Upper case")
checked: d.upperCaseValidator(newPswInput.text)
}

PassIncludesIndicator {
PasswordComponentIndicator {
caption: qsTr("Numbers")
checked: d.numbersValidator(newPswInput.text)
}

PassIncludesIndicator {
PasswordComponentIndicator {
caption: qsTr("Symbols")
checked: d.symbolsValidator(newPswInput.text)
}
Expand All @@ -381,13 +381,4 @@ ColumnLayout {
font.pixelSize: Theme.tertiaryTextFontSize
color: Theme.palette.dangerColor1
}

component PassIncludesIndicator: StatusBaseText {
property bool checked
property string caption

text: "%1 %2".arg(checked ? "" : "+").arg(caption)
font.pixelSize: Theme.tertiaryTextFontSize
color: checked ? Theme.palette.successColor1 : Theme.palette.baseColor1
}
}

0 comments on commit efb0078

Please sign in to comment.