File Picker: Using platform's native picker - removed custom picker.

This commit is contained in:
ItsLemmy
2025-09-22 11:39:04 -04:00
parent f348eb993c
commit 8ece805273
7 changed files with 216 additions and 886 deletions
+11 -9
View File
@@ -30,7 +30,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignTop
}
NInputButton {
NTextInputButton {
label: `${Quickshell.env("USER") || "user"}'s profile picture`
description: "Your profile picture that appears throughout the interface."
text: Settings.data.general.avatarImage
@@ -39,18 +39,20 @@ ColumnLayout {
buttonTooltip: "Browse for avatar image"
onInputEditingFinished: Settings.data.general.avatarImage = text
onButtonClicked: {
FilePickerService.open({
"title": "Select Avatar Image",
"initialPath": Settings.data.general.avatarImage || Quickshell.env("HOME"),
"selectFiles": true,
"scaling": scaling,
"parent": root,
"onSelected": path => Settings.data.general.avatarImage = path
})
filePicker.open()
}
}
}
NFilePicker {
id: filePicker
pickerType: "file"
title: "Select avatar image"
initialPath: Settings.data.general.avatarImage.substr(0, Settings.data.general.avatarImage.lastIndexOf("/")) || Quickshell.env("HOME")
nameFilters: ["Image files (*.jpg *.jpeg *.png *.gif *.pnm *.bmp *.face)", "All files (*)"]
onAccepted: paths => Settings.data.general.avatarImage = paths[0]
}
NDivider {
Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling
@@ -1,6 +1,7 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import qs.Commons
import qs.Services
import qs.Widgets
@@ -20,24 +21,15 @@ ColumnLayout {
spacing: Style.marginS * scaling
Layout.fillWidth: true
NInputButton {
NTextInputButton {
label: "Output folder"
description: "Folder where screen recordings will be saved."
placeholderText: "/home/xxx/Videos"
placeholderText: Quickshell.env("HOME") + "/Videos"
text: Settings.data.screenRecorder.directory
buttonIcon: "folder-open"
buttonTooltip: "Browse for output folder"
onInputEditingFinished: Settings.data.screenRecorder.directory = text
onButtonClicked: {
FilePickerService.open({
"title": "Select Output Folder",
"initialPath": Settings.data.screenRecorder.directory || Quickshell.env("HOME") + "/Videos",
"selectFiles": false,
"scaling": scaling,
"parent": root,
"onSelected": path => Settings.data.screenRecorder.directory = path
})
}
onButtonClicked: folderPicker.open()
}
ColumnLayout {
@@ -261,4 +253,12 @@ ColumnLayout {
Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginXL * scaling
}
NFilePicker {
id: folderPicker
pickerType: "folder"
title: "Select output folder"
initialPath: Settings.data.screenRecorder.directory || Quickshell.env("HOME") + "/Videos"
onAccepted: paths => Settings.data.screenRecorder.directory = paths[0]
}
}
+20 -34
View File
@@ -11,6 +11,8 @@ ColumnLayout {
id: root
spacing: Style.marginL * scaling
property string specificFolderMonitorName: ""
NHeader {
label: "Wallpaper settings"
description: "Control how wallpapers are managed and displayed."
@@ -18,7 +20,7 @@ ColumnLayout {
NToggle {
label: "Enable wallpaper management"
description: "Manage wallpapers with Noctalia. (Uncheck if you prefer using another application)."
description: "Manage wallpapers with Noctalia. Uncheck if you prefer using another application."
checked: Settings.data.wallpaper.enabled
onToggled: checked => Settings.data.wallpaper.enabled = checked
Layout.bottomMargin: Style.marginL * scaling
@@ -29,7 +31,7 @@ ColumnLayout {
spacing: Style.marginL * scaling
Layout.fillWidth: true
NInputButton {
NTextInputButton {
id: wallpaperPathInput
label: "Wallpaper folder"
description: "Path to your main wallpaper folder."
@@ -37,13 +39,8 @@ ColumnLayout {
buttonIcon: "folder-open"
buttonTooltip: "Browse for wallpaper folder"
Layout.fillWidth: true
onInputEditingFinished: {
Settings.data.wallpaper.directory = text
}
onButtonClicked: {
openFileManager()
}
onInputEditingFinished: Settings.data.wallpaper.directory = text
onButtonClicked: mainFolderPicker.open()
}
// Monitor-specific directories
@@ -83,17 +80,15 @@ ColumnLayout {
font.pointSize: Style.fontSizeM * scaling
}
NInputButton {
NTextInputButton {
text: WallpaperService.getMonitorDirectory(modelData.name)
buttonIcon: "folder-open"
buttonTooltip: "Browse for wallpaper folder"
Layout.fillWidth: true
onInputEditingFinished: {
WallpaperService.setMonitorDirectory(modelData.name, text)
}
onInputEditingFinished: WallpaperService.setMonitorDirectory(modelData.name, text)
onButtonClicked: {
openMonitorFileManager(modelData.name)
specificFolderMonitorName = modelData.name
monitorFolderPicker.open()
}
}
}
@@ -343,26 +338,17 @@ ColumnLayout {
Layout.bottomMargin: Style.marginXL * scaling
}
// File manager functions
function openFileManager() {
FilePickerService.open({
"title": "Select Wallpaper Folder",
"initialPath": Settings.data.wallpaper.directory || Quickshell.env("HOME"),
"selectFiles": false,
"scaling": scaling,
"parent": root,
"onSelected": path => Settings.data.wallpaper.directory = path
})
NFilePicker {
id: mainFolderPicker
pickerType: "folder"
title: "Select wallpaper folder"
onAccepted: paths => Settings.data.wallpaper.directory = paths[0]
}
function openMonitorFileManager(monitorName) {
FilePickerService.open({
"title": "Select Monitor Wallpaper Folder",
"initialPath": WallpaperService.getMonitorDirectory(monitorName),
"selectFiles": false,
"scaling": scaling,
"parent": root,
"onSelected": path => WallpaperService.setMonitorDirectory(monitorName, path)
})
NFilePicker {
id: monitorFolderPicker
pickerType: "folder"
title: "Select monitor wallpaper folder"
onAccepted: paths => WallpaperService.setMonitorDirectory(specificFolderMonitorName, paths[0])
}
}