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 if savedData then
optionPanel = JSON.decode(savedData) optionPanel = JSON.decode(savedData)
for id, enabled in pairs(optionPanel) do for id, enabled in pairs(optionPanel) do
if enabled then if enabled then self.UI.setAttribute("toggle" .. id, "isOn", true) end
self.UI.setAttribute("toggle" .. id, "isOn", true)
end
end end
else else
for i = 1, 8 do for i = 1, 8 do
@ -613,11 +611,13 @@ function onClick_toggleOption(_, id)
self.UI.setAttribute("toggle" .. id, "isOn", state) self.UI.setAttribute("toggle" .. id, "isOn", state)
optionPanel[id] = state optionPanel[id] = state
print("Option no. " .. id .. ": " .. tostring(optionPanel[id]))
end end
function onClick_applySettings() 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 end
function onClick_toggleUi(_, title) function onClick_toggleUi(_, title)

View File

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