From 14e7ea2ec31ce2e248ef7b78f0c7a5a4cb0546b1 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Mon, 8 Dec 2025 10:18:12 +0100 Subject: [PATCH] feat: Add separator to chat top bar --- ChatView/qml/controls/TopBar.qml | 44 +++++++++++++++++++------------- UIControls/CMakeLists.txt | 1 + UIControls/qml/QoAComboBox.qml | 15 ++++++----- UIControls/qml/QoASeparator.qml | 28 ++++++++++++++++++++ 4 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 UIControls/qml/QoASeparator.qml diff --git a/ChatView/qml/controls/TopBar.qml b/ChatView/qml/controls/TopBar.qml index 440da1d..ae96876 100644 --- a/ChatView/qml/controls/TopBar.qml +++ b/ChatView/qml/controls/TopBar.qml @@ -91,7 +91,7 @@ Rectangle { ToolTip.visible: hovered ToolTip.delay: 250 - ToolTip.text: qsTr("Switch AI configuration") + ToolTip.text: qsTr("Switch saved AI configuration") } QoAComboBox { @@ -174,6 +174,10 @@ Rectangle { ToolTip.delay: 250 ToolTip.text: qsTr("Open Chat Assistant Settings") } + + QoASeparator { + anchors.verticalCenter: parent.verticalCenter + } } Item { @@ -235,18 +239,20 @@ Rectangle { } QoAButton { - id: clearButtonId + id: openChatHistoryId icon { - source: "qrc:/qt/qml/ChatView/icons/clean-icon-dark.svg" + source: "qrc:/qt/qml/ChatView/icons/file-in-system.svg" height: 15 - width: 8 + width: 15 } ToolTip.visible: hovered ToolTip.delay: 250 - ToolTip.text: qsTr("Clean chat") + ToolTip.text: qsTr("Show in system") } + QoASeparator {} + QoAButton { id: compressButtonId @@ -292,19 +298,6 @@ Rectangle { } } - QoAButton { - id: openChatHistoryId - - icon { - source: "qrc:/qt/qml/ChatView/icons/file-in-system.svg" - height: 15 - width: 15 - } - ToolTip.visible: hovered - ToolTip.delay: 250 - ToolTip.text: qsTr("Show in system") - } - QoAButton { id: contextButtonId @@ -327,6 +320,21 @@ Rectangle { ToolTip.delay: 250 ToolTip.text: qsTr("Current amount tokens in chat and LLM limit threshold") } + + QoASeparator {} + + QoAButton { + id: clearButtonId + + icon { + source: "qrc:/qt/qml/ChatView/icons/clean-icon-dark.svg" + height: 15 + width: 8 + } + ToolTip.visible: hovered + ToolTip.delay: 250 + ToolTip.text: qsTr("Clean chat") + } } } } diff --git a/UIControls/CMakeLists.txt b/UIControls/CMakeLists.txt index 83c773f..7d38401 100644 --- a/UIControls/CMakeLists.txt +++ b/UIControls/CMakeLists.txt @@ -17,6 +17,7 @@ qt_add_qml_module(QodeAssistUIControls RESOURCES icons/dropdown-arrow-light.svg icons/dropdown-arrow-dark.svg + QML_FILES qml/QoASeparator.qml ) target_link_libraries(QodeAssistUIControls diff --git a/UIControls/qml/QoAComboBox.qml b/UIControls/qml/QoAComboBox.qml index e363a02..667f026 100644 --- a/UIControls/qml/QoAComboBox.qml +++ b/UIControls/qml/QoAComboBox.qml @@ -24,15 +24,10 @@ import QtQuick.Controls.Basic as Basic Basic.ComboBox { id: control - implicitWidth: Math.min(contentItem.implicitWidth + 8, 300) - implicitHeight: 30 - property real popupContentWidth: 100 - TextMetrics { - id: textMetrics - font.pixelSize: 12 - } + implicitWidth: Math.min(contentItem.implicitWidth + 8, 300) + implicitHeight: 30 function updatePopupWidth() { var maxWidth = 100; @@ -47,6 +42,7 @@ Basic.ComboBox { onModelChanged: updatePopupWidth() Component.onCompleted: updatePopupWidth() + clip: true indicator: Image { id: dropdownIcon @@ -178,5 +174,10 @@ Basic.ComboBox { } } } + + TextMetrics { + id: textMetrics + font.pixelSize: 12 + } } diff --git a/UIControls/qml/QoASeparator.qml b/UIControls/qml/QoASeparator.qml new file mode 100644 index 0000000..da12d94 --- /dev/null +++ b/UIControls/qml/QoASeparator.qml @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2025 Petr Mironychev + * + * This file is part of QodeAssist. + * + * QodeAssist is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * QodeAssist is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with QodeAssist. If not, see . + */ + +import QtQuick + +Rectangle { + id: root + + height: 15 + width: 1 + color: palette.mid +}