mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-06 13:38:28 -04:00
feat(settings): implement greeter & lockscreen customization options
- New option to customize your font & wallpaper on the LockScreen - New floating sync button if missed to explicitly sync on greeter changes
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
|
||||
SettingsDropdownRow {
|
||||
id: root
|
||||
|
||||
property string currentFont: ""
|
||||
signal fontSelected(string family)
|
||||
|
||||
property var _families: ["Default"]
|
||||
property bool _enumerated: false
|
||||
|
||||
function _enumerate() {
|
||||
if (_enumerated)
|
||||
return;
|
||||
var fonts = Qt.fontFamilies().filter(f => !f.startsWith("."));
|
||||
fonts.sort();
|
||||
fonts.unshift("Default");
|
||||
_families = fonts;
|
||||
_enumerated = true;
|
||||
}
|
||||
|
||||
enableFuzzySearch: true
|
||||
popupWidthOffset: 100
|
||||
maxPopupHeight: 400
|
||||
options: _families
|
||||
currentValue: (root.currentFont === "" || root.currentFont === Theme.defaultFontFamily) ? "Default" : root.currentFont
|
||||
onValueChanged: value => root.fontSelected(value === "Default" ? "" : value)
|
||||
|
||||
Component.onCompleted: Qt.callLater(_enumerate)
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
import qs.Modals.FileBrowser
|
||||
import qs.Widgets
|
||||
|
||||
Column {
|
||||
id: root
|
||||
|
||||
property string path: ""
|
||||
property string fillMode: ""
|
||||
property string fallbackFillMode: "Fill"
|
||||
property string browserTitle: I18n.tr("Select background image")
|
||||
property string placeholderText: I18n.tr("Use desktop wallpaper")
|
||||
property string fillModeSettingKey: ""
|
||||
property var fillModeTags: []
|
||||
|
||||
signal pathSelected(string path)
|
||||
signal fillModeSelected(string mode)
|
||||
|
||||
readonly property var _fillModes: ["Stretch", "Fit", "Fill", "Tile", "TileVertically", "TileHorizontally", "Pad"]
|
||||
|
||||
spacing: Theme.spacingS
|
||||
|
||||
FileBrowserModal {
|
||||
id: wallpaperBrowserModal
|
||||
browserTitle: root.browserTitle
|
||||
browserIcon: "wallpaper"
|
||||
browserType: "wallpaper"
|
||||
showHiddenFiles: true
|
||||
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp", "*.jxl", "*.avif", "*.heif"]
|
||||
onFileSelected: path => {
|
||||
root.pathSelected(path);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
|
||||
DankTextField {
|
||||
id: wallpaperPathField
|
||||
width: parent.width - browseWallpaperButton.width - Theme.spacingS
|
||||
placeholderText: root.placeholderText
|
||||
text: root.path
|
||||
backgroundColor: Theme.surfaceContainerHighest
|
||||
onTextChanged: {
|
||||
if (text !== root.path)
|
||||
root.pathSelected(text);
|
||||
}
|
||||
}
|
||||
|
||||
DankButton {
|
||||
id: browseWallpaperButton
|
||||
text: I18n.tr("Browse")
|
||||
horizontalPadding: Theme.spacingL
|
||||
onClicked: wallpaperBrowserModal.open()
|
||||
}
|
||||
}
|
||||
|
||||
SettingsDropdownRow {
|
||||
settingKey: root.fillModeSettingKey
|
||||
tags: root.fillModeTags
|
||||
text: I18n.tr("Wallpaper fill mode")
|
||||
description: I18n.tr("How the background image is scaled")
|
||||
options: root._fillModes.map(m => I18n.tr(m, "wallpaper fill mode"))
|
||||
currentValue: {
|
||||
var mode = (root.fillMode && root.fillMode !== "") ? root.fillMode : root.fallbackFillMode;
|
||||
var idx = root._fillModes.indexOf(mode);
|
||||
return idx >= 0 ? I18n.tr(root._fillModes[idx], "wallpaper fill mode") : I18n.tr("Fill", "wallpaper fill mode");
|
||||
}
|
||||
onValueChanged: value => {
|
||||
var idx = root._fillModes.map(m => I18n.tr(m, "wallpaper fill mode")).indexOf(value);
|
||||
if (idx >= 0)
|
||||
root.fillModeSelected(root._fillModes[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user