mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-19 12:06:28 +02:00
[ui] TextFileViewer: wait for request completion before sending a new one
On auto-realod mode, only trigger a new request when the last one has been completed. Avoids requests loops on slow filesystems that can lead to UI freezes.
This commit is contained in:
parent
88b0297660
commit
52361d0b86
1 changed files with 6 additions and 3 deletions
|
@ -22,6 +22,7 @@ Item {
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
|
|
||||||
onSourceChanged: loadSource()
|
onSourceChanged: loadSource()
|
||||||
|
onAutoReloadChanged: loadSource()
|
||||||
onVisibleChanged: if(visible) loadSource()
|
onVisibleChanged: if(visible) loadSource()
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
@ -307,11 +308,10 @@ Item {
|
||||||
|
|
||||||
// Auto-reload current file timer
|
// Auto-reload current file timer
|
||||||
Timer {
|
Timer {
|
||||||
|
id: reloadTimer
|
||||||
running: root.autoReload
|
running: root.autoReload
|
||||||
interval: root.autoReloadInterval
|
interval: root.autoReloadInterval
|
||||||
repeat: true
|
repeat: false // timer is restarted in request's callback (see loadSource)
|
||||||
// reload file on start and stop
|
|
||||||
onRunningChanged: loadSource()
|
|
||||||
onTriggered: loadSource()
|
onTriggered: loadSource()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,6 +333,9 @@ Item {
|
||||||
if(xhr.readyState === XMLHttpRequest.DONE) {
|
if(xhr.readyState === XMLHttpRequest.DONE) {
|
||||||
textView.setText(xhr.status === 200 ? xhr.responseText : "");
|
textView.setText(xhr.status === 200 ? xhr.responseText : "");
|
||||||
loading = false;
|
loading = false;
|
||||||
|
// re-trigger reload source file
|
||||||
|
if(autoReload)
|
||||||
|
reloadTimer.restart();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue