split release notes into separate window

This commit is contained in:
Chr1Z93 2023-04-16 23:10:23 +02:00
parent 387145ca19
commit ace11ed2b2
4 changed files with 101 additions and 52 deletions

View File

@ -1071,9 +1071,11 @@ function compareVersion(request)
-- updating the XML notification
local ui = UI.getXmlTable()
-- update the header
local header = find_tag_with_id(ui, 'versionHeader')
-- update the headers
local header = find_tag_with_id(ui, 'notificationHeader')
header.value = "New Version available: " .. modMeta["latestVersion"] .. " (current: " .. MOD_VERSION .. ")"
local header2 = find_tag_with_id(ui, 'versionHeader')
header2.value = "Release Notes for " .. modMeta["latestVersion"]
-- update the release notes
local releaseNoteWrapper = find_tag_with_id(ui, 'releaseNoteWrapper')
@ -1081,9 +1083,17 @@ function compareVersion(request)
for _, entry in pairs(releaseNotes["Details"]) do
table.insert(releaseNoteWrapper.children,
{ tag = 'Row',
attributes = { class="releaseNote" },
children =
{ tag = 'Cell',
attributes = { class="releaseNote" },
children =
{ tag = 'Text',
value = entry,
attributes = { class="releaseNote" }
attributes = { class="releaseNote" },
value = "• " .. entry,
}
}
})
end
UI.setXmlTable(ui)
@ -1097,6 +1107,13 @@ end
function onClick_notification(_, parameter)
if parameter == "dontNotify" then
dontNotify[modMeta["latestVersion"]] = true
elseif parameter == "details" then
UI.show("releaseNotes")
end
UI.hide("updateNotification")
end
function onClick_releaseNotes()
UI.hide("releaseNotes")
end

View File

@ -123,3 +123,4 @@
<Include src="OptionPanel.xml"/>
<Include src="UpdateNotification.xml"/>
<Include src="ReleaseNotes.xml"/>

65
xml/ReleaseNotes.xml Normal file
View File

@ -0,0 +1,65 @@
<Defaults>
<!-- table entries -->
<Text class="releaseNote"
fontSize="16"/>
<Row class="releaseNote"
preferredHeight="50"/>
<Cell class="releaseNote"
color="#333333"/>
</Defaults>
<TableLayout id="releaseNotes"
active="false"
color="#000000"
outlineSize="2 2"
outline="grey"
showAnimation="Grow"
hideAnimation="Shrink"
animationDuration="0.2"
rectAlignment="MiddleCenter"
height="300"
width="450">
<!-- Header -->
<Row preferredHeight="50">
<Cell>
<Panel padding="10 0 0 0">
<Text id="versionHeader"
font="font_teutonic-arkham"
fontSize="30"
alignment="MiddleCenter">Release Notes for </Text>
</Panel>
</Cell>
</Row>
<!-- Scrollable part with release notes -->
<Row preferredHeight="200">
<Cell>
<VerticalScrollView horizontalScrollbarVisibility="AutohideAndExpandViewport">
<!-- this part will be updated via script -->
<TableLayout id="releaseNoteWrapper"
autoCalculateHeight="1"
cellPadding="10 15 5 5">
<Row class="releaseNote">
<Cell class="releaseNote">
<Text class="releaseNote">Placeholder</Text>
</Cell>
</Row>
</TableLayout>
</VerticalScrollView>
</Cell>
</Row>
<!-- Buttons: "Close" -->
<Row preferredHeight="50">
<Cell>
<HorizontalLayout minHeight="55"
flexibleHeight="0"
padding="10 10 5 10"
spacing="100">
<Button class="bottomButtons"
onClick="onClick_releaseNotes">Close</Button>
</HorizontalLayout>
</Cell>
</Row>
</TableLayout>

View File

@ -1,25 +1,4 @@
<Defaults>
<Text color="#FFFFFF"
alignment="MiddleLeft" />
<Text class="releaseNote"
fontSize="18"/>
<!-- buttons at the bottom -->
<Button class="bottomButtons"
hoverClass="hover"
pressClass="press"
selectClass="select"
color="#888888"
minHeight="35"
fontSize="24"
font="font_teutonic-arkham"/>
<Button class="hover"
color="grey"/>
<Button class="press"
color="white"/>
<Button class="select"
color="white"/>
</Defaults>
<!-- Default formatting inherented from OptionPanel! -->
<TableLayout id="updateNotification"
active="false"
@ -29,47 +8,34 @@
showAnimation="SlideIn_Top"
hideAnimation="SlideOut_Top"
animationDuration="0.2"
rectAlignment="UpperCenter"
offsetXY="0 -60"
height="300"
width="450">
rectAlignment="UpperLeft"
offsetXY="60 -5"
height="100"
width="500">
<!-- Header -->
<Row preferredHeight="50">
<Cell>
<Panel padding="10 0 0 0">
<Text id="versionHeader"
<Text id="notificationHeader"
font="font_teutonic-arkham"
fontSize="30"
alignment="MiddleCenter">New Version available: </Text>
alignment="MiddleCenter">New version available: </Text>
</Panel>
</Cell>
</Row>
<!-- Scrollable part with release notes -->
<Row preferredHeight="200">
<Cell>
<VerticalScrollView horizontalScrollbarVisibility="AutohideAndExpandViewport">
<!-- this part will be updated via script -->
<VerticalLayout id="releaseNoteWrapper"
padding="10 0 0 0"
spacing="5">
<Text class="releaseNote">Entry 1</Text>
<Text class="releaseNote">Entry 2</Text>
</VerticalLayout>
</VerticalScrollView>
</Cell>
</Row>
<!-- Buttons: "Don't show again" and "Close" -->
<!-- Buttons: "Don't show again", "Details" and "Close" -->
<Row preferredHeight="50">
<Cell>
<HorizontalLayout minHeight="55"
flexibleHeight="0"
padding="10 10 5 10"
spacing="100">
spacing="10">
<Button class="bottomButtons"
onClick="onClick_notification(dontNotify)">Don't show again</Button>
<Button class="bottomButtons"
onClick="onClick_notification(details)">Show details</Button>
<Button class="bottomButtons"
onClick="onClick_notification(close)">Close</Button>
</HorizontalLayout>