[ui] Add a button to disable/enable the file watcher

By default, the file watcher polls every single node's file every 5
seconds, independently from their status. This commit adds a button
in the GraphEditor to disable or enable the file watcher at will.
This commit is contained in:
Candice Bentéjac 2022-10-31 12:08:51 +01:00
parent 47fcc2f9a4
commit 84715b5105
2 changed files with 71 additions and 0 deletions

View file

@ -952,6 +952,53 @@ ApplicationWindow {
property bool updatingStatus: false
enabled: !updatingStatus && (_reconstruction ? !_reconstruction.computingLocally : false)
}
MaterialToolButton {
id: filePollerRefreshStatus
text: _reconstruction.filePollerRefresh == 0 ? MaterialIcons.sync : MaterialIcons.sync_disabled
ToolTip.text: "Set File Refresh Status"
ToolTip.visible: hovered
font.pointSize: 11
padding: 2
onClicked: {
refreshFilesMenu.open()
}
enabled: true
Menu {
id: refreshFilesMenu
y: parent.height
x: -width + parent.width
MenuItem {
id: enableAutoRefresh
text: "Enable Auto-Refresh"
checkable: true
checked: _reconstruction.filePollerRefresh == 0
onToggled: {
if (checked) {
disableAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(0)
}
// Prevents cases where the user unchecks the currently checked option
enableAutoRefresh.checked = true
filePollerRefreshStatus.text = MaterialIcons.sync
}
}
MenuItem {
id: disableAutoRefresh
text: "Disable Auto-Refresh"
checkable: true
checked: _reconstruction.filePollerRefresh == 1
onToggled: {
if (checked) {
enableAutoRefresh.checked = false
_reconstruction.filePollerRefreshChanged(1)
}
// Prevents cases where the user unchecks the currently checked option
disableAutoRefresh.checked = true
filePollerRefreshStatus.text = MaterialIcons.sync_disabled
}
}
}
}
MaterialToolButton {
text: MaterialIcons.more_vert
font.pointSize: 11