mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
qml: main: Qt6 fixes, formatting
This commit is contained in:
parent
094142ae8e
commit
3d56ecf88c
1 changed files with 348 additions and 334 deletions
266
src/main.qml
266
src/main.qml
|
@ -442,22 +442,27 @@ ApplicationWindow {
|
|||
|
||||
// background of title
|
||||
Rectangle {
|
||||
id: hwpopup_title_background
|
||||
color: "#f5f5f5"
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
height: 35
|
||||
width: parent.width
|
||||
}
|
||||
// line under title
|
||||
Rectangle {
|
||||
color: "#afafaf"
|
||||
width: parent.width
|
||||
y: 35
|
||||
implicitHeight: 1
|
||||
|
||||
Text {
|
||||
text: qsTr("Raspberry Pi Device")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 10
|
||||
font.family: roboto.name
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "X"
|
||||
Layout.alignment: Qt.AlignRight
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
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
|
||||
}
|
||||
|
||||
Item {
|
||||
clip: true
|
||||
Layout.preferredWidth: hwlist.width
|
||||
Layout.preferredHeight: hwlist.height
|
||||
// line under title
|
||||
Rectangle {
|
||||
id: hwpopup_title_separator
|
||||
color: "#afafaf"
|
||||
width: parent.width
|
||||
anchors.top: hwpopup_title_background.bottom
|
||||
height: 1
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: hwlist
|
||||
clip: true
|
||||
model: ListModel {
|
||||
id: deviceModel
|
||||
ListElement {
|
||||
|
@ -506,11 +503,14 @@ ApplicationWindow {
|
|||
}
|
||||
currentIndex: -1
|
||||
delegate: hwdelegate
|
||||
width: window.width-100
|
||||
height: window.height-100
|
||||
anchors.top: hwpopup_title_separator.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
anchors.right: parent.right
|
||||
width: 10
|
||||
policy: hwlist.contentHeight > hwlist.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
|
||||
}
|
||||
|
@ -526,8 +526,6 @@ ApplicationWindow {
|
|||
Keys.onReturnPressed: Keys.onSpacePressed(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Popup for OS selection
|
||||
|
@ -544,22 +542,27 @@ ApplicationWindow {
|
|||
|
||||
// background of title
|
||||
Rectangle {
|
||||
id: ospopup_title_background
|
||||
color: "#f5f5f5"
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
height: 35
|
||||
width: parent.width
|
||||
}
|
||||
// line under title
|
||||
Rectangle {
|
||||
color: "#afafaf"
|
||||
width: parent.width
|
||||
y: 35
|
||||
implicitHeight: 1
|
||||
|
||||
Text {
|
||||
text: qsTr("Operating System")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 10
|
||||
font.family: roboto.name
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "X"
|
||||
Layout.alignment: Qt.AlignRight
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.rightMargin: 25
|
||||
|
@ -576,39 +579,38 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
|
||||
Text {
|
||||
text: qsTr("Operating System")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
font.family: roboto.name
|
||||
font.bold: true
|
||||
}
|
||||
// line under title
|
||||
Rectangle {
|
||||
id: ospopup_title_separator
|
||||
color: "#afafaf"
|
||||
width: parent.width
|
||||
anchors.top: ospopup_title_background.bottom
|
||||
height: 1
|
||||
}
|
||||
|
||||
Item {
|
||||
clip: true
|
||||
Layout.preferredWidth: oslist.width
|
||||
Layout.preferredHeight: oslist.height
|
||||
|
||||
SwipeView {
|
||||
anchors.top: ospopup_title_separator.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
id: osswipeview
|
||||
interactive: false
|
||||
clip: true
|
||||
|
||||
ListView {
|
||||
id: oslist
|
||||
model: osmodel
|
||||
currentIndex: -1
|
||||
delegate: osdelegate
|
||||
width: window.width-100
|
||||
height: window.height-100
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.bottom: parent.bottom
|
||||
width: ospopup.width
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
anchors.right: parent.right
|
||||
width: 10
|
||||
policy: oslist.contentHeight > oslist.height ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded
|
||||
}
|
||||
|
@ -630,8 +632,6 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: suboslist
|
||||
|
@ -658,8 +658,7 @@ ApplicationWindow {
|
|||
|
||||
currentIndex: -1
|
||||
delegate: osdelegate
|
||||
width: window.width-100
|
||||
height: window.height-100
|
||||
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
|
@ -940,22 +939,27 @@ ApplicationWindow {
|
|||
|
||||
// background of title
|
||||
Rectangle {
|
||||
id: dstpopup_title_background
|
||||
color: "#f5f5f5"
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
height: 35
|
||||
width: parent.width
|
||||
}
|
||||
// line under title
|
||||
Rectangle {
|
||||
color: "#afafaf"
|
||||
width: parent.width
|
||||
y: 35
|
||||
implicitHeight: 1
|
||||
|
||||
Text {
|
||||
text: qsTr("Storage")
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 10
|
||||
font.family: roboto.name
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "X"
|
||||
Layout.alignment: Qt.AlignRight
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
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
|
||||
}
|
||||
|
||||
Item {
|
||||
clip: true
|
||||
Layout.preferredWidth: dstlist.width
|
||||
Layout.preferredHeight: dstlist.height
|
||||
|
||||
// line under title
|
||||
Rectangle {
|
||||
id: dstpopup_title_separator
|
||||
color: "#afafaf"
|
||||
width: parent.width
|
||||
anchors.top: dstpopup_title_background.bottom
|
||||
height: 1
|
||||
}
|
||||
ListView {
|
||||
id: dstlist
|
||||
model: driveListModel
|
||||
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
|
||||
highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
|
||||
clip: true
|
||||
|
||||
Label {
|
||||
anchors.fill: parent
|
||||
|
@ -1027,15 +1025,15 @@ ApplicationWindow {
|
|||
Keys.onReturnPressed: Keys.onSpacePressed(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: dstdelegate
|
||||
|
||||
Item {
|
||||
width: window.width-100
|
||||
height: 60
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
Layout.topMargin: 1
|
||||
height: 61
|
||||
Accessible.name: {
|
||||
var txt = description+" - "+(size/1000000000).toFixed(1)+" gigabytes"
|
||||
if (mountpoints.length > 0) {
|
||||
|
@ -1049,56 +1047,60 @@ ApplicationWindow {
|
|||
|
||||
Rectangle {
|
||||
id: dstbgrect
|
||||
anchors.fill: parent
|
||||
color: "#f5f5f5"
|
||||
visible: mouseOver && parent.ListView.view.currentIndex !== index
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 60
|
||||
|
||||
color: mouseOver ? "#f5f5f5" : "#ffffff"
|
||||
property bool mouseOver: false
|
||||
|
||||
}
|
||||
Rectangle {
|
||||
id: dstborderrect
|
||||
implicitHeight: 1
|
||||
implicitWidth: parent.width
|
||||
color: "#dcdcdc"
|
||||
y: parent.height
|
||||
}
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
Row {
|
||||
leftPadding: 25
|
||||
|
||||
Column {
|
||||
width: 64
|
||||
Item {
|
||||
width: 25
|
||||
}
|
||||
|
||||
Image {
|
||||
id: dstitem_image
|
||||
source: isUsb ? "icons/ic_usb_40px.svg" : isScsi ? "icons/ic_storage_40px.svg" : "icons/ic_sd_storage_40px.svg"
|
||||
verticalAlignment: Image.AlignVCenter
|
||||
height: parent.parent.parent.height
|
||||
fillMode: Image.Pad
|
||||
width: 64
|
||||
height: 60
|
||||
}
|
||||
}
|
||||
Column {
|
||||
width: parent.parent.width-64
|
||||
|
||||
Item {
|
||||
width: 25
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Text {
|
||||
textFormat: Text.StyledText
|
||||
height: parent.parent.parent.height
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
font.family: roboto.name
|
||||
font.pointSize: 16
|
||||
color: isReadOnly ? "grey" : "";
|
||||
text: {
|
||||
var sizeStr = (size/1000000000).toFixed(1)+" GB";
|
||||
var txt;
|
||||
var sizeStr = (size/1000000000).toFixed(1)+ " " + qsTr("GB");
|
||||
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) {
|
||||
txt = "<p><font size='4' color='grey'>"+description+" - "+sizeStr+"</font></p>"
|
||||
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>"
|
||||
}
|
||||
txt += " " + qsTr("[WRITE PROTECTED]")
|
||||
}
|
||||
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 {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
@ -1196,6 +1208,8 @@ ApplicationWindow {
|
|||
}
|
||||
|
||||
OptionsPopup {
|
||||
minimumWidth: 450
|
||||
minimumHeight: 400
|
||||
id: optionspopup
|
||||
onSaveSettingsSignal: {
|
||||
imageWriter.setSavedCustomizationSettings(settings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue