mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-02-08 00:00:43 -05:00
feat: Add open in editor and remove from list (#267)
* refactor: Rename and move chat items * feat: Add hotkeys for open in editor and remove file from list * feat: Add opening by system * feat: Add context action menu
This commit is contained in:
@ -24,7 +24,8 @@ import QtQuick.Layouts
|
||||
import ChatView
|
||||
import UIControls
|
||||
import Qt.labs.platform as Platform
|
||||
import "./parts"
|
||||
|
||||
import "./chatparts"
|
||||
|
||||
ChatRootView {
|
||||
id: root
|
||||
@ -188,7 +189,7 @@ ChatRootView {
|
||||
Component {
|
||||
id: toolMessageComponent
|
||||
|
||||
ToolStatusItem {
|
||||
ToolBlock {
|
||||
id: toolsItem
|
||||
|
||||
width: parent.width
|
||||
@ -208,7 +209,7 @@ ChatRootView {
|
||||
Component {
|
||||
id: fileEditMessageComponent
|
||||
|
||||
FileEditItem {
|
||||
FileEditBlock {
|
||||
width: parent.width
|
||||
editContent: model.content
|
||||
|
||||
@ -233,7 +234,7 @@ ChatRootView {
|
||||
Component {
|
||||
id: thinkingMessageComponent
|
||||
|
||||
ThinkingStatusItem {
|
||||
ThinkingBlock {
|
||||
id: thinking
|
||||
|
||||
width: parent.width
|
||||
|
||||
@ -23,8 +23,6 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import UIControls
|
||||
|
||||
import "./dialog"
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
@ -40,19 +40,68 @@ Flow {
|
||||
Repeater {
|
||||
id: attachRepeater
|
||||
|
||||
delegate: Rectangle {
|
||||
delegate: FileItem {
|
||||
id: fileItem
|
||||
|
||||
required property int index
|
||||
required property string modelData
|
||||
|
||||
filePath: modelData
|
||||
|
||||
height: 30
|
||||
width: contentRow.width + 10
|
||||
radius: 4
|
||||
color: palette.button
|
||||
border.width: 1
|
||||
border.color: mouse.hovered ? palette.highlight : root.accentColor
|
||||
|
||||
HoverHandler {
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
color: palette.button
|
||||
border.width: 1
|
||||
border.color: mouse.containsMouse ? palette.highlight : root.accentColor
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
onClicked: (mouse) => {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
contextMenu.popup()
|
||||
} else if (mouse.button === Qt.MiddleButton ||
|
||||
(mouse.button === Qt.LeftButton && (mouse.modifiers & Qt.ControlModifier))) {
|
||||
root.removeFileFromListByIndex(fileItem.index)
|
||||
} else if (mouse.modifiers & Qt.ShiftModifier) {
|
||||
fileItem.openFileInExternalEditor()
|
||||
} else {
|
||||
fileItem.openFileInEditor()
|
||||
}
|
||||
}
|
||||
|
||||
ToolTip.visible: containsMouse
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: "Click: Open in Qt Creator\nShift+Click: Open in external editor\nCtrl+Click / Middle Click: Remove"
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: contextMenu
|
||||
|
||||
MenuItem {
|
||||
text: "Open in Qt Creator"
|
||||
onTriggered: fileItem.openFileInEditor()
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Open in External Editor"
|
||||
onTriggered: fileItem.openFileInExternalEditor()
|
||||
}
|
||||
|
||||
MenuSeparator {}
|
||||
|
||||
MenuItem {
|
||||
text: "Remove"
|
||||
onTriggered: root.removeFileFromListByIndex(fileItem.index)
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
Reference in New Issue
Block a user