cleaned up and commented code

This commit is contained in:
2026-08-10 23:41:39 -05:00
parent 75f0cbded6
commit 670a7d744e
4 changed files with 66 additions and 42 deletions
+24 -23
View File
@@ -3,12 +3,14 @@ import QtQuick.Window
import NomadInput 1.0
QtObject {
// this is our top screen, for now, though in the future I would like to have it configurable which screen does which.
// I'll burn that bridge when I get to it
property Window topWindow: Window {
width: 960
width: 960 // this resolution size is for development. I'd like to have a cleaner way to develop for 1080p without getting a dedicated monitor for testing nomad on my dev computer
height: 540
visible: true
title: "nomad-top"
property string lastInputText: "none"
title: "nomad-top" // this is necesarry for Sway, which auto-assigns the windows
property string lastInputText: "none" // I've never really integrated NomadInput into this debug section in the top half and now I'm too lazy to. it's just a placeholder anyway.
Connections {
target: inputManager
@@ -21,7 +23,7 @@ QtObject {
}
}
Rectangle {
Rectangle { // just a placeholder for the top screen until we do something better
anchors.fill: parent
color: "#181818"
@@ -45,19 +47,10 @@ QtObject {
}
property Window bottomWindow: Window {
width: 620
width: 620 // again, half-resolution
height: 540
visible: true
title: "nomad-bottom"
readonly property var mainMenuNavRegions: ({
DockMenu: 0,
GamesList: 1,
Count: 2
})
property int focusRegion: bottomWindow.mainMenuNavRegions.GamesList
property int dockMenuIndex: 0
title: "nomad-bottom" // window titling for Sway auto-assign
NavigationManager {
id: navigationManager
@@ -67,6 +60,8 @@ QtObject {
Connections {
target: inputManager
// you don't wanna know what this used to look like :dread:
// just checks if our navigation is directional, and, if so, moves the selection in that direction
function onActionPressed(action) {
switch (action) {
case InputManager.Up:
@@ -85,7 +80,8 @@ QtObject {
anchors.fill: parent
color: "#181818"
Text {
// top text where a menu dock will probably be eventually
Text {
anchors.top: parent.top
anchors.topMargin: 30
anchors.horizontalCenter: parent.horizontalCenter
@@ -95,6 +91,8 @@ QtObject {
font.pixelSize: 24
}
// this is the game carousel. mostly self explanatory, but I wanna point out that the local index for this listView does probably still matter.
// I got rid of dedicated menu indexing for the dock, but I think it still matters here, for the sake of auto-scrolling
ListView {
id: gamesList
@@ -102,23 +100,25 @@ QtObject {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
// TODO: Tune this stuff !!! it feels just slightly janky and off for now, game cards don't align when scrolling, they go all the way out
// to the edge with no spacing at all when on the leftmost or rightmost cards, and vertical navigation from the dock feels *wrong*, idk,
// fix it sometime.
height: 140
orientation: ListView.Horizontal
preferredHighlightBegin: 200
preferredHighlightEnd: 420
highlightRangeMode: ListView.ApplyRange
spacing: 20
model: 20
model: 20 // this is a placeholder for now, I don't know how I really want to handle max game carousel size yet. another time.
Component.onCompleted: {
Component.onCompleted: { // on startup, this should select the first game in the list.
if (currentItem) {
navigationManager.focusItem(currentItem)
}
}
delegate: Rectangle {
delegate: Rectangle { // TODO: design a real game card QML to replace this placeholder
id: gameTile
width: 110
@@ -126,7 +126,7 @@ QtObject {
color: navigationManager.currentItem === gameTile ? "blue" : "white"
function navFocus() {
function onNavigationFocused() {
gamesList.currentIndex = index
}
@@ -168,8 +168,9 @@ QtObject {
color: navigationManager.currentItem === dockButton ? "blue" : "white"
function navFocus() {
bottomWindow.dockMenuIndex = index
function onNavigationFocused() {
// there used to be code here when my navigation was worse. I bet I'll need it eventually tho
// this entire section is a placeholder dock button anyway though.
}
Component.onCompleted: {