Improve drive listing

- Show write protected SD cards greyed out.
  Show message if user select one of those. Closes #59
- Do show virtual drive types on Windows.
  Do keep them hidden on Mac OS X as that seems to
  cover .dmg file and timemachine stuff. Closes #79
This commit is contained in:
Floris Bos 2020-07-03 21:16:49 +02:00
parent 5f42c7d7cb
commit 39abeb239d
5 changed files with 45 additions and 33 deletions

View file

@ -615,24 +615,12 @@ ApplicationWindow {
Keys.onSpacePressed: {
if (currentIndex == -1)
return
dstpopup.close()
imageWriter.setDst(currentItem.device, currentItem.size)
dstbutton.text = currentItem.description
if (imageWriter.readyToWrite()) {
writebutton.enabled = true
}
selectDstItem(currentItem)
}
Accessible.onPressAction: {
if (currentIndex == -1)
return
dstpopup.close()
imageWriter.setDst(currentItem.device, currentItem.size)
dstbutton.text = currentItem.description
if (imageWriter.readyToWrite()) {
writebutton.enabled = true
}
selectDstItem(currentItem)
}
}
}
@ -694,9 +682,20 @@ ApplicationWindow {
verticalAlignment: Text.AlignVCenter
font.family: roboto.name
text: {
var txt = "<p><font size='4'>"+description+" - "+(size/1000000000).toFixed(1)+" GB"+"</font></p>"
if (mountpoints.length > 0) {
txt += "<font color='grey'>"+qsTr("Mounted as %1").arg(mountpoints.join(", "))+"</font>"
var sizeStr = (size/1000000000).toFixed(1)+" GB";
var txt;
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>"
}
}
return txt;
}
@ -718,12 +717,7 @@ ApplicationWindow {
}
onClicked: {
dstpopup.close()
imageWriter.setDst(device, size)
dstbutton.text = description
if (imageWriter.readyToWrite()) {
writebutton.enabled = true
}
selectDstItem(model)
}
}
}
@ -988,4 +982,18 @@ ApplicationWindow {
}
}
}
function selectDstItem(d) {
if (d.isReadOnly) {
onError(qsTr("SD card is write protected.<br>Push the lock switch on the left side of the card upwards, and try again."))
return
}
dstpopup.close()
imageWriter.setDst(d.device, d.size)
dstbutton.text = d.description
if (imageWriter.readyToWrite()) {
writebutton.enabled = true
}
}
}