Remove the auto refresh list of resource because it takes too much time, instead user has to press refresh button

This commit is contained in:
Sam Gateau 2019-09-24 14:29:09 -07:00
parent 8aaa5deb11
commit 2a78fc7b38
2 changed files with 38 additions and 23 deletions

View file

@ -58,10 +58,11 @@ Item {
needFreshList = true needFreshList = true
} }
Timer {
/* Timer {
interval: 2000; running: true; repeat: true interval: 2000; running: true; repeat: true
onTriggered: pullFreshValues() onTriggered: pullFreshValues()
} }*/
function pullFreshValues() { function pullFreshValues() {
if (needFreshList) { if (needFreshList) {
@ -138,34 +139,46 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
margin: global.horizontalMargin
Item { Item {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: totalCount.height height: totalCount.height
Prop.PropScalar { Prop.PropButton {
id: totalCount id: refreshButton
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter
label: "Count" text: "Refresh"
object: root.cache color: needFreshList ? global.colorOrangeAccent : global.fontColor
property: "numTotal" onPressed: { pullFreshValues() }
integral: true
readOnly: true
onSourceValueVarChanged: { updateItemListFromCache() }
} }
Prop.PropScalar {
id: cachedCount Item {
anchors.left: parent.horizontalCenter anchors.left: refreshButton.right
anchors.right: parent.right anchors.right: parent.right
label: "Cached" Prop.PropScalar {
object: root.cache id: totalCount
property: "numCached" anchors.left: parent.left
integral: true anchors.right: parent.horizontalCenter
readOnly: true label: "Count"
onSourceValueVarChanged: { updateItemListFromCache() } object: root.cache
property: "numTotal"
integral: true
readOnly: true
onSourceValueVarChanged: { updateItemListFromCache() }
}
Prop.PropScalar {
id: cachedCount
anchors.left: parent.horizontalCenter
anchors.right: parent.right
label: "Cached"
object: root.cache
property: "numCached"
integral: true
readOnly: true
onSourceValueVarChanged: { updateItemListFromCache() }
}
} }
} }
Item { Item {
@ -210,7 +223,6 @@ Item {
opacity: (nameFilter.text.length > 0) ? 1.0 : 0.5 opacity: (nameFilter.text.length > 0) ? 1.0 : 0.5
} }
} }
Prop.Prop
} }
Component { Component {

View file

@ -16,10 +16,13 @@ Button {
id: control id: control
text: "" text: ""
spacing: 0 spacing: 0
property alias color: theContentItem.color
contentItem: PiText { contentItem: PiText {
id: theContentItem
text: control.text text: control.text
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
color: global.fontColor
} }
background: Rectangle { background: Rectangle {