mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-15 07:35:20 -04:00
feat(Notepad): Complete refactor - New popout mode & settings
- Add a full popout Notepad experience w/new layout settings - New ability to choose the left or right side of the screen - Add more safegaurds to preserve user data throughout - New banner to show file reload/conflict handling - New extensionless file support - Polish settings with gap controls, compact buttons, and shortcuts help
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.Notepad
|
||||
|
||||
FloatingWindow {
|
||||
id: win
|
||||
|
||||
property alias shouldBeVisible: win.visible
|
||||
|
||||
function show() {
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function hide() {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
title: I18n.tr("Notepad")
|
||||
minimumSize: Qt.size(360, 320)
|
||||
implicitWidth: 640
|
||||
implicitHeight: 760
|
||||
color: Theme.surfaceContainer
|
||||
visible: false
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
Qt.callLater(notepad.externalSync);
|
||||
} else {
|
||||
notepad.flushAutoSave();
|
||||
}
|
||||
}
|
||||
|
||||
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: "edit_note"
|
||||
size: Theme.iconSize - 2
|
||||
color: Theme.primary
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
text: I18n.tr("Notepad")
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Notepad {
|
||||
id: notepad
|
||||
anchors.top: titleBar.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.topMargin: Theme.spacingM
|
||||
anchors.leftMargin: Theme.spacingM
|
||||
anchors.rightMargin: Theme.spacingM
|
||||
anchors.bottomMargin: Theme.spacingM
|
||||
inPopout: true
|
||||
surfaceVisible: win.visible
|
||||
onHideRequested: win.hide()
|
||||
onDockRequested: {
|
||||
win.hide();
|
||||
PopoutService.openNotepadSlideout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FloatingWindowControls {
|
||||
id: windowControls
|
||||
targetWindow: win
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user