mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Merge pull request #676 from cillian64/oslist-arrows
Enable arrow keys for OS list navigation
This commit is contained in:
commit
f675c48e35
1 changed files with 31 additions and 0 deletions
31
src/main.qml
31
src/main.qml
|
@ -626,6 +626,11 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: Keys.onSpacePressed(event)
|
Keys.onEnterPressed: Keys.onSpacePressed(event)
|
||||||
Keys.onReturnPressed: Keys.onSpacePressed(event)
|
Keys.onReturnPressed: Keys.onSpacePressed(event)
|
||||||
|
Keys.onRightPressed: {
|
||||||
|
// Navigate into sublists but don't select an OS entry
|
||||||
|
if (currentIndex != -1 && isOSsublist(model.get(currentIndex)))
|
||||||
|
selectOSitem(model.get(currentIndex), true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,6 +680,15 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
Keys.onEnterPressed: Keys.onSpacePressed(event)
|
Keys.onEnterPressed: Keys.onSpacePressed(event)
|
||||||
Keys.onReturnPressed: Keys.onSpacePressed(event)
|
Keys.onReturnPressed: Keys.onSpacePressed(event)
|
||||||
|
Keys.onRightPressed: {
|
||||||
|
// Navigate into sublists but don't select an OS entry
|
||||||
|
if (currentIndex != -1 && isOSsublist(model.get(currentIndex)))
|
||||||
|
selectOSitem(model.get(currentIndex), true)
|
||||||
|
}
|
||||||
|
Keys.onLeftPressed: {
|
||||||
|
osswipeview.decrementCurrentIndex()
|
||||||
|
ospopup.categorySelected = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1628,6 +1642,23 @@ ApplicationWindow {
|
||||||
hwpopup.close()
|
hwpopup.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Is the item a sub-list or sub-sub-list in the OS selection model?
|
||||||
|
function isOSsublist(d) {
|
||||||
|
// Top level category
|
||||||
|
if (typeof(d.subitems_json) == "string" && d.subitems_json !== "") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sub-category
|
||||||
|
if (typeof(d.subitems_url) == "string" && d.subitems_url !== ""
|
||||||
|
&& d.subitems_url !== "internal://back")
|
||||||
|
{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
function selectOSitem(d, selectFirstSubitem)
|
function selectOSitem(d, selectFirstSubitem)
|
||||||
{
|
{
|
||||||
if (typeof(d.subitems_json) == "string" && d.subitems_json !== "") {
|
if (typeof(d.subitems_json) == "string" && d.subitems_json !== "") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue