qml: Relayout buttons for [3,1,1,1]

This change adjusts the layout for the progress bar, write button and
cancellation buttons such that they are all placed on the same layout
'row', with the progress bar stacked as before, and the
write/cancel/cancel buttons stacked as a column.

This is not ideal, but probably as sensible as we can get inside this
layout paradigm.
This commit is contained in:
Tom Dewey tom.dewey@raspberrypi.com 2023-10-10 14:03:20 +01:00
parent bcdee1818d
commit e8663baf34
3 changed files with 49 additions and 37 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -69,23 +69,24 @@ ApplicationWindow {
spacing: 0 spacing: 0
Rectangle { Rectangle {
implicitHeight: window.height/2 implicitHeight: window.height/3
Image { Image {
id: image id: image
Layout.fillWidth: true //Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "icons/logo_stacked_imager.png" source: "icons/logo_sxs_imager.png"
width: window.width width: window.width
height: window.height/2 height: window.height/3
} }
} }
Rectangle { Rectangle {
color: "#c31c4a" color: "#c31c4a"
implicitWidth: window.width implicitWidth: window.width
implicitHeight: window.height/2 implicitHeight: (window.height/3) * 2
GridLayout { GridLayout {
id: gridLayout id: gridLayout
@ -215,41 +216,11 @@ ApplicationWindow {
} }
ColumnLayout { ColumnLayout {
id: columnLayoutProgress
spacing: 0 spacing: 0
Layout.row: 1 Layout.row: 1
Layout.column: 2
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
ImButton {
id: writebutton
text: qsTr("WRITE")
Layout.bottomMargin: 25
Layout.minimumHeight: 40
Layout.fillWidth: true
Accessible.ignored: ospopup.visible || dstpopup.visible || hwpopup.visible
Accessible.description: qsTr("Select this button to start writing the image")
enabled: false
onClicked: {
if (!imageWriter.readyToWrite()) {
return
}
if (!optionspopup.initialized && imageWriter.imageSupportsCustomization() && imageWriter.hasSavedCustomizationSettings()) {
usesavedsettingspopup.openPopup()
} else {
confirmwritepopup.askForConfirmation()
}
}
}
}
ColumnLayout {
id: columnLayout3
Layout.columnSpan: 2
Layout.row: 1
Layout.column: 0 Layout.column: 0
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.columnSpan: 2
Text { Text {
id: progressText id: progressText
@ -272,9 +243,19 @@ ApplicationWindow {
visible: false visible: false
Material.background: "#d15d7d" Material.background: "#d15d7d"
} }
}
ColumnLayout {
id: columnLayout3
Layout.row: 1
Layout.column: 2
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
spacing: 0
ImButton { ImButton {
Layout.bottomMargin: 25 Layout.bottomMargin: 25
Layout.minimumHeight: 40
Layout.preferredWidth: 200
padding: 5 padding: 5
id: cancelwritebutton id: cancelwritebutton
text: qsTr("CANCEL WRITE") text: qsTr("CANCEL WRITE")
@ -288,6 +269,8 @@ ApplicationWindow {
} }
ImButton { ImButton {
Layout.bottomMargin: 25 Layout.bottomMargin: 25
Layout.minimumHeight: 40
Layout.preferredWidth: 200
padding: 5 padding: 5
id: cancelverifybutton id: cancelverifybutton
text: qsTr("CANCEL VERIFY") text: qsTr("CANCEL VERIFY")
@ -302,6 +285,9 @@ ApplicationWindow {
ImButton { ImButton {
Layout.bottomMargin: 25 Layout.bottomMargin: 25
Layout.minimumHeight: 40
Layout.preferredWidth: 200
Layout.alignment: Qt.AlignRight
padding: 5 padding: 5
id: customizebutton id: customizebutton
onClicked: { onClicked: {
@ -314,6 +300,28 @@ ApplicationWindow {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
} }
ImButton {
id: writebutton
text: qsTr("WRITE")
Layout.bottomMargin: 25
Layout.minimumHeight: 40
Layout.preferredWidth: 200
Layout.alignment: Qt.AlignRight
Accessible.ignored: ospopup.visible || dstpopup.visible || hwpopup.visible
Accessible.description: qsTr("Select this button to start writing the image")
enabled: false
onClicked: {
if (!imageWriter.readyToWrite()) {
return
}
if (!optionspopup.initialized && imageWriter.imageSupportsCustomization() && imageWriter.hasSavedCustomizationSettings()) {
usesavedsettingspopup.openPopup()
} else {
confirmwritepopup.askForConfirmation()
}
}
}
} }
Text { Text {
@ -1126,6 +1134,7 @@ ApplicationWindow {
title: qsTr("Warning") title: qsTr("Warning")
onYes: { onYes: {
langbarRect.visible = false langbarRect.visible = false
writebutton.visible = false
writebutton.enabled = false writebutton.enabled = false
customizebutton.visible = false customizebutton.visible = false
cancelwritebutton.enabled = true cancelwritebutton.enabled = true
@ -1138,6 +1147,7 @@ ApplicationWindow {
progressBar.Material.accent = "#ffffff" progressBar.Material.accent = "#ffffff"
osbutton.enabled = false osbutton.enabled = false
dstbutton.enabled = false dstbutton.enabled = false
hwbutton.enabled = false
imageWriter.setVerifyEnabled(true) imageWriter.setVerifyEnabled(true)
imageWriter.startWrite() imageWriter.startWrite()
} }
@ -1259,6 +1269,7 @@ ApplicationWindow {
customizebutton.visible = imageWriter.imageSupportsCustomization() customizebutton.visible = imageWriter.imageSupportsCustomization()
osbutton.enabled = true osbutton.enabled = true
dstbutton.enabled = true dstbutton.enabled = true
hwbutton.enabled = true
writebutton.visible = true writebutton.visible = true
writebutton.enabled = imageWriter.readyToWrite() writebutton.enabled = imageWriter.readyToWrite()
cancelwritebutton.visible = false cancelwritebutton.visible = false

View file

@ -32,6 +32,7 @@
<file>icons/cat_language_specific_operating_systems.png</file> <file>icons/cat_language_specific_operating_systems.png</file>
<file>icons/cat_3d_printing.png</file> <file>icons/cat_3d_printing.png</file>
<file>icons/logo_stacked_imager.png</file> <file>icons/logo_stacked_imager.png</file>
<file>icons/logo_sxs_imager.png</file>
<file>qmlcomponents/ImButton.qml</file> <file>qmlcomponents/ImButton.qml</file>
<file>qmlcomponents/ImCheckBox.qml</file> <file>qmlcomponents/ImCheckBox.qml</file>
<file>qmlcomponents/ImRadioButton.qml</file> <file>qmlcomponents/ImRadioButton.qml</file>