Misc main.qml fixes

- Add support for tooltips
- Show more SD cards in list. Closes #32
This commit is contained in:
Floris Bos 2020-05-23 12:30:06 +02:00
parent 0264af9b73
commit a96450afbe

View file

@ -61,7 +61,6 @@ ApplicationWindow {
id: columnLayout id: columnLayout
spacing: 0 spacing: 0
Layout.fillWidth: true Layout.fillWidth: true
anchors.top: parent.top
Text { Text {
id: text1 id: text1
@ -96,7 +95,6 @@ ApplicationWindow {
id: columnLayout2 id: columnLayout2
spacing: 0 spacing: 0
Layout.fillWidth: true Layout.fillWidth: true
anchors.top: parent.top
Text { Text {
id: text2 id: text2
@ -131,7 +129,6 @@ ApplicationWindow {
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
Layout.fillWidth: true Layout.fillWidth: true
anchors.top: parent.top
Text { Text {
text: " " text: " "
@ -225,7 +222,6 @@ ApplicationWindow {
} }
} }
/* /*
Popup for OS selection Popup for OS selection
*/ */
@ -341,6 +337,7 @@ ApplicationWindow {
subitems: [] subitems: []
name: qsTr("Erase") name: qsTr("Erase")
description: qsTr("Format card as FAT32") description: qsTr("Format card as FAT32")
tooltip: ""
} }
ListElement { ListElement {
@ -380,6 +377,7 @@ ApplicationWindow {
subitems: [] subitems: []
name: qsTr("Back") name: qsTr("Back")
description: qsTr("Go back to main menu") description: qsTr("Go back to main menu")
tooltip: ""
} }
} }
@ -445,6 +443,13 @@ ApplicationWindow {
return txt; return txt;
} }
ToolTip {
visible: osMouseArea.containsMouse && typeof(tooltip) == "string" && tooltip != ""
delay: 1000
text: typeof(tooltip) == "string" ? tooltip : ""
clip: false
}
} }
} }
@ -459,6 +464,7 @@ ApplicationWindow {
} }
MouseArea { MouseArea {
id: osMouseArea
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
@ -594,7 +600,7 @@ ApplicationWindow {
model: driveListModel model: driveListModel
delegate: dstdelegate delegate: dstdelegate
width: window.width-100 width: window.width-100
height: window.height-170 height: window.height-100
focus: true focus: true
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar { ScrollBar.vertical: ScrollBar {
@ -741,8 +747,7 @@ ApplicationWindow {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true Layout.fillWidth: true
anchors.top: parent.top Layout.topMargin: 10
anchors.topMargin: 10
font.family: roboto.name font.family: roboto.name
font.bold: true font.bold: true
} }
@ -833,8 +838,8 @@ ApplicationWindow {
} else { } else {
newPos = 0 newPos = 0
} }
if (progressBar.value != newPos) { if (progressBar.value !== newPos) {
if (progressText.text == qsTr("Cancelling...")) if (progressText.text === qsTr("Cancelling..."))
return return
progressText.text = qsTr("Writing... %1%").arg(Math.floor(newPos*100)) progressText.text = qsTr("Writing... %1%").arg(Math.floor(newPos*100))
@ -851,13 +856,13 @@ ApplicationWindow {
newPos = 0 newPos = 0
} }
if (progressBar.value != newPos) { if (progressBar.value !== newPos) {
if (cancelwritebutton.visible) { if (cancelwritebutton.visible) {
cancelwritebutton.visible = false cancelwritebutton.visible = false
cancelverifybutton.visible = true cancelverifybutton.visible = true
} }
if (progressText.text == qsTr("Finalizing...")) if (progressText.text === qsTr("Finalizing..."))
return return
progressText.text = qsTr("Verifying... %1%").arg(Math.floor(newPos*100)) progressText.text = qsTr("Verifying... %1%").arg(Math.floor(newPos*100))