Files
dms-chat/views/ChatPopoutWindow.qml
SalastilandClaude Sonnet 5 7f3a1d36cd Restructure QML into views/settings/forms, add popout IPC command
- Move the ~17 top-level QML files into views/, settings/, and forms/
  subdirectories, grouped so cross-directory type references stay minimal
  (only 3 files need an added `import` line). Root now only holds the
  four surfaces plugin.json points at directly.
- Add a `dms ipc call dankChat popout` IPC target to open the floating
  window directly, alongside the existing `toggle`, and document both in
  the README along with the new directory layout.
- Add one line of breathing room between the last message and the
  composer bar via the message ListView's bottomMargin (measured with
  FontMetrics rather than a guessed pixel value).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-08-09 23:41:07 -04:00

113 lines
3.2 KiB
QML

import QtQuick
import Quickshell
import qs.Common
import qs.Widgets
// Full resizable/movable window, modeled directly on dms-ai-assistant's
// AIAssistantPopoutWindow.qml - a real, proven precedent for this exact
// dock/undock interaction in DMS rather than inventing a new one.
FloatingWindow {
id: win
signal dockRequested
function show() { visible = true; }
function hide() { visible = false; }
function toggle() { visible = !visible; }
title: "Dank Chat"
minimumSize: Qt.size(480, 360)
implicitWidth: 720
implicitHeight: 480
color: Theme.surfaceContainer
visible: false
onClosed: win.visible = false
Item {
anchors.fill: parent
Item {
id: titleBar
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 44
z: 10
MouseArea {
anchors.fill: parent
onPressed: windowControls.tryStartMove()
onDoubleClicked: windowControls.tryToggleMaximize()
}
Rectangle {
anchors.fill: parent
color: Theme.surfaceContainerHigh
opacity: 0.5
}
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingS
DankIcon {
name: "chat"
size: Theme.iconSize - 2
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "Dank Chat"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankActionButton {
visible: windowControls.canMaximize
circular: false
iconName: win.maximized ? "fullscreen_exit" : "fullscreen"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: windowControls.tryToggleMaximize()
}
DankActionButton {
circular: false
iconName: "close"
iconSize: Theme.iconSize - 4
iconColor: Theme.surfaceText
onClicked: win.hide()
}
}
}
ChatView {
anchors.top: titleBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
inPopout: true
onHideRequested: win.hide()
onDockRequested: win.dockRequested()
}
}
FloatingWindowControls {
id: windowControls
targetWindow: win
}
}