146 lines
5.0 KiB
QML
146 lines
5.0 KiB
QML
import QtQuick 2.15
|
|
import QtQuick.Controls 2.15
|
|
import QtQuick.Layouts 1.15
|
|
|
|
ApplicationWindow {
|
|
id: root
|
|
visible: true
|
|
width: 1000
|
|
height: 600
|
|
title: "Ollie"
|
|
font.family: theme.fontFamily || Qt.application.font.family
|
|
font.pointSize: theme.fontSize > 0 ? theme.fontSize : Qt.application.font.pointSize
|
|
|
|
// Apply theme palette to all Qt Quick Controls
|
|
palette.active.window: theme.windowColor
|
|
palette.active.windowText: theme.windowTextColor
|
|
palette.active.base: theme.baseColor
|
|
palette.active.text: theme.textColor
|
|
palette.active.button: theme.buttonColor
|
|
palette.active.buttonText: theme.buttonTextColor
|
|
palette.active.highlight: theme.highlightColor
|
|
palette.active.highlightedText: theme.highlightedTextColor
|
|
palette.active.mid: theme.midColor
|
|
palette.active.dark: theme.darkColor
|
|
palette.active.light: theme.lightColor
|
|
palette.active.shadow: theme.shadowColor
|
|
palette.active.link: theme.linkColor
|
|
palette.active.toolTipBase: theme.tooltipBaseColor
|
|
palette.active.toolTipText: theme.tooltipTextColor
|
|
palette.active.placeholderText: theme.placeholderTextColor
|
|
palette.active.alternateBase: theme.alternateBaseColor
|
|
palette.inactive.window: theme.windowColor
|
|
palette.inactive.windowText: theme.windowTextColor
|
|
palette.inactive.base: theme.baseColor
|
|
palette.inactive.text: theme.textColor
|
|
palette.inactive.button: theme.buttonColor
|
|
palette.inactive.buttonText: theme.buttonTextColor
|
|
palette.inactive.highlight: theme.highlightColor
|
|
palette.inactive.highlightedText: theme.highlightedTextColor
|
|
palette.inactive.mid: theme.midColor
|
|
palette.inactive.dark: theme.darkColor
|
|
palette.inactive.light: theme.lightColor
|
|
palette.inactive.shadow: theme.shadowColor
|
|
palette.inactive.link: theme.linkColor
|
|
palette.inactive.toolTipBase: theme.tooltipBaseColor
|
|
palette.inactive.toolTipText: theme.tooltipTextColor
|
|
palette.inactive.placeholderText: theme.placeholderTextColor
|
|
palette.inactive.alternateBase: theme.alternateBaseColor
|
|
palette.disabled.window: theme.windowColor
|
|
palette.disabled.windowText: theme.midColor
|
|
palette.disabled.base: theme.baseColor
|
|
palette.disabled.text: theme.midColor
|
|
palette.disabled.button: theme.buttonColor
|
|
palette.disabled.buttonText: theme.midColor
|
|
palette.disabled.highlight: theme.highlightColor
|
|
palette.disabled.highlightedText: theme.highlightedTextColor
|
|
palette.disabled.mid: theme.midColor
|
|
palette.disabled.dark: theme.darkColor
|
|
palette.disabled.light: theme.lightColor
|
|
palette.disabled.shadow: theme.shadowColor
|
|
|
|
Shortcut {
|
|
sequence: "Ctrl+B"
|
|
onActivated: root.sidebarVisible = !root.sidebarVisible
|
|
}
|
|
|
|
Shortcut {
|
|
sequence: "Escape"
|
|
onActivated: {
|
|
if (sessionTree.renamingIndex >= 0) {
|
|
sessionTree.cancelRename()
|
|
} else {
|
|
// Always send stop - server-side Interrupt() is safe to call
|
|
// on an idle agent (no-op). This avoids races where the GUI's
|
|
// cached activeState is stale.
|
|
ollie.interrupt()
|
|
}
|
|
}
|
|
}
|
|
|
|
property bool sidebarVisible: true
|
|
|
|
// --- Rename Error Dialog ---
|
|
Dialog {
|
|
id: renameErrorDialog
|
|
title: "Rename Failed"
|
|
anchors.centerIn: parent
|
|
width: 320
|
|
modal: true
|
|
standardButtons: Dialog.Ok
|
|
|
|
property string itemType: "session"
|
|
property string attemptedName: ""
|
|
|
|
contentItem: Label {
|
|
text: "Could not rename " + renameErrorDialog.itemType + " to \"" + renameErrorDialog.attemptedName + "\".\n\nThe name may already be in use."
|
|
wrapMode: Text.Wrap
|
|
}
|
|
}
|
|
|
|
// --- Settings Dialog ---
|
|
SettingsDialog {
|
|
id: settingsDialog
|
|
}
|
|
|
|
// --- New Session Dialog ---
|
|
NewSessionDialog {
|
|
id: newSessionDialog
|
|
}
|
|
|
|
// --- New Agent Dialog ---
|
|
NewAgentDialog {
|
|
id: newAgentDialog
|
|
targetSessionId: ""
|
|
}
|
|
|
|
SplitView {
|
|
anchors.fill: parent
|
|
|
|
SessionTree {
|
|
id: sessionTree
|
|
SplitView.preferredWidth: root.sidebarVisible ? root.width * 0.15 : 0
|
|
SplitView.minimumWidth: root.sidebarVisible ? 300 : 0
|
|
visiblePane: root.sidebarVisible
|
|
onNewSessionRequested: newSessionDialog.open()
|
|
onSettingsRequested: settingsDialog.open()
|
|
onNewAgentRequested: function(sessionId) {
|
|
newAgentDialog.targetSessionId = sessionId
|
|
newAgentDialog.open()
|
|
}
|
|
onRenameFailed: function(itemType, attemptedName) {
|
|
renameErrorDialog.itemType = itemType
|
|
renameErrorDialog.attemptedName = attemptedName
|
|
renameErrorDialog.open()
|
|
}
|
|
}
|
|
|
|
ChatPane {
|
|
SplitView.fillWidth: true
|
|
SplitView.fillHeight: true
|
|
sidebarVisible: root.sidebarVisible
|
|
onToggleSidebar: root.sidebarVisible = !root.sidebarVisible
|
|
}
|
|
}
|
|
}
|