2023-05-23 14:51:14 -04:00
|
|
|
import QtCore
|
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Controls.Basic
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Dialogs
|
2023-06-22 15:44:49 -04:00
|
|
|
import chatlistmodel
|
2023-05-23 14:51:14 -04:00
|
|
|
import localdocs
|
|
|
|
import llm
|
|
|
|
|
2023-07-06 10:53:43 -04:00
|
|
|
MyDialog {
|
2023-05-23 14:51:14 -04:00
|
|
|
id: collectionsDialog
|
|
|
|
modal: true
|
|
|
|
padding: 20
|
|
|
|
width: 480
|
|
|
|
height: 640
|
|
|
|
|
2023-06-22 15:44:49 -04:00
|
|
|
property var currentChat: ChatListModel.currentChat
|
2023-05-23 14:51:14 -04:00
|
|
|
|
|
|
|
Label {
|
|
|
|
id: listLabel
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
2023-06-08 13:44:17 -04:00
|
|
|
text: "Available LocalDocs Collections:"
|
2023-08-07 13:54:13 -04:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-05-23 14:51:14 -04:00
|
|
|
color: theme.textColor
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
id: scrollView
|
|
|
|
anchors.top: listLabel.bottom
|
|
|
|
anchors.topMargin: 20
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
clip: true
|
|
|
|
contentHeight: 300
|
|
|
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
color: theme.backgroundLighter
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: listView
|
|
|
|
model: LocalDocs.localDocsModel
|
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
|
|
delegate: Rectangle {
|
|
|
|
id: item
|
|
|
|
width: listView.width
|
|
|
|
height: collectionId.height + 40
|
|
|
|
color: index % 2 === 0 ? theme.backgroundLight : theme.backgroundLighter
|
|
|
|
MyCheckBox {
|
|
|
|
id: checkBox
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.margins: 20
|
|
|
|
checked: currentChat.hasCollection(collection)
|
|
|
|
onClicked: {
|
|
|
|
if (checkBox.checked) {
|
|
|
|
currentChat.addCollection(collection)
|
|
|
|
} else {
|
|
|
|
currentChat.removeCollection(collection)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
id: collectionId
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: checkBox.right
|
|
|
|
anchors.margins: 20
|
|
|
|
text: collection
|
2023-08-07 13:54:13 -04:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-05-23 14:51:14 -04:00
|
|
|
elide: Text.ElideRight
|
|
|
|
color: theme.textColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|