[ui] NodeLog: load file only if visible

* when visibility changes, only load current file if log is actually visible
* set 'keepCursorPosition' default value to false in 'loadCurrentFile' method
This commit is contained in:
Yann Lanthony 2018-09-06 15:56:12 +02:00
parent 143b519dbd
commit 3b656d97fd

View file

@ -87,8 +87,9 @@ FocusScope {
property string currentFile: chunksLV.currentChunk ? chunksLV.currentChunk[currentItem.fileProperty] : "" property string currentFile: chunksLV.currentChunk ? chunksLV.currentChunk[currentItem.fileProperty] : ""
property string lastLoadedFile property string lastLoadedFile
property date lastModTime property date lastModTime
onCurrentFileChanged: if(visible) loadCurrentFile(false) onCurrentFileChanged: if(visible) loadCurrentFile()
onVisibleChanged: loadCurrentFile() onVisibleChanged: if(visible) loadCurrentFile()
TabButton { TabButton {
property string fileProperty: "logFile" property string fileProperty: "logFile"
@ -197,6 +198,8 @@ FocusScope {
function loadCurrentFile(keepCursorPosition) function loadCurrentFile(keepCursorPosition)
{ {
if(keepCursorPosition == undefined)
keepCursorPosition = false
var xhr = new XMLHttpRequest; var xhr = new XMLHttpRequest;
xhr.open("GET", Filepath.stringToUrl(fileSelector.currentFile)); xhr.open("GET", Filepath.stringToUrl(fileSelector.currentFile));
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {