diff --git a/CMakeLists.txt b/CMakeLists.txt index 209c377..cc1769e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.16) +list(APPEND CMAKE_PREFIX_PATH "/Users/palm1r/Qt/Qt Creator.app/Contents/Resources/lib/cmake/QtCreator") + project(QodeAssist) set(CMAKE_AUTOMOC ON) diff --git a/ChatView/qml/RootItem.qml b/ChatView/qml/RootItem.qml index 69a6f5f..16871a0 100644 --- a/ChatView/qml/RootItem.qml +++ b/ChatView/qml/RootItem.qml @@ -148,7 +148,9 @@ ChatRootView { QQC.TextArea { id: messageInput - placeholderText: qsTr("Type your message here...") + placeholderText: Qt.platform.os === "osx" + ? qsTr("Type your message here... (⌘+↩ to send)") + : qsTr("Type your message here... (Ctrl+Enter to send)") placeholderTextColor: palette.mid color: palette.text background: Rectangle { @@ -170,13 +172,6 @@ ChatRootView { } onTextChanged: root.calculateMessageTokensCount(messageInput.text) - - Keys.onPressed: function(event) { - if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && !(event.modifiers & Qt.ShiftModifier)) { - root.sendChatMessage() - event.accepted = true; - } - } } } @@ -210,7 +205,10 @@ ChatRootView { sendButton.onClicked: !root.isRequestInProgress ? root.sendChatMessage() : root.cancelRequest() - isRequestInProgress: root.isRequestInProgress + sendButton.icon.source: !root.isRequestInProgress ? "qrc:/qt/qml/ChatView/icons/chat-icon.svg" + : "qrc:/qt/qml/ChatView/icons/chat-pause-icon.svg" + sendButton.ToolTip.text: !root.isRequestInProgress ? qsTr("Send message to LLM %1").arg(Qt.platform.os === "osx" ? "Cmd+Return" : "Ctrl+Return") + : qsTr("Stop") syncOpenFiles { checked: root.isSyncOpenFiles onCheckedChanged: root.setIsSyncOpenFiles(bottomBar.syncOpenFiles.checked) @@ -220,6 +218,18 @@ ChatRootView { } } + Shortcut { + id: sendMessageShortcut + + sequence: "Ctrl+Return" + context: Qt.WindowShortcut + onActivated: { + if (messageInput.activeFocus && !Qt.inputMethod.visible) { + root.sendChatMessage() + } + } + } + function clearChat() { root.chatModel.clear() root.clearAttachmentFiles() diff --git a/ChatView/qml/parts/BottomBar.qml b/ChatView/qml/parts/BottomBar.qml index dc74141..f22f120 100644 --- a/ChatView/qml/parts/BottomBar.qml +++ b/ChatView/qml/parts/BottomBar.qml @@ -30,7 +30,6 @@ Rectangle { property alias attachFiles: attachFilesId property alias linkFiles: linkFilesId - property bool isRequestInProgress: false color: palette.window.hslLightness > 0.5 ? Qt.darker(palette.window, 1.1) : @@ -53,15 +52,11 @@ Rectangle { id: sendButtonId icon { - source: !root.isRequestInProgress ? "qrc:/qt/qml/ChatView/icons/chat-icon.svg" - : "qrc:/qt/qml/ChatView/icons/chat-pause-icon.svg" height: 15 width: 15 } ToolTip.visible: hovered ToolTip.delay: 250 - ToolTip.text: !root.isRequestInProgress ? qsTr("Send message to LLM") - : qsTr("Stop") } QoAButton { diff --git a/qodeassist.cpp b/qodeassist.cpp index 91491c0..f85ab8d 100644 --- a/qodeassist.cpp +++ b/qodeassist.cpp @@ -212,6 +212,9 @@ public: if (!m_chatView->isVisible()) { m_chatView->show(); } + + m_chatView->raise(); + m_chatView->requestActivate(); }); m_statusWidget->setChatButtonAction(showChatViewAction.contextAction());