gpt4all/gpt4all-chat/qml/SettingsDialog.qml

133 lines
3.9 KiB
QML
Raw Normal View History

2023-04-23 10:58:07 +00:00
import QtCore
import QtQuick
import QtQuick.Controls
2023-04-24 03:56:33 +00:00
import QtQuick.Controls.Basic
import QtQuick.Dialogs
2023-04-23 10:58:07 +00:00
import QtQuick.Layouts
import Qt.labs.folderlistmodel
2023-04-23 10:58:07 +00:00
import download
2023-06-22 19:44:49 +00:00
import modellist
2023-04-23 10:58:07 +00:00
import network
import llm
2023-06-27 15:54:34 +00:00
import mysettings
2023-04-23 10:58:07 +00:00
2023-07-06 14:53:43 +00:00
MyDialog {
2023-04-23 10:58:07 +00:00
id: settingsDialog
modal: true
padding: 20
onOpened: {
Network.sendSettingsDialog();
}
signal downloadClicked
property alias pageToDisplay: listView.currentIndex
2023-04-23 10:58:07 +00:00
Item {
Accessible.role: Accessible.Dialog
Accessible.name: qsTr("Settings")
Accessible.description: qsTr("Contains various application settings")
2023-04-23 10:58:07 +00:00
}
2023-04-25 17:00:28 +00:00
2023-06-30 13:50:09 +00:00
ListModel {
id: stacksModel
ListElement {
title: qsTr("Models")
2023-06-30 13:50:09 +00:00
}
ListElement {
title: qsTr("Application")
2023-06-30 13:50:09 +00:00
}
ListElement {
title: qsTr("LocalDocs")
2023-06-30 13:50:09 +00:00
}
}
Rectangle {
2023-06-30 13:50:09 +00:00
id: stackList
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 220
color: theme.controlBackground
radius: 10
2023-06-30 13:50:09 +00:00
ScrollView {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 10
ScrollBar.vertical.policy: ScrollBar.AsNeeded
clip: true
2023-06-30 13:50:09 +00:00
ListView {
id: listView
anchors.fill: parent
model: stacksModel
2023-06-30 13:50:09 +00:00
delegate: Rectangle {
id: item
width: listView.width
height: titleLabel.height + 10
color: "transparent"
2023-07-11 18:58:54 +00:00
MyButton {
id: titleLabel
backgroundColor: index === listView.currentIndex ? theme.buttonBackground : theme.controlBackground
backgroundColorHovered: index === listView.currentIndex ? backgroundColor : theme.containerBackground
borderColor: index === listView.currentIndex ? theme.yellowAccent : "transparent"
borderWidth: index === listView.currentIndex ? 1 : 0
textColor: index === listView.currentIndex ? theme.oppositeTextColor : theme.titleTextColor
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: 10
font.bold: index === listView.currentIndex
text: title
font.pixelSize: theme.fontSizeLarge
onClicked: {
listView.currentIndex = index
}
2023-06-30 13:50:09 +00:00
}
}
}
}
}
StackLayout {
id: stackLayout
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: stackList.right
anchors.right: parent.right
currentIndex: listView.currentIndex
MySettingsStack {
title: qsTr("Model/Character Settings")
2023-06-30 13:50:09 +00:00
tabs: [
Component { ModelSettings { } }
2023-06-30 13:50:09 +00:00
]
}
MySettingsStack {
title: qsTr("Application General Settings")
2023-06-30 13:50:09 +00:00
tabs: [
Component { ApplicationSettings { } }
]
}
MySettingsStack {
title: qsTr("Local Document Collections")
2023-06-30 13:50:09 +00:00
tabs: [
Component {
LocalDocsSettings {
id: localDocsSettings
Component.onCompleted: {
localDocsSettings.downloadClicked.connect(settingsDialog.downloadClicked);
}
}
}
2023-06-30 13:50:09 +00:00
]
}
2023-04-23 10:58:07 +00:00
}
}