mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Keyboard: Cleaned keyboard shortcuts dispatch
+ SetupWizard cleanup (NImageCached can NOT be invisible)
This commit is contained in:
@@ -42,6 +42,9 @@ Item {
|
||||
// Keyboard focus
|
||||
property bool exclusiveKeyboard: true
|
||||
|
||||
// Support close with escape
|
||||
property bool closeWithEscape: true
|
||||
|
||||
// Track if window has been created (for lazy loading)
|
||||
property bool windowCreated: false
|
||||
|
||||
@@ -192,6 +195,7 @@ Item {
|
||||
panelContent: root.panelContent
|
||||
panelWrapper: root // Pass reference to SmartPanel for keyboard handlers
|
||||
exclusiveKeyboard: root.exclusiveKeyboard
|
||||
closeWithEscape: root.closeWithEscape
|
||||
|
||||
// Forward signals
|
||||
onPanelOpened: root.opened()
|
||||
|
||||
@@ -27,6 +27,9 @@ PanelWindow {
|
||||
// Keyboard focus
|
||||
property bool exclusiveKeyboard: true
|
||||
|
||||
// Support close with escape
|
||||
property bool closeWithEscape: true
|
||||
|
||||
// Track whether panel is open
|
||||
property bool isPanelOpen: false
|
||||
|
||||
@@ -49,78 +52,8 @@ PanelWindow {
|
||||
signal panelOpened
|
||||
signal panelClosed
|
||||
|
||||
// Keyboard event handlers (forwarded from SmartPanel wrapper)
|
||||
function handleEscapePressed() {
|
||||
close()
|
||||
}
|
||||
function handleTabPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onTabPressed) {
|
||||
contentLoader.item.onTabPressed()
|
||||
}
|
||||
}
|
||||
function handleShiftTabPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onShiftTabPressed) {
|
||||
contentLoader.item.onShiftTabPressed()
|
||||
}
|
||||
}
|
||||
function handleUpPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onUpPressed) {
|
||||
contentLoader.item.onUpPressed()
|
||||
}
|
||||
}
|
||||
function handleDownPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onDownPressed) {
|
||||
contentLoader.item.onDownPressed()
|
||||
}
|
||||
}
|
||||
function handleLeftPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onLeftPressed) {
|
||||
contentLoader.item.onLeftPressed()
|
||||
}
|
||||
}
|
||||
function handleRightPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onRightPressed) {
|
||||
contentLoader.item.onRightPressed()
|
||||
}
|
||||
}
|
||||
function handleReturnPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onReturnPressed) {
|
||||
contentLoader.item.onReturnPressed()
|
||||
}
|
||||
}
|
||||
function handleHomePressed() {
|
||||
if (contentLoader.item && contentLoader.item.onHomePressed) {
|
||||
contentLoader.item.onHomePressed()
|
||||
}
|
||||
}
|
||||
function handleEndPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onEndPressed) {
|
||||
contentLoader.item.onEndPressed()
|
||||
}
|
||||
}
|
||||
function handlePageUpPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onPageUpPressed) {
|
||||
contentLoader.item.onPageUpPressed()
|
||||
}
|
||||
}
|
||||
function handlePageDownPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onPageDownPressed) {
|
||||
contentLoader.item.onPageDownPressed()
|
||||
}
|
||||
}
|
||||
function handleCtrlJPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onCtrlJPressed) {
|
||||
contentLoader.item.onCtrlJPressed()
|
||||
}
|
||||
}
|
||||
function handleCtrlKPressed() {
|
||||
if (contentLoader.item && contentLoader.item.onCtrlKPressed) {
|
||||
contentLoader.item.onCtrlKPressed()
|
||||
}
|
||||
}
|
||||
|
||||
// Window configuration
|
||||
color: "transparent"
|
||||
color: Color.transparent
|
||||
mask: null // No mask - content window is rectangular
|
||||
visible: isPanelOpen
|
||||
|
||||
@@ -239,19 +172,17 @@ PanelWindow {
|
||||
// Handle keyboard events directly via Keys handler
|
||||
Keys.onPressed: event => {
|
||||
Logger.d("SmartPanelWindow", "Key pressed:", event.key, "for panel:", placeholder.panelName)
|
||||
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
Logger.d("SmartPanelWindow", "Escape - closing panel")
|
||||
root.close()
|
||||
event.accepted = true
|
||||
panelWrapper.onEscapePressed()
|
||||
if (closeWithEscape) {
|
||||
root.close()
|
||||
event.accepted = true
|
||||
}
|
||||
} else if (panelWrapper) {
|
||||
// Forward to panelWrapper's onXXXPressed methods (defined in SmartPanel/Launcher)
|
||||
if (event.key === Qt.Key_Up && panelWrapper.onUpPressed) {
|
||||
Logger.d("SmartPanelWindow", "Up - forwarding to panelWrapper")
|
||||
panelWrapper.onUpPressed()
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Down && panelWrapper.onDownPressed) {
|
||||
Logger.d("SmartPanelWindow", "Down - forwarding to panelWrapper")
|
||||
panelWrapper.onDownPressed()
|
||||
event.accepted = true
|
||||
} else if (event.key === Qt.Key_Left && panelWrapper.onLeftPressed) {
|
||||
|
||||
@@ -41,6 +41,9 @@ SmartPanel {
|
||||
panelAnchorBottom: panelPosition.startsWith("bottom_")
|
||||
panelAnchorTop: panelPosition.startsWith("top_")
|
||||
|
||||
// SessionMenu handle it's own closing logic
|
||||
property bool closeWithEscape: false
|
||||
|
||||
// Timer properties
|
||||
readonly property int timerDuration: Settings.data.sessionMenu.countdownDuration
|
||||
property string pendingAction: ""
|
||||
@@ -209,8 +212,7 @@ SmartPanel {
|
||||
if (timerActive) {
|
||||
cancelTimer()
|
||||
} else {
|
||||
cancelTimer()
|
||||
close()
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ ColumnLayout {
|
||||
id: previewCached
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
maxCacheDimension: 512
|
||||
cacheFolder: Settings.cacheDirImagesWallpapers
|
||||
imagePath: selectedWallpaper !== "" ? "file://" + selectedWallpaper : ""
|
||||
visible: false // used as texture source for the shader
|
||||
@@ -237,46 +236,22 @@ ColumnLayout {
|
||||
Layout.preferredWidth: 120
|
||||
Layout.preferredHeight: 80
|
||||
color: Color.mSurface
|
||||
radius: Style.radiusM
|
||||
border.color: selectedWallpaper === modelData ? Color.mPrimary : Color.mOutline
|
||||
border.width: selectedWallpaper === modelData ? 2 : 1
|
||||
clip: true
|
||||
|
||||
// Cached thumbnail (used as shader source)
|
||||
// Cached thumbnail
|
||||
NImageCached {
|
||||
id: thumbCached
|
||||
anchors.fill: parent
|
||||
anchors.margins: 3
|
||||
maxCacheDimension: 256
|
||||
cacheFolder: Settings.cacheDirImagesWallpapers
|
||||
imagePath: "file://" + modelData
|
||||
visible: false
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 3
|
||||
property var source: ShaderEffectSource {
|
||||
sourceItem: thumbCached
|
||||
hideSource: true
|
||||
live: true
|
||||
recursive: false
|
||||
format: ShaderEffectSource.RGBA
|
||||
}
|
||||
property real itemWidth: width
|
||||
property real itemHeight: height
|
||||
property real cornerRadius: Style.radiusM - 3
|
||||
property real imageOpacity: 1.0
|
||||
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/rounded_image.frag.qsb")
|
||||
supportsAtlasTextures: false
|
||||
blending: true
|
||||
source: "file://" + modelData
|
||||
}
|
||||
|
||||
// Loading state
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Color.mSurfaceVariant
|
||||
radius: Style.radiusM
|
||||
visible: thumbCached.status === Image.Loading
|
||||
|
||||
NIcon {
|
||||
@@ -313,7 +288,6 @@ ColumnLayout {
|
||||
anchors.fill: parent
|
||||
color: Color.mPrimary
|
||||
opacity: hoverHandler.hovered ? 0.1 : 0
|
||||
radius: Style.radiusM
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Style.animationFast
|
||||
|
||||
@@ -4,8 +4,10 @@ import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Modules.MainScreen
|
||||
import qs.Services.System
|
||||
import qs.Services.UI
|
||||
import qs.Widgets
|
||||
|
||||
SmartPanel {
|
||||
id: root
|
||||
@@ -18,11 +20,15 @@ SmartPanel {
|
||||
panelAnchorHorizontalCenter: true
|
||||
panelAnchorVerticalCenter: true
|
||||
|
||||
closeWithEscape: false
|
||||
|
||||
property int currentStep: 0
|
||||
property int totalSteps: 5
|
||||
|
||||
// Override Escape handler to prevent closing the setup wizard
|
||||
function onEscapePressed() {// Do nothing - prevent ESC from closing the setup wizard
|
||||
onOpened: function () {
|
||||
selectedScaleRatio = Settings.data.general.scaleRatio
|
||||
selectedBarPosition = Settings.data.bar.position
|
||||
selectedWallpaperDirectory = Settings.data.wallpaper.directory || Settings.defaultWallpapersDirectory
|
||||
}
|
||||
|
||||
// Setup wizard data
|
||||
@@ -389,14 +395,4 @@ SmartPanel {
|
||||
Settings.data.general.scaleRatio = selectedScaleRatio
|
||||
Settings.data.bar.position = selectedBarPosition
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.i("SetupWizard", "Setup wizard opened")
|
||||
// Initialize selections from existing settings to avoid overwriting user config
|
||||
if (Settings && Settings.data) {
|
||||
selectedScaleRatio = Settings.data.general.scaleRatio
|
||||
selectedBarPosition = Settings.data.bar.position
|
||||
selectedWallpaperDirectory = Settings.data.wallpaper.directory || Settings.defaultWallpapersDirectory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +489,6 @@ SmartPanel {
|
||||
|
||||
NImageCached {
|
||||
id: img
|
||||
maxCacheDimension: 384
|
||||
imagePath: wallpaperPath
|
||||
cacheFolder: Settings.cacheDirImagesWallpapers
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -12,7 +12,7 @@ Image {
|
||||
property string imagePath: ""
|
||||
property string imageHash: ""
|
||||
property string cacheFolder: Settings.cacheDirImages
|
||||
property int maxCacheDimension: 512
|
||||
property int maxCacheDimension: 384
|
||||
readonly property string cachePath: imageHash ? `${cacheFolder}${imageHash}@${maxCacheDimension}x${maxCacheDimension}.png` : ""
|
||||
|
||||
asynchronous: true
|
||||
|
||||
Reference in New Issue
Block a user