fix: unbreak ModuleWarning banners

they stopped appearing after the introduction of `localAppSettings.testEnvironment`
This commit is contained in:
Lukáš Tinkl 2023-01-30 11:42:26 +01:00 committed by Jonathan Rainville
parent 20733272f2
commit fbd936d151
2 changed files with 10 additions and 25 deletions

View File

@ -111,7 +111,7 @@ Item {
{ {
newVersionAvailable: available, newVersionAvailable: available,
downloadURL: url, downloadURL: url,
currentVersion: rootStore.profileSectionStore.getCurrentVersion(), currentVersion: appMain.rootStore.profileSectionStore.getCurrentVersion(),
newVersion: version newVersion: version
}) })
return downloadPage return downloadPage
@ -566,6 +566,9 @@ Item {
ColumnLayout { ColumnLayout {
id: bannersLayout id: bannersLayout
enabled: !localAppSettings.testEnvironment
visible: enabled
property var updateBanner: null property var updateBanner: null
property var connectedBanner: null property var connectedBanner: null
readonly property bool isConnected: appMain.rootStore.mainModuleInst.isOnline readonly property bool isConnected: appMain.rootStore.mainModuleInst.isOnline
@ -762,11 +765,9 @@ Item {
onCloseClicked: { onCloseClicked: {
hide(); hide();
} }
onHideStarted: {
bannersLayout.connectedBanner = null
}
onHideFinished: { onHideFinished: {
destroy() destroy()
bannersLayout.connectedBanner = null
} }
} }
} }
@ -813,11 +814,9 @@ Item {
appMain.rootStore.resetLastVersion(); appMain.rootStore.resetLastVersion();
hide() hide()
} }
onHideStarted: {
bannersLayout.updateBanner = null
}
onHideFinished: { onHideFinished: {
destroy() destroy()
bannersLayout.updateBanner = null
} }
} }
} }

View File

@ -17,7 +17,7 @@ Item {
Success Success
} }
property bool active: false property bool active
property int type: ModuleWarning.Danger property int type: ModuleWarning.Danger
property int progressValue: -1 // 0..100, -1 not visible property int progressValue: -1 // 0..100, -1 not visible
property string text: "" property string text: ""
@ -31,18 +31,9 @@ Item {
signal hideStarted() signal hideStarted()
signal hideFinished() signal hideFinished()
QtObject {
id: d
property bool active: false
}
function show() { function show() {
if (localAppSettings.testEnvironment) {
// Never show the banner while in a test enviornment
return
}
hideTimer.stop() hideTimer.stop()
d.active = true; active = true;
} }
function showFor(duration = 5000) { function showFor(duration = 5000) {
@ -61,15 +52,10 @@ Item {
signal linkActivated(string link) signal linkActivated(string link)
implicitHeight: d.active ? content.implicitHeight : 0 implicitHeight: active ? content.implicitHeight : 0
visible: implicitHeight > 0 visible: implicitHeight > 0
onActiveChanged: { onActiveChanged: {
if (localAppSettings.testEnvironment) {
// Never show the banner while in a test enviornment
return
}
d.active = active
active ? showAnimation.start() : hideAnimation.start() active ? showAnimation.start() : hideAnimation.start()
} }
@ -110,7 +96,7 @@ Item {
repeat: false repeat: false
running: false running: false
onTriggered: { onTriggered: {
d.active = false root.active = false
} }
} }