From 31fa575c35874e39faa2f30739e2ee63943e72f3 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Wed, 26 Jun 2024 16:43:11 -0400 Subject: [PATCH] Place the antenna icon in the lower left right above nomic logo as per discussion. Signed-off-by: Adam Treat --- gpt4all-chat/main.qml | 93 +++++++++++++++++++++++++++++++++++ gpt4all-chat/qml/ChatView.qml | 88 --------------------------------- 2 files changed, 93 insertions(+), 88 deletions(-) diff --git a/gpt4all-chat/main.qml b/gpt4all-chat/main.qml index 6d7fdafb..397f90ef 100644 --- a/gpt4all-chat/main.qml +++ b/gpt4all-chat/main.qml @@ -63,6 +63,7 @@ Window { property bool hasCheckedFirstStart: false property bool hasShownSettingsAccess: false + property var currentChat: ChatListModel.currentChat function startupDialogs() { if (!LLM.compatHardware()) { @@ -396,6 +397,98 @@ Window { Layout.margins: 0 spacing: 22 + Item { + id: antennaItem + Layout.alignment: Qt.AlignCenter + Layout.preferredWidth: antennaImage.width + Layout.preferredHeight: antennaImage.height + Image { + id: antennaImage + sourceSize.width: 32 + sourceSize.height: 32 + visible: false + fillMode: Image.PreserveAspectFit + source: "qrc:/gpt4all/icons/antenna_3.svg" + } + + ColorOverlay { + id: antennaColored + visible: ModelList.installedModels.count !== 0 && (currentChat.isServer || currentChat.modelInfo.isOnline || MySettings.networkIsActive) + anchors.fill: antennaImage + source: antennaImage + color: theme.styledTextColor + ToolTip.text: { + if (MySettings.networkIsActive) + return qsTr("The datalake is enabled") + else if (currentChat.modelInfo.isOnline) + return qsTr("Using a network model") + else if (currentChat.modelInfo.isOnline) + return qsTr("Server mode is enabled") + return "" + } + ToolTip.visible: maAntenna.containsMouse + ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval + MouseArea { + id: maAntenna + anchors.fill: antennaColored + hoverEnabled: true + } + } + + SequentialAnimation { + running: true + loops: Animation.Infinite + + PropertyAnimation { + target: antennaImage + property: "source" + duration: 500 + from: "qrc:/gpt4all/icons/antenna_1.svg" + to: "qrc:/gpt4all/icons/antenna_2.svg" + } + + PauseAnimation { + duration: 1500 + } + + PropertyAnimation { + target: antennaImage + property: "source" + duration: 500 + from: "qrc:/gpt4all/icons/antenna_2.svg" + to: "qrc:/gpt4all/icons/antenna_3.svg" + } + + PauseAnimation { + duration: 1500 + } + + PropertyAnimation { + target: antennaImage + property: "source" + duration: 500 + from: "qrc:/gpt4all/icons/antenna_3.svg" + to: "qrc:/gpt4all/icons/antenna_2.svg" + } + + PauseAnimation { + duration: 1500 + } + + PropertyAnimation { + target: antennaImage + property: "source" + duration: 1500 + from: "qrc:/gpt4all/icons/antenna_2.svg" + to: "qrc:/gpt4all/icons/antenna_1.svg" + } + + PauseAnimation { + duration: 500 + } + } + } + Rectangle { Layout.alignment: Qt.AlignCenter Layout.preferredWidth: image.width diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index 677cedc6..79dfeeab 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -1420,94 +1420,6 @@ Rectangle { } } - Image { - id: antennaImage - anchors.right: sendButton.left - anchors.verticalCenter: textInputView.verticalCenter - anchors.rightMargin: 15 - sourceSize.width: 32 - sourceSize.height: 32 - visible: false - fillMode: Image.PreserveAspectFit - source: "qrc:/gpt4all/icons/antenna_3.svg" - } - - ColorOverlay { - id: antennaColored - visible: ModelList.installedModels.count !== 0 && (currentChat.isServer || currentChat.modelInfo.isOnline || MySettings.networkIsActive) - anchors.fill: antennaImage - source: antennaImage - color: theme.styledTextColor - ToolTip.text: { - if (MySettings.networkIsActive) - return qsTr("The datalake is enabled") - else if (currentChat.modelInfo.isOnline) - return qsTr("Using a network model") - else if (currentChat.modelInfo.isOnline) - return qsTr("Server mode is enabled") - } - ToolTip.visible: maAntenna.containsMouse - ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval - MouseArea { - id: maAntenna - anchors.fill: antennaColored - hoverEnabled: true - } - } - - SequentialAnimation { - running: true - loops: Animation.Infinite - - PropertyAnimation { - target: antennaImage - property: "source" - duration: 500 - from: "qrc:/gpt4all/icons/antenna_1.svg" - to: "qrc:/gpt4all/icons/antenna_2.svg" - } - - PauseAnimation { - duration: 1500 - } - - PropertyAnimation { - target: antennaImage - property: "source" - duration: 500 - from: "qrc:/gpt4all/icons/antenna_2.svg" - to: "qrc:/gpt4all/icons/antenna_3.svg" - } - - PauseAnimation { - duration: 1500 - } - - PropertyAnimation { - target: antennaImage - property: "source" - duration: 500 - from: "qrc:/gpt4all/icons/antenna_3.svg" - to: "qrc:/gpt4all/icons/antenna_2.svg" - } - - PauseAnimation { - duration: 1500 - } - - PropertyAnimation { - target: antennaImage - property: "source" - duration: 1500 - from: "qrc:/gpt4all/icons/antenna_2.svg" - to: "qrc:/gpt4all/icons/antenna_1.svg" - } - - PauseAnimation { - duration: 500 - } - } - MyToolButton { id: sendButton backgroundColor: theme.sendButtonBackground