diff options
author | Jonas Karlsson <[email protected]> | 2025-07-04 13:06:26 +0200 |
---|---|---|
committer | Jonas Karlsson <[email protected]> | 2025-07-04 14:23:02 +0200 |
commit | 102b7bcb274e60e841f7211c43b304637158ecfc (patch) | |
tree | 4527d2b02ca705b3604cac60e3ee3c28d0705a63 /src/quick3d | |
parent | ce50a40a962eebe06ab1381c3dd886ed65c7015e (diff) |
- Rearrange the output window components. Add a label for showing the
baking stage and remove the elapsed time label. Add a Frame around the
log text.
- Add some proper types checks of the payload (fixes a bug where 0
numbers would mean false and not update the value).
Pick-to: 6.10
Change-Id: Ibbecfeb9dd37a3987e5b46204c37203871b82af1
Reviewed-by: Kristoffer Skau <[email protected]>
Diffstat (limited to 'src/quick3d')
-rw-r--r-- | src/quick3d/LightmapperOutputWindow.qml | 81 |
1 files changed, 44 insertions, 37 deletions
diff --git a/src/quick3d/LightmapperOutputWindow.qml b/src/quick3d/LightmapperOutputWindow.qml index 75c9f134..15cfad66 100644 --- a/src/quick3d/LightmapperOutputWindow.qml +++ b/src/quick3d/LightmapperOutputWindow.qml @@ -10,25 +10,28 @@ Pane { anchors.fill: parent property double totalProgress: 0 - property double totalTimeRemaining: 0 - property double totalTimeElapsed: 0 + property int totalTimeRemaining: -1 + property string stage : "Preparing..." function clearText() { textArea.clear(); } function update(payload) { - if (payload["message"]) { - textArea.insert(textArea.length, payload["message"] + "\n") + if ("message" in payload && typeof payload.message === "string" && payload.message) { + textArea.insert(textArea.length, payload.message + "\n"); } - if (payload["totalProgress"]) { - root.totalProgress = payload["totalProgress"]; + + if ("totalProgress" in payload && typeof payload.totalProgress === "number") { + root.totalProgress = payload.totalProgress; } - if (payload["totalTimeRemaining"]) { - root.totalTimeRemaining = payload["totalTimeRemaining"]; + + if ("totalTimeRemaining" in payload && typeof payload.totalTimeRemaining === "number") { + root.totalTimeRemaining = payload.totalTimeRemaining; } - if (payload["totalTimeElapsed"]) { - root.totalTimeElapsed = payload["totalTimeElapsed"] + + if ("stage" in payload && typeof payload.stage === "string") { + root.stage = payload.stage; } } @@ -54,47 +57,51 @@ Pane { ColumnLayout { anchors.fill: parent - ScrollView { - Layout.fillWidth: true - Layout.fillHeight: true - TextArea { - id: textArea - readOnly: true - placeholderText: qsTr("Qt Lightmapper") - font.pixelSize: 12 - wrapMode: Text.WordWrap + RowLayout { + Label { + padding: 0 + text: root.stage + } + Item { + Layout.fillWidth: true + } + Label { + padding: 0 + text: (root.totalProgress * 100).toFixed(0) + "%" } } ProgressBar { Layout.fillWidth: true - Layout.preferredHeight: 25 value: root.totalProgress } RowLayout { - //Layout.fillWidth: true - Item { - Layout.preferredWidth: 10 - } Label { - text: (root.totalProgress * 100).toFixed(0) + "% complete" + padding: 0 + text: totalTimeRemaining > 0 ? "Remaining: " + root.formatDuration(root.totalTimeRemaining) : "" } Item { Layout.fillWidth: true } - Label { - text: "Remaining: " + root.formatDuration(root.totalTimeRemaining) - } - Item { - Layout.fillWidth: true - } - Label { - Layout.alignment: Qt.AlignRight - text: "Elapsed: " + root.formatDuration(root.totalTimeElapsed) - } - Item { - Layout.preferredWidth: 10 + } + + Frame { + Layout.fillWidth: true + Layout.fillHeight: true + ScrollView { + width: parent.width + height: parent.height + id: scroll + TextArea { + id: textArea + width: parent.width + height: parent.height + readOnly: true + placeholderText: qsTr("Qt Lightmapper") + font.pixelSize: 12 + wrapMode: Text.WordWrap + } } } |