mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Make all the toolbuttons highlight on hover.
This commit is contained in:
parent
93a05c8834
commit
cae757aacd
@ -96,6 +96,7 @@ qt_add_qml_module(chat
|
|||||||
qml/MyTextField.qml
|
qml/MyTextField.qml
|
||||||
qml/MyCheckBox.qml
|
qml/MyCheckBox.qml
|
||||||
qml/MyBusyIndicator.qml
|
qml/MyBusyIndicator.qml
|
||||||
|
qml/MyToolButton.qml
|
||||||
RESOURCES
|
RESOURCES
|
||||||
icons/send_message.svg
|
icons/send_message.svg
|
||||||
icons/stop_generating.svg
|
icons/stop_generating.svg
|
||||||
|
@ -209,7 +209,7 @@ Window {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: bar1
|
id: bar1
|
||||||
color: theme.backgroundLightest
|
color: drawerButton.hovered ? theme.textColor : theme.backgroundLightest
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 6
|
height: 6
|
||||||
radius: 2
|
radius: 2
|
||||||
@ -219,7 +219,7 @@ Window {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: bar2
|
id: bar2
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: theme.backgroundLightest
|
color: drawerButton.hovered ? theme.textColor : theme.backgroundLightest
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 6
|
height: 6
|
||||||
radius: 2
|
radius: 2
|
||||||
@ -229,7 +229,7 @@ Window {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: bar3
|
id: bar3
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
color: theme.backgroundLightest
|
color: drawerButton.hovered ? theme.textColor : theme.backgroundLightest
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 6
|
height: 6
|
||||||
radius: 2
|
radius: 2
|
||||||
@ -253,7 +253,7 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
id: networkButton
|
id: networkButton
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -263,29 +263,12 @@ Window {
|
|||||||
height: 40
|
height: 40
|
||||||
z: 200
|
z: 200
|
||||||
padding: 15
|
padding: 15
|
||||||
|
checkable: true
|
||||||
Accessible.role: Accessible.Button
|
checked: Network.isActive
|
||||||
|
source: "qrc:/gpt4all/icons/network.svg"
|
||||||
Accessible.name: qsTr("Network button")
|
Accessible.name: qsTr("Network button")
|
||||||
Accessible.description: qsTr("Reveals a dialogue where you can opt-in for sharing data over network")
|
Accessible.description: qsTr("Reveals a dialogue where you can opt-in for sharing data over network")
|
||||||
|
|
||||||
background: Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
visible: Network.isActive
|
|
||||||
border.color: theme.backgroundLightest
|
|
||||||
border.width: 1
|
|
||||||
radius: 10
|
|
||||||
}
|
|
||||||
Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
source: "qrc:/gpt4all/icons/network.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (Network.isActive) {
|
if (Network.isActive) {
|
||||||
Network.isActive = false
|
Network.isActive = false
|
||||||
@ -307,7 +290,7 @@ Window {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
id: collectionsButton
|
id: collectionsButton
|
||||||
anchors.right: networkButton.left
|
anchors.right: networkButton.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -317,27 +300,9 @@ Window {
|
|||||||
height: 40
|
height: 40
|
||||||
z: 200
|
z: 200
|
||||||
padding: 15
|
padding: 15
|
||||||
|
checkable: true
|
||||||
background: Item {
|
checked: currentChat.collectionList.length
|
||||||
anchors.fill: parent
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
visible: currentChat.collectionList.length
|
|
||||||
border.color: theme.backgroundLightest
|
|
||||||
border.width: 1
|
|
||||||
radius: 10
|
|
||||||
}
|
|
||||||
Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
mipmap: true
|
|
||||||
width: 25
|
|
||||||
height: 25
|
|
||||||
source: "qrc:/gpt4all/icons/db.svg"
|
source: "qrc:/gpt4all/icons/db.svg"
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Add collections of documents to the chat")
|
Accessible.name: qsTr("Add collections of documents to the chat")
|
||||||
Accessible.description: qsTr("Provides a button to add collections of documents to the chat")
|
Accessible.description: qsTr("Provides a button to add collections of documents to the chat")
|
||||||
|
|
||||||
@ -346,7 +311,7 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
id: settingsButton
|
id: settingsButton
|
||||||
anchors.right: collectionsButton.left
|
anchors.right: collectionsButton.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -356,18 +321,7 @@ Window {
|
|||||||
height: 40
|
height: 40
|
||||||
z: 200
|
z: 200
|
||||||
padding: 15
|
padding: 15
|
||||||
|
|
||||||
background: Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
source: "qrc:/gpt4all/icons/settings.svg"
|
source: "qrc:/gpt4all/icons/settings.svg"
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Settings button")
|
Accessible.name: qsTr("Settings button")
|
||||||
Accessible.description: qsTr("Reveals a dialogue where you can change various settings")
|
Accessible.description: qsTr("Reveals a dialogue where you can change various settings")
|
||||||
|
|
||||||
@ -406,7 +360,7 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
id: copyButton
|
id: copyButton
|
||||||
anchors.right: settingsButton.left
|
anchors.right: settingsButton.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -416,21 +370,10 @@ Window {
|
|||||||
height: 40
|
height: 40
|
||||||
z: 200
|
z: 200
|
||||||
padding: 15
|
padding: 15
|
||||||
|
source: "qrc:/gpt4all/icons/copy.svg"
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Copy button")
|
Accessible.name: qsTr("Copy button")
|
||||||
Accessible.description: qsTr("Copy the conversation to the clipboard")
|
Accessible.description: qsTr("Copy the conversation to the clipboard")
|
||||||
|
|
||||||
background: Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
source: "qrc:/gpt4all/icons/copy.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextEdit{
|
TextEdit{
|
||||||
id: copyEdit
|
id: copyEdit
|
||||||
visible: false
|
visible: false
|
||||||
@ -482,7 +425,7 @@ Window {
|
|||||||
return str + "]}"
|
return str + "]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
id: resetContextButton
|
id: resetContextButton
|
||||||
anchors.right: copyButton.left
|
anchors.right: copyButton.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -492,21 +435,11 @@ Window {
|
|||||||
height: 40
|
height: 40
|
||||||
z: 200
|
z: 200
|
||||||
padding: 15
|
padding: 15
|
||||||
|
source: "qrc:/gpt4all/icons/regenerate.svg"
|
||||||
|
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: text
|
Accessible.name: text
|
||||||
Accessible.description: qsTr("Reset the context which erases current conversation")
|
Accessible.description: qsTr("Reset the context which erases current conversation")
|
||||||
|
|
||||||
background: Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
source: "qrc:/gpt4all/icons/regenerate.svg"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Network.sendResetContext(chatModel.count)
|
Network.sendResetContext(chatModel.count)
|
||||||
currentChat.reset();
|
currentChat.reset();
|
||||||
@ -712,16 +645,12 @@ Window {
|
|||||||
Item {
|
Item {
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
Button {
|
MyToolButton {
|
||||||
id: thumbsUp
|
id: thumbsUp
|
||||||
width: 30
|
width: 30
|
||||||
height: 30
|
height: 30
|
||||||
opacity: thumbsUpState || thumbsUpState == thumbsDownState ? 1.0 : 0.2
|
opacity: thumbsUpState || thumbsUpState == thumbsDownState ? 1.0 : 0.2
|
||||||
background: Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/gpt4all/icons/thumbs_up.svg"
|
source: "qrc:/gpt4all/icons/thumbs_up.svg"
|
||||||
}
|
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Thumbs up")
|
Accessible.name: qsTr("Thumbs up")
|
||||||
Accessible.description: qsTr("Gives a thumbs up to the response")
|
Accessible.description: qsTr("Gives a thumbs up to the response")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -735,7 +664,7 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
id: thumbsDown
|
id: thumbsDown
|
||||||
anchors.top: thumbsUp.top
|
anchors.top: thumbsUp.top
|
||||||
anchors.topMargin: 10
|
anchors.topMargin: 10
|
||||||
@ -753,11 +682,7 @@ Window {
|
|||||||
x: thumbsDown.width
|
x: thumbsDown.width
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
background: Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: "qrc:/gpt4all/icons/thumbs_down.svg"
|
source: "qrc:/gpt4all/icons/thumbs_down.svg"
|
||||||
}
|
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Thumbs down")
|
Accessible.name: qsTr("Thumbs down")
|
||||||
Accessible.description: qsTr("Opens thumbs down dialog")
|
Accessible.description: qsTr("Opens thumbs down dialog")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -919,20 +844,14 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
MyToolButton {
|
||||||
anchors.right: textInputView.right
|
anchors.right: textInputView.right
|
||||||
anchors.verticalCenter: textInputView.verticalCenter
|
anchors.verticalCenter: textInputView.verticalCenter
|
||||||
anchors.rightMargin: 15
|
anchors.rightMargin: 15
|
||||||
width: 30
|
width: 30
|
||||||
height: 30
|
height: 30
|
||||||
visible: !currentChat.isServer
|
visible: !currentChat.isServer
|
||||||
|
|
||||||
background: Image {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
source: "qrc:/gpt4all/icons/send_message.svg"
|
source: "qrc:/gpt4all/icons/send_message.svg"
|
||||||
}
|
|
||||||
|
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Send the message button")
|
Accessible.name: qsTr("Send the message button")
|
||||||
Accessible.description: qsTr("Sends the message/prompt contained in textfield to the model")
|
Accessible.description: qsTr("Sends the message/prompt contained in textfield to the model")
|
||||||
|
|
||||||
|
@ -141,41 +141,31 @@ Drawer {
|
|||||||
anchors.right: chatRectangle.right
|
anchors.right: chatRectangle.right
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
spacing: 10
|
spacing: 10
|
||||||
Button {
|
MyToolButton {
|
||||||
id: editButton
|
id: editButton
|
||||||
width: 30
|
width: 30
|
||||||
height: 30
|
height: 30
|
||||||
visible: isCurrent && !isServer
|
visible: isCurrent && !isServer
|
||||||
opacity: trashQuestionDisplayed ? 0.5 : 1.0
|
opacity: trashQuestionDisplayed ? 0.5 : 1.0
|
||||||
background: Image {
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
source: "qrc:/gpt4all/icons/edit.svg"
|
source: "qrc:/gpt4all/icons/edit.svg"
|
||||||
}
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
chatName.focus = true
|
chatName.focus = true
|
||||||
chatName.readOnly = false
|
chatName.readOnly = false
|
||||||
chatName.selectByMouse = true
|
chatName.selectByMouse = true
|
||||||
}
|
}
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Edit the chat name")
|
Accessible.name: qsTr("Edit the chat name")
|
||||||
Accessible.description: qsTr("Provides a button to edit the chat name")
|
Accessible.description: qsTr("Provides a button to edit the chat name")
|
||||||
}
|
}
|
||||||
Button {
|
MyToolButton {
|
||||||
id: trashButton
|
id: trashButton
|
||||||
width: 30
|
width: 30
|
||||||
height: 30
|
height: 30
|
||||||
visible: isCurrent && !isServer
|
visible: isCurrent && !isServer
|
||||||
background: Image {
|
|
||||||
width: 30
|
|
||||||
height: 30
|
|
||||||
source: "qrc:/gpt4all/icons/trash.svg"
|
source: "qrc:/gpt4all/icons/trash.svg"
|
||||||
}
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
trashQuestionDisplayed = true
|
trashQuestionDisplayed = true
|
||||||
timer.start()
|
timer.start()
|
||||||
}
|
}
|
||||||
Accessible.role: Accessible.Button
|
|
||||||
Accessible.name: qsTr("Delete of the chat")
|
Accessible.name: qsTr("Delete of the chat")
|
||||||
Accessible.description: qsTr("Provides a button to delete the chat")
|
Accessible.description: qsTr("Provides a button to delete the chat")
|
||||||
}
|
}
|
||||||
|
44
gpt4all-chat/qml/MyToolButton.qml
Normal file
44
gpt4all-chat/qml/MyToolButton.qml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import QtCore
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Basic
|
||||||
|
import Qt5Compat.GraphicalEffects
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: myButton
|
||||||
|
padding: 10
|
||||||
|
property alias source: image.source
|
||||||
|
contentItem: Text {
|
||||||
|
text: myButton.text
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: myButton.enabled ? theme.textColor : theme.mutedTextColor
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: text
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
visible: myButton.checkable && myButton.checked
|
||||||
|
border.color: theme.backgroundLightest
|
||||||
|
border.width: 1
|
||||||
|
radius: 10
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
id: image
|
||||||
|
anchors.centerIn: parent
|
||||||
|
mipmap: true
|
||||||
|
width: 30
|
||||||
|
height: 30
|
||||||
|
}
|
||||||
|
ColorOverlay {
|
||||||
|
anchors.fill: image
|
||||||
|
source: image
|
||||||
|
color: myButton.hovered ? theme.textColor : "transparent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: text
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user