additional new ui changes, part 4 (#2481)

Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
Jared Van Bortel
2024-06-28 17:11:12 -04:00
committed by GitHub
parent d893a6e5d6
commit f2cad6abaa
29 changed files with 184 additions and 117 deletions

View File

@@ -32,7 +32,7 @@ Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: 30
spacing: 50
spacing: 20
RowLayout {
Layout.fillWidth: true
@@ -61,10 +61,30 @@ Rectangle {
}
}
ColumnLayout {
Text {
id: addDocBanner
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
horizontalAlignment: Qt.AlignHCenter
text: qsTr("Add Document Collection")
font.pixelSize: theme.fontSizeBanner
color: theme.titleTextColor
}
Text {
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.maximumWidth: addDocBanner.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
text: qsTr("Add a folder containing plain text files, PDFs, or Markdown. Configure additional extensions in Settings.")
font.pixelSize: theme.fontSizeLarger
color: theme.titleInfoTextColor
}
GridLayout {
id: root
Layout.alignment: Qt.AlignTop | Qt.AlignCenter
spacing: 50
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
rowSpacing: 50
columnSpacing: 20
property alias collection: collection.text
property alias folder_path: folderEdit.text
@@ -80,17 +100,20 @@ Rectangle {
folderDialog.open();
}
Text {
horizontalAlignment: Qt.AlignHCenter
text: qsTr("New Local Doc\nCollection")
font.pixelSize: theme.fontSizeBanner
color: theme.titleTextColor
Label {
Layout.row: 2
Layout.column: 0
text: qsTr("Name")
font.bold: true
font.pixelSize: theme.fontSizeLarger
}
MyTextField {
id: collection
Layout.alignment: Qt.AlignCenter
Layout.row: 2
Layout.column: 1
Layout.minimumWidth: 400
Layout.alignment: Qt.AlignRight
horizontalAlignment: Text.AlignJustify
color: theme.textColor
font.pixelSize: theme.fontSizeLarge
@@ -109,10 +132,20 @@ Rectangle {
}
}
Label {
Layout.row: 3
Layout.column: 0
text: qsTr("Folder")
font.bold: true
font.pixelSize: theme.fontSizeLarger
}
RowLayout {
Layout.alignment: Qt.AlignCenter
Layout.row: 3
Layout.column: 1
Layout.minimumWidth: 400
Layout.maximumWidth: 400
Layout.alignment: Qt.AlignRight
spacing: 10
MyDirectoryField {
id: folderEdit
@@ -143,8 +176,9 @@ Rectangle {
}
MyButton {
Layout.alignment: Qt.AlignCenter
Layout.minimumWidth: 400
Layout.row: 4
Layout.column: 1
Layout.alignment: Qt.AlignRight
text: qsTr("Create Collection")
onClicked: {
var isError = false;

View File

@@ -46,7 +46,7 @@ Rectangle {
font.pixelSize: theme.fontSizeLarger
topPadding: 24
bottomPadding: 24
text: qsTr("\uFF0B New chat")
text: qsTr("\uFF0B New Chat")
Accessible.description: qsTr("Create a new chat")
onClicked: {
ChatListModel.addChat()

View File

@@ -503,7 +503,12 @@ Rectangle {
background: Rectangle {
radius: collectionsButton.backgroundRadius
color: collectionsButton.toggled ? collectionsButton.backgroundColorHovered : collectionsButton.backgroundColor
// TODO(jared): either use collectionsButton-specific theming, or don't - this is inconsistent
color: conversation.state == "expanded" ? (
collectionsButton.hovered ? theme.lightButtonBackgroundHovered : theme.lightButtonBackground
) : (
collectionsButton.hovered ? theme.lighterButtonBackground : theme.lighterButtonBackgroundHovered
)
}
Accessible.name: qsTr("Add documents")

View File

@@ -124,40 +124,6 @@ MySettingsTab {
}
}
RowLayout {
MySettingsLabel {
id: deviceLabel
text: qsTr("Embeddings Device")
helpText: qsTr('The compute device used for embeddings. "Auto" uses the CPU. Requires restart.')
}
MyComboBox {
id: deviceBox
enabled: !useNomicAPIBox.checked
Layout.minimumWidth: 400
Layout.maximumWidth: 400
Layout.fillWidth: false
Layout.alignment: Qt.AlignRight
model: MySettings.embeddingsDeviceList
Accessible.name: deviceLabel.text
Accessible.description: deviceLabel.helpText
function updateModel() {
deviceBox.currentIndex = deviceBox.indexOfValue(MySettings.localDocsEmbedDevice);
}
Component.onCompleted: {
deviceBox.updateModel();
}
Connections {
target: MySettings
function onDeviceChanged() {
deviceBox.updateModel();
}
}
onActivated: {
MySettings.localDocsEmbedDevice = deviceBox.currentText;
}
}
}
RowLayout {
MySettingsLabel {
id: apiKeyLabel
@@ -193,6 +159,40 @@ MySettingsTab {
}
}
RowLayout {
MySettingsLabel {
id: deviceLabel
text: qsTr("Embeddings Device")
helpText: qsTr('The compute device used for embeddings. "Auto" uses the CPU. Requires restart.')
}
MyComboBox {
id: deviceBox
enabled: !useNomicAPIBox.checked
Layout.minimumWidth: 400
Layout.maximumWidth: 400
Layout.fillWidth: false
Layout.alignment: Qt.AlignRight
model: MySettings.embeddingsDeviceList
Accessible.name: deviceLabel.text
Accessible.description: deviceLabel.helpText
function updateModel() {
deviceBox.currentIndex = deviceBox.indexOfValue(MySettings.localDocsEmbedDevice);
}
Component.onCompleted: {
deviceBox.updateModel();
}
Connections {
target: MySettings
function onDeviceChanged() {
deviceBox.updateModel();
}
}
onActivated: {
MySettings.localDocsEmbedDevice = deviceBox.currentText;
}
}
}
ColumnLayout {
spacing: 10
Label {

View File

@@ -68,7 +68,7 @@ Rectangle {
MyButton {
Layout.alignment: Qt.AlignTop | Qt.AlignRight
text: qsTr("\uFF0B Add Doc Collection")
text: qsTr("\uFF0B Add Collection")
onClicked: {
addCollectionViewRequested()
}
@@ -399,30 +399,35 @@ Rectangle {
RowLayout {
Layout.fillWidth: true
spacing: 30
Layout.leftMargin: 15
Layout.rightMargin: 15
Layout.topMargin: 15
MyTextButton {
MySettingsButton {
text: qsTr("Remove")
color: theme.red500
onClick: LocalDocs.removeFolder(collection, folder_path)
textColor: theme.red500
onClicked: LocalDocs.removeFolder(collection, folder_path)
backgroundColor: "transparent"
backgroundColorHovered: theme.lighterButtonBackgroundHoveredRed
}
Item {
Layout.fillWidth: true
}
MyTextButton {
MySettingsButton {
id: rebuildButton
visible: !model.forceIndexing && !model.indexing && model.currentEmbeddingsToIndex === 0
text: qsTr("Rebuild")
color: theme.green500
onClick: { LocalDocs.forceRebuildFolder(folder_path); }
tooltip: qsTr("Reindex this folder from scratch. This is slow and usually not needed.")
textColor: theme.green500
onClicked: LocalDocs.forceRebuildFolder(folder_path)
toolTip: qsTr("Reindex this folder from scratch. This is slow and usually not needed.")
backgroundColor: "transparent"
backgroundColorHovered: theme.lighterButtonBackgroundHovered
}
MyTextButton {
MySettingsButton {
id: updateButton
visible: model.forceIndexing
text: qsTr("Update")
color: theme.green500
onClick: { LocalDocs.forceIndexing(collection); }
tooltip: qsTr("Update the collection to the new version. This is a slow operation.")
textColor: theme.green500
onClicked: LocalDocs.forceIndexing(collection)
toolTip: qsTr("Update the collection to the new version. This is a slow operation.")
backgroundColor: "transparent"
backgroundColorHovered: theme.lighterButtonBackgroundHovered
}
}
}

View File

@@ -295,23 +295,12 @@ Rectangle {
color: theme.dividerColor
}
RowLayout {
Layout.fillWidth: true
spacing: 30
Layout.leftMargin: 15
Layout.topMargin: 15
Text {
text: qsTr("Remove")
elide: Text.ElideRight
color: theme.red500
font.bold: true
font.pixelSize: theme.fontSizeSmall
TapHandler {
onTapped: {
Download.removeModel(filename);
}
}
}
MySettingsButton {
text: qsTr("Remove")
textColor: theme.red500
onClicked: Download.removeModel(filename)
backgroundColor: "transparent"
backgroundColorHovered: theme.lighterButtonBackgroundHoveredRed
}
}
}

View File

@@ -9,13 +9,14 @@ Button {
padding: 10
rightPadding: 18
leftPadding: 18
property color textColor: theme.lightButtonText
property color mutedTextColor: theme.lightButtonMutedText
property color backgroundColor: theme.lightButtonBackground
property color backgroundColorHovered: enabled ? theme.lightButtonBackgroundHovered : backgroundColor
property real borderWidth: 0
property color borderColor: "transparent"
property real fontPixelSize: theme.fontSizeLarge
property color textColor: theme.lightButtonText
property color mutedTextColor: theme.lightButtonMutedText
property color backgroundColor: theme.lightButtonBackground
property color backgroundColorHovered: enabled ? theme.lightButtonBackgroundHovered : backgroundColor
property real borderWidth: 0
property color borderColor: "transparent"
property real fontPixelSize: theme.fontSizeLarge
property string toolTip
contentItem: Text {
text: myButton.text
@@ -34,5 +35,7 @@ Button {
}
Accessible.role: Accessible.Button
Accessible.name: text
ToolTip.text: toolTip
ToolTip.visible: toolTip !== "" && myButton.hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
}

View File

@@ -30,7 +30,7 @@ MyDialog {
anchors.left: parent.left
width: 60
height: 60
source: "qrc:/gpt4all/icons/logo.svg"
source: "qrc:/gpt4all/icons/gpt4all.svg"
}
Text {
anchors.left: img.right

View File

@@ -467,6 +467,17 @@ QtObject {
}
}
property color lighterButtonBackgroundHoveredRed: {
switch (MySettings.chatTheme) {
case "LegacyDark":
return buttonBackgroundHovered;
case "Dark":
return buttonBackgroundHovered;
default:
return red50;
}
}
property color sourcesBackground: {
switch (MySettings.chatTheme) {
case "LegacyDark":