qml: main: Qt6 fixes, formatting

This commit is contained in:
Tom Dewey 2024-07-17 11:07:54 +01:00 committed by Tom Dewey
parent 094142ae8e
commit 3d56ecf88c

View file

@ -442,22 +442,27 @@ ApplicationWindow {
// background of title // background of title
Rectangle { Rectangle {
id: hwpopup_title_background
color: "#f5f5f5" color: "#f5f5f5"
anchors.right: parent.right anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
height: 35 height: 35
width: parent.width width: parent.width
}
// line under title Text {
Rectangle { text: qsTr("Raspberry Pi Device")
color: "#afafaf" horizontalAlignment: Text.AlignHCenter
width: parent.width anchors.fill: parent
y: 35 anchors.topMargin: 10
implicitHeight: 1 font.family: roboto.name
font.bold: true
} }
Text { Text {
text: "X" text: "X"
Layout.alignment: Qt.AlignRight
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: 25 anchors.rightMargin: 25
@ -473,27 +478,19 @@ ApplicationWindow {
} }
} }
} }
ColumnLayout {
spacing: 10
Text {
text: qsTr("Raspberry Pi Device")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
Layout.topMargin: 10
font.family: roboto.name
font.bold: true
} }
// line under title
Item { Rectangle {
clip: true id: hwpopup_title_separator
Layout.preferredWidth: hwlist.width color: "#afafaf"
Layout.preferredHeight: hwlist.height width: parent.width
anchors.top: hwpopup_title_background.bottom
height: 1
}
ListView { ListView {
id: hwlist id: hwlist
clip: true
model: ListModel { model: ListModel {
id: deviceModel id: deviceModel
ListElement { ListElement {
@ -506,11 +503,14 @@ ApplicationWindow {
} }
currentIndex: -1 currentIndex: -1
delegate: hwdelegate delegate: hwdelegate
width: window.width-100 anchors.top: hwpopup_title_separator.bottom
height: window.height-100 anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
highlight: Rectangle { color: "lightsteelblue"; radius: 5 } highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
anchors.right: parent.right
width: 10 width: 10
policy: hwlist.contentHeight > hwlist.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded policy: hwlist.contentHeight > hwlist.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
} }
@ -526,8 +526,6 @@ ApplicationWindow {
Keys.onReturnPressed: Keys.onSpacePressed(event) Keys.onReturnPressed: Keys.onSpacePressed(event)
} }
} }
}
}
/* /*
Popup for OS selection Popup for OS selection
@ -544,22 +542,27 @@ ApplicationWindow {
// background of title // background of title
Rectangle { Rectangle {
id: ospopup_title_background
color: "#f5f5f5" color: "#f5f5f5"
anchors.right: parent.right anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
height: 35 height: 35
width: parent.width width: parent.width
}
// line under title Text {
Rectangle { text: qsTr("Operating System")
color: "#afafaf" horizontalAlignment: Text.AlignHCenter
width: parent.width anchors.fill: parent
y: 35 anchors.topMargin: 10
implicitHeight: 1 font.family: roboto.name
font.bold: true
} }
Text { Text {
text: "X" text: "X"
Layout.alignment: Qt.AlignRight
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: 25 anchors.rightMargin: 25
@ -576,39 +579,38 @@ ApplicationWindow {
} }
} }
} }
}
ColumnLayout { // line under title
spacing: 10 Rectangle {
id: ospopup_title_separator
Text { color: "#afafaf"
text: qsTr("Operating System") width: parent.width
horizontalAlignment: Text.AlignHCenter anchors.top: ospopup_title_background.bottom
verticalAlignment: Text.AlignVCenter height: 1
Layout.fillWidth: true
Layout.topMargin: 10
font.family: roboto.name
font.bold: true
} }
Item {
clip: true
Layout.preferredWidth: oslist.width
Layout.preferredHeight: oslist.height
SwipeView { SwipeView {
anchors.top: ospopup_title_separator.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
id: osswipeview id: osswipeview
interactive: false interactive: false
clip: true
ListView { ListView {
id: oslist id: oslist
model: osmodel model: osmodel
currentIndex: -1 currentIndex: -1
delegate: osdelegate delegate: osdelegate
width: window.width-100 anchors.top: parent.top
height: window.height-100 anchors.left: parent.left
anchors.bottom: parent.bottom
width: ospopup.width
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
highlight: Rectangle { color: "lightsteelblue"; radius: 5 } highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
anchors.right: parent.right
width: 10 width: 10
policy: oslist.contentHeight > oslist.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded policy: oslist.contentHeight > oslist.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
} }
@ -630,8 +632,6 @@ ApplicationWindow {
} }
} }
} }
}
}
Component { Component {
id: suboslist id: suboslist
@ -658,8 +658,7 @@ ApplicationWindow {
currentIndex: -1 currentIndex: -1
delegate: osdelegate delegate: osdelegate
width: window.width-100
height: window.height-100
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
highlight: Rectangle { color: "lightsteelblue"; radius: 5 } highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@ -940,22 +939,27 @@ ApplicationWindow {
// background of title // background of title
Rectangle { Rectangle {
id: dstpopup_title_background
color: "#f5f5f5" color: "#f5f5f5"
anchors.right: parent.right anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
height: 35 height: 35
width: parent.width width: parent.width
}
// line under title Text {
Rectangle { text: qsTr("Storage")
color: "#afafaf" horizontalAlignment: Text.AlignHCenter
width: parent.width anchors.fill: parent
y: 35 anchors.topMargin: 10
implicitHeight: 1 font.family: roboto.name
font.bold: true
} }
Text { Text {
text: "X" text: "X"
Layout.alignment: Qt.AlignRight
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: 25 anchors.rightMargin: 25
@ -971,33 +975,27 @@ ApplicationWindow {
} }
} }
} }
ColumnLayout {
spacing: 10
Text {
text: qsTr("Storage")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
Layout.topMargin: 10
font.family: roboto.name
font.bold: true
} }
// line under title
Item { Rectangle {
clip: true id: dstpopup_title_separator
Layout.preferredWidth: dstlist.width color: "#afafaf"
Layout.preferredHeight: dstlist.height width: parent.width
anchors.top: dstpopup_title_background.bottom
height: 1
}
ListView { ListView {
id: dstlist id: dstlist
model: driveListModel model: driveListModel
delegate: dstdelegate delegate: dstdelegate
width: window.width-100
height: window.height-100 anchors.top: dstpopup_title_separator.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
highlight: Rectangle { color: "lightsteelblue"; radius: 5 } highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
clip: true
Label { Label {
anchors.fill: parent anchors.fill: parent
@ -1027,15 +1025,15 @@ ApplicationWindow {
Keys.onReturnPressed: Keys.onSpacePressed(event) Keys.onReturnPressed: Keys.onSpacePressed(event)
} }
} }
}
}
Component { Component {
id: dstdelegate id: dstdelegate
Item { Item {
width: window.width-100 anchors.left: parent.left
height: 60 anchors.right: parent.right
Layout.topMargin: 1
height: 61
Accessible.name: { Accessible.name: {
var txt = description+" - "+(size/1000000000).toFixed(1)+" gigabytes" var txt = description+" - "+(size/1000000000).toFixed(1)+" gigabytes"
if (mountpoints.length > 0) { if (mountpoints.length > 0) {
@ -1049,56 +1047,60 @@ ApplicationWindow {
Rectangle { Rectangle {
id: dstbgrect id: dstbgrect
anchors.fill: parent anchors.top: parent.top
color: "#f5f5f5" anchors.left: parent.left
visible: mouseOver && parent.ListView.view.currentIndex !== index anchors.right: parent.right
height: 60
color: mouseOver ? "#f5f5f5" : "#ffffff"
property bool mouseOver: false property bool mouseOver: false
} RowLayout {
Rectangle { anchors.fill: parent
id: dstborderrect
implicitHeight: 1
implicitWidth: parent.width
color: "#dcdcdc"
y: parent.height
}
Row { Item {
leftPadding: 25 width: 25
}
Column {
width: 64
Image { Image {
id: dstitem_image
source: isUsb ? "icons/ic_usb_40px.svg" : isScsi ? "icons/ic_storage_40px.svg" : "icons/ic_sd_storage_40px.svg" source: isUsb ? "icons/ic_usb_40px.svg" : isScsi ? "icons/ic_storage_40px.svg" : "icons/ic_sd_storage_40px.svg"
verticalAlignment: Image.AlignVCenter verticalAlignment: Image.AlignVCenter
height: parent.parent.parent.height
fillMode: Image.Pad fillMode: Image.Pad
width: 64
height: 60
} }
}
Column {
width: parent.parent.width-64
Item {
width: 25
}
ColumnLayout {
Text { Text {
textFormat: Text.StyledText textFormat: Text.StyledText
height: parent.parent.parent.height
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
font.family: roboto.name font.family: roboto.name
font.pointSize: 16
color: isReadOnly ? "grey" : "";
text: { text: {
var sizeStr = (size/1000000000).toFixed(1)+" GB"; var sizeStr = (size/1000000000).toFixed(1)+ " " + qsTr("GB");
var txt; return description + " - " + sizeStr;
}
}
Text {
textFormat: Text.StyledText
height: parent.height
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
font.family: roboto.name
font.pointSize: 12
color: "grey"
text: {
var txt= qsTr("Mounted as %1").arg(mountpoints.join(", "));
if (isReadOnly) { if (isReadOnly) {
txt = "<p><font size='4' color='grey'>"+description+" - "+sizeStr+"</font></p>" txt += " " + qsTr("[WRITE PROTECTED]")
txt += "<font color='grey'>"
if (mountpoints.length > 0) {
txt += qsTr("Mounted as %1").arg(mountpoints.join(", "))+" "
}
txt += qsTr("[WRITE PROTECTED]")+"</font>"
} else {
txt = "<p><font size='4'>"+description+" - "+sizeStr+"</font></p>"
if (mountpoints.length > 0) {
txt += "<font color='grey'>"+qsTr("Mounted as %1").arg(mountpoints.join(", "))+"</font>"
}
} }
return txt; return txt;
} }
@ -1106,6 +1108,16 @@ ApplicationWindow {
} }
} }
}
Rectangle {
id: dstborderrect
anchors.top: dstbgrect.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 1
color: "#dcdcdc"
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@ -1196,6 +1208,8 @@ ApplicationWindow {
} }
OptionsPopup { OptionsPopup {
minimumWidth: 450
minimumHeight: 400
id: optionspopup id: optionspopup
onSaveSettingsSignal: { onSaveSettingsSignal: {
imageWriter.setSavedCustomizationSettings(settings) imageWriter.setSavedCustomizationSettings(settings)