xml cleanup

This commit is contained in:
Chr1Z93 2022-12-06 20:57:33 +01:00
parent 12a71894d8
commit ce8e6815a5
2 changed files with 78 additions and 68 deletions

View File

@ -135,9 +135,7 @@ function onLoad(savedData)
if savedData then
optionPanel = JSON.decode(savedData)
for id, enabled in pairs(optionPanel) do
if enabled then
self.UI.setAttribute("toggle" .. id, "isOn", true)
end
if enabled then self.UI.setAttribute("toggle" .. id, "isOn", true) end
end
else
for i = 1, 8 do
@ -613,11 +611,13 @@ function onClick_toggleOption(_, id)
self.UI.setAttribute("toggle" .. id, "isOn", state)
optionPanel[id] = state
print("Option no. " .. id .. ": " .. tostring(optionPanel[id]))
end
function onClick_applySettings()
print("Dummy: Apply settings")
print("Enabling following settings:")
for id, value in pairs(optionPanel) do
if value then print(id) end
end
end
function onClick_toggleUi(_, title)

View File

@ -11,80 +11,90 @@
<Text class="headerText" minWidth="200" flexibleWidth="100" fontSize="32"/>
<!-- Window layouting -->
<VerticalLayout class="window" active="false" visibility="Admin" width="800" height="780" color="black" outlineSize="1 1" outline="#303030"/>
<VerticalLayout color="black" visibility="Admin" outlineSize="1 1" outline="#303030"/>
<VerticalLayout class="window" active="false" width="800" height="780"/>
<Row class="tblRow" preferredHeight="75"/>
</Defaults>
<!-- Buttons in the bottom right of the screen -->
<VerticalLayout
visibility="Admin"
color="black"
outlineSize="1 1"
outline="#303030"
rectAlignment="LowerRight"
width="40"
height="240"
offsetXY="-1 70">
<Button color="#000000" icon="cthulhu" tooltip="Campaigns" onClick="onClick_toggleUi(Campaigns)"/>
<Button color="#000000" icon="dark-cult" tooltip="Standalone Scenarios" onClick="onClick_toggleUi(Standalone Scenarios)"/>
<Button color="#000000" icon="yog-sothoth" tooltip="Extras" onClick="onClick_toggleUi(Extras)"/>
<Button color="#000000" icon="elder-sign" tooltip="Investigators" onClick="onClick_toggleUi(Investigators)"/>
<Button color="#000000" icon="devourer" tooltip="Community Content" onClick="onClick_toggleUi(Community Content)"/>
<Button color="#000000" icon="option-gear" tooltip="Option Panel" onClick="onClick_toggleUi(Option Panel)"/>
<!--<Button icon="download" tooltip="ArkhamDB Deck Importer" onClick="onClick_toggleUi(Deck Importer)"/> -->
<VerticalLayout rectAlignment="LowerRight" width="40" height="240" offsetXY="-1 70">
<Button color="#000000" icon="cthulhu" tooltip="Campaigns" onClick="onClick_toggleUi(Campaigns)"/>
<Button color="#000000" icon="dark-cult" tooltip="Standalone Scenarios" onClick="onClick_toggleUi(Standalone Scenarios)"/>
<Button color="#000000" icon="yog-sothoth" tooltip="Extras" onClick="onClick_toggleUi(Extras)"/>
<Button color="#000000" icon="elder-sign" tooltip="Investigators" onClick="onClick_toggleUi(Investigators)"/>
<Button color="#000000" icon="devourer" tooltip="Community Content" onClick="onClick_toggleUi(Community Content)"/>
<Button color="#000000" icon="option-gear" tooltip="Option Panel" onClick="onClick_toggleUi(Option Panel)"/>
<!--<Button icon="download" tooltip="ArkhamDB Deck Importer" onClick="onClick_toggleUi(Deck Importer)"/> -->
</VerticalLayout>
<!-- Basic UI that will be replaced based on title -->
<VerticalLayout id="load_ui" class="window">
<HorizontalLayout class="headerLayout">
<Button class="headerButton" icon="refresh" tooltip="Refresh List" tooltipPosition="Right" onClick="onClick_refreshList"/>
<Text id="title" class="headerText">Loadable Items</Text>
<Button class="headerButton" icon="close" tooltip="Close" onClick="onClick_toggleUi(Hidden)"/>
</HorizontalLayout>
<VerticalScrollView color="transparent" minHeight="100" flexibleHeight="100">
<Panel id="ui_update_height" height="24">
<VerticalLayout id="ui_update_point" padding="10">
<Text>Please refresh to see available items.</Text>
</VerticalLayout>
</Panel>
</VerticalScrollView>
<Panel color="rgb(0,0,0)" minHeight="50" preferredHeight="50" flexibleHeight="0">
<Button id="load_button" active="false" onClick="onClick_load">Load:</Button>
<HorizontalLayout id="progress_display">
<ProgressBar id="download_progress" percentage="0" color="#000000" fillImageColor="#333333"/>
<Button onClick="onClick_cancel" active="false">Cancel</Button>
</HorizontalLayout>
<HorizontalLayout class="headerLayout">
<Button class="headerButton" icon="refresh" tooltip="Refresh List" tooltipPosition="Right" onClick="onClick_refreshList"/>
<Text id="title" class="headerText">Loadable Items</Text>
<Button class="headerButton" icon="close" tooltip="Close" onClick="onClick_toggleUi(Hidden)"/>
</HorizontalLayout>
<VerticalScrollView color="transparent" minHeight="100" flexibleHeight="100">
<Panel id="ui_update_height" height="24">
<VerticalLayout id="ui_update_point" padding="10">
<Text>Please refresh to see available items.</Text>
</VerticalLayout>
</Panel>
</VerticalScrollView>
<Panel color="rgb(0,0,0)" minHeight="50" preferredHeight="50" flexibleHeight="0">
<Button id="load_button" active="false" onClick="onClick_load">Load:</Button>
<HorizontalLayout id="progress_display">
<ProgressBar id="download_progress" percentage="0" color="#000000" fillImageColor="#333333"/>
<Button onClick="onClick_cancel" active="false">Cancel</Button>
</HorizontalLayout>
</Panel>
</VerticalLayout>
<!-- Option Panel -->
<VerticalLayout id="optionPanel" class="window">
<HorizontalLayout class="headerLayout">
<Button class="headerButton" icon="refresh" tooltip="Default Settings" tooltipPosition="Right" onClick="onClick_defaultSettings"/>
<Text class="headerText">Option Panel</Text>
<Button class="headerButton" icon="close" tooltip="Close" onClick="onClick_toggleUi(Hidden)"/>
</HorizontalLayout>
<VerticalScrollView color="transparent" minHeight="100" flexibleHeight="100">
<TableLayout padding="20" cellPadding="10" cellSpacing="10">
<Row class="tblRow">
<Cell><Toggle id="toggle1" onValueChanged="onClick_toggleOption(1)">Toggle Text 1</Toggle></Cell>
<Cell><Toggle id="toggle2" onValueChanged="onClick_toggleOption(2)">Toggle Text 2</Toggle></Cell>
</Row>
<Row class="tblRow">
<Cell><Toggle id="toggle3" onValueChanged="onClick_toggleOption(3)">Toggle Text 3</Toggle></Cell>
<Cell><Toggle id="toggle4" onValueChanged="onClick_toggleOption(4)">Toggle Text 4</Toggle></Cell>
</Row>
<Row class="tblRow">
<Cell><Toggle id="toggle5" onValueChanged="onClick_toggleOption(5)">Toggle Text 5</Toggle></Cell>
<Cell><Toggle id="toggle6" onValueChanged="onClick_toggleOption(6)">Toggle Text 6</Toggle></Cell>
</Row>
<Row class="tblRow">
<Cell><Toggle id="toggle7" onValueChanged="onClick_toggleOption(7)">Toggle Text 7</Toggle></Cell>
<Cell><Toggle id="toggle8" onValueChanged="onClick_toggleOption(8)">Toggle Text 8</Toggle></Cell>
</Row>
</TableLayout>
</VerticalScrollView>
<Panel color="rgb(0,0,0)" minHeight="50" preferredHeight="50" flexibleHeight="0">
<Button onClick="onClick_applySettings" color="#888888" fontSize="25">Apply Settings</Button>
</Panel>
<HorizontalLayout class="headerLayout">
<Button class="headerButton" icon="refresh" tooltip="Default Settings" tooltipPosition="Right" onClick="onClick_defaultSettings"/>
<Text class="headerText">Option Panel</Text>
<Button class="headerButton" icon="close" tooltip="Close" onClick="onClick_toggleUi(Hidden)"/>
</HorizontalLayout>
<VerticalScrollView color="transparent" minHeight="100" flexibleHeight="100">
<TableLayout padding="20" cellPadding="10" cellSpacing="10">
<Row class="tblRow">
<Cell>
<Toggle id="toggle1" onValueChanged="onClick_toggleOption(1)">Toggle Text 1</Toggle>
</Cell>
<Cell>
<Toggle id="toggle2" onValueChanged="onClick_toggleOption(2)">Toggle Text 2</Toggle>
</Cell>
</Row>
<Row class="tblRow">
<Cell>
<Toggle id="toggle3" onValueChanged="onClick_toggleOption(3)">Toggle Text 3</Toggle>
</Cell>
<Cell>
<Toggle id="toggle4" onValueChanged="onClick_toggleOption(4)">Toggle Text 4</Toggle>
</Cell>
</Row>
<Row class="tblRow">
<Cell>
<Toggle id="toggle5" onValueChanged="onClick_toggleOption(5)">Toggle Text 5</Toggle>
</Cell>
<Cell>
<Toggle id="toggle6" onValueChanged="onClick_toggleOption(6)">Toggle Text 6</Toggle>
</Cell>
</Row>
<Row class="tblRow">
<Cell>
<Toggle id="toggle7" onValueChanged="onClick_toggleOption(7)">Toggle Text 7</Toggle>
</Cell>
<Cell>
<Toggle id="toggle8" onValueChanged="onClick_toggleOption(8)">Toggle Text 8</Toggle>
</Cell>
</Row>
</TableLayout>
</VerticalScrollView>
<Panel color="rgb(0,0,0)" minHeight="50" preferredHeight="50" flexibleHeight="0">
<Button onClick="onClick_applySettings" color="#888888" fontSize="25">Apply Settings</Button>
</Panel>
</VerticalLayout>