Create default movie view setting

This commit is contained in:
1hitsong 2022-12-19 21:03:35 -05:00
parent 303014d9c3
commit 545c91ef58
4 changed files with 58 additions and 11 deletions

View File

@ -128,13 +128,9 @@ sub loadInitialItems()
m.view = get_user_setting("display." + m.top.parentItem.Id + ".landing")
sortAscendingStr = get_user_setting("display." + m.top.parentItem.Id + ".sortAscending")
' If user has not set a preferred view for this folder
' If user has not set a preferred view for this folder, check if they've set a default view
if not isValid(m.view)
' Check if user has set a preferred view for the parent folder
if isValid(m.top.parentItem.parentfolder)
print "Not View Set, Use Default"
m.view = get_user_setting("display." + m.top.parentItem.parentfolder + ".view")
end if
m.view = get_user_setting("itemgrid.movieDefaultView")
end if
if not isValid(m.sortField) then m.sortField = "SortName"
@ -196,12 +192,12 @@ sub loadInitialItems()
m.infoGroup.visible = false
else if LCase(m.options.view) = "moviesgrid" or LCase(m.view) = "moviesgrid"
m.itemGrid.translation = "[96, 60]"
m.itemGrid.itemSize = "[230, 350]"
m.itemGrid.rowHeights = "[350]"
m.top.showItemTitles = true
m.itemGrid.numRows = "3"
m.selectedMovieOverview.visible = false
m.infoGroup.visible = false
m.itemGrid.itemSize = "[230, 350]"
m.itemGrid.rowHeights = "[350]"
m.top.showItemTitles = true
else if m.options.view = "Genres" or m.view = "Genres"
m.loadItemsTask.StudioIds = m.top.parentItem.Id
m.loadItemsTask.view = "Genres"

View File

@ -13,6 +13,8 @@ sub init()
m.boolSetting = m.top.findNode("boolSetting")
m.integerSetting = m.top.findNode("integerSetting")
m.radioSetting = m.top.findNode("radioSetting")
m.integerSetting.observeField("submit", "onKeyGridSubmit")
m.integerSetting.observeField("escape", "onKeyGridEscape")
@ -21,6 +23,7 @@ sub init()
m.settingsMenu.observeField("itemSelected", "settingSelected")
m.boolSetting.observeField("checkedItem", "boolSettingChanged")
m.radioSetting.observeField("checkedItem", "radioSettingChanged")
' Load Configuration Tree
m.configTree = GetConfigTree()
@ -40,7 +43,6 @@ sub onKeyGridEscape()
end sub
sub LoadMenu(configSection)
if configSection.children = invalid
' Load parent menu
m.userLocation.pop()
@ -81,6 +83,7 @@ sub settingFocused()
' Hide Settings
m.boolSetting.visible = false
m.integerSetting.visible = false
m.radioSetting.visible = false
if selectedSetting.type = invalid
return
@ -99,6 +102,26 @@ sub settingFocused()
m.integerSetting.text = integerValue
end if
m.integerSetting.visible = true
else if LCase(selectedSetting.type) = "radio"
selectedValue = get_user_setting(selectedSetting.settingName, selectedSetting.default)
radioContent = CreateObject("roSGNode", "ContentNode")
itemIndex = 0
for each item in m.userLocation.peek().children[m.settingsMenu.itemFocused].options
listItem = radioContent.CreateChild("ContentNode")
listItem.title = tr(item.title)
listItem.id = item.id
if selectedValue = item.id
m.radioSetting.checkedItem = itemIndex
end if
itemIndex++
end for
m.radioSetting.content = radioContent
m.radioSetting.visible = true
else
print "Unknown setting type " + selectedSetting.type
end if
@ -117,6 +140,9 @@ sub settingSelected()
if selectedItem.type = "integer"
m.integerSetting.setFocus(true)
end if
if (selectedItem.type) = "radio"
m.radioSetting.setFocus(true)
end if
else if selectedItem.children <> invalid and selectedItem.children.Count() > 0 ' Show sub menu
LoadMenu(selectedItem)
m.settingsMenu.setFocus(true)
@ -139,9 +165,13 @@ sub boolSettingChanged()
else
set_user_setting(selectedSetting.settingName, "false")
end if
end sub
sub radioSettingChanged()
if m.radioSetting.focusedChild = invalid then return
selectedSetting = m.userLocation.peek().children[m.settingsMenu.itemFocused]
set_user_setting(selectedSetting.settingName, m.radioSetting.content.getChild(m.radioSetting.checkedItem).id)
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
@ -152,6 +182,9 @@ function onKeyEvent(key as string, press as boolean) as boolean
else if (key = "back" or key = "left") and m.settingDetail.focusedChild <> invalid
m.settingsMenu.setFocus(true)
return true
else if (key = "back" or key = "left") and m.radioSetting.hasFocus()
m.settingsMenu.setFocus(true)
return true
end if
if key = "right"

View File

@ -31,6 +31,7 @@
</RadioButtonList>
</LayoutGroup>
<RadioButtonList id="radioSetting" translation="[900, 450]" inheritParentTransform="false" vertFocusAnimationStyle="floatingFocus" />
<intkeyboard_integerKeyboard translation="[900, 520]" id="integerSetting" maxLength="3" domain="numeric" visible="false" />
</children>

View File

@ -147,6 +147,23 @@
"settingName": "itemgrid.reset",
"type": "bool",
"default": "true"
},
{
"title": "Movie Library Default View",
"description": "Default view for Movie Libraries.",
"settingName": "itemgrid.movieDefaultView",
"type": "radio",
"default": "movies",
"options": [
{
"title": "Movies (Presentation)",
"id": "Movies"
},
{
"title": "Movies (Grid)",
"id": "MoviesGrid"
}
]
}
]
}