targeted state dot updates in render path
- onAgentStateChanged: update specific agent in model instead of version bump - State dot: use model.state directly instead of ollie.agentState() callback - Remove ollie.isSessionPaused() call (was O(n) iteration per agent) - Remove unused agentStateVersion property Before: 1 state change → re-evaluate ALL agent dots → N * ollie.agentState() calls After: 1 state change → setProperty on 1 model item → 1 binding update
This commit is contained in:
parent
2d373b4bfb
commit
1d0fb99501
23
gui/main.qml
23
gui/main.qml
|
|
@ -11,9 +11,6 @@ ApplicationWindow {
|
|||
font.family: theme.fontFamily || Qt.application.font.family
|
||||
font.pointSize: theme.fontSize > 0 ? theme.fontSize : Qt.application.font.pointSize
|
||||
|
||||
// Version counter to force re-evaluation of agent state colors
|
||||
property int agentStateVersion: 0
|
||||
|
||||
// Apply theme palette to all Qt Quick Controls
|
||||
palette.active.window: theme.windowColor
|
||||
palette.active.windowText: theme.windowTextColor
|
||||
|
|
@ -386,8 +383,14 @@ ApplicationWindow {
|
|||
}
|
||||
}
|
||||
function onAgentStateChanged(sessionId, agentId, state) {
|
||||
// Increment version to force re-evaluation of all agent state colors
|
||||
root.agentStateVersion++
|
||||
// Update only the specific agent in the model (avoids re-evaluating all)
|
||||
for (var i = 0; i < sessionTreeModel.count; ++i) {
|
||||
var item = sessionTreeModel.get(i)
|
||||
if (item.type === "agent" && item.parentId === sessionId && item.agentId === agentId) {
|
||||
sessionTreeModel.setProperty(i, "state", state)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -979,10 +982,7 @@ ApplicationWindow {
|
|||
Layout.preferredHeight: 8
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
radius: 4
|
||||
property int stateVersion: root.agentStateVersion
|
||||
color: {
|
||||
// Depend on stateVersion to force re-evaluation
|
||||
void(stateVersion)
|
||||
if (type === "session") {
|
||||
// Session: RPC connection health
|
||||
var cc = connectionColor || "gray"
|
||||
|
|
@ -991,11 +991,8 @@ ApplicationWindow {
|
|||
if (cc === "red") return "#f44336"
|
||||
return "#9e9e9e"
|
||||
}
|
||||
// Agent: check if parent session is paused
|
||||
if (ollie.isSessionPaused(parentId))
|
||||
return "#9e9e9e" // gray when paused
|
||||
// Agent: execution state - query live state
|
||||
var s = ollie.agentState(parentId, agentId) || "idle"
|
||||
// Agent: use state from model (already updated via onAgentStateChanged)
|
||||
var s = model.state || "idle"
|
||||
if (s === "idle") return "#4caf50"
|
||||
if (s.startsWith("calling")) return "#ff9800"
|
||||
return "#2196f3"
|
||||
|
|
|
|||
Reference in New Issue