Rework the left chat panel to be persistently open.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
Adam Treat
2024-03-13 08:53:53 -04:00
committed by AT
parent 0072860d24
commit b68ebb7c15
5 changed files with 55 additions and 50 deletions

View File

@@ -528,57 +528,24 @@ Window {
}
}
Button {
MyToolButton {
id: drawerButton
backgroundColor: theme.iconBackgroundLight
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 42.5
anchors.leftMargin: 30
width: 40
height: 40
scale: 1.5
z: 200
padding: 15
source: conversation.state === "expanded" ? "qrc:/gpt4all/icons/left_panel_open.svg" : "qrc:/gpt4all/icons/left_panel_closed.svg"
Accessible.role: Accessible.ButtonMenu
Accessible.name: qsTr("Main menu")
Accessible.description: qsTr("Navigation drawer with options")
background: Item {
anchors.centerIn: parent
width: 30
height: 30
Rectangle {
id: bar1
color: drawerButton.hovered ? theme.iconBackgroundHovered : theme.iconBackgroundLight
width: parent.width
height: 6
radius: 2
antialiasing: true
}
Rectangle {
id: bar2
anchors.centerIn: parent
color: drawerButton.hovered ? theme.iconBackgroundHovered : theme.iconBackgroundLight
width: parent.width
height: 6
radius: 2
antialiasing: true
}
Rectangle {
id: bar3
anchors.bottom: parent.bottom
color: drawerButton.hovered ? theme.iconBackgroundHovered : theme.iconBackgroundLight
width: parent.width
height: 6
radius: 2
antialiasing: true
}
}
Accessible.name: qsTr("Chat panel")
Accessible.description: qsTr("Chat panel with options")
onClicked: {
drawer.visible = !drawer.visible
conversation.toggleLeftPanel()
}
}
@@ -857,9 +824,10 @@ Window {
ChatDrawer {
id: drawer
y: header.height + accentRibbon.height
width: Math.min(600, 0.3 * window.width)
height: window.height - y
anchors.left: parent.left
anchors.top: accentRibbon.bottom
anchors.bottom: parent.bottom
width: Math.min(600, 0.2 * window.width)
onDownloadClicked: {
downloadNewModels.showEmbeddingModels = false
downloadNewModels.open()
@@ -884,6 +852,39 @@ Window {
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.top: accentRibbon.bottom
state: "collapsed"
states: [
State {
name: "expanded"
AnchorChanges {
target: conversation
anchors.left: drawer.right
}
},
State {
name: "collapsed"
AnchorChanges {
target: conversation
anchors.left: parent.left
}
}
]
function toggleLeftPanel() {
if (conversation.state === "expanded") {
conversation.state = "collapsed";
} else {
conversation.state = "expanded";
}
}
transitions: Transition {
AnchorAnimation {
easing.type: Easing.InOutQuad
duration: 200
}
}
ScrollView {
id: scrollView