fix(gui): use eventwait data directly, remove focus-stealing timer
- onEventReadyRead() now parses the eventwait data directly instead of discarding it and re-reading session/idx - Removed the 2-second refresh timer that was stealing focus from the prompt text area on every tick
This commit is contained in:
parent
87850f7f10
commit
b68b72b31f
11
gui/main.qml
11
gui/main.qml
|
|
@ -90,17 +90,6 @@ ApplicationWindow {
|
|||
onTriggered: chatView.positionViewAtEnd()
|
||||
}
|
||||
|
||||
// Periodic session list refresh — fallback for missed events
|
||||
Timer {
|
||||
id: refreshTimer
|
||||
interval: 2000
|
||||
repeat: true
|
||||
running: true
|
||||
onTriggered: {
|
||||
ollie.refreshSessions()
|
||||
}
|
||||
}
|
||||
|
||||
// Session ID to kill — set on right-click, consumed by context menu
|
||||
property string killTargetSessionId: ""
|
||||
|
||||
|
|
|
|||
|
|
@ -536,10 +536,30 @@ void Ollie9pClient::startEventStream()
|
|||
|
||||
void Ollie9pClient::onEventReadyRead()
|
||||
{
|
||||
// Consume the data to prevent readyRead from firing again
|
||||
m_eventProc->readAllStandardOutput();
|
||||
// Session index changed (create/delete/rename). Refresh.
|
||||
refreshSessions();
|
||||
// eventwait returned the full session index — use it directly
|
||||
QByteArray data = m_eventProc->readAllStandardOutput();
|
||||
QString raw = QString::fromUtf8(data).trimmed();
|
||||
|
||||
m_sessions.clear();
|
||||
if (!raw.isEmpty()) {
|
||||
for (const QString &line : raw.split('\n')) {
|
||||
QStringList parts = line.split('\t');
|
||||
if (parts.size() >= 2) {
|
||||
QVariantMap session;
|
||||
session["id"] = parts[0];
|
||||
session["state"] = parts[1];
|
||||
session["model"] = parts.size() > 2 ? parts[2] : "";
|
||||
session["agent"] = parts.size() > 3 ? parts[3] : "";
|
||||
m_sessions.append(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
emit sessionsChanged();
|
||||
|
||||
// Auto-select first session if none active
|
||||
if (m_activeSessionId.isEmpty() && !m_sessions.isEmpty()) {
|
||||
setActiveSessionId(m_sessions.first().toMap()["id"].toString());
|
||||
}
|
||||
}
|
||||
|
||||
void Ollie9pClient::onEventFinished(int, QProcess::ExitStatus)
|
||||
|
|
|
|||
Reference in New Issue